mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-06-09 23:06:01 +00:00
fix(transactions): usa data da última transação ao adicionar nova linha no MassAddDialog
Quando o usuário adiciona uma nova linha de transação no dialog de múltiplos lançamentos, a data agora é pré-preenchida com o valor da transação anterior em vez da data atual. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -123,10 +123,11 @@ interface TransactionRow {
|
|||||||
|
|
||||||
function createEmptyTransactionRow(
|
function createEmptyTransactionRow(
|
||||||
defaultPayerId?: string | null,
|
defaultPayerId?: string | null,
|
||||||
|
lastPurchaseDate?: string,
|
||||||
): TransactionRow {
|
): TransactionRow {
|
||||||
return {
|
return {
|
||||||
id: createClientSafeId(),
|
id: createClientSafeId(),
|
||||||
purchaseDate: getTodayDateString(),
|
purchaseDate: lastPurchaseDate ?? getTodayDateString(),
|
||||||
name: "",
|
name: "",
|
||||||
amount: "",
|
amount: "",
|
||||||
categoryId: undefined,
|
categoryId: undefined,
|
||||||
@@ -180,9 +181,10 @@ export function MassAddDialog({
|
|||||||
}, [categoryOptions, transactionType]);
|
}, [categoryOptions, transactionType]);
|
||||||
|
|
||||||
const addTransaction = () => {
|
const addTransaction = () => {
|
||||||
|
const lastTransaction = transactions[transactions.length - 1];
|
||||||
setTransactions([
|
setTransactions([
|
||||||
...transactions,
|
...transactions,
|
||||||
createEmptyTransactionRow(defaultPayerId),
|
createEmptyTransactionRow(defaultPayerId, lastTransaction?.purchaseDate),
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user