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(
|
||||
defaultPayerId?: string | null,
|
||||
lastPurchaseDate?: string,
|
||||
): TransactionRow {
|
||||
return {
|
||||
id: createClientSafeId(),
|
||||
purchaseDate: getTodayDateString(),
|
||||
purchaseDate: lastPurchaseDate ?? getTodayDateString(),
|
||||
name: "",
|
||||
amount: "",
|
||||
categoryId: undefined,
|
||||
@@ -180,9 +181,10 @@ export function MassAddDialog({
|
||||
}, [categoryOptions, transactionType]);
|
||||
|
||||
const addTransaction = () => {
|
||||
const lastTransaction = transactions[transactions.length - 1];
|
||||
setTransactions([
|
||||
...transactions,
|
||||
createEmptyTransactionRow(defaultPayerId),
|
||||
createEmptyTransactionRow(defaultPayerId, lastTransaction?.purchaseDate),
|
||||
]);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user