vb_book/app/Views/template_creation.php
2024-10-29 15:37:48 +05:30

88 lines
4.8 KiB
PHP
Executable File

<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="float-right">
<a href="<?= base_url()."template_creation_form/0"; ?>" class="btn btn-primary"><i class="ri-file-edit-line"></i> Add Template </a>
</div><!-- end col-->
<br>
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
<?php if (session()->getFlashdata('success') || session()->getFlashdata('error')) : ?>
<?php if (session()->getFlashdata('success')) : ?>
<div class="alert alert-success alert-dismissible fade show" role="alert">
<?= session('success') ?>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php endif; ?>
<?php if (session()->getFlashdata('error')) : ?>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<?= session('error') ?>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php endif; ?>
<?php endif; ?>
<div class="table-responsive">
<table id="scroll-horizontal-datatable_customer" class="table w-100 nowrap">
<thead class="thead-light">
<tr>
<th hidden></th>
<th>Template Name</th>
<th>Mode</th>
<th>Created at</th>
<th>Created by</th>
<th>Status</th>
<th align="center" id="action-column">Action</th>
</tr>
</thead>
<?php foreach ($template as $temp) :
if ($temp['isactive']) {
$class = 'badge badge-soft-success';
$message = 'Active';
} else {
$class = 'badge badge-soft-danger';
$message = 'In-Active';
} ?>
<tr>
<td hidden><?= $temp['template_id']; ?></td>
<td data-order="<?= $temp['template_name']; ?>"><?= $temp['template_name']; ?></td>
<td data-order="<?= $temp['mode']; ?>"><?= $temp['mode']; ?></td>
<td data-order="<?= $temp['formatted_created_on']; ?>"><?= $temp['formatted_created_on']; ?></td>
<td data-order="<?= $temp['created_by_name']; ?>"><?= $temp['created_by_name']; ?></td>
<td data-order="<?= $message; ?>"><span class="<?php echo $class; ?>"><?php echo $message; ?></span></td>
<td>
<a href="<?= base_url()."template_creation_form/".$temp['template_id']; ?>" class="edit-button" title="Click to Edit Template" ><i class="ri-pencil-line"></i></a>
<?php if ($temp['isactive']) { ?> <a href="<?php echo "template_creation_delete/".$temp['template_id']; ?>" class="delete-button" title="Click to Delete Template" ><i class="ri-delete-bin-line"></i></a> <?php } ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div><!-- end row-->
<script>
$(document).ready(function() {
var actionColumnIndex = $('#action-column').index();
$('#scroll-horizontal-datatable_customer').DataTable({
"order": [ [0, "desc"] ],
"columnDefs": [{ "targets": [actionColumnIndex], "orderable": false }]
});
});
</script>
<!-- <script>
$(document).ready(function() {
$('#bs-example-modal-lg').on('show.bs.modal', function(event) {
var primaryKey = $(event.relatedTarget).data('primary-key');
console.log(primaryKey);
var groupName = $(event.relatedTarget).data('modal-title');
$('#myLargeModalLabel').text(groupName);
});
});
</script> -->