@fayz-ai/plugin-financial 0.31.2 → 0.33.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-2FIMXWCQ.js} +8 -5
- package/dist/FinancialPage-2FIMXWCQ.js.map +1 -0
- package/dist/{chunk-ILHSYF6L.js → chunk-F7UW7VZI.js} +35 -15
- package/dist/chunk-F7UW7VZI.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/lib/routes.d.ts +1 -1
- package/dist/lib/routes.d.ts.map +1 -1
- package/dist/lib/useStockedItemTypes.d.ts.map +1 -1
- package/dist/views/GapScreens.d.ts +2 -1
- package/dist/views/GapScreens.d.ts.map +1 -1
- package/dist/views/InvoiceFormView.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/FinancialPage-QPMREIN4.js.map +0 -1
- package/dist/chunk-ILHSYF6L.js.map +0 -1
|
@@ -2,7 +2,7 @@ import { chartRowsFor, chartTreeProps } from './chunk-XGBGRXZ3.js';
|
|
|
2
2
|
import { consumePayableDraft, PayableDraftSurface } from './chunk-7VKJLBYY.js';
|
|
3
3
|
import { useFinancialConfig, useFinancialStore, formatCurrency, useFinancialProvider } from './chunk-CNXAVGSW.js';
|
|
4
4
|
import { FINANCIAL_INVOICE_ZONES } from '@fayz-ai/financial/views/zones';
|
|
5
|
-
export { FINANCIAL_INVOICE_ZONES } from '@fayz-ai/financial/views/zones';
|
|
5
|
+
export { FINANCIAL_FISCAL_ZONES, FINANCIAL_INVOICE_ZONES } from '@fayz-ai/financial/views/zones';
|
|
6
6
|
import * as React12 from 'react';
|
|
7
7
|
import React12__default, { useState, useEffect, useRef, useMemo } from 'react';
|
|
8
8
|
import { useTranslation, createPendingCommand, useUnitMode, useDataChanged, useActiveUnitId, appHref, resolveCurrency, getSupabaseClientOptional } from '@fayz-ai/core';
|
|
@@ -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
|
}
|
|
@@ -2814,8 +2819,9 @@ function useStockedItemTypes(itemTypes, entityLookups) {
|
|
|
2814
2819
|
cancelled = true;
|
|
2815
2820
|
};
|
|
2816
2821
|
}, [backed]);
|
|
2822
|
+
const ALWAYS_OFFERED = /* @__PURE__ */ new Set(["product"]);
|
|
2817
2823
|
return React12__default.useMemo(
|
|
2818
|
-
() => empty?.size ? itemTypes.filter((type) => !empty.has(type.value)) : itemTypes,
|
|
2824
|
+
() => empty?.size ? itemTypes.filter((type) => ALWAYS_OFFERED.has(type.value) || !empty.has(type.value)) : itemTypes,
|
|
2819
2825
|
[itemTypes, empty]
|
|
2820
2826
|
);
|
|
2821
2827
|
}
|
|
@@ -3016,10 +3022,11 @@ function InvoiceFormView({ direction, editId, onSaved, focusReceipt = false, fro
|
|
|
3016
3022
|
const canManageFinancial = can("financial", "manage");
|
|
3017
3023
|
const isEdit = !!editId;
|
|
3018
3024
|
const [attachmentsOpen, setAttachmentsOpen] = useState(false);
|
|
3019
|
-
const [
|
|
3025
|
+
const [attachments, setAttachments] = useState([]);
|
|
3026
|
+
const attachmentCount = attachments.length;
|
|
3020
3027
|
const loadAttachmentCount = React12__default.useCallback(() => {
|
|
3021
3028
|
if (!editId || !provider.getInvoiceAttachments) return;
|
|
3022
|
-
provider.getInvoiceAttachments(editId).then(
|
|
3029
|
+
provider.getInvoiceAttachments(editId).then(setAttachments).catch(() => {
|
|
3023
3030
|
});
|
|
3024
3031
|
}, [editId, provider]);
|
|
3025
3032
|
useEffect(() => {
|
|
@@ -3776,13 +3783,18 @@ function InvoiceFormView({ direction, editId, onSaved, focusReceipt = false, fro
|
|
|
3776
3783
|
}
|
|
3777
3784
|
),
|
|
3778
3785
|
actions: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3779
|
-
canAttach
|
|
3786
|
+
(canAttach || isEdit) && /* @__PURE__ */ jsx(
|
|
3780
3787
|
InstallmentReceiptButton,
|
|
3781
3788
|
{
|
|
3782
|
-
attached: !!inst.receiptUrl,
|
|
3789
|
+
attached: !!inst.receiptUrl || isEdit && attachments.some((a) => a.installmentNumber === i + 1),
|
|
3790
|
+
count: isEdit ? attachments.filter((a) => a.installmentNumber === i + 1).length : void 0,
|
|
3783
3791
|
pending: !inst.receiptUrl && !!pendingReceipt,
|
|
3784
3792
|
title: !inst.receiptUrl && pendingReceipt ? t("financial.receipt.attachRead") : t("financial.quickTx.receiptCapture"),
|
|
3785
3793
|
onClick: () => {
|
|
3794
|
+
if (isEdit && editId) {
|
|
3795
|
+
setAttachmentsOpen(i + 1);
|
|
3796
|
+
return;
|
|
3797
|
+
}
|
|
3786
3798
|
if (!inst.receiptUrl && pendingReceipt) {
|
|
3787
3799
|
patch({ receiptUrl: pendingReceipt });
|
|
3788
3800
|
setPendingReceipt(void 0);
|
|
@@ -4213,7 +4225,15 @@ function InvoiceFormView({ direction, editId, onSaved, focusReceipt = false, fro
|
|
|
4213
4225
|
}
|
|
4214
4226
|
),
|
|
4215
4227
|
receiptPicker.input,
|
|
4216
|
-
attachmentsOpen && editId && /* @__PURE__ */ jsx(
|
|
4228
|
+
attachmentsOpen && editId && /* @__PURE__ */ jsx(
|
|
4229
|
+
InvoiceAttachmentsModal,
|
|
4230
|
+
{
|
|
4231
|
+
invoiceId: editId,
|
|
4232
|
+
installmentNumber: typeof attachmentsOpen === "number" ? attachmentsOpen : void 0,
|
|
4233
|
+
onClose: () => setAttachmentsOpen(false),
|
|
4234
|
+
onChanged: loadAttachmentCount
|
|
4235
|
+
}
|
|
4236
|
+
),
|
|
4217
4237
|
payingMovement && /* @__PURE__ */ jsx(CurrencyScope, { code: documentCurrency, children: /* @__PURE__ */ jsx(
|
|
4218
4238
|
PaymentModal,
|
|
4219
4239
|
{
|
|
@@ -4272,5 +4292,5 @@ function InvoiceFormView({ direction, editId, onSaved, focusReceipt = false, fro
|
|
|
4272
4292
|
}
|
|
4273
4293
|
|
|
4274
4294
|
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-
|
|
4295
|
+
//# sourceMappingURL=chunk-F7UW7VZI.js.map
|
|
4296
|
+
//# sourceMappingURL=chunk-F7UW7VZI.js.map
|