CHANGE_SCRIPT_TERMS : RV
This commit is contained in:
parent
f1e1223337
commit
339518f760
@ -2399,6 +2399,7 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
public function enrollmentGMCDisplayValueTransform()
|
public function enrollmentGMCDisplayValueTransform()
|
||||||
{
|
{
|
||||||
|
$data = [];
|
||||||
|
|
||||||
if ($this->request->getPost("waiverofpreexistingdiseases_display")) {
|
if ($this->request->getPost("waiverofpreexistingdiseases_display")) {
|
||||||
$data['Waiver of Pre-existing Diseases'] = $this->request->getPost("waiverofpreexistingdiseases");
|
$data['Waiver of Pre-existing Diseases'] = $this->request->getPost("waiverofpreexistingdiseases");
|
||||||
@ -2560,6 +2561,17 @@ class ClientController extends AdminController
|
|||||||
$data['Breavement Cover'] = $this->request->getPost("breavement_cover");
|
$data['Breavement Cover'] = $this->request->getPost("breavement_cover");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("special_condition_display_value")) {
|
||||||
|
|
||||||
|
$specialConditionKeyValue = $this->request->getPost("special_condition_display_value") ?? [];
|
||||||
|
$specialConditionKeyValue = json_decode($specialConditionKeyValue, true);
|
||||||
|
|
||||||
|
if (is_array($specialConditionKeyValue) && count($specialConditionKeyValue) > 0) {
|
||||||
|
$mergedArray = array_merge(...array_map(fn($item) => (array) $item, $specialConditionKeyValue));
|
||||||
|
$data = array_merge($data, $mergedArray);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($data) && !empty($data)){
|
if(isset($data) && !empty($data)){
|
||||||
return $data;
|
return $data;
|
||||||
}else{
|
}else{
|
||||||
@ -2678,6 +2690,8 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
public function enrollmentGPADisplayValueTransform()
|
public function enrollmentGPADisplayValueTransform()
|
||||||
{
|
{
|
||||||
|
$data = [];
|
||||||
|
|
||||||
if ($this->request->getPost("accidentalDeathBenefit_display")) {
|
if ($this->request->getPost("accidentalDeathBenefit_display")) {
|
||||||
$data['Accidental Death Benefit'] = $this->request->getPost("accidentalDeathBenefit");
|
$data['Accidental Death Benefit'] = $this->request->getPost("accidentalDeathBenefit");
|
||||||
}
|
}
|
||||||
@ -2742,6 +2756,16 @@ class ClientController extends AdminController
|
|||||||
$data['Air Ambulance'] = $this->request->getPost("air_ambulance");
|
$data['Air Ambulance'] = $this->request->getPost("air_ambulance");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->request->getPost("gpa_special_condition_display_value")) {
|
||||||
|
|
||||||
|
$specialConditionKeyValue = $this->request->getPost("gpa_special_condition_display_value") ?? [];
|
||||||
|
$specialConditionKeyValue = json_decode($specialConditionKeyValue, true);
|
||||||
|
|
||||||
|
if (is_array($specialConditionKeyValue) && count($specialConditionKeyValue) > 0) {
|
||||||
|
$mergedArray = array_merge(...array_map(fn($item) => (array) $item, $specialConditionKeyValue));
|
||||||
|
$data = array_merge($data, $mergedArray);
|
||||||
|
}
|
||||||
|
}
|
||||||
// print_r($data); die;
|
// print_r($data); die;
|
||||||
|
|
||||||
if (isset($data) && !empty($data)) {
|
if (isset($data) && !empty($data)) {
|
||||||
|
|||||||
@ -1012,11 +1012,29 @@ $("#policyJsonForm").submit(function(event) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var specialConditions = [];
|
||||||
|
|
||||||
|
$(".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 });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("specialConditions", specialConditions);
|
||||||
|
|
||||||
|
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
$('.loader-mask').fadeIn();
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
var formData = new FormData($('#policyJsonForm')[0]);
|
var formData = new FormData($('#policyJsonForm')[0]);
|
||||||
var policy_form_action = '<?= base_url("client/policy/policyGMCTerms") ?>';
|
var policy_form_action = '<?= base_url("client/policy/policyGMCTerms") ?>';
|
||||||
|
formData.append("special_condition_display_value", JSON.stringify(specialConditions));
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: formData,
|
data: formData,
|
||||||
@ -1140,6 +1158,25 @@ $('body').on('click', '.btnPolicyMaster', function() {
|
|||||||
element.value = " ";
|
element.value = " ";
|
||||||
} else {
|
} else {
|
||||||
element.value = jsonObject[key][index];
|
element.value = jsonObject[key][index];
|
||||||
|
|
||||||
|
if (key.includes("special_condition_label")) {
|
||||||
|
let checkbox = $(element).closest('.form-group').find('input[name="special_condition_display[]"]');
|
||||||
|
console.log("First element:", element);
|
||||||
|
|
||||||
|
if (checkbox.length) {
|
||||||
|
console.log("Checkbox found:", checkbox);
|
||||||
|
|
||||||
|
// Correct way to set the 'id' attribute
|
||||||
|
let formattedValue = jsonObject[key][index].replace(/[\s\-\/,&]+/g, '').toLowerCase();
|
||||||
|
console.log('formattedValue', formattedValue);
|
||||||
|
checkbox.attr('id', formattedValue + '_display');
|
||||||
|
|
||||||
|
console.log("Updated Checkbox:", checkbox);
|
||||||
|
} else {
|
||||||
|
console.log("Checkbox not found for:", element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1534,7 +1571,7 @@ function specialCondition(count = 0) {
|
|||||||
var index = $('.modifyclassinput').length;
|
var index = $('.modifyclassinput').length;
|
||||||
var appendElement = `<div class="form-group col-md-6 form-group-client-policy-masters removeDom">
|
var appendElement = `<div class="form-group col-md-6 form-group-client-policy-masters removeDom">
|
||||||
<div class="col-md-1">
|
<div class="col-md-1">
|
||||||
<input type="checkbox" style="margin-top: 12px" name="special_condition_display_input[]" id="special_condition_display_input" class="unchecked" checked>
|
<input type="checkbox" style="margin-top: 12px" name="special_condition_display[]" id="special_condition_display" class="unchecked" checked>
|
||||||
</div>
|
</div>
|
||||||
<label for="specialconditionlabel" class="special_condition_label[]" style="width: 450px;position: relative;bottom: 6px;">
|
<label for="specialconditionlabel" class="special_condition_label[]" style="width: 450px;position: relative;bottom: 6px;">
|
||||||
<input class="form-control" name="special_condition_label[]" id="special_condition_label[]" style="position: relative;right: 5px;">
|
<input class="form-control" name="special_condition_label[]" id="special_condition_label[]" style="position: relative;right: 5px;">
|
||||||
@ -1736,8 +1773,8 @@ function processJsonObject(jsonObject) {
|
|||||||
|
|
||||||
for (let key in jsonObject) {
|
for (let key in jsonObject) {
|
||||||
if (typeof jsonObject[key] === 'object' && !Array.isArray(jsonObject[key])) {
|
if (typeof jsonObject[key] === 'object' && !Array.isArray(jsonObject[key])) {
|
||||||
console.log('enrollment_display_key');
|
// console.log('enrollment_display_key');
|
||||||
console.log(jsonObject[key]);
|
// console.log(jsonObject[key]);
|
||||||
|
|
||||||
for (let innerKey in jsonObject[key]) {
|
for (let innerKey in jsonObject[key]) {
|
||||||
|
|
||||||
@ -1759,13 +1796,13 @@ function processJsonObject(jsonObject) {
|
|||||||
let base_id = innerKey.replace(/[\s\-\/,&]+/g, '').toLowerCase();
|
let base_id = innerKey.replace(/[\s\-\/,&]+/g, '').toLowerCase();
|
||||||
|
|
||||||
if (keysToCheck.includes(innerKey)) {
|
if (keysToCheck.includes(innerKey)) {
|
||||||
console.log("Key found: " + innerKey);
|
// console.log("Key found: " + innerKey);
|
||||||
base_id = innerKey.replace(/[\s\-\/]+/g, '_').toLowerCase();
|
base_id = innerKey.replace(/[\s\-\/]+/g, '_').toLowerCase();
|
||||||
} else if (innerKey == "Claim Intimation Clause") {
|
} else if (innerKey == "Claim Intimation Clause") {
|
||||||
console.log("Key found: " + innerKey);
|
// console.log("Key found: " + innerKey);
|
||||||
base_id = "days_of_discharge";
|
base_id = "days_of_discharge";
|
||||||
} else if (innerKey == "Claim Submission") {
|
} else if (innerKey == "Claim Submission") {
|
||||||
console.log("Key found: " + innerKey);
|
// console.log("Key found: " + innerKey);
|
||||||
base_id = "days_from_dod";
|
base_id = "days_from_dod";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1778,4 +1815,5 @@ function processJsonObject(jsonObject) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -567,11 +567,28 @@ $("#policyGPATerms").submit(function(event) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var specialConditions = [];
|
||||||
|
|
||||||
|
$(".removeDom").each(function () {
|
||||||
|
var isChecked = $(this).find("input[name='gpa_special_condition_display[]']").is(":checked");
|
||||||
|
|
||||||
|
if (isChecked) {
|
||||||
|
var label = $(this).find("input[name='gpa_special_condition_label[]']").val();
|
||||||
|
var input = $(this).find("input[name='gpa_special_condition_input[]']").val();
|
||||||
|
|
||||||
|
specialConditions.push({ [label]: input });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("gpa_specialConditions", specialConditions);
|
||||||
|
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
$('.loader-mask').fadeIn();
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
var formData = new FormData($('#policyGPATerms')[0]);
|
var formData = new FormData($('#policyGPATerms')[0]);
|
||||||
var policy_form_action = '<?= base_url("client/terms/gpa_create") ?>';
|
var policy_form_action = '<?= base_url("client/terms/gpa_create") ?>';
|
||||||
|
formData.append("gpa_special_condition_display_value", JSON.stringify(specialConditions));
|
||||||
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: formData,
|
data: formData,
|
||||||
@ -691,6 +708,24 @@ $('body').on('click', '.btnPolicyMaster', function() {
|
|||||||
gpaJsonObjectForSpecialCondition[key][
|
gpaJsonObjectForSpecialCondition[key][
|
||||||
index
|
index
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (key.includes("gpa_special_condition_label")) {
|
||||||
|
let checkbox = $(element).closest('.form-group').find('input[name="gpa_special_condition_display[]"]');
|
||||||
|
console.log("First element:", element);
|
||||||
|
|
||||||
|
if (checkbox.length) {
|
||||||
|
console.log("Checkbox found:", checkbox);
|
||||||
|
|
||||||
|
// Correct way to set the 'id' attribute
|
||||||
|
let formattedValue = gpaJsonObjectForSpecialCondition[key][index].replace(/[\s\-\/,&]+/g, '').toLowerCase();
|
||||||
|
console.log('formattedValue', formattedValue);
|
||||||
|
checkbox.attr('id', formattedValue + '_display');
|
||||||
|
|
||||||
|
console.log("Updated Checkbox:", checkbox);
|
||||||
|
} else {
|
||||||
|
console.log("Checkbox not found for:", element);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -713,7 +748,7 @@ $('body').on('click', '.btnPolicyMaster', function() {
|
|||||||
console.log('enrollment_display_key');
|
console.log('enrollment_display_key');
|
||||||
console.log(gpaJsonObjectForSpecialCondition[key]);
|
console.log(gpaJsonObjectForSpecialCondition[key]);
|
||||||
|
|
||||||
processJsonObject(gpaJsonObjectForSpecialCondition);
|
processJsonObject2(gpaJsonObjectForSpecialCondition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -838,7 +873,9 @@ function specialConditionForGPA(count = 0) {
|
|||||||
|
|
||||||
var index = $('.modifyclassinput').length;
|
var index = $('.modifyclassinput').length;
|
||||||
var appendElement = `<div class="form-group col-md-6 form-group-client-policy-masters removeDom">
|
var appendElement = `<div class="form-group col-md-6 form-group-client-policy-masters removeDom">
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="checkbox" style="margin-top: 12px" name="gpa_special_condition_display[]" id="special_condition_display" class="unchecked" checked>
|
||||||
|
</div>
|
||||||
<label for="specialconditionlabel" class="special_condition_label[]" style="width: 450px;position: relative;bottom: 6px;">
|
<label for="specialconditionlabel" class="special_condition_label[]" style="width: 450px;position: relative;bottom: 6px;">
|
||||||
<input class="form-control" name="gpa_special_condition_label[]" id="gpa_special_condition_label[]" style="position: relative;right: 5px;">
|
<input class="form-control" name="gpa_special_condition_label[]" id="gpa_special_condition_label[]" style="position: relative;right: 5px;">
|
||||||
<span class="specialConditionClose" style="color: red; float: right;position: relative;bottom: 28px;left: 15px;">X</span>
|
<span class="specialConditionClose" style="color: red; float: right;position: relative;bottom: 28px;left: 15px;">X</span>
|
||||||
@ -951,7 +988,7 @@ function inArray(key, array) {
|
|||||||
return array.includes(key);
|
return array.includes(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
function processJsonObject(jsonObject) {
|
function processJsonObject2(jsonObject) {
|
||||||
|
|
||||||
if (typeof jsonObject !== 'object' || Array.isArray(jsonObject)) {
|
if (typeof jsonObject !== 'object' || Array.isArray(jsonObject)) {
|
||||||
console.log("jsonObject Input is not a valid object.");
|
console.log("jsonObject Input is not a valid object.");
|
||||||
@ -962,8 +999,8 @@ function processJsonObject(jsonObject) {
|
|||||||
|
|
||||||
for (let key in jsonObject) {
|
for (let key in jsonObject) {
|
||||||
if (typeof jsonObject[key] === 'object' && !Array.isArray(jsonObject[key])) {
|
if (typeof jsonObject[key] === 'object' && !Array.isArray(jsonObject[key])) {
|
||||||
console.log('enrollment_display_key');
|
// console.log('enrollment_display_key');
|
||||||
console.log(jsonObject[key]);
|
// console.log(jsonObject[key]);
|
||||||
|
|
||||||
for (let innerKey in jsonObject[key]) {
|
for (let innerKey in jsonObject[key]) {
|
||||||
|
|
||||||
@ -983,20 +1020,20 @@ function processJsonObject(jsonObject) {
|
|||||||
base_id = base_id.charAt(0).toLowerCase() + base_id.slice(1);
|
base_id = base_id.charAt(0).toLowerCase() + base_id.slice(1);
|
||||||
|
|
||||||
if (keysToCheck.includes(innerKey)) {
|
if (keysToCheck.includes(innerKey)) {
|
||||||
console.log("Key found: " + innerKey);
|
// console.log("Key found: " + innerKey);
|
||||||
base_id = innerKey.replace(/[\s\-\/]+/g, '_').toLowerCase();
|
base_id = innerKey.replace(/[\s\-\/]+/g, '_').toLowerCase();
|
||||||
} else if (innerKey == "Medical Expenses / Medical Extension (IPD)") {
|
} else if (innerKey == "Medical Expenses / Medical Extension (IPD)") {
|
||||||
console.log("Key found: " + innerKey);
|
// console.log("Key found: " + innerKey);
|
||||||
base_id = "medical_expenses_medical_extension";
|
base_id = "medical_expenses_medical_extension";
|
||||||
} else if (innerKey == "Terrorism") {
|
} else if (innerKey == "Terrorism") {
|
||||||
console.log("Key found: " + innerKey);
|
// console.log("Key found: " + innerKey);
|
||||||
base_id = "gpa_terrorism";
|
base_id = "gpa_terrorism";
|
||||||
}
|
}
|
||||||
|
|
||||||
let display_id = base_id + "_display";
|
let display_id = base_id + "_display";
|
||||||
$('#' + display_id).prop('checked', true);
|
$('#' + display_id).prop('checked', true);
|
||||||
console.log('display_id : ', display_id);
|
// console.log('display_id : ', display_id);
|
||||||
console.log($('#' + display_id))
|
// console.log($('#' + display_id))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log(`${key} is not an object.`);
|
console.log(`${key} is not an object.`);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user