From b2c2793df29c417b538cbf497cc89349f8161000 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Wed, 1 Nov 2023 19:10:08 +0530 Subject: [PATCH] Internal Discussion 31st : ps --- app/Controllers/ApiIntegration.php | 2 +- app/Controllers/Customer.php | 15 +- app/Controllers/Event.php | 2 +- app/Controllers/Invoice.php | 6 +- app/Controllers/Subscription.php | 2 +- app/Models/CustomerModel.php | 2 +- app/Models/InvoiceModel.php | 33 +- app/Models/NotificationModel.php | 4 +- app/Views/book_list.php | 15 +- app/Views/customer_form.php | 133 +++--- app/Views/customer_group.php | 6 +- app/Views/customer_group_form.php | 4 +- app/Views/customer_list.php | 7 +- app/Views/invoice_form.php | 702 ++++++++++++----------------- app/Views/invoice_list.php | 273 ++++++----- app/Views/scheme_form.php | 56 +-- app/Views/scheme_list.php | 8 +- app/Views/subscribers_list.php | 188 ++++---- app/Views/template/header.php | 12 +- app/Views/user_list.php | 9 +- 20 files changed, 668 insertions(+), 811 deletions(-) diff --git a/app/Controllers/ApiIntegration.php b/app/Controllers/ApiIntegration.php index d6082689..0a9f8f8b 100644 --- a/app/Controllers/ApiIntegration.php +++ b/app/Controllers/ApiIntegration.php @@ -19,7 +19,7 @@ class ApiIntegration extends ResourceController public function __construct() { $this->global_variable_business_id = 1; - $this->global_variable_role = "online"; + $this->global_variable_role = "Online"; $api_model = new ApiIntegrationModel(); $table = 'users'; $where = ['role'=>$this->global_variable_role,'business_id'=>(int)$this->global_variable_business_id]; diff --git a/app/Controllers/Customer.php b/app/Controllers/Customer.php index bfd7f1be..11c05924 100644 --- a/app/Controllers/Customer.php +++ b/app/Controllers/Customer.php @@ -91,20 +91,15 @@ class Customer extends BaseController $session_uid = get_logged_user_id(); $session_role = get_user_role(); $model = new CustomerModel(); + $dob = $this->request->getPost('dob'); + $dob = (isset($dob) && $dob != "") ? $dob : NULL ; $data = [ 'first_name' => $this->request->getPost('cfname'), 'last_name' => $this->request->getPost('csname'), 'mobile_no' => $this->request->getPost('cmobile'), - 'address' => $this->request->getPost('address'), - 'city' => $this->request->getPost('ccity'), 'email' => $this->request->getPost('cmail'), - 'state' => $this->request->getPost('cstate'), - 'postal_code' => $this->request->getPost('czip'), - 'country' => $this->request->getPost('ccountry'), - 'date_of_birth' => $this->request->getPost('dob'), - 'gender' => $this->request->getPost('gen'), - 'profile_picture' => $this->request->getPost('cfile'), - 'mode' => $this->request->getPost('cmode'), + 'date_of_birth' => $dob, + 'mode' => "Offline", 'business_id' => $this->request->getPost('business_id') ]; @@ -308,7 +303,7 @@ class Customer extends BaseController ['value'=>'CA.state','fieldflag'=>1,'text'=> 'State','disable' => false], ['value'=>'CM.name','fieldflag'=>1,'text'=> 'Category','disable' => false], ['value'=>'I.invoice_date','fieldflag'=>2,'text'=> 'Invoice Date','disable' => false], - ['value'=>'S.to_subscription','fieldflag'=>2,'text'=> 'Due Date','disable' => false]]; + ['value'=>'S.to_subscription','fieldflag'=>2,'text'=> 'Expiry Date','disable' => false]]; $data['operator'] = [ '' => 'Choose the operator', diff --git a/app/Controllers/Event.php b/app/Controllers/Event.php index 2b883377..df5cbaa8 100644 --- a/app/Controllers/Event.php +++ b/app/Controllers/Event.php @@ -48,7 +48,7 @@ public function new_event($id) $data['page_name'] = 'Add Event'; $data['event'] = []; } else if ($id !== '0') { - $data['page_name'] = 'Edit Scheme'; + $data['page_name'] = 'Edit Event'; $model = new EventModel(); $model->setTable('events'); $edit_event_details = $model->where(['id' => $id])->first(); diff --git a/app/Controllers/Invoice.php b/app/Controllers/Invoice.php index 60a6305a..83ce4f5b 100644 --- a/app/Controllers/Invoice.php +++ b/app/Controllers/Invoice.php @@ -50,19 +50,19 @@ class Invoice extends BaseController $data['books'] = $model->getNonMembershipCategoryBooks('books', $where); if ($id === '0') { - $this->logger->info("Book Invoice: In Add Page"); + $this->logger->info("Book Invoice: In Add Details"); $data['page_name'] = 'Add Book Invoice Details'; $data['invoice_type'] = '2'; $data['invoice_details'] = []; $data['invoice_item_details'] = []; } elseif ($id !== '0') { - $this->logger->info("Book Invoice: In Edit Page ID =" . $id); + $this->logger->info("Book Invoice: In Edit Details ID =" . $id); $data['page_name'] = 'Edit Book Invoice Details'; $data['invoice_type'] ='2'; $data['invoice_details'] = $model->where(['invoice_id' => $id, 'isactive' => 1])->first(); $data['invoice_item_details'] = $this->get_invoice_item($id); } - + // print_r($data['invoice_details']);die; $this->render_page('invoice_form', $data); } diff --git a/app/Controllers/Subscription.php b/app/Controllers/Subscription.php index d67fa18b..cb9a5158 100644 --- a/app/Controllers/Subscription.php +++ b/app/Controllers/Subscription.php @@ -27,7 +27,7 @@ class Subscription extends BaseController $model = new InvoiceModel(); $data['page_name'] = 'Subscription Invoice Details'; - $data['invoice'] = $model->getJoinedData($where); + $data['invoice'] = $model->getSubscriptionInvoiceDetail($where); $this->logger->info("Invoice: Listing Count ." . count($data['invoice'])); diff --git a/app/Models/CustomerModel.php b/app/Models/CustomerModel.php index 66dc7ea6..1bdfd935 100644 --- a/app/Models/CustomerModel.php +++ b/app/Models/CustomerModel.php @@ -151,7 +151,7 @@ public function getGroupDetails() return $this->db->table('customer_groups as CG' ) ->join('users as U1', 'U1.user_id = CG.created_by', 'left') ->join('users as U2', 'U2.user_id = CG.updated_by', 'left') -->select('CG.group_id,CG.group_name,CG.created_on,CG.created_by,CG.updated_on,CG.updated_by,DATE_FORMAT(CG.created_on, "%d-%m-%Y %h:%i %p") AS formatted_created_on,concat(U1.first_name," ",U1.last_name) as created_by_name,concat(U2.first_name," ",U2.last_name) as updated_by_name,CG.isactive') +->select('CG.group_id,CG.group_name,CG.created_on,CG.created_by,CG.updated_on,CG.updated_by,DATE_FORMAT(CG.created_on, "%d/%m/%Y %h:%i %p") AS formatted_created_on,concat(U1.first_name," ",U1.last_name) as created_by_name,concat(U2.first_name," ",U2.last_name) as updated_by_name,CG.isactive') // ->where(['CG.isactive' => 1]) ->get() ->getResultArray(); diff --git a/app/Models/InvoiceModel.php b/app/Models/InvoiceModel.php index 6a64bb94..7705cefe 100644 --- a/app/Models/InvoiceModel.php +++ b/app/Models/InvoiceModel.php @@ -44,6 +44,33 @@ public function updateData($table, $data, $where) return $affected_rows; } + public function getSubscriptionInvoiceDetail($where) + { + $result = $this->getJoinedData($where); + // print_r($result);die; + if(!empty($result)){ + foreach ($result as $i => $item) { + $invoiceId = $item['invoice_id']; + $scheme_name = []; + $from_subscription = []; + $to_subscription = []; + $invoiceItems = $this->getInvoiceItems($invoiceId); + foreach ($invoiceItems as $j => $child) { + if ($child->category_name == 'Membership') { + $scheme_name[] = $child->title; + $from_subscription[] = $child->from_subscription ? date('d/m/Y', strtotime($child->from_subscription)) : ""; + $to_subscription[] = $child->to_subscription ? date('d/m/Y', strtotime($child->to_subscription)) : ""; + } + } + $result[$i]['scheme_name'] = !empty($scheme_name) ? implode(", ", $scheme_name) : ''; + $result[$i]['from_subscription'] = !empty($from_subscription) ? implode(", ", $from_subscription) : ''; + $result[$i]['to_subscription'] = !empty($to_subscription) ? implode(", ", $to_subscription) : ''; + $result[$i]['invoice_items_details'] = $invoiceItems; + } + } + return $result; + } + public function getJoinedData($where) { @@ -127,14 +154,14 @@ public function updateData($table, $data, $where) } // this function Also Used For Approve Notification. - public function getInvoiceItems($id) { $data = $this->db->table('invoiceitems') ->where(['invoice_id' => $id, 'invoiceitems.isactive' => 1]) ->join('books as B', 'B.book_id = invoiceitems.product', 'left') - // ->join('book_images as BI', 'BI.book_id = invoiceitems.product', 'left') - ->select('invoiceitems.*,B.*') + ->join('book_categories as BC', 'BC.book_id = invoiceitems.product', 'left') + ->join('category as C', 'C.id = BC.category_id', 'left') + ->select('invoiceitems.*,B.*,C.name as category_name') //->orderBy("book_img_id", "asc") // Order by book_img_id in ascending order //->limit(1,0) ->get() diff --git a/app/Models/NotificationModel.php b/app/Models/NotificationModel.php index 6d42bd89..352e6edc 100644 --- a/app/Models/NotificationModel.php +++ b/app/Models/NotificationModel.php @@ -41,7 +41,7 @@ class NotificationModel extends Model return $this->db->table('templates as T' ) ->join('users as U1', 'U1.user_id = T.created_by', 'left') ->join('users as U2', 'U2.user_id = T.updated_by', 'left') - ->select('T.template_id,T.template_name,T.mode,T.created_on,T.created_by,T.updated_on,T.updated_by,DATE_FORMAT(T.created_on, "%d-%m-%Y %h:%i %p") AS formatted_created_on,concat(U1.first_name," ",U1.last_name) as created_by_name,concat(U2.first_name," ",U2.last_name) as updated_by_name,T.isactive') + ->select('T.template_id,T.template_name,T.mode,T.created_on,T.created_by,T.updated_on,T.updated_by,DATE_FORMAT(T.created_on, "%d/%m/%Y %h:%i %p") AS formatted_created_on,concat(U1.first_name," ",U1.last_name) as created_by_name,concat(U2.first_name," ",U2.last_name) as updated_by_name,T.isactive') ->get()->getResultArray(); } @@ -81,7 +81,7 @@ public function getCampaignDetails(){ ->join('users as U1', 'U1.user_id = NC.created_by', 'left') ->join('users as U2', 'U2.user_id = NC.updated_by', 'left') ->join('templates as T', 'T.template_id = NC.template_id', 'left') - ->select('NC.campaign_id,NC.campaign_name,T.template_id,T.template_name,NC.mode,NC.created_on,NC.created_by,NC.updated_on,NC.updated_by,DATE_FORMAT(NC.created_on, "%d-%m-%Y %h:%i %p") AS formatted_created_on,concat(U1.first_name," ",U1.last_name) as created_by_name,concat(U2.first_name," ",U2.last_name) as updated_by_name,NC.isactive,NC.group_id,NC.scheduled_date,NC.scheduled_time') + ->select('NC.campaign_id,NC.campaign_name,T.template_id,T.template_name,NC.mode,NC.created_on,NC.created_by,NC.updated_on,NC.updated_by,DATE_FORMAT(NC.created_on, "%d/%m/%Y %h:%i %p") AS formatted_created_on,concat(U1.first_name," ",U1.last_name) as created_by_name,concat(U2.first_name," ",U2.last_name) as updated_by_name,NC.isactive,NC.group_id,NC.scheduled_date,NC.scheduled_time') ->get()->getResultArray(); if (!empty($result)) { diff --git a/app/Views/book_list.php b/app/Views/book_list.php index 854a61a8..b8616425 100644 --- a/app/Views/book_list.php +++ b/app/Views/book_list.php @@ -2,9 +2,9 @@
-
+

getFlashdata('success') || session()->getFlashdata('error')) : ?> @@ -38,7 +38,7 @@ Year Of Release Price of the Book Status - Action + @@ -58,17 +58,18 @@ - - ₹ + + + ₹ - + diff --git a/app/Views/customer_form.php b/app/Views/customer_form.php index 2fa0886a..fb38b1dd 100644 --- a/app/Views/customer_form.php +++ b/app/Views/customer_form.php @@ -9,7 +9,7 @@ - + @@ -59,30 +59,9 @@
- -
-
- - -
Please provide.
-
- -
- - -
Please provide.
-
-
@@ -153,11 +132,6 @@
Please provide.
-
- - -
Please provide.
-
@@ -178,6 +152,11 @@
+
+ + +
Please provide.
+
@@ -197,7 +176,7 @@
-
+

@@ -226,12 +205,6 @@
Please provide.
- - -
Please provide.
-
-
- - - - -
+
+ + +
Please provide.
+
@@ -260,16 +234,13 @@
-
-
> @@ -278,9 +249,7 @@
- + " class="btn btn-secondary waves-effect">Cancel @@ -431,9 +400,9 @@ j=0; for (var i = 0; i < sarray.length; i++) { if (i == 0) { - var html = $(".after-add-smore").first(); + var html = $(".after-shipping-addr-add-more").first(); } else { - var html = $(".after-add-smore").first().clone(); + var html = $(".after-shipping-addr-add-more").first().clone(); } if((barray[0]['address_1'] == sarray[i]['address_1']) && (barray[0]['city'] == sarray[i]['city']) && @@ -459,35 +428,32 @@ html.find('input#szip').val(sarray[i]['postal_code']); if (i !== 0) { - // html.find(".schange").html("+ Add More Shipping Address - Remove "); - html.find(".schange").html("- Remove "); - html.insertAfter(".after-add-smore:last"); + html.find(".shipping-addr-div-change").html("+ Add More Shipping Address - Remove "); + html.insertAfter(".after-shipping-addr-add-more:last"); } - if (sarray.length == 1) { $(".schange").hide(); } j++; + toggleButtons(); } } else { - $(".sremove").hide(); - $(".add-smore").show(); + toggleButtons(); } - $("body").on("click", ".add-smore", function() { - var html = $(".after-add-smore").first().clone(); - var count = $(".after-add-smore").length; + $("body").on("click", ".shipping-addr-add-more", function() { + var html = $(".after-shipping-addr-add-more").first().clone(); + var count = $(".after-shipping-addr-add-more").length; html.find('select#scountry0').attr('id','scountry'+count).val('') html.find('select#sdstate0').attr('id','sdstate'+count).css("display", "none").val(''); html.find('input#sistate0').attr('id','sistate'+count).css("display", "block").val(''); html.find('input').val(''); // Clear input values in the cloned element - // html.find(".schange").html("+ Add More Shipping Address - Remove "); - html.find(".schange").html("- Remove "); - html.insertAfter(".after-add-smore:last"); + html.find(".shipping-addr-div-change").html("+ Add More Shipping Address - Remove "); + html.insertAfter(".after-shipping-addr-add-more:last"); toggleButtons(); }); - $("body").on("click", ".sremove", function() { - var rows = $(".after-add-smore"); + $("body").on("click", ".shipping-addr-remove", function() { + var rows = $(".after-shipping-addr-add-more"); if (rows.length > 1) { - $(this).parents(".after-add-smore").remove(); + $(this).parents(".after-shipping-addr-add-more").remove(); } else { alert("At least one Shipping Address must be displayed."); } @@ -495,14 +461,32 @@ }); function toggleButtons() { - var elementCount = $(".after-add-smore").length; + var elementCount = $(".after-shipping-addr-add-more").length; + console.log('elementCount == '+elementCount); if (elementCount > 1) { - $(".schange").show(); + $(".shipping-addr-remove").show(); // Show the "shipping-addr-remove" buttons } else { - $(".schange").hide(); + $(".shipping-addr-remove").hide(); // Hide the "shipping-addr-remove" buttons } + $(".after-shipping-addr-add-more .shipping-addr-add-more").hide(); + $(".after-shipping-addr-add-more:last .shipping-addr-add-more").show(); + } + $('#submit-button').click(function() { + // Disable the button + $(this).prop('disabled', true); + + // Change the button content to a spinner + $(this).html(' Loading...'); + + // Simulate a delay to demonstrate loading (you can replace this with your actual loading logic) + setTimeout(function() { + // Re-enable the button and restore the original text + $('#submit-button').prop('disabled', false); + $('#submit-button').html('Submit'); + }, 3000); // Replace 3000 with the actual loading time in milliseconds + }); }); function changeFields(element) { @@ -553,19 +537,4 @@ function validateEmail(email) { validationMessage.style.color = "red"; } } -// let clicked = false; -// function handleButtonClick() { -// if (!clicked) { // Check if the button hasn't been clicked before -// clicked = true; -// const requiredInputs = document.querySelectorAll('#myForm [required]'); -// for (let input of requiredInputs) { -// if (input.value.trim() === '') { -// alert('Please fill in all required fields.'); -// return false; // Prevent form submission -// } -// } -// document.getElementById("submitButton").disabled = true; -// // Add your code here to handle the first click action -// } -// } \ No newline at end of file diff --git a/app/Views/customer_group.php b/app/Views/customer_group.php index cb1df249..0cb0fe81 100644 --- a/app/Views/customer_group.php +++ b/app/Views/customer_group.php @@ -53,7 +53,7 @@ " class="edit-button" title="Edit" > - + " class="delete-button" title="Delete" > @@ -69,7 +69,7 @@