From 436499e21afabd67163ddcc540969ac17cbe60c0 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Fri, 7 Nov 2025 11:16:27 +0530 Subject: [PATCH] FIX_actions --- app/Views/insurer_or_tpa_data.php | 105 ++++++++++++------------------ 1 file changed, 42 insertions(+), 63 deletions(-) diff --git a/app/Views/insurer_or_tpa_data.php b/app/Views/insurer_or_tpa_data.php index b3d0a502..33e34bf2 100755 --- a/app/Views/insurer_or_tpa_data.php +++ b/app/Views/insurer_or_tpa_data.php @@ -484,13 +484,24 @@ if(policy_value == 0 || insurer_or_tpa == 'tpa' || action_type == 'import'){ $("#event_type").removeAttr("multiple"); $("#event_type").attr("name", "event_type"); - if ($.fn.select2 && $('#event_type').data('select2')) { - $('#event_type').select2('destroy'); - } $("#event_type").select2('destroy'); } }) + /**This function updates the download link based on the selected option in the dropdown menu. **/ + $('#event_type').on('change', function() { + + var selectedValue = $(this).val(); + if (selectedValue !== '') { + $('#import_excel_download').show(); + var fullURL = '' + selectedValue; + $('#import_excel_download').attr('href', fullURL); + } else { + $('#import_excel_download').hide(); + $('#import_excel_download').removeAttr('href'); + } + }); + $('#event_type').on('change', function() { var selectedVal = $(this).val(); @@ -517,6 +528,34 @@ console.log('tpa_api_sevice type', typeof tpa_api_sevice); }); + $('#action_type').on('change', function() { + + var selectedValue = $(this).val(); + var insurer_or_tpa = $('#insurer_or_tpa').val() + // console.log(selectedValue); + + if (selectedValue == '') { + $('#import_excel_btn').hide(); + $('#export_excel_btn').hide(); + } else if (selectedValue == 'import') { + $('#import_file').prop('required', true); + $('#import_file').attr('name', 'import_file_data'); + $('#import_excel_btn').show(); + $('#export_excel_btn').hide(); + } else if (selectedValue == 'export') { + $('#import_file').removeAttr('name'); + $('#import_file').prop('required', false); + $('#import_excel_btn').hide(); + $('#export_excel_btn').show(); + } + + if (tpa_api_sevice == 0 || selectedValue == 'export' || insurer_or_tpa == "insurer") { + $('.fetch_tpa').hide(); + } else { + $('.fetch_tpa').show(); + } + }); + $('#insurer_or_tpa').on('change', function() { var insurer_or_tpa = $(this).val() @@ -538,18 +577,12 @@ $("#event_type").removeAttr("multiple"); $("#event_type").attr("name", "event_type"); - if ($.fn.select2 && $('#event_type').data('select2')) { - $('#event_type').select2('destroy'); - } $("#event_type").select2('destroy'); }else if(insurer_or_tpa == 'insurer' && action_type == 'import'){ $("#event_type").removeAttr("multiple"); $("#event_type").attr("name", "event_type"); - if ($.fn.select2 && $('#event_type').data('select2')) { - $('#event_type').select2('destroy'); - } $("#event_type").select2('destroy'); }else if(insurer_or_tpa == 'insurer' && action_type == 'export' && event_type_data == 1){ @@ -562,9 +595,6 @@ $("#event_type").removeAttr("multiple"); $("#event_type").attr("name", "event_type"); - if ($.fn.select2 && $('#event_type').data('select2')) { - $('#event_type').select2('destroy'); - } $("#event_type").select2('destroy'); }else{ @@ -596,18 +626,12 @@ $("#event_type").removeAttr("multiple"); $("#event_type").attr("name", "event_type"); - if ($.fn.select2 && $('#event_type').data('select2')) { - $('#event_type').select2('destroy'); - } $("#event_type").select2('destroy'); } else if(action_type == 'export' && insurer_or_tpa == 'tpa'){ $("#event_type").removeAttr("multiple"); $("#event_type").attr("name", "event_type"); - if ($.fn.select2 && $('#event_type').data('select2')) { - $('#event_type').select2('destroy'); - } $("#event_type").select2('destroy'); }else if(action_type == 'export' && insurer_or_tpa == 'insurer' && event_type_data == 1){ @@ -620,9 +644,6 @@ $("#event_type").removeAttr("multiple"); $("#event_type").attr("name", "event_type"); - if ($.fn.select2 && $('#event_type').data('select2')) { - $('#event_type').select2('destroy'); - } $("#event_type").select2('destroy'); }else{ @@ -634,48 +655,6 @@ } }); - /**This function updates the download link based on the selected option in the dropdown menu. **/ - $('#event_type').on('change', function() { - - var selectedValue = $(this).val(); - if (selectedValue !== '') { - $('#import_excel_download').show(); - var fullURL = '' + selectedValue; - $('#import_excel_download').attr('href', fullURL); - } else { - $('#import_excel_download').hide(); - $('#import_excel_download').removeAttr('href'); - } - }); - - $('#action_type').on('change', function() { - - var selectedValue = $(this).val(); - var insurer_or_tpa = $('#insurer_or_tpa').val() - // console.log(selectedValue); - - if (selectedValue == '') { - $('#import_excel_btn').hide(); - $('#export_excel_btn').hide(); - } else if (selectedValue == 'import') { - $('#import_file').prop('required', true); - $('#import_file').attr('name', 'import_file_data'); - $('#import_excel_btn').show(); - $('#export_excel_btn').hide(); - } else if (selectedValue == 'export') { - $('#import_file').removeAttr('name'); - $('#import_file').prop('required', false); - $('#import_excel_btn').hide(); - $('#export_excel_btn').show(); - } - - if (tpa_api_sevice == 0 || selectedValue == 'export' || insurer_or_tpa == "insurer") { - $('.fetch_tpa').hide(); - } else { - $('.fetch_tpa').show(); - } - }); - }); // Function to convert object to query parameters