FEAT_OPD_POLICY_AND_FIX_MAST_VALIDATION
This commit is contained in:
parent
201766675b
commit
a2911696c7
@ -5307,6 +5307,18 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$data['family_floaters']['elders_count'] = $this->request->getPost("elder_member_count") ? $this->request->getPost("elder_member_count") : 0;
|
$data['family_floaters']['elders_count'] = $this->request->getPost("elder_member_count") ? $this->request->getPost("elder_member_count") : 0;
|
||||||
|
|
||||||
|
// OPD policy terms fields for policy_type_id = 72
|
||||||
|
$data['mode_of_serviceability'] = $policy_terms['mode_of_serviceability'] ?? '';
|
||||||
|
$data['eligibility'] = $policy_terms['eligibility'] ?? '';
|
||||||
|
$data['total_sum_insured_limit'] = $policy_terms['total_sum_insured_limit'] ?? 'INR 15000';
|
||||||
|
$data['in_person_doctor_consultation'] = $policy_terms['in_person_doctor_consultation'] ?? '';
|
||||||
|
$data['prescribed_lab_test_pathology_radiology'] = $policy_terms['prescribed_lab_test_pathology_radiology'] ?? '';
|
||||||
|
$data['prescribed_pharmacy'] = $policy_terms['prescribed_pharmacy'] ?? '';
|
||||||
|
$data['dental'] = $policy_terms['dental'] ?? '';
|
||||||
|
$data['vision'] = $policy_terms['vision'] ?? '';
|
||||||
|
$data['vaccination_for_children_and_adults'] = $policy_terms['vaccination_for_children_and_adults'] ?? '';
|
||||||
|
|
||||||
$data['special_condition_label'] = $policy_terms['special_condition_label'] ?? [];
|
$data['special_condition_label'] = $policy_terms['special_condition_label'] ?? [];
|
||||||
$data['special_condition_input'] = $policy_terms["special_condition_input"] ?? [];
|
$data['special_condition_input'] = $policy_terms["special_condition_input"] ?? [];
|
||||||
|
|
||||||
@ -5364,6 +5376,7 @@ class ClientController extends AdminController
|
|||||||
$values = $data['special_condition_input'] ?? [];
|
$values = $data['special_condition_input'] ?? [];
|
||||||
|
|
||||||
$special_conditions = [];
|
$special_conditions = [];
|
||||||
|
$display_fields = [];
|
||||||
|
|
||||||
foreach ($labels as $i => $label) {
|
foreach ($labels as $i => $label) {
|
||||||
$value = $values[$i] ?? '';
|
$value = $values[$i] ?? '';
|
||||||
@ -5376,7 +5389,39 @@ class ClientController extends AdminController
|
|||||||
$special_conditions[$label] = $value;
|
$special_conditions[$label] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $special_conditions;
|
$labelMap = [
|
||||||
|
'mode_of_serviceability' => 'Mode Of Serviceability',
|
||||||
|
'eligibility' => 'Eligibility',
|
||||||
|
'total_sum_insured_limit' => 'Total Sum Insured Limit',
|
||||||
|
'in_person_doctor_consultation' => 'In Person Doctor Consultation',
|
||||||
|
'prescribed_lab_test_pathology_radiology' => 'Prescribed Lab Test Pathology Radiology',
|
||||||
|
'prescribed_pharmacy' => 'Prescribed Pharmacy',
|
||||||
|
'dental' => 'Dental',
|
||||||
|
'vision' => 'Vision',
|
||||||
|
'vaccination_for_children_and_adults' => 'Vaccination For Children And Adults',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($data as $key => $value) {
|
||||||
|
if (!str_ends_with($key, '_display')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($value)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$baseKey = substr($key, 0, -8);
|
||||||
|
$baseValue = $data[$baseKey] ?? '';
|
||||||
|
|
||||||
|
if (trim((string)$baseValue) === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$label = $labelMap[$baseKey] ?? ucwords(str_replace('_', ' ', $baseKey));
|
||||||
|
$display_fields[$label] = $baseValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_merge($display_fields, $special_conditions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkPolicyType($policy_type_id, $client_branch_id, $client_id)
|
public function checkPolicyType($policy_type_id, $client_branch_id, $client_id)
|
||||||
|
|||||||
@ -420,7 +420,7 @@ class MasterController extends AdminController
|
|||||||
|
|
||||||
'state' => [
|
'state' => [
|
||||||
'label' => 'State',
|
'label' => 'State',
|
||||||
'rules' => 'required|regex_match[/^[a-zA-Z\s\-]+$/]',
|
'rules' => 'required|regex_match[/^[a-zA-Z0-9\/\-\_\.\s]+$/]',
|
||||||
'errors' => [
|
'errors' => [
|
||||||
'required' => 'State is required.',
|
'required' => 'State is required.',
|
||||||
'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
|
'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
|
||||||
@ -661,7 +661,7 @@ class MasterController extends AdminController
|
|||||||
|
|
||||||
'state' => [
|
'state' => [
|
||||||
'label' => 'State',
|
'label' => 'State',
|
||||||
'rules' => 'required|regex_match[/^[a-zA-Z\s\-]+$/]',
|
'rules' => 'required|regex_match[/^[a-zA-Z0-9\/\-\_\.\s]+$/]',
|
||||||
'errors' => [
|
'errors' => [
|
||||||
'required' => 'State is required.',
|
'required' => 'State is required.',
|
||||||
'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
|
'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
|
||||||
@ -1057,7 +1057,7 @@ class MasterController extends AdminController
|
|||||||
|
|
||||||
'state' => [
|
'state' => [
|
||||||
'label' => 'State',
|
'label' => 'State',
|
||||||
'rules' => 'required|regex_match[/^[a-zA-Z\s\-]+$/]',
|
'rules' => 'required|regex_match[/^[a-zA-Z0-9\/\-\_\.\s]+$/]',
|
||||||
'errors' => [
|
'errors' => [
|
||||||
'required' => 'State is required.',
|
'required' => 'State is required.',
|
||||||
'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
|
'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
|
||||||
@ -1370,7 +1370,7 @@ class MasterController extends AdminController
|
|||||||
|
|
||||||
'state' => [
|
'state' => [
|
||||||
'label' => 'State',
|
'label' => 'State',
|
||||||
'rules' => 'required|regex_match[/^[a-zA-Z\s\-]+$/]',
|
'rules' => 'required|regex_match[/^[a-zA-Z0-9\/\-\_\.\s]+$/]',
|
||||||
'errors' => [
|
'errors' => [
|
||||||
'required' => 'State is required.',
|
'required' => 'State is required.',
|
||||||
'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
|
'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
|
||||||
@ -3590,7 +3590,7 @@ class MasterController extends AdminController
|
|||||||
],
|
],
|
||||||
'state' => [
|
'state' => [
|
||||||
'label' => 'State',
|
'label' => 'State',
|
||||||
'rules' => 'required|regex_match[/^[a-zA-Z\s\-]+$/]',
|
'rules' => 'required|regex_match[/^[a-zA-Z0-9\/\-\_\.\s]+$/]',
|
||||||
'errors' => [
|
'errors' => [
|
||||||
'required' => 'State is required.',
|
'required' => 'State is required.',
|
||||||
'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
|
'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
|
||||||
|
|||||||
@ -395,6 +395,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="append_html_for_other_policy_terms_72_after_family"></div>
|
||||||
|
|
||||||
|
|
||||||
<div class="other_special_condition" style="margin-top: 10px;">
|
<div class="other_special_condition" style="margin-top: 10px;">
|
||||||
|
|
||||||
@ -521,6 +523,7 @@
|
|||||||
$('body').on('click', '.btnPolicyMaster', function() {
|
$('body').on('click', '.btnPolicyMaster', function() {
|
||||||
|
|
||||||
$("#append_html_for_other_policy_terms").empty();
|
$("#append_html_for_other_policy_terms").empty();
|
||||||
|
$("#append_html_for_other_policy_terms_72_after_family").empty();
|
||||||
|
|
||||||
var client_policy_id = $(this).data('id');
|
var client_policy_id = $(this).data('id');
|
||||||
policy_type_id = $(this).data('typeid');
|
policy_type_id = $(this).data('typeid');
|
||||||
@ -575,6 +578,10 @@
|
|||||||
|
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
|
|
||||||
|
if (policy_type_id == 72) {
|
||||||
|
appendPolicyTermsHTML(policy_type_id);
|
||||||
|
}
|
||||||
|
|
||||||
//special conditions fields
|
//special conditions fields
|
||||||
let otherTermsJsonObjectSpecialCondition = JSON.parse(res.data);
|
let otherTermsJsonObjectSpecialCondition = JSON.parse(res.data);
|
||||||
Object.keys(otherTermsJsonObjectSpecialCondition).forEach(function(key) {
|
Object.keys(otherTermsJsonObjectSpecialCondition).forEach(function(key) {
|
||||||
@ -757,6 +764,10 @@
|
|||||||
$('#other_member_max_age_others').val(jsonObject[key].elders.max);
|
$('#other_member_max_age_others').val(jsonObject[key].elders.max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (key.includes("enrollment_display_key") && jsonObject[key]) {
|
||||||
|
processOtherEnrollmentDisplayKey(jsonObject[key]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -929,7 +940,12 @@
|
|||||||
function appendPolicyTermsHTML(policy_type) {
|
function appendPolicyTermsHTML(policy_type) {
|
||||||
|
|
||||||
var termsHTML = ""
|
var termsHTML = ""
|
||||||
$('#append_html_for_other_policy_terms').empty();
|
var targetContainer = '#append_html_for_other_policy_terms';
|
||||||
|
if (policy_type == 72) {
|
||||||
|
targetContainer = '#append_html_for_other_policy_terms_72_after_family';
|
||||||
|
}
|
||||||
|
|
||||||
|
$(targetContainer).empty();
|
||||||
|
|
||||||
if (policy_type == 7) {
|
if (policy_type == 7) {
|
||||||
|
|
||||||
@ -1132,10 +1148,126 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
`
|
||||||
|
} else if (policy_type == 72) {
|
||||||
|
termsHTML = `
|
||||||
|
|
||||||
|
<div class="form-group OPD_POLICY_TERMS">
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" name="mode_of_serviceability_display" id="mode_of_serviceability_display" class="unchecked" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<label for="mode_of_serviceability">Mode of Serviceability</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="mode_of_serviceability" id="mode_of_serviceability" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" name="eligibility_display" id="eligibility_display" class="unchecked" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<label for="eligibility">Eligibility</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="eligibility" id="eligibility" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" name="total_sum_insured_limit_display" id="total_sum_insured_limit_display" class="unchecked" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<label for="total_sum_insured_limit">Total Sum Insured limit</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="total_sum_insured_limit" id="total_sum_insured_limit" class="form-control" value="INR 15000">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" name="in_person_doctor_consultation_display" id="in_person_doctor_consultation_display" class="unchecked" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<label for="in_person_doctor_consultation">In Person Doctor Consultation</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="in_person_doctor_consultation" id="in_person_doctor_consultation" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" name="prescribed_lab_test_pathology_radiology_display" id="prescribed_lab_test_pathology_radiology_display" class="unchecked" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<label for="prescribed_lab_test_pathology_radiology">Prescribed Lab test (Pathology & Radiology)</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="prescribed_lab_test_pathology_radiology" id="prescribed_lab_test_pathology_radiology" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" name="prescribed_pharmacy_display" id="prescribed_pharmacy_display" class="unchecked" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<label for="prescribed_pharmacy">Prescribed Pharmacy</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="prescribed_pharmacy" id="prescribed_pharmacy" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" name="dental_display" id="dental_display" class="unchecked" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<label for="dental">Dental</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="dental" id="dental" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" name="vision_display" id="vision_display" class="unchecked" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<label for="vision">Vision</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="vision" id="vision" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" name="vaccination_for_children_and_adults_display" id="vaccination_for_children_and_adults_display" class="unchecked" checked>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<label for="vaccination_for_children_and_adults">Vaccination for children & adults</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" name="vaccination_for_children_and_adults" id="vaccination_for_children_and_adults" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#append_html_for_other_policy_terms').append(termsHTML);
|
$(targetContainer).append(termsHTML);
|
||||||
}
|
}
|
||||||
|
|
||||||
function appendOtherSIAddMore(data = null) {
|
function appendOtherSIAddMore(data = null) {
|
||||||
@ -1177,6 +1309,41 @@
|
|||||||
.join(' '); // Join with spaces instead of underscores
|
.join(' '); // Join with spaces instead of underscores
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function processOtherEnrollmentDisplayKey(displayObject) {
|
||||||
|
if (!displayObject || typeof displayObject !== 'object' || Array.isArray(displayObject)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const displayMap = {
|
||||||
|
'Mode Of Serviceability': 'mode_of_serviceability_display',
|
||||||
|
'Eligibility': 'eligibility_display',
|
||||||
|
'Total Sum Insured Limit': 'total_sum_insured_limit_display',
|
||||||
|
'In Person Doctor Consultation': 'in_person_doctor_consultation_display',
|
||||||
|
'Prescribed Lab Test Pathology Radiology': 'prescribed_lab_test_pathology_radiology_display',
|
||||||
|
'Prescribed Pharmacy': 'prescribed_pharmacy_display',
|
||||||
|
'Dental': 'dental_display',
|
||||||
|
'Vision': 'vision_display',
|
||||||
|
'Vaccination For Children And Adults': 'vaccination_for_children_and_adults_display'
|
||||||
|
};
|
||||||
|
|
||||||
|
$('#append_html_for_other_policy_terms_72_after_family .unchecked').prop('checked', false);
|
||||||
|
|
||||||
|
Object.keys(displayObject).forEach(function(label) {
|
||||||
|
let checkboxId = displayMap[label];
|
||||||
|
if (!checkboxId) {
|
||||||
|
checkboxId = label
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(/[\s\-\/,&]+/g, '_')
|
||||||
|
.replace(/_+/g, '_')
|
||||||
|
.replace(/^_+|_+$/g, '') + '_display';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (displayObject[label] !== '' && displayObject[label] !== null && displayObject[label] !== undefined) {
|
||||||
|
$('#' + checkboxId).prop('checked', true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function autoSaveOtherTerms() {
|
function autoSaveOtherTerms() {
|
||||||
|
|
||||||
console.log('autoSaveOtherTerms function called');
|
console.log('autoSaveOtherTerms function called');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user