From 42773b2700a29402cb87390d08146e46fe3d5f64 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Sat, 20 Sep 2025 11:13:16 +0530 Subject: [PATCH] CHANGE_BDS --- .../policy_transaction_inception_form.php | 110 +++++++++++++++--- .../policy_transaction_inception_list.php | 14 +++ 2 files changed, 106 insertions(+), 18 deletions(-) diff --git a/app/Views/policy_transaction_inception_form.php b/app/Views/policy_transaction_inception_form.php index 9e488811..e77664a4 100644 --- a/app/Views/policy_transaction_inception_form.php +++ b/app/Views/policy_transaction_inception_form.php @@ -295,7 +295,7 @@ -
+
@@ -1374,6 +1374,8 @@ $('#client_row_div').empty(); $('#actcual_clients').show(); + let status = $('#policy_status').val(); + console.log(client_id); console.log(branch_id); @@ -1414,6 +1416,17 @@ $(this).val('').select2(); $('#actcual_clients').hide(); appendVehicleForm(); + + $('#pre_sales_row').hide(); + $('#sales_row').hide(); + $('#submitButton').hide(); + + }else{ + $('#pre_sales_row').show(); + $('#submitButton').show(); + if(status == "completed"){ + $('#sales_row').show(); + } } }) @@ -1513,6 +1526,13 @@ $('#client_row_div').empty(); $('#actcual_clients').show(); + let status = $('#policy_status').val(); + $('#pre_sales_row').show(); + $('#submitButton').show(); + if(status == "completed"){ + $('#sales_row').show(); + } + var client_type = $('#client_type').val(); var value = $(this).val(); var selectedOption = $(this).find('option:selected'); @@ -1621,24 +1641,27 @@ $('#client_type option[value="2"]').show(); } - if(value == 1 || value == 2 || value == 3 || value == 4 || value == 5 || value == 38 || value == 40){ - $('#tpa_div').hide(); - }else{ + // if(value == 38 || value == 40){ + // $('#tpa_div').hide(); + // }else{ + // $('#tpa_div').show(); + // } + + if(value == 1 || value == 2 || value == 3 || value == 4 || value == 5){ $('#tpa_div').show(); + }else{ + $('#tpa_div').hide(); } - if( value == 38 || value == 40 ){ - $('#tpa_div').hide(); - } - else if(value > 7){ - $('#tpa_div').hide(); - $('#no_of_insured_div').hide(); - $('#no_of_dependents_div').hide(); - } - else{ - $('#tpa_div').show(); + if(value == 2 || value == 3 || value == 4 || value == 5){ $('#no_of_insured_div').show(); $('#no_of_dependents_div').show(); + }else if(value == 1 || value == 6 || value == 7) { + $('#no_of_insured_div').show(); + $('#no_of_dependents_div').hide(); + }else{ + $('#no_of_insured_div').hide(); + $('#no_of_dependents_div').hide(); } if(value == 1 || value == 2 || value == 3 || value == 4 || value == 5 || value == 6 || value == 7){ @@ -3931,10 +3954,21 @@ }); } - if(policy_type_id == 1 || policy_type_id == 2 || policy_type_id == 3 || policy_type_id == 4 || policy_type_id == 5 || policy_type_id == 38 || policy_type_id == 40){ - $('#tpa_div').hide(); - }else{ + if(policy_type_id == 1 || policy_type_id == 2 || policy_type_id == 3 || policy_type_id == 4 || policy_type_id == 5){ $('#tpa_div').show(); + }else{ + $('#tpa_div').hide(); + } + + if(policy_type_id == 2 || policy_type_id == 3 || policy_type_id == 4 || policy_type_id == 5){ + $('#no_of_insured_div').show(); + $('#no_of_dependents_div').show(); + }else if(policy_type_id == 1 || policy_type_id == 6 || policy_type_id == 7) { + $('#no_of_insured_div').show(); + $('#no_of_dependents_div').hide(); + }else{ + $('#no_of_insured_div').hide(); + $('#no_of_dependents_div').hide(); } }else{ @@ -4972,7 +5006,7 @@ function toggleClient(input) { let btn = $("#vehicle_client_btn"); - let client_type = $('#client_type').val(); + let client_type = $('#owner_client_type').val(); // if (btn.text().trim() === "New Client") { // btn.text("Existing Client"); @@ -5040,10 +5074,22 @@ function removeVehicleForm(){ $('#vehicle_row_div').empty(); $('#actcual_clients').show(); + let status = $('#policy_status').val(); + $('#pre_sales_row').show(); + $('#submitButton').show(); + if(status == "completed"){ + $('#sales_row').show(); + } } function removeClientForm(){ $('#client_row_div').empty(); + let status = $('#policy_status').val(); + $('#pre_sales_row').show(); + $('#submitButton').show(); + if(status == "completed"){ + $('#sales_row').show(); + } } function getVehicleFormData() { @@ -5114,6 +5160,12 @@ $('#client_row_div').empty(); $('#vehicle_row_div').empty(); $('#actcual_clients').show(); + let status = $('#policy_status').val(); + $('#pre_sales_row').show(); + $('#submitButton').show(); + if(status == "completed"){ + $('#sales_row').show(); + } }, function(xhr, status, error) { console.error('Error fetching data:', error); @@ -5173,6 +5225,13 @@ $('#client_row_div').empty(); $('#vehicle_row_div').empty(); + let status = $('#policy_status').val(); + $('#pre_sales_row').show(); + $('#submitButton').show(); + if(status == "completed"){ + $('#sales_row').show(); + } + }, function(xhr, status, error) { console.error('Error fetching data:', error); console.error(xhr.responseText); @@ -5490,6 +5549,20 @@ $(".individual_client").find("select, input, textarea").val("").prop("required", true); } + + $("#client_form_row_div").on("input change", "input, select, textarea", function () { + if ($("#client_type").val() === "") { + alert("Please select the client type first"); + if ($(this).is(":checkbox")) { + // uncheck checkbox + $(this).prop("checked", false); + } else { + // clear text/select/textarea + $(this).val(""); + } + $("#client_type").focus(); // focus back to client_type + } + }); } function validateInputForClient(input, table, field) { @@ -5529,6 +5602,7 @@ }); $('#hide_smbt_btn button').prop('disabled', false); + } $('#client_type').on('change', function() { diff --git a/app/Views/policy_transaction_inception_list.php b/app/Views/policy_transaction_inception_list.php index 32658cd3..f1b63dfc 100644 --- a/app/Views/policy_transaction_inception_list.php +++ b/app/Views/policy_transaction_inception_list.php @@ -1234,6 +1234,8 @@ $(document).ready(function(){ $('#policy_holder_name').val(client_name); + let status = $('#policy_status').val(); + if(client_id == 'add_client') { // if($('#client_type').val()){ @@ -1254,6 +1256,18 @@ $(document).ready(function(){ // toastr.warning('Please select the client type', 'WARNING') // } appendClientForm(); + + $(this).val('').select2(); + $('#pre_sales_row').hide(); + $('#sales_row').hide(); + $('#submitButton').hide(); + + }else{ + $('#pre_sales_row').show(); + $('#submitButton').show(); + if(status == "completed"){ + $('#sales_row').show(); + } } if(branch_list != '') {