crm-summit/app/Views/productcatalog_index.php

137 lines
4.9 KiB
PHP
Raw Normal View History

2024-04-24 13:20:52 +07:00
<?= $this->extend('layouts/main.php') ?>
<?= $this->section('content') ?>
<?php
if(!isset($productname)) {$productname = '';}
if(!isset($catalognumber)) {$catalognumber = '';}
if(!isset($qproducttypeid)) { $producttypeid = ''; }
?>
<div class="page-wrapper">
<div class="container-fluid">
<div class="row page-titles">
<div class="col-md-5 align-self-center">
<h4 class="text-themecolor">Product Catalog</h4>
</div>
<div class="col-md-7 align-self-center text-end">
<a class='btn btn-info text-white btn-sm' href='productcatalog/create/'
onclick="window.open(this.href, 'Create Product Catalog','width=900,height=600,toolbar=1,resizable=0'); return false;">
<i class="fas fa-plus-circle"></i> Create
</a>
</div>
</div>
<?php
if(isset($validation)) {
?>
<div class='alert alert-danger alert-dismissible'>
<?= $validation->listErrors(); ?>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"> <span aria-hidden="true"></span> </button>
</div>
<?php
}
?>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<form method='post' >
2024-04-24 13:20:52 +07:00
<div class='form-group row'>
<label class='form-label col-2'>Product type</label>
<div class='col-10'>
<select class='form-control form-select form-select-sm' name='producttypeid' placeholder='product type'>
<option value=''></option>
<?php
foreach($producttype as $data){
$qproducttypeid = $data['producttypeid'];
$qtexts = $data['texts'];
if($producttypeid == $qproducttypeid) { echo "<option value='$qproducttypeid' selected>$qtexts</option>"; }
else { echo "<option value='$qproducttypeid'>$qtexts</option>"; }
}
?>
</select>
</div>
</div>
<div class='form-group row'>
<label class='form-label col-2'>Catalog#</label>
<div class='col-10'>
<input class='form-control' type='text' name='catalognumber' placeholder='catalog#' value='<?=$catalognumber;?>' />
</div>
</div>
<div class='form-group row'>
<label class='form-label col-2'>Product Name</label>
<div class='col-10'>
<input class='form-control' type='text' name='productname' placeholder='product name' value='<?=$productname;?>' />
</div>
</div>
<button type="submit" class="btn btn-success text-white"> <i class="fa fa-search"></i> Search</button>
</form>
</div>
</div>
</div>
</div>
<?php if(isset($productcatalog)) {?>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="table-responsive">
<table id="myTable" class="table display table-striped border">
<thead>
<th>ID</th> <th>Catalog#</th> <th>Product Name</th> <th>Vendor Name</th> <th>Create Date</th> <th></th>
</thead>
<tbody>
<?php
foreach($productcatalog as $data) {
$catalogid = $data['catalogid'];
$catalognumber = $data['catalognumber'];
$productname = $data['productname'];
$vendorname = $data['vendorname'];
$toggletext = "<a class='btn btn-danger btn-sm crm-confirmation' href='productcatalog/toggle/$catalogid'> <i class='fas fa-trash-alt'></i> Disable </a>";
if( $data['createdate'] != '' ) {
$createdate = date('d-m-Y', strtotime($data['createdate']));
} else { $createdate = ''; }
if ($data['enddate'] != '' ) {
$productname = "<del>$productname</del>";
$toggletext = "<a class='btn btn-success btn-sm crm-confirmation' href='productcatalog/toggle/$catalogid'> <i class='fas fa-check'></i> Enable </a>";
}
?>
<tr>
<td><?=$catalogid;?></td> <td><?=$catalognumber;?></td> <td><?=$productname;?></td> <td><?=$vendorname;?></td> <td><?=$createdate;?></td>
<td>
<a class='btn btn-warning btn-sm' href='productcatalog/edit/<?=$catalogid;?>'
onclick="window.open(this.href, 'Catalog Editor','width=900,height=600,toolbar=1,resizable=0'); return false;">
<i class="fas fa-pencil-alt"></i> Edit
</a>
<?//=$toggletext;?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<!-- edit Modal -->
<div id="editModal" class="modal" tabindex="-1" role="dialog" aria-labelledby="tooltipmodel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-xl">
<div class="modal-content">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
<?= $this->endSection() ?>
<?= $this->section('script') ?>
<script>
$(function () {
$('#myTable').DataTable({
"order" : []
});
});
</script>
<?= $this->endSection() ?>