CHANGE_CLIENT_FILE_UPLOAD : AADHAVAN
This commit is contained in:
parent
731568ac44
commit
d25bacfcad
@ -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 ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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']);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -11,7 +11,11 @@
|
||||
<div class="content-page">
|
||||
<!-- Start Content-->
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="loader-mask modal-loader-mask" style="display:none;">
|
||||
<div class="loader modal-loader" style="display:none;">
|
||||
Please Wait <img src="<?= base_url() . "public" ?>/assets/images/simple_loader.gif" height="30" width="30" alt="Loading...">
|
||||
</div>
|
||||
</div>
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@ -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 = '<?= base_url("client_upload"); ?>';
|
||||
@ -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);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user