98 lines
5.6 KiB
PHP
Executable File
98 lines
5.6 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() . "book_page/0"; ?>" class="btn btn-primary waves-effect"> <span> <i class="mdi mdi-book-plus"></i></span> Add Book </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">×</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">×</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 nowrap">
|
|
<thead class="thead-light">
|
|
<tr>
|
|
<th hidden></th>
|
|
<th>Name</th>
|
|
<th>Author</th>
|
|
<th>Category</th>
|
|
<th>Language</th>
|
|
<th>Year Of Release</th>
|
|
<th>Price of the Book</th>
|
|
<th>Status</th>
|
|
<th align="center" id="action-column">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() . "book_page/" . $row['book_id'];
|
|
$formattedPublicationYear = ($row['publication_date'] !== null && $row['publication_date'] != '') ? date('Y', strtotime($row['publication_date'])) : "";
|
|
?>
|
|
<tr>
|
|
<td hidden><?php echo $row['book_id']; ?></td>
|
|
<td data-order="<?= $row['title']; ?>"><?php echo $row['title']; ?></td>
|
|
<td data-order="<?= $row['author']; ?>"><?php echo isset($row['author']) ? $row['author'] : ""; ?></td>
|
|
<td data-order="<?= $row['category_name']; ?>"><?php echo $row['category_name']; ?></td>
|
|
<td data-order="<?= $row['language']; ?>"><?php echo $row['language']; ?></td>
|
|
<td data-order="<?= $formattedPublicationYear; ?>"><?php echo $formattedPublicationYear ; ?></td>
|
|
<!-- <td>₹ <span data-plugin="counterup"><?php echo $row['price']; ?></span></td> -->
|
|
<td data-order="<?= $row['price']; ?>">₹ <?php echo $row['price']; ?></td>
|
|
<td data-order="<?= $message; ?>">
|
|
<span class="<?php echo $class; ?>"><?php echo $message; ?></span>
|
|
</td>
|
|
<td>
|
|
<?php if($row['wp_api_product_id']){
|
|
echo "Online Product";
|
|
}else{ ?>
|
|
<a href="<?php echo $edit_page_route; ?>" class="edit-button" title="Click to Edit Book"><i class="ri-pencil-line"></i></a>
|
|
<?php if((int)$row['isactive'] === 1){ ?>
|
|
<a href="<?= base_url() . "delete_books/" . $row['book_id']; ?>" class="delete-button" title="Click to Delete Book"><i class="ri-delete-bin-line"></i></a>
|
|
<?php } ?>
|
|
<?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_new').DataTable({
|
|
"order": [[0, "desc"]],
|
|
"columnDefs": [{ "targets": [actionColumnIndex], "orderable": false }]
|
|
});
|
|
});
|
|
</script>
|