MERGE_TEST_SIGNOFF_ISSUES

This commit is contained in:
Ubuntu 2025-05-30 22:43:18 +05:30
commit 74f49f8d0a
36 changed files with 3177 additions and 2515 deletions

View File

@ -332,7 +332,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
$routes->get("send_manual_ecard/(:any)", "DashboardController::sendManualEcard/$1"); $routes->get("send_manual_ecard/(:any)", "DashboardController::sendManualEcard/$1");
$routes->get("get_client_policy_list_for_remainder/(:any)", "EmployeeController::get_client_policy_list_for_remainder/$1"); $routes->get("get_client_policy_list_for_remainder/(:any)", "EmployeeController::get_client_policy_list_for_remainder/$1");
$routes->get("get_client_branch_data/(:any)", "ClientController::get_client_branch_data/$1"); $routes->get("get_client_branch_data/(:any)", "ClientController::get_client_branch_data/$1");
$routes->get("getLevelContects", "LeadsControllerg::getLevelContects"); $routes->get("getLevelContects", "LeadsController::getLevelContects");
$routes->get("get_emp_master_data_for_update/(:any)", "EmployeeController::get_emp_master_data_for_update/$1"); $routes->get("get_emp_master_data_for_update/(:any)", "EmployeeController::get_emp_master_data_for_update/$1");
$routes->get("send_mail_for_individual_employee_ecard/(:any)", "EmployeeController::send_mail_for_individual_employee_ecard/$1"); $routes->get("send_mail_for_individual_employee_ecard/(:any)", "EmployeeController::send_mail_for_individual_employee_ecard/$1");
$routes->post("update_emp_data", "EmployeeController::update_emp_data"); $routes->post("update_emp_data", "EmployeeController::update_emp_data");
@ -524,6 +524,8 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy"); $routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");
$routes->get("getFEContent", "EmployeeRestController::getFEContent"); $routes->get("getFEContent", "EmployeeRestController::getFEContent");
$routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage"); $routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
$routes->get("getWellnessURL", "EmployeeRestController::getWellnessURL");
// $routes->post('postDataForTicket',"EmployeeRestController::postDataForTicket"); // $routes->post('postDataForTicket',"EmployeeRestController::postDataForTicket");
}); });
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy"); $routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");

View File

@ -687,6 +687,7 @@ class ClientController extends AdminController
$CD_Account_Number = $this->CDMasterModel $CD_Account_Number = $this->CDMasterModel
->where('client_id', $client_id) ->where('client_id', $client_id)
->where('insurer_id', $insurer_id) ->where('insurer_id', $insurer_id)
->where('is_active', 1)
->first(); ->first();
// Prepare the array with data // Prepare the array with data
$date = \DateTime::createFromFormat('d/m/Y', $record_date); $date = \DateTime::createFromFormat('d/m/Y', $record_date);
@ -2092,7 +2093,7 @@ class ClientController extends AdminController
->findAll(); ->findAll();
$client_policy_list = $this->clientPolicyModel->getPolicyTypeForPolicyBinding($client_id); $client_policy_list = $this->clientPolicyModel->getPolicyTypeForPolicyBinding($client_id);
$cd_data = $this->CDMasterModel->where('client_id', $client_id)->where('insurer_id', $insurer_id)->findAll(); $cd_data = $this->CDMasterModel->where('client_id', $client_id)->where('insurer_id', $insurer_id)->where('is_active', 1)->findAll();
// $client_policy_data['policy_end_date'] = date('d/m/Y', strtotime($client_policy_data['policy_end_date'])); // $client_policy_data['policy_end_date'] = date('d/m/Y', strtotime($client_policy_data['policy_end_date']));
$fromDate = new \DateTime($client_policy_data['policy_end_date']); $fromDate = new \DateTime($client_policy_data['policy_end_date']);
$fromDate->modify('+1 year'); $fromDate->modify('+1 year');
@ -2405,52 +2406,109 @@ class ClientController extends AdminController
// print_r($data);die; // print_r($data);die;
$data['waiverofpreexistingdiseases'] = $this->request->getPost("waiverofpreexistingdiseases"); // $data['waiverofpreexistingdiseases'] = $this->request->getPost("waiverofpreexistingdiseases");
$data['waiverof1,2,3&4thyearexclusions'] = $this->request->getPost("waiverof1,2,3&4thyearexclusions"); // $data['waiverof1,2,3&4thyearexclusions'] = $this->request->getPost("waiverof1,2,3&4thyearexclusions");
$data['waiverof30dayswaitingperiod'] = $this->request->getPost("waiverof30dayswaitingperiod"); // $data['waiverof30dayswaitingperiod'] = $this->request->getPost("waiverof30dayswaitingperiod");
$data['waiver_of_90_days_waiting_period'] = $this->request->getPost("waiver_of_90_days_waiting_period"); // $data['waiver_of_90_days_waiting_period'] = $this->request->getPost("waiver_of_90_days_waiting_period");
$data['waiver_of_other_waiting_periods'] = $this->request->getPost("waiver_of_other_waiting_periods"); // $data['waiver_of_other_waiting_periods'] = $this->request->getPost("waiver_of_other_waiting_periods");
$data['maternity_benefit'] = $this->request->getPost("maternity_benefit"); // $data['maternity_benefit'] = $this->request->getPost("maternity_benefit");
$data['9monthwaitingperiodwaived'] = str_replace(',', '', $this->request->getPost("9monthwaitingperiodwaived")); // $data['9monthwaitingperiodwaived'] = str_replace(',', '', $this->request->getPost("9monthwaitingperiodwaived"));
$data['maternitycoverage'] = str_replace(',', '', $this->request->getPost("maternitycoverage")); // $data['maternitycoverage'] = str_replace(',', '', $this->request->getPost("maternitycoverage"));
$data['twindelivery'] = str_replace(',', '', $this->request->getPost("twindelivery")); // $data['twindelivery'] = str_replace(',', '', $this->request->getPost("twindelivery"));
$data['well_baby_well_mother_expenses'] = str_replace(',', '', $this->request->getPost("well_baby_well_mother_expenses")); // $data['well_baby_well_mother_expenses'] = str_replace(',', '', $this->request->getPost("well_baby_well_mother_expenses"));
$data['preandpostnatal'] = str_replace(',', '', $this->request->getPost("preandpostnatal")); // $data['preandpostnatal'] = str_replace(',', '', $this->request->getPost("preandpostnatal"));
$data['infertility_treatment_coverage'] = str_replace(',', '', $this->request->getPost("infertility_treatment_coverage")); // $data['infertility_treatment_coverage'] = str_replace(',', '', $this->request->getPost("infertility_treatment_coverage"));
$data['babyday1cover'] = str_replace(',', '', $this->request->getPost("babyday1cover")); // $data['babyday1cover'] = str_replace(',', '', $this->request->getPost("babyday1cover"));
$data['coverfromthedateofjoining'] = str_replace(',', '', $this->request->getPost("coverfromthedateofjoining")); // $data['coverfromthedateofjoining'] = str_replace(',', '', $this->request->getPost("coverfromthedateofjoining"));
$data['mid_term_addition_of_new_born_newly_wedded_spouse'] = str_replace(',', '', $this->request->getPost("mid_term_addition_of_new_born_newly_wedded_spouse")); // $data['mid_term_addition_of_new_born_newly_wedded_spouse'] = str_replace(',', '', $this->request->getPost("mid_term_addition_of_new_born_newly_wedded_spouse"));
$data['prehospitalizationcover'] = str_replace(',', '', $this->request->getPost("prehospitalizationcover")); // $data['prehospitalizationcover'] = str_replace(',', '', $this->request->getPost("prehospitalizationcover"));
$data['posthospitalizationcover'] =$this->request->getPost("posthospitalizationcover"); // $data['posthospitalizationcover'] =$this->request->getPost("posthospitalizationcover");
$data['congenitaldiseasesinternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesinternal")); // $data['congenitaldiseasesinternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesinternal"));
$data['congenitaldiseasesexternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesexternal")); // $data['congenitaldiseasesexternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesexternal"));
$data['copayzonewisecopay'] = $this->request->getPost("copayzonewisecopay"); // $data['copayzonewisecopay'] = $this->request->getPost("copayzonewisecopay");
$data['roomrentlimit'] = str_replace(',', '', $this->request->getPost("roomrentlimit")); // $data['roomrentlimit'] = str_replace(',', '', $this->request->getPost("roomrentlimit"));
$data['icu_limit'] = str_replace(',', '', $this->request->getPost("icu_limit")); // $data['icu_limit'] = str_replace(',', '', $this->request->getPost("icu_limit"));
$data['proportionatedeductionclause'] = str_replace(',', '', $this->request->getPost("proportionatedeductionclause")); // $data['proportionatedeductionclause'] = str_replace(',', '', $this->request->getPost("proportionatedeductionclause"));
$data['ailmentcapping'] = $this->request->getPost("ailmentcapping"); // $data['ailmentcapping'] = $this->request->getPost("ailmentcapping");
$data['ailment_capping_details'] = str_replace(',', '', $this->request->getPost("ailment_capping_details")); // $data['ailment_capping_details'] = str_replace(',', '', $this->request->getPost("ailment_capping_details"));
$data['corporatebuffer'] = str_replace(',', '', $this->request->getPost("corporatebuffer")); // $data['corporatebuffer'] = str_replace(',', '', $this->request->getPost("corporatebuffer"));
$data['non_admissible_contingency_corporate_buffer'] = str_replace(',', '', $this->request->getPost("non_admissible_contingency_corporate_buffer")); // $data['non_admissible_contingency_corporate_buffer'] = str_replace(',', '', $this->request->getPost("non_admissible_contingency_corporate_buffer"));
$data['ambulancecharges'] = str_replace(',', '', $this->request->getPost("ambulancecharges")); // $data['ambulancecharges'] = str_replace(',', '', $this->request->getPost("ambulancecharges"));
$data['airambulance'] = str_replace(',', '', $this->request->getPost("airambulance")); // $data['airambulance'] = str_replace(',', '', $this->request->getPost("airambulance"));
$data['reasonableandcustomarycharges'] = str_replace(',', '', $this->request->getPost("reasonableandcustomarycharges")); // $data['reasonableandcustomarycharges'] = str_replace(',', '', $this->request->getPost("reasonableandcustomarycharges"));
$data['daycaretreatment'] = str_replace(',', '', $this->request->getPost("daycaretreatment")); // $data['daycaretreatment'] = str_replace(',', '', $this->request->getPost("daycaretreatment"));
$data['lasiksurgery'] = str_replace(',', '', $this->request->getPost("lasiksurgery")); // $data['lasiksurgery'] = str_replace(',', '', $this->request->getPost("lasiksurgery"));
$data['ayudhtreatmentcover'] = str_replace(',', '', $this->request->getPost("ayudhtreatmentcover")); // $data['ayudhtreatmentcover'] = str_replace(',', '', $this->request->getPost("ayudhtreatmentcover"));
$data['moderntreatmentsasperirdai'] = str_replace(',', '', $this->request->getPost("moderntreatmentsasperirdai")); // $data['moderntreatmentsasperirdai'] = str_replace(',', '', $this->request->getPost("moderntreatmentsasperirdai"));
$data['opd_treatment'] = str_replace(',', '', $this->request->getPost("opd_treatment")); // $data['opd_treatment'] = str_replace(',', '', $this->request->getPost("opd_treatment"));
$data['days_of_discharge'] = str_replace(',', '', $this->request->getPost("days_of_discharge")); // $data['days_of_discharge'] = str_replace(',', '', $this->request->getPost("days_of_discharge"));
$data['days_from_dod'] = str_replace(',', '', $this->request->getPost("days_from_dod")); // $data['days_from_dod'] = str_replace(',', '', $this->request->getPost("days_from_dod"));
$data['terrorism'] = str_replace(',', '', $this->request->getPost("terrorism")); // $data['terrorism'] = str_replace(',', '', $this->request->getPost("terrorism"));
$data['widower_cover'] = str_replace(',', '', $this->request->getPost("widower_cover")); // $data['widower_cover'] = str_replace(',', '', $this->request->getPost("widower_cover"));
$data['breavement_cover'] = str_replace(',', '', $this->request->getPost("breavement_cover")); // $data['breavement_cover'] = str_replace(',', '', $this->request->getPost("breavement_cover"));
$data['suminsuredenhancement'] = str_replace(',', '', $this->request->getPost("suminsuredenhancement")); // $data['suminsuredenhancement'] = str_replace(',', '', $this->request->getPost("suminsuredenhancement"));
$data['special_condition_label'] = str_replace(',', '', $this->request->getPost("special_condition_label")) ?? []; // $data['special_condition_label'] = str_replace(',', '', $this->request->getPost("special_condition_label")) ?? [];
$data['special_condition_input'] = str_replace(',', '', $this->request->getPost("special_condition_input")) ?? []; // $data['special_condition_input'] = str_replace(',', '', $this->request->getPost("special_condition_input")) ?? [];
$data['multiple_sum_insured'] = str_replace(',', '', $this->request->getPost("multiple_sum_insured")) ?? []; // $data['multiple_sum_insured'] = str_replace(',', '', $this->request->getPost("multiple_sum_insured")) ?? [];
$fields = [
'waiverofpreexistingdiseases' => false,
'waiverof1,2,3&4thyearexclusions' => false,
'waiverof30dayswaitingperiod' => false,
'waiver_of_90_days_waiting_period' => false,
'waiver_of_other_waiting_periods' => false,
'maternity_benefit' => false,
'9monthwaitingperiodwaived' => true,
'maternitycoverage' => true,
'twindelivery' => true,
'well_baby_well_mother_expenses' => true,
'preandpostnatal' => true,
'infertility_treatment_coverage' => true,
'babyday1cover' => true,
'coverfromthedateofjoining' => true,
'mid_term_addition_of_new_born_newly_wedded_spouse' => true,
'prehospitalizationcover' => true,
'posthospitalizationcover' => false,
'congenitaldiseasesinternal' => true,
'congenitaldiseasesexternal' => true,
'copayzonewisecopay' => false,
'roomrentlimit' => true,
'icu_limit' => true,
'proportionatedeductionclause' => true,
'ailmentcapping' => false,
'ailment_capping_details' => true,
'corporatebuffer' => true,
'non_admissible_contingency_corporate_buffer' => true,
'ambulancecharges' => true,
'airambulance' => true,
'reasonableandcustomarycharges' => true,
'daycaretreatment' => true,
'lasiksurgery' => true,
'ayudhtreatmentcover' => true,
'moderntreatmentsasperirdai' => true,
'opd_treatment' => true,
'days_of_discharge' => true,
'days_from_dod' => true,
'terrorism' => true,
'widower_cover' => true,
'breavement_cover' => true,
'suminsuredenhancement' => true,
'special_condition_label' => true,
'special_condition_input' => true,
'multiple_sum_insured' => true,
];
// $data = [];
foreach ($fields as $field => $needsCleanup) {
$value = $this->request->getPost($field);
if ($value !== null && $value !== '') {
$data[$field] = $needsCleanup ? str_replace(',', '', $value) : $value;
}
}
$data['enrollment_display_key'] = $this->enrollmentGMCDisplayValueTransform(); $data['enrollment_display_key'] = $this->enrollmentGMCDisplayValueTransform();
@ -2502,6 +2560,10 @@ class ClientController extends AdminController
if ($this->request->getPost("waiverof30dayswaitingperiod_display")) { if ($this->request->getPost("waiverof30dayswaitingperiod_display")) {
$data['Waiver of 30 days waiting period'] = $this->request->getPost("waiverof30dayswaitingperiod"); $data['Waiver of 30 days waiting period'] = $this->request->getPost("waiverof30dayswaitingperiod");
} }
if ($this->request->getPost("suminsuredenhancement_display")) {
$data['Sum Insured Enhancement'] = $this->request->getPost("suminsuredenhancement");
}
if ($this->request->getPost("waiver_of_90_days_waiting_period_display")) { if ($this->request->getPost("waiver_of_90_days_waiting_period_display")) {
$data['Waiver of 90 Days Waiting Period'] = $this->request->getPost("waiver_of_90_days_waiting_period"); $data['Waiver of 90 Days Waiting Period'] = $this->request->getPost("waiver_of_90_days_waiting_period");
@ -2719,33 +2781,79 @@ class ClientController extends AdminController
$data['age_ratio']['self']['max'] = $this->request->getPost("self_max_age"); $data['age_ratio']['self']['max'] = $this->request->getPost("self_max_age");
$data['is_payable_employee']['self'] = 0; $data['is_payable_employee']['self'] = 0;
$data['accidentalDeathBenefit'] = str_replace(',', '', $this->request->getPost("accidentalDeathBenefit")); // $data['accidentalDeathBenefit'] = str_replace(',', '', $this->request->getPost("accidentalDeathBenefit"));
$data['permanentTotalDisablement'] = str_replace(',', '', $this->request->getPost("permanentTotalDisablement")); // $data['permanentTotalDisablement'] = str_replace(',', '', $this->request->getPost("permanentTotalDisablement"));
$data['permanentPartialDisablement'] = $this->request->getPost("permanentPartialDisablement"); // $data['permanentPartialDisablement'] = $this->request->getPost("permanentPartialDisablement");
$data['temporaryTotalDisablementBenefit'] = $this->request->getPost("temporaryTotalDisablementBenefit"); // $data['temporaryTotalDisablementBenefit'] = $this->request->getPost("temporaryTotalDisablementBenefit");
$data['medical_expenses_medical_extension'] = str_replace(',', '', $this->request->getPost("medical_expenses_medical_extension")); // $data['medical_expenses_medical_extension'] = str_replace(',', '', $this->request->getPost("medical_expenses_medical_extension"));
$data['opd_treatment_cover'] = str_replace(',', '', $this->request->getPost("opd_treatment_cover")); // $data['opd_treatment_cover'] = str_replace(',', '', $this->request->getPost("opd_treatment_cover"));
$data['ambulanceCharges'] = str_replace(',', '', $this->request->getPost("ambulanceCharges")); // $data['ambulanceCharges'] = str_replace(',', '', $this->request->getPost("ambulanceCharges"));
$data['repatriation_of_mortal_remains'] = str_replace(',', '', $this->request->getPost("repatriation_of_mortal_remains")); // $data['repatriation_of_mortal_remains'] = str_replace(',', '', $this->request->getPost("repatriation_of_mortal_remains"));
$data['childrenEducationWelfareFund'] = str_replace(',', '', $this->request->getPost("childrenEducationWelfareFund")); // $data['childrenEducationWelfareFund'] = str_replace(',', '', $this->request->getPost("childrenEducationWelfareFund"));
$data['terrorism'] = $this->request->getPost("terrorism"); // $data['terrorism'] = $this->request->getPost("terrorism");
$data['worldwideCover'] = $this->request->getPost("worldwideCover"); // $data['worldwideCover'] = $this->request->getPost("worldwideCover");
$data['family_transportation_benefits'] = $this->request->getPost("family_transportation_benefits"); // $data['family_transportation_benefits'] = $this->request->getPost("family_transportation_benefits");
$data['fractures_dislocation_burns'] = $this->request->getPost("fractures_dislocation_burns"); // $data['fractures_dislocation_burns'] = $this->request->getPost("fractures_dislocation_burns");
$data['coma'] = $this->request->getPost("coma"); // $data['coma'] = $this->request->getPost("coma");
$data['carriageOfDeadBody'] = $this->request->getPost("carriageOfDeadBody"); // $data['carriageOfDeadBody'] = $this->request->getPost("carriageOfDeadBody");
$data['compassionateVisitExpenses'] = $this->request->getPost("compassionateVisitExpenses"); // $data['compassionateVisitExpenses'] = $this->request->getPost("compassionateVisitExpenses");
$data['travel_expenses_for_medical_treatment'] = $this->request->getPost("travel_expenses_for_medical_treatment"); // $data['travel_expenses_for_medical_treatment'] = $this->request->getPost("travel_expenses_for_medical_treatment");
$data['daily_cash_allowance'] = $this->request->getPost("daily_cash_allowance"); // $data['daily_cash_allowance'] = $this->request->getPost("daily_cash_allowance");
$data['artifical_limb_and_prosthesis'] = $this->request->getPost("artifical_limb_and_prosthesis"); // $data['artifical_limb_and_prosthesis'] = $this->request->getPost("artifical_limb_and_prosthesis");
$data['animalSnakeInsectBite'] = $this->request->getPost("animalSnakeInsectBite"); // $data['animalSnakeInsectBite'] = $this->request->getPost("animalSnakeInsectBite");
$data['air_ambulance'] = $this->request->getPost("air_ambulance"); // $data['air_ambulance'] = $this->request->getPost("air_ambulance");
$data['gpa_special_condition_label'] = str_replace(',', '', $this->request->getPost("gpa_special_condition_label")) ?? []; // $data['gpa_special_condition_label'] = str_replace(',', '', $this->request->getPost("gpa_special_condition_label")) ?? [];
$data['gpa_special_condition_input'] = str_replace(',', '', $this->request->getPost("gpa_special_condition_input")) ?? []; // $data['gpa_special_condition_input'] = str_replace(',', '', $this->request->getPost("gpa_special_condition_input")) ?? [];
$data['multiple_sum_insured'] = str_replace(',', '', $this->request->getPost("multiple_sum_insured")) ?? []; // $data['multiple_sum_insured'] = str_replace(',', '', $this->request->getPost("multiple_sum_insured")) ?? [];
$fieldsWithCommaRemoval = [
'accidentalDeathBenefit',
'permanentTotalDisablement',
'medical_expenses_medical_extension',
'opd_treatment_cover',
'ambulanceCharges',
'repatriation_of_mortal_remains',
'childrenEducationWelfareFund',
'gpa_special_condition_label',
'gpa_special_condition_input',
'multiple_sum_insured',
];
$fieldsWithoutCommaRemoval = [
'permanentPartialDisablement',
'temporaryTotalDisablementBenefit',
'terrorism',
'worldwideCover',
'family_transportation_benefits',
'fractures_dislocation_burns',
'coma',
'carriageOfDeadBody',
'compassionateVisitExpenses',
'travel_expenses_for_medical_treatment',
'daily_cash_allowance',
'artifical_limb_and_prosthesis',
'animalSnakeInsectBite',
'air_ambulance'
];
// Remove commas and assign if present
foreach ($fieldsWithCommaRemoval as $field) {
$value = $this->request->getPost($field);
if ($value !== null) {
$data[$field] = str_replace(',', '', $value);
}
}
// Direct assign if present
foreach ($fieldsWithoutCommaRemoval as $field) {
$value = $this->request->getPost($field);
if ($value !== null) {
$data[$field] = $value;
}
}
$data['enrollment_display_key'] = $this->enrollmentGPADisplayValueTransform(); $data['enrollment_display_key'] = $this->enrollmentGPADisplayValueTransform();
// print_r($data); die; // print_r($data); die;
@ -3371,11 +3479,29 @@ class ClientController extends AdminController
$client_policy_id = $this->request->getPost("client_policy_id"); $client_policy_id = $this->request->getPost("client_policy_id");
$policy_terms = $this->request->getPost("policy_terms"); $policy_terms = $this->request->getPost("policy_terms");
$policy_terms = json_decode($policy_terms, true);
if (!empty($policy_terms)) { $data = [];
$policy_terms = json_decode($policy_terms, true);
foreach ($policy_terms as $key => $value) {
if (str_ends_with($key, '_display')) {
$original_key = substr($key, 0, -8);
$newKey = implode(' ', array_map('ucfirst', explode('_', $original_key)));
$data['enrollment_display_key'][$newKey] = $policy_terms[$original_key] ?? " ";
} else {
$data[$key] = $value;
}
}
if (!empty($data)) {
$policy_terms['is_payable_employee']['self'] = 0; $policy_terms['is_payable_employee']['self'] = 0;
$policy_terms = json_encode($policy_terms); $policy_terms = json_encode($data);
} }
@ -3882,6 +4008,7 @@ class ClientController extends AdminController
$cdmData = $this->CDMasterModel $cdmData = $this->CDMasterModel
->where('client_id', $client) ->where('client_id', $client)
->where('insurer_id', $insurer) ->where('insurer_id', $insurer)
->where('is_active', 1)
->findAll(); ->findAll();
if ($cdmData) { if ($cdmData) {
@ -4720,7 +4847,7 @@ class ClientController extends AdminController
// $EmpDataServiceController->importDeletionValidation(['file_id' => 304]); //for live // $EmpDataServiceController->importDeletionValidation(['file_id' => 304]); //for live
// $EmpDataServiceController->importSIEnhancementUpdateEndorsementID(['file_id' => 1199]); //for live // $EmpDataServiceController->importSIEnhancementUpdateEndorsementID(['file_id' => 1199]); //for live
// $EmpDataServiceController->importSIEnhancementValidation(['file_id' => 1205]); //for live // $EmpDataServiceController->importSIEnhancementValidation(['file_id' => 1205]); //for live
$EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 214]); //for live // $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 214]); //for live
// $result = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($batch_data); // $result = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($batch_data);
// print_rr($result); die; // print_rr($result); die;

View File

@ -315,8 +315,10 @@ class EmployeeController extends AdminController
// ->join('clients c', 'files.client_id = c.id and files.client_id = cp.client_id', 'left') // ->join('clients c', 'files.client_id = c.id and files.client_id = cp.client_id', 'left')
// ->where('files.created_by', get_session_userid())->orderBy('files.created_at', 'desc')->findAll(); // ->where('files.created_by', get_session_userid())->orderBy('files.created_at', 'desc')->findAll();
// dd($this->fileModel->getLastQuery()); // dd($this->fileModel->getLastQuery());
$role_id = get_role_id();
$user_id = get_session_userid();
$data['fileList'] = $this->fileModel $query = $this->fileModel
->select([ ->select([
'files.id','files.file_name','files.created_by','files.created_at','files.is_active','files.status','files.client_id','files.policy_id','files.client_branch_id','files.action','files.uploaded_by', 'files.id','files.file_name','files.created_by','files.created_at','files.is_active','files.status','files.client_id','files.policy_id','files.client_branch_id','files.action','files.uploaded_by',
'up.emp_code', 'up.emp_code',
@ -334,13 +336,19 @@ class EmployeeController extends AdminController
->join('client_branch cb', 'files.client_branch_id = cb.id', 'left') ->join('client_branch cb', 'files.client_branch_id = cb.id', 'left')
->join('policy_type', 'policy_type.id = cp.policy_type_id') ->join('policy_type', 'policy_type.id = cp.policy_type_id')
->join('clients c', 'files.client_id = c.id and files.client_id = cp.client_id', 'left') ->join('clients c', 'files.client_id = c.id and files.client_id = cp.client_id', 'left')
->join("client_rm cr","cr.client_id = c.id and cr.is_active = 1",'left');
if (in_array($role_id, [2, 3])) {
// If the user is a Account Manager or Manager, filter by user_id
$query->where('cr.user_id', $user_id);
}
// ->where('files.created_by', get_session_userid()) // ->where('files.created_by', get_session_userid())
->orderBy('files.created_at', 'desc') $data['fileList'] = $query->orderBy('files.created_at', 'desc')
->limit(100) ->limit(100)
->find(); ->find();
// dd($data['fileList']); // dd($data['fileList']);
$data['batch_list'] = $this->batchFileModel->select(" $query2 = $this->batchFileModel->select("
batch_files.id, batch_files.id,
batch_files.client_id, batch_files.client_id,
@ -378,9 +386,17 @@ class EmployeeController extends AdminController
->join('client_branch', 'client_branch.id = batch_files.client_branch_id') ->join('client_branch', 'client_branch.id = batch_files.client_branch_id')
->join('policy_type', 'policy_type.id = client_policy.policy_type_id') ->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
->join('clients', 'clients.id = client_policy.client_id') ->join('clients', 'clients.id = client_policy.client_id')
->orderBy('batch_files.id', 'desc') ->join("client_rm cr","cr.client_id = clients.id and cr.is_active = 1",'left');
->limit(1000) if (in_array($role_id, [2, 3])) {
->find();
// If the user is a Account Manager or Manager, filter by user_id
$query2->where('cr.user_id', $user_id);
}
// ->where('files.created_by', get_session_userid())
$data['batch_list'] = $query2->orderBy('batch_files.id', 'desc')
->limit(1000)
->find();
// dd($data['fileList']);die(); // dd($data['fileList']);die();
@ -759,8 +775,18 @@ class EmployeeController extends AdminController
public function enrollmentClientList() public function enrollmentClientList()
{ {
$role_id = get_role_id();
$user_id = get_session_userid();
$data = []; $data = [];
$client_list = $this->clientModel->where('clients.is_active', 1)->findAll(); $client_list = $this->clientModel->join("client_rm","client_rm.client_id = clients.id",'left')->where('clients.is_active', 1);
if (in_array($role_id, [2, 3])) {
// If the user is a Account Manager or Manager, filter by user_id
$client_list->where('client_rm.user_id', $user_id);
}
$client_list = $client_list->groupBy("clients.id")->findAll();
$branch_list = $this->clientBranchModel->where('client_branch.is_active', 1)->findAll(); $branch_list = $this->clientBranchModel->where('client_branch.is_active', 1)->findAll();
$policy_list = $this->clientPolicyModel $policy_list = $this->clientPolicyModel
->select('client_policy.*, policy_type.policy_type') ->select('client_policy.*, policy_type.policy_type')

View File

@ -1100,7 +1100,7 @@ class EmployeeRestController extends AdminController
$keysToRemove = ["removable_keys"]; $keysToRemove = ["removable_keys"];
// Retrieve employee policy data by passing the employee primary key // Retrieve employee policy data by passing the employee primary key
$empPolicy = $this->employeeModel->getEmployeePolicy($id); $empPolicy = $this->employeeModel->getEmployeePolicy($id);
// dd($empPolicy); // dd($empPolicy);
// Retrieve employee and dependents data by passing the employee code // Retrieve employee and dependents data by passing the employee code
$employeeData = $this->employeeModel->where('emp_code',$emp_code) $employeeData = $this->employeeModel->where('emp_code',$emp_code)
->where('client_id',$client_id) ->where('client_id',$client_id)
@ -3323,4 +3323,22 @@ class EmployeeRestController extends AdminController
return $this->response->setJSON(['ticket_data' => $ticket_data])->setStatusCode(200); return $this->response->setJSON(['ticket_data' => $ticket_data])->setStatusCode(200);
} }
public function getWellnessUrl()
{
$url = "https://aam.mohfw.gov.in/home/login";
if (!empty($url)) {
return $this->respond([
'status' => 'success',
'data' => $url
], 200);
} else {
return $this->respond([
'status' => 'failed',
'message' => 'No link found'
], 200);
}
}
} }

View File

@ -724,6 +724,9 @@ class LeadsController extends BaseController
$data['mail_content'] = $this->transformMailContent($lead_data, $mail_content, $data['page_name']); $data['mail_content'] = $this->transformMailContent($lead_data, $mail_content, $data['page_name']);
$data['subject'] = $this->transformMailContent($lead_data, $subject, $data['page_name']); $data['subject'] = $this->transformMailContent($lead_data, $subject, $data['page_name']);
$data['placement_mail_content'] = $this->transformMailContent($lead_data, $mail_content, 'Placement');
$data['placement_subject'] = $this->transformMailContent($lead_data, $subject, 'Placement');
$data['multi_file_data'] = $this->leadFilesModel->where('lead_id', $id)->where('is_active', 1)->findAll() ?? null; $data['multi_file_data'] = $this->leadFilesModel->where('lead_id', $id)->where('is_active', 1)->findAll() ?? null;
$installment_data['installments'] = $this->leadInstallmentPaymentDetails->where('lead_id', $id)->where('is_active', 1)->findAll() ?? null; $installment_data['installments'] = $this->leadInstallmentPaymentDetails->where('lead_id', $id)->where('is_active', 1)->findAll() ?? null;
@ -1126,10 +1129,21 @@ class LeadsController extends BaseController
// print_r($id); die; // print_r($id); die;
if (!empty($id)) { if (!empty($id)) {
$this->leadInstallmentPaymentDetails->whereIn('id', $id)->set(['is_active' => 0])->update(); $this->leadInstallmentPaymentDetails->whereIn('id', $id)->set(['is_active' => 0])->update();
return $this->respond(['status' => true, 'message' => 'Removed successfully'], 200);
} else { } else {
return $this->respond(['status' => false, 'message' => 'Could not be removed.'], 200); return $this->respond(['status' => false, 'message' => 'Could not be removed.'], 200);
} }
if ($this->request->getGet('lead_id')) {
$lead_id = $this->request->getGet('lead_id');
$data = [
'no_of_installment' => 0,
'is_installment'=> 0
];
$this->leadsModel->where('id', $lead_id)->set($data)->update();
}
return $this->respond(['status' => true, 'message' => 'Removed successfully'], 200);
} }
//-----RFQ and QCR EXPORT------------------------------------------------------------------------------------------------ //-----RFQ and QCR EXPORT------------------------------------------------------------------------------------------------
@ -1199,13 +1213,14 @@ class LeadsController extends BaseController
public function constructExcelToSaveTemp($lead_id, $type, $propsal_and_insurer = null) public function constructExcelToSaveTemp($lead_id, $type, $propsal_and_insurer = null)
{ {
$rfq_data = $this->RFQModel->getRFQTableDataWithLeadIDAndType($lead_id, $type); $rfq_data = $this->RFQModel->getRFQTableDataWithLeadIDAndType($lead_id, $type);
$is_placement = false;
// dd($rfq_data, $lead_id, $type, $propsal_and_insurer); // dd($rfq_data, $lead_id, $type, $propsal_and_insurer);
// print_r($propsal_and_insurer); die; // print_r($propsal_and_insurer); die;
if ($rfq_data['lead_type'] == 1) { if ($rfq_data['lead_type'] == 1) {
if ($rfq_data['policy_type_id'] == 2) { if (in_array($rfq_data['policy_type_id'], [2,3,4,5])) {
$lead_data = [ $lead_data = [
'Insured' => $rfq_data['client_name'], 'Insured' => $rfq_data['client_name'],
'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "", 'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "",
@ -1215,9 +1230,9 @@ class LeadsController extends BaseController
'Total Lives' => $rfq_data['incept_no_of_lives'], 'Total Lives' => $rfq_data['incept_no_of_lives'],
'Period of Insurance ' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date']) ? date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])) : "To be decided", 'Period of Insurance ' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date']) ? date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
'Policy Run Days' => $rfq_data['policy_run_days'], // 'Policy Run Days' => $rfq_data['policy_run_days'],
]; ];
} else if ($rfq_data['policy_type_id'] == 1) { } else if (in_array( $rfq_data['policy_type_id'], [1, 6, 7])) {
$lead_data = [ $lead_data = [
'Insured' => $rfq_data['client_name'], 'Insured' => $rfq_data['client_name'],
'No of Employees at Inception' => $rfq_data['incept_emp_count'], 'No of Employees at Inception' => $rfq_data['incept_emp_count'],
@ -1228,7 +1243,7 @@ class LeadsController extends BaseController
} }
} else { } else {
if ($rfq_data['policy_type_id'] == 2) { if (in_array($rfq_data['policy_type_id'], [2,3,4,5])) {
$lead_data = [ $lead_data = [
'Insured' => $rfq_data['client_name'], 'Insured' => $rfq_data['client_name'],
@ -1256,7 +1271,7 @@ class LeadsController extends BaseController
'Incurred Claims Ratio' => $rfq_data['incurred_claims_ratio'], 'Incurred Claims Ratio' => $rfq_data['incurred_claims_ratio'],
'Earned Claims Ratio' => $rfq_data['earned_claims_ratio'], 'Earned Claims Ratio' => $rfq_data['earned_claims_ratio'],
]; ];
} else if ($rfq_data['policy_type_id'] == 1) { } else if (in_array( $rfq_data['policy_type_id'], [1, 6, 7])) {
$lead_data = [ $lead_data = [
'Insured' => $rfq_data['client_name'], 'Insured' => $rfq_data['client_name'],
'No of Employees at Renewal' => $rfq_data['renewal_emp_count'], 'No of Employees at Renewal' => $rfq_data['renewal_emp_count'],
@ -1279,6 +1294,7 @@ class LeadsController extends BaseController
if ($propsal_and_insurer !== null) { if ($propsal_and_insurer !== null) {
list($proposal_key, $insurer_key) = explode('-', $propsal_and_insurer, 2); list($proposal_key, $insurer_key) = explode('-', $propsal_and_insurer, 2);
$data = $this->transformProposelData($data, $proposal_key, $insurer_key); $data = $this->transformProposelData($data, $proposal_key, $insurer_key);
$is_placement = true;
} }
} else if ($type == 1) { } else if ($type == 1) {
$sheetName = 'RFQ'; $sheetName = 'RFQ';
@ -1382,7 +1398,11 @@ class LeadsController extends BaseController
], ],
]); ]);
$subheader_count = array_sum(array_map(fn($header) => count($header['subHeaders']), $data['table_data']['headers'])); $subheader_count = array_sum(array_map(fn($header) => count($header['subHeaders']), $data['table_data']['headers']));
$subheader_count = $subheader_count - 2;
if($is_placement == false){
$subheader_count = $subheader_count - 2;
}
$headerCount = count($data['table_data']['headers']); $headerCount = count($data['table_data']['headers']);
$lastColumn = Coordinate::stringFromColumnIndex($subheader_count); $lastColumn = Coordinate::stringFromColumnIndex($subheader_count);
// dd( $headerCount, $lastColumn); // dd( $headerCount, $lastColumn);
@ -1428,7 +1448,11 @@ class LeadsController extends BaseController
$subHeaderCount = count($header['subHeaders']); // Number of subheaders for this parent header $subHeaderCount = count($header['subHeaders']); // Number of subheaders for this parent header
// Set parent header value // Set parent header value
$sheet->setCellValue("{$startColumn}{$rowNumber}", $header['parentHeader']); if($is_placement == true && !in_array($header['parentHeader'] , ['Particulars', 'S.No.'])){
$sheet->setCellValue("{$startColumn}{$rowNumber}", "Terms");
}else{
$sheet->setCellValue("{$startColumn}{$rowNumber}", $header['parentHeader']);
}
$sheet->getStyle("{$startColumn}{$rowNumber}")->applyFromArray([ $sheet->getStyle("{$startColumn}{$rowNumber}")->applyFromArray([
'font' => ['bold' => true], 'font' => ['bold' => true],
'alignment' => [ 'alignment' => [
@ -1448,7 +1472,7 @@ class LeadsController extends BaseController
// Add subheaders // Add subheaders
foreach ($header['subHeaders'] as $subHeader) { foreach ($header['subHeaders'] as $subHeader) {
if($type == 2){ if($type == 2 && $is_placement == false){
$sheet->setCellValue("{$columnLetter}{$subHeaderRow}", $subHeader); $sheet->setCellValue("{$columnLetter}{$subHeaderRow}", $subHeader);
} }
@ -1458,13 +1482,16 @@ class LeadsController extends BaseController
$sheet->getColumnDimension('A')->setWidth(10); $sheet->getColumnDimension('A')->setWidth(10);
} }
$sheet->getStyle("{$columnLetter}{$subHeaderRow}")->applyFromArray([ if($is_placement == false){
'font' => ['bold' => true], $sheet->getStyle("{$columnLetter}{$subHeaderRow}")->applyFromArray([
'alignment' => [ 'font' => ['bold' => true],
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER, 'alignment' => [
'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER, 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
], 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
]); ],
]);
}
$columnLetter++; // Move to the next column for subheaders $columnLetter++; // Move to the next column for subheaders
} }
} }
@ -1485,7 +1512,12 @@ class LeadsController extends BaseController
$sheet->getRowDimension($rowNumber)->setRowHeight(25); // Header row height $sheet->getRowDimension($rowNumber)->setRowHeight(25); // Header row height
$sheet->getRowDimension($subHeaderRow)->setRowHeight(20); // Subheader row height $sheet->getRowDimension($subHeaderRow)->setRowHeight(20); // Subheader row height
$rowNumber = $subHeaderRow + 2; if($is_placement == true){
$rowNumber = $subHeaderRow;
}else{
$rowNumber = $subHeaderRow + 2;
}
// dd($rowNumber);
$column_data = $data['table_data']['data']; $column_data = $data['table_data']['data'];
$serial_no = 1; $serial_no = 1;
$maxColumnWidths = []; $maxColumnWidths = [];
@ -1521,7 +1553,7 @@ class LeadsController extends BaseController
], ],
]); ]);
//premium data
if ($type == 2) { if ($type == 2) {
$rowNumber += 2; $rowNumber += 2;
@ -1558,9 +1590,14 @@ class LeadsController extends BaseController
$rowNumber++; $rowNumber++;
} }
$prevColumn3 = $this->getPreviousColumn($columnLetter, 2); if($is_placement == true){
$prevColumn3 = $this->getPreviousColumn($columnLetter);
}else{
$prevColumn3 = $this->getPreviousColumn($columnLetter, 2);
}
$premiumRange = "B" . ($rowNumber - 4) . ":" . "{$prevColumn3}" . ($rowNumber - 1); $premiumRange = "B" . ($rowNumber - 4) . ":" . "{$prevColumn3}" . ($rowNumber - 1);
// dd($premiumRange); // dd($premiumRange);
$sheet->getStyle($premiumRange)->applyFromArray([ $sheet->getStyle($premiumRange)->applyFromArray([
'borders' => [ 'borders' => [
'allBorders' => [ 'allBorders' => [
@ -1575,7 +1612,11 @@ class LeadsController extends BaseController
//set imgage and align the row and column //set imgage and align the row and column
// Kint::dump($columnLetter); // Kint::dump($columnLetter);
if($type == 2){ if($type == 2){
$columnLetter_img = $this->getPreviousColumn($columnLetter, 2); if($is_placement == true){
$columnLetter_img = $this->getPreviousColumn($columnLetter);
}else{
$columnLetter_img = $this->getPreviousColumn($columnLetter, 2);
}
}else{ }else{
$columnLetter_img = $this->getPreviousColumn($columnLetter); $columnLetter_img = $this->getPreviousColumn($columnLetter);
} }
@ -1667,7 +1708,7 @@ class LeadsController extends BaseController
// Set filename // Set filename
$string = ($type == 2) ? 'QCR' : 'RFQ'; $string = ($type == 2) ? ( $is_placement == true ? 'Placement' : 'QCR') : 'RFQ';
$current_year = date('Y'); $current_year = date('Y');
$next_year = $current_year + 1; $next_year = $current_year + 1;
$policy_year = "$current_year-$next_year"; $policy_year = "$current_year-$next_year";
@ -2163,6 +2204,13 @@ class LeadsController extends BaseController
$mail_subject = $params['subject']; $mail_subject = $params['subject'];
$attachment_file_ids = $params['selected_attachment_files']; $attachment_file_ids = $params['selected_attachment_files'];
$from_mail = getenv('email.fromEmail');
if(in_array($recipient_type ,['placement', 'insurer', 'internal'])){
$from_mail = "im@nhanceindia.in";
}else if(in_array($recipient_type, ['client'])){
$from_mail = "bs@nhanceindia.in";
}
$result_data = []; $result_data = [];
// dd($recipient_mail); // dd($recipient_mail);
if ($recipient_type == 'insurer' && (!is_array($recipient_mail) || count($recipient_mail) == 0)) { if ($recipient_type == 'insurer' && (!is_array($recipient_mail) || count($recipient_mail) == 0)) {
@ -2348,14 +2396,17 @@ class LeadsController extends BaseController
$string = implode(", ", $cc_mails); $string = implode(", ", $cc_mails);
$bcc_string = implode(", ", $bcc_mails); $bcc_string = implode(", ", $bcc_mails);
$res = MailHelper::send_email(['mail' => $recipient['email'], 'cc' => $string, 'subject' => $subject, 'message' => $message, 'attachments' => $attachments, 'reply_to' => $reply_to, 'bcc' => $bcc_string]); $res = MailHelper::send_email(['from_mail' => $from_mail, 'mail' => $recipient['email'], 'cc' => $string, 'subject' => $subject, 'message' => $message, 'attachments' => $attachments, 'reply_to' => $reply_to, 'bcc' => $bcc_string]);
// !dd($res); // !dd($res);
$result_data[] = ['mail' => $recipient['email'], 'status' => $res]; $result_data[] = ['mail' => $recipient['email'], 'status' => $res];
} }
} }
$is_placement = false;
if ($recipient_type == 'placement') { if ($recipient_type == 'placement') {
$is_placement = true;
list($proposal_key, $insurer_key) = explode('-', $propsal_and_insurer, 2); list($proposal_key, $insurer_key) = explode('-', $propsal_and_insurer, 2);
$lead_update_data = [ $lead_update_data = [
@ -2367,8 +2418,8 @@ class LeadsController extends BaseController
$data = [ $data = [
'proposel_data' => json_encode($lead_update_data), 'proposel_data' => json_encode($lead_update_data),
'status' => 'won', 'status' => 'won',
'placement_date' => date('Y-m-d', strtotime($params['placement_date']) ?? "") ?? null, 'placement_date' => !empty($params['placement_date']) ? change_date_format($params['placement_date']) : null,
'payment_date' => date('Y-m-d', strtotime($params['payment_date'] ?? "")) ?? null, 'payment_date' => !empty($params['payment_date']) ? change_date_format($params['payment_date']) : null,
'utr_no' => $params['utr_no'] ?? null, 'utr_no' => $params['utr_no'] ?? null,
'is_cd' => $params['is_cd'] ?? null , 'is_cd' => $params['is_cd'] ?? null ,
'premium_amount' => $params['premium_amount'] ?? null, 'premium_amount' => $params['premium_amount'] ?? null,
@ -2385,6 +2436,7 @@ class LeadsController extends BaseController
$installment_data = json_decode($params['installments'], true); $installment_data = json_decode($params['installments'], true);
if(!empty($installment_data)){ if(!empty($installment_data)){
foreach ($installment_data as $key => $value) { foreach ($installment_data as $key => $value) {
// print_r($value);die
$value['payment_date'] = !empty($value['payment_date']) && strtotime($value['payment_date']) $value['payment_date'] = !empty($value['payment_date']) && strtotime($value['payment_date'])
? date('Y/m/d', strtotime($value['payment_date'])) ? date('Y/m/d', strtotime($value['payment_date']))
: null; : null;
@ -2419,7 +2471,7 @@ class LeadsController extends BaseController
//delete attachment file //delete attachment file
unlink($file_path); unlink($file_path);
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result_data], 200); return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result_data, 'is_placement' => $is_placement], 200);
} }
public function getLevelContects() public function getLevelContects()
@ -2483,7 +2535,7 @@ class LeadsController extends BaseController
$headerData[] = [ $headerData[] = [
'parentHeader' => $header['parentHeader'], 'parentHeader' => $header['parentHeader'],
'subHeaders' => [ 'subHeaders' => [
'Quote Asked', // Default value // 'Quote Asked', // Default value
$subHeader // Matched insurer key $subHeader // Matched insurer key
] ]
]; ];
@ -2519,15 +2571,16 @@ class LeadsController extends BaseController
]; ];
} }
// Include Proposal with Quote Asked by default // Include Proposal with Quote Asked by default
if ($item['parentth'] === $proposel && $item['subth'] === "Quote Asked") { /* For proposel do not remove it */
$result['data'][] = [ // if ($item['parentth'] === $proposel && $item['subth'] === "Quote Asked") {
"parentth" => $item['parentth'], // $result['data'][] = [
"subth" => $item['subth'], // "parentth" => $item['parentth'],
"value" => $item['value'], // "subth" => $item['subth'],
"input_value" => $item['input_value'] // "value" => $item['value'],
]; // "input_value" => $item['input_value']
} // ];
// }
// Example of including matching specific proposals and insurers // Example of including matching specific proposals and insurers
if ($item['parentth'] === $proposel && $item['subth'] === $insurer) { if ($item['parentth'] === $proposel && $item['subth'] === $insurer) {
@ -2548,7 +2601,7 @@ class LeadsController extends BaseController
foreach ($data['premium_data']['data'] as $key => $value) { foreach ($data['premium_data']['data'] as $key => $value) {
if ($key === $proposel) { if ($key === $proposel) {
$premiumData[$key]['Quote Asked'] = $value['Quote Asked']; // $premiumData[$key]['Quote Asked'] = $value['Quote Asked'];
$premiumData[$key][$insurer] = $value[$insurer]; $premiumData[$key][$insurer] = $value[$insurer];
} }
} }
@ -2874,6 +2927,7 @@ class LeadsController extends BaseController
$JSON = json_decode($QCRData['json'], true); $JSON = json_decode($QCRData['json'], true);
$converted_json = $this->transformProposelData($JSON, $proposel_data['proposel_name'], $proposel_data['insurer_name']); $converted_json = $this->transformProposelData($JSON, $proposel_data['proposel_name'], $proposel_data['insurer_name']);
// log_message('error', 'Converted JSON: ' . json_encode($converted_json));
return $this->convertQCRJsonToPolicyTerms($converted_json, $data['policy_type_id'], $proposel_data['proposel_name'], $proposel_data['insurer_name']); return $this->convertQCRJsonToPolicyTerms($converted_json, $data['policy_type_id'], $proposel_data['proposel_name'], $proposel_data['insurer_name']);
} catch (\Throwable $e) { } catch (\Throwable $e) {
$this->myLogger->logme('error','preparePolicyTermsFromRFQ'); $this->myLogger->logme('error','preparePolicyTermsFromRFQ');
@ -2925,7 +2979,7 @@ class LeadsController extends BaseController
foreach ($dataRow['data'] as $cellData) { foreach ($dataRow['data'] as $cellData) {
$parentth = $cellData['parentth'] ?? ''; $parentth = $cellData['parentth'] ?? '';
$subth = $cellData['subth'] ?? ''; $subth = $cellData['subth'] ?? '';
$input_value = $cellData['input_value'] ?? ''; $input_value = $cellData['input_value'] != "" ? $cellData['input_value'] : ($cellData['value'] ?? '');
$value = $cellData['value'] ?? ''; $value = $cellData['value'] ?? '';
// Skip unwanted keys // Skip unwanted keys
@ -2937,7 +2991,9 @@ class LeadsController extends BaseController
// CASE 1: Handle special conditions // CASE 1: Handle special conditions
case str_starts_with($item, 'special_condition') && $parentth === $proposel_name && $subth === $insurer_name: case str_starts_with($item, 'special_condition') && $parentth === $proposel_name && $subth === $insurer_name:
// log_message("error","INPUT".json_encode($input_value));
$parts = explode('-', $input_value); $parts = explode('-', $input_value);
$labelKey = $policy_type == 1 ? 'gpa_special_condition_label' : 'special_condition_label'; $labelKey = $policy_type == 1 ? 'gpa_special_condition_label' : 'special_condition_label';
$inputKey = $policy_type == 1 ? 'gpa_special_condition_input' : 'special_condition_input'; $inputKey = $policy_type == 1 ? 'gpa_special_condition_input' : 'special_condition_input';
@ -3015,7 +3071,15 @@ class LeadsController extends BaseController
// Set the value directly, overwriting with latest encountered // Set the value directly, overwriting with latest encountered
if (!empty($item) && !empty($value)) { if (!empty($item) && !empty($value)) {
$terms_array[$item] = $value;
$finalItem = $item;
if (strpos($tableGroup['tableId'], 'summary') !== false) {
$policy_type = explode('_', $tableGroup['tableId'])[0] ?? '';
$finalItem = $policy_type . ' - ' . $item;
}
$terms_array[$finalItem] = $value;
} }
} }
} }
@ -4102,32 +4166,63 @@ class LeadsController extends BaseController
public function handleMultiFileAttachments($json_string, $lead_id) public function handleMultiFileAttachments($json_string, $lead_id)
{ {
log_message('error', 'handleMultiFileAttachments called with lead_id: ' . $lead_id);
$attachments = []; $attachments = [];
if (!empty($json_string)) { if (!empty($json_string)) {
log_message('error', 'json_string is not empty');
$fileIds = json_decode($json_string, true); $fileIds = json_decode($json_string, true);
log_message('error', 'Decoded fileIds: ' . print_r($fileIds, true));
$lead_file_path = WRITEPATH . 'uploads/lead_files/'; $lead_file_path = WRITEPATH . 'uploads/lead_files/';
log_message('error', 'Lead file path: ' . $lead_file_path);
foreach ($fileIds as $id) { foreach ($fileIds as $id) {
$lead_file = $this->leadFilesModel->where('lead_id', $lead_id)->where('id', $id)->where('is_active', 1)->first(); log_message('error', 'Processing file ID: ' . $id);
$lead_file = $this->leadFilesModel
->where('lead_id', $lead_id)
->where('id', $id)
->where('is_active', 1)
->first();
if ($lead_file) { if ($lead_file) {
log_message('error', 'Found lead file: ' . print_r($lead_file, true));
$fullPath = $lead_file_path . $lead_file['file_name']; $fullPath = $lead_file_path . $lead_file['file_name'];
log_message('error', 'Full file path: ' . $fullPath);
if (file_exists($fullPath) && !empty($fileName)) { if (file_exists($fullPath)) {
$attachments[] = [ log_message('error', 'File exists at path: ' . $fullPath);
'fileName' => $lead_file['file_name'],
'filePath' => $fullPath if (!empty($lead_file['file_name'])) {
]; log_message('error', 'File name is not empty: ' . $lead_file['file_name']);
$attachments[] = [
'fileName' => $lead_file['file_name'],
'filePath' => $fullPath
];
} else {
log_message('warning', 'File name is empty for ID: ' . $id);
}
} else {
log_message('warning', 'File does not exist at path: ' . $fullPath);
} }
} else {
log_message('warning', 'No active lead file found for ID: ' . $id . ' and lead_id: ' . $lead_id);
} }
} }
} else {
log_message('error', 'json_string is empty');
} }
log_message('error', 'Attachments prepared: ' . print_r($attachments, true));
return $attachments; return $attachments;
} }
public function handleMemberDataGPATotalSumInsurerFromExcel($params) public function handleMemberDataGPATotalSumInsurerFromExcel($params)
{ {
$lead_id = $params['lead_id']; $lead_id = $params['lead_id'];

View File

@ -461,6 +461,12 @@ class PolicyTransactionController extends BaseController
$insurer_id = null; $insurer_id = null;
} }
if($data['bro_payable_by'] == 1){
$cop_amt = isset($data['co_premium'][$index]) && ($data['co_premium'][$index] != "0.00" || !empty($data['co_premium'][$index]) ) ? $data['co_premium'][$index] : ($data['base_premium'][$index] ?? 0);
}else{
$cop_amt = $data['co_premium'][$index] ?? 0;
}
// Prepare each co-share detail entry // Prepare each co-share detail entry
$coShareDetails[] = [ $coShareDetails[] = [
'pt_id' => $pt_id, 'pt_id' => $pt_id,
@ -493,10 +499,10 @@ class PolicyTransactionController extends BaseController
'actual_bp_brokerage_amt' => $data['actual_bp_brokerage_amt'][$index] ?? 0, 'actual_bp_brokerage_amt' => $data['actual_bp_brokerage_amt'][$index] ?? 0,
'actual_tp_brokerage_amt' => $data['actual_tp_brokerage_amt'][$index] ?? 0, 'actual_tp_brokerage_amt' => $data['actual_tp_brokerage_amt'][$index] ?? 0,
'actual_tep_brokerage_amt' => $data['actual_tep_brokerage_amt'][$index] ?? 0, 'actual_tep_brokerage_amt' => $data['actual_tep_brokerage_amt'][$index] ?? 0,
'exp_amt' => $data['exp_amt'][$index] ?? 0, 'exp_amt' => isset($data['exp_amt'][$index]) && !empty($data['exp_amt'][$index]) ? $data['exp_amt'][$index] : expected_amount_calc($data, $index),
'amount' => $data['total'][$index] ?? 0, 'amount' => $data['total'][$index] ?? 0,
'stamp_duty' => $data['stamp_duty'][$index] ?? 0, 'stamp_duty' => $data['stamp_duty'][$index] ?? 0,
'cop_amt' => $data['co_premium'][$index] ?? 0, 'cop_amt' => $cop_amt,
'variance' => $data['variance'][$index] ?? 0, 'variance' => $data['variance'][$index] ?? 0,
'reward' => $data['reward'][$index] ?? null, 'reward' => $data['reward'][$index] ?? null,
'created_by' => get_session_userid() ?? null, 'created_by' => get_session_userid() ?? null,
@ -1657,7 +1663,7 @@ class PolicyTransactionController extends BaseController
return $this->respond(['status' => true, 'code' => 200, 'data' => $totalCount, 'is_copay_yes' => $is_copay_yes, "cd_master_data" => $cd_ac_no], 200); return $this->respond(['status' => true, 'code' => 200, 'data' => $totalCount, 'is_copay_yes' => $is_copay_yes, "cd_master_data" => $cd_ac_no], 200);
} else { } else {
$insurer_data = $this->clientPolicyModel->where('id', $client_policy_id)->where('is_active', 1)->first(); $insurer_data = $this->clientPolicyModel->where('id', $client_policy_id)->where('is_active', 1)->first();
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to get data'], 200); return $this->respond(['status' => false, 'code' => 404, 'message' => 'There is no policy inception data.'], 200);
} }
} }
@ -2588,7 +2594,7 @@ class PolicyTransactionController extends BaseController
public function dmsSearch() public function dmsSearch()
{ {
// echo 'scbsc';die(); // echo 'scbsc';die();
if ($this->request->getMethod() == 'post') { if ($this->request->is('post')) {
// $jsonData = (array)$this->request->getJSON(); // $jsonData = (array)$this->request->getJSON();
$customer_id = $this->request->getPost('customer_id'); $customer_id = $this->request->getPost('customer_id');
$policy_id = $this->request->getPost('policy_id'); $policy_id = $this->request->getPost('policy_id');

View File

@ -188,6 +188,7 @@ class TicketController extends BaseController
} else { } else {
$isFromDashboard = $this->request->getPost("is_dashboard"); $isFromDashboard = $this->request->getPost("is_dashboard");
log_message('error', 'Is From Dashboard: ' . $isFromDashboard);
if (isset($isFromDashboard) && !empty($isFromDashboard)){ if (isset($isFromDashboard) && !empty($isFromDashboard)){
$data['page_name'] = "Claims"; $data['page_name'] = "Claims";
@ -223,7 +224,7 @@ class TicketController extends BaseController
public function ticketSearch($action = null) public function ticketSearch($action = null)
{ {
$db = db_connect(); $db = db_connect();
// log_message('error', 'Ticket Search Action: ' . $action);
$subquery = $db->table('ticket_master tm') $subquery = $db->table('ticket_master tm')
->select([ ->select([
'tm.id AS ticket_id', 'tm.id AS ticket_id',
@ -1575,14 +1576,21 @@ class TicketController extends BaseController
$statusMapping = json_decode($incoming_form_values['extra_fields_array_for_validate']); $statusMapping = json_decode($incoming_form_values['extra_fields_array_for_validate']);
foreach ($statusMapping as $status => $requiredFields) { foreach ($statusMapping as $status => $requiredFields) {
// Ensure requiredFields is an array // Ensure requiredFields is an array
if (!is_array($requiredFields)) { if (!is_array($requiredFields)) {
$requiredFields = [$requiredFields]; $requiredFields = [$requiredFields];
} }
// Check if all required fields exist and are not empty in the incoming form values // Check if all required fields exist and are not empty in the incoming form values
$allFieldsMatched = true; $allFieldsMatched = true;
foreach ($requiredFields as $field) { foreach ($requiredFields as $field) {
if(in_array($field, ['approved_description'])){
continue;
}
if (!isset($incoming_form_values[$field]) || empty($incoming_form_values[$field])) { if (!isset($incoming_form_values[$field]) || empty($incoming_form_values[$field])) {
$allFieldsMatched = false; $allFieldsMatched = false;
break; break;

View File

@ -131,10 +131,16 @@ class ExcelMergeHelper {
$newName = $sheetName; $newName = $sheetName;
$counter = 1; $counter = 1;
while (in_array($newName, $mergedSpreadsheet->getSheetNames())) { // while (in_array($newName, $mergedSpreadsheet->getSheetNames())) {
// $newName = $sheetName . "_" . $counter++; // // $newName = $sheetName . "_" . $counter++;
log_message('debug', "Sheet name already exists. Trying new name: {$newName}"); // log_message('debug', "Sheet name already exists. Trying new name: {$newName}");
// echo "Sheet name already exists. Trying new name: {$newName}\n"; // // echo "Sheet name already exists. Trying new name: {$newName}\n";
// }
if (in_array($newName, $mergedSpreadsheet->getSheetNames())) {
$newName = $sheetName . '_' . $counter++;
$worksheet->setTitle($newName);
} }
// Clone the worksheet and set the new name // Clone the worksheet and set the new name

File diff suppressed because it is too large Load Diff

View File

@ -741,5 +741,47 @@ if (!function_exists('check_cd_entry_exist')) {
} }
} }
if (!function_exists('expected_amount_calc')) {
function expected_amount_calc($data, $index)
{
$agreed_amount = (float) ($data['agreed_amount'][$index] ?? 0);
$agreed_bp_per = (float) ($data['agreed_bp'][$index] ?? 0);
$agreed_tp_per = (float) ($data['agreed_tp'][$index] ?? 0);
$agreed_tep_per = (float) ($data['agreed_ter'][$index] ?? 0);
$standard_bp_per = (float) ($data['standard_bp'][$index] ?? 0);
$standard_tp_per = (float) ($data['standard_tp'][$index] ?? 0);
$standard_tep_per = (float) ($data['standard_ter'][$index] ?? 0);
if($data['bro_payable_by'] == 0){
$base_premium = (float) ($data['co_premium'][$index] ?? 0);
$third_part_premium = (float) ($data['co_tp_premium'][$index] ?? 0);
$terrisom_premium = (float) ($data['co_ter_premium'][$index] ?? 0);
}else{
$base_premium = (float) ($data['base_premium'][$index] ?? 0);
$third_part_premium = (float) ($data['tp_premium'][$index] ?? 0);
$terrisom_premium = (float) ($data['ter_premium'][$index] ?? 0);
}
$sum_of_agreed_premium = $agreed_bp_per + $agreed_tp_per + $agreed_tep_per;
$expectedAmount = 0;
if ($agreed_amount > 0) {
$expectedAmount = $agreed_amount;
} elseif ($sum_of_agreed_premium > 0) {
$expectedAmount =
($base_premium * $agreed_bp_per / 100) +
($third_part_premium * $agreed_tp_per / 100) +
($terrisom_premium * $agreed_tep_per / 100);
} else {
$expectedAmount =
($base_premium * $standard_bp_per / 100) +
($third_part_premium * $standard_tp_per / 100) +
($terrisom_premium * $standard_tep_per / 100);
}
return round($expectedAmount, 2); // Optional: round to 2 decimal places
}
}

View File

@ -53,17 +53,19 @@ class ClientModel extends Model
$columns = ['clients.id ', 'client_name','short_name']; $columns = ['clients.id ', 'client_name','short_name'];
$clients = $this->select($columns) $clients = $this->select($columns)
->where('is_active',1) ->where('clients.is_active',1)
->findAll(); ->findAll();
// if($role_id == 2 || $role_id == 3){ if($role_id == 2 || $role_id == 3){
// $clients = $this->select($columns) $clients = $this->select($columns)
// ->join('client_rm', 'client_rm.client_id = clients.id') ->join('client_rm', 'client_rm.client_id = clients.id')
// ->where('client_rm.user_id', $user_id) ->where('client_rm.user_id', $user_id)
// ->where('clients.is_active',1) ->where('clients.is_active',1)
// ->findAll(); ->findAll();
// } }
// $clients->findAll();
@ -107,11 +109,24 @@ class ClientModel extends Model
public function getCreatedByUserName(){ public function getCreatedByUserName(){
return $this->db->table('clients') $role_id = get_role_id();
$user_id = get_session_userid();
$query = $this->db->table('clients')
->select('clients.*') ->select('clients.*')
->where('is_active', 1) ->join('client_rm', 'client_rm.client_id = clients.id','left')
->get() ->where('clients.is_active', 1);
->getResult();
if (in_array($role_id, [2, 3])) {
// If the user is a Account Manager or Manager, filter by user_id
$query->where('client_rm.user_id', $user_id);
}
$data = $query->groupBy("clients.id")->get()->getResult();
// dd($data);
return $data;
} }

View File

@ -180,6 +180,7 @@ class ClientPolicyModel extends Model
->join('cd_master', 'cd_master.insurer_id = insurers.id AND cd_master.client_id = client_policy.client_id') ->join('cd_master', 'cd_master.insurer_id = insurers.id AND cd_master.client_id = client_policy.client_id')
->where('client_policy.client_id', $id) ->where('client_policy.client_id', $id)
->where('cd_master.id = client_policy.cd_ac_pk') ->where('cd_master.id = client_policy.cd_ac_pk')
->where('cd_master.is_active', 1)
->groupBy('client_policy.insurer_id') ->groupBy('client_policy.insurer_id')
->groupBy('client_policy.client_id', $id) // Group by insurer_id ->groupBy('client_policy.client_id', $id) // Group by insurer_id
->get() ->get()

View File

@ -243,7 +243,8 @@ function linkRedirectForBDS(input, team)
console.log(link); console.log(link);
if(link){ if(link){
window.location.href = link;
window.open(link, '_blank');
} }
} }

View File

@ -268,8 +268,8 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team(
} }
function linkRedirectForClaims(ticketTypeId, status,ids) { function linkRedirectForClaims(ticketTypeId, status,ids) {
$('.loader').fadeIn(); // $('.loader').fadeIn();
$('.loader-mask').fadeIn(); // $('.loader-mask').fadeIn();
// $.ajax({ // $.ajax({
// url: "<?= base_url("/dashboard/prepareClaimSearchData") ?>", // url: "<?= base_url("/dashboard/prepareClaimSearchData") ?>",
// type: "POST", // type: "POST",
@ -305,13 +305,14 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(CLAIMS_TEAM_ID,user_team(
redirectWithPost("<?= base_url("ticket/list") ?>", data); redirectWithPost2("<?= base_url("ticket/list") ?>", data);
} }
function redirectWithPost(url, data = {}) { function redirectWithPost2(url, data = {}) {
const form = document.createElement('form'); const form = document.createElement('form');
form.method = 'POST'; form.method = 'POST';
form.action = url; form.action = url;
form.target = '_blank';
for (const key in data) { for (const key in data) {
if (data.hasOwnProperty(key)) { if (data.hasOwnProperty(key)) {

View File

@ -179,10 +179,9 @@ body {
} }
function client_policies() { function client_policies() {
var check_client_id = $('#general_PrimaryKey'); var check_client_id = $('#general_PrimaryKey').val();
if(check_client_id == '' || check_client_id == null || check_client_id == 0){
if(check_client_id[0].value == '' || check_client_id[0].value == null || check_client_id[0].value == 0){
$('#BtnAdd').hide(); $('#BtnAdd').hide();
toastr.warning('Please Add the Client!', 'warning',{timeOut: 2000}); toastr.warning('Please Add the Client!', 'warning',{timeOut: 2000});
}else{ }else{

View File

@ -136,7 +136,7 @@
<input type="text" class="form-control" placeholder="GST (%)" id="gst_no" name="gst" required> <input type="text" class="form-control" placeholder="GST (%)" id="gst_no" name="gst" required>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4 EB">
<label class="switch" style="position: relative;top: 43px;left: 20px;"> <label class="switch" style="position: relative;top: 43px;left: 20px;">
<input id="inception_type" type="checkbox" name="inception_type"> <input id="inception_type" type="checkbox" name="inception_type">
<span class="slider round" style="height: 27px;"></span> <span class="slider round" style="height: 27px;"></span>
@ -161,12 +161,12 @@
<input value="" type="text" class="form-control dateofdata" placeholder="Enter Remainder Dates( eg, 28,29,30 )" name="reminder_date" id="reminder_date" > <input value="" type="text" class="form-control dateofdata" placeholder="Enter Remainder Dates( eg, 28,29,30 )" name="reminder_date" id="reminder_date" >
</div> </div>
<div class="form-group col-md-12"> <div class="form-group col-md-12 EB">
<label for="disclaimer">Disclaimer<span class="text-danger">*</span></label> <label for="disclaimer">Disclaimer<span class="text-danger">*</span></label>
<textarea class="form-control" placeholder="Enter Disclaimer" name="disclaimer" id="disclaimer" ></textarea> <textarea class="form-control" placeholder="Enter Disclaimer" name="disclaimer" id="disclaimer" ></textarea>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4 EB">
<label class="switch" style="position: relative;top: 43px;left: 20px;"> <label class="switch" style="position: relative;top: 43px;left: 20px;">
<input id="policy_visibility" type="checkbox" name="enrolment_visibility" checked> <input id="policy_visibility" type="checkbox" name="enrolment_visibility" checked>
<span class="slider round" style="height: 27px;"></span> <span class="slider round" style="height: 27px;"></span>
@ -175,7 +175,7 @@
<label for="policy_visibility" style="position: relative;bottom: 5px;left: 85px;">Policy Visibilty in Enrollment App</label> <label for="policy_visibility" style="position: relative;bottom: 5px;left: 85px;">Policy Visibilty in Enrollment App</label>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4 EB">
<label class="switch" style="position: relative;top: 43px;left: 20px;"> <label class="switch" style="position: relative;top: 43px;left: 20px;">
<input id="is_lgbtq" type="checkbox" name="is_lgbtq"> <input id="is_lgbtq" type="checkbox" name="is_lgbtq">
<span class="slider round" style="height: 27px;"></span> <span class="slider round" style="height: 27px;"></span>
@ -897,6 +897,16 @@
} }
if (res.data.policy_type_id > 7) {
$('#first').show();
$('#second').show();
$('#third').show();
$('#base_policy_id').hide();
$('#base_policy').prop('required', false);
$(".EB").hide();
}
if (res.data.is_addon == 2 || res.data.is_addon == 3) { if (res.data.is_addon == 2 || res.data.is_addon == 3) {
@ -1984,6 +1994,17 @@
$('#tpa').prop('required', true); $('#tpa').prop('required', true);
$('#tpa_danger').show() $('#tpa_danger').show()
} }
if (res.data.policy_type_id > 7) {
$('#first').show();
$('#second').show();
$('#third').show();
$('#base_policy_id').hide();
$('#base_policy').prop('required', false);
$(".EB").hide();
}
setTimeout(() => { setTimeout(() => {
$('#client_branch').val(res.data.client_branch_id).select2(); $('#client_branch').val(res.data.client_branch_id).select2();

View File

@ -229,7 +229,7 @@ table.dataTable tbody td {
// }); // });
// }); // });
document.addEventListener("DOMContentLoaded", init); // document.addEventListener("DOMContentLoaded", init);
function init() { function init() {
const table = document.getElementById("tickets-table"); const table = document.getElementById("tickets-table");

View File

@ -306,11 +306,13 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID, user_
} }
function redirectWithPost(url, data = {}, method = "GET") { function redirectWithPost(url, data = {}, method = "GET") {
$('.loader').fadeIn(); // $('.loader').fadeIn();
$('.loader-mask').fadeIn(); // $('.loader-mask').fadeIn();
const form = document.createElement('form'); const form = document.createElement('form');
form.method = method; form.method = method;
form.action = url; form.action = url;
form.target = '_blank';
for (const key in data) { for (const key in data) {
if (data.hasOwnProperty(key)) { if (data.hasOwnProperty(key)) {

View File

@ -385,10 +385,12 @@
}); });
}else if (lead_type == 3) { }else if (lead_type == 3) {
$('#client_id').prepend($('<option>', { if ($('#client_id option[value="add_client"]').length === 0) {
value: 'add_client', $('#client_id').prepend($('<option>', {
text: '+ Add Client' value: 'add_client',
})); text: '+ Add Client'
}));
}
$("#source_policy_id").removeAttr("required"); $("#source_policy_id").removeAttr("required");
$("#source_policy_id").closest("div") .find("label .text-danger").remove(); $("#source_policy_id").closest("div") .find("label .text-danger").remove();
@ -544,7 +546,11 @@
let increment = this.input.id.split('_').pop(); let increment = this.input.id.split('_').pop();
console.log('Extracted increment:', increment); console.log('Extracted increment:', increment);
let lead_type = $('#lead_type').val();
var policyStartDate = $("#source_policy_start_date"); var policyStartDate = $("#source_policy_start_date");
if(lead_type == 3){
policyStartDate = $("#policy_start_date");
}
console.log('Selected Dates:', selectedDates); console.log('Selected Dates:', selectedDates);
console.log('policy start date instance', policyStartDate) console.log('policy start date instance', policyStartDate)
console.log('Policy Start Date:', policyStartDate.val()); console.log('Policy Start Date:', policyStartDate.val());
@ -909,6 +915,10 @@
console.log('Extracted increment:', increment); console.log('Extracted increment:', increment);
var policyStartDate = $("#source_policy_start_date"); var policyStartDate = $("#source_policy_start_date");
if(lead_type == 3){
policyStartDate = $("#policy_start_date");
}
console.log('Selected Dates:', selectedDates); console.log('Selected Dates:', selectedDates);
console.log('policy start date instance', policyStartDate) console.log('policy start date instance', policyStartDate)
console.log('Policy Start Date:', policyStartDate.val()); console.log('Policy Start Date:', policyStartDate.val());
@ -1155,8 +1165,11 @@
console.log('calculatePolicyRunDays function called'); console.log('calculatePolicyRunDays function called');
console.log('increment', increment); console.log('increment', increment);
let lead_type = $('#lead_type').val();
var policyStartDate = $("#source_policy_start_date"); var policyStartDate = $("#source_policy_start_date");
if(lead_type == 3){
policyStartDate = $("#policy_start_date");
}
var policyStartDate = flatpickr.parseDate(policyStartDate.val(), "d/m/Y"); var policyStartDate = flatpickr.parseDate(policyStartDate.val(), "d/m/Y");
var incurredClaimDate = flatpickr.parseDate($("#incurred_claim_date_" + increment).val(), "d/m/Y"); var incurredClaimDate = flatpickr.parseDate($("#incurred_claim_date_" + increment).val(), "d/m/Y");
@ -1207,23 +1220,33 @@
// Prevent division by zero in incurred claim ratio calculation // Prevent division by zero in incurred claim ratio calculation
let premium_as_on_date = Number($('#premium_date_' + increment).val()) || 0; let premium_as_on_date = Number($('#premium_date_' + increment).val()) || 0;
let incurred_claim_ratio = annualised_claims > 0 ? annualised_claims / premium_as_on_date : 0; let incurred_claim_ratio = (annualised_claims > 0 && premium_as_on_date > 0)
let incurred_claim_ratio_roundoff = Math.round(incurred_claim_ratio); ? (annualised_claims / premium_as_on_date)
: 0;
let incurred_claim_ratio_roundoff = isFinite(incurred_claim_ratio)
? Math.round(incurred_claim_ratio)
: 0;
console.log('incurred_claim_ratio', incurred_claim_ratio_roundoff); console.log('incurred_claim_ratio', incurred_claim_ratio_roundoff);
$('#incurred_claims_ratio_' + increment).val(incurred_claim_ratio_roundoff); $('#incurred_claims_ratio_' + increment).val(incurred_claim_ratio_roundoff);
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
let earned_premium = Number($('#earned_premium_' + increment).val()) || 0; let earnedPremium = parseFloat($('#earned_premium_' + increment).val()) || 0;
console.log('earned_premium', earned_premium); console.log('earnedPremium:', earnedPremium);
// Prevent division by zero in earned claims ratio calculation // Prevent division by zero
let earned_claims_ratio = earned_premium > 0 ? annualised_claims / earned_premium : 0; let earnedClaimsRatio = earnedPremium > 0 ? annualised_claims / earnedPremium : 0;
let earned_claims_ration_roundoff = Math.round(earned_claims_ratio);
console.log('earned_claims_ratio', earned_claims_ratio); // Round to nearest integer
let earnedClaimsRatioRounded = Math.round(earnedClaimsRatio);
console.log('earnedClaimsRatio:', earnedClaimsRatio);
// Set the value to the corresponding input
$('#earned_claims_ratio_' + increment).val(earnedClaimsRatioRounded);
$('#earned_claims_ratio_' + increment).val(earned_claims_ration_roundoff);
} }
function earnedPremiumCalc(input) { function earnedPremiumCalc(input) {

View File

@ -150,8 +150,20 @@ if (isset($selected_lead_type)) {
} }
function appendClients(data) { function appendClients(data) {
// console.log("lead_type",lead_type.value);
$('#client_id').empty(); $('#client_id').empty();
if (lead_type.value == 3) {
if ($('#client_id option[value="add_client"]').length === 0) {
$('#client_id').prepend($('<option>', {
value: 'add_client',
text: '+ Add Client'
}));
}
}
$('#client_id').append($('<option>', { $('#client_id').append($('<option>', {
value: '', value: '',
text: 'Select Client' text: 'Select Client'
@ -848,18 +860,25 @@ if (isset($selected_lead_type)) {
} }
function waitForDropdownValue(selector, value, callback, retries = 20) { function waitForDropdownValue(selector, value, callback, retries = 20) {
const trySet = () => { const trySet = () => {
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
const $el = $(selector); const $el = $(selector);
if ($el.find(`option[value="${value}"]`).length > 0) { if ($el.find(`option[value="${value}"]`).length > 0) {
$el.val(value).trigger('change'); $el.val(value).trigger('change');
callback(); callback();
} else if (retries > 0) { } else if (retries > 0) {
setTimeout(() => trySet(selector, value, callback, retries - 1), 300); setTimeout(trySet, 300); // retry without re-passing arguments
retries--;
} else { } else {
console.warn(`Value ${value} not found for ${selector}`); console.warn(`Value ${value} not found for ${selector}`);
callback(); // Proceed anyway to avoid hanging callback(); // Proceed anyway to avoid hanging
} }
}; };
trySet(); trySet();
} }
@ -867,41 +886,42 @@ if (isset($selected_lead_type)) {
let lead_type = data.lead_type || null; let lead_type = data.lead_type || null;
waitForDropdownValue('#client_id', data.client_id || '', () => { waitForDropdownValue('#client_id', data.client_id || '', () => {
if (lead_type == 3) { if (lead_type == 3) {
// Add "+ Add Client" option if not already present
$('#client_id').prepend($('<option>', { if ($('#client_id option[value="add_client"]').length === 0) {
value: 'add_client', $('#client_id').prepend($('<option>', {
text: '+ Add Client' value: 'add_client',
})); text: '+ Add Client'
}));
}
console.log("trying to remove required "); console.log("Trying to remove 'required' attribute and asterisk");
$("#source_policy_id").prop("required",false); $("#source_policy_id").prop("required", false);
$("#source_policy_id").closest("div") .find("label .text-danger").remove(); $("#source_policy_id").closest("div").find("label .text-danger").remove();
} else {
} else if (lead_type != 3) {
$("#source_policy_id").prop("required",true);
$("#source_policy_id").prop("required", true);
// Check if the asterisk doesn't already exist, then add it if(lead_type == 2){
let $label = $("#source_policy_id") $("#source_policy_id").prop("required", true);
.closest("div") }else{
.find("label"); $("#source_policy_id").prop("required", false);
}
// Add asterisk if not present
let $label = $("#source_policy_id").closest("div").find("label");
if ($label.find(".text-danger").length === 0) { if ($label.find(".text-danger").length === 0) {
$label.append(' <span class="text-danger">*</span>'); $label.append(' <span class="text-danger">*</span>');
} }
var addOption = $('#client_id option[value="add_client"]'); // Remove "+ Add Client" option if exists
if (addOption.length > 0) { $('#client_id option[value="add_client"]').remove();
addOption.remove();
}
console.log("rying to remove required and option removed from client")
console.log("Set 'required' for source_policy_id and removed add_client option if present");
} }
waitForDropdownValue('#client_branch_id', data.client_branch_id || '', () => { waitForDropdownValue('#client_branch_id', data.client_branch_id || '', () => {
// Fill other fields once both dropdowns are ready // Fill other form fields
$('#source_policy_id').val(data.source_policy_id || ''); $('#source_policy_id').val(data.source_policy_id || '');
$('#source_policy_end_date').val(data.source_policy_end_date || ''); $('#source_policy_end_date').val(data.source_policy_end_date || '');
$('#source_policy_start_date').val(data.source_policy_start_date || ''); $('#source_policy_start_date').val(data.source_policy_start_date || '');
@ -917,9 +937,10 @@ if (isset($selected_lead_type)) {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
$(".loss_date").each(function () { $(".loss_date").each(function () {
flatpickr(this, { flatpickr(this, {
dateFormat: "d-m-Y", dateFormat: "d-m-Y"
}); });
}); });
}); });

View File

@ -575,10 +575,12 @@
if (value == 3) { if (value == 3) {
// alert("Function Called"); // alert("Function Called");
$('#client_id').prepend($('<option>', { if ($('#client_id option[value="add_client"]').length === 0) {
value: 'add_client', $('#client_id').prepend($('<option>', {
text: '+ Add Client' value: 'add_client',
})); text: '+ Add Client'
}));
}
$("#source_policy_id").prop("required",false); $("#source_policy_id").prop("required",false);
$("#source_policy_id").closest("div") .find("label .text-danger").remove(); $("#source_policy_id").closest("div") .find("label .text-danger").remove();

View File

@ -87,7 +87,24 @@ label {
<input type="hidden" name="client_policy_id" id="other_client_policy_id" /> <input type="hidden" name="client_policy_id" id="other_client_policy_id" />
<input type="hidden" name="policy_id" id="gpa_policy_id" /> <input type="hidden" name="policy_id" id="gpa_policy_id" />
<input type="hidden" id="emp_count" /> <input type="hidden" id="emp_count" />
<div id="sumInsuredDiv" class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="sumInsured">Sum Insured</label>
</div>
<div class="col-md-4">
<input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
</div>
<div class="col-md-2" style="position: relative;left: 88px;">
<button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
</div>
<div class="col-md-6">
</div>
<div class="col-md-6">
<div id='numberToWordOthers' class="text-danger-2" ></div>
</div>
</div>
<div style="margin-top: 10px;margin-bottom:15px;" id="sum_insured_add_more" ></div>
<div id="append_html_for_other_policy_terms"></div> <div id="append_html_for_other_policy_terms"></div>
<hr> <hr>
@ -164,6 +181,9 @@ $("#otherPolicyTerms").submit(function(event) {
// Append the JSON string to the FormData object // Append the JSON string to the FormData object
formData.append('policy_terms', jsonString); formData.append('policy_terms', jsonString);
formData.forEach((value, key) => {
console.log(key + ': ' + value);
});
$.ajax({ $.ajax({
data: formData, data: formData,
@ -187,6 +207,7 @@ $("#otherPolicyTerms").submit(function(event) {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
}, 1000); }, 1000);
location.reload();
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
console.error(xhr.responseText); console.error(xhr.responseText);
@ -207,17 +228,18 @@ $("#otherPolicyTerms").submit(function(event) {
}); });
var policy_type_id = "";
$('body').on('click', '.btnPolicyMaster', function() { $('body').on('click', '.btnPolicyMaster', function() {
$("#append_html_for_other_policy_terms").empty();
var client_policy_id = $(this).data('id'); var client_policy_id = $(this).data('id');
var policy_type_id = $(this).data('typeid'); policy_type_id = $(this).data('typeid');
console.log('policy_type_id', policy_type_id); console.log('policy_type_id', policy_type_id);
console.log('client_policy_id :', client_policy_id); console.log('client_policy_id :', client_policy_id);
$('#other_client_policy_id').val(client_policy_id); $('#other_client_policy_id').val(client_policy_id);
appendPolicyTermsHTML(policy_type_id);
var gpa_policy_type_id = $(this).attr('id'); var gpa_policy_type_id = $(this).attr('id');
// console.log('gpa_policy_type_id', gpa_policy_type_id) // console.log('gpa_policy_type_id', gpa_policy_type_id)
@ -262,16 +284,17 @@ $('body').on('click', '.btnPolicyMaster', function() {
} }
if (res) { if (res.data) {
//special conditions fields //special conditions fields
let gpaJsonObjectForSpecialCondition = JSON.parse(res.data); let otherTermsJsonObjectSpecialCondition = JSON.parse(res.data);
Object.keys(gpaJsonObjectForSpecialCondition).forEach(function(key) { Object.keys(otherTermsJsonObjectSpecialCondition).forEach(function(key) {
if (key.includes("other_special_condition_label") || key.includes( if (key.includes("special_condition_label") || key.includes(
"other_special_condition_input")) { "special_condition_input")) {
if (key.includes("other_special_condition_label")) { if (key.includes("special_condition_label")) {
for (let index = 0; index < for (let index = 0; index <
gpaJsonObjectForSpecialCondition[key].length; index++) { otherTermsJsonObjectSpecialCondition[key].length; index++) {
specialConditionForOthers(); specialConditionForOthers();
} }
} }
@ -280,26 +303,55 @@ $('body').on('click', '.btnPolicyMaster', function() {
if (elements) { if (elements) {
elements.forEach((element, index) => { elements.forEach((element, index) => {
if (gpaJsonObjectForSpecialCondition[key][ if (otherTermsJsonObjectSpecialCondition[key][
index index
] == undefined) { ] == undefined) {
element.value = " "; element.value = " ";
} else { } else {
element.value = element.value =
gpaJsonObjectForSpecialCondition[key][ otherTermsJsonObjectSpecialCondition[key][
index index
]; ];
} }
}); });
} }
}
if (!key.startsWith("special_condition") && !key.startsWith('multiple_sum_insured') && !key.startsWith("sum_insured") && !key.startsWith("enrollment_display_key") ) {
termsHTML = `
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="${key}_display"
id="${key}_display" class="unchecked" checked>
</div>
<div class="col-md-5">
<label for="${key}">${beautifyString(key)}</label>
</div>
<div class="col-md-6">
<input type="text" name="${key}" id="${key}" class="form-control">
</div>
</div>
`
$("#append_html_for_other_policy_terms").append(termsHTML);
} }
if (key.includes("multiple_sum_insured")) { if (key.includes("multiple_sum_insured")) {
gpaJsonObjectForSpecialCondition[key].forEach((value, index) => {
appendOtherSIAddMore(value); const value = otherTermsJsonObjectSpecialCondition[key];
});
if (Array.isArray(value)) {
value.forEach(item => appendOtherSIAddMore(item));
} else if (typeof value === 'object' && value !== null) {
Object.values(value).forEach(item => appendOtherSIAddMore(item));
}
// else if (typeof value === 'string') {
// appendOtherSIAddMore(value); // Use directly, no loop
// }
} }
}); });
@ -347,6 +399,10 @@ $('body').on('click', '.btnPolicyMaster', function() {
}); });
} else {
appendPolicyTermsHTML(policy_type_id);
} }
@ -367,6 +423,11 @@ $('body').on('click', '.btnPolicyMaster', function() {
} }
if(policy_type_id > 7) {
$("#sumInsuredDiv").empty();
}
}); });
</script> </script>
@ -395,11 +456,11 @@ function specialConditionForOthers(count = 0) {
var appendElement = `<div class="form-group col-md-6 form-group-client-policy-masters removeDom"> var appendElement = `<div class="form-group col-md-6 form-group-client-policy-masters removeDom">
<label for="specialconditionlabel" class="special_condition_label[]" style="width: 450px;position: relative;bottom: 6px;"> <label for="specialconditionlabel" class="special_condition_label[]" style="width: 450px;position: relative;bottom: 6px;">
<input class="form-control" name="other_special_condition_label[]" id="other_special_condition_label[]" style="position: relative;right: 15px;"> <input class="form-control" name="special_condition_label[]" id="special_condition_label[]" style="position: relative;right: 0px;">
<span class="specialConditionClose" style="color: red; float: right;position: relative;bottom: 28px;left: 15px;">X</span> <span class="specialConditionClose" style="color: red; float: right;position: relative;bottom: 28px;left: 15px;">X</span>
</label> </label>
<input type="text" name="other_special_condition_input[]" id="other_special_condition_input[]" class="form-control s special_condition_input[]"> <input type="text" name="special_condition_input[]" id="special_condition_input[]" class="form-control s special_condition_input[]">
</div>`; </div>`;
console.log($(this)); console.log($(this));
$('.other_special_condition').each(function() { $('.other_special_condition').each(function() {
@ -467,29 +528,29 @@ function appendPolicyTermsHTML(policy_type) {
if (policy_type == 7) { if (policy_type == 7) {
termsHTML = `
// <div class="row" style="margin-bottom: 10px;">
// <div class="col-md-6">
// <label for="sumInsured">Sum Insured</label>
// </div>
// <div class="col-md-4">
// <input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
// </div>
// <div class="col-md-2" style="position: relative;left: 88px;">
// <button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
// </div>
// <div class="col-md-6">
// </div>
// <div class="col-md-6">
// <div id='numberToWordOthers' class="text-danger-2" ></div>
// </div>
// </div>
// <div id="sum_insured_add_more" ></div>
termsHTML = `
<div class="form-group"> <div class="form-group">
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="sumInsured">Sum Insured</label>
</div>
<div class="col-md-4">
<input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
</div>
<div class="col-md-2" style="position: relative;left: 88px;">
<button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
</div>
<div class="col-md-6">
</div>
<div class="col-md-6">
<div id='numberToWordOthers' class="text-danger-2" ></div>
</div>
</div>
<div id="sum_insured_add_more" ></div>
<div class="row" style="margin-bottom: 10px;"> <div class="row" style="margin-bottom: 10px;">
<div class="col-md-6"> <div class="col-md-6">
<label for="totalSumInsured">Policy Type</label> <label for="totalSumInsured">Policy Type</label>
@ -585,29 +646,30 @@ function appendPolicyTermsHTML(policy_type) {
} else if (policy_type == 6) { } else if (policy_type == 6) {
termsHTML = `
// <div class="row" style="margin-bottom: 10px;">
// <div class="col-md-6">
// <label for="sumInsured">Sum Insured</label>
// </div>
// <div class="col-md-4" >
// <input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
// </div>
// <div class="col-md-2" style="position: relative;left: 88px;">
// <button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
// </div>
// <div class="col-md-6">
// </div>
// <div class="col-md-6">
// <div id='numberToWordOthers' class="text-danger-2" ></div>
// </div>
// </div>
// <div id="sum_insured_add_more" ></div>
termsHTML = `
<div class="form-group EDLI"> <div class="form-group EDLI">
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="sumInsured">Sum Insured</label>
</div>
<div class="col-md-4" >
<input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
</div>
<div class="col-md-2" style="position: relative;left: 88px;">
<button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
</div>
<div class="col-md-6">
</div>
<div class="col-md-6">
<div id='numberToWordOthers' class="text-danger-2" ></div>
</div>
</div>
<div id="sum_insured_add_more" ></div>
<div class="row" style="margin-bottom: 10px;"> <div class="row" style="margin-bottom: 10px;">
<div class="col-md-6"> <div class="col-md-6">
<label for="totalSumInsured">Existing Insurer</label> <label for="totalSumInsured">Existing Insurer</label>
@ -676,10 +738,12 @@ function appendOtherSIAddMore(data = null) {
const addMoreContainer = document.getElementById('sum_insured_add_more'); const addMoreContainer = document.getElementById('sum_insured_add_more');
// addMoreContainer.innerHTML = ''; // Clear previous content if needed
console.log(addMoreContainer) console.log(addMoreContainer)
const html = ` const html = `
<div class="row" style="margin-bottom: 10px;"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<label for="sumInsured">Additional Sum Insured</label> <label for="sumInsured">Additional Sum Insured</label>
</div> </div>
@ -699,4 +763,13 @@ function appendOtherSIAddMore(data = null) {
addMoreContainer.insertAdjacentHTML('beforeend', html); addMoreContainer.insertAdjacentHTML('beforeend', html);
} }
function beautifyString(str) {
return str
.split('_') // Split the string by underscores
.map(word =>
word.charAt(0).toUpperCase() + word.slice(1).toLowerCase() // Capitalize each word
)
.join(' '); // Join with spaces instead of underscores
}
</script> </script>

File diff suppressed because it is too large Load Diff

View File

@ -475,75 +475,75 @@ $('.close').click(function() {
}); });
$('input[name="burnExpenses"]').change(function() { // $('input[name="burnExpenses"]').change(function() {
console.log($(this).val()); // console.log($(this).val());
if ($(this).val() == '1') { // if ($(this).val() == '1') {
var element = $(this).parent().parent().next()[0]; // var element = $(this).parent().parent().next()[0];
$(element).css("display", ""); // $(element).css("display", "");
} else { // } else {
var element = $(this).parent().parent().next()[0]; // var element = $(this).parent().parent().next()[0];
$(element).css("display", "none"); // $(element).css("display", "none");
} // }
}); // });
$('input[name="compassionateVisitExpenses"]').change(function() { // $('input[name="compassionateVisitExpenses"]').change(function() {
console.log($(this).val()); // console.log($(this).val());
if ($(this).val() == '1') { // if ($(this).val() == '1') {
var element = $(this).parent().parent().next()[0]; // var element = $(this).parent().parent().next()[0];
$(element).css("display", ""); // $(element).css("display", "");
} else { // } else {
var element = $(this).parent().parent().next()[0]; // var element = $(this).parent().parent().next()[0];
$(element).css("display", "none"); // $(element).css("display", "none");
} // }
}); // });
$('input[name="carriageOfDeadBody"]').change(function() { // $('input[name="carriageOfDeadBody"]').change(function() {
console.log($(this).val()); // console.log($(this).val());
if ($(this).val() == '1') { // if ($(this).val() == '1') {
var element = $(this).parent().parent().next()[0]; // var element = $(this).parent().parent().next()[0];
$(element).css("display", ""); // $(element).css("display", "");
} else { // } else {
var element = $(this).parent().parent().next()[0]; // var element = $(this).parent().parent().next()[0];
$(element).css("display", "none"); // $(element).css("display", "none");
} // }
}); // });
$('input[name="ambulanceCharges"]').change(function() { // $('input[name="ambulanceCharges"]').change(function() {
console.log($(this).val()); // console.log($(this).val());
if ($(this).val() == '1') { // if ($(this).val() == '1') {
var element = $(this).parent().parent().next()[0]; // var element = $(this).parent().parent().next()[0];
$(element).css("display", ""); // $(element).css("display", "");
} else { // } else {
var element = $(this).parent().parent().next()[0]; // var element = $(this).parent().parent().next()[0];
$(element).css("display", "none"); // $(element).css("display", "none");
} // }
}); // });
$('input[name="brokenBoneExpenses"]').change(function() { // $('input[name="brokenBoneExpenses"]').change(function() {
console.log($(this).val()); // console.log($(this).val());
if ($(this).val() == '1') { // if ($(this).val() == '1') {
var element = $(this).parent().parent().next()[0]; // var element = $(this).parent().parent().next()[0];
$(element).css("display", ""); // $(element).css("display", "");
} else { // } else {
var element = $(this).parent().parent().next()[0]; // var element = $(this).parent().parent().next()[0];
$(element).css("display", "none"); // $(element).css("display", "none");
} // }
}); // });
$("#policyGPATerms").submit(function(event) { $("#policyGPATerms").submit(function(event) {
@ -784,6 +784,7 @@ $('body').on('click', '.btnPolicyMaster', function() {
.next()[0]; .next()[0];
$(element).css("display", ""); $(element).css("display", "");
} }
disableUnwantedTermsforGPA(jsonObject);
Object.keys(jsonObject).forEach(function(key) { Object.keys(jsonObject).forEach(function(key) {
@ -853,6 +854,34 @@ $('body').on('click', '.btnPolicyMaster', function() {
<script> <script>
const gpaFields = [
'accidentalDeathBenefit',
'permanentTotalDisablement',
'permanentPartialDisablement',
'temporaryTotalDisablementBenefit',
'medical_expenses_medical_extension',
'opd_treatment_cover',
'ambulanceCharges',
'repatriation_of_mortal_remains',
'childrenEducationWelfareFund',
'terrorism',
'worldwideCover',
'family_transportation_benefits',
'fractures_dislocation_burns',
'coma',
'carriageOfDeadBody',
'compassionateVisitExpenses',
'travel_expenses_for_medical_treatment',
'daily_cash_allowance',
'artifical_limb_and_prosthesis',
'animalSnakeInsectBite',
'air_ambulance',
'gpa_special_condition_label',
'gpa_special_condition_input',
'multiple_sum_insured'
];
document.getElementById('gpaButtonSpecialCondition').addEventListener('click', function(event) { document.getElementById('gpaButtonSpecialCondition').addEventListener('click', function(event) {
console.log('specialConditionForGPA callback clicked') console.log('specialConditionForGPA callback clicked')
@ -1040,4 +1069,37 @@ function processJsonObject2(jsonObject) {
} }
} }
} }
function disableUnwantedTermsforGPA(jsonObject) {
// alert("Disabling unwanted terms");
gpaFields.forEach(function(key) {
// If key NOT in jsonObject, then hide and disable its associated elements
if (!jsonObject.hasOwnProperty(key)) {
const elements = document.getElementsByName(key);
elements.forEach(element => {
element.style.display = "none";
element.disabled = true;
const label = document.querySelector(`label[for="${element.id}"]`);
if (label) {
label.style.display = "none";
}
const displayElement = document.getElementById(`${element.id}_display`);
if (displayElement) {
displayElement.checked = false;
displayElement.disabled = true;
displayElement.style.display = "none";
}
const rowDiv = element.closest('.row');
if (rowDiv) {
rowDiv.style.display = "none";
}
});
}
});
}
</script> </script>

View File

@ -153,7 +153,7 @@
<label for="client_branch">Client<span class="text-danger">*</span></label> <label for="client_branch">Client<span class="text-danger">*</span></label>
<select class="form-control" id="client_id" name="client_id" required> <select class="form-control" id="client_id" name="client_id" required>
<option value="">Select Client</option> <option value="">Select Client</option>
<option value="add_client"> + Add Client</option> <!-- <option value="add_client"> + Add Client</option> -->
</select> </select>
</div> </div>
@ -652,14 +652,19 @@ $(document).ready(function(){
populateTable(res.data); populateTable(res.data);
$('#btnSubmit').prop('disabled', false).data('disable', false);
}else{ }else{
$('#ct_type').val(1) $('#ct_type').val(1)
addInsurerColumn() // addInsurerColumn()
toastr.warning("There is no policy inception data.", 'WARNING!');
$('#btnSubmit').prop('disabled', true).data('disable', true);
} }
}else{ }else{
$('#ct_type').val(1) $('#ct_type').val(1)
addInsurerColumn() // addInsurerColumn()
toastr.warning(res.message, 'WARNING!');
$('#btnSubmit').prop('disabled', true).data('disable', true);
} }
}, },
error: function (xhr, status, error) { error: function (xhr, status, error) {
@ -774,7 +779,7 @@ $("#endorsement_form_id").submit(function(event) {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
console.log('inception_form_response', res) console.log('ENDORSEMENT FOR SUBMIT RESPONSE : ', res);
if (res.status == true) { if (res.status == true) {
toastr.success(res.message, 'Success'); toastr.success(res.message, 'Success');
@ -2315,9 +2320,13 @@ function getURLParamsForReport()
function onlyNumbers(event) function onlyNumbers(event)
{ {
var charcode; var charcode = event.which || event.keyCode;
charcode = event.which || event.keyCode;
if (charcode >= 48 && charcode <= 57 || charcode == 46) return true; // Allow: 0-9 (48-57), dot (46), minus (45)
if ((charcode >= 48 && charcode <= 57) || charcode === 46 || charcode === 45) {
return true;
}
return false; return false;
} }

View File

@ -633,10 +633,10 @@ document.addEventListener("DOMContentLoaded", function () {
text: 'Select Client' text: 'Select Client'
})); }));
$('#client_id').append($('<option>', { // $('#client_id').append($('<option>', {
value: 'add_client', // value: 'add_client',
text: '+ Add Client' // text: '+ Add Client'
})); // }));
$.each(data, function(index, item) { $.each(data, function(index, item) {

View File

@ -3854,15 +3854,15 @@ $('#policy_no').change(function(){
if(res.status == true){ if(res.status == true){
$('#ct_type').val(1); $('#ct_type').val(1);
$('#client_policy_id').val(res.data.client_policy_id); $('#client_policy_id').val(res.data.id);
$('#policy_start_date').val(res.data.policy_start_date); $('#policy_start_date').val(res.data.policy_start_date);
$('#policy_end_date').val(res.data.policy_end_date); $('#policy_end_date').val(res.data.policy_end_date);
$('#tpa').val(res.data.tpa_branch_id+'-'+res.data.tpa_id).select2(); $('#tpa').val(res.data.tpa_branch_id+'-'+res.data.tpa_id).select2();
}else{ }else{
$('#ct_type').val(2); $('#ct_type').val(2);
$('#client_policy_id').val(); $('#client_policy_id').val('');
$('#policy_start_date').val(); $('#policy_start_date').val('');
$('#policy_end_date').val(); $('#policy_end_date').val('');
$('#tpa').val('').select2(); $('#tpa').val('').select2();
console.log(res.message, 'warning'); console.log(res.message, 'warning');
} }

View File

@ -11,11 +11,11 @@
</div> </div>
<div class="form-check form-check-inline"> <div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="risk_location" value="multi_with_floter" <?= isset($lead_edit_data['risk_location']) && $lead_edit_data['risk_location'] == 'multi_with_floter' ? 'checked' : ''; ?>> <input class="form-check-input" type="radio" name="risk_location" value="multi_with_floter" <?= isset($lead_edit_data['risk_location']) && $lead_edit_data['risk_location'] == 'multi_with_floter' ? 'checked' : ''; ?>>
<label class="form-check-label">Multi with Floter</label> <label class="form-check-label">Multi with Floater</label>
</div> </div>
<div class="form-check form-check-inline"> <div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="risk_location" value="multi_without_floter" <?= isset($lead_edit_data['risk_location']) && $lead_edit_data['risk_location'] == 'multi_without_floter' ? 'checked' : ''; ?>> <input class="form-check-input" type="radio" name="risk_location" value="multi_without_floter" <?= isset($lead_edit_data['risk_location']) && $lead_edit_data['risk_location'] == 'multi_without_floter' ? 'checked' : ''; ?>>
<label class="form-check-label">Multi without Floter</label> <label class="form-check-label">Multi without Floater</label>
</div> </div>
</div> </div>

View File

@ -11,11 +11,11 @@
</div> </div>
<div class="form-check form-check-inline"> <div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="risk_location" value="multi_with_floter" <?= isset($lead_edit_data['risk_location']) && $lead_edit_data['risk_location'] == 'multi_with_floter' ? 'checked' : ''; ?>> <input class="form-check-input" type="radio" name="risk_location" value="multi_with_floter" <?= isset($lead_edit_data['risk_location']) && $lead_edit_data['risk_location'] == 'multi_with_floter' ? 'checked' : ''; ?>>
<label class="form-check-label">Multi with Floter</label> <label class="form-check-label">Multi with Floater</label>
</div> </div>
<div class="form-check form-check-inline"> <div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="risk_location" value="multi_without_floter" <?= isset($lead_edit_data['risk_location']) && $lead_edit_data['risk_location'] == 'multi_without_floter' ? 'checked' : ''; ?>> <input class="form-check-input" type="radio" name="risk_location" value="multi_without_floter" <?= isset($lead_edit_data['risk_location']) && $lead_edit_data['risk_location'] == 'multi_without_floter' ? 'checked' : ''; ?>>
<label class="form-check-label">Multi without Floter</label> <label class="form-check-label">Multi without Floater</label>
</div> </div>
</div> </div>

View File

@ -11,11 +11,11 @@
</div> </div>
<div class="form-check form-check-inline"> <div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="risk_location" value="multi_with_floter" <?= isset($lead_edit_data['risk_location']) && $lead_edit_data['risk_location'] == 'multi_with_floter' ? 'checked' : ''; ?>> <input class="form-check-input" type="radio" name="risk_location" value="multi_with_floter" <?= isset($lead_edit_data['risk_location']) && $lead_edit_data['risk_location'] == 'multi_with_floter' ? 'checked' : ''; ?>>
<label class="form-check-label">Multi with Floter</label> <label class="form-check-label">Multi with Floater</label>
</div> </div>
<div class="form-check form-check-inline"> <div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="risk_location" value="multi_without_floter" <?= isset($lead_edit_data['risk_location']) && $lead_edit_data['risk_location'] == 'multi_without_floter' ? 'checked' : ''; ?>> <input class="form-check-input" type="radio" name="risk_location" value="multi_without_floter" <?= isset($lead_edit_data['risk_location']) && $lead_edit_data['risk_location'] == 'multi_without_floter' ? 'checked' : ''; ?>>
<label class="form-check-label">Multi without Floter</label> <label class="form-check-label">Multi without Floater</label>
</div> </div>
</div> </div>

View File

@ -30,7 +30,7 @@
<div class="form-group col-md-3 renewalFields" style="display: none;"> <div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="policy_run_days">Policy Run Days<span class="text-danger">*</span></label> <label for="policy_run_days">Policy Run Days<span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['policy_run_days']) ? $lead_edit_data['policy_run_days'] : '' ?>" type="text" class="form-control" id="policy_run_days<?= $increment ?>" name="policy_run_days[]" <input value="<?= isset($lead_edit_data['policy_run_days']) ? $lead_edit_data['policy_run_days'] : '' ?>" type="text" class="form-control" id="policy_run_days<?= $increment ?>" name="policy_run_days[]"
placeholder="Enter Policy Run Days" oninput="earnedPremiumCalc(this)" onkeyup="incurredClaimSum(this)"> placeholder="Enter Policy Run Days" oninput="earnedPremiumCalc(this); incurredClaimSum(this)">
</div> </div>
<div class="form-group col-md-3 renewalFields" style="display: none;"> <div class="form-group col-md-3 renewalFields" style="display: none;">
@ -43,7 +43,7 @@
<div class="form-group col-md-3 renewalFields" style="display: none;"> <div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="premium_date">Premium as on Date<span class="text-danger">*</span></label> <label for="premium_date">Premium as on Date<span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['premium_date']) ? $lead_edit_data['premium_date'] : '' ?>" type="text" class="form-control" id="premium_date<?= $increment ?>" name="premium_date[]" <input value="<?= isset($lead_edit_data['premium_date']) ? $lead_edit_data['premium_date'] : '' ?>" type="text" class="form-control" id="premium_date<?= $increment ?>" name="premium_date[]"
placeholder="Enter Premium Date"> placeholder="Enter Premium Date" oninput="incurredClaimSum(this); earnedPremiumCalc(this)">
</div> </div>
<div class="form-group col-md-3 renewalFields" style="display: none;"> <div class="form-group col-md-3 renewalFields" style="display: none;">
@ -55,7 +55,7 @@
<div class="form-group col-md-3 renewalFields" style="display: none;"> <div class="form-group col-md-3 renewalFields" style="display: none;">
<label for="annualised_claims">Annualised Claims<span class="text-danger">*</span></label> <label for="annualised_claims">Annualised Claims<span class="text-danger">*</span></label>
<input value="<?= isset($lead_edit_data['annualised_claims']) ? $lead_edit_data['annualised_claims'] : '' ?>" type="text" class="form-control" id="annualised_claims<?= $increment ?>" name="annualised_claims[]" <input value="<?= isset($lead_edit_data['annualised_claims']) ? $lead_edit_data['annualised_claims'] : '' ?>" type="text" class="form-control" id="annualised_claims<?= $increment ?>" name="annualised_claims[]"
placeholder="Enter Annualised Claims"> placeholder="Enter Annualised Claims" oninput="incurredClaimSum(this)">
</div> </div>
<div class="form-group col-md-3 renewalFields" style="display: none;"> <div class="form-group col-md-3 renewalFields" style="display: none;">

View File

@ -480,6 +480,7 @@
var doa = flatpickr("#doa", { var doa = flatpickr("#doa", {
dateFormat: "d/m/Y", dateFormat: "d/m/Y",
allowInput: false, allowInput: false,
maxDate: "today",
onChange: function(selectedDates) { onChange: function(selectedDates) {
let selectedDOA = selectedDates[0]; // Get selected DOA date let selectedDOA = selectedDates[0]; // Get selected DOA date
dod.set("minDate", selectedDOA); // Set DOD minDate to DOA dod.set("minDate", selectedDOA); // Set DOD minDate to DOA
@ -488,35 +489,43 @@
var dod = flatpickr("#dod", { var dod = flatpickr("#dod", {
dateFormat: "d/m/Y", dateFormat: "d/m/Y",
allowInput: false allowInput: false,
maxDate: "today"
}); });
flatpickr("#raised_date", { flatpickr("#raised_date", {
dateFormat: "d/m/Y", dateFormat: "d/m/Y",
maxDate: "today",
allowInput: false allowInput: false
}); });
flatpickr("#registration_date", { flatpickr("#registration_date", {
dateFormat: "d/m/Y", dateFormat: "d/m/Y",
maxDate: "today",
allowInput: false allowInput: false
}); });
flatpickr("#query_received_date", { flatpickr("#query_received_date", {
dateFormat: "d/m/Y", dateFormat: "d/m/Y",
maxDate: "today",
allowInput: false allowInput: false
}); });
flatpickr("#denial_date", { flatpickr("#denial_date", {
dateFormat: "d/m/Y", dateFormat: "d/m/Y",
maxDate: "today",
allowInput: false allowInput: false
}); });
flatpickr("#approved_date", { flatpickr("#approved_date", {
dateFormat: "d/m/Y", dateFormat: "d/m/Y",
maxDate: "today",
allowInput: false allowInput: false
}); });
flatpickr("#settled_date", { flatpickr("#settled_date", {
dateFormat: "d/m/Y", dateFormat: "d/m/Y",
maxDate: "today",
allowInput: false allowInput: false
}); });
flatpickr("#pay_initiate_date", { flatpickr("#pay_initiate_date", {
dateFormat: "d/m/Y", dateFormat: "d/m/Y",
maxDate: "today",
allowInput: false allowInput: false
}); });
@ -633,6 +642,29 @@
$field.prop('required', true); $field.prop('required', true);
} }
} }
let extrafieldsArray = $('#extra_fields_array_for_validate').val();
try {
extrafieldsArray = JSON.parse(extrafieldsArray);
// Keep only the entry for the current claim_status_id
extrafieldsArray = {
[selectedVal]: extrafieldsArray[selectedVal]
};
console.log('Filtered extrafieldsArray:', extrafieldsArray);
extrafieldsArray = JSON.stringify(extrafieldsArray);
console.log('Filtered extrafieldsArray string:', extrafieldsArray);
$('#extra_fields_array_for_validate').val(extrafieldsArray);
} catch (error) {
console.error("Invalid JSON format in extra_fields_array_for_validate:", error);
return;
}
}); });
function claimStatusFieldChanges(fields) { function claimStatusFieldChanges(fields) {
@ -1080,6 +1112,7 @@
console.log("doa not found, initializing"); console.log("doa not found, initializing");
doa = flatpickr("#doa", { doa = flatpickr("#doa", {
dateFormat: "d/m/Y", dateFormat: "d/m/Y",
maxDate: "today",
allowInput: false, allowInput: false,
onChange: function(selectedDates) { onChange: function(selectedDates) {
let selectedDOA = selectedDates[0]; // Get selected DOA date let selectedDOA = selectedDates[0]; // Get selected DOA date
@ -1089,6 +1122,7 @@
}); });
var dod = flatpickr("#dod", { var dod = flatpickr("#dod", {
dateFormat: "d/m/Y", dateFormat: "d/m/Y",
maxDate: "today",
allowInput: false allowInput: false
}); });
} else { } else {

View File

@ -364,21 +364,25 @@
$("#emp_client_policy").select2(); $("#emp_client_policy").select2();
date_of_join = flatpickr("#date_of_join", { date_of_join = flatpickr("#date_of_join", {
dateFormat: "d/m/Y", dateFormat: "d/m/Y",
maxDate: "today",
allowInput: false allowInput: false
}); });
dob = flatpickr("#dob", { dob = flatpickr("#dob", {
dateFormat: "d/m/Y", dateFormat: "d/m/Y",
maxDate: "today",
allowInput: false allowInput: false
}); });
var date_of_incep = flatpickr("#date_of_incep", { var date_of_incep = flatpickr("#date_of_incep", {
dateFormat: "d/m/Y", dateFormat: "d/m/Y",
maxDate: "today",
allowInput: false allowInput: false
}); });
date_of_accident = flatpickr("#date_of_accident", { date_of_accident = flatpickr("#date_of_accident", {
dateFormat: "d/m/Y", dateFormat: "d/m/Y",
maxDate: "today",
allowInput: false, allowInput: false,
onChange: function(selectedDates) { onChange: function(selectedDates) {
let selectedDOA = selectedDates[0]; // Get selected DOA date let selectedDOA = selectedDates[0]; // Get selected DOA date
@ -389,20 +393,24 @@
date_of_death = flatpickr("#date_of_death", { date_of_death = flatpickr("#date_of_death", {
dateFormat: "d/m/Y", dateFormat: "d/m/Y",
maxDate: "today",
allowInput: false allowInput: false
}); });
date_of_intimat = flatpickr("#date_of_intimat", { date_of_intimat = flatpickr("#date_of_intimat", {
dateFormat: "d/m/Y", dateFormat: "d/m/Y",
maxDate: "today",
allowInput: false allowInput: false
}); });
flatpickr("#approved_date", { flatpickr("#approved_date", {
dateFormat: "d/m/Y", dateFormat: "d/m/Y",
maxDate: "today",
allowInput: false allowInput: false
}); });
flatpickr("#settled_date", { flatpickr("#settled_date", {
dateFormat: "d/m/Y", dateFormat: "d/m/Y",
maxDate: "today",
allowInput: false allowInput: false
}); });

View File

@ -297,11 +297,12 @@ $(document).ready(function() {
function viewTicket(ticket_id){ function viewTicket(ticket_id){
$('.loader').fadeIn(); // $('.loader').fadeIn();
$('.loader-mask').fadeIn(); // $('.loader-mask').fadeIn();
let url = '<?= base_url('ticket/view/'); ?>' + ticket_id;
window.open(url, '_blank');
let url = '<?= base_url('ticket/view/'); ?>' + ticket_id
window.location.href = url
} }

View File

@ -493,7 +493,7 @@
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="placement_date">Placement Date</label> <label for="placement_date">Placement Date</label>
<input type="text" class="form-control" id="placement_date" name="placement_date" placeholder="DD/MM/YYY" value="<?= isset($lead_data['placement_date']) ? date('d/m/Y', strtotime($lead_data['placement_date'])) : "" ?>"> <input type="text" class="form-control" id="placement_date" name="placement_date" placeholder="DD/MM/YYY" value="<?= isset($lead_data['placement_date']) ? date('d-m-Y', strtotime($lead_data['placement_date'])) : "" ?>">
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
@ -521,7 +521,7 @@
<?php } ?> <?php } ?>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="is_installment_switch">Installemnt </label> <label for="is_installment_switch">Installment </label>
<input id="is_installment_switch" type="checkbox" name = "is_installment" value = "1" data-toggle="toggle" data-on="With Installments" data-off="Without Installments" data-onstyle="info" data-offstyle="dark" data-style="border" data-width="218" <?= isset($lead_data['is_installment']) && $lead_data['is_installment'] == 1 ? 'checked' : '' ?>> <input id="is_installment_switch" type="checkbox" name = "is_installment" value = "1" data-toggle="toggle" data-on="With Installments" data-off="Without Installments" data-onstyle="info" data-offstyle="dark" data-style="border" data-width="218" <?= isset($lead_data['is_installment']) && $lead_data['is_installment'] == 1 ? 'checked' : '' ?>>
</div> </div>
@ -530,23 +530,24 @@
<input type="text" class="form-control" id="no_of_installment" name="no_of_installment" <input type="text" class="form-control" id="no_of_installment" name="no_of_installment"
value="<?= isset($lead_data['no_of_installment']) ? $lead_data['no_of_installment'] : 1 ?>"> value="<?= isset($lead_data['no_of_installment']) ? $lead_data['no_of_installment'] : 1 ?>">
</div> </div>
</div>
<div class="row" id="not_installment">
<?php if (isset($lead_data['is_installment']) && $lead_data['is_installment'] == 0 || !isset($lead_data['is_installment'])) { ?> <?php if (isset($lead_data['is_installment']) && $lead_data['is_installment'] == 0 || !isset($lead_data['is_installment'])) { ?>
<div class="form-group col-md-3">
<label for="payment_date">Payment Date</label>
<input type="text" class="form-control payment_date" id="payment_date" name="payment_date" placeholder="DD/MM/YYY" value="<?= isset($lead_data['payment_date']) ? date('d-m-Y', strtotime($lead_data['payment_date'])) : "" ?>">
</div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="payment_date">Payment Date</label> <label for="utr_no">UTR No.</label>
<input type="text" class="form-control" id="payment_date" name="payment_date" placeholder="DD/MM/YYY" value="<?= isset($lead_data['payment_date']) ? date('d/m/Y', strtotime($lead_data['payment_date'])) : "" ?>"> <input type="text" class="form-control" id="utr_no" name="utr_no" placeholder="Enter UTR No." value="<?= isset($lead_data['utr_no']) ? $lead_data['utr_no'] : "" ?>">
</div> </div>
<div class="form-group col-md-3">
<label for="utr_no">UTR No.</label>
<input type="text" class="form-control" id="utr_no" name="utr_no" placeholder="Enter UTR No." value="<?= isset($lead_data['utr_no']) ? $lead_data['utr_no'] : "" ?>">
</div>
<?php } ?> <?php } ?>
</div>
</div> <!-- </div> -->
<hr> <hr>
<div id="installment_form_row"> <div id="installment_form_row">
@ -588,7 +589,7 @@
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<label for="subject">Subject</label> <label for="subject">Subject</label>
<input type="text" class="form-control" id="placement_subject" name="placement_subject" value="<?= isset($subject) ? $subject : " " ?>" placeholder="Enter Subject"> <input type="text" class="form-control" id="placement_subject" name="placement_subject" value="<?= isset($placement_subject) ? $placement_subject : " " ?>" placeholder="Enter Subject">
</div> </div>
</div> </div>
@ -596,7 +597,7 @@
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<label for="mail_content">Mail Content</label> <label for="mail_content">Mail Content</label>
<textarea id="placement_mail_content" class="form-control" name="placement_mail_content" rows="3"><?= isset($mail_content) ? $mail_content : " " ?></textarea> <textarea id="placement_mail_content" class="form-control" name="placement_mail_content" rows="3"><?= isset($placement_mail_content) ? $placement_mail_content : " " ?></textarea>
</div> </div>
</div> </div>
@ -844,12 +845,12 @@
const editor2 = Jodit.make("#internal_mail_content", editorConfig); const editor2 = Jodit.make("#internal_mail_content", editorConfig);
var placement_date_datePicker = flatpickr("#placement_date", { var placement_date_datePicker = flatpickr("#placement_date", {
dateFormat: "d/m/Y", dateFormat: "d-m-Y",
allowInput: false, allowInput: false,
}); });
var payment_date_datePicker = flatpickr("#payment_date", { var payment_date_datePicker = flatpickr("#payment_date", {
dateFormat: "d/m/Y", dateFormat: "d-m-Y",
allowInput: false, allowInput: false,
}); });
@ -860,11 +861,30 @@
<script> <script>
let intervalId;
$(document).ready(function () { $(document).ready(function () {
setInterval(function () { console.log("Document ready");
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();
} else {
console.log("Lead status is 'won', submitData will not be called");
}
});
function startInterval() {
intervalId = setInterval(function () {
console.log("Calling submitData(1) at 20-second interval");
submitData(1); submitData(1);
}, 20000); }, 20000);
}); }
const openDialogBtn = document.getElementById('openDialogBtn'); const openDialogBtn = document.getElementById('openDialogBtn');
@ -3692,6 +3712,11 @@ function constructURL_ForPlacementMailSend() {
function ajaxRequest(formData) { function ajaxRequest(formData) {
// console.log("formData", formData);
// formData.forEach((value, key) => {
// console.log(key + ': ' + value);
// });
var apiURL = '<?= base_url('leads/sendMail') ?>'; var apiURL = '<?= base_url('leads/sendMail') ?>';
console.log(apiURL); console.log(apiURL);
@ -3713,6 +3738,10 @@ function ajaxRequest(formData) {
console.log(res); console.log(res);
if (res.status == 'success' && res.code == 200) { if (res.status == 'success' && res.code == 200) {
toastr.success('Mail send Successfully', 'SUCCESS') toastr.success('Mail send Successfully', 'SUCCESS')
if(res.is_placement == true){
clearInterval(intervalId);
console.log('******** Intervel Cleared ********')
}
} else { } else {
if (res.messgae) { if (res.messgae) {
toastr.error(res.messgae, 'ERROR') toastr.error(res.messgae, 'ERROR')
@ -5886,6 +5915,7 @@ function appendMultiFileData(data) {
let $installmentContainer = $('#installment_form_row'); let $installmentContainer = $('#installment_form_row');
let row_count = $installmentContainer.find('.form-row').length; let row_count = $installmentContainer.find('.form-row').length;
let remove_count = $("#no_of_installment").val(); let remove_count = $("#no_of_installment").val();
let lead_id = $('#lead_id').val();
console.log("row count",row_count); console.log("row count",row_count);
if (row_count > 0 ) { if (row_count > 0 ) {
let ids = $installmentContainer.find('.form-row').slice(-remove_count).find('input[name="installment_primary_key[]"]').map(function() { let ids = $installmentContainer.find('.form-row').slice(-remove_count).find('input[name="installment_primary_key[]"]').map(function() {
@ -5901,7 +5931,21 @@ function appendMultiFileData(data) {
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
let url = '<?= base_url('util/removeInstallments') ?>'; let url = '<?= base_url('util/removeInstallments') ?>';
let requestData = { id: ids }; let requestData = { id: ids,'lead_id': lead_id};
if (requestData.id.length == 0) {
$("#no_of_installment").hide();
$("#payment_date").show();
$("#utr_no").show();
$("#no_of_installment").closest('.form-group').hide();
$("#payment_date").closest('.form-group').show();
$("#utr_no").closest('.form-group').show();
$('#installment_form_row').empty();
$('#no_of_installment').val("");
return;
}
$('.loader').fadeIn(); $('.loader').fadeIn();
$('.loader-mask').fadeIn(); $('.loader-mask').fadeIn();
@ -5911,14 +5955,31 @@ function appendMultiFileData(data) {
if (response.status === true) { if (response.status === true) {
toastr.success(response.message, 'SUCCESS'); toastr.success(response.message, 'SUCCESS');
$("#no_of_installment").hide(); $("#no_of_installment").closest('.form-group').hide();
$('#no_of_installment').val("");
$('#installment_form_row').empty();
// $("#no_of_installment").hide();
$("#payment_date").show(); $("#payment_date").show();
$("#utr_no").show(); $("#utr_no").show();
$("#no_of_installment").closest('.form-group').hide();
$("#payment_date").closest('.form-group').show(); $("#payment_date").closest('.form-group').show();
$("#utr_no").closest('.form-group').show(); $("#utr_no").closest('.form-group').show();
$('#installment_form_row').empty(); $('#not_installment').empty();
$('#no_of_installment').val("");
newhtml = `
<div class="form-group col-md-3">
<label for="payment_date">Payment Date</label>
<input type="text" class="form-control payment_date" id="payment_date" name="payment_date" placeholder="DD/MM/YYY">
</div>
<div class="form-group col-md-3">
<label for="utr_no">UTR No.</label>
<input type="text" class="form-control" id="utr_no" name="utr_no" placeholder="Enter UTR No.">
</div>
`;
$('#not_installment').append(newhtml);
$('.payment_date').flatpickr({
dateFormat: 'd-m-Y',
});
} else { } else {
toastr.error(response.message, 'WARNING'); toastr.error(response.message, 'WARNING');
} }
@ -5942,7 +6003,6 @@ function appendMultiFileData(data) {
// $('#is_installment_switch').prop('checked', true).trigger('change'); // $('#is_installment_switch').prop('checked', true).trigger('change');
$('#is_installment_switch').trigger('click'); // in some cases, this forces the CSS to update $('#is_installment_switch').trigger('click'); // in some cases, this forces the CSS to update
} }
}); });
} }
@ -6017,7 +6077,7 @@ function appendMultiFileData(data) {
$('#installment_form_row').append(html); $('#installment_form_row').append(html);
$('.payment_date').flatpickr({ $('.payment_date').flatpickr({
dateFormat: 'd/m/Y', dateFormat: 'd-m-Y',
}); });
} }
@ -6175,7 +6235,7 @@ function appendMultiFileData(data) {
$(document).ready(function(){ $(document).ready(function(){
setTimeout(function(){ setTimeout(function(){
$('.payment_date').flatpickr({ $('.payment_date').flatpickr({
dateFormat: 'd/m/Y', dateFormat: 'd-m-Y',
}); });
}, 2000) }, 2000)
}) })

View File

@ -295,6 +295,7 @@
<input type="hidden" id="lead_id" value="<?= htmlspecialchars($lead_data['id'] ?? "", ENT_QUOTES, 'UTF-8') ?>" /> <input type="hidden" id="lead_id" value="<?= htmlspecialchars($lead_data['id'] ?? "", ENT_QUOTES, 'UTF-8') ?>" />
<input type="hidden" id="rfq_primaryKey" name="rfq_primaryKey" value="<?= isset($rfq_data['id']) ? $rfq_data['id'] : '' ?>">
<div id="allTableContainer"> <div id="allTableContainer">
<div id="tablesContainer"></div> <div id="tablesContainer"></div>
@ -434,7 +435,7 @@
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="placement_date">Placement Date</label> <label for="placement_date">Placement Date</label>
<input type="text" class="form-control" id="placement_date" name="placement_date" placeholder="DD/MM/YYY" value="<?= isset($lead_data['placement_date']) ? date('d/m/Y', strtotime($lead_data['placement_date'])) : "" ?>"> <input type="text" class="form-control" id="placement_date" name="placement_date" placeholder="DD/MM/YYY" value="<?= isset($lead_data['placement_date']) ? date('d-m-Y', strtotime($lead_data['placement_date'])) : "" ?>">
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
@ -472,11 +473,15 @@
value="<?= isset($lead_data['no_of_installment']) ? $lead_data['no_of_installment'] : 1 ?>"> value="<?= isset($lead_data['no_of_installment']) ? $lead_data['no_of_installment'] : 1 ?>">
</div> </div>
</div>
<div class="row" id="not_installment">
<?php if (isset($lead_data['is_installment']) && $lead_data['is_installment'] == 0 || !isset($lead_data['is_installment'])) { ?> <?php if (isset($lead_data['is_installment']) && $lead_data['is_installment'] == 0 || !isset($lead_data['is_installment'])) { ?>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="payment_date">Payment Date</label> <label for="payment_date">Payment Date</label>
<input type="text" class="form-control" id="payment_date" name="payment_date" placeholder="DD/MM/YYY" value="<?= isset($lead_data['payment_date']) ? date('d/m/Y', strtotime($lead_data['payment_date'])) : "" ?>"> <input type="text" class="form-control" id="payment_date" name="payment_date" placeholder="DD/MM/YYY" value="<?= isset($lead_data['payment_date']) ? date('d-m-Y', strtotime($lead_data['payment_date'])) : "" ?>">
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
@ -523,7 +528,7 @@
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<label for="subject">Subject</label> <label for="subject">Subject</label>
<input type="text" class="form-control" id="placement_subject" name="placement_subject" value="<?= isset($subject) ? $subject : " " ?>" placeholder="Enter Subject"> <input type="text" class="form-control" id="placement_subject" name="placement_subject" value="<?= isset($placement_subject) ? $placement_subject : " " ?>" placeholder="Enter Subject">
</div> </div>
</div> </div>
@ -531,7 +536,7 @@
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<label for="mail_content">Mail Content</label> <label for="mail_content">Mail Content</label>
<textarea id="placement_mail_content" class="form-control" name="placement_mail_content" rows="3"><?= isset($mail_content) ? $mail_content : " " ?></textarea> <textarea id="placement_mail_content" class="form-control" name="placement_mail_content" rows="3"><?= isset($placement_mail_content) ? $placement_mail_content : " " ?></textarea>
</div> </div>
</div> </div>
@ -629,6 +634,31 @@
myModal = new bootstrap.Modal(document.getElementById('policyRegisterModel')); myModal = new bootstrap.Modal(document.getElementById('policyRegisterModel'));
// monitorTableChanges(); // monitorTableChanges();
}); });
let intervalId;
$(document).ready(function () {
console.log("Document ready");
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();
} else {
console.log("Lead status is 'won', submitData will not be called");
}
});
function startInterval() {
intervalId = setInterval(function () {
console.log("Calling submitData(1) at 20-second interval");
saveRFQ(true);
}, 20000);
}
var tableCount = 0; var tableCount = 0;
const policies = <?= json_encode($policies) ?>; const policies = <?= json_encode($policies) ?>;
// // console.log('policies', policies); // // console.log('policies', policies);
@ -1630,7 +1660,7 @@
collapsibleBar.innerHTML = ` collapsibleBar.innerHTML = `
${tableData ? tableData.table_name : "Particulars"} ${tableData ? tableData.table_name : "Particulars"}
<span class="collapse-icon"></span> <span class="collapse-icon"></span>
`; `;
// Create table content wrapper with Bootstrap 4 collapse class // Create table content wrapper with Bootstrap 4 collapse class
const tableContent = document.createElement('div'); const tableContent = document.createElement('div');
@ -1975,12 +2005,16 @@
// Initialize the parent table // Initialize the parent table
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
// // // console.log("bjnglfkrg ", rfq_data.length); // // // console.log("bjnglfkrg ", rfq_data.length);
const url = window.location.pathname; // Get the path (e.g., "/nhance/rfq/list/75/1") // const url = window.location.pathname; // Get the path (e.g., "/nhance/rfq/list/75/1")
const segments = url.split("/"); // Split by "/" // const segments = url.split("/"); // Split by "/"
segments[segments.length - 1] = "1"; // Change the last segment // segments[segments.length - 1] = "1"; // Change the last segment
const newUrl = segments.join("/"); // Rebuild the URL // const newUrl = segments.join("/"); // Rebuild the URL
rfq_or_qcr = 1; const path = window.location.pathname; // Get the current URL path
history.pushState(null, "", newUrl); // Change the URL without reloading const segments = path.split('/'); // Split the path into segments
const lead_id = segments[segments.length - 2]; // Get the second last segment (15)
const type = segments[segments.length - 1];
rfq_or_qcr = type;
// history.pushState(null, "", newUrl); // Change the URL without reloading
if (rfq_data.length) { if (rfq_data.length) {
// // console.log("inside if conditoon"); // // console.log("inside if conditoon");
@ -2473,10 +2507,7 @@
table_type: "new", table_type: "new",
table_id: `${policyName}_summary_` + locationIndex, table_id: `${policyName}_summary_` + locationIndex,
table_editable: true, table_editable: true,
table_name: "Risk Location " + locationIndex + "- " + table_name: "Risk Location " + locationIndex,
storedData.locations[i].policyRisk['occupancy'] + "- " +
storedData.locations[i].policyRisk['address1'] + " " +
storedData.locations[i].policyRisk['address2'],
table_row_contents: rowContents table_row_contents: rowContents
}); });
} }
@ -2548,17 +2579,17 @@
return null; // If canceled, return null return null; // If canceled, return null
} }
function saveRFQ() { function saveRFQ(isAutoSave = false) {
// alert("Function Called"); // alert("Function Called");
isSaved = true; isSaved = true;
// // console.log("save button clicked"); // // console.log("save button clicked");
leadJson = tablesToJson(); leadJson = tablesToJson();
// // console.log("json from function ", leadJson); console.log("json from function ", leadJson);
var policyJson = localStorage.getItem("policyData") ?? null; var policyJson = localStorage.getItem("policyData") ?? null;
saveRFQTODB(leadJson, policyJson); saveRFQTODB(leadJson, policyJson, isAutoSave);
} }
function saveRFQTODB(tableJSON, policyJson) { function saveRFQTODB(tableJSON, policyJson,isAutoSave = false) {
let submit_type = "RFQ" let submit_type = "RFQ"
if(rfq_or_qcr == 2){submit_type = 'QCR'} if(rfq_or_qcr == 2){submit_type = 'QCR'}
@ -2570,9 +2601,20 @@
registration_json: policyJson registration_json: policyJson
} }
let rfq_primaryKey = $('#rfq_primaryKey').val();
if (isAutoSave) {
formData['rfq_primaryKey'] = rfq_primaryKey;
}
var url = '<?= base_url('rfq/create') ?>'; var url = '<?= base_url('rfq/create') ?>';
$('.loader').fadeIn();
$('.loader-mask').fadeIn(); if (!isAutoSave) {
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
}
$.ajax({ $.ajax({
url: url, url: url,
@ -2583,24 +2625,29 @@
console.log('RFQ NON EB FORM SUBMIT RESPONSE : ', response); console.log('RFQ NON EB FORM SUBMIT RESPONSE : ', response);
if (response.status == true) { if (response.status == true) {
localStorage.removeItem('policyData');
toastr.success(response.message, "Success"); toastr.success(response.message, "Success");
// // console.log(rfq_data.length);
$('.actionBtns').show(); if (!isAutoSave) {
if (rfq_or_qcr == 2) {
$("#openQCR").hide(); localStorage.removeItem('policyData');
$('.actionBtns').show();
if (rfq_or_qcr == 2) {
$("#openQCR").hide();
}
} else {
$('#rfq_primaryKey').val(response.id);
} }
// window.location.reload(); // window.location.reload();
} else { } else {
toastr.error(response.message, "Error"); toastr.error(response.message, "Error");
$('.actionBtns').hide(); $('.actionBtns').hide();
} }
$('.loader').fadeOut(); if (!isAutoSave) {
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader').fadeOut();
window.location.reload(); $('.loader-mask').delay(350).fadeOut('slow');
window.location.reload();
}
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
$('.loader').fadeOut(); $('.loader').fadeOut();
@ -3717,14 +3764,30 @@
} }
function removeRowQCR(event) { function removeRowQCR(event) {
const button = event.target; Swal.fire({
const row = button.closest('tr'); title: 'Are you sure?',
const table = row.closest('table'); text: "Do you want to remove the row?",
if (row && row.parentElement.children.length > 1) { icon: 'warning',
// // console.log("Row Removed"); showCancelButton: true,
row.remove(); confirmButtonColor: '#d33',
updateVisisbleSNO(table.id); cancelButtonColor: '#3085d6',
} confirmButtonText: 'Yes, remove it!',
cancelButtonText: 'Cancel'
}).then((result) => {
if (result.isConfirmed) {
const button = event.target;
const row = button.closest('tr');
const table = row.closest('table');
if (row && row.parentElement.children.length > 1) {
// // console.log("Row Removed");
row.remove();
updateVisisbleSNO(table.id);
}
isFormDataModified = true; // if any value changeing in the table to set true
}
})
} }
function updateVisisbleSNO(tableId) { function updateVisisbleSNO(tableId) {
@ -4394,7 +4457,7 @@
const editor2 = Jodit.make("#internal_mail_content", editorConfig); const editor2 = Jodit.make("#internal_mail_content", editorConfig);
var placement_date_datePicker = flatpickr("#placement_date", { var placement_date_datePicker = flatpickr("#placement_date", {
dateFormat: "d/m/Y", dateFormat: "d-m-Y",
allowInput: false, allowInput: false,
}); });
@ -4937,7 +5000,11 @@
// // console.log(res); // // console.log(res);
if (res.status == 'success' && res.code == 200) { if (res.status == 'success' && res.code == 200) {
toastr.success('Mail send Successfully', 'SUCCESS') toastr.success('Mail send Successfully', 'SUCCESS');
if(res.is_placement == true){
clearInterval(intervalId);
console.log('******** Intervel Cleared ********')
}
} else { } else {
if (res.messgae) { if (res.messgae) {
toastr.error(res.messgae, 'ERROR') toastr.error(res.messgae, 'ERROR')
@ -5336,6 +5403,7 @@
let $installmentContainer = $('#installment_form_row'); let $installmentContainer = $('#installment_form_row');
let row_count = $installmentContainer.find('.form-row').length; let row_count = $installmentContainer.find('.form-row').length;
let remove_count = $("#no_of_installment").val(); let remove_count = $("#no_of_installment").val();
let lead_id = $('#lead_id').val();
console.log("row count",row_count); console.log("row count",row_count);
if (row_count > 0 ) { if (row_count > 0 ) {
let ids = $installmentContainer.find('.form-row').slice(-remove_count).find('input[name="installment_primary_key[]"]').map(function() { let ids = $installmentContainer.find('.form-row').slice(-remove_count).find('input[name="installment_primary_key[]"]').map(function() {
@ -5351,7 +5419,21 @@
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
let url = '<?= base_url('util/removeInstallments') ?>'; let url = '<?= base_url('util/removeInstallments') ?>';
let requestData = { id: ids }; let requestData = { id: ids,'lead_id': lead_id};
if (requestData.id.length == 0) {
$("#no_of_installment").hide();
$("#payment_date").show();
$("#utr_no").show();
$("#no_of_installment").closest('.form-group').hide();
$("#payment_date").closest('.form-group').show();
$("#utr_no").closest('.form-group').show();
$('#installment_form_row').empty();
$('#no_of_installment').val("");
return;
}
$('.loader').fadeIn(); $('.loader').fadeIn();
$('.loader-mask').fadeIn(); $('.loader-mask').fadeIn();
@ -5369,6 +5451,21 @@
$("#utr_no").closest('.form-group').show(); $("#utr_no").closest('.form-group').show();
$('#installment_form_row').empty(); $('#installment_form_row').empty();
$('#no_of_installment').val(""); $('#no_of_installment').val("");
newhtml = `
<div class="form-group col-md-3">
<label for="payment_date">Payment Date</label>
<input type="text" class="form-control payment_date" id="payment_date" name="payment_date" placeholder="DD/MM/YYY">
</div>
<div class="form-group col-md-3">
<label for="utr_no">UTR No.</label>
<input type="text" class="form-control" id="utr_no" name="utr_no" placeholder="Enter UTR No.">
</div>
`;
$('#not_installment').append(newhtml);
$('.payment_date').flatpickr({
dateFormat: 'd-m-Y',
});
} else { } else {
toastr.error(response.message, 'WARNING'); toastr.error(response.message, 'WARNING');
} }
@ -5513,14 +5610,15 @@
$('#installment_form_row').append(html); $('#installment_form_row').append(html);
$('.payment_date').flatpickr({ $('.payment_date').flatpickr({
dateFormat: 'd/m/Y',
dateFormat: 'd-m-Y',
}); });
} }
$(document).ready(function(){ $(document).ready(function(){
setTimeout(function(){ setTimeout(function(){
$('.payment_date').flatpickr({ $('.payment_date').flatpickr({
dateFormat: 'd/m/Y', dateFormat: 'd-m-Y',
}); });
}, 2000) }, 2000)
@ -5671,6 +5769,7 @@
}); });
}); });
} }
</script> </script>