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