@fayz-ai/plugin-financial 0.31.2 → 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.
- package/dist/{FinancialPage-QPMREIN4.js → FinancialPage-CQP6KORC.js} +3 -3
- package/dist/{FinancialPage-QPMREIN4.js.map → FinancialPage-CQP6KORC.js.map} +1 -1
- package/dist/{chunk-ILHSYF6L.js → chunk-GQFACLFS.js} +32 -13
- package/dist/chunk-GQFACLFS.js.map +1 -0
- package/dist/components/InvoiceAttachmentsModal.d.ts +6 -1
- package/dist/components/InvoiceAttachmentsModal.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/views/InvoiceFormView.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-ILHSYF6L.js.map +0 -1
|
@@ -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: () =>
|
|
1259
|
-
|
|
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 [
|
|
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(
|
|
3028
|
+
provider.getInvoiceAttachments(editId).then(setAttachments).catch(() => {
|
|
3023
3029
|
});
|
|
3024
3030
|
}, [editId, provider]);
|
|
3025
3031
|
useEffect(() => {
|
|
@@ -3776,13 +3782,18 @@ function InvoiceFormView({ direction, editId, onSaved, focusReceipt = false, fro
|
|
|
3776
3782
|
}
|
|
3777
3783
|
),
|
|
3778
3784
|
actions: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3779
|
-
canAttach
|
|
3785
|
+
(canAttach || isEdit) && /* @__PURE__ */ jsx(
|
|
3780
3786
|
InstallmentReceiptButton,
|
|
3781
3787
|
{
|
|
3782
|
-
attached: !!inst.receiptUrl,
|
|
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,
|
|
3783
3790
|
pending: !inst.receiptUrl && !!pendingReceipt,
|
|
3784
3791
|
title: !inst.receiptUrl && pendingReceipt ? t("financial.receipt.attachRead") : t("financial.quickTx.receiptCapture"),
|
|
3785
3792
|
onClick: () => {
|
|
3793
|
+
if (isEdit && editId) {
|
|
3794
|
+
setAttachmentsOpen(i + 1);
|
|
3795
|
+
return;
|
|
3796
|
+
}
|
|
3786
3797
|
if (!inst.receiptUrl && pendingReceipt) {
|
|
3787
3798
|
patch({ receiptUrl: pendingReceipt });
|
|
3788
3799
|
setPendingReceipt(void 0);
|
|
@@ -4213,7 +4224,15 @@ function InvoiceFormView({ direction, editId, onSaved, focusReceipt = false, fro
|
|
|
4213
4224
|
}
|
|
4214
4225
|
),
|
|
4215
4226
|
receiptPicker.input,
|
|
4216
|
-
attachmentsOpen && editId && /* @__PURE__ */ jsx(
|
|
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
|
+
),
|
|
4217
4236
|
payingMovement && /* @__PURE__ */ jsx(CurrencyScope, { code: documentCurrency, children: /* @__PURE__ */ jsx(
|
|
4218
4237
|
PaymentModal,
|
|
4219
4238
|
{
|
|
@@ -4272,5 +4291,5 @@ function InvoiceFormView({ direction, editId, onSaved, focusReceipt = false, fro
|
|
|
4272
4291
|
}
|
|
4273
4292
|
|
|
4274
4293
|
export { ACCOUNTS_ROUTE, AccountIcon, BankLogo, BankPicker, CancelInvoicesDialog, FinancialCounterpartySearchSelect, InvoiceAttachmentsModal, InvoiceDetailView, InvoiceFormView, PaymentModal, UnitField, createFinancialCounterpartyLookup, findBrBank, marcarItemParaAbrir, renderAccountAvatar, renderCardChip, useStockedItemTypes, useWritableUnits };
|
|
4275
|
-
//# sourceMappingURL=chunk-
|
|
4276
|
-
//# sourceMappingURL=chunk-
|
|
4294
|
+
//# sourceMappingURL=chunk-GQFACLFS.js.map
|
|
4295
|
+
//# sourceMappingURL=chunk-GQFACLFS.js.map
|