@fayz-ai/plugin-financial 0.29.2 → 0.29.4

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.
@@ -1,4 +1,5 @@
1
- import { InvoiceFormView, InvoiceDetailView, marcarItemParaAbrir, AccountIcon, createFinancialCounterpartyLookup, InvoiceAttachmentsModal, CancelInvoicesDialog, FinancialCounterpartySearchSelect, useWritableUnits, useStockedItemTypes, UnitField, BankLogo, findBrBank, BankPicker } from './chunk-IQHWMVUM.js';
1
+ import { InvoiceFormView, InvoiceDetailView, marcarItemParaAbrir, AccountIcon, createFinancialCounterpartyLookup, InvoiceAttachmentsModal, CancelInvoicesDialog, FinancialCounterpartySearchSelect, useWritableUnits, useStockedItemTypes, UnitField, BankLogo, findBrBank, BankPicker } from './chunk-W7T7RTC4.js';
2
+ import { chartTreeProps, chartAccountWithDescendants, chartRowsFor } from './chunk-XGBGRXZ3.js';
2
3
  import { startReceiptCapture, RECEIVABLE_RECEIPT_INSTRUCTIONS, RECEIPT_INSTRUCTIONS, createReceiptTools } from './chunk-7VKJLBYY.js';
3
4
  import { FINANCIAL_MODULE_DEFAULTS, FinancialGeneralSettings } from './chunk-POYZFEAN.js';
4
5
  import { CashRegistersView } from './chunk-MGDAJLUQ.js';
@@ -6,17 +7,17 @@ import { formatCurrency, FinancialContextProvider, useFinancialConfig, useFinanc
6
7
  import * as React15 from 'react';
7
8
  import React15__default, { memo, useState, useMemo, useCallback, useEffect, useRef } from 'react';
8
9
  import { useTranslation, navigateApp, appHref, useUnitMode, useDataChanged, describeError, resolveCurrency, exportCSV, formatCurrency as formatCurrency$1 } from '@fayz-ai/core';
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, useFilterDraft, usePageSize, PageHeaderActions, FilterPanel, FilterPanelField, SearchSelect, SegmentedControl, Card, Pagination, Hint, RequiredFilter, FilterMenuRow, toast, printDocument, ChoiceList, Skeleton, Modal, ModalContent, ModalHeader, ModalTitle, ModalDescription, ModalBody, ModalFooter, RefreshButton, AiActionButton, CurrencyInput, ModalFlow, useSaveBar, Switch, Textarea, RowActions, WizardSteps } from '@fayz-ai/ui';
10
+ import { Badge, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, TreeSelect, Input, PageTransition, ModulePage, Button, DashboardCanvas, ComingSoon, SubpageHeader, PageTabs, StatTiles, Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, ListView, DatePicker, DataTable, DateRangeControl, useFilterDraft, usePageSize, PageHeaderActions, FilterPanel, FilterPanelField, SearchSelect, SegmentedControl, Card, Pagination, Hint, RequiredFilter, FilterMenuRow, toast, printDocument, ChoiceList, Skeleton, Modal, ModalContent, ModalHeader, ModalTitle, ModalDescription, ModalBody, ModalFooter, RefreshButton, AiActionButton, CurrencyInput, ModalFlow, useSaveBar, Switch, Textarea, RowActions, WizardSteps } from '@fayz-ai/ui';
10
11
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
11
12
  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 { ChevronDown, ChevronRight, DollarSign, Landmark, CreditCard, BookOpen, Check, Wallet, Receipt, CalendarClock, Plus, Loader2, BadgeCheck, Gift, Pencil, Target, Settings, Play, ArrowRight, Users, RefreshCw, ListChecks, Search, ArrowRightLeft, Building2, Download, Paperclip, CircleDashed, CircleEllipsis, CircleCheckBig, CircleAlert, Ban, Printer, FileText, Camera, AlertCircle, 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
+ import { ChevronDown, ChevronRight, DollarSign, Landmark, CreditCard, BookOpen, Check, Wallet, Receipt, CalendarClock, Plus, Loader2, BadgeCheck, Gift, Pencil, Target, Settings, Play, ArrowRight, Users, RefreshCw, ListChecks, Search, ArrowRightLeft, Building2, Download, Paperclip, CircleDashed, CircleEllipsis, CircleCheckBig, CircleAlert, Ban, Printer, FileText, ListTree, Camera, AlertCircle, 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
14
  import { T } from '@fayz-ai/financial/data/tables';
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';
16
16
  import { invoiceOpensForEditing, availableInvoiceItemTypes } from '@fayz-ai/financial/domain/invoice';
17
17
  import { createPortal } from 'react-dom';
18
18
  import { newestStatementEntriesFirst } from '@fayz-ai/financial/domain/statement';
19
- import { resolveCandidates, adjustmentDirection, sumItems, itemsMismatch, adjustmentGap, adjustmentsMismatch, reconciliationPaymentNote } from '@fayz-ai/financial/domain/reconciliation';
19
+ import { resolveCandidates, sumItems, itemsMismatch, adjustmentGap, adjustmentsMismatch, adjustmentDirection, reconciliationPaymentNote } from '@fayz-ai/financial/domain/reconciliation';
20
+ import { postableAccounts } from '@fayz-ai/financial/domain/chart-of-accounts';
20
21
  import { round2 as round2$1 } from '@fayz-ai/financial/domain/money';
21
22
  import { counterpartyAccountingPolicy, resolveCounterpartyAccountingPolicy } from '@fayz-ai/financial/domain/counterparty';
22
23
 
@@ -1102,7 +1103,6 @@ function InvoiceListView({ direction, onNew, onNewReceipt, onEdit }) {
1102
1103
  const unitFilter = useUnitFilter();
1103
1104
  const effectiveUnitId = unitMode ? unitFilter.value : unitId || void 0;
1104
1105
  const [accounts, setAccounts] = useState([]);
1105
- const postable = useMemo(() => postableAccounts(accounts), [accounts]);
1106
1106
  const [costCenters, setCostCenters] = useState([]);
1107
1107
  const mesCorrente = useMemo(() => {
1108
1108
  const hoje = /* @__PURE__ */ new Date();
@@ -1179,7 +1179,7 @@ function InvoiceListView({ direction, onNew, onNewReceipt, onEdit }) {
1179
1179
  let active = true;
1180
1180
  Promise.all([provider.getChartOfAccounts(), provider.getCostCenters()]).then(([accountRows, costCenterRows]) => {
1181
1181
  if (!active) return;
1182
- setAccounts(accountRows.filter((account) => account.nodeType === "leaf"));
1182
+ setAccounts(accountRows);
1183
1183
  setCostCenters(costCenterRows);
1184
1184
  }).catch(() => {
1185
1185
  if (!active) return;
@@ -1199,6 +1199,10 @@ function InvoiceListView({ direction, onNew, onNewReceipt, onEdit }) {
1199
1199
  const [paging, setPaging] = useState({ key: sliceKey, page: 1 });
1200
1200
  const page = paging.key === sliceKey ? paging.page : 1;
1201
1201
  const setPage = (next) => setPaging({ key: sliceKey, page: next });
1202
+ const accountIdsKey = useMemo(
1203
+ () => emVigor.accountId ? chartAccountWithDescendants(accounts, emVigor.accountId).join(",") : "",
1204
+ [accounts, emVigor.accountId]
1205
+ );
1202
1206
  const query = useMemo(() => ({
1203
1207
  direction,
1204
1208
  page,
@@ -1209,7 +1213,7 @@ function InvoiceListView({ direction, onNew, onNewReceipt, onEdit }) {
1209
1213
  contactId: emVigor.contactId || void 0,
1210
1214
  fiscalNumber: emVigor.fiscalNumber.trim() || void 0,
1211
1215
  bankAccountId: emVigor.bankAccountId || void 0,
1212
- accountId: emVigor.accountId || void 0,
1216
+ accountIds: accountIdsKey ? accountIdsKey.split(",") : void 0,
1213
1217
  costCenterId: emVigor.costCenterId || void 0,
1214
1218
  unitId: effectiveUnitId,
1215
1219
  dateRange: { from: emVigor.from, to: emVigor.to },
@@ -1219,7 +1223,7 @@ function InvoiceListView({ direction, onNew, onNewReceipt, onEdit }) {
1219
1223
  // A window entirely in the past or future is a deliberate look at that
1220
1224
  // period, and stays exactly that period.
1221
1225
  includeOverdue: emVigor.overdue && windowReachesToday(emVigor.from, emVigor.to) || void 0
1222
- }), [direction, emVigor, search, effectiveUnitId, page, pageSize]);
1226
+ }), [direction, emVigor, accountIdsKey, search, effectiveUnitId, page, pageSize]);
1223
1227
  useEffect(() => {
1224
1228
  fetchInvoices(query);
1225
1229
  }, [query]);
@@ -1498,19 +1502,19 @@ function InvoiceListView({ direction, onNew, onNewReceipt, onEdit }) {
1498
1502
  ] })
1499
1503
  ] });
1500
1504
  const filtrosAvancados = /* @__PURE__ */ jsxs(Fragment, { children: [
1501
- postable.length > 0 && /* @__PURE__ */ jsx(FilterPanelField, { label: t("financial.invoice.filterAccount"), compact: true, children: /* @__PURE__ */ jsx(
1502
- SearchSelect,
1505
+ accounts.length > 0 && /* @__PURE__ */ jsx(FilterPanelField, { label: t("financial.invoice.filterAccount"), compact: true, children: /* @__PURE__ */ jsx(
1506
+ TreeSelect,
1503
1507
  {
1508
+ label: t("financial.invoice.filterAccount"),
1509
+ ...chartTreeProps,
1510
+ nodes: accounts,
1504
1511
  value: accountId,
1505
- displayValue: postable.find((a) => a.id === accountId) ? accountLabel(postable.find((a) => a.id === accountId)) : "",
1506
- placeholder: t("financial.invoice.filterAllAccounts"),
1507
- clearLabel: t("financial.invoice.filterAllAccounts"),
1508
- noResultsLabel: t("financial.invoice.filterAllAccounts"),
1509
- onChange: (id) => setAccountId(id),
1510
- onSearch: async (termo) => {
1511
- const q = termo.trim().toLocaleLowerCase("pt-BR");
1512
- return postable.filter((a) => !q || accountLabel(a).toLocaleLowerCase("pt-BR").includes(q)).slice(0, 50).map((a) => ({ id: a.id, label: accountLabel(a) }));
1513
- }
1512
+ onChange: setAccountId,
1513
+ allLabel: t("financial.invoice.filterAllAccounts"),
1514
+ searchPlaceholder: t("financial.invoice.filterSearchAccount"),
1515
+ noResultsLabel: t("financial.invoice.filterNoAccountFound"),
1516
+ icon: ListTree,
1517
+ className: "h-9 w-full justify-start"
1514
1518
  }
1515
1519
  ) }),
1516
1520
  costCenters.length > 0 && /* @__PURE__ */ jsx(FilterPanelField, { label: t("financial.invoice.filterCostCenter"), compact: true, children: /* @__PURE__ */ jsx(
@@ -3735,11 +3739,12 @@ function ReconcileFlow({ line, initialIntent, initialTarget, initialStep = 0, on
3735
3739
  const [receiptName, setReceiptName] = useState(null);
3736
3740
  const [reading, setReading] = useState(null);
3737
3741
  const [readingBusy, setReadingBusy] = useState(false);
3738
- const [chart, setChart] = useState([]);
3742
+ const [fullChart, setChart] = useState([]);
3743
+ const chart = useMemo(() => fullChart.filter((n) => n.nodeType !== "group"), [fullChart]);
3739
3744
  const [costCenters, setCostCenters] = useState([]);
3740
3745
  const [contas, setContas] = useState([]);
3741
3746
  useEffect(() => {
3742
- void provider.getChartOfAccounts().then((nodes) => setChart(nodes.filter((n) => n.isActive && n.nodeType !== "group"))).catch(() => setChart([]));
3747
+ void provider.getChartOfAccounts().then((nodes) => setChart(nodes.filter((n) => n.isActive))).catch(() => setChart([]));
3743
3748
  void provider.getCostCenters().then(setCostCenters).catch(() => setCostCenters([]));
3744
3749
  void provider.getBankAccounts().then(setContas).catch(() => setContas([]));
3745
3750
  }, [provider, line.bankAccountId]);
@@ -3844,20 +3849,16 @@ function ReconcileFlow({ line, initialIntent, initialTarget, initialStep = 0, on
3844
3849
  const doTipo = folhas.filter((a) => a.accountType === natureza);
3845
3850
  return doTipo.length > 0 ? doTipo : folhas;
3846
3851
  }, [chart, isOut]);
3847
- const buscaNoPlano = useCallback((query) => {
3848
- const q = query.trim().toLocaleLowerCase("pt-BR");
3849
- const rows = q ? planoDoTipo.filter((a) => `${a.code ?? ""} ${a.name}`.toLocaleLowerCase("pt-BR").includes(q)) : planoDoTipo;
3850
- return rows.slice(0, 50).map((a) => ({ id: a.id, label: accountLabel(a) }));
3851
- }, [planoDoTipo]);
3852
+ const planoRows = useMemo(() => chartRowsFor(fullChart, planoDoTipo.map((a) => a.id)), [fullChart, planoDoTipo]);
3852
3853
  const descricaoPadrao = (type) => type === "interest" ? t("financial.reconciliation.adjustmentDefaultInterest") : type === "fine" ? t("financial.reconciliation.adjustmentDefaultFine") : isOut ? t("financial.reconciliation.adjustmentDefaultDiscountOut") : t("financial.reconciliation.adjustmentDefaultDiscountIn");
3853
- const buscaPlanoDoAjuste = useCallback((adj, query) => {
3854
- const natureza = adjustmentDirection(line.direction, adj.type) === "debit" ? "expense" : "revenue";
3854
+ const ajusteRows = useMemo(() => {
3855
3855
  const folhas = postableAccounts(chart);
3856
- const doTipo = folhas.filter((a) => a.accountType === natureza);
3857
- const base = doTipo.length > 0 ? doTipo : folhas;
3858
- const q = query.trim().toLocaleLowerCase("pt-BR");
3859
- return (q ? base.filter((a) => `${a.code ?? ""} ${a.name}`.toLocaleLowerCase("pt-BR").includes(q)) : base).slice(0, 50).map((a) => ({ id: a.id, label: accountLabel(a) }));
3860
- }, [chart, line.direction]);
3856
+ const of = (natureza) => {
3857
+ const doTipo = folhas.filter((a) => a.accountType === natureza);
3858
+ return chartRowsFor(fullChart, (doTipo.length > 0 ? doTipo : folhas).map((a) => a.id));
3859
+ };
3860
+ return { debit: of("expense"), credit: of("revenue") };
3861
+ }, [chart, fullChart]);
3861
3862
  const valorAQuitar = intent === "link" && target && !partial ? target.openAmount : round2(line.amount);
3862
3863
  const quita = intent === "bill" || intent === "link" && target?.mode === "settle";
3863
3864
  const leitor = useMemo(() => {
@@ -4293,17 +4294,18 @@ function ReconcileFlow({ line, initialIntent, initialTarget, initialStep = 0, on
4293
4294
  /* @__PURE__ */ jsxs("div", { className: "fz-fields-2", children: [
4294
4295
  /* @__PURE__ */ jsxs("div", { children: [
4295
4296
  /* @__PURE__ */ jsx(
4296
- SearchSelect,
4297
+ TreeSelect,
4297
4298
  {
4299
+ variant: "field",
4300
+ leafOnly: true,
4298
4301
  label: t("financial.reconciliation.chartAccount"),
4302
+ ...chartTreeProps,
4303
+ nodes: planoRows,
4299
4304
  value: accountId,
4300
- displayValue: planoDoTipo.find((a) => a.id === accountId)?.name,
4301
4305
  placeholder: t("financial.reconciliation.chartAccountPlaceholder"),
4302
- minChars: 0,
4303
- loadOnOpen: true,
4306
+ allLabel: "Limpar",
4307
+ searchPlaceholder: "Buscar conta\u2026",
4304
4308
  noResultsLabel: t("financial.reconciliation.chartAccountNone"),
4305
- clearLabel: "Limpar",
4306
- onSearch: buscaNoPlano,
4307
4309
  onChange: (id) => setAccountId(id)
4308
4310
  }
4309
4311
  ),
@@ -4427,17 +4429,18 @@ function ReconcileFlow({ line, initialIntent, initialTarget, initialStep = 0, on
4427
4429
  }
4428
4430
  ),
4429
4431
  /* @__PURE__ */ jsx(
4430
- SearchSelect,
4432
+ TreeSelect,
4431
4433
  {
4432
- label: `${t("financial.reconciliation.chartAccount")} *`,
4434
+ variant: "field",
4435
+ leafOnly: true,
4436
+ required: true,
4437
+ label: t("financial.reconciliation.chartAccount"),
4438
+ ...chartTreeProps,
4439
+ nodes: ajusteRows[adjustmentDirection(line.direction, adj.type)],
4433
4440
  value: adj.accountId ?? "",
4434
- displayValue: chart.find((a) => a.id === adj.accountId)?.name,
4435
4441
  placeholder: t("financial.reconciliation.chartAccountPlaceholder"),
4436
- minChars: 0,
4437
- loadOnOpen: true,
4442
+ searchPlaceholder: "Buscar conta\u2026",
4438
4443
  noResultsLabel: t("financial.reconciliation.chartAccountNone"),
4439
- clearLabel: "Limpar",
4440
- onSearch: (q) => buscaPlanoDoAjuste(adj, q),
4441
4444
  onChange: (id) => mudar({ accountId: id || void 0 })
4442
4445
  }
4443
4446
  ),
@@ -4689,7 +4692,7 @@ function BatchClassifyModal({ provider, bankAccountId, dateRange, onClose, onDon
4689
4692
  toast.error("N\xE3o foi poss\xEDvel ler o extrato", { description: e instanceof Error ? e.message : String(e) });
4690
4693
  setGroups([]);
4691
4694
  });
4692
- void provider.getChartOfAccounts().then((n) => alive && setChart(n.filter((a) => a.isActive && a.nodeType !== "group"))).catch(() => {
4695
+ void provider.getChartOfAccounts().then((n) => alive && setChart(n.filter((a) => a.isActive))).catch(() => {
4693
4696
  });
4694
4697
  void provider.getBankAccounts().then((a) => alive && setAccounts(a.filter((x) => x.id !== bankAccountId))).catch(() => {
4695
4698
  });
@@ -4697,11 +4700,10 @@ function BatchClassifyModal({ provider, bankAccountId, dateRange, onClose, onDon
4697
4700
  alive = false;
4698
4701
  };
4699
4702
  }, [provider, bankAccountId, dateRange.from, dateRange.to]);
4700
- const leaves = useMemo(() => postableAccounts(chart), [chart]);
4701
4703
  const options = useMemo(() => {
4702
- const of = (first) => [...leaves.filter((a) => a.accountType === first), ...leaves.filter((a) => a.accountType !== first)].map((a) => ({ value: a.id, label: accountLabel(a) }));
4704
+ const of = (first) => (a, b) => Number(b.accountType === first) - Number(a.accountType === first) || chartTreeProps.compare(a, b);
4703
4705
  return { credit: of("revenue"), debit: of("expense") };
4704
- }, [leaves]);
4706
+ }, []);
4705
4707
  const accountOptions = useMemo(() => accounts.map((a) => ({ value: a.id, label: a.name })), [accounts]);
4706
4708
  const set = useCallback((key, patch) => setDecisions((d) => ({ ...d, [key]: { ...d[key], ...patch } })), []);
4707
4709
  const toggle = useCallback((key) => setOpen((s) => {
@@ -4773,7 +4775,8 @@ function BatchClassifyModal({ provider, bankAccountId, dateRange, onClose, onDon
4773
4775
  g,
4774
4776
  d: decisions[g.key],
4775
4777
  expanded: open.has(g.key),
4776
- options: options[g.direction],
4778
+ chart,
4779
+ compare: options[g.direction],
4777
4780
  accounts: accountOptions,
4778
4781
  onSet: set,
4779
4782
  onToggle: toggle
@@ -4814,7 +4817,7 @@ function LazySelect({ value, onChange, placeholder, options }) {
4814
4817
  /* @__PURE__ */ jsx(SelectContent, { children: shown.map((o) => /* @__PURE__ */ jsx(SelectItem, { value: o.value, children: o.label }, o.value)) })
4815
4818
  ] });
4816
4819
  }
4817
- var GroupRow = memo(function GroupRow2({ g, d, expanded, options, accounts, onSet, onToggle }) {
4820
+ var GroupRow = memo(function GroupRow2({ g, d, expanded, chart, compare, accounts, onSet, onToggle }) {
4818
4821
  const count = g.lines.length - d.excluded.size;
4819
4822
  return (
4820
4823
  // content-visibility: rows scrolled out of view skip layout and paint.
@@ -4844,7 +4847,21 @@ var GroupRow = memo(function GroupRow2({ g, d, expanded, options, accounts, onSe
4844
4847
  ] })
4845
4848
  ] }),
4846
4849
  d.action === "bill" && /* @__PURE__ */ jsxs(Fragment, { children: [
4847
- /* @__PURE__ */ jsx(LazySelect, { value: d.accountId, onChange: (v) => onSet(g.key, { accountId: v }), placeholder: "Conta do plano", options }),
4850
+ /* @__PURE__ */ jsx(
4851
+ TreeSelect,
4852
+ {
4853
+ ...chartTreeProps,
4854
+ compare,
4855
+ variant: "field",
4856
+ leafOnly: true,
4857
+ nodes: chart,
4858
+ value: d.accountId,
4859
+ onChange: (v) => onSet(g.key, { accountId: v }),
4860
+ placeholder: "Conta do plano",
4861
+ searchPlaceholder: "Buscar conta\u2026",
4862
+ noResultsLabel: "Nenhuma conta encontrada"
4863
+ }
4864
+ ),
4848
4865
  /* @__PURE__ */ jsx(
4849
4866
  Input,
4850
4867
  {
@@ -5888,7 +5905,7 @@ function RecurringBillFormView({ direction, valueId, onBack }) {
5888
5905
  valueId ? provider.getRecurringBills?.(direction) ?? Promise.resolve([]) : Promise.resolve([])
5889
5906
  ]).then(([nextAccounts, nextCenters, recurring]) => {
5890
5907
  if (cancelled) return;
5891
- setAccounts(postableAccounts(nextAccounts));
5908
+ setAccounts(nextAccounts);
5892
5909
  setCostCenters(nextCenters);
5893
5910
  if (valueId) {
5894
5911
  const nextValue = recurring.find((item) => item.id === valueId) ?? null;
@@ -5944,6 +5961,7 @@ function RecurringBillFormView({ direction, valueId, onBack }) {
5944
5961
  const allowed = new Set(counterpartyAccounting.allowedAccountIds);
5945
5962
  return postable.filter((account) => allowed.has(account.id));
5946
5963
  }, [accounts, counterpartyAccounting]);
5964
+ const accountRows = React15__default.useMemo(() => chartRowsFor(accounts, selectableAccounts.map((a) => a.id)), [accounts, selectableAccounts]);
5947
5965
  const hasItemLookups = itemTypes.some((item) => entityLookups[item.value]);
5948
5966
  const amount = React15__default.useMemo(() => items.reduce(
5949
5967
  (sum, item) => sum + item.quantity * item.unitPrice - (item.discount ?? 0) + (item.surcharge ?? 0),
@@ -6171,14 +6189,18 @@ function RecurringBillFormView({ direction, valueId, onBack }) {
6171
6189
  summary: selectableAccounts.find((account) => account.id === item.accountId)?.name,
6172
6190
  onClear: () => updateItem(item._id, { accountId: void 0 }),
6173
6191
  field: /* @__PURE__ */ jsx(
6174
- SearchSelect,
6192
+ TreeSelect,
6175
6193
  {
6194
+ variant: "field",
6195
+ leafOnly: true,
6176
6196
  label: "Plano de contas",
6177
- value: item.accountId,
6178
- displayValue: selectableAccounts.find((account) => account.id === item.accountId)?.name,
6197
+ ...chartTreeProps,
6198
+ nodes: accountRows,
6199
+ value: item.accountId ?? "",
6179
6200
  placeholder: "Sem classifica\xE7\xE3o",
6180
- minChars: 0,
6181
- onSearch: (query) => selectableAccounts.filter((account) => accountLabel(account).toLowerCase().includes(query.toLowerCase())).map((account) => ({ id: account.id, label: accountLabel(account) })),
6201
+ allLabel: "Sem classifica\xE7\xE3o",
6202
+ searchPlaceholder: "Buscar conta\u2026",
6203
+ noResultsLabel: "Nenhuma conta encontrada",
6182
6204
  onChange: (id) => updateItem(item._id, { accountId: id || void 0 })
6183
6205
  }
6184
6206
  )
@@ -6613,5 +6635,5 @@ function FinancialPage({ config: appConfig, provider, store, registries }) {
6613
6635
  }
6614
6636
 
6615
6637
  export { FinancialPage };
6616
- //# sourceMappingURL=FinancialPage-LCKLEAM3.js.map
6617
- //# sourceMappingURL=FinancialPage-LCKLEAM3.js.map
6638
+ //# sourceMappingURL=FinancialPage-S2EBQVIA.js.map
6639
+ //# sourceMappingURL=FinancialPage-S2EBQVIA.js.map