@fayz-ai/plugin-financial 0.29.0 → 0.29.2

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.
@@ -1122,7 +1122,9 @@ function InvoiceListView({ direction, onNew, onNewReceipt, onEdit }) {
1122
1122
  costCenterId: "",
1123
1123
  from: mesCorrente.from,
1124
1124
  to: mesCorrente.to,
1125
- preset: "custom"
1125
+ preset: "custom",
1126
+ /** Also list what fell due before the window and is still unpaid. Off: the period is the period. */
1127
+ overdue: false
1126
1128
  },
1127
1129
  { persistKey: `financial.invoices.${direction}`, persistExclude: ["preset"] }
1128
1130
  );
@@ -1216,7 +1218,7 @@ function InvoiceListView({ direction, onNew, onNewReceipt, onEdit }) {
1216
1218
  // default month view hid every overdue line and people took them for lost.
1217
1219
  // A window entirely in the past or future is a deliberate look at that
1218
1220
  // period, and stays exactly that period.
1219
- includeOverdue: windowReachesToday(emVigor.from, emVigor.to) || void 0
1221
+ includeOverdue: emVigor.overdue && windowReachesToday(emVigor.from, emVigor.to) || void 0
1220
1222
  }), [direction, emVigor, search, effectiveUnitId, page, pageSize]);
1221
1223
  useEffect(() => {
1222
1224
  fetchInvoices(query);
@@ -1252,10 +1254,16 @@ function InvoiceListView({ direction, onNew, onNewReceipt, onEdit }) {
1252
1254
  );
1253
1255
  const summaries = useMemo(() => {
1254
1256
  if (invoicesTotals) {
1255
- return invoicesTotals.map((sum) => {
1257
+ const merged = /* @__PURE__ */ new Map();
1258
+ for (const sum of invoicesTotals) {
1256
1259
  const cur = resolveCurrency(currency, sum.currency);
1257
- return { currency: cur, totalAmount: sum.total, paidAmount: sum.paid, openAmount: sum.total - sum.paid };
1258
- });
1260
+ const row = merged.get(cur.code) ?? { currency: cur, totalAmount: 0, paidAmount: 0, openAmount: 0 };
1261
+ row.totalAmount += sum.total;
1262
+ row.paidAmount += sum.paid;
1263
+ row.openAmount = row.totalAmount - row.paidAmount;
1264
+ merged.set(cur.code, row);
1265
+ }
1266
+ return [...merged.values()];
1259
1267
  }
1260
1268
  const byCode = /* @__PURE__ */ new Map();
1261
1269
  for (const inv of filtered) {
@@ -1474,6 +1482,18 @@ function InvoiceListView({ direction, onNew, onNewReceipt, onEdit }) {
1474
1482
  },
1475
1483
  preset
1476
1484
  )),
1485
+ /* @__PURE__ */ jsx(
1486
+ Button,
1487
+ {
1488
+ variant: "bare",
1489
+ size: "bare",
1490
+ type: "button",
1491
+ "aria-pressed": draft.overdue,
1492
+ onClick: () => patch({ overdue: !draft.overdue }),
1493
+ className: `font-normal rounded-full border px-2 py-0.5 text-[10px] transition-colors ${draft.overdue ? "border-primary bg-primary/10 text-primary" : "border-transparent bg-muted/60 text-muted-foreground hover:bg-muted"}`,
1494
+ children: t("financial.invoice.filterIncludeOverdue")
1495
+ }
1496
+ ),
1477
1497
  /* @__PURE__ */ jsx("span", { className: "ml-auto text-[10px] text-muted-foreground", children: t("financial.invoice.filterMaxRange") })
1478
1498
  ] })
1479
1499
  ] });
@@ -6593,5 +6613,5 @@ function FinancialPage({ config: appConfig, provider, store, registries }) {
6593
6613
  }
6594
6614
 
6595
6615
  export { FinancialPage };
6596
- //# sourceMappingURL=FinancialPage-BFC3K4WY.js.map
6597
- //# sourceMappingURL=FinancialPage-BFC3K4WY.js.map
6616
+ //# sourceMappingURL=FinancialPage-LCKLEAM3.js.map
6617
+ //# sourceMappingURL=FinancialPage-LCKLEAM3.js.map