From 0c6be0aaebadfd2338e2f698684a067fd372d9fa Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 9 May 2024 10:27:56 +0530 Subject: [PATCH] FIX_CLIENT_POLICY_EDIT_HIDE_AND_SHOW_ISSUE : RV --- app/Views/client_policy.php | 67 ++++++++++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 15 deletions(-) diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index fb5cd99f..ff519275 100644 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -549,26 +549,39 @@ // appendPolicyFormFields(2); // } - if (dataId == 3) { + if($('#policy_type').val() == 1){ - var displayStatus = $('#base_policy_id').css('display'); - $('#base_policy_id').show(); - $('#base_policy').prop('required', true); + console.log('step 1') - if (displayStatus === 'none') { - $('#base_policy').val('').change(); - } + if (dataId == 3) { - // $('#base_policy').find('option[data-id="3"]').hide(); + console.log('step 2') - } else { + var displayStatus = $('#base_policy_id').css('display'); + $('#base_policy_id').show(); + $('#base_policy').prop('required', true); - var displayStatus = $('#base_policy_id').css('display'); - $('#base_policy_id').hide(); - $('#base_policy').prop('required', false); + if (displayStatus === 'none') { + console.log('step 2.1') - if (displayStatus === 'none') { - $('#base_policy').val('').change(); + $('#base_policy').val('').change(); + } + + // $('#base_policy').find('option[data-id="3"]').hide(); + + } else { + + console.log('step 3') + + var displayStatus = $('#base_policy_id').css('display'); + $('#base_policy_id').hide(); + $('#base_policy').prop('required', false); + + if (displayStatus === 'none') { + console.log('step 3.1') + + $('#base_policy').val('').change(); + } } } @@ -648,7 +661,28 @@ $('#base_policy').prop('required', false); } + + if(res.data.is_addon == 1 && res.data.base_policy > 0){ + + // $("#insurer").next(".select2-container").css({ + // 'pointer-events': 'none', + // }); + // $('#select2-insurer-container').css({ + // 'background-color': '#ebebe0', + // }); + + // $("#tpa").next(".select2-container").css({ + // 'pointer-events': 'none', + // }); + // $('#select2-tpa-container').css({ + // 'background-color': '#ebebe0', + // }); + + } + + if (res.data.is_addon == 2 || res.data.is_addon == 3) { + $("#insurer").next(".select2-container").css({ 'pointer-events': 'none', }); @@ -693,14 +727,17 @@ $.each(res.client_policy_list, function(index, item) { OptionsHTML += ''; + 'selected="selected"' : '') + '>' + item.name + '( ' + item.policy_type + ' )'; }); $('#base_policy').html(OptionsHTML); setTimeout(function() { $('#policy').val(res.data.policy_id).change(); + $('#base_policy').val(res.data.base_policy); + $('#base_policy').change(); }, 3000); + }, error: function(xhr, status, error) { console.error(xhr.responseText);