the_mechanic/app/Views/business_list.php
2024-09-25 09:12:05 +05:30

126 lines
5.8 KiB
PHP
Executable File

<?php include('layout/header.php'); ?>
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Business List</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class=""> <a href="<?= base_url() . "new_business/0"; ?>" class="btn btn-primary waves-effect">Add Business</a>
</li>
</ol>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<!-- <h4 class="header-title">Business List</h4> -->
<table id="datatable-buttons-2" class="table table-striped dt-responsive nowrap w-100"
style="width:100% !important;">
<thead>
<tr>
<th>#</th>
<th>Business Name</th>
<!-- <th>Email</th> -->
<!-- <th>Mobile</th> -->
<!-- <th style="width:10% !important">Address</th> -->
<!-- <th>City</th> -->
<!-- <th>State</th> -->
<!-- <th>Postal Code</th> -->
<!-- <th>Country</th> -->
<th>Branch List</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($business as $value) :
if ($value['isactive'] == 1) : ?>
<tr>
<td><?= $value['business_id']; ?></td>
<td><?= $value['business_name']; ?></td>
<?php if(isset($value['email'])) { ?><td><?= $value['email']; ?></td> <?php } ?>
<?php if(isset($value['email'])) { ?><td><?= $value['mobile']; ?></td><?php } ?>
<?php if(isset($value['email'])) { ?><td ><?= $value['address']; ?></td> <?php } ?>
<?php if(isset($value['email'])) { ?><td><?= $value['city']; ?></td><?php } ?>
<?php if(isset($value['email'])) { ?><td><?= $value['state']; ?></td><?php } ?>
<?php if(isset($value['email'])) { ?><td><?= $value['postal_code']; ?></td><?php } ?>
<?php if(isset($value['email'])) { ?><td><?= $value['country']; ?></td><?php } ?>
<!-- Call the model method -->
<td> <a href="<?= base_url("branch_index/" . $value['business_id']) ?>" style="margin-left: 20px;">View</a></td>
<td>
<a href="<?= "new_business/" . $value['business_id']; ?>" class="edit-button" style="margin-right: 5px;"><i
class="ri-pencil-line"></i></a>
<a href="<?= "delete_business/" . $value['business_id']; ?>"
class="delete-button"><i class="ri-delete-bin-line"></i></a>
</td>
<?php endif?>
<?php endforeach; ?>
</tr>
</tbody>
</table>
</div> <!-- end table-responsive-->
</div>
</div> <!-- end card -->
</div> <!-- end col -->
</div>
<?php include('layout/footer.php'); ?>
<script>
$(document).ready(function() {
$('#datatable-buttons-2').DataTable({
"order": [[2, 'desc']], // Set initial sorting to descending on the first column
"dom": 'Bfrtip', // Show export buttons
"buttons": [ {
extend: 'pdfHtml5',
title: 'Business', // Set your custom PDF title here
text: 'PDF',
customize: function(doc) {
// You can further customize the PDF here if needed
// doc.content[1].table.body.forEach(function(row) {
// row.splice(0, 1); // Remove the first column (ID column)
// });
}
},
{
extend: 'print',
title: 'Business', // Set your custom print title here
text: 'Print',
customize: function(win) {
// You can further customize the print output here if needed
// $(win.document.body).find('table').find('th:first-child, td:first-child').remove();
}
},
{
extend: 'copy',
text: 'Copy', // Set the title for the Copy button
titleAttr: 'Copy', // Set the tooltip for the Copy button
exportOptions: {
// columns: ':not(:first-child)' // Exclude the first column (ID column)
}
},
{
extend: 'csv',
text: 'CSV', // Set the title for the CSV button
title: 'Business', // Set your custom print title here
exportOptions: {
// columns: ':not(:first-child)' // Exclude the first column (ID column)
}
}], // Enable export options
"language": {
"search": "Search: " // Customize search label
},
"ordering": false
});
});
</script>