Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
VENKATESHWARAN 2025-05-28 17:37:12 +05:30
commit d0f017a228
16 changed files with 1639 additions and 1233 deletions

View File

@ -2406,52 +2406,109 @@ class ClientController extends AdminController
// print_r($data);die;
$data['waiverofpreexistingdiseases'] = $this->request->getPost("waiverofpreexistingdiseases");
$data['waiverof1,2,3&4thyearexclusions'] = $this->request->getPost("waiverof1,2,3&4thyearexclusions");
$data['waiverof30dayswaitingperiod'] = $this->request->getPost("waiverof30dayswaitingperiod");
$data['waiver_of_90_days_waiting_period'] = $this->request->getPost("waiver_of_90_days_waiting_period");
$data['waiver_of_other_waiting_periods'] = $this->request->getPost("waiver_of_other_waiting_periods");
$data['maternity_benefit'] = $this->request->getPost("maternity_benefit");
$data['9monthwaitingperiodwaived'] = str_replace(',', '', $this->request->getPost("9monthwaitingperiodwaived"));
$data['maternitycoverage'] = str_replace(',', '', $this->request->getPost("maternitycoverage"));
$data['twindelivery'] = str_replace(',', '', $this->request->getPost("twindelivery"));
$data['well_baby_well_mother_expenses'] = str_replace(',', '', $this->request->getPost("well_baby_well_mother_expenses"));
$data['preandpostnatal'] = str_replace(',', '', $this->request->getPost("preandpostnatal"));
$data['infertility_treatment_coverage'] = str_replace(',', '', $this->request->getPost("infertility_treatment_coverage"));
$data['babyday1cover'] = str_replace(',', '', $this->request->getPost("babyday1cover"));
$data['coverfromthedateofjoining'] = str_replace(',', '', $this->request->getPost("coverfromthedateofjoining"));
$data['mid_term_addition_of_new_born_newly_wedded_spouse'] = str_replace(',', '', $this->request->getPost("mid_term_addition_of_new_born_newly_wedded_spouse"));
$data['prehospitalizationcover'] = str_replace(',', '', $this->request->getPost("prehospitalizationcover"));
$data['posthospitalizationcover'] =$this->request->getPost("posthospitalizationcover");
$data['congenitaldiseasesinternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesinternal"));
$data['congenitaldiseasesexternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesexternal"));
$data['copayzonewisecopay'] = $this->request->getPost("copayzonewisecopay");
$data['roomrentlimit'] = str_replace(',', '', $this->request->getPost("roomrentlimit"));
$data['icu_limit'] = str_replace(',', '', $this->request->getPost("icu_limit"));
$data['proportionatedeductionclause'] = str_replace(',', '', $this->request->getPost("proportionatedeductionclause"));
$data['ailmentcapping'] = $this->request->getPost("ailmentcapping");
$data['ailment_capping_details'] = str_replace(',', '', $this->request->getPost("ailment_capping_details"));
$data['corporatebuffer'] = str_replace(',', '', $this->request->getPost("corporatebuffer"));
$data['non_admissible_contingency_corporate_buffer'] = str_replace(',', '', $this->request->getPost("non_admissible_contingency_corporate_buffer"));
$data['ambulancecharges'] = str_replace(',', '', $this->request->getPost("ambulancecharges"));
$data['airambulance'] = str_replace(',', '', $this->request->getPost("airambulance"));
$data['reasonableandcustomarycharges'] = str_replace(',', '', $this->request->getPost("reasonableandcustomarycharges"));
$data['daycaretreatment'] = str_replace(',', '', $this->request->getPost("daycaretreatment"));
$data['lasiksurgery'] = str_replace(',', '', $this->request->getPost("lasiksurgery"));
$data['ayudhtreatmentcover'] = str_replace(',', '', $this->request->getPost("ayudhtreatmentcover"));
$data['moderntreatmentsasperirdai'] = str_replace(',', '', $this->request->getPost("moderntreatmentsasperirdai"));
$data['opd_treatment'] = str_replace(',', '', $this->request->getPost("opd_treatment"));
$data['days_of_discharge'] = str_replace(',', '', $this->request->getPost("days_of_discharge"));
$data['days_from_dod'] = str_replace(',', '', $this->request->getPost("days_from_dod"));
$data['terrorism'] = str_replace(',', '', $this->request->getPost("terrorism"));
$data['widower_cover'] = str_replace(',', '', $this->request->getPost("widower_cover"));
$data['breavement_cover'] = str_replace(',', '', $this->request->getPost("breavement_cover"));
// $data['waiverofpreexistingdiseases'] = $this->request->getPost("waiverofpreexistingdiseases");
// $data['waiverof1,2,3&4thyearexclusions'] = $this->request->getPost("waiverof1,2,3&4thyearexclusions");
// $data['waiverof30dayswaitingperiod'] = $this->request->getPost("waiverof30dayswaitingperiod");
// $data['waiver_of_90_days_waiting_period'] = $this->request->getPost("waiver_of_90_days_waiting_period");
// $data['waiver_of_other_waiting_periods'] = $this->request->getPost("waiver_of_other_waiting_periods");
// $data['maternity_benefit'] = $this->request->getPost("maternity_benefit");
// $data['9monthwaitingperiodwaived'] = str_replace(',', '', $this->request->getPost("9monthwaitingperiodwaived"));
// $data['maternitycoverage'] = str_replace(',', '', $this->request->getPost("maternitycoverage"));
// $data['twindelivery'] = str_replace(',', '', $this->request->getPost("twindelivery"));
// $data['well_baby_well_mother_expenses'] = str_replace(',', '', $this->request->getPost("well_baby_well_mother_expenses"));
// $data['preandpostnatal'] = str_replace(',', '', $this->request->getPost("preandpostnatal"));
// $data['infertility_treatment_coverage'] = str_replace(',', '', $this->request->getPost("infertility_treatment_coverage"));
// $data['babyday1cover'] = str_replace(',', '', $this->request->getPost("babyday1cover"));
// $data['coverfromthedateofjoining'] = str_replace(',', '', $this->request->getPost("coverfromthedateofjoining"));
// $data['mid_term_addition_of_new_born_newly_wedded_spouse'] = str_replace(',', '', $this->request->getPost("mid_term_addition_of_new_born_newly_wedded_spouse"));
// $data['prehospitalizationcover'] = str_replace(',', '', $this->request->getPost("prehospitalizationcover"));
// $data['posthospitalizationcover'] =$this->request->getPost("posthospitalizationcover");
// $data['congenitaldiseasesinternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesinternal"));
// $data['congenitaldiseasesexternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesexternal"));
// $data['copayzonewisecopay'] = $this->request->getPost("copayzonewisecopay");
// $data['roomrentlimit'] = str_replace(',', '', $this->request->getPost("roomrentlimit"));
// $data['icu_limit'] = str_replace(',', '', $this->request->getPost("icu_limit"));
// $data['proportionatedeductionclause'] = str_replace(',', '', $this->request->getPost("proportionatedeductionclause"));
// $data['ailmentcapping'] = $this->request->getPost("ailmentcapping");
// $data['ailment_capping_details'] = str_replace(',', '', $this->request->getPost("ailment_capping_details"));
// $data['corporatebuffer'] = str_replace(',', '', $this->request->getPost("corporatebuffer"));
// $data['non_admissible_contingency_corporate_buffer'] = str_replace(',', '', $this->request->getPost("non_admissible_contingency_corporate_buffer"));
// $data['ambulancecharges'] = str_replace(',', '', $this->request->getPost("ambulancecharges"));
// $data['airambulance'] = str_replace(',', '', $this->request->getPost("airambulance"));
// $data['reasonableandcustomarycharges'] = str_replace(',', '', $this->request->getPost("reasonableandcustomarycharges"));
// $data['daycaretreatment'] = str_replace(',', '', $this->request->getPost("daycaretreatment"));
// $data['lasiksurgery'] = str_replace(',', '', $this->request->getPost("lasiksurgery"));
// $data['ayudhtreatmentcover'] = str_replace(',', '', $this->request->getPost("ayudhtreatmentcover"));
// $data['moderntreatmentsasperirdai'] = str_replace(',', '', $this->request->getPost("moderntreatmentsasperirdai"));
// $data['opd_treatment'] = str_replace(',', '', $this->request->getPost("opd_treatment"));
// $data['days_of_discharge'] = str_replace(',', '', $this->request->getPost("days_of_discharge"));
// $data['days_from_dod'] = str_replace(',', '', $this->request->getPost("days_from_dod"));
// $data['terrorism'] = str_replace(',', '', $this->request->getPost("terrorism"));
// $data['widower_cover'] = str_replace(',', '', $this->request->getPost("widower_cover"));
// $data['breavement_cover'] = str_replace(',', '', $this->request->getPost("breavement_cover"));
$data['suminsuredenhancement'] = str_replace(',', '', $this->request->getPost("suminsuredenhancement"));
// $data['suminsuredenhancement'] = str_replace(',', '', $this->request->getPost("suminsuredenhancement"));
// $data['special_condition_label'] = str_replace(',', '', $this->request->getPost("special_condition_label")) ?? [];
// $data['special_condition_input'] = str_replace(',', '', $this->request->getPost("special_condition_input")) ?? [];
// $data['multiple_sum_insured'] = str_replace(',', '', $this->request->getPost("multiple_sum_insured")) ?? [];
$fields = [
'waiverofpreexistingdiseases' => false,
'waiverof1,2,3&4thyearexclusions' => false,
'waiverof30dayswaitingperiod' => false,
'waiver_of_90_days_waiting_period' => false,
'waiver_of_other_waiting_periods' => false,
'maternity_benefit' => false,
'9monthwaitingperiodwaived' => true,
'maternitycoverage' => true,
'twindelivery' => true,
'well_baby_well_mother_expenses' => true,
'preandpostnatal' => true,
'infertility_treatment_coverage' => true,
'babyday1cover' => true,
'coverfromthedateofjoining' => true,
'mid_term_addition_of_new_born_newly_wedded_spouse' => true,
'prehospitalizationcover' => true,
'posthospitalizationcover' => false,
'congenitaldiseasesinternal' => true,
'congenitaldiseasesexternal' => true,
'copayzonewisecopay' => false,
'roomrentlimit' => true,
'icu_limit' => true,
'proportionatedeductionclause' => true,
'ailmentcapping' => false,
'ailment_capping_details' => true,
'corporatebuffer' => true,
'non_admissible_contingency_corporate_buffer' => true,
'ambulancecharges' => true,
'airambulance' => true,
'reasonableandcustomarycharges' => true,
'daycaretreatment' => true,
'lasiksurgery' => true,
'ayudhtreatmentcover' => true,
'moderntreatmentsasperirdai' => true,
'opd_treatment' => true,
'days_of_discharge' => true,
'days_from_dod' => true,
'terrorism' => true,
'widower_cover' => true,
'breavement_cover' => true,
'suminsuredenhancement' => true,
'special_condition_label' => true,
'special_condition_input' => true,
'multiple_sum_insured' => true,
];
// $data = [];
foreach ($fields as $field => $needsCleanup) {
$value = $this->request->getPost($field);
if ($value !== null && $value !== '') {
$data[$field] = $needsCleanup ? str_replace(',', '', $value) : $value;
}
}
$data['special_condition_label'] = str_replace(',', '', $this->request->getPost("special_condition_label")) ?? [];
$data['special_condition_input'] = str_replace(',', '', $this->request->getPost("special_condition_input")) ?? [];
$data['multiple_sum_insured'] = str_replace(',', '', $this->request->getPost("multiple_sum_insured")) ?? [];
$data['enrollment_display_key'] = $this->enrollmentGMCDisplayValueTransform();
@ -2720,32 +2777,78 @@ class ClientController extends AdminController
$data['age_ratio']['self']['max'] = $this->request->getPost("self_max_age");
$data['is_payable_employee']['self'] = 0;
$data['accidentalDeathBenefit'] = str_replace(',', '', $this->request->getPost("accidentalDeathBenefit"));
$data['permanentTotalDisablement'] = str_replace(',', '', $this->request->getPost("permanentTotalDisablement"));
$data['permanentPartialDisablement'] = $this->request->getPost("permanentPartialDisablement");
$data['temporaryTotalDisablementBenefit'] = $this->request->getPost("temporaryTotalDisablementBenefit");
$data['medical_expenses_medical_extension'] = str_replace(',', '', $this->request->getPost("medical_expenses_medical_extension"));
$data['opd_treatment_cover'] = str_replace(',', '', $this->request->getPost("opd_treatment_cover"));
$data['ambulanceCharges'] = str_replace(',', '', $this->request->getPost("ambulanceCharges"));
$data['repatriation_of_mortal_remains'] = str_replace(',', '', $this->request->getPost("repatriation_of_mortal_remains"));
$data['childrenEducationWelfareFund'] = str_replace(',', '', $this->request->getPost("childrenEducationWelfareFund"));
$data['terrorism'] = $this->request->getPost("terrorism");
$data['worldwideCover'] = $this->request->getPost("worldwideCover");
$data['family_transportation_benefits'] = $this->request->getPost("family_transportation_benefits");
$data['fractures_dislocation_burns'] = $this->request->getPost("fractures_dislocation_burns");
$data['coma'] = $this->request->getPost("coma");
$data['carriageOfDeadBody'] = $this->request->getPost("carriageOfDeadBody");
$data['compassionateVisitExpenses'] = $this->request->getPost("compassionateVisitExpenses");
$data['travel_expenses_for_medical_treatment'] = $this->request->getPost("travel_expenses_for_medical_treatment");
$data['daily_cash_allowance'] = $this->request->getPost("daily_cash_allowance");
$data['artifical_limb_and_prosthesis'] = $this->request->getPost("artifical_limb_and_prosthesis");
$data['animalSnakeInsectBite'] = $this->request->getPost("animalSnakeInsectBite");
$data['air_ambulance'] = $this->request->getPost("air_ambulance");
// $data['accidentalDeathBenefit'] = str_replace(',', '', $this->request->getPost("accidentalDeathBenefit"));
// $data['permanentTotalDisablement'] = str_replace(',', '', $this->request->getPost("permanentTotalDisablement"));
// $data['permanentPartialDisablement'] = $this->request->getPost("permanentPartialDisablement");
// $data['temporaryTotalDisablementBenefit'] = $this->request->getPost("temporaryTotalDisablementBenefit");
// $data['medical_expenses_medical_extension'] = str_replace(',', '', $this->request->getPost("medical_expenses_medical_extension"));
// $data['opd_treatment_cover'] = str_replace(',', '', $this->request->getPost("opd_treatment_cover"));
// $data['ambulanceCharges'] = str_replace(',', '', $this->request->getPost("ambulanceCharges"));
// $data['repatriation_of_mortal_remains'] = str_replace(',', '', $this->request->getPost("repatriation_of_mortal_remains"));
// $data['childrenEducationWelfareFund'] = str_replace(',', '', $this->request->getPost("childrenEducationWelfareFund"));
// $data['terrorism'] = $this->request->getPost("terrorism");
// $data['worldwideCover'] = $this->request->getPost("worldwideCover");
// $data['family_transportation_benefits'] = $this->request->getPost("family_transportation_benefits");
// $data['fractures_dislocation_burns'] = $this->request->getPost("fractures_dislocation_burns");
// $data['coma'] = $this->request->getPost("coma");
// $data['carriageOfDeadBody'] = $this->request->getPost("carriageOfDeadBody");
// $data['compassionateVisitExpenses'] = $this->request->getPost("compassionateVisitExpenses");
// $data['travel_expenses_for_medical_treatment'] = $this->request->getPost("travel_expenses_for_medical_treatment");
// $data['daily_cash_allowance'] = $this->request->getPost("daily_cash_allowance");
// $data['artifical_limb_and_prosthesis'] = $this->request->getPost("artifical_limb_and_prosthesis");
// $data['animalSnakeInsectBite'] = $this->request->getPost("animalSnakeInsectBite");
// $data['air_ambulance'] = $this->request->getPost("air_ambulance");
$data['gpa_special_condition_label'] = str_replace(',', '', $this->request->getPost("gpa_special_condition_label")) ?? [];
$data['gpa_special_condition_input'] = str_replace(',', '', $this->request->getPost("gpa_special_condition_input")) ?? [];
$data['multiple_sum_insured'] = str_replace(',', '', $this->request->getPost("multiple_sum_insured")) ?? [];
// $data['gpa_special_condition_label'] = str_replace(',', '', $this->request->getPost("gpa_special_condition_label")) ?? [];
// $data['gpa_special_condition_input'] = str_replace(',', '', $this->request->getPost("gpa_special_condition_input")) ?? [];
// $data['multiple_sum_insured'] = str_replace(',', '', $this->request->getPost("multiple_sum_insured")) ?? [];
$fieldsWithCommaRemoval = [
'accidentalDeathBenefit',
'permanentTotalDisablement',
'medical_expenses_medical_extension',
'opd_treatment_cover',
'ambulanceCharges',
'repatriation_of_mortal_remains',
'childrenEducationWelfareFund',
'gpa_special_condition_label',
'gpa_special_condition_input',
'multiple_sum_insured',
];
$fieldsWithoutCommaRemoval = [
'permanentPartialDisablement',
'temporaryTotalDisablementBenefit',
'terrorism',
'worldwideCover',
'family_transportation_benefits',
'fractures_dislocation_burns',
'coma',
'carriageOfDeadBody',
'compassionateVisitExpenses',
'travel_expenses_for_medical_treatment',
'daily_cash_allowance',
'artifical_limb_and_prosthesis',
'animalSnakeInsectBite',
'air_ambulance'
];
// Remove commas and assign if present
foreach ($fieldsWithCommaRemoval as $field) {
$value = $this->request->getPost($field);
if ($value !== null) {
$data[$field] = str_replace(',', '', $value);
}
}
// Direct assign if present
foreach ($fieldsWithoutCommaRemoval as $field) {
$value = $this->request->getPost($field);
if ($value !== null) {
$data[$field] = $value;
}
}
$data['enrollment_display_key'] = $this->enrollmentGPADisplayValueTransform();
@ -3372,11 +3475,29 @@ class ClientController extends AdminController
$client_policy_id = $this->request->getPost("client_policy_id");
$policy_terms = $this->request->getPost("policy_terms");
if (!empty($policy_terms)) {
$policy_terms = json_decode($policy_terms, true);
$data = [];
foreach ($policy_terms as $key => $value) {
if (str_ends_with($key, '_display')) {
$original_key = substr($key, 0, -8);
$newKey = implode(' ', array_map('ucfirst', explode('_', $original_key)));
$data['enrollment_display_key'][$newKey] = $policy_terms[$original_key] ?? " ";
} else {
$data[$key] = $value;
}
}
if (!empty($data)) {
$policy_terms['is_payable_employee']['self'] = 0;
$policy_terms = json_encode($policy_terms);
$policy_terms = json_encode($data);
}

View File

@ -2912,6 +2912,7 @@ class LeadsController extends BaseController
$JSON = json_decode($QCRData['json'], true);
$converted_json = $this->transformProposelData($JSON, $proposel_data['proposel_name'], $proposel_data['insurer_name']);
// log_message('error', 'Converted JSON: ' . json_encode($converted_json));
return $this->convertQCRJsonToPolicyTerms($converted_json, $data['policy_type_id'], $proposel_data['proposel_name'], $proposel_data['insurer_name']);
} catch (\Throwable $e) {
$this->myLogger->logme('error','preparePolicyTermsFromRFQ');
@ -2963,7 +2964,7 @@ class LeadsController extends BaseController
foreach ($dataRow['data'] as $cellData) {
$parentth = $cellData['parentth'] ?? '';
$subth = $cellData['subth'] ?? '';
$input_value = $cellData['input_value'] ?? '';
$input_value = $cellData['input_value'] != "" ? $cellData['input_value'] : ($cellData['value'] ?? '');
$value = $cellData['value'] ?? '';
// Skip unwanted keys
@ -2975,7 +2976,9 @@ class LeadsController extends BaseController
// CASE 1: Handle special conditions
case str_starts_with($item, 'special_condition') && $parentth === $proposel_name && $subth === $insurer_name:
// log_message("error","INPUT".json_encode($input_value));
$parts = explode('-', $input_value);
$labelKey = $policy_type == 1 ? 'gpa_special_condition_label' : 'special_condition_label';
$inputKey = $policy_type == 1 ? 'gpa_special_condition_input' : 'special_condition_input';
@ -3053,7 +3056,15 @@ class LeadsController extends BaseController
// Set the value directly, overwriting with latest encountered
if (!empty($item) && !empty($value)) {
$terms_array[$item] = $value;
$finalItem = $item;
if (strpos($tableGroup['tableId'], 'summary') !== false) {
$policy_type = explode('_', $tableGroup['tableId'])[0] ?? '';
$finalItem = $policy_type . ' - ' . $item;
}
$terms_array[$finalItem] = $value;
}
}
}

View File

@ -188,6 +188,7 @@ class TicketController extends BaseController
} else {
$isFromDashboard = $this->request->getPost("is_dashboard");
log_message('error', 'Is From Dashboard: ' . $isFromDashboard);
if (isset($isFromDashboard) && !empty($isFromDashboard)){
$data['page_name'] = "Claims";
@ -223,7 +224,7 @@ class TicketController extends BaseController
public function ticketSearch($action = null)
{
$db = db_connect();
// log_message('error', 'Ticket Search Action: ' . $action);
$subquery = $db->table('ticket_master tm')
->select([
'tm.id AS ticket_id',

View File

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

View File

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

View File

@ -179,7 +179,7 @@ body {
}
function client_policies() {
var check_client_id = $('#general_PrimaryKey');
var check_client_id = $('#general_PrimaryKey').val();
if(check_client_id[0].value == '' || check_client_id[0].value == null || check_client_id[0].value == 0){

View File

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

View File

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

View File

@ -87,7 +87,25 @@ label {
<input type="hidden" name="client_policy_id" id="other_client_policy_id" />
<input type="hidden" name="policy_id" id="gpa_policy_id" />
<input type="hidden" id="emp_count" />
<div class="row" style="margin-bottom: 10px;">
<div id="sumInsuredDiv">
<div class="col-md-6">
<label for="sumInsured">Sum Insured</label>
</div>
<div class="col-md-4">
<input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
</div>
<div class="col-md-2" style="position: relative;left: 88px;">
<button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
</div>
<div class="col-md-6">
</div>
<div class="col-md-6">
<div id='numberToWordOthers' class="text-danger-2" ></div>
</div>
</div>
<div id="sum_insured_add_more" ></div>
</div>
<div id="append_html_for_other_policy_terms"></div>
<hr>
@ -164,6 +182,9 @@ $("#otherPolicyTerms").submit(function(event) {
// Append the JSON string to the FormData object
formData.append('policy_terms', jsonString);
formData.forEach((value, key) => {
console.log(key + ': ' + value);
});
$.ajax({
data: formData,
@ -207,17 +228,17 @@ $("#otherPolicyTerms").submit(function(event) {
});
var policy_type_id = "";
$('body').on('click', '.btnPolicyMaster', function() {
var client_policy_id = $(this).data('id');
var policy_type_id = $(this).data('typeid');
policy_type_id = $(this).data('typeid');
console.log('policy_type_id', policy_type_id);
console.log('client_policy_id :', client_policy_id);
$('#other_client_policy_id').val(client_policy_id);
appendPolicyTermsHTML(policy_type_id);
// appendPolicyTermsHTML(policy_type_id);
var gpa_policy_type_id = $(this).attr('id');
// console.log('gpa_policy_type_id', gpa_policy_type_id)
@ -265,13 +286,14 @@ $('body').on('click', '.btnPolicyMaster', function() {
if (res) {
//special conditions fields
let gpaJsonObjectForSpecialCondition = JSON.parse(res.data);
Object.keys(gpaJsonObjectForSpecialCondition).forEach(function(key) {
if (key.includes("other_special_condition_label") || key.includes(
"other_special_condition_input")) {
if (key.includes("other_special_condition_label")) {
let otherTermsJsonObjectSpecialCondition = JSON.parse(res.data);
Object.keys(otherTermsJsonObjectSpecialCondition).forEach(function(key) {
if (key.includes("special_condition_label") || key.includes(
"special_condition_input")) {
if (key.includes("special_condition_label")) {
for (let index = 0; index <
gpaJsonObjectForSpecialCondition[key].length; index++) {
otherTermsJsonObjectSpecialCondition[key].length; index++) {
specialConditionForOthers();
}
}
@ -280,13 +302,13 @@ $('body').on('click', '.btnPolicyMaster', function() {
if (elements) {
elements.forEach((element, index) => {
if (gpaJsonObjectForSpecialCondition[key][
if (otherTermsJsonObjectSpecialCondition[key][
index
] == undefined) {
element.value = " ";
} else {
element.value =
gpaJsonObjectForSpecialCondition[key][
otherTermsJsonObjectSpecialCondition[key][
index
];
}
@ -296,10 +318,39 @@ $('body').on('click', '.btnPolicyMaster', function() {
}
if (!key.startsWith("special_condition") && !key.startsWith("sum_insured") && !key.startsWith("enrollment_display_key") ) {
termsHTML = `
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="${key}_display"
id="${key}_display" class="unchecked" checked>
</div>
<div class="col-md-5">
<label for="${key}">${beautifyString(key)}</label>
</div>
<div class="col-md-6">
<input type="text" name="${key}" id="${key}" class="form-control">
</div>
</div>
`
$("#append_html_for_other_policy_terms").append(termsHTML);
}
if (key.includes("multiple_sum_insured")) {
gpaJsonObjectForSpecialCondition[key].forEach((value, index) => {
appendOtherSIAddMore(value);
});
const value = otherTermsJsonObjectSpecialCondition[key];
if (Array.isArray(value)) {
value.forEach(item => appendOtherSIAddMore(item));
} else if (typeof value === 'object' && value !== null) {
Object.values(value).forEach(item => appendOtherSIAddMore(item));
}
// else if (typeof value === 'string') {
// appendOtherSIAddMore(value); // Use directly, no loop
// }
}
});
@ -367,6 +418,11 @@ $('body').on('click', '.btnPolicyMaster', function() {
}
if(policy_type_id > 7) {
$("#sumInsuredDiv").empty();
}
});
</script>
@ -395,11 +451,11 @@ function specialConditionForOthers(count = 0) {
var appendElement = `<div class="form-group col-md-6 form-group-client-policy-masters removeDom">
<label for="specialconditionlabel" class="special_condition_label[]" style="width: 450px;position: relative;bottom: 6px;">
<input class="form-control" name="other_special_condition_label[]" id="other_special_condition_label[]" style="position: relative;right: 15px;">
<input class="form-control" name="special_condition_label[]" id="special_condition_label[]" style="position: relative;right: 0px;">
<span class="specialConditionClose" style="color: red; float: right;position: relative;bottom: 28px;left: 15px;">X</span>
</label>
<input type="text" name="other_special_condition_input[]" id="other_special_condition_input[]" class="form-control s special_condition_input[]">
<input type="text" name="special_condition_input[]" id="special_condition_input[]" class="form-control s special_condition_input[]">
</div>`;
console.log($(this));
$('.other_special_condition').each(function() {
@ -465,208 +521,208 @@ function appendPolicyTermsHTML(policy_type) {
var termsHTML = ""
$('#append_html_for_other_policy_terms').empty();
if (policy_type == 7) {
// if (policy_type == 7) {
termsHTML = `
// termsHTML = `
<div class="form-group">
// <div class="form-group">
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="sumInsured">Sum Insured</label>
</div>
<div class="col-md-4">
<input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
</div>
<div class="col-md-2" style="position: relative;left: 88px;">
<button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
</div>
<div class="col-md-6">
</div>
<div class="col-md-6">
<div id='numberToWordOthers' class="text-danger-2" ></div>
</div>
</div>
// <div class="row" style="margin-bottom: 10px;">
// <div class="col-md-6">
// <label for="sumInsured">Sum Insured</label>
// </div>
// <div class="col-md-4">
// <input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
// </div>
// <div class="col-md-2" style="position: relative;left: 88px;">
// <button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
// </div>
// <div class="col-md-6">
// </div>
// <div class="col-md-6">
// <div id='numberToWordOthers' class="text-danger-2" ></div>
// </div>
// </div>
<div id="sum_insured_add_more" ></div>
// <div id="sum_insured_add_more" ></div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="totalSumInsured">Policy Type</label>
</div>
<div class="col-md-6">
<input type="text" name="policy_type" id="policy_type" class="form-control">
</div>
</div>
// <div class="row" style="margin-bottom: 10px;">
// <div class="col-md-6">
// <label for="totalSumInsured">Policy Type</label>
// </div>
// <div class="col-md-6">
// <input type="text" name="policy_type" id="policy_type" class="form-control">
// </div>
// </div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="totalSumInsured">Existing Insurer</label>
</div>
<div class="col-md-6">
<input type="text" name="existing_insurer" id="existing_insurer" class="form-control">
</div>
</div>
// <div class="row" style="margin-bottom: 10px;">
// <div class="col-md-6">
// <label for="totalSumInsured">Existing Insurer</label>
// </div>
// <div class="col-md-6">
// <input type="text" name="existing_insurer" id="existing_insurer" class="form-control">
// </div>
// </div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="renewal_lives">Renewal Lives</label>
</div>
<div class="col-md-6">
<input type="text" name="renewal_lives" id="renewal_lives" class="form-control">
</div>
</div>
// <div class="row" style="margin-bottom: 10px;">
// <div class="col-md-6">
// <label for="renewal_lives">Renewal Lives</label>
// </div>
// <div class="col-md-6">
// <input type="text" name="renewal_lives" id="renewal_lives" class="form-control">
// </div>
// </div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="totalSumInsured">Total Sum Assured</label>
</div>
<div class="col-md-6">
<input type="text" style="width: 100% !important;" class="form-control" name="total_sum_insured"
id="total_sum_insured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)">
</div>
<div class="col-md-6">
</div>
<div class="col-md-6">
<div id='numberToWordTotalSumInsured' class="text-danger-2"></div>
</div>
</div>
// <div class="row" style="margin-bottom: 10px;">
// <div class="col-md-6">
// <label for="totalSumInsured">Total Sum Assured</label>
// </div>
// <div class="col-md-6">
// <input type="text" style="width: 100% !important;" class="form-control" name="total_sum_insured"
// id="total_sum_insured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)">
// </div>
// <div class="col-md-6">
// </div>
// <div class="col-md-6">
// <div id='numberToWordTotalSumInsured' class="text-danger-2"></div>
// </div>
// </div>
<div class="row" style="margin-bottom: 10px;display:true;">
<div class="col-md-6">
<label for="lives_at_inception">Lives at Inception</label>
</div>
<div class="col-md-6">
<input type="text" name="lives_at_inception" id="lives_at_inception" class="form-control">
</div>
</div>
// <div class="row" style="margin-bottom: 10px;display:true;">
// <div class="col-md-6">
// <label for="lives_at_inception">Lives at Inception</label>
// </div>
// <div class="col-md-6">
// <input type="text" name="lives_at_inception" id="lives_at_inception" class="form-control">
// </div>
// </div>
<div class="row" style="margin-bottom: 10px;display:true;">
<div class="col-md-6">
<label for="totalSumInsured">Total Sum Insured at Inception</label>
</div>
<div class="col-md-6">
<input type="text" name="total_sum_insured_at_inception" id="total_sum_insured_at_inception"
class="form-control" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)">
</div>
</div>
// <div class="row" style="margin-bottom: 10px;display:true;">
// <div class="col-md-6">
// <label for="totalSumInsured">Total Sum Insured at Inception</label>
// </div>
// <div class="col-md-6">
// <input type="text" name="total_sum_insured_at_inception" id="total_sum_insured_at_inception"
// class="form-control" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)">
// </div>
// </div>
<div class="row" style="margin-bottom: 10px;display:true;">
<div class="col-md-6">
<label for="totalSumInsured">Premium at Inception (Excl GST)</label>
</div>
<div class="col-md-6">
<input type="text" name="premium_at_inception" id="premium_at_inception" class="form-control">
</div>
</div>
// <div class="row" style="margin-bottom: 10px;display:true;">
// <div class="col-md-6">
// <label for="totalSumInsured">Premium at Inception (Excl GST)</label>
// </div>
// <div class="col-md-6">
// <input type="text" name="premium_at_inception" id="premium_at_inception" class="form-control">
// </div>
// </div>
<div class="row" style="margin-bottom: 10px;display:true;">
<div class="col-md-6">
<label for="coverage">Coverage</label>
</div>
<div class="col-md-6">
<input type="text" name="coverage " id="coverage" class="form-control">
</div>
</div>
// <div class="row" style="margin-bottom: 10px;display:true;">
// <div class="col-md-6">
// <label for="coverage">Coverage</label>
// </div>
// <div class="col-md-6">
// <input type="text" name="coverage " id="coverage" class="form-control">
// </div>
// </div>
<div class="row" style="margin-bottom: 10px;display:true;">
<div class="col-md-6">
<label for="free_cover_limit">Free Cover Limit</label>
</div>
<div class="col-md-6">
<input type="text" name="free_cover_limit" id="free_cover_limit" class="form-control">
</div>
</div>
// <div class="row" style="margin-bottom: 10px;display:true;">
// <div class="col-md-6">
// <label for="free_cover_limit">Free Cover Limit</label>
// </div>
// <div class="col-md-6">
// <input type="text" name="free_cover_limit" id="free_cover_limit" class="form-control">
// </div>
// </div>
</div>
// </div>
`
// `
} else if (policy_type == 6) {
// } else if (policy_type == 6) {
termsHTML = `
// termsHTML = `
<div class="form-group EDLI">
// <div class="form-group EDLI">
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="sumInsured">Sum Insured</label>
</div>
<div class="col-md-4" >
<input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
</div>
<div class="col-md-2" style="position: relative;left: 88px;">
<button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
</div>
<div class="col-md-6">
</div>
<div class="col-md-6">
<div id='numberToWordOthers' class="text-danger-2" ></div>
</div>
</div>
// <div class="row" style="margin-bottom: 10px;">
// <div class="col-md-6">
// <label for="sumInsured">Sum Insured</label>
// </div>
// <div class="col-md-4" >
// <input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
// </div>
// <div class="col-md-2" style="position: relative;left: 88px;">
// <button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
// </div>
// <div class="col-md-6">
// </div>
// <div class="col-md-6">
// <div id='numberToWordOthers' class="text-danger-2" ></div>
// </div>
// </div>
<div id="sum_insured_add_more" ></div>
// <div id="sum_insured_add_more" ></div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="totalSumInsured">Existing Insurer</label>
</div>
<div class="col-md-6">
<input type="text" name="existing_insurer" id="existing_insurer" class="form-control">
</div>
</div>
// <div class="row" style="margin-bottom: 10px;">
// <div class="col-md-6">
// <label for="totalSumInsured">Existing Insurer</label>
// </div>
// <div class="col-md-6">
// <input type="text" name="existing_insurer" id="existing_insurer" class="form-control">
// </div>
// </div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="renewal_lives">Renewal Lives</label>
</div>
<div class="col-md-6">
<input type="text" name="renewal_lives" id="renewal_lives" class="form-control">
</div>
</div>
// <div class="row" style="margin-bottom: 10px;">
// <div class="col-md-6">
// <label for="renewal_lives">Renewal Lives</label>
// </div>
// <div class="col-md-6">
// <input type="text" name="renewal_lives" id="renewal_lives" class="form-control">
// </div>
// </div>
<div class="row" style="margin-bottom: 10px;display:true;">
<div class="col-md-6">
<label for="lives_at_inception">Lives at Inception</label>
</div>
<div class="col-md-6">
<input type="text" name="lives_at_inception" id="lives_at_inception" class="form-control">
</div>
</div>
// <div class="row" style="margin-bottom: 10px;display:true;">
// <div class="col-md-6">
// <label for="lives_at_inception">Lives at Inception</label>
// </div>
// <div class="col-md-6">
// <input type="text" name="lives_at_inception" id="lives_at_inception" class="form-control">
// </div>
// </div>
<div class="row" style="margin-bottom: 10px;display:true;">
<div class="col-md-6">
<label for="totalSumInsured">Total Sum Insured at Inception</label>
</div>
<div class="col-md-6">
<input type="text" name="total_sum_insured_at_inception" id="total_sum_insured_at_inception"
class="form-control" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)">
</div>
</div>
// <div class="row" style="margin-bottom: 10px;display:true;">
// <div class="col-md-6">
// <label for="totalSumInsured">Total Sum Insured at Inception</label>
// </div>
// <div class="col-md-6">
// <input type="text" name="total_sum_insured_at_inception" id="total_sum_insured_at_inception"
// class="form-control" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)">
// </div>
// </div>
<div class="row" style="margin-bottom: 10px;display:true;">
<div class="col-md-6">
<label for="coverage">Coverage</label>
</div>
<div class="col-md-6">
<input type="text" name="coverage " id="coverage" class="form-control">
</div>
</div>
// <div class="row" style="margin-bottom: 10px;display:true;">
// <div class="col-md-6">
// <label for="coverage">Coverage</label>
// </div>
// <div class="col-md-6">
// <input type="text" name="coverage " id="coverage" class="form-control">
// </div>
// </div>
<div class="row" style="margin-bottom: 10px;display:true;">
<div class="col-md-6">
<label for="free_cover_limit">Free Cover Limit for Base Cover</label>
</div>
<div class="col-md-6">
<input type="text" name="free_cover_limit_for_base_cover" id="free_cover_limit_for_base_cover" class="form-control">
</div>
</div>
// <div class="row" style="margin-bottom: 10px;display:true;">
// <div class="col-md-6">
// <label for="free_cover_limit">Free Cover Limit for Base Cover</label>
// </div>
// <div class="col-md-6">
// <input type="text" name="free_cover_limit_for_base_cover" id="free_cover_limit_for_base_cover" class="form-control">
// </div>
// </div>
</div>
// </div>
`
}
// `
// }
$('#append_html_for_other_policy_terms').append(termsHTML);
}
@ -699,4 +755,13 @@ function appendOtherSIAddMore(data = null) {
addMoreContainer.insertAdjacentHTML('beforeend', html);
}
function beautifyString(str) {
return str
.split('_') // Split the string by underscores
.map(word =>
word.charAt(0).toUpperCase() + word.slice(1).toLowerCase() // Capitalize each word
)
.join(' '); // Join with spaces instead of underscores
}
</script>

View File

@ -1,6 +1,6 @@
<!-- Modal content for the Large example -->
<style>
.underline-input {
.underline-input {
border: none;
border-bottom: 1px solid grey;
/* Underline style */
@ -10,9 +10,9 @@
/* Adjust padding (top/bottom right/left) */
font-size: 16px;
/* Adjust font size */
}
}
.button-like {
.button-like {
display: inline-block;
padding: 8px 15px;
background-color: #02a8b5;
@ -21,55 +21,55 @@
border-radius: 2px;
cursor: pointer;
margin-right: -85px;
}
}
.radiobuttondiv {
.radiobuttondiv {
margin-left: 32px;
}
}
/* .{
/* .{
width:62% !important;
margin-left: 30px;
margin-top: 3px
} */
/* .form-group.col-md-6 */
.form-group-client-policy-master {
/* .form-group.col-md-6 */
.form-group-client-policy-master {
display: -webkit-box;
max-width: 100% !important;
/* border:1px solid; */
/* background-color: #0001; */
}
}
.form-group-client-policy-masters {
.form-group-client-policy-masters {
display: -webkit-box;
max-width: 100% !important;
margin-left: -23px;
}
}
.flex-container {
.flex-container {
display: block;
/* flex-wrap: wrap; */
/* align-items: center; Align items vertically center */
}
}
.flex-container>div {
.flex-container>div {
flex: 1;
/* Each div takes equal space */
}
}
label {
label {
padding-top: 7px;
width: 400px;
/* background-color: #0001; */
height: 36px;
/* text-align: center; */
}
}
.jodit-status-bar {
.jodit-status-bar {
display: none;
}
}
/* .jodit-container{
/* .jodit-container{
width: 821px !important;
margin-top: 3px;
margin-bottom: 3px;
@ -77,24 +77,24 @@ label {
height: 0px !important;
min-height: 100px !important;
} */
.input-group {
.input-group {
width: 64.5% !important;
}
}
.input-group-append-client-policy-master {
.input-group-append-client-policy-master {
margin-top: 3px;
}
}
.jodit-wysiwyg {
.jodit-wysiwyg {
margin-bottom: 162px;
}
}
.s {
.s {
margin-left: 50px;
/* width: 689px; */
/* margin-left: 141px; */
width: 576px;
}
}
</style>
@ -326,10 +326,10 @@ label {
<input type="checkbox" style="margin-top: 12px" name="waiverofpreexistingdiseases_display" id="waiverofpreexistingdiseases_display" class="unchecked" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Waiver of Pre-existing Diseases</label>
<label for="waiverofpreexistingdiseases">Waiver of Pre-existing Diseases</label>
</div>
<div class="col-md-6">
<input type="text" name="waiverofpreexistingdiseases" class="form-control waiverofpreexistingdiseases">
<input type="text" name="waiverofpreexistingdiseases" id="waiverofpreexistingdiseases" class="form-control waiverofpreexistingdiseases">
</div>
</div>
@ -405,10 +405,10 @@ label {
id="9monthwaitingperiodwaived_display" class="unchecked" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">9-month waiting Period waived</label>
<label for="9monthwaitingperiodwaived">9-month waiting Period waived</label>
</div>
<div class="col-md-6">
<input type="text" name="9monthwaitingperiodwaived" class="form-control 9monthwaitingperiodwaived">
<input type="text" name="9monthwaitingperiodwaived" id="9monthwaitingperiodwaived" class="form-control 9monthwaitingperiodwaived">
</div>
</div>
@ -418,7 +418,7 @@ label {
id="maternitycoverage_display" class="unchecked" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Maternity Coverage</label>
<label for="maternitycoverage">Maternity Coverage</label>
</div>
<div class="col-md-6">
<input type="text" name="maternitycoverage" id="maternitycoverage" class="form-control">
@ -431,7 +431,7 @@ label {
id="twindelivery_display" class="unchecked" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Twin Delivery</label>
<label for="twindelivery">Twin Delivery</label>
</div>
<div class="col-md-6">
<input type="text" name="twindelivery" id="twindelivery" class="form-control ">
@ -457,7 +457,7 @@ label {
id="preandpostnatal_display" class="unchecked" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Pre and Post natal</label>
<label for="preandpostnatal">Pre and Post natal</label>
</div>
<div class="col-md-6">
<input type="text" name="preandpostnatal" id="preandpostnatal" class="form-control ">
@ -483,7 +483,7 @@ label {
id="babyday1cover_display" class="unchecked" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Baby Day 1 Cover</label>
<label for="babyday1cover">Baby Day 1 Cover</label>
</div>
<div class="col-md-6">
<input type="text" name="babyday1cover" id="babyday1cover" class="form-control ">
@ -496,7 +496,7 @@ label {
id="coverfromthedateofjoining_display" class="unchecked" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Cover from the date of Joining</label>
<label for="coverfromthedateofjoining">Cover from the date of Joining</label>
</div>
<div class="col-md-6">
<input type="text" name="coverfromthedateofjoining" id="coverfromthedateofjoining"
@ -523,7 +523,7 @@ label {
id="prehospitalizationcover_display" class="unchecked" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Pre Hospitalization Cover</label>
<label for="prehospitalizationcover">Pre Hospitalization Cover</label>
</div>
<div class="col-md-6">
<input type="text" name="prehospitalizationcover" id="prehospitalizationcover"
@ -537,7 +537,7 @@ label {
id="posthospitalizationcover_display" class="unchecked" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Post Hospitalization Cover</label>
<label for="posthospitalizationcover">Post Hospitalization Cover</label>
</div>
<div class="col-md-6">
<input type="text" name="posthospitalizationcover" id="posthospitalizationcover"
@ -551,7 +551,7 @@ label {
id="congenitaldiseasesinternal_display" class="unchecked" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Congenital Diseases - Internal</label>
<label for="congenitaldiseasesinternal">Congenital Diseases - Internal</label>
</div>
<div class="col-md-6">
<input type="text" name="congenitaldiseasesinternal" class="form-control congenitaldiseasesinternal">
@ -564,7 +564,7 @@ label {
id="congenitaldiseasesexternal_display" class="unchecked" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Congenital Diseases - External</label>
<label for="congenitaldiseasesexternal">Congenital Diseases - External</label>
</div>
<div class="col-md-6">
<input type="text" name="congenitaldiseasesexternal" id="congenitaldiseasesexternal"
@ -591,7 +591,7 @@ label {
id="roomrentlimit_display" class="unchecked" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Room Rent Limit</label>
<label for="roomrentlimit">Room Rent Limit</label>
</div>
<div class="col-md-6">
<input type="text" name="roomrentlimit" id="roomrentlimit" class="form-control ">
@ -617,7 +617,7 @@ label {
id="proportionatedeductionclause_display" class="unchecked" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Proportionate Deduction Clause</label>
<label for="proportionatedeductionclause">Proportionate Deduction Clause</label>
</div>
<div class="col-md-6">
<input type="text" name="proportionatedeductionclause" id="proportionatedeductionclause" class="form-control proportionatedeductionclause">
@ -643,7 +643,7 @@ label {
id="ailment_capping_details_display" class="unchecked" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Ailment capping Details</label>
<label for="ailment_capping_details">Ailment capping Details</label>
</div>
<div class="col-md-6">
<input type="text" name="ailment_capping_details" id="ailment_capping_details" class="form-control">
@ -656,7 +656,7 @@ label {
id="corporatebuffer_display" class="unchecked" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Corporate Buffer</label>
<label for="corporatebuffer">Corporate Buffer</label>
</div>
<div class="col-md-6">
<input type="text" name="corporatebuffer" id="corporatebuffer" class="form-control ">
@ -683,7 +683,7 @@ label {
id="ambulancecharges_display" class="unchecked" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Ambulance Charges</label>
<label for="ambulancecharges">Ambulance Charges</label>
</div>
<div class="col-md-6">
<input type="text" name="ambulancecharges" id="ambulancecharges" class="form-control ">
@ -696,7 +696,7 @@ label {
id="airambulance_display" class="unchecked" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Air Ambulance</label>
<label for="airambulance">Air Ambulance</label>
</div>
<div class="col-md-6">
<input type="text" name="airambulance" id="airambulance" class="form-control ">
@ -735,7 +735,7 @@ label {
id="lasiksurgery_display" class="unchecked" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Lasik Surgery</label>
<label for="lasiksurgery">Lasik Surgery</label>
</div>
<div class="col-md-6">
<input type="text" name="lasiksurgery" id="lasiksurgery" class="form-control ">
@ -744,14 +744,14 @@ label {
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="ayushtreatmentcover_display"
id="ayushtreatmentcover_display" class="unchecked" checked>
<input type="checkbox" style="margin-top: 12px" name="ayudhtreatmentcover_display"
id="ayudhtreatmentcover_display" class="unchecked" checked>
</div>
<div class="col-md-4">
<label for="ayudhtreatmentcover">AYUSH treatment cover</label>
</div>
<div class="col-md-6">
<input type="text" name="ayudhtreatmentcover" class="form-control ayudhtreatmentcover">
<input type="text" name="ayudhtreatmentcover" id="ayudhtreatmentcover" class="form-control ayudhtreatmentcover">
</div>
</div>
@ -761,7 +761,7 @@ label {
id="moderntreatmentsasperirdai_display" class="unchecked" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Modern treatments as per IRDAI</label>
<label for="moderntreatmentsasperirdai">Modern treatments as per IRDAI</label>
</div>
<div class="col-md-6">
<input type="text" name="moderntreatmentsasperirdai" id="moderntreatmentsasperirdai"
@ -788,7 +788,7 @@ label {
id="days_of_discharge_display" class="unchecked" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Claim Intimation Clause</label>
<label for="days_of_discharge">Claim Intimation Clause</label>
</div>
<div class="col-md-6">
<input type="text" id="days_of_discharge" name="days_of_discharge" class="form-control ">
@ -801,7 +801,7 @@ label {
id="days_from_dod_display" class="unchecked" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Claim Submission</label>
<label for="days_from_dod">Claim Submission</label>
</div>
<div class="col-md-6">
<input type="text" id="days_from_dod" name="days_from_dod" class="form-control ">
@ -817,7 +817,7 @@ label {
<label for="terrorism">Terrorism</label>
</div>
<div class="col-md-6">
<input type="text" name="terrorism" id="terrorism" class="form-control terrorism" >
<input type="text" name="terrorism" id="terrorism" class="form-control terrorism">
</div>
</div>
@ -880,19 +880,19 @@ label {
<script>
var policy_grid_id = $('#client_id').val();
var grid_html = '';
var policy_grid_id = $('#client_id').val();
var grid_html = '';
$('.close').click(function() {
$('.close').click(function() {
$('#sum_insured').val("");
$('#familyfloater').val("");
$('#waiverofpreexistingdiseases').prop('checked', false);
$('#maternitycoverage').val("");
});
});
$('input[name="ayudhtreatmentcover"]').change(function() {
$('input[name="ayudhtreatmentcover"]').change(function() {
////console.log($(this).val());
@ -904,9 +904,9 @@ $('input[name="ayudhtreatmentcover"]').change(function() {
var element = $(this).parent().parent().next()[0];
$(element).css("display", "none");
}
});
});
$('input[name="ailmentcapping"]').change(function() {
$('input[name="ailmentcapping"]').change(function() {
////console.log($(this).val());
@ -918,9 +918,9 @@ $('input[name="ailmentcapping"]').change(function() {
var element = $(this).parent().parent().next()[0];
$(element).css("display", "none");
}
});
});
$('input[name="copayzonewisecopay"]').change(function() {
$('input[name="copayzonewisecopay"]').change(function() {
////console.log($(this).val());
@ -932,9 +932,9 @@ $('input[name="copayzonewisecopay"]').change(function() {
var element = $(this).parent().parent().next()[0];
$(element).css("display", "none");
}
});
});
$('input[name="cataract"]').change(function() {
$('input[name="cataract"]').change(function() {
//console.log($(this).val());
@ -946,10 +946,10 @@ $('input[name="cataract"]').change(function() {
var element = $(this).parent().parent().next()[0];
$(element).css("display", "none");
}
});
});
$('input[name="waiverofpreexistingdiseases"]').change(function() {
$('input[name="waiverofpreexistingdiseases"]').change(function() {
if ($(this).val() == '1') {
var element = $(this).parent().parent().next()[0];
@ -970,10 +970,10 @@ $('input[name="waiverofpreexistingdiseases"]').change(function() {
var element4 = $(this).parent().parent().next().next().next().next()[0];
$(element4).css("display", "none");
}
});
});
$("#policyJsonForm").submit(function(event) {
$("#policyJsonForm").submit(function(event) {
checkAdditionPremiumJSON()
@ -1015,14 +1015,16 @@ $("#policyJsonForm").submit(function(event) {
var specialConditions = [];
$(".removeDom").each(function () {
$(".removeDom").each(function() {
var isChecked = $(this).find("input[name='special_condition_display[]']").is(":checked");
if (isChecked) {
var label = $(this).find("input[name='special_condition_label[]']").val();
var input = $(this).find("input[name='special_condition_input[]']").val();
specialConditions.push({ [label]: input });
specialConditions.push({
[label]: input
});
}
});
@ -1035,7 +1037,10 @@ $("#policyJsonForm").submit(function(event) {
var formData = new FormData($('#policyJsonForm')[0]);
var policy_form_action = '<?= base_url("client/policy/policyGMCTerms") ?>';
formData.append("special_condition_display_value", JSON.stringify(specialConditions));
console.log('formData', formData);
formData.forEach((value, key) => {
console.log(key + ':', value);
});
$.ajax({
data: formData,
url: policy_form_action,
@ -1079,10 +1084,11 @@ $("#policyJsonForm").submit(function(event) {
var message = 'Policy Terms Updated successfully';
toastr.success(message, 'Success');
}, 500);
});
});
$('body').on('click', '.btnPolicyMaster', function() {
$('body').on('click', '.btnPolicyMaster', function() {
// alert("HELLO");
var client_policy_id = $(this).data('id');
//console.log('gmc_client_policy_id :', client_policy_id);
@ -1136,6 +1142,7 @@ $('body').on('click', '.btnPolicyMaster', function() {
}
let jsonObject = JSON.parse(response.data);
disableUnwantedTerms(jsonObject);
Object.keys(jsonObject).forEach(function(key) {
if (key.includes("special_condition_label") || key.includes(
@ -1206,8 +1213,8 @@ $('body').on('click', '.btnPolicyMaster', function() {
`input[name="${key}[]"]`);
if (jsonObject[key]) {
//console.log(jsonObject[key]);
// //console.log(jsonObject[key]);
console.log(jsonObject[key]);
console.log(jsonObject[key]);
if (jsonObject[key].childrens) {
$('#children').val(jsonObject[key].childrens);
}
@ -1321,11 +1328,14 @@ $('body').on('click', '.btnPolicyMaster', function() {
key]; // Add your new content inside the <p> tag
}
}
// //console.log(jsonObject[key]);
console.log(jsonObject[key]);
} else {
console.log(jsonObject[key]);
if (jsonObject[key] == undefined) {
if (jsonObject[key] === undefined || jsonObject[key] === "" || jsonObject[key] === null) {
element.value = " ";
} else {
element.value = jsonObject[key];
}
@ -1517,9 +1527,9 @@ $('body').on('click', '.btnPolicyMaster', function() {
})
});
});
function si_keup_num_to_word(input) {
function si_keup_num_to_word(input) {
console.log('keyup sum insured');
var inputNumber = $(input).val();
@ -1531,34 +1541,83 @@ function si_keup_num_to_word(input) {
} else {
$("#numberToWordGMC").text("");
}
};
};
</script>
<!-- Jodit RTE -->
<script>
// $(document).ready(function() {
// var editor = new Jodit('#additionalsicknessbenefit', {
// buttons: 'bold,italic,underline,|,align,alignCenter,alignRight,alignJustify',
// });
// $(document).ready(function() {
// var editor = new Jodit('#additionalsicknessbenefit', {
// buttons: 'bold,italic,underline,|,align,alignCenter,alignRight,alignJustify',
// });
// var editor = new Jodit('#Wellness', {
// buttons: 'bold,italic,underline,|,align,alignCenter,alignRight,alignJustify',
// });
// });
// </script>
// var editor = new Jodit('#Wellness', {
// buttons: 'bold,italic,underline,|,align,alignCenter,alignRight,alignJustify',
// });
// });
//
</script>
<!-- Policy terms Add Special Condition -->
<script>
document.getElementById('myButtonSpecialCondition').addEventListener('click', function(event) {
document.getElementById('myButtonSpecialCondition').addEventListener('click', function(event) {
//console.log('specialCondition callback clicked')
event.preventDefault();
specialCondition();
});
});
function specialCondition(count = 0) {
const fields = [
'waiverofpreexistingdiseases',
'waiverof1,2,3&4thyearexclusions',
'waiverof30dayswaitingperiod',
'waiver_of_90_days_waiting_period',
'waiver_of_other_waiting_periods',
'maternity_benefit',
'9monthwaitingperiodwaived',
'maternitycoverage',
'twindelivery',
'well_baby_well_mother_expenses',
'preandpostnatal',
'infertility_treatment_coverage',
'babyday1cover',
'coverfromthedateofjoining',
'mid_term_addition_of_new_born_newly_wedded_spouse',
'prehospitalizationcover',
'posthospitalizationcover',
'congenitaldiseasesinternal',
'congenitaldiseasesexternal',
'copayzonewisecopay',
'roomrentlimit',
'icu_limit',
'proportionatedeductionclause',
'ailmentcapping',
'ailment_capping_details',
'corporatebuffer',
'non_admissible_contingency_corporate_buffer',
'ambulancecharges',
'airambulance',
'reasonableandcustomarycharges',
'daycaretreatment',
'lasiksurgery',
'ayudhtreatmentcover',
'moderntreatmentsasperirdai',
'opd_treatment',
'days_of_discharge',
'days_from_dod',
'terrorism',
'widower_cover',
'breavement_cover',
'suminsuredenhancement',
'special_condition_label',
'special_condition_input',
'multiple_sum_insured'
];
function specialCondition(count = 0) {
//console.log('specialCondition function called')
@ -1587,14 +1646,14 @@ function specialCondition(count = 0) {
//console.log('else')
}
}
}
$(document).on('click', '.specialConditionClose', function() {
$(document).on('click', '.specialConditionClose', function() {
$(this)[0].parentNode.parentNode.remove();
});
});
// Close the Policy terms
$(document).on('click', '#policyGMCTermsClose', function() {
// Close the Policy terms
$(document).on('click', '#policyGMCTermsClose', function() {
$('#policyGMCTerms').css('display', 'none');
$('#police-tab').css('display', '');
$('.nav.nav-pills.navtab-bg').css('display', '');
@ -1602,29 +1661,29 @@ $(document).on('click', '#policyGMCTermsClose', function() {
$('#policyJsonForm')[0].reset();
$('.text-danger-2').html('');
});
});
// function formatNumber(input) {
// // Remove non-numeric characters
// let value = input.value.replace(/\D/g, '');
// function formatNumber(input) {
// // Remove non-numeric characters
// let value = input.value.replace(/\D/g, '');
// // Add commas
// value = Number(value).toLocaleString('en-IN');
// // Add commas
// value = Number(value).toLocaleString('en-IN');
// // Update the input value
// input.value = value;
// }
// // Update the input value
// input.value = value;
// }
$('#self').change(function() {
$('#self').change(function() {
if ($(this).prop('checked')) {
$('.self-age').css('display', '');
} else {
$('.self-age').css('display', 'none');
}
});
});
$('#spouse').change(function() {
$('#spouse').change(function() {
if ($(this).prop('checked')) {
$('.spouse-age').css('display', '');
if ($('#spouse_min_age').val() < 17 || $('#spouse_min_age').val() == '') {
@ -1636,9 +1695,9 @@ $('#spouse').change(function() {
} else {
$('.spouse-age').css('display', 'none');
}
});
});
$('#children').change(function() {
$('#children').change(function() {
if ($(this).val() != 0) {
$('.child-age').css('display', '');
@ -1651,9 +1710,9 @@ $('#children').change(function() {
} else {
$('.child-age').css('display', 'none');
}
});
});
$('#family_floaters').change(function() {
$('#family_floaters').change(function() {
checkAdditionPremiumJSON()
@ -1686,9 +1745,9 @@ $('#family_floaters').change(function() {
} else if (family_floaters == '4EPORPIL') {
$('#member_count').val(4);
}
});
});
function lowerIsEighteen(params) {
function lowerIsEighteen(params) {
var value = $(params).val();
if (value < 18) {
@ -1696,9 +1755,9 @@ function lowerIsEighteen(params) {
} else if (value > 99) {
$(params).val(99);
}
}
}
function appendGMCSIAddMore(data = null) {
function appendGMCSIAddMore(data = null) {
console.log('function called')
@ -1722,14 +1781,14 @@ function appendGMCSIAddMore(data = null) {
</div>`;
$('#gmc_si_add_more').append(html);
}
}
function removeGMCAdditionalSI(button) {
function removeGMCAdditionalSI(button) {
console.log('remove clicked');
$(button).closest('.row').remove();
}
}
function checkAdditionPremiumJSON() {
function checkAdditionPremiumJSON() {
var client_id = $('#Client_id').val();
var client_policy_id = $('#gmc_client_policy_id').val();
@ -1756,13 +1815,16 @@ function checkAdditionPremiumJSON() {
console.error(status, error);
});
}
}
function inArray(key, array) {
function inArray(key, array) {
return array.includes(key);
}
}
function processJsonObject(jsonObject) {
function processJsonObject(jsonObject) {
// alert("Processing JSON Object");
// console.log("Processing JSON Object:", jsonObject);
if (typeof jsonObject !== 'object' || Array.isArray(jsonObject)) {
console.log("jsonObject Input is not a valid object.");
@ -1807,13 +1869,49 @@ function processJsonObject(jsonObject) {
}
let display_id = base_id + "_display";
console.log("input value : ", jsonObject[key][innerKey]);
let inputValue = jsonObject[key][innerKey];
if (inputValue && inputValue.trim() !== '' && inputValue !== ' ') {
$('#' + display_id).prop('checked', true);
}
console.log('display_id : ', display_id);
}
} else {
console.log(`${key} is not an object.`);
}
}
}
}
function disableUnwantedTerms(jsonObject) {
// alert("Disabling unwanted terms");
fields.forEach(function(key) {
// If key NOT in jsonObject, then hide and disable its associated elements
if (!jsonObject.hasOwnProperty(key)) {
const elements = document.getElementsByName(key);
elements.forEach(element => {
element.style.display = "none";
element.disabled = true;
const label = document.querySelector(`label[for="${element.id}"]`);
if (label) {
label.style.display = "none";
}
const displayElement = document.getElementById(`${element.id}_display`);
if (displayElement) {
displayElement.checked = false;
displayElement.disabled = true;
displayElement.style.display = "none";
}
const rowDiv = element.closest('.row');
if (rowDiv) {
rowDiv.style.display = "none";
}
});
}
});
}
</script>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -295,6 +295,7 @@
<input type="hidden" id="lead_id" value="<?= htmlspecialchars($lead_data['id'] ?? "", ENT_QUOTES, 'UTF-8') ?>" />
<input type="hidden" id="rfq_primaryKey" name="rfq_primaryKey" value="<?= isset($rfq_data['id']) ? $rfq_data['id'] : '' ?>">
<div id="allTableContainer">
<div id="tablesContainer"></div>
@ -629,6 +630,27 @@
myModal = new bootstrap.Modal(document.getElementById('policyRegisterModel'));
// monitorTableChanges();
});
$(document).ready(function () {
console.log("Document ready");
let lead_status = '<?= isset($lead_data['status']) ? $lead_data['status'] : '' ?>';
console.log('Lead status retrieved:', lead_status);
if (lead_status != "won") {
console.log("Lead status is not 'won', setting interval for submitData");
setInterval(function () {
console.log("Calling submitData(1) at 20-second interval");
saveRFQ(true);
}, 20000);
} else {
console.log("Lead status is 'won', submitData will not be called");
}
});
var tableCount = 0;
const policies = <?= json_encode($policies) ?>;
// // console.log('policies', policies);
@ -2473,10 +2495,7 @@
table_type: "new",
table_id: `${policyName}_summary_` + locationIndex,
table_editable: true,
table_name: "Risk Location " + locationIndex + "- " +
storedData.locations[i].policyRisk['occupancy'] + "- " +
storedData.locations[i].policyRisk['address1'] + " " +
storedData.locations[i].policyRisk['address2'],
table_name: "Risk Location " + locationIndex,
table_row_contents: rowContents
});
}
@ -2548,17 +2567,17 @@
return null; // If canceled, return null
}
function saveRFQ() {
function saveRFQ(isAutoSave = false) {
// alert("Function Called");
isSaved = true;
// // console.log("save button clicked");
leadJson = tablesToJson();
// // console.log("json from function ", leadJson);
console.log("json from function ", leadJson);
var policyJson = localStorage.getItem("policyData") ?? null;
saveRFQTODB(leadJson, policyJson);
saveRFQTODB(leadJson, policyJson, isAutoSave);
}
function saveRFQTODB(tableJSON, policyJson) {
function saveRFQTODB(tableJSON, policyJson,isAutoSave = false) {
let submit_type = "RFQ"
if(rfq_or_qcr == 2){submit_type = 'QCR'}
@ -2570,9 +2589,20 @@
registration_json: policyJson
}
let rfq_primaryKey = $('#rfq_primaryKey').val();
if (isAutoSave) {
formData['rfq_primaryKey'] = rfq_primaryKey;
}
var url = '<?= base_url('rfq/create') ?>';
if (!isAutoSave) {
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
}
$.ajax({
url: url,
@ -2583,24 +2613,27 @@
console.log('RFQ NON EB FORM SUBMIT RESPONSE : ', response);
if (response.status == true) {
localStorage.removeItem('policyData');
toastr.success(response.message, "Success");
// // console.log(rfq_data.length);
if (!isAutoSave) {
localStorage.removeItem('policyData');
$('.actionBtns').show();
if (rfq_or_qcr == 2) {
$("#openQCR").hide();
}
}
// window.location.reload();
} else {
toastr.error(response.message, "Error");
$('.actionBtns').hide();
}
if (!isAutoSave) {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
window.location.reload();
}
},
error: function(xhr, status, error) {
$('.loader').fadeOut();