MERGE_LIVE_SI_MAPPING_ISSUE
This commit is contained in:
commit
a19731f82f
@ -2071,9 +2071,12 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------- POLICY TREMS ------------------------------------------------------------------------------------
|
||||||
|
|
||||||
public function policyGMCTerms()
|
public function policyGMCTerms()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// echo "<pre>";
|
// echo "<pre>";
|
||||||
// print_r($this->request->getPost());die;
|
// print_r($this->request->getPost());die;
|
||||||
$this->myLogger->logme('error', 'Terms CREATE function called');
|
$this->myLogger->logme('error', 'Terms CREATE function called');
|
||||||
@ -2083,7 +2086,6 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$data['sum_insured'] = str_replace(',', '', $this->request->getPost("sum_insured"));
|
$data['sum_insured'] = str_replace(',', '', $this->request->getPost("sum_insured"));
|
||||||
$data['family_floater'] = $this->request->getPost("family_floater") ? $this->request->getPost("family_floater") : 0;
|
$data['family_floater'] = $this->request->getPost("family_floater") ? $this->request->getPost("family_floater") : 0;
|
||||||
// $data['corporatebuffer'] = $this->request->getPost("corporatebuffer") ? $this->request->getPost("corporatebuffer") : 0;
|
|
||||||
$data['family_floaters'] = $this->request->getPost("family_floaters") ?? [];
|
$data['family_floaters'] = $this->request->getPost("family_floaters") ?? [];
|
||||||
|
|
||||||
$data['age_ratio']['self']['min'] = $this->request->getPost("self_min_age") ? $this->request->getPost("self_min_age") : 0;
|
$data['age_ratio']['self']['min'] = $this->request->getPost("self_min_age") ? $this->request->getPost("self_min_age") : 0;
|
||||||
@ -2101,12 +2103,9 @@ class ClientController extends AdminController
|
|||||||
$data['is_payable_employee']['elders'] = $this->request->getPost("is_payable_employee_for_elders") ? 1 : 0;
|
$data['is_payable_employee']['elders'] = $this->request->getPost("is_payable_employee_for_elders") ? 1 : 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// if (!in_array("self", $data['family_floaters'])) {
|
|
||||||
// array_unshift($data['family_floaters'], "self");
|
|
||||||
// }
|
|
||||||
$temp_family_floaters = $data['family_floaters'];
|
$temp_family_floaters = $data['family_floaters'];
|
||||||
$data['family_floaters'] = [];
|
$data['family_floaters'] = [];
|
||||||
|
|
||||||
if (in_array("self", $temp_family_floaters) == 1) {
|
if (in_array("self", $temp_family_floaters) == 1) {
|
||||||
$data['family_floaters']['self'] = 1;
|
$data['family_floaters']['self'] = 1;
|
||||||
} else {
|
} else {
|
||||||
@ -2119,8 +2118,6 @@ class ClientController extends AdminController
|
|||||||
$data['family_floaters']['spouse'] = 0;
|
$data['family_floaters']['spouse'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// $data['family_floaters']['either-parents-pil'] =0;
|
|
||||||
|
|
||||||
if (count($temp_family_floaters)) {
|
if (count($temp_family_floaters)) {
|
||||||
$children_value = 0;
|
$children_value = 0;
|
||||||
$value = 0;
|
$value = 0;
|
||||||
@ -2179,79 +2176,55 @@ class ClientController extends AdminController
|
|||||||
// print_r($data);die;
|
// print_r($data);die;
|
||||||
|
|
||||||
$data['waiverofpreexistingdiseases'] = $this->request->getPost("waiverofpreexistingdiseases");
|
$data['waiverofpreexistingdiseases'] = $this->request->getPost("waiverofpreexistingdiseases");
|
||||||
if ($data['waiverofpreexistingdiseases'] == 1) {
|
|
||||||
$data['maternitycoverage'] = str_replace(',', '', $this->request->getPost("maternitycoverage"));
|
|
||||||
$data['twindelivery'] = str_replace(',', '', $this->request->getPost("twindelivery"));
|
|
||||||
$data['preandpostnatal'] = str_replace(',', '', $this->request->getPost("preandpostnatal"));
|
|
||||||
$data['babyday1cover'] = str_replace(',', '', $this->request->getPost("babyday1cover"));
|
|
||||||
} else {
|
|
||||||
$data['maternitycoverage'] = "";
|
|
||||||
$data['twindelivery'] = "";
|
|
||||||
$data['preandpostnatal'] = "";
|
|
||||||
$data['babyday1cover'] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
$data['9monthwaitingperiodwaived'] = str_replace(',', '', $this->request->getPost("9monthwaitingperiodwaived"));
|
|
||||||
$data['coverfromthedateofjoining'] = str_replace(',', '', $this->request->getPost("coverfromthedateofjoining"));
|
|
||||||
$data['waiverof1,2,3&4thyearexclusions'] = $this->request->getPost("waiverof1,2,3&4thyearexclusions");
|
$data['waiverof1,2,3&4thyearexclusions'] = $this->request->getPost("waiverof1,2,3&4thyearexclusions");
|
||||||
$data['waiverof30dayswaitingperiod'] = $this->request->getPost("waiverof30dayswaitingperiod");
|
$data['waiverof30dayswaitingperiod'] = $this->request->getPost("waiverof30dayswaitingperiod");
|
||||||
|
$data['waiver_of_90_days_waiting_period'] = $this->request->getPost("waiver_of_90_days_waiting_period");
|
||||||
|
$data['waiver_of_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['prehospitalizationcover'] = str_replace(',', '', $this->request->getPost("prehospitalizationcover"));
|
||||||
// $data['posthospitalizationcover'] =$this->request->getPost("posthospitalizationcover");
|
$data['posthospitalizationcover'] =$this->request->getPost("posthospitalizationcover");
|
||||||
$data['congenitaldiseasesinternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesinternal"));
|
$data['congenitaldiseasesinternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesinternal"));
|
||||||
// $data['congenitaldiseasesexternal'] =$this->request->getPost("congenitaldiseasesexternal");
|
$data['congenitaldiseasesexternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesexternal"));
|
||||||
$data['copayzonewisecopay'] = $this->request->getPost("copayzonewisecopay");
|
$data['copayzonewisecopay'] = $this->request->getPost("copayzonewisecopay");
|
||||||
$data['co_pay_details'] = str_replace(',', '', $this->request->getPost("co_pay_details"));
|
|
||||||
|
|
||||||
$data['bioabsorbablestenttoriclensmultifocallens'] = $this->request->getPost("bioabsorbablestenttoriclensmultifocallens");
|
|
||||||
$data['roomrentlimit'] = str_replace(',', '', $this->request->getPost("roomrentlimit"));
|
$data['roomrentlimit'] = str_replace(',', '', $this->request->getPost("roomrentlimit"));
|
||||||
|
$data['icu_limit'] = str_replace(',', '', $this->request->getPost("icu_limit"));
|
||||||
$data['proportionatedeductionclause'] = str_replace(',', '', $this->request->getPost("proportionatedeductionclause"));
|
$data['proportionatedeductionclause'] = str_replace(',', '', $this->request->getPost("proportionatedeductionclause"));
|
||||||
// $data['nursingallowance'] =str_replace(',', '',$this->request->getPost("nursingallowance"));
|
|
||||||
$data['ailmentcapping'] = $this->request->getPost("ailmentcapping");
|
$data['ailmentcapping'] = $this->request->getPost("ailmentcapping");
|
||||||
$data['ailment_capping_details'] = str_replace(',', '', $this->request->getPost("ailment_capping_details"));
|
$data['ailment_capping_details'] = str_replace(',', '', $this->request->getPost("ailment_capping_details"));
|
||||||
|
$data['corporatebuffer'] = str_replace(',', '', $this->request->getPost("corporatebuffer"));
|
||||||
|
$data['non_admissible_contingency_corporate_buffer'] = str_replace(',', '', $this->request->getPost("non_admissible_contingency_corporate_buffer"));
|
||||||
$data['ambulancecharges'] = str_replace(',', '', $this->request->getPost("ambulancecharges"));
|
$data['ambulancecharges'] = str_replace(',', '', $this->request->getPost("ambulancecharges"));
|
||||||
$data['airambulance'] = str_replace(',', '', $this->request->getPost("airambulance"));
|
$data['airambulance'] = str_replace(',', '', $this->request->getPost("airambulance"));
|
||||||
$data['familytransportationbenefit'] = str_replace(',', '', $this->request->getPost("familytransportationbenefit"));
|
|
||||||
$data['reasonableandcustomarycharges'] = str_replace(',', '', $this->request->getPost("reasonableandcustomarycharges"));
|
$data['reasonableandcustomarycharges'] = str_replace(',', '', $this->request->getPost("reasonableandcustomarycharges"));
|
||||||
$data['daycaretreatment'] = str_replace(',', '', $this->request->getPost("daycaretreatment"));
|
$data['daycaretreatment'] = str_replace(',', '', $this->request->getPost("daycaretreatment"));
|
||||||
$data['ayudhtreatmentcover'] = str_replace(',', '', $this->request->getPost("ayudhtreatmentcover"));
|
|
||||||
|
|
||||||
$data['congenitaldiseasesexternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesexternal"));
|
|
||||||
// $data['optionalparentalcopay'] = str_replace(',', '', $this->request->getPost("optionalparentalcopay"));
|
|
||||||
$data['posthospitalizationcover'] = str_replace(',', '', $this->request->getPost("posthospitalizationcover"));
|
|
||||||
$data['corporatebuffer'] = str_replace(',', '', $this->request->getPost("corporatebuffer"));
|
|
||||||
$data['sublimitofcorporatebuffer'] = str_replace(',', '', $this->request->getPost("sublimitofcorporatebuffer"));
|
|
||||||
|
|
||||||
if ($data['ayudhtreatmentcover'] == 1) {
|
|
||||||
$data['ayushTreatmentCoverData'] = str_replace(',', '', $this->request->getPost("ayushTreatmentCoverData"));
|
|
||||||
} else {
|
|
||||||
$data['ayushTreatmentCoverData'] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
$data['armdcovered'] = str_replace(',', '', $this->request->getPost("armdcovered"));
|
|
||||||
$data['suminsuredenhancement'] = str_replace(',', '', $this->request->getPost("suminsuredenhancement"));
|
|
||||||
$data['automaticsuminsuredreinstatement'] = str_replace(',', '', $this->request->getPost("automaticsuminsuredreinstatement"));
|
|
||||||
$data['additionalsicknessbenefit'] = str_replace(',', '', $this->request->getPost("additionalsicknessbenefit"));
|
|
||||||
$data['lasiksurgery'] = str_replace(',', '', $this->request->getPost("lasiksurgery"));
|
$data['lasiksurgery'] = str_replace(',', '', $this->request->getPost("lasiksurgery"));
|
||||||
$data['midterminclusion'] = str_replace(',', '', $this->request->getPost("midterminclusion"));
|
$data['ayudhtreatmentcover'] = str_replace(',', '', $this->request->getPost("ayudhtreatmentcover"));
|
||||||
$data['capd'] = str_replace(',', '', $this->request->getPost("capd"));
|
|
||||||
$data['organdonorexpenses'] = str_replace(',', '', $this->request->getPost("organdonorexpenses"));
|
|
||||||
$data['moderntreatmentsasperirdai'] = str_replace(',', '', $this->request->getPost("moderntreatmentsasperirdai"));
|
$data['moderntreatmentsasperirdai'] = str_replace(',', '', $this->request->getPost("moderntreatmentsasperirdai"));
|
||||||
$data['Wellness'] = str_replace(',', '', $this->request->getPost("Wellness"));
|
$data['opd_treatment'] = str_replace(',', '', $this->request->getPost("opd_treatment"));
|
||||||
$data['days_of_discharge'] = str_replace(',', '', $this->request->getPost("days_of_discharge"));
|
$data['days_of_discharge'] = str_replace(',', '', $this->request->getPost("days_of_discharge"));
|
||||||
$data['days_from_dod'] = str_replace(',', '', $this->request->getPost("days_from_dod"));
|
$data['days_from_dod'] = str_replace(',', '', $this->request->getPost("days_from_dod"));
|
||||||
|
$data['terrorism'] = str_replace(',', '', $this->request->getPost("terrorism"));
|
||||||
|
$data['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['special_condition_label'] = str_replace(',', '', $this->request->getPost("special_condition_label")) ?? [];
|
$data['special_condition_label'] = str_replace(',', '', $this->request->getPost("special_condition_label")) ?? [];
|
||||||
$data['special_condition_input'] = str_replace(',', '', $this->request->getPost("special_condition_input")) ?? [];
|
$data['special_condition_input'] = str_replace(',', '', $this->request->getPost("special_condition_input")) ?? [];
|
||||||
$data['multiple_sum_insured'] = str_replace(',', '', $this->request->getPost("multiple_sum_insured")) ?? [];
|
$data['multiple_sum_insured'] = str_replace(',', '', $this->request->getPost("multiple_sum_insured")) ?? [];
|
||||||
|
|
||||||
$data['cataract'] = str_replace(',', '', $this->request->getPost("cataract"));
|
$data['enrollment_display_key'] = $this->enrollmentGMCDisplayValueTransform();
|
||||||
|
|
||||||
if ($data['cataract'] == 1) {
|
|
||||||
$data['cataractData'] = str_replace(',', '', $this->request->getPost("cataractData"));
|
|
||||||
} else {
|
|
||||||
$data['cataractData'] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// print_r($data);die;
|
||||||
|
|
||||||
$jsonData = json_encode($data);
|
$jsonData = json_encode($data);
|
||||||
$dataa = array(
|
$dataa = array(
|
||||||
@ -2260,7 +2233,6 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||||
|
|
||||||
|
|
||||||
// print_r($data);die;
|
// print_r($data);die;
|
||||||
if ($record) {
|
if ($record) {
|
||||||
$update = $this->clientPolicyModel->update($client_policy_id, $dataa);
|
$update = $this->clientPolicyModel->update($client_policy_id, $dataa);
|
||||||
@ -2285,6 +2257,190 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function enrollmentGMCDisplayValueTransform()
|
||||||
|
{
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
if ($this->request->getPost("waiverofpreexistingdiseases_display")) {
|
||||||
|
$data['Waiver of Pre-existing Diseases'] = $this->request->getPost("waiverofpreexistingdiseases");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("waiverof1234thyearexclusions_display")) {
|
||||||
|
$data['Waiver of 1, 2, 3 & 4th year Exclusions'] = $this->request->getPost("waiverof1,2,3&4thyearexclusions");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("waiverof30dayswaitingperiod_display")) {
|
||||||
|
$data['Waiver of 30 days waiting period'] = $this->request->getPost("waiverof30dayswaitingperiod");
|
||||||
|
}
|
||||||
|
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("waiver_of_other_waiting_periods_display")) {
|
||||||
|
$data['Waiver of Other Waiting Periods'] = $this->request->getPost("waiver_of_other_waiting_periods");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("maternity_benefit_display")) {
|
||||||
|
$data['Maternity Benefit'] = $this->request->getPost("maternity_benefit");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("9monthwaitingperiodwaived_display")) {
|
||||||
|
$data['9-month waiting Period - waived'] = $this->request->getPost("9monthwaitingperiodwaived");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("maternitycoverage_display")) {
|
||||||
|
$data['Maternity Coverage'] = $this->request->getPost("maternitycoverage");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("twindelivery_display")) {
|
||||||
|
$data['Twin Delivery'] = $this->request->getPost("twindelivery");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("well_baby_well_mother_expenses_display")) {
|
||||||
|
$data['Well baby / Well Mother Expenses'] = $this->request->getPost("well_baby_well_mother_expenses");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("preandpostnatal_display")) {
|
||||||
|
$data['Pre and Post natal'] = $this->request->getPost("preandpostnatal");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("infertility_treatment_coverage_display")) {
|
||||||
|
$data['Infertility Treatment Coverage'] = $this->request->getPost("infertility_treatment_coverage");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("babyday1cover_display")) {
|
||||||
|
$data['Baby Day 1 Cover'] = $this->request->getPost("babyday1cover");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("coverfromthedateofjoining_display")) {
|
||||||
|
$data['Cover from the date of Joining'] = $this->request->getPost("coverfromthedateofjoining");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("mid_term_addition_of_new_born_newly_wedded_spouse_display")) {
|
||||||
|
$data['Mid Term Addition of New Born / Newly Wedded Spouse'] = $this->request->getPost("mid_term_addition_of_new_born_newly_wedded_spouse");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("prehospitalizationcover_display")) {
|
||||||
|
$data['Pre Hospitalization Cover'] = $this->request->getPost("prehospitalizationcover");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("posthospitalizationcover_display")) {
|
||||||
|
$data['Post Hospitalization Cover'] = $this->request->getPost("posthospitalizationcover");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("congenitaldiseasesinternal_display")) {
|
||||||
|
$data['Congenital Diseases - Internal'] = $this->request->getPost("congenitaldiseasesinternal");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("congenitaldiseasesexternal_display")) {
|
||||||
|
$data['Congenital Diseases - External'] = $this->request->getPost("congenitaldiseasesexternal");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("copayzonewisecopay_display")) {
|
||||||
|
$data['Co-Pay/Zone wise Co Pay'] = $this->request->getPost("copayzonewisecopay");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("roomrentlimit_display")) {
|
||||||
|
$data['Room Rent Limit'] = $this->request->getPost("roomrentlimit");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("icu_limit_display")) {
|
||||||
|
$data['ICU Limit'] = $this->request->getPost("icu_limit");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("proportionatedeductionclause_display")) {
|
||||||
|
$data['Proportionate Deduction Clause'] = $this->request->getPost("proportionatedeductionclause");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("ailmentcapping_display")) {
|
||||||
|
$data['Ailment capping'] = $this->request->getPost("ailmentcapping");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("ailment_capping_details_display")) {
|
||||||
|
$data['Ailment capping Details'] = $this->request->getPost("ailment_capping_details");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("corporatebuffer_display")) {
|
||||||
|
$data['Corporate Buffer'] = $this->request->getPost("corporatebuffer");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("non_admissible_contingency_corporate_buffer_display")) {
|
||||||
|
$data['Non-Admissible / Contingency Corporate Buffer'] = $this->request->getPost("non_admissible_contingency_corporate_buffer");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("ambulancecharges_display")) {
|
||||||
|
$data['Ambulance Charges'] = $this->request->getPost("ambulancecharges");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("airambulance_display")) {
|
||||||
|
$data['Air Ambulance'] = $this->request->getPost("airambulance");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("reasonableandcustomarycharges_display")) {
|
||||||
|
$data['Reasonable and Customary Charges'] = $this->request->getPost("reasonableandcustomarycharges");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("daycaretreatment_display")) {
|
||||||
|
$data['Day Care Treatment'] = $this->request->getPost("daycaretreatment");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("lasiksurgery_display")) {
|
||||||
|
$data['Lasik Surgery'] = $this->request->getPost("lasiksurgery");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("ayushtreatmentcover_display")) {
|
||||||
|
$data['AYUSH treatment cover'] = $this->request->getPost("ayudhtreatmentcover");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("moderntreatmentsasperirdai_display")) {
|
||||||
|
$data['Modern treatments as per IRDAI'] = $this->request->getPost("moderntreatmentsasperirdai");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("opd_treatment_display")) {
|
||||||
|
$data['OPD Treatment'] = $this->request->getPost("opd_treatment");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("days_of_discharge_display")) {
|
||||||
|
$data['Claim Intimation Clause'] = $this->request->getPost("days_of_discharge");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("days_from_dod_display")) {
|
||||||
|
$data['Claim Submission'] = $this->request->getPost("days_from_dod");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("terrorism_display")) {
|
||||||
|
$data['Terrorism'] = $this->request->getPost("terrorism");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("widower_cover_display")) {
|
||||||
|
$data['Widower Cover'] = $this->request->getPost("widower_cover");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("breavement_cover_display")) {
|
||||||
|
$data['Breavement Cover'] = $this->request->getPost("breavement_cover");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("special_condition_display_value")) {
|
||||||
|
|
||||||
|
$specialConditionKeyValue = $this->request->getPost("special_condition_display_value") ?? [];
|
||||||
|
$specialConditionKeyValue = json_decode($specialConditionKeyValue, true);
|
||||||
|
|
||||||
|
if (is_array($specialConditionKeyValue) && count($specialConditionKeyValue) > 0) {
|
||||||
|
$mergedArray = array_merge(...array_map(fn($item) => (array) $item, $specialConditionKeyValue));
|
||||||
|
$data = array_merge($data, $mergedArray);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($data) && !empty($data)){
|
||||||
|
return $data;
|
||||||
|
}else{
|
||||||
|
$data = [];
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function getterms()
|
public function getterms()
|
||||||
{
|
{
|
||||||
$client_policy_id = $this->request->getVar('client_policy_id');
|
$client_policy_id = $this->request->getVar('client_policy_id');
|
||||||
@ -2337,52 +2493,32 @@ class ClientController extends AdminController
|
|||||||
$data['permanentTotalDisablement'] = str_replace(',', '', $this->request->getPost("permanentTotalDisablement"));
|
$data['permanentTotalDisablement'] = str_replace(',', '', $this->request->getPost("permanentTotalDisablement"));
|
||||||
$data['permanentPartialDisablement'] = $this->request->getPost("permanentPartialDisablement");
|
$data['permanentPartialDisablement'] = $this->request->getPost("permanentPartialDisablement");
|
||||||
$data['temporaryTotalDisablementBenefit'] = $this->request->getPost("temporaryTotalDisablementBenefit");
|
$data['temporaryTotalDisablementBenefit'] = $this->request->getPost("temporaryTotalDisablementBenefit");
|
||||||
$data['accidentalHospitalizationExpenses'] = str_replace(',', '', $this->request->getPost("accidentalHospitalizationExpenses"));
|
$data['medical_expenses_medical_extension'] = str_replace(',', '', $this->request->getPost("medical_expenses_medical_extension"));
|
||||||
$data['childrenEducationWelfareFund'] = str_replace(',', '', $this->request->getPost("childrenEducationWelfareFund"));
|
$data['opd_treatment_cover'] = str_replace(',', '', $this->request->getPost("opd_treatment_cover"));
|
||||||
|
|
||||||
$data['compassionateVisitExpenses'] = $this->request->getPost("compassionateVisitExpenses");
|
|
||||||
if ($data['compassionateVisitExpenses'] == 1) {
|
|
||||||
$data['compassionateVisitExpensesData'] = $this->request->getPost("compassionateVisitExpensesData");
|
|
||||||
} else {
|
|
||||||
$data['compassionateVisitExpensesData'] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
$data['brokenBoneExpenses'] = str_replace(',', '', $this->request->getPost("brokenBoneExpenses"));
|
|
||||||
if ($data['brokenBoneExpenses'] == 1) {
|
|
||||||
$data['brokenBoneExpensesData'] = str_replace(',', '', $this->request->getPost("brokenBoneExpensesData"));
|
|
||||||
} else {
|
|
||||||
$data['brokenBoneExpensesData'] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
$data['ambulanceCharges'] = str_replace(',', '', $this->request->getPost("ambulanceCharges"));
|
$data['ambulanceCharges'] = str_replace(',', '', $this->request->getPost("ambulanceCharges"));
|
||||||
if ($data['ambulanceCharges'] == 1) {
|
$data['repatriation_of_mortal_remains'] = str_replace(',', '', $this->request->getPost("repatriation_of_mortal_remains"));
|
||||||
$data['ambulanceChargesData'] = str_replace(',', '', $this->request->getPost("ambulanceChargesData"));
|
$data['childrenEducationWelfareFund'] = str_replace(',', '', $this->request->getPost("childrenEducationWelfareFund"));
|
||||||
} else {
|
|
||||||
$data['ambulanceChargesData'] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
$data['burnExpenses'] = $this->request->getPost("burnExpenses");
|
|
||||||
if ($data['burnExpenses'] == 1) {
|
|
||||||
$data['burnExpensesData'] = $this->request->getPost("burnExpensesData");
|
|
||||||
} else {
|
|
||||||
$data['burnExpensesData'] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
$data['carriageOfDeadBody'] = $this->request->getPost("carriageOfDeadBody");
|
|
||||||
if ($data['carriageOfDeadBody'] == 1) {
|
|
||||||
$data['carriageOfDeadBodyData'] = $this->request->getPost("carriageOfDeadBodyData");
|
|
||||||
} else {
|
|
||||||
$data['carriageOfDeadBodyData'] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
$data['animalSnakeInsectBite'] = $this->request->getPost("animalSnakeInsectBite");
|
|
||||||
$data['terrorism'] = $this->request->getPost("terrorism");
|
$data['terrorism'] = $this->request->getPost("terrorism");
|
||||||
$data['worldwideCover'] = $this->request->getPost("worldwideCover");
|
$data['worldwideCover'] = $this->request->getPost("worldwideCover");
|
||||||
|
$data['family_transportation_benefits'] = $this->request->getPost("family_transportation_benefits");
|
||||||
|
$data['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_label'] = str_replace(',', '', $this->request->getPost("gpa_special_condition_label")) ?? [];
|
||||||
$data['gpa_special_condition_input'] = str_replace(',', '', $this->request->getPost("gpa_special_condition_input")) ?? [];
|
$data['gpa_special_condition_input'] = str_replace(',', '', $this->request->getPost("gpa_special_condition_input")) ?? [];
|
||||||
$data['multiple_sum_insured'] = str_replace(',', '', $this->request->getPost("multiple_sum_insured")) ?? [];
|
$data['multiple_sum_insured'] = str_replace(',', '', $this->request->getPost("multiple_sum_insured")) ?? [];
|
||||||
|
|
||||||
|
$data['enrollment_display_key'] = $this->enrollmentGPADisplayValueTransform();
|
||||||
|
|
||||||
|
// print_r($data); die;
|
||||||
|
|
||||||
$jsonData = json_encode($data);
|
$jsonData = json_encode($data);
|
||||||
$dataa = array(
|
$dataa = array(
|
||||||
@ -2412,6 +2548,94 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function enrollmentGPADisplayValueTransform()
|
||||||
|
{
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
if ($this->request->getPost("accidentalDeathBenefit_display")) {
|
||||||
|
$data['Accidental Death Benefit'] = $this->request->getPost("accidentalDeathBenefit");
|
||||||
|
}
|
||||||
|
if ($this->request->getPost("permanentTotalDisablement_display")) {
|
||||||
|
$data['Permanent Total Disablement'] = $this->request->getPost("permanentTotalDisablement");
|
||||||
|
}
|
||||||
|
if ($this->request->getPost("permanentPartialDisablement_display")) {
|
||||||
|
$data['Permanent Partial Disablement'] = $this->request->getPost("permanentPartialDisablement");
|
||||||
|
}
|
||||||
|
if ($this->request->getPost("temporaryTotalDisablementBenefit_display")) {
|
||||||
|
$data['Temporary Total Disablement Benefit'] = $this->request->getPost("temporaryTotalDisablementBenefit");
|
||||||
|
}
|
||||||
|
if ($this->request->getPost("medical_expenses_medical_extension_display")) {
|
||||||
|
$data['Medical Expenses / Medical Extension (IPD)'] = $this->request->getPost("medical_expenses_medical_extension");
|
||||||
|
}
|
||||||
|
if ($this->request->getPost("opd_treatment_cover_display")) {
|
||||||
|
$data['OPD Treatment Cover'] = $this->request->getPost("opd_treatment_cover");
|
||||||
|
}
|
||||||
|
if ($this->request->getPost("ambulanceCharges_display")) {
|
||||||
|
$data['Ambulance Charges'] = $this->request->getPost("ambulanceCharges");
|
||||||
|
}
|
||||||
|
if ($this->request->getPost("repatriation_of_mortal_remains_display")) {
|
||||||
|
$data['Repatriation of Mortal Remains'] = $this->request->getPost("repatriation_of_mortal_remains");
|
||||||
|
}
|
||||||
|
if ($this->request->getPost("childrenEducationWelfareFund_display")) {
|
||||||
|
$data['Children Education Welfare Fund'] = $this->request->getPost("childrenEducationWelfareFund");
|
||||||
|
}
|
||||||
|
if ($this->request->getPost("terrorism_display")) {
|
||||||
|
$data['Terrorism'] = $this->request->getPost("terrorism");
|
||||||
|
}
|
||||||
|
if ($this->request->getPost("worldwideCover_display")) {
|
||||||
|
$data['Worldwide Cover'] = $this->request->getPost("worldwideCover");
|
||||||
|
}
|
||||||
|
if ($this->request->getPost("family_transportation_benefits_display")) {
|
||||||
|
$data['Family Transportation Benefits'] = $this->request->getPost("family_transportation_benefits");
|
||||||
|
}
|
||||||
|
if ($this->request->getPost("fractures_dislocation_burns_display")) {
|
||||||
|
$data['Fractures / Dislocation / Burns'] = $this->request->getPost("fractures_dislocation_burns");
|
||||||
|
}
|
||||||
|
if ($this->request->getPost("coma_display")) {
|
||||||
|
$data['Coma'] = $this->request->getPost("coma");
|
||||||
|
}
|
||||||
|
if ($this->request->getPost("carriageofDeadBody_display")) {
|
||||||
|
$data['Carriage of Dead Body'] = $this->request->getPost("carriageOfDeadBody");
|
||||||
|
}
|
||||||
|
if ($this->request->getPost("compassionateVisitExpenses_display")) {
|
||||||
|
$data['Compassionate Visit Expenses'] = $this->request->getPost("compassionateVisitExpenses");
|
||||||
|
}
|
||||||
|
if ($this->request->getPost("travel_expenses_for_medical_treatment_display")) {
|
||||||
|
$data['Travel expenses for Medical Treatment'] = $this->request->getPost("travel_expenses_for_medical_treatment");
|
||||||
|
}
|
||||||
|
if ($this->request->getPost("daily_cash_allowance_display")) {
|
||||||
|
$data['Daily cash Allowance'] = $this->request->getPost("daily_cash_allowance");
|
||||||
|
}
|
||||||
|
if ($this->request->getPost("artifical_limb_and_prosthesis_display")) {
|
||||||
|
$data['Artifical Limb and Prosthesis'] = $this->request->getPost("artifical_limb_and_prosthesis");
|
||||||
|
}
|
||||||
|
if ($this->request->getPost("animalSnakeInsectBite_display")) {
|
||||||
|
$data['Animal/Snake/Insect Bite'] = $this->request->getPost("animalSnakeInsectBite");
|
||||||
|
}
|
||||||
|
if ($this->request->getPost("air_ambulance_display")) {
|
||||||
|
$data['Air Ambulance'] = $this->request->getPost("air_ambulance");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("gpa_special_condition_display_value")) {
|
||||||
|
|
||||||
|
$specialConditionKeyValue = $this->request->getPost("gpa_special_condition_display_value") ?? [];
|
||||||
|
$specialConditionKeyValue = json_decode($specialConditionKeyValue, true);
|
||||||
|
|
||||||
|
if (is_array($specialConditionKeyValue) && count($specialConditionKeyValue) > 0) {
|
||||||
|
$mergedArray = array_merge(...array_map(fn($item) => (array) $item, $specialConditionKeyValue));
|
||||||
|
$data = array_merge($data, $mergedArray);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// print_r($data); die;
|
||||||
|
|
||||||
|
if (isset($data) && !empty($data)) {
|
||||||
|
return $data;
|
||||||
|
} else {
|
||||||
|
$data = [];
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function getPolicyGPATerms()
|
public function getPolicyGPATerms()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -2426,6 +2650,8 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
public function updateClientPolicyStatus()
|
public function updateClientPolicyStatus()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@ -98,18 +98,59 @@ class DashboardController extends AdminController
|
|||||||
public function dashboard()
|
public function dashboard()
|
||||||
{
|
{
|
||||||
|
|
||||||
$data = [];
|
$data['page_name'] = 'Dashboard';
|
||||||
|
|
||||||
$results = $this->clientModel->select('clients.id as client_id, clients.client_name, clients.short_name,
|
$db = db_connect();
|
||||||
client_branch.id as client_branch_id, client_branch.branch_name,
|
$sql = "SELECT
|
||||||
client_branch.branch_code, employees.id as employee_id,
|
clients.id AS client_id,
|
||||||
employees.name as employee_name, employees.relationship,
|
clients.client_name,
|
||||||
employees.emp_code, employees.emp_status, auth_history.user_type, client_policy.policy_type_id, client_policy.id as client_policy_id')
|
clients.short_name,
|
||||||
->join('client_branch', 'clients.id = client_branch.client_id', 'left')
|
client_branch.id AS client_branch_id,
|
||||||
->join('client_policy', 'client_branch.id = client_policy.client_branch_id', 'left')
|
client_branch.branch_name,
|
||||||
->join('employees', 'client_branch.id = employees.client_branch_id', 'left')
|
client_branch.branch_code,
|
||||||
->join('auth_history', 'employees.id = auth_history.user_id AND "employee" = auth_history.user_type', 'left')
|
|
||||||
->findAll();
|
COUNT(employees.id) AS total_employees,
|
||||||
|
SUM(CASE WHEN employees.emp_status = 'draft' THEN 1 ELSE 0 END) AS draft_count,
|
||||||
|
SUM(CASE WHEN employees.emp_status IN ('enrolled', 'active') THEN 1 ELSE 0 END) AS enrolled_count,
|
||||||
|
|
||||||
|
SUM(CASE WHEN auth_history.user_id IS NOT NULL THEN 1 ELSE 0 END) AS logged_in_count,
|
||||||
|
SUM(CASE WHEN auth_history.user_id IS NULL THEN 1 ELSE 0 END) AS not_logged_in_count,
|
||||||
|
|
||||||
|
CASE
|
||||||
|
WHEN EXISTS (
|
||||||
|
SELECT 1 FROM client_policy
|
||||||
|
WHERE client_policy.client_branch_id = client_branch.id
|
||||||
|
AND client_policy.is_active = 1
|
||||||
|
AND client_policy.open_for_enrollment = 1
|
||||||
|
) THEN 1
|
||||||
|
ELSE 0
|
||||||
|
END AS open_or_close_enrollment
|
||||||
|
|
||||||
|
FROM clients
|
||||||
|
LEFT JOIN client_branch ON clients.id = client_branch.client_id
|
||||||
|
LEFT JOIN employees ON client_branch.id = employees.client_branch_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT user_id, user_type
|
||||||
|
FROM auth_history
|
||||||
|
WHERE user_type = 'employee'
|
||||||
|
GROUP BY user_id
|
||||||
|
) AS auth_history ON employees.id = auth_history.user_id
|
||||||
|
|
||||||
|
WHERE employees.relationship = 'Self'
|
||||||
|
AND employees.emp_status IN ('draft', 'enrolled', 'active')
|
||||||
|
AND employees.is_active = 1
|
||||||
|
AND clients.is_active = 1
|
||||||
|
AND client_branch.is_active = 1
|
||||||
|
|
||||||
|
GROUP BY clients.id, client_branch.id";
|
||||||
|
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
|
||||||
|
|
||||||
|
$data['client_branch_emp_list'] = $results;
|
||||||
|
$session = \Config\Services::session();
|
||||||
|
$session->set('enrollment_data', json_encode($data));
|
||||||
|
|
||||||
// $pendingActionsController = new PendingActionsController;
|
// $pendingActionsController = new PendingActionsController;
|
||||||
// $pendingActionsData = $pendingActionsController->getPendingActionsForDashBoard();
|
// $pendingActionsData = $pendingActionsController->getPendingActionsForDashBoard();
|
||||||
@ -118,95 +159,6 @@ class DashboardController extends AdminController
|
|||||||
// $businessTeamStatusData = $this->data_construct_for_bds($businessTeamData);
|
// $businessTeamStatusData = $this->data_construct_for_bds($businessTeamData);
|
||||||
// $financeTeamStatusData = $this->data_construct_for_bds($financeTeamData);
|
// $financeTeamStatusData = $this->data_construct_for_bds($financeTeamData);
|
||||||
|
|
||||||
$groupedData = [];
|
|
||||||
|
|
||||||
foreach ($results as $row) {
|
|
||||||
$clientId = $row['client_id'];
|
|
||||||
$clientName = $row['client_name'];
|
|
||||||
$shortName = $row['short_name'];
|
|
||||||
$branchId = $row['client_branch_id'];
|
|
||||||
$branchName = $row['branch_name'];
|
|
||||||
$branchCode = $row['branch_code'];
|
|
||||||
|
|
||||||
$clientPolicyId = $row['client_policy_id'];
|
|
||||||
$policyTypeId = $row['policy_type_id'];
|
|
||||||
$employeeId = '';
|
|
||||||
if ($employeeId != $row['employee_id']) {
|
|
||||||
$employeeId = $row['employee_id'];
|
|
||||||
} else {
|
|
||||||
$employeeId = null;
|
|
||||||
}
|
|
||||||
$employeeName = $row['employee_name'];
|
|
||||||
$employeeRelationship = $row['relationship'];
|
|
||||||
$employeeEmpCode = $row['emp_code'];
|
|
||||||
$employeeEmpStatus = $row['emp_status'];
|
|
||||||
$employeeUserType = $row['user_type'];
|
|
||||||
|
|
||||||
// Initialize the client entry if it doesn't exist
|
|
||||||
if (!isset($groupedData[$clientId])) {
|
|
||||||
$groupedData[$clientId] = [
|
|
||||||
'client_id' => $clientId,
|
|
||||||
'client_name' => $clientName,
|
|
||||||
'short_name' => $shortName,
|
|
||||||
'branches' => []
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize the branch entry if it doesn't exist
|
|
||||||
if (!isset($groupedData[$clientId]['branches'][$branchId])) {
|
|
||||||
$groupedData[$clientId]['branches'][$branchId] = [
|
|
||||||
'client_branch_id' => $branchId,
|
|
||||||
'branch_name' => $branchName,
|
|
||||||
'branch_code' => $branchCode,
|
|
||||||
'emp_login' => 0,
|
|
||||||
'emp_enroll' => 0,
|
|
||||||
'client_policies' => [],
|
|
||||||
'employees' => []
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add the client policy to the branch's policies list if it exists, not already added, and policyTypeId is not equal to 1
|
|
||||||
if ($clientPolicyId !== null && $policyTypeId != 1 && !in_array(['client_policy_id' => $clientPolicyId, 'policy_type_id' => $policyTypeId], $groupedData[$clientId]['branches'][$branchId]['client_policies'])) {
|
|
||||||
$groupedData[$clientId]['branches'][$branchId]['client_policies'][] = [
|
|
||||||
'client_policy_id' => $clientPolicyId,
|
|
||||||
'policy_type_id' => $policyTypeId
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Append employee error to the branch's employees list if relationship is 'Self' and not already added
|
|
||||||
$employeeKey = $employeeId . '-' . $employeeName; // unique key to identify an employee
|
|
||||||
if ($employeeId !== null && $employeeRelationship == 'Self' && !isset($groupedData[$clientId]['branches'][$branchId]['employees'][$employeeKey])) {
|
|
||||||
$groupedData[$clientId]['branches'][$branchId]['employees'][$employeeKey] = [
|
|
||||||
'employee_id' => $employeeId,
|
|
||||||
'employee_name' => $employeeName,
|
|
||||||
'relationship' => $employeeRelationship,
|
|
||||||
'emp_code' => $employeeEmpCode,
|
|
||||||
'emp_status' => $employeeEmpStatus,
|
|
||||||
'user_type' => $employeeUserType
|
|
||||||
];
|
|
||||||
if (!empty($employeeUserType)) {
|
|
||||||
$groupedData[$clientId]['branches'][$branchId]['emp_login']++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Increment emp_enroll if emp_status is not 'draft'
|
|
||||||
if ($employeeEmpStatus !== 'draft') {
|
|
||||||
$groupedData[$clientId]['branches'][$branchId]['emp_enroll']++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Re-index the arrays to match the expected structure
|
|
||||||
foreach ($groupedData as &$client) {
|
|
||||||
foreach ($client['branches'] as &$branch) {
|
|
||||||
$branch['employees'] = array_values($branch['employees']);
|
|
||||||
}
|
|
||||||
$client['branches'] = array_values($client['branches']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$data['client_branch_emp_list'] = $groupedData;
|
|
||||||
$session = \Config\Services::session();
|
|
||||||
$session->set('enrollment_data', json_encode($data));
|
|
||||||
// echo "<pre>";
|
|
||||||
// $data['pendingActionsData'] = $pendingActionsData;
|
// $data['pendingActionsData'] = $pendingActionsData;
|
||||||
// $data['businessTeamCount'] = count($businessTeamData) ?? 0;
|
// $data['businessTeamCount'] = count($businessTeamData) ?? 0;
|
||||||
// $data['financeTeamCount'] = count($financeTeamData) ?? 0;
|
// $data['financeTeamCount'] = count($financeTeamData) ?? 0;
|
||||||
@ -214,9 +166,8 @@ class DashboardController extends AdminController
|
|||||||
// $data['financeTeamStatusData'] = $financeTeamStatusData;
|
// $data['financeTeamStatusData'] = $financeTeamStatusData;
|
||||||
// $data['policyStatus'] = $this->policyStatus;
|
// $data['policyStatus'] = $this->policyStatus;
|
||||||
// $data['colorShades'] = $this->colorShades;
|
// $data['colorShades'] = $this->colorShades;
|
||||||
// dd($data);die;
|
|
||||||
|
|
||||||
$data['page_name'] = 'Dashboard';
|
// dd($data);
|
||||||
|
|
||||||
echo view('layout/header', $data);
|
echo view('layout/header', $data);
|
||||||
echo view('DashBoard', $data);
|
echo view('DashBoard', $data);
|
||||||
|
|||||||
@ -2199,12 +2199,17 @@ class EmployeeController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//UPDATE EMPLOYEE
|
||||||
public function update_emp_data()
|
public function update_emp_data()
|
||||||
{
|
{
|
||||||
|
helper('utility_helper');
|
||||||
|
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
// print_rr($data);die();
|
// print_rr($data);die();
|
||||||
// $data['dob'] = date('Y-m-d', strtotime($data['dob']));
|
// $data['dob'] = date('Y-m-d', strtotime($data['dob']));
|
||||||
$data['dob'] = change_date_format($data['dob'], 'd/m/Y', 'Y-m-d');
|
if (isset($data['dob'])) {
|
||||||
|
$data['dob'] = change_date_format($data['dob'], null, 'Y-m-d');
|
||||||
|
}
|
||||||
// print_rr($data); die;
|
// print_rr($data); die;
|
||||||
|
|
||||||
// Fetch current employee data
|
// Fetch current employee data
|
||||||
@ -2212,6 +2217,8 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
if ($employee_data['relationship'] == 'Self') {
|
if ($employee_data['relationship'] == 'Self') {
|
||||||
|
|
||||||
|
if (isset($data['gender'])) {
|
||||||
|
|
||||||
if ($employee_data['gender'] != $data['gender']) {
|
if ($employee_data['gender'] != $data['gender']) {
|
||||||
|
|
||||||
$spouse_gender = ($data['gender'] == 'M') ? 'F' : 'M';
|
$spouse_gender = ($data['gender'] == 'M') ? 'F' : 'M';
|
||||||
@ -2222,6 +2229,7 @@ class EmployeeController extends AdminController
|
|||||||
->update();
|
->update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update the employee data
|
// Update the employee data
|
||||||
$result = $this->employeeModel->where('id', $data['employee_primary_id'])->set($data)->update();
|
$result = $this->employeeModel->where('id', $data['employee_primary_id'])->set($data)->update();
|
||||||
|
|||||||
@ -115,33 +115,38 @@ class RestAuthenticationController extends AdminController
|
|||||||
$email = $this->request->getJSON()->email;
|
$email = $this->request->getJSON()->email;
|
||||||
|
|
||||||
|
|
||||||
$employeeData = $this->employeeModel->select('employees.relationship,EP.employee_id')
|
$employeeData = $this->employeeModel->select('
|
||||||
|
employees.relationship,
|
||||||
|
EP.employee_id,
|
||||||
|
employees.client_id,
|
||||||
|
employees.client_branch_id,
|
||||||
|
employees.email_corporate
|
||||||
|
|
||||||
|
')
|
||||||
->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner')
|
->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner')
|
||||||
->where('employees.is_active', 1)
|
->where('employees.is_active', 1)
|
||||||
->where('employees.relationship', 'self')
|
->where('employees.relationship', 'Self')
|
||||||
->where('employees.emp_status !=', 'truncated')
|
->where('employees.emp_status !=', 'truncated')
|
||||||
->where('employees.email_corporate', $email)
|
->where('employees.email_corporate', $email)
|
||||||
->where('EP.is_active', 1)
|
->where('EP.is_active', 1)
|
||||||
->whereIn('EP.status', ['draft', 'enrolled'])
|
->whereIn('EP.status', ['draft', 'enrolled'])
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if (isset($employeeData['employee_id']))
|
if (isset($employeeData['employee_id'])) {
|
||||||
{
|
|
||||||
|
|
||||||
$otp = random_int(100000, 999999);
|
$otp = random_int(100000, 999999);
|
||||||
|
|
||||||
$update = $this->employeeModel->where('email_corporate', $email)->where('relationship', 'self')
|
$update = $this->employeeModel->where('email_corporate', $email)->where('relationship', 'Self')
|
||||||
->where('is_active', 1)->set(array('otp' => $otp))
|
->where('is_active', 1)->set(array('otp' => $otp))
|
||||||
->update();
|
->update();
|
||||||
if($update)
|
if ($update) {
|
||||||
{
|
|
||||||
|
|
||||||
$common = [
|
$common = [
|
||||||
'client_id' => $employeeData['client_id'],
|
'client_id' => $employeeData['client_id'],
|
||||||
'client_branch_id' => $employeeData['client_branch_id'],
|
'client_branch_id' => $employeeData['client_branch_id'],
|
||||||
'client_policy_id' => null,
|
'client_policy_id' => null,
|
||||||
'employee_policy_id' => null,
|
'employee_policy_id' => null,
|
||||||
'employee_id' => $employeeData['id'],
|
'employee_id' => $employeeData['employee_id'],
|
||||||
'mail_type' => 'otp_mail',
|
'mail_type' => 'otp_mail',
|
||||||
];
|
];
|
||||||
$subject = 'Nhance user verification - OTP';
|
$subject = 'Nhance user verification - OTP';
|
||||||
@ -149,24 +154,18 @@ class RestAuthenticationController extends AdminController
|
|||||||
$res = MailHelper::send_email(['mail' => $employeeData['email_corporate'], 'subject' => $subject, 'common' => $common, 'message' => $mail_content]);
|
$res = MailHelper::send_email(['mail' => $employeeData['email_corporate'], 'subject' => $subject, 'common' => $common, 'message' => $mail_content]);
|
||||||
$this->myLogger->logme("info", $res);
|
$this->myLogger->logme("info", $res);
|
||||||
|
|
||||||
if(json_decode($res)->status == 'success')
|
if (json_decode($res)->status == 'success') {
|
||||||
{
|
|
||||||
$result = ['user_verification' => true, 'message' => "Verified Successfully"];
|
$result = ['user_verification' => true, 'message' => "Verified Successfully"];
|
||||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200);
|
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$result = ['user_verification' => false, 'message' => "Mail sending failed , try again"];
|
$result = ['user_verification' => false, 'message' => "Mail sending failed , try again"];
|
||||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$result = ['user_verification' => false, 'message' => "Verification failed , try again"];
|
$result = ['user_verification' => false, 'message' => "Verification failed , try again"];
|
||||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Call the third-party API function
|
// Call the third-party API function
|
||||||
return $this->callThirdPartyAPI($this->request->getJSON(), 'verifyEmployeeEmailId');
|
return $this->callThirdPartyAPI($this->request->getJSON(), 'verifyEmployeeEmailId');
|
||||||
|
|||||||
@ -1124,19 +1124,26 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
}
|
}
|
||||||
$temp_slab_rates = $slab_details[ $slab_index ]['slab_rates'];
|
$temp_slab_rates = $slab_details[ $slab_index ]['slab_rates'];
|
||||||
|
|
||||||
//if curent action is dependent addition OR addition then pull insurer master to set whether add one day from employee date of coverage
|
|
||||||
if($emp_data['temp']['action'] == 'DA' || $emp_data['temp']['action'] == 'A')
|
|
||||||
{
|
|
||||||
$insurer = new InsurerModel();
|
|
||||||
$insurer = ($insurer->find($policy_terms['insurer_id']));
|
|
||||||
if($insurer['addition_add_day'] == true)
|
|
||||||
{
|
|
||||||
// $emp_data['policy_details']['date_coverage'] = (new DateTime($emp_data['policy_details']['date_coverage']))->modify('+1 day')->format('Y-m-d');
|
|
||||||
|
|
||||||
$emp_data['policy_details']['date_coverage'] = isset($emp_data['policy_details']['date_coverage']) && $emp_data['policy_details']['date_coverage'] != '' && $emp_data['policy_details']['date_coverage'] != null ?
|
// ------------"THIS PART HAS NO INSURER IN THE PRE-ENROLL, SO COMMENT OUT THIS PART (04-03-2025)."-------------------------------------------------------------------------------------------------------------------
|
||||||
(new DateTime($emp_data['policy_details']['date_coverage']))->modify('+1 day')->format('Y-m-d') : null ;
|
|
||||||
}
|
// //if curent action is dependent addition OR addition then pull insurer master to set whether add one day from employee date of coverage
|
||||||
}
|
// if($emp_data['temp']['action'] == 'DA' || $emp_data['temp']['action'] == 'A')
|
||||||
|
// {
|
||||||
|
// $insurer = new InsurerModel();
|
||||||
|
// $insurer = ($insurer->find($policy_terms['insurer_id']));
|
||||||
|
// if($insurer['addition_add_day'] == true)
|
||||||
|
// {
|
||||||
|
// // $emp_data['policy_details']['date_coverage'] = (new DateTime($emp_data['policy_details']['date_coverage']))->modify('+1 day')->format('Y-m-d');
|
||||||
|
|
||||||
|
// $emp_data['policy_details']['date_coverage'] = isset($emp_data['policy_details']['date_coverage']) && $emp_data['policy_details']['date_coverage'] != '' && $emp_data['policy_details']['date_coverage'] != null ?
|
||||||
|
// (new DateTime($emp_data['policy_details']['date_coverage']))->modify('+1 day')->format('Y-m-d') : null ;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
// dd($emp_data);
|
// dd($emp_data);
|
||||||
$is_match_found = false;
|
$is_match_found = false;
|
||||||
$gst = isset($policy_terms['gst']) && $policy_terms['gst'] != 0 ? $policy_terms['gst'] : 18;
|
$gst = isset($policy_terms['gst']) && $policy_terms['gst'] != 0 ? $policy_terms['gst'] : 18;
|
||||||
|
|||||||
@ -544,6 +544,10 @@ if (!function_exists('change_date_format')) {
|
|||||||
'Y/m/d', // 2024/12/01
|
'Y/m/d', // 2024/12/01
|
||||||
'Y.m.d', // 2024.12.01
|
'Y.m.d', // 2024.12.01
|
||||||
'Y,m,d', // 2024,12,01
|
'Y,m,d', // 2024,12,01
|
||||||
|
|
||||||
|
'd/m/Y', // 01/01/2025
|
||||||
|
'd-m-Y', // 01-01-2025
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
<div class="tab-pane active show" id="pending-actions-dash-tab" style="/*padding-left: 35px;*/padding-right: 35px;">
|
<div class="tab-pane active show" id="pending-actions-dash-tab" style="/*padding-left: 35px;*/padding-right: 35px;">
|
||||||
<div class="row visa_status_count_view">
|
<div class="row visa_status_count_view">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card" style="border: 0px;height: 470px;">
|
<div class="card" style="border: 0px;height: 470px;">
|
||||||
<div class="card-body status-option" id="statusContent" style="padding: 0.5rem !important;background-color: white;">
|
<div class="card-body status-option" id="statusContent"
|
||||||
|
style="padding: 0.5rem !important;background-color: white;">
|
||||||
<!-- Search Input Field -->
|
<!-- Search Input Field -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
@ -14,7 +14,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-5"></div>
|
<div class="col-5"></div>
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<input type="text" id="searchInput" class="search-input" placeholder="Search by client or branch">
|
<input type="text" id="searchInput" class="search-input"
|
||||||
|
placeholder="Search by client or branch">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Carousel Structure -->
|
<!-- Carousel Structure -->
|
||||||
@ -25,23 +26,28 @@
|
|||||||
$currentItem = 0; // Counter for items
|
$currentItem = 0; // Counter for items
|
||||||
$isActive = true; // Variable to set the first item as active
|
$isActive = true; // Variable to set the first item as active
|
||||||
foreach ($client_branch_emp_list as $clients) {
|
foreach ($client_branch_emp_list as $clients) {
|
||||||
foreach ($clients['branches'] as $branches) {
|
|
||||||
// Start a new carousel item if needed
|
// Start a new carousel item if needed
|
||||||
if ($currentItem % $itemsPerSlide == 0) {
|
if ($currentItem % $itemsPerSlide == 0) {
|
||||||
if (!$isActive) echo '</div>'; // Close previous carousel item
|
if (!$isActive) echo '</div>'; // Close previous carousel item
|
||||||
echo '<div class="carousel-item' . ($isActive ? ' active' : '') . '">';
|
echo '<div class="carousel-item' . ($isActive ? ' active' : '') . '">';
|
||||||
$isActive = false;
|
$isActive = false;
|
||||||
}
|
}
|
||||||
if(count($branches['client_policies']) != 0){ ?>
|
?>
|
||||||
<!-- New Card Layout for each item -->
|
<!-- New Card Layout for each item -->
|
||||||
<div class="col-xl-3 col-md-6 d-inline-block scroll-item carousel-slide-item" data-client="<?php echo $clients['short_name']; ?>" data-branch="<?php echo $branches['branch_name']; ?>">
|
<div class="col-xl-3 col-md-6 d-inline-block scroll-item carousel-slide-item"
|
||||||
|
data-client="<?php echo $clients['short_name']; ?>"
|
||||||
|
data-branch="<?php echo $clients['branch_name']; ?>">
|
||||||
<div class="card" style="box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);">
|
<div class="card" style="box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);">
|
||||||
<div class="card-header add_card_background_random">
|
<div class="card-header add_card_background_random">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8 emp-count-view-click">
|
<div class="col-8 emp-count-view-click">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="w-100 ">
|
<div class="w-100 ">
|
||||||
<h3 class="my-2 py-1" ><span data-plugin="counterup" style="font-size: 2.0rem;background-color: white;border-radius: 6px;height: 30;padding: 4px 11px 4px 11px;" onclick="enrollment_list(this, 'emp_count_view_click')"><?php echo isset($branches['employees']) ? count($branches['employees']) : '0'; ?></span></h3>
|
<h3 class="my-2 py-1"><span data-plugin="counterup"
|
||||||
|
style="font-size: 2.0rem;background-color: white;border-radius: 6px;height: 30;padding: 4px 11px 4px 11px;"
|
||||||
|
onclick="enrollment_list(this, 'emp_count_view_click')"><?php echo isset($clients['total_employees']) ? $clients['total_employees'] : '0'; ?></span>
|
||||||
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -50,7 +56,12 @@
|
|||||||
<div class="col-12 emp-count-view-click">
|
<div class="col-12 emp-count-view-click">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="w-100">
|
<div class="w-100">
|
||||||
<h5 class="mt-0 text-truncate" title="Branch Info" style="font-weight: 400 !important;font-size: 20px !important;line-height: 36px;color: black !important;"><?php echo isset($clients['short_name']) ? $clients['short_name'] : 'N/A'; ?> - <?php echo isset($branches['branch_name']) ? $branches['branch_name'] : 'N/A'; ?></h5>
|
<h5 class="mt-0 text-truncate" title="Branch Info"
|
||||||
|
style="font-weight: 400 !important;font-size: 20px !important;line-height: 36px;color: black !important;">
|
||||||
|
<?php echo isset($clients['short_name']) ? $clients['short_name'] : 'N/A'; ?>
|
||||||
|
-
|
||||||
|
<?php echo isset($clients['branch_name']) ? $clients['branch_name'] : 'N/A'; ?>
|
||||||
|
</h5>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -67,26 +78,41 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<input type="text" class="client_id" value="<?php echo $clients['client_id']; ?>" hidden>
|
<input type="text" class="client_id"
|
||||||
<input type="text" class="client_branch_id" value="<?php echo $branches['client_branch_id'] ?>" hidden>
|
value="<?php echo $clients['client_id']; ?>" hidden>
|
||||||
|
<input type="text" class="client_branch_id"
|
||||||
|
value="<?php echo $clients['client_branch_id'] ?>" hidden>
|
||||||
<div class="row emp-status" style="margin-top: -9px;">
|
<div class="row emp-status" style="margin-top: -9px;">
|
||||||
<div class="col-6 emp-count-view-click">
|
<div class="col-6 emp-count-view-click">
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_logged_in_view_click')"><?php echo isset($branches['emp_login']) ? $branches['emp_login'] : '0'; ?></span><br>
|
<span style="font-size: large;color: black !important;"
|
||||||
<span class="text-nowrap " style="color: currentColor;font-size: 15px;">Logged-In</span>
|
class="number_css"
|
||||||
|
onclick="enrollment_list(this, 'emp_logged_in_view_click')"><?php echo isset($clients['logged_in_count']) ? $clients['logged_in_count'] : '0'; ?></span><br>
|
||||||
|
<span class="text-nowrap "
|
||||||
|
style="color: currentColor;font-size: 15px;">Logged-In</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 emp-count-view-click">
|
<div class="col-6 emp-count-view-click">
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_logged_in_view_click')"><?php echo isset($branches['emp_login']) ? count($branches['employees']) - $branches['emp_login'] : '0'; ?></span><br>
|
<span style="font-size: large;color: black !important;"
|
||||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;margin-left: -13px;">Not Logged-In</span>
|
class="number_css"
|
||||||
|
onclick="enrollment_list(this, 'emp_not_logged_in_view_click')"><?php echo isset($clients['not_logged_in_count']) ? $clients['not_logged_in_count'] : '0'; ?></span><br>
|
||||||
|
<span class="text-nowrap"
|
||||||
|
style="color: currentColor;font-size: 15px;margin-left: -13px;">Not
|
||||||
|
Logged-In</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row emp-status" style="margin-top: 5px;">
|
<div class="row emp-status" style="margin-top: 5px;">
|
||||||
<div class="col-6 emp-count-view-click">
|
<div class="col-6 emp-count-view-click">
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_enrolled_view_click')"><?php echo isset($branches['emp_enroll']) ? count($branches['employees']) - $branches['emp_enroll'] : '0'; ?></span><br>
|
<span style="font-size: large;color: black !important;"
|
||||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Draft</span>
|
class="number_css"
|
||||||
|
onclick="enrollment_list(this, 'emp_not_enrolled_view_click')"><?php echo isset($clients['draft_count']) ? $clients['draft_count'] : '0'; ?></span><br>
|
||||||
|
<span class="text-nowrap"
|
||||||
|
style="color: currentColor;font-size: 15px;">Draft</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 emp-count-view-click">
|
<div class="col-6 emp-count-view-click">
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_enrolled_view_click')"><?php echo isset($branches['emp_enroll']) ? $branches['emp_enroll'] : '0'; ?></span><br>
|
<span style="font-size: large;color: black !important;"
|
||||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Enrolled</span>
|
class="number_css"
|
||||||
|
onclick="enrollment_list(this, 'emp_enrolled_view_click')"><?php echo isset($clients['enrolled_count']) ? $clients['enrolled_count'] : '0'; ?></span><br>
|
||||||
|
<span class="text-nowrap"
|
||||||
|
style="color: currentColor;font-size: 15px;">Enrolled</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -94,20 +120,31 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
$currentItem++;
|
$currentItem++;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($currentItem % $itemsPerSlide != 0) echo '</div>'; // Close the last carousel item
|
if ($currentItem % $itemsPerSlide != 0) echo '</div>'; // Close the last carousel item
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
|
<a class="carousel-control-prev" href="#carouselExampleControls" role="button"
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" style="width: 28px;"><!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z"/></svg> <!-- <img src="<?php echo base_url()?>public/assets/images/left_arrow.png" alt="<"> -->
|
data-slide="prev">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" style="width: 28px;">
|
||||||
|
<!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.-->
|
||||||
|
<path
|
||||||
|
d="M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z" />
|
||||||
|
</svg>
|
||||||
|
<!-- <img src="<?php echo base_url() ?>public/assets/images/left_arrow.png" alt="<"> -->
|
||||||
<!-- <span class="carousel-control-prev-icon" aria-hidden="true"></span> -->
|
<!-- <span class="carousel-control-prev-icon" aria-hidden="true"></span> -->
|
||||||
<span class="sr-only">Previous</span>
|
<span class="sr-only">Previous</span>
|
||||||
</a>
|
</a>
|
||||||
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
|
<a class="carousel-control-next" href="#carouselExampleControls" role="button"
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" style="width: 28px;"><!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M278.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-160 160c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L210.7 256 73.4 118.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l160 160z"/></svg>
|
data-slide="next">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" style="width: 28px;">
|
||||||
|
<!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.-->
|
||||||
|
<path
|
||||||
|
d="M278.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-160 160c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L210.7 256 73.4 118.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l160 160z" />
|
||||||
|
</svg>
|
||||||
<!-- <span class="carousel-control-next-icon" aria-hidden="true"></span> -->
|
<!-- <span class="carousel-control-next-icon" aria-hidden="true"></span> -->
|
||||||
<span class="sr-only">Next</span>
|
<span class="sr-only">Next</span>
|
||||||
</a>
|
</a>
|
||||||
@ -119,6 +156,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var lastDirection = ''; // Variable to keep track of the last direction
|
var lastDirection = ''; // Variable to keep track of the last direction
|
||||||
|
|
||||||
@ -226,6 +264,69 @@ $(document).ready(function() {
|
|||||||
checkEmptyCarouselItem();
|
checkEmptyCarouselItem();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
random_color_set();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#enrollment_status_open_close').change(function() {
|
||||||
|
|
||||||
|
if ($(this).val() === 'open') {
|
||||||
|
|
||||||
|
var enrollment_data = '<?php echo addslashes(json_encode($client_branch_emp_list, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT)); ?>';
|
||||||
|
|
||||||
|
console.log('Raw enrollment_data:', enrollment_data);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Ensure enrollment_data is not empty or invalid
|
||||||
|
if (!enrollment_data || enrollment_data === 'null' || enrollment_data === '""') {
|
||||||
|
throw new Error('Invalid JSON data received.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse JSON data
|
||||||
|
var data = JSON.parse(enrollment_data);
|
||||||
|
console.log('Parsed data:', data);
|
||||||
|
|
||||||
|
// Ensure parsed data is always treated as an array
|
||||||
|
if (!Array.isArray(data)) {
|
||||||
|
data = data && typeof data === 'object' ? [data] : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Final client_branch_emp_list:', data);
|
||||||
|
updateCarouselWithData(data, 1);
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error parsing JSON:', error.message, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Fetch the session data from PHP
|
||||||
|
var enrollment_data = '<?php echo addslashes(json_encode($client_branch_emp_list, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT)); ?>';
|
||||||
|
console.log('Raw enrollment_data:', enrollment_data);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Ensure enrollment_data is valid before parsing
|
||||||
|
if (!enrollment_data || enrollment_data === 'null' || enrollment_data === '""') {
|
||||||
|
throw new Error('Invalid JSON data received.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse JSON data
|
||||||
|
var data = JSON.parse(enrollment_data);
|
||||||
|
console.log('Parsed data:', data);
|
||||||
|
|
||||||
|
// Ensure `data` is always an array
|
||||||
|
data = Array.isArray(data) ? data : (data && typeof data === 'object' ? [data] : []);
|
||||||
|
|
||||||
|
console.log('Final client_branch_emp_list:', data);
|
||||||
|
updateCarouselWithData(data, 2);
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error parsing JSON:', error.message, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
function enrollment_list(current_element, type) {
|
function enrollment_list(current_element, type) {
|
||||||
var clientId = $(current_element).closest('.carousel-slide-item').find('.client_id').val();
|
var clientId = $(current_element).closest('.carousel-slide-item').find('.client_id').val();
|
||||||
@ -244,79 +345,6 @@ function enrollment_list(current_element, type) {
|
|||||||
window.location.href = `${url}?${params.toString()}`;
|
window.location.href = `${url}?${params.toString()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#enrollment_status_open_close').change(function () {
|
|
||||||
if ($(this).val() === 'open') {
|
|
||||||
var enrollment_data = '<?php echo addslashes($_SESSION['enrollment_data']); ?>';
|
|
||||||
try {
|
|
||||||
// Parse JSON data
|
|
||||||
var data = JSON.parse(enrollment_data);
|
|
||||||
console.log('Parsed data:', data);
|
|
||||||
|
|
||||||
// Ensure data is an object and client_branch_emp_list is treated as an array
|
|
||||||
if (data && typeof data === 'object') {
|
|
||||||
if (Array.isArray(data.client_branch_emp_list)) {
|
|
||||||
console.log('client_branch_emp_list:', data.client_branch_emp_list);
|
|
||||||
updateCarouselWithData(data, 1);
|
|
||||||
} else {
|
|
||||||
// Convert client_branch_emp_list to an array if it's not already
|
|
||||||
if (data.client_branch_emp_list && typeof data.client_branch_emp_list === 'object') {
|
|
||||||
// If it's an object but not an array, wrap it in an array
|
|
||||||
data.client_branch_emp_list = [data.client_branch_emp_list];
|
|
||||||
} else {
|
|
||||||
// Handle the case where it's neither an array nor an object
|
|
||||||
console.error('client_branch_emp_list is not an array or object:', data.client_branch_emp_list);
|
|
||||||
data.client_branch_emp_list = []; // Ensure it is at least an empty array
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('Converted client_branch_emp_list:', data.client_branch_emp_list);
|
|
||||||
updateCarouselWithData(data, 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.error('Parsed data is not an object:', data);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Error parsing JSON:', e);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Fetch the session data from PHP
|
|
||||||
var enrollment_data = '<?php echo addslashes($_SESSION['enrollment_data']); ?>';
|
|
||||||
try {
|
|
||||||
// Parse JSON data
|
|
||||||
var data = JSON.parse(enrollment_data);
|
|
||||||
console.log('Parsed data:', data);
|
|
||||||
|
|
||||||
// Ensure data is an object and client_branch_emp_list is treated as an array
|
|
||||||
if (data && typeof data === 'object') {
|
|
||||||
if (Array.isArray(data.client_branch_emp_list)) {
|
|
||||||
console.log('client_branch_emp_list:', data.client_branch_emp_list);
|
|
||||||
updateCarouselWithData(data, 2);
|
|
||||||
} else {
|
|
||||||
// Convert client_branch_emp_list to an array if it's not already
|
|
||||||
if (data.client_branch_emp_list && typeof data.client_branch_emp_list === 'object') {
|
|
||||||
// If it's an object but not an array, wrap it in an array
|
|
||||||
data.client_branch_emp_list = [data.client_branch_emp_list];
|
|
||||||
} else {
|
|
||||||
// Handle the case where it's neither an array nor an object
|
|
||||||
console.error('client_branch_emp_list is not an array or object:', data.client_branch_emp_list);
|
|
||||||
data.client_branch_emp_list = []; // Ensure it is at least an empty array
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('Converted client_branch_emp_list:', data.client_branch_emp_list);
|
|
||||||
updateCarouselWithData(data, 2);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.error('Parsed data is not an object:', data);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Error parsing JSON:', e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function updateCarouselWithData(data, open_close) {
|
function updateCarouselWithData(data, open_close) {
|
||||||
var itemsPerSlide = 3; // Number of items per slide
|
var itemsPerSlide = 3; // Number of items per slide
|
||||||
var currentItem = 0; // Counter for items
|
var currentItem = 0; // Counter for items
|
||||||
@ -327,10 +355,11 @@ function updateCarouselWithData(data, open_close) {
|
|||||||
carouselInner.empty();
|
carouselInner.empty();
|
||||||
|
|
||||||
// Check if data.client_branch_emp_list is valid
|
// Check if data.client_branch_emp_list is valid
|
||||||
if (Array.isArray(data.client_branch_emp_list) && data.client_branch_emp_list.length > 0) {
|
if (Array.isArray(data) && data.length > 0) {
|
||||||
console.log("Processing array...");
|
|
||||||
|
console.log("Processing array........................................");
|
||||||
// Handle the case where data.client_branch_emp_list is an array
|
// Handle the case where data.client_branch_emp_list is an array
|
||||||
var items = data.client_branch_emp_list[0];
|
var items = data[0];
|
||||||
console.log("Items data:", items);
|
console.log("Items data:", items);
|
||||||
|
|
||||||
// Convert items object to an array
|
// Convert items object to an array
|
||||||
@ -338,17 +367,15 @@ function updateCarouselWithData(data, open_close) {
|
|||||||
|
|
||||||
// Validate if client_list is an array
|
// Validate if client_list is an array
|
||||||
if (Array.isArray(client_list)) {
|
if (Array.isArray(client_list)) {
|
||||||
|
|
||||||
console.log(client_list);
|
console.log(client_list);
|
||||||
for (var i = 0; i < client_list.length; i++) {
|
|
||||||
var client = client_list[i];
|
|
||||||
// console.log(item.branches);
|
|
||||||
var branch_list = client.branches;
|
|
||||||
for (var j = 0; j < branch_list.length; j++) {
|
|
||||||
var branch = branch_list[j];
|
|
||||||
console.log(branch);
|
|
||||||
|
|
||||||
if(open_close == 1){
|
for (var i = 0; i < data.length; i++) {
|
||||||
if(branch.client_policies.length > 0){
|
|
||||||
|
let client = data[i];
|
||||||
|
|
||||||
|
if (open_close == 1 && client.open_or_close_enrollment == 1) {
|
||||||
|
|
||||||
if (currentItem % itemsPerSlide === 0) {
|
if (currentItem % itemsPerSlide === 0) {
|
||||||
if (!isActive) carouselInner.append('</div>'); // Close previous carousel item
|
if (!isActive) carouselInner.append('</div>'); // Close previous carousel item
|
||||||
carouselInner.append('<div class="carousel-item' + (isActive ? ' active' : '') + '">');
|
carouselInner.append('<div class="carousel-item' + (isActive ? ' active' : '') + '">');
|
||||||
@ -356,14 +383,14 @@ function updateCarouselWithData(data, open_close) {
|
|||||||
}
|
}
|
||||||
// Generate HTML for each item
|
// Generate HTML for each item
|
||||||
var itemHtml = `
|
var itemHtml = `
|
||||||
<div class="col-xl-3 col-md-6 d-inline-block scroll-item carousel-slide-item" data-client="${client.short_name}" data-branch="${branch.branch_name }">
|
<div class="col-xl-3 col-md-6 d-inline-block scroll-item carousel-slide-item" data-client="${client.short_name}" data-branch="${client.branch_name }">
|
||||||
<div class="card" style="box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);">
|
<div class="card" style="box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);">
|
||||||
<div class="card-header add_card_background_random" >
|
<div class="card-header add_card_background_random" >
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8 emp-count-view-click" >
|
<div class="col-8 emp-count-view-click" >
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="w-100 " >
|
<div class="w-100 " >
|
||||||
<h3 class="my-2 py-1" ><span data-plugin="counterup" style="font-size: 2.0rem;background-color: white;border-radius: 6px;height: 30;padding: 4px 11px 4px 11px;" onclick="enrollment_list(this, 'emp_count_view_click')">${branch.employees.length}</span></h3>
|
<h3 class="my-2 py-1" ><span data-plugin="counterup" style="font-size: 2.0rem;background-color: white;border-radius: 6px;height: 30;padding: 4px 11px 4px 11px;" onclick="enrollment_list(this, 'emp_count_view_click')">${client.total_employees}</span></h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -372,7 +399,7 @@ function updateCarouselWithData(data, open_close) {
|
|||||||
<div class="col-12 emp-count-view-click" >
|
<div class="col-12 emp-count-view-click" >
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="w-100" >
|
<div class="w-100" >
|
||||||
<h5 class="mt-0 text-truncate" title="Branch Info" style="font-weight: 400 !important;font-size: 20px !important;line-height: 36px;color: black !important;">${client.short_name} - ${branch.branch_name} </h5>
|
<h5 class="mt-0 text-truncate" title="Branch Info" style="font-weight: 400 !important;font-size: 20px !important;line-height: 36px;color: black !important;">${client.short_name} - ${client.branch_name} </h5>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -390,24 +417,24 @@ function updateCarouselWithData(data, open_close) {
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-body" >
|
<div class="card-body" >
|
||||||
<input type="text" class="client_id" value="${client.client_id}" hidden>
|
<input type="text" class="client_id" value="${client.client_id}" hidden>
|
||||||
<input type="text" class="client_branch_id" value="${branch.client_branch_id}" hidden>
|
<input type="text" class="client_branch_id" value="${client.client_branch_id}" hidden>
|
||||||
<div class="row emp-status" style="margin-top: -9px;">
|
<div class="row emp-status" style="margin-top: -9px;">
|
||||||
<div class="col-6 emp-count-view-click" >
|
<div class="col-6 emp-count-view-click" >
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_logged_in_view_click')">${branch.emp_login}</span><br>
|
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_logged_in_view_click')">${client.logged_in_count ?? 0}</span><br>
|
||||||
<span class="text-nowrap " style="color: currentColor;font-size: 15px;">Logged-In</span>
|
<span class="text-nowrap " style="color: currentColor;font-size: 15px;">Logged-In</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 emp-count-view-click" >
|
<div class="col-6 emp-count-view-click" >
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_logged_in_view_click')"> ${branch.employees.length - (branch.emp_login || 0)}</span><br>
|
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_logged_in_view_click')"> ${client.not_logged_in_count ?? 0}</span><br>
|
||||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;margin-left: -13px;">Not Logged-In</span>
|
<span class="text-nowrap" style="color: currentColor;font-size: 15px;margin-left: -13px;">Not Logged-In</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row emp-status" style="margin-top: 5px;">
|
<div class="row emp-status" style="margin-top: 5px;">
|
||||||
<div class="col-6 emp-count-view-click" >
|
<div class="col-6 emp-count-view-click" >
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_enrolled_view_click')">${branch.employees.length - (branch.emp_enroll || 0)}</span><br>
|
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_enrolled_view_click')">${client.draft_count ?? 0}</span><br>
|
||||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Draft</span>
|
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Draft</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 emp-count-view-click" >
|
<div class="col-6 emp-count-view-click" >
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_enrolled_view_click')">${(branch.emp_enroll || 0)}</span><br>
|
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_enrolled_view_click')">${(client.enrolled_count ?? 0)}</span><br>
|
||||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Enrolled</span>
|
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Enrolled</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -418,9 +445,9 @@ function updateCarouselWithData(data, open_close) {
|
|||||||
|
|
||||||
carouselInner.find('.carousel-item').last().append(itemHtml);
|
carouselInner.find('.carousel-item').last().append(itemHtml);
|
||||||
currentItem++;
|
currentItem++;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if(branch.client_policies.length == 0){
|
|
||||||
if (currentItem % itemsPerSlide === 0) {
|
if (currentItem % itemsPerSlide === 0) {
|
||||||
if (!isActive) carouselInner.append('</div>'); // Close previous carousel item
|
if (!isActive) carouselInner.append('</div>'); // Close previous carousel item
|
||||||
carouselInner.append('<div class="carousel-item' + (isActive ? ' active' : '') + '">');
|
carouselInner.append('<div class="carousel-item' + (isActive ? ' active' : '') + '">');
|
||||||
@ -428,14 +455,14 @@ function updateCarouselWithData(data, open_close) {
|
|||||||
}
|
}
|
||||||
// Generate HTML for each item
|
// Generate HTML for each item
|
||||||
var itemHtml = `
|
var itemHtml = `
|
||||||
<div class="col-xl-3 col-md-6 d-inline-block scroll-item carousel-slide-item" data-client="${client.short_name}" data-branch="${branch.branch_name }">
|
<div class="col-xl-3 col-md-6 d-inline-block scroll-item carousel-slide-item" data-client="${client.short_name}" data-branch="${client.branch_name }">
|
||||||
<div class="card" style="box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);">
|
<div class="card" style="box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);">
|
||||||
<div class="card-header add_card_background_random" >
|
<div class="card-header add_card_background_random" >
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8 emp-count-view-click" >
|
<div class="col-8 emp-count-view-click" >
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="w-100 " >
|
<div class="w-100 " >
|
||||||
<h3 class="my-2 py-1" ><span data-plugin="counterup" style="font-size: 2.0rem;background-color: white;border-radius: 6px;height: 30;padding: 4px 11px 4px 11px;" onclick="enrollment_list(this, 'emp_count_view_click')">${branch.employees.length}</span></h3>
|
<h3 class="my-2 py-1" ><span data-plugin="counterup" style="font-size: 2.0rem;background-color: white;border-radius: 6px;height: 30;padding: 4px 11px 4px 11px;" onclick="enrollment_list(this, 'emp_count_view_click')">${client.total_employees}</span></h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -444,7 +471,7 @@ function updateCarouselWithData(data, open_close) {
|
|||||||
<div class="col-12 emp-count-view-click" >
|
<div class="col-12 emp-count-view-click" >
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="w-100" >
|
<div class="w-100" >
|
||||||
<h5 class="mt-0 text-truncate" title="Branch Info" style="font-weight: 400 !important;font-size: 20px !important;line-height: 36px;color: black !important;">${client.short_name} - ${branch.branch_name} </h5>
|
<h5 class="mt-0 text-truncate" title="Branch Info" style="font-weight: 400 !important;font-size: 20px !important;line-height: 36px;color: black !important;">${client.short_name} - ${client.branch_name} </h5>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -462,24 +489,24 @@ function updateCarouselWithData(data, open_close) {
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-body" >
|
<div class="card-body" >
|
||||||
<input type="text" class="client_id" value="${client.client_id}" hidden>
|
<input type="text" class="client_id" value="${client.client_id}" hidden>
|
||||||
<input type="text" class="client_branch_id" value="${branch.client_branch_id}" hidden>
|
<input type="text" class="client_branch_id" value="${client.client_branch_id}" hidden>
|
||||||
<div class="row emp-status" style="margin-top: -9px;">
|
<div class="row emp-status" style="margin-top: -9px;">
|
||||||
<div class="col-6 emp-count-view-click" >
|
<div class="col-6 emp-count-view-click" >
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_logged_in_view_click')">${branch.emp_login}</span><br>
|
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_logged_in_view_click')">${client.logged_in_count}</span><br>
|
||||||
<span class="text-nowrap " style="color: currentColor;font-size: 15px;">Logged-In</span>
|
<span class="text-nowrap " style="color: currentColor;font-size: 15px;">Logged-In</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 emp-count-view-click" >
|
<div class="col-6 emp-count-view-click" >
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_logged_in_view_click')"> ${branch.employees.length - (branch.emp_login || 0)}</span><br>
|
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_logged_in_view_click')"> ${client.not_logged_in_count ?? 0}</span><br>
|
||||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;margin-left: -13px;">Not Logged-In</span>
|
<span class="text-nowrap" style="color: currentColor;font-size: 15px;margin-left: -13px;">Not Logged-In</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row emp-status" style="margin-top: 5px;">
|
<div class="row emp-status" style="margin-top: 5px;">
|
||||||
<div class="col-6 emp-count-view-click" >
|
<div class="col-6 emp-count-view-click" >
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_enrolled_view_click')">${branch.employees.length - (branch.emp_enroll || 0)}</span><br>
|
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_enrolled_view_click')">${client.draft_count ?? 0}</span><br>
|
||||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Draft</span>
|
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Draft</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 emp-count-view-click" >
|
<div class="col-6 emp-count-view-click" >
|
||||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_enrolled_view_click')">${(branch.emp_enroll || 0)}</span><br>
|
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_enrolled_view_click')">${(client.enrolled_count ?? 0)}</span><br>
|
||||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Enrolled</span>
|
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Enrolled</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -490,35 +517,28 @@ function updateCarouselWithData(data, open_close) {
|
|||||||
|
|
||||||
carouselInner.find('.carousel-item').last().append(itemHtml);
|
carouselInner.find('.carousel-item').last().append(itemHtml);
|
||||||
currentItem++;
|
currentItem++;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
// Create a new carousel item every `itemsPerSlide` items
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the last carousel item if it was opened
|
// Close the last carousel item if it was opened
|
||||||
if (currentItem % itemsPerSlide !== 0) carouselInner.append('</div>');
|
if (currentItem % itemsPerSlide !== 0) carouselInner.append('</div>');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.error('Expected an array for items, but got:', client_list);
|
console.error('Expected an array for items, but got:', client_list);
|
||||||
}
|
}
|
||||||
} else if (typeof data.client_branch_emp_list === 'object') {
|
|
||||||
console.error('client_branch_emp_list is an object, not an array:', data.client_branch_emp_list);
|
} else if (typeof data === 'object') {
|
||||||
|
console.error('client_branch_emp_list is an object, not an array:', data);
|
||||||
} else {
|
} else {
|
||||||
console.error('client_branch_emp_list is missing or not in the expected format:', data.client_branch_emp_list);
|
console.error('client_branch_emp_list is missing or not in the expected format:', data);
|
||||||
}
|
}
|
||||||
random_color_set();
|
random_color_set();
|
||||||
|
|
||||||
// Initialize or refresh carousel if needed
|
// Initialize or refresh carousel if needed
|
||||||
$('#carouselExampleControls').carousel('dispose').carousel();
|
$('#carouselExampleControls').carousel('dispose'); // Properly dispose of the instance
|
||||||
}
|
$('#carouselExampleControls').carousel(); // Reinitialize it
|
||||||
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
random_color_set();
|
|
||||||
});
|
|
||||||
|
|
||||||
function remove_empty_carousel() {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -75,8 +75,10 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div id="policyGPATermsForm" style="display:none">
|
<div id="policyGPATermsForm" style="display:none">
|
||||||
<span id="policyGPATermsClose" style="float: right;font-size: 26px;color: red;margin-top: -42px;margin-left: 3px;margin-right: 7px;">x</span>
|
<span id="policyGPATermsClose"
|
||||||
<h5><label for="gpaTerms" style="margin-bottom: 20px;">Policy Terms <span id="nameOfThePolicyInGPA"></span></label></h5>
|
style="float: right;font-size: 26px;color: red;margin-top: -42px;margin-left: 3px;margin-right: 7px;">x</span>
|
||||||
|
<h5><label for="gpaTerms" style="margin-bottom: 20px;">Policy Terms <span id="nameOfThePolicyInGPA"></span></label>
|
||||||
|
</h5>
|
||||||
<form role="form" class="parsley-examples" method="post" id="policyGPATerms" enctype="multipart/form-data">
|
<form role="form" class="parsley-examples" method="post" id="policyGPATerms" enctype="multipart/form-data">
|
||||||
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||||
<input type="hidden" name="client_id" id="Client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
<input type="hidden" name="client_id" id="Client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
||||||
@ -91,7 +93,9 @@
|
|||||||
<label for="sumInsured">Sum Insured</label>
|
<label for="sumInsured">Sum Insured</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<input style="width: 128%;" class="form-control" type="text" name="sumInsured2" id="sumInsured2" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" style="width: 100% !important;">
|
<input style="width: 128%;" class="form-control" type="text" name="sumInsured2" id="sumInsured2"
|
||||||
|
onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)"
|
||||||
|
style="width: 100% !important;">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2" style="position: relative;left: 88px;">
|
<div class="col-md-2" style="position: relative;left: 88px;">
|
||||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendGPASIAddMore()">+</button>
|
<button type="button" class="btn btn-primary si-add-more" onclick="appendGPASIAddMore()">+</button>
|
||||||
@ -110,7 +114,8 @@
|
|||||||
<label for="totalSumInsured">Total Sum Assured</label>
|
<label for="totalSumInsured">Total Sum Assured</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="text" style="width: 100% !important;" class="form-control" name="totalSumInsured" id="totalSumInsured" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)">
|
<input type="text" style="width: 100% !important;" class="form-control" name="totalSumInsured"
|
||||||
|
id="totalSumInsured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
</div>
|
</div>
|
||||||
@ -126,28 +131,52 @@
|
|||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 5%;">
|
<td style="width: 5%;">
|
||||||
<span style="margin-right: 20px;">Self:</span>
|
<span style="margin-right: 20px;">Self:</span>
|
||||||
</td>
|
</td>
|
||||||
<td style="width: 11%;">
|
<td style="width: 11%;">
|
||||||
<input disabled type="checkbox" style="margin-right: 70px;" name="family_floaters[]" value="self" id="self" checked>
|
<input disabled type="checkbox" style="margin-right: 70px;" name="family_floaters[]"
|
||||||
|
value="self" id="self" checked>
|
||||||
</td>
|
</td>
|
||||||
<td style="width: 20%;">
|
<td style="width: 20%;">
|
||||||
<div class="self-age">
|
<div class="self-age">
|
||||||
<span style="margin-right: 20px;">Min Age:</span>
|
<span style="margin-right: 20px;">Min Age:</span>
|
||||||
<input class="underline-input min_age" value="<?php echo isset($self_min_age) ? $self_min_age : '18'; ?>" style="width: 65%;" type="number" name="self_min_age" id="self_min_age_gpa" onchange="lowerIsEighteen(this)">
|
<input class="underline-input min_age"
|
||||||
|
value="<?php echo isset($self_min_age) ? $self_min_age : '18'; ?>"
|
||||||
|
style="width: 65%;" type="number" name="self_min_age" id="self_min_age_gpa"
|
||||||
|
onchange="lowerIsEighteen(this)">
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td style="width: 20%;">
|
<td style="width: 20%;">
|
||||||
<div class="self-age">
|
<div class="self-age">
|
||||||
<span style="margin-right: 20px;">Max Age:</span>
|
<span style="margin-right: 20px;">Max Age:</span>
|
||||||
<input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 65%;" type="number" name="self_max_age" id="self_max_age_gpa" onchange="lowerIsEighteen(this)">
|
<input class="underline-input max_age"
|
||||||
|
value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>"
|
||||||
|
style="width: 65%;" type="number" name="self_max_age" id="self_max_age_gpa"
|
||||||
|
onchange="lowerIsEighteen(this)">
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@ -157,176 +186,262 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="accidentalDeathBenefit_display" id="accidentalDeathBenefit_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
<label for="totalSumInsured">Accidental Death Benefit</label>
|
<label for="totalSumInsured">Accidental Death Benefit</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="radio" name="accidentalDeathBenefit" value="1"> Yes
|
<input type="text" name="accidentalDeathBenefit" class="form-control">
|
||||||
<input type="radio" name="accidentalDeathBenefit" value="0" style="margin-left:10px" checked> No
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured">Permanent Total Disablement</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="permanentTotalDisablement_display" id="permanentTotalDisablement_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="permanentTotalDisablement">Permanent Total Disablement</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="text" name="permanentTotalDisablement" id="permanentTotalDisablement" class="form-control">
|
<input type="text" name="permanentTotalDisablement" id="permanentTotalDisablement"
|
||||||
|
class="form-control">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
|
||||||
<label for="totalSumInsured">Permanent Partial Disablement</label>
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="permanentPartialDisablement_display" id="permanentPartialDisablement_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="permanentPartialDisablement">Permanent Partial Disablement</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="text" name="permanentPartialDisablement" id="permanentPartialDisablement" class="form-control">
|
<input type="text" name="permanentPartialDisablement" id="permanentPartialDisablement"
|
||||||
|
class="form-control">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured">Temporary Total Disablement benefit</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="temporaryTotalDisablementBenefit_display" id="temporaryTotalDisablementBenefit_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="temporaryTotalDisablementBenefit">Temporary Total Disablement Benefit</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="text" name="temporaryTotalDisablementBenefit" id="temporaryTotalDisablementBenefit" class="form-control">
|
<input type="text" name="temporaryTotalDisablementBenefit" id="temporaryTotalDisablementBenefit"
|
||||||
|
class="form-control">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured">Accidental Hospitalization Expenses</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="medical_expenses_medical_extension_display" id="medical_expenses_medical_extension_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="medical_expenses_medical_extension">Medical Expenses / Medical Extension (IPD)</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<select name="accidentalHospitalizationExpenses" id="accidentalHospitalizationExpenses" class="form-control">
|
<input type="text" name="medical_expenses_medical_extension" id="medical_expenses_medical_extension"
|
||||||
<option value="">Select an option</option>
|
class="form-control">
|
||||||
<option value="No">No</option>
|
|
||||||
<option value="10%-40%">Covered upto 10% of SI or 40% of actual which ever is less</option>
|
|
||||||
<option value="20%-50%">Covered upto 20% of SI or 50% of actual which ever is less</option>
|
|
||||||
<option value="50K-500k">INR 50K, to vary in multiples of 25K till 5 Lacs</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured">Children Education Welfare Fund</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="opd_treatment_cover_display" id="opd_treatment_cover_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="opd_treatment_cover">OPD Treatment Cover</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<select name="childrenEducationWelfareFund" id="childrenEducationWelfareFund" class="form-control">
|
<input type="text" name="opd_treatment_cover" id="opd_treatment_cover" class="form-control">
|
||||||
<option value="">Select an option</option>
|
|
||||||
<option value="No">No</option>
|
|
||||||
<option value="10000">Covered upto 10,000/ per child ( Restricted to 2 children)</option>
|
|
||||||
<option value="5000">Covered upto 5,000/ per child ( Restricted to 2 children)</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured">Compassionate Visit Expenses</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="ambulanceCharges_display" id="ambulanceCharges_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="ambulanceCharges"> Ambulance Charges</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="radio" name="compassionateVisitExpenses" value="1"> Yes
|
<input type="text" name="ambulanceCharges" class="form-control">
|
||||||
<input type="radio" name="compassionateVisitExpenses" value="0" style="margin-left:10px" checked> No
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<label for="totalSumInsured">Compassionate Visit Expenses Data</label>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<input type="text" name="compassionateVisitExpensesData" id="compassionateVisitExpensesData" class="form-control">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured">Broken Bone Expenses</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="repatriation_of_mortal_remains_display" id="repatriation_of_mortal_remains_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="repatriation_of_mortal_remains">Repatriation of Mortal Remains</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="radio" name="brokenBoneExpenses" value="1"> Yes
|
<input type="text" name="repatriation_of_mortal_remains" id="repatriation_of_mortal_remains" class="form-control">
|
||||||
<input type="radio" name="brokenBoneExpenses" value="0" style="margin-left:10px" checked> No
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<label for="totalSumInsured">Broken Bone Expenses Data</label>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<input type="text" name="brokenBoneExpensesData" id="brokenBoneExpensesData" class="form-control">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured"> Ambulance charges</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="childrenEducationWelfareFund_display" id="childrenEducationWelfareFund_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="childrenEducationWelfareFund">Children Education Welfare Fund</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="radio" name="ambulanceCharges" value="1"> Yes
|
<input type="text" name="childrenEducationWelfareFund" id="childrenEducationWelfareFund" class="form-control">
|
||||||
<input type="radio" name="ambulanceCharges" value="0" style="margin-left:10px" checked> No
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<label for="totalSumInsured">Ambulance charges Data</label>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<input type="text" name="ambulanceChargesData" id="ambulanceChargesData" class="form-control">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured"> Burn Expenses</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="terrorism_display" id="gpa_terrorism_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="terrorism">Terrorism</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="radio" name="burnExpenses" value="1"> Yes
|
<input type="text" name="terrorism" class="form-control">
|
||||||
<input type="radio" name="burnExpenses" value="0" style="margin-left:10px" checked> No
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<label for="totalSumInsured">Burn Expenses Data</label>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<input type="text" name="burnExpensesData" id="burnExpensesData" class="form-control">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured">Carriage of Dead Body</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="worldwideCover_display" id="worldwideCover_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="worldwideCover">Worldwide Cover</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="radio" name="carriageOfDeadBody" value="1"> Yes
|
<input type="text" name="worldwideCover" class="form-control">
|
||||||
<input type="radio" name="carriageOfDeadBody" value="0" style="margin-left:10px" checked> No
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<label for="totalSumInsured">Carriage of Dead Body Data</label>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<input type="text" name="carriageOfDeadBodyData" id="carriageOfDeadBodyData" class="form-control">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured">Animal/Snake/Insect bite</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="family_transportation_benefits_display" id="family_transportation_benefits_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="family_transportation_benefits">Family Transportation Benefits</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="radio" name="animalSnakeInsectBite" value="1"> Yes
|
<input type="text" name="family_transportation_benefits" id="family_transportation_benefits" class="form-control">
|
||||||
<input type="radio" name="animalSnakeInsectBite" value="0" style="margin-left:10px" checked> No
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured">Terrorism</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="fractures_dislocation_burns_display" id="fractures_dislocation_burns_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="fractures_dislocation_burns">Fractures / Dislocation / Burns</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="radio" name="terrorism" value="1"> Yes
|
<input type="text" name="fractures_dislocation_burns" id="fractures_dislocation_burns" class="form-control">
|
||||||
<input type="radio" name="terrorism" value="0" style="margin-left:10px" checked> No
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-1">
|
||||||
<label for="totalSumInsured">Worldwide Cover</label>
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="coma_display" id="coma_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="coma">Coma</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="radio" name="worldwideCover" value="1"> Yes
|
<input type="text" name="coma" id="coma" class="form-control">
|
||||||
<input type="radio" name="worldwideCover" value="0" style="margin-left:10px" checked> No
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="carriageofDeadBody_display" id="carriageofDeadBody_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="carriageOfDeadBody">Carriage of Dead Body</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="carriageOfDeadBody" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="compassionateVisitExpenses_display" id="compassionateVisitExpenses_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="compassionateVisitExpenses">Compassionate Visit Expenses</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="compassionateVisitExpenses" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="travel_expenses_for_medical_treatment_display" id="travel_expenses_for_medical_treatment_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="travel_expenses_for_medical_treatment">Travel expenses for Medical Treatment</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="travel_expenses_for_medical_treatment" id="travel_expenses_for_medical_treatment" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="daily_cash_allowance_display" id="daily_cash_allowance_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="daily_cash_allowance">Daily cash Allowance</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="daily_cash_allowance" id="daily_cash_allowance" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="artifical_limb_and_prosthesis_display" id="artifical_limb_and_prosthesis_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="artifical_limb_and_prosthesis">Artifical Limb and Prosthesis</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="artifical_limb_and_prosthesis" id="artifical_limb_and_prosthesis" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="animalSnakeInsectBite_display" id="animalSnakeInsectBite_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="animalSnakeInsectBite">Animal/Snake/Insect bite</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="animalSnakeInsectBite" id="animalSnakeInsectBite" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="air_ambulance_display" id="air_ambulance_display" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label for="air_ambulance">Air Ambulance</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="air_ambulance" id="air_ambulance" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -339,8 +454,10 @@
|
|||||||
|
|
||||||
<br>
|
<br>
|
||||||
<div class="form-group text-right m-b-0" style="margin-top: -49px;">
|
<div class="form-group text-right m-b-0" style="margin-top: -49px;">
|
||||||
<a href="#" class="button-like" id="gpaButtonSpecialCondition" title="Special Condition">Special Condition</a>
|
<a href="#" class="button-like" id="gpaButtonSpecialCondition" title="Special Condition">Special
|
||||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGPATermsSubmit" style="margin-top: 100px;">Submit</button>
|
Condition</a>
|
||||||
|
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGPATermsSubmit"
|
||||||
|
style="margin-top: 100px;">Submit</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -428,7 +545,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$("#policyGPATerms").submit(function(event) {
|
$("#policyGPATerms").submit(function(event) {
|
||||||
|
|
||||||
|
|
||||||
@ -451,11 +567,28 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var specialConditions = [];
|
||||||
|
|
||||||
|
$(".removeDom").each(function () {
|
||||||
|
var isChecked = $(this).find("input[name='gpa_special_condition_display[]']").is(":checked");
|
||||||
|
|
||||||
|
if (isChecked) {
|
||||||
|
var label = $(this).find("input[name='gpa_special_condition_label[]']").val();
|
||||||
|
var input = $(this).find("input[name='gpa_special_condition_input[]']").val();
|
||||||
|
|
||||||
|
specialConditions.push({ [label]: input });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("gpa_specialConditions", specialConditions);
|
||||||
|
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
$('.loader-mask').fadeIn();
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
var formData = new FormData($('#policyGPATerms')[0]);
|
var formData = new FormData($('#policyGPATerms')[0]);
|
||||||
var policy_form_action = '<?= base_url("client/terms/gpa_create") ?>';
|
var policy_form_action = '<?= base_url("client/terms/gpa_create") ?>';
|
||||||
|
formData.append("gpa_special_condition_display_value", JSON.stringify(specialConditions));
|
||||||
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: formData,
|
data: formData,
|
||||||
@ -500,7 +633,6 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('body').on('click', '.btnPolicyMaster', function() {
|
$('body').on('click', '.btnPolicyMaster', function() {
|
||||||
|
|
||||||
var client_policy_id = $(this).data('id');
|
var client_policy_id = $(this).data('id');
|
||||||
@ -550,13 +682,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (res) {
|
if (res && res.data) {
|
||||||
|
|
||||||
let gpaJsonObjectForSpecialCondition = JSON.parse(res.data);
|
let gpaJsonObjectForSpecialCondition = JSON.parse(res.data);
|
||||||
Object.keys(gpaJsonObjectForSpecialCondition).forEach(function(key) {
|
Object.keys(gpaJsonObjectForSpecialCondition).forEach(function(key) {
|
||||||
if (key.includes("gpa_special_condition_label") || key.includes("gpa_special_condition_input")) {
|
if (key.includes("gpa_special_condition_label") || key.includes(
|
||||||
|
"gpa_special_condition_input")) {
|
||||||
if (key.includes("gpa_special_condition_label")) {
|
if (key.includes("gpa_special_condition_label")) {
|
||||||
for (let index = 0; index < gpaJsonObjectForSpecialCondition[key].length; index++) {
|
for (let index = 0; index <
|
||||||
|
gpaJsonObjectForSpecialCondition[key].length; index++) {
|
||||||
specialConditionForGPA();
|
specialConditionForGPA();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -565,10 +699,33 @@
|
|||||||
if (elements) {
|
if (elements) {
|
||||||
elements.forEach((element, index) => {
|
elements.forEach((element, index) => {
|
||||||
|
|
||||||
if(gpaJsonObjectForSpecialCondition[key][index] == undefined){
|
if (gpaJsonObjectForSpecialCondition[key][
|
||||||
|
index
|
||||||
|
] == undefined) {
|
||||||
element.value = " ";
|
element.value = " ";
|
||||||
} else {
|
} else {
|
||||||
element.value = gpaJsonObjectForSpecialCondition[key][index];
|
element.value =
|
||||||
|
gpaJsonObjectForSpecialCondition[key][
|
||||||
|
index
|
||||||
|
];
|
||||||
|
|
||||||
|
if (key.includes("gpa_special_condition_label")) {
|
||||||
|
let checkbox = $(element).closest('.form-group').find('input[name="gpa_special_condition_display[]"]');
|
||||||
|
console.log("First element:", element);
|
||||||
|
|
||||||
|
if (checkbox.length) {
|
||||||
|
console.log("Checkbox found:", checkbox);
|
||||||
|
|
||||||
|
// Correct way to set the 'id' attribute
|
||||||
|
let formattedValue = gpaJsonObjectForSpecialCondition[key][index].replace(/[\s\-\/,&]+/g, '').toLowerCase();
|
||||||
|
console.log('formattedValue', formattedValue);
|
||||||
|
checkbox.attr('id', formattedValue + '_display');
|
||||||
|
|
||||||
|
console.log("Updated Checkbox:", checkbox);
|
||||||
|
} else {
|
||||||
|
console.log("Checkbox not found for:", element);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -577,7 +734,8 @@
|
|||||||
if (key.includes("multiple_sum_insured") && key != "") {
|
if (key.includes("multiple_sum_insured") && key != "") {
|
||||||
|
|
||||||
if (Array.isArray(gpaJsonObjectForSpecialCondition[key])) {
|
if (Array.isArray(gpaJsonObjectForSpecialCondition[key])) {
|
||||||
gpaJsonObjectForSpecialCondition[key].forEach((value, index) => {
|
gpaJsonObjectForSpecialCondition[key].forEach((value,
|
||||||
|
index) => {
|
||||||
appendGPASIAddMore(value);
|
appendGPASIAddMore(value);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -585,22 +743,36 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (key.includes("enrollment_display_key") && key != "") {
|
||||||
|
|
||||||
|
console.log('enrollment_display_key');
|
||||||
|
console.log(gpaJsonObjectForSpecialCondition[key]);
|
||||||
|
|
||||||
|
processJsonObject2(gpaJsonObjectForSpecialCondition);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let jsonObject = JSON.parse(res.data);
|
let jsonObject = JSON.parse(res.data);
|
||||||
$("#numberToWordSumInsured").text(convertCommaNumberToWords(jsonObject.sumInsured2) ?? '' );
|
$("#numberToWordSumInsured").text(convertCommaNumberToWords(jsonObject
|
||||||
$("#numberToWordTotalSumInsured").text(convertCommaNumberToWords(jsonObject.totalSumInsured) ?? '');
|
.sumInsured2) ?? '');
|
||||||
|
$("#numberToWordTotalSumInsured").text(convertCommaNumberToWords(jsonObject
|
||||||
|
.totalSumInsured) ?? '');
|
||||||
|
|
||||||
if (jsonObject.compassionateVisitExpenses == '1') {
|
if (jsonObject.compassionateVisitExpenses == '1') {
|
||||||
var element = $('input[name="compassionateVisitExpenses"]').parent().parent().next()[0];
|
var element = $('input[name="compassionateVisitExpenses"]').parent()
|
||||||
|
.parent().next()[0];
|
||||||
$(element).css("display", "");
|
$(element).css("display", "");
|
||||||
}
|
}
|
||||||
if (jsonObject.brokenBoneExpenses == '1') {
|
if (jsonObject.brokenBoneExpenses == '1') {
|
||||||
var element = $('input[name="brokenBoneExpenses"]').parent().parent().next()[0];
|
var element = $('input[name="brokenBoneExpenses"]').parent().parent()
|
||||||
|
.next()[0];
|
||||||
$(element).css("display", "");
|
$(element).css("display", "");
|
||||||
}
|
}
|
||||||
if (jsonObject.ambulanceCharges == '1') {
|
if (jsonObject.ambulanceCharges == '1') {
|
||||||
var element = $('input[name="ambulanceCharges"]').parent().parent().next()[0];
|
var element = $('input[name="ambulanceCharges"]').parent().parent().next()[
|
||||||
|
0];
|
||||||
$(element).css("display", "");
|
$(element).css("display", "");
|
||||||
}
|
}
|
||||||
if (jsonObject.burnExpenses == '1') {
|
if (jsonObject.burnExpenses == '1') {
|
||||||
@ -608,22 +780,23 @@
|
|||||||
$(element).css("display", "");
|
$(element).css("display", "");
|
||||||
}
|
}
|
||||||
if (jsonObject.carriageOfDeadBody == '1') {
|
if (jsonObject.carriageOfDeadBody == '1') {
|
||||||
var element = $('input[name="carriageOfDeadBody"]').parent().parent().next()[0];
|
var element = $('input[name="carriageOfDeadBody"]').parent().parent()
|
||||||
|
.next()[0];
|
||||||
$(element).css("display", "");
|
$(element).css("display", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Object.keys(jsonObject).forEach(function(key) {
|
Object.keys(jsonObject).forEach(function(key) {
|
||||||
|
|
||||||
console.log('jsonObject key', key)
|
// console.log('jsonObject key', key)
|
||||||
console.log('jsonObject value', jsonObject[key])
|
// console.log('jsonObject value', jsonObject[key])
|
||||||
console.log('jsonObject value type',typeof jsonObject[key])
|
// console.log('jsonObject value type', typeof jsonObject[key])
|
||||||
|
|
||||||
let elements = document.getElementsByName(key);
|
let elements = document.getElementsByName(key);
|
||||||
if (elements && elements.length > 0) {
|
if (elements && elements.length > 0) {
|
||||||
let element = elements[0];
|
let element = elements[0];
|
||||||
|
|
||||||
if (element.tagName === 'INPUT' && (element.type === 'checkbox' || element.type === 'radio')) {
|
if (element.tagName === 'INPUT' && (element.type ===
|
||||||
|
'checkbox' || element.type === 'radio')) {
|
||||||
|
|
||||||
if (element.type === 'checkbox') {
|
if (element.type === 'checkbox') {
|
||||||
element.checked = jsonObject[key] === '1';
|
element.checked = jsonObject[key] === '1';
|
||||||
@ -657,7 +830,6 @@
|
|||||||
$('.multiple_sum_insured').trigger("keyup");
|
$('.multiple_sum_insured').trigger("keyup");
|
||||||
$("#totalSumInsured").trigger("keyup");
|
$("#totalSumInsured").trigger("keyup");
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
@ -676,7 +848,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
@ -690,7 +861,6 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function specialConditionForGPA(count = 0) {
|
function specialConditionForGPA(count = 0) {
|
||||||
|
|
||||||
console.log('specialConditionForGPA function called')
|
console.log('specialConditionForGPA function called')
|
||||||
@ -703,7 +873,9 @@
|
|||||||
|
|
||||||
var index = $('.modifyclassinput').length;
|
var index = $('.modifyclassinput').length;
|
||||||
var appendElement = `<div class="form-group col-md-6 form-group-client-policy-masters removeDom">
|
var appendElement = `<div class="form-group col-md-6 form-group-client-policy-masters removeDom">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" name="gpa_special_condition_display[]" id="special_condition_display" class="unchecked" checked>
|
||||||
|
</div>
|
||||||
<label for="specialconditionlabel" class="special_condition_label[]" style="width: 450px;position: relative;bottom: 6px;">
|
<label for="specialconditionlabel" class="special_condition_label[]" style="width: 450px;position: relative;bottom: 6px;">
|
||||||
<input class="form-control" name="gpa_special_condition_label[]" id="gpa_special_condition_label[]" style="position: relative;right: 5px;">
|
<input class="form-control" name="gpa_special_condition_label[]" id="gpa_special_condition_label[]" style="position: relative;right: 5px;">
|
||||||
<span class="specialConditionClose" style="color: red; float: right;position: relative;bottom: 28px;left: 15px;">X</span>
|
<span class="specialConditionClose" style="color: red; float: right;position: relative;bottom: 28px;left: 15px;">X</span>
|
||||||
@ -721,8 +893,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$(document).on('click', '#policyGPATermsClose', function() {
|
$(document).on('click', '#policyGPATermsClose', function() {
|
||||||
$('#policyGPATermsForm').css('display', 'none');
|
$('#policyGPATermsForm').css('display', 'none');
|
||||||
$('#police-tab').css('display', '');
|
$('#police-tab').css('display', '');
|
||||||
@ -733,7 +903,6 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$("#sumInsured2").on("keyup", function() {
|
$("#sumInsured2").on("keyup", function() {
|
||||||
var inputNumber = $(this).val();
|
var inputNumber = $(this).val();
|
||||||
if (inputNumber) {
|
if (inputNumber) {
|
||||||
@ -759,7 +928,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function numtowordinkeyup(input) {
|
function numtowordinkeyup(input) {
|
||||||
console.log('testing......')
|
console.log('testing......')
|
||||||
console.log(input);
|
console.log(input);
|
||||||
@ -779,7 +947,6 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$("#totalSumInsured").on("keyup", function() {
|
$("#totalSumInsured").on("keyup", function() {
|
||||||
var inputNumber = $(this).val();
|
var inputNumber = $(this).val();
|
||||||
if (inputNumber) {
|
if (inputNumber) {
|
||||||
@ -790,9 +957,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function appendGPASIAddMore(data = null) {
|
||||||
function appendGPASIAddMore(data = null)
|
|
||||||
{
|
|
||||||
|
|
||||||
console.log('appendGPASIAddMore function called')
|
console.log('appendGPASIAddMore function called')
|
||||||
console.log('appendGPASIAddMore function data', data)
|
console.log('appendGPASIAddMore function data', data)
|
||||||
@ -818,4 +983,61 @@
|
|||||||
|
|
||||||
$('#gpa_si_add_more').append(html);
|
$('#gpa_si_add_more').append(html);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function inArray(key, array) {
|
||||||
|
return array.includes(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
function processJsonObject2(jsonObject) {
|
||||||
|
|
||||||
|
if (typeof jsonObject !== 'object' || Array.isArray(jsonObject)) {
|
||||||
|
console.log("jsonObject Input is not a valid object.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.unchecked').prop('checked', false);
|
||||||
|
|
||||||
|
for (let key in jsonObject) {
|
||||||
|
if (typeof jsonObject[key] === 'object' && !Array.isArray(jsonObject[key])) {
|
||||||
|
// console.log('enrollment_display_key');
|
||||||
|
// console.log(jsonObject[key]);
|
||||||
|
|
||||||
|
for (let innerKey in jsonObject[key]) {
|
||||||
|
|
||||||
|
const keysToCheck = [
|
||||||
|
"OPD Treatment Cover",
|
||||||
|
"Repatriation of Mortal Remains",
|
||||||
|
"Family Transportation Benefits",
|
||||||
|
"Fractures / Dislocation / Burns",
|
||||||
|
"Travel expenses for Medical Treatment",
|
||||||
|
"Daily cash Allowance",
|
||||||
|
"Artifical Limb and Prosthesis",
|
||||||
|
"Air Ambulance",
|
||||||
|
];
|
||||||
|
|
||||||
|
//let base_id = innerKey.replace(/[\s\-\/,&]+/g, '').toLowerCase();
|
||||||
|
let base_id = innerKey.replace(/[\s\-\/,&]+/g, '');
|
||||||
|
base_id = base_id.charAt(0).toLowerCase() + base_id.slice(1);
|
||||||
|
|
||||||
|
if (keysToCheck.includes(innerKey)) {
|
||||||
|
// console.log("Key found: " + innerKey);
|
||||||
|
base_id = innerKey.replace(/[\s\-\/]+/g, '_').toLowerCase();
|
||||||
|
} else if (innerKey == "Medical Expenses / Medical Extension (IPD)") {
|
||||||
|
// console.log("Key found: " + innerKey);
|
||||||
|
base_id = "medical_expenses_medical_extension";
|
||||||
|
} else if (innerKey == "Terrorism") {
|
||||||
|
// console.log("Key found: " + innerKey);
|
||||||
|
base_id = "gpa_terrorism";
|
||||||
|
}
|
||||||
|
|
||||||
|
let display_id = base_id + "_display";
|
||||||
|
$('#' + display_id).prop('checked', true);
|
||||||
|
// console.log('display_id : ', display_id);
|
||||||
|
// console.log($('#' + display_id))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log(`${key} is not an object.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -52,6 +52,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
var si_amt_parent_policy = new Set();
|
||||||
|
var si_amt_base_policy = new Set();
|
||||||
|
|
||||||
function loadModal(client_policy_id, base_policy_id) {
|
function loadModal(client_policy_id, base_policy_id) {
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
$('.loader-mask').fadeIn();
|
$('.loader-mask').fadeIn();
|
||||||
@ -65,7 +68,7 @@ function loadModal(client_policy_id, base_policy_id) {
|
|||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
};
|
};
|
||||||
|
|
||||||
var si_amt_base_policy = new Set();
|
|
||||||
|
|
||||||
function checkExistingMapping(client_policy_id, base_policy_id) {
|
function checkExistingMapping(client_policy_id, base_policy_id) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -78,27 +81,17 @@ function checkExistingMapping(client_policy_id, base_policy_id) {
|
|||||||
success: function(response) {
|
success: function(response) {
|
||||||
if (response.status === true && response.code === 200 && response.data.length > 0) {
|
if (response.status === true && response.code === 200 && response.data.length > 0) {
|
||||||
// Clear existing rows except the first one
|
// Clear existing rows except the first one
|
||||||
$('.si-mapping-row:not(:first)').remove();
|
$('.si-mapping-row:not(:first)').empty();
|
||||||
|
|
||||||
// First, ensure base policy and parent policy data is loaded
|
// First, ensure base policy and parent policy data is loaded
|
||||||
fetchBasePolicy(client_policy_id, base_policy_id);
|
fetchBasePolicy(client_policy_id, base_policy_id).then(()=>{
|
||||||
fetchParentPolicy(client_policy_id, base_policy_id);
|
fetchParentPolicy(client_policy_id, base_policy_id).then(()=>{
|
||||||
|
// setTimeout(() => {
|
||||||
// Wait for dropdowns to be populated
|
|
||||||
setTimeout(() => {
|
|
||||||
response.data.forEach((mapping, index) => {
|
response.data.forEach((mapping, index) => {
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
// Handle first row
|
// Handle first row
|
||||||
const firstRow = $('.si-mapping-row:first');
|
const firstRow = $('.si-mapping-row:first');
|
||||||
|
|
||||||
// Clear existing values
|
|
||||||
firstRow.find('select[name="choose_si_amount_from_base_policy"]')
|
|
||||||
.val('')
|
|
||||||
.trigger('change');
|
|
||||||
firstRow.find('select[name="choose_si_amount_for_policy[]"]')
|
|
||||||
.val([])
|
|
||||||
.trigger('change');
|
|
||||||
|
|
||||||
// Set base policy SI amount
|
// Set base policy SI amount
|
||||||
firstRow.find('select[name="choose_si_amount_from_base_policy"]')
|
firstRow.find('select[name="choose_si_amount_from_base_policy"]')
|
||||||
.val(mapping.base_policy_si_amount)
|
.val(mapping.base_policy_si_amount)
|
||||||
@ -113,22 +106,13 @@ function checkExistingMapping(client_policy_id, base_policy_id) {
|
|||||||
// Store pk value
|
// Store pk value
|
||||||
firstRow.find('input[name="primary_key"]').val(mapping.pk);
|
firstRow.find('input[name="primary_key"]').val(mapping.pk);
|
||||||
} else {
|
} else {
|
||||||
// Add new row for subsequent mappings
|
// For subsequent mappings, add a new row WITHOUT triggering the add button
|
||||||
addRow();
|
addSIMappingRow();
|
||||||
$('#addButton').trigger("click");
|
|
||||||
|
|
||||||
// Wait for the new row to be properly initialized
|
// Wait for the new row to be properly initialized
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
const newRow = $('.si-mapping-row:last');
|
const newRow = $('.si-mapping-row:last');
|
||||||
|
|
||||||
// Clear existing values
|
|
||||||
newRow.find('select[name="choose_si_amount_from_base_policy"]')
|
|
||||||
.val('')
|
|
||||||
.trigger('change');
|
|
||||||
newRow.find('select[name="choose_si_amount_for_policy[]"]')
|
|
||||||
.val([])
|
|
||||||
.trigger('change');
|
|
||||||
|
|
||||||
// Set base policy SI amount
|
// Set base policy SI amount
|
||||||
newRow.find('select[name="choose_si_amount_from_base_policy"]')
|
newRow.find('select[name="choose_si_amount_from_base_policy"]')
|
||||||
.val(mapping.base_policy_si_amount)
|
.val(mapping.base_policy_si_amount)
|
||||||
@ -142,10 +126,16 @@ function checkExistingMapping(client_policy_id, base_policy_id) {
|
|||||||
|
|
||||||
// Store pk value
|
// Store pk value
|
||||||
newRow.find('input[name="primary_key"]').val(mapping.pk);
|
newRow.find('input[name="primary_key"]').val(mapping.pk);
|
||||||
}, 500);
|
// }, 500);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, 1000); // Wait for fetchBasePolicy and fetchParentPolicy to complete
|
// }, 1000);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// Wait for dropdowns to be populated
|
||||||
|
// Wait for fetchBasePolicy and fetchParentPolicy to complete
|
||||||
} else {
|
} else {
|
||||||
fetchBasePolicy(client_policy_id, base_policy_id);
|
fetchBasePolicy(client_policy_id, base_policy_id);
|
||||||
fetchParentPolicy(client_policy_id, base_policy_id);
|
fetchParentPolicy(client_policy_id, base_policy_id);
|
||||||
@ -159,7 +149,7 @@ function checkExistingMapping(client_policy_id, base_policy_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function fetchBasePolicy(client_policy_id, base_policy_id) {
|
function fetchBasePolicy(client_policy_id, base_policy_id) {
|
||||||
$.ajax({
|
return $.ajax({
|
||||||
url: '<?php echo base_url("util/getPolicySIRacketData")?>',
|
url: '<?php echo base_url("util/getPolicySIRacketData")?>',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
data: {
|
data: {
|
||||||
@ -180,17 +170,17 @@ function fetchBasePolicy(client_policy_id, base_policy_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Convert Set back to an array to use in the dropdown
|
// Convert Set back to an array to use in the dropdown
|
||||||
si_amt_base_policy = Array.from(si_amt_base_policy);
|
var si_amt_base_policy_array = Array.from(si_amt_base_policy);
|
||||||
console.log("Unique SI amounts:", si_amt_base_policy); // Check the result
|
console.log("Unique SI amounts:", si_amt_base_policy_array); // Check the result
|
||||||
|
|
||||||
// Clear existing options in the dropdown
|
// Clear existing options in the dropdown
|
||||||
// $('#choose_si_amount_from_base_policy').empty();
|
$('#choose_si_amount_from_base_policy').empty();
|
||||||
$('#choose_si_amount_from_base_policy').append('<option value="">Select SI Amount</option>');
|
$('#choose_si_amount_from_base_policy').append('<option value="">Select SI Amount</option>');
|
||||||
|
|
||||||
// Append the new options
|
// Append the new options
|
||||||
for (let i = 0; i < si_amt_base_policy.length; i++) {
|
for (let i = 0; i < si_amt_base_policy_array.length; i++) {
|
||||||
console.log("Appending option:", si_amt_base_policy[i]); // Log each SI value
|
console.log("Appending option:", si_amt_base_policy_array[i]); // Log each SI value
|
||||||
$('#choose_si_amount_from_base_policy').append(`<option value="${si_amt_base_policy[i]}">${si_amt_base_policy[i]}</option>`);
|
$('#choose_si_amount_from_base_policy').append(`<option value="${si_amt_base_policy_array[i]}">${si_amt_base_policy_array[i]}</option>`);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -203,9 +193,8 @@ function fetchBasePolicy(client_policy_id, base_policy_id) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var si_amt_parent_policy = new Set();
|
|
||||||
function fetchParentPolicy(client_policy_id, base_policy_id) {
|
function fetchParentPolicy(client_policy_id, base_policy_id) {
|
||||||
$.ajax({
|
return $.ajax({
|
||||||
url: '<?= base_url("util/fetchPolicySIDataForParentPolicy")?>',
|
url: '<?= base_url("util/fetchPolicySIDataForParentPolicy")?>',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
data: {
|
data: {
|
||||||
@ -224,17 +213,17 @@ function fetchParentPolicy(client_policy_id, base_policy_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Convert Set back to an array to use in the dropdown
|
// Convert Set back to an array to use in the dropdown
|
||||||
si_amt_parent_policy = Array.from(si_amt_parent_policy);
|
var si_amt_parent_policy_array = Array.from(si_amt_parent_policy);
|
||||||
console.log("Unique SI amounts:", si_amt_parent_policy); // Check the result
|
console.log("Unique SI amounts:", si_amt_parent_policy_array); // Check the result
|
||||||
|
|
||||||
// Clear existing options in the dropdown
|
// Clear existing options in the dropdown
|
||||||
// $('#choose_si_amount_for_policy').empty();
|
$('#choose_si_amount_for_policy').empty();
|
||||||
$('#choose_si_amount_for_policy').append('<option value="">Select SI Amount</option>');
|
$('#choose_si_amount_for_policy').append('<option value="">Select SI Amount</option>');
|
||||||
|
|
||||||
// Append the new options
|
// Append the new options
|
||||||
for (let i = 0; i < si_amt_parent_policy.length; i++) {
|
for (let i = 0; i < si_amt_parent_policy_array.length; i++) {
|
||||||
console.log("Appending option:", si_amt_parent_policy[i]); // Log each SI value
|
console.log("Appending option:", si_amt_parent_policy_array[i]); // Log each SI value
|
||||||
$('#choose_si_amount_for_policy').append(`<option value="${si_amt_parent_policy[i]}">${si_amt_parent_policy[i]}</option>`);
|
$('#choose_si_amount_for_policy').append(`<option value="${si_amt_parent_policy_array[i]}">${si_amt_parent_policy_array[i]}</option>`);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -256,98 +245,10 @@ $(document).ready(function() {
|
|||||||
$("textarea.select2-search__field").css('resize', 'none');
|
$("textarea.select2-search__field").css('resize', 'none');
|
||||||
|
|
||||||
// Function to get all selected base policy values
|
// Function to get all selected base policy values
|
||||||
function getSelectedBasePolicies() {
|
|
||||||
var selectedBasePolicies = [];
|
|
||||||
$('.si-mapping-row').each(function() {
|
|
||||||
var selectedBasePolicy = $(this).find('select[name="choose_si_amount_from_base_policy"]').val();
|
|
||||||
if (selectedBasePolicy) {
|
|
||||||
selectedBasePolicies.push(selectedBasePolicy);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return selectedBasePolicies;
|
|
||||||
}
|
|
||||||
|
|
||||||
function addRow() {
|
|
||||||
// Get selected base policies from all previous rows
|
|
||||||
var selectedBasePolicies = getSelectedBasePolicies();
|
|
||||||
|
|
||||||
// Check if si_amt_base_policy has been populated
|
|
||||||
if (si_amt_base_policy.length === 0) {
|
|
||||||
console.log("SI amounts not yet loaded.");
|
|
||||||
return; // Prevent adding the row if the data isn't ready
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a new row with the same structure as the existing row
|
|
||||||
var newRow = $('<div class="form-row si-mapping-row">');
|
|
||||||
|
|
||||||
// Generate unique IDs for the new row's selects
|
|
||||||
var uniqueIdForBasePolicy = 'choose_base_policy_' + Date.now();
|
|
||||||
var uniqueIdForSIAmountForPolicy = 'choose_si_amount_for_policy_' + Date.now();
|
|
||||||
|
|
||||||
newRow.append(
|
|
||||||
'<input name = "primary_key" type="hidden" id="'+uniqueIdForBasePolicy+'" value="">'+
|
|
||||||
'<div class="form-group col-md-3">' +
|
|
||||||
'<label>Base Policy SI Amount<span class="text-danger">*</span></label>' +
|
|
||||||
'<select class="form-control" id="' + uniqueIdForBasePolicy + '" name="choose_si_amount_from_base_policy">' +
|
|
||||||
'<option value="">Choose SI Amount</option>' +
|
|
||||||
'</select>' +
|
|
||||||
'</div>'
|
|
||||||
);
|
|
||||||
|
|
||||||
newRow.append(
|
|
||||||
'<div class="form-group col-md-3">' +
|
|
||||||
'<label>Policy SI Amount</label><br />' +
|
|
||||||
'<select class="form-control" id="' + uniqueIdForSIAmountForPolicy + '" name="choose_si_amount_for_policy[]" multiple>' +
|
|
||||||
'</select>' +
|
|
||||||
'</div>'
|
|
||||||
);
|
|
||||||
|
|
||||||
newRow.append(
|
|
||||||
'<div class="form-group">' +
|
|
||||||
'<div class="btn-group" style="margin-top: 45px;">' +
|
|
||||||
'<button type="button" class="btn btn-danger remove-row" style="margin-right: 5px;">x</button>' +
|
|
||||||
'<button type="button" class="btn btn-success add-row">+</button>' +
|
|
||||||
'</div>' +
|
|
||||||
'</div>'
|
|
||||||
);
|
|
||||||
|
|
||||||
// Append the new row to the container
|
|
||||||
$('#si-mapping-container').append(newRow);
|
|
||||||
|
|
||||||
// Loop through and append SI amounts to the new row's 'choose_si_amount_from_base_policy' dropdown
|
|
||||||
si_amt_base_policy.forEach(function(value) {
|
|
||||||
newRow.find('select[name="choose_si_amount_from_base_policy"]').append('<option value="'+value+'">'+value+'</option>');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Remove selected base policies from the new row's 'choose_si_amount_from_base_policy' options
|
|
||||||
newRow.find('select[name="choose_si_amount_from_base_policy"] option').each(function() {
|
|
||||||
var value = $(this).val();
|
|
||||||
if (selectedBasePolicies.includes(value)) {
|
|
||||||
$(this).remove();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Append the unique SI amounts to 'choose_si_amount_for_policy[]'
|
|
||||||
si_amt_parent_policy.forEach(function(value) {
|
|
||||||
newRow.find('select[name="choose_si_amount_for_policy[]"]').append('<option value="'+value+'">'+value+'</option>');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Re-initialize select2 for the new row's dropdowns
|
|
||||||
newRow.find('select[name="choose_si_amount_for_policy[]"]').select2({
|
|
||||||
placeholder: 'Select SI Amount'
|
|
||||||
});
|
|
||||||
|
|
||||||
newRow.find('select[name="choose_si_amount_from_base_policy"]').select2({
|
|
||||||
placeholder: 'Choose SI Amount'
|
|
||||||
});
|
|
||||||
|
|
||||||
$("textarea.select2-search__field").attr('rows', '1');
|
|
||||||
$("textarea.select2-search__field").css('resize', 'none');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use event delegation to bind the click event for .add-row
|
// Use event delegation to bind the click event for .add-row
|
||||||
$(document).on('click', '.add-row', function() {
|
$(document).on('click', '.add-row', function() {
|
||||||
addRow();
|
addSIMappingRow();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Remove an SI Mapping row
|
// Remove an SI Mapping row
|
||||||
@ -446,6 +347,9 @@ function submitForm() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function resetFormAndRemoveRows() {
|
function resetFormAndRemoveRows() {
|
||||||
|
|
||||||
|
si_amt_parent_policy.clear();
|
||||||
|
si_amt_base_policy.clear();
|
||||||
// Reset the form fields
|
// Reset the form fields
|
||||||
$('#si_mapping_form')[0].reset(); // Reset all form fields
|
$('#si_mapping_form')[0].reset(); // Reset all form fields
|
||||||
|
|
||||||
@ -462,5 +366,93 @@ function resetFormAndRemoveRows() {
|
|||||||
$('#choose_si_amount_for_policy').val('').trigger('change');
|
$('#choose_si_amount_for_policy').val('').trigger('change');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSelectedBasePolicies() {
|
||||||
|
var selectedBasePolicies = [];
|
||||||
|
$('.si-mapping-row').each(function() {
|
||||||
|
var selectedBasePolicy = $(this).find('select[name="choose_si_amount_from_base_policy"]').val();
|
||||||
|
if (selectedBasePolicy) {
|
||||||
|
selectedBasePolicies.push(selectedBasePolicy);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return selectedBasePolicies;
|
||||||
|
}
|
||||||
|
|
||||||
|
function addSIMappingRow() {
|
||||||
|
// Get selected base policies from all previous rows
|
||||||
|
var selectedBasePolicies = getSelectedBasePolicies();
|
||||||
|
|
||||||
|
// Check if si_amt_base_policy has been populated
|
||||||
|
if (si_amt_base_policy.length === 0) {
|
||||||
|
console.log("SI amounts not yet loaded.");
|
||||||
|
return; // Prevent adding the row if the data isn't ready
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a new row with the same structure as the existing row
|
||||||
|
var newRow = $('<div class="form-row si-mapping-row">');
|
||||||
|
|
||||||
|
// Generate unique IDs for the new row's selects
|
||||||
|
var uniqueIdForBasePolicy = 'choose_base_policy_' + Date.now();
|
||||||
|
var uniqueIdForSIAmountForPolicy = 'choose_si_amount_for_policy_' + Date.now();
|
||||||
|
|
||||||
|
newRow.append(
|
||||||
|
'<input name="primary_key" type="hidden" value="">'+
|
||||||
|
'<div class="form-group col-md-3">' +
|
||||||
|
'<label>Base Policy SI Amount<span class="text-danger">*</span></label>' +
|
||||||
|
'<select class="form-control" id="' + uniqueIdForBasePolicy + '" name="choose_si_amount_from_base_policy">' +
|
||||||
|
'<option value="">Choose SI Amount</option>' +
|
||||||
|
'</select>' +
|
||||||
|
'</div>'
|
||||||
|
);
|
||||||
|
|
||||||
|
newRow.append(
|
||||||
|
'<div class="form-group col-md-3">' +
|
||||||
|
'<label>Policy SI Amount</label><br />' +
|
||||||
|
'<select class="form-control" id="' + uniqueIdForSIAmountForPolicy + '" name="choose_si_amount_for_policy[]" multiple>' +
|
||||||
|
'</select>' +
|
||||||
|
'</div>'
|
||||||
|
);
|
||||||
|
|
||||||
|
newRow.append(
|
||||||
|
'<div class="form-group">' +
|
||||||
|
'<div class="btn-group" style="margin-top: 45px;">' +
|
||||||
|
'<button type="button" class="btn btn-danger remove-row" style="margin-right: 5px;">x</button>' +
|
||||||
|
'<button type="button" class="btn btn-success add-row">+</button>' +
|
||||||
|
'</div>' +
|
||||||
|
'</div>'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Append the new row to the container
|
||||||
|
$('#si-mapping-container').append(newRow);
|
||||||
|
|
||||||
|
// First, populate all options
|
||||||
|
si_amt_base_policy.forEach(function(value) {
|
||||||
|
newRow.find('select[name="choose_si_amount_from_base_policy"]').append('<option value="'+value+'">'+value+'</option>');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Then, remove already selected values from the dropdown
|
||||||
|
selectedBasePolicies.forEach(function(value) {
|
||||||
|
if (value) { // Check if the value is not empty
|
||||||
|
newRow.find('select[name="choose_si_amount_from_base_policy"] option[value="'+value+'"]').remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Append the unique SI amounts to 'choose_si_amount_for_policy[]'
|
||||||
|
si_amt_parent_policy.forEach(function(value) {
|
||||||
|
newRow.find('select[name="choose_si_amount_for_policy[]"]').append('<option value="'+value+'">'+value+'</option>');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Initialize select2 for the new dropdowns
|
||||||
|
newRow.find('select[name="choose_si_amount_for_policy[]"]').select2({
|
||||||
|
placeholder: 'Select SI Amount'
|
||||||
|
});
|
||||||
|
|
||||||
|
// newRow.find('select[name="choose_si_amount_from_base_policy"]').select2({
|
||||||
|
// placeholder: 'Choose SI Amount'
|
||||||
|
// });
|
||||||
|
|
||||||
|
$("textarea.select2-search__field").attr('rows', '1');
|
||||||
|
$("textarea.select2-search__field").css('resize', 'none');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user