forked from git.gladyson/openmonetis
refactor(inbox): remove process dialog e integra fluxo ao lancamento-dialog
- Remove process-dialog.tsx (componente não mais utilizado) - Simplifica inbox-page.tsx removendo estados e lógica do process dialog - Atualiza inbox-details-dialog para usar lancamento-dialog diretamente - Adiciona suporte a dados iniciais do inbox no lancamento-dialog - Move campos de metadata da inbox para o form de lançamento - Remove campo currency não utilizado do schema - Atualiza actions e data com melhor tratamento de erros
This commit is contained in:
@@ -20,10 +20,16 @@ export interface LancamentoDialogProps {
|
||||
defaultCartaoId?: string | null;
|
||||
defaultPaymentMethod?: string | null;
|
||||
defaultPurchaseDate?: string | null;
|
||||
defaultName?: string | null;
|
||||
defaultAmount?: string | null;
|
||||
lockCartaoSelection?: boolean;
|
||||
lockPaymentMethod?: boolean;
|
||||
isImporting?: boolean;
|
||||
defaultTransactionType?: "Despesa" | "Receita";
|
||||
/** Force showing transaction type select even when defaultTransactionType is set */
|
||||
forceShowTransactionType?: boolean;
|
||||
/** Called after successful create/update. Receives the action result. */
|
||||
onSuccess?: () => void;
|
||||
onBulkEditRequest?: (data: {
|
||||
id: string;
|
||||
name: string;
|
||||
|
||||
@@ -60,10 +60,14 @@ export function LancamentoDialog({
|
||||
defaultCartaoId,
|
||||
defaultPaymentMethod,
|
||||
defaultPurchaseDate,
|
||||
defaultName,
|
||||
defaultAmount,
|
||||
lockCartaoSelection,
|
||||
lockPaymentMethod,
|
||||
isImporting = false,
|
||||
defaultTransactionType,
|
||||
forceShowTransactionType = false,
|
||||
onSuccess,
|
||||
onBulkEditRequest,
|
||||
}: LancamentoDialogProps) {
|
||||
const [dialogOpen, setDialogOpen] = useControlledState(
|
||||
@@ -77,6 +81,8 @@ export function LancamentoDialog({
|
||||
defaultCartaoId,
|
||||
defaultPaymentMethod,
|
||||
defaultPurchaseDate,
|
||||
defaultName,
|
||||
defaultAmount,
|
||||
defaultTransactionType,
|
||||
isImporting,
|
||||
}),
|
||||
@@ -96,6 +102,8 @@ export function LancamentoDialog({
|
||||
defaultCartaoId,
|
||||
defaultPaymentMethod,
|
||||
defaultPurchaseDate,
|
||||
defaultName,
|
||||
defaultAmount,
|
||||
defaultTransactionType,
|
||||
isImporting,
|
||||
},
|
||||
@@ -112,6 +120,8 @@ export function LancamentoDialog({
|
||||
defaultCartaoId,
|
||||
defaultPaymentMethod,
|
||||
defaultPurchaseDate,
|
||||
defaultName,
|
||||
defaultAmount,
|
||||
defaultTransactionType,
|
||||
isImporting,
|
||||
]);
|
||||
@@ -247,6 +257,7 @@ export function LancamentoDialog({
|
||||
|
||||
if (result.success) {
|
||||
toast.success(result.message);
|
||||
onSuccess?.();
|
||||
setDialogOpen(false);
|
||||
return;
|
||||
}
|
||||
@@ -290,6 +301,7 @@ export function LancamentoDialog({
|
||||
|
||||
if (result.success) {
|
||||
toast.success(result.message);
|
||||
onSuccess?.();
|
||||
setDialogOpen(false);
|
||||
return;
|
||||
}
|
||||
@@ -304,6 +316,7 @@ export function LancamentoDialog({
|
||||
lancamento?.id,
|
||||
lancamento?.seriesId,
|
||||
setDialogOpen,
|
||||
onSuccess,
|
||||
onBulkEditRequest,
|
||||
],
|
||||
);
|
||||
@@ -371,7 +384,7 @@ export function LancamentoDialog({
|
||||
categoriaOptions={categoriaOptions}
|
||||
categoriaGroups={categoriaGroups}
|
||||
isUpdateMode={isUpdateMode}
|
||||
hideTransactionType={Boolean(isNewWithType)}
|
||||
hideTransactionType={Boolean(isNewWithType) && !forceShowTransactionType}
|
||||
/>
|
||||
|
||||
{!isUpdateMode ? (
|
||||
|
||||
Reference in New Issue
Block a user