@fayz-ai/plugin-financial 0.31.1 → 0.32.0

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.
@@ -1244,19 +1244,24 @@ function rebalanceInstallments(input) {
1244
1244
  });
1245
1245
  return next.map((c) => c / 100);
1246
1246
  }
1247
- function InvoiceAttachmentsModal({ invoiceId, onClose, onChanged }) {
1247
+ function InvoiceAttachmentsModal({ invoiceId, installmentNumber, onClose, onChanged }) {
1248
1248
  const provider = useFinancialProvider();
1249
+ const one = installmentNumber != null;
1249
1250
  return /* @__PURE__ */ jsx(
1250
1251
  AttachmentsModal,
1251
1252
  {
1252
1253
  labels: {
1253
- title: "Anexos da conta",
1254
- emptyTitle: "Nenhum anexo ainda",
1255
- emptyHint: "Guarde aqui o boleto, a nota ou o comprovante de pagamento \u2014 fica tudo junto da conta.",
1254
+ title: one ? `Comprovantes da parcela ${installmentNumber}` : "Anexos da conta",
1255
+ emptyTitle: one ? "Nenhum comprovante desta parcela" : "Nenhum anexo ainda",
1256
+ emptyHint: one ? "Guarde aqui o comprovante de pagamento desta parcela." : "Guarde aqui o boleto, a nota ou o comprovante de pagamento \u2014 fica tudo junto da conta.",
1256
1257
  pendingMessage: "O registro deste anexo atravessou, o arquivo ainda n\xE3o. Ele continua no V1 \u2014 procure pelo nome do arquivo."
1257
1258
  },
1258
- load: () => provider.getInvoiceAttachments?.(invoiceId) ?? Promise.resolve([]),
1259
- upload: provider.addInvoiceAttachment ? (file) => provider.addInvoiceAttachment(invoiceId, file) : void 0,
1259
+ load: async () => {
1260
+ const all = await provider.getInvoiceAttachments?.(invoiceId) ?? [];
1261
+ return one ? all.filter((a) => a.installmentNumber === installmentNumber) : all;
1262
+ },
1263
+ upload: provider.addInvoiceAttachment ? (file) => provider.addInvoiceAttachment(invoiceId, file, one ? { installmentNumber } : void 0) : void 0,
1264
+ remove: provider.removeInvoiceAttachment ? (a) => provider.removeInvoiceAttachment(a.id) : void 0,
1260
1265
  onClose,
1261
1266
  onChanged
1262
1267
  }
@@ -3016,10 +3021,11 @@ function InvoiceFormView({ direction, editId, onSaved, focusReceipt = false, fro
3016
3021
  const canManageFinancial = can("financial", "manage");
3017
3022
  const isEdit = !!editId;
3018
3023
  const [attachmentsOpen, setAttachmentsOpen] = useState(false);
3019
- const [attachmentCount, setAttachmentCount] = useState(0);
3024
+ const [attachments, setAttachments] = useState([]);
3025
+ const attachmentCount = attachments.length;
3020
3026
  const loadAttachmentCount = React12__default.useCallback(() => {
3021
3027
  if (!editId || !provider.getInvoiceAttachments) return;
3022
- provider.getInvoiceAttachments(editId).then((list) => setAttachmentCount(list.length)).catch(() => {
3028
+ provider.getInvoiceAttachments(editId).then(setAttachments).catch(() => {
3023
3029
  });
3024
3030
  }, [editId, provider]);
3025
3031
  useEffect(() => {
@@ -3679,174 +3685,186 @@ function InvoiceFormView({ direction, editId, onSaved, focusReceipt = false, fro
3679
3685
  const canEditItems = !hasPayments && !hasCancelledInstallments && (!isEdit || !!provider.replaceInvoiceItems);
3680
3686
  const scheduleSection = (
3681
3687
  // Tour anchor: the guided setup points here for the installment schedule.
3682
- /* @__PURE__ */ jsx("div", { ...tourAnchor("financial.installments"), children: /* @__PURE__ */ jsx(OrderFormBlock, { title: t("financial.invoice.paymentSchedule"), children: /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
3683
- hasPayments ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("financial.invoiceForm.scheduleLocked") }) : hasCancelledInstallments ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("financial.invoiceForm.scheduleHasCancelled") }) : !canReschedule ? null : (
3684
- // Atalhos de parcelamento — 1x, 2x, 3x, 6x, 12x cobrem quase tudo.
3685
- /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5", children: [1, 2, 3, 6, 12].map((n) => /* @__PURE__ */ jsxs(
3686
- Button,
3687
- {
3688
- variant: "bare",
3689
- size: "bare",
3690
- type: "button",
3691
- onClick: () => generateInstallments(n),
3692
- disabled: totalAmount <= 0,
3693
- className: `rounded-full px-2.5 py-1 text-[10px] font-medium transition-colors disabled:opacity-30 ${installments.length === n ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground hover:bg-muted/80"}`,
3694
- children: [
3695
- n,
3696
- "x"
3697
- ]
3698
- },
3699
- n
3700
- )) })
3701
- ),
3702
- installments.length > 0 && /* @__PURE__ */ jsx("p", { className: "text-[11px] text-muted-foreground", children: t("financial.invoiceForm.scheduleSourceHint") }),
3703
- installments.length === 0 ? /* @__PURE__ */ jsx("p", { className: "py-4 text-center text-xs text-muted-foreground", children: totalAmount <= 0 ? t("financial.invoiceForm.addItemsFirst") : t("financial.invoiceForm.selectInstallments") }) : /* @__PURE__ */ jsx("div", { className: "divide-y rounded border", children: installments.map((inst, i) => {
3704
- const patch = (next) => {
3705
- const updated = [...installments];
3706
- updated[i] = { ...inst, ...next };
3707
- setInstallments(updated);
3708
- };
3709
- const saved = savedMovements[i];
3710
- const isPaid = saved?.status === "paid";
3711
- const isPartial = saved?.status === "partial";
3712
- const lockedAmounts = installments.map((_, n) => {
3713
- const st = savedMovements[n]?.status;
3714
- return st === "paid" || st === "partial" || st === "cancelled";
3715
- });
3716
- const changeAmount = (value) => {
3717
- const next = rebalanceInstallments({
3718
- amounts: installments.map((x) => x.amount),
3719
- index: i,
3720
- value,
3721
- total: scheduleTotal,
3722
- locked: lockedAmounts,
3723
- pinned: installments.map((x) => pinnedAmounts.has(x._id))
3724
- });
3725
- if (next) {
3726
- setPinnedAmounts((prev) => new Set(prev).add(inst._id));
3727
- setInstallments(installments.map((x, n) => ({ ...x, amount: next[n] })));
3728
- return;
3729
- }
3730
- const rest = Math.round((inst.amount - value) * 100) / 100;
3731
- if (installments.length !== 1 || value <= 0 || rest <= 0) return;
3732
- const due = /* @__PURE__ */ new Date(`${inst.dueDate}T12:00:00`);
3733
- due.setMonth(due.getMonth() + 1);
3734
- setPinnedAmounts((prev) => new Set(prev).add(inst._id));
3735
- setInstallments([
3736
- { ...inst, amount: value },
3737
- { _id: fid(), amount: rest, dueDate: due.toISOString().slice(0, 10) }
3738
- ]);
3739
- };
3740
- const canChangeAmount = canReschedule && !lockedAmounts[i] && (installments.length === 1 || installments.some((_, n) => n !== i && !lockedAmounts[n]));
3741
- const canAttach = isEdit ? !!saved && !isPaid : true;
3742
- const semFonte = Math.abs(inst.amount) < 5e-3 && !isPaid && !isPartial;
3743
- const fonteTravada = isPaid || isPartial;
3744
- const formaEscolhida = paymentMethodTypes.find((tp) => tp.id === inst.payMethodTypeId);
3745
- const contaEscolhida = bankAccounts.find((a) => a.id === inst.payAccountId);
3746
- return /* @__PURE__ */ jsxs("div", { children: [
3747
- /* @__PURE__ */ jsx(
3748
- InstallmentRow,
3749
- {
3750
- number: i + 1,
3751
- amount: money(inst.amount),
3752
- amountValue: inst.amount,
3753
- onAmountChange: canChangeAmount ? changeAmount : void 0,
3754
- status: saved?.status,
3755
- dueDate: inst.dueDate,
3756
- onDueDateChange: !hasPayments ? (v) => patch({ dueDate: v }) : void 0,
3757
- source: semFonte ? (
3758
- // A zero-value line (gift, 100% discount) has no method to ask for.
3759
- /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "\u2014" })
3760
- ) : fonteTravada ? /* @__PURE__ */ jsx("span", { className: "truncate text-xs text-muted-foreground", children: [formaEscolhida?.name, contaEscolhida?.name].filter(Boolean).join(" \xB7 ") }) : /* @__PURE__ */ jsx(
3761
- InstallmentSourceFields,
3688
+ /* @__PURE__ */ jsx("div", { ...tourAnchor("financial.installments"), children: /* @__PURE__ */ jsx(
3689
+ OrderFormBlock,
3690
+ {
3691
+ title: t("financial.invoice.paymentSchedule"),
3692
+ actions: isEdit && editId ? /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", type: "button", onClick: () => setAttachmentsOpen(true), children: [
3693
+ /* @__PURE__ */ jsx(Paperclip, { className: "h-3.5 w-3.5" }),
3694
+ " ",
3695
+ t("financial.invoiceForm.attachments"),
3696
+ attachmentCount > 0 ? ` (${attachmentCount})` : ""
3697
+ ] }) : void 0,
3698
+ children: /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
3699
+ hasPayments ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("financial.invoiceForm.scheduleLocked") }) : hasCancelledInstallments ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("financial.invoiceForm.scheduleHasCancelled") }) : !canReschedule ? null : (
3700
+ // Atalhos de parcelamento — 1x, 2x, 3x, 6x, 12x cobrem quase tudo.
3701
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5", children: [1, 2, 3, 6, 12].map((n) => /* @__PURE__ */ jsxs(
3702
+ Button,
3703
+ {
3704
+ variant: "bare",
3705
+ size: "bare",
3706
+ type: "button",
3707
+ onClick: () => generateInstallments(n),
3708
+ disabled: totalAmount <= 0,
3709
+ className: `rounded-full px-2.5 py-1 text-[10px] font-medium transition-colors disabled:opacity-30 ${installments.length === n ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground hover:bg-muted/80"}`,
3710
+ children: [
3711
+ n,
3712
+ "x"
3713
+ ]
3714
+ },
3715
+ n
3716
+ )) })
3717
+ ),
3718
+ installments.length > 0 && /* @__PURE__ */ jsx("p", { className: "text-[11px] text-muted-foreground", children: t("financial.invoiceForm.scheduleSourceHint") }),
3719
+ installments.length === 0 ? /* @__PURE__ */ jsx("p", { className: "py-4 text-center text-xs text-muted-foreground", children: totalAmount <= 0 ? t("financial.invoiceForm.addItemsFirst") : t("financial.invoiceForm.selectInstallments") }) : /* @__PURE__ */ jsx("div", { className: "divide-y rounded border", children: installments.map((inst, i) => {
3720
+ const patch = (next) => {
3721
+ const updated = [...installments];
3722
+ updated[i] = { ...inst, ...next };
3723
+ setInstallments(updated);
3724
+ };
3725
+ const saved = savedMovements[i];
3726
+ const isPaid = saved?.status === "paid";
3727
+ const isPartial = saved?.status === "partial";
3728
+ const lockedAmounts = installments.map((_, n) => {
3729
+ const st = savedMovements[n]?.status;
3730
+ return st === "paid" || st === "partial" || st === "cancelled";
3731
+ });
3732
+ const changeAmount = (value) => {
3733
+ const next = rebalanceInstallments({
3734
+ amounts: installments.map((x) => x.amount),
3735
+ index: i,
3736
+ value,
3737
+ total: scheduleTotal,
3738
+ locked: lockedAmounts,
3739
+ pinned: installments.map((x) => pinnedAmounts.has(x._id))
3740
+ });
3741
+ if (next) {
3742
+ setPinnedAmounts((prev) => new Set(prev).add(inst._id));
3743
+ setInstallments(installments.map((x, n) => ({ ...x, amount: next[n] })));
3744
+ return;
3745
+ }
3746
+ const rest = Math.round((inst.amount - value) * 100) / 100;
3747
+ if (installments.length !== 1 || value <= 0 || rest <= 0) return;
3748
+ const due = /* @__PURE__ */ new Date(`${inst.dueDate}T12:00:00`);
3749
+ due.setMonth(due.getMonth() + 1);
3750
+ setPinnedAmounts((prev) => new Set(prev).add(inst._id));
3751
+ setInstallments([
3752
+ { ...inst, amount: value },
3753
+ { _id: fid(), amount: rest, dueDate: due.toISOString().slice(0, 10) }
3754
+ ]);
3755
+ };
3756
+ const canChangeAmount = canReschedule && !lockedAmounts[i] && (installments.length === 1 || installments.some((_, n) => n !== i && !lockedAmounts[n]));
3757
+ const canAttach = isEdit ? !!saved && !isPaid : true;
3758
+ const semFonte = Math.abs(inst.amount) < 5e-3 && !isPaid && !isPartial;
3759
+ const fonteTravada = isPaid || isPartial;
3760
+ const formaEscolhida = paymentMethodTypes.find((tp) => tp.id === inst.payMethodTypeId);
3761
+ const contaEscolhida = bankAccounts.find((a) => a.id === inst.payAccountId);
3762
+ return /* @__PURE__ */ jsxs("div", { children: [
3763
+ /* @__PURE__ */ jsx(
3764
+ InstallmentRow,
3762
3765
  {
3763
- direction,
3764
- value: { payMethodTypeId: inst.payMethodTypeId, payAccountId: inst.payAccountId },
3765
- onChange: (next) => patch(next)
3766
+ number: i + 1,
3767
+ amount: money(inst.amount),
3768
+ amountValue: inst.amount,
3769
+ onAmountChange: canChangeAmount ? changeAmount : void 0,
3770
+ status: saved?.status,
3771
+ dueDate: inst.dueDate,
3772
+ onDueDateChange: !hasPayments ? (v) => patch({ dueDate: v }) : void 0,
3773
+ source: semFonte ? (
3774
+ // A zero-value line (gift, 100% discount) has no method to ask for.
3775
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "\u2014" })
3776
+ ) : fonteTravada ? /* @__PURE__ */ jsx("span", { className: "truncate text-xs text-muted-foreground", children: [formaEscolhida?.name, contaEscolhida?.name].filter(Boolean).join(" \xB7 ") }) : /* @__PURE__ */ jsx(
3777
+ InstallmentSourceFields,
3778
+ {
3779
+ direction,
3780
+ value: { payMethodTypeId: inst.payMethodTypeId, payAccountId: inst.payAccountId },
3781
+ onChange: (next) => patch(next)
3782
+ }
3783
+ ),
3784
+ actions: /* @__PURE__ */ jsxs(Fragment, { children: [
3785
+ (canAttach || isEdit) && /* @__PURE__ */ jsx(
3786
+ InstallmentReceiptButton,
3787
+ {
3788
+ attached: !!inst.receiptUrl || isEdit && attachments.some((a) => a.installmentNumber === i + 1),
3789
+ count: isEdit ? attachments.filter((a) => a.installmentNumber === i + 1).length : void 0,
3790
+ pending: !inst.receiptUrl && !!pendingReceipt,
3791
+ title: !inst.receiptUrl && pendingReceipt ? t("financial.receipt.attachRead") : t("financial.quickTx.receiptCapture"),
3792
+ onClick: () => {
3793
+ if (isEdit && editId) {
3794
+ setAttachmentsOpen(i + 1);
3795
+ return;
3796
+ }
3797
+ if (!inst.receiptUrl && pendingReceipt) {
3798
+ patch({ receiptUrl: pendingReceipt });
3799
+ setPendingReceipt(void 0);
3800
+ return;
3801
+ }
3802
+ setReceiptTarget(i);
3803
+ receiptPicker.open();
3804
+ }
3805
+ }
3806
+ ),
3807
+ !isPaid && (saved || !isEdit && !!contactId && items.length > 0 && inst.amount > 0) && /* @__PURE__ */ jsx(
3808
+ InstallmentPayButton,
3809
+ {
3810
+ disabled: saving,
3811
+ onClick: () => {
3812
+ void pagarParcela(i);
3813
+ },
3814
+ children: t(direction === "credit" ? "financial.invoice.receive" : "financial.invoice.pay")
3815
+ }
3816
+ )
3817
+ ] })
3766
3818
  }
3767
3819
  ),
3768
- actions: /* @__PURE__ */ jsxs(Fragment, { children: [
3769
- (canAttach || isEdit) && /* @__PURE__ */ jsx(
3770
- InstallmentReceiptButton,
3820
+ !isEdit && inst.receiptUrl && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2 border-t bg-muted/20 px-3 py-2", children: [
3821
+ /* @__PURE__ */ jsx(
3822
+ "img",
3771
3823
  {
3772
- attached: !!inst.receiptUrl || isEdit && attachmentCount > 0,
3773
- count: isEdit ? attachmentCount : void 0,
3774
- pending: !inst.receiptUrl && !!pendingReceipt,
3775
- title: !inst.receiptUrl && pendingReceipt ? t("financial.receipt.attachRead") : t("financial.quickTx.receiptCapture"),
3776
- onClick: () => {
3777
- if (isEdit && editId) {
3778
- setAttachmentsOpen(true);
3779
- return;
3780
- }
3781
- if (!inst.receiptUrl && pendingReceipt) {
3782
- patch({ receiptUrl: pendingReceipt });
3783
- setPendingReceipt(void 0);
3784
- return;
3785
- }
3786
- setReceiptTarget(i);
3787
- receiptPicker.open();
3788
- }
3824
+ src: inst.receiptUrl,
3825
+ alt: t("financial.quickTx.receipt"),
3826
+ className: "h-8 w-8 shrink-0 rounded border object-cover"
3789
3827
  }
3790
3828
  ),
3791
- !isPaid && (saved || !isEdit && !!contactId && items.length > 0 && inst.amount > 0) && /* @__PURE__ */ jsx(
3792
- InstallmentPayButton,
3829
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-[10px] font-medium text-success", children: t("financial.invoiceForm.willBePaid") }),
3830
+ /* @__PURE__ */ jsx(
3831
+ Button,
3793
3832
  {
3794
- disabled: saving,
3795
- onClick: () => {
3796
- void pagarParcela(i);
3797
- },
3798
- children: t(direction === "credit" ? "financial.invoice.receive" : "financial.invoice.pay")
3833
+ variant: "bare",
3834
+ size: "bare",
3835
+ type: "button",
3836
+ onClick: () => patch({ receiptUrl: void 0, payMethodTypeId: void 0, payAccountId: void 0 }),
3837
+ "aria-label": t("financial.quickTx.receiptRemove"),
3838
+ className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
3839
+ children: /* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" })
3799
3840
  }
3800
3841
  )
3801
3842
  ] })
3802
- }
3803
- ),
3804
- !isEdit && inst.receiptUrl && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2 border-t bg-muted/20 px-3 py-2", children: [
3805
- /* @__PURE__ */ jsx(
3806
- "img",
3807
- {
3808
- src: inst.receiptUrl,
3809
- alt: t("financial.quickTx.receipt"),
3810
- className: "h-8 w-8 shrink-0 rounded border object-cover"
3811
- }
3812
- ),
3813
- /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-[10px] font-medium text-success", children: t("financial.invoiceForm.willBePaid") }),
3843
+ ] }, inst._id);
3844
+ }) }),
3845
+ pendingDocs.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: pendingDocs.map((file, idx) => /* @__PURE__ */ jsxs("span", { className: "inline-flex max-w-full items-center gap-1.5 rounded-md border bg-muted/30 px-2 py-1 text-xs", children: [
3846
+ /* @__PURE__ */ jsx(FileText, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
3847
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: file.name }),
3848
+ /* @__PURE__ */ jsxs("span", { className: "shrink-0 text-muted-foreground", children: [
3849
+ "\xB7 ",
3850
+ t("financial.invoiceForm.attachOnSave")
3851
+ ] }),
3814
3852
  /* @__PURE__ */ jsx(
3815
3853
  Button,
3816
3854
  {
3817
3855
  variant: "bare",
3818
3856
  size: "bare",
3819
3857
  type: "button",
3820
- onClick: () => patch({ receiptUrl: void 0, payMethodTypeId: void 0, payAccountId: void 0 }),
3858
+ onClick: () => setPendingDocs((prev) => prev.filter((_, j) => j !== idx)),
3821
3859
  "aria-label": t("financial.quickTx.receiptRemove"),
3822
- className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
3823
- children: /* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" })
3860
+ className: "font-normal flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground",
3861
+ children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
3824
3862
  }
3825
3863
  )
3826
- ] })
3827
- ] }, inst._id);
3828
- }) }),
3829
- pendingDocs.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: pendingDocs.map((file, idx) => /* @__PURE__ */ jsxs("span", { className: "inline-flex max-w-full items-center gap-1.5 rounded-md border bg-muted/30 px-2 py-1 text-xs", children: [
3830
- /* @__PURE__ */ jsx(FileText, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
3831
- /* @__PURE__ */ jsx("span", { className: "truncate", children: file.name }),
3832
- /* @__PURE__ */ jsxs("span", { className: "shrink-0 text-muted-foreground", children: [
3833
- "\xB7 ",
3834
- t("financial.invoiceForm.attachOnSave")
3835
- ] }),
3836
- /* @__PURE__ */ jsx(
3837
- Button,
3838
- {
3839
- variant: "bare",
3840
- size: "bare",
3841
- type: "button",
3842
- onClick: () => setPendingDocs((prev) => prev.filter((_, j) => j !== idx)),
3843
- "aria-label": t("financial.quickTx.receiptRemove"),
3844
- className: "font-normal flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground",
3845
- children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
3846
- }
3847
- )
3848
- ] }, `${file.name}-${idx}`)) })
3849
- ] }) }) })
3864
+ ] }, `${file.name}-${idx}`)) })
3865
+ ] })
3866
+ }
3867
+ ) })
3850
3868
  );
3851
3869
  const contactSection = /* @__PURE__ */ jsx("div", { ...tourAnchor("financial.contact"), children: /* @__PURE__ */ jsxs(OrderFormBlock, { title: direction === "debit" ? t("financial.invoiceForm.payTo") : t("financial.invoiceForm.receiveFrom"), children: [
3852
3870
  /* @__PURE__ */ jsx(
@@ -4206,7 +4224,15 @@ function InvoiceFormView({ direction, editId, onSaved, focusReceipt = false, fro
4206
4224
  }
4207
4225
  ),
4208
4226
  receiptPicker.input,
4209
- attachmentsOpen && editId && /* @__PURE__ */ jsx(InvoiceAttachmentsModal, { invoiceId: editId, onClose: () => setAttachmentsOpen(false), onChanged: loadAttachmentCount }),
4227
+ attachmentsOpen && editId && /* @__PURE__ */ jsx(
4228
+ InvoiceAttachmentsModal,
4229
+ {
4230
+ invoiceId: editId,
4231
+ installmentNumber: typeof attachmentsOpen === "number" ? attachmentsOpen : void 0,
4232
+ onClose: () => setAttachmentsOpen(false),
4233
+ onChanged: loadAttachmentCount
4234
+ }
4235
+ ),
4210
4236
  payingMovement && /* @__PURE__ */ jsx(CurrencyScope, { code: documentCurrency, children: /* @__PURE__ */ jsx(
4211
4237
  PaymentModal,
4212
4238
  {
@@ -4265,5 +4291,5 @@ function InvoiceFormView({ direction, editId, onSaved, focusReceipt = false, fro
4265
4291
  }
4266
4292
 
4267
4293
  export { ACCOUNTS_ROUTE, AccountIcon, BankLogo, BankPicker, CancelInvoicesDialog, FinancialCounterpartySearchSelect, InvoiceAttachmentsModal, InvoiceDetailView, InvoiceFormView, PaymentModal, UnitField, createFinancialCounterpartyLookup, findBrBank, marcarItemParaAbrir, renderAccountAvatar, renderCardChip, useStockedItemTypes, useWritableUnits };
4268
- //# sourceMappingURL=chunk-D4WRL7ST.js.map
4269
- //# sourceMappingURL=chunk-D4WRL7ST.js.map
4294
+ //# sourceMappingURL=chunk-GQFACLFS.js.map
4295
+ //# sourceMappingURL=chunk-GQFACLFS.js.map