Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
velz 2025-06-03 11:01:14 +05:30
commit 8215b0b1a6
40 changed files with 3309 additions and 2617 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("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("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("send_mail_for_individual_employee_ecard/(:any)", "EmployeeController::send_mail_for_individual_employee_ecard/$1");
$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("getFEContent", "EmployeeRestController::getFEContent");
$routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
$routes->get("getWellnessURL", "EmployeeRestController::getWellnessURL");
// $routes->post('postDataForTicket',"EmployeeRestController::postDataForTicket");
});
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");

View File

@ -687,6 +687,7 @@ class ClientController extends AdminController
$CD_Account_Number = $this->CDMasterModel
->where('client_id', $client_id)
->where('insurer_id', $insurer_id)
->where('is_active', 1)
->first();
// Prepare the array with data
$date = \DateTime::createFromFormat('d/m/Y', $record_date);
@ -2092,7 +2093,7 @@ class ClientController extends AdminController
->findAll();
$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']));
$fromDate = new \DateTime($client_policy_data['policy_end_date']);
$fromDate->modify('+1 year');
@ -2405,52 +2406,109 @@ class ClientController extends AdminController
// print_r($data);die;
$data['waiverofpreexistingdiseases'] = $this->request->getPost("waiverofpreexistingdiseases");
$data['waiverof1,2,3&4thyearexclusions'] = $this->request->getPost("waiverof1,2,3&4thyearexclusions");
$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_other_waiting_periods'] = $this->request->getPost("waiver_of_other_waiting_periods");
$data['maternity_benefit'] = $this->request->getPost("maternity_benefit");
$data['9monthwaitingperiodwaived'] = str_replace(',', '', $this->request->getPost("9monthwaitingperiodwaived"));
$data['maternitycoverage'] = str_replace(',', '', $this->request->getPost("maternitycoverage"));
$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['preandpostnatal'] = str_replace(',', '', $this->request->getPost("preandpostnatal"));
$data['infertility_treatment_coverage'] = str_replace(',', '', $this->request->getPost("infertility_treatment_coverage"));
$data['babyday1cover'] = str_replace(',', '', $this->request->getPost("babyday1cover"));
$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['prehospitalizationcover'] = str_replace(',', '', $this->request->getPost("prehospitalizationcover"));
$data['posthospitalizationcover'] =$this->request->getPost("posthospitalizationcover");
$data['congenitaldiseasesinternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesinternal"));
$data['congenitaldiseasesexternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesexternal"));
$data['copayzonewisecopay'] = $this->request->getPost("copayzonewisecopay");
$data['roomrentlimit'] = str_replace(',', '', $this->request->getPost("roomrentlimit"));
$data['icu_limit'] = str_replace(',', '', $this->request->getPost("icu_limit"));
$data['proportionatedeductionclause'] = str_replace(',', '', $this->request->getPost("proportionatedeductionclause"));
$data['ailmentcapping'] = $this->request->getPost("ailmentcapping");
$data['ailment_capping_details'] = str_replace(',', '', $this->request->getPost("ailment_capping_details"));
$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['ambulancecharges'] = str_replace(',', '', $this->request->getPost("ambulancecharges"));
$data['airambulance'] = str_replace(',', '', $this->request->getPost("airambulance"));
$data['reasonableandcustomarycharges'] = str_replace(',', '', $this->request->getPost("reasonableandcustomarycharges"));
$data['daycaretreatment'] = str_replace(',', '', $this->request->getPost("daycaretreatment"));
$data['lasiksurgery'] = str_replace(',', '', $this->request->getPost("lasiksurgery"));
$data['ayudhtreatmentcover'] = str_replace(',', '', $this->request->getPost("ayudhtreatmentcover"));
$data['moderntreatmentsasperirdai'] = str_replace(',', '', $this->request->getPost("moderntreatmentsasperirdai"));
$data['opd_treatment'] = str_replace(',', '', $this->request->getPost("opd_treatment"));
$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['terrorism'] = str_replace(',', '', $this->request->getPost("terrorism"));
$data['widower_cover'] = str_replace(',', '', $this->request->getPost("widower_cover"));
$data['breavement_cover'] = str_replace(',', '', $this->request->getPost("breavement_cover"));
// $data['waiverofpreexistingdiseases'] = $this->request->getPost("waiverofpreexistingdiseases");
// $data['waiverof1,2,3&4thyearexclusions'] = $this->request->getPost("waiverof1,2,3&4thyearexclusions");
// $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_other_waiting_periods'] = $this->request->getPost("waiver_of_other_waiting_periods");
// $data['maternity_benefit'] = $this->request->getPost("maternity_benefit");
// $data['9monthwaitingperiodwaived'] = str_replace(',', '', $this->request->getPost("9monthwaitingperiodwaived"));
// $data['maternitycoverage'] = str_replace(',', '', $this->request->getPost("maternitycoverage"));
// $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['preandpostnatal'] = str_replace(',', '', $this->request->getPost("preandpostnatal"));
// $data['infertility_treatment_coverage'] = str_replace(',', '', $this->request->getPost("infertility_treatment_coverage"));
// $data['babyday1cover'] = str_replace(',', '', $this->request->getPost("babyday1cover"));
// $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['prehospitalizationcover'] = str_replace(',', '', $this->request->getPost("prehospitalizationcover"));
// $data['posthospitalizationcover'] =$this->request->getPost("posthospitalizationcover");
// $data['congenitaldiseasesinternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesinternal"));
// $data['congenitaldiseasesexternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesexternal"));
// $data['copayzonewisecopay'] = $this->request->getPost("copayzonewisecopay");
// $data['roomrentlimit'] = str_replace(',', '', $this->request->getPost("roomrentlimit"));
// $data['icu_limit'] = str_replace(',', '', $this->request->getPost("icu_limit"));
// $data['proportionatedeductionclause'] = str_replace(',', '', $this->request->getPost("proportionatedeductionclause"));
// $data['ailmentcapping'] = $this->request->getPost("ailmentcapping");
// $data['ailment_capping_details'] = str_replace(',', '', $this->request->getPost("ailment_capping_details"));
// $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['ambulancecharges'] = str_replace(',', '', $this->request->getPost("ambulancecharges"));
// $data['airambulance'] = str_replace(',', '', $this->request->getPost("airambulance"));
// $data['reasonableandcustomarycharges'] = str_replace(',', '', $this->request->getPost("reasonableandcustomarycharges"));
// $data['daycaretreatment'] = str_replace(',', '', $this->request->getPost("daycaretreatment"));
// $data['lasiksurgery'] = str_replace(',', '', $this->request->getPost("lasiksurgery"));
// $data['ayudhtreatmentcover'] = str_replace(',', '', $this->request->getPost("ayudhtreatmentcover"));
// $data['moderntreatmentsasperirdai'] = str_replace(',', '', $this->request->getPost("moderntreatmentsasperirdai"));
// $data['opd_treatment'] = str_replace(',', '', $this->request->getPost("opd_treatment"));
// $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['terrorism'] = str_replace(',', '', $this->request->getPost("terrorism"));
// $data['widower_cover'] = str_replace(',', '', $this->request->getPost("widower_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_input'] = str_replace(',', '', $this->request->getPost("special_condition_input")) ?? [];
$data['multiple_sum_insured'] = str_replace(',', '', $this->request->getPost("multiple_sum_insured")) ?? [];
// $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['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();
@ -2502,6 +2560,10 @@ class ClientController extends AdminController
if ($this->request->getPost("waiverof30dayswaitingperiod_display")) {
$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")) {
$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['is_payable_employee']['self'] = 0;
$data['accidentalDeathBenefit'] = str_replace(',', '', $this->request->getPost("accidentalDeathBenefit"));
$data['permanentTotalDisablement'] = str_replace(',', '', $this->request->getPost("permanentTotalDisablement"));
$data['permanentPartialDisablement'] = $this->request->getPost("permanentPartialDisablement");
$data['temporaryTotalDisablementBenefit'] = $this->request->getPost("temporaryTotalDisablementBenefit");
$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['ambulanceCharges'] = str_replace(',', '', $this->request->getPost("ambulanceCharges"));
$data['repatriation_of_mortal_remains'] = str_replace(',', '', $this->request->getPost("repatriation_of_mortal_remains"));
$data['childrenEducationWelfareFund'] = str_replace(',', '', $this->request->getPost("childrenEducationWelfareFund"));
$data['terrorism'] = $this->request->getPost("terrorism");
$data['worldwideCover'] = $this->request->getPost("worldwideCover");
$data['family_transportation_benefits'] = $this->request->getPost("family_transportation_benefits");
$data['fractures_dislocation_burns'] = $this->request->getPost("fractures_dislocation_burns");
$data['coma'] = $this->request->getPost("coma");
$data['carriageOfDeadBody'] = $this->request->getPost("carriageOfDeadBody");
$data['compassionateVisitExpenses'] = $this->request->getPost("compassionateVisitExpenses");
$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['artifical_limb_and_prosthesis'] = $this->request->getPost("artifical_limb_and_prosthesis");
$data['animalSnakeInsectBite'] = $this->request->getPost("animalSnakeInsectBite");
$data['air_ambulance'] = $this->request->getPost("air_ambulance");
// $data['accidentalDeathBenefit'] = str_replace(',', '', $this->request->getPost("accidentalDeathBenefit"));
// $data['permanentTotalDisablement'] = str_replace(',', '', $this->request->getPost("permanentTotalDisablement"));
// $data['permanentPartialDisablement'] = $this->request->getPost("permanentPartialDisablement");
// $data['temporaryTotalDisablementBenefit'] = $this->request->getPost("temporaryTotalDisablementBenefit");
// $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['ambulanceCharges'] = str_replace(',', '', $this->request->getPost("ambulanceCharges"));
// $data['repatriation_of_mortal_remains'] = str_replace(',', '', $this->request->getPost("repatriation_of_mortal_remains"));
// $data['childrenEducationWelfareFund'] = str_replace(',', '', $this->request->getPost("childrenEducationWelfareFund"));
// $data['terrorism'] = $this->request->getPost("terrorism");
// $data['worldwideCover'] = $this->request->getPost("worldwideCover");
// $data['family_transportation_benefits'] = $this->request->getPost("family_transportation_benefits");
// $data['fractures_dislocation_burns'] = $this->request->getPost("fractures_dislocation_burns");
// $data['coma'] = $this->request->getPost("coma");
// $data['carriageOfDeadBody'] = $this->request->getPost("carriageOfDeadBody");
// $data['compassionateVisitExpenses'] = $this->request->getPost("compassionateVisitExpenses");
// $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['artifical_limb_and_prosthesis'] = $this->request->getPost("artifical_limb_and_prosthesis");
// $data['animalSnakeInsectBite'] = $this->request->getPost("animalSnakeInsectBite");
// $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_input'] = str_replace(',', '', $this->request->getPost("gpa_special_condition_input")) ?? [];
$data['multiple_sum_insured'] = str_replace(',', '', $this->request->getPost("multiple_sum_insured")) ?? [];
// $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['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();
// print_r($data); die;
@ -3371,11 +3479,29 @@ class ClientController extends AdminController
$client_policy_id = $this->request->getPost("client_policy_id");
$policy_terms = $this->request->getPost("policy_terms");
$policy_terms = json_decode($policy_terms, true);
if (!empty($policy_terms)) {
$policy_terms = json_decode($policy_terms, true);
$data = [];
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 = json_encode($policy_terms);
$policy_terms = json_encode($data);
}
@ -3882,6 +4008,7 @@ class ClientController extends AdminController
$cdmData = $this->CDMasterModel
->where('client_id', $client)
->where('insurer_id', $insurer)
->where('is_active', 1)
->findAll();
if ($cdmData) {
@ -4720,7 +4847,7 @@ class ClientController extends AdminController
// $EmpDataServiceController->importDeletionValidation(['file_id' => 304]); //for live
// $EmpDataServiceController->importSIEnhancementUpdateEndorsementID(['file_id' => 1199]); //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);
// print_rr($result); die;
@ -5065,8 +5192,10 @@ class ClientController extends AdminController
->where('insurers.is_active', 1)
->where('tpa.is_active', 1)
->where('employees.is_active', 1)
->where('employees.emp_status', "active")
->where('employees.relationship', "Self")
->where('employee_polices.is_active', 1)
->where('employee_polices.status', "active")
->where($field_name, $param);
if (!empty($client_id)) {

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')
// ->where('files.created_by', get_session_userid())->orderBy('files.created_at', 'desc')->findAll();
// dd($this->fileModel->getLastQuery());
$role_id = get_role_id();
$user_id = get_session_userid();
$data['fileList'] = $this->fileModel
$query = $this->fileModel
->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',
'up.emp_code',
@ -334,13 +336,19 @@ class EmployeeController extends AdminController
->join('client_branch cb', 'files.client_branch_id = cb.id', 'left')
->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("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())
->orderBy('files.created_at', 'desc')
$data['fileList'] = $query->groupBy("c.id")->orderBy('files.created_at', 'desc')
->limit(100)
->find();
// dd($data['fileList']);
$data['batch_list'] = $this->batchFileModel->select("
$query2 = $this->batchFileModel->select("
batch_files.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('policy_type', 'policy_type.id = client_policy.policy_type_id')
->join('clients', 'clients.id = client_policy.client_id')
->orderBy('batch_files.id', 'desc')
->limit(1000)
->find();
->join("client_rm cr","cr.client_id = clients.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
$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();
@ -759,8 +775,18 @@ class EmployeeController extends AdminController
public function enrollmentClientList()
{
$role_id = get_role_id();
$user_id = get_session_userid();
$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();
$policy_list = $this->clientPolicyModel
->select('client_policy.*, policy_type.policy_type')

View File

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

View File

@ -724,6 +724,9 @@ class LeadsController extends BaseController
$data['mail_content'] = $this->transformMailContent($lead_data, $mail_content, $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;
$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;
if (!empty($id)) {
$this->leadInstallmentPaymentDetails->whereIn('id', $id)->set(['is_active' => 0])->update();
return $this->respond(['status' => true, 'message' => 'Removed successfully'], 200);
} else {
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------------------------------------------------------------------------------------------------
@ -1199,13 +1213,14 @@ class LeadsController extends BaseController
public function constructExcelToSaveTemp($lead_id, $type, $propsal_and_insurer = null)
{
$rfq_data = $this->RFQModel->getRFQTableDataWithLeadIDAndType($lead_id, $type);
$is_placement = false;
// dd($rfq_data, $lead_id, $type, $propsal_and_insurer);
// print_r($propsal_and_insurer); die;
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 = [
'Insured' => $rfq_data['client_name'],
'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "",
@ -1217,7 +1232,7 @@ class LeadsController extends BaseController
'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'],
];
} else if ($rfq_data['policy_type_id'] == 1) {
} else if (in_array( $rfq_data['policy_type_id'], [1, 6, 7])) {
$lead_data = [
'Insured' => $rfq_data['client_name'],
'No of Employees at Inception' => $rfq_data['incept_emp_count'],
@ -1228,7 +1243,7 @@ class LeadsController extends BaseController
}
} else {
if ($rfq_data['policy_type_id'] == 2) {
if (in_array($rfq_data['policy_type_id'], [2,3,4,5])) {
$lead_data = [
'Insured' => $rfq_data['client_name'],
@ -1256,7 +1271,7 @@ class LeadsController extends BaseController
'Incurred Claims Ratio' => $rfq_data['incurred_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 = [
'Insured' => $rfq_data['client_name'],
'No of Employees at Renewal' => $rfq_data['renewal_emp_count'],
@ -1279,6 +1294,7 @@ class LeadsController extends BaseController
if ($propsal_and_insurer !== null) {
list($proposal_key, $insurer_key) = explode('-', $propsal_and_insurer, 2);
$data = $this->transformProposelData($data, $proposal_key, $insurer_key);
$is_placement = true;
}
} else if ($type == 1) {
$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 = $subheader_count - 2;
if($is_placement == false){
$subheader_count = $subheader_count - 2;
}
$headerCount = count($data['table_data']['headers']);
$lastColumn = Coordinate::stringFromColumnIndex($subheader_count);
// dd( $headerCount, $lastColumn);
@ -1428,7 +1448,11 @@ class LeadsController extends BaseController
$subHeaderCount = count($header['subHeaders']); // Number of subheaders for this parent header
// 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([
'font' => ['bold' => true],
'alignment' => [
@ -1448,7 +1472,7 @@ class LeadsController extends BaseController
// Add subheaders
foreach ($header['subHeaders'] as $subHeader) {
if($type == 2){
if($type == 2 && $is_placement == false){
$sheet->setCellValue("{$columnLetter}{$subHeaderRow}", $subHeader);
}
@ -1458,13 +1482,16 @@ class LeadsController extends BaseController
$sheet->getColumnDimension('A')->setWidth(10);
}
$sheet->getStyle("{$columnLetter}{$subHeaderRow}")->applyFromArray([
'font' => ['bold' => true],
'alignment' => [
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
],
]);
if($is_placement == false){
$sheet->getStyle("{$columnLetter}{$subHeaderRow}")->applyFromArray([
'font' => ['bold' => true],
'alignment' => [
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
],
]);
}
$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($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'];
$serial_no = 1;
$maxColumnWidths = [];
@ -1521,7 +1553,7 @@ class LeadsController extends BaseController
],
]);
//premium data
if ($type == 2) {
$rowNumber += 2;
@ -1558,9 +1590,14 @@ class LeadsController extends BaseController
$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);
// dd($premiumRange);
$sheet->getStyle($premiumRange)->applyFromArray([
'borders' => [
'allBorders' => [
@ -1575,7 +1612,11 @@ class LeadsController extends BaseController
//set imgage and align the row and column
// Kint::dump($columnLetter);
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{
$columnLetter_img = $this->getPreviousColumn($columnLetter);
}
@ -1667,7 +1708,7 @@ class LeadsController extends BaseController
// Set filename
$string = ($type == 2) ? 'QCR' : 'RFQ';
$string = ($type == 2) ? ( $is_placement == true ? 'Placement' : 'QCR') : 'RFQ';
$current_year = date('Y');
$next_year = $current_year + 1;
$policy_year = "$current_year-$next_year";
@ -2361,8 +2402,11 @@ class LeadsController extends BaseController
}
}
$is_placement = false;
if ($recipient_type == 'placement') {
$is_placement = true;
list($proposal_key, $insurer_key) = explode('-', $propsal_and_insurer, 2);
$lead_update_data = [
@ -2374,8 +2418,8 @@ class LeadsController extends BaseController
$data = [
'proposel_data' => json_encode($lead_update_data),
'status' => 'won',
'placement_date' => date('Y-m-d', strtotime($params['placement_date']) ?? "") ?? null,
'payment_date' => date('Y-m-d', strtotime($params['payment_date'] ?? "")) ?? null,
'placement_date' => !empty($params['placement_date']) ? change_date_format($params['placement_date']) : null,
'payment_date' => !empty($params['payment_date']) ? change_date_format($params['payment_date']) : null,
'utr_no' => $params['utr_no'] ?? null,
'is_cd' => $params['is_cd'] ?? null ,
'premium_amount' => $params['premium_amount'] ?? null,
@ -2392,6 +2436,7 @@ class LeadsController extends BaseController
$installment_data = json_decode($params['installments'], true);
if(!empty($installment_data)){
foreach ($installment_data as $key => $value) {
// print_r($value);die
$value['payment_date'] = !empty($value['payment_date']) && strtotime($value['payment_date'])
? date('Y/m/d', strtotime($value['payment_date']))
: null;
@ -2426,7 +2471,7 @@ class LeadsController extends BaseController
//delete attachment file
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()
@ -2490,7 +2535,7 @@ class LeadsController extends BaseController
$headerData[] = [
'parentHeader' => $header['parentHeader'],
'subHeaders' => [
'Quote Asked', // Default value
// 'Quote Asked', // Default value
$subHeader // Matched insurer key
]
];
@ -2526,15 +2571,16 @@ class LeadsController extends BaseController
];
}
// Include Proposal with Quote Asked by default
if ($item['parentth'] === $proposel && $item['subth'] === "Quote Asked") {
$result['data'][] = [
"parentth" => $item['parentth'],
"subth" => $item['subth'],
"value" => $item['value'],
"input_value" => $item['input_value']
];
}
// Include Proposal with Quote Asked by default
/* For proposel do not remove it */
// if ($item['parentth'] === $proposel && $item['subth'] === "Quote Asked") {
// $result['data'][] = [
// "parentth" => $item['parentth'],
// "subth" => $item['subth'],
// "value" => $item['value'],
// "input_value" => $item['input_value']
// ];
// }
// Example of including matching specific proposals and insurers
if ($item['parentth'] === $proposel && $item['subth'] === $insurer) {
@ -2555,7 +2601,7 @@ class LeadsController extends BaseController
foreach ($data['premium_data']['data'] as $key => $value) {
if ($key === $proposel) {
$premiumData[$key]['Quote Asked'] = $value['Quote Asked'];
// $premiumData[$key]['Quote Asked'] = $value['Quote Asked'];
$premiumData[$key][$insurer] = $value[$insurer];
}
}
@ -2881,6 +2927,7 @@ class LeadsController extends BaseController
$JSON = json_decode($QCRData['json'], true);
$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']);
} catch (\Throwable $e) {
$this->myLogger->logme('error','preparePolicyTermsFromRFQ');
@ -2932,7 +2979,7 @@ class LeadsController extends BaseController
foreach ($dataRow['data'] as $cellData) {
$parentth = $cellData['parentth'] ?? '';
$subth = $cellData['subth'] ?? '';
$input_value = $cellData['input_value'] ?? '';
$input_value = $cellData['input_value'] != "" ? $cellData['input_value'] : ($cellData['value'] ?? '');
$value = $cellData['value'] ?? '';
// Skip unwanted keys
@ -2944,7 +2991,9 @@ class LeadsController extends BaseController
// CASE 1: Handle special conditions
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);
$labelKey = $policy_type == 1 ? 'gpa_special_condition_label' : 'special_condition_label';
$inputKey = $policy_type == 1 ? 'gpa_special_condition_input' : 'special_condition_input';
@ -3022,7 +3071,15 @@ class LeadsController extends BaseController
// Set the value directly, overwriting with latest encountered
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;
}
}
}

View File

@ -461,6 +461,12 @@ class PolicyTransactionController extends BaseController
$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
$coShareDetails[] = [
'pt_id' => $pt_id,
@ -493,10 +499,10 @@ class PolicyTransactionController extends BaseController
'actual_bp_brokerage_amt' => $data['actual_bp_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,
'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,
'stamp_duty' => $data['stamp_duty'][$index] ?? 0,
'cop_amt' => $data['co_premium'][$index] ?? 0,
'cop_amt' => $cop_amt,
'variance' => $data['variance'][$index] ?? 0,
'reward' => $data['reward'][$index] ?? 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);
} else {
$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()
{
// echo 'scbsc';die();
if ($this->request->getMethod() == 'post') {
if ($this->request->is('post')) {
// $jsonData = (array)$this->request->getJSON();
$customer_id = $this->request->getPost('customer_id');
$policy_id = $this->request->getPost('policy_id');

View File

@ -188,6 +188,7 @@ class TicketController extends BaseController
} else {
$isFromDashboard = $this->request->getPost("is_dashboard");
log_message('error', 'Is From Dashboard: ' . $isFromDashboard);
if (isset($isFromDashboard) && !empty($isFromDashboard)){
$data['page_name'] = "Claims";
@ -223,7 +224,7 @@ class TicketController extends BaseController
public function ticketSearch($action = null)
{
$db = db_connect();
// log_message('error', 'Ticket Search Action: ' . $action);
$subquery = $db->table('ticket_master tm')
->select([
'tm.id AS ticket_id',
@ -1658,6 +1659,8 @@ class TicketController extends BaseController
$policies = $this->employeePolicyModel
->select('client_policy_id')
->where('employee_id', $emp_id)
->where('is_active', 1)
->where('status', 'active')
->findAll();
if (empty($policies)) {
@ -1669,8 +1672,20 @@ class TicketController extends BaseController
// Fetch all policy names and IDs in one query
$policyNameandID = $this->clientPolicyModel
->select('CONCAT(policy_type.policy_type, "-", client_policy.policy_no) as client_policy_name, client_policy.id as client_policy_value,client_policy.policy_type_id,client_policy.policy_no')
->select('
CONCAT(policy_type.policy_type, "-", client_policy.policy_no) as client_policy_name,
client_policy.id as client_policy_value,
client_policy.policy_type_id,
client_policy.policy_no,
insurers.id as insurer_id,
insurers.name as insurer_name,
tpa.name as tpa_name,
tpa.id as tpa_id,
')
->join('policy_type', 'policy_type.id = client_policy.policy_type_id AND policy_type.is_active = 1')
->join('insurers', 'insurers.id = client_policy.insurer_id AND insurers.is_active = 1', 'left')
->join('tpa', 'tpa.id = client_policy.tpa_id AND tpa.is_active = 1', 'left')
->where('client_policy.policy_status', 1)
->whereIn('client_policy.id', $policy_ids)
->findAll();

View File

@ -131,10 +131,16 @@ class ExcelMergeHelper {
$newName = $sheetName;
$counter = 1;
while (in_array($newName, $mergedSpreadsheet->getSheetNames())) {
// $newName = $sheetName . "_" . $counter++;
log_message('debug', "Sheet name already exists. Trying new name: {$newName}");
// echo "Sheet name already exists. Trying new name: {$newName}\n";
// while (in_array($newName, $mergedSpreadsheet->getSheetNames())) {
// // $newName = $sheetName . "_" . $counter++;
// log_message('debug', "Sheet name already exists. Trying new name: {$newName}");
// // 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

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'];
$clients = $this->select($columns)
->where('is_active',1)
->where('clients.is_active',1)
->findAll();
// if($role_id == 2 || $role_id == 3){
if($role_id == 2 || $role_id == 3){
// $clients = $this->select($columns)
// ->join('client_rm', 'client_rm.client_id = clients.id')
// ->where('client_rm.user_id', $user_id)
// ->where('clients.is_active',1)
// ->findAll();
// }
$clients = $this->select($columns)
->join('client_rm', 'client_rm.client_id = clients.id')
->where('client_rm.user_id', $user_id)
->where('clients.is_active',1)
->findAll();
}
// $clients->findAll();
@ -107,11 +109,24 @@ class ClientModel extends Model
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.*')
->where('is_active', 1)
->get()
->getResult();
->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
$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')
->where('client_policy.client_id', $id)
->where('cd_master.id = client_policy.cd_ac_pk')
->where('cd_master.is_active', 1)
->groupBy('client_policy.insurer_id')
->groupBy('client_policy.client_id', $id) // Group by insurer_id
->get()
@ -325,14 +326,18 @@ class ClientPolicyModel extends Model
public function updateStatus()
{
// Update client_policy table
$client = $this->db->query("UPDATE client_policy SET policy_status = 0 WHERE policy_end_date < CURDATE()");
$client_count = $this->db->affectedRows();
// Update employee_polices table
$employee = $this->db->query("UPDATE employee_polices SET status = 'expired' WHERE policy_end_date < CURDATE()");
$employee = $this->db->query("UPDATE employee_polices SET status = 'expired', is_active = 0 WHERE policy_end_date < CURDATE()");
$emp_count = $this->db->affectedRows();
// Log the result
log_message('info', "Client policies updated: {$client_count}");
log_message('info', "Employee policies updated: {$emp_count}");
return ['client' => $client_count, 'emp' => $emp_count];
}
@ -357,12 +362,12 @@ class ClientPolicyModel extends Model
{
$query = "
SELECT client_policy.*, policies.name, policies.policy_type_id
FROM client_policy
JOIN policies ON policies.id = client_policy.policy_id
JOIN policy_type ON policy_type.id = policies.policy_type_id
WHERE policy_type.policy_type = '{$type}'
AND client_policy.client_id = {$client_id}";
SELECT client_policy.*, policies.name, policies.policy_type_id
FROM client_policy
JOIN policies ON policies.id = client_policy.policy_id
JOIN policy_type ON policy_type.id = policies.policy_type_id
WHERE policy_type.policy_type = '{$type}'
AND client_policy.client_id = {$client_id}";
$result = $this->db->query($query)->getResult();

View File

@ -243,7 +243,8 @@ function linkRedirectForBDS(input, team)
console.log(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) {
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
// $('.loader').fadeIn();
// $('.loader-mask').fadeIn();
// $.ajax({
// url: "<?= base_url("/dashboard/prepareClaimSearchData") ?>",
// 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');
form.method = 'POST';
form.action = url;
form.target = '_blank';
for (const key in data) {
if (data.hasOwnProperty(key)) {

View File

@ -125,13 +125,13 @@ input:checked + .slider:before {
</div>
</div>
<div>
<!-- <div>
<label class="switch">
<input id="is_download_btn" type="checkbox" name="is_download_btn" <?= (isset($client['is_download_btn']) && $client['is_download_btn'] == 1) ? 'checked' : '' ?>>
<input id="is_download_btn" type="checkbox" name="is_download_btn" <?php // echo(isset($client['is_download_btn']) && $client['is_download_btn'] == 1) ? 'checked' : '' ?>>
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="is_download_btn" style=" position: relative;bottom: 5px;">Enable Client Export Option</label>
</div>
</div> -->

View File

@ -94,16 +94,16 @@ body {
<span class="d-none d-sm-inline-block">API</span>
</a>
</li> -->
<li class="nav-item">
<!-- <li class="nav-item">
<a href="#others-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="others_tab">
<span class="mr-1"><i class="mdi mdi-tag-text-outline"></i></span>
<span class="d-none d-sm-inline-block">Others</span>
</a>
</li>
</li> -->
</ul>
<div class="tab-content">
<?php include("client_api.php"); ?>
<?php include('client_others_tab.php'); ?>
<?php // include('client_others_tab.php'); ?>
<?php include('notification.php'); ?>
<?php include('client_basic_info.php'); ?>
<?php include('client_kyc.php'); ?>
@ -179,10 +179,9 @@ body {
}
function client_policies() {
var check_client_id = $('#general_PrimaryKey');
var check_client_id = $('#general_PrimaryKey').val();
if(check_client_id[0].value == '' || check_client_id[0].value == null || check_client_id[0].value == 0){
if(check_client_id == '' || check_client_id == null || check_client_id == 0){
$('#BtnAdd').hide();
toastr.warning('Please Add the Client!', 'warning',{timeOut: 2000});
}else{

View File

@ -16,7 +16,7 @@
<th>Client Branch</th>
<th>TPA</th>
<th>Date</th>
<th>Enrolment Status</th>
<!-- <th>Enrolment Status</th> -->
<th>Status</th>
<th>Action</th>
</tr>
@ -136,7 +136,7 @@
<input type="text" class="form-control" placeholder="GST (%)" id="gst_no" name="gst" required>
</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;">
<input id="inception_type" type="checkbox" name="inception_type">
<span class="slider round" style="height: 27px;"></span>
@ -159,14 +159,14 @@
<div class="form-group col-md-4">
<label for="reminder_date">Reminder Date<span class="text-danger">*</span></label>
<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>
<textarea class="form-control" placeholder="Enter Disclaimer" name="disclaimer" id="disclaimer" ></textarea>
</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;">
<input id="policy_visibility" type="checkbox" name="enrolment_visibility" checked>
<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>
</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;">
<input id="is_lgbtq" type="checkbox" name="is_lgbtq">
<span class="slider round" style="height: 27px;"></span>
@ -239,23 +239,23 @@
<script>
$('#inception_type').change(function () {
var open_data = $('#open_date').parent();
var close_data = $('#close_date').parent();
var reminder_data = $('#reminder_date').parent();
if($(this).prop('checked')){
$(open_data).show();
$(close_data).show();
$(reminder_data).show();
$('.dateofdata').attr('required', true);
}else{
$(open_data).hide();
$(close_data).hide();
$(reminder_data).hide();
$('.dateofdata').attr('required', false);
// $('#inception_type').change(function () {
// var open_data = $('#open_date').parent();
// var close_data = $('#close_date').parent();
// var reminder_data = $('#reminder_date').parent();
// if($(this).prop('checked')){
// $(open_data).show();
// $(close_data).show();
// $(reminder_data).show();
// $('.dateofdata').attr('required', true);
// }else{
// $(open_data).hide();
// $(close_data).hide();
// $(reminder_data).hide();
// $('.dateofdata').attr('required', false);
}
})
// }
// })
var policy_PrimaryKey = $('#client_id_policy').val();
var policy_client = $('#policy_PrimaryKey').val();
@ -348,28 +348,28 @@
}
//console.log('search_term :', search_term)
var enrollmentStatus = '';
if (item.inception_type == 1) {
// var enrollmentStatus = '';
// if (item.inception_type == 1) {
enrollmentStatus = 'N/A'
// enrollmentStatus = 'N/A'
} else if (item.inception_type == 2) {
// } else if (item.inception_type == 2) {
if (item.open_for_enrollment == 1) {
// if (item.open_for_enrollment == 1) {
enrollmentStatus = '<a href="#" data-id="' + item.id + '" id="' + item.policy_id +
'" class="btnOpenEnroll" data-toggle="tooltip" data-placement="left" title="Click To Close Enrolment">Open</a>'
// enrollmentStatus = '<a href="#" data-id="' + item.id + '" id="' + item.policy_id +
// '" class="btnOpenEnroll" data-toggle="tooltip" data-placement="left" title="Click To Close Enrolment">Open</a>'
} else if (item.open_for_enrollment == 0) {
// } else if (item.open_for_enrollment == 0) {
enrollmentStatus =
'<a href="#" data-toggle="tooltip" data-placement="top" title="Click To Open Enrolment" data-id="' +
item.id + '" id="' + item.policy_id + '" class="btnOpenEnroll">Closed</a>'
// enrollmentStatus =
// '<a href="#" data-toggle="tooltip" data-placement="top" title="Click To Open Enrolment" data-id="' +
// item.id + '" id="' + item.policy_id + '" class="btnOpenEnroll">Closed</a>'
}
// }
}
// }
var tpaValue = 'TPA Unavailable';
@ -388,7 +388,7 @@
<td>${item.branch_name ? item.branch_name : ' - '}</td>
<td>${tpaValue}</td>
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
<td style="text-align: center;">${(enrollmentStatus)}</td>
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
<td>
<div class="btn-group dropdown">
@ -434,6 +434,7 @@
$('#policy_form')[0].reset();
$('#add_form').show();
// console.log("Policy Form Added")
$('#table_list').hide();
$('.btnBack').show();
$('.btnAdd').hide();
@ -442,9 +443,9 @@
$('#tpa').val('').change();
$('#policy_no').val('').change();
$('#policy_no').val('').change();
$('#start_date').val('').change();
$('#end_date').val('').change();
$('#close_date').val('').change();
// $('#start_date').val('').change();
// $('#end_date').val('').change();
// $('#close_date').val('').change();
// $('#policy').html('<option value="" selected>Select Policy</option>').change();
$('#policy_form_action').val('<?= base_url("client/policy/create"); ?>');
$('#policy_status_field').hide()
@ -590,31 +591,31 @@
// //console.log('search_term :', search_term)
var enrollmentStatus = '';
if (item.inception_type == 1) {
// var enrollmentStatus = '';
// if (item.inception_type == 1) {
enrollmentStatus = 'N/A'
// enrollmentStatus = 'N/A'
} else if (item.inception_type == 2) {
// } else if (item.inception_type == 2) {
if (item.open_for_enrollment == 1) {
// if (item.open_for_enrollment == 1) {
enrollmentStatus =
'<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrolment" href="#" data-id="' +
item.id + '" id="' + item.policy_id +
'" class="btnOpenEnroll">Open</a>'
// enrollmentStatus =
// '<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrolment" href="#" data-id="' +
// item.id + '" id="' + item.policy_id +
// '" class="btnOpenEnroll">Open</a>'
} else if (item.open_for_enrollment == 0) {
// } else if (item.open_for_enrollment == 0) {
enrollmentStatus =
'<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrolment" href="#" data-id="' +
item.id + '" id="' + item.policy_id +
'" class="btnOpenEnroll">Closed</a>'
// enrollmentStatus =
// '<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrolment" href="#" data-id="' +
// item.id + '" id="' + item.policy_id +
// '" class="btnOpenEnroll">Closed</a>'
}
// }
}
// }
var tpaValue = 'TPA Unavailable';
@ -632,7 +633,6 @@
<td>${tpaValue}</td>
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
<td style="text-align: center;">${(enrollmentStatus)}</td>
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
<td>
<div class="btn-group dropdown">
@ -725,10 +725,12 @@
$(document).ready(function() {
/********* set the Policy_Type_id for Form Submit *******/
$('#policy_type').change(function() {
// alert('policy_type change');
var policy_type_id = $(this).val();
// alert(policy_type_id);
if (policy_type_id == 1 || policy_type_id == 6 || policy_type_id == 7) {
if (policy_type_id == 1 || policy_type_id == 6 || policy_type_id == 7 || policy_type_id > 10) {
$('#tpa').prop('required', false);
$('#tpa_danger').hide()
} else {
@ -804,19 +806,19 @@
//Open for enrollment yes or no
if (res.data.inception_type == 2) {
$('#inception_type').prop('checked', true);
$('#open_date').parent().show();
$('#close_date').parent().show();
$('#reminder_date').parent().show();
$('.dateofdata').attr('required', true);
} else {
$('#inception_type').prop('checked', false);
$('#open_date').parent().hide();
$('#close_date').parent().hide();
$('#reminder_date').parent().hide();
$('.dateofdata').attr('required', false);
}
// if (res.data.inception_type == 2) {
// $('#inception_type').prop('checked', true);
// $('#open_date').parent().show();
// $('#close_date').parent().show();
// $('#reminder_date').parent().show();
// $('.dateofdata').attr('required', true);
// } else {
// $('#inception_type').prop('checked', false);
// $('#open_date').parent().hide();
// $('#close_date').parent().hide();
// $('#reminder_date').parent().hide();
// $('.dateofdata').attr('required', false);
// }
//Policy Visibility in Web App
if (res.data.enrolment_visibility == 1) {
@ -897,6 +899,17 @@
}
if (res.data.policy_type_id > 7) {
$('#first').show();
$('#second').show();
$('#third').show();
$('#base_policy_id').hide();
$('#base_policy').prop('required', false);
$("#tpa").prop('required', false);
$('#tpa_danger').hide();
$(".EB").hide();
}
if (res.data.is_addon == 2 || res.data.is_addon == 3) {
@ -1440,14 +1453,29 @@
$('#base_policy').prop('required', false);
$('#base_danger').hide();
}
if($('#inception_type').prop('checked')){
if ($(this).val() > 7) {
$('#first').show();
$('#second').show();
$('#third').show();
$('#base_policy_id').hide();
$('#base_policy').prop('required', false);
$(".EB").hide();
setTimeout(() => {
$("#tpa").prop('required', false);
$('#tpa_danger').hide();
}, 100);
}else{
$('#open_date').parent().hide();
$('#close_date').parent().hide();
$('#reminder_date').parent().hide();
}
// if($('#inception_type').prop('checked')){
// }else{
// $('#open_date').parent().hide();
// $('#close_date').parent().hide();
// $('#reminder_date').parent().hide();
// }
})
@ -1520,6 +1548,7 @@
$(document).ready(function() {
$('#base_policy').change(function() {
// alert('Base Policy Change');
var client_policy_id = $(this).val() ? $(this).val() : 0;
var policy_type = $('#policy_type').val()
@ -1872,19 +1901,19 @@
$('#policy_status_field').show();
if (res.data.inception_type == 2) {
$('#inception_type').prop('checked', true);
$('#open_date').parent().show();
$('#close_date').parent().show();
$('#reminder_date').parent().show();
$('.dateofdata').attr('required', true);
} else {
$('#inception_type').prop('checked', false);
$('#open_date').parent().hide();
$('#close_date').parent().hide();
$('#reminder_date').parent().hide();
$('.dateofdata').attr('required', false);
}
// if (res.data.inception_type == 2) {
// $('#inception_type').prop('checked', true);
// $('#open_date').parent().show();
// $('#close_date').parent().show();
// $('#reminder_date').parent().show();
// $('.dateofdata').attr('required', true);
// } else {
// $('#inception_type').prop('checked', false);
// $('#open_date').parent().hide();
// $('#close_date').parent().hide();
// $('#reminder_date').parent().hide();
// $('.dateofdata').attr('required', false);
// }
if (res.data.enrolment_visibility == 1) {
@ -1984,6 +2013,18 @@
$('#tpa').prop('required', true);
$('#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);
$("#tpa").prop('required', false);
$('#tpa_danger').hide();
$(".EB").hide();
}
setTimeout(() => {
$('#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() {
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") {
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
// $('.loader').fadeIn();
// $('.loader-mask').fadeIn();
const form = document.createElement('form');
form.method = method;
form.action = url;
form.target = '_blank';
for (const key in data) {
if (data.hasOwnProperty(key)) {

View File

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

View File

@ -150,8 +150,20 @@ if (isset($selected_lead_type)) {
}
function appendClients(data) {
// console.log("lead_type",lead_type.value);
$('#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>', {
value: '',
text: 'Select Client'
@ -874,6 +886,7 @@ if (isset($selected_lead_type)) {
let lead_type = data.lead_type || null;
waitForDropdownValue('#client_id', data.client_id || '', () => {
if (lead_type == 3) {
// Add "+ Add Client" option if not already present
if ($('#client_id option[value="add_client"]').length === 0) {
@ -888,7 +901,12 @@ if (isset($selected_lead_type)) {
$("#source_policy_id").closest("div").find("label .text-danger").remove();
} else {
$("#source_policy_id").prop("required", true);
if(lead_type == 2){
$("#source_policy_id").prop("required", true);
}else{
$("#source_policy_id").prop("required", false);
}
// Add asterisk if not present
let $label = $("#source_policy_id").closest("div").find("label");

View File

@ -575,10 +575,12 @@
if (value == 3) {
// alert("Function Called");
$('#client_id').prepend($('<option>', {
value: 'add_client',
text: '+ Add Client'
}));
if ($('#client_id option[value="add_client"]').length === 0) {
$('#client_id').prepend($('<option>', {
value: 'add_client',
text: '+ Add Client'
}));
}
$("#source_policy_id").prop("required",false);
$("#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="policy_id" id="gpa_policy_id" />
<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>
<hr>
@ -164,6 +181,9 @@ $("#otherPolicyTerms").submit(function(event) {
// Append the JSON string to the FormData object
formData.append('policy_terms', jsonString);
formData.forEach((value, key) => {
console.log(key + ': ' + value);
});
$.ajax({
data: formData,
@ -187,6 +207,7 @@ $("#otherPolicyTerms").submit(function(event) {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}, 1000);
location.reload();
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
@ -207,17 +228,18 @@ $("#otherPolicyTerms").submit(function(event) {
});
var policy_type_id = "";
$('body').on('click', '.btnPolicyMaster', function() {
$("#append_html_for_other_policy_terms").empty();
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('client_policy_id :', client_policy_id);
$('#other_client_policy_id').val(client_policy_id);
appendPolicyTermsHTML(policy_type_id);
var gpa_policy_type_id = $(this).attr('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
let gpaJsonObjectForSpecialCondition = JSON.parse(res.data);
Object.keys(gpaJsonObjectForSpecialCondition).forEach(function(key) {
if (key.includes("other_special_condition_label") || key.includes(
"other_special_condition_input")) {
if (key.includes("other_special_condition_label")) {
let otherTermsJsonObjectSpecialCondition = JSON.parse(res.data);
Object.keys(otherTermsJsonObjectSpecialCondition).forEach(function(key) {
if (key.includes("special_condition_label") || key.includes(
"special_condition_input")) {
if (key.includes("special_condition_label")) {
for (let index = 0; index <
gpaJsonObjectForSpecialCondition[key].length; index++) {
otherTermsJsonObjectSpecialCondition[key].length; index++) {
specialConditionForOthers();
}
}
@ -280,26 +303,55 @@ $('body').on('click', '.btnPolicyMaster', function() {
if (elements) {
elements.forEach((element, index) => {
if (gpaJsonObjectForSpecialCondition[key][
if (otherTermsJsonObjectSpecialCondition[key][
index
] == undefined) {
element.value = " ";
} else {
element.value =
gpaJsonObjectForSpecialCondition[key][
otherTermsJsonObjectSpecialCondition[key][
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")) {
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>
@ -395,11 +456,11 @@ function specialConditionForOthers(count = 0) {
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;">
<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>
</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>`;
console.log($(this));
$('.other_special_condition').each(function() {
@ -467,29 +528,29 @@ function appendPolicyTermsHTML(policy_type) {
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="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="col-md-6">
<label for="totalSumInsured">Policy Type</label>
@ -585,29 +646,30 @@ function appendPolicyTermsHTML(policy_type) {
} 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="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="col-md-6">
<label for="totalSumInsured">Existing Insurer</label>
@ -676,10 +738,12 @@ function appendOtherSIAddMore(data = null) {
const addMoreContainer = document.getElementById('sum_insured_add_more');
// addMoreContainer.innerHTML = ''; // Clear previous content if needed
console.log(addMoreContainer)
const html = `
<div class="row" style="margin-bottom: 10px;">
<div class="row">
<div class="col-md-6">
<label for="sumInsured">Additional Sum Insured</label>
</div>
@ -699,4 +763,13 @@ function appendOtherSIAddMore(data = null) {
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>

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') {
var element = $(this).parent().parent().next()[0];
$(element).css("display", "");
// if ($(this).val() == '1') {
// var element = $(this).parent().parent().next()[0];
// $(element).css("display", "");
} else {
var element = $(this).parent().parent().next()[0];
$(element).css("display", "none");
}
});
// } else {
// var element = $(this).parent().parent().next()[0];
// $(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') {
var element = $(this).parent().parent().next()[0];
$(element).css("display", "");
// if ($(this).val() == '1') {
// var element = $(this).parent().parent().next()[0];
// $(element).css("display", "");
} else {
var element = $(this).parent().parent().next()[0];
$(element).css("display", "none");
}
});
// } else {
// var element = $(this).parent().parent().next()[0];
// $(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') {
var element = $(this).parent().parent().next()[0];
$(element).css("display", "");
// if ($(this).val() == '1') {
// var element = $(this).parent().parent().next()[0];
// $(element).css("display", "");
} else {
var element = $(this).parent().parent().next()[0];
$(element).css("display", "none");
}
});
// } else {
// var element = $(this).parent().parent().next()[0];
// $(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') {
var element = $(this).parent().parent().next()[0];
$(element).css("display", "");
// if ($(this).val() == '1') {
// var element = $(this).parent().parent().next()[0];
// $(element).css("display", "");
} else {
var element = $(this).parent().parent().next()[0];
$(element).css("display", "none");
}
});
// } else {
// var element = $(this).parent().parent().next()[0];
// $(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') {
var element = $(this).parent().parent().next()[0];
$(element).css("display", "");
// if ($(this).val() == '1') {
// var element = $(this).parent().parent().next()[0];
// $(element).css("display", "");
} else {
var element = $(this).parent().parent().next()[0];
$(element).css("display", "none");
}
});
// } else {
// var element = $(this).parent().parent().next()[0];
// $(element).css("display", "none");
// }
// });
$("#policyGPATerms").submit(function(event) {
@ -784,6 +784,7 @@ $('body').on('click', '.btnPolicyMaster', function() {
.next()[0];
$(element).css("display", "");
}
disableUnwantedTermsforGPA(jsonObject);
Object.keys(jsonObject).forEach(function(key) {
@ -853,6 +854,34 @@ $('body').on('click', '.btnPolicyMaster', function() {
<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) {
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>

View File

@ -108,6 +108,7 @@
onchange="addGridHTML(this)" required>
</select>
</div>
<input type="hidden" id="hidden_unit" />
<div class="form-group col-md-6"
style="position: relative; left: 45px; display:none" id="premium_type">
@ -385,6 +386,14 @@ $('body').on('click', '.btnPolicyModel', function()
// console.log('rack rate responce.premium data', res.premiumData)
// console.log('rack rate responce.premium data parsed', JSON.parse(res.premiumData));
branch_units = JSON.parse(res.branch_units) ?? [];
if (branch_units && branch_units.length == 1) {
$("#hidden_unit").val(branch_units[0]);
console.log('unit', branch_units[0]);
$("#gpa_unit1").val(branch_units[0]);
}
var data_for_the_rack_rate = JSON.parse(res.premiumData) ?? [];
var groupedData = groupByRackRateName(data_for_the_rack_rate) ?? [];
rarc_rate_json_array.push(res.jsonArray);
@ -673,8 +682,12 @@ $('#grid').change(function()
if(unit_length == 1 || unit_length == 0){
$('.unitDiv').hide();
$('.unitDiv').find('input').removeAttr('required');
// $('.unitDiv').hide();
// $('.unitDiv').find('input').removeAttr('required');
setTimeout(() => {
$('.unitDiv').hide();
$('.unitDiv input').removeAttr('required');
}, 1000); // Run after DOM updates
}else{
$('.unitDiv').show();
$('.unitDiv').find('input').attr('required', true);
@ -734,6 +747,9 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
var id_var = 'grid_';
var default_unit = $('#hidden_unit').val();
var dataIdValue = ''
if (event === false) {
var dataIdValue = ui_type
@ -801,14 +817,14 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
<div id="si_or_bp_sum_insure" class="form-row">
<div class="form-row col-md-4" style="margin-left: 346px; margin-top: -114px;">
<label for="mobile">Premium Multiplier<span class="text-danger">*</span></label>
<div class="form-row col-md-4" style="margin-left: 381px; margin-top: -114px;">
<label for="mobile" style = "margin-bottom: -10px;margin-top: 17px;">Premium Multiplier<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '1' ? data.multiplier : '') : ''}" type="text" class="form-control" placeholder="Multiplier" name="gpa_sum_multiplier" id="gpa_sum_multiplier" onchange="gpaSumInsureMultiplier(this)" required>
</div>
<div class="form-row" style="width:101%;padding: 10px;" id="removeChild_${Count}">
<div class="form-group col-md-3 unitDiv">
<label for="mobile">Units<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '1' ? data.unit : '') : ''}" type="text" class="form-control" placeholder="Enter Unit" name="gpa_unit_1[]" id="gpa_unit1" required>
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '1' ? data.unit : default_unit) : default_unit}" type="text" class="form-control" placeholder="Enter Unit" name="gpa_unit_1[]" id="gpa_unit1" required>
</div>
<div class="form-group col-md-3" id="">
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
@ -1341,8 +1357,13 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
}
if(unit_length == 1 || unit_length == 0){
$('.unitDiv').hide();
$('.unitDiv').find('input').removeAttr('required');
// alert("Hello World");
// $('.unitDiv').hide();
// $('.unitDiv').find('input').removeAttr('required');
setTimeout(() => {
$('.unitDiv').hide();
$('.unitDiv input').removeAttr('required');
}, 1000); // Run after DOM updates
}else{
$('.unitDiv').show();
$('.unitDiv').find('input').attr('required', true);
@ -1399,7 +1420,7 @@ function appendGridtHtml(ui_type = false, secondary = false, data = false)
html = `<div class="form-row gpa_sum_insure_remove" style="width:101%" id="removeChild_${Count}">
<div class="form-group col-md-3 unitDiv">
<label for="mobile">Units<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}"}" type="text" class="form-control" placeholder="Enter Unit" name="gpa_unit_1[]" id="gpa_unit1" required>
<input value="${data !== false && data !== undefined && data !== default_unit ? data.unit : default_unit}"}" type="text" class="form-control" placeholder="Enter Unit" name="gpa_unit_1[]" id="gpa_unit1" required>
</div>
<div class="form-group col-md-3" id="">
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
@ -1840,8 +1861,12 @@ function appendGridtHtml(ui_type = false, secondary = false, data = false)
// Count++
if(unit_length == 1 || unit_length == 0){
$('.unitDiv').hide();
$('.unitDiv').find('input').removeAttr('required');
// $('.unitDiv').hide();
// $('.unitDiv').find('input').removeAttr('required');
setTimeout(() => {
$('.unitDiv').hide();
$('.unitDiv input').removeAttr('required');
}, 1000); // Run after DOM updates
}else{
$('.unitDiv').show();
$('.unitDiv').find('input').attr('required', true);
@ -2770,7 +2795,7 @@ function si_orbp_change_function()
$('#gpa_sum_multiplier').attr('required', true);
$('#gpa_sum_si').attr('required', true);
$('#gpa_sum_premium').attr('required', true);
$('#gpa_unit1').attr('required', true);
$('#gpa_unit1').attr('required', false);
var gridContentInput = $('#grid_content_input');
@ -3936,8 +3961,12 @@ function appendFourthAndSixthRackRate(data = null, uniqueId = null)
grid_container.insertAdjacentHTML('beforeend', grid_html);
if(unit_length == 1 || unit_length == 0){
$('.unitDiv').hide();
$('.unitDiv').find('input').removeAttr('required');
// $('.unitDiv').hide();
// $('.unitDiv').find('input').removeAttr('required');
setTimeout(() => {
$('.unitDiv').hide();
$('.unitDiv input').removeAttr('required');
}, 1000); // Run after DOM updates
}else{
$('.unitDiv').show();
$('.unitDiv').find('input').attr('required', true);

View File

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

View File

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

View File

@ -3854,15 +3854,15 @@ $('#policy_no').change(function(){
if(res.status == true){
$('#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_end_date').val(res.data.policy_end_date);
$('#tpa').val(res.data.tpa_branch_id+'-'+res.data.tpa_id).select2();
}else{
$('#ct_type').val(2);
$('#client_policy_id').val();
$('#policy_start_date').val();
$('#policy_end_date').val();
$('#client_policy_id').val('');
$('#policy_start_date').val('');
$('#policy_end_date').val('');
$('#tpa').val('').select2();
console.log(res.message, 'warning');
}

View File

@ -11,11 +11,11 @@
</div>
<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' : ''; ?>>
<label class="form-check-label">Multi with Floter</label>
<label class="form-check-label">Multi with Floater</label>
</div>
<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' : ''; ?>>
<label class="form-check-label">Multi without Floter</label>
<label class="form-check-label">Multi without Floater</label>
</div>
</div>

View File

@ -11,11 +11,11 @@
</div>
<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' : ''; ?>>
<label class="form-check-label">Multi with Floter</label>
<label class="form-check-label">Multi with Floater</label>
</div>
<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' : ''; ?>>
<label class="form-check-label">Multi without Floter</label>
<label class="form-check-label">Multi without Floater</label>
</div>
</div>

View File

@ -11,11 +11,11 @@
</div>
<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' : ''; ?>>
<label class="form-check-label">Multi with Floter</label>
<label class="form-check-label">Multi with Floater</label>
</div>
<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' : ''; ?>>
<label class="form-check-label">Multi without Floter</label>
<label class="form-check-label">Multi without Floater</label>
</div>
</div>

View File

@ -30,7 +30,7 @@
<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>
<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 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;">
<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[]"
placeholder="Enter Premium Date">
placeholder="Enter Premium Date" oninput="incurredClaimSum(this); earnedPremiumCalc(this)">
</div>
<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;">
<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[]"
placeholder="Enter Annualised Claims">
placeholder="Enter Annualised Claims" oninput="incurredClaimSum(this)">
</div>
<div class="form-group col-md-3 renewalFields" style="display: none;">

View File

@ -102,7 +102,7 @@
name="policy_no" placeholder="Policy Number">
</div>
<div class="form-group col-md-3">
<label for="tpa_id">TPA ID <span class="text-danger"></span></label>
<label for="tpa_no">TPA ID <span class="text-danger"></span></label>
<input type="text" class="form-control" id="tpa_no" placeholder="Enter TPA ID"
value="<?= isset($ticket_data['tpa_no']) ? $ticket_data['tpa_no'] : '' ?>"
name="tpa_no">
@ -145,7 +145,7 @@
<div class="form-group">
<label>Policy <span class="text-danger">*</span></label>
<select id="emp_client_policy" name="client_policy_id"
class="form-control custom-select" required onchange="setMinDateDOA(this.value)">
class="form-control custom-select" required onchange="setMinDateDOA(this.value); setInsurerAndTPAData(this)">
<?php if (!empty($ticket_data['client_policy_id'])) { ?>
<option value="<?= $ticket_data['client_policy_id'] ?>"><?= $ticket_data['client_policy_id_text'] ?></option>
<?php } else { ?>
@ -156,7 +156,7 @@
</div>
<div class="form-group col-md-3">
<label for="tpa_id">TPA <span class="text-danger"></span></label>
<label for="tpa_name">TPA <span class="text-danger"></span></label>
<input type=hidden id="tpa_id" name="tpa_id" value="<?= isset($ticket_data['tpa_id']) ? $ticket_data['tpa_id'] : '' ?>">
<input type=text class="form-control" id="tpa_name" placeholder="TPA" value="<?= isset($ticket_data['tpa_name']) ? $ticket_data['tpa_name'] : '' ?>" readonly>
</div>
@ -1048,7 +1048,11 @@
if (ticket_type == 1 && item.policy_type_id != 1) {
$('#emp_client_policy').append($('<option>', {
value: item.client_policy_value,
text: item.client_policy_name
text: item.client_policy_name,
'data-insurerid' : item.insurer_id ?? "",
'data-tpaid' : item.tpa_id ?? "",
'data-insurername' : item.insurer_name ?? "",
'data-tpaname' : item.tpa_name ?? "",
}));
$("#policy_no").val("");
if (policyCount == 1) {
@ -1139,6 +1143,26 @@
}
});
}
function setInsurerAndTPAData(input) {
let selectedOption = $(input).find('option:selected');
let insurer_id = selectedOption.data('insurerid');
let insurer_name = selectedOption.data('insurername');
let tap_name = selectedOption.data('tpaname');
let tap_id = selectedOption.data('tpaid');
console.log('Insurer ID:', insurer_id);
console.log('Insurer Name:', insurer_name);
console.log('TPA Name:', tap_name);
console.log('TPA ID:', tap_id);
$('#insurer_id').val(insurer_id);
$('#insurer_name').val(insurer_name);
$('#tpa_id').val(tap_id);
$('#tpa_name').val(tap_name);
}
</script>
<script>
$("#infoIcon").click(function() {

View File

@ -111,7 +111,7 @@
<div class="form-group">
<label>Policy <span class="text-danger">*</span></label>
<select id="emp_client_policy" name="client_policy_id"
class="form-control custom-select" required onchange="setDateValidation(this.value,true)"
class="form-control custom-select" required onchange="setDateValidation(this.value,true); setInsurerAndTPAData(this)"
<?= isset($ticket_data['client_policy_id'])?" class = 'readonly-select'":'' ?>
>
<?php if (!empty($ticket_data['client_policy_id'])) { ?>
@ -705,7 +705,11 @@
if (ticket_type != 1 && item.policy_type_id != 2) {
$('#emp_client_policy').append($('<option>', {
value: item.client_policy_value,
text: item.client_policy_name
text: item.client_policy_name,
'data-insurerid' : item.insurer_id ?? "",
'data-tpaid' : item.tpa_id ?? "",
'data-insurername' : item.insurer_name ?? "",
'data-tpaname' : item.tpa_name ?? "",
}));
console.log("policy count from loop","");
$("#policy_no").val("");
@ -813,6 +817,25 @@
});
}
function setInsurerAndTPAData(input) {
let selectedOption = $(input).find('option:selected');
let insurer_id = selectedOption.data('insurerid');
let insurer_name = selectedOption.data('insurername');
let tap_name = selectedOption.data('tpaname');
let tap_id = selectedOption.data('tpaid');
console.log('Insurer ID:', insurer_id);
console.log('Insurer Name:', insurer_name);
console.log('TPA Name:', tap_name);
console.log('TPA ID:', tap_id);
$('#insurer_id').val(insurer_id);
$('#tpa_id').val(tap_id);
$('#insurer_name').val(insurer_name);
$('#tpa_name').val(tap_name);
}
// function setMinDateDOA(policy_id) {
// console.log("Function set min date called ");
// console.log("Existing DOA instance: ", doa);

View File

@ -582,7 +582,7 @@ if (!isset($view_ticket_page)) {
// if (response.data.emp_id == null || response.data.emp_id == ''){
unSetClientPolicy();
// }
setClientAndInsurerData(response.data);
setClientAndInsurerData(response.data, true);
setClientBranchPolicy(response.data.emp_id, searchType ?? null, response.data.policy_id ?? null);
appendACMS(response.acms)
@ -742,12 +742,15 @@ if (!isset($view_ticket_page)) {
}
function setClientAndInsurerData(data) {
function setClientAndInsurerData(data, insurer_data = false) {
if(insurer_data == false){
$('#insurer_id').val(data.insurer_id);
$('#insurer_name').val(data.insurer_name);
$('#tpa_id').val(data.tpa_id);
$('#tpa_name').val(data.tpa_name);
}
$('#insurer_id').val(data.insurer_id);
$('#insurer_name').val(data.insurer_name);
$('#tpa_id').val(data.tpa_id);
$('#tpa_name').val(data.tpa_name);
$('#client_id').val(data.client_id);
$('#client_name').val(data.client_name);

View File

@ -297,11 +297,12 @@ $(document).ready(function() {
function viewTicket(ticket_id){
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
// $('.loader').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">
<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 class="form-group col-md-3">
@ -521,7 +521,7 @@
<?php } ?>
<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' : '' ?>>
</div>
@ -530,23 +530,24 @@
<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 ?>">
</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'])) { ?>
<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">
<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'])) : "" ?>">
</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>
<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 } ?>
</div>
</div>
<!-- </div> -->
<hr>
<div id="installment_form_row">
@ -588,7 +589,7 @@
<div class="form-group col-md-12">
<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>
@ -596,7 +597,7 @@
<div class="form-row">
<div class="form-group col-md-12">
<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>
@ -844,12 +845,12 @@
const editor2 = Jodit.make("#internal_mail_content", editorConfig);
var placement_date_datePicker = flatpickr("#placement_date", {
dateFormat: "d/m/Y",
dateFormat: "d-m-Y",
allowInput: false,
});
var payment_date_datePicker = flatpickr("#payment_date", {
dateFormat: "d/m/Y",
dateFormat: "d-m-Y",
allowInput: false,
});
@ -860,11 +861,30 @@
<script>
let intervalId;
$(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);
}, 20000);
});
}
const openDialogBtn = document.getElementById('openDialogBtn');
@ -3692,6 +3712,11 @@ function constructURL_ForPlacementMailSend() {
function ajaxRequest(formData) {
// console.log("formData", formData);
// formData.forEach((value, key) => {
// console.log(key + ': ' + value);
// });
var apiURL = '<?= base_url('leads/sendMail') ?>';
console.log(apiURL);
@ -3713,6 +3738,10 @@ function ajaxRequest(formData) {
console.log(res);
if (res.status == 'success' && res.code == 200) {
toastr.success('Mail send Successfully', 'SUCCESS')
if(res.is_placement == true){
clearInterval(intervalId);
console.log('******** Intervel Cleared ********')
}
} else {
if (res.messgae) {
toastr.error(res.messgae, 'ERROR')
@ -5886,6 +5915,7 @@ function appendMultiFileData(data) {
let $installmentContainer = $('#installment_form_row');
let row_count = $installmentContainer.find('.form-row').length;
let remove_count = $("#no_of_installment").val();
let lead_id = $('#lead_id').val();
console.log("row count",row_count);
if (row_count > 0 ) {
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) => {
if (result.isConfirmed) {
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-mask').fadeIn();
@ -5911,14 +5955,31 @@ function appendMultiFileData(data) {
if (response.status === true) {
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();
$("#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("");
$('#not_installment').empty();
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 {
toastr.error(response.message, 'WARNING');
}
@ -5942,7 +6003,6 @@ function appendMultiFileData(data) {
// $('#is_installment_switch').prop('checked', true).trigger('change');
$('#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);
$('.payment_date').flatpickr({
dateFormat: 'd/m/Y',
dateFormat: 'd-m-Y',
});
}
@ -6175,7 +6235,7 @@ function appendMultiFileData(data) {
$(document).ready(function(){
setTimeout(function(){
$('.payment_date').flatpickr({
dateFormat: 'd/m/Y',
dateFormat: 'd-m-Y',
});
}, 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="rfq_primaryKey" name="rfq_primaryKey" value="<?= isset($rfq_data['id']) ? $rfq_data['id'] : '' ?>">
<div id="allTableContainer">
<div id="tablesContainer"></div>
@ -434,7 +435,7 @@
<div class="form-group col-md-3">
<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 class="form-group col-md-3">
@ -472,11 +473,15 @@
value="<?= isset($lead_data['no_of_installment']) ? $lead_data['no_of_installment'] : 1 ?>">
</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'])) { ?>
<div class="form-group col-md-3">
<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 class="form-group col-md-3">
@ -523,7 +528,7 @@
<div class="form-group col-md-12">
<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>
@ -531,7 +536,7 @@
<div class="form-row">
<div class="form-group col-md-12">
<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>
@ -629,6 +634,31 @@
myModal = new bootstrap.Modal(document.getElementById('policyRegisterModel'));
// 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;
const policies = <?= json_encode($policies) ?>;
// // console.log('policies', policies);
@ -1630,7 +1660,7 @@
collapsibleBar.innerHTML = `
${tableData ? tableData.table_name : "Particulars"}
<span class="collapse-icon"></span>
`;
`;
// Create table content wrapper with Bootstrap 4 collapse class
const tableContent = document.createElement('div');
@ -1975,12 +2005,16 @@
// Initialize the parent table
document.addEventListener('DOMContentLoaded', () => {
// // // console.log("bjnglfkrg ", rfq_data.length);
const url = window.location.pathname; // Get the path (e.g., "/nhance/rfq/list/75/1")
const segments = url.split("/"); // Split by "/"
segments[segments.length - 1] = "1"; // Change the last segment
const newUrl = segments.join("/"); // Rebuild the URL
rfq_or_qcr = 1;
history.pushState(null, "", newUrl); // Change the URL without reloading
// const url = window.location.pathname; // Get the path (e.g., "/nhance/rfq/list/75/1")
// const segments = url.split("/"); // Split by "/"
// segments[segments.length - 1] = "1"; // Change the last segment
// const newUrl = segments.join("/"); // Rebuild the URL
const path = window.location.pathname; // Get the current URL path
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) {
// // console.log("inside if conditoon");
@ -2473,10 +2507,7 @@
table_type: "new",
table_id: `${policyName}_summary_` + locationIndex,
table_editable: true,
table_name: "Risk Location " + locationIndex + "- " +
storedData.locations[i].policyRisk['occupancy'] + "- " +
storedData.locations[i].policyRisk['address1'] + " " +
storedData.locations[i].policyRisk['address2'],
table_name: "Risk Location " + locationIndex,
table_row_contents: rowContents
});
}
@ -2548,17 +2579,17 @@
return null; // If canceled, return null
}
function saveRFQ() {
function saveRFQ(isAutoSave = false) {
// alert("Function Called");
isSaved = true;
// // console.log("save button clicked");
leadJson = tablesToJson();
// // console.log("json from function ", leadJson);
console.log("json from function ", leadJson);
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"
if(rfq_or_qcr == 2){submit_type = 'QCR'}
@ -2570,9 +2601,20 @@
registration_json: policyJson
}
let rfq_primaryKey = $('#rfq_primaryKey').val();
if (isAutoSave) {
formData['rfq_primaryKey'] = rfq_primaryKey;
}
var url = '<?= base_url('rfq/create') ?>';
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
if (!isAutoSave) {
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
}
$.ajax({
url: url,
@ -2583,24 +2625,29 @@
console.log('RFQ NON EB FORM SUBMIT RESPONSE : ', response);
if (response.status == true) {
localStorage.removeItem('policyData');
toastr.success(response.message, "Success");
// // console.log(rfq_data.length);
$('.actionBtns').show();
if (rfq_or_qcr == 2) {
$("#openQCR").hide();
if (!isAutoSave) {
localStorage.removeItem('policyData');
$('.actionBtns').show();
if (rfq_or_qcr == 2) {
$("#openQCR").hide();
}
} else {
$('#rfq_primaryKey').val(response.id);
}
// window.location.reload();
} else {
toastr.error(response.message, "Error");
$('.actionBtns').hide();
}
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
window.location.reload();
if (!isAutoSave) {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
window.location.reload();
}
},
error: function(xhr, status, error) {
$('.loader').fadeOut();
@ -3717,14 +3764,30 @@
}
function removeRowQCR(event) {
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);
}
Swal.fire({
title: 'Are you sure?',
text: "Do you want to remove the row?",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#d33',
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) {
@ -4394,7 +4457,7 @@
const editor2 = Jodit.make("#internal_mail_content", editorConfig);
var placement_date_datePicker = flatpickr("#placement_date", {
dateFormat: "d/m/Y",
dateFormat: "d-m-Y",
allowInput: false,
});
@ -4937,7 +5000,11 @@
// // console.log(res);
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 {
if (res.messgae) {
toastr.error(res.messgae, 'ERROR')
@ -5336,6 +5403,7 @@
let $installmentContainer = $('#installment_form_row');
let row_count = $installmentContainer.find('.form-row').length;
let remove_count = $("#no_of_installment").val();
let lead_id = $('#lead_id').val();
console.log("row count",row_count);
if (row_count > 0 ) {
let ids = $installmentContainer.find('.form-row').slice(-remove_count).find('input[name="installment_primary_key[]"]').map(function() {
@ -5351,7 +5419,21 @@
}).then((result) => {
if (result.isConfirmed) {
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-mask').fadeIn();
@ -5369,6 +5451,21 @@
$("#utr_no").closest('.form-group').show();
$('#installment_form_row').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 {
toastr.error(response.message, 'WARNING');
}
@ -5513,14 +5610,15 @@
$('#installment_form_row').append(html);
$('.payment_date').flatpickr({
dateFormat: 'd/m/Y',
dateFormat: 'd-m-Y',
});
}
$(document).ready(function(){
setTimeout(function(){
$('.payment_date').flatpickr({
dateFormat: 'd/m/Y',
dateFormat: 'd-m-Y',
});
}, 2000)
@ -5671,6 +5769,7 @@
});
});
}
</script>

View File

@ -10,9 +10,9 @@ class ExcelMergeHelperTest extends TestCase
{
// Use the paths you provided
$filePaths = [
['file_path' =>WRITEPATH.'uploads/lead_files/Member_Data.xlsx','sheets' => []],
['file_path' =>'/home/venba/Downloads/RFQ_qw_Office Package_20250326112828.xlsx','sheets' => []],
['file_path' =>WRITEPATH.'/tmp/RFQ_ABC_GMC_20241220140640.xlsx','sheets' => []],
['file_path' =>'/home/venba/Downloads/RFQ_qw_Office Package_20250326112828 (copy).xlsx','sheets' => []],
// ['file_path' =>'/home/venba/Downloads/Employee_data.xlsx','sheets' => []],
];