refactor: alinha features financeiras ao novo naming

This commit is contained in:
Felipe Coutinho
2026-03-14 12:50:55 +00:00
parent ef918a3667
commit 67ad4b9d02
51 changed files with 876 additions and 898 deletions

View File

@@ -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) {

View File

@@ -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

View File

@@ -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 =

View File

@@ -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)}

View File

@@ -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;
};