From 212f61fa3acbbc51db1db05a63960df45bdc2e05 Mon Sep 17 00:00:00 2001 From: velz Date: Fri, 24 Oct 2025 10:53:14 +0530 Subject: [PATCH] FIX_INV_MODAL_ISSUE --- .../PolicyTransactionController.php | 4 ++++ app/Views/insurer_statement_list.php | 22 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index 94033074..77643f19 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -2682,6 +2682,10 @@ class PolicyTransactionController extends BaseController $gst = $gstTotal[$index]; $paymentDate = $paymentDates[$index]; + if($utrNo == "" && $tds == "" && $gst == "" && $receivedAmount == "") + { + continue; + } // Prepare data for insert/update $childData = [ 'inv_amt' => $receivedAmount, diff --git a/app/Views/insurer_statement_list.php b/app/Views/insurer_statement_list.php index 8e89fcb2..197d19ed 100644 --- a/app/Views/insurer_statement_list.php +++ b/app/Views/insurer_statement_list.php @@ -959,6 +959,23 @@ return parts[2] + '/' + parts[1] + '/' + parts[0]; // Rearrange to DD-MM-YYYY } + function togglePaymentCardRequired(flag) { + // Select the default payment card container + const card = document.getElementById("default_payment_card"); + if (!card) return; + + // Select all input elements inside the card + const inputs = card.querySelectorAll("input"); + + inputs.forEach(input => { + if (flag) { + input.setAttribute("required", "required"); + } else { + input.removeAttribute("required"); + } + }); + } + function showInvoiceStatusModal(event) { console.log('############ showInvoiceStatusModal function called ##################'); var modal_received_amt_div = document.getElementById('modal_received_amt_div'); @@ -1102,6 +1119,7 @@ // Clear existing payment cards in the container var defaultPaymentCardContainer = document.getElementById('default_payment_card'); defaultPaymentCardContainer.style.display = 'block'; + togglePaymentCardRequired(true); var paymentCardContainer = document.getElementById('payment_card_container'); paymentCardContainer.innerHTML = ''; @@ -1110,6 +1128,10 @@ // Populate payment cards if (response.data.payments.length) { defaultPaymentCardContainer.style.display = 'none'; + togglePaymentCardRequired(false); + // if (defaultPaymentCardContainer) { + // defaultPaymentCardContainer.remove(); + // } response.data.payments.forEach(function(payment, index) { var paymentCard = document.createElement('div'); paymentCard.className = 'payment-card';