books
This commit is contained in:
parent
1bfb35e027
commit
2a812d9e5a
@ -79,15 +79,15 @@ abstract class BaseController extends Controller
|
||||
|
||||
$data['loggedin_person_role'] = $details[0]['role'];
|
||||
$data['favicon'] = !empty($details[0]['favicon']) && file_exists(FCPATH."public/uploads/".$details[0]['favicon']) ? base_url("public/uploads/".$details[0]['favicon']) : base_url("public/uploads/default.ico");
|
||||
$data['profile_picture'] = !empty($details[0]['profile_picture']) && file_exists(FCPATH."public/uploads/".$details[0]['profile_picture']) ? base_url("public/uploads/" . $details[0]['profile_picture']) : base_url("public/assets/images/users/avatar-9.jpg");
|
||||
$data['profile_picture'] = !empty($details[0]['profile_picture']) && file_exists(FCPATH."public/uploads/".$details[0]['profile_picture']) ? base_url("public/uploads/" . $details[0]['profile_picture']) : base_url("public/uploads/avatar.png");
|
||||
$data['company_logo_small'] = !empty($details[0]['company_logo_small']) && file_exists(FCPATH."public/uploads/".$details[0]['company_logo_small']) ? base_url("public/uploads/" . $details[0]['company_logo_small']) : base_url("public/uploads/default_logo.png");
|
||||
$data['company_logo_large'] = !empty($details[0]['company_logo_large']) && file_exists(FCPATH."public/uploads/".$details[0]['company_logo_large']) ? base_url("public/uploads/" . $details[0]['company_logo_large']) : base_url("public/uploads/default.png");
|
||||
$data['browser_title'] = $data['company_name'] . ' | ' . $data['company_short_name'] . ' ' . $data['page_name'];
|
||||
$data['heading'] = $data['page_name'] === "Dashboard" ? 'Welcome to ' . $data['company_name'] : "";
|
||||
$data['loggedin_person'] = $session_uname;
|
||||
$session_bid = get_business_id();
|
||||
$data['bid'] = $session_bid;
|
||||
|
||||
$data['bid'] = $session_bid;
|
||||
$data['footer_about'] = $details[0]['footer_about'];
|
||||
|
||||
echo view('template/header.php', $data);
|
||||
echo view('template/topbar.php', $data);
|
||||
|
||||
@ -25,7 +25,7 @@ class Event extends BaseController
|
||||
$EventModel = new EventModel();
|
||||
$data['page_name'] = 'Event Details';
|
||||
// $events = $EventModel->where($where)->orderBy('id', 'desc')->findAll(); // Retrieve the events
|
||||
$events = $EventModel->where($where)->findAll(); // Retrieve the events
|
||||
$events = $EventModel->where($where)->orderBy('id', 'DESC')->findAll(); // Retrieve the events
|
||||
|
||||
// Sort the events by ID in descending order (newest first)
|
||||
// usort($events, function ($a, $b) {
|
||||
|
||||
@ -23,7 +23,8 @@ class Scheme extends BaseController
|
||||
$SchemeModel = new SchemeModel();
|
||||
|
||||
$data['page_name'] = 'Scheme Listing';
|
||||
$data['scheme'] = $SchemeModel->where($where)->orderBy('book_id', 'DESC')->findAll();
|
||||
$data['scheme'] = $SchemeModel->getSchemeNamesAndDurationsByBusiness($session_bid);
|
||||
|
||||
|
||||
|
||||
$this->render_page('scheme_list', $data);
|
||||
|
||||
@ -10,7 +10,7 @@ class AuthenticationModel extends Model
|
||||
public function getheringDetailsForHeader($user_id)
|
||||
{
|
||||
$builder = $this->db->table('users');
|
||||
$builder->select('users.user_id,users.business_id,users.profile_picture,users.role,settings.site_name,settings.site_title,settings.favicon,settings.logo as company_logo_large,business.business_logo as company_logo_small,business.email as company_email,business.address as company_address,business.mobile_no as company_mobile_no,business.title');
|
||||
$builder->select('users.user_id,users.business_id,users.profile_picture,users.role,settings.site_name,settings.site_title,settings.favicon,settings.logo as company_logo_large,business.business_logo as company_logo_small,business.email as company_email,business.address as company_address,business.mobile_no as company_mobile_no,business.title,settings.footer_about');
|
||||
$builder->join('settings', 'settings.business_id = users.business_id', 'left');
|
||||
$builder->join('business', 'business.business_id = users.business_id', 'left');
|
||||
$builder->where('user_id', $user_id);
|
||||
|
||||
@ -9,7 +9,7 @@ class CustomerModel extends Model
|
||||
{
|
||||
protected $table = 'customers';
|
||||
protected $primaryKey = 'customer_id ';
|
||||
protected $allowedFields = ['customer_id ','first_name','city','last_name','email','mobile_no','country','state','postal_code' ,'address','profile_picture','date_of_birth','gender','mode','type','isactive','business_id'];
|
||||
protected $allowedFields = ['customer_id ','first_name','city','last_name','email','mobile_no','country','state','postal_code' ,'address','profile_picture','date_of_birth','gender','mode','isactive','business_id'];
|
||||
|
||||
public function insertCustomer($data)
|
||||
{
|
||||
|
||||
@ -17,25 +17,32 @@ class SchemeModel extends Model
|
||||
}
|
||||
|
||||
|
||||
public function getSchemeNamesAndDurationsByBusiness($business_id)
|
||||
{
|
||||
$builder = $this->builder();
|
||||
$builder->select('scheme_id, scheme_name, duration');
|
||||
$builder->where('business_id', $business_id);
|
||||
public function getSchemeNamesAndDurationsByBusiness($business_id)
|
||||
{
|
||||
$builder = $this->builder();
|
||||
$builder->select('books.book_id, books.title, books.price, books.duration, category.name as category_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');
|
||||
|
||||
$query = $builder->get();
|
||||
$query = $builder->get();
|
||||
|
||||
$schemes = [];
|
||||
$schemes = [];
|
||||
|
||||
foreach ($query->getResult() as $row) {
|
||||
$schemes[$row->scheme_id] = [
|
||||
'scheme_name' => $row->scheme_name,
|
||||
'duration' => $row->duration,
|
||||
];
|
||||
}
|
||||
|
||||
return $schemes;
|
||||
foreach ($query->getResult() as $row) {
|
||||
$schemes[$row->book_id] = [
|
||||
'title' => $row->title,
|
||||
'price' => $row->price,
|
||||
'duration' => $row->duration,
|
||||
'category_name' => $row->category_name,
|
||||
'book_id'=>$row->book_id
|
||||
];
|
||||
}
|
||||
|
||||
return $schemes;
|
||||
}
|
||||
|
||||
|
||||
// public function getSchemeDuration($schemeId)
|
||||
// {
|
||||
@ -102,24 +109,8 @@ public function getAllSchemes()
|
||||
{
|
||||
return $this->findAll();
|
||||
}
|
||||
public function getCategoryName($book_id)
|
||||
{
|
||||
$builder = $this->builder();
|
||||
$builder->select('category.name AS category_name');
|
||||
$builder->join('book_categories', 'book_categories.book_id = books.book_id');
|
||||
$builder->join('category', 'category.id = book_categories.category_id');
|
||||
$builder->where('books.book_id', $book_id);
|
||||
|
||||
$query = $builder->get();
|
||||
|
||||
if ($query->getNumRows() === 1) {
|
||||
$row = $query->getRow();
|
||||
return $row->category_name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
<br>
|
||||
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
|
||||
<div class="table-responsive">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<table id="scroll-horizontal-datatable_customer" class="table w-100 nowrap">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th hidden></th>
|
||||
@ -46,7 +46,7 @@
|
||||
<!-- end row-->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#scroll-horizontal-datatable_wrapper').DataTable({
|
||||
$('#scroll-horizontal-datatable_customer').DataTable({
|
||||
"order": [[0, "desc"]] // 4 is the column index of "created_on" in your table
|
||||
// Other DataTables configuration options
|
||||
});
|
||||
|
||||
@ -10,10 +10,11 @@
|
||||
<div class="table-responsive">
|
||||
|
||||
|
||||
<table id="basic-datatable" class="table dt-responsive nowrap w-100">
|
||||
<table id="basic-datatable_new" class="table dt-responsive nowrap w-100">
|
||||
<thead class="thead-light">
|
||||
|
||||
<tr>
|
||||
<th hidden ></th>
|
||||
<th>Event Name</th>
|
||||
<th>Next ID</th>
|
||||
<th>Left Pad</th>
|
||||
@ -22,6 +23,7 @@
|
||||
</thead>
|
||||
<?php foreach ($event as $value) :?>
|
||||
<tr>
|
||||
<td hidden><?= $value['id']; ?></td>
|
||||
<td><?= $value['event_name']; ?></td>
|
||||
<td><?= $value['next_id']; ?></td>
|
||||
<td><?= $value['left_pad']; ?></td>
|
||||
@ -40,7 +42,7 @@
|
||||
</div><!-- end row-->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var table = $('#scroll-horizontal-datatable').DataTable({
|
||||
var table = $('#basic-datatable_new').DataTable({
|
||||
"order": [[0, "dsc"]] // Sort by the first (index 0) column (id) in ascending order
|
||||
});
|
||||
});
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="sname" class="col-form-label">Scheme Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="sname" name="sname" value="<?= isset($scheme['title']) ? $scheme['title'] : '' ?>" placeholder=" Name" required />
|
||||
<input type="text" class="form-control" id="sname" name="sname" value="<?= isset($scheme['title']) ? $scheme['title'] : '' ?>" placeholder=" Scheme Name" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
@ -23,12 +23,12 @@
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="sduration" class="col-form-label">Duration<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="sduration" value="<?= isset($scheme['duration']) ? $scheme['duration'] : '' ?>" placeholder="Duration (eg: 1 Month / 3 months / 1 Year ... )" required />
|
||||
<input type="text" class="form-control" name="sduration" value="<?= isset($scheme['duration']) ? $scheme['duration'] : '' ?>" placeholder="Duration In Months" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="sku" class="col-form-label">Sku ID<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="sku" value="<?= isset($scheme['sku']) ? $scheme['sku'] : '' ?>" placeholder="Duration (eg: 1 Month / 3 months / 1 Year ... )" required />
|
||||
<label for="sku" class="col-form-label">SKU ID<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="sku" value="<?= isset($scheme['sku']) ? $scheme['sku'] : '' ?>" placeholder="SKU ID" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -9,31 +9,31 @@
|
||||
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
|
||||
<div class="table-responsive">
|
||||
<!-- <table id="datatable-buttons" class="table dt-responsive w-100"> -->
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<table id="scroll-horizontal-datatable_scheme" class="table w-100 nowrap">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th hidden></th>
|
||||
<th>Scheme Name</th>
|
||||
<th>Price</th>
|
||||
<th>Duration</th>
|
||||
<th hidden>Category</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php foreach ($scheme as $value) :?>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td hidden><? $value['book_id'];?></td>
|
||||
<td><?= $value['title']; ?></td>
|
||||
<td><?= $value['price']; ?></td>
|
||||
<td><?= $value['duration']; ?></td>
|
||||
<td>
|
||||
<a href="<?= "new_scheme/" . $value['book_id']; ?>" class="edit-button"><i class="ri-pencil-line"></i></a>
|
||||
<a href="<?php echo "delete_scheme/" . $value['book_id']; ?>" class="delete-button"><i class="ri-delete-bin-line"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php foreach ($scheme as $row) : ?>
|
||||
<tr>
|
||||
<td hidden><?= $row['book_id'];?></td>
|
||||
<td><?= $row['title']; ?></td>
|
||||
<td><?= $row['price']; ?></td>
|
||||
<td><?= $row['duration']; ?></td>
|
||||
<td hidden><?= $row['category_name']; ?></td>
|
||||
<td>
|
||||
<a href="<?= "new_scheme/" . $row['book_id']; ?>" class="edit-button"><i class="ri-pencil-line"></i></a>
|
||||
<a href="<?php echo "delete_scheme/" . $row['book_id']; ?>" class="delete-button"><i class="ri-delete-bin-line"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@ -43,7 +43,7 @@
|
||||
</div><!-- end row-->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#scroll-horizontal-datatable_wrapper').DataTable({
|
||||
$('#scroll-horizontal-datatable_scheme').DataTable({
|
||||
"order": [[0, "desc"]] // 4 is the column index of "created_on" in your table
|
||||
// Other DataTables configuration options
|
||||
});
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
<td><?php echo $row['mobile'] ; ?></td>
|
||||
<td><?php echo $row['copyright'] ; ?></td>
|
||||
<td><?php echo $row['logo'] ; ?></td>
|
||||
<td><?php echo $row['favicon'] ; ?></td>
|
||||
<td><?php echo $row['favicon'] ; ?></td>
|
||||
<td>
|
||||
<span class="<?php echo $class; ?>"><?php echo $message; ?></span>
|
||||
</td>
|
||||
|
||||
@ -16,9 +16,10 @@
|
||||
<!-- <table id="alternative-page-datatable" class="table table-borderless table-hover table-centered m-0"> -->
|
||||
<!-- <table class="table table-borderless table-hover table-centered m-0"> -->
|
||||
<!-- <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_old" class="table w-100 nowrap">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th hidden ></th>
|
||||
<th>Scheme Name</th>
|
||||
<th>Customer Name</th>
|
||||
<th>Subscription From</th>
|
||||
@ -30,6 +31,7 @@
|
||||
<tbody>
|
||||
<?php foreach ($subscriber as $value) :?>
|
||||
<tr>
|
||||
<td hidden><?= $value['sub_id'];?></td>
|
||||
<td><?= $value['title']; ?></td>
|
||||
<td><?= $value['customer_name']; ?></td>
|
||||
<td><?= $value['from_subscription']; ?></td>
|
||||
@ -93,4 +95,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#scroll-horizontal-datatable_old').DataTable({
|
||||
"order": [[0, "desc"]] // 0 is the column index
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@ -28,10 +28,10 @@
|
||||
|
||||
<div class="table-responsive">
|
||||
<!-- <table id="datatable-buttons" class="table dt-responsive w-100"> -->
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<table id="scroll-horizontal-datatable_user" class="table w-100 nowrap">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th hidden></th>
|
||||
<th hidden ></th>
|
||||
<th>Name</th>
|
||||
<th>Email</th>
|
||||
<th>Role</th>
|
||||
@ -84,7 +84,7 @@
|
||||
<!-- end row-->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#scroll-horizontal-datatable_wrapper').DataTable({
|
||||
$('#scroll-horizontal-datatable_user').DataTable({
|
||||
"order": [[0, "desc"]] // 4 is the column index of "created_on" in your table
|
||||
// Other DataTables configuration options
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user