CHANGE_EB_CLAIMS_HISTORY_BASED_ON_THE_TOGGLE
This commit is contained in:
parent
c97f49e692
commit
a5b609c926
@ -571,6 +571,70 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// $leadFormType = (int) ($postData['lead_form_type'] ?? 1);
|
||||||
|
// $postedPolicyTypeIds = array_map('intval', (array) ($postData['policy_type_id'] ?? []));
|
||||||
|
// $isEbRenewalGpaClaimHistory = $leadFormType === 1
|
||||||
|
// && (int) ($postData['lead_type'] ?? 0) === 2
|
||||||
|
// && in_array(1, $postedPolicyTypeIds, true)
|
||||||
|
// && (int) ($postData['claim_history'] ?? 0) === 1;
|
||||||
|
|
||||||
|
// if ($isEbRenewalGpaClaimHistory) {
|
||||||
|
// $rules['first_year.*'] = [
|
||||||
|
// 'rules' => 'required|regex_match[/^\d{4}-\d{4}$/]',
|
||||||
|
// 'errors' => [
|
||||||
|
// 'required' => 'Claim Year is required for all entries.',
|
||||||
|
// 'regex_match' => 'Year must be in format YYYY-YYYY.',
|
||||||
|
// ],
|
||||||
|
// ];
|
||||||
|
// $rules['emp_id.*'] = [
|
||||||
|
// 'rules' => 'required',
|
||||||
|
// 'errors' => ['required' => 'Employee ID is required in Claim History.'],
|
||||||
|
// ];
|
||||||
|
// $rules['emp_name.*'] = [
|
||||||
|
// 'rules' => 'required',
|
||||||
|
// 'errors' => ['required' => 'Employee Name is required in Claim History.'],
|
||||||
|
// ];
|
||||||
|
// $rules['gender.*'] = [
|
||||||
|
// 'rules' => 'required|in_list[Female,Male]',
|
||||||
|
// 'errors' => [
|
||||||
|
// 'required' => 'Gender is required in Claim History.',
|
||||||
|
// 'in_list' => 'Gender must be Female or Male.',
|
||||||
|
// ],
|
||||||
|
// ];
|
||||||
|
// $rules['designation.*'] = [
|
||||||
|
// 'rules' => 'required',
|
||||||
|
// 'errors' => ['required' => 'Designation is required in Claim History.'],
|
||||||
|
// ];
|
||||||
|
// $rules['sum_insured.*'] = [
|
||||||
|
// 'rules' => 'required|numeric',
|
||||||
|
// 'errors' => [
|
||||||
|
// 'required' => 'Sum Insured is required in Claim History.',
|
||||||
|
// 'numeric' => 'Sum Insured must be a number.',
|
||||||
|
// ],
|
||||||
|
// ];
|
||||||
|
// $rules['first_death_date.*'] = [
|
||||||
|
// 'rules' => 'required|regex_match[/^[0-9]{2}-([0-9]{2}|[A-Za-z]{3})-[0-9]{4}$/]',
|
||||||
|
// 'errors' => [
|
||||||
|
// 'required' => 'Date of Death is required.',
|
||||||
|
// 'regex_match' => 'Date of Death must be in DD-MM-YYYY or DD-MMM-YYYY format.',
|
||||||
|
// ],
|
||||||
|
// ];
|
||||||
|
// $rules['first_cause_of_death.*'] = [
|
||||||
|
// 'rules' => 'required|in_list[natural_death,suicide,accident,cardiac_arrest,septic_shock,heart_attack]',
|
||||||
|
// 'errors' => [
|
||||||
|
// 'required' => 'Nature/Cause Of Death is required.',
|
||||||
|
// 'in_list' => 'Nature/Cause Of Death is invalid.',
|
||||||
|
// ],
|
||||||
|
// ];
|
||||||
|
// $rules['first_claim_amount.*'] = [
|
||||||
|
// 'rules' => 'required|numeric',
|
||||||
|
// 'errors' => [
|
||||||
|
// 'required' => 'Claim/Settled Amount is required.',
|
||||||
|
// 'numeric' => 'Claim/Settled Amount must be a number.',
|
||||||
|
// ],
|
||||||
|
// ];
|
||||||
|
// }
|
||||||
|
|
||||||
// 1. MANUALLY VALIDATE FILES BEFORE PROCESSING
|
// 1. MANUALLY VALIDATE FILES BEFORE PROCESSING
|
||||||
// $allFiles = $this->request->getFiles();
|
// $allFiles = $this->request->getFiles();
|
||||||
// foreach ($allFiles as $inputName => $files) {
|
// foreach ($allFiles as $inputName => $files) {
|
||||||
@ -2140,6 +2204,8 @@ class LeadsController extends BaseController
|
|||||||
{
|
{
|
||||||
helper('excel_util_helper');
|
helper('excel_util_helper');
|
||||||
$rfq_data = $this->RFQModel->getRFQTableDataWithLeadIDAndType($lead_id, $type);
|
$rfq_data = $this->RFQModel->getRFQTableDataWithLeadIDAndType($lead_id, $type);
|
||||||
|
$claim_history = $rfq_data['claim_history'] ?? 0;
|
||||||
|
|
||||||
$is_placement = false;
|
$is_placement = false;
|
||||||
$length = 0;
|
$length = 0;
|
||||||
|
|
||||||
@ -2176,7 +2242,7 @@ class LeadsController extends BaseController
|
|||||||
'No of Dependents' => $rfq_data['incept_dept_count'],
|
'No of Dependents' => $rfq_data['incept_dept_count'],
|
||||||
'Total Lives' => $rfq_data['incept_no_of_lives'],
|
'Total Lives' => $rfq_data['incept_no_of_lives'],
|
||||||
|
|
||||||
'Period of Insurance ' => ! empty($rfq_data['policy_start_date']) && ! empty($rfq_data['policy_end_date']) ? date('d-m-Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d-m-Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
|
// 'Period of Insurance ' => ! empty($rfq_data['policy_start_date']) && ! empty($rfq_data['policy_end_date']) ? date('d-m-Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d-m-Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
|
||||||
// 'Insurer' => $rfq_data['insurer_name'] ?? " - ",
|
// 'Insurer' => $rfq_data['insurer_name'] ?? " - ",
|
||||||
// 'TPA' => $rfq_data['tpa_name'] ?? " - ",
|
// 'TPA' => $rfq_data['tpa_name'] ?? " - ",
|
||||||
// 'Policy Run Days' => $rfq_data['policy_run_days'],
|
// 'Policy Run Days' => $rfq_data['policy_run_days'],
|
||||||
@ -2186,7 +2252,7 @@ class LeadsController extends BaseController
|
|||||||
'Insured' => $rfq_data['client_name'],
|
'Insured' => $rfq_data['client_name'],
|
||||||
'No of Employees at Inception' => $rfq_data['incept_emp_count'],
|
'No of Employees at Inception' => $rfq_data['incept_emp_count'],
|
||||||
// 'Total Sum Insured at Inception ' => $rfq_data['total_si_at_incept'],
|
// 'Total Sum Insured at Inception ' => $rfq_data['total_si_at_incept'],
|
||||||
'Policy Period' => ! empty($rfq_data['policy_start_date']) && ! empty($rfq_data['policy_end_date']) ? date('d-m-Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d-m-Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
|
// 'Policy Period' => ! empty($rfq_data['policy_start_date']) && ! empty($rfq_data['policy_end_date']) ? date('d-m-Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d-m-Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
|
||||||
// 'Insurer' => $rfq_data['insurer_name'] ?? " - ",
|
// 'Insurer' => $rfq_data['insurer_name'] ?? " - ",
|
||||||
// 'TPA' => $rfq_data['tpa_name'] ?? " - ",
|
// 'TPA' => $rfq_data['tpa_name'] ?? " - ",
|
||||||
'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "",
|
'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "",
|
||||||
@ -2279,7 +2345,7 @@ class LeadsController extends BaseController
|
|||||||
'Existing Insurer' => $rfq_data['insurer_name'],
|
'Existing Insurer' => $rfq_data['insurer_name'],
|
||||||
'No of Employees at Renewal' => $rfq_data['renewal_emp_count'],
|
'No of Employees at Renewal' => $rfq_data['renewal_emp_count'],
|
||||||
'Total Sum Insured at Renewal' => $rfq_data['total_si_at_renewal'],
|
'Total Sum Insured at Renewal' => $rfq_data['total_si_at_renewal'],
|
||||||
'Claims Experience for last 3 years' => "Mentioned in Claims sheet",
|
'Claims Experience for last 3 years' => $claim_history == "1" ? "Mentioned in Claims sheet" : "Nil",
|
||||||
// 'Insurer' => $rfq_data['insurer_name'] ?? " - ",
|
// 'Insurer' => $rfq_data['insurer_name'] ?? " - ",
|
||||||
// 'TPA' => $rfq_data['tpa_name'] ?? " - ",
|
// 'TPA' => $rfq_data['tpa_name'] ?? " - ",
|
||||||
// 'Total Lives at Inception' => $rfq_data['total_lives_at_incept'],
|
// 'Total Lives at Inception' => $rfq_data['total_lives_at_incept'],
|
||||||
@ -2796,7 +2862,7 @@ class LeadsController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
//claim history new sheet;
|
//claim history new sheet;
|
||||||
if (! empty($rfq_data['fin_years_claims'])) {
|
if ($claim_history == 1 && !empty($rfq_data['fin_years_claims'])) {
|
||||||
|
|
||||||
$claim_details = json_decode($rfq_data['fin_years_claims'], true) ?? [];
|
$claim_details = json_decode($rfq_data['fin_years_claims'], true) ?? [];
|
||||||
|
|
||||||
|
|||||||
@ -744,7 +744,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
leadTypeBsedHideAndShow(lead_type)
|
leadTypeBsedHideAndShow(lead_type, false, policy_type_id)
|
||||||
|
|
||||||
|
|
||||||
if (lead_type == 1) {
|
if (lead_type == 1) {
|
||||||
@ -851,6 +851,7 @@
|
|||||||
.contact_person_email);
|
.contact_person_email);
|
||||||
$('#policy_type_id_1').val(res.data.policy_type_id)
|
$('#policy_type_id_1').val(res.data.policy_type_id)
|
||||||
.select2();
|
.select2();
|
||||||
|
togglePolicyDateFields(lead_type, res.data.policy_type_id);
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
}, 1000)
|
}, 1000)
|
||||||
@ -1093,6 +1094,7 @@
|
|||||||
|
|
||||||
var lead_type = $('#lead_type').val();
|
var lead_type = $('#lead_type').val();
|
||||||
console.log("lead_type", lead_type);
|
console.log("lead_type", lead_type);
|
||||||
|
togglePolicyDateFields(lead_type);
|
||||||
|
|
||||||
let url = '<?= base_url('util/getPolicyTypeFields/') ?>';
|
let url = '<?= base_url('util/getPolicyTypeFields/') ?>';
|
||||||
|
|
||||||
@ -1281,7 +1283,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4 policy-date-field">
|
||||||
<label for="policy_start_date">Date of Commencement <span class="text-danger">*</span></label>
|
<label for="policy_start_date">Date of Commencement <span class="text-danger">*</span></label>
|
||||||
<div class="input-icon">
|
<div class="input-icon">
|
||||||
<input type="text" class="form-control policy_start_date" id="policy_start_date_${increment}" name="policy_start_date[]" placeholder="Enter DOC" onchange="calculatePolicyMetrics(this)" autocomplete="off" >
|
<input type="text" class="form-control policy_start_date" id="policy_start_date_${increment}" name="policy_start_date[]" placeholder="Enter DOC" onchange="calculatePolicyMetrics(this)" autocomplete="off" >
|
||||||
@ -1290,7 +1292,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4 policy-date-field">
|
||||||
<label for="policy_end_date">Date of Expiry <span class="text-danger">*</span></label>
|
<label for="policy_end_date">Date of Expiry <span class="text-danger">*</span></label>
|
||||||
<div class="input-icon">
|
<div class="input-icon">
|
||||||
<input type="text" class="form-control policy_end_date" id="policy_end_date_${increment}" name="policy_end_date[]" placeholder="Enter DOE" autocomplete="off">
|
<input type="text" class="form-control policy_end_date" id="policy_end_date_${increment}" name="policy_end_date[]" placeholder="Enter DOE" autocomplete="off">
|
||||||
@ -1776,6 +1778,8 @@
|
|||||||
const finyearJsonString = gatherClaimExperienceData(policy_type_ids);
|
const finyearJsonString = gatherClaimExperienceData(policy_type_ids);
|
||||||
console.log('finyearJsonString', finyearJsonString);
|
console.log('finyearJsonString', finyearJsonString);
|
||||||
formData.append('finyear', finyearJsonString);
|
formData.append('finyear', finyearJsonString);
|
||||||
|
let claimHistoryStatus = $("#claim_history").length > 0 && $("#claim_history").prop("checked") ? 1 : 0;
|
||||||
|
formData.set('claim_history', claimHistoryStatus);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: formData,
|
data: formData,
|
||||||
@ -1898,6 +1902,7 @@
|
|||||||
$('#policy_start_date').val("");
|
$('#policy_start_date').val("");
|
||||||
$('#policy_end_date').val("");
|
$('#policy_end_date').val("");
|
||||||
$("#appendArea_1").empty();
|
$("#appendArea_1").empty();
|
||||||
|
togglePolicyDateFields(value);
|
||||||
|
|
||||||
// $('#source_policy_start_date').val("");
|
// $('#source_policy_start_date').val("");
|
||||||
// $('#source_policy_end_date').val("");
|
// $('#source_policy_end_date').val("");
|
||||||
@ -2019,6 +2024,12 @@
|
|||||||
|
|
||||||
let claimData = [];
|
let claimData = [];
|
||||||
|
|
||||||
|
if ($("#claim_history").length > 0 && !$("#claim_history").prop("checked")) {
|
||||||
|
return JSON.stringify({
|
||||||
|
"finyear": claimData
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$(".claim-row").each(function() {
|
$(".claim-row").each(function() {
|
||||||
|
|
||||||
let year = $(this).find("[name='first_year[]']").val();
|
let year = $(this).find("[name='first_year[]']").val();
|
||||||
@ -2156,15 +2167,23 @@
|
|||||||
let policy_type_id = $('#policy_type_id_' + count).val()
|
let policy_type_id = $('#policy_type_id_' + count).val()
|
||||||
console.log('policy_type_id', policy_type_id);
|
console.log('policy_type_id', policy_type_id);
|
||||||
|
|
||||||
|
let lead_type = $('#lead_type').val();
|
||||||
|
let showClaimHistorySwitch = lead_type == 2 && policy_type_id == 1;
|
||||||
|
|
||||||
console.log('claimIndex from parent', claimIndex);
|
console.log('claimIndex from parent', claimIndex);
|
||||||
let increment = claimIndex;
|
let increment = claimIndex;
|
||||||
|
|
||||||
let claimsFields = `
|
let claimsFields = `${showClaimHistorySwitch && !document.querySelector('#claim_history') ? `<div class="custom-control custom-switch">
|
||||||
|
<input type="checkbox" onchange="claimHistoryToggle()" class="custom-control-input" id="claim_history" name="claim_history" checked>
|
||||||
|
<label class="custom-control-label" for="claim_history">Claims History</label>
|
||||||
|
</div><br>` : ``}`;
|
||||||
|
|
||||||
|
claimsFields += `
|
||||||
<div class="row claim-row">
|
<div class="row claim-row">
|
||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label for="first_year_${increment}">Year<span class="text-danger">*</span></label>
|
<label for="first_year_${increment}">Year<span class="text-danger">*</span></label>
|
||||||
<select class="form-control first_year_" id="first_year_${increment}" name="first_year[]">
|
<select class="form-control first_year_ claim-input" id="first_year_${increment}" name="first_year[]">
|
||||||
<option value="">Select Year</option>
|
<option value="">Select Year</option>
|
||||||
<?php foreach ($lastFiveYears as $year) {
|
<?php foreach ($lastFiveYears as $year) {
|
||||||
echo "<option value='$year'>$year</option>";
|
echo "<option value='$year'>$year</option>";
|
||||||
@ -2174,18 +2193,18 @@
|
|||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label for="emp_id_${increment}">Emp ID<span class="text-danger">*</span></label>
|
<label for="emp_id_${increment}">Emp ID<span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="emp_id_${increment}" name="emp_id[]">
|
<input type="text" class="form-control claim-input" id="emp_id_${increment}" name="emp_id[]">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label for="emp_name_${increment}">Employee Name<span class="text-danger">*</span></label>
|
<label for="emp_name_${increment}">Employee Name<span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="emp_name_${increment}" name="emp_name[]">
|
<input type="text" class="form-control claim-input" id="emp_name_${increment}" name="emp_name[]">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label for="gender_${increment}">Gender<span class="text-danger">*</span></label>
|
<label for="gender_${increment}">Gender<span class="text-danger">*</span></label>
|
||||||
<select class="form-control" id="gender_${increment}" name="gender[]">
|
<select class="form-control claim-input" id="gender_${increment}" name="gender[]">
|
||||||
<option value="">Select Gender</option>
|
<option value="">Select Gender</option>
|
||||||
<option value="Female">Female</option>
|
<option value="Female">Female</option>
|
||||||
<option value="Male">Male</option>
|
<option value="Male">Male</option>
|
||||||
@ -2194,25 +2213,25 @@
|
|||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label for="designation_${increment}">Designation <span class="text-danger">*</span></label>
|
<label for="designation_${increment}">Designation <span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="designation_${increment}" name="designation[]">
|
<input type="text" class="form-control claim-input" id="designation_${increment}" name="designation[]">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label for="sum_insured_${increment}">Sum Insured <span class="text-danger">*</span></label>
|
<label for="sum_insured_${increment}">Sum Insured <span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="sum_insured_${increment}" name="sum_insured[]">
|
<input type="text" class="form-control claim-input" id="sum_insured_${increment}" name="sum_insured[]">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label for="first_death_date_${increment}">Date of Death<span class="text-danger">*</span></label>
|
<label for="first_death_date_${increment}">Date of Death<span class="text-danger">*</span></label>
|
||||||
<div class="input-icon">
|
<div class="input-icon">
|
||||||
<input type="text" class="form-control death_date flatpickr-date" id="first_death_date_${increment}" name="first_death_date[]" autocomplete="off">
|
<input type="text" class="form-control death_date flatpickr-date claim-input" id="first_death_date_${increment}" name="first_death_date[]" autocomplete="off">
|
||||||
<i class="mdi mdi-calendar-blank-outline additional-icon"></i>
|
<i class="mdi mdi-calendar-blank-outline additional-icon"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label for="first_cause_of_death_${increment}">Nature/Cause Of Death <span class="text-danger">*</span></label>
|
<label for="first_cause_of_death_${increment}">Nature/Cause Of Death <span class="text-danger">*</span></label>
|
||||||
<select class="form-control" id="first_cause_of_death_${increment}" name="first_cause_of_death[]">
|
<select class="form-control claim-input" id="first_cause_of_death_${increment}" name="first_cause_of_death[]">
|
||||||
<option value="">Select Cause of Death</option>
|
<option value="">Select Cause of Death</option>
|
||||||
<?php foreach ($causeOfDeath as $cause => $death_value) {
|
<?php foreach ($causeOfDeath as $cause => $death_value) {
|
||||||
echo "<option value='$cause'>$death_value</option>";
|
echo "<option value='$cause'>$death_value</option>";
|
||||||
@ -2222,7 +2241,7 @@
|
|||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label for="first_claim_amount_${increment}">Claim/Settled Amount<span class="text-danger">*</span></label>
|
<label for="first_claim_amount_${increment}">Claim/Settled Amount<span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="first_claim_amount_${increment}" name="first_claim_amount[]">
|
<input type="text" class="form-control claim-input" id="first_claim_amount_${increment}" name="first_claim_amount[]">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div class="form-group col-md-2">
|
<!-- <div class="form-group col-md-2">
|
||||||
@ -2283,6 +2302,10 @@
|
|||||||
maxDate: 'today', // Optional: disable future dates
|
maxDate: 'today', // Optional: disable future dates
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (showClaimHistorySwitch) {
|
||||||
|
claimHistoryToggle();
|
||||||
|
}
|
||||||
|
|
||||||
toggleRequiredFields();
|
toggleRequiredFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2297,7 +2320,43 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function leadTypeBsedHideAndShow(value, resetValues = false) {
|
function claimHistoryToggle() {
|
||||||
|
let claimHistoryStatus = $("#claim_history").prop("checked") ? 1 : 0;
|
||||||
|
|
||||||
|
if (claimHistoryStatus == 1) {
|
||||||
|
$(".claim-row").show();
|
||||||
|
$(".claim-input").attr("required", true);
|
||||||
|
} else {
|
||||||
|
$(".claim-row").hide();
|
||||||
|
$(".claim-input").removeAttr("required").val("");
|
||||||
|
$(".claim-input").each(function() {
|
||||||
|
if ($(this).hasClass('select2-hidden-accessible')) {
|
||||||
|
$(this).val(null).trigger('change');
|
||||||
|
}
|
||||||
|
if ($(this).parsley) {
|
||||||
|
$(this).parsley().reset();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleRequiredFields();
|
||||||
|
}
|
||||||
|
|
||||||
|
function togglePolicyDateFields(value, fallbackPolicyTypeId = null) {
|
||||||
|
const policyTypesToHide = ['1', '2', '3', '4', '5', '6', '7'];
|
||||||
|
|
||||||
|
$('.dynamic-form-row').each(function(index) {
|
||||||
|
const selectedPolicyTypeId = $(this).find('[id^="policy_type_id_"]').val();
|
||||||
|
const policyTypeId = String(selectedPolicyTypeId || (index === 0 ? fallbackPolicyTypeId || '' : ''));
|
||||||
|
const shouldHide = value == 1 && policyTypesToHide.includes(policyTypeId);
|
||||||
|
|
||||||
|
$(this).find('.policy-date-field').toggle(!shouldHide);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function leadTypeBsedHideAndShow(value, resetValues = false, fallbackPolicyTypeId = null) {
|
||||||
|
|
||||||
|
togglePolicyDateFields(value, fallbackPolicyTypeId);
|
||||||
|
|
||||||
if (value == 1) {
|
if (value == 1) {
|
||||||
$('.btnDiv').show();
|
$('.btnDiv').show();
|
||||||
|
|||||||
@ -837,7 +837,10 @@ if (isset($selected_lead_type)) {
|
|||||||
$('#appendAreaForClaim').attr('id', newId);
|
$('#appendAreaForClaim').attr('id', newId);
|
||||||
}
|
}
|
||||||
|
|
||||||
leadTypeBsedHideAndShow(lead_type);
|
leadTypeBsedHideAndShow(lead_type, false, policy_type_id);
|
||||||
|
if ($('#claim_history').length && typeof claimHistoryToggle === 'function') {
|
||||||
|
claimHistoryToggle();
|
||||||
|
}
|
||||||
|
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
$('.loader-mask').fadeIn();
|
$('.loader-mask').fadeIn();
|
||||||
@ -935,6 +938,10 @@ if (isset($selected_lead_type)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($('#claim_history').length && typeof claimHistoryToggle === 'function') {
|
||||||
|
claimHistoryToggle();
|
||||||
|
}
|
||||||
|
|
||||||
if(lead_type == 3){
|
if(lead_type == 3){
|
||||||
let incurred_claim_date_id = 'incurred_claim_date';
|
let incurred_claim_date_id = 'incurred_claim_date';
|
||||||
|
|
||||||
@ -1324,6 +1331,7 @@ if (isset($selected_lead_type)) {
|
|||||||
$('#contact_person_email').val(data.contact_person_email || '');
|
$('#contact_person_email').val(data.contact_person_email || '');
|
||||||
$('#policy_type_id').val(data.policy_type_id || '').select2();
|
$('#policy_type_id').val(data.policy_type_id || '').select2();
|
||||||
$('#policy_type_id_1').val(data.policy_type_id || '').select2();
|
$('#policy_type_id_1').val(data.policy_type_id || '').select2();
|
||||||
|
togglePolicyDateFields(lead_type, data.policy_type_id || '');
|
||||||
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|||||||
@ -41,10 +41,23 @@
|
|||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<?php if(isset($lead_edit_data)) { ?>
|
<?php if(isset($lead_edit_data)) { ?>
|
||||||
|
<?php
|
||||||
|
$savedClaims = !empty($lead_edit_data['fin_years_claims_array']) ? $lead_edit_data['fin_years_claims_array'] : [];
|
||||||
|
$isClaimHistoryChecked = (isset($lead_edit_data['claim_history']) && (int) $lead_edit_data['claim_history'] === 1) || !empty($savedClaims);
|
||||||
|
$showClaimHistorySwitch = isset($lead_edit_data['lead_type'], $lead_edit_data['policy_type_id'])
|
||||||
|
&& (int) $lead_edit_data['lead_type'] === 2
|
||||||
|
&& (int) $lead_edit_data['policy_type_id'] === 1;
|
||||||
|
?>
|
||||||
|
<?php if ($showClaimHistorySwitch) { ?>
|
||||||
|
<div class="custom-control custom-switch">
|
||||||
|
<input type="checkbox" onchange="claimHistoryToggle()" class="custom-control-input" id="claim_history" name="claim_history" <?= $isClaimHistoryChecked ? 'checked' : '' ?>>
|
||||||
|
<label class="custom-control-label" for="claim_history">Claims History</label>
|
||||||
|
</div><br>
|
||||||
|
<?php } ?>
|
||||||
<div class="form-row" id="appendAreaForClaim_1">
|
<div class="form-row" id="appendAreaForClaim_1">
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$claims = !empty($lead_edit_data['fin_years_claims_array']) ? $lead_edit_data['fin_years_claims_array'] : [ ['year' => '', 'claim_amount' => '', 'status' => '', 'claim_type' => '', 'cause_of_death' => '', 'death_date' => ''] ];
|
$claims = !empty($savedClaims) ? $savedClaims : [ ['year' => '', 'claim_amount' => '', 'status' => '', 'claim_type' => '', 'cause_of_death' => '', 'death_date' => ''] ];
|
||||||
|
|
||||||
foreach ($claims as $key => $value) { ?>
|
foreach ($claims as $key => $value) { ?>
|
||||||
|
|
||||||
@ -52,7 +65,7 @@
|
|||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label for="first_year">Year<span class="text-danger">*</span></label>
|
<label for="first_year">Year<span class="text-danger">*</span></label>
|
||||||
<select class="form-control first_year_" id="first_year" name="first_year[]">
|
<select class="form-control first_year_ claim-input" id="first_year" name="first_year[]">
|
||||||
<option value="">Select Year</option>
|
<option value="">Select Year</option>
|
||||||
<?php foreach ($lastFiveYears as $year) {
|
<?php foreach ($lastFiveYears as $year) {
|
||||||
$selected = ($year == $value['year']) ? 'selected' : '';
|
$selected = ($year == $value['year']) ? 'selected' : '';
|
||||||
@ -63,17 +76,17 @@
|
|||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label for="emp_id">Emp ID<span class="text-danger">*</span></label>
|
<label for="emp_id">Emp ID<span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="emp_id" name="emp_id[]" value="<?= htmlspecialchars(isset($value['emp_id']) ? $value['emp_id'] : '-' ) ?>">
|
<input type="text" class="form-control claim-input" id="emp_id" name="emp_id[]" value="<?= htmlspecialchars(isset($value['emp_id']) ? $value['emp_id'] : '-' ) ?>">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label for="emp_name">Employee Name<span class="text-danger">*</span></label>
|
<label for="emp_name">Employee Name<span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="emp_name" name="emp_name[]" value="<?= htmlspecialchars(isset($value['emp_name']) ? $value['emp_name'] : '-' ) ?>">
|
<input type="text" class="form-control claim-input" id="emp_name" name="emp_name[]" value="<?= htmlspecialchars(isset($value['emp_name']) ? $value['emp_name'] : '-' ) ?>">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label for="gender">Gender<span class="text-danger">*</span></label>
|
<label for="gender">Gender<span class="text-danger">*</span></label>
|
||||||
<select class="form-control" id="gender" name="gender[]">
|
<select class="form-control claim-input" id="gender" name="gender[]">
|
||||||
<option value="">Select Gender</option>
|
<option value="">Select Gender</option>
|
||||||
<option value="Female" <?= (isset($value['gender']) && $value['gender'] == 'Female') ? 'selected' : '' ?>>Female</option>
|
<option value="Female" <?= (isset($value['gender']) && $value['gender'] == 'Female') ? 'selected' : '' ?>>Female</option>
|
||||||
<option value="Male" <?= (isset($value['gender']) && $value['gender'] == 'Male') ? 'selected' : '' ?>>Male</option>
|
<option value="Male" <?= (isset($value['gender']) && $value['gender'] == 'Male') ? 'selected' : '' ?>>Male</option>
|
||||||
@ -83,22 +96,22 @@
|
|||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label for="designation">Designation <span class="text-danger">*</span></label>
|
<label for="designation">Designation <span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="designation" name="designation[]" value="<?= htmlspecialchars(isset($value['designation']) ? $value['designation'] : '-' ) ?>">
|
<input type="text" class="form-control claim-input" id="designation" name="designation[]" value="<?= htmlspecialchars(isset($value['designation']) ? $value['designation'] : '-' ) ?>">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label for="sum_insured">Sum Insured <span class="text-danger">*</span></label>
|
<label for="sum_insured">Sum Insured <span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="sum_insured" name="sum_insured[]" value="<?= htmlspecialchars(isset($value['sum_insured']) ? $value['sum_insured'] : '-' ) ?>">
|
<input type="text" class="form-control claim-input" id="sum_insured" name="sum_insured[]" value="<?= htmlspecialchars(isset($value['sum_insured']) ? $value['sum_insured'] : '-' ) ?>">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label for="first_death_date">Date of Death<span class="text-danger">*</span></label>
|
<label for="first_death_date">Date of Death<span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control flatpickr-date" id="first_death_date" name="first_death_date[]" value="<?= htmlspecialchars($value['death_date']) ?>" autocomplete="off">
|
<input type="text" class="form-control flatpickr-date claim-input" id="first_death_date" name="first_death_date[]" value="<?= htmlspecialchars($value['death_date']) ?>" autocomplete="off">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label for="first_cause_of_death">Nature/Cause Of Death <span class="text-danger">*</span></label>
|
<label for="first_cause_of_death">Nature/Cause Of Death <span class="text-danger">*</span></label>
|
||||||
<select class="form-control" id="first_cause_of_death" name="first_cause_of_death[]">
|
<select class="form-control claim-input" id="first_cause_of_death" name="first_cause_of_death[]">
|
||||||
<option value="">Select Cause of Death</option>
|
<option value="">Select Cause of Death</option>
|
||||||
<?php foreach ($causeOfDeath as $cause => $death_value) {
|
<?php foreach ($causeOfDeath as $cause => $death_value) {
|
||||||
$selected = ($cause == $value['cause_of_death']) ? 'selected' : '';
|
$selected = ($cause == $value['cause_of_death']) ? 'selected' : '';
|
||||||
@ -109,7 +122,7 @@
|
|||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-2">
|
||||||
<label for="first_claim_amount">Claim/Settled Amount<span class="text-danger">*</span></label>
|
<label for="first_claim_amount">Claim/Settled Amount<span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="first_claim_amount" name="first_claim_amount[]" value="<?= htmlspecialchars(isset($value['claim_amount']) ? $value['claim_amount'] : ( isset($value['settled']) ? $value['settled'] : '-' )) ?>">
|
<input type="text" class="form-control claim-input" id="first_claim_amount" name="first_claim_amount[]" value="<?= htmlspecialchars(isset($value['claim_amount']) ? $value['claim_amount'] : ( isset($value['settled']) ? $value['settled'] : '-' )) ?>">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div class="form-group col-md-2">
|
<!-- <div class="form-group col-md-2">
|
||||||
|
|||||||
@ -884,13 +884,13 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
<label for="policy_start_date">Policy Start Date</label>
|
<label for="policy_start_date">Policy Start Date <span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="policy_start_date" name="policy_start_date" placeholder="DD/MM/YYY" value="<?= isset($lead_data['policy_start_date']) ? date('d-m-Y', strtotime($lead_data['policy_start_date'])) : "" ?>">
|
<input type="text" class="form-control" id="policy_start_date" name="policy_start_date" placeholder="DD/MM/YYY" value="<?= isset($lead_data['policy_start_date']) ? date('d-m-Y', strtotime($lead_data['policy_start_date'])) : "" ?>" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
<label for="policy_end_date">Policy End Date</label>
|
<label for="policy_end_date">Policy End Date <span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="policy_end_date" name="policy_end_date" placeholder="DD/MM/YYY" value="<?= isset($lead_data['policy_end_date']) ? date('d-m-Y', strtotime($lead_data['policy_end_date'])) : "" ?>">
|
<input type="text" class="form-control" id="policy_end_date" name="policy_end_date" placeholder="DD/MM/YYY" value="<?= isset($lead_data['policy_end_date']) ? date('d-m-Y', strtotime($lead_data['policy_end_date'])) : "" ?>" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
@ -4429,6 +4429,18 @@ function constructURL_ForPlacementMailSend(return_type = false) {
|
|||||||
let acm_pk = $('#acm_id option:selected').data('id');
|
let acm_pk = $('#acm_id option:selected').data('id');
|
||||||
let is_installment = $("#is_installment_switch").is(":checked") ? 1 : 0;
|
let is_installment = $("#is_installment_switch").is(":checked") ? 1 : 0;
|
||||||
|
|
||||||
|
if (!policy_start_date) {
|
||||||
|
toastr.warning('Policy Start Date is required.', 'Warning');
|
||||||
|
$('#policy_start_date').focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!policy_end_date) {
|
||||||
|
toastr.warning('Policy End Date is required.', 'Warning');
|
||||||
|
$('#policy_end_date').focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Process `to` field
|
// Process `to` field
|
||||||
to = to.split(',').map(email => email.trim());
|
to = to.split(',').map(email => email.trim());
|
||||||
// cc = cc.map(Number); // or split if it's a string: `cc.split(',').map(email => email.trim())`
|
// cc = cc.map(Number); // or split if it's a string: `cc.split(',').map(email => email.trim())`
|
||||||
@ -7552,6 +7564,9 @@ function appendMultiFileData(data) {
|
|||||||
|
|
||||||
// Data to send in the AJAX request
|
// Data to send in the AJAX request
|
||||||
let requestData = constructURL_ForPlacementMailSend(true);
|
let requestData = constructURL_ForPlacementMailSend(true);
|
||||||
|
if (requestData === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
console.log('requestData', requestData);
|
console.log('requestData', requestData);
|
||||||
|
|
||||||
// Show loader
|
// Show loader
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user