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();
|
$data = $spreadsheet->getActiveSheet()->toArray();
|
||||||
// Extract headers and data
|
// Extract headers and data
|
||||||
$headers = array_shift($data);
|
$headers = array_shift($data);
|
||||||
|
|
||||||
$nameIndex = array_search('Name', $headers);
|
$nameIndex = array_search('Name', $headers);
|
||||||
$panNoIndex = array_search('PAN No', $headers);
|
$panNoIndex = array_search('PAN No', $headers);
|
||||||
$emailIndex = array_search('Email', $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.";
|
echo "Required columns (Name, PAN No, Email, Mobile No) not found in the spreadsheet.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$groupedData = [];
|
$groupedData = [];
|
||||||
// Group data by the "Name" field
|
// Group data by the "Name" field
|
||||||
foreach ($data as $row) {
|
foreach ($data as $key => $row) {
|
||||||
$name = $row[$nameIndex];
|
$name = $row[$nameIndex];
|
||||||
$panNo = $row[$panNoIndex];
|
$panNo = $row[$panNoIndex];
|
||||||
$email = $row[$emailIndex];
|
$email = $row[$emailIndex];
|
||||||
@ -406,31 +408,34 @@ class ClientController extends BaseController
|
|||||||
case 'City':
|
case 'City':
|
||||||
$branch['city'] = $row[$index];
|
$branch['city'] = $row[$index];
|
||||||
break;
|
break;
|
||||||
default:
|
case 'Address':
|
||||||
$branch[$header] = $row[$index];
|
$branch['address'] = $row[$index];
|
||||||
break;
|
break;
|
||||||
|
// default:
|
||||||
|
// $branch[$header] = $row[$index];
|
||||||
|
// break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$groupedData[$name]['branches'][] = $branch;
|
$groupedData[$name]['branches'][] = $branch;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($groupedData as $key => $value) {
|
foreach ($groupedData as $key => $value) {
|
||||||
// print_r($value);
|
|
||||||
$created_by = $this->session->get('is_staff_logged_in');
|
$created_by = $this->session->get('is_staff_logged_in');
|
||||||
$branch_id = $this->session->get('logged_in_staff_branch_id');
|
// $branch_id = $this->session->get('logged_in_staff_branch_id');
|
||||||
$business= $this->BranchModel->select('*')
|
// $business= $this->BranchModel->select('*')
|
||||||
->join('business' , 'branches.business_id = business.business_id', 'left')
|
// ->join('business' , 'branches.business_id = business.business_id', 'left')
|
||||||
->where('branches.branch_id ',$branch_id)
|
// ->where('branches.branch_id ',$branch_id)
|
||||||
->first();
|
// ->first();
|
||||||
$business_id = $business['business_id'];
|
// $business_id = $business['business_id'];
|
||||||
$insertData = [
|
$insertData = [
|
||||||
"name" => $value['name'],
|
"name" => $value['name'],
|
||||||
"pan_no" => $value['pan_no'],
|
"pan_no" => $value['pan_no'],
|
||||||
"email" => $value['email'],
|
"email" => $value['email'],
|
||||||
"mobile_no" => $value['mobile_no'],
|
"mobile_no" => $value['mobile_no'],
|
||||||
"created_by" => $created_by,
|
"created_by" => $created_by,
|
||||||
"branch_id" => $branch_id,
|
|
||||||
"business_id" => $business_id
|
|
||||||
];
|
];
|
||||||
|
// print_r($insertData);die;
|
||||||
|
|
||||||
$client = $this->ClientModel->insert($insertData);
|
$client = $this->ClientModel->insert($insertData);
|
||||||
if($client){
|
if($client){
|
||||||
if($value['branches']){
|
if($value['branches']){
|
||||||
@ -446,6 +451,7 @@ class ClientController extends BaseController
|
|||||||
"state" => $branch['state'],
|
"state" => $branch['state'],
|
||||||
"city" => $branch['city'],
|
"city" => $branch['city'],
|
||||||
"pin_code" => $branch['pin_code'],
|
"pin_code" => $branch['pin_code'],
|
||||||
|
"address" => $branch['address'],
|
||||||
];
|
];
|
||||||
$clientBranch = $this->ClientBranchModel->insert($insertBranchData);
|
$clientBranch = $this->ClientBranchModel->insert($insertBranchData);
|
||||||
}
|
}
|
||||||
@ -459,6 +465,7 @@ class ClientController extends BaseController
|
|||||||
} else {
|
} else {
|
||||||
echo "No file uploaded.";
|
echo "No file uploaded.";
|
||||||
}
|
}
|
||||||
|
return ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -777,8 +777,7 @@ class MasterController extends BaseController
|
|||||||
$notificationHelper = new NotificationHelper();
|
$notificationHelper = new NotificationHelper();
|
||||||
$number = '91'.$clientData->mobile_no; // Replace with dynamic recipient number
|
$number = '91'.$clientData->mobile_no; // Replace with dynamic recipient number
|
||||||
if($clientData->whatsapp == 1){
|
if($clientData->whatsapp == 1){
|
||||||
|
$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." ;
|
||||||
$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." ;
|
|
||||||
// $notificationHelper->sendWhatsAppMessage($number, $whatsApp_message, $url);
|
// $notificationHelper->sendWhatsAppMessage($number, $whatsApp_message, $url);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -830,7 +829,7 @@ class MasterController extends BaseController
|
|||||||
$notificationHelper = new NotificationHelper();
|
$notificationHelper = new NotificationHelper();
|
||||||
$number = '91'.$clientData->mobile_no; // Replace with dynamic recipient number
|
$number = '91'.$clientData->mobile_no; // Replace with dynamic recipient number
|
||||||
if($clientData->whatsapp == 1){
|
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);
|
//$notificationHelper->sendWhatsAppMessage($number, $whatsApp_message, $url);
|
||||||
}
|
}
|
||||||
return $this->respond(['success' => true, 'data' => 'Remember Send Successfully']);
|
return $this->respond(['success' => true, 'data' => 'Remember Send Successfully']);
|
||||||
|
|||||||
@ -89,8 +89,9 @@ class NotificationHelper
|
|||||||
$senderId = getenv('SENDER_ID');
|
$senderId = getenv('SENDER_ID');
|
||||||
if($message_type_name == 'doc_verify')
|
if($message_type_name == 'doc_verify')
|
||||||
{
|
{
|
||||||
|
$client_name = $client_full_data['client_name'];
|
||||||
$message = 'Dear '. $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';
|
'. $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
|
$serviceName = getenv('SERVICE_NAME'); // Service name
|
||||||
|
|||||||
@ -11,7 +11,11 @@
|
|||||||
<div class="content-page">
|
<div class="content-page">
|
||||||
<!-- Start Content-->
|
<!-- Start Content-->
|
||||||
<div class="container-fluid">
|
<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 -->
|
<!-- start page title -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
@ -486,7 +490,8 @@
|
|||||||
if (fileInput) {
|
if (fileInput) {
|
||||||
fileInput.addEventListener('change', function(event) {
|
fileInput.addEventListener('change', function(event) {
|
||||||
console.log('File input change event triggered');
|
console.log('File input change event triggered');
|
||||||
|
// $('.loader').fadeIn();
|
||||||
|
// $('.loader-mask').fadeIn();
|
||||||
const file = event.target.files[0];
|
const file = event.target.files[0];
|
||||||
if (file) {
|
if (file) {
|
||||||
var url = '<?= base_url("client_upload"); ?>';
|
var url = '<?= base_url("client_upload"); ?>';
|
||||||
@ -500,6 +505,8 @@
|
|||||||
processData: false,
|
processData: false,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
|
// $('.loader').fadeOut();
|
||||||
|
// $('.loader-mask').fadeOut('slow');
|
||||||
console.log(response);
|
console.log(response);
|
||||||
if(response == true){
|
if(response == true){
|
||||||
toastr.success( 'Clients and Branches Added SuccessFully');
|
toastr.success( 'Clients and Branches Added SuccessFully');
|
||||||
@ -507,6 +514,7 @@
|
|||||||
window.location.reload();
|
window.location.reload();
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
|
|
||||||
// Handle error response here
|
// Handle error response here
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user