@feedmepos/mf-inventory-portal 1.8.0-dev.19 → 1.8.0-dev.20
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/{App-BXDscpMf.js → App-5GYyCfFq.js} +9 -9
- package/dist/{ApprovalView-CbP2H_8q.js → ApprovalView-DY1ayl1W.js} +9 -9
- package/dist/{BindingsDialog-C7OFDUAr.js → BindingsDialog-Dm7uKMfV.js} +2 -2
- package/dist/{BindingsPicker-BQjHQWPl.js → BindingsPicker-DhnMlj4x.js} +2 -2
- package/dist/{BindingsTable-grJZdI5F.js → BindingsTable-Cxibcjka.js} +4 -4
- package/dist/{BulkReceiveRequestPage-jZtPq5XF.js → BulkReceiveRequestPage-w4AA6BxB.js} +21 -21
- package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DOgwkHnO.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-B3ESPbQp.js} +1 -1
- package/dist/{ClosingDraftView-UmNAyX_s.js → ClosingDraftView-DMaONEZ7.js} +19 -19
- package/dist/{ClosingHistoryView-CZcOYK98.js → ClosingHistoryView-BBYruOux.js} +7 -7
- package/dist/{ClosingTemplateView-CP2-ib2S.js → ClosingTemplateView-DcwgokRl.js} +18 -18
- package/dist/{CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-DYZjiuAH.js → CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-a72IldDO.js} +1 -1
- package/dist/{DefaultView-DOa4PWSU.js → DefaultView-BVr_7JDn.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-DtFuSUby.js → DeliveryOrderPrintPreview-BXZFD3D5.js} +2 -2
- package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-CxsxIwZm.js → EmailDialog.vue_vue_type_script_setup_true_lang-Dne_9P3j.js} +25 -25
- package/dist/{FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-B3mPB7-O.js → FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-CYkPbFSA.js} +1 -1
- package/dist/FeatureCapabilityGate-DK_rTVyJ.js +82 -0
- package/dist/{FeaturePageGate.vue_vue_type_script_setup_true_lang-O58GGptu.js → FeaturePageGate.vue_vue_type_script_setup_true_lang-DIhV51l7.js} +1 -1
- package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-CCrEBis5.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-B80EHMBT.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-YGOFZ7uY.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-C94IFGoH.js} +2 -2
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-F36jHbKZ.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-COZPDuAM.js} +2 -2
- package/dist/{FmMultiselectDialog-BDCQmCSh.js → FmMultiselectDialog-C1P22sj2.js} +2 -2
- package/dist/{FmMultiselectDialog-Dd9oKz5m.js → FmMultiselectDialog-Kb3IftHf.js} +2 -2
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-CUmlLKDV.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BqB71yfu.js} +5 -5
- package/dist/ImportView-EJ4u8NHM.js +1540 -0
- package/dist/{IngredientsView-Bcxo5AlS.js → IngredientsView-Bxsgm4E7.js} +15 -15
- package/dist/{IntegrationExplorerView-C2jsPi_3.js → IntegrationExplorerView-owEaOVeG.js} +6 -6
- package/dist/{IntegrationPlatformView-Cr7Fyt4p.js → IntegrationPlatformView-BuptPyjg.js} +2 -2
- package/dist/{IntegrationView-BTcnK-_q.js → IntegrationView-DAcdY_d_.js} +14 -14
- package/dist/{InventoryBindingForm-e1rSW4FA.js → InventoryBindingForm-BvjY4zrn.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BjDz4LFE.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DhbF-jgN.js} +4 -4
- package/dist/{InventoryBindingSummary-CAGMRuy4.js → InventoryBindingSummary-DPqm94GX.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-eygCK9vN.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DDsigNJ4.js} +2 -2
- package/dist/{ProductionRunDetailPage-CQz-U7Sw.js → ProductionRunDetailPage-BaPCJUqT.js} +4 -4
- package/dist/{ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-BtnKFZy2.js → ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-CNRX3MYt.js} +8 -8
- package/dist/{ProductionRunPage-BZnmoyLo.js → ProductionRunPage-B6Jsv9Hh.js} +4 -4
- package/dist/{PublishView-BJFoRmsD.js → PublishView-DonUv6nP.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-BQExGk_A.js → PurchaseOrderPrintPreview-CK3Cqdwp.js} +2 -2
- package/dist/{ReceiveRequestView-C4XUYhl5.js → ReceiveRequestView-CMAnKxzm.js} +13 -13
- package/dist/RecipeView-Bx13Bckq.js +3272 -0
- package/dist/{SettingsView-BDogzqxV.js → SettingsView-D1MiAkD8.js} +397 -425
- package/dist/StockView-CsxTjVEd.js +3003 -0
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Ce82k1-V.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BT73j9SA.js} +1 -1
- package/dist/{SupplierView-DRSh4m07.js → SupplierView-CFACoZya.js} +13 -13
- package/dist/{SurchargeView-gNIDCY22.js → SurchargeView-CShhZa3x.js} +7 -7
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-DrP1vAZX.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-B2OdmdI_.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Cxpc2Wtp.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-x3N2Oypo.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-D4kpyIAQ.js → TransferDetails.vue_vue_type_script_setup_true_lang-BISmGBJE.js} +517 -517
- package/dist/{TransferTemplateView-adEB_aZg.js → TransferTemplateView-kx2IPqEv.js} +19 -19
- package/dist/{UnitCostHistoryView-ClgafUAg.js → UnitCostHistoryView-DgPWsXaB.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-DpN-7H9P.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-BtfJJgIP.js} +4 -4
- package/dist/{UnitView-DU-Kim1r.js → UnitView-aupXLRMk.js} +7 -7
- package/dist/{WarehouseView-Dw1xkcrx.js → WarehouseView-MTvbY4n4.js} +8 -8
- package/dist/{WastageTemplateView-CQj821yg.js → WastageTemplateView-Bs9HL-LK.js} +15 -15
- package/dist/api/bill.d.ts +4 -2
- package/dist/api/bill.spec.d.ts +1 -0
- package/dist/api/closing.d.ts +1 -0
- package/dist/api/feature-flags.d.ts +2 -0
- package/dist/api/license.d.ts +0 -1
- package/dist/api/stock.d.ts +1 -1
- package/dist/{app--e70sT_h.js → app-D38sV2ls.js} +2286 -2147
- package/dist/app.d.ts +92 -8
- package/dist/app.js +1 -1
- package/dist/bulk-edit-simulation.helper-DgniL8FN.js +178 -0
- package/dist/{closing-template-i0bDCk-x.js → closing-template-D_NAj_mU.js} +1 -1
- package/dist/{date2-CXI-d_rQ.js → date2-CvgxwuM1.js} +1 -1
- package/dist/{dayjs.min-Ivf4HAC3.js → dayjs.min-BOKV8T5Q.js} +1 -1
- package/dist/{decimal-d3XWw4d_.js → decimal-5xyg1WLu.js} +2 -2
- package/dist/{defineDeepModel-DrQmqGvi.js → defineDeepModel-BwB9XcMu.js} +1 -1
- package/dist/{duplicate-template-yVd6JWGz.js → duplicate-template-DvIgjm4K.js} +1 -1
- package/dist/{feature-CBrHj9bO.js → feature-CsPbMoeJ.js} +231 -221
- package/dist/{format-time-from-id-DpFUCBGw.js → format-time-from-id-DD6Ik9EK.js} +1 -1
- package/dist/{format-unit-display-CICNepRU.js → format-unit-display-DG564AN3.js} +12 -12
- package/dist/helper/country.spec.d.ts +1 -0
- package/dist/{id-to-date-BicEvFx1.js → id-to-date-DoN7OM21.js} +1 -1
- package/dist/{import-export.helper-Cy-nm8Ao.js → import-export.helper-CevBRFTZ.js} +6 -5
- package/dist/{index-CiWNQMAX.js → index-BIh1oTQH.js} +3 -3
- package/dist/{index-BfY6L-3r.js → index-BP3Avix6.js} +1 -1
- package/dist/{index-W7Q7cZGV.js → index-mzXhLwrZ.js} +1 -1
- package/dist/{lz-string-ClJ0qg4U.js → lz-string-DMjWYCk6.js} +1 -1
- package/dist/{netsuite-jSt2nlwO.js → netsuite-ZtoZBFBX.js} +2 -2
- package/dist/{netsuite-explorer-BWrO3KfB.js → netsuite-explorer-h_vID_ao.js} +1 -1
- package/dist/{predefined-templates-DKiqLY6F.js → predefined-templates-CdurFRJ4.js} +1 -1
- package/dist/{purchase-order-template-D-NkhbNh.js → purchase-order-template-BVdCftEo.js} +1 -1
- package/dist/{recalculationUtils-Bbe1w-wj.js → recalculationUtils-DBG8HGiJ.js} +1 -1
- package/dist/{row-action.enum-C8JhgYiR.js → row-action.enum-CGyAg4dC.js} +1 -1
- package/dist/{rules-CrAeAKSS.js → rules-DbFiOzUd.js} +3 -3
- package/dist/{stock-x072pQVW.js → stock-BATH4SoA.js} +1 -1
- package/dist/{stock-B27nWQ5z.js → stock-DXxsDPEO.js} +2 -2
- package/dist/stores/feature.d.ts +4 -0
- package/dist/style.css +1 -1
- package/dist/{supplier-sh98cdAW.js → supplier-CKXQmBZn.js} +2 -2
- package/dist/{surcharge-DsF53Jiz.js → surcharge-qupRJjjO.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{uom-rules-DuYrxEZK.js → uom-rules-ALtgjANX.js} +1 -1
- package/dist/{use-ingredient-select-dialog-DZJPaYJX.js → use-ingredient-select-dialog-C1sJpjfV.js} +2 -2
- package/dist/{use-inventory-binding-dialog-CEr-Nctj.js → use-inventory-binding-dialog-tl7-epun.js} +2 -2
- package/dist/{use-template-enabled-locations-h-1Om4op.js → use-template-enabled-locations-DWk2ndDC.js} +2 -2
- package/dist/{use-transfer-locations-CuCYcO6G.js → use-transfer-locations-CsdYY996.js} +2 -2
- package/dist/{useHrmPermission-Db-rrPU-.js → useHrmPermission-BtuqUrwj.js} +1 -1
- package/dist/{useNavigationMenu-DJCT15IW.js → useNavigationMenu-DKxKXykI.js} +4 -4
- package/dist/{useSseClient-B2_SvHJ2.js → useSseClient-CRfpltKK.js} +1 -1
- package/dist/views/import/helper/submit-rows.d.ts +1 -1
- package/dist/views/integration/components/IntegrationCard.vue.d.ts +3 -3
- package/dist/views/production-run/features/detail/ProductionRunItemsTable.vue.d.ts +2 -2
- package/dist/views/recipe/helper/import-recipe.d.ts +30 -0
- package/dist/views/settings/PlanLicenseDisplay.vue.d.ts +1 -14
- package/dist/views/stock/components/StockRecordCard.spec.d.ts +1 -0
- package/dist/views/stock/components/StockRecordCard.vue.d.ts +3 -863
- package/dist/views/stock/components/dialog/BillInventoryInfoDialog.spec.d.ts +1 -0
- package/dist/views/stock/components/dialog/BillInventoryInfoDialog.vue.d.ts +36 -0
- package/dist/views/stock/composables/use-last-closing-summary.d.ts +4 -0
- package/dist/views/stock/composables/use-last-closing-summary.spec.d.ts +1 -0
- package/dist/{vue-Co39mHJn.js → vue-CVco8McV.js} +2 -2
- package/dist/{vue-i18n-C2pkD_vQ.js → vue-i18n-C443zpcA.js} +280 -280
- package/dist/{xlsx.util-CLUjDX2E.js → xlsx.util-5_47Kslf.js} +2 -2
- package/package.json +2 -2
- package/dist/FeatureCapabilityGate-Dp_SfIlO.js +0 -77
- package/dist/ImportView-CbRrxlrW.js +0 -1290
- package/dist/RecipeView-Bd5--ENI.js +0 -3440
- package/dist/StockView-BCWwamwk.js +0 -2756
|
@@ -1,1290 +0,0 @@
|
|
|
1
|
-
import { defineComponent as Me, ref as $, computed as J, watch as De, resolveComponent as Y, createElementBlock as D, openBlock as C, createVNode as A, createCommentVNode as Z, unref as l, normalizeClass as ve, createSlots as Be, withCtx as Q, createElementVNode as n, createBlock as ae, toDisplayString as m, Fragment as Te, renderList as Ue, shallowRef as Ce, h as _e, createTextVNode as S } from "vue";
|
|
2
|
-
import { u as je, _ as Se } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DpwneGOV.js";
|
|
3
|
-
import { useCoreStore as ke, useI18n as Fe } from "@feedmepos/mf-common";
|
|
4
|
-
import { useDialogChild as Pe, useSnackbar as $e, useDialog as ze, useBreakpoints as He } from "@feedmepos/ui-library";
|
|
5
|
-
import { u as Ve } from "./feature-CBrHj9bO.js";
|
|
6
|
-
import { a as le, s as We } from "./app--e70sT_h.js";
|
|
7
|
-
import "./dayjs.min-Ivf4HAC3.js";
|
|
8
|
-
import "./app-C39bYJmq.js";
|
|
9
|
-
import "./FmAdminBadge-DlplQOHb.js";
|
|
10
|
-
import { s as Ge, a as Oe, d as Le, t as Re, r as Ke } from "./xlsx.util-CLUjDX2E.js";
|
|
11
|
-
import { s as Je, g as qe, b as Xe, d as Ne } from "./import-export.helper-Cy-nm8Ao.js";
|
|
12
|
-
import { s as Qe, a as Ee } from "./rules-CrAeAKSS.js";
|
|
13
|
-
import { F as Ye } from "./FmDroppableField-J0tG_U3w.js";
|
|
14
|
-
function* Ze(h) {
|
|
15
|
-
for (; ; )
|
|
16
|
-
yield h[Math.floor(Math.random() * h.length)];
|
|
17
|
-
}
|
|
18
|
-
function et(h = 4, e = Ze("qwertyuiopasdfghjklzxcvbnm".split(""))) {
|
|
19
|
-
return Array.from({ length: h }).map(() => e.next().value).join("");
|
|
20
|
-
}
|
|
21
|
-
function we() {
|
|
22
|
-
return `measurement_${(/* @__PURE__ */ new Date()).toISOString()}_${et()}`;
|
|
23
|
-
}
|
|
24
|
-
function tt(h) {
|
|
25
|
-
const [
|
|
26
|
-
e,
|
|
27
|
-
k,
|
|
28
|
-
p,
|
|
29
|
-
g,
|
|
30
|
-
w,
|
|
31
|
-
b,
|
|
32
|
-
...r
|
|
33
|
-
] = Ge(h);
|
|
34
|
-
if (!e || !e.length || e.some((d) => d.length && !d.startsWith("system:")))
|
|
35
|
-
throw new Error("Missing meta header. Excel file does not come from the template.");
|
|
36
|
-
const i = e.map((d) => d.split(":")[1]), y = ["name", "symbol", "precision"].filter((d) => !i.includes(d));
|
|
37
|
-
if (y.length)
|
|
38
|
-
throw new Error(
|
|
39
|
-
`Missing meta headers (${y.join()}). Excel file does not come from the template.`
|
|
40
|
-
);
|
|
41
|
-
return r.map((d, f) => {
|
|
42
|
-
const o = {};
|
|
43
|
-
for (const a in i) {
|
|
44
|
-
const v = i[a];
|
|
45
|
-
Object.assign(o, { [v]: d[a] });
|
|
46
|
-
}
|
|
47
|
-
return {
|
|
48
|
-
index: f,
|
|
49
|
-
data: o
|
|
50
|
-
};
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
function nt(h) {
|
|
54
|
-
try {
|
|
55
|
-
const e = tt(h).filter((r) => {
|
|
56
|
-
const { name: i, symbol: s, precision: y, measurement_name: c, measurement_symbol: d, measurement_conversion: f } = r.data;
|
|
57
|
-
return i || s || y || c || d || f;
|
|
58
|
-
}), p = le().units, g = [], w = [], b = {};
|
|
59
|
-
for (const r of e)
|
|
60
|
-
if (r.data.name && r.data.symbol)
|
|
61
|
-
b[r.data.name] = {
|
|
62
|
-
unit: {
|
|
63
|
-
name: r.data.name,
|
|
64
|
-
abbrev: r.data.symbol,
|
|
65
|
-
precision: Math.max(0, Math.min(10, Math.floor(r.data.precision || 2))),
|
|
66
|
-
measurements: []
|
|
67
|
-
},
|
|
68
|
-
rowNumber: r.index
|
|
69
|
-
}, r.data.measurement_name && r.data.measurement_symbol && r.data.measurement_conversion && b[r.data.name].unit.measurements.push({
|
|
70
|
-
id: we(),
|
|
71
|
-
name: r.data.measurement_name,
|
|
72
|
-
abbrev: r.data.measurement_symbol,
|
|
73
|
-
conversion: {
|
|
74
|
-
amount: Math.round(r.data.measurement_conversion * Math.pow(10, b[r.data.name].unit.precision)),
|
|
75
|
-
precision: b[r.data.name].unit.precision
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
else {
|
|
79
|
-
const i = Object.keys(b)[Object.keys(b).length - 1];
|
|
80
|
-
i && b[i] && r.data.measurement_name && r.data.measurement_symbol && r.data.measurement_conversion && b[i].unit.measurements.push({
|
|
81
|
-
id: we(),
|
|
82
|
-
name: r.data.measurement_name,
|
|
83
|
-
abbrev: r.data.measurement_symbol,
|
|
84
|
-
conversion: {
|
|
85
|
-
amount: Math.round(r.data.measurement_conversion * Math.pow(10, b[i].unit.precision)),
|
|
86
|
-
precision: b[i].unit.precision
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
for (const [r, { unit: i, rowNumber: s }] of Object.entries(b)) {
|
|
91
|
-
const y = p.find((c) => {
|
|
92
|
-
var d, f;
|
|
93
|
-
return c.abbrev === i.abbrev && ((d = c.name) == null ? void 0 : d.trim()) === ((f = i.name) == null ? void 0 : f.trim());
|
|
94
|
-
});
|
|
95
|
-
y ? w.push({
|
|
96
|
-
type: "update",
|
|
97
|
-
original: y,
|
|
98
|
-
unit: {
|
|
99
|
-
...y,
|
|
100
|
-
name: i.name || y.name,
|
|
101
|
-
abbrev: i.abbrev || y.abbrev,
|
|
102
|
-
precision: i.precision !== void 0 ? i.precision : y.precision,
|
|
103
|
-
measurements: i.measurements.map((c) => {
|
|
104
|
-
const d = y.measurements.find((f) => f.name === c.name && f.abbrev === c.abbrev);
|
|
105
|
-
return d ? { ...d, ...c, id: d.id } : { ...c, id: we() };
|
|
106
|
-
})
|
|
107
|
-
},
|
|
108
|
-
errors: [],
|
|
109
|
-
excelRowNumber: s
|
|
110
|
-
}) : g.push({
|
|
111
|
-
type: "create",
|
|
112
|
-
unit: {
|
|
113
|
-
...i,
|
|
114
|
-
measurements: i.measurements.map((c) => ({ ...c, id: we() }))
|
|
115
|
-
},
|
|
116
|
-
errors: [],
|
|
117
|
-
excelRowNumber: s
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
return {
|
|
121
|
-
invalidExcel: !1,
|
|
122
|
-
importCreateResult: g,
|
|
123
|
-
importUpdateResult: w
|
|
124
|
-
};
|
|
125
|
-
} catch (e) {
|
|
126
|
-
return {
|
|
127
|
-
invalidExcel: !0,
|
|
128
|
-
invalidExcelMessage: (e == null ? void 0 : e.message) ?? "Invalid excel",
|
|
129
|
-
importCreateResult: [],
|
|
130
|
-
importUpdateResult: []
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
function ot(h, { ignoreErrors: e = !1 } = {}) {
|
|
135
|
-
var k;
|
|
136
|
-
try {
|
|
137
|
-
const p = le(), g = p.skuByCode, w = p.recipeByName, b = p.units, r = [], i = {};
|
|
138
|
-
for (const o of h) {
|
|
139
|
-
const a = [];
|
|
140
|
-
let v = "";
|
|
141
|
-
if (o.data.type === "INGREDIENT") {
|
|
142
|
-
const E = g[o.data.code];
|
|
143
|
-
E ? v = E._id : a.push(`Ingredient with code '${o.data.code}' not found`);
|
|
144
|
-
} else if (o.data.type === "RECIPE") {
|
|
145
|
-
const E = w[o.data.name];
|
|
146
|
-
E ? v = E._id : a.push(`Recipe with name '${o.data.name}' not found`);
|
|
147
|
-
} else
|
|
148
|
-
a.push(`Invalid type '${o.data.type}'. Must be 'INGREDIENT' or 'RECIPE'`);
|
|
149
|
-
const G = !!o.data.amount && Qe(o.data.amount);
|
|
150
|
-
G || a.push(`Invalid amount '${o.data.amount}'. Must be a valid number`);
|
|
151
|
-
let B;
|
|
152
|
-
if ((o.data.unit || o.data.baseUnit) && o.data.type !== "RECIPE" && (B = b.find((E) => {
|
|
153
|
-
var T, U;
|
|
154
|
-
return E.abbrev === o.data.baseUnit && ((T = E.name) == null ? void 0 : T.trim()) === ((U = o.data.unit) == null ? void 0 : U.trim());
|
|
155
|
-
}), B || (o.data.baseUnit && o.data.unit ? a.push(`Cannot find unit with symbol '${o.data.baseUnit}' and name '${o.data.unit}'`) : o.data.baseUnit ? a.push(`Cannot find unit with symbol '${o.data.baseUnit}'`) : o.data.unit && a.push(`Cannot find unit with name '${o.data.unit}'`))), a.length > 0 && r.push(`Row ${o.index + 6}: ${a.join(", ")}`), e || a.length === 0) {
|
|
156
|
-
let E;
|
|
157
|
-
o.data.type === "RECIPE" ? E = void 0 : E = (k = B == null ? void 0 : B.measurements) == null ? void 0 : k.find((F) => F.abbrev === o.data.measurementName);
|
|
158
|
-
const T = G ? {
|
|
159
|
-
type: o.data.type === "INGREDIENT" ? "SKU" : o.data.type,
|
|
160
|
-
id: v,
|
|
161
|
-
amount: We.fromNumber(+o.data.amount),
|
|
162
|
-
measurement: E || void 0
|
|
163
|
-
} : null, U = a.length > 0 ? `Row ${o.index + 6}: ${a.join(", ")}` : null;
|
|
164
|
-
if (o.data.recipeName)
|
|
165
|
-
i[o.data.recipeName] = {
|
|
166
|
-
name: o.data.recipeName,
|
|
167
|
-
customAttributes: o.data.customAttributes ? Je(o.data.customAttributes) : {},
|
|
168
|
-
contains: T ? [T] : []
|
|
169
|
-
}, r[o.data.recipeName] = U ?? [];
|
|
170
|
-
else {
|
|
171
|
-
const F = Object.keys(i)[Object.keys(i).length - 1];
|
|
172
|
-
if (F && i[F]) {
|
|
173
|
-
i[F] = {
|
|
174
|
-
...i[F],
|
|
175
|
-
contains: T ? [...i[F].contains, T] : i[F].contains
|
|
176
|
-
};
|
|
177
|
-
const ee = r[F], oe = typeof ee == "string" && ee.length > 0;
|
|
178
|
-
U ? r[F] = oe ? `${ee}, ${U}` : U : oe || (r[F] = []);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
const s = Object.values(i), y = s.filter((o) => !w[o.name]), c = s.filter((o) => w[o.name]), d = y.map((o, a) => ({
|
|
184
|
-
type: "create",
|
|
185
|
-
recipe: o,
|
|
186
|
-
// Type assertion - _id will be assigned by backend
|
|
187
|
-
errors: r[o.name],
|
|
188
|
-
excelRowNumber: a + 6
|
|
189
|
-
// Assuming header rows
|
|
190
|
-
})), f = c.map((o, a) => {
|
|
191
|
-
const v = w[o.name];
|
|
192
|
-
return {
|
|
193
|
-
type: "update",
|
|
194
|
-
original: v,
|
|
195
|
-
recipe: {
|
|
196
|
-
...v,
|
|
197
|
-
name: o.name || v.name,
|
|
198
|
-
contains: o.contains.length > 0 ? o.contains : v.contains,
|
|
199
|
-
customAttributes: o.customAttributes || v.customAttributes
|
|
200
|
-
},
|
|
201
|
-
errors: r[o.name],
|
|
202
|
-
excelRowNumber: a + 6
|
|
203
|
-
};
|
|
204
|
-
});
|
|
205
|
-
return {
|
|
206
|
-
invalidExcel: r.length > 0,
|
|
207
|
-
invalidExcelMessage: r.length > 0 ? `Import completed with ${r.length} error(s): ${r.join("; ")}` : void 0,
|
|
208
|
-
importCreateResult: d,
|
|
209
|
-
importUpdateResult: f
|
|
210
|
-
};
|
|
211
|
-
} catch (p) {
|
|
212
|
-
return {
|
|
213
|
-
invalidExcel: !0,
|
|
214
|
-
invalidExcelMessage: p instanceof Error ? p.message : "Unknown error occurred",
|
|
215
|
-
importCreateResult: [],
|
|
216
|
-
importUpdateResult: []
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
function rt(h) {
|
|
221
|
-
const [
|
|
222
|
-
e,
|
|
223
|
-
k,
|
|
224
|
-
p,
|
|
225
|
-
g,
|
|
226
|
-
w,
|
|
227
|
-
b,
|
|
228
|
-
...r
|
|
229
|
-
] = Ge(h);
|
|
230
|
-
if (!e || !e.length || e.some((d) => d.length && !d.startsWith("system:")))
|
|
231
|
-
throw new Error("Missing meta header. Excel file does not come from the template.");
|
|
232
|
-
const i = e.map((d) => d.split(":")[1]), y = ["code", "recipeName", "unit", "baseUnit", "type", "amount"].filter((d) => !i.includes(d));
|
|
233
|
-
if (y.length)
|
|
234
|
-
throw new Error(
|
|
235
|
-
`Missing meta headers (${y.join()}). Excel file does not come from the template.`
|
|
236
|
-
);
|
|
237
|
-
return r.map((d, f) => {
|
|
238
|
-
const o = {};
|
|
239
|
-
for (const a in i) {
|
|
240
|
-
const v = i[a];
|
|
241
|
-
Object.assign(o, { [v]: d[a] });
|
|
242
|
-
}
|
|
243
|
-
return {
|
|
244
|
-
index: f,
|
|
245
|
-
data: o
|
|
246
|
-
};
|
|
247
|
-
}).filter((d) => {
|
|
248
|
-
const { recipeName: f, type: o, code: a, name: v, amount: G, unit: B, baseUnit: E, measurementName: T, customAttributes: U } = d.data;
|
|
249
|
-
return f || o || a || v || G || B || E || T || U;
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
function st() {
|
|
253
|
-
const e = ke().currentBusiness.value, k = le(), p = [
|
|
254
|
-
{ id: "name", name: "Unit Name" },
|
|
255
|
-
{ id: "symbol", name: "Symbol" },
|
|
256
|
-
{ id: "precision", name: "Precision" },
|
|
257
|
-
{ id: "measurement_name", name: "Measurement Symbol" },
|
|
258
|
-
{ id: "measurement_symbol", name: "Measurement Symbol" },
|
|
259
|
-
{ id: "measurement_conversion", name: "Measurement Conversion" }
|
|
260
|
-
];
|
|
261
|
-
let g = [];
|
|
262
|
-
k.units.length > 0 ? k.units.forEach((r) => {
|
|
263
|
-
if (r.measurements.length === 0)
|
|
264
|
-
g.push([
|
|
265
|
-
r.name,
|
|
266
|
-
r.abbrev,
|
|
267
|
-
r.precision,
|
|
268
|
-
"",
|
|
269
|
-
"",
|
|
270
|
-
""
|
|
271
|
-
]);
|
|
272
|
-
else {
|
|
273
|
-
g.push([
|
|
274
|
-
r.name,
|
|
275
|
-
r.abbrev,
|
|
276
|
-
r.precision,
|
|
277
|
-
r.measurements[0].name,
|
|
278
|
-
r.measurements[0].abbrev,
|
|
279
|
-
+Ee(r.measurements[0].conversion)
|
|
280
|
-
]);
|
|
281
|
-
for (let i = 1; i < r.measurements.length; i++)
|
|
282
|
-
g.push([
|
|
283
|
-
"",
|
|
284
|
-
"",
|
|
285
|
-
"",
|
|
286
|
-
r.measurements[i].name,
|
|
287
|
-
r.measurements[i].abbrev,
|
|
288
|
-
+Ee(r.measurements[i].conversion)
|
|
289
|
-
]);
|
|
290
|
-
}
|
|
291
|
-
}) : g = [
|
|
292
|
-
["Length", "m", 2, "Meter", "m", 1],
|
|
293
|
-
["", "", "", "Centimeter", "cm", 0.01],
|
|
294
|
-
["", "", "", "Millimeter", "mm", 1e-3],
|
|
295
|
-
["Weight", "kg", 3, "Kilogram", "kg", 1],
|
|
296
|
-
["", "", "", "Gram", "g", 1e-3],
|
|
297
|
-
["", "", "", "Pound", "lb", 0.453592]
|
|
298
|
-
];
|
|
299
|
-
const w = [
|
|
300
|
-
["Business name:", e == null ? void 0 : e.name],
|
|
301
|
-
["Business ID:", e == null ? void 0 : e._id],
|
|
302
|
-
["Menu version", e == null ? void 0 : e.menuVersion],
|
|
303
|
-
[],
|
|
304
|
-
p.map((r) => r.name),
|
|
305
|
-
...g
|
|
306
|
-
], b = p.map((r) => `system:${r.id}`);
|
|
307
|
-
return Re(w, b);
|
|
308
|
-
}
|
|
309
|
-
function it() {
|
|
310
|
-
const e = ke().currentBusiness.value, k = le(), p = Xe();
|
|
311
|
-
let g = [];
|
|
312
|
-
k.skus.length > 0 ? g = k.skus.map((r) => {
|
|
313
|
-
var i, s, y, c, d, f, o, a;
|
|
314
|
-
return [
|
|
315
|
-
r.code,
|
|
316
|
-
r.name,
|
|
317
|
-
((i = r.unit) == null ? void 0 : i.name) || "",
|
|
318
|
-
((s = r.unit) == null ? void 0 : s.abbrev) || "",
|
|
319
|
-
((c = (y = r.unit) == null ? void 0 : y.measurements.find((v) => v.id === r.trackingMeasurement)) == null ? void 0 : c.abbrev) ?? r.unit.abbrev,
|
|
320
|
-
r.valuation || "WAVG",
|
|
321
|
-
(d = r.defaultCost) != null && d.costPerUnit ? +Ee((f = r.defaultCost) == null ? void 0 : f.costPerUnit) : 0,
|
|
322
|
-
((o = r.thresholds) == null ? void 0 : o.low) ?? Ne().low,
|
|
323
|
-
((a = r.thresholds) == null ? void 0 : a.mid) ?? Ne().mid,
|
|
324
|
-
r.customAttributes ? Object.entries(r.customAttributes).map(([v, G]) => `${v}:${G}`).join("|") : ""
|
|
325
|
-
];
|
|
326
|
-
}) : g = [
|
|
327
|
-
["EXAMPLE_CODE", "Example Ingredient", "kg", "kg", "Unit Name", "WAVG", 10.5, 5, 10, ""]
|
|
328
|
-
];
|
|
329
|
-
const w = [
|
|
330
|
-
["Business name:", e == null ? void 0 : e.name],
|
|
331
|
-
["Business ID:", e == null ? void 0 : e._id],
|
|
332
|
-
["Menu version", e == null ? void 0 : e.menuVersion],
|
|
333
|
-
[],
|
|
334
|
-
p.map((r) => r.name),
|
|
335
|
-
...g
|
|
336
|
-
], b = p.map((r) => `system:${r.id}`);
|
|
337
|
-
return Re(w, b);
|
|
338
|
-
}
|
|
339
|
-
function at() {
|
|
340
|
-
const e = ke().currentBusiness.value, k = le(), p = [
|
|
341
|
-
{ id: "recipeName", name: "Recipe Name" },
|
|
342
|
-
{ id: "type", name: "Type" },
|
|
343
|
-
{ id: "code", name: "Code" },
|
|
344
|
-
{ id: "name", name: "Item Name" },
|
|
345
|
-
{ id: "amount", name: "Amount" },
|
|
346
|
-
{ id: "unit", name: "Unit" },
|
|
347
|
-
{ id: "baseUnit", name: "Unit Symbol" },
|
|
348
|
-
{ id: "measurementName", name: "Measurement Symbol" },
|
|
349
|
-
{ id: "customAttributes", name: "Custom Attributes" }
|
|
350
|
-
];
|
|
351
|
-
let g = [];
|
|
352
|
-
if (k.recipes.length > 0) {
|
|
353
|
-
const r = k.recipeById, i = k.skuById;
|
|
354
|
-
g = k.recipes.flatMap((s) => {
|
|
355
|
-
var c;
|
|
356
|
-
const y = s.customAttributes ? Object.entries(s.customAttributes).map(([d, f]) => `${d}:${f}`).join("|") : "";
|
|
357
|
-
if ((c = s.contains) != null && c.length) {
|
|
358
|
-
const d = s.contains.filter((o) => o.type === "RECIPE"), f = s.contains.filter((o) => o.type === "SKU");
|
|
359
|
-
return [
|
|
360
|
-
...d.map((o, a) => {
|
|
361
|
-
var v;
|
|
362
|
-
return [
|
|
363
|
-
a === 0 ? s.name : "",
|
|
364
|
-
"RECIPE",
|
|
365
|
-
"",
|
|
366
|
-
((v = r[o.id]) == null ? void 0 : v.name) || "",
|
|
367
|
-
o.amount.amount,
|
|
368
|
-
"",
|
|
369
|
-
"unit",
|
|
370
|
-
"Unit",
|
|
371
|
-
a === 0 ? y : ""
|
|
372
|
-
];
|
|
373
|
-
}),
|
|
374
|
-
...f.map((o, a) => {
|
|
375
|
-
var v, G, B, E, T, U, F, ee, oe, ye, ge, me, fe, ue, be, he;
|
|
376
|
-
return [
|
|
377
|
-
!d.length && a === 0 ? s.name : "",
|
|
378
|
-
"INGREDIENT",
|
|
379
|
-
((v = i[o.id]) == null ? void 0 : v.code) || "",
|
|
380
|
-
((G = i[o.id]) == null ? void 0 : G.name) || "",
|
|
381
|
-
+Ee(o.amount),
|
|
382
|
-
o.measurement ? ((E = (B = i[o.id]) == null ? void 0 : B.unit) == null ? void 0 : E.name) || "" : ((U = (T = i[o.id]) == null ? void 0 : T.unit) == null ? void 0 : U.name) || "",
|
|
383
|
-
o.measurement ? ((ee = (F = i[o.id]) == null ? void 0 : F.unit) == null ? void 0 : ee.abbrev) || "" : ((ye = (oe = i[o.id]) == null ? void 0 : oe.unit) == null ? void 0 : ye.abbrev) || "",
|
|
384
|
-
o.measurement ? o.measurement.abbrev : ((ue = (fe = (me = (ge = i[o.id]) == null ? void 0 : ge.unit) == null ? void 0 : me.measurements) == null ? void 0 : fe.find((Ie) => {
|
|
385
|
-
var xe;
|
|
386
|
-
return Ie.id === ((xe = i[o.id]) == null ? void 0 : xe.trackingMeasurement);
|
|
387
|
-
})) == null ? void 0 : ue.abbrev) || ((he = (be = i[o.id]) == null ? void 0 : be.unit) == null ? void 0 : he.abbrev) || "",
|
|
388
|
-
!d.length && a === 0 ? y : ""
|
|
389
|
-
];
|
|
390
|
-
})
|
|
391
|
-
];
|
|
392
|
-
}
|
|
393
|
-
return [];
|
|
394
|
-
});
|
|
395
|
-
} else
|
|
396
|
-
g = [
|
|
397
|
-
["Pizza Dough", "INGREDIENT", "FLOUR001", "Flour", "500", "Weight", "g", "Gram", "difficulty:easy, category:italian"],
|
|
398
|
-
["", "INGREDIENT", "WATER001", "Water", "300", "Volume", "ml", "Milliliter", ""],
|
|
399
|
-
["", "INGREDIENT", "SALT001", "Salt", "10", "Weight", "g", "Gram", ""]
|
|
400
|
-
];
|
|
401
|
-
const w = [
|
|
402
|
-
["Business name:", e == null ? void 0 : e.name],
|
|
403
|
-
["Business ID:", e == null ? void 0 : e._id],
|
|
404
|
-
["Menu version", e == null ? void 0 : e.menuVersion],
|
|
405
|
-
[],
|
|
406
|
-
p.map((r) => r.name),
|
|
407
|
-
...g
|
|
408
|
-
], b = p.map((r) => `system:${r.id}`);
|
|
409
|
-
return Re(w, b);
|
|
410
|
-
}
|
|
411
|
-
function lt() {
|
|
412
|
-
const h = Oe({
|
|
413
|
-
unit: st(),
|
|
414
|
-
ingredient: it(),
|
|
415
|
-
recipe: at()
|
|
416
|
-
}), e = "FeedMe comprehensive template.xlsx";
|
|
417
|
-
return Le(h, e), e;
|
|
418
|
-
}
|
|
419
|
-
async function mt(h) {
|
|
420
|
-
if (!h) return null;
|
|
421
|
-
try {
|
|
422
|
-
return nt(h);
|
|
423
|
-
} catch (e) {
|
|
424
|
-
throw console.error("Error in processUnitsSheet:", e), e;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
async function ut(h) {
|
|
428
|
-
if (!h) return null;
|
|
429
|
-
try {
|
|
430
|
-
return qe(h);
|
|
431
|
-
} catch (e) {
|
|
432
|
-
throw console.error("Error in processIngredientsSheet:", e), e;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
async function dt(h) {
|
|
436
|
-
if (!h) return null;
|
|
437
|
-
try {
|
|
438
|
-
const e = rt(h);
|
|
439
|
-
return ot(e, { ignoreErrors: !0 });
|
|
440
|
-
} catch (e) {
|
|
441
|
-
throw console.error("Error in processRecipesSheet:", e), e;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
function ie(h) {
|
|
445
|
-
return (h ?? []).filter((e) => !e.errors || e.errors.length === 0).map(({ errors: e, ...k }) => k);
|
|
446
|
-
}
|
|
447
|
-
const ct = { class: "flex flex-col gap-24" }, pt = { class: "flex flex-col gap-8" }, vt = { class: "flex flex-col flex-1 gap-4" }, yt = { class: "fm-typo-en-body-md-600" }, gt = {
|
|
448
|
-
key: 2,
|
|
449
|
-
class: "shrink-0"
|
|
450
|
-
}, ft = {
|
|
451
|
-
key: 0,
|
|
452
|
-
class: "flex flex-col"
|
|
453
|
-
}, bt = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, ht = {
|
|
454
|
-
key: 0,
|
|
455
|
-
class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
|
|
456
|
-
}, xt = { class: "fm-typo-en-body-lg-600" }, _t = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, wt = /* @__PURE__ */ Me({
|
|
457
|
-
__name: "ImportDialog",
|
|
458
|
-
setup(h) {
|
|
459
|
-
const e = $(null), k = Pe();
|
|
460
|
-
$e();
|
|
461
|
-
const p = $(!1), g = $(new Array()), w = $(null), b = $([]), r = $([]), i = J(() => !!g.value.length), s = J(() => !!w.value && b.value.length > 0), { t: y } = Fe();
|
|
462
|
-
async function c(o) {
|
|
463
|
-
g.value = [], w.value = null, b.value = [], r.value = [];
|
|
464
|
-
try {
|
|
465
|
-
p.value = !0;
|
|
466
|
-
const [a] = await Promise.all([
|
|
467
|
-
Ke(o),
|
|
468
|
-
// fake buffer for UX
|
|
469
|
-
new Promise((v) => setTimeout(v, 1e3))
|
|
470
|
-
]);
|
|
471
|
-
w.value = a, d();
|
|
472
|
-
} catch (a) {
|
|
473
|
-
console.error("Error parsing Excel file:", a), g.value.push((a == null ? void 0 : a.message) || "Unknown error occurred");
|
|
474
|
-
} finally {
|
|
475
|
-
p.value = !1;
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
function d() {
|
|
479
|
-
if (g.value = [], !w.value) return;
|
|
480
|
-
const a = ["unit", "ingredient", "recipe"].filter((v) => w.value.Sheets[v]);
|
|
481
|
-
if (a.length === 0) {
|
|
482
|
-
g.value.push("No valid sheets found. Expected sheets: unit, ingredient, or recipe");
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
|
-
b.value = a, k.emitData({ availableSheets: a, workbook: w.value });
|
|
486
|
-
}
|
|
487
|
-
De(e, (o) => {
|
|
488
|
-
o && c(o);
|
|
489
|
-
});
|
|
490
|
-
function f() {
|
|
491
|
-
if (!w.value || b.value.length === 0) return "";
|
|
492
|
-
const o = [];
|
|
493
|
-
return b.value.forEach((a) => {
|
|
494
|
-
switch (a) {
|
|
495
|
-
case "unit":
|
|
496
|
-
o.push("Units sheet found");
|
|
497
|
-
break;
|
|
498
|
-
case "ingredient":
|
|
499
|
-
o.push("Ingredients sheet found");
|
|
500
|
-
break;
|
|
501
|
-
case "recipe":
|
|
502
|
-
o.push("Recipes sheet found");
|
|
503
|
-
break;
|
|
504
|
-
}
|
|
505
|
-
}), o.length > 0 ? `Ready to process: ${o.join(", ")}. Processing will follow dependency order.` : "No valid sheets found";
|
|
506
|
-
}
|
|
507
|
-
return (o, a) => {
|
|
508
|
-
const v = Y("FmCircularProgress"), G = Y("FmIcon"), B = Y("FmButton");
|
|
509
|
-
return C(), D("div", ct, [
|
|
510
|
-
A(Ye, {
|
|
511
|
-
class: ve({
|
|
512
|
-
"w-full": !0,
|
|
513
|
-
"h-[200px]": !e.value
|
|
514
|
-
}),
|
|
515
|
-
accept: ".xlsx,.xls",
|
|
516
|
-
onFileUpload: a[0] || (a[0] = (E) => e.value = E),
|
|
517
|
-
label: l(y)("inventory.ingredient.import.uploadTemplate"),
|
|
518
|
-
"button-label": l(y)("inventory.ingredient.import.selectFile")
|
|
519
|
-
}, Be({ _: 2 }, [
|
|
520
|
-
e.value ? {
|
|
521
|
-
name: "default",
|
|
522
|
-
fn: Q(({ openFileDialog: E }) => [
|
|
523
|
-
n("div", pt, [
|
|
524
|
-
n("div", {
|
|
525
|
-
class: ve([
|
|
526
|
-
"fm-corner-radius-md p-16 flex items-center gap-16",
|
|
527
|
-
{
|
|
528
|
-
"border border-fm-color-neutral-gray-100": p.value,
|
|
529
|
-
"border border-fm-color-neutral-gray-200": !p.value && !i.value,
|
|
530
|
-
"border border-fm-color-system-error-200": i.value
|
|
531
|
-
}
|
|
532
|
-
])
|
|
533
|
-
}, [
|
|
534
|
-
p.value ? (C(), ae(v, {
|
|
535
|
-
key: 0,
|
|
536
|
-
size: "md",
|
|
537
|
-
color: "neutral-gray-200"
|
|
538
|
-
})) : (C(), ae(G, {
|
|
539
|
-
key: 1,
|
|
540
|
-
name: i.value ? "error" : "check_circle",
|
|
541
|
-
color: i.value ? "system-error-300" : "system-success-400",
|
|
542
|
-
size: "lg"
|
|
543
|
-
}, null, 8, ["name", "color"])),
|
|
544
|
-
n("div", vt, [
|
|
545
|
-
n("div", yt, m(e.value.name), 1),
|
|
546
|
-
n("div", {
|
|
547
|
-
class: ve([
|
|
548
|
-
"fm-typo-en-body-sm-400",
|
|
549
|
-
{
|
|
550
|
-
"text-fm-color-system-error-300": i.value,
|
|
551
|
-
"text-fm-color-typo-secondary": !i.value
|
|
552
|
-
}
|
|
553
|
-
])
|
|
554
|
-
}, m(i.value ? l(y)("inventory.ingredient.import.error.invalidContent") : "File valid"), 3)
|
|
555
|
-
]),
|
|
556
|
-
p.value ? Z("", !0) : (C(), D("div", gt, [
|
|
557
|
-
A(B, {
|
|
558
|
-
label: l(y)("inventory.ingredient.import.replaceFile"),
|
|
559
|
-
variant: i.value ? "destructive" : "secondary",
|
|
560
|
-
"prepend-icon": i.value ? void 0 : "autorenew",
|
|
561
|
-
onClick: E
|
|
562
|
-
}, null, 8, ["label", "variant", "prepend-icon", "onClick"])
|
|
563
|
-
]))
|
|
564
|
-
], 2),
|
|
565
|
-
g.value.length ? (C(), D("div", ft, [
|
|
566
|
-
(C(!0), D(Te, null, Ue(g.value, (T, U) => (C(), D("div", {
|
|
567
|
-
key: U,
|
|
568
|
-
class: "flex gap-8 items-center"
|
|
569
|
-
}, [
|
|
570
|
-
A(G, {
|
|
571
|
-
name: "error",
|
|
572
|
-
size: "sm",
|
|
573
|
-
color: "system-error-300"
|
|
574
|
-
}),
|
|
575
|
-
n("div", bt, m(T), 1)
|
|
576
|
-
]))), 128))
|
|
577
|
-
])) : Z("", !0)
|
|
578
|
-
])
|
|
579
|
-
]),
|
|
580
|
-
key: "0"
|
|
581
|
-
} : void 0
|
|
582
|
-
]), 1032, ["class", "label", "button-label"]),
|
|
583
|
-
s.value ? (C(), D("div", ht, [
|
|
584
|
-
n("div", xt, m(l(y)("inventory.ingredient.import.summary")), 1),
|
|
585
|
-
n("div", _t, m(f()), 1)
|
|
586
|
-
])) : Z("", !0)
|
|
587
|
-
]);
|
|
588
|
-
};
|
|
589
|
-
}
|
|
590
|
-
}), Et = {
|
|
591
|
-
key: 0,
|
|
592
|
-
class: "bg-blue-50 border border-blue-200 rounded-lg p-16"
|
|
593
|
-
}, It = { class: "flex items-start gap-12" }, St = { class: "flex flex-col gap-8" }, kt = { class: "fm-typo-en-body-md-400 text-blue-800" }, Rt = { class: "fm-typo-en-body-sm-400 text-blue-700" }, Ct = { class: "mb-8" }, Nt = ["innerHTML"], Mt = ["innerHTML"], Tt = { class: "mb-8" }, Ut = { class: "mb-12" }, Ft = { class: "mb-12" }, $t = { class: "mb-8" }, Gt = { class: "text-orange-600" }, At = {
|
|
594
|
-
key: 1,
|
|
595
|
-
class: "bg-white rounded-lg shadow"
|
|
596
|
-
}, Dt = { class: "flex items-center justify-between p-16 border-b" }, Bt = { class: "fm-typo-en-title-md-600" }, jt = { class: "fm-typo-en-body-sm-400 text-gray-600 mt-4" }, Pt = {
|
|
597
|
-
key: 0,
|
|
598
|
-
class: "text-red-600"
|
|
599
|
-
}, zt = {
|
|
600
|
-
key: 1,
|
|
601
|
-
class: "text-orange-600"
|
|
602
|
-
}, Ht = {
|
|
603
|
-
key: 2,
|
|
604
|
-
class: "text-green-600"
|
|
605
|
-
}, Vt = { class: "flex gap-8" }, Wt = { class: "p-16" }, Ot = {
|
|
606
|
-
key: 2,
|
|
607
|
-
class: "bg-white rounded-lg shadow"
|
|
608
|
-
}, Lt = { class: "flex items-center justify-between p-16 border-b" }, Kt = { class: "fm-typo-en-title-md-600 text-red-800" }, Jt = { class: "fm-typo-en-body-sm-400 text-gray-600 mt-4" }, qt = { class: "flex gap-8" }, Xt = { class: "p-16" }, Qt = {
|
|
609
|
-
key: 0,
|
|
610
|
-
class: "flex flex-col gap-16 p-16"
|
|
611
|
-
}, Yt = { class: "fm-typo-en-title-sm-600 mb-12" }, Zt = { class: "grid grid-cols-2 gap-12" }, en = { class: "fm-typo-en-body-sm-400 text-gray-600" }, tn = { class: "fm-typo-en-body-md-600" }, nn = { key: 0 }, on = { class: "fm-typo-en-body-sm-400 text-gray-600" }, rn = { class: "fm-typo-en-body-md-600" }, sn = { class: "fm-typo-en-body-sm-400 text-gray-600" }, an = { class: "fm-typo-en-body-md-600" }, ln = { class: "fm-typo-en-body-sm-400 text-gray-600" }, mn = { class: "fm-typo-en-body-md-600" }, un = { class: "fm-typo-en-body-sm-400 text-gray-600" }, dn = { class: "fm-typo-en-title-sm-600 mb-12 text-red-800" }, cn = { class: "space-y-8" }, pn = { class: "fm-typo-en-body-md-400 text-red-800" }, vn = { class: "fm-typo-en-title-sm-600 mb-12" }, yn = { class: "bg-gray-50 p-12 rounded border overflow-auto" }, gn = { class: "text-sm" }, fn = { class: "flex gap-8" }, bn = { class: "flex flex-col items-center justify-center h-64 gap-16" }, hn = { class: "text-center" }, xn = { class: "fm-typo-en-title-md-600 text-gray-600 mb-8" }, _n = { class: "flex flex-col items-center justify-center h-64 gap-16" }, wn = { class: "text-center" }, En = { class: "fm-typo-en-title-md-600 text-gray-600 mb-8" }, In = { class: "fm-typo-en-body-md-400 text-gray-500" }, Bn = /* @__PURE__ */ Me({
|
|
612
|
-
__name: "ImportView",
|
|
613
|
-
setup(h) {
|
|
614
|
-
const { t: e } = Fe(), k = ze(), p = $e();
|
|
615
|
-
je();
|
|
616
|
-
const g = Ve(), { breakpoints: w } = He(), b = le(), r = $("");
|
|
617
|
-
$(!1);
|
|
618
|
-
const i = $(!1), s = $(null), y = $(!1), c = $(null), d = $(!1), f = $([]), o = $(null), a = $([]), v = $(!1), G = J(() => w.value.xs || w.value.sm), B = J(() => G.value ? 10 : 20), E = J(() => {
|
|
619
|
-
const u = s.value;
|
|
620
|
-
if (!u) return [];
|
|
621
|
-
const t = [], { units: R, skus: j, recipes: L, _invalidExcel: W, _invalidExcelMessage: q } = u, X = (M) => {
|
|
622
|
-
var z;
|
|
623
|
-
return ((z = M.errors) == null ? void 0 : z.length) > 0 ? Array.isArray(M.errors) ? M.errors.join(", ") : M.errors || e("inventory.common.validationFailed") : W ? q || e("inventory.common.invalidExcelFormat") : e("inventory.common.readyToImport");
|
|
624
|
-
}, V = (M, H) => {
|
|
625
|
-
if (M)
|
|
626
|
-
for (const z of ["create", "update"]) {
|
|
627
|
-
const O = M[z];
|
|
628
|
-
if (O)
|
|
629
|
-
for (const P of O)
|
|
630
|
-
t.push({
|
|
631
|
-
name: P.name || P.abbrev || P.code || e("inventory.common.unknown"),
|
|
632
|
-
type: H,
|
|
633
|
-
operation: e(z === "create" ? "inventory.common.create" : "inventory.common.update"),
|
|
634
|
-
status: X(P),
|
|
635
|
-
errors: P.errors || [],
|
|
636
|
-
details: P
|
|
637
|
-
});
|
|
638
|
-
}
|
|
639
|
-
};
|
|
640
|
-
return V(R, e("inventory.common.unit")), V(j, e("inventory.common.ingredient")), V(L, e("inventory.common.recipe")), t;
|
|
641
|
-
}), T = J(() => E.value.some(
|
|
642
|
-
(u) => u.errors && u.errors.length > 0
|
|
643
|
-
)), U = J(() => E.value.some(
|
|
644
|
-
(u) => u.status && u.status.includes("Invalid Excel")
|
|
645
|
-
)), F = J(() => {
|
|
646
|
-
const u = E.value.find(
|
|
647
|
-
(t) => t.status && t.status.includes("Invalid Excel")
|
|
648
|
-
);
|
|
649
|
-
return (u == null ? void 0 : u.status) || e("inventory.common.invalidExcelFormatDetected");
|
|
650
|
-
}), ee = J(() => !a.value || a.value.length === 0 ? [] : a.value.map((u, t) => {
|
|
651
|
-
var R, j;
|
|
652
|
-
return {
|
|
653
|
-
id: t + 1,
|
|
654
|
-
name: ((R = u.error.data) == null ? void 0 : R.name) || e("inventory.common.unknown"),
|
|
655
|
-
type: u.type || e("inventory.common.general"),
|
|
656
|
-
message: ((j = u.error) == null ? void 0 : j.message) || JSON.stringify(u.error)
|
|
657
|
-
};
|
|
658
|
-
}));
|
|
659
|
-
function oe(u) {
|
|
660
|
-
switch (u) {
|
|
661
|
-
case "import":
|
|
662
|
-
return ye();
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
function ye() {
|
|
666
|
-
k.open({
|
|
667
|
-
title: e("inventory.common.import"),
|
|
668
|
-
contentComponent: wt,
|
|
669
|
-
overlay: !0,
|
|
670
|
-
closeButton: !0,
|
|
671
|
-
primaryActions: {
|
|
672
|
-
text: e("inventory.common.next"),
|
|
673
|
-
close: !1
|
|
674
|
-
},
|
|
675
|
-
secondaryActions: {
|
|
676
|
-
text: e("inventory.common.close"),
|
|
677
|
-
close: !0
|
|
678
|
-
},
|
|
679
|
-
tertiaryActions: {
|
|
680
|
-
text: e("inventory.ingredient.import.actions.downloadTemplate"),
|
|
681
|
-
close: !1,
|
|
682
|
-
variant: "plain"
|
|
683
|
-
}
|
|
684
|
-
}).onPrimary(async (u) => {
|
|
685
|
-
u && u.workbook && u.availableSheets && (await ge(u), k.close()), f.value.length === 0 && k.close();
|
|
686
|
-
}).onTertiary(() => {
|
|
687
|
-
try {
|
|
688
|
-
const u = lt();
|
|
689
|
-
p.open({
|
|
690
|
-
title: e("inventory.common.export") + " " + e("inventory.ingredient.import.actions.downloadTemplate"),
|
|
691
|
-
message: e("inventory.common.templateDownloaded", [u]),
|
|
692
|
-
type: "success"
|
|
693
|
-
});
|
|
694
|
-
} catch (u) {
|
|
695
|
-
p.open({
|
|
696
|
-
title: e("inventory.common.downloadFailed"),
|
|
697
|
-
message: e("inventory.common.failedDownloadTemplate"),
|
|
698
|
-
type: "error"
|
|
699
|
-
}), console.error("Error downloading template:", u);
|
|
700
|
-
}
|
|
701
|
-
});
|
|
702
|
-
}
|
|
703
|
-
async function ge(u) {
|
|
704
|
-
o.value = u.workbook, f.value = [...u.availableSheets], s.value = {}, a.value = [], await me();
|
|
705
|
-
}
|
|
706
|
-
async function me() {
|
|
707
|
-
var t, R, j, L, W, q, X, V, M, H, z, O, P, de, ce;
|
|
708
|
-
if (!o.value || f.value.length === 0) {
|
|
709
|
-
y.value = !0;
|
|
710
|
-
return;
|
|
711
|
-
}
|
|
712
|
-
const u = f.value[0];
|
|
713
|
-
try {
|
|
714
|
-
switch (u) {
|
|
715
|
-
case "unit": {
|
|
716
|
-
const K = o.value.Sheets.unit, I = await mt(K);
|
|
717
|
-
I && (s.value = {
|
|
718
|
-
...s.value,
|
|
719
|
-
_invalidExcel: I.invalidExcel || ((t = s.value) == null ? void 0 : t._invalidExcel),
|
|
720
|
-
_invalidExcelMessage: I.invalidExcelMessage || ((R = s.value) == null ? void 0 : R._invalidExcelMessage) || e("inventory.common.invalidExcelFormat") + " for Units sheet",
|
|
721
|
-
units: I.importCreateResult || I.importUpdateResult ? {
|
|
722
|
-
create: ((j = I.importCreateResult) == null ? void 0 : j.map((x) => ({
|
|
723
|
-
...x.unit,
|
|
724
|
-
errors: x.errors
|
|
725
|
-
}))) || [],
|
|
726
|
-
update: ((L = I.importUpdateResult) == null ? void 0 : L.map((x) => ({
|
|
727
|
-
...x.unit,
|
|
728
|
-
errors: x.errors
|
|
729
|
-
}))) || []
|
|
730
|
-
} : (W = s.value) == null ? void 0 : W.units
|
|
731
|
-
});
|
|
732
|
-
break;
|
|
733
|
-
}
|
|
734
|
-
case "ingredient": {
|
|
735
|
-
const K = o.value.Sheets.ingredient, I = await ut(K);
|
|
736
|
-
I && (s.value = {
|
|
737
|
-
...s.value,
|
|
738
|
-
_invalidExcel: I.invalidExcel || ((q = s.value) == null ? void 0 : q._invalidExcel),
|
|
739
|
-
_invalidExcelMessage: I.invalidExcelMessage || ((X = s.value) == null ? void 0 : X._invalidExcelMessage) || e("inventory.common.invalidExcelFormat") + " for Ingredients sheet",
|
|
740
|
-
skus: I.importCreateResult || I.importUpdateResult ? {
|
|
741
|
-
create: ((V = I.importCreateResult) == null ? void 0 : V.map((x) => ({
|
|
742
|
-
...x.sku,
|
|
743
|
-
errors: x.errors
|
|
744
|
-
}))) || [],
|
|
745
|
-
update: ((M = I.importUpdateResult) == null ? void 0 : M.map((x) => ({
|
|
746
|
-
...x.sku,
|
|
747
|
-
errors: x.errors
|
|
748
|
-
}))) || []
|
|
749
|
-
} : (H = s.value) == null ? void 0 : H.skus
|
|
750
|
-
});
|
|
751
|
-
break;
|
|
752
|
-
}
|
|
753
|
-
case "recipe": {
|
|
754
|
-
const K = o.value.Sheets.recipe, I = await dt(K);
|
|
755
|
-
I && (s.value = {
|
|
756
|
-
...s.value,
|
|
757
|
-
_invalidExcel: I.invalidExcel || ((z = s.value) == null ? void 0 : z._invalidExcel),
|
|
758
|
-
_invalidExcelMessage: I.invalidExcelMessage || ((O = s.value) == null ? void 0 : O._invalidExcelMessage) || e("inventory.common.invalidExcelFormat") + " for Recipes sheet",
|
|
759
|
-
recipes: I.importCreateResult || I.importUpdateResult ? {
|
|
760
|
-
create: ((P = I.importCreateResult) == null ? void 0 : P.map((x) => ({
|
|
761
|
-
...x.recipe,
|
|
762
|
-
errors: x.errors
|
|
763
|
-
}))) || [],
|
|
764
|
-
update: ((de = I.importUpdateResult) == null ? void 0 : de.map((x) => ({
|
|
765
|
-
...x.recipe,
|
|
766
|
-
errors: x.errors
|
|
767
|
-
}))) || []
|
|
768
|
-
} : (ce = s.value) == null ? void 0 : ce.recipes
|
|
769
|
-
});
|
|
770
|
-
break;
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
f.value.shift(), y.value = !0;
|
|
774
|
-
} catch (K) {
|
|
775
|
-
console.error(`Error processing ${u} sheet:`, K), p.open({
|
|
776
|
-
title: e("inventory.common.processingError"),
|
|
777
|
-
message: e("inventory.common.failedToProcessSheet", [u]),
|
|
778
|
-
type: "error"
|
|
779
|
-
});
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
async function fe() {
|
|
783
|
-
var u, t, R, j, L, W, q, X, V, M, H, z, O, P, de, ce, K, I;
|
|
784
|
-
if (s.value) {
|
|
785
|
-
if (U.value) {
|
|
786
|
-
p.open({
|
|
787
|
-
title: e("inventory.common.invalidExcelFormatTitle"),
|
|
788
|
-
message: F.value,
|
|
789
|
-
type: "error"
|
|
790
|
-
});
|
|
791
|
-
return;
|
|
792
|
-
}
|
|
793
|
-
if (T.value) {
|
|
794
|
-
p.open({
|
|
795
|
-
title: e("inventory.ingredient.import.error.invalidContent"),
|
|
796
|
-
message: e("inventory.ingredient.import.error.hasErrors"),
|
|
797
|
-
type: "error"
|
|
798
|
-
});
|
|
799
|
-
return;
|
|
800
|
-
}
|
|
801
|
-
i.value = !0;
|
|
802
|
-
try {
|
|
803
|
-
let x = 0, re = "";
|
|
804
|
-
if (s.value.units && ((u = s.value.units.create) != null && u.length || (t = s.value.units.update) != null && t.length)) {
|
|
805
|
-
const N = {
|
|
806
|
-
create: ie(s.value.units.create),
|
|
807
|
-
update: ie(s.value.units.update)
|
|
808
|
-
};
|
|
809
|
-
if (N.create.length || N.update.length) {
|
|
810
|
-
const _ = await b.importUnits(N);
|
|
811
|
-
((R = _ == null ? void 0 : _.errors) == null ? void 0 : R.length) > 0 && a.value.push(..._.errors.map((se) => ({
|
|
812
|
-
type: "units",
|
|
813
|
-
error: se
|
|
814
|
-
})));
|
|
815
|
-
const te = N.create.length + N.update.length, ne = ((j = _ == null ? void 0 : _.errors) == null ? void 0 : j.length) || 0;
|
|
816
|
-
x = te - ne, re = "units", s.value = {
|
|
817
|
-
...s.value,
|
|
818
|
-
units: null
|
|
819
|
-
};
|
|
820
|
-
}
|
|
821
|
-
} else if (s.value.skus && ((L = s.value.skus.create) != null && L.length || (W = s.value.skus.update) != null && W.length)) {
|
|
822
|
-
const N = {
|
|
823
|
-
create: ie(s.value.skus.create),
|
|
824
|
-
update: ie(s.value.skus.update)
|
|
825
|
-
};
|
|
826
|
-
if (N.create.length || N.update.length) {
|
|
827
|
-
const _ = await b.importSkus(N);
|
|
828
|
-
((q = _ == null ? void 0 : _.errors) == null ? void 0 : q.length) > 0 && a.value.push(..._.errors.map((se) => ({
|
|
829
|
-
type: "ingredients",
|
|
830
|
-
error: se
|
|
831
|
-
})));
|
|
832
|
-
const te = N.create.length + N.update.length, ne = ((X = _ == null ? void 0 : _.errors) == null ? void 0 : X.length) || 0;
|
|
833
|
-
x = te - ne, re = "ingredients", s.value = {
|
|
834
|
-
...s.value,
|
|
835
|
-
skus: null
|
|
836
|
-
};
|
|
837
|
-
}
|
|
838
|
-
} else if (s.value.recipes && ((V = s.value.recipes.create) != null && V.length || (M = s.value.recipes.update) != null && M.length)) {
|
|
839
|
-
const N = {
|
|
840
|
-
create: ie(s.value.recipes.create),
|
|
841
|
-
update: ie(s.value.recipes.update)
|
|
842
|
-
};
|
|
843
|
-
if (N.create.length || N.update.length) {
|
|
844
|
-
const _ = await b.importRecipes(N);
|
|
845
|
-
((H = _ == null ? void 0 : _.errors) == null ? void 0 : H.length) > 0 && a.value.push(..._.errors.map((se) => ({
|
|
846
|
-
type: "recipes",
|
|
847
|
-
error: se
|
|
848
|
-
})));
|
|
849
|
-
const te = N.create.length + N.update.length, ne = ((z = _ == null ? void 0 : _.errors) == null ? void 0 : z.length) || 0;
|
|
850
|
-
x = te - ne, re = "recipes", s.value = {
|
|
851
|
-
...s.value,
|
|
852
|
-
recipes: null
|
|
853
|
-
};
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
if (x > 0) {
|
|
857
|
-
const N = a.value.filter((_) => _.type === re);
|
|
858
|
-
N.length > 0 ? p.open({
|
|
859
|
-
title: e("inventory.common.importCompletedWithIssues"),
|
|
860
|
-
message: e("inventory.common.successfullyImported", [x, re, N.length, re]),
|
|
861
|
-
type: "warning"
|
|
862
|
-
}) : p.open({
|
|
863
|
-
title: e("inventory.ingredient.import.success"),
|
|
864
|
-
message: e("inventory.common.successfullyImported", [x, re, "0", ""]),
|
|
865
|
-
type: "success"
|
|
866
|
-
});
|
|
867
|
-
}
|
|
868
|
-
if (f.value.length > 0)
|
|
869
|
-
await me();
|
|
870
|
-
else if (!(s.value.units && (((O = s.value.units.create) == null ? void 0 : O.length) || ((P = s.value.units.update) == null ? void 0 : P.length)) || s.value.skus && (((de = s.value.skus.create) == null ? void 0 : de.length) || ((ce = s.value.skus.update) == null ? void 0 : ce.length)) || s.value.recipes && (((K = s.value.recipes.create) == null ? void 0 : K.length) || ((I = s.value.recipes.update) == null ? void 0 : I.length))))
|
|
871
|
-
if (ue(), a.value.length > 0) {
|
|
872
|
-
const _ = a.value.filter((pe) => pe.type === "units").length, te = a.value.filter((pe) => pe.type === "ingredients").length, ne = a.value.filter((pe) => pe.type === "recipes").length, se = _ + te + ne;
|
|
873
|
-
v.value = !0, p.open({
|
|
874
|
-
title: e("inventory.common.importCompletedWithIssues"),
|
|
875
|
-
message: e("inventory.common.importFinishedWithFailedItems", [se, _, te, ne]),
|
|
876
|
-
type: "warning"
|
|
877
|
-
}), console.error("Import errors:", a.value);
|
|
878
|
-
} else
|
|
879
|
-
p.open({
|
|
880
|
-
title: e("inventory.common.importComplete"),
|
|
881
|
-
message: e("inventory.common.allDataSuccessfullyImported"),
|
|
882
|
-
type: "success"
|
|
883
|
-
});
|
|
884
|
-
} catch (x) {
|
|
885
|
-
p.open({
|
|
886
|
-
title: e("inventory.ingredient.import.error.failed"),
|
|
887
|
-
message: (x == null ? void 0 : x.message) || e("inventory.common.unknownErrorOccurred"),
|
|
888
|
-
type: "error"
|
|
889
|
-
}), console.error("Error during import:", x);
|
|
890
|
-
} finally {
|
|
891
|
-
i.value = !1;
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
function ue() {
|
|
896
|
-
y.value = !1, v.value = !1, s.value = null, f.value = [], o.value = null;
|
|
897
|
-
}
|
|
898
|
-
function be() {
|
|
899
|
-
v.value = !1, a.value = [];
|
|
900
|
-
}
|
|
901
|
-
function he() {
|
|
902
|
-
d.value = !1, c.value = null;
|
|
903
|
-
}
|
|
904
|
-
const Ie = J(() => [
|
|
905
|
-
{
|
|
906
|
-
label: e("inventory.common.import"),
|
|
907
|
-
value: "import",
|
|
908
|
-
isPrimary: !1,
|
|
909
|
-
prependIcon: "upload"
|
|
910
|
-
}
|
|
911
|
-
]), xe = Ce([
|
|
912
|
-
{
|
|
913
|
-
id: "name",
|
|
914
|
-
accessorKey: "name",
|
|
915
|
-
header: () => e("inventory.common.name"),
|
|
916
|
-
size: 200
|
|
917
|
-
},
|
|
918
|
-
{
|
|
919
|
-
id: "type",
|
|
920
|
-
accessorKey: "type",
|
|
921
|
-
header: () => e("inventory.common.type"),
|
|
922
|
-
size: 120
|
|
923
|
-
},
|
|
924
|
-
{
|
|
925
|
-
id: "operation",
|
|
926
|
-
accessorKey: "operation",
|
|
927
|
-
header: () => e("inventory.common.operation"),
|
|
928
|
-
size: 100
|
|
929
|
-
},
|
|
930
|
-
{
|
|
931
|
-
id: "status",
|
|
932
|
-
accessorKey: "status",
|
|
933
|
-
header: () => e("inventory.common.status"),
|
|
934
|
-
size: 120,
|
|
935
|
-
cell: (u) => {
|
|
936
|
-
const t = u.row.original.status;
|
|
937
|
-
let R = "px-8 py-4 rounded";
|
|
938
|
-
return t === e("inventory.common.readyToImport") ? R += " bg-blue-100 text-blue-800 border border-blue-200" : t === "Imported" || t === "Successfully Imported" ? R += " bg-green-100 text-green-800 border border-green-200" : t === "Failed" ? R += " bg-red-100 text-red-800 border border-red-200" : t === e("inventory.common.validationFailed") ? R += " bg-orange-100 text-orange-800 border border-orange-200" : (t.includes("Invalid Excel"), R += " bg-red-100 text-red-800 border border-red-200"), _e("div", { class: R, title: t }, t);
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
]), Ae = Ce([
|
|
942
|
-
{
|
|
943
|
-
id: "name",
|
|
944
|
-
accessorKey: "name",
|
|
945
|
-
header: () => e("inventory.common.name"),
|
|
946
|
-
cell: (u) => _e("div", { class: "text-gray-800 text-sm py-2" }, u.row.original.name || e("inventory.common.unknown"))
|
|
947
|
-
},
|
|
948
|
-
{
|
|
949
|
-
id: "type",
|
|
950
|
-
accessorKey: "type",
|
|
951
|
-
header: () => e("inventory.common.errorType"),
|
|
952
|
-
cell: (u) => {
|
|
953
|
-
const t = u.row.original.type, R = e(t === "units" ? "inventory.common.unit" : t === "ingredients" ? "inventory.common.ingredient" : t === "recipes" ? "inventory.common.recipe" : "inventory.common.unknown");
|
|
954
|
-
return _e("div", { class: "text-gray-800 text-sm py-2" }, R);
|
|
955
|
-
}
|
|
956
|
-
},
|
|
957
|
-
{
|
|
958
|
-
id: "message",
|
|
959
|
-
accessorKey: "message",
|
|
960
|
-
header: () => e("inventory.common.errorMessage"),
|
|
961
|
-
cell: (u) => _e(
|
|
962
|
-
"div",
|
|
963
|
-
{ class: "text-red-800 text-sm py-2", title: u.row.original.message },
|
|
964
|
-
u.row.original.message
|
|
965
|
-
)
|
|
966
|
-
}
|
|
967
|
-
]);
|
|
968
|
-
return (u, t) => {
|
|
969
|
-
const R = Y("FmIcon"), j = Y("FmButton"), L = Y("FmTable"), W = Y("FmCard"), q = Y("FmSideSheet"), X = Y("FmSpinner");
|
|
970
|
-
return l(g).isLoaded && l(g).enableBulkImport ? (C(), ae(Se, {
|
|
971
|
-
key: 0,
|
|
972
|
-
title: l(e)("inventory.common.import"),
|
|
973
|
-
actions: Ie.value,
|
|
974
|
-
"onClick:action": oe
|
|
975
|
-
}, {
|
|
976
|
-
default: Q(() => {
|
|
977
|
-
var V;
|
|
978
|
-
return [
|
|
979
|
-
n("div", {
|
|
980
|
-
class: ve([
|
|
981
|
-
"flex flex-col gap-8 max-h-full",
|
|
982
|
-
{
|
|
983
|
-
"p-0": G.value,
|
|
984
|
-
"px-24": !G.value
|
|
985
|
-
}
|
|
986
|
-
])
|
|
987
|
-
}, [
|
|
988
|
-
y.value ? Z("", !0) : (C(), D("div", Et, [
|
|
989
|
-
n("div", It, [
|
|
990
|
-
A(R, {
|
|
991
|
-
name: "info",
|
|
992
|
-
class: "text-blue-600 mt-2"
|
|
993
|
-
}),
|
|
994
|
-
n("div", St, [
|
|
995
|
-
n("div", kt, m(l(e)("inventory.ingredient.import.multiUploadTemplateInstruction")), 1),
|
|
996
|
-
n("div", Rt, [
|
|
997
|
-
n("div", Ct, [
|
|
998
|
-
n("strong", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.title")), 1)
|
|
999
|
-
]),
|
|
1000
|
-
t[39] || (t[39] = S(" 1. ")),
|
|
1001
|
-
n("span", {
|
|
1002
|
-
innerHTML: l(e)("inventory.ingredient.import.importInstructions.step1")
|
|
1003
|
-
}, null, 8, Nt),
|
|
1004
|
-
t[40] || (t[40] = n("br", null, null, -1)),
|
|
1005
|
-
t[41] || (t[41] = S(" 2. ")),
|
|
1006
|
-
n("span", {
|
|
1007
|
-
innerHTML: l(e)("inventory.ingredient.import.importInstructions.step2")
|
|
1008
|
-
}, null, 8, Mt),
|
|
1009
|
-
t[42] || (t[42] = n("br", null, null, -1)),
|
|
1010
|
-
S(" 3. " + m(l(e)("inventory.ingredient.import.importInstructions.step3")), 1),
|
|
1011
|
-
t[43] || (t[43] = n("br", null, null, -1)),
|
|
1012
|
-
S(" 4. " + m(l(e)("inventory.ingredient.import.importInstructions.step4")), 1),
|
|
1013
|
-
t[44] || (t[44] = n("br", null, null, -1)),
|
|
1014
|
-
t[45] || (t[45] = n("br", null, null, -1)),
|
|
1015
|
-
n("div", Tt, [
|
|
1016
|
-
n("strong", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.title")), 1)
|
|
1017
|
-
]),
|
|
1018
|
-
n("div", Ut, [
|
|
1019
|
-
n("strong", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.title")), 1),
|
|
1020
|
-
S(" " + m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.description")), 1),
|
|
1021
|
-
t[1] || (t[1] = n("br", null, null, -1)),
|
|
1022
|
-
t[2] || (t[2] = S(" • ")),
|
|
1023
|
-
n("em", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col1")), 1),
|
|
1024
|
-
t[3] || (t[3] = n("br", null, null, -1)),
|
|
1025
|
-
t[4] || (t[4] = S(" • ")),
|
|
1026
|
-
n("em", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col2")), 1),
|
|
1027
|
-
t[5] || (t[5] = n("br", null, null, -1)),
|
|
1028
|
-
t[6] || (t[6] = S(" • ")),
|
|
1029
|
-
n("em", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col3")), 1),
|
|
1030
|
-
t[7] || (t[7] = n("br", null, null, -1)),
|
|
1031
|
-
t[8] || (t[8] = S(" • ")),
|
|
1032
|
-
n("em", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col4")), 1),
|
|
1033
|
-
t[9] || (t[9] = n("br", null, null, -1)),
|
|
1034
|
-
t[10] || (t[10] = S(" • ")),
|
|
1035
|
-
n("em", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col5")), 1),
|
|
1036
|
-
t[11] || (t[11] = n("br", null, null, -1)),
|
|
1037
|
-
t[12] || (t[12] = S(" • ")),
|
|
1038
|
-
n("em", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col6")), 1)
|
|
1039
|
-
]),
|
|
1040
|
-
n("div", Ft, [
|
|
1041
|
-
n("strong", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.title")), 1),
|
|
1042
|
-
S(" " + m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.description")), 1),
|
|
1043
|
-
t[13] || (t[13] = n("br", null, null, -1)),
|
|
1044
|
-
t[14] || (t[14] = S(" • ")),
|
|
1045
|
-
n("em", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.col1")), 1),
|
|
1046
|
-
t[15] || (t[15] = n("br", null, null, -1)),
|
|
1047
|
-
t[16] || (t[16] = S(" • ")),
|
|
1048
|
-
n("em", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.col2")), 1),
|
|
1049
|
-
t[17] || (t[17] = n("br", null, null, -1)),
|
|
1050
|
-
t[18] || (t[18] = S(" • ")),
|
|
1051
|
-
n("em", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.col3")), 1),
|
|
1052
|
-
t[19] || (t[19] = n("br", null, null, -1)),
|
|
1053
|
-
t[20] || (t[20] = S(" • ")),
|
|
1054
|
-
n("em", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.col4")), 1),
|
|
1055
|
-
t[21] || (t[21] = n("br", null, null, -1)),
|
|
1056
|
-
t[22] || (t[22] = S(" • ")),
|
|
1057
|
-
n("em", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.col5")), 1)
|
|
1058
|
-
]),
|
|
1059
|
-
n("div", $t, [
|
|
1060
|
-
n("strong", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.title")), 1),
|
|
1061
|
-
S(" " + m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.description")), 1),
|
|
1062
|
-
t[23] || (t[23] = n("br", null, null, -1)),
|
|
1063
|
-
t[24] || (t[24] = S(" • ")),
|
|
1064
|
-
n("em", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col1")), 1),
|
|
1065
|
-
t[25] || (t[25] = n("br", null, null, -1)),
|
|
1066
|
-
t[26] || (t[26] = S(" • ")),
|
|
1067
|
-
n("em", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col2")), 1),
|
|
1068
|
-
t[27] || (t[27] = n("br", null, null, -1)),
|
|
1069
|
-
t[28] || (t[28] = S(" • ")),
|
|
1070
|
-
n("em", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col3")), 1),
|
|
1071
|
-
t[29] || (t[29] = n("br", null, null, -1)),
|
|
1072
|
-
t[30] || (t[30] = S(" • ")),
|
|
1073
|
-
n("em", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col4")), 1),
|
|
1074
|
-
t[31] || (t[31] = n("br", null, null, -1)),
|
|
1075
|
-
t[32] || (t[32] = S(" • ")),
|
|
1076
|
-
n("em", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col5")), 1),
|
|
1077
|
-
t[33] || (t[33] = n("br", null, null, -1)),
|
|
1078
|
-
t[34] || (t[34] = S(" • ")),
|
|
1079
|
-
n("em", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col6")), 1),
|
|
1080
|
-
t[35] || (t[35] = n("br", null, null, -1)),
|
|
1081
|
-
t[36] || (t[36] = S(" • ")),
|
|
1082
|
-
n("em", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col7")), 1),
|
|
1083
|
-
t[37] || (t[37] = n("br", null, null, -1)),
|
|
1084
|
-
t[38] || (t[38] = S(" • ")),
|
|
1085
|
-
n("em", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col8")), 1)
|
|
1086
|
-
]),
|
|
1087
|
-
n("div", Gt, [
|
|
1088
|
-
n("strong", null, m(l(e)("inventory.ingredient.import.importInstructions.detailedGuide.warning")), 1)
|
|
1089
|
-
])
|
|
1090
|
-
])
|
|
1091
|
-
])
|
|
1092
|
-
])
|
|
1093
|
-
])),
|
|
1094
|
-
y.value ? (C(), D("div", At, [
|
|
1095
|
-
n("div", Dt, [
|
|
1096
|
-
n("div", null, [
|
|
1097
|
-
n("div", Bt, m(l(e)("inventory.common.importPreview")), 1),
|
|
1098
|
-
n("div", jt, [
|
|
1099
|
-
U.value ? (C(), D("span", Pt, m(l(e)("inventory.common.errorExist")) + ": " + m(F.value), 1)) : T.value ? (C(), D("span", zt, m(l(e)("inventory.common.someItemsValidationErrors")), 1)) : (C(), D("span", Ht, m(l(e)("inventory.common.allItemsValidReadyImport")), 1))
|
|
1100
|
-
])
|
|
1101
|
-
]),
|
|
1102
|
-
n("div", Vt, [
|
|
1103
|
-
A(j, {
|
|
1104
|
-
variant: "secondary",
|
|
1105
|
-
onClick: ue,
|
|
1106
|
-
label: l(e)("inventory.common.cancel")
|
|
1107
|
-
}, null, 8, ["label"]),
|
|
1108
|
-
A(j, {
|
|
1109
|
-
variant: "primary",
|
|
1110
|
-
onClick: fe,
|
|
1111
|
-
loading: i.value,
|
|
1112
|
-
disabled: i.value || T.value || U.value,
|
|
1113
|
-
label: l(e)("inventory.common.import")
|
|
1114
|
-
}, null, 8, ["loading", "disabled", "label"])
|
|
1115
|
-
])
|
|
1116
|
-
]),
|
|
1117
|
-
n("div", Wt, [
|
|
1118
|
-
A(L, {
|
|
1119
|
-
"column-defs": xe.value,
|
|
1120
|
-
"row-data": E.value,
|
|
1121
|
-
"page-size": B.value,
|
|
1122
|
-
"search-value": r.value,
|
|
1123
|
-
loading: !1,
|
|
1124
|
-
"row-hover": ""
|
|
1125
|
-
}, null, 8, ["column-defs", "row-data", "page-size", "search-value"])
|
|
1126
|
-
])
|
|
1127
|
-
])) : Z("", !0),
|
|
1128
|
-
v.value && a.value.length > 0 ? (C(), D("div", Ot, [
|
|
1129
|
-
n("div", Lt, [
|
|
1130
|
-
n("div", null, [
|
|
1131
|
-
n("div", Kt, m(l(e)("inventory.common.importErrors")), 1),
|
|
1132
|
-
n("div", Jt, m(a.value.length) + " " + m(l(e)("inventory.common.itemsFailedImport")), 1)
|
|
1133
|
-
]),
|
|
1134
|
-
n("div", qt, [
|
|
1135
|
-
A(j, {
|
|
1136
|
-
variant: "secondary",
|
|
1137
|
-
onClick: be,
|
|
1138
|
-
label: l(e)("inventory.common.close")
|
|
1139
|
-
}, null, 8, ["label"])
|
|
1140
|
-
])
|
|
1141
|
-
]),
|
|
1142
|
-
n("div", Xt, [
|
|
1143
|
-
A(L, {
|
|
1144
|
-
"column-defs": Ae.value,
|
|
1145
|
-
"row-data": ee.value,
|
|
1146
|
-
"page-size": B.value,
|
|
1147
|
-
"search-value": r.value,
|
|
1148
|
-
loading: !1,
|
|
1149
|
-
"row-hover": ""
|
|
1150
|
-
}, null, 8, ["column-defs", "row-data", "page-size", "search-value"])
|
|
1151
|
-
])
|
|
1152
|
-
])) : Z("", !0)
|
|
1153
|
-
], 2),
|
|
1154
|
-
A(q, {
|
|
1155
|
-
"model-value": d.value,
|
|
1156
|
-
"onUpdate:modelValue": t[0] || (t[0] = (M) => d.value = M),
|
|
1157
|
-
header: `${(V = c.value) == null ? void 0 : V.type} Details`,
|
|
1158
|
-
"max-width": 600,
|
|
1159
|
-
"dismiss-away": ""
|
|
1160
|
-
}, {
|
|
1161
|
-
"side-sheet-footer": Q(() => [
|
|
1162
|
-
n("div", fn, [
|
|
1163
|
-
A(j, {
|
|
1164
|
-
label: l(e)("inventory.common.close"),
|
|
1165
|
-
variant: "tertiary",
|
|
1166
|
-
onClick: he
|
|
1167
|
-
}, null, 8, ["label"])
|
|
1168
|
-
])
|
|
1169
|
-
]),
|
|
1170
|
-
default: Q(() => [
|
|
1171
|
-
c.value != null ? (C(), D("div", Qt, [
|
|
1172
|
-
A(W, {
|
|
1173
|
-
variant: "outlined",
|
|
1174
|
-
class: "p-16"
|
|
1175
|
-
}, {
|
|
1176
|
-
default: Q(() => {
|
|
1177
|
-
var M, H, z, O, P;
|
|
1178
|
-
return [
|
|
1179
|
-
n("div", Yt, m(l(e)("inventory.common.basicInformation")), 1),
|
|
1180
|
-
n("div", Zt, [
|
|
1181
|
-
n("div", null, [
|
|
1182
|
-
n("div", en, m(l(e)("inventory.common.name")), 1),
|
|
1183
|
-
n("div", tn, m(((H = (M = c.value) == null ? void 0 : M.details) == null ? void 0 : H.name) || ((z = c.value) == null ? void 0 : z.name)), 1)
|
|
1184
|
-
]),
|
|
1185
|
-
(P = (O = c.value) == null ? void 0 : O.details) != null && P.code ? (C(), D("div", nn, [
|
|
1186
|
-
n("div", on, m(l(e)("inventory.common.code")), 1),
|
|
1187
|
-
n("div", rn, m(c.value.details.code), 1)
|
|
1188
|
-
])) : Z("", !0),
|
|
1189
|
-
n("div", null, [
|
|
1190
|
-
n("div", sn, m(l(e)("inventory.common.type")), 1),
|
|
1191
|
-
n("div", an, m(c.value.type), 1)
|
|
1192
|
-
]),
|
|
1193
|
-
n("div", null, [
|
|
1194
|
-
n("div", ln, m(l(e)("inventory.common.operation")), 1),
|
|
1195
|
-
n("div", mn, m(c.value.operation), 1)
|
|
1196
|
-
]),
|
|
1197
|
-
n("div", null, [
|
|
1198
|
-
n("div", un, m(l(e)("inventory.common.status")), 1),
|
|
1199
|
-
n("div", {
|
|
1200
|
-
class: ve([
|
|
1201
|
-
"inline-block px-8 py-4 rounded text-sm",
|
|
1202
|
-
c.value.status !== l(e)("inventory.common.readyToImport") ? "bg-red-100 text-red-800 border border-red-200" : "bg-green-100 text-green-800 border border-green-200"
|
|
1203
|
-
])
|
|
1204
|
-
}, m(c.value.status), 3)
|
|
1205
|
-
])
|
|
1206
|
-
])
|
|
1207
|
-
];
|
|
1208
|
-
}),
|
|
1209
|
-
_: 1
|
|
1210
|
-
}),
|
|
1211
|
-
c.value.errors && c.value.errors.length > 0 ? (C(), ae(W, {
|
|
1212
|
-
key: 0,
|
|
1213
|
-
variant: "outlined",
|
|
1214
|
-
class: "p-16"
|
|
1215
|
-
}, {
|
|
1216
|
-
default: Q(() => [
|
|
1217
|
-
n("div", dn, m(l(e)("inventory.common.validationErrors")), 1),
|
|
1218
|
-
n("div", cn, [
|
|
1219
|
-
(C(!0), D(Te, null, Ue(c.value.errors, (M, H) => (C(), D("div", {
|
|
1220
|
-
key: H,
|
|
1221
|
-
class: "flex items-start gap-8 p-12 bg-red-50 border border-red-200 rounded"
|
|
1222
|
-
}, [
|
|
1223
|
-
A(R, {
|
|
1224
|
-
name: "error",
|
|
1225
|
-
class: "text-red-600 mt-2",
|
|
1226
|
-
size: "sm"
|
|
1227
|
-
}),
|
|
1228
|
-
n("div", pn, m(M), 1)
|
|
1229
|
-
]))), 128))
|
|
1230
|
-
])
|
|
1231
|
-
]),
|
|
1232
|
-
_: 1
|
|
1233
|
-
})) : Z("", !0),
|
|
1234
|
-
A(W, {
|
|
1235
|
-
variant: "outlined",
|
|
1236
|
-
class: "p-16"
|
|
1237
|
-
}, {
|
|
1238
|
-
default: Q(() => [
|
|
1239
|
-
n("div", vn, m(l(e)("inventory.common.rawData")), 1),
|
|
1240
|
-
n("div", yn, [
|
|
1241
|
-
n("pre", gn, m(JSON.stringify(c.value.details, null, 2)), 1)
|
|
1242
|
-
])
|
|
1243
|
-
]),
|
|
1244
|
-
_: 1
|
|
1245
|
-
})
|
|
1246
|
-
])) : Z("", !0)
|
|
1247
|
-
]),
|
|
1248
|
-
_: 1
|
|
1249
|
-
}, 8, ["model-value", "header"])
|
|
1250
|
-
];
|
|
1251
|
-
}),
|
|
1252
|
-
_: 1
|
|
1253
|
-
}, 8, ["title", "actions"])) : l(g).isLoaded ? (C(), ae(Se, {
|
|
1254
|
-
key: 2,
|
|
1255
|
-
title: l(e)("inventory.common.import")
|
|
1256
|
-
}, {
|
|
1257
|
-
default: Q(() => [
|
|
1258
|
-
n("div", _n, [
|
|
1259
|
-
A(R, {
|
|
1260
|
-
name: "block",
|
|
1261
|
-
class: "text-gray-400",
|
|
1262
|
-
size: "xl"
|
|
1263
|
-
}),
|
|
1264
|
-
n("div", wn, [
|
|
1265
|
-
n("div", En, m(l(e)("inventory.common.featureNotAvailable")), 1),
|
|
1266
|
-
n("div", In, m(l(e)("inventory.common.bulkImportNotEnabled")), 1)
|
|
1267
|
-
])
|
|
1268
|
-
])
|
|
1269
|
-
]),
|
|
1270
|
-
_: 1
|
|
1271
|
-
}, 8, ["title"])) : (C(), ae(Se, {
|
|
1272
|
-
key: 1,
|
|
1273
|
-
title: l(e)("inventory.common.import")
|
|
1274
|
-
}, {
|
|
1275
|
-
default: Q(() => [
|
|
1276
|
-
n("div", bn, [
|
|
1277
|
-
A(X, { size: "lg" }),
|
|
1278
|
-
n("div", hn, [
|
|
1279
|
-
n("div", xn, m(l(e)("inventory.common.loading")), 1)
|
|
1280
|
-
])
|
|
1281
|
-
])
|
|
1282
|
-
]),
|
|
1283
|
-
_: 1
|
|
1284
|
-
}, 8, ["title"]));
|
|
1285
|
-
};
|
|
1286
|
-
}
|
|
1287
|
-
});
|
|
1288
|
-
export {
|
|
1289
|
-
Bn as default
|
|
1290
|
-
};
|