FIX_RACK_RATE_TERMS_FIELD_NAME_CNG : RV

This commit is contained in:
VENKATESHWARAN 2024-06-21 17:20:29 +05:30
parent b9320f22da
commit 9ff46033eb
5 changed files with 83 additions and 41 deletions

View File

@ -2227,33 +2227,50 @@ class ClientController extends AdminController
public function getPolicyTerms($client_policy_id)
{
$policy_terms = $this->clientPolicyModel->where('id', $client_policy_id)->first();
if (isset($policy_terms['policy_terms']) && $policy_terms['policy_terms'] != null) {
$JSON = json_decode($policy_terms['policy_terms']);
$si = null;
if (isset($JSON->sum_insured) && !empty($JSON->sum_insured)) {
$si = $JSON->sum_insured;
} elseif (isset($JSON->sumInsured2) && !empty($JSON->sumInsured2)) {
$si = $JSON->sumInsured2;
}
if ($si !== null) {
$multi_si = $JSON->multiple_sum_insured ?? [];
$multi_si[] = $si;
} else {
$multi_si = [];
}
} else {
$multi_si = [];
if (!$policy_terms) {
return $this->respond(['status' => false, 'error' => 'Policy not found'], 404);
}
if (is_array($policy_terms)) {
if (!isset($policy_terms['policy_terms'])) {
return $this->respond(['status' => false, 'error' => 'Policy terms not found in array'], 500);
}
$JSON = json_decode($policy_terms['policy_terms']);
} elseif (is_object($policy_terms)) {
if (!isset($policy_terms->policy_terms)) {
return $this->respond(['status' => false, 'error' => 'Policy terms not found in object'], 500);
}
$JSON = json_decode($policy_terms->policy_terms);
} else {
return $this->respond(['status' => false, 'error' => 'Unexpected data type for policy terms'], 500);
}
if (!$JSON) {
return $this->respond(['status' => false, 'error' => 'Invalid JSON format in policy terms'], 500);
}
$multi_si = [];
if (isset($JSON->sum_insured) && !empty($JSON->sum_insured)) {
$multi_si[] = $JSON->sum_insured;
} elseif (isset($JSON->sumInsured2) && !empty($JSON->sumInsured2)) {
$multi_si[] = $JSON->sumInsured2;
}
if (isset($JSON->multiple_sum_insured) && is_array($JSON->multiple_sum_insured)) {
foreach ($JSON->multiple_sum_insured as $msi) {
if (!empty($msi)) {
$multi_si[] = $msi;
}
}
}
return $this->respond(['status' => true, 'data' => $multi_si], 200);
}
public function getPolicyTermsFormJson($policy_type_id){

View File

@ -280,10 +280,20 @@ $(document).on('click', '.policy_terms', function() {
const fragment = document.createDocumentFragment();
for (const key in obj) {
if (obj.hasOwnProperty(key) && obj[key] !== null && obj[key] !== '' && key !=
'family_floater' && key != 'gpa_special_condition_input' && key !=
'gpa_special_condition_label' && key != 'special_condition_label' && key !=
'special_condition_input' && key != 'age_ratio' && key != "multiple_sum_insured" && key != "other_special_condition_label" && key != "other_special_condition_input") {
if (
obj.hasOwnProperty(key) &&
obj[key] !== null &&
obj[key] !== '' &&
key != 'family_floater' &&
key != 'family_floater' &&
key != 'gpa_special_condition_input' &&
key != 'gpa_special_condition_label' &&
key != 'special_condition_label' &&
key != 'special_condition_input' &&
key != 'age_ratio' &&
key != "multiple_sum_insured" &&
key != "other_special_condition_label" &&
key != "other_special_condition_input") {
const listItem = document.createElement('li');

View File

@ -507,7 +507,7 @@
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
<label for="totalSumInsured">AYUSH treatment cover Data</label>
<label for="totalSumInsured">AYUSH treatment cover Limit</label>
</div>
<div class="col-md-6">
<input type="text" name="ayushTreatmentCoverData" id="ayushTreatmentCoverData" class="form-control">
@ -637,7 +637,7 @@
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
<label for="totalSumInsured">Cataract Data</label>
<label for="totalSumInsured">Cataract Limit</label>
</div>
<div class="col-md-6">
<input type="text" name="cataractData" id="cataractData" class="form-control">
@ -929,10 +929,21 @@
}
if (key.includes("multiple_sum_insured")) {
jsonObject[key].forEach((value, index) => {
appendGMCSIAddMore(value);
});
// if (key.includes("multiple_sum_insured")) {
// jsonObject[key].forEach((value, index) => {
// appendGMCSIAddMore(value);
// });
// }
if (key.includes("multiple_sum_insured") && key != "") {
if (Array.isArray(jsonObject[key])) {
jsonObject[key].forEach((value, index) => {
appendGMCSIAddMore(value);
});
} else {
console.error(`${key} is not an array.`);
}
}
if (key.includes("family_floaters")) {

View File

@ -575,11 +575,17 @@
}
}
if (key.includes("multiple_sum_insured")) {
gpaJsonObjectForSpecialCondition[key].forEach((value, index) => {
appendGPASIAddMore(value);
});
if (key.includes("multiple_sum_insured") && key != "") {
if (Array.isArray(gpaJsonObjectForSpecialCondition[key])) {
gpaJsonObjectForSpecialCondition[key].forEach((value, index) => {
appendGPASIAddMore(value);
});
} else {
console.error(`${key} is not an array.`);
}
}
});
let jsonObject = JSON.parse(res.data);

View File

@ -63,8 +63,7 @@
<label for="individual" style="position: relative;top: 5px;left: 5px;">
Individual </label>&nbsp;
<input type="radio" id="single" name="premium_type" value="1">
<label for="single" style="position: relative;top: 5px;left: 5px;"> Single
Insurance </label>
<label for="single" style="position: relative;top: 5px;left: 5px;"> Family Floater </label>
</div>
</div>
</div>
@ -123,8 +122,7 @@
<label for="individual" style="position: relative;top: 5px;left: 5px;">
Individual </label>&nbsp;
<input type="radio" id="single_2" name="premium_type" value="1">
<label for="single" style="position: relative;top: 5px;left: 5px;"> Single
Insurance </label>
<label for="single" style="position: relative;top: 5px;left: 5px;"> Family Floater </label>
</div>
</div>
</div>