fix(finance): preserve visibility and settlement updates

This commit is contained in:
Felipe Coutinho
2026-03-25 00:29:36 +00:00
parent 5f70421f5a
commit 1e0c93fb6c
10 changed files with 18 additions and 3 deletions

View File

@@ -172,6 +172,7 @@ export async function updateTransactionBulkAction(
payerId: data.payerId ?? null,
accountId: data.accountId ?? null,
cardId: data.cardId ?? null,
...(data.isSettled !== undefined && { isSettled: data.isSettled }),
};
if (data.amount !== undefined) {

View File

@@ -705,6 +705,7 @@ export const updateBulkSchema = z.object({
})
.optional()
.nullable(),
isSettled: z.boolean().nullable().optional(),
});
export type UpdateBulkInput = z.infer<typeof updateBulkSchema>;

View File

@@ -41,6 +41,7 @@ export interface TransactionDialogProps {
amount: number;
dueDate: string | null;
boletoPaymentDate: string | null;
isSettled: boolean | null;
}) => void;
}

View File

@@ -346,6 +346,10 @@ export function TransactionDialog({
mode === "update" && formState.paymentMethod === "Boleto"
? formState.boletoPaymentDate || null
: null,
isSettled:
formState.paymentMethod === "Cartão de crédito"
? null
: Boolean(formState.isSettled),
});
return;
}

View File

@@ -129,6 +129,7 @@ export function TransactionsPage({
amount: number;
dueDate: string | null;
boletoPaymentDate: string | null;
isSettled: boolean | null;
transaction: TransactionItem;
} | null>(null);
const [pendingDeleteData, setPendingDeleteData] =
@@ -182,7 +183,7 @@ export function TransactionsPage({
toast.success(
nextValue
? `"${item.name}" marcado como pago`
: `"${item.name}" desmarcado`,
: `"${item.name}" marcado como não pago`,
);
} catch (error) {
const message =
@@ -244,6 +245,7 @@ export function TransactionsPage({
amount: number;
dueDate: string | null;
boletoPaymentDate: string | null;
isSettled: boolean | null;
}) => {
if (!selectedTransaction) {
return;
@@ -274,6 +276,7 @@ export function TransactionsPage({
amount: pendingEditData.amount,
dueDate: pendingEditData.dueDate,
boletoPaymentDate: pendingEditData.boletoPaymentDate,
isSettled: pendingEditData.isSettled ?? undefined,
});
if (!result.success) {

View File

@@ -43,6 +43,7 @@ const DEFAULT_EXCLUDE_INITIAL_BALANCE = true;
const buildInitialBalanceVisibilityFilter = () =>
or(
isNull(transactions.note),
ne(transactions.note, INITIAL_BALANCE_NOTE),
isNull(financialAccounts.excludeInitialBalanceFromIncome),
eq(financialAccounts.excludeInitialBalanceFromIncome, false),