CHANGE_Post_app_having_pre_branch_id - VADIVEL J 2025-09-10
This commit is contained in:
commit
ab7bccca6c
@ -101,6 +101,6 @@ class Autoload extends AutoloadConfig
|
|||||||
* @phpstan-var list<string>
|
* @phpstan-var list<string>
|
||||||
*/
|
*/
|
||||||
public $helpers = ['uuid','session','utility', 'form', 'url', 'oauth', 'fileupload',
|
public $helpers = ['uuid','session','utility', 'form', 'url', 'oauth', 'fileupload',
|
||||||
'excel_import_export', 'file', 'drive','ExcelSanitizeHelper', 'api_helper','exception'
|
'excel_import_export', 'file', 'drive','ExcelSanitizeHelper', 'api_helper','exception','sms_helper'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,11 +90,13 @@ $routes->group("/dashboard", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->group("/client", ["filter" => "authMVC"], function ($routes) {
|
$routes->group("/client", ["filter" => "authMVC"], function ($routes) {
|
||||||
|
|
||||||
$routes->get("list", "ClientController::index");
|
$routes->get("list", "ClientController::index");
|
||||||
|
$routes->get("type/(:any)", "ClientController::type/$1");
|
||||||
$routes->get("create", "ClientController::clientOnboarding");
|
$routes->get("create", "ClientController::clientOnboarding");
|
||||||
$routes->get('deposit/(:num)', 'ClientController::deposit/$1');
|
$routes->get('deposit/(:num)', 'ClientController::deposit/$1');
|
||||||
$routes->get('remove/(:num)', 'ClientController::removeClient/$1');
|
$routes->get('remove/(:num)', 'ClientController::removeClient/$1');
|
||||||
$routes->get("list/(:any)", "ClientController::editClientOnboarding/$1");
|
$routes->get("list/(:any)", "ClientController::editClientOnboarding/$1");
|
||||||
$routes->post('wipe', 'ClientController::wipeDemoClient');
|
$routes->post('wipe', 'ClientController::wipeDemoClient');
|
||||||
|
$routes->get("typeList/(:any)", "ClientController::typeList/$1");
|
||||||
|
|
||||||
// application/config/routes.php
|
// application/config/routes.php
|
||||||
|
|
||||||
@ -388,6 +390,10 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->get("download_claim_dump_file/(:any)", "TicketController::downloadClaimDumpFile/$1");
|
$routes->get("download_claim_dump_file/(:any)", "TicketController::downloadClaimDumpFile/$1");
|
||||||
$routes->post('uploadMultiFileFromRfq', 'LeadsController::uploadMultiFileFromRfq');
|
$routes->post('uploadMultiFileFromRfq', 'LeadsController::uploadMultiFileFromRfq');
|
||||||
$routes->get('downloadMemberFile/(:any)', 'LeadsController::downloadMemberFile/$1');
|
$routes->get('downloadMemberFile/(:any)', 'LeadsController::downloadMemberFile/$1');
|
||||||
|
$routes->get('downloadFullMemberDataExcelErrorFile/(:any)', 'LeadsController::downloadFullMemberDataExcelErrorFile/$1');
|
||||||
|
$routes->get('getMemberDataExcelFileErrors', 'LeadsController::getMemberDataExcelFileErrors');
|
||||||
|
$routes->post('savePlacementDataAndValidateMemberDataFile', 'LeadsController::savePlacementDataAndValidateMemberDataFile');
|
||||||
|
$routes->get('checkMemberDataFileValidationStatus', 'LeadsController::checkMemberDataFileValidationStatus');
|
||||||
});
|
});
|
||||||
|
|
||||||
$routes->post("policy_tranction/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail");
|
$routes->post("policy_tranction/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail");
|
||||||
@ -701,6 +707,8 @@ $routes->group('test', function($routes) {
|
|||||||
$routes->get('exportexcel', 'TestingController::exportExcel');
|
$routes->get('exportexcel', 'TestingController::exportExcel');
|
||||||
$routes->post('saverfq', 'TestingController::saverfq');
|
$routes->post('saverfq', 'TestingController::saverfq');
|
||||||
$routes->get('mapping_client_id_and_branch_id','TestingController::mapping_client_id_and_branch_id');
|
$routes->get('mapping_client_id_and_branch_id','TestingController::mapping_client_id_and_branch_id');
|
||||||
|
$routes->get('membervalidation', 'TestingController::membervalidation');
|
||||||
|
$routes->get('generateExcel', 'TestingController::generateExcel');
|
||||||
});
|
});
|
||||||
$routes->cli('cli/testcli', 'TestingController::testcli');
|
$routes->cli('cli/testcli', 'TestingController::testcli');
|
||||||
|
|
||||||
|
|||||||
@ -14,11 +14,63 @@ class EcardDownloadConversation extends Conversation
|
|||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
$this->bot->types();
|
$this->bot->types();
|
||||||
sleep(0.5);
|
// sleep(0.5);
|
||||||
$this->showEcardMenu();
|
$this->showEcardMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function showEcardMenu()
|
protected function showEcardMenu()
|
||||||
|
{
|
||||||
|
// Log entry for debugging
|
||||||
|
log_message('error', 'showEcardMenu function called');
|
||||||
|
|
||||||
|
|
||||||
|
// Get chat session and policies
|
||||||
|
$chat_session_info = get_chatbot_session_info();
|
||||||
|
$policy_list = ChatbotHelper::getListOfPolicies($chat_session_info);
|
||||||
|
|
||||||
|
// If policies found, build an HTML list of links (and raw URLs as fallback)
|
||||||
|
if (is_array($policy_list) && count($policy_list)) {
|
||||||
|
$parts = [];
|
||||||
|
foreach ($policy_list as $policy) {
|
||||||
|
// Resolve rand string (defensive)
|
||||||
|
$randString = '';
|
||||||
|
if (isset($policy['rand_string']) && $policy['rand_string'] !== '') {
|
||||||
|
$randString = $policy['rand_string'];
|
||||||
|
} elseif (isset($policy['rand']) && $policy['rand'] !== '') {
|
||||||
|
$randString = $policy['rand'];
|
||||||
|
} elseif (isset($policy['emp_policy_id'])) {
|
||||||
|
// As a last resort, use emp_policy_id (not ideal but prevents broken links)
|
||||||
|
$randString = $policy['emp_policy_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build link; make sure base_url produces correct path
|
||||||
|
$link = base_url('/download-e-card/' . $randString . '/1');
|
||||||
|
|
||||||
|
// Escape policy name to avoid HTML injection
|
||||||
|
$safeName = isset($policy['policy_name']) ? htmlspecialchars($policy['policy_name'], ENT_QUOTES, 'UTF-8') : 'Policy';
|
||||||
|
|
||||||
|
// Add to parts; include anchor and raw URL fallback
|
||||||
|
$parts[] = "🔹 <a href=\"{$link}\" target=\"_blank\">{$safeName}</a><br>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$message = "Choose a policy to download (click the policy name below):<br><br>" . implode('<br><br>', $parts);
|
||||||
|
log_message('error', 'Ecard links displayed: ' . json_encode(array_column($policy_list, 'policy_name')));
|
||||||
|
$this->say($message);
|
||||||
|
} else {
|
||||||
|
log_message('error', 'No policies found for ecard download');
|
||||||
|
$this->say('No policy found.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// After showing links, move to confirmation conversation (Do you want to continue?)
|
||||||
|
// This keeps the UX identical to previous flow where we asked the user if they want to continue.
|
||||||
|
$this->bot->startConversation(new doYouWantToContinueConversation());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected function showEcardMenuOLD()
|
||||||
{
|
{
|
||||||
log_message('error', ('showEcardMenu function called'));
|
log_message('error', ('showEcardMenu function called'));
|
||||||
|
|
||||||
@ -27,17 +79,13 @@ class EcardDownloadConversation extends Conversation
|
|||||||
$buttons = [];
|
$buttons = [];
|
||||||
|
|
||||||
$question = 'Choose Policy to Download Ecard:';
|
$question = 'Choose Policy to Download Ecard:';
|
||||||
// log_message('error', ('policy_list : ' . json_encode($policy_list)));
|
log_message('error', ('policy_list : ' . json_encode($policy_list)));
|
||||||
|
|
||||||
if(is_array($policy_list) && count($policy_list))
|
if(is_array($policy_list) && count($policy_list))
|
||||||
{
|
{
|
||||||
foreach($policy_list as $policy)
|
foreach($policy_list as $policy)
|
||||||
{
|
{
|
||||||
// $question = Question::create("Choose Policy to Download Ecard:")
|
|
||||||
// ->addButtons([
|
|
||||||
// Button::create("🔹 $policy['policy_name']")->value("$policy['emp_policy_id']"),
|
|
||||||
// Button::create("◀️ Go Back")->value("go_back"),
|
|
||||||
// ]);
|
|
||||||
$this->buttonsData[$policy['emp_policy_id'].'#'.$policy['rand_string']] = ['response_text' => "🔹 {$policy['policy_name']}"] ;
|
$this->buttonsData[$policy['emp_policy_id'].'#'.$policy['rand_string']] = ['response_text' => "🔹 {$policy['policy_name']}"] ;
|
||||||
$buttons[] = Button::create("{$policy['policy_name']}")->value($policy['emp_policy_id'].'#'.$policy['rand_string']);
|
$buttons[] = Button::create("{$policy['policy_name']}")->value($policy['emp_policy_id'].'#'.$policy['rand_string']);
|
||||||
}
|
}
|
||||||
@ -63,10 +111,9 @@ class EcardDownloadConversation extends Conversation
|
|||||||
case is_string($answer->getValue()) && is_array(explode('#',$answer->getValue())) && count((explode('#',$answer->getValue()))) == 2:
|
case is_string($answer->getValue()) && is_array(explode('#',$answer->getValue())) && count((explode('#',$answer->getValue()))) == 2:
|
||||||
|
|
||||||
$link = base_url().'/download-e-card/' . explode('#',$answer->getValue())[1].'/1';
|
$link = base_url().'/download-e-card/' . explode('#',$answer->getValue())[1].'/1';
|
||||||
$this->say('Click here to downlad: <a href="'.$link.'" target="_blank">Ecard</a>');
|
log_message('error', $link);
|
||||||
|
$this->say('Click here to downlad: <a href="'.$link.'" target="_blank">GMC</a><br>Click here to downlad: <a href="'.$link.'" target="_blank">GMC Parent</a>');
|
||||||
$this->bot->startConversation(new doYouWantToContinueConversation()); // ✅ Restart the
|
$this->bot->startConversation(new doYouWantToContinueConversation()); // ✅ Restart the
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -76,4 +123,7 @@ class EcardDownloadConversation extends Conversation
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,7 @@ class MainMenuConversation extends Conversation
|
|||||||
{
|
{
|
||||||
$this->bot->userStorage()->delete();
|
$this->bot->userStorage()->delete();
|
||||||
$this->bot->types(); // Typing indicator for the first message
|
$this->bot->types(); // Typing indicator for the first message
|
||||||
sleep(0.5); // Delay
|
// sleep(0.5); // Delay
|
||||||
$this->showMainMenu();
|
$this->showMainMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,11 +16,11 @@ class NetworkHospitalConversation extends Conversation
|
|||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
$this->bot->types(); // Typing indicator for the first message
|
$this->bot->types(); // Typing indicator for the first message
|
||||||
sleep(0.5); // Delay
|
// sleep(0.5); // Delay
|
||||||
$this->showHospitalMenu();
|
$this->showHospitalMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function showHospitalMenu()
|
protected function showHospitalMenuOLD()
|
||||||
{
|
{
|
||||||
$chat_session_info = get_chatbot_session_info();
|
$chat_session_info = get_chatbot_session_info();
|
||||||
$policy_list = ChatbotHelper::getListOfPolicies($chat_session_info);
|
$policy_list = ChatbotHelper::getListOfPolicies($chat_session_info);
|
||||||
@ -92,4 +92,54 @@ class NetworkHospitalConversation extends Conversation
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function showHospitalMenu()
|
||||||
|
{
|
||||||
|
log_message('error', 'showHospitalMenu function called');
|
||||||
|
|
||||||
|
|
||||||
|
// Get chat session and policies
|
||||||
|
$chat_session_info = get_chatbot_session_info();
|
||||||
|
$policy_list = ChatbotHelper::getListOfPolicies($chat_session_info);
|
||||||
|
|
||||||
|
if (is_array($policy_list) && count($policy_list)) {
|
||||||
|
$parts = [];
|
||||||
|
foreach ($policy_list as $policy) {
|
||||||
|
// Resolve rand string (defensive)
|
||||||
|
$randString = '';
|
||||||
|
if (isset($policy['rand_string']) && $policy['rand_string'] !== '') {
|
||||||
|
$randString = $policy['rand_string'];
|
||||||
|
} elseif (isset($policy['rand']) && $policy['rand'] !== '') {
|
||||||
|
$randString = $policy['rand'];
|
||||||
|
} elseif (isset($policy['emp_policy_id'])) {
|
||||||
|
$randString = $policy['emp_policy_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$emp_policy_id = isset($policy['emp_policy_id']) ? $policy['emp_policy_id'] : '';
|
||||||
|
$hospital_link = ChatbotHelper::getHospitalLink($emp_policy_id);
|
||||||
|
|
||||||
|
$safeName = isset($policy['policy_name']) ? htmlspecialchars($policy['policy_name'], ENT_QUOTES, 'UTF-8') : 'Policy';
|
||||||
|
|
||||||
|
if ($hospital_link) {
|
||||||
|
$parts[] = "🔹 <a href=\"{$hospital_link}\" target=\"_blank\">{$safeName}</a><br>";
|
||||||
|
} else {
|
||||||
|
$parts[] = "🔹 {$safeName} — No Data found, please contact support team";
|
||||||
|
}
|
||||||
|
|
||||||
|
log_message('error', 'Hospital link for policy ' . $emp_policy_id . ': ' . $hospital_link);
|
||||||
|
}
|
||||||
|
|
||||||
|
$message = "Access hospital details for your policies below:<br><br>" . implode('<br><br>', $parts);
|
||||||
|
$this->say($message);
|
||||||
|
} else {
|
||||||
|
log_message('error', 'No policies found for hospital menu');
|
||||||
|
$this->say('No policy found.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// After showing links, move to confirmation conversation
|
||||||
|
$this->bot->startConversation(new doYouWantToContinueConversation());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -111,7 +111,7 @@ class ChatbotControllerNew extends BaseController
|
|||||||
log_message("error","Inside Bot Type Function");
|
log_message("error","Inside Bot Type Function");
|
||||||
|
|
||||||
$bot->types(); // Typing indicator for the first message
|
$bot->types(); // Typing indicator for the first message
|
||||||
sleep(0.1); // Delay
|
// sleep(0.5); // Delay
|
||||||
});
|
});
|
||||||
// Start the Main Menu when user says "hi" or "start"
|
// Start the Main Menu when user says "hi" or "start"
|
||||||
$this->botman->hears('start|hi|hello|help|help me', function (BotMan $bot) {
|
$this->botman->hears('start|hi|hello|help|help me', function (BotMan $bot) {
|
||||||
|
|||||||
@ -471,7 +471,7 @@ class ClientController extends AdminController
|
|||||||
$this->myLogger->logme('error', 'Client list function called');
|
$this->myLogger->logme('error', 'Client list function called');
|
||||||
$headerData['tab_name'] = 'Client List';
|
$headerData['tab_name'] = 'Client List';
|
||||||
$headerData['page_name'] = 'Clients'; // Both Browser Tab name And Page name are same.
|
$headerData['page_name'] = 'Clients'; // Both Browser Tab name And Page name are same.
|
||||||
$data['clientList'] = $this->clientModel->getCreatedByUserName();
|
$data['clientList'] = $this->clientModel->getCreatedByUserName(1); // passing client_type
|
||||||
$data['client_rm'] = $this->clientRMModel->getAllClientRM();
|
$data['client_rm'] = $this->clientRMModel->getAllClientRM();
|
||||||
$data['lead_data'] = $this->leadsModel->getLeadForInsertClientList();
|
$data['lead_data'] = $this->leadsModel->getLeadForInsertClientList();
|
||||||
|
|
||||||
@ -484,6 +484,29 @@ class ClientController extends AdminController
|
|||||||
// $this->loadLayout('client_onboarding', $data);
|
// $this->loadLayout('client_onboarding', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function typeList($id = null)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$data = $this->clientModel->getCreatedByUserName($id); // passing client_type
|
||||||
|
if (empty($data)) {
|
||||||
|
return $this->response
|
||||||
|
->setJSON(['status' => 'error', 'message' => 'No Records found'])
|
||||||
|
->setStatusCode(404);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->response
|
||||||
|
->setJSON(['status' => 'success', 'data' => $data])
|
||||||
|
->setStatusCode(200);
|
||||||
|
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
return $this->response
|
||||||
|
->setJSON(['status' => 'error', 'message' => $e->getMessage()])
|
||||||
|
->setStatusCode(500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function updateEmpAndPolicyStatus()
|
public function updateEmpAndPolicyStatus()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@ -67,24 +67,57 @@ class ICICILombardController extends AdminController
|
|||||||
|
|
||||||
|
|
||||||
//Prepare body data
|
//Prepare body data
|
||||||
$db = \Config\Database::connect();
|
// $db = \Config\Database::connect();
|
||||||
$data = $db->table('employee_polices ep')
|
// $data = $db->table('employee_polices ep')
|
||||||
->select('cp.policy_no as policyNumber, cp.cd_ac_no as CDBGAccountNumber,
|
// ->select('cp.policy_no as policyNumber, cp.cd_ac_no as CDBGAccountNumber,
|
||||||
e.id,e.emp_code as MemberEmpId, e.doj as DOJ, e.name as InsuredName, e.dob as DOB, e.relationship as Relationship,
|
// e.id,e.emp_code as MemberEmpId, e.doj as DOJ, e.name as InsuredName, e.dob as DOB, e.relationship as Relationship,
|
||||||
e.gender as Gender, ep.date_coverage as DOC,ep.basic_cover_si as SumInsured, e.email_corporate as EmailId
|
// e.gender as Gender, ep.date_coverage as DOC,ep.basic_cover_si as SumInsured, e.email_corporate as EmailId
|
||||||
')
|
// ')
|
||||||
->join('employees e', 'e.id = ep.employee_id')
|
// ->join('employees e', 'e.id = ep.employee_id')
|
||||||
->join('client_policy cp', 'ep.client_policy_id = cp.id')
|
// ->join('client_policy cp', 'ep.client_policy_id = cp.id')
|
||||||
->where('ep.client_policy_id', $policy_id)
|
// ->where('ep.client_policy_id', $policy_id)
|
||||||
->where('ep.status', 'active')
|
// ->where('ep.status', 'active')
|
||||||
->where('ep.is_active', 1)
|
// ->where('ep.is_active', 1)
|
||||||
// ->where('ep.uhid', null)
|
// // ->where('ep.uhid', null)
|
||||||
->get()
|
// ->get()
|
||||||
->getResultArray();
|
// ->getResultArray();
|
||||||
|
|
||||||
$body = $this->formatPolicyData($data);
|
// $body = $this->formatPolicyData($data);
|
||||||
// dd($body);
|
// dd($body);
|
||||||
|
|
||||||
|
|
||||||
|
$body = [
|
||||||
|
"PolicyNumber" => "4016/A/O/53130557/00/000",
|
||||||
|
"CDBGAccountNumber" => "CD-MUM-0026",
|
||||||
|
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440010",
|
||||||
|
"MemberDetails" => [
|
||||||
|
[
|
||||||
|
"MemberEmpId" => "EMPID3625557",
|
||||||
|
"DOJ" => "21-MAR-2019",
|
||||||
|
"InsuredName" => "Kumar",
|
||||||
|
"DOB" => "7-JUL-1983",
|
||||||
|
"Relationship" => "SELF",
|
||||||
|
"Gender" => "MALE",
|
||||||
|
"DOC" => "05-SEP-2025",
|
||||||
|
"SumInsured" => "400000",
|
||||||
|
"EmailId" => "KUMAR@GMAIL.COM",
|
||||||
|
"FlagStatus" => "A"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"MemberEmpId" => "EMPID3625557",
|
||||||
|
"DOJ" => "21-MAR-2019",
|
||||||
|
"InsuredName" => "Saranya",
|
||||||
|
"DOB" => "8-AUG-1970",
|
||||||
|
"Relationship" => "MOTHER",
|
||||||
|
"Gender" => "FEMALE",
|
||||||
|
"DOC" => "05-SEP-2025",
|
||||||
|
"SumInsured" => "400000",
|
||||||
|
"EmailId" => "Saranya@GMAIL.COM",
|
||||||
|
"FlagStatus" => "A"
|
||||||
|
],
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
$response = call_third_party_api($url, 'POST', $headers, $body, true); // true = raw body mode
|
$response = call_third_party_api($url, 'POST', $headers, $body, true); // true = raw body mode
|
||||||
// print_rr(json_encode($response));die();
|
// print_rr(json_encode($response));die();
|
||||||
return $this->response->setJSON($response);
|
return $this->response->setJSON($response);
|
||||||
@ -115,9 +148,9 @@ class ICICILombardController extends AdminController
|
|||||||
// dd($headers);
|
// dd($headers);
|
||||||
|
|
||||||
$body = [
|
$body = [
|
||||||
"PolicyNumber" => "4016/A/O/53077718/00/000",
|
"PolicyNumber" => "4016/A/O/53130557/00/000",
|
||||||
"BatchId" => "3646145",
|
"BatchId" => "3658147",
|
||||||
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440001"
|
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440010"
|
||||||
];
|
];
|
||||||
|
|
||||||
$response = call_third_party_api($url, 'POST', $headers, $body, true);
|
$response = call_third_party_api($url, 'POST', $headers, $body, true);
|
||||||
|
|||||||
@ -167,6 +167,10 @@ class JobWorker extends AdminController
|
|||||||
'type' => 'CC', // Handler Category
|
'type' => 'CC', // Handler Category
|
||||||
'handler' => 'App\Controllers\EmployeeMultiEventServiceController',
|
'handler' => 'App\Controllers\EmployeeMultiEventServiceController',
|
||||||
],
|
],
|
||||||
|
'memberDataListExcelFileFormatValidation' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\LeadsController',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -79,10 +79,6 @@ class RestAuthenticationController extends AdminController
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function verifyEmployeeWithMobileNumber()
|
public function verifyEmployeeWithMobileNumber()
|
||||||
{
|
{
|
||||||
log_message('error', ' ');
|
log_message('error', ' ');
|
||||||
@ -93,6 +89,7 @@ class RestAuthenticationController extends AdminController
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
$mobile_number = $this->request->getJSON()->mobile_number;
|
||||||
|
$otp = $this->request->getJSON()->otp;
|
||||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: Received mobile_number = " . $mobile_number);
|
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: Received mobile_number = " . $mobile_number);
|
||||||
|
|
||||||
|
|
||||||
@ -112,12 +109,49 @@ class RestAuthenticationController extends AdminController
|
|||||||
|
|
||||||
if (isset($employeeData['employee_id']))
|
if (isset($employeeData['employee_id']))
|
||||||
{
|
{
|
||||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: Employee found: employee_id = " . $employeeData['employee_id']);
|
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: Employee verified with ID = " . $employeeData['employee_id']);
|
||||||
log_message('error', ' ');
|
log_message('error', ' ');
|
||||||
log_message('error', ' ************************************* POST END **************************************** ');
|
log_message('error', '************************ POST END ********************************');
|
||||||
log_message('error', ' ');
|
|
||||||
$result = ['user_verification' => true ,'message' => "Verified Successfully"];
|
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
$sql = "
|
||||||
|
UPDATE employees
|
||||||
|
INNER JOIN employee_polices ON employee_polices.employee_id = employees.id
|
||||||
|
SET employees.otp = ?
|
||||||
|
WHERE employees.id = ?
|
||||||
|
AND employees.relationship = 'self'
|
||||||
|
AND employees.is_active = 1
|
||||||
|
AND employee_polices.is_active = 1
|
||||||
|
AND employee_polices.status IN ('active')
|
||||||
|
";
|
||||||
|
|
||||||
|
$db = db_connect();
|
||||||
|
$update = $db->query($sql, [$otp, $employeeData['employee_id']]);
|
||||||
|
|
||||||
|
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: OTP update query executed. SQL = " . $db->getLastQuery());
|
||||||
|
|
||||||
|
if($update)
|
||||||
|
{
|
||||||
|
//send sms
|
||||||
|
$SMSResult = sendOtpSms($mobile_number, $otp);
|
||||||
|
if ($SMSResult['status'] == 'success')
|
||||||
|
{
|
||||||
|
$result = ['user_verification' => true ,'message' => "Verified Successfully" ];
|
||||||
|
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||||
|
}else{
|
||||||
|
$result = ['user_verification' => false, 'message' => "SMS sending failed , try again"];
|
||||||
|
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: OTP update query Failed. SQL = " . $db->getLastQuery());
|
||||||
|
|
||||||
|
$result = ['user_verification' => false, 'message' => "Try again. , try again"];
|
||||||
|
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: No matching employee found");
|
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: No matching employee found");
|
||||||
log_message('error', ' ');
|
log_message('error', ' ');
|
||||||
@ -148,6 +182,7 @@ class RestAuthenticationController extends AdminController
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
$email = $this->request->getJSON()->email;
|
$email = $this->request->getJSON()->email;
|
||||||
|
$otp = $this->request->getJSON()->otp;
|
||||||
$client_id = $this->request->getJSON()->client_id ?? null;
|
$client_id = $this->request->getJSON()->client_id ?? null;
|
||||||
|
|
||||||
|
|
||||||
@ -181,11 +216,6 @@ class RestAuthenticationController extends AdminController
|
|||||||
|
|
||||||
if (isset($employeeData['employee_id'])) {
|
if (isset($employeeData['employee_id'])) {
|
||||||
|
|
||||||
$otp = random_int(100000, 999999);
|
|
||||||
|
|
||||||
// $update = $this->employeeModel->where('email_corporate', $email)->where('relationship', 'Self')
|
|
||||||
// ->where('is_active', 1)->set(array('otp' => $otp))
|
|
||||||
// ->update();
|
|
||||||
|
|
||||||
$builder = $this->employeeModel
|
$builder = $this->employeeModel
|
||||||
->where('email_corporate', $email)
|
->where('email_corporate', $email)
|
||||||
@ -265,24 +295,23 @@ class RestAuthenticationController extends AdminController
|
|||||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateEmpOTP: Received payload = " . json_encode($this->request->getJSON() ?? []));
|
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateEmpOTP: Received payload = " . json_encode($this->request->getJSON() ?? []));
|
||||||
|
|
||||||
|
|
||||||
$email = $this->request->getJSON()->email;
|
$email = $this->request->getJSON()->email ?? null;
|
||||||
|
$mobile_number = $this->request->getJSON()->mobile_number ?? null;
|
||||||
$otp = $this->request->getJSON()->otp;
|
$otp = $this->request->getJSON()->otp;
|
||||||
$client_id = $this->request->getJSON()->client_id ?? null;
|
$client_id = $this->request->getJSON()->client_id ?? null;
|
||||||
$employee_id = $this->request->getJSON()->employee_id ?? null;
|
$employee_id = $this->request->getJSON()->employee_id ?? null;
|
||||||
|
|
||||||
$builder = $this->employeeModel
|
$builder = $this->employeeModel
|
||||||
->where('email_corporate', $email)
|
|
||||||
->where('relationship', 'Self')
|
->where('relationship', 'Self')
|
||||||
->where('is_active', 1);
|
->where('is_active', 1);
|
||||||
|
|
||||||
// $builder = $this->employeeModel
|
if (!empty($email)) {
|
||||||
// ->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner')
|
$builder->where('email_corporate', $email);
|
||||||
// ->where('employees.email_corporate', $email)
|
}
|
||||||
// ->where('employees.relationship', 'Self')
|
|
||||||
// ->where('employees.is_active', 1)
|
if (!empty($mobile_number)) {
|
||||||
// ->whereIn('employees.emp_status', ['active', 'expired'])
|
$builder->where('mobile', $mobile_number);
|
||||||
// ->where('EP.is_active', 1)
|
}
|
||||||
// ->whereIn('EP.status', ['active', 'expired']);
|
|
||||||
|
|
||||||
|
|
||||||
if (!empty($client_id)) {
|
if (!empty($client_id)) {
|
||||||
@ -306,57 +335,6 @@ class RestAuthenticationController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// public function updateEmpMPIN()
|
|
||||||
// {
|
|
||||||
// $requestData = $this->request->getJSON();
|
|
||||||
// print_r($requestData); die;
|
|
||||||
// $mobile_number = $requestData->mobile_number ?? null;
|
|
||||||
// $email_id = $requestData->email_id ?? null;
|
|
||||||
// $new_mpin = $requestData->new_mpin ?? $requestData->mpin ?? null;
|
|
||||||
// $old_mpin = $requestData->old_mpin ?? null;
|
|
||||||
// $is_mpin_skipped = $requestData->is_mpin_skipped ?? null;
|
|
||||||
// $is_biometric_enabled = $requestData->is_biometric_enabled ?? null;
|
|
||||||
|
|
||||||
// if (!$new_mpin) {
|
|
||||||
// return $this->response->setJSON(['status' => false, 'message' => 'MPIN is required.']);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $query = $this->employeeModel->where('relationship', 'self');
|
|
||||||
|
|
||||||
// if ($mobile_number) {
|
|
||||||
// $query->where('mobile', $mobile_number);
|
|
||||||
// } elseif ($email_id) {
|
|
||||||
// $query->where('email_corporate', $email_id);
|
|
||||||
// } else {
|
|
||||||
// return $this->response->setJSON(['status' => false, 'message' => 'Mobile number or Email ID is required.']);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (!empty($old_mpin)) {
|
|
||||||
// $query->where('mpin', $old_mpin);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Fetch employee data
|
|
||||||
// $employeeData = $query->first();
|
|
||||||
|
|
||||||
// if (!$employeeData) {
|
|
||||||
// return $this->response->setJSON(['status' => false, 'message' => 'Employee not found or invalid MPIN.']);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if(!empty($is_mpin_skipped) && !empty($is_biometric_enabled)){
|
|
||||||
// $mpin_data_to_updata = [
|
|
||||||
// 'mpin' => $new_mpin,
|
|
||||||
// 'is_mpin_skipped' => $is_mpin_skipped,
|
|
||||||
// 'is_biometric_enabled' => $is_biometric_enabled
|
|
||||||
// ];
|
|
||||||
// }else{
|
|
||||||
// $mpin_data_to_updata = ['mpin' => $new_mpin];
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Update MPIN
|
|
||||||
// $updated = $this->employeeModel->update($employeeData['id'], $mpin_data_to_updata);
|
|
||||||
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public function updateEmpMPIN()
|
public function updateEmpMPIN()
|
||||||
{
|
{
|
||||||
@ -415,17 +393,11 @@ class RestAuthenticationController extends AdminController
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$otp_verification = isset($this->request->getJSON()->otp_verification) ? $this->request->getJSON()->otp_verification : null;
|
|
||||||
$mobile_number = isset($this->request->getJSON()->mobile_number) ? $this->request->getJSON()->mobile_number : null;
|
$mobile_number = isset($this->request->getJSON()->mobile_number) ? $this->request->getJSON()->mobile_number : null;
|
||||||
|
|
||||||
$otp = isset($this->request->getJSON()->otp) ? $this->request->getJSON()->otp : null;
|
|
||||||
$email_id = isset($this->request->getJSON()->email_id) ? $this->request->getJSON()->email_id : null;
|
$email_id = isset($this->request->getJSON()->email_id) ? $this->request->getJSON()->email_id : null;
|
||||||
|
$otp = isset($this->request->getJSON()->otp) ? $this->request->getJSON()->otp : null;
|
||||||
$client_id = $this->request->getJSON()->client_id ?? null;
|
$client_id = $this->request->getJSON()->client_id ?? null;
|
||||||
|
|
||||||
if (isset($this->request->getJSON()->login_by_hr))
|
|
||||||
{
|
|
||||||
$employeeData = $this->employeeModel->where('id', $this->request->getJSON()->employee_id)->where('relationship', 'self')->where('emp_status !=', 'truncated')->where('is_active', 1)->first();
|
|
||||||
}else{
|
|
||||||
if (isset($mobile_number))
|
if (isset($mobile_number))
|
||||||
{
|
{
|
||||||
// $employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->where('emp_status !=', 'truncated')->where('is_active', 1)->first();
|
// $employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->where('emp_status !=', 'truncated')->where('is_active', 1)->first();
|
||||||
@ -437,7 +409,8 @@ class RestAuthenticationController extends AdminController
|
|||||||
->where('employee_polices.is_active', 1)
|
->where('employee_polices.is_active', 1)
|
||||||
->whereIn('employee_polices.status', ['active', 'expired'])
|
->whereIn('employee_polices.status', ['active', 'expired'])
|
||||||
->where('employees.is_active', 1)
|
->where('employees.is_active', 1)
|
||||||
->whereIn('employees.emp_status', ['active', 'expired']);
|
->whereIn('employees.emp_status', ['active', 'expired'])
|
||||||
|
->where('otp', $otp);
|
||||||
|
|
||||||
if (!empty($client_id)) {
|
if (!empty($client_id)) {
|
||||||
$builder->where('employees.client_id', $client_id);
|
$builder->where('employees.client_id', $client_id);
|
||||||
@ -464,14 +437,15 @@ class RestAuthenticationController extends AdminController
|
|||||||
|
|
||||||
$employeeData = $builder->orderBy('employees.id', 'desc')->first();
|
$employeeData = $builder->orderBy('employees.id', 'desc')->first();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$lastQuery = $this->employeeModel->db->getLastQuery();
|
$lastQuery = $this->employeeModel->db->getLastQuery();
|
||||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - getVerifiedUserData: Last Executed Query: " . $lastQuery);
|
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - getVerifiedUserData: Last Executed Query: " . $lastQuery);
|
||||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - getVerifiedUserData: employeeData: " . json_encode($employeeData ?? []));
|
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - getVerifiedUserData: employeeData: " . json_encode($employeeData ?? []));
|
||||||
|
|
||||||
|
|
||||||
if ($employeeData && $otp_verification == true || $employeeData && isset($this->request->getJSON()->login_by_hr) || $employeeData && isset($this->request->getJSON()->otp) ) {
|
if ($employeeData && isset($this->request->getJSON()->otp) )
|
||||||
|
{
|
||||||
$auth = HttpRequestHelper::getRequestInfo();
|
$auth = HttpRequestHelper::getRequestInfo();
|
||||||
if ($auth) {
|
if ($auth) {
|
||||||
$data = [
|
$data = [
|
||||||
@ -524,17 +498,43 @@ class RestAuthenticationController extends AdminController
|
|||||||
public function verifyHrWithMobileNumber()
|
public function verifyHrWithMobileNumber()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
$data = $this->request->getJSON();
|
||||||
|
|
||||||
|
$mobile_number = $data->mobile_number;
|
||||||
|
$otp = $data->otp;
|
||||||
|
|
||||||
$HrData = $this->hrModel->where('mobile', $mobile_number)
|
$HrData = $this->hrModel->where('mobile', $mobile_number)
|
||||||
->where('contact_type', 'client')
|
->where('contact_type', 'client')
|
||||||
->where('is_active', 1)
|
->where('is_active', 1)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
|
||||||
if ($HrData) {
|
if ($HrData) {
|
||||||
|
|
||||||
$result = ['user_verification' => true ,'message' => "Verified Successfully"];
|
$sql = "UPDATE level_contacts SET otp = ? WHERE mobile = ? AND contact_type = 'client' AND is_active = 1";
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
|
||||||
|
$db = db_connect();
|
||||||
|
$update = $db->query($sql, [$otp, $mobile_number]);
|
||||||
|
|
||||||
|
if($update)
|
||||||
|
{
|
||||||
|
|
||||||
|
//send sms
|
||||||
|
$SMSResult = sendOtpSms($mobile_number, $otp);
|
||||||
|
if ($SMSResult['status'] == 'success')
|
||||||
|
{
|
||||||
|
$result = ['user_verification' => true, 'message' => "Verified Successfully"];
|
||||||
|
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200);
|
||||||
|
} else {
|
||||||
|
$result = ['user_verification' => false, 'message' => "SMS sending failed , try again"];
|
||||||
|
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
|
$result = ['user_verification' => false, 'message' => "SMS sending failed , try again"];
|
||||||
|
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$result = ['user_verification' => false , 'message' => "User not found"];
|
$result = ['user_verification' => false , 'message' => "User not found"];
|
||||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
|
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
|
||||||
@ -552,6 +552,7 @@ class RestAuthenticationController extends AdminController
|
|||||||
$data = $this->request->getJSON();
|
$data = $this->request->getJSON();
|
||||||
|
|
||||||
$email = $data->email;
|
$email = $data->email;
|
||||||
|
$otp = $data->otp;
|
||||||
|
|
||||||
$HrData = $this->hrModel->where('email', $email)
|
$HrData = $this->hrModel->where('email', $email)
|
||||||
->where('contact_type', 'client')
|
->where('contact_type', 'client')
|
||||||
@ -560,8 +561,6 @@ class RestAuthenticationController extends AdminController
|
|||||||
|
|
||||||
if ($HrData) {
|
if ($HrData) {
|
||||||
|
|
||||||
$otp = random_int(100000, 999999);
|
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
UPDATE level_contacts
|
UPDATE level_contacts
|
||||||
SET otp = ?
|
SET otp = ?
|
||||||
@ -575,7 +574,7 @@ class RestAuthenticationController extends AdminController
|
|||||||
|
|
||||||
if($update)
|
if($update)
|
||||||
{
|
{
|
||||||
$data->otp = $otp;
|
|
||||||
|
|
||||||
$common = [
|
$common = [
|
||||||
'login_type' => 'HR login',
|
'login_type' => 'HR login',
|
||||||
@ -612,35 +611,49 @@ class RestAuthenticationController extends AdminController
|
|||||||
public function updateHROTP()
|
public function updateHROTP()
|
||||||
{
|
{
|
||||||
|
|
||||||
$email = $this->request->getJSON()->email;
|
$email = $this->request->getJSON()->email ?? null;
|
||||||
$otp = $this->request->getJSON()->otp;
|
$mobile_number = $this->request->getJSON()->mobile_number ?? null;
|
||||||
|
$otp = $this->request->getJSON()->otp ?? null;
|
||||||
|
|
||||||
$this->hrModel->where('email', $email) ->where('contact_type', 'client')
|
|
||||||
->where('is_active', 1)->set(array('otp' => $otp))
|
|
||||||
->update();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
$builder = $this->hrModel
|
||||||
|
->where('contact_type', 'client')
|
||||||
|
->where('is_active', 1);
|
||||||
|
|
||||||
|
if (!empty($email)) {
|
||||||
|
$builder->where('email', $email);
|
||||||
|
} elseif (!empty($mobile_number)) {
|
||||||
|
$builder->where('mobile', $mobile_number);
|
||||||
|
}
|
||||||
|
|
||||||
|
$builder->set(['otp' => $otp])->update();
|
||||||
|
|
||||||
|
if ($this->hrModel->db->affectedRows() > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getVerifiedHrData()
|
public function getVerifiedHrData()
|
||||||
{
|
{
|
||||||
// try {
|
try {
|
||||||
// mobile number
|
|
||||||
$otp_verification = isset($this->request->getJSON()->otp_verification) ? $this->request->getJSON()->otp_verification : null;
|
|
||||||
$mobile_number = isset($this->request->getJSON()->mobile_no) ? $this->request->getJSON()->mobile_no : null;
|
|
||||||
// email id
|
|
||||||
$otp = isset($this->request->getJSON()->otp) ? $this->request->getJSON()->otp : null;
|
$otp = isset($this->request->getJSON()->otp) ? $this->request->getJSON()->otp : null;
|
||||||
$email = isset($this->request->getJSON()->email) ? $this->request->getJSON()->email : null;
|
$email = isset($this->request->getJSON()->email) ? $this->request->getJSON()->email : null;
|
||||||
|
$mobile_number = isset($this->request->getJSON()->mobile_no) ? $this->request->getJSON()->mobile_no : null;
|
||||||
|
|
||||||
if (isset($mobile_number))
|
if (isset($mobile_number))
|
||||||
{
|
{
|
||||||
$hrData = $this->hrModel->where('mobile', $mobile_number)->where('contact_type', 'client')->first();
|
$hrData = $this->hrModel->where('mobile', $mobile_number)->where('contact_type', 'client')->where('otp', $otp)->first();
|
||||||
}else{
|
}else{
|
||||||
$hrData = $this->hrModel->where('email', $email)->where('contact_type', 'client')->where('otp', $otp)->first();
|
$hrData = $this->hrModel->where('email', $email)->where('contact_type', 'client')->where('otp', $otp)->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($hrData && $otp_verification == true || $hrData && isset($this->request->getJSON()->otp) )
|
if ($hrData)
|
||||||
{
|
{
|
||||||
|
|
||||||
$auth = HttpRequestHelper::getRequestInfo();
|
$auth = HttpRequestHelper::getRequestInfo();
|
||||||
@ -660,23 +673,25 @@ class RestAuthenticationController extends AdminController
|
|||||||
|
|
||||||
if(isset($this->request->getJSON()->mobile_no)){
|
if(isset($this->request->getJSON()->mobile_no)){
|
||||||
|
|
||||||
$getAllhrData = $this->hrModel->select('level_contacts.id ,level_contacts.mobile , level_contacts.email , clients.id as client_id, clients.client_name, clients.short_name , client_branch.id as client_branch_id,client_branch.branch_name, client_branch.pre_branch_id')
|
$getAllhrData = $this->hrModel->select('level_contacts.id ,level_contacts.mobile , level_contacts.email , clients.id as client_id, clients.client_name, clients.short_name , client_branch.id as client_branch_id,client_branch.branch_name , client_branch.pre_branch_id')
|
||||||
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
|
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
|
||||||
->join('clients', 'client_branch.client_id = clients.id', 'left')
|
->join('clients', 'client_branch.client_id = clients.id', 'left')
|
||||||
->where('level_contacts.mobile', $mobile_number )
|
->where('level_contacts.mobile', $mobile_number )
|
||||||
->where('level_contacts.contact_type', 'client')
|
->where('level_contacts.contact_type', 'client')
|
||||||
->findAll();
|
->findAll();
|
||||||
|
//set otp value null
|
||||||
|
$this->hrModel->where('mobile', $mobile_number)->where('otp', $otp)->where('contact_type', 'client')->set(['otp'=>null])->update();
|
||||||
|
|
||||||
}else if(isset($this->request->getJSON()->otp)){
|
}else if(isset($this->request->getJSON()->email)){
|
||||||
|
|
||||||
|
$getAllhrData = $this->hrModel->select('level_contacts.id ,level_contacts.mobile , level_contacts.email , clients.id as client_id, clients.client_name, clients.short_name , client_branch.id as client_branch_id,client_branch.branch_name , client_branch.pre_branch_id')
|
||||||
|
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
|
||||||
|
->join('clients', 'client_branch.client_id = clients.id', 'left')
|
||||||
|
->where('level_contacts.email', $email )
|
||||||
|
->where('level_contacts.contact_type', 'client')
|
||||||
|
->findAll();
|
||||||
|
//set otp value null
|
||||||
$this->hrModel->where('email', $email)->where('otp', $otp)->where('contact_type', 'client')->set(['otp'=>null])->update();
|
$this->hrModel->where('email', $email)->where('otp', $otp)->where('contact_type', 'client')->set(['otp'=>null])->update();
|
||||||
|
|
||||||
$getAllhrData = $this->hrModel->select('level_contacts.id ,level_contacts.mobile , level_contacts.email , clients.id as client_id, clients.client_name, clients.short_name , client_branch.id as client_branch_id,client_branch.branch_name, client_branch.pre_branch_id')
|
|
||||||
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
|
|
||||||
->join('clients', 'client_branch.client_id = clients.id', 'left')
|
|
||||||
->where('level_contacts.email', $email )
|
|
||||||
->where('level_contacts.contact_type', 'client')
|
|
||||||
->findAll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($getAllhrData))
|
if(count($getAllhrData))
|
||||||
@ -705,29 +720,26 @@ class RestAuthenticationController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->respond(['status' => 'success','code' => 200,'data' => $getAllhrData ],200);
|
||||||
|
|
||||||
|
}else {
|
||||||
|
|
||||||
|
return $this->respond(['status' => 'failed','code' => 404,'data' => "" , 'message' => 'User not found' ],200);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => $getAllhrData ],200);
|
|
||||||
|
|
||||||
|
|
||||||
// $HRAccessData = $this->getHRAccessData( $hrData['0']['id'] , 'post_enrollment');
|
|
||||||
|
|
||||||
// if(isset($HRAccessData['allowed_modules'])){ $hrData['0']['allowed_modules'] = json_decode($HRAccessData['allowed_modules'],true)['post']; }else{ $hrData['0']['allowed_modules'] = []; }
|
|
||||||
|
|
||||||
// $hrData['0']['token_type'] = 'post';
|
|
||||||
// $result = JWTToken::encode($hrData['0']);
|
|
||||||
|
|
||||||
|
|
||||||
// return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
return $this->respond(['status' => 'failed','code' => 404,'data' => "" ],200);
|
return $this->respond(['status' => 'failed','code' => 404,'data' => "" , 'message' => 'User not found' ],200);
|
||||||
}
|
}
|
||||||
// } catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);
|
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1395,6 +1407,10 @@ class RestAuthenticationController extends AdminController
|
|||||||
->where('EP.is_active', 1)
|
->where('EP.is_active', 1)
|
||||||
->whereIn('EP.status', ['active', 'expired']);
|
->whereIn('EP.status', ['active', 'expired']);
|
||||||
|
|
||||||
|
if (!empty($otp)) {
|
||||||
|
$builder->where('employees.otp', $otp);
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($old_mpin)) {
|
if (!empty($old_mpin)) {
|
||||||
$builder->where('employees.mpin', $old_mpin);
|
$builder->where('employees.mpin', $old_mpin);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,12 @@ use CodeIgniter\API\ResponseTrait;
|
|||||||
use Dompdf\Dompdf;
|
use Dompdf\Dompdf;
|
||||||
use Dompdf\Options;
|
use Dompdf\Options;
|
||||||
|
|
||||||
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Style\Alignment;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Style\Fill;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Style\Border;
|
||||||
|
|
||||||
class TestingController extends BaseController
|
class TestingController extends BaseController
|
||||||
{
|
{
|
||||||
use ResponseTrait;
|
use ResponseTrait;
|
||||||
@ -486,4 +492,185 @@ class TestingController extends BaseController
|
|||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
public function membervalidation($lead_id = 329)
|
||||||
|
{
|
||||||
|
$lead_controll = new LeadsController();
|
||||||
|
// $lead_controll->getMemberDataExcelFileErrors();
|
||||||
|
$res = $lead_controll->memberDataListExcelFileFormatValidation(['lead_id' => $lead_id]);
|
||||||
|
dd($res);
|
||||||
|
}
|
||||||
|
|
||||||
|
private $firstNames = [
|
||||||
|
'Rajesh', 'Priya', 'Amit', 'Sneha', 'Vikram', 'Anjali', 'Rahul', 'Deepika',
|
||||||
|
'Sanjay', 'Kavita', 'Arun', 'Pooja', 'Manoj', 'Nisha', 'Suresh', 'Meera',
|
||||||
|
'Karthik', 'Divya', 'Ravi', 'Lakshmi', 'Anand', 'Swathi', 'Vijay', 'Rekha',
|
||||||
|
'Ashok', 'Sangeetha', 'Prakash', 'Uma', 'Ramesh', 'Vani', 'Kumar', 'Radha',
|
||||||
|
'Dinesh', 'Shanti', 'Ganesh', 'Parvati', 'Mohan', 'Sita', 'Arjun', 'Geetha'
|
||||||
|
];
|
||||||
|
|
||||||
|
private $lastNames = [
|
||||||
|
'Kumar', 'Sharma', 'Singh', 'Patel', 'Reddy', 'Nair', 'Iyer', 'Krishnan',
|
||||||
|
'Rao', 'Gupta', 'Verma', 'Agarwal', 'Joshi', 'Mehta', 'Desai', 'Pillai',
|
||||||
|
'Menon', 'Bhat', 'Naidu', 'Varma', 'Malhotra', 'Kapoor', 'Chopra', 'Saxena',
|
||||||
|
'Pandey', 'Mishra', 'Tiwari', 'Dubey', 'Sinha', 'Jain', 'Shah', 'Thakur'
|
||||||
|
];
|
||||||
|
|
||||||
|
private $relationships = ['Self', 'Spouse', 'Son', 'Daughter', 'Father', 'Mother'];
|
||||||
|
private $genders = ['M', 'F'];
|
||||||
|
private $domains = ['gmail.com', 'yahoo.com', 'outlook.com', 'company.com', 'example.com'];
|
||||||
|
|
||||||
|
public function generateExcel()
|
||||||
|
{
|
||||||
|
// Increase execution time and memory for large files
|
||||||
|
ini_set('max_execution_time', 600);
|
||||||
|
ini_set('memory_limit', '1024M');
|
||||||
|
|
||||||
|
$spreadsheet = new Spreadsheet();
|
||||||
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
|
||||||
|
// Define headers
|
||||||
|
$headers = [
|
||||||
|
'Sl no',
|
||||||
|
'Emp Code',
|
||||||
|
'Name',
|
||||||
|
'Relationship',
|
||||||
|
'Gender',
|
||||||
|
'DOB',
|
||||||
|
'Age',
|
||||||
|
'Email',
|
||||||
|
'Mobile',
|
||||||
|
'SI',
|
||||||
|
'SI Enhancement',
|
||||||
|
'Proposed Sum Insured 1',
|
||||||
|
'Proposed Sum Insured 2',
|
||||||
|
'Proposed Sum Insured 3',
|
||||||
|
'Proposed Sum Insured 4'
|
||||||
|
];
|
||||||
|
|
||||||
|
// Set headers in row 1
|
||||||
|
$col = 'A';
|
||||||
|
foreach ($headers as $header) {
|
||||||
|
$sheet->setCellValue($col . '1', $header);
|
||||||
|
$col++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Style the header row
|
||||||
|
$headerStyle = [
|
||||||
|
'font' => ['bold' => true, 'color' => ['rgb' => 'FFFFFF']],
|
||||||
|
'fill' => ['fillType' => Fill::FILL_SOLID, 'startColor' => ['rgb' => '4472C4']],
|
||||||
|
'alignment' => ['horizontal' => Alignment::HORIZONTAL_CENTER, 'vertical' => Alignment::VERTICAL_CENTER],
|
||||||
|
'borders' => ['allBorders' => ['borderStyle' => Border::BORDER_THIN]]
|
||||||
|
];
|
||||||
|
$sheet->getStyle('A1:O1')->applyFromArray($headerStyle);
|
||||||
|
|
||||||
|
// Generate 70,000 sample records
|
||||||
|
$totalRecords = 1000;
|
||||||
|
$batchSize = 1000;
|
||||||
|
|
||||||
|
for ($i = 1; $i <= $totalRecords; $i++) {
|
||||||
|
$row = $i + 1; // Start from row 2 (row 1 is header)
|
||||||
|
|
||||||
|
$record = $this->generateSampleRecord($i);
|
||||||
|
|
||||||
|
$sheet->setCellValue('A' . $row, $record['sl_no']);
|
||||||
|
$sheet->setCellValue('B' . $row, $record['emp_code']);
|
||||||
|
$sheet->setCellValue('C' . $row, $record['name']);
|
||||||
|
$sheet->setCellValue('D' . $row, $record['relationship']);
|
||||||
|
$sheet->setCellValue('E' . $row, $record['gender']);
|
||||||
|
$sheet->setCellValue('F' . $row, $record['dob']);
|
||||||
|
$sheet->setCellValue('G' . $row, $record['age']);
|
||||||
|
$sheet->setCellValue('H' . $row, $record['email']);
|
||||||
|
$sheet->setCellValue('I' . $row, $record['mobile']);
|
||||||
|
$sheet->setCellValue('J' . $row, $record['si']);
|
||||||
|
$sheet->setCellValue('K' . $row, $record['si_enhancement']);
|
||||||
|
$sheet->setCellValue('L' . $row, $record['proposed_si_1']);
|
||||||
|
$sheet->setCellValue('M' . $row, $record['proposed_si_2']);
|
||||||
|
$sheet->setCellValue('N' . $row, $record['proposed_si_3']);
|
||||||
|
$sheet->setCellValue('O' . $row, $record['proposed_si_4']);
|
||||||
|
|
||||||
|
// Clear memory every batch
|
||||||
|
if ($i % $batchSize == 0) {
|
||||||
|
$sheet->garbageCollect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Auto-size columns
|
||||||
|
foreach (range('A', 'O') as $col) {
|
||||||
|
$sheet->getColumnDimension($col)->setAutoSize(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate filename
|
||||||
|
$filename = 'employee_data_70k_' . date('Y-m-d_His') . '.xlsx';
|
||||||
|
|
||||||
|
// Set headers for download
|
||||||
|
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||||
|
header('Content-Disposition: attachment;filename="' . $filename . '"');
|
||||||
|
header('Cache-Control: max-age=0');
|
||||||
|
|
||||||
|
// Write file to output
|
||||||
|
$writer = new Xlsx($spreadsheet);
|
||||||
|
$writer->save('php://output');
|
||||||
|
|
||||||
|
// Clean up
|
||||||
|
$spreadsheet->disconnectWorksheets();
|
||||||
|
unset($spreadsheet);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function generateSampleRecord($index)
|
||||||
|
{
|
||||||
|
$firstName = $this->firstNames[array_rand($this->firstNames)];
|
||||||
|
$lastName = $this->lastNames[array_rand($this->lastNames)];
|
||||||
|
$name = $firstName . ' ' . $lastName;
|
||||||
|
|
||||||
|
$relationship = $this->relationships[array_rand($this->relationships)];
|
||||||
|
$gender = $this->genders[array_rand($this->genders)];
|
||||||
|
|
||||||
|
// Generate random age between 18 and 65
|
||||||
|
$age = rand(18, 65);
|
||||||
|
|
||||||
|
// Calculate DOB based on age
|
||||||
|
$year = date('Y') - $age;
|
||||||
|
$month = str_pad(rand(1, 12), 2, '0', STR_PAD_LEFT);
|
||||||
|
$day = str_pad(rand(1, 28), 2, '0', STR_PAD_LEFT);
|
||||||
|
$dob = "{$day}-{$month}-{$year}";
|
||||||
|
|
||||||
|
// Generate employee code
|
||||||
|
$empCode = 'EMP' . str_pad($index, 6, '0', STR_PAD_LEFT);
|
||||||
|
|
||||||
|
// Generate email
|
||||||
|
$email = strtolower($firstName . '.' . $lastName . $index) . '@' . $this->domains[array_rand($this->domains)];
|
||||||
|
|
||||||
|
// Generate mobile number (Indian format)
|
||||||
|
$mobile = '+91' . rand(7000000000, 9999999999);
|
||||||
|
|
||||||
|
// Generate insurance amounts
|
||||||
|
$siOptions = [100000, 200000, 300000, 500000, 1000000];
|
||||||
|
$si = $siOptions[array_rand($siOptions)];
|
||||||
|
$si_enhancement = rand(0, 1) ? rand(50000, 200000) : 0;
|
||||||
|
|
||||||
|
$proposed_si_1 = $si + rand(100000, 500000);
|
||||||
|
$proposed_si_2 = $proposed_si_1 + rand(100000, 500000);
|
||||||
|
$proposed_si_3 = $proposed_si_2 + rand(100000, 500000);
|
||||||
|
$proposed_si_4 = $proposed_si_3 + rand(100000, 500000);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'sl_no' => $index,
|
||||||
|
'emp_code' => $empCode,
|
||||||
|
'name' => $name,
|
||||||
|
'relationship' => $relationship,
|
||||||
|
'gender' => $gender,
|
||||||
|
'dob' => $dob,
|
||||||
|
'age' => $age,
|
||||||
|
'email' => $email,
|
||||||
|
'mobile' => $mobile,
|
||||||
|
'si' => $si,
|
||||||
|
'si_enhancement' => $si_enhancement,
|
||||||
|
'proposed_si_1' => $proposed_si_1,
|
||||||
|
'proposed_si_2' => $proposed_si_2,
|
||||||
|
'proposed_si_3' => $proposed_si_3,
|
||||||
|
'proposed_si_4' => $proposed_si_4
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,7 @@ class ChatbotHelper
|
|||||||
$client_branch_id = $chat_session_info['client_branch_id'];
|
$client_branch_id = $chat_session_info['client_branch_id'];
|
||||||
$relationship ='Self';
|
$relationship ='Self';
|
||||||
$EmployeeModel = new EmployeeModel();
|
$EmployeeModel = new EmployeeModel();
|
||||||
return $EmployeeModel->getEmpFamilybyEmpCode(emp_code: $emp_code,client_id: $client_id,emp_status: ['active'],policy_status:['active'],client_branch_id:[ $client_branch_id ],relationship:[$relationship]);//,relationship:[$relationship];
|
return $EmployeeModel->getEmpFamilybyEmpCode(emp_code: $emp_code,client_id: $client_id,emp_status: ['active'],policy_status:['active'],client_branch_id:[ $client_branch_id ],relationship:[$relationship],policy_type_id:[2,3,4,5]);//,relationship:[$relationship];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getHospitalLink($emp_policy_id){
|
public static function getHospitalLink($emp_policy_id){
|
||||||
|
|||||||
@ -666,12 +666,12 @@ if(!function_exists('generate_insurer_based_excel')){
|
|||||||
foreach ($excel_header_array as $header) {
|
foreach ($excel_header_array as $header) {
|
||||||
|
|
||||||
$fieldName = $header['db_column_name'];
|
$fieldName = $header['db_column_name'];
|
||||||
$defaultValue = isset($header['default_value']) ? $header['default_value'] : null;
|
$defaultValue = isset($header['default_value']) ? $header['default_value'] : "";
|
||||||
|
|
||||||
if ($fieldName === 'index') {
|
if ($fieldName === 'index') {
|
||||||
$value = $serialNumber;
|
$value = $serialNumber;
|
||||||
} else {
|
} else {
|
||||||
if(empty($fieldName) && !empty($defaultValue)){
|
if(empty($fieldName) && $defaultValue != ""){
|
||||||
$value = $defaultValue;
|
$value = $defaultValue;
|
||||||
}else{
|
}else{
|
||||||
$value = $row->$fieldName ?? '';
|
$value = $row->$fieldName ?? '';
|
||||||
|
|||||||
@ -1993,7 +1993,6 @@ if (!function_exists('group_slab_rates_basedon_name')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//this key generating mandantory for display employee info in enrolment app w/o error
|
//this key generating mandantory for display employee info in enrolment app w/o error
|
||||||
if (!function_exists('generate_family_floater_key')) {
|
if (!function_exists('generate_family_floater_key')) {
|
||||||
function generate_family_floater_key($relationship)
|
function generate_family_floater_key($relationship)
|
||||||
@ -2002,7 +2001,7 @@ if (!function_exists('generate_family_floater_key')) {
|
|||||||
$relation = 'parent';
|
$relation = 'parent';
|
||||||
} else if (strtolower(trim($relationship)) === 'son' || strtolower(trim($relationship)) === 'daughter') {
|
} else if (strtolower(trim($relationship)) === 'son' || strtolower(trim($relationship)) === 'daughter') {
|
||||||
$relation = 'child';
|
$relation = 'child';
|
||||||
} else if ((strtolower(trim($relationship)) === 'father in Law' || strtolower(trim($relationship)) === 'mother in Law') || (strtolower(trim($relationship)) === 'father-in-Law' || strtolower(trim($relationship)) === 'mother-in-Law')) {
|
} else if ((strtolower(trim($relationship)) === 'father in law' || strtolower(trim($relationship)) === 'mother in law') || (strtolower(trim($relationship)) === 'father-in-law' || strtolower(trim($relationship)) === 'mother-in-law')) {
|
||||||
$relation = 'parent_in_law';
|
$relation = 'parent_in_law';
|
||||||
} else if (strtolower(trim($relationship)) === 'spouse') {
|
} else if (strtolower(trim($relationship)) === 'spouse') {
|
||||||
$relation = 'spouse';
|
$relation = 'spouse';
|
||||||
@ -2041,3 +2040,331 @@ if (!function_exists('formatIndianCurrency')) {
|
|||||||
return $formatted . $decimal;
|
return $formatted . $decimal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------- FUNCTION FOR LEAD MEMBER DATA LIST VALIDATIONS --------------------------------------
|
||||||
|
|
||||||
|
if (!function_exists('check_columns_name_exist')) {
|
||||||
|
function check_columns_name_exist($definedColumns, $excelColumns)
|
||||||
|
{
|
||||||
|
$mismatchedColumns = [];
|
||||||
|
|
||||||
|
foreach ($definedColumns as $colKey => $definedCol) {
|
||||||
|
$definedColName = strtolower(trim($definedCol['col_name']));
|
||||||
|
|
||||||
|
// Normalize excel columns to lowercase for comparison
|
||||||
|
$excelColsLower = array_map('strtolower', array_map('trim', $excelColumns));
|
||||||
|
|
||||||
|
if (!in_array($definedColName, $excelColsLower)) {
|
||||||
|
$mismatchedColumns[] = "Missing column: <strong>" . $definedCol['col_name'] . "</strong> in Excel file.<br/>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $mismatchedColumns;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('update_excel_column_indexes')) {
|
||||||
|
function update_excel_column_indexes($definedColumns, $excelColumns)
|
||||||
|
{
|
||||||
|
// $excelColumns is the first row of the Excel file (header row)
|
||||||
|
// Example: ['Emp Code', 'Name', 'Gender', 'DOB', 'SI']
|
||||||
|
|
||||||
|
foreach ($definedColumns as $key => &$definedCol) {
|
||||||
|
$definedColName = strtolower(trim($definedCol['col_name']));
|
||||||
|
$excelColsLower = array_map('strtolower', array_map('trim', $excelColumns));
|
||||||
|
|
||||||
|
// Find column index in Excel
|
||||||
|
$colIndex = array_search($definedColName, $excelColsLower);
|
||||||
|
|
||||||
|
if ($colIndex !== false) {
|
||||||
|
$definedCol['col_idx'] = $colIndex;
|
||||||
|
$definedCol['col_cell_name'] = chr(65 + $colIndex); // A=65, B=66...
|
||||||
|
} else {
|
||||||
|
// If column missing in Excel
|
||||||
|
$definedCol['col_idx'] = null;
|
||||||
|
$definedCol['col_cell_name'] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $definedColumns;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('check_duplicate_rows_and_contacts')) {
|
||||||
|
function check_duplicate_rows_and_contacts($excel_data, $columns_to_check, $err_data)
|
||||||
|
{
|
||||||
|
$exl_col = $columns_to_check;
|
||||||
|
$keys = array_keys($columns_to_check);
|
||||||
|
unset($columns_to_check['sno'], $columns_to_check['si'], $columns_to_check['email'], $columns_to_check['mobile'], $columns_to_check['age']);
|
||||||
|
|
||||||
|
$seenRows = [];
|
||||||
|
$emailSeen = [];
|
||||||
|
$mobileSeen = [];
|
||||||
|
$duplicateRows = [];
|
||||||
|
|
||||||
|
foreach ($excel_data as $rowIndex => $row) {
|
||||||
|
|
||||||
|
// Build unique key from selected columns
|
||||||
|
$values = [];
|
||||||
|
foreach ($columns_to_check as $colIdx) {
|
||||||
|
$values[] = isset($row[$colIdx['col_idx']]) ? trim($row[$colIdx['col_idx']]) : '';
|
||||||
|
}
|
||||||
|
$rowKey = json_encode($values);
|
||||||
|
|
||||||
|
// =============== STEP 1: Main duplicate check ===============
|
||||||
|
if (!isset($seenRows[$rowKey])) {
|
||||||
|
$seenRows[$rowKey] = [$rowIndex];
|
||||||
|
} else {
|
||||||
|
// First duplicate occurrence — mark all related rows
|
||||||
|
$seenRows[$rowKey][] = $rowIndex;
|
||||||
|
$indexes = $seenRows[$rowKey];
|
||||||
|
|
||||||
|
$rows_str = implode(', ', array_map(fn($i) => $i + 1, $indexes));
|
||||||
|
$error_message = "Duplicate found in selected columns: Rows {$rows_str} are identical";
|
||||||
|
|
||||||
|
foreach ($indexes as $i) {
|
||||||
|
// Avoid re-adding duplicate errors
|
||||||
|
if (!in_array($i, $duplicateRows)) {
|
||||||
|
array_push($err_data['error_summary'], 1);
|
||||||
|
$err_data['error_data'][$i][$keys[0]]['col_name'] = 'Sl no';
|
||||||
|
$err_data['error_data'][$i][$keys[0]]['col_idx'] = 0;
|
||||||
|
$err_data['error_data'][$i][$keys[0]]['error'][] = $error_message;
|
||||||
|
$duplicateRows[] = $i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skip email/mobile check for this duplicate row
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// =============== STEP 2: Email & Mobile check (only if not duplicate) ===============
|
||||||
|
$email = isset($row[$exl_col['email']['col_idx']]) ? trim($row[$exl_col['email']['col_idx']]) : '';
|
||||||
|
$mobile = isset($row[$exl_col['mobile']['col_idx']]) ? trim($row[$exl_col['mobile']['col_idx']]) : '';
|
||||||
|
|
||||||
|
// Check email duplicates
|
||||||
|
if ($email !== '') {
|
||||||
|
if (isset($emailSeen[$email])) {
|
||||||
|
$firstIndex = $emailSeen[$email] + 1;
|
||||||
|
$currentRow = $rowIndex + 1;
|
||||||
|
$error_message = "Duplicate email found: Row {$currentRow} and Row {$firstIndex} have the same email '$email'";
|
||||||
|
array_push($err_data['error_summary'], 1);
|
||||||
|
$err_data['error_data'][$rowIndex][$keys[$exl_col['email']['col_idx']]]['col_name'] = $exl_col['email']['col_name'];
|
||||||
|
$err_data['error_data'][$rowIndex][$keys[$exl_col['email']['col_idx']]]['col_idx'] = $exl_col['email']['col_idx'];
|
||||||
|
$err_data['error_data'][$rowIndex][$keys[$exl_col['email']['col_idx']]]['error'][] = $error_message;
|
||||||
|
} else {
|
||||||
|
$emailSeen[$email] = $rowIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check mobile duplicates
|
||||||
|
if ($mobile !== '') {
|
||||||
|
if (isset($mobileSeen[$mobile])) {
|
||||||
|
$firstIndex = $mobileSeen[$mobile] + 1;
|
||||||
|
$currentRow = $rowIndex + 1;
|
||||||
|
$error_message = "Duplicate mobile number found: Row {$currentRow} and Row {$firstIndex} have the same mobile '$mobile'";
|
||||||
|
array_push($err_data['error_summary'], 1);
|
||||||
|
$err_data['error_data'][$rowIndex][$keys[$exl_col['mobile']['col_idx']]]['col_name'] = $exl_col['mobile']['col_name'];
|
||||||
|
$err_data['error_data'][$rowIndex][$keys[$exl_col['mobile']['col_idx']]]['col_idx'] = $exl_col['mobile']['col_idx'];
|
||||||
|
$err_data['error_data'][$rowIndex][$keys[$exl_col['mobile']['col_idx']]]['error'][] = $error_message;
|
||||||
|
} else {
|
||||||
|
$mobileSeen[$mobile] = $rowIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $err_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('check_relationship_for_member_data')) {
|
||||||
|
function check_relationship_for_member_data($row, $relationship, $columns_to_check)
|
||||||
|
{
|
||||||
|
$relation_col_idx = $columns_to_check['relationship']['col_idx'] ?? null;
|
||||||
|
$gender_col_idx = $columns_to_check['gender']['col_idx'] ?? null;
|
||||||
|
|
||||||
|
if ($relation_col_idx !== null && $gender_col_idx !== null && !empty($row[$relation_col_idx]) && !empty($row[$gender_col_idx])) { //$row[5] = relationship $row[4] = Gender
|
||||||
|
|
||||||
|
$slug = \Config\Services::slug();
|
||||||
|
$col = $slug->slugify($row[$relation_col_idx]);
|
||||||
|
|
||||||
|
if ($col != 'self' && $col != 'spouse') {
|
||||||
|
if (!isset($relationship[$col])) {
|
||||||
|
return array('status' => false, 'error' => 'Rule Conflict: Unknown Relationship');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($relationship[$col]) && $relationship[$col]['gender'] != $row[$gender_col_idx]) {
|
||||||
|
$error = "Gender relationship conflict: Expected " . $relationship[$col]['gender'] . ", received $row[$gender_col_idx]";
|
||||||
|
return array('status' => false, 'error' => $error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return array('status' => true);
|
||||||
|
} else {
|
||||||
|
return array('status' => false, 'error' => 'Rule Conflict: Both Relationship and Gender required for check relationship conflict');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('member_data_group_by_family')) {
|
||||||
|
function member_data_group_by_family($member_data, $columns_to_check)
|
||||||
|
{
|
||||||
|
$result = [];
|
||||||
|
// Kint::dump($member_data);
|
||||||
|
foreach ($member_data as $rowIndex => $row) {
|
||||||
|
if (!check_row_is_empty_or_null($row)) {
|
||||||
|
|
||||||
|
$row['row_index'] = $rowIndex;
|
||||||
|
|
||||||
|
$relation_idx = $columns_to_check['relationship']['col_idx'];
|
||||||
|
$emp_code_idx = $columns_to_check['emp_code']['col_idx'];
|
||||||
|
|
||||||
|
if (isset($row[$relation_idx]) && strtolower($row[$relation_idx]) == 'self' && isset($result[$row[$emp_code_idx]])) {
|
||||||
|
array_unshift($result[$row[$emp_code_idx]], $row);
|
||||||
|
} else {
|
||||||
|
$result[$row[$emp_code_idx]][] = $row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('validateFamily')) {
|
||||||
|
function validateFamily($familyData, $columns_to_check, $errors) {
|
||||||
|
|
||||||
|
$keys = array_keys($columns_to_check);
|
||||||
|
foreach ($familyData as $familyId => $members) {
|
||||||
|
|
||||||
|
$selfMember = null;
|
||||||
|
$spouseMember = null;
|
||||||
|
$selfCount = 0;
|
||||||
|
$row_index = null;
|
||||||
|
|
||||||
|
// Find Self and Spouse members
|
||||||
|
foreach ($members as $member) {
|
||||||
|
$relation = trim($member[3]); // Relationship field
|
||||||
|
|
||||||
|
if (strtolower($relation) == 'self') {
|
||||||
|
$selfCount++;
|
||||||
|
$selfMember = $member;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strtolower($relation) == 'spouse') {
|
||||||
|
$spouseMember = $member;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($row_index == null){
|
||||||
|
if(strtolower($relation) == 'self'){
|
||||||
|
$row_index = $member['row_index'];
|
||||||
|
}else if(strtolower($relation) == 'spouse'){
|
||||||
|
$row_index = $member['row_index'];
|
||||||
|
}else{
|
||||||
|
$row_index = $member['row_index'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validation 1: Check if Self exists
|
||||||
|
if ($selfCount === 0) {
|
||||||
|
|
||||||
|
$message = "Emp ID - {$familyId}: Missing 'Self' member";
|
||||||
|
array_push($errors['error_summary'], 4);
|
||||||
|
$errors['error_data'][$row_index][$keys[$columns_to_check['emp_code']['col_idx']]]['col_name'] = $columns_to_check['emp_code']['col_name'];
|
||||||
|
$errors['error_data'][$row_index][$keys[$columns_to_check['emp_code']['col_idx']]]['col_idx'] = $columns_to_check['emp_code']['col_idx'];
|
||||||
|
$errors['error_data'][$row_index][$keys[$columns_to_check['emp_code']['col_idx']]]['error'][] = $message;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validation 2: Check if there's exactly one Self
|
||||||
|
if ($selfCount > 1) {
|
||||||
|
$message = "Emp ID - {$familyId}: Multiple 'Self' members found. Only one 'Self' is allowed per family";
|
||||||
|
array_push($errors['error_summary'], 5);
|
||||||
|
$errors['error_data'][$row_index][$keys[$columns_to_check['emp_code']['col_idx']]]['col_name'] = $columns_to_check['emp_code']['col_name'];
|
||||||
|
$errors['error_data'][$row_index][$keys[$columns_to_check['emp_code']['col_idx']]]['col_idx'] = $columns_to_check['emp_code']['col_idx'];
|
||||||
|
$errors['error_data'][$row_index][$keys[$columns_to_check['emp_code']['col_idx']]]['error'][] = $message;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validation 3: Validate spouse gender if spouse exists
|
||||||
|
if ($spouseMember !== null) {
|
||||||
|
|
||||||
|
$selfGender = strtoupper(trim($selfMember[4])); // Gender field
|
||||||
|
$spouseGender = strtoupper(trim($spouseMember[4]));
|
||||||
|
$selfName = $selfMember[2]; // Name field
|
||||||
|
$spouseName = $spouseMember[2];
|
||||||
|
|
||||||
|
// Check gender compatibility
|
||||||
|
$message = '';
|
||||||
|
if ($selfGender === 'M' && $spouseGender !== 'F') {
|
||||||
|
$message = "Emp ID - {$familyId}: Self ('{$selfName}') is Male (M); spouse must be Female (F). Found spouse ('{$spouseName}') with gender '({$spouseGender})'.";
|
||||||
|
} elseif ($selfGender === 'F' && $spouseGender !== 'M') {
|
||||||
|
$message = "Emp ID - {$familyId}: Self ('{$selfName}') is Female (F); spouse must be Male (M). Found spouse ('{$spouseName}') with gender '({$spouseGender})'.";
|
||||||
|
} elseif (!in_array($selfGender, ['M', 'F'])) {
|
||||||
|
$message = "Emp ID - {$familyId}: Invalid gender for Self member ('{$selfName}'). Expected 'M' or 'F', found '({$selfGender})'.";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($message) && !empty($message)){
|
||||||
|
array_push($errors['error_summary'], 6);
|
||||||
|
$errors['error_data'][$row_index][$keys[$columns_to_check['emp_code']['col_idx']]]['col_name'] = $columns_to_check['emp_code']['col_name'];
|
||||||
|
$errors['error_data'][$row_index][$keys[$columns_to_check['emp_code']['col_idx']]]['col_idx'] = $columns_to_check['emp_code']['col_idx'];
|
||||||
|
$errors['error_data'][$row_index][$keys[$columns_to_check['emp_code']['col_idx']]]['error'][] = $message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $errors;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('check_age_validation')) {
|
||||||
|
function check_age_validation($row, $family_composition)
|
||||||
|
{
|
||||||
|
if ($row[5] != null) {
|
||||||
|
|
||||||
|
$dateString = convert_string_to_date($row[5]);
|
||||||
|
if ($dateString === false) {
|
||||||
|
return array('status' => false, 'error' => 'Not a valid Date');
|
||||||
|
}
|
||||||
|
|
||||||
|
$relationships = $family_composition['age_ratio'];
|
||||||
|
|
||||||
|
$dob = $dateString;
|
||||||
|
$currentDateTime = new DateTime();
|
||||||
|
|
||||||
|
$passedDateTime = new DateTime($dob);
|
||||||
|
$interval = $currentDateTime->diff($passedDateTime);
|
||||||
|
|
||||||
|
$slug = \Config\Services::slug();
|
||||||
|
$relationship = $slug->slugify($row[3]);
|
||||||
|
if($relationship == 'son' || $relationship == 'daughter'){
|
||||||
|
$relationship = 'child';
|
||||||
|
}
|
||||||
|
if($relationship == 'father' || $relationship == 'mother' || $relationship == 'mother-in-law'|| $relationship == 'father-in-law' ){
|
||||||
|
$relationship = 'elders';
|
||||||
|
}
|
||||||
|
|
||||||
|
$age_min = isset($relationships[$relationship]['min']) ? $relationships[$relationship]['min'] : NULL;
|
||||||
|
$age_max = isset($relationships[$relationship]['max']) ? $relationships[$relationship]['max'] : NULL;
|
||||||
|
|
||||||
|
// Kint::dump($dob,$currentDateTime,$passedDateTime, $interval->y, $age_min, $age_max, $relationship, $relationships);
|
||||||
|
|
||||||
|
if ($age_min !== null && $age_min > $interval->y) {
|
||||||
|
return array('status' => false, 'error' => "Age conflict : minimum $age_min yrs allowed, received $interval->y");
|
||||||
|
}
|
||||||
|
if ($age_max !== null && $age_max < $interval->y) {
|
||||||
|
return array('status' => false, 'error' => "Age conflict : maximum $age_max yrs allowed, received $interval->y");
|
||||||
|
}
|
||||||
|
return array('status' => true);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return array('status' => false, 'error' => 'Rule Conflict: Both DOB and Relationship required for age check');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------- END OF LEAD MEMBER DATA LIST VALIDATIONS --------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
44
app/Helpers/sms_helper.php
Normal file
44
app/Helpers/sms_helper.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use CodeIgniter\Database\BaseConnection;
|
||||||
|
|
||||||
|
if (!function_exists('sendOtpSms')) {
|
||||||
|
|
||||||
|
|
||||||
|
function sendOtpSms(string $mobile, string $otp)
|
||||||
|
{
|
||||||
|
$apiKey = env('SMS_API_KEY');
|
||||||
|
$senderId = env('SMS_SENDER_ID');
|
||||||
|
$templateId = env('SMS_TEMPLATE_ID');
|
||||||
|
$serviceName = env('SMS_SERVICE_NAME');
|
||||||
|
$appName = env('SMS_APP_NAME');
|
||||||
|
|
||||||
|
// Replace variables {#var#}
|
||||||
|
$message = "Hi, Your One Time Code for logging into Nhance {$appName} App is {$otp}. Valid for 3 minutes. Please do not share this with anyone. -NHANCE";
|
||||||
|
|
||||||
|
log_message('info' , 'SMS - Message '.$message);
|
||||||
|
|
||||||
|
// Build the API URL
|
||||||
|
$url = "https://smsapi.24x7sms.com/api_2.0/SendSMS.aspx?" . http_build_query([
|
||||||
|
'APIKEY' => $apiKey,
|
||||||
|
'MobileNo' => $mobile,
|
||||||
|
'SenderID' => $senderId,
|
||||||
|
'Message' => $message,
|
||||||
|
'ServiceName' => $serviceName,
|
||||||
|
'DLTTemplateID' => $templateId,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Send request
|
||||||
|
$response = @file_get_contents($url);
|
||||||
|
|
||||||
|
log_message('info' , 'SMS - Response '.$response);
|
||||||
|
|
||||||
|
// If response failed
|
||||||
|
if ($response === FALSE) {
|
||||||
|
return ['status' => 'failed', 'message' => 'Failed to send SMS.'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return ['status' => 'success', 'message' => 'OTP sent successfully', 'api_response' => $response];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -108,7 +108,7 @@ class ClientModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getCreatedByUserName(){
|
public function getCreatedByUserName($client_type = null){
|
||||||
|
|
||||||
$role_id = get_role_id();
|
$role_id = get_role_id();
|
||||||
$user_id = get_session_userid();
|
$user_id = get_session_userid();
|
||||||
@ -118,6 +118,10 @@ class ClientModel extends Model
|
|||||||
->join('client_rm', 'client_rm.client_id = clients.id','left')
|
->join('client_rm', 'client_rm.client_id = clients.id','left')
|
||||||
->where('clients.is_active', 1);
|
->where('clients.is_active', 1);
|
||||||
|
|
||||||
|
if (!empty($client_type)) {
|
||||||
|
$query->where('clients.client_type', $client_type);
|
||||||
|
}
|
||||||
|
|
||||||
if (in_array($role_id, [2, 3])) {
|
if (in_array($role_id, [2, 3])) {
|
||||||
|
|
||||||
// If the user is a Account Manager or Manager, filter by user_id
|
// If the user is a Account Manager or Manager, filter by user_id
|
||||||
|
|||||||
@ -106,9 +106,9 @@ class EmployeeModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getEmpFamilybyEmpCode(string $client_policy_id = null,string $emp_code = null,string $client_id = null,array $emp_status = [],array $policy_status = [],array $relationship = [],array $client_branch_id = [])
|
public function getEmpFamilybyEmpCode(string $client_policy_id = null,string $emp_code = null,string $client_id = null,array $emp_status = [],array $policy_status = [],array $relationship = [],array $client_branch_id = [],array $policy_type_id = [])
|
||||||
{
|
{
|
||||||
$result = $this->select(['employees.id as emp_id', 'employees.client_id','employees.client_branch_id', 'employees.relationship', 'employees.relationship_code', 'employees.change_event', 'employees.emp_code', 'employees.name', 'employees.email_personal', 'employees.email_corporate', 'employees.mobile', 'employees.gender', 'employees.dob', 'employees.doj', 'employees.basic_pay', 'employees.band', 'employees.designation', 'employees.emp_status','employees.unit','employees.file_id','employee_polices.id as emp_policy_id', 'employee_polices.employee_id', 'employee_polices.client_policy_id', 'employee_polices.tpa_id', 'employee_polices.uhid', 'employee_polices.batch_code', 'employee_polices.status', 'employee_polices.pre_existing_alignments', 'employee_polices.basic_cover_si', 'employee_polices.date_coverage', 'employee_polices.policy_end_date', 'employee_polices.days', 'employee_polices.premium', 'employee_polices.rata_premimum', 'employee_polices.gst', 'employee_polices.date_of_exit', 'employee_polices.reason_for_exit','policy_type.long_name as policy_name','client_policy.is_addon', 'employee_polices.payable_employee','employee_polices.rand_string','employee_polices.claim_status'])
|
$result = $this->select(['employees.id as emp_id', 'employees.client_id','employees.client_branch_id', 'employees.relationship', 'employees.relationship_code', 'employees.change_event', 'employees.emp_code', 'employees.name', 'employees.email_personal', 'employees.email_corporate', 'employees.mobile', 'employees.gender', 'employees.dob', 'employees.doj', 'employees.basic_pay', 'employees.band', 'employees.designation', 'employees.emp_status','employees.unit','employees.file_id','employee_polices.id as emp_policy_id', 'employee_polices.employee_id', 'employee_polices.client_policy_id', 'employee_polices.tpa_id', 'employee_polices.uhid', 'employee_polices.batch_code', 'employee_polices.status', 'employee_polices.pre_existing_alignments', 'employee_polices.basic_cover_si', 'employee_polices.date_coverage', 'employee_polices.policy_end_date', 'employee_polices.days', 'employee_polices.premium', 'employee_polices.rata_premimum', 'employee_polices.gst', 'employee_polices.date_of_exit', 'employee_polices.reason_for_exit','policy_type.long_name as policy_name','client_policy.policy_type_id','client_policy.is_addon', 'employee_polices.payable_employee','employee_polices.rand_string','employee_polices.claim_status'])
|
||||||
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
||||||
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
|
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
|
||||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id','left')
|
->join('policy_type', 'policy_type.id = client_policy.policy_type_id','left')
|
||||||
@ -135,6 +135,9 @@ class EmployeeModel extends Model
|
|||||||
})
|
})
|
||||||
->when(count($policy_status), function($query) use ($policy_status){
|
->when(count($policy_status), function($query) use ($policy_status){
|
||||||
return $query->whereIn('employee_polices.status', $policy_status);
|
return $query->whereIn('employee_polices.status', $policy_status);
|
||||||
|
})
|
||||||
|
->when(count($policy_type_id), function($query) use ($policy_type_id){
|
||||||
|
return $query->whereIn('client_policy.policy_type_id', $policy_type_id);
|
||||||
})
|
})
|
||||||
->when($client_id, function($query) use ($client_id){
|
->when($client_id, function($query) use ($client_id){
|
||||||
return $query->where('employees.client_id',$client_id);
|
return $query->where('employees.client_id',$client_id);
|
||||||
|
|||||||
@ -17,7 +17,10 @@ class LeadFilesModel extends Model
|
|||||||
'updated_by',
|
'updated_by',
|
||||||
'created_at',
|
'created_at',
|
||||||
'updated_at',
|
'updated_at',
|
||||||
'is_active'
|
'is_active',
|
||||||
|
'error_data',
|
||||||
|
'status',
|
||||||
|
'type',
|
||||||
];
|
];
|
||||||
|
|
||||||
// Callbacks
|
// Callbacks
|
||||||
|
|||||||
@ -147,6 +147,7 @@ class LeadsModel extends Model
|
|||||||
|
|
||||||
$data = $this->select('
|
$data = $this->select('
|
||||||
leads.*,
|
leads.*,
|
||||||
|
lead_files.status as demography_file_status,
|
||||||
kyc_entity_type.name as entity_type,
|
kyc_entity_type.name as entity_type,
|
||||||
policy_type.policy_type,
|
policy_type.policy_type,
|
||||||
user_profiles.first_name as salse_person_name,
|
user_profiles.first_name as salse_person_name,
|
||||||
@ -169,6 +170,7 @@ class LeadsModel extends Model
|
|||||||
->join('kyc_entity_type', 'leads.entity_type_id = kyc_entity_type.id', 'left')
|
->join('kyc_entity_type', 'leads.entity_type_id = kyc_entity_type.id', 'left')
|
||||||
->join('user_profiles', 'leads.salse_person_id = user_profiles.id', 'left')
|
->join('user_profiles', 'leads.salse_person_id = user_profiles.id', 'left')
|
||||||
->join('policy_type', 'leads.policy_type_id = policy_type.id', 'left')
|
->join('policy_type', 'leads.policy_type_id = policy_type.id', 'left')
|
||||||
|
->join('lead_files', 'leads.id = lead_files.lead_id AND lead_files.type = 2 AND lead_files.is_active = 1', 'left')
|
||||||
->where('leads.is_active', 1);
|
->where('leads.is_active', 1);
|
||||||
|
|
||||||
if (!empty($where)) {
|
if (!empty($where)) {
|
||||||
|
|||||||
@ -110,13 +110,14 @@ input:checked + .slider:before {
|
|||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="client_name">Client Name<span
|
<label for="client_name">Client Name<span
|
||||||
class="text-danger">*</span></label>
|
class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="client_name"
|
<input type="text" class="form-control" id="client_name" data-old-name="<?= isset($client['client_name']) ? $client['client_name'] : '' ?>"
|
||||||
placeholder="Enter Client Name" value="<?= isset($client['client_name']) ? $client['client_name'] : '' ?>" name="client_name" required>
|
placeholder="Enter Client Name" value="<?= isset($client['client_name']) ? $client['client_name'] : '' ?>" name="client_name" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="short_name">Client Short Name<span
|
<label for="short_name">Client Short Name<span
|
||||||
class="text-danger">*</span></label>
|
class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="short_name"
|
<input type="text" class="form-control" id="short_name"
|
||||||
|
data-old-short="<?= isset($client['short_name']) ? $client['short_name'] : '' ?>"
|
||||||
placeholder="Enter Short Name" value="<?= isset($client['short_name']) ? $client['short_name'] : '' ?>" name="short_name" onkeyup="validateInput(this, 'clients', 'short_name', 'clientBtnSubmit')" required>
|
placeholder="Enter Short Name" value="<?= isset($client['short_name']) ? $client['short_name'] : '' ?>" name="short_name" onkeyup="validateInput(this, 'clients', 'short_name', 'clientBtnSubmit')" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -870,6 +870,83 @@ function checkMobileNumber(input) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// function generateShortName() {
|
||||||
|
// let clientName = $("#client_name").val().trim();
|
||||||
|
// if (clientName.length > 0) {
|
||||||
|
// let shortName = clientName.substring(0, 10).replace(/\s+/g, '').toUpperCase(); // Take first 10 chars , space removed, converted caps
|
||||||
|
// $("#short_name").val(shortName);
|
||||||
|
// makeUniqueShortName(shortName);
|
||||||
|
// }else{
|
||||||
|
// $("#short_name").val('');
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
let shortNameTimer;
|
||||||
|
|
||||||
|
$("#client_name").on("input change keyup", function() {
|
||||||
|
clearTimeout(shortNameTimer); // cancel previous call
|
||||||
|
shortNameTimer = setTimeout(() => {
|
||||||
|
generateShortName(); // only runs after 200ms pause
|
||||||
|
}, 200); // adjust debounce delay as needed
|
||||||
|
});
|
||||||
|
|
||||||
|
function generateShortName() {
|
||||||
|
let clientInput = $("#client_name");
|
||||||
|
let shortInput = $("#short_name");
|
||||||
|
|
||||||
|
let oldClientName = clientInput.data("old-name"); // from DB
|
||||||
|
let oldShortName = shortInput.data("old-short"); // from DB
|
||||||
|
let newClientName = clientInput.val().trim();
|
||||||
|
console.log(`LN 882 : NEW - ${newClientName} | OLD - ${oldClientName} | OLD SN - ${oldShortName}`);
|
||||||
|
|
||||||
|
if (newClientName.toUpperCase() === (oldClientName || '').toUpperCase()) {
|
||||||
|
shortInput.val(oldShortName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newClientName.length == 0) {
|
||||||
|
shortInput.val('');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newClientName.length > 0) {
|
||||||
|
let shortName = newClientName.substring(0, 10).replace(/\s+/g, '').toUpperCase();
|
||||||
|
shortInput.val(shortName);
|
||||||
|
makeUniqueShortName(shortName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function makeUniqueShortName(baseName) {
|
||||||
|
let input = $("#short_name")[0]; // input element
|
||||||
|
checkDuplicateTableFieldValue("clients", "short_name", baseName, function(isDuplicate) {
|
||||||
|
if (isDuplicate) {
|
||||||
|
// Append sequence until unique
|
||||||
|
let counter = 1;
|
||||||
|
function tryNext() {
|
||||||
|
let padded = String(counter).padStart(3, '0'); // 001, 002, 003
|
||||||
|
let newName = baseName + padded;
|
||||||
|
|
||||||
|
checkDuplicateTableFieldValue("clients", "short_name", newName, function(exists) {
|
||||||
|
if (exists) {
|
||||||
|
counter++;
|
||||||
|
tryNext(); // keep checking
|
||||||
|
} else {
|
||||||
|
$("#short_name").val(newName);
|
||||||
|
validateInput(input, "clients", "short_name", "clientBtnSubmit");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
tryNext();
|
||||||
|
} else {
|
||||||
|
$("#short_name").val(baseName);
|
||||||
|
validateInput(input, "clients", "short_name", "clientBtnSubmit");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function validateInput(input, table, field, submitButId){
|
function validateInput(input, table, field, submitButId){
|
||||||
|
|
||||||
let value = $(input).val();
|
let value = $(input).val();
|
||||||
|
|||||||
@ -294,10 +294,10 @@ table.dataTable thead th {
|
|||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$('#lead_id').select2();
|
$('#lead_id').select2();
|
||||||
})
|
})
|
||||||
|
var table;
|
||||||
$(document).ready(function()
|
$(document).ready(function()
|
||||||
{
|
{
|
||||||
$('#tickets-table').DataTable({
|
table = $('#tickets-table').DataTable({
|
||||||
dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" +
|
dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" +
|
||||||
"<'row'<'col-sm-12'tr>>" +
|
"<'row'<'col-sm-12'tr>>" +
|
||||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||||
@ -326,6 +326,11 @@ $(document).ready(function()
|
|||||||
extend: 'csv',
|
extend: 'csv',
|
||||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||||
title: 'Client-List',
|
title: 'Client-List',
|
||||||
|
// title: function() {
|
||||||
|
// return $('#toggleButtons').is(':checked')
|
||||||
|
// ? 'GC-Client-List'
|
||||||
|
// : 'RC-Client-List';
|
||||||
|
// },
|
||||||
className: 'app-btn-primary ',
|
className: 'app-btn-primary ',
|
||||||
exportOptions: {
|
exportOptions: {
|
||||||
columns: ':not(:last-child)'
|
columns: ':not(:last-child)'
|
||||||
@ -340,13 +345,104 @@ $(document).ready(function()
|
|||||||
_INPUT_
|
_INPUT_
|
||||||
<i class="mdi mdi-magnify datatable-search-icon"></i>
|
<i class="mdi mdi-magnify datatable-search-icon"></i>
|
||||||
</div>`,
|
</div>`,
|
||||||
searchPlaceholder: "Search"
|
searchPlaceholder: "Search",
|
||||||
|
emptyTable: '<div class="text-center text-muted">No Data found</div>'
|
||||||
},
|
},
|
||||||
paging: true ,
|
paging: true ,
|
||||||
// pagingType: 'full_numbers'
|
// pagingType: 'full_numbers'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// $(".datatable-buttons").prepend(`
|
||||||
|
// <label class="switch">
|
||||||
|
// <input type="checkbox" id="toggleButtons">
|
||||||
|
// <span">Group</span>
|
||||||
|
// </label>
|
||||||
|
// `);
|
||||||
|
|
||||||
|
$(".datatable-buttons").prepend(`
|
||||||
|
<span id="statusSwitchWrapper" class="dt-switch-wrapper">
|
||||||
|
<span class="custom-switch" style="text-align: left;">
|
||||||
|
<input type="checkbox" class="custom-control-input" id="toggleButtons" checked>
|
||||||
|
<label class="custom-control-label" for="toggleButtons" style="vertical-align: middle !important;">Group Client</label>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
`);
|
||||||
|
$('#toggleButtons').on('change', function() {
|
||||||
|
let type = $(this).is(':checked') ? 1 : 2;
|
||||||
|
// $('div.col-6 h4').text(
|
||||||
|
// $(this).is(':checked')
|
||||||
|
// ? "GC Client List"
|
||||||
|
// : "RC Client List"
|
||||||
|
// );
|
||||||
|
let url = '<?= base_url('client/typeList/') ?>' + type;
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
method: 'GET',
|
||||||
|
success: function(response) {
|
||||||
|
if (response.status === "success" && Array.isArray(response.data)) {
|
||||||
|
renderRows(response.data);
|
||||||
|
} else {
|
||||||
|
renderRows([]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error("Error loading:", error);
|
||||||
|
renderRows([]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function renderRows(data) {
|
||||||
|
table.clear();
|
||||||
|
if (Array.isArray(data) && data.length) {
|
||||||
|
data.forEach((row, index) => {
|
||||||
|
let clientrm = <?= json_encode($client_rm) ?>;
|
||||||
|
let account_managers = "";
|
||||||
|
|
||||||
|
clientrm.forEach(client => {
|
||||||
|
if (client.client_id == row.id) {
|
||||||
|
account_managers += client.account_manager + ", ";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
account_managers = account_managers.replace(/,\s*$/, "");
|
||||||
|
if (account_managers === "") account_managers = "N/A";
|
||||||
|
|
||||||
|
let rowData = [
|
||||||
|
index + 1,
|
||||||
|
`<span class="client_info" data-id="${row.id}">${row.client_name} (${row.short_name})</span>`,
|
||||||
|
account_managers,
|
||||||
|
`<div class="btn-group dropdown">
|
||||||
|
<a href="javascript:void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown">
|
||||||
|
<i class="mdi mdi-dots-horizontal"></i>
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
|
<a class="dropdown-item" href="<?= base_url("client/list/") ?>${row.id}">
|
||||||
|
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||||
|
</a>
|
||||||
|
<a class="dropdown-item" href="<?= base_url("client/deposit/") ?>${row.id}">
|
||||||
|
<i class="mdi mdi-cash mr-2 text-muted font-18 vertical-middle"></i>CD Transactions
|
||||||
|
</a>
|
||||||
|
<?php if(in_array(get_role_id(), [1, 5])) { ?>
|
||||||
|
<a class="dropdown-item" data-id="${row.id}" onclick="removeClient(this)">
|
||||||
|
<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete
|
||||||
|
</a>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
</div>`
|
||||||
|
];
|
||||||
|
|
||||||
|
let newRow = table.row.add(rowData);
|
||||||
|
$(newRow.node()).find('td:eq(0)').addClass('text-center');
|
||||||
|
$(newRow.node()).find('td:eq(1)').addClass('client_info').attr('data-id', row.id);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
table.draw();
|
||||||
|
}
|
||||||
|
|
||||||
//DO NOT REMOVE THIS FUNCTION >>> THI FUNCTION FOR CLIENT SOFT DELETE
|
//DO NOT REMOVE THIS FUNCTION >>> THI FUNCTION FOR CLIENT SOFT DELETE
|
||||||
// function removeClient(element)
|
// function removeClient(element)
|
||||||
// {
|
// {
|
||||||
|
|||||||
@ -332,7 +332,8 @@
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="#hr-access-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="hr_access_tab" onclick="appendHrAccessControllHtml(this)">
|
<a href="#hr-access-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="hr_access_tab" onclick="appendHrAccessControllHtml(this)">
|
||||||
<span class="mr-1"><i class="mdi mdi-book-open-page-variant"></i></span>
|
<span class="mr-1"><i class="mdi mdi-book-open-page-variant"></i></span>
|
||||||
<span class="d-none d-sm-inline-block">HR Access Control</span>
|
<span class="d-none d-sm-inline-block">Client Access Control</span>
|
||||||
|
<!-- Name Changed "HR Access Controll" into "Client Access Control" -->
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
@ -563,7 +564,7 @@
|
|||||||
client_notification();
|
client_notification();
|
||||||
});
|
});
|
||||||
|
|
||||||
//HR Access Controll
|
//HR Access Controll also know as "Client Access Control"
|
||||||
function appendHrAccessControllHtml(input) {
|
function appendHrAccessControllHtml(input) {
|
||||||
console.log(input.id);
|
console.log(input.id);
|
||||||
let client_id = $('#general_PrimaryKey').val();
|
let client_id = $('#general_PrimaryKey').val();
|
||||||
|
|||||||
@ -200,7 +200,8 @@
|
|||||||
<span class="slider round" style="height: 27px;"></span>
|
<span class="slider round" style="height: 27px;"></span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label for="policy_visibility" style="position: relative;bottom: 5px;left: 85px;">Policy Visibilty in Enrollment App</label>
|
<!-- <label for="policy_visibility" style="position: relative;bottom: 5px;left: 85px;">Policy Visibilty in Enrollment App</label> -->
|
||||||
|
<label for="policy_visibility" style="position: relative;bottom: 5px;left: 85px;">Policy Visibilty in Employee App</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-4 EB">
|
<div class="form-group col-md-4 EB">
|
||||||
|
|||||||
@ -110,7 +110,18 @@ table.dataTable tbody td {
|
|||||||
<!-- Include DataTables Buttons HTML5 export extension -->
|
<!-- Include DataTables Buttons HTML5 export extension -->
|
||||||
<script src="https://cdn.datatables.net/buttons/2.3.0/js/buttons.html5.min.js"></script>
|
<script src="https://cdn.datatables.net/buttons/2.3.0/js/buttons.html5.min.js"></script>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if (isset($lead_id)) {
|
||||||
|
$url = base_url("util/downloadFullMemberDataExcelErrorFile/") . $lead_id;
|
||||||
|
} else {
|
||||||
|
$url = base_url("util/full-excel-error-file/") . $file_id;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
let url = "<?= $url ?>";
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#tickets-table').DataTable({
|
$('#tickets-table').DataTable({
|
||||||
dom: 'Bfrtip',
|
dom: 'Bfrtip',
|
||||||
@ -123,7 +134,7 @@ $(document).ready(function() {
|
|||||||
{
|
{
|
||||||
text: 'Excel Error', // Set the text for the custom button
|
text: 'Excel Error', // Set the text for the custom button
|
||||||
action: function (e, dt, node, config) {
|
action: function (e, dt, node, config) {
|
||||||
window.location.href = '<?= base_url("util/full-excel-error-file/") . $file_id ?>';
|
window.location.href = url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@ -184,7 +184,18 @@ table.dataTable tbody td {
|
|||||||
<?php if(isset($lead_data_list)) { ?>
|
<?php if(isset($lead_data_list)) { ?>
|
||||||
<?php foreach($lead_data_list as $index => $row){ ?>
|
<?php foreach($lead_data_list as $index => $row){ ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-center"><?php echo $index + 1; ?></td>
|
<td class="text-center">
|
||||||
|
<?php echo $index + 1; ?>
|
||||||
|
<?php if($row['demography_file_status'] == "failed") { ?>
|
||||||
|
<a href="<?= base_url('util/getMemberDataExcelFileErrors?lead_id=').$row['id'] ?>"
|
||||||
|
class="mdi mdi-information-outline text-danger"
|
||||||
|
style="cursor: pointer; font-size: 16px"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
data-placement="top"
|
||||||
|
title="Click to view the Demography File Error data" target="_blank">
|
||||||
|
</a>
|
||||||
|
<?php } ?>
|
||||||
|
</td>
|
||||||
<td><?php echo $lead_type[$row['lead_type']] ?? '-'; ?></td>
|
<td><?php echo $lead_type[$row['lead_type']] ?? '-'; ?></td>
|
||||||
<td><?php echo $issuer[$row['issuer']] ?? '-'; ?></td>
|
<td><?php echo $issuer[$row['issuer']] ?? '-'; ?></td>
|
||||||
<td><?php echo $client_type[$row['client_type']] ?? '-'; ?></td>
|
<td><?php echo $client_type[$row['client_type']] ?? '-'; ?></td>
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
<style>
|
<style>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.table-container {
|
.table-container {
|
||||||
overflow-x: auto !important;
|
overflow-x: auto !important;
|
||||||
/* margin-top: 20px; */
|
/* margin-top: 20px; */
|
||||||
@ -178,18 +176,18 @@
|
|||||||
width: 300px;
|
width: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-header {
|
/* .dialog-header {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
} */
|
||||||
|
|
||||||
.dialog-content {
|
.dialog-content {
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-footer {
|
/* .dialog-footer {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
} */
|
||||||
|
|
||||||
.dialog button {
|
.dialog button {
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
@ -310,16 +308,205 @@
|
|||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
.dialog {
|
||||||
|
position: fixed;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
background: white;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
|
||||||
|
z-index: 1000;
|
||||||
|
width: 90%;
|
||||||
|
max-width: 450px;
|
||||||
|
max-height: 90vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-header {
|
||||||
|
padding: 10px 20px;
|
||||||
|
border-bottom: 1px solid #ddd;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
background: #f8f9fa;
|
||||||
|
border-radius: 8px 8px 0 0;
|
||||||
|
position: relative;
|
||||||
|
top: -7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-content {
|
||||||
|
padding: 22px;
|
||||||
|
/* overflow-y: auto;
|
||||||
|
overflow-x: hidden; */
|
||||||
|
flex: 1;
|
||||||
|
/* max-height: calc(80vh - 120px); */
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-content::-webkit-scrollbar {
|
||||||
|
width: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-content::-webkit-scrollbar-track {
|
||||||
|
background: #f1f1f1;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-content::-webkit-scrollbar-thumb {
|
||||||
|
background: #888;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-content::-webkit-scrollbar-thumb:hover {
|
||||||
|
background: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-footer {
|
||||||
|
padding: 5px 5px;
|
||||||
|
/* border-top: 1px solid #ddd; */
|
||||||
|
text-align: right;
|
||||||
|
flex-shrink: 0;
|
||||||
|
/* background: #f8f9fa; */
|
||||||
|
/* border-radius: 0 0 8px 8px; */
|
||||||
|
margin-top: -41px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Family Row Layout */
|
||||||
|
.family-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 15px;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
min-height: 45px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.family-member-col {
|
||||||
|
flex: 0 0 200px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.family-member-col.full-width {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.family-member-col > label {
|
||||||
|
font-weight: 500;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.family-member-col input[type="checkbox"] {
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.age-inputs-col {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
gap: 15px;
|
||||||
|
align-items: flex-start;
|
||||||
|
transition: opacity 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.age-inputs-col.hidden {
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.age-input-group {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.age-label {
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #666;
|
||||||
|
margin-bottom: 3px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.age-input {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 120px;
|
||||||
|
padding: 6px 10px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.age-input:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: #007bff;
|
||||||
|
box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
.select-small {
|
||||||
|
width: 200px !important;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-control {
|
||||||
|
width: 100%;
|
||||||
|
padding: 6px 10px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Responsive */
|
||||||
|
@media (max-width: 576px) {
|
||||||
|
.family-row {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.family-member-col {
|
||||||
|
flex: 1;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.age-inputs-col {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.age-input {
|
||||||
|
max-width: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
<div class="row" id="inception_list">
|
<div class="row" id="inception_list">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<div class="row" style="margin-bottom:1rem;">
|
<div class="row" style="margin-bottom:1rem;">
|
||||||
<div class="col-6" style="align-self: center;">
|
<div class="col-4" style="align-self: center;">
|
||||||
<h4 style="position: relative;" id="rfq_qcr_page_title"> <?= isset($page_name) ? $page_name : 'RFQ' ?></h4>
|
<h4 style="position: relative;" id="rfq_qcr_page_title"> <?= isset($page_name) ? $page_name : 'RFQ' ?></h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="col-2" style="position: relative;right: 255px;">
|
||||||
|
<?php if($lead_data['demography_file_status'] == "failed") { ?>
|
||||||
|
<a href="<?= base_url('util/getMemberDataExcelFileErrors?lead_id=').$lead_data['id'] ?>"
|
||||||
|
class="mdi mdi-information-outline text-danger"
|
||||||
|
style="cursor: pointer; font-size: 27px"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
data-placement="top"
|
||||||
|
title="Member data demography file validation failed Click to view the Error data" target="_blank">
|
||||||
|
</a>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-2" id="status_change"
|
<div class="col-2" id="status_change"
|
||||||
style="text-align: right; position: relative;top: 56px; left: 386px;">
|
style="text-align: right; position: relative;top: 56px; left: 386px;">
|
||||||
<a onclick="checkTheTableDataChanged(1)" class="btn btn-primary">Back</a>
|
<a onclick="checkTheTableDataChanged(1)" class="btn btn-primary">Back</a>
|
||||||
@ -426,51 +613,130 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- familiy floater dialog -->
|
<!-- familiy floater dialog -->
|
||||||
<div class="dialog" id="familyFloaterDialog">
|
<div class="dialog" id="familyFloaterDialog" style="display: none;">
|
||||||
<div class="dialog-header ">
|
<div class="dialog-header">
|
||||||
<span style="color:black;" >Family Members </span>
|
<span style="color:black;">Family Members</span>
|
||||||
<span>
|
<span>
|
||||||
<i class="mdi mdi-close remove-icon" id="closeDialogBtn" aria-hidden="true"
|
<i class="mdi mdi-close remove-icon" id="closeDialogBtn" aria-hidden="true"
|
||||||
style="color: black;text-align: right;margin-left: 80px;margin-top:10px;"></i>
|
style="color: black;text-align: right;margin-left: 80px;margin-top:10px;"></i>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="dialog-content">
|
<div class="dialog-content">
|
||||||
<label>
|
<!-- Self -->
|
||||||
<input type="checkbox" id="family_self" checked>
|
<div class="family-row">
|
||||||
Self
|
<div class="family-member-col" style="margin-top: 15px;">
|
||||||
</label><br>
|
<label>
|
||||||
<label>
|
<input type="checkbox" id="family_self" checked onchange="toggleAgeFields(this, 'self')">
|
||||||
<input type="checkbox" id="family_spouse">
|
Self
|
||||||
Spouse
|
</label>
|
||||||
</label><br>
|
</div>
|
||||||
<label for="children">Children:</label>
|
<div class="age-inputs-col" id="self_age_fields">
|
||||||
<select class="form-control" id="family_children">
|
<div class="age-input-group" style="margin-top: -23px;">
|
||||||
<option value="0">0</option>
|
<label class="age-label">Min Age</label>
|
||||||
<option value="1">1</option>
|
<input type="number" class="age-input" id="family_self_min_age"
|
||||||
<option value="2">2</option>
|
placeholder="18" min="18" max="99">
|
||||||
<option value="3">3</option>
|
</div>
|
||||||
<option value="4">4</option>
|
<div class="age-input-group" style="margin-top: -23px;">
|
||||||
</select><br>
|
<label class="age-label">Max Age</label>
|
||||||
<label for="otherMembers">Other Members:</label>
|
<input type="number" class="age-input" id="family_self_max_age"
|
||||||
<select class="form-control" id="family_other_members" onchange="setEldersCount(this)">
|
placeholder="99" min="18" max="99">
|
||||||
<option value="0">Select</option>
|
</div>
|
||||||
<option data-value="1" value="oneparent">Only one parent (Either Father / Mother)</option>
|
</div>
|
||||||
<option data-value="2" value="twoparent">Only two parents (Father+Mother)</option>
|
</div>
|
||||||
<option data-value="1" value="onepil">Only one parent in law (Either MIL / FIL)</option>
|
|
||||||
<option data-value="2" value="twopil">Only two parents in law (FIL + MIL)</option>
|
<!-- Spouse -->
|
||||||
<option data-value="2" value="either_par_pil">Parents or PIL (Any two of Father, Mother, MIl, FIL)</option>
|
<div class="family-row">
|
||||||
<option data-value="2" value="any_two">Either Parents or PIL (Parents or Parents In Law)</option>
|
<div class="family-member-col" style="margin-top: 24px;">
|
||||||
<option data-value="4" value="all">Parents + PIL (Father + Mother + MIL + FIL)</option>
|
<label>
|
||||||
</select><br>
|
<input type="checkbox" id="family_spouse" onchange="toggleAgeFields(this, 'spouse')">
|
||||||
<label for="eldersCount">Elders Count:</label>
|
Spouse
|
||||||
<input class="form-control" type="text" id="family_elders_count" readonly>
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="age-inputs-col hidden" id="spouse_age_fields">
|
||||||
|
<div class="age-input-group" style="margin-top: -11px;">
|
||||||
|
<label class="age-label">Min Age</label>
|
||||||
|
<input type="number" class="age-input" id="family_spouse_min_age"
|
||||||
|
placeholder="18" min="18" max="99">
|
||||||
|
</div>
|
||||||
|
<div class="age-input-group" style="margin-top: -11px;">
|
||||||
|
<label class="age-label">Max Age</label>
|
||||||
|
<input type="number" class="age-input" id="family_spouse_max_age"
|
||||||
|
placeholder="99" min="18" max="99">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Children -->
|
||||||
|
<div class="family-row">
|
||||||
|
<div class="family-member-col">
|
||||||
|
<label for="children">Children:</label>
|
||||||
|
<select class="form-control select-small" id="family_children" onchange="toggleAgeFields(this, 'children')">
|
||||||
|
<option value="0">0</option>
|
||||||
|
<option value="1">1</option>
|
||||||
|
<option value="2">2</option>
|
||||||
|
<option value="3">3</option>
|
||||||
|
<option value="4">4</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="age-inputs-col hidden" id="children_age_fields">
|
||||||
|
<div class="age-input-group">
|
||||||
|
<label class="age-label">Min Age</label>
|
||||||
|
<input type="number" class="age-input" id="family_children_min_age"
|
||||||
|
placeholder="0" min="0" max="25">
|
||||||
|
</div>
|
||||||
|
<div class="age-input-group">
|
||||||
|
<label class="age-label">Max Age</label>
|
||||||
|
<input type="number" class="age-input" id="family_children_max_age"
|
||||||
|
placeholder="25" min="0" max="25">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Other Members -->
|
||||||
|
<div class="family-row">
|
||||||
|
<div class="family-member-col">
|
||||||
|
<label for="otherMembers">Other Members:</label>
|
||||||
|
<select class="form-control" id="family_other_members" onchange="setEldersCount(this); toggleAgeFields(this, 'others')">
|
||||||
|
<option value="0">Select</option>
|
||||||
|
<option data-value="1" value="oneparent">Only one parent (Either Father / Mother)</option>
|
||||||
|
<option data-value="2" value="twoparent">Only two parents (Father+Mother)</option>
|
||||||
|
<option data-value="1" value="onepil">Only one parent in law (Either MIL / FIL)</option>
|
||||||
|
<option data-value="2" value="twopil">Only two parents in law (FIL + MIL)</option>
|
||||||
|
<option data-value="2" value="either_par_pil">Parents or PIL (Any two of Father, Mother, MIl, FIL)</option>
|
||||||
|
<option data-value="2" value="any_two">Either Parents or PIL (Parents or Parents In Law)</option>
|
||||||
|
<option data-value="4" value="all">Parents + PIL (Father + Mother + MIL + FIL)</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="age-inputs-col hidden" id="others_age_fields">
|
||||||
|
<div class="age-input-group">
|
||||||
|
<label class="age-label">Min Age</label>
|
||||||
|
<input type="number" class="age-input" id="family_others_min_age"
|
||||||
|
placeholder="40" min="40" max="99">
|
||||||
|
</div>
|
||||||
|
<div class="age-input-group">
|
||||||
|
<label class="age-label">Max Age</label>
|
||||||
|
<input type="number" class="age-input" id="family_others_max_age"
|
||||||
|
placeholder="99" min="40" max="99" >
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Elders Count -->
|
||||||
|
<div class="family-row">
|
||||||
|
<div class="family-member-col full-width">
|
||||||
|
<label for="eldersCount">Elders Count:</label>
|
||||||
|
<input class="form-control" type="text" id="family_elders_count" readonly>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<input type="text" id="familiy_dialog_row_index" style="display: none;" readonly>
|
<input type="text" id="familiy_dialog_row_index" style="display: none;" readonly>
|
||||||
<input type="text" id="familiy_dialog_column_index" style="display: none;" readonly>
|
<input type="text" id="familiy_dialog_column_index" style="display: none;" readonly>
|
||||||
</div>
|
</div>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<button class="btn btn-primary btn-sm" id="savefamiliy" onclick="saveFamilyMembersDetails()">save</button>
|
<button class="btn btn-primary btn-sm" id="savefamiliy" onclick="saveFamilyMembersDetails()">Save</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- familiy floater dialog end -->
|
<!-- familiy floater dialog end -->
|
||||||
|
|
||||||
<!-- Modal content for Send Insurer and Client Mail -->
|
<!-- Modal content for Send Insurer and Client Mail -->
|
||||||
@ -765,10 +1031,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
<div class="form-group text-right m-b-0" id="send_mail_btn">
|
||||||
<button type="submit" class="btn btn-primary" onclick="constructURL(3)">Send Mail</button>
|
<button type="submit" class="btn btn-primary" onclick="constructURL(3)">Send Mail</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group text-right m-b-0" id="validate_file_btn" style="display: none;">
|
||||||
|
<button type="submit" class="btn btn-warning" onclick="savePlacementDataAndValidateMemberDataFile(3)">Validate File</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div><!-- /.modal-content -->
|
</div><!-- /.modal-content -->
|
||||||
</div>
|
</div>
|
||||||
@ -1081,13 +1351,16 @@ let intervalId;
|
|||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
console.log("Document ready");
|
console.log("Document ready");
|
||||||
|
|
||||||
|
var demography_file_status_for_hide_and_show = '<?= $lead_data['demography_file_status'] ?>';
|
||||||
|
toggleButtons(demography_file_status_for_hide_and_show);
|
||||||
|
|
||||||
let lead_status = '<?= isset($lead_data['status']) ? $lead_data['status'] : '' ?>';
|
let lead_status = '<?= isset($lead_data['status']) ? $lead_data['status'] : '' ?>';
|
||||||
console.log('Lead status retrieved:', lead_status);
|
console.log('Lead status retrieved:', lead_status);
|
||||||
|
|
||||||
if (lead_status != "won") {
|
if (lead_status != "won") {
|
||||||
console.log("Lead status is not 'won', setting interval for submitData");
|
console.log("Lead status is not 'won', setting interval for submitData");
|
||||||
|
|
||||||
startInterval();
|
// startInterval();
|
||||||
} else {
|
} else {
|
||||||
console.log("Lead status is 'won', submitData will not be called");
|
console.log("Lead status is 'won', submitData will not be called");
|
||||||
}
|
}
|
||||||
@ -1121,10 +1394,12 @@ const closeDialogBtn = document.getElementById('closeDialogBtn');
|
|||||||
// };
|
// };
|
||||||
$('.remove-icon').on('click', function() {
|
$('.remove-icon').on('click', function() {
|
||||||
$('#familyFloaterDialog').css('display', 'none');
|
$('#familyFloaterDialog').css('display', 'none');
|
||||||
|
resetFamiliyDialogModalValues();
|
||||||
});
|
});
|
||||||
|
|
||||||
var currentThrdottedMenu = '';
|
var currentThrdottedMenu = '';
|
||||||
var proposal_colum_count = 1;
|
var proposal_colum_count = 1;
|
||||||
|
var demography_file_status = '<?= $lead_data['demography_file_status'] ?>';
|
||||||
|
|
||||||
var over_all_column_data = {
|
var over_all_column_data = {
|
||||||
"Proposal 1": {
|
"Proposal 1": {
|
||||||
@ -1133,6 +1408,7 @@ var over_all_column_data = {
|
|||||||
'insurers': []
|
'insurers': []
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
const textarea = document.getElementById('placement_mail_content');
|
const textarea = document.getElementById('placement_mail_content');
|
||||||
const textarea2 = document.getElementById("placement_subject");
|
const textarea2 = document.getElementById("placement_subject");
|
||||||
@ -1179,7 +1455,7 @@ function showFamilyFloaterDialogBox(target) {
|
|||||||
let hiddenInput = target.querySelector('input[type="hidden"]');
|
let hiddenInput = target.querySelector('input[type="hidden"]');
|
||||||
// alert(hiddenInput);
|
// alert(hiddenInput);
|
||||||
let inputValue = hiddenInput ? hiddenInput.value : null;
|
let inputValue = hiddenInput ? hiddenInput.value : null;
|
||||||
// console.log('hidden input value');
|
console.log('hidden input value');
|
||||||
console.log(inputValue);
|
console.log(inputValue);
|
||||||
if (inputValue !== null && inputValue !== '') {
|
if (inputValue !== null && inputValue !== '') {
|
||||||
//get stored familiy composition json if any in hidden input and display it
|
//get stored familiy composition json if any in hidden input and display it
|
||||||
@ -1189,6 +1465,8 @@ function showFamilyFloaterDialogBox(target) {
|
|||||||
|
|
||||||
setFamilyDialogValues(inputValue);
|
setFamilyDialogValues(inputValue);
|
||||||
// return true;
|
// return true;
|
||||||
|
}else{
|
||||||
|
resetFamiliyDialogModalValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
// setCellInnerHTMLByCellIndex('rfqTable', currentTD.rowIndex, (currentTD.columnIndex), '<b>TEST</b>');
|
// setCellInnerHTMLByCellIndex('rfqTable', currentTD.rowIndex, (currentTD.columnIndex), '<b>TEST</b>');
|
||||||
@ -1207,6 +1485,19 @@ function saveFamilyMembersDetails() {
|
|||||||
var elders = $('#family_other_members').val();
|
var elders = $('#family_other_members').val();
|
||||||
var elders_count = $('#family_elders_count').val();
|
var elders_count = $('#family_elders_count').val();
|
||||||
|
|
||||||
|
// --- Get min/max age values ---
|
||||||
|
let self_min_age = $('#family_self_min_age').val();
|
||||||
|
let self_max_age = $('#family_self_max_age').val();
|
||||||
|
|
||||||
|
let spouse_min_age = $('#family_spouse_min_age').val();
|
||||||
|
let spouse_max_age = $('#family_spouse_max_age').val();
|
||||||
|
|
||||||
|
let children_min_age = $('#family_children_min_age').val();
|
||||||
|
let children_max_age = $('#family_children_max_age').val();
|
||||||
|
|
||||||
|
let others_min_age = $('#family_others_min_age').val();
|
||||||
|
let others_max_age = $('#family_others_max_age').val();
|
||||||
|
|
||||||
console.log('Current Family Modal Values');
|
console.log('Current Family Modal Values');
|
||||||
console.log('self' + '-' + self);
|
console.log('self' + '-' + self);
|
||||||
console.log('spouse' + '-' + spouse);
|
console.log('spouse' + '-' + spouse);
|
||||||
@ -1227,8 +1518,17 @@ function saveFamilyMembersDetails() {
|
|||||||
'spouse': spouse,
|
'spouse': spouse,
|
||||||
'children': children,
|
'children': children,
|
||||||
'family_other_members': elders,
|
'family_other_members': elders,
|
||||||
'elders_count': elders_count
|
'elders_count': elders_count,
|
||||||
|
'self_min_age': self_min_age,
|
||||||
|
'self_max_age': self_max_age,
|
||||||
|
'spouse_min_age': spouse_min_age,
|
||||||
|
'spouse_max_age': spouse_max_age,
|
||||||
|
'children_min_age': children_min_age,
|
||||||
|
'children_max_age': children_max_age,
|
||||||
|
'others_min_age': others_min_age,
|
||||||
|
'others_max_age': others_max_age
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('display string');
|
console.log('display string');
|
||||||
console.log(display_value);
|
console.log(display_value);
|
||||||
|
|
||||||
@ -1256,16 +1556,36 @@ function saveFamilyMembersDetails() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resetFamiliyDialogModalValues() {
|
function resetFamiliyDialogModalValues() {
|
||||||
|
|
||||||
$('#familiy_dialog_row_index').val('');
|
$('#familiy_dialog_row_index').val('');
|
||||||
$('#familiy_dialog_column_index').val('');
|
$('#familiy_dialog_column_index').val('');
|
||||||
// $('#family_self').val('');
|
|
||||||
$('#family_self').prop('checked', true); // Checks the checkbox
|
|
||||||
|
|
||||||
// $('#family_spouse').val('');
|
// Reset Self
|
||||||
$('#family_spouse').prop('checked', false); // Checks the checkbox
|
$('#family_self').prop('checked', true);
|
||||||
$('#family_children').val(0)
|
$('#family_self_min_age').val('18');
|
||||||
|
$('#family_self_max_age').val('99');
|
||||||
|
$('#self_age_fields').removeClass('hidden');
|
||||||
|
|
||||||
|
// Reset Spouse
|
||||||
|
$('#family_spouse').prop('checked', false);
|
||||||
|
$('#family_spouse_min_age').val('0');
|
||||||
|
$('#family_spouse_max_age').val('0');
|
||||||
|
$('#spouse_age_fields').addClass('hidden');
|
||||||
|
|
||||||
|
// Reset Children
|
||||||
|
$('#family_children').val('0');
|
||||||
|
$('#family_children_min_age').val('0');
|
||||||
|
$('#family_children_max_age').val('0');
|
||||||
|
$('#children_age_fields').addClass('hidden');
|
||||||
|
|
||||||
|
// Reset Other Members
|
||||||
$('#family_other_members').val('0');
|
$('#family_other_members').val('0');
|
||||||
$('#family_elders_count').val(0);
|
$('#family_others_min_age').val('0');
|
||||||
|
$('#family_others_max_age').val('0');
|
||||||
|
$('#others_age_fields').addClass('hidden');
|
||||||
|
|
||||||
|
// Reset Elders Count
|
||||||
|
$('#family_elders_count').val('0');
|
||||||
}
|
}
|
||||||
|
|
||||||
function createFamilyDisplayString(familyArray) {
|
function createFamilyDisplayString(familyArray) {
|
||||||
@ -1307,6 +1627,9 @@ function createFamilyDisplayString(familyArray) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createFamilyJSONString(familyArray) {
|
function createFamilyJSONString(familyArray) {
|
||||||
|
|
||||||
|
console.log('familyArray', familyArray);
|
||||||
|
|
||||||
let result = {
|
let result = {
|
||||||
"self": familyArray['self'] || 0,
|
"self": familyArray['self'] || 0,
|
||||||
"spouse": familyArray['spouse'] || 0,
|
"spouse": familyArray['spouse'] || 0,
|
||||||
@ -1317,6 +1640,15 @@ function createFamilyJSONString(familyArray) {
|
|||||||
"elders_count": familyArray['elders_count'] || "0"
|
"elders_count": familyArray['elders_count'] || "0"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let familyAgeLimits = {
|
||||||
|
"self": { "min": familyArray['self_min_age'], "max": familyArray['self_max_age'] },
|
||||||
|
"spouse": { "min": familyArray['spouse_min_age'], "max": familyArray['spouse_max_age'] },
|
||||||
|
"child": { "min": familyArray['children_min_age'], "max": familyArray['children_max_age'] },
|
||||||
|
"elders": { "min": familyArray['others_min_age'], "max": familyArray['others_max_age'] }
|
||||||
|
};
|
||||||
|
|
||||||
|
result['age_ratio'] = familyAgeLimits;
|
||||||
|
|
||||||
// Process the family_other_members values to set parents and parents-in-law
|
// Process the family_other_members values to set parents and parents-in-law
|
||||||
switch (familyArray['family_other_members']) {
|
switch (familyArray['family_other_members']) {
|
||||||
case 'oneparent':
|
case 'oneparent':
|
||||||
@ -1350,19 +1682,74 @@ function createFamilyJSONString(familyArray) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Conditionally add min/max ages
|
||||||
|
if (result['self'] == 1) {
|
||||||
|
result['self_min_age'] = familyArray['self_min_age'];
|
||||||
|
result['self_max_age'] = familyArray['self_max_age'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result['spouse'] == 1) {
|
||||||
|
result['spouse_min_age'] = familyArray['spouse_min_age'];
|
||||||
|
result['spouse_max_age'] = familyArray['spouse_max_age'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parseInt(result['childrens']) > 0) {
|
||||||
|
result['children_min_age'] = familyArray['children_min_age'];
|
||||||
|
result['children_max_age'] = familyArray['children_max_age'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (familyArray['family_other_members'] && familyArray['family_other_members'] != "0") {
|
||||||
|
result['elders_min_age'] = familyArray['others_min_age'];
|
||||||
|
result['elders_max_age'] = familyArray['others_max_age'];
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('result', result);
|
||||||
|
|
||||||
// Convert the result object to a JSON string
|
// Convert the result object to a JSON string
|
||||||
return JSON.stringify(result);
|
return JSON.stringify(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setFamilyDialogValues(familyData) {
|
function setFamilyDialogValues(familyData) {
|
||||||
|
|
||||||
// Set Self checkbox
|
// Set Self checkbox
|
||||||
$('#family_self').prop('checked', familyData.self === 1);
|
$('#family_self').prop('checked', familyData.self === 1);
|
||||||
|
$('#family_self_min_age').val(familyData.self_min_age || 18);
|
||||||
|
$('#family_self_max_age').val(familyData.self_max_age || 99);
|
||||||
|
if (familyData.self === 1) {
|
||||||
|
$('#self_age_fields').removeClass('hidden');
|
||||||
|
} else {
|
||||||
|
$('#self_age_fields').addClass('hidden');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set Spouse checkbox
|
// Set Spouse checkbox
|
||||||
$('#family_spouse').prop('checked', familyData.spouse === 1);
|
$('#family_spouse').prop('checked', familyData.spouse === 1);
|
||||||
|
$('#family_spouse_min_age').val(familyData.spouse_min_age || 18);
|
||||||
|
$('#family_spouse_max_age').val(familyData.spouse_max_age || 99);
|
||||||
|
if (familyData.spouse === 1) {
|
||||||
|
$('#spouse_age_fields').removeClass('hidden');
|
||||||
|
} else {
|
||||||
|
$('#spouse_age_fields').addClass('hidden');
|
||||||
|
}
|
||||||
|
|
||||||
// Set Children select
|
// Set Children select
|
||||||
$('#family_children').val(familyData.childrens);
|
$('#family_children').val(familyData.childrens);
|
||||||
|
$('#family_children_min_age').val(familyData.children_min_age || 0);
|
||||||
|
$('#family_children_max_age').val(familyData.children_max_age || 25);
|
||||||
|
if (parseInt(familyData.childrens) > 0) {
|
||||||
|
$('#children_age_fields').removeClass('hidden');
|
||||||
|
} else {
|
||||||
|
$('#children_age_fields').addClass('hidden');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set Other Members
|
||||||
|
$('#family_others_min_age').val(familyData.elders_min_age || 40);
|
||||||
|
$('#family_others_max_age').val(familyData.elders_max_age || 99);
|
||||||
|
if (familyData.elders_count && familyData.elders_count != 0) {
|
||||||
|
$('#others_age_fields').removeClass('hidden');
|
||||||
|
} else {
|
||||||
|
$('#others_age_fields').addClass('hidden');
|
||||||
|
}
|
||||||
|
|
||||||
// Determine which value to select for family other members (parents, parents-in-law)
|
// Determine which value to select for family other members (parents, parents-in-law)
|
||||||
if (familyData.parents === 1) {
|
if (familyData.parents === 1) {
|
||||||
@ -4010,7 +4397,7 @@ function constructURL_ForInternalMailSend() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//placement mail
|
//placement mail
|
||||||
function constructURL_ForPlacementMailSend() {
|
function constructURL_ForPlacementMailSend(return_type = false) {
|
||||||
|
|
||||||
var lead_id = $('#lead_id').val();
|
var lead_id = $('#lead_id').val();
|
||||||
let to = $('#placement_to').val();
|
let to = $('#placement_to').val();
|
||||||
@ -4067,7 +4454,6 @@ function constructURL_ForPlacementMailSend() {
|
|||||||
data.push(obj);
|
data.push(obj);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Prepare FormData
|
// Prepare FormData
|
||||||
var formData = new FormData();
|
var formData = new FormData();
|
||||||
formData.append('lead_id', lead_id);
|
formData.append('lead_id', lead_id);
|
||||||
@ -4096,8 +4482,40 @@ function constructURL_ForPlacementMailSend() {
|
|||||||
formData.append('acm_email', acm_email);
|
formData.append('acm_email', acm_email);
|
||||||
formData.append('acm_pk', acm_pk);
|
formData.append('acm_pk', acm_pk);
|
||||||
|
|
||||||
|
// Prepare plain key-value object
|
||||||
|
let dataObj = {
|
||||||
|
lead_id: lead_id,
|
||||||
|
file_type: RFQ_or_QCR == 2 ? 'qcr' : 'rfq',
|
||||||
|
recipient_type: 'placement',
|
||||||
|
recipient_mail: to,
|
||||||
|
cc: cc,
|
||||||
|
subject: subject,
|
||||||
|
proposal_insurer: proposal_insurer,
|
||||||
|
insurer_and_branch: insurer_and_branch,
|
||||||
|
placement_date: placement_date,
|
||||||
|
payment_date: payment_date,
|
||||||
|
policy_end_date: policy_end_date,
|
||||||
|
policy_start_date: policy_start_date,
|
||||||
|
is_cd: is_cd,
|
||||||
|
utr_no: utr_no,
|
||||||
|
premium_amount: premium_amount,
|
||||||
|
total_amount: total_amount,
|
||||||
|
cd_amount: cd_amount,
|
||||||
|
mail_content: mail_content,
|
||||||
|
selected_attachment_files: selectedFiles,
|
||||||
|
installments: JSON.stringify(data),
|
||||||
|
no_of_installment: no_of_installment,
|
||||||
|
is_installment: is_installment,
|
||||||
|
tpa_id: tpa_id,
|
||||||
|
acm_email: acm_email,
|
||||||
|
acm_pk: acm_pk
|
||||||
|
};
|
||||||
|
|
||||||
ajaxRequest(formData);
|
if(return_type == false){
|
||||||
|
ajaxRequest(formData);
|
||||||
|
}else{
|
||||||
|
return dataObj;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4441,9 +4859,13 @@ function checkTheTableDataChanged(redirect_type, url){
|
|||||||
window.location.href = url;
|
window.location.href = url;
|
||||||
|
|
||||||
}else if(redirect_type == 6){
|
}else if(redirect_type == 6){
|
||||||
//INTERNAL MAIL SEND
|
//PLACEMENT MAIL SEND
|
||||||
showModal(3);
|
showModal(3);
|
||||||
|
// if(demography_file_status == "failed"){
|
||||||
|
// toastr.warning('Member Demography file validation failed. Please re-upload', 'WARNING');
|
||||||
|
// }else{
|
||||||
|
// showModal(3);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7053,6 +7475,7 @@ function appendMultiFileData(data) {
|
|||||||
$('.attachmet_row').empty();
|
$('.attachmet_row').empty();
|
||||||
$('#multiFileAppendArea').append(res.document_data);
|
$('#multiFileAppendArea').append(res.document_data);
|
||||||
$('.attachmet_row').html(res.attachment_html);
|
$('.attachmet_row').html(res.attachment_html);
|
||||||
|
window.location.reload();
|
||||||
}else{
|
}else{
|
||||||
toastr.warning(res.message, 'WARNING');
|
toastr.warning(res.message, 'WARNING');
|
||||||
}
|
}
|
||||||
@ -7069,4 +7492,155 @@ function appendMultiFileData(data) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function toggleAgeFields(element, type) {
|
||||||
|
|
||||||
|
const ageFieldsDiv = document.getElementById(type + '_age_fields');
|
||||||
|
const minAgeInput = document.getElementById('family_' + type + '_min_age');
|
||||||
|
const maxAgeInput = document.getElementById('family_' + type + '_max_age');
|
||||||
|
|
||||||
|
if (type === 'self' || type === 'spouse') {
|
||||||
|
// For checkboxes
|
||||||
|
if (element.checked) {
|
||||||
|
ageFieldsDiv.classList.remove('hidden');
|
||||||
|
minAgeInput.value = '18';
|
||||||
|
maxAgeInput.value = '99';
|
||||||
|
} else {
|
||||||
|
ageFieldsDiv.classList.add('hidden');
|
||||||
|
// Clear values when unchecked
|
||||||
|
minAgeInput.value = '0';
|
||||||
|
maxAgeInput.value = '0';
|
||||||
|
}
|
||||||
|
} else if (type === 'children') {
|
||||||
|
// For children dropdown
|
||||||
|
if (element.value > 0) {
|
||||||
|
ageFieldsDiv.classList.remove('hidden');
|
||||||
|
minAgeInput.value = '0';
|
||||||
|
maxAgeInput.value = '25';
|
||||||
|
} else {
|
||||||
|
ageFieldsDiv.classList.add('hidden');
|
||||||
|
minAgeInput.value = '0';
|
||||||
|
maxAgeInput.value = '0';
|
||||||
|
}
|
||||||
|
} else if (type === 'others') {
|
||||||
|
// For other members dropdown
|
||||||
|
if (element.value !== '0') {
|
||||||
|
ageFieldsDiv.classList.remove('hidden');
|
||||||
|
minAgeInput.value = '40';
|
||||||
|
maxAgeInput.value = '99';
|
||||||
|
} else {
|
||||||
|
ageFieldsDiv.classList.add('hidden');
|
||||||
|
minAgeInput.value = '0';
|
||||||
|
maxAgeInput.value = '0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function savePlacementDataAndValidateMemberDataFile(){
|
||||||
|
|
||||||
|
let url = '<?= base_url('util/savePlacementDataAndValidateMemberDataFile') ?>';
|
||||||
|
console.log('url', url);
|
||||||
|
|
||||||
|
// Data to send in the AJAX request
|
||||||
|
let requestData = constructURL_ForPlacementMailSend(true);
|
||||||
|
console.log('requestData', requestData);
|
||||||
|
|
||||||
|
// Show loader
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
// Send AJAX request
|
||||||
|
sendAjaxRequestForGlobal(url, 'POST', requestData, function(res) {
|
||||||
|
|
||||||
|
if (res.status == true) {
|
||||||
|
toastr.success(res.message, 'SUCCESS');
|
||||||
|
checkMemberDataValidationStatus(res.lead_id)
|
||||||
|
} else {
|
||||||
|
toastr.warning(res.message, 'WARNING');
|
||||||
|
// Hide loader
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
}
|
||||||
|
|
||||||
|
}, function(xhr, status, error) {
|
||||||
|
clearInterval(interval);
|
||||||
|
console.error('Error fetching data:', error);
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
toastr.error('An error occurred while validation.', 'ERROR');
|
||||||
|
console.error("❌ Error checking validation status:", err);
|
||||||
|
// Hide loader
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkMemberDataValidationStatus(lead_id) {
|
||||||
|
|
||||||
|
if (!lead_id) {
|
||||||
|
console.error("Lead ID is required");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let url = '<?= base_url('util/checkMemberDataFileValidationStatus') ?>';
|
||||||
|
|
||||||
|
// Data to send in the AJAX request
|
||||||
|
let requestData = {
|
||||||
|
lead_id: lead_id,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Show loader
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
let interval = setInterval(() => {
|
||||||
|
|
||||||
|
// Send AJAX request
|
||||||
|
sendAjaxRequestForGlobal(url, 'GET', requestData, function(res) {
|
||||||
|
|
||||||
|
if (res.code === 200 && res.data.status != "pending") {
|
||||||
|
|
||||||
|
clearInterval(interval); // stop checking
|
||||||
|
if(res.data.status == 'success'){
|
||||||
|
toastr.success("✅ Validation Completed status : " + res.data.status, 'SUCCESS');
|
||||||
|
}else{
|
||||||
|
toastr.warning("✅ Validation Completed status : " + res.data.status, 'WARNING');
|
||||||
|
}
|
||||||
|
|
||||||
|
window.location.reload();
|
||||||
|
|
||||||
|
// if (typeof callback === "function") {
|
||||||
|
// callback(res.data); // send final result to callback
|
||||||
|
// }
|
||||||
|
|
||||||
|
} else {
|
||||||
|
console.log("⏳ Validation still in progress...");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hide loader
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
}, function(xhr, status, error) {
|
||||||
|
clearInterval(interval);
|
||||||
|
console.error('Error fetching data:', error);
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
toastr.error('An error occurred while validation.', 'ERROR');
|
||||||
|
console.error("❌ Error checking validation status:", err);
|
||||||
|
// Hide loader
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
});
|
||||||
|
|
||||||
|
}, 2000); // check every 2 seconds
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleButtons(status) {
|
||||||
|
if (status === "failed") {
|
||||||
|
$("#send_mail_btn").hide();
|
||||||
|
$("#validate_file_btn").show();
|
||||||
|
} else {
|
||||||
|
$("#validate_file_btn").hide();
|
||||||
|
$("#send_mail_btn").show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user