mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-06-10 07:16:01 +00:00
fix(boletos): diferencia pagamentos e recebimentos
This commit is contained in:
@@ -63,6 +63,7 @@ export type PayerBoletoItem = {
|
||||
dueDate: string | null;
|
||||
boletoPaymentDate: string | null;
|
||||
isSettled: boolean;
|
||||
transactionType: string;
|
||||
};
|
||||
|
||||
export type PayerPaymentStatusData = {
|
||||
@@ -322,6 +323,7 @@ export async function fetchPayerBoletoItems({
|
||||
dueDate: transactions.dueDate,
|
||||
boletoPaymentDate: transactions.boletoPaymentDate,
|
||||
isSettled: transactions.isSettled,
|
||||
transactionType: transactions.transactionType,
|
||||
})
|
||||
.from(transactions)
|
||||
.leftJoin(
|
||||
@@ -350,6 +352,7 @@ export async function fetchPayerBoletoItems({
|
||||
dueDate: toDateOnlyString(row.dueDate),
|
||||
boletoPaymentDate: toDateOnlyString(row.boletoPaymentDate),
|
||||
isSettled: Boolean(row.isSettled),
|
||||
transactionType: row.transactionType,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ type FinancialDueDateInfo = {
|
||||
date: string | null;
|
||||
};
|
||||
|
||||
type RelativeFinancialDateContext = "due" | "paid";
|
||||
type RelativeFinancialDateContext = "due" | "paid" | "received";
|
||||
|
||||
export function formatFinancialDateLabel(
|
||||
value: string | null,
|
||||
@@ -75,15 +75,17 @@ export function formatRelativeFinancialDateLabel(
|
||||
return formatFinancialDateLabel(normalizedValue, "Vence em");
|
||||
}
|
||||
|
||||
const settlementLabel = context === "received" ? "Recebido" : "Pago";
|
||||
|
||||
if (normalizedValue === referenceDate) {
|
||||
return "Pago hoje";
|
||||
return `${settlementLabel} hoje`;
|
||||
}
|
||||
|
||||
if (normalizedValue === yesterday) {
|
||||
return "Pago ontem";
|
||||
return `${settlementLabel} ontem`;
|
||||
}
|
||||
|
||||
return formatFinancialDateLabel(normalizedValue, "Pago em");
|
||||
return formatFinancialDateLabel(normalizedValue, `${settlementLabel} em`);
|
||||
}
|
||||
|
||||
export function buildFinancialStatusLabel({
|
||||
|
||||
Reference in New Issue
Block a user