@feedmepos/mf-inventory-portal 1.2.7-dev.8 → 1.2.7
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-DIqdK9d8.js → App-BtLCesbn.js} +1 -1
- package/dist/{ApprovalView-BKK_eDzO.js → ApprovalView-Ba4XBhGf.js} +68 -69
- package/dist/{BindingsDialog-BRzOVR30.js → BindingsDialog-BbBUniCu.js} +2 -2
- package/dist/{BindingsPicker-BtCdvAgU.js → BindingsPicker-C3q3ROku.js} +1 -1
- package/dist/{BindingsTable-DnS3ypzP.js → BindingsTable-BTxWMif_.js} +1 -1
- package/dist/{ClosingDraftView-BZLUoCOk.js → ClosingDraftView-DGITBnaY.js} +203 -203
- package/dist/ClosingTemplateView-eRvwxXBq.js +1908 -0
- package/dist/{DeliveryOrderPrintPreview-ClbyQK9l.js → DeliveryOrderPrintPreview-CUaHpblV.js} +8 -8
- package/dist/{FmAdminBadge-DcDyRj6K.js → FmAdminBadge-BdwGZY-f.js} +6 -6
- package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-lDkElrkF.js +227 -0
- package/dist/{FmMultiselectDialog-CYPN-2of.js → FmMultiselectDialog-BETfHs3j.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-C4QKxv_V.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BNdbeRQp.js} +23 -23
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-Bollyyl1.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-VYMMcwLl.js} +1 -1
- package/dist/{IngredientGroupView-baNWf_60.js → IngredientGroupView-C4d9b3Td.js} +12 -12
- package/dist/IngredientsView-BvqWuIVT.js +1876 -0
- package/dist/{IntegrationView-CiwxB7rj.js → IntegrationView-CWFzRDWO.js} +1552 -1430
- package/dist/{InventoryBindingForm-BCY8vtGx.js → InventoryBindingForm-Cx0Prlq8.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-hjbfvhVh.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-cpR3Sf2Y.js} +41 -41
- package/dist/{InventoryBindingSummary-CCPxd5ir.js → InventoryBindingSummary-l8XvpxVU.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CmqDgde9.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BjRvIX-v.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DnpRhNG0.js → PremiumBadge.vue_vue_type_script_setup_true_lang-gjuZveKy.js} +11 -11
- package/dist/{PublishView-CDrYaJX9.js → PublishView-D2iUnDan.js} +14 -14
- package/dist/{PurchaseOrderPrintPreview-QeqPa532.js → PurchaseOrderPrintPreview-DdLvM-wt.js} +11 -11
- package/dist/{ReceiveRequestView-C8NJ7ILf.js → ReceiveRequestView-DpF5ZzvH.js} +145 -148
- package/dist/{RecipeView-Bmvl_poR.js → RecipeView-Dvtm8o1Y.js} +49 -49
- package/dist/StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js +59 -0
- package/dist/StockView-CRDu_GQ_.js +2086 -0
- package/dist/{SupplierView-Dq3vMn5q.js → SupplierView-7GtIJ3Fz.js} +1015 -1133
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DbmLtbZt.js +2494 -0
- package/dist/{TransferTemplateView-NTw0N3zX.js → TransferTemplateView-Cmvg-yvW.js} +130 -131
- package/dist/{UnitView-BFeT0jpH.js → UnitView-DjVm1iVX.js} +59 -59
- package/dist/WarehouseView-CBso3SXT.js +1034 -0
- package/dist/api/inventory.d.ts +0 -8
- package/dist/api/netsuite.d.ts +0 -3
- package/dist/api/purchase-order-template.d.ts +0 -1
- package/dist/api/purchase-order.d.ts +0 -2
- package/dist/api/warehouse.d.ts +1 -3
- package/dist/{app-D5vamHiS.js → app-Z-ylwRmy.js} +17113 -17876
- package/dist/app.d.ts +9 -96
- package/dist/app.js +3 -3
- package/dist/components/FmEnhancedSelect.vue.d.ts +30 -0
- package/dist/components/FmInventoryTableToolbar.vue.d.ts +2 -9
- package/dist/{decimal-BVxO-7VE.js → decimal-D1pJ2776.js} +1 -1
- package/dist/{format-unit-display-CvUKKMA2.js → format-unit-display-9BMm-8A4.js} +404 -372
- package/dist/{index-_TXzIRmu.js → index-BOl10vcm.js} +1 -1
- package/dist/{index-BmPwzWR6.js → index-rEIM0AVC.js} +1 -1
- package/dist/{stock-4-rgOZcm.js → stock-B8ewk80v.js} +1 -1
- package/dist/stores/feature.d.ts +0 -10
- package/dist/stores/integration/netsuite.d.ts +0 -19
- package/dist/stores/inventory.d.ts +0 -1
- package/dist/stores/location.d.ts +1 -57
- package/dist/stores/supplier.d.ts +0 -96
- package/dist/stores/warehouse.d.ts +0 -4
- package/dist/{supplier-BOW9xXhe.js → supplier-DLSXYY1o.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-DbJhveFq.js → use-ingredient-select-dialog-CTjwdY3T.js} +5 -5
- package/dist/{use-inventory-binding-dialog-BNY9P_Pg.js → use-inventory-binding-dialog-zXJB7MQY.js} +8 -8
- package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +0 -24
- package/dist/views/ingredients/components/ingredient-form/IngredientFormProps.d.ts +0 -6
- package/dist/views/integration/components/netsuite/business/BusinessNetSuiteSideSheet.vue.d.ts +0 -2
- package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +0 -1
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +0 -60
- package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +0 -10
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +0 -94
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +1 -72
- package/dist/views/supplier/components/SupplierForm.vue.d.ts +0 -8
- package/dist/views/supplier/components/SupplierSupplyItemField.vue.d.ts +0 -3
- package/dist/views/supplier/composables/use-supplier-table.d.ts +0 -4
- package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +0 -8
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +0 -16
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +0 -48
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +0 -48
- package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +0 -8
- package/package.json +2 -2
- package/dist/ClosingTemplateView-BwDaPcHe.js +0 -1862
- package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Da5zZ3ZF.js +0 -230
- package/dist/IngredientsView-B00A9orQ.js +0 -2306
- package/dist/StockView-H8EcBWrt.js +0 -2104
- package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-D-H0oT-V.js +0 -158
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-r7U0Wgsm.js +0 -3058
- package/dist/WarehouseView-50a9WiLB.js +0 -1066
- package/dist/api/shipment.d.ts +0 -11
- package/dist/closing-template-C8n1siov.js +0 -53
- package/dist/components/netsuite/SubsidiaryTreeDialog.vue.d.ts +0 -2
- package/dist/purchase-order-template-CekjfB92.js +0 -41
- package/dist/views/receive-request/components/delivery-order-form/CreateForm.vue.d.ts +0 -16
- package/dist/views/receive-request/components/delivery-order-form/CreateFormProps.d.ts +0 -4
- package/dist/views/receive-request/components/delivery-order-form/EditForm.vue.d.ts +0 -16
- package/dist/views/receive-request/components/delivery-order-form/EditFormProps.d.ts +0 -4
|
@@ -1,34 +1,65 @@
|
|
|
1
|
-
import { a as q,
|
|
2
|
-
import { useCoreStore as
|
|
3
|
-
import { useDialogChild as
|
|
1
|
+
import { a4 as Ae, a as q, V as Ie, al as M, v as De, am as he, w as ve, u as Z, j as B, x as Oe, aO as ce, y as ge, b as te, t as G, Z as J, aN as Fe, aF as Pe, a1 as Ue, z as Me, B as Be, an as Le, e as me, f as re, R as ue, a3 as Qe, aj as He, D as j, i as I, h as Ve } from "./app-Z-ylwRmy.js";
|
|
2
|
+
import { useCoreStore as ne, useI18n as oe } from "@feedmepos/mf-common";
|
|
3
|
+
import { useDialogChild as qe, useSnackbar as be, useDialog as je, FmButtonVariant as z, components as X } from "@feedmepos/ui-library";
|
|
4
4
|
import { defineStore as xe } from "pinia";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
5
|
+
import { defineComponent as ae, resolveComponent as Q, openBlock as _, createElementBlock as k, createElementVNode as C, normalizeClass as H, createTextVNode as ze, toDisplayString as D, unref as A, createCommentVNode as V, createVNode as P, withCtx as ee, Fragment as L, renderList as Y, ref as N, onMounted as Ke, computed as de, watch as Ye, createSlots as We, createBlock as K, h as W } from "vue";
|
|
6
|
+
import { useRouter as Ge } from "vue-router";
|
|
7
|
+
import { u as se } from "./supplier-DLSXYY1o.js";
|
|
8
|
+
const Se = Ae((e, t) => {
|
|
9
|
+
function s() {
|
|
10
|
+
var o;
|
|
11
|
+
return `business_${((o = ne().currentBusiness.value) == null ? void 0 : o._id) ?? ""}`;
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
async getTemplate(l) {
|
|
15
|
+
const i = s(), o = `${e.inventoryBackendUrl}/${i}/purchase-order-template/${l}`;
|
|
16
|
+
return t.get(o);
|
|
17
|
+
},
|
|
18
|
+
async readTemplates() {
|
|
19
|
+
const l = s(), i = `${e.inventoryBackendUrl}/${l}/purchase-order-template`;
|
|
20
|
+
return t.get(i);
|
|
21
|
+
},
|
|
22
|
+
async createTemplate(l) {
|
|
23
|
+
const i = s(), o = `${e.inventoryBackendUrl}/${i}/purchase-order-template`;
|
|
24
|
+
return t.post(o, l);
|
|
25
|
+
},
|
|
26
|
+
async updateTemplate(l) {
|
|
27
|
+
const i = s(), o = `${e.inventoryBackendUrl}/${i}/purchase-order-template`;
|
|
28
|
+
return t.put(o, l);
|
|
29
|
+
},
|
|
30
|
+
async deleteTemplate(l) {
|
|
31
|
+
const i = s(), o = `${e.inventoryBackendUrl}/${i}/purchase-order-template`;
|
|
32
|
+
return t.delete(o, { _id: l._id, _rev: l._rev });
|
|
33
|
+
},
|
|
34
|
+
async importTemplates(l) {
|
|
35
|
+
const i = s(), o = `${e.inventoryBackendUrl}/${i}/purchase-order-template/import`;
|
|
36
|
+
return t.post(o, l);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
});
|
|
9
40
|
function Te(e) {
|
|
10
|
-
const t = q(),
|
|
11
|
-
if (
|
|
41
|
+
const t = q(), s = e.sku, l = t.skuById[s._id];
|
|
42
|
+
if (l.unit._id !== s.unit._id) return !0;
|
|
12
43
|
const i = e.measurement;
|
|
13
|
-
return i ? !t.unitById[
|
|
44
|
+
return i ? !t.unitById[l.unit._id].measurements.find((c) => c.id === i.id) : !1;
|
|
14
45
|
}
|
|
15
|
-
var
|
|
16
|
-
const
|
|
46
|
+
var R = /* @__PURE__ */ ((e) => (e.PURCHASE = "PURCHASE", e.TRANSFER = "TRANSFER", e))(R || {}), ie = /* @__PURE__ */ ((e) => (e.Source = "Source", e.Destination = "Destination", e.Ingredient = "Ingredient", e))(ie || {});
|
|
47
|
+
const pe = Ie(0);
|
|
17
48
|
function _e(e) {
|
|
18
|
-
var
|
|
49
|
+
var l;
|
|
19
50
|
const t = e.sku;
|
|
20
51
|
return {
|
|
21
52
|
code: t.code,
|
|
22
53
|
overrideCode: e.code,
|
|
23
54
|
name: t.name,
|
|
24
|
-
unit: ((
|
|
25
|
-
defaultQuantity: +
|
|
26
|
-
minimumQuantity: +
|
|
27
|
-
maximumQuantity: +
|
|
28
|
-
quantityStep: +
|
|
55
|
+
unit: ((l = t.unit.measurements.find((i) => i.id === t.trackingMeasurement)) == null ? void 0 : l.abbrev) ?? t.unit.abbrev,
|
|
56
|
+
defaultQuantity: +B(e.quantity),
|
|
57
|
+
minimumQuantity: +B(e.minimumQuantity ?? pe),
|
|
58
|
+
maximumQuantity: +B(e.maximumQuantity ?? pe),
|
|
59
|
+
quantityStep: +B(e.quantityStep)
|
|
29
60
|
};
|
|
30
61
|
}
|
|
31
|
-
function
|
|
62
|
+
function $e() {
|
|
32
63
|
return [
|
|
33
64
|
{
|
|
34
65
|
id: "code",
|
|
@@ -64,53 +95,53 @@ function we() {
|
|
|
64
95
|
}
|
|
65
96
|
];
|
|
66
97
|
}
|
|
67
|
-
function
|
|
68
|
-
var
|
|
69
|
-
const
|
|
98
|
+
function Ze(e) {
|
|
99
|
+
var c;
|
|
100
|
+
const s = ne().currentBusiness.value, i = (c = e.map((a) => {
|
|
70
101
|
var b;
|
|
71
|
-
const
|
|
72
|
-
["Template ID",
|
|
73
|
-
["Template name",
|
|
74
|
-
["Business name",
|
|
75
|
-
["Business ID",
|
|
76
|
-
["Menu version",
|
|
102
|
+
const m = a.purchaseOrder.items.map((r) => _e(r)), h = $e(), d = [
|
|
103
|
+
["Template ID", a._id],
|
|
104
|
+
["Template name", a.name],
|
|
105
|
+
["Business name", s == null ? void 0 : s.name],
|
|
106
|
+
["Business ID", s == null ? void 0 : s._id],
|
|
107
|
+
["Menu version", s == null ? void 0 : s.menuVersion],
|
|
77
108
|
[
|
|
78
109
|
"Purchase/Transfer",
|
|
79
|
-
typeof
|
|
110
|
+
typeof a.purchaseOrder.supplier.internal == "string" ? R.TRANSFER : R.PURCHASE
|
|
80
111
|
],
|
|
81
112
|
[
|
|
82
113
|
"Transfer from",
|
|
83
|
-
`${
|
|
84
|
-
|
|
85
|
-
|
|
114
|
+
`${a.purchaseOrder.supplier.name} (${[
|
|
115
|
+
a.purchaseOrder.supplier.internal,
|
|
116
|
+
a.purchaseOrder.supplier._id
|
|
86
117
|
].filter((r) => r).join("_")})`
|
|
87
118
|
],
|
|
88
119
|
[
|
|
89
120
|
"Locations",
|
|
90
|
-
...(b =
|
|
121
|
+
...(b = a.locations) != null && b.length ? a.locations.map((r) => `${r.name} (${r.dbName})`) : ["All"]
|
|
91
122
|
],
|
|
92
|
-
["Reference",
|
|
93
|
-
["Remark",
|
|
123
|
+
["Reference", a.purchaseOrder.ref ?? ""],
|
|
124
|
+
["Remark", a.purchaseOrder.remark ?? ""],
|
|
94
125
|
[],
|
|
95
126
|
h.map((r) => r.name),
|
|
96
|
-
...
|
|
97
|
-
],
|
|
98
|
-
return { name:
|
|
127
|
+
...m.map((r) => h.map((x) => r[x.id]))
|
|
128
|
+
], u = h.map((r) => `system:${r.id}`), v = M(d, u);
|
|
129
|
+
return { name: a.name, sheet: v };
|
|
99
130
|
}).reduce(
|
|
100
|
-
(
|
|
131
|
+
(a, m) => {
|
|
101
132
|
var d;
|
|
102
|
-
const h =
|
|
103
|
-
return (d =
|
|
133
|
+
const h = m.name.slice(0, 12);
|
|
134
|
+
return (d = a.sheetOccurence)[h] ?? (d[h] = 0), a.sheetOccurence[h] += 1, a.sheets[`${h} (${a.sheetOccurence[h]})`] = m.sheet, a;
|
|
104
135
|
},
|
|
105
136
|
{
|
|
106
137
|
sheets: {},
|
|
107
138
|
sheetOccurence: {}
|
|
108
139
|
}
|
|
109
|
-
)) == null ? void 0 :
|
|
110
|
-
return
|
|
140
|
+
)) == null ? void 0 : c.sheets, o = `${s == null ? void 0 : s.name} transfer templates (${De(/* @__PURE__ */ new Date())}).xlsx`, f = he(i);
|
|
141
|
+
return ve(f, o), o;
|
|
111
142
|
}
|
|
112
|
-
function
|
|
113
|
-
const e =
|
|
143
|
+
function Je() {
|
|
144
|
+
const e = ne(), t = se(), s = Z(), l = q(), i = e.currentBusiness.value, o = _e({
|
|
114
145
|
sku: {
|
|
115
146
|
unit: {
|
|
116
147
|
_id: "",
|
|
@@ -141,7 +172,7 @@ function Ze() {
|
|
|
141
172
|
amount: 1,
|
|
142
173
|
precision: 0
|
|
143
174
|
}
|
|
144
|
-
}), f =
|
|
175
|
+
}), f = $e(), c = [
|
|
145
176
|
["Template ID (leave empty to create new)"],
|
|
146
177
|
["Template Name", "New template"],
|
|
147
178
|
["Business name", i == null ? void 0 : i.name],
|
|
@@ -162,8 +193,8 @@ function Ze() {
|
|
|
162
193
|
["Remark"],
|
|
163
194
|
[],
|
|
164
195
|
f.map((r) => r.name),
|
|
165
|
-
f.map((r) =>
|
|
166
|
-
],
|
|
196
|
+
f.map((r) => o[r.id])
|
|
197
|
+
], a = f.map((r) => `system:${r.id}`), m = M(c, a), h = M(
|
|
167
198
|
[
|
|
168
199
|
...t.businessSuppliers.map((r) => [
|
|
169
200
|
`${r.name} (${r._id})`,
|
|
@@ -175,13 +206,13 @@ function Ze() {
|
|
|
175
206
|
r.address.state,
|
|
176
207
|
r.address.country
|
|
177
208
|
]),
|
|
178
|
-
...
|
|
179
|
-
var x,
|
|
209
|
+
...s.locations.map((r) => {
|
|
210
|
+
var x, $, S, p, n, y;
|
|
180
211
|
return [
|
|
181
212
|
`${r.name} (${r.dbName})`,
|
|
182
213
|
"Transfer",
|
|
183
214
|
(x = r.doc.profile.address) == null ? void 0 : x.line1,
|
|
184
|
-
(
|
|
215
|
+
($ = r.doc.profile.address) == null ? void 0 : $.line2,
|
|
185
216
|
(S = r.doc.profile.address) == null ? void 0 : S.city,
|
|
186
217
|
(p = r.doc.profile.address) == null ? void 0 : p.postcode,
|
|
187
218
|
(n = r.doc.profile.address) == null ? void 0 : n.state,
|
|
@@ -190,13 +221,13 @@ function Ze() {
|
|
|
190
221
|
})
|
|
191
222
|
],
|
|
192
223
|
["Name", "Type", "Line 1", "Line 2", "City", "Postal", "State", "Country"]
|
|
193
|
-
), d =
|
|
194
|
-
|
|
195
|
-
var x,
|
|
224
|
+
), d = M(
|
|
225
|
+
s.locations.map((r) => {
|
|
226
|
+
var x, $, S, p, n, y;
|
|
196
227
|
return [
|
|
197
228
|
`${r.name} (${r.dbName})`,
|
|
198
229
|
(x = r.doc.profile.address) == null ? void 0 : x.line1,
|
|
199
|
-
(
|
|
230
|
+
($ = r.doc.profile.address) == null ? void 0 : $.line2,
|
|
200
231
|
(S = r.doc.profile.address) == null ? void 0 : S.city,
|
|
201
232
|
(p = r.doc.profile.address) == null ? void 0 : p.postcode,
|
|
202
233
|
(n = r.doc.profile.address) == null ? void 0 : n.state,
|
|
@@ -204,41 +235,41 @@ function Ze() {
|
|
|
204
235
|
];
|
|
205
236
|
}),
|
|
206
237
|
["Name", "Line 1", "Line 2", "City", "Postal", "State", "Country"]
|
|
207
|
-
),
|
|
208
|
-
|
|
238
|
+
), u = M(
|
|
239
|
+
l.skus.map((r) => [
|
|
209
240
|
r.code,
|
|
210
241
|
r.name,
|
|
211
242
|
r.unit.abbrev,
|
|
212
243
|
...r.unit.measurements.map((x) => x.abbrev)
|
|
213
244
|
]),
|
|
214
245
|
["Code", "Name", "Base unit", "Measurements"]
|
|
215
|
-
), v =
|
|
216
|
-
Template:
|
|
246
|
+
), v = he({
|
|
247
|
+
Template: m,
|
|
217
248
|
Source: h,
|
|
218
249
|
Destination: d,
|
|
219
|
-
Ingredient:
|
|
250
|
+
Ingredient: u
|
|
220
251
|
}), b = `${i == null ? void 0 : i.name} transfer templates import.xlsx`;
|
|
221
|
-
return
|
|
252
|
+
return ve(v, b), b;
|
|
222
253
|
}
|
|
223
|
-
function
|
|
224
|
-
const
|
|
225
|
-
if (!
|
|
226
|
-
return
|
|
227
|
-
errors:
|
|
254
|
+
function Xe(e, t) {
|
|
255
|
+
const s = new Array(), l = /(.*) \(((supplier_|warehouse_|restaurant_).{24,})\)/, o = Z().locationByDbName, c = se().supplierById, a = e.trim(), m = l.exec(a);
|
|
256
|
+
if (!m)
|
|
257
|
+
return s.push(`Transfer from location value of ${a} cannot be read.`), {
|
|
258
|
+
errors: s
|
|
228
259
|
};
|
|
229
|
-
const h =
|
|
230
|
-
let
|
|
260
|
+
const h = m[1], d = m[2];
|
|
261
|
+
let u;
|
|
231
262
|
if (d.startsWith("supplier"))
|
|
232
|
-
|
|
263
|
+
u = c[d], t !== R.PURCHASE && s.push(`Expected transfer type Purchase but found ${t} instead.`);
|
|
233
264
|
else {
|
|
234
|
-
const v =
|
|
265
|
+
const v = o[d];
|
|
235
266
|
if (!v)
|
|
236
|
-
return
|
|
237
|
-
errors:
|
|
267
|
+
return s.push(`Location (${h}) of id ${d} is not found.`), {
|
|
268
|
+
errors: s
|
|
238
269
|
};
|
|
239
|
-
h !== v.name &&
|
|
270
|
+
h !== v.name && s.push(
|
|
240
271
|
`Location id ${d} has non-matching name. Found ${h} but expected ${v.name}`
|
|
241
|
-
),
|
|
272
|
+
), u = {
|
|
242
273
|
_id: v.doc._id,
|
|
243
274
|
name: v.name,
|
|
244
275
|
address: v.doc.profile.address ?? {
|
|
@@ -249,7 +280,7 @@ function Je(e, t) {
|
|
|
249
280
|
postcode: "",
|
|
250
281
|
coordinates: [0, 0]
|
|
251
282
|
},
|
|
252
|
-
internal: d.split("_")[0] === "restaurant" ?
|
|
283
|
+
internal: d.split("_")[0] === "restaurant" ? ce.enum.restaurant : ce.enum.warehouse,
|
|
253
284
|
phoneNumber: v.doc.profile.phoneNo ?? "",
|
|
254
285
|
email: v.doc.profile.email ?? "",
|
|
255
286
|
_rev: "",
|
|
@@ -258,75 +289,75 @@ function Je(e, t) {
|
|
|
258
289
|
};
|
|
259
290
|
}
|
|
260
291
|
return {
|
|
261
|
-
from:
|
|
262
|
-
errors:
|
|
292
|
+
from: u,
|
|
293
|
+
errors: s
|
|
263
294
|
};
|
|
264
295
|
}
|
|
265
|
-
function
|
|
296
|
+
function et(e) {
|
|
266
297
|
if (!e.length || `${e[0]}`.toLocaleLowerCase() === "all")
|
|
267
298
|
return [];
|
|
268
|
-
const t = /(.*) \(((warehouse_|restaurant_).{24,})\)/,
|
|
299
|
+
const t = /(.*) \(((warehouse_|restaurant_).{24,})\)/, l = Z().locationByDbName;
|
|
269
300
|
return e.map((i) => {
|
|
270
|
-
const
|
|
271
|
-
if (!
|
|
272
|
-
return
|
|
273
|
-
errors:
|
|
301
|
+
const o = new Array(), f = i.trim(), c = t.exec(f);
|
|
302
|
+
if (!c)
|
|
303
|
+
return o.push(`Enabled location value of ${f} cannot be read.`), {
|
|
304
|
+
errors: o
|
|
274
305
|
};
|
|
275
|
-
const
|
|
276
|
-
return h ? (
|
|
277
|
-
`Location id ${
|
|
306
|
+
const a = c[1], m = c[2], h = l[m];
|
|
307
|
+
return h ? (a !== h.name && o.push(
|
|
308
|
+
`Location id ${m} has non-matching name. Found ${a} but expected ${h.name}`
|
|
278
309
|
), {
|
|
279
|
-
errors:
|
|
310
|
+
errors: o,
|
|
280
311
|
location: h
|
|
281
|
-
}) : (
|
|
282
|
-
errors:
|
|
312
|
+
}) : (o.push(`Location (${a}) of id ${m} is not found.`), {
|
|
313
|
+
errors: o
|
|
283
314
|
});
|
|
284
315
|
});
|
|
285
316
|
}
|
|
286
|
-
function
|
|
317
|
+
function tt(e) {
|
|
287
318
|
const [
|
|
288
319
|
t,
|
|
289
|
-
a,
|
|
290
|
-
u,
|
|
291
|
-
i,
|
|
292
320
|
s,
|
|
293
|
-
f,
|
|
294
321
|
l,
|
|
322
|
+
i,
|
|
295
323
|
o,
|
|
324
|
+
f,
|
|
296
325
|
c,
|
|
326
|
+
a,
|
|
327
|
+
m,
|
|
297
328
|
h,
|
|
298
329
|
d
|
|
299
|
-
] =
|
|
330
|
+
] = ge(e);
|
|
300
331
|
return {
|
|
301
|
-
id: `${
|
|
302
|
-
name: `${
|
|
303
|
-
type: `${
|
|
304
|
-
transferFrom: `${
|
|
305
|
-
locations:
|
|
332
|
+
id: `${s[1] ?? ""}`.trim(),
|
|
333
|
+
name: `${l[1] ?? ""}`.trim(),
|
|
334
|
+
type: `${c[1] ?? ""}`.trim().toLocaleLowerCase() === "transfer" ? R.TRANSFER : R.PURCHASE,
|
|
335
|
+
transferFrom: `${a[1] ?? ""}`.trim(),
|
|
336
|
+
locations: m.slice(1).map((u) => `${u}`.trim()).filter((u) => u),
|
|
306
337
|
reference: `${h[1] ?? ""}`.trim(),
|
|
307
338
|
remark: `${d[1] ?? ""}`.trim()
|
|
308
339
|
};
|
|
309
340
|
}
|
|
310
|
-
function
|
|
341
|
+
function rt(e) {
|
|
311
342
|
const [
|
|
312
343
|
t,
|
|
313
|
-
a,
|
|
314
|
-
u,
|
|
315
|
-
i,
|
|
316
344
|
s,
|
|
317
|
-
f,
|
|
318
345
|
l,
|
|
346
|
+
i,
|
|
319
347
|
o,
|
|
348
|
+
f,
|
|
320
349
|
c,
|
|
350
|
+
a,
|
|
351
|
+
m,
|
|
321
352
|
h,
|
|
322
353
|
d,
|
|
323
|
-
|
|
354
|
+
u,
|
|
324
355
|
v,
|
|
325
356
|
...b
|
|
326
|
-
] =
|
|
357
|
+
] = ge(e);
|
|
327
358
|
if (!t || !t.length || t.some((p) => p.length && !p.startsWith("system:")))
|
|
328
359
|
throw new Error("Missing meta header. Excel file does not come from the template.");
|
|
329
|
-
const r = t.map((p) => p.split(":")[1]),
|
|
360
|
+
const r = t.map((p) => p.split(":")[1]), $ = [
|
|
330
361
|
"code",
|
|
331
362
|
"name",
|
|
332
363
|
"unit",
|
|
@@ -335,15 +366,15 @@ function tt(e) {
|
|
|
335
366
|
"maximumQuantity",
|
|
336
367
|
"quantityStep"
|
|
337
368
|
].filter((p) => !r.includes(p));
|
|
338
|
-
if (
|
|
369
|
+
if ($.length)
|
|
339
370
|
throw new Error(
|
|
340
|
-
`Missing meta headers (${
|
|
371
|
+
`Missing meta headers (${$.join()}). Excel file does not come from the template.`
|
|
341
372
|
);
|
|
342
373
|
return b.map((p, n) => {
|
|
343
374
|
const y = {};
|
|
344
375
|
for (const T in r) {
|
|
345
|
-
const
|
|
346
|
-
Object.assign(y, { [
|
|
376
|
+
const w = r[T];
|
|
377
|
+
Object.assign(y, { [w]: p[T] });
|
|
347
378
|
}
|
|
348
379
|
return {
|
|
349
380
|
index: n,
|
|
@@ -351,42 +382,42 @@ function tt(e) {
|
|
|
351
382
|
};
|
|
352
383
|
});
|
|
353
384
|
}
|
|
354
|
-
function
|
|
355
|
-
const
|
|
385
|
+
function nt(e, t, s) {
|
|
386
|
+
const l = e === "" ? null : G(e, s), i = t === "" ? null : G(t, s), o = l && i && l.amount > i.amount;
|
|
356
387
|
return {
|
|
357
|
-
min:
|
|
388
|
+
min: l,
|
|
358
389
|
max: i,
|
|
359
|
-
compareError:
|
|
390
|
+
compareError: o ? "Minimum amount must be less than or equal to maximum amount" : void 0
|
|
360
391
|
};
|
|
361
392
|
}
|
|
362
|
-
function
|
|
363
|
-
const
|
|
364
|
-
if (!
|
|
393
|
+
function ot(e, t, s) {
|
|
394
|
+
const l = q(), i = te(), o = l.skuByCode[e.code], f = new Array();
|
|
395
|
+
if (!o)
|
|
365
396
|
return f.push(`Cannot find ingredient with code (${e.code}) ${e.name}.`), {
|
|
366
397
|
index: t,
|
|
367
398
|
errors: f
|
|
368
399
|
};
|
|
369
|
-
if (
|
|
400
|
+
if (s.filter((p) => p.data.code === e.code).length > 1)
|
|
370
401
|
return f.push(`Ingredient ${e.code} is defined twice.`), {
|
|
371
402
|
index: t,
|
|
372
403
|
errors: f
|
|
373
404
|
};
|
|
374
|
-
const
|
|
375
|
-
if (
|
|
405
|
+
const c = o.unit, a = c == null ? void 0 : c.measurements.find((p) => p.abbrev === e.unit);
|
|
406
|
+
if (c.abbrev !== e.unit && !a) {
|
|
376
407
|
const p = `Cannot find unit measurement of symbol ${e.unit || "[empty]"} for ingredient (${e.code}) ${e.name}.`;
|
|
377
408
|
f.push(p);
|
|
378
409
|
const n = {
|
|
379
|
-
sku:
|
|
380
|
-
code: e.overrideCode ||
|
|
381
|
-
name:
|
|
382
|
-
measurement:
|
|
410
|
+
sku: o,
|
|
411
|
+
code: e.overrideCode || o.code,
|
|
412
|
+
name: o.name,
|
|
413
|
+
measurement: a,
|
|
383
414
|
quantity: { amount: 0, precision: 0 },
|
|
384
415
|
quantityStep: { amount: 0, precision: 0 },
|
|
385
416
|
minimumQuantity: { amount: 0, precision: 0 },
|
|
386
417
|
maximumQuantity: { amount: 0, precision: 0 }
|
|
387
418
|
};
|
|
388
419
|
if (i.isEnabled) {
|
|
389
|
-
const y = i.getItemCustomCode(
|
|
420
|
+
const y = i.getItemCustomCode(o);
|
|
390
421
|
y && (n.code = y);
|
|
391
422
|
}
|
|
392
423
|
return {
|
|
@@ -395,32 +426,32 @@ function nt(e, t, a) {
|
|
|
395
426
|
templateItem: n
|
|
396
427
|
};
|
|
397
428
|
}
|
|
398
|
-
const
|
|
429
|
+
const m = G(
|
|
399
430
|
e.quantityStep,
|
|
400
|
-
J(
|
|
431
|
+
J(c, a)
|
|
401
432
|
);
|
|
402
433
|
(Number.isNaN(Number(e.quantityStep)) || Number(e.quantityStep) <= 0) && f.push("Amount step must be more than 0");
|
|
403
|
-
const h =
|
|
434
|
+
const h = Fe(m), d = nt(
|
|
404
435
|
e.minimumQuantity,
|
|
405
436
|
e.maximumQuantity,
|
|
406
|
-
J(
|
|
407
|
-
),
|
|
437
|
+
J(c, a)
|
|
438
|
+
), u = d.min, v = d.max;
|
|
408
439
|
d.compareError && f.push(d.compareError);
|
|
409
|
-
const b =
|
|
440
|
+
const b = Pe(+e.minimumQuantity, +e.maximumQuantity), r = G(
|
|
410
441
|
e.defaultQuantity,
|
|
411
|
-
J(
|
|
442
|
+
J(c, a)
|
|
412
443
|
), x = h(r);
|
|
413
444
|
typeof x == "string" && f.push(`Default amount: ${x}`);
|
|
414
|
-
const
|
|
415
|
-
typeof
|
|
445
|
+
const $ = d.min && d.max ? b(`${e.defaultQuantity}`) : null;
|
|
446
|
+
typeof $ == "string" && f.push(`Default amount: ${$}`);
|
|
416
447
|
const S = {
|
|
417
|
-
sku:
|
|
418
|
-
code: e.overrideCode ||
|
|
419
|
-
name: e.name ||
|
|
420
|
-
measurement:
|
|
448
|
+
sku: o,
|
|
449
|
+
code: e.overrideCode || o.code,
|
|
450
|
+
name: e.name || o.name,
|
|
451
|
+
measurement: a,
|
|
421
452
|
quantity: r,
|
|
422
|
-
quantityStep:
|
|
423
|
-
minimumQuantity:
|
|
453
|
+
quantityStep: m,
|
|
454
|
+
minimumQuantity: u,
|
|
424
455
|
maximumQuantity: v
|
|
425
456
|
};
|
|
426
457
|
return {
|
|
@@ -429,80 +460,80 @@ function nt(e, t, a) {
|
|
|
429
460
|
templateItem: S
|
|
430
461
|
};
|
|
431
462
|
}
|
|
432
|
-
function
|
|
463
|
+
function at(e) {
|
|
433
464
|
const t = e.SheetNames.filter(
|
|
434
|
-
(
|
|
435
|
-
),
|
|
465
|
+
(o) => !Object.values(ie).map(String).includes(o)
|
|
466
|
+
), l = Ce().templates, i = Oe(l, "_id");
|
|
436
467
|
try {
|
|
437
468
|
return t.reduce(
|
|
438
|
-
(
|
|
469
|
+
(o, f) => {
|
|
439
470
|
var p;
|
|
440
|
-
const
|
|
441
|
-
|
|
442
|
-
const d = h.from,
|
|
443
|
-
|
|
444
|
-
const b =
|
|
445
|
-
(n, y) =>
|
|
471
|
+
const c = new Array(), a = e.Sheets[f], m = tt(a), h = Xe(m.transferFrom, m.type);
|
|
472
|
+
c.push(...h.errors);
|
|
473
|
+
const d = h.from, u = et(m.locations), v = u.filter((n) => n.location).map((n) => n.location);
|
|
474
|
+
c.push(...u.flatMap((n) => n.errors));
|
|
475
|
+
const b = rt(a).filter((n) => n.data.code), r = b.map(
|
|
476
|
+
(n, y) => ot(n.data, y, b)
|
|
446
477
|
);
|
|
447
|
-
|
|
478
|
+
c.push(
|
|
448
479
|
...r.flatMap(
|
|
449
480
|
(n) => n.errors.map((y) => `(Excel row ${n.index + 14}) ${y}`)
|
|
450
481
|
)
|
|
451
482
|
);
|
|
452
483
|
const x = r.filter((n) => n.templateItem).map((n) => n.templateItem);
|
|
453
|
-
if (
|
|
454
|
-
const n = i[
|
|
484
|
+
if (m.id) {
|
|
485
|
+
const n = i[m.id];
|
|
455
486
|
if (!n) {
|
|
456
487
|
const T = {
|
|
457
|
-
_id:
|
|
488
|
+
_id: m.id,
|
|
458
489
|
_rev: "",
|
|
459
|
-
name:
|
|
460
|
-
purchaseOrder:
|
|
490
|
+
name: m.name || `(unnamed from sheet ${f || "<unnamed sheet>"})`,
|
|
491
|
+
purchaseOrder: st()
|
|
461
492
|
};
|
|
462
|
-
return
|
|
493
|
+
return c.push(`Template ID ${m.id} is not found.`), o.importUpdateResult.push({
|
|
463
494
|
type: "update",
|
|
464
495
|
original: T,
|
|
465
496
|
template: T,
|
|
466
497
|
excelSheetName: f,
|
|
467
|
-
errors:
|
|
468
|
-
}),
|
|
498
|
+
errors: c
|
|
499
|
+
}), o;
|
|
469
500
|
}
|
|
470
501
|
const y = {
|
|
471
502
|
type: "update",
|
|
472
503
|
original: n,
|
|
473
504
|
template: {
|
|
474
505
|
...n,
|
|
475
|
-
name:
|
|
506
|
+
name: m.name,
|
|
476
507
|
locations: v.length ? v : null,
|
|
477
508
|
purchaseOrder: {
|
|
478
509
|
...n.purchaseOrder,
|
|
479
510
|
supplier: d ?? ((p = n.purchaseOrder) == null ? void 0 : p.supplier),
|
|
480
|
-
ref:
|
|
481
|
-
remark:
|
|
511
|
+
ref: m.reference,
|
|
512
|
+
remark: m.remark,
|
|
482
513
|
items: x
|
|
483
514
|
}
|
|
484
515
|
},
|
|
485
516
|
excelSheetName: f,
|
|
486
|
-
errors:
|
|
517
|
+
errors: c
|
|
487
518
|
};
|
|
488
|
-
return
|
|
519
|
+
return o.importUpdateResult.push(y), o;
|
|
489
520
|
}
|
|
490
521
|
const S = {
|
|
491
522
|
type: "create",
|
|
492
523
|
template: {
|
|
493
|
-
name:
|
|
524
|
+
name: m.name,
|
|
494
525
|
locations: v.length ? v : null,
|
|
495
526
|
purchaseOrder: {
|
|
496
|
-
supplier: d ??
|
|
497
|
-
ref:
|
|
498
|
-
remark:
|
|
527
|
+
supplier: d ?? we(),
|
|
528
|
+
ref: m.reference,
|
|
529
|
+
remark: m.remark,
|
|
499
530
|
items: x
|
|
500
531
|
}
|
|
501
532
|
},
|
|
502
533
|
excelSheetName: f,
|
|
503
|
-
errors:
|
|
534
|
+
errors: c
|
|
504
535
|
};
|
|
505
|
-
return
|
|
536
|
+
return o.importCreateResult.push(S), o;
|
|
506
537
|
},
|
|
507
538
|
{
|
|
508
539
|
invalidExcel: !1,
|
|
@@ -510,16 +541,16 @@ function ot(e) {
|
|
|
510
541
|
importUpdateResult: new Array()
|
|
511
542
|
}
|
|
512
543
|
);
|
|
513
|
-
} catch (
|
|
544
|
+
} catch (o) {
|
|
514
545
|
return {
|
|
515
546
|
invalidExcel: !0,
|
|
516
|
-
invalidExcelMessage: (
|
|
547
|
+
invalidExcelMessage: (o == null ? void 0 : o.message) ?? "Invalid excel",
|
|
517
548
|
importCreateResult: [],
|
|
518
549
|
importUpdateResult: []
|
|
519
550
|
};
|
|
520
551
|
}
|
|
521
552
|
}
|
|
522
|
-
function
|
|
553
|
+
function we() {
|
|
523
554
|
return {
|
|
524
555
|
_id: "",
|
|
525
556
|
name: "",
|
|
@@ -533,18 +564,18 @@ function $e() {
|
|
|
533
564
|
}
|
|
534
565
|
};
|
|
535
566
|
}
|
|
536
|
-
function
|
|
567
|
+
function st() {
|
|
537
568
|
return {
|
|
538
569
|
remark: void 0,
|
|
539
570
|
ref: void 0,
|
|
540
571
|
items: [],
|
|
541
|
-
supplier:
|
|
572
|
+
supplier: we()
|
|
542
573
|
};
|
|
543
574
|
}
|
|
544
|
-
const
|
|
575
|
+
const it = { class: "flex items-center gap-12 pl-8" }, lt = { class: "flex flex-col" }, ct = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" }, mt = { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, ut = {
|
|
545
576
|
key: 0,
|
|
546
577
|
class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
|
|
547
|
-
},
|
|
578
|
+
}, dt = { key: 0 }, fe = /* @__PURE__ */ ae({
|
|
548
579
|
__name: "TransferTemplateImportItem",
|
|
549
580
|
props: {
|
|
550
581
|
type: {},
|
|
@@ -555,31 +586,31 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
555
586
|
errors: {}
|
|
556
587
|
},
|
|
557
588
|
setup(e) {
|
|
558
|
-
return (t,
|
|
559
|
-
var
|
|
560
|
-
const
|
|
561
|
-
return _(),
|
|
562
|
-
|
|
563
|
-
C("div",
|
|
564
|
-
C("div",
|
|
589
|
+
return (t, s) => {
|
|
590
|
+
var o, f, c;
|
|
591
|
+
const l = Q("FmIcon"), i = Q("FmTooltip");
|
|
592
|
+
return _(), k("div", it, [
|
|
593
|
+
s[0] || (s[0] = C("div", null, "•", -1)),
|
|
594
|
+
C("div", lt, [
|
|
595
|
+
C("div", ct, [
|
|
565
596
|
C("div", {
|
|
566
597
|
class: H({
|
|
567
598
|
"text-fm-color-system-error-300": t.errors.length
|
|
568
599
|
})
|
|
569
600
|
}, [
|
|
570
|
-
|
|
571
|
-
C("span",
|
|
572
|
-
t.type === "create" ? (_(),
|
|
601
|
+
ze(D(t.name) + " ", 1),
|
|
602
|
+
C("span", mt, " (" + D(A(Ue)(`${t.transferType}`)) + ") ", 1),
|
|
603
|
+
t.type === "create" ? (_(), k("span", ut, "(new)")) : V("", !0)
|
|
573
604
|
], 2),
|
|
574
|
-
t.errors.length ? (_(),
|
|
605
|
+
t.errors.length ? (_(), k("div", dt, [
|
|
575
606
|
P(i, { "z-index": 50 }, {
|
|
576
607
|
content: ee(() => [
|
|
577
608
|
C("ol", null, [
|
|
578
|
-
(_(!0),
|
|
609
|
+
(_(!0), k(L, null, Y(t.errors, (a, m) => (_(), k("li", { key: m }, D(a), 1))), 128))
|
|
579
610
|
])
|
|
580
611
|
]),
|
|
581
612
|
default: ee(() => [
|
|
582
|
-
P(
|
|
613
|
+
P(l, {
|
|
583
614
|
name: "error",
|
|
584
615
|
size: "sm",
|
|
585
616
|
color: "system-error-300"
|
|
@@ -597,93 +628,93 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
597
628
|
"text-fm-color-typo-secondary": !t.errors.length
|
|
598
629
|
}
|
|
599
630
|
])
|
|
600
|
-
}, D((
|
|
631
|
+
}, D((o = t.locations) != null && o.length ? `${(f = t.locations) == null ? void 0 : f.length} locations` : "All locations") + ", " + D(`${(c = t.items) == null ? void 0 : c.length} items`), 3)
|
|
601
632
|
])
|
|
602
633
|
]);
|
|
603
634
|
};
|
|
604
635
|
}
|
|
605
|
-
}),
|
|
636
|
+
}), pt = { class: "flex flex-col gap-24" }, ft = {
|
|
606
637
|
key: 0,
|
|
607
638
|
class: "flex items-center gap-8"
|
|
608
|
-
},
|
|
639
|
+
}, yt = { class: "flex flex-col gap-8" }, ht = { class: "line-clamp-2 text-ellipsis break-all" }, vt = {
|
|
609
640
|
key: 2,
|
|
610
641
|
class: "shrink-0"
|
|
611
|
-
},
|
|
642
|
+
}, gt = {
|
|
612
643
|
key: 0,
|
|
613
644
|
class: "flex flex-col"
|
|
614
|
-
},
|
|
645
|
+
}, bt = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, xt = {
|
|
615
646
|
key: 0,
|
|
616
647
|
class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
|
|
617
|
-
},
|
|
648
|
+
}, St = { class: "fm-typo-en-body-lg-600" }, Tt = /* @__PURE__ */ ae({
|
|
618
649
|
__name: "TransferTemplateImport",
|
|
619
650
|
setup(e) {
|
|
620
|
-
const t =
|
|
621
|
-
|
|
622
|
-
|
|
651
|
+
const t = N(null), s = qe(), l = be(), i = N(!1), o = N(!1), f = se();
|
|
652
|
+
Ke(async () => {
|
|
653
|
+
o.value = !0;
|
|
623
654
|
try {
|
|
624
655
|
await f.readSuppliers().delayed(1e3);
|
|
625
656
|
} catch {
|
|
626
|
-
|
|
657
|
+
l.open({
|
|
627
658
|
title: "Something went wrong.",
|
|
628
659
|
message: "Error at reading suppliers list. Please try again.",
|
|
629
660
|
type: "error"
|
|
630
661
|
});
|
|
631
662
|
} finally {
|
|
632
|
-
|
|
663
|
+
o.value = !1;
|
|
633
664
|
}
|
|
634
665
|
});
|
|
635
|
-
const
|
|
636
|
-
() => !!
|
|
637
|
-
), d =
|
|
638
|
-
() => !!
|
|
639
|
-
), { t:
|
|
666
|
+
const c = N(new Array()), a = N([]), m = N([]), h = de(
|
|
667
|
+
() => !!c.value.length || a.value.some((b) => b.errors.length) || m.value.some((b) => b.errors.length)
|
|
668
|
+
), d = de(
|
|
669
|
+
() => !!a.value.length || !!m.value.length
|
|
670
|
+
), { t: u } = oe();
|
|
640
671
|
async function v(b) {
|
|
641
|
-
|
|
672
|
+
c.value = [], a.value = [], m.value = [];
|
|
642
673
|
try {
|
|
643
674
|
i.value = !0;
|
|
644
675
|
const [r] = await Promise.all([
|
|
645
|
-
|
|
676
|
+
Be(b),
|
|
646
677
|
// fake buffer
|
|
647
678
|
new Promise((p) => setTimeout(p, 1e3))
|
|
648
679
|
]);
|
|
649
680
|
if (!r.SheetNames.filter(
|
|
650
|
-
(p) => !Object.values(
|
|
681
|
+
(p) => !Object.values(ie).map(String).includes(p)
|
|
651
682
|
).find((p) => p)) {
|
|
652
|
-
|
|
683
|
+
c.value.push(u("inventory.ingredient.import.fileError.noSheet"));
|
|
653
684
|
return;
|
|
654
685
|
}
|
|
655
|
-
const S =
|
|
686
|
+
const S = at(r);
|
|
656
687
|
if (S.invalidExcel) {
|
|
657
|
-
|
|
658
|
-
S.invalidExcelMessage ??
|
|
688
|
+
c.value.push(
|
|
689
|
+
S.invalidExcelMessage ?? u("inventory.ingredient.import.fileError.invalidExcel")
|
|
659
690
|
);
|
|
660
691
|
return;
|
|
661
692
|
}
|
|
662
|
-
if (
|
|
663
|
-
|
|
693
|
+
if (a.value = S.importCreateResult, m.value = S.importUpdateResult, !a.value.length && !m.value.length) {
|
|
694
|
+
c.value.push(u("inventory.ingredient.import.fileError.noData"));
|
|
664
695
|
return;
|
|
665
696
|
}
|
|
666
|
-
|
|
697
|
+
s.emitData(S);
|
|
667
698
|
} catch (r) {
|
|
668
|
-
|
|
669
|
-
title:
|
|
699
|
+
l.open({
|
|
700
|
+
title: u("inventory.ingredient.import.fileError.unableToRead"),
|
|
670
701
|
message: r == null ? void 0 : r.message,
|
|
671
702
|
type: "error"
|
|
672
703
|
}), console.error("Error in reading file", r);
|
|
673
704
|
} finally {
|
|
674
|
-
|
|
675
|
-
title:
|
|
705
|
+
c.value.length && l.open({
|
|
706
|
+
title: u("inventory.ingredient.import.fileError.invalidExcel"),
|
|
676
707
|
type: "error"
|
|
677
708
|
}), i.value = !1;
|
|
678
709
|
}
|
|
679
710
|
}
|
|
680
|
-
return
|
|
711
|
+
return Ye(t, (b) => {
|
|
681
712
|
b && v(b);
|
|
682
713
|
}), (b, r) => {
|
|
683
|
-
const x = Q("FmCircularProgress"),
|
|
684
|
-
return _(),
|
|
714
|
+
const x = Q("FmCircularProgress"), $ = Q("FmIcon"), S = Q("FmButton");
|
|
715
|
+
return _(), k("div", pt, [
|
|
685
716
|
r[2] || (r[2] = C("div", { class: "fm-typo-en-body-md-400" }, "Import transfer templates from excel sheets.", -1)),
|
|
686
|
-
|
|
717
|
+
o.value ? (_(), k("div", ft, [
|
|
687
718
|
C("div", null, [
|
|
688
719
|
P(x, {
|
|
689
720
|
size: "md",
|
|
@@ -691,7 +722,7 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
691
722
|
})
|
|
692
723
|
]),
|
|
693
724
|
r[1] || (r[1] = C("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "Loading...", -1))
|
|
694
|
-
])) : (_(),
|
|
725
|
+
])) : (_(), k(L, { key: 1 }, [
|
|
695
726
|
P(Me, {
|
|
696
727
|
class: H({
|
|
697
728
|
"w-full": !0,
|
|
@@ -699,13 +730,13 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
699
730
|
}),
|
|
700
731
|
accept: ".xlsx",
|
|
701
732
|
onFileUpload: r[0] || (r[0] = (p) => t.value = p),
|
|
702
|
-
label: A(
|
|
703
|
-
"button-label": A(
|
|
704
|
-
},
|
|
733
|
+
label: A(u)("inventory.ingredient.import.uploadTemplate"),
|
|
734
|
+
"button-label": A(u)("inventory.ingredient.import.selectFile")
|
|
735
|
+
}, We({ _: 2 }, [
|
|
705
736
|
t.value ? {
|
|
706
737
|
name: "default",
|
|
707
738
|
fn: ee(({ openFileDialog: p }) => [
|
|
708
|
-
C("div",
|
|
739
|
+
C("div", yt, [
|
|
709
740
|
C("div", {
|
|
710
741
|
class: H([
|
|
711
742
|
"fm-corner-radius-md p-16 flex items-center gap-16",
|
|
@@ -720,7 +751,7 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
720
751
|
key: 0,
|
|
721
752
|
size: "md",
|
|
722
753
|
color: "neutral-gray-200"
|
|
723
|
-
})) : (_(), K(
|
|
754
|
+
})) : (_(), K($, {
|
|
724
755
|
key: 1,
|
|
725
756
|
name: h.value ? "error" : "attach_file",
|
|
726
757
|
outline: "",
|
|
@@ -735,28 +766,28 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
735
766
|
}
|
|
736
767
|
])
|
|
737
768
|
}, [
|
|
738
|
-
C("div",
|
|
769
|
+
C("div", ht, D(t.value.name), 1)
|
|
739
770
|
], 2),
|
|
740
|
-
i.value ? V("", !0) : (_(),
|
|
771
|
+
i.value ? V("", !0) : (_(), k("div", vt, [
|
|
741
772
|
P(S, {
|
|
742
|
-
label: A(
|
|
773
|
+
label: A(u)("inventory.ingredient.import.replaceFile"),
|
|
743
774
|
variant: h.value ? "destructive" : "secondary",
|
|
744
775
|
"prepend-icon": h.value ? void 0 : "autorenew",
|
|
745
776
|
onClick: p
|
|
746
777
|
}, null, 8, ["label", "variant", "prepend-icon", "onClick"])
|
|
747
778
|
]))
|
|
748
779
|
], 2),
|
|
749
|
-
|
|
750
|
-
(_(!0),
|
|
780
|
+
c.value.length ? (_(), k("div", gt, [
|
|
781
|
+
(_(!0), k(L, null, Y(c.value, (n, y) => (_(), k("div", {
|
|
751
782
|
key: y,
|
|
752
783
|
class: "flex gap-8 items-center"
|
|
753
784
|
}, [
|
|
754
|
-
P(
|
|
785
|
+
P($, {
|
|
755
786
|
name: "error",
|
|
756
787
|
size: "sm",
|
|
757
788
|
color: "system-error-300"
|
|
758
789
|
}),
|
|
759
|
-
C("div",
|
|
790
|
+
C("div", bt, D(n), 1)
|
|
760
791
|
]))), 128))
|
|
761
792
|
])) : V("", !0)
|
|
762
793
|
])
|
|
@@ -764,21 +795,21 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
764
795
|
key: "0"
|
|
765
796
|
} : void 0
|
|
766
797
|
]), 1032, ["class", "label", "button-label"]),
|
|
767
|
-
d.value ? (_(),
|
|
768
|
-
C("div",
|
|
769
|
-
(_(!0),
|
|
798
|
+
d.value ? (_(), k("div", xt, [
|
|
799
|
+
C("div", St, D(A(u)("inventory.ingredient.import.summary")), 1),
|
|
800
|
+
(_(!0), k(L, null, Y(a.value, (p, n) => (_(), K(fe, {
|
|
770
801
|
key: n,
|
|
771
802
|
name: p.template.name,
|
|
772
|
-
"transfer-type": typeof p.template.purchaseOrder.supplier.internal == "string" ? A(
|
|
803
|
+
"transfer-type": typeof p.template.purchaseOrder.supplier.internal == "string" ? A(R).TRANSFER : A(R).PURCHASE,
|
|
773
804
|
locations: p.template.locations,
|
|
774
805
|
items: p.template.purchaseOrder.items,
|
|
775
806
|
errors: p.errors,
|
|
776
807
|
type: "create"
|
|
777
808
|
}, null, 8, ["name", "transfer-type", "locations", "items", "errors"]))), 128)),
|
|
778
|
-
(_(!0),
|
|
809
|
+
(_(!0), k(L, null, Y(m.value, (p) => (_(), K(fe, {
|
|
779
810
|
key: p.template._id,
|
|
780
811
|
name: p.template.name,
|
|
781
|
-
"transfer-type": typeof p.template.purchaseOrder.supplier.internal == "string" ? A(
|
|
812
|
+
"transfer-type": typeof p.template.purchaseOrder.supplier.internal == "string" ? A(R).TRANSFER : A(R).PURCHASE,
|
|
782
813
|
locations: p.template.locations,
|
|
783
814
|
items: p.template.purchaseOrder.items,
|
|
784
815
|
errors: p.errors,
|
|
@@ -790,39 +821,39 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
790
821
|
};
|
|
791
822
|
}
|
|
792
823
|
});
|
|
793
|
-
function
|
|
794
|
-
var
|
|
824
|
+
function _t(e) {
|
|
825
|
+
var o, f;
|
|
795
826
|
const t = te();
|
|
796
827
|
if (!t.isEnabled) return !0;
|
|
797
828
|
if (!e.internal) {
|
|
798
|
-
const
|
|
799
|
-
return
|
|
829
|
+
const c = t.getNetSuiteVendor(e._id), a = c == null ? void 0 : c.subsidiaryId, m = (o = t.currentVendorSubsidiary(e._id)) == null ? void 0 : o.id;
|
|
830
|
+
return a && a == m;
|
|
800
831
|
}
|
|
801
|
-
const
|
|
802
|
-
return
|
|
832
|
+
const s = t.getNetSuiteLocation(`${e.internal}_${e._id}`), l = t.getLocationSubsidiary(s == null ? void 0 : s.netSuiteId).id, i = (f = t.currentLocationSubsidiary()) == null ? void 0 : f.id;
|
|
833
|
+
return l && l == i;
|
|
803
834
|
}
|
|
804
|
-
const
|
|
805
|
-
const e =
|
|
835
|
+
const $t = xe("transferTemplateActions", () => {
|
|
836
|
+
const e = je(), t = be(), s = Z(), l = Ce(), i = Le(), o = Se(), f = te(), c = Ge(), { t: a } = oe(), m = N({});
|
|
806
837
|
function h() {
|
|
807
|
-
|
|
808
|
-
mode:
|
|
838
|
+
m.value = {
|
|
839
|
+
mode: me.CREATE,
|
|
809
840
|
show: !0,
|
|
810
841
|
"onUpdate:show"(n) {
|
|
811
|
-
|
|
842
|
+
m.value.show = n;
|
|
812
843
|
}
|
|
813
844
|
};
|
|
814
845
|
}
|
|
815
846
|
function d(n) {
|
|
816
|
-
|
|
817
|
-
mode:
|
|
847
|
+
m.value = {
|
|
848
|
+
mode: me.UPDATE,
|
|
818
849
|
modelValue: n,
|
|
819
850
|
show: !0,
|
|
820
851
|
"onUpdate:show"(y) {
|
|
821
|
-
|
|
852
|
+
m.value.show = y;
|
|
822
853
|
}
|
|
823
854
|
};
|
|
824
855
|
}
|
|
825
|
-
function
|
|
856
|
+
function u(n, y, T) {
|
|
826
857
|
e.open({
|
|
827
858
|
title: `Confirm deleting template ${n.name}?`,
|
|
828
859
|
message: "Deleted template can no longer be retrieved",
|
|
@@ -843,28 +874,28 @@ const _t = xe("transferTemplateActions", () => {
|
|
|
843
874
|
});
|
|
844
875
|
try {
|
|
845
876
|
y.value = !0;
|
|
846
|
-
const [
|
|
847
|
-
|
|
848
|
-
new Promise((
|
|
877
|
+
const [w] = await Promise.allSettled([
|
|
878
|
+
o.deleteTemplate(n),
|
|
879
|
+
new Promise((E) => setTimeout(E, 1e3))
|
|
849
880
|
]);
|
|
850
|
-
if (
|
|
881
|
+
if (w.status === "rejected") throw w.reason;
|
|
851
882
|
t.open({
|
|
852
883
|
title: `Deleted ${n.name}`,
|
|
853
884
|
type: "success"
|
|
854
885
|
});
|
|
855
|
-
} catch (
|
|
886
|
+
} catch (w) {
|
|
856
887
|
t.open({
|
|
857
888
|
title: `Unable to delete ${n.name}`,
|
|
858
|
-
message: `See error from server: ${
|
|
889
|
+
message: `See error from server: ${w}`,
|
|
859
890
|
type: "error"
|
|
860
|
-
}), console.error("error on deleting purchase order template",
|
|
891
|
+
}), console.error("error on deleting purchase order template", w);
|
|
861
892
|
} finally {
|
|
862
893
|
y.value = !1, T();
|
|
863
894
|
}
|
|
864
895
|
});
|
|
865
896
|
}
|
|
866
897
|
function v(n, y, T) {
|
|
867
|
-
let
|
|
898
|
+
let w;
|
|
868
899
|
e.open({
|
|
869
900
|
title: `Confirm duplicating template "${n.name}"?`,
|
|
870
901
|
message: "Duplicated template can be edited and used independently",
|
|
@@ -878,13 +909,13 @@ const _t = xe("transferTemplateActions", () => {
|
|
|
878
909
|
variant: z.Plain,
|
|
879
910
|
close: !0
|
|
880
911
|
},
|
|
881
|
-
contentComponent:
|
|
912
|
+
contentComponent: ae({
|
|
882
913
|
props: ["modelValue"],
|
|
883
914
|
emits: ["update:modelValue"],
|
|
884
|
-
setup(
|
|
915
|
+
setup(E) {
|
|
885
916
|
return () => W(X.FmTextField, {
|
|
886
|
-
modelValue:
|
|
887
|
-
"onUpdate:modelValue": (g) =>
|
|
917
|
+
modelValue: E.modelValue,
|
|
918
|
+
"onUpdate:modelValue": (g) => w = g,
|
|
888
919
|
label: "New Template Name",
|
|
889
920
|
size: "md",
|
|
890
921
|
variant: "primary"
|
|
@@ -898,27 +929,27 @@ const _t = xe("transferTemplateActions", () => {
|
|
|
898
929
|
});
|
|
899
930
|
try {
|
|
900
931
|
y.value = !0;
|
|
901
|
-
const [
|
|
902
|
-
i.duplicatePurchaseOrderTemplate(n._id,
|
|
932
|
+
const [E] = await Promise.allSettled([
|
|
933
|
+
i.duplicatePurchaseOrderTemplate(n._id, w),
|
|
903
934
|
new Promise((g) => setTimeout(g, 1e3))
|
|
904
935
|
]);
|
|
905
|
-
if (
|
|
936
|
+
if (E.status === "rejected") throw E.reason;
|
|
906
937
|
t.open({
|
|
907
938
|
title: `Duplicated ${n.name}`,
|
|
908
939
|
type: "success"
|
|
909
940
|
});
|
|
910
|
-
} catch (
|
|
941
|
+
} catch (E) {
|
|
911
942
|
t.open({
|
|
912
943
|
title: `Unable to duplicate ${n.name}`,
|
|
913
|
-
message: `See error from server: ${
|
|
944
|
+
message: `See error from server: ${E}`,
|
|
914
945
|
type: "error"
|
|
915
|
-
}), console.error("error on duplicating purchase order template",
|
|
946
|
+
}), console.error("error on duplicating purchase order template", E);
|
|
916
947
|
} finally {
|
|
917
948
|
y.value = !1, T();
|
|
918
949
|
}
|
|
919
950
|
});
|
|
920
951
|
}
|
|
921
|
-
const b =
|
|
952
|
+
const b = N({});
|
|
922
953
|
function r(n) {
|
|
923
954
|
b.value = {
|
|
924
955
|
template: n,
|
|
@@ -934,11 +965,11 @@ const _t = xe("transferTemplateActions", () => {
|
|
|
934
965
|
function x() {
|
|
935
966
|
const { promise: n, resolve: y } = Promise.withResolvers(), T = (g) => {
|
|
936
967
|
y(g);
|
|
937
|
-
},
|
|
968
|
+
}, w = l.templates.filter((g) => {
|
|
938
969
|
var O, F;
|
|
939
|
-
return ((O = g.purchaseOrder.supplier) == null ? void 0 : O._id) ===
|
|
970
|
+
return ((O = g.purchaseOrder.supplier) == null ? void 0 : O._id) === s.currentLocation.doc._id ? !1 : (F = g.locations) != null && F.length ? g.locations.find((U) => U.doc._id === s.currentLocation.doc._id) : !0;
|
|
940
971
|
});
|
|
941
|
-
if (
|
|
972
|
+
if (!w.length)
|
|
942
973
|
return e.open({
|
|
943
974
|
title: "Select one template",
|
|
944
975
|
message: "There is no available template in your business. Configure a new template?",
|
|
@@ -951,26 +982,26 @@ const _t = xe("transferTemplateActions", () => {
|
|
|
951
982
|
close: !0
|
|
952
983
|
}
|
|
953
984
|
}).onPrimary(() => {
|
|
954
|
-
|
|
985
|
+
c.push({ name: ue.TRANSFER_TEMPLATE }), T(void 0);
|
|
955
986
|
}).onSecondary(() => T(void 0)).onClose(() => T(void 0)), n;
|
|
956
|
-
const
|
|
957
|
-
var
|
|
958
|
-
const O = !g.purchaseOrder.items.length || g.purchaseOrder.items.some(Te), F = !
|
|
987
|
+
const E = w.map((g) => {
|
|
988
|
+
var le;
|
|
989
|
+
const O = !g.purchaseOrder.items.length || g.purchaseOrder.items.some(Te), F = !_t(g.purchaseOrder.supplier), U = g.purchaseOrder.supplier.internal ? f.getNetSuiteLocation(
|
|
959
990
|
`${g.purchaseOrder.supplier.internal}_${g.purchaseOrder.supplier._id}`
|
|
960
|
-
) : f.getNetSuiteVendor(g.purchaseOrder.supplier._id),
|
|
961
|
-
location is ${(
|
|
991
|
+
) : f.getNetSuiteVendor(g.purchaseOrder.supplier._id), ke = F ? `The subsidiary of the request
|
|
992
|
+
location is ${(le = f.getLocationSubsidiary(U == null ? void 0 : U.netSuiteId)) == null ? void 0 : le.fullName}.` : void 0, Ee = O || F, Ne = O ? "This template is invalid. Update this template." : F ? ke : void 0, Re = `${g.purchaseOrder.supplier.internal ? "Transfer" : "Purchase"} from ${g.purchaseOrder.supplier.name}`;
|
|
962
993
|
return {
|
|
963
994
|
label: g.name,
|
|
964
995
|
value: g._id,
|
|
965
|
-
disabled:
|
|
966
|
-
sublabel:
|
|
996
|
+
disabled: Ee,
|
|
997
|
+
sublabel: Ne ?? Re
|
|
967
998
|
};
|
|
968
999
|
});
|
|
969
|
-
return
|
|
1000
|
+
return E.sort((g, O) => +!!g.disabled - +!!O.disabled), e.open({
|
|
970
1001
|
title: "Select one template",
|
|
971
|
-
contentComponent:
|
|
1002
|
+
contentComponent: Qe,
|
|
972
1003
|
contentComponentProps: {
|
|
973
|
-
items:
|
|
1004
|
+
items: E,
|
|
974
1005
|
singleSelect: !0
|
|
975
1006
|
},
|
|
976
1007
|
primaryActions: {
|
|
@@ -986,54 +1017,54 @@ const _t = xe("transferTemplateActions", () => {
|
|
|
986
1017
|
close: !0
|
|
987
1018
|
}
|
|
988
1019
|
}).onPrimary((g) => Array.isArray(g) ? T(g[0]) : null).onSecondary(() => T(void 0)).onTertiary(() => {
|
|
989
|
-
|
|
1020
|
+
c.push({ name: ue.TRANSFER_TEMPLATE }), T(void 0);
|
|
990
1021
|
}).onClose(() => T(void 0)), n;
|
|
991
1022
|
}
|
|
992
|
-
function
|
|
1023
|
+
function $() {
|
|
993
1024
|
e.open({
|
|
994
|
-
title:
|
|
995
|
-
contentComponent:
|
|
1025
|
+
title: a("inventory.ingredient.import.title"),
|
|
1026
|
+
contentComponent: Tt,
|
|
996
1027
|
overlay: !0,
|
|
997
1028
|
closeButton: !0,
|
|
998
1029
|
primaryActions: {
|
|
999
|
-
text:
|
|
1030
|
+
text: a("common.import"),
|
|
1000
1031
|
close: !1
|
|
1001
1032
|
},
|
|
1002
1033
|
secondaryActions: {
|
|
1003
|
-
text:
|
|
1034
|
+
text: a("common.close"),
|
|
1004
1035
|
close: !0
|
|
1005
1036
|
},
|
|
1006
1037
|
tertiaryActions: {
|
|
1007
|
-
text:
|
|
1038
|
+
text: a("inventory.ingredient.import.actions.downloadTemplate"),
|
|
1008
1039
|
close: !1,
|
|
1009
1040
|
variant: "plain"
|
|
1010
1041
|
}
|
|
1011
1042
|
}).onPrimary((n) => {
|
|
1012
1043
|
if (!n) {
|
|
1013
1044
|
t.open({
|
|
1014
|
-
title:
|
|
1045
|
+
title: a("inventory.ingredient.import.error.noData"),
|
|
1015
1046
|
type: "error"
|
|
1016
1047
|
});
|
|
1017
1048
|
return;
|
|
1018
1049
|
}
|
|
1019
1050
|
if (!n.importCreateResult.length && !n.importUpdateResult.length) {
|
|
1020
1051
|
t.open({
|
|
1021
|
-
title:
|
|
1022
|
-
message:
|
|
1052
|
+
title: a("inventory.ingredient.import.error.invalidContent"),
|
|
1053
|
+
message: a("inventory.ingredient.import.error.noImportData"),
|
|
1023
1054
|
type: "error"
|
|
1024
1055
|
});
|
|
1025
1056
|
return;
|
|
1026
1057
|
}
|
|
1027
1058
|
if (n.importCreateResult.some((y) => y.errors.length) || n.importUpdateResult.some((y) => y.errors.length)) {
|
|
1028
1059
|
t.open({
|
|
1029
|
-
title:
|
|
1030
|
-
message:
|
|
1060
|
+
title: a("inventory.ingredient.import.error.invalidContent"),
|
|
1061
|
+
message: a("inventory.ingredient.import.error.hasErrors"),
|
|
1031
1062
|
type: "error"
|
|
1032
1063
|
});
|
|
1033
1064
|
return;
|
|
1034
1065
|
}
|
|
1035
1066
|
e.close(), S(n);
|
|
1036
|
-
}).onTertiary(
|
|
1067
|
+
}).onTertiary(Je);
|
|
1037
1068
|
}
|
|
1038
1069
|
async function S(n) {
|
|
1039
1070
|
try {
|
|
@@ -1045,36 +1076,36 @@ const _t = xe("transferTemplateActions", () => {
|
|
|
1045
1076
|
(g) => g.template
|
|
1046
1077
|
)
|
|
1047
1078
|
], T = 100;
|
|
1048
|
-
let
|
|
1049
|
-
const
|
|
1050
|
-
|
|
1051
|
-
title:
|
|
1052
|
-
Math.min(
|
|
1079
|
+
let w = 0;
|
|
1080
|
+
const E = () => {
|
|
1081
|
+
w += T, t.open({
|
|
1082
|
+
title: a("inventory.ingredient.import.progress", [
|
|
1083
|
+
Math.min(w, y.length),
|
|
1053
1084
|
y.length
|
|
1054
1085
|
])
|
|
1055
1086
|
});
|
|
1056
1087
|
};
|
|
1057
1088
|
for (const g of y.chunk(100))
|
|
1058
|
-
|
|
1089
|
+
E(), await o.importTemplates(g);
|
|
1059
1090
|
t.open({
|
|
1060
|
-
title:
|
|
1091
|
+
title: a("inventory.ingredient.import.success"),
|
|
1061
1092
|
type: "success"
|
|
1062
1093
|
});
|
|
1063
1094
|
} catch (y) {
|
|
1064
1095
|
t.open({
|
|
1065
|
-
title:
|
|
1066
|
-
message:
|
|
1096
|
+
title: a("inventory.ingredient.import.error.failed"),
|
|
1097
|
+
message: a("inventory.ingredient.import.error.systemMessage", [y == null ? void 0 : y.message]),
|
|
1067
1098
|
type: "error"
|
|
1068
1099
|
}), console.error("Error in importing skus", n, y);
|
|
1069
1100
|
} finally {
|
|
1070
|
-
|
|
1101
|
+
l.fetchTemplates();
|
|
1071
1102
|
}
|
|
1072
1103
|
}
|
|
1073
1104
|
function p() {
|
|
1074
|
-
const n =
|
|
1105
|
+
const n = Ze(l.templates);
|
|
1075
1106
|
t.open({
|
|
1076
|
-
title:
|
|
1077
|
-
message:
|
|
1107
|
+
title: a("inventory.ingredient.export.success"),
|
|
1108
|
+
message: a("inventory.ingredient.export.filename", [n]),
|
|
1078
1109
|
type: "success"
|
|
1079
1110
|
});
|
|
1080
1111
|
}
|
|
@@ -1082,61 +1113,61 @@ const _t = xe("transferTemplateActions", () => {
|
|
|
1082
1113
|
createTemplate: h,
|
|
1083
1114
|
viewTemplate: r,
|
|
1084
1115
|
updateTemplate: d,
|
|
1085
|
-
deleteTemplate:
|
|
1116
|
+
deleteTemplate: u,
|
|
1086
1117
|
duplicateTemplate: v,
|
|
1087
1118
|
getTemplateId: x,
|
|
1088
|
-
importTemplates:
|
|
1119
|
+
importTemplates: $,
|
|
1089
1120
|
exportTemplates: p,
|
|
1090
|
-
templateDialogProps:
|
|
1121
|
+
templateDialogProps: m,
|
|
1091
1122
|
templateDetailsProps: b
|
|
1092
1123
|
};
|
|
1093
1124
|
});
|
|
1094
|
-
function
|
|
1095
|
-
const { skuById: t } = q(),
|
|
1096
|
-
return
|
|
1125
|
+
function ye(e) {
|
|
1126
|
+
const { skuById: t } = q(), s = re(e);
|
|
1127
|
+
return s.purchaseOrder.items = e.purchaseOrder.items.filter((l) => t[l.sku._id]), s;
|
|
1097
1128
|
}
|
|
1098
1129
|
const Ce = xe(
|
|
1099
1130
|
"transferTemplateTable",
|
|
1100
1131
|
function() {
|
|
1101
|
-
const { t } =
|
|
1102
|
-
async function
|
|
1103
|
-
i.value = [],
|
|
1132
|
+
const { t } = oe(), s = $t(), l = N(!1), i = N(new Array()), o = Se(), f = q();
|
|
1133
|
+
async function c() {
|
|
1134
|
+
i.value = [], l.value = !0;
|
|
1104
1135
|
try {
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
);
|
|
1109
|
-
i.value = d.map(
|
|
1136
|
+
const [d] = await Promise.all([
|
|
1137
|
+
o.readTemplates(),
|
|
1138
|
+
f.readInventory()
|
|
1139
|
+
]).delayed(1e3);
|
|
1140
|
+
i.value = d.map(ye);
|
|
1110
1141
|
} catch (d) {
|
|
1111
1142
|
console.log("Something went wrong when fetching templates:", d);
|
|
1112
1143
|
} finally {
|
|
1113
|
-
|
|
1144
|
+
l.value = !1;
|
|
1114
1145
|
}
|
|
1115
1146
|
}
|
|
1116
|
-
async function
|
|
1117
|
-
if (!i.value.find((
|
|
1118
|
-
|
|
1147
|
+
async function a(d) {
|
|
1148
|
+
if (!i.value.find((u) => u._id)) {
|
|
1149
|
+
l.value = !0;
|
|
1119
1150
|
try {
|
|
1120
1151
|
i.value = [
|
|
1121
|
-
await
|
|
1152
|
+
await o.getTemplate(d).then(ye).delayed(1e3)
|
|
1122
1153
|
];
|
|
1123
|
-
} catch (
|
|
1124
|
-
console.log("Something went wrong when fetching templates:",
|
|
1154
|
+
} catch (u) {
|
|
1155
|
+
console.log("Something went wrong when fetching templates:", u);
|
|
1125
1156
|
} finally {
|
|
1126
|
-
|
|
1157
|
+
l.value = !1;
|
|
1127
1158
|
}
|
|
1128
1159
|
}
|
|
1129
1160
|
}
|
|
1130
|
-
function
|
|
1131
|
-
switch (
|
|
1132
|
-
case
|
|
1133
|
-
return
|
|
1134
|
-
case
|
|
1135
|
-
return
|
|
1136
|
-
case
|
|
1137
|
-
return
|
|
1138
|
-
case
|
|
1139
|
-
return
|
|
1161
|
+
function m(d, u) {
|
|
1162
|
+
switch (u = re(u), d) {
|
|
1163
|
+
case I.Details:
|
|
1164
|
+
return s.viewTemplate(u);
|
|
1165
|
+
case I.Edit:
|
|
1166
|
+
return s.updateTemplate(u);
|
|
1167
|
+
case I.Delete:
|
|
1168
|
+
return s.deleteTemplate(u, l, c);
|
|
1169
|
+
case I.Duplicate:
|
|
1170
|
+
return s.duplicateTemplate(u, l, c);
|
|
1140
1171
|
}
|
|
1141
1172
|
}
|
|
1142
1173
|
return {
|
|
@@ -1146,7 +1177,7 @@ const Ce = xe(
|
|
|
1146
1177
|
accessorKey: "_id",
|
|
1147
1178
|
header: () => t("inventory.transfer.table.createdAt"),
|
|
1148
1179
|
cell(d) {
|
|
1149
|
-
return
|
|
1180
|
+
return He(`${d.getValue()}`);
|
|
1150
1181
|
},
|
|
1151
1182
|
enableSorting: !0
|
|
1152
1183
|
},
|
|
@@ -1174,8 +1205,8 @@ const Ce = xe(
|
|
|
1174
1205
|
textAlign: "right"
|
|
1175
1206
|
},
|
|
1176
1207
|
cell(d) {
|
|
1177
|
-
const
|
|
1178
|
-
return
|
|
1208
|
+
const u = Number(d.getValue()) || 0, v = d.row.original.purchaseOrder.items.some(Te);
|
|
1209
|
+
return u === 0 || v ? W("div", { class: "flex justify-end gap-4 items-center" }, [
|
|
1179
1210
|
W(
|
|
1180
1211
|
X.FmTooltip,
|
|
1181
1212
|
{},
|
|
@@ -1192,8 +1223,8 @@ const Ce = xe(
|
|
|
1192
1223
|
}
|
|
1193
1224
|
}
|
|
1194
1225
|
),
|
|
1195
|
-
|
|
1196
|
-
]) :
|
|
1226
|
+
u
|
|
1227
|
+
]) : u;
|
|
1197
1228
|
}
|
|
1198
1229
|
},
|
|
1199
1230
|
{
|
|
@@ -1202,8 +1233,8 @@ const Ce = xe(
|
|
|
1202
1233
|
header: () => "Enabled outlets",
|
|
1203
1234
|
cell(d) {
|
|
1204
1235
|
var v;
|
|
1205
|
-
const
|
|
1206
|
-
return
|
|
1236
|
+
const u = (v = d.row.original.locations) == null ? void 0 : v.length;
|
|
1237
|
+
return u ? `${u}` : "All";
|
|
1207
1238
|
},
|
|
1208
1239
|
enableSorting: !1,
|
|
1209
1240
|
meta: {
|
|
@@ -1221,13 +1252,13 @@ const Ce = xe(
|
|
|
1221
1252
|
{
|
|
1222
1253
|
id: "action",
|
|
1223
1254
|
cell(d) {
|
|
1224
|
-
const
|
|
1225
|
-
j[
|
|
1226
|
-
j[
|
|
1227
|
-
j[
|
|
1228
|
-
j[
|
|
1255
|
+
const u = d.row.original, v = [
|
|
1256
|
+
j[I.Details],
|
|
1257
|
+
j[I.Edit],
|
|
1258
|
+
j[I.Duplicate],
|
|
1259
|
+
j[I.Delete]
|
|
1229
1260
|
];
|
|
1230
|
-
return
|
|
1261
|
+
return Ve(v, (b) => m(b, u));
|
|
1231
1262
|
},
|
|
1232
1263
|
enableSorting: !1,
|
|
1233
1264
|
size: 40,
|
|
@@ -1238,19 +1269,20 @@ const Ce = xe(
|
|
|
1238
1269
|
}
|
|
1239
1270
|
],
|
|
1240
1271
|
templates: i,
|
|
1241
|
-
loading:
|
|
1242
|
-
fetchTemplates:
|
|
1243
|
-
loadTemplate:
|
|
1272
|
+
loading: l,
|
|
1273
|
+
fetchTemplates: c,
|
|
1274
|
+
loadTemplate: a
|
|
1244
1275
|
};
|
|
1245
1276
|
}
|
|
1246
1277
|
);
|
|
1247
|
-
function Dt(e, t,
|
|
1248
|
-
const
|
|
1249
|
-
return `${
|
|
1278
|
+
function Dt(e, t, s) {
|
|
1279
|
+
const l = (s == null ? void 0 : s.abbrev) ?? t.abbrev;
|
|
1280
|
+
return `${B(e, !1)} ${l}`;
|
|
1250
1281
|
}
|
|
1251
1282
|
export {
|
|
1252
|
-
|
|
1253
|
-
|
|
1283
|
+
R as P,
|
|
1284
|
+
Se as a,
|
|
1285
|
+
$t as b,
|
|
1254
1286
|
Dt as f,
|
|
1255
1287
|
Te as t,
|
|
1256
1288
|
Ce as u
|