mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-05-09 19:01:47 +00:00
refactor: alinha features financeiras ao novo naming
This commit is contained in:
@@ -70,7 +70,7 @@ const buildInitialValues = ({
|
||||
limit: formatLimitInput(card?.limit ?? null),
|
||||
note: card?.note ?? "",
|
||||
logo: selectedLogo,
|
||||
contaId: card?.contaId ?? accounts[0]?.id ?? "",
|
||||
accountId: card?.accountId ?? accounts[0]?.id ?? "",
|
||||
};
|
||||
};
|
||||
|
||||
@@ -146,7 +146,7 @@ export function CardDialog({
|
||||
return;
|
||||
}
|
||||
|
||||
if (!formState.contaId) {
|
||||
if (!formState.accountId) {
|
||||
const message = "Selecione a conta vinculada.";
|
||||
setErrorMessage(message);
|
||||
toast.error(message);
|
||||
@@ -163,7 +163,7 @@ export function CardDialog({
|
||||
limit: rawLimit ? Number(rawLimit) : null,
|
||||
note: formState.note.trim() || null,
|
||||
logo: formState.logo,
|
||||
contaId: formState.contaId,
|
||||
accountId: formState.accountId,
|
||||
};
|
||||
|
||||
if (!payload.logo) {
|
||||
|
||||
@@ -160,10 +160,10 @@ export function CardFormFields({
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-2 sm:col-span-2">
|
||||
<Label htmlFor="card-account">Conta vinculada</Label>
|
||||
<Label htmlFor="card-account">FinancialAccount vinculada</Label>
|
||||
<Select
|
||||
value={values.contaId}
|
||||
onValueChange={(value) => onChange("contaId", value)}
|
||||
value={values.accountId}
|
||||
onValueChange={(value) => onChange("accountId", value)}
|
||||
disabled={accountOptions.length === 0}
|
||||
>
|
||||
<SelectTrigger id="card-account" className="w-full">
|
||||
@@ -174,10 +174,10 @@ export function CardFormFields({
|
||||
: "Selecione a conta"
|
||||
}
|
||||
>
|
||||
{values.contaId &&
|
||||
{values.accountId &&
|
||||
(() => {
|
||||
const selectedAccount = accountOptions.find(
|
||||
(acc) => acc.id === values.contaId,
|
||||
(acc) => acc.id === values.accountId,
|
||||
);
|
||||
return selectedAccount ? (
|
||||
<AccountSelectContent
|
||||
|
||||
@@ -33,7 +33,7 @@ interface CardItemProps {
|
||||
limit: number | null;
|
||||
limitInUse?: number | null;
|
||||
limitAvailable?: number | null;
|
||||
contaName: string;
|
||||
accountName: string;
|
||||
logo?: string | null;
|
||||
note?: string | null;
|
||||
onEdit?: () => void;
|
||||
@@ -52,14 +52,14 @@ export function CardItem({
|
||||
limit,
|
||||
limitInUse,
|
||||
limitAvailable,
|
||||
contaName: _contaName,
|
||||
accountName: _accountName,
|
||||
logo,
|
||||
note,
|
||||
onEdit,
|
||||
onInvoice,
|
||||
onRemove,
|
||||
}: CardItemProps) {
|
||||
void _contaName;
|
||||
void _accountName;
|
||||
|
||||
const limitTotal = limit ?? null;
|
||||
const used =
|
||||
|
||||
@@ -142,7 +142,7 @@ export function CardsPage({
|
||||
limit={card.limit}
|
||||
limitInUse={card.limitInUse ?? null}
|
||||
limitAvailable={card.limitAvailable ?? card.limit ?? null}
|
||||
contaName={card.contaName}
|
||||
accountName={card.accountName}
|
||||
logo={card.logo}
|
||||
note={card.note}
|
||||
onEdit={() => handleEdit(card)}
|
||||
|
||||
@@ -8,10 +8,10 @@ export type Card = {
|
||||
note: string | null;
|
||||
logo: string | null;
|
||||
limit: number | null;
|
||||
contaId: string;
|
||||
contaName: string;
|
||||
limitInUse?: number | null;
|
||||
limitAvailable?: number | null;
|
||||
accountId: string;
|
||||
accountName: string;
|
||||
limitInUse: number;
|
||||
limitAvailable: number | null;
|
||||
};
|
||||
|
||||
export type CardFormValues = {
|
||||
@@ -23,5 +23,5 @@ export type CardFormValues = {
|
||||
limit: string;
|
||||
note: string;
|
||||
logo: string;
|
||||
contaId: string;
|
||||
accountId: string;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user