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