mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-05-09 11:01:45 +00:00
fix(finance): preserve visibility and settlement updates
This commit is contained in:
@@ -111,10 +111,11 @@ export function buildCategoryBreakdownData({
|
||||
});
|
||||
}
|
||||
|
||||
categories.sort((a, b) => b.currentAmount - a.currentAmount);
|
||||
const filtered = categories.filter((c) => c.currentAmount > 0);
|
||||
filtered.sort((a, b) => b.currentAmount - a.currentAmount);
|
||||
|
||||
return {
|
||||
categories,
|
||||
categories: filtered,
|
||||
currentTotal,
|
||||
previousTotal,
|
||||
};
|
||||
|
||||
@@ -111,6 +111,7 @@ export async function fetchCategoryDetails(
|
||||
sanitizedNote,
|
||||
eq(transactions.period, previousPeriod),
|
||||
or(
|
||||
isNull(transactions.note),
|
||||
ne(transactions.note, INITIAL_BALANCE_NOTE),
|
||||
isNull(financialAccounts.excludeInitialBalanceFromIncome),
|
||||
eq(financialAccounts.excludeInitialBalanceFromIncome, false),
|
||||
|
||||
@@ -50,6 +50,7 @@ export const excludeAutoGeneratedEntryNotes = () =>
|
||||
|
||||
export const excludeInitialBalanceWhenConfigured = () =>
|
||||
or(
|
||||
isNull(transactions.note),
|
||||
ne(transactions.note, INITIAL_BALANCE_NOTE),
|
||||
isNull(financialAccounts.excludeInitialBalanceFromIncome),
|
||||
eq(financialAccounts.excludeInitialBalanceFromIncome, false),
|
||||
|
||||
@@ -113,6 +113,7 @@ export async function fetchTopEstablishmentsData(
|
||||
not(ilike(transactions.note, `${ACCOUNT_AUTO_INVOICE_NOTE_PREFIX}%`)),
|
||||
),
|
||||
or(
|
||||
isNull(transactions.note),
|
||||
ne(transactions.note, INITIAL_BALANCE_NOTE),
|
||||
isNull(financialAccounts.excludeInitialBalanceFromIncome),
|
||||
eq(financialAccounts.excludeInitialBalanceFromIncome, false),
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -705,6 +705,7 @@ export const updateBulkSchema = z.object({
|
||||
})
|
||||
.optional()
|
||||
.nullable(),
|
||||
isSettled: z.boolean().nullable().optional(),
|
||||
});
|
||||
|
||||
export type UpdateBulkInput = z.infer<typeof updateBulkSchema>;
|
||||
|
||||
@@ -41,6 +41,7 @@ export interface TransactionDialogProps {
|
||||
amount: number;
|
||||
dueDate: string | null;
|
||||
boletoPaymentDate: string | null;
|
||||
isSettled: boolean | null;
|
||||
}) => void;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user