Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
3a43fae3e9
@ -172,6 +172,7 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
$routes->group("others", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("create", "ClientController::createOtherTabContent");
|
||||
$routes->post('check-duplicate', 'ClientController::validateDuplicateByClientBranch');
|
||||
});
|
||||
});
|
||||
|
||||
@ -390,6 +391,10 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("download_claim_dump_file/(:any)", "TicketController::downloadClaimDumpFile/$1");
|
||||
$routes->post('uploadMultiFileFromRfq', 'LeadsController::uploadMultiFileFromRfq');
|
||||
$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");
|
||||
@ -703,6 +708,9 @@ $routes->group('test', function($routes) {
|
||||
$routes->get('viewrfq', 'TestingController::viewRFQNonEb');
|
||||
$routes->get('exportexcel', 'TestingController::exportExcel');
|
||||
$routes->post('saverfq', 'TestingController::saverfq');
|
||||
$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');
|
||||
|
||||
|
||||
@ -14,11 +14,63 @@ class EcardDownloadConversation extends Conversation
|
||||
public function run()
|
||||
{
|
||||
$this->bot->types();
|
||||
sleep(0.5);
|
||||
// sleep(0.5);
|
||||
$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'));
|
||||
|
||||
@ -27,17 +79,13 @@ class EcardDownloadConversation extends Conversation
|
||||
$buttons = [];
|
||||
|
||||
$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))
|
||||
{
|
||||
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']}"] ;
|
||||
$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:
|
||||
|
||||
$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
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -76,4 +123,7 @@ class EcardDownloadConversation extends Conversation
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ class MainMenuConversation extends Conversation
|
||||
{
|
||||
$this->bot->userStorage()->delete();
|
||||
$this->bot->types(); // Typing indicator for the first message
|
||||
sleep(0.5); // Delay
|
||||
// sleep(0.5); // Delay
|
||||
$this->showMainMenu();
|
||||
}
|
||||
|
||||
|
||||
@ -16,11 +16,11 @@ class NetworkHospitalConversation extends Conversation
|
||||
public function run()
|
||||
{
|
||||
$this->bot->types(); // Typing indicator for the first message
|
||||
sleep(0.5); // Delay
|
||||
// sleep(0.5); // Delay
|
||||
$this->showHospitalMenu();
|
||||
}
|
||||
|
||||
protected function showHospitalMenu()
|
||||
protected function showHospitalMenuOLD()
|
||||
{
|
||||
$chat_session_info = get_chatbot_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");
|
||||
|
||||
$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"
|
||||
$this->botman->hears('start|hi|hello|help|help me', function (BotMan $bot) {
|
||||
|
||||
@ -132,6 +132,15 @@ class ClientController extends AdminController
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
public function validateDuplicateByClientBranch()
|
||||
{
|
||||
$value = $this->request->getPost('value');
|
||||
$clientId = $this->request->getPost('client_id');
|
||||
$branchId = $this->request->getPost('branch_id');
|
||||
$field = $this->request->getPost('field');
|
||||
$isDuplicate = $this->clientModel->isDuplicateByClientBranch($value, $field, $clientId, $branchId);
|
||||
return $this->response->setJSON(['isDuplicate' => $isDuplicate]);
|
||||
}
|
||||
public function checkDuplicateTableFieldValue()
|
||||
{
|
||||
$table = $this->request->getPost('table');
|
||||
@ -1121,14 +1130,47 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
$data['created_by'] = get_session_userid();
|
||||
|
||||
|
||||
// before updating check if pre_branch_id is already existing in the current db
|
||||
|
||||
if(isset($data['pre_branch_id']) && !empty($data['pre_branch_id']))
|
||||
{
|
||||
$existing_pre_branch = $this->clientBranchModel
|
||||
->where('pre_branch_id',$data['pre_branch_id'])
|
||||
//->where('id !=',$post_branch_id)
|
||||
->first();
|
||||
|
||||
if($existing_pre_branch)
|
||||
{
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 409,
|
||||
'message' => 'The branch is already mapped with another branch. Please check.',
|
||||
], 409);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$insert = $this->clientBranchModel->insert($data);
|
||||
|
||||
$post_branch_id = $insert;
|
||||
|
||||
if ($insert) {
|
||||
$level_contact_data = $this->request->getPost('level_contect_data');
|
||||
$level_contact_data = !empty($level_contact_data) ? json_decode($level_contact_data, true) : null;
|
||||
$this->saveLevelContacts($level_contact_data, $insert);
|
||||
}
|
||||
|
||||
if($post_branch_id && isset($data['pre_branch_id']) && !empty($data['pre_branch_id']))
|
||||
{
|
||||
// need to update the client_branch in the pre
|
||||
$result = $this->updatePreClientBranch($data['pre_branch_id'],$post_branch_id , "create");
|
||||
|
||||
log_message('error','Pre client_branch update result for pre_branch_id '.$data['pre_branch_id'].' and post_branch_id '.$post_branch_id.' is '.json_encode($result));
|
||||
}
|
||||
|
||||
if ($insert) {
|
||||
$branchData = $this->clientBranchModel->where('client_id', $this->request->getPost('client_id'))->findAll();
|
||||
$branchData['role'] = get_role_id();
|
||||
@ -1153,7 +1195,11 @@ class ClientController extends AdminController
|
||||
$this->myLogger->logme('error', 'Client branch EDIT function called');
|
||||
$id = $this->request->getPost('branch_id_primarykey');
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$pre_branch_id = $this->request->getPost('pre_branch_id') ?? '';
|
||||
|
||||
$data = $this->request->getPost();
|
||||
$data['pre_branch_id'] = $pre_branch_id;
|
||||
|
||||
$units = $this->request->getPost('units');
|
||||
|
||||
$emp_unit_count = 0;
|
||||
@ -1212,7 +1258,41 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
$data['updated_by'] = get_session_userid();
|
||||
|
||||
$post_branch_id = $id;
|
||||
|
||||
// before updating check if pre_branch_id is already existing in the current db
|
||||
|
||||
if(isset($data['pre_branch_id']) && !empty($data['pre_branch_id']))
|
||||
{
|
||||
$existing_pre_branch = $this->clientBranchModel
|
||||
->where('pre_branch_id',$data['pre_branch_id'])
|
||||
->where('id !=',$post_branch_id)
|
||||
->first();
|
||||
|
||||
if($existing_pre_branch)
|
||||
{
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 409,
|
||||
'message' => 'The branch is already mapped with another branch. Please check.',
|
||||
], 409);
|
||||
}
|
||||
}
|
||||
|
||||
$insert = $this->clientBranchModel->update($id, $data);
|
||||
|
||||
|
||||
|
||||
if($post_branch_id && isset($data['pre_branch_id']) && !empty($data['pre_branch_id']))
|
||||
{
|
||||
// need to update the client_branch in the pre
|
||||
$result = $this->updatePreClientBranch($data['pre_branch_id'],$post_branch_id , "update");
|
||||
|
||||
log_message('error','Pre client_branch update result for pre_branch_id '.$data['pre_branch_id'].' and post_branch_id '.$post_branch_id.' is '.json_encode($result));
|
||||
}
|
||||
|
||||
|
||||
$this->myLogger->logme('error', 'Client branch EDITED by {data}', ['data' => get_session_userid()]);
|
||||
|
||||
|
||||
@ -6939,7 +7019,9 @@ class ClientController extends AdminController
|
||||
foreach ($postHrs as $post) {
|
||||
$found = false;
|
||||
foreach ($preHrs as $index => $pre) {
|
||||
if ($post['hr_mobile'] === $pre['hr_mobile'] && $post['hr_mail'] === $pre['hr_mail']) {
|
||||
|
||||
if ( trim($post['hr_mobile']) == trim($pre['hr_mobile']) && trim($post['hr_mail']) == trim($pre['hr_mail']) ) {
|
||||
|
||||
$merged[] = [
|
||||
'pre_hr_id' => $pre['pre_hr_id'],
|
||||
'post_hr_id' => $post['post_hr_id'],
|
||||
@ -6972,6 +7054,13 @@ class ClientController extends AdminController
|
||||
|
||||
// Remaining preHrs (not matched)
|
||||
foreach ($preHrs as $pre) {
|
||||
|
||||
foreach ($merged as $value) {
|
||||
if ( trim($pre['hr_mobile']) == trim($value['hr_mobile']) && trim($pre['hr_mail']) == trim($value['hr_mail']) ) {
|
||||
continue 2; // Skip adding this pre_hr as it's already matched
|
||||
}
|
||||
}
|
||||
|
||||
$merged[] = [
|
||||
'pre_hr_id' => $pre['pre_hr_id'],
|
||||
'post_hr_id' => null,
|
||||
@ -7130,9 +7219,15 @@ class ClientController extends AdminController
|
||||
$post_branch_id = $value['post_branch_id'];
|
||||
$post_hr_id = $value['post_hr_id'];
|
||||
|
||||
$value['pre_client_id'] = $this->getPreClientId($post_branch_id);
|
||||
$value['pre_branch_id'] = $this->getPreBranchId($post_branch_id);
|
||||
$value["pre_hr_id"] = $this->getPreHrId($post_branch_id);
|
||||
$preBranchId = $this->getPreBranchIdByPostBranchId($post_branch_id);
|
||||
|
||||
if (!empty($preBranchId)) {
|
||||
$value['pre_branch_id'] = $preBranchId;
|
||||
$value['pre_client_id'] = $this->getPreClientIdByPreBranchId($preBranchId);
|
||||
$value["pre_hr_id"] = $this->getPreHrIdByPreBranchId($preBranchId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// INSERT or UPDATE
|
||||
if (empty($value['pk']) || (int)$value['pk'] === 0) {
|
||||
@ -7199,26 +7294,28 @@ class ClientController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
private function getPreClientId($post_branch_id){
|
||||
private function getPreClientIdByPreBranchId($pre_branch_id){
|
||||
$db2 = \Config\Database::connect('preDB');
|
||||
$pre_client_id = $db2->table('client_branch')->where('post_branch_id',$post_branch_id)->where('is_Active',1)->get()->getResultArray()[0]['client_id']??[];
|
||||
$pre_client_id = $db2->table('client_branch')->where('id',$pre_branch_id)->where('is_Active',1)->get()->getResultArray()[0]['client_id']??"";
|
||||
return $pre_client_id;
|
||||
}
|
||||
|
||||
private function getPreBranchId($post_branch_id){
|
||||
$db2 = \Config\Database::connect('preDB');
|
||||
$pre_branch_id = $db2->table('client_branch')->where('post_branch_id',$post_branch_id)->where('is_Active',1)->get()->getResultArray()[0]['id']??[];
|
||||
return $pre_branch_id;
|
||||
}
|
||||
private function getPreHrId($post_branch_id){
|
||||
private function getPreHrIdByPreBranchId($pre_branch_id){
|
||||
$db2 = \Config\Database::connect('preDB');
|
||||
$pre_hr_id = $db2->table('client_branch cb')
|
||||
->select('lc.id')
|
||||
->join('level_contacts lc','lc.ref_id = cb.id')
|
||||
->where('post_branch_id',$post_branch_id)->where('is_Active',1)->get()->getResultArray()[0]['id']??[];
|
||||
->where('cb.id',$pre_branch_id)->where('cb.is_Active',1)->where('lc.is_Active',1)->get()->getResultArray()[0]['id']??"";
|
||||
return $pre_hr_id;
|
||||
}
|
||||
|
||||
private function getPreBranchIdByPostBranchId($post_branch_id){
|
||||
$db = \Config\Database::connect();
|
||||
$pre_branch_id = $db->table('client_branch')->where('id',$post_branch_id)->where('is_Active',1)->get()->getResultArray()[0]['pre_branch_id']??"";
|
||||
return $pre_branch_id;
|
||||
}
|
||||
|
||||
|
||||
// ------------------- DEMO CLIENT FUNCTION --------------------------------------------------------------------------------
|
||||
|
||||
public function wipeDemoClient()
|
||||
@ -7607,6 +7704,26 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
private function updatePreClientBranch($pre_branch_id,$post_branch_id ,$operation)
|
||||
{
|
||||
|
||||
|
||||
|
||||
$preDB = \Config\Database::connect('preDB');
|
||||
|
||||
if($operation != 'create'){
|
||||
|
||||
$builder = $preDB->table('client_branch');
|
||||
$builder->where('post_branch_id', $post_branch_id);
|
||||
$builder->update(['post_branch_id' => null]);
|
||||
}
|
||||
|
||||
$builder = $preDB->table('client_branch');
|
||||
$builder->where('id', $pre_branch_id);
|
||||
$builder->update(['post_branch_id' => $post_branch_id]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -2868,14 +2868,14 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
}else if($ClientPolicyValue['policy_type_id'] == 6)
|
||||
{
|
||||
$policyGroup = 'gpa';
|
||||
$policyGroup = 'other';
|
||||
$data['ticket_type_id'] = 3;
|
||||
$data['claim_subject'] = "Claim EDLI";
|
||||
$data['sum_insured_label'] = "Sum Assured";
|
||||
|
||||
}else if($ClientPolicyValue['policy_type_id'] == 7)
|
||||
{
|
||||
$policyGroup = 'gpa';
|
||||
$policyGroup = 'other';
|
||||
$data['ticket_type_id'] = 4;
|
||||
$data['claim_subject'] = "Claim GTLI";
|
||||
$data['sum_insured_label'] = "Sum Assured";
|
||||
@ -2969,9 +2969,6 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
function policyTermsFiter($terms , $type)
|
||||
{
|
||||
|
||||
|
||||
|
||||
$gpa = [
|
||||
"sumInsured2" => "Sum Insured",
|
||||
"totalSumInsured" => "Total Sum Assured",
|
||||
@ -3021,8 +3018,6 @@ class EmployeeRestController extends AdminController
|
||||
"moderntreatmentsasperirdai" => "Modern Treatment "
|
||||
];
|
||||
|
||||
|
||||
|
||||
$finalarray = [];
|
||||
if($type == 'gpa'){
|
||||
foreach ($gpa as $key => $value) {
|
||||
@ -3046,6 +3041,18 @@ class EmployeeRestController extends AdminController
|
||||
$finalarray[$terms->gpa_special_condition_label[$i]] = $terms->gpa_special_condition_input[$i];
|
||||
}
|
||||
}
|
||||
}else if($type == 'other'){
|
||||
foreach ($terms as $key => $value) {
|
||||
if($key != "multiple_sum_insured" && $value != ""){
|
||||
$result = ucwords(str_replace('_', ' ', $key));
|
||||
$finalarray[$result] = $value;
|
||||
}
|
||||
}
|
||||
if(isset(($terms->gpa_special_condition_label)) && is_array($terms->gpa_special_condition_label) && is_array($terms->gpa_special_condition_input)){
|
||||
for ($i=0; $i < count($terms->gpa_special_condition_label); $i++) {
|
||||
$finalarray[$terms->gpa_special_condition_label[$i]] = $terms->gpa_special_condition_input[$i];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
foreach ($gmc as $key => $value) {
|
||||
if(isset($terms->$key))
|
||||
@ -3070,9 +3077,7 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $finalarray;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -167,6 +167,10 @@ class JobWorker extends AdminController
|
||||
'type' => 'CC', // Handler Category
|
||||
'handler' => 'App\Controllers\EmployeeMultiEventServiceController',
|
||||
],
|
||||
'memberDataListExcelFileFormatValidation' => [
|
||||
'type' => 'CC', // Handler Category
|
||||
'handler' => 'App\Controllers\LeadsController',
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -11,6 +11,12 @@ use CodeIgniter\API\ResponseTrait;
|
||||
use Dompdf\Dompdf;
|
||||
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
|
||||
{
|
||||
use ResponseTrait;
|
||||
@ -20,7 +26,7 @@ class TestingController extends BaseController
|
||||
{
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
}
|
||||
|
||||
|
||||
public function saveForm()
|
||||
{
|
||||
// Get JSON input
|
||||
@ -35,7 +41,7 @@ class TestingController extends BaseController
|
||||
}
|
||||
|
||||
public function testcli()
|
||||
{
|
||||
{
|
||||
echo "hi";
|
||||
$this->myLogger->logme('error', "test log");
|
||||
echo "hi 2";
|
||||
@ -79,19 +85,19 @@ class TestingController extends BaseController
|
||||
$options->set('debugLayoutBlocks', false);
|
||||
$options->set('debugLayoutInline', false);
|
||||
$options->set('debugLayoutPaddingBox', false);
|
||||
|
||||
|
||||
// Initialize DomPDF
|
||||
$dompdf = new Dompdf($options);
|
||||
|
||||
|
||||
// Load HTML content
|
||||
$dompdf->loadHtml($html);
|
||||
|
||||
|
||||
// Set paper size and orientation
|
||||
$dompdf->setPaper('A4', 'landscape'); // or 'portrait'
|
||||
|
||||
|
||||
// Render PDF
|
||||
$dompdf->render();
|
||||
|
||||
|
||||
// Output PDF to browser
|
||||
$filename = 'ecard_' . date('Y-m-d_H-i-s') . '.pdf';
|
||||
$dompdf->stream($filename, ['Attachment' => true]); // Set to false for inline view
|
||||
@ -111,7 +117,7 @@ class TestingController extends BaseController
|
||||
'POLICY_DATE' => '31/12/2024',
|
||||
'INSURER_NAME' => 'ZURICH KOTAK GTNERAL INSURANCE COIIPANY lNDlA LIMITED',
|
||||
'TPA_NAME' => 'HealthIndia Insurance TPA Services Pvt. Ltd.',
|
||||
'FRONT_CARD' => base_url() .('public/uploads/template_bg/Nhance_Ecard_working_1_front_3.png'),
|
||||
'FRONT_CARD' => base_url() . ('public/uploads/template_bg/Nhance_Ecard_working_1_front_3.png'),
|
||||
'BACK_CARD' => base_url() . ('public/uploads/template_bg/Nhance_Ecard_working_1_Back_3.png'),
|
||||
'LEVELS' => 'Level 1: 1800-XXX-XXXX<br>Level 2: support@company.com'
|
||||
];
|
||||
@ -127,7 +133,7 @@ class TestingController extends BaseController
|
||||
'POLICY_DATE' => '31/12/2024',
|
||||
'INSURER_NAME' => 'ABC Insurance Co.',
|
||||
'TPA_NAME' => 'XYZ TPA Ltd.',
|
||||
'FRONT_CARD' => base_url() .('public/uploads/template_bg/Nhance_Ecard_working_1_front_3.png'),
|
||||
'FRONT_CARD' => base_url() . ('public/uploads/template_bg/Nhance_Ecard_working_1_front_3.png'),
|
||||
'BACK_CARD' => base_url() . ('public/uploads/template_bg/Nhance_Ecard_working_1_Back_3.png'),
|
||||
'LEVELS' => 'Level 1: 1800-XXX-XXXX<br>Level 2: support@company.com'
|
||||
];
|
||||
@ -157,12 +163,12 @@ class TestingController extends BaseController
|
||||
{
|
||||
// Load your HTML template
|
||||
$template = file_get_contents(WRITEPATH . 'e_card_template/common.html');
|
||||
|
||||
|
||||
// Replace placeholders with actual data
|
||||
foreach ($data as $key => $value) {
|
||||
$template = str_replace('{' . $key . '}', $value, $template);
|
||||
}
|
||||
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
||||
@ -225,21 +231,21 @@ class TestingController extends BaseController
|
||||
$employeePolicy = new EmployeePolicyModel();
|
||||
|
||||
$data = $employeePolicy
|
||||
->select('client_policy.policy_type_id')
|
||||
->join('employees', 'employee_polices.employee_id = employees.id')
|
||||
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id')
|
||||
->where('employees.is_active', 1)
|
||||
->where('employees.emp_status', ['active', 'expired'])
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where('employee_polices.status', ['active', 'expired'])
|
||||
->where('employees.client_id', $client_id)
|
||||
->where('employees.emp_code', $emp_code)
|
||||
->groupBy('employee_polices.client_policy_id')
|
||||
->findAll();
|
||||
|
||||
->select('client_policy.policy_type_id')
|
||||
->join('employees', 'employee_polices.employee_id = employees.id')
|
||||
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id')
|
||||
->where('employees.is_active', 1)
|
||||
->where('employees.emp_status', ['active', 'expired'])
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where('employee_polices.status', ['active', 'expired'])
|
||||
->where('employees.client_id', $client_id)
|
||||
->where('employees.emp_code', $emp_code)
|
||||
->groupBy('employee_polices.client_policy_id')
|
||||
->findAll();
|
||||
}
|
||||
|
||||
public function ptedfitdata($id){
|
||||
public function ptedfitdata($id)
|
||||
{
|
||||
$policy_transaction = new PolicyTransactionController();
|
||||
$data = $policy_transaction->getInceptionDataForEdit($id);
|
||||
// dd($data);
|
||||
@ -249,7 +255,7 @@ class TestingController extends BaseController
|
||||
$dataArray = $data['pt_co_share_details']; // Example
|
||||
$cd_ac_pk = 'CD12345';
|
||||
$role_id = 1;
|
||||
$team_id = ['6'];
|
||||
$team_id = ['6'];
|
||||
$insurer_branch = $insurer_branch;
|
||||
|
||||
return view('pt_calc_table', [
|
||||
@ -315,7 +321,7 @@ class TestingController extends BaseController
|
||||
}
|
||||
|
||||
public function viewRFQNonEb()
|
||||
{
|
||||
{
|
||||
$insurerBranchModel = new InsurerBranchModel();
|
||||
$data['page_name'] = "RFQ NON EB";
|
||||
$data['insurer'] = $insurerBranchModel->getInsurerBranchesWithInsurerNames();
|
||||
@ -323,7 +329,8 @@ class TestingController extends BaseController
|
||||
return $this->loadLayout('view_rfq_non_eb_new', $data);
|
||||
}
|
||||
|
||||
public function saverfq(){
|
||||
public function saverfq()
|
||||
{
|
||||
$json = $this->request->getPost('json');
|
||||
$json = json_encode($json);
|
||||
print_r($json);
|
||||
@ -342,8 +349,328 @@ class TestingController extends BaseController
|
||||
// print_rr($policy_data['json']); die;
|
||||
$policy_data = json_decode($policy_data['json'], true);
|
||||
$policy_data = array_slice($policy_data, 0, -2);
|
||||
print_rr($policy_data); die;
|
||||
dd($policy_data);
|
||||
print_rr($policy_data);
|
||||
die;
|
||||
dd($policy_data);
|
||||
}
|
||||
|
||||
|
||||
public function mapping_client_id_and_branch_id()
|
||||
{
|
||||
|
||||
$post_clients_list = $this->getNonDuplicatePostClients();
|
||||
|
||||
$pre_clients_list = $this->getNonDuplicatePreClients();
|
||||
|
||||
|
||||
|
||||
if (
|
||||
!empty($pre_clients_list) &&
|
||||
!empty($post_clients_list)
|
||||
) {
|
||||
|
||||
$postDB = \Config\Database::connect();
|
||||
$preDB = \Config\Database::connect('preDB');
|
||||
|
||||
foreach ($post_clients_list as $post_client) {
|
||||
|
||||
foreach ($pre_clients_list as $pre_client) {
|
||||
|
||||
if (trim($post_client['short_name']) == trim($pre_client['short_name'])) {
|
||||
|
||||
$postDB->table('clients')->where('id', $post_client['id'])->update(['pre_client_id' => $pre_client['id']]);
|
||||
|
||||
$preDB->table('clients')->where('id', $pre_client['id'])->update(['post_client_id' => $post_client['id']]);
|
||||
|
||||
// upto here we updated client_id in both dbs.
|
||||
|
||||
$post_branches = $postDB->table('client_branch')
|
||||
->where('client_id', $post_client['id'])
|
||||
->get()
|
||||
->getResultArray() ?? [];
|
||||
|
||||
$pre_branches = $preDB->table('client_branch')
|
||||
->where('client_id', $pre_client['id'])
|
||||
->get()
|
||||
->getResultArray() ?? [];
|
||||
|
||||
if (!empty($post_branches) && !empty($pre_branches)) {
|
||||
|
||||
|
||||
foreach ($post_branches as $post_branch) {
|
||||
|
||||
$pre_branch = $preDB->table('client_branch')
|
||||
->where('client_id', $pre_client['id'])
|
||||
->where('branch_code', $post_branch['branch_code'])
|
||||
->get()
|
||||
->getRowArray() ?? [];
|
||||
|
||||
if (!empty($pre_branch)) {
|
||||
$postDB->table('client_branch')->where('id', $post_branch['id'])->update(['pre_branch_id' => $pre_branch['id']]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($pre_branches as $pre_branch) {
|
||||
|
||||
$post_branch = $postDB->table('client_branch')
|
||||
->where('client_id', $post_client['id'])
|
||||
->where('branch_code', $pre_branch['branch_code'])
|
||||
->get()
|
||||
->getRowArray() ?? [];
|
||||
|
||||
if (!empty($post_branch)) {
|
||||
$preDB->table('client_branch')->where('id', $pre_branch['id'])->update(['post_branch_id' => $post_branch['id']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function getNonDuplicatePostClients()
|
||||
{
|
||||
|
||||
|
||||
$postDB = \Config\Database::connect();
|
||||
|
||||
$sql = "SELECT *
|
||||
FROM clients AS post_clients
|
||||
WHERE post_clients.client_type = 1
|
||||
AND post_clients.is_active = 1
|
||||
AND (post_clients.short_name NOT IN
|
||||
(
|
||||
SELECT ir_post_clients.short_name
|
||||
FROM clients as ir_post_clients
|
||||
WHERE ir_post_clients.client_type = 1
|
||||
AND ir_post_clients.short_name IS NOT NULL
|
||||
AND TRIM(ir_post_clients.short_name) <> ''
|
||||
AND ir_post_clients.is_active = 1
|
||||
GROUP BY ir_post_clients.short_name
|
||||
HAVING COUNT(*) > 1)
|
||||
)
|
||||
ORDER BY post_clients.short_name";
|
||||
|
||||
$binds = [];
|
||||
|
||||
$query = $postDB->query($sql, $binds);
|
||||
|
||||
$results = $query->getResultArray() ?? [];
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
private function getNonDuplicatePreClients()
|
||||
{
|
||||
|
||||
$preDB = \Config\Database::connect('preDB');
|
||||
|
||||
$sql = "SELECT *
|
||||
FROM clients AS pre_clients
|
||||
WHERE pre_clients.client_type = 1
|
||||
AND pre_clients.is_active = 1
|
||||
AND (pre_clients.short_name NOT IN
|
||||
(
|
||||
SELECT ir_pre_clients.short_name
|
||||
FROM clients as ir_pre_clients
|
||||
WHERE ir_pre_clients.client_type = 1
|
||||
AND ir_pre_clients.short_name IS NOT NULL
|
||||
AND TRIM(ir_pre_clients.short_name) <> ''
|
||||
AND ir_pre_clients.is_active = 1
|
||||
GROUP BY ir_pre_clients.short_name
|
||||
HAVING COUNT(*) > 1)
|
||||
)
|
||||
ORDER BY pre_clients.short_name";
|
||||
|
||||
$binds = [];
|
||||
|
||||
$query = $preDB->query($sql, $binds);
|
||||
|
||||
$results = $query->getResultArray() ?? [];
|
||||
|
||||
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'];
|
||||
$relationship ='Self';
|
||||
$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){
|
||||
|
||||
@ -666,12 +666,12 @@ if(!function_exists('generate_insurer_based_excel')){
|
||||
foreach ($excel_header_array as $header) {
|
||||
|
||||
$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') {
|
||||
$value = $serialNumber;
|
||||
} else {
|
||||
if(empty($fieldName) && !empty($defaultValue)){
|
||||
if(empty($fieldName) && $defaultValue != ""){
|
||||
$value = $defaultValue;
|
||||
}else{
|
||||
$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
|
||||
if (!function_exists('generate_family_floater_key')) {
|
||||
function generate_family_floater_key($relationship)
|
||||
@ -2002,7 +2001,7 @@ if (!function_exists('generate_family_floater_key')) {
|
||||
$relation = 'parent';
|
||||
} else if (strtolower(trim($relationship)) === 'son' || strtolower(trim($relationship)) === 'daughter') {
|
||||
$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';
|
||||
} else if (strtolower(trim($relationship)) === 'spouse') {
|
||||
$relation = 'spouse';
|
||||
@ -2041,3 +2040,331 @@ if (!function_exists('formatIndianCurrency')) {
|
||||
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 --------------------------------------
|
||||
|
||||
|
||||
|
||||
@ -226,5 +226,18 @@ class ClientModel extends Model
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function isDuplicateByClientBranch($value, $field, $clientId, $branchId)
|
||||
{
|
||||
$builder = $this->db->table('level_contacts lc')
|
||||
->select('lc.id')
|
||||
->join('client_branch cb', 'lc.ref_id = cb.id', 'left')
|
||||
->where('lc.'.$field, $value)
|
||||
->where('lc.contact_type', 'client')
|
||||
->where('cb.client_id', $clientId)
|
||||
->where('lc.ref_id', $branchId)
|
||||
->get();
|
||||
|
||||
return $builder->getNumRows() > 0 ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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('client_policy', 'client_policy.id = employee_polices.client_policy_id')
|
||||
->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){
|
||||
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){
|
||||
return $query->where('employees.client_id',$client_id);
|
||||
|
||||
@ -17,7 +17,10 @@ class LeadFilesModel extends Model
|
||||
'updated_by',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'is_active'
|
||||
'is_active',
|
||||
'error_data',
|
||||
'status',
|
||||
'type',
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
|
||||
@ -147,6 +147,7 @@ class LeadsModel extends Model
|
||||
|
||||
$data = $this->select('
|
||||
leads.*,
|
||||
lead_files.status as demography_file_status,
|
||||
kyc_entity_type.name as entity_type,
|
||||
policy_type.policy_type,
|
||||
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('user_profiles', 'leads.salse_person_id = user_profiles.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);
|
||||
|
||||
if (!empty($where)) {
|
||||
|
||||
@ -86,13 +86,18 @@
|
||||
<hr>
|
||||
|
||||
<form role="form" class="parsley-examples" method="post" id="branch_form" enctype="multipart/form-data">
|
||||
|
||||
|
||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
|
||||
|
||||
<!-- post_client_id as client_id -->
|
||||
<input type="hidden" name="client_id" id="client_id_branch"
|
||||
value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
||||
|
||||
<!-- pre_branch_id -->
|
||||
<input type="hidden" name="pre_branch_id" id="pre_branch_id"
|
||||
value="<?= isset($pre_branch_id) ? $pre_branch_id : '' ?>" />
|
||||
|
||||
<!-- post_branch_id as branch_id_primarykey -->
|
||||
<input type="hidden" name="branch_id_primarykey" id="branch_id_primarykey" />
|
||||
|
||||
<div class="form-group">
|
||||
@ -193,12 +198,13 @@
|
||||
<div class="form-group col-md-6">
|
||||
<label for="last_name">Email<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter Contact Email"
|
||||
name="email[]" id="email" data-parsley-trigger="change" data-parsley-type="email" onkeyup="validateInput(this, 'level_contacts', 'email', 'branchBtnSubmit')" required>
|
||||
name="email[]" id="email" data-parsley-trigger="change" data-parsley-type="email" onchange="validateDuplicateByClientBranch(this, 'email','branchBtnSubmit')" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="mobile">Mobile<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter Contact Mobile"
|
||||
name="mobile[]" id="mobile" onkeyup="validateInput(this, 'level_contacts', 'mobile', 'branchBtnSubmit')"
|
||||
name="mobile[]" id="mobile"
|
||||
onchange="validateDuplicateByClientBranch(this, 'mobile','branchBtnSubmit')"
|
||||
onkeypress="return onlyNumbers(event)" maxlength="10" minlength="10"
|
||||
data-parsley-type-message="Please enter a valid 10-digit mobile number."
|
||||
data-parsley-required-message="Please enter a valid 10-digit mobile number."
|
||||
@ -297,6 +303,8 @@ $('#btnBranchAdd').click(function() {
|
||||
$('#district').val('');
|
||||
$('#branch_city').val('');
|
||||
$('#branch_form')[0].reset();
|
||||
$('#branch_form').parsley().reset();
|
||||
$('#pre_branch_id').val('');
|
||||
$('.ac').css('display', 'block');
|
||||
contactCount = 1
|
||||
|
||||
@ -389,6 +397,7 @@ $("#branch_form").submit(function(event) {
|
||||
|
||||
var formData = new FormData($('#branch_form')[0]);
|
||||
|
||||
|
||||
const jsonString = JSON.stringify(selectedValues);
|
||||
const level_contect_data_json_string = JSON.stringify(level_contect_data);
|
||||
console.log('jsonString', jsonString);
|
||||
@ -479,6 +488,9 @@ $("#branch_form").submit(function(event) {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.log('Something Wrong!', 'warning');
|
||||
if(xhr.status === 409){
|
||||
alert('The Current Branch is Already Existing..!!');
|
||||
}
|
||||
}, 300);
|
||||
},
|
||||
complete: function() {
|
||||
@ -546,7 +558,7 @@ $('body').on('click', '.btnBranchEdit', function() {
|
||||
$('#district').val(res.data.district);
|
||||
$('#branch_city').val(res.data.city);
|
||||
$('#branch_PrimaryKey').val(res.data.id);
|
||||
$('#pre_branch_id').val(res.data.pre_branch_id)
|
||||
$('#pre_branch_id').val(res.data.pre_branch_id??'')
|
||||
|
||||
if(res.data.sez == 1){
|
||||
$('#sez').prop('checked', true);
|
||||
@ -638,11 +650,11 @@ function appendContactHtml(contact = false, reset = false) {
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_last_name">Email<span class="text-danger">*</span></label>
|
||||
<input value="${contact !== undefined && contact !== false ? contact.email : ''}" type="text" class="form-control" placeholder="Enter Contact Email" name="email[]" id="${uniqueId}_email" data-parsley-trigger="change" data-parsley-type="email" onkeyup="validateInput(this, 'level_contacts', 'email', 'branchBtnSubmit')" required>
|
||||
<input value="${contact !== undefined && contact !== false ? contact.email : ''}" type="text" class="form-control" placeholder="Enter Contact Email" name="email[]" id="${uniqueId}_email" data-parsley-trigger="change" data-parsley-type="email" onchange="validateDuplicateByClientBranch(this, 'email', 'branchBtnSubmit')" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_mobile">Mobile<span class="text-danger">*</span></label>
|
||||
<input value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="text" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" onkeyup="validateInput(this, 'level_contacts', 'mobile', 'branchBtnSubmit')" onkeypress = "return onlyNumbers(event)" maxlength="10" min="10" data-parsley-type-message="Please enter a valid 10-digit mobile number." data-parsley-required-message="Please enter a valid 10-digit mobile number." required>
|
||||
<input value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="text" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" onchange="validateDuplicateByClientBranch(this, 'mobile', 'branchBtnSubmit')" onkeypress = "return onlyNumbers(event)" maxlength="10" min="10" data-parsley-type-message="Please enter a valid 10-digit mobile number." data-parsley-required-message="Please enter a valid 10-digit mobile number." required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="display: flex;">
|
||||
@ -961,6 +973,68 @@ function validateInput(input, table, field, submitButId){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function validateDuplicateByClientBranch(input, field, submitButId) {
|
||||
let value = $(input).val().trim();
|
||||
let clientId = $('#client_id_branch').val();
|
||||
let branchId = $('#branch_id_primarykey').val();
|
||||
let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim();
|
||||
let message = label ? label + " is duplicate!" : "Value is duplicate!";
|
||||
|
||||
console.log(`cId: ${clientId} | bId: ${branchId}`);
|
||||
|
||||
// Don't forgot be careful
|
||||
// 1 Local duplication check (User entered)
|
||||
let isLocalDuplicate = false;
|
||||
$('input[name="' + field + '[]"]').each(function(index) {
|
||||
console.log(`Entered value: ${value} | Contact ${index+1} value: ${$(this).val()}`);
|
||||
if (this !== input && $(this).val().trim() === value) {
|
||||
isLocalDuplicate = true;
|
||||
return false; // break loop
|
||||
}
|
||||
});
|
||||
|
||||
if (isLocalDuplicate) {
|
||||
console.log(`r u n Local`);
|
||||
console.log(`btn Dis - true`);
|
||||
toastr.warning(message, 'WARNING');
|
||||
$('#' + submitButId).prop('disabled', true);
|
||||
return; // don’t call server if duplicate in UI
|
||||
}
|
||||
|
||||
// Don't forgot be careful
|
||||
// 2 Server-side duplicate check (DB)
|
||||
if (!isLocalDuplicate && value !== '') {
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/others/check-duplicate") ?>',
|
||||
type: 'POST',
|
||||
data: {
|
||||
client_id: clientId,
|
||||
branch_id: branchId,
|
||||
value: value,
|
||||
field: field
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
if (response.isDuplicate) {
|
||||
console.log(`r u n Server`);
|
||||
console.log(`btn Dis - true`);
|
||||
toastr.warning(message, 'WARNING');
|
||||
$('#' + submitButId).prop('disabled', true);
|
||||
} else {
|
||||
console.log(`btn Dis - false`);
|
||||
$('#' + submitButId).prop('disabled', false);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('AJAX Error:', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getContactsData() {
|
||||
const contacts = [];
|
||||
|
||||
|
||||
@ -418,7 +418,7 @@
|
||||
<div class="col-md-6">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="auto_fetch_client">Client List<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="auto_fetch_client" name="auto_fetch_client" required>
|
||||
<select class="form-control select2" id="auto_fetch_client" name="auto_fetch_client" required>
|
||||
<option value="">Select Client</option>
|
||||
<?php if (!empty($auto_fetch_client_list)): ?>
|
||||
<?php foreach ($auto_fetch_client_list as $client_list): ?>
|
||||
@ -434,7 +434,7 @@
|
||||
<div class="col-md-6">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="auto_fetch_branch">Branch List<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="auto_fetch_branch" name="auto_fetch_branch" required>
|
||||
<select class="form-control select2" id="auto_fetch_branch" name="auto_fetch_branch" required>
|
||||
<option value="">Select Branch</option>
|
||||
|
||||
</select>
|
||||
@ -1043,38 +1043,52 @@
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$('#auto_fetch_client').change(function() {
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#auto_fetch_branch').html(`<option value="">Select Branch</option>`);
|
||||
$('#auto_fetch_client').select2();
|
||||
$('#auto_fetch_branch').select2();
|
||||
|
||||
$('#auto_fetch_client').change(function() {
|
||||
|
||||
$.ajax({
|
||||
url: "<?php echo base_url('client/branch/auto_fetch_branch'); ?>",
|
||||
type: "POST",
|
||||
data: {
|
||||
client_id: $('#auto_fetch_client').val()
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(response, textStatus, xhr) {
|
||||
if (xhr.status === 200) {
|
||||
let options = `<option value="">Select Branch</option>`;
|
||||
$('#auto_fetch_branch').html(`<option value="">Select Branch</option>`);
|
||||
|
||||
response.data.forEach((data) => {
|
||||
options += `<option value="${data.id}">${data.branch_name}</option>`;
|
||||
});
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$('#auto_fetch_branch').html(options);
|
||||
} else {
|
||||
$('#auto_fetch_branch').html('<option value="">No Branch Found</option>');
|
||||
$.ajax({
|
||||
url: "<?php echo base_url('client/branch/auto_fetch_branch'); ?>",
|
||||
type: "POST",
|
||||
data: {
|
||||
client_id: $('#auto_fetch_client').val()
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(response, textStatus, xhr) {
|
||||
if (xhr.status === 200) {
|
||||
let options = `<option value="">Select Branch</option>`;
|
||||
|
||||
response.data.forEach((data) => {
|
||||
options += `<option value="${data.id}">${data.branch_name}</option>`;
|
||||
});
|
||||
|
||||
$('#auto_fetch_branch').html(options);
|
||||
} else {
|
||||
$('#auto_fetch_branch').html('<option value="">No Branch Found</option>');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error("Error occurred:", status, error);
|
||||
},
|
||||
complete: function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.log("auto_fetch_client call is completed..!!");
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error("Error occurred:", status, error);
|
||||
},
|
||||
complete: function() {
|
||||
console.log("auto_fetch_client call is completed..!!");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
@ -1156,4 +1170,7 @@
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@ -110,7 +110,18 @@ table.dataTable tbody td {
|
||||
<!-- Include DataTables Buttons HTML5 export extension -->
|
||||
<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>
|
||||
|
||||
let url = "<?= $url ?>";
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#tickets-table').DataTable({
|
||||
dom: 'Bfrtip',
|
||||
@ -123,7 +134,7 @@ $(document).ready(function() {
|
||||
{
|
||||
text: 'Excel Error', // Set the text for the custom button
|
||||
action: function (e, dt, node, config) {
|
||||
window.location.href = '<?= base_url("util/full-excel-error-file/") . $file_id ?>';
|
||||
window.location.href = url;
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
@ -1862,6 +1862,7 @@
|
||||
let claimData = [];
|
||||
|
||||
$(".claim-row").each(function() {
|
||||
|
||||
let year = $(this).find("[name='first_year[]']").val();
|
||||
let claimAmount = $(this).find("[name='first_claim_amount[]']").val();
|
||||
let claimStatus = $(this).find("[name='first_claim_status[]']").val();
|
||||
@ -1869,13 +1870,22 @@
|
||||
let causeOfDeath = $(this).find("[name='first_cause_of_death[]']").val();
|
||||
let deathDate = $(this).find("[name='first_death_date[]']").val();
|
||||
|
||||
let emp_id = $(this).find("[name='emp_id[]']").val();
|
||||
let emp_name = $(this).find("[name='emp_name[]']").val();
|
||||
let gender = $(this).find("[name='gender[]']").val();
|
||||
let designation = $(this).find("[name='designation[]']").val();
|
||||
let sum_insured = $(this).find("[name='sum_insured[]']").val();
|
||||
|
||||
claimData.push({
|
||||
"year": year,
|
||||
"claim_amount": claimAmount,
|
||||
"status": claimStatus,
|
||||
"claim_type": claimType,
|
||||
"emp_id": emp_id,
|
||||
"emp_name": emp_name,
|
||||
"gender": gender,
|
||||
"designation": designation,
|
||||
"sum_insured": sum_insured,
|
||||
"death_date": deathDate,
|
||||
"cause_of_death": causeOfDeath,
|
||||
"death_date": deathDate
|
||||
"settled": claimAmount,
|
||||
});
|
||||
});
|
||||
|
||||
@ -1893,6 +1903,93 @@
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
|
||||
// do not remove this
|
||||
// function appendThreeYearsClaims(count) {
|
||||
|
||||
// // let count = $('#appendAreaForClaim').data('count');
|
||||
// console.log("count", count);
|
||||
|
||||
// let policy_type_id = $('#policy_type_id_' + count).val()
|
||||
// console.log('policy_type_id', policy_type_id);
|
||||
|
||||
// console.log('claimIndex from parent', claimIndex);
|
||||
// let increment = claimIndex;
|
||||
|
||||
// let claimsFields = `
|
||||
// <div class="row claim-row">
|
||||
|
||||
// <div class="form-group col-md-2">
|
||||
// <label for="first_year_${increment}">Year<span class="text-danger">*</span></label>
|
||||
// <select class="form-control first_year_" id="first_year_${increment}" name="first_year[]">
|
||||
// <option value="">Select Year</option>
|
||||
// <?php foreach ($lastFiveYears as $year) {echo "<option value='$year'>$year</option>";} ?>
|
||||
// </select>
|
||||
// </div>
|
||||
// <div class="form-group col-md-2">
|
||||
// <label for="first_claim_amount_${increment}">Claim/Settled Amount<span class="text-danger">*</span></label>
|
||||
// <input type="text" class="form-control" id="first_claim_amount_${increment}" name="first_claim_amount[]">
|
||||
// </div>
|
||||
// <div class="form-group col-md-2">
|
||||
// <label for="first_claim_status_${increment}">Claim Status<span class="text-danger">*</span></label>
|
||||
// <input type="text" class="form-control" id="first_claim_status_${increment}" name="first_claim_status[]">
|
||||
// </div>
|
||||
// <div class="form-group col-md-2 lifeClaimFields" style="display:none;">
|
||||
// <label for="first_cause_of_death_${increment}">Nature/Cause Of Death <span class="text-danger">*</span></label>
|
||||
// <select class="form-control" id="first_cause_of_death_${increment}" name="first_cause_of_death[]">
|
||||
// <option value="">Select Cause of Death</option>
|
||||
// <?php foreach ($causeOfDeath as $cause => $death_value) {echo "<option value='$cause'>$death_value</option>";} ?>
|
||||
// </select>
|
||||
// </div>
|
||||
// <div class="form-group col-md-2 lifeClaimFields" style="display:none;">
|
||||
// <label for="first_death_date_${increment}">Date of Death<span class="text-danger">*</span></label>
|
||||
// <input type="text" class="form-control" id="first_death_date_${increment}" name="first_death_date[]">
|
||||
// </div>
|
||||
// <div class="form-group col-md-2 gpaClaimFileds" style="display:none;">
|
||||
// <label for="claim_type_${increment}">Claim Type<span class="text-danger">*</span></label>
|
||||
// <select class="form-control" id="claim_type_${increment}" name="claim_type[]">
|
||||
// <option value="">Select Claim Type</option>
|
||||
// <?php foreach ($gpaClaimType as $claimType => $claim_value) {echo "<option value='$claimType'>$claim_value</option>";} ?>
|
||||
// </select>
|
||||
// </div>
|
||||
// <div class="form-group col-md-2">
|
||||
// <div class="" style="position: relative; top: 28px; float: right; text-align: end;">
|
||||
// <a class="btn btn-danger waves-effect waves-light" onclick="removeClaim(this, ${count})">x</a>
|
||||
// <a class="btn btn-primary waves-effect waves-light mr-1" onclick="appendThreeYearsClaims(${count})">+</a>
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
// `;
|
||||
|
||||
// // Append new claim fields
|
||||
// let referenceDiv = document.getElementById('appendAreaForClaim_' + count);
|
||||
|
||||
// if (referenceDiv) {
|
||||
// referenceDiv.insertAdjacentHTML('beforeend', claimsFields);
|
||||
// } else {
|
||||
// console.error('Element not found: appendAreaForClaim_' + count);
|
||||
// }
|
||||
|
||||
// // Increment claim index
|
||||
// console.log("claim index " + claimIndex);
|
||||
// claimIndex++;
|
||||
// console.log("after claim index " + claimIndex);
|
||||
|
||||
// if (policy_type_id == 1) {
|
||||
// $('.gpaClaimFileds').show();
|
||||
// $('.lifeClaimFields').hide();
|
||||
// } else if (policy_type_id == 6 || policy_type_id == 7) {
|
||||
// $('.gpaClaimFileds').hide();
|
||||
// $('.lifeClaimFields').show();
|
||||
// }
|
||||
|
||||
// // Initialize Select2 for the newly added fields
|
||||
// $("#first_year_" + increment).select2();
|
||||
// $("#claim_type_" + increment).select2();
|
||||
// $("#first_cause_of_death_" + increment).select2();
|
||||
|
||||
// toggleRequiredFields();
|
||||
// }
|
||||
|
||||
function appendThreeYearsClaims(count) {
|
||||
|
||||
// let count = $('#appendAreaForClaim').data('count');
|
||||
@ -1916,15 +2013,46 @@
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="first_claim_amount_${increment}">Claim/Settled Amount<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="first_claim_amount_${increment}" name="first_claim_amount[]">
|
||||
<label for="emp_id_${increment}">Emp ID<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="emp_id_${increment}" name="emp_id[]">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="first_claim_status_${increment}">Claim Status<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="first_claim_status_${increment}" name="first_claim_status[]">
|
||||
<label for="emp_name_${increment}">Employee Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="emp_name_${increment}" name="emp_name[]">
|
||||
</div>
|
||||
<div class="form-group col-md-2 lifeClaimFields" style="display:none;">
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="gender_${increment}">Gender<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="gender_${increment}" name="gender[]">
|
||||
<option value="">Select Gender</option>
|
||||
<option value="Female">Female</option>
|
||||
<option value="Male">Male</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="designation_${increment}">Designation <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="designation_${increment}" name="designation[]">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="sum_insured_${increment}">Sum Insured <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="sum_insured_${increment}" name="sum_insured[]">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="first_death_date_${increment}">Date of Death<span class="text-danger">*</span></label>
|
||||
<div class="input-icon">
|
||||
<input type="text" class="form-control death_date flatpickr-date" id="first_death_date_${increment}" name="first_death_date[]" autocomplete="off">
|
||||
<i class="mdi mdi-calendar-blank-outline additional-icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="first_cause_of_death_${increment}">Nature/Cause Of Death <span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="first_cause_of_death_${increment}" name="first_cause_of_death[]">
|
||||
<option value="">Select Cause of Death</option>
|
||||
@ -1933,11 +2061,18 @@
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-2 lifeClaimFields" style="display:none;">
|
||||
<label for="first_death_date_${increment}">Date of Death<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="first_death_date_${increment}" name="first_death_date[]">
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="first_claim_amount_${increment}">Claim/Settled Amount<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="first_claim_amount_${increment}" name="first_claim_amount[]">
|
||||
</div>
|
||||
<div class="form-group col-md-2 gpaClaimFileds" style="display:none;">
|
||||
|
||||
<!-- <div class="form-group col-md-2">
|
||||
<label for="first_claim_status_${increment}">Claim Status<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="first_claim_status_${increment}" name="first_claim_status[]">
|
||||
</div> -->
|
||||
|
||||
<!-- <div class="form-group col-md-2 gpaClaimFileds" style="display:none;">
|
||||
<label for="claim_type_${increment}">Claim Type<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="claim_type_${increment}" name="claim_type[]">
|
||||
<option value="">Select Claim Type</option>
|
||||
@ -1945,7 +2080,8 @@
|
||||
echo "<option value='$claimType'>$claim_value</option>";
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<div class="" style="position: relative; top: 28px; float: right; text-align: end;">
|
||||
<a class="btn btn-danger waves-effect waves-light" onclick="removeClaim(this, ${count})">x</a>
|
||||
@ -1981,10 +2117,18 @@
|
||||
$("#first_year_" + increment).select2();
|
||||
$("#claim_type_" + increment).select2();
|
||||
$("#first_cause_of_death_" + increment).select2();
|
||||
$("#gender_" + increment).select2();
|
||||
|
||||
flatpickr('.flatpickr-date', {
|
||||
dateFormat: 'd-m-Y', // Example format: 11-10-2025
|
||||
allowInput: true, // Allow manual typing
|
||||
maxDate: 'today', // Optional: disable future dates
|
||||
});
|
||||
|
||||
toggleRequiredFields();
|
||||
}
|
||||
|
||||
|
||||
function removeClaim(btn, count) {
|
||||
const container = document.getElementById('appendAreaForClaim_' + count);
|
||||
const rows = container.querySelectorAll('.claim-row');
|
||||
@ -2108,6 +2252,10 @@
|
||||
$(this).find('.form-group').each(function() {
|
||||
var input = $(this).find('input, select');
|
||||
|
||||
if (input.attr('name') === "gender[]") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (input.length === 0) {
|
||||
console.warn('No input/select fields found in:', this);
|
||||
return;
|
||||
|
||||
@ -393,7 +393,6 @@ if (isset($selected_lead_type)) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('#client_branch_id').change(function() {
|
||||
|
||||
let client_branch_id = $(this).val();
|
||||
|
||||
@ -184,7 +184,18 @@ table.dataTable tbody td {
|
||||
<?php if(isset($lead_data_list)) { ?>
|
||||
<?php foreach($lead_data_list as $index => $row){ ?>
|
||||
<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 $issuer[$row['issuer']] ?? '-'; ?></td>
|
||||
<td><?php echo $client_type[$row['client_type']] ?? '-'; ?></td>
|
||||
|
||||
@ -37,14 +37,15 @@
|
||||
<hr>
|
||||
|
||||
<?php if(isset($lead_edit_data)) { ?>
|
||||
|
||||
<div class="form-row" id="appendAreaForClaim_1">
|
||||
<?php
|
||||
|
||||
$claims = !empty($lead_edit_data['fin_years_claims_array']) ? $lead_edit_data['fin_years_claims_array'] : [ ['year' => '', 'claim_amount' => '', 'status' => '', 'claim_type' => '', 'cause_of_death' => '', 'death_date' => ''] ];
|
||||
|
||||
foreach ($claims as $key => $value) { ?>
|
||||
|
||||
<div class="row claim-row">
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="first_year">Year<span class="text-danger">*</span></label>
|
||||
<select class="form-control first_year_" id="first_year" name="first_year[]">
|
||||
@ -55,15 +56,42 @@
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="first_claim_amount">Claim/Settled Amount<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="first_claim_amount" name="first_claim_amount[]" value="<?= htmlspecialchars($value['claim_amount']) ?>">
|
||||
<label for="emp_id">Emp ID<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="emp_id" name="emp_id[]" value="<?= htmlspecialchars(isset($value['emp_id']) ? $value['emp_id'] : '-' ) ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="first_claim_status">Claim Status<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="first_claim_status" name="first_claim_status[]" value="<?= htmlspecialchars($value['status']) ?>">
|
||||
<label for="emp_name">Employee Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="emp_name" name="emp_name[]" value="<?= htmlspecialchars(isset($value['emp_name']) ? $value['emp_name'] : '-' ) ?>">
|
||||
</div>
|
||||
<div class="form-group col-md-2 lifeClaimFields" style="display:none;">
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="gender">Gender<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="gender" name="gender[]">
|
||||
<option value="">Select Gender</option>
|
||||
<option value="Female" <?= htmlspecialchars(isset($value['gender']) && $value['gender'] == "" ? 'selected' : "Female" ) ?> >Female</option>
|
||||
<option value="Male" <?= htmlspecialchars(isset($value['gender']) && $value['gender'] == "" ? 'selected' : "Male" ) ?> >Male</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="designation">Designation <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="designation" name="designation[]" value="<?= htmlspecialchars(isset($value['designation']) ? $value['designation'] : '-' ) ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="sum_insured">Sum Insured <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="sum_insured" name="sum_insured[]" value="<?= htmlspecialchars(isset($value['sum_insured']) ? $value['sum_insured'] : '-' ) ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="first_death_date">Date of Death<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control flatpickr-date" id="first_death_date" name="first_death_date[]" value="<?= htmlspecialchars($value['death_date']) ?>" autocomplete="off">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="first_cause_of_death">Nature/Cause Of Death <span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="first_cause_of_death" name="first_cause_of_death[]">
|
||||
<option value="">Select Cause of Death</option>
|
||||
@ -73,26 +101,37 @@
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-2 lifeClaimFields" style="display:none;">
|
||||
<label for="first_death_date">Date of Death<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="first_death_date" name="first_death_date[]" value="<?= htmlspecialchars($value['death_date']) ?>">
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="first_claim_amount">Claim/Settled Amount<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="first_claim_amount" name="first_claim_amount[]" value="<?= htmlspecialchars(isset($value['claim_amount']) ? $value['claim_amount'] : ( isset($value['settled']) ? $value['settled'] : '-' )) ?>">
|
||||
</div>
|
||||
<div class="form-group col-md-2 gpaClaimFileds" style="display:none;">
|
||||
|
||||
<!-- <div class="form-group col-md-2">
|
||||
<label for="first_claim_status">Claim Status<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="first_claim_status" name="first_claim_status[]" value="<?php //htmlspecialchars($value['status']) ?>">
|
||||
</div> -->
|
||||
|
||||
<!-- <div class="form-group col-md-2 gpaClaimFileds" style="display:none;">
|
||||
<label for="claim_type">Claim Type<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="claim_type" name="claim_type[]">
|
||||
<option value="">Select Claim Type</option>
|
||||
<?php foreach ($gpaClaimType as $claimType => $claim_value) {
|
||||
$selected = ($claimType == $value['claim_type']) ? 'selected' : '';
|
||||
echo "<option value='$claimType' $selected>$claim_value</option>";
|
||||
} ?>
|
||||
<?php
|
||||
// foreach ($gpaClaimType as $claimType => $claim_value) {
|
||||
// $selected = ($claimType == $value['claim_type']) ? 'selected' : '';
|
||||
// echo "<option value='$claimType' $selected>$claim_value</option>";
|
||||
// }
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<div class="" style="position: relative; top: 28px; float: right; text-align: end;">
|
||||
<a class="btn btn-danger waves-effect waves-light" onclick="removeClaim(this, 1)">x</a>
|
||||
<a class="btn btn-primary waves-effect waves-light mr-1" onclick="appendThreeYearsClaims(1)">+</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
@ -100,3 +139,13 @@
|
||||
<div class="form-row" id="appendAreaForClaim"></div>
|
||||
<?php } ?>
|
||||
|
||||
<script>
|
||||
|
||||
flatpickr('.flatpickr-date', {
|
||||
dateFormat: 'd-M-Y', // Example format: 11-10-2025
|
||||
allowInput: true, // Allow manual typing
|
||||
maxDate: 'today', // Optional: disable future dates
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
<style>
|
||||
|
||||
|
||||
|
||||
.table-container {
|
||||
overflow-x: auto !important;
|
||||
/* margin-top: 20px; */
|
||||
@ -178,18 +176,18 @@
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
.dialog-header {
|
||||
/* .dialog-header {
|
||||
font-size: 18px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
} */
|
||||
|
||||
.dialog-content {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.dialog-footer {
|
||||
/* .dialog-footer {
|
||||
text-align: right;
|
||||
}
|
||||
} */
|
||||
|
||||
.dialog button {
|
||||
padding: 5px 10px;
|
||||
@ -310,16 +308,205 @@
|
||||
|
||||
</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="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<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>
|
||||
</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"
|
||||
style="text-align: right; position: relative;top: 56px; left: 386px;">
|
||||
<a onclick="checkTheTableDataChanged(1)" class="btn btn-primary">Back</a>
|
||||
@ -426,51 +613,130 @@
|
||||
</div>
|
||||
|
||||
<!-- familiy floater dialog -->
|
||||
<div class="dialog" id="familyFloaterDialog">
|
||||
<div class="dialog-header ">
|
||||
<span style="color:black;" >Family Members </span>
|
||||
<div class="dialog" id="familyFloaterDialog" style="display: none;">
|
||||
<div class="dialog-header">
|
||||
<span style="color:black;">Family Members</span>
|
||||
<span>
|
||||
<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>
|
||||
</span>
|
||||
</div>
|
||||
<div class="dialog-content">
|
||||
<label>
|
||||
<input type="checkbox" id="family_self" checked>
|
||||
Self
|
||||
</label><br>
|
||||
<label>
|
||||
<input type="checkbox" id="family_spouse">
|
||||
Spouse
|
||||
</label><br>
|
||||
<label for="children">Children:</label>
|
||||
<select class="form-control" id="family_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><br>
|
||||
<label for="otherMembers">Other Members:</label>
|
||||
<select class="form-control" id="family_other_members" onchange="setEldersCount(this)">
|
||||
<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><br>
|
||||
<label for="eldersCount">Elders Count:</label>
|
||||
<input class="form-control" type="text" id="family_elders_count" readonly>
|
||||
<!-- Self -->
|
||||
<div class="family-row">
|
||||
<div class="family-member-col" style="margin-top: 15px;">
|
||||
<label>
|
||||
<input type="checkbox" id="family_self" checked onchange="toggleAgeFields(this, 'self')">
|
||||
Self
|
||||
</label>
|
||||
</div>
|
||||
<div class="age-inputs-col" id="self_age_fields">
|
||||
<div class="age-input-group" style="margin-top: -23px;">
|
||||
<label class="age-label">Min Age</label>
|
||||
<input type="number" class="age-input" id="family_self_min_age"
|
||||
placeholder="18" min="18" max="99">
|
||||
</div>
|
||||
<div class="age-input-group" style="margin-top: -23px;">
|
||||
<label class="age-label">Max Age</label>
|
||||
<input type="number" class="age-input" id="family_self_max_age"
|
||||
placeholder="99" min="18" max="99">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Spouse -->
|
||||
<div class="family-row">
|
||||
<div class="family-member-col" style="margin-top: 24px;">
|
||||
<label>
|
||||
<input type="checkbox" id="family_spouse" onchange="toggleAgeFields(this, 'spouse')">
|
||||
Spouse
|
||||
</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_column_index" style="display: none;" readonly>
|
||||
</div>
|
||||
<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>
|
||||
|
||||
<!-- familiy floater dialog end -->
|
||||
|
||||
<!-- Modal content for Send Insurer and Client Mail -->
|
||||
@ -765,10 +1031,14 @@
|
||||
</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>
|
||||
</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><!-- /.modal-content -->
|
||||
</div>
|
||||
@ -1081,13 +1351,16 @@ let intervalId;
|
||||
$(document).ready(function () {
|
||||
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'] : '' ?>';
|
||||
console.log('Lead status retrieved:', lead_status);
|
||||
|
||||
if (lead_status != "won") {
|
||||
console.log("Lead status is not 'won', setting interval for submitData");
|
||||
|
||||
startInterval();
|
||||
// startInterval();
|
||||
} else {
|
||||
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() {
|
||||
$('#familyFloaterDialog').css('display', 'none');
|
||||
resetFamiliyDialogModalValues();
|
||||
});
|
||||
|
||||
var currentThrdottedMenu = '';
|
||||
var proposal_colum_count = 1;
|
||||
var demography_file_status = '<?= $lead_data['demography_file_status'] ?>';
|
||||
|
||||
var over_all_column_data = {
|
||||
"Proposal 1": {
|
||||
@ -1133,6 +1408,7 @@ var over_all_column_data = {
|
||||
'insurers': []
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const textarea = document.getElementById('placement_mail_content');
|
||||
const textarea2 = document.getElementById("placement_subject");
|
||||
@ -1179,7 +1455,7 @@ function showFamilyFloaterDialogBox(target) {
|
||||
let hiddenInput = target.querySelector('input[type="hidden"]');
|
||||
// alert(hiddenInput);
|
||||
let inputValue = hiddenInput ? hiddenInput.value : null;
|
||||
// console.log('hidden input value');
|
||||
console.log('hidden input value');
|
||||
console.log(inputValue);
|
||||
if (inputValue !== null && inputValue !== '') {
|
||||
//get stored familiy composition json if any in hidden input and display it
|
||||
@ -1189,6 +1465,8 @@ function showFamilyFloaterDialogBox(target) {
|
||||
|
||||
setFamilyDialogValues(inputValue);
|
||||
// return true;
|
||||
}else{
|
||||
resetFamiliyDialogModalValues();
|
||||
}
|
||||
|
||||
// setCellInnerHTMLByCellIndex('rfqTable', currentTD.rowIndex, (currentTD.columnIndex), '<b>TEST</b>');
|
||||
@ -1207,6 +1485,19 @@ function saveFamilyMembersDetails() {
|
||||
var elders = $('#family_other_members').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('self' + '-' + self);
|
||||
console.log('spouse' + '-' + spouse);
|
||||
@ -1227,8 +1518,17 @@ function saveFamilyMembersDetails() {
|
||||
'spouse': spouse,
|
||||
'children': children,
|
||||
'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_value);
|
||||
|
||||
@ -1256,16 +1556,36 @@ function saveFamilyMembersDetails() {
|
||||
}
|
||||
|
||||
function resetFamiliyDialogModalValues() {
|
||||
|
||||
$('#familiy_dialog_row_index').val('');
|
||||
$('#familiy_dialog_column_index').val('');
|
||||
// $('#family_self').val('');
|
||||
$('#family_self').prop('checked', true); // Checks the checkbox
|
||||
|
||||
// $('#family_spouse').val('');
|
||||
$('#family_spouse').prop('checked', false); // Checks the checkbox
|
||||
$('#family_children').val(0)
|
||||
|
||||
// Reset Self
|
||||
$('#family_self').prop('checked', true);
|
||||
$('#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_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) {
|
||||
@ -1307,6 +1627,9 @@ function createFamilyDisplayString(familyArray) {
|
||||
}
|
||||
|
||||
function createFamilyJSONString(familyArray) {
|
||||
|
||||
console.log('familyArray', familyArray);
|
||||
|
||||
let result = {
|
||||
"self": familyArray['self'] || 0,
|
||||
"spouse": familyArray['spouse'] || 0,
|
||||
@ -1317,6 +1640,15 @@ function createFamilyJSONString(familyArray) {
|
||||
"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
|
||||
switch (familyArray['family_other_members']) {
|
||||
case 'oneparent':
|
||||
@ -1350,19 +1682,74 @@ function createFamilyJSONString(familyArray) {
|
||||
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
|
||||
return JSON.stringify(result);
|
||||
}
|
||||
|
||||
function setFamilyDialogValues(familyData) {
|
||||
|
||||
// Set Self checkbox
|
||||
$('#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
|
||||
$('#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
|
||||
$('#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)
|
||||
if (familyData.parents === 1) {
|
||||
@ -4010,7 +4397,7 @@ function constructURL_ForInternalMailSend() {
|
||||
}
|
||||
|
||||
//placement mail
|
||||
function constructURL_ForPlacementMailSend() {
|
||||
function constructURL_ForPlacementMailSend(return_type = false) {
|
||||
|
||||
var lead_id = $('#lead_id').val();
|
||||
let to = $('#placement_to').val();
|
||||
@ -4067,7 +4454,6 @@ function constructURL_ForPlacementMailSend() {
|
||||
data.push(obj);
|
||||
});
|
||||
|
||||
|
||||
// Prepare FormData
|
||||
var formData = new FormData();
|
||||
formData.append('lead_id', lead_id);
|
||||
@ -4096,8 +4482,40 @@ function constructURL_ForPlacementMailSend() {
|
||||
formData.append('acm_email', acm_email);
|
||||
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;
|
||||
|
||||
}else if(redirect_type == 6){
|
||||
//INTERNAL MAIL SEND
|
||||
//PLACEMENT MAIL SEND
|
||||
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();
|
||||
$('#multiFileAppendArea').append(res.document_data);
|
||||
$('.attachmet_row').html(res.attachment_html);
|
||||
window.location.reload();
|
||||
}else{
|
||||
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>
|
||||
Loading…
Reference in New Issue
Block a user