@fayz-ai/plugin-financial 0.33.10 → 0.33.12
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-2FIMXWCQ.js → FinancialPage-LJCVGEM3.js} +10 -8
- package/dist/FinancialPage-LJCVGEM3.js.map +1 -0
- package/dist/{chunk-F7UW7VZI.js → chunk-KD46ZOEH.js} +29 -16
- package/dist/chunk-KD46ZOEH.js.map +1 -0
- package/dist/components/InvoiceAttachmentsModal.d.ts +15 -1
- package/dist/components/InvoiceAttachmentsModal.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/views/InvoiceDetailView.d.ts.map +1 -1
- package/dist/views/InvoiceFormView.d.ts.map +1 -1
- package/dist/views/InvoiceListView.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/FinancialPage-2FIMXWCQ.js.map +0 -1
- package/dist/chunk-F7UW7VZI.js.map +0 -1
|
@@ -15,8 +15,8 @@ import { AttachmentsModal, useCurrency, useUnitStore, OrderDetailSkeleton, Widge
|
|
|
15
15
|
import { T } from '@fayz-ai/financial/data/tables';
|
|
16
16
|
import { groupPaymentsByBill, reversiblePayments } from '@fayz-ai/financial/domain/movement';
|
|
17
17
|
import { describePayment, paymentHolderId } from '@fayz-ai/financial/domain/payment-method';
|
|
18
|
+
import { attachmentBelongsTo, availableInvoiceItemTypes, splitInstallments } from '@fayz-ai/financial/domain/invoice';
|
|
18
19
|
import { postableAccounts } from '@fayz-ai/financial/domain/chart-of-accounts';
|
|
19
|
-
import { availableInvoiceItemTypes, splitInstallments } from '@fayz-ai/financial/domain/invoice';
|
|
20
20
|
import { counterpartyAccountingPolicy, resolveCounterpartyAccountingPolicy } from '@fayz-ai/financial/domain/counterparty';
|
|
21
21
|
|
|
22
22
|
var ACCOUNTS_ROUTE = "/registry/accounts";
|
|
@@ -1244,9 +1244,21 @@ function rebalanceInstallments(input) {
|
|
|
1244
1244
|
});
|
|
1245
1245
|
return next.map((c) => c / 100);
|
|
1246
1246
|
}
|
|
1247
|
-
function
|
|
1247
|
+
function invoiceAttachmentScope(provider, invoiceId, installmentNumber, totalInstallments = 1) {
|
|
1248
|
+
const one = installmentNumber != null;
|
|
1249
|
+
return {
|
|
1250
|
+
load: async () => {
|
|
1251
|
+
const all = await provider.getInvoiceAttachments?.(invoiceId) ?? [];
|
|
1252
|
+
return one ? all.filter((a) => attachmentBelongsTo(a, installmentNumber, totalInstallments)) : all;
|
|
1253
|
+
},
|
|
1254
|
+
upload: provider.addInvoiceAttachment ? (file) => provider.addInvoiceAttachment(invoiceId, file, one ? { installmentNumber } : void 0) : void 0,
|
|
1255
|
+
remove: provider.removeInvoiceAttachment ? (a) => provider.removeInvoiceAttachment(a.id) : void 0
|
|
1256
|
+
};
|
|
1257
|
+
}
|
|
1258
|
+
function InvoiceAttachmentsModal({ invoiceId, installmentNumber, totalInstallments, onClose, onChanged }) {
|
|
1248
1259
|
const provider = useFinancialProvider();
|
|
1249
1260
|
const one = installmentNumber != null;
|
|
1261
|
+
const scope = invoiceAttachmentScope(provider, invoiceId, installmentNumber, totalInstallments);
|
|
1250
1262
|
return /* @__PURE__ */ jsx(
|
|
1251
1263
|
AttachmentsModal,
|
|
1252
1264
|
{
|
|
@@ -1256,12 +1268,9 @@ function InvoiceAttachmentsModal({ invoiceId, installmentNumber, onClose, onChan
|
|
|
1256
1268
|
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.",
|
|
1257
1269
|
pendingMessage: "O registro deste anexo atravessou, o arquivo ainda n\xE3o. Ele continua no V1 \u2014 procure pelo nome do arquivo."
|
|
1258
1270
|
},
|
|
1259
|
-
load:
|
|
1260
|
-
|
|
1261
|
-
|
|
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,
|
|
1271
|
+
load: scope.load,
|
|
1272
|
+
upload: scope.upload,
|
|
1273
|
+
remove: scope.remove,
|
|
1265
1274
|
onClose,
|
|
1266
1275
|
onChanged
|
|
1267
1276
|
}
|
|
@@ -2401,6 +2410,7 @@ function InvoiceDetailView({ invoiceId, direction, onBack, onEdit, backLabel, em
|
|
|
2401
2410
|
const editavel = !hasPaidDetails && invoice.status !== "cancelled";
|
|
2402
2411
|
const canChooseSource = editavel && Math.abs(mov.amount) >= 5e-3;
|
|
2403
2412
|
const ativa = invoice.status !== "cancelled";
|
|
2413
|
+
const ownAttachments = attachments.filter((a) => attachmentBelongsTo(a, mov.installmentNumber ?? 1, invoice.totalInstallments ?? 1));
|
|
2404
2414
|
return /* @__PURE__ */ jsx(
|
|
2405
2415
|
InstallmentRow,
|
|
2406
2416
|
{
|
|
@@ -2452,10 +2462,10 @@ function InvoiceDetailView({ invoiceId, direction, onBack, onEdit, backLabel, em
|
|
|
2452
2462
|
/* @__PURE__ */ jsx(
|
|
2453
2463
|
InstallmentReceiptButton,
|
|
2454
2464
|
{
|
|
2455
|
-
title: "
|
|
2456
|
-
attached:
|
|
2457
|
-
count:
|
|
2458
|
-
onClick: () => setAttachmentsOpen(
|
|
2465
|
+
title: "Comprovantes da parcela",
|
|
2466
|
+
attached: ownAttachments.length > 0,
|
|
2467
|
+
count: ownAttachments.length,
|
|
2468
|
+
onClick: () => setAttachmentsOpen(mov.installmentNumber ?? 1)
|
|
2459
2469
|
}
|
|
2460
2470
|
),
|
|
2461
2471
|
!isPaid && !isPartial && ativa && /* @__PURE__ */ jsxs(
|
|
@@ -2516,6 +2526,8 @@ function InvoiceDetailView({ invoiceId, direction, onBack, onEdit, backLabel, em
|
|
|
2516
2526
|
InvoiceAttachmentsModal,
|
|
2517
2527
|
{
|
|
2518
2528
|
invoiceId: invoice.id,
|
|
2529
|
+
installmentNumber: typeof attachmentsOpen === "number" ? attachmentsOpen : void 0,
|
|
2530
|
+
totalInstallments: invoice.totalInstallments ?? 1,
|
|
2519
2531
|
onClose: () => setAttachmentsOpen(false),
|
|
2520
2532
|
onChanged: () => {
|
|
2521
2533
|
void loadData();
|
|
@@ -3786,8 +3798,8 @@ function InvoiceFormView({ direction, editId, onSaved, focusReceipt = false, fro
|
|
|
3786
3798
|
(canAttach || isEdit) && /* @__PURE__ */ jsx(
|
|
3787
3799
|
InstallmentReceiptButton,
|
|
3788
3800
|
{
|
|
3789
|
-
attached: !!inst.receiptUrl || isEdit && attachments.some((a) => a
|
|
3790
|
-
count: isEdit ? attachments.filter((a) => a
|
|
3801
|
+
attached: !!inst.receiptUrl || isEdit && attachments.some((a) => attachmentBelongsTo(a, i + 1, installments.length)),
|
|
3802
|
+
count: isEdit ? attachments.filter((a) => attachmentBelongsTo(a, i + 1, installments.length)).length : void 0,
|
|
3791
3803
|
pending: !inst.receiptUrl && !!pendingReceipt,
|
|
3792
3804
|
title: !inst.receiptUrl && pendingReceipt ? t("financial.receipt.attachRead") : t("financial.quickTx.receiptCapture"),
|
|
3793
3805
|
onClick: () => {
|
|
@@ -4230,6 +4242,7 @@ function InvoiceFormView({ direction, editId, onSaved, focusReceipt = false, fro
|
|
|
4230
4242
|
{
|
|
4231
4243
|
invoiceId: editId,
|
|
4232
4244
|
installmentNumber: typeof attachmentsOpen === "number" ? attachmentsOpen : void 0,
|
|
4245
|
+
totalInstallments: installments.length,
|
|
4233
4246
|
onClose: () => setAttachmentsOpen(false),
|
|
4234
4247
|
onChanged: loadAttachmentCount
|
|
4235
4248
|
}
|
|
@@ -4292,5 +4305,5 @@ function InvoiceFormView({ direction, editId, onSaved, focusReceipt = false, fro
|
|
|
4292
4305
|
}
|
|
4293
4306
|
|
|
4294
4307
|
export { ACCOUNTS_ROUTE, AccountIcon, BankLogo, BankPicker, CancelInvoicesDialog, FinancialCounterpartySearchSelect, InvoiceAttachmentsModal, InvoiceDetailView, InvoiceFormView, PaymentModal, UnitField, createFinancialCounterpartyLookup, findBrBank, marcarItemParaAbrir, renderAccountAvatar, renderCardChip, useStockedItemTypes, useWritableUnits };
|
|
4295
|
-
//# sourceMappingURL=chunk-
|
|
4296
|
-
//# sourceMappingURL=chunk-
|
|
4308
|
+
//# sourceMappingURL=chunk-KD46ZOEH.js.map
|
|
4309
|
+
//# sourceMappingURL=chunk-KD46ZOEH.js.map
|