BBnepal-Accounts/account/application/views/setup/listitems.php
Sampanna Rimal 9cd05ef3cb commitall
2024-07-10 18:28:19 +05:45

73 lines
3.4 KiB
PHP

<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0"><?php echo $pageTitle; ?> <?php showCreateButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/add","Create New ".$pageTitle); ?></h5>
</div>
<div class="card-body">
<?php $ItemCategories = $this->MItems->getItemCategories(); ?>
<form method="GET" action="">
<div class="form-group form-row">
<label for="item_category" class="col-2">Filter Items by Category</label>
<select name="item_category" id="item_category" class="col-6 form-control">
<option value="">Displaying All</option>
<?php foreach ($ItemCategories as $ItemCategory) : ?>
<option value="<?php echo $ItemCategory->category_alias; ?>" <?php if (isset($_GET['item_category'])) {
if ($_GET['item_category'] == $ItemCategory->category_alias) echo "SELECTED";
} ?>><?php echo $ItemCategory->category_name; ?></option>
<?php endforeach; ?>
</select>
</div>
<input type="submit" class="col-2 btn btn-success form-control" value='Filter' />
</div>
</form>
<?php $LoggedUser = $this->session->userdata('loggedInUser'); ?>
<table class="table table-bordered table-striped dataTable">
<thead>
<tr>
<th>Sn</th>
<th>Category</th>
<th>Item Name</th>
<th>Desc</th>
<th>Units</th>
<th class="table-col col-2">Action</th>
</tr>
</thead>
<tbody>
<?php $a = 0;
foreach ($TableData as $TableRow) : $a++; ?>
<?php foreach ($TableRow as $cols) : $id = $cols;
break;
endforeach; ?><tr>
<td><?php echo $a; ?></td>
<td><?php echo $TableRow->Category->category_name; ?></td>
<td><?php echo $TableRow->item_name; ?></td>
<td><?php echo $TableRow->item_desc; ?></td>
<td><?php echo $TableRow->item_units; ?></td>
<td><?php if ($LoggedUser == "admin") : ?><?php showEditButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/edit/$id"); ?>
<?php showDeleteButton($id); ?><?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
<tbody>
</table>
<?php //pre($TableData);
?>
<script>
function doDelete(id) {
if (confirm('Are you sure to delete?')) {
window.location = '<?php echo site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/delete/"); ?>' + id;
}
}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>