diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index ef10a13..54bc4aa 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -354,6 +354,7 @@ class ClientController extends BaseController $data = $spreadsheet->getActiveSheet()->toArray(); // Extract headers and data $headers = array_shift($data); + $nameIndex = array_search('Name', $headers); $panNoIndex = array_search('PAN No', $headers); $emailIndex = array_search('Email', $headers); @@ -362,9 +363,10 @@ class ClientController extends BaseController echo "Required columns (Name, PAN No, Email, Mobile No) not found in the spreadsheet."; return; } + $groupedData = []; // Group data by the "Name" field - foreach ($data as $row) { + foreach ($data as $key => $row) { $name = $row[$nameIndex]; $panNo = $row[$panNoIndex]; $email = $row[$emailIndex]; @@ -406,31 +408,34 @@ class ClientController extends BaseController case 'City': $branch['city'] = $row[$index]; break; - default: - $branch[$header] = $row[$index]; + case 'Address': + $branch['address'] = $row[$index]; break; + // default: + // $branch[$header] = $row[$index]; + // break; } } $groupedData[$name]['branches'][] = $branch; } + foreach ($groupedData as $key => $value) { - // print_r($value); $created_by = $this->session->get('is_staff_logged_in'); - $branch_id = $this->session->get('logged_in_staff_branch_id'); - $business= $this->BranchModel->select('*') - ->join('business' , 'branches.business_id = business.business_id', 'left') - ->where('branches.branch_id ',$branch_id) - ->first(); - $business_id = $business['business_id']; + // $branch_id = $this->session->get('logged_in_staff_branch_id'); + // $business= $this->BranchModel->select('*') + // ->join('business' , 'branches.business_id = business.business_id', 'left') + // ->where('branches.branch_id ',$branch_id) + // ->first(); + // $business_id = $business['business_id']; $insertData = [ "name" => $value['name'], "pan_no" => $value['pan_no'], "email" => $value['email'], "mobile_no" => $value['mobile_no'], "created_by" => $created_by, - "branch_id" => $branch_id, - "business_id" => $business_id ]; + // print_r($insertData);die; + $client = $this->ClientModel->insert($insertData); if($client){ if($value['branches']){ @@ -446,6 +451,7 @@ class ClientController extends BaseController "state" => $branch['state'], "city" => $branch['city'], "pin_code" => $branch['pin_code'], + "address" => $branch['address'], ]; $clientBranch = $this->ClientBranchModel->insert($insertBranchData); } @@ -459,6 +465,7 @@ class ClientController extends BaseController } else { echo "No file uploaded."; } + return ; } } diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index 486d675..408b7f0 100644 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -777,8 +777,7 @@ class MasterController extends BaseController $notificationHelper = new NotificationHelper(); $number = '91'.$clientData->mobile_no; // Replace with dynamic recipient number if($clientData->whatsapp == 1){ - - $whatsApp_message = "Dear " . $clientData->client_name . "," . $businessData->business_name . " has requested your approval for a document. Please click the link below to preview and approve." ; + $whatsApp_message = "Dear " . substr($clientData->client_name, 0, 20) . "," . $businessData->business_name . " has requested your approval for a document. Please click the link below to preview and approve." ; // $notificationHelper->sendWhatsAppMessage($number, $whatsApp_message, $url); } @@ -830,7 +829,7 @@ class MasterController extends BaseController $notificationHelper = new NotificationHelper(); $number = '91'.$clientData->mobile_no; // Replace with dynamic recipient number if($clientData->whatsapp == 1){ - $whatsApp_message = "Dear " . $clientData->client_name . "," . $businessData->business_name . " has requested your approval for a document. Please click the link below to preview and approve." ; + $whatsApp_message = "Dear " . substr($clientData->client_name, 0, 20) . "," . $businessData->business_name . " has requested your approval for a document. Please click the link below to preview and approve." ; //$notificationHelper->sendWhatsAppMessage($number, $whatsApp_message, $url); } return $this->respond(['success' => true, 'data' => 'Remember Send Successfully']); diff --git a/app/Helpers/NotificationHelper.php b/app/Helpers/NotificationHelper.php index 06bad1a..83894c5 100644 --- a/app/Helpers/NotificationHelper.php +++ b/app/Helpers/NotificationHelper.php @@ -89,8 +89,9 @@ class NotificationHelper $senderId = getenv('SENDER_ID'); if($message_type_name == 'doc_verify') { - - $message = 'Dear '. $client_full_data['client_name'] .', + $client_name = $client_full_data['client_name']; + + $message = 'Dear '. substr($client_name, 0, 20) .', '. $otp .' is OTP to approve '. $client_full_data['group_name'] .' for '. $client_full_data['service_name'] .' purposes. -L D RAJ AND CO'; } $serviceName = getenv('SERVICE_NAME'); // Service name diff --git a/app/Views/client_list.php b/app/Views/client_list.php index f44915a..99e642b 100644 --- a/app/Views/client_list.php +++ b/app/Views/client_list.php @@ -11,7 +11,11 @@
- +
@@ -486,7 +490,8 @@ if (fileInput) { fileInput.addEventListener('change', function(event) { console.log('File input change event triggered'); - + // $('.loader').fadeIn(); + // $('.loader-mask').fadeIn(); const file = event.target.files[0]; if (file) { var url = ''; @@ -500,6 +505,8 @@ processData: false, contentType: false, success: function(response) { + // $('.loader').fadeOut(); + // $('.loader-mask').fadeOut('slow'); console.log(response); if(response == true){ toastr.success( 'Clients and Branches Added SuccessFully'); @@ -507,6 +514,7 @@ window.location.reload(); }, error: function(xhr, status, error) { + // Handle error response here console.error(xhr.responseText); }