Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
VENKATESHWARAN 2025-10-24 12:01:46 +05:30
commit 4817da49ef
2 changed files with 26 additions and 0 deletions

View File

@ -2687,6 +2687,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,

View File

@ -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';