donation/app/Views/book_list.php
bitbucket 1b89482e5b ss
2024-02-17 10:32:29 +05:30

94 lines
4.5 KiB
PHP

<style>
.maxWidth {
max-width: 50px;
}
</style>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="float-right">
<a href="<?= base_url() . "add_causes/0"; ?>" class="btn btn-primary waves-effect"> <span> <i class="mdi mdi-book-plus"></i></span> Add Causes </a>
</div>
<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="basic-datatable" class="table dt-responsive w-100"> -->
<table id="scroll-horizontal-datatable_new" class="table w-100">
<thead class="thead-light">
<tr>
<th hidden></th>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($details as $row) :
if ($row['isactive']) {
$class = 'badge badge-soft-success';
$message = 'Active';
} else {
$class = 'badge badge-soft-danger';
$message = 'In-Active';
}
$edit_page_route = base_url() . "add_causes/" . $row['causes_id'];
?>
<tr>
<td hidden><?php echo $row['causes_id']; ?></td>
<td><?php echo $row['name']; ?></td>
<td>
<?php
foreach ($cause_list as $key => $value) {
if($row['type'] == $value->id)
echo $value->name;
}
?>
</td>
<td><?php echo $row['description']; ?></td>
<td>
<a href="<?php echo $edit_page_route; ?>" class="edit-button"> <i class="ri-pencil-line"></i></a>
<?php if(get_user_role() != 'auditor') { ?>
<a href="<?= base_url() . "delete_books/" . $row['causes_id']; ?>" class="delete-button"><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() {
$('#scroll-horizontal-datatable_new').DataTable({
"order": [[0, "desc"]] // 4 is the column index of "created_on" in your table
// Other DataTables configuration options
});
});
</script>