mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-05-09 19:01:47 +00:00
feat: endurece mutações financeiras e permite zerar conta
This commit is contained in:
@@ -33,10 +33,10 @@ import { AccountFormFields } from "./account-form-fields";
|
||||
import type { Account, AccountFormValues } from "./types";
|
||||
|
||||
const DEFAULT_ACCOUNT_TYPES = [
|
||||
"FinancialAccount Corrente",
|
||||
"FinancialAccount Poupança",
|
||||
"Conta Corrente",
|
||||
"Conta Poupança",
|
||||
"Carteira Digital",
|
||||
"FinancialAccount Investimento",
|
||||
"Conta Investimento",
|
||||
"Pré-Pago | VR/VA",
|
||||
] as const;
|
||||
|
||||
@@ -167,7 +167,7 @@ export function AccountDialog({
|
||||
const accountId = account?.id;
|
||||
|
||||
if (mode === "update" && !accountId) {
|
||||
const message = "FinancialAccount inválida.";
|
||||
const message = "Conta inválida.";
|
||||
setErrorMessage(message);
|
||||
toast.error(message);
|
||||
return;
|
||||
|
||||
@@ -20,7 +20,10 @@ interface AccountFormFieldsProps {
|
||||
values: AccountFormValues;
|
||||
accountTypes: string[];
|
||||
accountStatuses: string[];
|
||||
onChange: (field: keyof AccountFormValues, value: string) => void;
|
||||
onChange: <K extends keyof AccountFormValues>(
|
||||
field: K,
|
||||
value: AccountFormValues[K],
|
||||
) => void;
|
||||
showInitialBalance?: boolean;
|
||||
}
|
||||
|
||||
@@ -112,7 +115,7 @@ export function AccountFormFields({
|
||||
id="exclude-from-balance"
|
||||
checked={Boolean(values.excludeFromBalance)}
|
||||
onCheckedChange={(checked) =>
|
||||
onChange("excludeFromBalance", checked ? "true" : "false")
|
||||
onChange("excludeFromBalance", checked === true)
|
||||
}
|
||||
/>
|
||||
<Label
|
||||
@@ -129,10 +132,7 @@ export function AccountFormFields({
|
||||
id="exclude-initial-balance-from-income"
|
||||
checked={Boolean(values.excludeInitialBalanceFromIncome)}
|
||||
onCheckedChange={(checked) =>
|
||||
onChange(
|
||||
"excludeInitialBalanceFromIncome",
|
||||
checked ? "true" : "false",
|
||||
)
|
||||
onChange("excludeInitialBalanceFromIncome", checked === true)
|
||||
}
|
||||
/>
|
||||
<Label
|
||||
|
||||
@@ -157,7 +157,7 @@ export function TransferDialog({
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-2 sm:col-span-2">
|
||||
<Label htmlFor="from-account">FinancialAccount de origem</Label>
|
||||
<Label htmlFor="from-account">Conta de origem</Label>
|
||||
<Select value={fromAccountId} disabled>
|
||||
<SelectTrigger id="from-account" className="w-full">
|
||||
<SelectValue>
|
||||
@@ -185,7 +185,7 @@ export function TransferDialog({
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-2 sm:col-span-2">
|
||||
<Label htmlFor="to-account">FinancialAccount de destino</Label>
|
||||
<Label htmlFor="to-account">Conta de destino</Label>
|
||||
{availableAccounts.length === 0 ? (
|
||||
<div className="rounded-md border border-border bg-muted p-3 text-sm text-muted-foreground">
|
||||
É necessário ter mais de uma conta cadastrada para realizar
|
||||
|
||||
Reference in New Issue
Block a user