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 {
|
return {
|
||||||
categories,
|
categories: filtered,
|
||||||
currentTotal,
|
currentTotal,
|
||||||
previousTotal,
|
previousTotal,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ export async function fetchCategoryDetails(
|
|||||||
sanitizedNote,
|
sanitizedNote,
|
||||||
eq(transactions.period, previousPeriod),
|
eq(transactions.period, previousPeriod),
|
||||||
or(
|
or(
|
||||||
|
isNull(transactions.note),
|
||||||
ne(transactions.note, INITIAL_BALANCE_NOTE),
|
ne(transactions.note, INITIAL_BALANCE_NOTE),
|
||||||
isNull(financialAccounts.excludeInitialBalanceFromIncome),
|
isNull(financialAccounts.excludeInitialBalanceFromIncome),
|
||||||
eq(financialAccounts.excludeInitialBalanceFromIncome, false),
|
eq(financialAccounts.excludeInitialBalanceFromIncome, false),
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ export const excludeAutoGeneratedEntryNotes = () =>
|
|||||||
|
|
||||||
export const excludeInitialBalanceWhenConfigured = () =>
|
export const excludeInitialBalanceWhenConfigured = () =>
|
||||||
or(
|
or(
|
||||||
|
isNull(transactions.note),
|
||||||
ne(transactions.note, INITIAL_BALANCE_NOTE),
|
ne(transactions.note, INITIAL_BALANCE_NOTE),
|
||||||
isNull(financialAccounts.excludeInitialBalanceFromIncome),
|
isNull(financialAccounts.excludeInitialBalanceFromIncome),
|
||||||
eq(financialAccounts.excludeInitialBalanceFromIncome, false),
|
eq(financialAccounts.excludeInitialBalanceFromIncome, false),
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ export async function fetchTopEstablishmentsData(
|
|||||||
not(ilike(transactions.note, `${ACCOUNT_AUTO_INVOICE_NOTE_PREFIX}%`)),
|
not(ilike(transactions.note, `${ACCOUNT_AUTO_INVOICE_NOTE_PREFIX}%`)),
|
||||||
),
|
),
|
||||||
or(
|
or(
|
||||||
|
isNull(transactions.note),
|
||||||
ne(transactions.note, INITIAL_BALANCE_NOTE),
|
ne(transactions.note, INITIAL_BALANCE_NOTE),
|
||||||
isNull(financialAccounts.excludeInitialBalanceFromIncome),
|
isNull(financialAccounts.excludeInitialBalanceFromIncome),
|
||||||
eq(financialAccounts.excludeInitialBalanceFromIncome, false),
|
eq(financialAccounts.excludeInitialBalanceFromIncome, false),
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ export async function updateTransactionBulkAction(
|
|||||||
payerId: data.payerId ?? null,
|
payerId: data.payerId ?? null,
|
||||||
accountId: data.accountId ?? null,
|
accountId: data.accountId ?? null,
|
||||||
cardId: data.cardId ?? null,
|
cardId: data.cardId ?? null,
|
||||||
|
...(data.isSettled !== undefined && { isSettled: data.isSettled }),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (data.amount !== undefined) {
|
if (data.amount !== undefined) {
|
||||||
|
|||||||
@@ -705,6 +705,7 @@ export const updateBulkSchema = z.object({
|
|||||||
})
|
})
|
||||||
.optional()
|
.optional()
|
||||||
.nullable(),
|
.nullable(),
|
||||||
|
isSettled: z.boolean().nullable().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export type UpdateBulkInput = z.infer<typeof updateBulkSchema>;
|
export type UpdateBulkInput = z.infer<typeof updateBulkSchema>;
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ export interface TransactionDialogProps {
|
|||||||
amount: number;
|
amount: number;
|
||||||
dueDate: string | null;
|
dueDate: string | null;
|
||||||
boletoPaymentDate: string | null;
|
boletoPaymentDate: string | null;
|
||||||
|
isSettled: boolean | null;
|
||||||
}) => void;
|
}) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -346,6 +346,10 @@ export function TransactionDialog({
|
|||||||
mode === "update" && formState.paymentMethod === "Boleto"
|
mode === "update" && formState.paymentMethod === "Boleto"
|
||||||
? formState.boletoPaymentDate || null
|
? formState.boletoPaymentDate || null
|
||||||
: null,
|
: null,
|
||||||
|
isSettled:
|
||||||
|
formState.paymentMethod === "Cartão de crédito"
|
||||||
|
? null
|
||||||
|
: Boolean(formState.isSettled),
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ export function TransactionsPage({
|
|||||||
amount: number;
|
amount: number;
|
||||||
dueDate: string | null;
|
dueDate: string | null;
|
||||||
boletoPaymentDate: string | null;
|
boletoPaymentDate: string | null;
|
||||||
|
isSettled: boolean | null;
|
||||||
transaction: TransactionItem;
|
transaction: TransactionItem;
|
||||||
} | null>(null);
|
} | null>(null);
|
||||||
const [pendingDeleteData, setPendingDeleteData] =
|
const [pendingDeleteData, setPendingDeleteData] =
|
||||||
@@ -182,7 +183,7 @@ export function TransactionsPage({
|
|||||||
toast.success(
|
toast.success(
|
||||||
nextValue
|
nextValue
|
||||||
? `"${item.name}" marcado como pago`
|
? `"${item.name}" marcado como pago`
|
||||||
: `"${item.name}" desmarcado`,
|
: `"${item.name}" marcado como não pago`,
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const message =
|
const message =
|
||||||
@@ -244,6 +245,7 @@ export function TransactionsPage({
|
|||||||
amount: number;
|
amount: number;
|
||||||
dueDate: string | null;
|
dueDate: string | null;
|
||||||
boletoPaymentDate: string | null;
|
boletoPaymentDate: string | null;
|
||||||
|
isSettled: boolean | null;
|
||||||
}) => {
|
}) => {
|
||||||
if (!selectedTransaction) {
|
if (!selectedTransaction) {
|
||||||
return;
|
return;
|
||||||
@@ -274,6 +276,7 @@ export function TransactionsPage({
|
|||||||
amount: pendingEditData.amount,
|
amount: pendingEditData.amount,
|
||||||
dueDate: pendingEditData.dueDate,
|
dueDate: pendingEditData.dueDate,
|
||||||
boletoPaymentDate: pendingEditData.boletoPaymentDate,
|
boletoPaymentDate: pendingEditData.boletoPaymentDate,
|
||||||
|
isSettled: pendingEditData.isSettled ?? undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ const DEFAULT_EXCLUDE_INITIAL_BALANCE = true;
|
|||||||
|
|
||||||
const buildInitialBalanceVisibilityFilter = () =>
|
const buildInitialBalanceVisibilityFilter = () =>
|
||||||
or(
|
or(
|
||||||
|
isNull(transactions.note),
|
||||||
ne(transactions.note, INITIAL_BALANCE_NOTE),
|
ne(transactions.note, INITIAL_BALANCE_NOTE),
|
||||||
isNull(financialAccounts.excludeInitialBalanceFromIncome),
|
isNull(financialAccounts.excludeInitialBalanceFromIncome),
|
||||||
eq(financialAccounts.excludeInitialBalanceFromIncome, false),
|
eq(financialAccounts.excludeInitialBalanceFromIncome, false),
|
||||||
|
|||||||
Reference in New Issue
Block a user