diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index 523c7de7..5e90b4b2 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/uploads/avatar.png"); + $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['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['footer_about'] = $details[0]['footer_about']; +$data['bid'] = $session_bid; + echo view('template/header.php', $data); echo view('template/topbar.php', $data); diff --git a/app/Controllers/Customer.php b/app/Controllers/Customer.php index 08b0f9e3..968af851 100644 --- a/app/Controllers/Customer.php +++ b/app/Controllers/Customer.php @@ -23,7 +23,7 @@ class Customer extends BaseController $CustomerModel = new CustomerModel(); $data['page_name'] = 'Customer Listing'; - $data['customer'] = $CustomerModel->where($where)->findAll(); + $data['customer'] = $CustomerModel->where($where)->orderBy('customer_id', 'DESC')->findAll(); // print_r($data); die(); @@ -93,8 +93,7 @@ class Customer extends BaseController 'state' => $this->request->getPost('cstate'), 'postal_code' => $this->request->getPost('czip'), 'country' => $this->request->getPost('ccountry'), - 'type' => $this->request->getPost('ctype'), - 'date_of_birth' => $this->request->getPost('dob'), + 'date_of_birth' => $this->request->getPost('dob'), 'gender' => $this->request->getPost('gen'), 'profile_picture' => $this->request->getPost('cfile'), 'mode' => $this->request->getPost('cmode'), diff --git a/app/Controllers/Scheme.php b/app/Controllers/Scheme.php index 711c8df9..cab834cf 100644 --- a/app/Controllers/Scheme.php +++ b/app/Controllers/Scheme.php @@ -21,9 +21,10 @@ class Scheme extends BaseController $where = ['isactive != ' => NULL]; } $SchemeModel = new SchemeModel(); - + $data['page_name'] = 'Scheme Listing'; - $data['scheme'] = $SchemeModel->where($where)->findAll(); + $data['scheme'] = $SchemeModel->where($where)->orderBy('book_id', 'DESC')->findAll(); + $this->render_page('scheme_list', $data); } else { @@ -65,6 +66,7 @@ class Scheme extends BaseController 'description' => $this->request->getPost('sdescription'), 'price' => $this->request->getPost('sprice'), 'duration' => $this->request->getPost('sduration'), + 'sku' => $this->request->getPost('sku'), 'business_id' => $this->request->getPost('business_id') ]; @@ -73,10 +75,33 @@ class Scheme extends BaseController if (empty($scheme_id)) { // It's an insert operation $data['isactive'] = 1; - $data['category'] = 2; + $data['created_by'] = $session_uid; $SchemeModel->insert($data); - } else { + // $last_inserted_id = 100; + $last_inserted_id = $SchemeModel->insertID(); + + // Retrieve the category name 'membership' + $category_name = 'membership'; + + // Find the category ID for 'membership' from the category table + $db = db_connect(); + $category = $db->table('category') + ->select('id') + ->where('name', $category_name) + ->get() + ->getRow(); + + // Check if the category exists + if ($category) { + // Insert data into book_categories table + $db->table('book_categories')->insert([ + 'book_id' => $last_inserted_id, + 'category_id' => $category->id + ]); + } + } + else { // It's an update operation $isactive = $this->request->getPost('isactive'); $data['isactive'] = ($isactive == 'on') ? 1 : 0; diff --git a/app/Models/AuthenticationModel.php b/app/Models/AuthenticationModel.php index f34224a7..eb805a3a 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,settings.footer_about'); + $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->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/InvoiceModel.php b/app/Models/InvoiceModel.php index 05ce427b..82f58a1e 100644 --- a/app/Models/InvoiceModel.php +++ b/app/Models/InvoiceModel.php @@ -162,3 +162,4 @@ public function insertSubscriptionData($data) + diff --git a/app/Models/SchemeModel.php b/app/Models/SchemeModel.php index f1f63d49..c7043933 100644 --- a/app/Models/SchemeModel.php +++ b/app/Models/SchemeModel.php @@ -9,7 +9,7 @@ class SchemeModel extends Model { protected $table = 'books'; protected $primaryKey = 'book_id'; - protected $allowedFields = ['book_id ','title','description','price','features','duration','business_id','updated_by','category','isactive']; + protected $allowedFields = ['book_id ','title','sku','description','price','features','duration','business_id','updated_by','category','isactive']; public function insertScheme($data) { @@ -102,6 +102,23 @@ 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_form.php b/app/Views/customer_form.php index 5afce7de..0382706c 100644 --- a/app/Views/customer_form.php +++ b/app/Views/customer_form.php @@ -17,7 +17,7 @@ href="#subscriptionDetails" role="tab" aria-controls="subscriptionDetails" aria-selected="false">Subscription Details - @@ -75,8 +75,7 @@
- + @@ -94,15 +93,8 @@
-
- - -
Please provide.
-
-
+ +
Please provide.
+
+ + +
Please provide.
+
@@ -33,7 +38,7 @@
- +
diff --git a/app/Views/scheme_list.php b/app/Views/scheme_list.php index 44666ebd..f53b6f86 100644 --- a/app/Views/scheme_list.php +++ b/app/Views/scheme_list.php @@ -12,27 +12,40 @@ + - - - - - - + + + + + - +
Scheme Name Price Duration Action
+ + + + +
" class="edit-button"> " class="delete-button">
- \ No newline at end of file + + \ No newline at end of file diff --git a/app/Views/user_form.php b/app/Views/user_form.php index ec5713e9..5065dc70 100644 --- a/app/Views/user_form.php +++ b/app/Views/user_form.php @@ -9,19 +9,14 @@
" method="post" enctype="multipart/form-data">
-
- - - -
-
+
-
+
@@ -34,8 +29,8 @@
- - + +
- -
- - -
- -
+
+
+ + +
+ +
- - + +
- - + +
- - + +
- - + +
@@ -113,7 +108,7 @@
- +