fix: format prices in notifications, change partial payment label, and add session holding notify API
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user