books
This commit is contained in:
parent
c1066b0053
commit
1bfb35e027
@ -23,7 +23,7 @@ class Books extends BaseController
|
|||||||
|
|
||||||
$model = new BooksModel();
|
$model = new BooksModel();
|
||||||
$model->setTable('books');
|
$model->setTable('books');
|
||||||
$book_details = $model->where($where)->orderBy('book_id', 'DESC')->findAll();
|
$book_details =$model->getnonMembershiplist($session_bid);
|
||||||
$data['page_name'] = 'Book Details';
|
$data['page_name'] = 'Book Details';
|
||||||
$data['details'] = $book_details;
|
$data['details'] = $book_details;
|
||||||
$this->render_page('book_list', $data);
|
$this->render_page('book_list', $data);
|
||||||
|
|||||||
@ -27,4 +27,35 @@ class BooksModel extends Model
|
|||||||
$this->db->table('book_images')->insertBatch($imgDataArray);
|
$this->db->table('book_images')->insertBatch($imgDataArray);
|
||||||
return $this->db->insertID(); // Note: insertID() might not be applicable for batch inserts
|
return $this->db->insertID(); // Note: insertID() might not be applicable for batch inserts
|
||||||
}
|
}
|
||||||
|
public function getnonMembershiplist($business_id)
|
||||||
|
{
|
||||||
|
$builder = $this->builder();
|
||||||
|
$builder->select('books.book_id, books.title, books.price, books.duration,books.isactive,books.publisher,books.genre,books.language,books.publication_date,category.name as name');
|
||||||
|
$builder->join('book_categories', 'book_categories.book_id = books.book_id', 'left');
|
||||||
|
$builder->join('category', 'category.id = book_categories.category_id', 'left');
|
||||||
|
$builder->where('books.business_id', $business_id);
|
||||||
|
$builder->where('category.name !=', 'membership'); // Exclude books with the category name "membership"
|
||||||
|
|
||||||
|
$query = $builder->get();
|
||||||
|
|
||||||
|
$books = [];
|
||||||
|
|
||||||
|
foreach ($query->getResult() as $row) {
|
||||||
|
$books[$row->book_id] = [
|
||||||
|
'title' => $row->title,
|
||||||
|
'price' => $row->price,
|
||||||
|
'duration' => $row->duration,
|
||||||
|
'isactive'=>$row->isactive,
|
||||||
|
'book_id'=>$row->book_id,
|
||||||
|
'publisher'=>$row->publisher,
|
||||||
|
'genre'=>$row->genre,
|
||||||
|
'language'=>$row->language,
|
||||||
|
'publication_date'=>$row->publication_date,
|
||||||
|
'name'=>$row->name
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $books;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,9 +9,10 @@
|
|||||||
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
|
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<!-- <table id="basic-datatable" class="table dt-responsive w-100"> -->
|
<!-- <table id="basic-datatable" class="table dt-responsive w-100"> -->
|
||||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
<table id="scroll-horizontal-datatable_new" class="table w-100 nowrap">
|
||||||
<thead class="thead-light">
|
<thead class="thead-light">
|
||||||
<tr>
|
<tr>
|
||||||
|
<th hidden></th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Author</th>
|
<th>Author</th>
|
||||||
<th>Category</th>
|
<th>Category</th>
|
||||||
@ -34,9 +35,10 @@
|
|||||||
$edit_page_route = base_url() . "book_page/" . $row['book_id'];
|
$edit_page_route = base_url() . "book_page/" . $row['book_id'];
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
|
<td hidden><?php echo $row['book_id']; ?></td>
|
||||||
<td><?php echo $row['title']; ?></td>
|
<td><?php echo $row['title']; ?></td>
|
||||||
<td><?php echo $row['publisher']; ?></td>
|
<td><?php echo $row['publisher']; ?></td>
|
||||||
<td><?php echo $row['genre']; ?></td>
|
<td><?php echo $row['name']; ?></td>
|
||||||
<td><?php echo $row['language']; ?></td>
|
<td><?php echo $row['language']; ?></td>
|
||||||
<td><?php echo date('Y', strtotime($row['publication_date'])); ?></td>
|
<td><?php echo date('Y', strtotime($row['publication_date'])); ?></td>
|
||||||
<td>₹ <span data-plugin="counterup"><?php echo $row['price']; ?></span></td>
|
<td>₹ <span data-plugin="counterup"><?php echo $row['price']; ?></span></td>
|
||||||
@ -60,3 +62,11 @@
|
|||||||
</div><!-- end col-->
|
</div><!-- end col-->
|
||||||
</div>
|
</div>
|
||||||
<!-- end row-->
|
<!-- 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>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user