diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index 5e90b4b2..523c7de7 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -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); diff --git a/app/Controllers/Event.php b/app/Controllers/Event.php index 6eb506b7..92cef9c0 100644 --- a/app/Controllers/Event.php +++ b/app/Controllers/Event.php @@ -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) { diff --git a/app/Controllers/Scheme.php b/app/Controllers/Scheme.php index cab834cf..91ede95e 100644 --- a/app/Controllers/Scheme.php +++ b/app/Controllers/Scheme.php @@ -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); diff --git a/app/Models/AuthenticationModel.php b/app/Models/AuthenticationModel.php index eb805a3a..f34224a7 100644 --- a/app/Models/AuthenticationModel.php +++ b/app/Models/AuthenticationModel.php @@ -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); diff --git a/app/Models/CustomerModel.php b/app/Models/CustomerModel.php index e3c07561..e666f00e 100644 --- a/app/Models/CustomerModel.php +++ b/app/Models/CustomerModel.php @@ -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) { diff --git a/app/Models/SchemeModel.php b/app/Models/SchemeModel.php index c7043933..513bc406 100644 --- a/app/Models/SchemeModel.php +++ b/app/Models/SchemeModel.php @@ -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; - } -} } + diff --git a/app/Views/customer_list.php b/app/Views/customer_list.php index 0f4a3a04..acb0ce56 100644 --- a/app/Views/customer_list.php +++ b/app/Views/customer_list.php @@ -8,7 +8,7 @@

- +
@@ -46,7 +46,7 @@ diff --git a/app/Views/user_list.php b/app/Views/user_list.php index 24143255..88116a18 100644 --- a/app/Views/user_list.php +++ b/app/Views/user_list.php @@ -28,10 +28,10 @@
-
+
- + @@ -84,7 +84,7 @@
Name Email Role