@fayz-ai/plugin-financial 0.26.2 → 0.26.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,14 +2,14 @@ import { InvoiceFormView, InvoiceDetailView, marcarItemParaAbrir, AccountIcon, c
2
2
  import { startReceiptCapture, RECEIVABLE_RECEIPT_INSTRUCTIONS, RECEIPT_INSTRUCTIONS, createReceiptTools } from './chunk-7VKJLBYY.js';
3
3
  import { FINANCIAL_MODULE_DEFAULTS, FinancialGeneralSettings } from './chunk-POYZFEAN.js';
4
4
  import { CashRegistersView } from './chunk-MGDAJLUQ.js';
5
- import { FinancialContextProvider, useFinancialConfig, useFinancialStore, useFinancialProvider, formatCurrency } from './chunk-CNXAVGSW.js';
5
+ import { formatCurrency, FinancialContextProvider, useFinancialConfig, useFinancialStore, useFinancialProvider } from './chunk-CNXAVGSW.js';
6
6
  import * as React14 from 'react';
7
- import React14__default, { useMemo, useCallback, useState, useEffect, useRef } from 'react';
7
+ import React14__default, { memo, useState, useMemo, useCallback, useEffect, useRef } from 'react';
8
8
  import { useTranslation, navigateApp, appHref, useUnitMode, useDataChanged, describeError, resolveCurrency, exportCSV, formatCurrency as formatCurrency$1 } from '@fayz-ai/core';
9
- import { PageTransition, ModulePage, Button, DashboardCanvas, ComingSoon, SubpageHeader, PageTabs, StatTiles, Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, ListView, Input, DatePicker, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, DataTable, DateRangeControl, usePageSize, PageHeaderActions, FilterPanel, FilterPanelField, SearchSelect, SegmentedControl, Card, Pagination, Hint, RequiredFilter, FilterMenuRow, toast, printDocument, ChoiceList, Skeleton, Modal, ModalContent, ModalHeader, ModalTitle, ModalDescription, ModalBody, ModalFooter, Badge, AiActionButton, CurrencyInput, ModalFlow, useSaveBar, Switch, Textarea, RowActions, WizardSteps } from '@fayz-ai/ui';
10
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
+ import { Badge, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Input, PageTransition, ModulePage, Button, DashboardCanvas, ComingSoon, SubpageHeader, PageTabs, StatTiles, Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, ListView, DatePicker, DataTable, DateRangeControl, usePageSize, PageHeaderActions, FilterPanel, FilterPanelField, SearchSelect, SegmentedControl, Card, Pagination, Hint, RequiredFilter, FilterMenuRow, toast, printDocument, ChoiceList, Skeleton, Modal, ModalContent, ModalHeader, ModalTitle, ModalDescription, ModalBody, ModalFooter, AiActionButton, CurrencyInput, ModalFlow, useSaveBar, Switch, Textarea, RowActions, WizardSteps } from '@fayz-ai/ui';
10
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
11
11
  import { useTenantPluginSettings, useModuleNavigation, usePluginOnboardingGate, usePermissionOptional, useModuleNavAccess, PluginOnboardingGateSkeleton, PluginSettingsPanel, ModuleActionBar, EntitlementGate, UpgradePrompt, parseViewId, GetStarted, PermissionGate, PageActions, useUnitFilter, adminNavigateTo, PersonLink, createOneShotAsk, useLookupCreate, createArchetypeLookup, OrderFormSkeleton, OrderFormView, OrderFormBlock, OrderFormItemsCard, OrderFormItemRow, OrderFormAddItemStep, useAgentSurface, shrinkForVision, toInlineFile } from '@fayz-ai/admin';
12
- import { DollarSign, Landmark, CreditCard, BookOpen, Check, ChevronRight, Wallet, Receipt, CalendarClock, Plus, Loader2, BadgeCheck, Gift, Pencil, Target, Settings, Play, ArrowRight, Users, RefreshCw, CloudDownload, ListChecks, Search, ChevronDown, ArrowRightLeft, Building2, Download, Paperclip, CircleDashed, CircleEllipsis, CircleCheckBig, CircleAlert, Ban, Printer, FileText, Camera, Sparkles, Link2, FileSearch, Undo2, Eye, TriangleAlert, Trash2, CheckCheck, X, Pause, ShoppingCart, Car, Home, Utensils, Zap, Film, HeartPulse, Dumbbell, Music, ShoppingBag, CircleDollarSign, ArrowLeft, FileDown, AlertTriangle } from 'lucide-react';
12
+ import { ChevronDown, ChevronRight, DollarSign, Landmark, CreditCard, BookOpen, Check, Wallet, Receipt, CalendarClock, Plus, Loader2, BadgeCheck, Gift, Pencil, Target, Settings, Play, ArrowRight, Users, RefreshCw, CloudDownload, ListChecks, Search, ArrowRightLeft, Building2, Download, Paperclip, CircleDashed, CircleEllipsis, CircleCheckBig, CircleAlert, Ban, Printer, FileText, Camera, Sparkles, Link2, FileSearch, Undo2, Eye, TriangleAlert, Trash2, CheckCheck, X, Pause, ShoppingCart, Car, Home, Utensils, Zap, Film, HeartPulse, Dumbbell, Music, ShoppingBag, CircleDollarSign, ArrowLeft, FileDown, AlertTriangle } from 'lucide-react';
13
13
  import { T } from '@fayz-ai/financial/data/tables';
14
14
  import { postableAccounts, accountLabel } from '@fayz-ai/financial/domain/chart-of-accounts';
15
15
  import { cnabPayeeGaps, inferPixKeyType, generateCnab240, splitAccountDigit, suggestPaymentForm } from '@fayz-ai/financial/domain/cnab240';
@@ -2003,9 +2003,9 @@ function StatementsView({ onNavigate }) {
2003
2003
  cell: ({ row }) => {
2004
2004
  const e = row.original;
2005
2005
  const isTransfer = e.entryKind !== "movement";
2006
- const memo = e.movement.notes;
2007
- const title = e.invoice?.contactName || (isTransfer ? t("financial.statements.transfer") : memo || t("financial.statements.untitledEntry"));
2008
- const memoLine = memo && memo !== title ? memo : void 0;
2006
+ const memo2 = e.movement.notes;
2007
+ const title = e.invoice?.contactName || (isTransfer ? t("financial.statements.transfer") : memo2 || t("financial.statements.untitledEntry"));
2008
+ const memoLine = memo2 && memo2 !== title ? memo2 : void 0;
2009
2009
  const doc = e.invoice?.fiscalNumber;
2010
2010
  const inst = e.movement.installmentNumber;
2011
2011
  const canOpen = !!onNavigate && !!e.movement.invoiceId;
@@ -4642,11 +4642,18 @@ function BatchClassifyModal({ provider, bankAccountId, dateRange, onClose, onDon
4642
4642
  };
4643
4643
  }, [provider, bankAccountId, dateRange.from, dateRange.to]);
4644
4644
  const leaves = useMemo(() => postableAccounts(chart), [chart]);
4645
- const accountsFor = (direction) => {
4646
- const first = direction === "credit" ? "revenue" : "expense";
4647
- return [...leaves.filter((a) => a.accountType === first), ...leaves.filter((a) => a.accountType !== first)];
4648
- };
4649
- const set = (key, patch) => setDecisions((d) => ({ ...d, [key]: { ...d[key], ...patch } }));
4645
+ const options = useMemo(() => {
4646
+ const of = (first) => [...leaves.filter((a) => a.accountType === first), ...leaves.filter((a) => a.accountType !== first)].map((a) => ({ value: a.id, label: accountLabel(a) }));
4647
+ return { credit: of("revenue"), debit: of("expense") };
4648
+ }, [leaves]);
4649
+ const accountOptions = useMemo(() => accounts.map((a) => ({ value: a.id, label: a.name })), [accounts]);
4650
+ const set = useCallback((key, patch) => setDecisions((d) => ({ ...d, [key]: { ...d[key], ...patch } })), []);
4651
+ const toggle = useCallback((key) => setOpen((s) => {
4652
+ const n = new Set(s);
4653
+ if (n.has(key)) n.delete(key);
4654
+ else n.add(key);
4655
+ return n;
4656
+ }), []);
4650
4657
  const ready = (g, d) => d.action === "bill" ? Boolean(d.accountId) : d.action === "transfer" ? Boolean(d.counterAccountId) : false;
4651
4658
  const chosen = (groups ?? []).filter((g) => decisions[g.key] && ready(g, decisions[g.key]));
4652
4659
  const linesToApply = chosen.reduce((n, g) => n + g.lines.filter((l) => !decisions[g.key].excluded.has(l.id)).length, 0);
@@ -4684,128 +4691,58 @@ function BatchClassifyModal({ provider, bankAccountId, dateRange, onClose, onDon
4684
4691
  else toast.success(`${state.total} linhas classificadas e conciliadas`);
4685
4692
  onDone();
4686
4693
  }
4687
- const money3 = (v) => formatCurrency(v);
4688
4694
  return /* @__PURE__ */ jsx(Modal, { open: true, onOpenChange: (o) => {
4689
4695
  if (!o && !running) onClose();
4690
- }, children: /* @__PURE__ */ jsxs(ModalContent, { size: "xl", className: "max-h-[92vh] overflow-y-auto", children: [
4696
+ }, children: /* @__PURE__ */ jsxs(ModalContent, { size: "xl", className: "sm:max-h-[92vh]", children: [
4691
4697
  /* @__PURE__ */ jsxs(ModalHeader, { children: [
4692
4698
  /* @__PURE__ */ jsx(ModalTitle, { children: "Classificar em lote" }),
4693
4699
  /* @__PURE__ */ jsx(ModalDescription, { children: "As linhas pendentes, agrupadas por quem pagou ou recebeu (ou pelo texto do extrato). Uma escolha por grupo vale para todas as linhas dele: cada uma vira a conta escolhida, j\xE1 quitada e conciliada, como no \xABLan\xE7ar como conta\xBB de linha em linha." })
4694
4700
  ] }),
4695
- groups === null && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
4696
- /* @__PURE__ */ jsx(Skeleton, { className: "h-14 w-full" }),
4697
- /* @__PURE__ */ jsx(Skeleton, { className: "h-14 w-full" }),
4698
- /* @__PURE__ */ jsx(Skeleton, { className: "h-14 w-full" })
4699
- ] }),
4700
- groups?.length === 0 && /* @__PURE__ */ jsx("p", { className: "py-6 text-center text-sm text-muted-foreground", children: "Nenhuma linha pendente neste recorte." }),
4701
- groups && groups.length > 0 && !running && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
4702
- /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
4703
- "Falta uma conta no plano (por exemplo \xABVendas B2B\xBB, \xABAporte de s\xF3cio\xBB, \xABResgate de aplica\xE7\xE3o\xBB)?",
4704
- " ",
4705
- /* @__PURE__ */ jsx("button", { type: "button", className: "underline", onClick: () => adminNavigateTo("/settings/financial/chart-of-accounts"), children: "Abrir o plano de contas" })
4701
+ /* @__PURE__ */ jsxs(ModalBody, { children: [
4702
+ groups === null && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
4703
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-14 w-full" }),
4704
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-14 w-full" }),
4705
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-14 w-full" })
4706
4706
  ] }),
4707
- groups.map((g) => {
4708
- const d = decisions[g.key];
4709
- if (!d) return null;
4710
- const expanded = open.has(g.key);
4711
- const count = g.lines.length - d.excluded.size;
4712
- return /* @__PURE__ */ jsxs("div", { className: "rounded-md border p-3", "data-testid": "batch-group", children: [
4713
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
4714
- /* @__PURE__ */ jsx(
4715
- "button",
4716
- {
4717
- type: "button",
4718
- className: "text-muted-foreground",
4719
- "aria-label": expanded ? "Recolher" : "Ver linhas",
4720
- onClick: () => setOpen((s) => {
4721
- const n = new Set(s);
4722
- if (n.has(g.key)) n.delete(g.key);
4723
- else n.add(g.key);
4724
- return n;
4725
- }),
4726
- children: expanded ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
4727
- }
4728
- ),
4729
- /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate font-medium", children: g.label }),
4730
- /* @__PURE__ */ jsx(Badge, { variant: "outline", className: g.direction === "credit" ? "text-emerald-700" : "text-destructive", children: g.direction === "credit" ? "Entrada" : "Sa\xEDda" }),
4731
- /* @__PURE__ */ jsxs("span", { className: "text-sm text-muted-foreground", children: [
4732
- count,
4733
- " ",
4734
- count === 1 ? "linha" : "linhas"
4735
- ] }),
4736
- /* @__PURE__ */ jsx("span", { className: "w-28 text-right text-sm font-semibold", children: money3(g.total) })
4737
- ] }),
4738
- g.document && /* @__PURE__ */ jsxs("p", { className: "ml-6 text-xs text-muted-foreground", children: [
4739
- "Documento ",
4740
- g.document
4741
- ] }),
4742
- /* @__PURE__ */ jsxs("div", { className: "ml-6 mt-2 grid gap-2 sm:grid-cols-[180px_1fr_1fr]", children: [
4743
- /* @__PURE__ */ jsxs(Select, { value: d.action, onValueChange: (v) => set(g.key, { action: v }), children: [
4744
- /* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, {}) }),
4745
- /* @__PURE__ */ jsxs(SelectContent, { children: [
4746
- /* @__PURE__ */ jsx(SelectItem, { value: "skip", children: "Deixar para depois" }),
4747
- /* @__PURE__ */ jsx(SelectItem, { value: "bill", children: g.direction === "credit" ? "Lan\xE7ar como conta a receber" : "Lan\xE7ar como conta a pagar" }),
4748
- /* @__PURE__ */ jsx(SelectItem, { value: "transfer", children: "Transfer\xEAncia entre contas" })
4749
- ] })
4750
- ] }),
4751
- d.action === "bill" && /* @__PURE__ */ jsxs(Fragment, { children: [
4752
- /* @__PURE__ */ jsxs(Select, { value: d.accountId || void 0, onValueChange: (v) => set(g.key, { accountId: v }), children: [
4753
- /* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Conta do plano" }) }),
4754
- /* @__PURE__ */ jsx(SelectContent, { children: accountsFor(g.direction).map((a) => /* @__PURE__ */ jsx(SelectItem, { value: a.id, children: accountLabel(a) }, a.id)) })
4755
- ] }),
4756
- /* @__PURE__ */ jsx(
4757
- Input,
4758
- {
4759
- placeholder: g.direction === "credit" ? "Cliente ou de quem veio (opcional)" : "Fornecedor (opcional)",
4760
- value: d.contactName,
4761
- onChange: (e) => set(g.key, { contactName: e.target.value })
4762
- }
4763
- )
4764
- ] }),
4765
- d.action === "transfer" && /* @__PURE__ */ jsxs(Select, { value: d.counterAccountId || void 0, onValueChange: (v) => set(g.key, { counterAccountId: v }), children: [
4766
- /* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: accounts.length ? "A outra conta" : "Nenhuma outra conta cadastrada" }) }),
4767
- /* @__PURE__ */ jsx(SelectContent, { children: accounts.map((a) => /* @__PURE__ */ jsx(SelectItem, { value: a.id, children: a.name }, a.id)) })
4768
- ] })
4769
- ] }),
4770
- expanded && /* @__PURE__ */ jsx("ul", { className: "ml-6 mt-2 max-h-56 space-y-1 overflow-y-auto text-xs", children: g.lines.map((l) => /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-2", children: [
4771
- /* @__PURE__ */ jsx(
4772
- "input",
4773
- {
4774
- type: "checkbox",
4775
- checked: !d.excluded.has(l.id),
4776
- "aria-label": "Incluir esta linha",
4777
- onChange: (e) => {
4778
- const n = new Set(d.excluded);
4779
- if (e.target.checked) n.delete(l.id);
4780
- else n.add(l.id);
4781
- set(g.key, { excluded: n });
4782
- }
4783
- }
4784
- ),
4785
- /* @__PURE__ */ jsx("span", { className: "w-20 text-muted-foreground", children: (/* @__PURE__ */ new Date(l.date + "T12:00:00")).toLocaleDateString("pt-BR") }),
4786
- /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: l.description }),
4787
- /* @__PURE__ */ jsx("span", { className: "w-24 text-right", children: money3(l.amount) })
4788
- ] }, l.id)) })
4789
- ] }, g.key);
4790
- })
4791
- ] }),
4792
- running && /* @__PURE__ */ jsxs("div", { className: "space-y-3 py-2", children: [
4793
- /* @__PURE__ */ jsxs("p", { className: "text-sm", children: [
4794
- running.done,
4795
- " de ",
4796
- running.total,
4797
- " linhas\u2026"
4707
+ groups?.length === 0 && /* @__PURE__ */ jsx("p", { className: "py-6 text-center text-sm text-muted-foreground", children: "Nenhuma linha pendente neste recorte." }),
4708
+ groups && groups.length > 0 && !running && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
4709
+ /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
4710
+ "Falta uma conta no plano (por exemplo \xABVendas B2B\xBB, \xABAporte de s\xF3cio\xBB, \xABResgate de aplica\xE7\xE3o\xBB)?",
4711
+ " ",
4712
+ /* @__PURE__ */ jsx("button", { type: "button", className: "underline", onClick: () => adminNavigateTo("/settings/financial/chart-of-accounts"), children: "Abrir o plano de contas" })
4713
+ ] }),
4714
+ groups.map((g) => decisions[g.key] && /* @__PURE__ */ jsx(
4715
+ GroupRow,
4716
+ {
4717
+ g,
4718
+ d: decisions[g.key],
4719
+ expanded: open.has(g.key),
4720
+ options: options[g.direction],
4721
+ accounts: accountOptions,
4722
+ onSet: set,
4723
+ onToggle: toggle
4724
+ },
4725
+ g.key
4726
+ ))
4798
4727
  ] }),
4799
- /* @__PURE__ */ jsx("div", { className: "h-2 w-full overflow-hidden rounded bg-muted", children: /* @__PURE__ */ jsx("div", { className: "h-full bg-primary transition-all", style: { width: `${running.total ? running.done / running.total * 100 : 0}%` } }) }),
4800
- running.failed.length > 0 && /* @__PURE__ */ jsx("ul", { className: "max-h-48 space-y-1 overflow-y-auto text-xs text-destructive", children: running.failed.map((f) => /* @__PURE__ */ jsxs("li", { children: [
4801
- f.line.date,
4802
- " \xB7 ",
4803
- f.line.description,
4804
- " \xB7 ",
4805
- money3(f.line.amount),
4806
- ": ",
4807
- f.error
4808
- ] }, f.line.id)) })
4728
+ running && /* @__PURE__ */ jsxs("div", { className: "space-y-3 py-2", children: [
4729
+ /* @__PURE__ */ jsxs("p", { className: "text-sm", children: [
4730
+ running.done,
4731
+ " de ",
4732
+ running.total,
4733
+ " linhas\u2026"
4734
+ ] }),
4735
+ /* @__PURE__ */ jsx("div", { className: "h-2 w-full overflow-hidden rounded bg-muted", children: /* @__PURE__ */ jsx("div", { className: "h-full bg-primary transition-all", style: { width: `${running.total ? running.done / running.total * 100 : 0}%` } }) }),
4736
+ running.failed.length > 0 && /* @__PURE__ */ jsx("ul", { className: "max-h-48 space-y-1 overflow-y-auto text-xs text-destructive", children: running.failed.map((f) => /* @__PURE__ */ jsxs("li", { children: [
4737
+ f.line.date,
4738
+ " \xB7 ",
4739
+ f.line.description,
4740
+ " \xB7 ",
4741
+ formatCurrency(f.line.amount),
4742
+ ": ",
4743
+ f.error
4744
+ ] }, f.line.id)) })
4745
+ ] })
4809
4746
  ] }),
4810
4747
  /* @__PURE__ */ jsx(ModalFooter, { children: running && running.done === running.total ? /* @__PURE__ */ jsx(Button, { onClick: onClose, children: "Fechar" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
4811
4748
  /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: onClose, disabled: Boolean(running), children: "Cancelar" }),
@@ -4813,6 +4750,86 @@ function BatchClassifyModal({ provider, bankAccountId, dateRange, onClose, onDon
4813
4750
  ] }) })
4814
4751
  ] }) });
4815
4752
  }
4753
+ function LazySelect({ value, onChange, placeholder, options }) {
4754
+ const [opened, setOpened] = useState(false);
4755
+ const shown = opened ? options : options.filter((o) => o.value === value);
4756
+ return /* @__PURE__ */ jsxs(Select, { value: value || void 0, onValueChange: onChange, onOpenChange: setOpened, children: [
4757
+ /* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder }) }),
4758
+ /* @__PURE__ */ jsx(SelectContent, { children: shown.map((o) => /* @__PURE__ */ jsx(SelectItem, { value: o.value, children: o.label }, o.value)) })
4759
+ ] });
4760
+ }
4761
+ var GroupRow = memo(function GroupRow2({ g, d, expanded, options, accounts, onSet, onToggle }) {
4762
+ const count = g.lines.length - d.excluded.size;
4763
+ return (
4764
+ // content-visibility: rows scrolled out of view skip layout and paint.
4765
+ /* @__PURE__ */ jsxs("div", { className: "rounded-md border p-3", style: { contentVisibility: "auto", containIntrinsicSize: "auto 7rem" }, "data-testid": "batch-group", children: [
4766
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
4767
+ /* @__PURE__ */ jsx("button", { type: "button", className: "text-muted-foreground", "aria-label": expanded ? "Recolher" : "Ver linhas", onClick: () => onToggle(g.key), children: expanded ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" }) }),
4768
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate font-medium", children: g.label }),
4769
+ /* @__PURE__ */ jsx(Badge, { variant: "outline", className: g.direction === "credit" ? "text-emerald-700" : "text-destructive", children: g.direction === "credit" ? "Entrada" : "Sa\xEDda" }),
4770
+ /* @__PURE__ */ jsxs("span", { className: "text-sm text-muted-foreground", children: [
4771
+ count,
4772
+ " ",
4773
+ count === 1 ? "linha" : "linhas"
4774
+ ] }),
4775
+ /* @__PURE__ */ jsx("span", { className: "w-28 text-right text-sm font-semibold", children: formatCurrency(g.total) })
4776
+ ] }),
4777
+ g.document && /* @__PURE__ */ jsxs("p", { className: "ml-6 text-xs text-muted-foreground", children: [
4778
+ "Documento ",
4779
+ g.document
4780
+ ] }),
4781
+ /* @__PURE__ */ jsxs("div", { className: "ml-6 mt-2 grid gap-2 sm:grid-cols-[180px_1fr_1fr]", children: [
4782
+ /* @__PURE__ */ jsxs(Select, { value: d.action, onValueChange: (v) => onSet(g.key, { action: v }), children: [
4783
+ /* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, {}) }),
4784
+ /* @__PURE__ */ jsxs(SelectContent, { children: [
4785
+ /* @__PURE__ */ jsx(SelectItem, { value: "skip", children: "Deixar para depois" }),
4786
+ /* @__PURE__ */ jsx(SelectItem, { value: "bill", children: g.direction === "credit" ? "Lan\xE7ar como conta a receber" : "Lan\xE7ar como conta a pagar" }),
4787
+ /* @__PURE__ */ jsx(SelectItem, { value: "transfer", children: "Transfer\xEAncia entre contas" })
4788
+ ] })
4789
+ ] }),
4790
+ d.action === "bill" && /* @__PURE__ */ jsxs(Fragment, { children: [
4791
+ /* @__PURE__ */ jsx(LazySelect, { value: d.accountId, onChange: (v) => onSet(g.key, { accountId: v }), placeholder: "Conta do plano", options }),
4792
+ /* @__PURE__ */ jsx(
4793
+ Input,
4794
+ {
4795
+ placeholder: g.direction === "credit" ? "Cliente ou de quem veio (opcional)" : "Fornecedor (opcional)",
4796
+ value: d.contactName,
4797
+ onChange: (e) => onSet(g.key, { contactName: e.target.value })
4798
+ }
4799
+ )
4800
+ ] }),
4801
+ d.action === "transfer" && /* @__PURE__ */ jsx(
4802
+ LazySelect,
4803
+ {
4804
+ value: d.counterAccountId,
4805
+ onChange: (v) => onSet(g.key, { counterAccountId: v }),
4806
+ placeholder: accounts.length ? "A outra conta" : "Nenhuma outra conta cadastrada",
4807
+ options: accounts
4808
+ }
4809
+ )
4810
+ ] }),
4811
+ expanded && /* @__PURE__ */ jsx("ul", { className: "ml-6 mt-2 max-h-56 space-y-1 overflow-y-auto text-xs", children: g.lines.map((l) => /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-2", children: [
4812
+ /* @__PURE__ */ jsx(
4813
+ "input",
4814
+ {
4815
+ type: "checkbox",
4816
+ checked: !d.excluded.has(l.id),
4817
+ "aria-label": "Incluir esta linha",
4818
+ onChange: (e) => {
4819
+ const n = new Set(d.excluded);
4820
+ if (e.target.checked) n.delete(l.id);
4821
+ else n.add(l.id);
4822
+ onSet(g.key, { excluded: n });
4823
+ }
4824
+ }
4825
+ ),
4826
+ /* @__PURE__ */ jsx("span", { className: "w-20 text-muted-foreground", children: (/* @__PURE__ */ new Date(l.date + "T12:00:00")).toLocaleDateString("pt-BR") }),
4827
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: l.description }),
4828
+ /* @__PURE__ */ jsx("span", { className: "w-24 text-right", children: formatCurrency(l.amount) })
4829
+ ] }, l.id)) })
4830
+ ] })
4831
+ );
4832
+ });
4816
4833
  var PAGE_SIZE = 50;
4817
4834
  var shortDate3 = (value) => {
4818
4835
  const [year, month, day] = value.split("-");
@@ -6483,5 +6500,5 @@ function FinancialPage({ config: appConfig, provider, store, registries }) {
6483
6500
  }
6484
6501
 
6485
6502
  export { FinancialPage };
6486
- //# sourceMappingURL=FinancialPage-EXFS4ADV.js.map
6487
- //# sourceMappingURL=FinancialPage-EXFS4ADV.js.map
6503
+ //# sourceMappingURL=FinancialPage-7SQNQEY2.js.map
6504
+ //# sourceMappingURL=FinancialPage-7SQNQEY2.js.map