@fayz-ai/plugin-fiscal-br 0.16.5 → 0.17.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/{InboundNotesPage-IEPEEOY2.js → InboundNotesPage-MT4FL7JO.js} +4 -4
- package/dist/{InboundNotesPage-IEPEEOY2.js.map → InboundNotesPage-MT4FL7JO.js.map} +1 -1
- package/dist/NoteReconcileView-XRJGCGTD.js +6 -0
- package/dist/{NoteReconcileView-3MFYJZME.js.map → NoteReconcileView-XRJGCGTD.js.map} +1 -1
- package/dist/{chunk-VMZN3UYW.js → chunk-J6LXGXCA.js} +3 -3
- package/dist/{chunk-VMZN3UYW.js.map → chunk-J6LXGXCA.js.map} +1 -1
- package/dist/{chunk-GXI2FGDQ.js → chunk-X7X57O7P.js} +158 -37
- package/dist/chunk-X7X57O7P.js.map +1 -0
- package/dist/data/inbox.d.ts +18 -0
- package/dist/data/inbox.d.ts.map +1 -1
- package/dist/index.js +52 -8
- package/dist/index.js.map +1 -1
- package/dist/locales/en.d.ts.map +1 -1
- package/dist/locales/pt-BR.d.ts.map +1 -1
- package/dist/migrations/index.d.ts +1 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/main.browser.js +2 -1
- package/dist/migrations/main.browser.js.map +1 -1
- package/dist/migrations/main.js +568 -2
- package/dist/migrations/main.js.map +1 -1
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/views/NoteReconcileView.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/NoteReconcileView-3MFYJZME.js +0 -6
- package/dist/chunk-GXI2FGDQ.js.map +0 -1
|
@@ -399,7 +399,8 @@ var ITEM_COLUMNS = `
|
|
|
399
399
|
icms_cst, icms_csosn, icms_base, icms_rate, icms_value, pis_value, cofins_value, ipi_value,
|
|
400
400
|
product_id, entry_type, chart_account_id, stock_unit_id, stock_quantity,
|
|
401
401
|
conversion_factor, cost_mode, unit_cost_new, reconciled, stock_movement_id,
|
|
402
|
-
shortage_quantity, shortage_reason, shortage_note, suggested_by, suggestion_confidence
|
|
402
|
+
shortage_quantity, shortage_reason, shortage_note, suggested_by, suggestion_confidence,
|
|
403
|
+
stock_location_id, batch_number, expiration_date
|
|
403
404
|
`;
|
|
404
405
|
function rowToItem(row) {
|
|
405
406
|
const quantity = Number(row.quantity_commercial ?? 0);
|
|
@@ -440,7 +441,10 @@ function rowToItem(row) {
|
|
|
440
441
|
stockMovementId: row.stock_movement_id ?? null,
|
|
441
442
|
shortageQuantity: row.shortage_quantity == null ? null : Number(row.shortage_quantity),
|
|
442
443
|
shortageReason: row.shortage_reason ?? null,
|
|
443
|
-
shortageNote: row.shortage_note ?? null
|
|
444
|
+
shortageNote: row.shortage_note ?? null,
|
|
445
|
+
stockLocationId: row.stock_location_id ?? null,
|
|
446
|
+
batchNumber: row.batch_number ?? null,
|
|
447
|
+
expirationDate: row.expiration_date ?? null
|
|
444
448
|
};
|
|
445
449
|
}
|
|
446
450
|
async function getInboxNote(id) {
|
|
@@ -570,7 +574,10 @@ async function saveNoteDecision(input) {
|
|
|
570
574
|
suggestion_confidence: i.suggestionConfidence ?? null,
|
|
571
575
|
// `missing_quantity` (note units) is the key the save RPC reads since
|
|
572
576
|
// fiscal-br/034; without it the receipt already saved is kept.
|
|
573
|
-
...i.missingQuantity !== void 0 ? { missing_quantity: i.missingQuantity, shortage_reason: i.shortageReason ?? null, shortage_note: i.shortageNote ?? null } : {}
|
|
577
|
+
...i.missingQuantity !== void 0 ? { missing_quantity: i.missingQuantity, shortage_reason: i.shortageReason ?? null, shortage_note: i.shortageNote ?? null } : {},
|
|
578
|
+
...i.stockLocationId !== void 0 ? { stock_location_id: i.stockLocationId } : {},
|
|
579
|
+
...i.batchNumber !== void 0 ? { batch_number: i.batchNumber } : {},
|
|
580
|
+
...i.expirationDate !== void 0 ? { expiration_date: i.expirationDate } : {}
|
|
574
581
|
})),
|
|
575
582
|
p_default_chart_account_id: input.defaultChartAccountId ?? null,
|
|
576
583
|
p_default_location_id: input.defaultLocationId ?? null,
|
|
@@ -659,7 +666,12 @@ async function findInboxNoteByOperation(operationId) {
|
|
|
659
666
|
if (!operationId) return null;
|
|
660
667
|
const { data, error } = await sb().from("plg_fiscalbr_inbox_documents").select("id").eq("inventory_operation_id", operationId).limit(1).maybeSingle();
|
|
661
668
|
if (error) throw error;
|
|
662
|
-
|
|
669
|
+
const direct = data?.id;
|
|
670
|
+
if (direct) return direct;
|
|
671
|
+
const { data: movements, error: movError } = await sb().from("plg_inventory_stock_movements").select("id").eq("operation_id", operationId).limit(50);
|
|
672
|
+
if (movError || !movements?.length) return null;
|
|
673
|
+
const { data: line } = await sb().from("plg_fiscalbr_inbox_items").select("inbox_document_id").in("stock_movement_id", movements.map((m) => m.id)).limit(1).maybeSingle();
|
|
674
|
+
return line?.inbox_document_id ?? null;
|
|
663
675
|
}
|
|
664
676
|
async function suggestNoteItems(documentId, reevaluate = false) {
|
|
665
677
|
const { data, error } = await sb().functions.invoke("fiscalbr-suggest-note-items", {
|
|
@@ -720,6 +732,19 @@ async function listChartAccountNodes() {
|
|
|
720
732
|
isGroup: a.node_type === "group" || parents.has(String(a.id))
|
|
721
733
|
}));
|
|
722
734
|
}
|
|
735
|
+
async function getProductStockDefaults(documentId, productIds) {
|
|
736
|
+
if (productIds.length === 0) return /* @__PURE__ */ new Map();
|
|
737
|
+
const { data, error } = await sb().rpc("fiscalbr_product_stock_defaults", {
|
|
738
|
+
p_document_id: documentId,
|
|
739
|
+
p_product_ids: productIds
|
|
740
|
+
});
|
|
741
|
+
if (error) throw error;
|
|
742
|
+
return new Map((data ?? []).map((r) => [String(r.product_id), {
|
|
743
|
+
locationId: r.location_id ?? null,
|
|
744
|
+
requireBatch: Boolean(r.require_batch),
|
|
745
|
+
requireExpiry: Boolean(r.require_expiry)
|
|
746
|
+
}]));
|
|
747
|
+
}
|
|
723
748
|
async function listStockLocations() {
|
|
724
749
|
const { data, error } = await sb().from("plg_inventory_stock_locations").select("id, name, unit_id, is_active").order("name");
|
|
725
750
|
if (error) throw error;
|
|
@@ -1215,6 +1240,20 @@ var ENTRY_TYPES = [
|
|
|
1215
1240
|
{ value: "despesa", label: "Despesa", hint: "n\xE3o vira estoque" },
|
|
1216
1241
|
{ value: "servico", label: "Servi\xE7o", hint: "n\xE3o vira estoque" }
|
|
1217
1242
|
];
|
|
1243
|
+
var STOCK_REFUSALS = /* @__PURE__ */ new Set([
|
|
1244
|
+
"STOCK_LOCATION_MISSING",
|
|
1245
|
+
"STOCK_LOCATION_UNKNOWN",
|
|
1246
|
+
"STOCK_LOCATION_INACTIVE",
|
|
1247
|
+
"STOCK_LOCATION_OTHER_UNIT",
|
|
1248
|
+
"BATCH_REQUIRED",
|
|
1249
|
+
"EXPIRY_REQUIRED",
|
|
1250
|
+
"EXPIRY_BAD_DATE"
|
|
1251
|
+
]);
|
|
1252
|
+
function stockRefusalOf(e) {
|
|
1253
|
+
const err = e;
|
|
1254
|
+
if (!err?.hint || !STOCK_REFUSALS.has(err.hint)) return null;
|
|
1255
|
+
return { code: err.hint, item: /item (\d+)/.exec(err.message ?? "")?.[1] ?? "?" };
|
|
1256
|
+
}
|
|
1218
1257
|
var localSearch = (options) => (query) => {
|
|
1219
1258
|
const q = query.trim().toLowerCase();
|
|
1220
1259
|
return (q ? options.filter((o) => o.label.toLowerCase().includes(q)) : options).slice(0, 40);
|
|
@@ -1259,7 +1298,10 @@ var draftOf = (item) => ({
|
|
|
1259
1298
|
shortageNote: item.shortageNote ?? "",
|
|
1260
1299
|
// Vem do SERVIDOR: é o que faz o selo sobreviver a recarregar a página.
|
|
1261
1300
|
suggestedBy: item.suggestedBy,
|
|
1262
|
-
suggestionConfidence: item.suggestionConfidence
|
|
1301
|
+
suggestionConfidence: item.suggestionConfidence,
|
|
1302
|
+
stockLocationId: item.stockLocationId,
|
|
1303
|
+
batchNumber: item.batchNumber ?? "",
|
|
1304
|
+
expirationDate: item.expirationDate ?? ""
|
|
1263
1305
|
});
|
|
1264
1306
|
function receiptOf(item, d) {
|
|
1265
1307
|
const missing = parseQty(d.shortageQuantity);
|
|
@@ -1306,6 +1348,7 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
1306
1348
|
const [chartNodes, setChartNodes] = useState([]);
|
|
1307
1349
|
useMemo(() => chartNodes.filter((a) => !a.isGroup), [chartNodes]);
|
|
1308
1350
|
const [locations, setLocations] = useState([]);
|
|
1351
|
+
const [stockDefaults, setStockDefaults] = useState(() => /* @__PURE__ */ new Map());
|
|
1309
1352
|
const [saving, setSaving] = useState(false);
|
|
1310
1353
|
const [accepting, setAccepting] = useState(false);
|
|
1311
1354
|
const [openIds, setOpenIds] = useState([]);
|
|
@@ -1366,13 +1409,18 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
1366
1409
|
const nomes = vinculados.length ? new Map((await listProductsByIds(vinculados).catch(() => [])).map((p) => [p.id, p.name])) : /* @__PURE__ */ new Map();
|
|
1367
1410
|
const unidadesDoProduto = await listProductStockUnits(vinculados).catch(() => /* @__PURE__ */ new Map());
|
|
1368
1411
|
setProductUnits(unidadesDoProduto);
|
|
1412
|
+
const padroes = await getProductStockDefaults(detail.id, vinculados).catch(() => /* @__PURE__ */ new Map());
|
|
1413
|
+
setStockDefaults(padroes);
|
|
1369
1414
|
setDrafts(Object.fromEntries(detail.items.map((i) => [
|
|
1370
1415
|
i.id,
|
|
1371
1416
|
{
|
|
1372
1417
|
...draftOf(i),
|
|
1373
1418
|
productLabel: i.productId && nomes.get(i.productId) || "",
|
|
1374
1419
|
// Stocked lines keep what was recorded; open ones get a unit instead of a blank.
|
|
1375
|
-
stockUnitId: i.stockUnitId ?? (i.stockMovementId ? null : suggestedStockUnit(i, u, unidadesDoProduto, i.productId))
|
|
1420
|
+
stockUnitId: i.stockUnitId ?? (i.stockMovementId ? null : suggestedStockUnit(i, u, unidadesDoProduto, i.productId)),
|
|
1421
|
+
// V1: the line's own location, else the product's Local padrão when it
|
|
1422
|
+
// is still valid, else blank for the person to choose.
|
|
1423
|
+
stockLocationId: i.stockLocationId ?? (i.stockMovementId || !i.productId ? null : padroes.get(i.productId)?.locationId ?? null)
|
|
1376
1424
|
}
|
|
1377
1425
|
])));
|
|
1378
1426
|
setChecked(Object.fromEntries(detail.items.filter((i) => i.reconciled).map((i) => [i.id, true])));
|
|
@@ -1380,7 +1428,7 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
1380
1428
|
setOpenIds(pending ? [pending.id] : []);
|
|
1381
1429
|
setInstalments(instalmentsOf(detail));
|
|
1382
1430
|
setDefaultAccount(detail.defaultChartAccountId);
|
|
1383
|
-
setLocation(detail.defaultLocationId ??
|
|
1431
|
+
setLocation(detail.defaultLocationId ?? null);
|
|
1384
1432
|
}
|
|
1385
1433
|
} catch (e) {
|
|
1386
1434
|
setError(e instanceof Error ? e.message : String(e));
|
|
@@ -1423,7 +1471,9 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
1423
1471
|
suggestedBy: d.suggestedBy,
|
|
1424
1472
|
suggestionConfidence: d.suggestionConfidence,
|
|
1425
1473
|
// The receipt travels as `missing_quantity` (note units); nothing missing is null.
|
|
1426
|
-
...receiptOf(item, d)
|
|
1474
|
+
...receiptOf(item, d),
|
|
1475
|
+
// Where it enters, per line (fiscal-br/039). A line already in stock keeps what it recorded.
|
|
1476
|
+
...item.stockMovementId ? {} : isStockBearing(d.entryType) ? { stockLocationId: d.stockLocationId, batchNumber: d.batchNumber.trim() || null, expirationDate: d.expirationDate || null } : { stockLocationId: null, batchNumber: null, expirationDate: null }
|
|
1427
1477
|
};
|
|
1428
1478
|
});
|
|
1429
1479
|
}, [note, defaultAccount]);
|
|
@@ -1441,6 +1491,11 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
1441
1491
|
return !d.stockUnitId && !item?.stockMovementId;
|
|
1442
1492
|
}).length;
|
|
1443
1493
|
const missingType = decisions.filter((d) => !d.entryType).length;
|
|
1494
|
+
const openStockLines = stockLines.filter((d) => !note?.items.find((i) => i.id === d.id)?.stockMovementId);
|
|
1495
|
+
const requires = (d) => d.productId ? stockDefaults.get(d.productId) : void 0;
|
|
1496
|
+
const missingLocation = openStockLines.filter((d) => !d.stockLocationId).length;
|
|
1497
|
+
const missingBatch = openStockLines.filter((d) => requires(d)?.requireBatch && !d.batchNumber).length;
|
|
1498
|
+
const missingExpiry = openStockLines.filter((d) => requires(d)?.requireExpiry && !d.expirationDate).length;
|
|
1444
1499
|
const badReceipt = note ? note.items.filter((i) => receiptInvalid(i, drafts[i.id] ?? draftOf(i))).length : 0;
|
|
1445
1500
|
const occurrence = note ? summarizeOccurrence(note.items.map((i) => receiptLine(i, drafts[i.id] ?? draftOf(i)))) : { count: 0, value: 0 };
|
|
1446
1501
|
const suspectFactor = (item, d) => packagingCount(item.unit) !== null && isStockBearing(d.entryType) && ((Number(d.conversionFactor.replace(",", ".")) || 1) === 1 || !d.stockUnitId);
|
|
@@ -1622,6 +1677,23 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
1622
1677
|
void load();
|
|
1623
1678
|
}, children: /* @__PURE__ */ jsx(RefreshCw, { className: "h-4 w-4" }) }) })
|
|
1624
1679
|
] }) : null;
|
|
1680
|
+
const describeError = (e) => {
|
|
1681
|
+
const refusal = stockRefusalOf(e);
|
|
1682
|
+
if (refusal) return t(`fiscalbr.stock.refusal.${refusal.code}`, { item: refusal.item });
|
|
1683
|
+
return e instanceof Error ? e.message : String(e?.message ?? e);
|
|
1684
|
+
};
|
|
1685
|
+
const applyLocationToAll = (id) => {
|
|
1686
|
+
setLocation(id);
|
|
1687
|
+
if (!id || !note) return;
|
|
1688
|
+
setDrafts((prev) => {
|
|
1689
|
+
const next = { ...prev };
|
|
1690
|
+
for (const item of note.items) {
|
|
1691
|
+
const d = next[item.id] ?? draftOf(item);
|
|
1692
|
+
if (!item.stockMovementId && isStockBearing(d.entryType)) next[item.id] = { ...d, stockLocationId: id };
|
|
1693
|
+
}
|
|
1694
|
+
return next;
|
|
1695
|
+
});
|
|
1696
|
+
};
|
|
1625
1697
|
const save = async () => {
|
|
1626
1698
|
if (!note) return;
|
|
1627
1699
|
setSaving(true);
|
|
@@ -1636,7 +1708,7 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
1636
1708
|
});
|
|
1637
1709
|
await load();
|
|
1638
1710
|
} catch (e) {
|
|
1639
|
-
setError(
|
|
1711
|
+
setError(describeError(e));
|
|
1640
1712
|
} finally {
|
|
1641
1713
|
setSaving(false);
|
|
1642
1714
|
}
|
|
@@ -1653,13 +1725,13 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
1653
1725
|
defaultLocationId: location,
|
|
1654
1726
|
instalments
|
|
1655
1727
|
});
|
|
1656
|
-
const result = await acceptNote(note.id,
|
|
1728
|
+
const result = await acceptNote(note.id, null);
|
|
1657
1729
|
if (result.invoiceId) await moveNoteAttachmentsToInvoice(note.id, result.invoiceId).catch(() => {
|
|
1658
1730
|
});
|
|
1659
1731
|
setAccepted(result);
|
|
1660
1732
|
await load();
|
|
1661
1733
|
} catch (e) {
|
|
1662
|
-
setError(
|
|
1734
|
+
setError(describeError(e));
|
|
1663
1735
|
} finally {
|
|
1664
1736
|
setAccepting(false);
|
|
1665
1737
|
}
|
|
@@ -1706,6 +1778,9 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
1706
1778
|
missingType > 0 && `${missingType} sem tipo`,
|
|
1707
1779
|
missingProduct > 0 && `${missingProduct} sem produto`,
|
|
1708
1780
|
missingUnit > 0 && `${missingUnit} sem unidade de estoque`,
|
|
1781
|
+
missingLocation > 0 && t("fiscalbr.stock.pendingLocation", { count: missingLocation }),
|
|
1782
|
+
missingBatch > 0 && t("fiscalbr.stock.pendingBatch", { count: missingBatch }),
|
|
1783
|
+
missingExpiry > 0 && t("fiscalbr.stock.pendingExpiry", { count: missingExpiry }),
|
|
1709
1784
|
badReceipt > 0 && t("fiscalbr.receipt.pending", { count: badReceipt })
|
|
1710
1785
|
].filter(Boolean).join(" \xB7 ");
|
|
1711
1786
|
const rodape = readOnly ? null : {
|
|
@@ -1743,7 +1818,7 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
1743
1818
|
onClick: () => {
|
|
1744
1819
|
void accept();
|
|
1745
1820
|
},
|
|
1746
|
-
disabled: accepting || saving || missingType > 0 || missingProduct > 0 || missingUnit > 0 || unverifiedFactor > 0 || badReceipt > 0,
|
|
1821
|
+
disabled: accepting || saving || missingType > 0 || missingProduct > 0 || missingUnit > 0 || unverifiedFactor > 0 || badReceipt > 0 || missingLocation > 0 || missingBatch > 0 || missingExpiry > 0,
|
|
1747
1822
|
children: [
|
|
1748
1823
|
accepting ? /* @__PURE__ */ jsx(Loader2, { className: "mr-1.5 h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsx(Check, { className: "mr-1.5 h-3.5 w-3.5" }),
|
|
1749
1824
|
hasPayable ? "Dar entrada no estoque" : "Aceitar"
|
|
@@ -1859,23 +1934,27 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
1859
1934
|
/* @__PURE__ */ jsx("span", { className: "mt-1 block text-[11px] text-muted-foreground", children: "Itens sem plano herdar\xE3o este." })
|
|
1860
1935
|
] }),
|
|
1861
1936
|
/* @__PURE__ */ jsxs("label", { className: "block", children: [
|
|
1862
|
-
/* @__PURE__ */
|
|
1937
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs font-medium text-muted-foreground", children: [
|
|
1938
|
+
t("fiscalbr.stock.location"),
|
|
1939
|
+
" \xB7 ",
|
|
1940
|
+
t("fiscalbr.stock.applyAll")
|
|
1941
|
+
] }),
|
|
1863
1942
|
/* @__PURE__ */ jsx(
|
|
1864
1943
|
SearchSelect,
|
|
1865
1944
|
{
|
|
1866
1945
|
onSearch: localSearch(locationOptions),
|
|
1867
1946
|
value: location ?? void 0,
|
|
1868
1947
|
displayValue: labelOf(locationOptions, location),
|
|
1869
|
-
onChange: (id) =>
|
|
1948
|
+
onChange: (id) => applyLocationToAll(id || null),
|
|
1870
1949
|
minChars: 0,
|
|
1871
|
-
placeholder: "
|
|
1872
|
-
noResultsLabel: "
|
|
1950
|
+
placeholder: t("fiscalbr.stock.applyAllPlaceholder"),
|
|
1951
|
+
noResultsLabel: t("fiscalbr.stock.noLocations"),
|
|
1873
1952
|
searchingLabel: "Buscando\u2026",
|
|
1874
1953
|
clearLabel: "Limpar",
|
|
1875
1954
|
disabled: readOnly
|
|
1876
1955
|
}
|
|
1877
1956
|
),
|
|
1878
|
-
/* @__PURE__ */ jsx("span", { className: "mt-1 block text-[11px] text-muted-foreground", children: "
|
|
1957
|
+
/* @__PURE__ */ jsx("span", { className: "mt-1 block text-[11px] text-muted-foreground", children: t("fiscalbr.stock.applyAllHint") })
|
|
1879
1958
|
] })
|
|
1880
1959
|
] })
|
|
1881
1960
|
] }),
|
|
@@ -2138,6 +2217,14 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
2138
2217
|
displayValue: d.productLabel || void 0,
|
|
2139
2218
|
onChange: (id, option) => {
|
|
2140
2219
|
patch(item.id, { productId: id || null, productLabel: option?.label ?? "" });
|
|
2220
|
+
if (id) {
|
|
2221
|
+
void getProductStockDefaults(note.id, [id]).then((m) => {
|
|
2222
|
+
setStockDefaults((prev) => new Map([...prev, ...m]));
|
|
2223
|
+
const own = m.get(id)?.locationId;
|
|
2224
|
+
if (own) setDrafts((prev) => ({ ...prev, [item.id]: { ...prev[item.id], stockLocationId: own } }));
|
|
2225
|
+
}).catch(() => {
|
|
2226
|
+
});
|
|
2227
|
+
}
|
|
2141
2228
|
if (id && !d.stockUnitId) {
|
|
2142
2229
|
void listProductStockUnits([id]).then((m) => {
|
|
2143
2230
|
setProductUnits((prev) => new Map([...prev, ...m]));
|
|
@@ -2228,23 +2315,57 @@ function NoteReconcileView({ noteId, onBack, onOpenInvoice, chrome = "page" }) {
|
|
|
2228
2315
|
/* @__PURE__ */ jsx("span", { className: "tabular-nums", children: money2(unitCost) })
|
|
2229
2316
|
] })
|
|
2230
2317
|
] }),
|
|
2231
|
-
/* @__PURE__ */
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
/* @__PURE__ */
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2318
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: /* @__PURE__ */ jsx(
|
|
2319
|
+
EmBreve,
|
|
2320
|
+
{
|
|
2321
|
+
label: "Criar produto daqui",
|
|
2322
|
+
o_que: "Cadastrar o produto a partir desta linha da nota, com nome, c\xF3digo e unidade j\xE1 preenchidos",
|
|
2323
|
+
quantas: "ela criou 33 produtos no V1 no meio de importa\xE7\xF5es"
|
|
2324
|
+
}
|
|
2325
|
+
) }),
|
|
2326
|
+
!item.stockMovementId && /* @__PURE__ */ jsxs("div", { className: "space-y-3 rounded-md border p-3", "data-testid": "item-stock-entry", children: [
|
|
2327
|
+
/* @__PURE__ */ jsxs("label", { className: "block", children: [
|
|
2328
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: t("fiscalbr.stock.location") }),
|
|
2329
|
+
/* @__PURE__ */ jsx(
|
|
2330
|
+
SearchSelect,
|
|
2331
|
+
{
|
|
2332
|
+
onSearch: localSearch(locationOptions),
|
|
2333
|
+
value: d.stockLocationId ?? void 0,
|
|
2334
|
+
displayValue: labelOf(locationOptions, d.stockLocationId),
|
|
2335
|
+
onChange: (id) => patch(item.id, { stockLocationId: id || null }),
|
|
2336
|
+
minChars: 0,
|
|
2337
|
+
placeholder: t("fiscalbr.stock.locationPlaceholder"),
|
|
2338
|
+
noResultsLabel: t("fiscalbr.stock.noLocations"),
|
|
2339
|
+
searchingLabel: "Buscando\u2026",
|
|
2340
|
+
clearLabel: "Limpar",
|
|
2341
|
+
disabled: readOnly
|
|
2342
|
+
}
|
|
2343
|
+
),
|
|
2344
|
+
/* @__PURE__ */ jsx("span", { className: "mt-1 block text-[11px] text-muted-foreground", children: !d.stockLocationId ? t("fiscalbr.stock.locationChoose") : d.productId && stockDefaults.get(d.productId)?.locationId === d.stockLocationId ? t("fiscalbr.stock.locationFromProduct") : null })
|
|
2345
|
+
] }),
|
|
2346
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
2347
|
+
/* @__PURE__ */ jsxs("label", { className: "block", children: [
|
|
2348
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: d.productId && stockDefaults.get(d.productId)?.requireBatch ? t("fiscalbr.stock.required", { field: t("fiscalbr.stock.batch") }) : t("fiscalbr.stock.batch") }),
|
|
2349
|
+
/* @__PURE__ */ jsx(
|
|
2350
|
+
Input,
|
|
2351
|
+
{
|
|
2352
|
+
value: d.batchNumber,
|
|
2353
|
+
onChange: (e) => patch(item.id, { batchNumber: e.target.value }),
|
|
2354
|
+
disabled: readOnly
|
|
2355
|
+
}
|
|
2356
|
+
)
|
|
2357
|
+
] }),
|
|
2358
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2359
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: d.productId && stockDefaults.get(d.productId)?.requireExpiry ? t("fiscalbr.stock.required", { field: t("fiscalbr.stock.expiry") }) : t("fiscalbr.stock.expiry") }),
|
|
2360
|
+
/* @__PURE__ */ jsx(
|
|
2361
|
+
DatePicker,
|
|
2362
|
+
{
|
|
2363
|
+
value: d.expirationDate,
|
|
2364
|
+
onChange: (v) => patch(item.id, { expirationDate: v })
|
|
2365
|
+
}
|
|
2366
|
+
)
|
|
2367
|
+
] })
|
|
2368
|
+
] })
|
|
2248
2369
|
] }),
|
|
2249
2370
|
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-3", children: /* @__PURE__ */ jsxs("label", { className: "block", children: [
|
|
2250
2371
|
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Modo de custo" }),
|
|
@@ -2452,6 +2573,6 @@ function Field({ label, value, mono, small }) {
|
|
|
2452
2573
|
] });
|
|
2453
2574
|
}
|
|
2454
2575
|
|
|
2455
|
-
export { NfeParseError, NoteReconcileView, PullByKeyDialog, PullByKeyError, STOCK_BEARING_ENTRY_TYPES, acceptNote, addNoteAttachment, extractPaymentCode, fillInboxLines, findInboxNoteByNumber, findInboxNoteByOperation, getInboxIntakeHealth, getInboxNote, getInboxNotePdf, getInboxNoteXml, getNotePayable, healInboxNote, isStockBearing, linkInboxSupplier, listChartAccountNodes, listChartAccounts, listInboxNotes, listMeasurementUnits, listNoteAttachments, listProductStockUnits, listProductsByIds, listStockLocations, listSupplierMap, moveNoteAttachmentsToInvoice, onlyDigits, parseNfeXml, paymentLabel, paymentTypeFromCode, pullNoteByKey, rejectNote, removeNoteAttachment, saveNoteDecision, searchProducts, stageNoteFromXml, suggestNoteItems, syncNewNotes, toStagePayload };
|
|
2456
|
-
//# sourceMappingURL=chunk-
|
|
2457
|
-
//# sourceMappingURL=chunk-
|
|
2576
|
+
export { NfeParseError, NoteReconcileView, PullByKeyDialog, PullByKeyError, STOCK_BEARING_ENTRY_TYPES, acceptNote, addNoteAttachment, extractPaymentCode, fillInboxLines, findInboxNoteByNumber, findInboxNoteByOperation, getInboxIntakeHealth, getInboxNote, getInboxNotePdf, getInboxNoteXml, getNotePayable, getProductStockDefaults, healInboxNote, isStockBearing, linkInboxSupplier, listChartAccountNodes, listChartAccounts, listInboxNotes, listMeasurementUnits, listNoteAttachments, listProductStockUnits, listProductsByIds, listStockLocations, listSupplierMap, moveNoteAttachmentsToInvoice, onlyDigits, parseNfeXml, paymentLabel, paymentTypeFromCode, pullNoteByKey, rejectNote, removeNoteAttachment, saveNoteDecision, searchProducts, stageNoteFromXml, suggestNoteItems, syncNewNotes, toStagePayload };
|
|
2577
|
+
//# sourceMappingURL=chunk-X7X57O7P.js.map
|
|
2578
|
+
//# sourceMappingURL=chunk-X7X57O7P.js.map
|