fix: format prices in notifications, change partial payment label, and add session holding notify API

This commit is contained in:
2026-08-21 20:17:30 +03:30
parent 6839685a21
commit 4c07ca2ae1
9 changed files with 145 additions and 14 deletions
+10
View File
@@ -44,6 +44,15 @@ const sumPaidTransactions = (transactions = []) => {
}, 0);
};
const formatPrice = (value) => {
if (value === null || value === undefined || value === '') return '';
const num = typeof value === 'number' ? value : Number(String(value).replace(/,/g, ''));
if (!Number.isNaN(num) && Number.isFinite(num)) {
return num.toLocaleString('en-US');
}
return String(value);
};
const remainingPayable = (payment = {}, transactions = []) => {
return Math.max(0, getPayableAmount(payment) - sumPaidTransactions(transactions));
};
@@ -53,6 +62,7 @@ module.exports = {
getPayableAmount,
normalizeDiscount,
sanitizeNotes,
formatPrice,
rialsToToman,
isPaidTransaction,
isCancelledTransaction,