From 3842ee69797ec4d161a9d882cb3dc7a0f90a9a98 Mon Sep 17 00:00:00 2001 From: bitbucket Date: Thu, 22 Feb 2024 11:50:28 +0530 Subject: [PATCH] ss --- app/Controllers/Customer.php | 5 ++- app/Controllers/Invoice.php | 8 ++--- app/Models/NotificationModel.php | 7 ++-- app/Views/customer_form.php | 16 ++++----- app/Views/donations_accepted.php | 1 + app/Views/invoice_form.php | 57 +++++++++++++++++--------------- 6 files changed, 51 insertions(+), 43 deletions(-) diff --git a/app/Controllers/Customer.php b/app/Controllers/Customer.php index 79c28f9..8295e38 100644 --- a/app/Controllers/Customer.php +++ b/app/Controllers/Customer.php @@ -82,6 +82,7 @@ class Customer extends BaseController $session_role = get_user_role(); $model = new CustomerModel(); $dob = $this->request->getPost('dob'); + $pan = ($this->request->getPost('pan_no') == '') ? $this->request->getPost('o_pan_no') : $this->request->getPost('pan_no'); $dob = (isset($dob) && $dob != "") ? $dob : NULL ; $data = [ 'first_name' => $this->request->getPost('cfname'), @@ -89,7 +90,7 @@ class Customer extends BaseController 'mobile_no' => $this->request->getPost('cmobile'), 'email' => $this->request->getPost('cmail'), 'date_of_birth' => $dob, - 'pan_no' => $this->request->getPost('pan_no'), + 'pan_no' => $pan, 'adhar_no' => $this->request->getPost('adhar_no'), 'donor_type' => $this->request->getPost('DonorType'), @@ -405,6 +406,8 @@ class Customer extends BaseController case 'is not null': $conditionStrings[] = "$column IS NOT NULL"; break; + case '': + throw new \Exception("Data Not Found"); } } diff --git a/app/Controllers/Invoice.php b/app/Controllers/Invoice.php index 9503c95..f4c9483 100644 --- a/app/Controllers/Invoice.php +++ b/app/Controllers/Invoice.php @@ -107,7 +107,7 @@ class Invoice extends BaseController $upt_data = $model->updateData('donations_accepted', $data, $where); } } - session()->setFlashdata('success', 'Causes has been added successfully.'); + session()->setFlashdata('success', 'Data has been added successfully.'); return redirect()->route('donations_accepted'); } catch (\Throwable $e) @@ -139,7 +139,7 @@ class Invoice extends BaseController $data['currency'] = $setting_model->select('currency')->where($where)->findAll(); $data['customers'] = $model->getData('donor', $where); // $data['causes'] = $model->getData('causes', $where); - $data['causes'] = $bmodel->select('*')->where('business_id', (int)get_business_id() )->get()->getResult(); + $data['causes'] = $bmodel->select('*')->where('business_id', (int)get_business_id() )->where('isactive',1)->get()->getResult(); $data['campaign'] = $model->getData('campaign', $where); $data['invoice_number_formatting'] = $model->getData('settings', $where); @@ -197,7 +197,7 @@ class Invoice extends BaseController $this->AuditHistoryModel->save($audit_data); /************************************* */ - if($upt_data) echo true; + if($upt_data){ session()->setFlashdata('success', 'Data has been accepted successfully.');echo true; } else echo false; } @@ -230,7 +230,7 @@ class Invoice extends BaseController ]; $this->AuditHistoryModel->save($audit_data); /************************************* */ - + session()->setFlashdata('success', 'Data has been rejected successfully.'); return redirect()->route('receipt_list'); } diff --git a/app/Models/NotificationModel.php b/app/Models/NotificationModel.php index 38d0f88..1679c64 100644 --- a/app/Models/NotificationModel.php +++ b/app/Models/NotificationModel.php @@ -97,7 +97,7 @@ public function getCampaignDetails(){ $group_names = []; $group_query = []; foreach ($group_id as $j) { - $cg_data = $this->db->table('customer_groups as CG') + $cg_data = $this->db->table('donor_groups as CG') ->select('CG.group_id, CG.group_name,CG.group_query, CG.isactive') ->where(['CG.isactive' => 1, 'CG.group_id' => $j]) ->get() @@ -135,7 +135,8 @@ public function customerGroupQueryExecution($queries){ foreach ($results as $innerArray) { foreach ($innerArray as $customer) { - $customerId = $customer->customer_id; + // echo json_encode($customer);die; + $customerId = $customer->donor_id; // Check if the customer_id already exists in $uniqueCustomers if (!isset($uniqueCustomers[$customerId])) { @@ -160,7 +161,7 @@ public function customerGroupQueryExecution($queries){ { $db = \Config\Database::connect(); - $query = "SELECT * FROM customer_groups WHERE group_name = 'EXPIRYDATE'"; + $query = "SELECT * FROM donor_groups WHERE group_name = 'EXPIRYDATE'"; $result = $db->query($query)->getResultArray(); diff --git a/app/Views/customer_form.php b/app/Views/customer_form.php index 6748a5e..51e497c 100644 --- a/app/Views/customer_form.php +++ b/app/Views/customer_form.php @@ -47,7 +47,7 @@
- +
Please provide.
@@ -78,8 +78,8 @@
- - + +
@@ -115,13 +115,13 @@
- +
- +
- +
Please provide.
- +
diff --git a/app/Views/donations_accepted.php b/app/Views/donations_accepted.php index a729402..c440c6a 100644 --- a/app/Views/donations_accepted.php +++ b/app/Views/donations_accepted.php @@ -43,6 +43,7 @@ +
Please provide.
diff --git a/app/Views/invoice_form.php b/app/Views/invoice_form.php index d49a847..be34103 100644 --- a/app/Views/invoice_form.php +++ b/app/Views/invoice_form.php @@ -15,7 +15,7 @@
-
" id="myForm"> + " class="main-form" id="myForm">
@@ -47,7 +47,7 @@ - - - - - - + + + + + +
@@ -192,11 +192,30 @@ $(function() { $(function() { $('#form-submit').on('click', function(){ console.log('edakfibsefui'); - $('#submitBtn').click(); + // Disable the button to prevent multiple clicks + if ($('.myForm')[0].checkValidity()) { + this.disabled = true; + } + $('#submitBtn').click(); + // Perform any other actions (e.g., form submission) + // For example, you can use AJAX to submit the form data }); }); +$(function() { + $('#saveDraftButton').on('click', function(){ + // Check if the form is valid + if ($('.main-form')[0].checkValidity()) { + // Disable the button to prevent multiple clicks + $(this).prop('disabled', true); + + // Submit the form + $('.main-form').submit(); + } +}); + +}); // hide all fields for account login $(function() { @@ -231,23 +250,6 @@ $(function() { // }); } }); - -// $(document).ready(function(){ -// var invoiceNo = $("#invoiceNumber").val() -// if (invoiceNo != '') { -// $("#invoiceNumber").val(invoiceNo).prop("readonly", true); -// }else{ -// var final_sno = ""; - -// // console.log(final_sno); -// $("#invoiceNumber").val(final_sno).prop("readonly", true); -// } -// }); - function restriction(event) { var charCode = event.which || event.keyCode; if ((charCode >= 48 && charCode <= 57)) { @@ -298,7 +300,7 @@ $(document).ready(function(){