@feedmepos/mf-inventory-portal 0.0.24-dev.1 → 0.0.24-dev.3
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-D3sNH2MR.js → App-C8gm6x7Q.js} +1 -1
- package/dist/{ApprovalView-DHnRx0hJ.js → ApprovalView-xtUG5yeg.js} +2 -2
- package/dist/{BindingsDialog-oTeg2Dai.js → BindingsDialog-II1cNZ8y.js} +2 -2
- package/dist/{BindingsPicker-CWdjmMJ3.js → BindingsPicker-7hWtLm42.js} +1 -1
- package/dist/{BindingsTable-bKLR1OKX.js → BindingsTable-Bub-L-pM.js} +1 -1
- package/dist/{ClosingDraftView-CIQVz7lY.js → ClosingDraftView-C9VKku7E.js} +2 -2
- package/dist/{ClosingTemplateView-D5pLzQwU.js → ClosingTemplateView-cmdRLrA3.js} +1 -1
- package/dist/{FmCustomAttribute.vue_vue_type_script_setup_true_lang-ClLDcchC.js → FmCustomAttribute.vue_vue_type_script_setup_true_lang-Dk618cmq.js} +1 -1
- package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BSB7T16f.js +286 -0
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DhpHOaRH.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BcQSDPWo.js} +1 -1
- package/dist/{IngredientGroupView-4C437mso.js → IngredientGroupView-YGl-cE0p.js} +1 -1
- package/dist/{IngredientsView-DoiGgjre.js → IngredientsView-XxrOFv-u.js} +3 -3
- package/dist/{IntegrationView-8ZKE7MAM.js → IntegrationView-Bq-m4-Wh.js} +1 -1
- package/dist/{InventoryBindingForm-CcnfliYQ.js → InventoryBindingForm-DFWSf75X.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-B_J-6C9x.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-RQ6XxdxU.js} +3 -3
- package/dist/{InventoryBindingSummary-CRdHCzNE.js → InventoryBindingSummary-DU6GO2TJ.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-B2-TypU0.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-ChpZ0NwL.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BuQde75S.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Ba2Uq1H-.js} +1 -1
- package/dist/{PublishView-t5gjGmK_.js → PublishView-CBIvo-Qj.js} +2 -2
- package/dist/{PurchaseOrderPrintPreview-6i53Y-v1.js → PurchaseOrderPrintPreview-cp_DzuxM.js} +1 -1
- package/dist/{ReceiveRequestView-uOeSh0Mr.js → ReceiveRequestView-UIaPylF0.js} +184 -174
- package/dist/{RecipeView-BTWywckD.js → RecipeView-voWc35VV.js} +3 -3
- package/dist/{StockView-DN2xk8ei.js → StockView-CoigRqM-.js} +7 -7
- package/dist/{SupplierView-l0XUg3J4.js → SupplierView-BDpCPZE7.js} +357 -354
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-CWMn6fFf.js → TransferDetails.vue_vue_type_script_setup_true_lang-CyovzdZg.js} +3 -3
- package/dist/{TransferTemplateView-wDKXpCWZ.js → TransferTemplateView-C2XMghN_.js} +425 -404
- package/dist/{UnitView-CUI-k-tS.js → UnitView-BBPJ0vhB.js} +3 -3
- package/dist/{WarehouseView-WsI_eG5r.js → WarehouseView-Ck6hBrGf.js} +1 -1
- package/dist/{app-DntcWR3_.js → app-ojZQI-KQ.js} +89 -89
- package/dist/app.js +1 -1
- package/dist/{decimal-DTCTnMwO.js → decimal-xq82Pirk.js} +1 -1
- package/dist/{format-unit-display-Hy48Iw5j.js → format-unit-display-ByfsyWBU.js} +438 -437
- package/dist/{index-Bv9RYyTZ.js → index-Bi6FnWGy.js} +3 -3
- package/dist/{index-D4yJP9I2.js → index-CKEbjSig.js} +1 -1
- package/dist/{stock-BsdmfT-b.js → stock-CC4RqQaB.js} +1 -1
- package/dist/stores/feature.d.ts +1 -0
- package/dist/{supplier-CXhkgC4M.js → supplier-DLXOOcIm.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-inventory-binding-dialog-DPMJmBCr.js → use-inventory-binding-dialog-B1zBTsW9.js} +1 -1
- package/dist/views/transfer-template/helpers/import-export.helper.d.ts +1 -1
- package/dist/{vue-i18n-ByVzHsI7.js → vue-i18n-AeCKtYb7.js} +2 -2
- package/package.json +3 -3
- package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-B_c6Vn6P.js +0 -282
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import { X as Re, a as Q, L as Ie, aa as F, r as
|
|
2
|
-
import { useCoreStore as
|
|
3
|
-
import { useDialogChild as Qe, useSnackbar as he, useDialog as He, FmButtonVariant as
|
|
1
|
+
import { X as Re, a as Q, L as Ie, aa as F, r as Ae, ab as pe, s as fe, u as z, j as P, v as Ne, aC as oe, w as ye, b as J, t as H, P as q, aB as De, au as Oe, V as Fe, x as Pe, y as Ue, e as ae, f as X, R as se, J as Be, a9 as Me, D as W, i as N, h as Le } from "./app-ojZQI-KQ.js";
|
|
2
|
+
import { useCoreStore as Z, useI18n as ee } from "@feedmepos/mf-common";
|
|
3
|
+
import { useDialogChild as Qe, useSnackbar as he, useDialog as He, FmButtonVariant as ie, components as le } from "@feedmepos/ui-library";
|
|
4
4
|
import { defineStore as ve } from "pinia";
|
|
5
|
-
import { defineComponent as ge, resolveComponent as B, openBlock as T, createElementBlock as
|
|
5
|
+
import { defineComponent as ge, resolveComponent as B, openBlock as T, createElementBlock as k, createElementVNode as $, normalizeClass as M, createTextVNode as qe, toDisplayString as I, unref as R, createCommentVNode as L, createVNode as D, withCtx as G, Fragment as U, renderList as j, ref as C, onMounted as Ve, computed as ce, watch as je, createSlots as ze, createBlock as V, h as Y } from "vue";
|
|
6
6
|
import { useRouter as Ke } from "vue-router";
|
|
7
|
-
import { u as
|
|
7
|
+
import { u as te } from "./supplier-DLXOOcIm.js";
|
|
8
8
|
const be = Re((e, t) => {
|
|
9
|
-
function
|
|
9
|
+
function s() {
|
|
10
10
|
var n;
|
|
11
|
-
return `business_${((n =
|
|
11
|
+
return `business_${((n = Z().currentBusiness.value) == null ? void 0 : n._id) ?? ""}`;
|
|
12
12
|
}
|
|
13
13
|
return {
|
|
14
14
|
async getTemplate(c) {
|
|
15
|
-
const
|
|
15
|
+
const a = s(), n = `${e.inventoryBackendUrl}/${a}/purchase-order-template/${c}`;
|
|
16
16
|
return t.get(n);
|
|
17
17
|
},
|
|
18
18
|
async readTemplates() {
|
|
19
|
-
const c =
|
|
20
|
-
return t.get(
|
|
19
|
+
const c = s(), a = `${e.inventoryBackendUrl}/${c}/purchase-order-template`;
|
|
20
|
+
return t.get(a);
|
|
21
21
|
},
|
|
22
22
|
async createTemplate(c) {
|
|
23
|
-
const
|
|
23
|
+
const a = s(), n = `${e.inventoryBackendUrl}/${a}/purchase-order-template`;
|
|
24
24
|
return t.post(n, c);
|
|
25
25
|
},
|
|
26
26
|
async updateTemplate(c) {
|
|
27
|
-
const
|
|
27
|
+
const a = s(), n = `${e.inventoryBackendUrl}/${a}/purchase-order-template`;
|
|
28
28
|
return t.put(n, c);
|
|
29
29
|
},
|
|
30
30
|
async deleteTemplate(c) {
|
|
31
|
-
const
|
|
31
|
+
const a = s(), n = `${e.inventoryBackendUrl}/${a}/purchase-order-template`;
|
|
32
32
|
return t.delete(n, { _id: c._id, _rev: c._rev });
|
|
33
33
|
},
|
|
34
34
|
async importTemplates(c) {
|
|
35
|
-
const
|
|
35
|
+
const a = s(), n = `${e.inventoryBackendUrl}/${a}/purchase-order-template/import`;
|
|
36
36
|
return t.post(n, c);
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
});
|
|
40
40
|
function xe(e) {
|
|
41
|
-
const t = Q(),
|
|
42
|
-
if (c.unit._id !==
|
|
43
|
-
const
|
|
44
|
-
return
|
|
41
|
+
const t = Q(), s = e.sku, c = t.skuById[s._id];
|
|
42
|
+
if (c.unit._id !== s.unit._id) return !0;
|
|
43
|
+
const a = e.measurement;
|
|
44
|
+
return a ? !t.unitById[c.unit._id].measurements.find((o) => o.id === a.id) : !1;
|
|
45
45
|
}
|
|
46
|
-
var E = /* @__PURE__ */ ((e) => (e.PURCHASE = "PURCHASE", e.TRANSFER = "TRANSFER", e))(E || {}),
|
|
47
|
-
const
|
|
48
|
-
function Se(e
|
|
49
|
-
var
|
|
50
|
-
const
|
|
46
|
+
var E = /* @__PURE__ */ ((e) => (e.PURCHASE = "PURCHASE", e.TRANSFER = "TRANSFER", e))(E || {}), re = /* @__PURE__ */ ((e) => (e.Source = "Source", e.Destination = "Destination", e.Ingredient = "Ingredient", e))(re || {});
|
|
47
|
+
const me = Ie(0);
|
|
48
|
+
function Se(e) {
|
|
49
|
+
var c;
|
|
50
|
+
const t = e.sku;
|
|
51
51
|
return {
|
|
52
|
-
code:
|
|
53
|
-
overrideCode:
|
|
54
|
-
name:
|
|
55
|
-
unit: ((
|
|
52
|
+
code: t.code,
|
|
53
|
+
overrideCode: e.code,
|
|
54
|
+
name: t.name,
|
|
55
|
+
unit: ((c = t.unit.measurements.find((a) => a.id === t.trackingMeasurement)) == null ? void 0 : c.abbrev) ?? t.unit.abbrev,
|
|
56
56
|
defaultQuantity: +P(e.quantity),
|
|
57
|
-
minimumQuantity: +P(e.minimumQuantity ??
|
|
58
|
-
maximumQuantity: +P(e.maximumQuantity ??
|
|
57
|
+
minimumQuantity: +P(e.minimumQuantity ?? me),
|
|
58
|
+
maximumQuantity: +P(e.maximumQuantity ?? me),
|
|
59
59
|
quantityStep: +P(e.quantityStep)
|
|
60
60
|
};
|
|
61
61
|
}
|
|
@@ -96,15 +96,15 @@ function Te() {
|
|
|
96
96
|
];
|
|
97
97
|
}
|
|
98
98
|
function We(e) {
|
|
99
|
-
var
|
|
100
|
-
const
|
|
99
|
+
var o;
|
|
100
|
+
const s = Z().currentBusiness.value, a = (o = e.map((l) => {
|
|
101
101
|
var x;
|
|
102
|
-
const
|
|
102
|
+
const d = l.purchaseOrder.items.map((r) => Se(r)), h = Te(), y = [
|
|
103
103
|
["Template ID", l._id],
|
|
104
104
|
["Template name", l.name],
|
|
105
|
-
["Business name",
|
|
106
|
-
["Business ID",
|
|
107
|
-
["Menu version",
|
|
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],
|
|
108
108
|
[
|
|
109
109
|
"Purchase/Transfer",
|
|
110
110
|
typeof l.purchaseOrder.supplier.internal == "string" ? E.TRANSFER : E.PURCHASE
|
|
@@ -120,64 +120,61 @@ function We(e) {
|
|
|
120
120
|
["Reference", l.purchaseOrder.ref ?? ""],
|
|
121
121
|
["Remark", l.purchaseOrder.remark ?? ""],
|
|
122
122
|
[],
|
|
123
|
-
|
|
124
|
-
...
|
|
125
|
-
], m =
|
|
123
|
+
h.map((r) => r.name),
|
|
124
|
+
...d.map((r) => h.map((S) => r[S.id]))
|
|
125
|
+
], m = h.map((r) => `system:${r.id}`), v = F(y, m);
|
|
126
126
|
return { name: l.name, sheet: v };
|
|
127
127
|
}).reduce(
|
|
128
|
-
(l,
|
|
129
|
-
var
|
|
130
|
-
const
|
|
131
|
-
return (
|
|
128
|
+
(l, d) => {
|
|
129
|
+
var y;
|
|
130
|
+
const h = d.name.slice(0, 12);
|
|
131
|
+
return (y = l.sheetOccurence)[h] ?? (y[h] = 0), l.sheetOccurence[h] += 1, l.sheets[`${h} (${l.sheetOccurence[h]})`] = d.sheet, l;
|
|
132
132
|
},
|
|
133
133
|
{
|
|
134
134
|
sheets: {},
|
|
135
135
|
sheetOccurence: {}
|
|
136
136
|
}
|
|
137
|
-
)) == null ? void 0 :
|
|
138
|
-
return
|
|
137
|
+
)) == null ? void 0 : o.sheets, n = `${s == null ? void 0 : s.name} transfer templates (${Ae(/* @__PURE__ */ new Date())}).xlsx`, f = pe(a);
|
|
138
|
+
return fe(f, n), n;
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
const e =
|
|
142
|
-
{
|
|
143
|
-
|
|
144
|
-
unit: {
|
|
145
|
-
_id: "",
|
|
146
|
-
name: "Unit",
|
|
147
|
-
abbrev: "Unit",
|
|
148
|
-
precision: 0,
|
|
149
|
-
measurements: []
|
|
150
|
-
},
|
|
151
|
-
code: "ING001",
|
|
140
|
+
function Ye() {
|
|
141
|
+
const e = Z(), t = te(), s = z(), c = Q(), a = e.currentBusiness.value, n = Se({
|
|
142
|
+
sku: {
|
|
143
|
+
unit: {
|
|
152
144
|
_id: "",
|
|
153
|
-
name: "
|
|
145
|
+
name: "Unit",
|
|
146
|
+
abbrev: "Unit",
|
|
147
|
+
precision: 0,
|
|
148
|
+
measurements: []
|
|
154
149
|
},
|
|
155
150
|
code: "ING001",
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
amount: 1,
|
|
159
|
-
precision: 0
|
|
160
|
-
},
|
|
161
|
-
quantityStep: {
|
|
162
|
-
amount: 1,
|
|
163
|
-
precision: 0
|
|
164
|
-
},
|
|
165
|
-
minimumQuantity: {
|
|
166
|
-
amount: 1,
|
|
167
|
-
precision: 0
|
|
168
|
-
},
|
|
169
|
-
maximumQuantity: {
|
|
170
|
-
amount: 1,
|
|
171
|
-
precision: 0
|
|
172
|
-
}
|
|
151
|
+
_id: "",
|
|
152
|
+
name: "Sugar"
|
|
173
153
|
},
|
|
174
|
-
"ING001
|
|
175
|
-
|
|
154
|
+
code: "ING001 (override optional)",
|
|
155
|
+
name: "Sugar",
|
|
156
|
+
quantity: {
|
|
157
|
+
amount: 1,
|
|
158
|
+
precision: 0
|
|
159
|
+
},
|
|
160
|
+
quantityStep: {
|
|
161
|
+
amount: 1,
|
|
162
|
+
precision: 0
|
|
163
|
+
},
|
|
164
|
+
minimumQuantity: {
|
|
165
|
+
amount: 1,
|
|
166
|
+
precision: 0
|
|
167
|
+
},
|
|
168
|
+
maximumQuantity: {
|
|
169
|
+
amount: 1,
|
|
170
|
+
precision: 0
|
|
171
|
+
}
|
|
172
|
+
}), f = Te(), o = [
|
|
176
173
|
["Template ID (leave empty to create new)"],
|
|
177
174
|
["Template Name", "New template"],
|
|
178
|
-
["Business name",
|
|
179
|
-
["Business ID",
|
|
180
|
-
["Menu version",
|
|
175
|
+
["Business name", a == null ? void 0 : a.name],
|
|
176
|
+
["Business ID", a == null ? void 0 : a._id],
|
|
177
|
+
["Menu version", a == null ? void 0 : a.menuVersion],
|
|
181
178
|
["Purchase/Transfer", "Purchase"],
|
|
182
179
|
[
|
|
183
180
|
"Transfer from",
|
|
@@ -192,9 +189,9 @@ function Ge() {
|
|
|
192
189
|
["Reference"],
|
|
193
190
|
["Remark"],
|
|
194
191
|
[],
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
], l =
|
|
192
|
+
f.map((r) => r.name),
|
|
193
|
+
f.map((r) => n[r.id])
|
|
194
|
+
], l = f.map((r) => `system:${r.id}`), d = F(o, l), h = F(
|
|
198
195
|
[
|
|
199
196
|
...t.businessSuppliers.map((r) => [
|
|
200
197
|
`${r.name} (${r._id})`,
|
|
@@ -206,32 +203,32 @@ function Ge() {
|
|
|
206
203
|
r.address.state,
|
|
207
204
|
r.address.country
|
|
208
205
|
]),
|
|
209
|
-
...
|
|
210
|
-
var S, _, p,
|
|
206
|
+
...s.locations.map((r) => {
|
|
207
|
+
var S, _, p, i, u, g;
|
|
211
208
|
return [
|
|
212
209
|
`${r.name} (${r.dbName})`,
|
|
213
210
|
"Transfer",
|
|
214
211
|
(S = r.doc.profile.address) == null ? void 0 : S.line1,
|
|
215
212
|
(_ = r.doc.profile.address) == null ? void 0 : _.line2,
|
|
216
213
|
(p = r.doc.profile.address) == null ? void 0 : p.city,
|
|
217
|
-
(
|
|
218
|
-
(
|
|
219
|
-
(
|
|
214
|
+
(i = r.doc.profile.address) == null ? void 0 : i.postcode,
|
|
215
|
+
(u = r.doc.profile.address) == null ? void 0 : u.state,
|
|
216
|
+
(g = r.doc.profile.address) == null ? void 0 : g.country
|
|
220
217
|
];
|
|
221
218
|
})
|
|
222
219
|
],
|
|
223
220
|
["Name", "Type", "Line 1", "Line 2", "City", "Postal", "State", "Country"]
|
|
224
|
-
),
|
|
225
|
-
|
|
226
|
-
var S, _, p,
|
|
221
|
+
), y = F(
|
|
222
|
+
s.locations.map((r) => {
|
|
223
|
+
var S, _, p, i, u, g;
|
|
227
224
|
return [
|
|
228
225
|
`${r.name} (${r.dbName})`,
|
|
229
226
|
(S = r.doc.profile.address) == null ? void 0 : S.line1,
|
|
230
227
|
(_ = r.doc.profile.address) == null ? void 0 : _.line2,
|
|
231
228
|
(p = r.doc.profile.address) == null ? void 0 : p.city,
|
|
232
|
-
(
|
|
233
|
-
(
|
|
234
|
-
(
|
|
229
|
+
(i = r.doc.profile.address) == null ? void 0 : i.postcode,
|
|
230
|
+
(u = r.doc.profile.address) == null ? void 0 : u.state,
|
|
231
|
+
(g = r.doc.profile.address) == null ? void 0 : g.country
|
|
235
232
|
];
|
|
236
233
|
}),
|
|
237
234
|
["Name", "Line 1", "Line 2", "City", "Postal", "State", "Country"]
|
|
@@ -243,32 +240,32 @@ function Ge() {
|
|
|
243
240
|
...r.unit.measurements.map((S) => S.abbrev)
|
|
244
241
|
]),
|
|
245
242
|
["Code", "Name", "Base unit", "Measurements"]
|
|
246
|
-
), v =
|
|
247
|
-
Template:
|
|
248
|
-
Source:
|
|
249
|
-
Destination:
|
|
243
|
+
), v = pe({
|
|
244
|
+
Template: d,
|
|
245
|
+
Source: h,
|
|
246
|
+
Destination: y,
|
|
250
247
|
Ingredient: m
|
|
251
|
-
}), x = `${
|
|
252
|
-
return
|
|
248
|
+
}), x = `${a == null ? void 0 : a.name} transfer templates import.xlsx`;
|
|
249
|
+
return fe(v, x), x;
|
|
253
250
|
}
|
|
254
|
-
function
|
|
255
|
-
const
|
|
256
|
-
if (!
|
|
257
|
-
return
|
|
258
|
-
errors:
|
|
251
|
+
function Ge(e, t) {
|
|
252
|
+
const s = new Array(), c = /(.*) \(((supplier_|warehouse_|restaurant_).{24,})\)/, n = z().locationByDbName, o = te().supplierById, l = e.trim(), d = c.exec(l);
|
|
253
|
+
if (!d)
|
|
254
|
+
return s.push(`Transfer from location value of ${l} cannot be read.`), {
|
|
255
|
+
errors: s
|
|
259
256
|
};
|
|
260
|
-
const
|
|
257
|
+
const h = d[1], y = d[2];
|
|
261
258
|
let m;
|
|
262
|
-
if (
|
|
263
|
-
m =
|
|
259
|
+
if (y.startsWith("supplier"))
|
|
260
|
+
m = o[y], t !== E.PURCHASE && s.push(`Expected transfer type Purchase but found ${t} instead.`);
|
|
264
261
|
else {
|
|
265
|
-
const v = n[
|
|
262
|
+
const v = n[y];
|
|
266
263
|
if (!v)
|
|
267
|
-
return
|
|
268
|
-
errors:
|
|
264
|
+
return s.push(`Location (${h}) of id ${y} is not found.`), {
|
|
265
|
+
errors: s
|
|
269
266
|
};
|
|
270
|
-
|
|
271
|
-
`Location id ${
|
|
267
|
+
h !== v.name && s.push(
|
|
268
|
+
`Location id ${y} has non-matching name. Found ${h} but expected ${v.name}`
|
|
272
269
|
), m = {
|
|
273
270
|
_id: v.doc._id,
|
|
274
271
|
name: v.name,
|
|
@@ -280,7 +277,7 @@ function Ye(e, t) {
|
|
|
280
277
|
postcode: "",
|
|
281
278
|
coordinates: [0, 0]
|
|
282
279
|
},
|
|
283
|
-
internal:
|
|
280
|
+
internal: y.split("_")[0] === "restaurant" ? oe.enum.restaurant : oe.enum.warehouse,
|
|
284
281
|
phoneNumber: v.doc.profile.phoneNo ?? "",
|
|
285
282
|
email: v.doc.profile.email ?? "",
|
|
286
283
|
_rev: "",
|
|
@@ -290,26 +287,26 @@ function Ye(e, t) {
|
|
|
290
287
|
}
|
|
291
288
|
return {
|
|
292
289
|
from: m,
|
|
293
|
-
errors:
|
|
290
|
+
errors: s
|
|
294
291
|
};
|
|
295
292
|
}
|
|
296
293
|
function Je(e) {
|
|
297
294
|
if (!e.length || `${e[0]}`.toLocaleLowerCase() === "all")
|
|
298
295
|
return [];
|
|
299
296
|
const t = /(.*) \(((warehouse_|restaurant_).{24,})\)/, c = z().locationByDbName;
|
|
300
|
-
return e.map((
|
|
301
|
-
const n = new Array(),
|
|
302
|
-
if (!
|
|
303
|
-
return n.push(`Enabled location value of ${
|
|
297
|
+
return e.map((a) => {
|
|
298
|
+
const n = new Array(), f = a.trim(), o = t.exec(f);
|
|
299
|
+
if (!o)
|
|
300
|
+
return n.push(`Enabled location value of ${f} cannot be read.`), {
|
|
304
301
|
errors: n
|
|
305
302
|
};
|
|
306
|
-
const l =
|
|
307
|
-
return
|
|
308
|
-
`Location id ${
|
|
303
|
+
const l = o[1], d = o[2], h = c[d];
|
|
304
|
+
return h ? (l !== h.name && n.push(
|
|
305
|
+
`Location id ${d} has non-matching name. Found ${l} but expected ${h.name}`
|
|
309
306
|
), {
|
|
310
307
|
errors: n,
|
|
311
|
-
location:
|
|
312
|
-
}) : (n.push(`Location (${l}) of id ${
|
|
308
|
+
location: h
|
|
309
|
+
}) : (n.push(`Location (${l}) of id ${d} is not found.`), {
|
|
313
310
|
errors: n
|
|
314
311
|
});
|
|
315
312
|
});
|
|
@@ -317,47 +314,47 @@ function Je(e) {
|
|
|
317
314
|
function Xe(e) {
|
|
318
315
|
const [
|
|
319
316
|
t,
|
|
320
|
-
|
|
317
|
+
s,
|
|
321
318
|
c,
|
|
322
|
-
|
|
319
|
+
a,
|
|
323
320
|
n,
|
|
324
|
-
|
|
325
|
-
|
|
321
|
+
f,
|
|
322
|
+
o,
|
|
326
323
|
l,
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
] =
|
|
324
|
+
d,
|
|
325
|
+
h,
|
|
326
|
+
y
|
|
327
|
+
] = ye(e);
|
|
331
328
|
return {
|
|
332
|
-
id: `${
|
|
329
|
+
id: `${s[1] ?? ""}`.trim(),
|
|
333
330
|
name: `${c[1] ?? ""}`.trim(),
|
|
334
|
-
type: `${
|
|
331
|
+
type: `${o[1] ?? ""}`.trim().toLocaleLowerCase() === "transfer" ? E.TRANSFER : E.PURCHASE,
|
|
335
332
|
transferFrom: `${l[1] ?? ""}`.trim(),
|
|
336
|
-
locations:
|
|
337
|
-
reference: `${
|
|
338
|
-
remark: `${
|
|
333
|
+
locations: d.slice(1).map((m) => `${m}`.trim()).filter((m) => m),
|
|
334
|
+
reference: `${h[1] ?? ""}`.trim(),
|
|
335
|
+
remark: `${y[1] ?? ""}`.trim()
|
|
339
336
|
};
|
|
340
337
|
}
|
|
341
338
|
function Ze(e) {
|
|
342
339
|
const [
|
|
343
340
|
t,
|
|
344
|
-
|
|
341
|
+
s,
|
|
345
342
|
c,
|
|
346
|
-
|
|
343
|
+
a,
|
|
347
344
|
n,
|
|
348
|
-
|
|
349
|
-
|
|
345
|
+
f,
|
|
346
|
+
o,
|
|
350
347
|
l,
|
|
351
|
-
|
|
348
|
+
d,
|
|
349
|
+
h,
|
|
352
350
|
y,
|
|
353
|
-
f,
|
|
354
351
|
m,
|
|
355
352
|
v,
|
|
356
353
|
...x
|
|
357
|
-
] =
|
|
358
|
-
if (!t || !t.length || t.some((
|
|
354
|
+
] = ye(e);
|
|
355
|
+
if (!t || !t.length || t.some((i) => i.length && !i.startsWith("system:")))
|
|
359
356
|
throw new Error("Missing meta header. Excel file does not come from the template.");
|
|
360
|
-
const r = t.map((
|
|
357
|
+
const r = t.map((i) => i.split(":")[1]), _ = [
|
|
361
358
|
"code",
|
|
362
359
|
"name",
|
|
363
360
|
"unit",
|
|
@@ -365,163 +362,167 @@ function Ze(e) {
|
|
|
365
362
|
"minimumQuantity",
|
|
366
363
|
"maximumQuantity",
|
|
367
364
|
"quantityStep"
|
|
368
|
-
].filter((
|
|
365
|
+
].filter((i) => !r.includes(i));
|
|
369
366
|
if (_.length)
|
|
370
367
|
throw new Error(
|
|
371
368
|
`Missing meta headers (${_.join()}). Excel file does not come from the template.`
|
|
372
369
|
);
|
|
373
|
-
return x.map((
|
|
374
|
-
const
|
|
375
|
-
for (const
|
|
376
|
-
const
|
|
377
|
-
Object.assign(
|
|
370
|
+
return x.map((i, u) => {
|
|
371
|
+
const g = {};
|
|
372
|
+
for (const w in r) {
|
|
373
|
+
const b = r[w];
|
|
374
|
+
Object.assign(g, { [b]: i[w] });
|
|
378
375
|
}
|
|
379
376
|
return {
|
|
380
|
-
index:
|
|
381
|
-
data:
|
|
377
|
+
index: u,
|
|
378
|
+
data: g
|
|
382
379
|
};
|
|
383
380
|
});
|
|
384
381
|
}
|
|
385
|
-
function et(e, t,
|
|
386
|
-
const
|
|
387
|
-
if (!
|
|
388
|
-
return
|
|
382
|
+
function et(e, t, s) {
|
|
383
|
+
const c = Q(), a = J(), n = c.skuByCode[e.code], f = new Array();
|
|
384
|
+
if (!n)
|
|
385
|
+
return f.push(`Cannot find ingredient with code (${e.code}) ${e.name}.`), {
|
|
389
386
|
index: t,
|
|
390
|
-
errors:
|
|
387
|
+
errors: f
|
|
391
388
|
};
|
|
392
|
-
if (
|
|
393
|
-
return
|
|
389
|
+
if (s.filter((u) => u.data.code === e.code).length > 1)
|
|
390
|
+
return f.push(`Ingredient ${e.code} is defined twice.`), {
|
|
394
391
|
index: t,
|
|
395
|
-
errors:
|
|
392
|
+
errors: f
|
|
396
393
|
};
|
|
397
|
-
const
|
|
398
|
-
if (
|
|
399
|
-
const
|
|
400
|
-
|
|
401
|
-
const
|
|
402
|
-
sku:
|
|
403
|
-
code:
|
|
404
|
-
name:
|
|
405
|
-
measurement:
|
|
394
|
+
const o = n.unit, l = o == null ? void 0 : o.measurements.find((u) => u.abbrev === e.unit);
|
|
395
|
+
if (o.abbrev !== e.unit && !l) {
|
|
396
|
+
const u = `Cannot find unit measurement of symbol ${e.unit || "[empty]"} for ingredient (${e.code}) ${e.name}.`;
|
|
397
|
+
f.push(u);
|
|
398
|
+
const g = {
|
|
399
|
+
sku: n,
|
|
400
|
+
code: e.overrideCode || n.code,
|
|
401
|
+
name: n.name,
|
|
402
|
+
measurement: l,
|
|
406
403
|
quantity: { amount: 0, precision: 0 },
|
|
407
404
|
quantityStep: { amount: 0, precision: 0 },
|
|
408
405
|
minimumQuantity: { amount: 0, precision: 0 },
|
|
409
406
|
maximumQuantity: { amount: 0, precision: 0 }
|
|
410
407
|
};
|
|
408
|
+
if (a.isEnabled) {
|
|
409
|
+
const w = a.getItemPKTCode(n);
|
|
410
|
+
w && (g.code = w);
|
|
411
|
+
}
|
|
411
412
|
return {
|
|
412
413
|
index: t,
|
|
413
|
-
errors:
|
|
414
|
-
templateItem:
|
|
414
|
+
errors: f,
|
|
415
|
+
templateItem: g
|
|
415
416
|
};
|
|
416
417
|
}
|
|
417
|
-
const
|
|
418
|
+
const d = H(
|
|
418
419
|
e.quantityStep,
|
|
419
|
-
q(
|
|
420
|
+
q(o, l)
|
|
420
421
|
);
|
|
421
|
-
(Number.isNaN(Number(e.quantityStep)) || Number(e.quantityStep) <= 0) &&
|
|
422
|
-
const
|
|
422
|
+
(Number.isNaN(Number(e.quantityStep)) || Number(e.quantityStep) <= 0) && f.push("Amount step must be more than 0");
|
|
423
|
+
const h = De(d), y = H(
|
|
423
424
|
e.minimumQuantity,
|
|
424
|
-
q(
|
|
425
|
-
),
|
|
426
|
-
typeof
|
|
427
|
-
const
|
|
425
|
+
q(o, l)
|
|
426
|
+
), m = h(y);
|
|
427
|
+
typeof m == "string" && f.push(`Minimum amount: ${m}`);
|
|
428
|
+
const v = H(
|
|
428
429
|
e.maximumQuantity,
|
|
429
|
-
q(
|
|
430
|
-
),
|
|
431
|
-
typeof
|
|
432
|
-
const
|
|
430
|
+
q(o, l)
|
|
431
|
+
), x = h(v);
|
|
432
|
+
typeof x == "string" && f.push(`Maximum amount: ${x}`), +e.minimumQuantity > +e.maximumQuantity && f.push("Minimum amount must be less than or equal to maximum amount");
|
|
433
|
+
const r = Oe(+e.minimumQuantity, +e.maximumQuantity), S = H(
|
|
433
434
|
e.defaultQuantity,
|
|
434
|
-
q(
|
|
435
|
-
),
|
|
436
|
-
typeof
|
|
437
|
-
const
|
|
438
|
-
sku:
|
|
439
|
-
code: e.overrideCode ||
|
|
440
|
-
name: e.name ||
|
|
441
|
-
measurement:
|
|
442
|
-
quantity:
|
|
443
|
-
quantityStep:
|
|
435
|
+
q(o, l)
|
|
436
|
+
), _ = h(S), p = r(`${e.defaultQuantity}`);
|
|
437
|
+
typeof _ == "string" && f.push(`Default amount: ${_}`), typeof p == "string" && f.push(`Default amount: ${p}`);
|
|
438
|
+
const i = {
|
|
439
|
+
sku: n,
|
|
440
|
+
code: e.overrideCode || n.code,
|
|
441
|
+
name: e.name || n.name,
|
|
442
|
+
measurement: l,
|
|
443
|
+
quantity: S,
|
|
444
|
+
quantityStep: d,
|
|
444
445
|
minimumQuantity: y,
|
|
445
|
-
maximumQuantity:
|
|
446
|
+
maximumQuantity: v
|
|
446
447
|
};
|
|
447
448
|
return {
|
|
448
449
|
index: t,
|
|
449
|
-
errors:
|
|
450
|
-
templateItem:
|
|
450
|
+
errors: f,
|
|
451
|
+
templateItem: i
|
|
451
452
|
};
|
|
452
453
|
}
|
|
453
454
|
function tt(e) {
|
|
454
455
|
const t = e.SheetNames.filter(
|
|
455
|
-
(n) => !Object.values(
|
|
456
|
-
), c = $e().templates,
|
|
456
|
+
(n) => !Object.values(re).map(String).includes(n)
|
|
457
|
+
), c = $e().templates, a = Ne(c, "_id");
|
|
457
458
|
try {
|
|
458
459
|
return t.reduce(
|
|
459
|
-
(n,
|
|
460
|
-
var
|
|
461
|
-
const
|
|
462
|
-
|
|
463
|
-
const
|
|
464
|
-
|
|
465
|
-
const x = Ze(l).filter((
|
|
466
|
-
(
|
|
460
|
+
(n, f) => {
|
|
461
|
+
var i;
|
|
462
|
+
const o = new Array(), l = e.Sheets[f], d = Xe(l), h = Ge(d.transferFrom, d.type);
|
|
463
|
+
o.push(...h.errors);
|
|
464
|
+
const y = h.from, m = Je(d.locations), v = m.filter((u) => u.location).map((u) => u.location);
|
|
465
|
+
o.push(...m.flatMap((u) => u.errors));
|
|
466
|
+
const x = Ze(l).filter((u) => u.data.code), r = x.map(
|
|
467
|
+
(u, g) => et(u.data, g, x)
|
|
467
468
|
);
|
|
468
|
-
|
|
469
|
+
o.push(
|
|
469
470
|
...r.flatMap(
|
|
470
|
-
(
|
|
471
|
+
(u) => u.errors.map((g) => `(Excel row ${u.index + 14}) ${g}`)
|
|
471
472
|
)
|
|
472
473
|
);
|
|
473
|
-
const S = r.filter((
|
|
474
|
-
if (
|
|
475
|
-
const
|
|
476
|
-
if (!
|
|
477
|
-
const
|
|
478
|
-
_id:
|
|
474
|
+
const S = r.filter((u) => u.templateItem).map((u) => u.templateItem);
|
|
475
|
+
if (d.id) {
|
|
476
|
+
const u = a[d.id];
|
|
477
|
+
if (!u) {
|
|
478
|
+
const w = {
|
|
479
|
+
_id: d.id,
|
|
479
480
|
_rev: "",
|
|
480
|
-
name:
|
|
481
|
+
name: d.name || `(unnamed from sheet ${f || "<unnamed sheet>"})`,
|
|
481
482
|
purchaseOrder: rt()
|
|
482
483
|
};
|
|
483
|
-
return
|
|
484
|
+
return o.push(`Template ID ${d.id} is not found.`), n.importUpdateResult.push({
|
|
484
485
|
type: "update",
|
|
485
|
-
original:
|
|
486
|
-
template:
|
|
487
|
-
excelSheetName:
|
|
488
|
-
errors:
|
|
486
|
+
original: w,
|
|
487
|
+
template: w,
|
|
488
|
+
excelSheetName: f,
|
|
489
|
+
errors: o
|
|
489
490
|
}), n;
|
|
490
491
|
}
|
|
491
|
-
const
|
|
492
|
+
const g = {
|
|
492
493
|
type: "update",
|
|
493
|
-
original:
|
|
494
|
+
original: u,
|
|
494
495
|
template: {
|
|
495
|
-
...
|
|
496
|
-
name:
|
|
496
|
+
...u,
|
|
497
|
+
name: d.name,
|
|
497
498
|
locations: v.length ? v : null,
|
|
498
499
|
purchaseOrder: {
|
|
499
|
-
...
|
|
500
|
-
supplier:
|
|
501
|
-
ref:
|
|
502
|
-
remark:
|
|
500
|
+
...u.purchaseOrder,
|
|
501
|
+
supplier: y ?? ((i = u.purchaseOrder) == null ? void 0 : i.supplier),
|
|
502
|
+
ref: d.reference,
|
|
503
|
+
remark: d.remark,
|
|
503
504
|
items: S
|
|
504
505
|
}
|
|
505
506
|
},
|
|
506
|
-
excelSheetName:
|
|
507
|
-
errors:
|
|
507
|
+
excelSheetName: f,
|
|
508
|
+
errors: o
|
|
508
509
|
};
|
|
509
|
-
return n.importUpdateResult.push(
|
|
510
|
+
return n.importUpdateResult.push(g), n;
|
|
510
511
|
}
|
|
511
512
|
const p = {
|
|
512
513
|
type: "create",
|
|
513
514
|
template: {
|
|
514
|
-
name:
|
|
515
|
+
name: d.name,
|
|
515
516
|
locations: v,
|
|
516
517
|
purchaseOrder: {
|
|
517
|
-
supplier:
|
|
518
|
-
ref:
|
|
519
|
-
remark:
|
|
518
|
+
supplier: y ?? _e(),
|
|
519
|
+
ref: d.reference,
|
|
520
|
+
remark: d.remark,
|
|
520
521
|
items: S
|
|
521
522
|
}
|
|
522
523
|
},
|
|
523
|
-
excelSheetName:
|
|
524
|
-
errors:
|
|
524
|
+
excelSheetName: f,
|
|
525
|
+
errors: o
|
|
525
526
|
};
|
|
526
527
|
return n.importCreateResult.push(p), n;
|
|
527
528
|
},
|
|
@@ -565,7 +566,7 @@ function rt() {
|
|
|
565
566
|
const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-col" }, at = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" }, st = { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, it = {
|
|
566
567
|
key: 0,
|
|
567
568
|
class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
|
|
568
|
-
}, lt = { key: 0 },
|
|
569
|
+
}, lt = { key: 0 }, ue = /* @__PURE__ */ ge({
|
|
569
570
|
__name: "TransferTemplateImportItem",
|
|
570
571
|
props: {
|
|
571
572
|
type: {},
|
|
@@ -576,11 +577,11 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
576
577
|
errors: {}
|
|
577
578
|
},
|
|
578
579
|
setup(e) {
|
|
579
|
-
return (t,
|
|
580
|
-
var n,
|
|
581
|
-
const c = B("FmIcon"),
|
|
582
|
-
return T(),
|
|
583
|
-
|
|
580
|
+
return (t, s) => {
|
|
581
|
+
var n, f, o;
|
|
582
|
+
const c = B("FmIcon"), a = B("FmTooltip");
|
|
583
|
+
return T(), k("div", nt, [
|
|
584
|
+
s[0] || (s[0] = $("div", null, "•", -1)),
|
|
584
585
|
$("div", ot, [
|
|
585
586
|
$("div", at, [
|
|
586
587
|
$("div", {
|
|
@@ -590,17 +591,17 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
590
591
|
}, [
|
|
591
592
|
qe(I(t.name) + " ", 1),
|
|
592
593
|
$("span", st, " (" + I(R(Fe)(`${t.transferType}`)) + ") ", 1),
|
|
593
|
-
t.type === "create" ? (T(),
|
|
594
|
+
t.type === "create" ? (T(), k("span", it, "(new)")) : L("", !0)
|
|
594
595
|
], 2),
|
|
595
|
-
t.errors.length ? (T(),
|
|
596
|
-
|
|
597
|
-
content:
|
|
596
|
+
t.errors.length ? (T(), k("div", lt, [
|
|
597
|
+
D(a, { "z-index": 50 }, {
|
|
598
|
+
content: G(() => [
|
|
598
599
|
$("ol", null, [
|
|
599
|
-
(T(!0),
|
|
600
|
+
(T(!0), k(U, null, j(t.errors, (l, d) => (T(), k("li", { key: d }, I(l), 1))), 128))
|
|
600
601
|
])
|
|
601
602
|
]),
|
|
602
|
-
default:
|
|
603
|
-
|
|
603
|
+
default: G(() => [
|
|
604
|
+
D(c, {
|
|
604
605
|
name: "error",
|
|
605
606
|
size: "sm",
|
|
606
607
|
color: "system-error-300"
|
|
@@ -618,7 +619,7 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
618
619
|
"text-fm-color-typo-secondary": !t.errors.length
|
|
619
620
|
}
|
|
620
621
|
])
|
|
621
|
-
}, I((n = t.locations) != null && n.length ? `${(
|
|
622
|
+
}, I((n = t.locations) != null && n.length ? `${(f = t.locations) == null ? void 0 : f.length} locations` : "All locations") + ", " + I(`${(o = t.items) == null ? void 0 : o.length} items`), 3)
|
|
622
623
|
])
|
|
623
624
|
]);
|
|
624
625
|
};
|
|
@@ -638,11 +639,11 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
638
639
|
}, vt = { class: "fm-typo-en-body-lg-600" }, gt = /* @__PURE__ */ ge({
|
|
639
640
|
__name: "TransferTemplateImport",
|
|
640
641
|
setup(e) {
|
|
641
|
-
const t = C(null),
|
|
642
|
+
const t = C(null), s = Qe(), c = he(), a = C(!1), n = C(!1), f = te();
|
|
642
643
|
Ve(async () => {
|
|
643
644
|
n.value = !0;
|
|
644
645
|
try {
|
|
645
|
-
await
|
|
646
|
+
await f.readSuppliers().delayed(1e3);
|
|
646
647
|
} catch {
|
|
647
648
|
c.open({
|
|
648
649
|
title: "Something went wrong.",
|
|
@@ -653,38 +654,38 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
653
654
|
n.value = !1;
|
|
654
655
|
}
|
|
655
656
|
});
|
|
656
|
-
const
|
|
657
|
-
() => !!
|
|
658
|
-
),
|
|
659
|
-
() => !!l.value.length || !!
|
|
660
|
-
), { t: m } =
|
|
657
|
+
const o = C(new Array()), l = C([]), d = C([]), h = ce(
|
|
658
|
+
() => !!o.value.length || l.value.some((x) => x.errors.length) || d.value.some((x) => x.errors.length)
|
|
659
|
+
), y = ce(
|
|
660
|
+
() => !!l.value.length || !!d.value.length
|
|
661
|
+
), { t: m } = ee();
|
|
661
662
|
async function v(x) {
|
|
662
|
-
|
|
663
|
+
o.value = [], l.value = [], d.value = [];
|
|
663
664
|
try {
|
|
664
|
-
|
|
665
|
+
a.value = !0;
|
|
665
666
|
const [r] = await Promise.all([
|
|
666
667
|
Ue(x),
|
|
667
668
|
// fake buffer
|
|
668
|
-
new Promise((
|
|
669
|
+
new Promise((i) => setTimeout(i, 1e3))
|
|
669
670
|
]);
|
|
670
671
|
if (!r.SheetNames.filter(
|
|
671
|
-
(
|
|
672
|
-
).find((
|
|
673
|
-
|
|
672
|
+
(i) => !Object.values(re).map(String).includes(i)
|
|
673
|
+
).find((i) => i)) {
|
|
674
|
+
o.value.push(m("inventory.ingredient.import.fileError.noSheet"));
|
|
674
675
|
return;
|
|
675
676
|
}
|
|
676
677
|
const p = tt(r);
|
|
677
678
|
if (p.invalidExcel) {
|
|
678
|
-
|
|
679
|
+
o.value.push(
|
|
679
680
|
p.invalidExcelMessage ?? m("inventory.ingredient.import.fileError.invalidExcel")
|
|
680
681
|
);
|
|
681
682
|
return;
|
|
682
683
|
}
|
|
683
|
-
if (l.value = p.importCreateResult,
|
|
684
|
-
|
|
684
|
+
if (l.value = p.importCreateResult, d.value = p.importUpdateResult, !l.value.length && !d.value.length) {
|
|
685
|
+
o.value.push(m("inventory.ingredient.import.fileError.noData"));
|
|
685
686
|
return;
|
|
686
687
|
}
|
|
687
|
-
|
|
688
|
+
s.emitData(p);
|
|
688
689
|
} catch (r) {
|
|
689
690
|
c.open({
|
|
690
691
|
title: m("inventory.ingredient.import.fileError.unableToRead"),
|
|
@@ -692,92 +693,92 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
692
693
|
type: "error"
|
|
693
694
|
}), console.error("Error in reading file", r);
|
|
694
695
|
} finally {
|
|
695
|
-
|
|
696
|
+
o.value.length && c.open({
|
|
696
697
|
title: m("inventory.ingredient.import.fileError.invalidExcel"),
|
|
697
698
|
type: "error"
|
|
698
|
-
}),
|
|
699
|
+
}), a.value = !1;
|
|
699
700
|
}
|
|
700
701
|
}
|
|
701
702
|
return je(t, (x) => {
|
|
702
703
|
x && v(x);
|
|
703
704
|
}), (x, r) => {
|
|
704
705
|
const S = B("FmCircularProgress"), _ = B("FmIcon"), p = B("FmButton");
|
|
705
|
-
return T(),
|
|
706
|
+
return T(), k("div", ct, [
|
|
706
707
|
r[2] || (r[2] = $("div", { class: "fm-typo-en-body-md-400" }, "Import transfer templates from excel sheets.", -1)),
|
|
707
|
-
n.value ? (T(),
|
|
708
|
+
n.value ? (T(), k("div", mt, [
|
|
708
709
|
$("div", null, [
|
|
709
|
-
|
|
710
|
+
D(S, {
|
|
710
711
|
size: "md",
|
|
711
712
|
color: "neutral-gray-200"
|
|
712
713
|
})
|
|
713
714
|
]),
|
|
714
715
|
r[1] || (r[1] = $("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "Loading...", -1))
|
|
715
|
-
])) : (T(),
|
|
716
|
-
|
|
716
|
+
])) : (T(), k(U, { key: 1 }, [
|
|
717
|
+
D(Pe, {
|
|
717
718
|
class: M({
|
|
718
719
|
"w-full": !0,
|
|
719
720
|
"h-[200px]": !t.value
|
|
720
721
|
}),
|
|
721
722
|
accept: ".xlsx",
|
|
722
|
-
onFileUpload: r[0] || (r[0] = (
|
|
723
|
+
onFileUpload: r[0] || (r[0] = (i) => t.value = i),
|
|
723
724
|
label: R(m)("inventory.ingredient.import.uploadTemplate"),
|
|
724
725
|
"button-label": R(m)("inventory.ingredient.import.selectFile")
|
|
725
726
|
}, ze({ _: 2 }, [
|
|
726
727
|
t.value ? {
|
|
727
728
|
name: "default",
|
|
728
|
-
fn:
|
|
729
|
+
fn: G(({ openFileDialog: i }) => [
|
|
729
730
|
$("div", ut, [
|
|
730
731
|
$("div", {
|
|
731
732
|
class: M([
|
|
732
733
|
"fm-corner-radius-md p-16 flex items-center gap-16",
|
|
733
734
|
{
|
|
734
|
-
"border border-fm-color-neutral-gray-100":
|
|
735
|
-
"border border-fm-color-neutral-gray-200": !
|
|
736
|
-
"border border-fm-color-system-error-200":
|
|
735
|
+
"border border-fm-color-neutral-gray-100": a.value,
|
|
736
|
+
"border border-fm-color-neutral-gray-200": !a.value && !h.value,
|
|
737
|
+
"border border-fm-color-system-error-200": h.value
|
|
737
738
|
}
|
|
738
739
|
])
|
|
739
740
|
}, [
|
|
740
|
-
|
|
741
|
+
a.value ? (T(), V(S, {
|
|
741
742
|
key: 0,
|
|
742
743
|
size: "md",
|
|
743
744
|
color: "neutral-gray-200"
|
|
744
745
|
})) : (T(), V(_, {
|
|
745
746
|
key: 1,
|
|
746
|
-
name:
|
|
747
|
+
name: h.value ? "error" : "attach_file",
|
|
747
748
|
outline: "",
|
|
748
|
-
color:
|
|
749
|
+
color: h.value ? "system-error-300" : void 0
|
|
749
750
|
}, null, 8, ["name", "color"])),
|
|
750
751
|
$("div", {
|
|
751
752
|
class: M([
|
|
752
753
|
"fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center",
|
|
753
754
|
{
|
|
754
|
-
"text-fm-color-typo-disabled":
|
|
755
|
-
"text-fm-color-typo-primary": !
|
|
755
|
+
"text-fm-color-typo-disabled": a.value,
|
|
756
|
+
"text-fm-color-typo-primary": !a.value
|
|
756
757
|
}
|
|
757
758
|
])
|
|
758
759
|
}, [
|
|
759
760
|
$("div", dt, I(t.value.name), 1)
|
|
760
761
|
], 2),
|
|
761
|
-
|
|
762
|
-
|
|
762
|
+
a.value ? L("", !0) : (T(), k("div", pt, [
|
|
763
|
+
D(p, {
|
|
763
764
|
label: R(m)("inventory.ingredient.import.replaceFile"),
|
|
764
|
-
variant:
|
|
765
|
-
"prepend-icon":
|
|
766
|
-
onClick:
|
|
765
|
+
variant: h.value ? "destructive" : "secondary",
|
|
766
|
+
"prepend-icon": h.value ? void 0 : "autorenew",
|
|
767
|
+
onClick: i
|
|
767
768
|
}, null, 8, ["label", "variant", "prepend-icon", "onClick"])
|
|
768
769
|
]))
|
|
769
770
|
], 2),
|
|
770
|
-
|
|
771
|
-
(T(!0),
|
|
772
|
-
key:
|
|
771
|
+
o.value.length ? (T(), k("div", ft, [
|
|
772
|
+
(T(!0), k(U, null, j(o.value, (u, g) => (T(), k("div", {
|
|
773
|
+
key: g,
|
|
773
774
|
class: "flex gap-8 items-center"
|
|
774
775
|
}, [
|
|
775
|
-
|
|
776
|
+
D(_, {
|
|
776
777
|
name: "error",
|
|
777
778
|
size: "sm",
|
|
778
779
|
color: "system-error-300"
|
|
779
780
|
}),
|
|
780
|
-
$("div", yt, I(
|
|
781
|
+
$("div", yt, I(u), 1)
|
|
781
782
|
]))), 128))
|
|
782
783
|
])) : L("", !0)
|
|
783
784
|
])
|
|
@@ -785,24 +786,24 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
785
786
|
key: "0"
|
|
786
787
|
} : void 0
|
|
787
788
|
]), 1032, ["class", "label", "button-label"]),
|
|
788
|
-
|
|
789
|
+
y.value ? (T(), k("div", ht, [
|
|
789
790
|
$("div", vt, I(R(m)("inventory.ingredient.import.summary")), 1),
|
|
790
|
-
(T(!0),
|
|
791
|
-
key:
|
|
792
|
-
name:
|
|
793
|
-
"transfer-type": typeof
|
|
794
|
-
locations:
|
|
795
|
-
items:
|
|
796
|
-
errors:
|
|
791
|
+
(T(!0), k(U, null, j(l.value, (i, u) => (T(), V(ue, {
|
|
792
|
+
key: u,
|
|
793
|
+
name: i.template.name,
|
|
794
|
+
"transfer-type": typeof i.template.purchaseOrder.supplier.internal == "string" ? R(E).TRANSFER : R(E).PURCHASE,
|
|
795
|
+
locations: i.template.locations,
|
|
796
|
+
items: i.template.purchaseOrder.items,
|
|
797
|
+
errors: i.errors,
|
|
797
798
|
type: "create"
|
|
798
799
|
}, null, 8, ["name", "transfer-type", "locations", "items", "errors"]))), 128)),
|
|
799
|
-
(T(!0),
|
|
800
|
-
key:
|
|
801
|
-
name:
|
|
802
|
-
"transfer-type": typeof
|
|
803
|
-
locations:
|
|
804
|
-
items:
|
|
805
|
-
errors:
|
|
800
|
+
(T(!0), k(U, null, j(d.value, (i) => (T(), V(ue, {
|
|
801
|
+
key: i.template._id,
|
|
802
|
+
name: i.template.name,
|
|
803
|
+
"transfer-type": typeof i.template.purchaseOrder.supplier.internal == "string" ? R(E).TRANSFER : R(E).PURCHASE,
|
|
804
|
+
locations: i.template.locations,
|
|
805
|
+
items: i.template.purchaseOrder.items,
|
|
806
|
+
errors: i.errors,
|
|
806
807
|
type: "update"
|
|
807
808
|
}, null, 8, ["name", "transfer-type", "locations", "items", "errors"]))), 128))
|
|
808
809
|
])) : L("", !0)
|
|
@@ -812,49 +813,49 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
812
813
|
}
|
|
813
814
|
});
|
|
814
815
|
function bt(e) {
|
|
815
|
-
var n,
|
|
816
|
-
const t =
|
|
816
|
+
var n, f;
|
|
817
|
+
const t = J();
|
|
817
818
|
if (!t.isEnabled) return !0;
|
|
818
819
|
if (!e.internal) {
|
|
819
|
-
const
|
|
820
|
-
return l && l ==
|
|
820
|
+
const o = t.getNetSuiteVendor(e._id), l = o == null ? void 0 : o.subsidiaryId, d = (n = t.currentVendorSubsidiary(e._id)) == null ? void 0 : n.id;
|
|
821
|
+
return l && l == d;
|
|
821
822
|
}
|
|
822
|
-
const
|
|
823
|
-
return c && c ==
|
|
823
|
+
const s = t.getNetSuiteLocation(`${e.internal}_${e._id}`), c = t.getLocationSubsidiary(s == null ? void 0 : s.netSuiteId).id, a = (f = t.currentLocationSubsidiary()) == null ? void 0 : f.id;
|
|
824
|
+
return c && c == a;
|
|
824
825
|
}
|
|
825
826
|
const xt = ve("transferTemplateActions", () => {
|
|
826
|
-
const e = He(), t = he(),
|
|
827
|
-
function
|
|
827
|
+
const e = He(), t = he(), s = z(), c = $e(), a = be(), n = J(), f = Ke(), { t: o } = ee(), l = C({});
|
|
828
|
+
function d() {
|
|
828
829
|
l.value = {
|
|
829
|
-
mode:
|
|
830
|
+
mode: ae.CREATE,
|
|
830
831
|
show: !0,
|
|
831
832
|
"onUpdate:show"(p) {
|
|
832
833
|
l.value.show = p;
|
|
833
834
|
}
|
|
834
835
|
};
|
|
835
836
|
}
|
|
836
|
-
function
|
|
837
|
+
function h(p) {
|
|
837
838
|
l.value = {
|
|
838
|
-
mode:
|
|
839
|
+
mode: ae.UPDATE,
|
|
839
840
|
modelValue: p,
|
|
840
841
|
show: !0,
|
|
841
|
-
"onUpdate:show"(
|
|
842
|
-
l.value.show =
|
|
842
|
+
"onUpdate:show"(i) {
|
|
843
|
+
l.value.show = i;
|
|
843
844
|
}
|
|
844
845
|
};
|
|
845
846
|
}
|
|
846
|
-
function
|
|
847
|
+
function y(p, i, u) {
|
|
847
848
|
e.open({
|
|
848
849
|
title: `Confirm deleting template ${p.name}?`,
|
|
849
850
|
message: "Deleted template can no longer be retrieved",
|
|
850
851
|
primaryActions: {
|
|
851
852
|
text: "Delete",
|
|
852
|
-
variant:
|
|
853
|
+
variant: ie.Destructive,
|
|
853
854
|
close: !0
|
|
854
855
|
},
|
|
855
856
|
secondaryActions: {
|
|
856
857
|
text: "Cancel",
|
|
857
|
-
variant:
|
|
858
|
+
variant: ie.Plain,
|
|
858
859
|
close: !0
|
|
859
860
|
}
|
|
860
861
|
}).onPrimary(async () => {
|
|
@@ -863,24 +864,24 @@ const xt = ve("transferTemplateActions", () => {
|
|
|
863
864
|
type: "info"
|
|
864
865
|
});
|
|
865
866
|
try {
|
|
866
|
-
|
|
867
|
-
const [
|
|
868
|
-
|
|
869
|
-
new Promise((
|
|
867
|
+
i.value = !0;
|
|
868
|
+
const [g] = await Promise.allSettled([
|
|
869
|
+
a.deleteTemplate(p),
|
|
870
|
+
new Promise((w) => setTimeout(w, 1e3))
|
|
870
871
|
]);
|
|
871
|
-
if (
|
|
872
|
+
if (g.status === "rejected") throw g.reason;
|
|
872
873
|
t.open({
|
|
873
874
|
title: `Deleted ${p.name}`,
|
|
874
875
|
type: "success"
|
|
875
876
|
});
|
|
876
|
-
} catch (
|
|
877
|
+
} catch (g) {
|
|
877
878
|
t.open({
|
|
878
879
|
title: `Unable to delete ${p.name}`,
|
|
879
|
-
message: `See error from server: ${
|
|
880
|
+
message: `See error from server: ${g}`,
|
|
880
881
|
type: "error"
|
|
881
|
-
}), console.error("error on deleting purchase order template",
|
|
882
|
+
}), console.error("error on deleting purchase order template", g);
|
|
882
883
|
} finally {
|
|
883
|
-
|
|
884
|
+
i.value = !1, u();
|
|
884
885
|
}
|
|
885
886
|
});
|
|
886
887
|
}
|
|
@@ -889,24 +890,24 @@ const xt = ve("transferTemplateActions", () => {
|
|
|
889
890
|
m.value = {
|
|
890
891
|
template: p,
|
|
891
892
|
show: !0,
|
|
892
|
-
"onUpdate:show"(
|
|
893
|
-
m.value.show =
|
|
893
|
+
"onUpdate:show"(i) {
|
|
894
|
+
m.value.show = i;
|
|
894
895
|
},
|
|
895
896
|
"onAction:edit"() {
|
|
896
|
-
m.value.show = !1,
|
|
897
|
+
m.value.show = !1, h(X(p));
|
|
897
898
|
}
|
|
898
899
|
};
|
|
899
900
|
}
|
|
900
901
|
function x() {
|
|
901
|
-
const { promise: p, resolve:
|
|
902
|
-
|
|
903
|
-
},
|
|
904
|
-
(
|
|
905
|
-
var
|
|
906
|
-
return (!
|
|
902
|
+
const { promise: p, resolve: i } = Promise.withResolvers(), u = (b) => {
|
|
903
|
+
i(b);
|
|
904
|
+
}, g = c.templates.filter(
|
|
905
|
+
(b) => {
|
|
906
|
+
var A;
|
|
907
|
+
return (!b.locations || b.locations.find((O) => O.doc._id === s.currentLocation.doc._id)) && ((A = b.purchaseOrder.supplier) == null ? void 0 : A._id) !== s.currentLocation.doc._id;
|
|
907
908
|
}
|
|
908
909
|
);
|
|
909
|
-
if (!
|
|
910
|
+
if (!g.length)
|
|
910
911
|
return e.open({
|
|
911
912
|
title: "Select one template",
|
|
912
913
|
message: "There is no available template in your business. Configure a new template?",
|
|
@@ -919,26 +920,26 @@ const xt = ve("transferTemplateActions", () => {
|
|
|
919
920
|
close: !0
|
|
920
921
|
}
|
|
921
922
|
}).onPrimary(() => {
|
|
922
|
-
|
|
923
|
-
}).onSecondary(() =>
|
|
924
|
-
const
|
|
925
|
-
var
|
|
926
|
-
const
|
|
927
|
-
`${
|
|
928
|
-
) : n.getNetSuiteVendor(
|
|
929
|
-
location is ${(
|
|
923
|
+
f.push({ name: se.TRANSFER_TEMPLATE }), u(void 0);
|
|
924
|
+
}).onSecondary(() => u(void 0)).onClose(() => u(void 0)), p;
|
|
925
|
+
const w = g.map((b) => {
|
|
926
|
+
var ne;
|
|
927
|
+
const A = !b.purchaseOrder.items.length || b.purchaseOrder.items.some(xe), O = !bt(b.purchaseOrder.supplier), K = b.purchaseOrder.supplier.internal ? n.getNetSuiteLocation(
|
|
928
|
+
`${b.purchaseOrder.supplier.internal}_${b.purchaseOrder.supplier._id}`
|
|
929
|
+
) : n.getNetSuiteVendor(b.purchaseOrder.supplier._id), we = O ? `The subsidiary of the request
|
|
930
|
+
location is ${(ne = n.getLocationSubsidiary(K == null ? void 0 : K.netSuiteId)) == null ? void 0 : ne.fullName}.` : void 0, ke = A || O, Ce = A ? "This template is invalid. Update this template." : O ? we : void 0, Ee = `${b.purchaseOrder.supplier.internal ? "Transfer" : "Purchase"} from ${b.purchaseOrder.supplier.name}`;
|
|
930
931
|
return {
|
|
931
|
-
label:
|
|
932
|
-
value:
|
|
932
|
+
label: b.name,
|
|
933
|
+
value: b._id,
|
|
933
934
|
disabled: ke,
|
|
934
935
|
sublabel: Ce ?? Ee
|
|
935
936
|
};
|
|
936
937
|
});
|
|
937
|
-
return
|
|
938
|
+
return w.sort((b, A) => +!!b.disabled - +!!A.disabled), e.open({
|
|
938
939
|
title: "Select one template",
|
|
939
940
|
contentComponent: Be,
|
|
940
941
|
contentComponentProps: {
|
|
941
|
-
items:
|
|
942
|
+
items: w,
|
|
942
943
|
singleSelect: !0
|
|
943
944
|
},
|
|
944
945
|
primaryActions: {
|
|
@@ -953,87 +954,87 @@ const xt = ve("transferTemplateActions", () => {
|
|
|
953
954
|
text: "Templates",
|
|
954
955
|
close: !0
|
|
955
956
|
}
|
|
956
|
-
}).onPrimary((
|
|
957
|
-
|
|
958
|
-
}).onClose(() =>
|
|
957
|
+
}).onPrimary((b) => Array.isArray(b) ? u(b[0]) : null).onSecondary(() => u(void 0)).onTertiary(() => {
|
|
958
|
+
f.push({ name: se.TRANSFER_TEMPLATE }), u(void 0);
|
|
959
|
+
}).onClose(() => u(void 0)), p;
|
|
959
960
|
}
|
|
960
961
|
function r() {
|
|
961
962
|
e.open({
|
|
962
|
-
title:
|
|
963
|
+
title: o("inventory.ingredient.import.title"),
|
|
963
964
|
contentComponent: gt,
|
|
964
965
|
overlay: !0,
|
|
965
966
|
closeButton: !0,
|
|
966
967
|
primaryActions: {
|
|
967
|
-
text:
|
|
968
|
+
text: o("common.import"),
|
|
968
969
|
close: !1
|
|
969
970
|
},
|
|
970
971
|
secondaryActions: {
|
|
971
|
-
text:
|
|
972
|
+
text: o("common.close"),
|
|
972
973
|
close: !0
|
|
973
974
|
},
|
|
974
975
|
tertiaryActions: {
|
|
975
|
-
text:
|
|
976
|
+
text: o("inventory.ingredient.import.actions.downloadTemplate"),
|
|
976
977
|
close: !1,
|
|
977
978
|
variant: "plain"
|
|
978
979
|
}
|
|
979
980
|
}).onPrimary((p) => {
|
|
980
981
|
if (!p) {
|
|
981
982
|
t.open({
|
|
982
|
-
title:
|
|
983
|
+
title: o("inventory.ingredient.import.error.noData"),
|
|
983
984
|
type: "error"
|
|
984
985
|
});
|
|
985
986
|
return;
|
|
986
987
|
}
|
|
987
988
|
if (!p.importCreateResult.length && !p.importUpdateResult.length) {
|
|
988
989
|
t.open({
|
|
989
|
-
title:
|
|
990
|
-
message:
|
|
990
|
+
title: o("inventory.ingredient.import.error.invalidContent"),
|
|
991
|
+
message: o("inventory.ingredient.import.error.noImportData"),
|
|
991
992
|
type: "error"
|
|
992
993
|
});
|
|
993
994
|
return;
|
|
994
995
|
}
|
|
995
|
-
if (p.importCreateResult.some((
|
|
996
|
+
if (p.importCreateResult.some((i) => i.errors.length) || p.importUpdateResult.some((i) => i.errors.length)) {
|
|
996
997
|
t.open({
|
|
997
|
-
title:
|
|
998
|
-
message:
|
|
998
|
+
title: o("inventory.ingredient.import.error.invalidContent"),
|
|
999
|
+
message: o("inventory.ingredient.import.error.hasErrors"),
|
|
999
1000
|
type: "error"
|
|
1000
1001
|
});
|
|
1001
1002
|
return;
|
|
1002
1003
|
}
|
|
1003
1004
|
e.close(), S(p);
|
|
1004
|
-
}).onTertiary(
|
|
1005
|
+
}).onTertiary(Ye);
|
|
1005
1006
|
}
|
|
1006
1007
|
async function S(p) {
|
|
1007
1008
|
try {
|
|
1008
|
-
const
|
|
1009
|
+
const i = [
|
|
1009
1010
|
...p.importCreateResult.map(
|
|
1010
|
-
(
|
|
1011
|
+
(b) => b.template
|
|
1011
1012
|
),
|
|
1012
1013
|
...p.importUpdateResult.map(
|
|
1013
|
-
(
|
|
1014
|
+
(b) => b.template
|
|
1014
1015
|
)
|
|
1015
|
-
],
|
|
1016
|
-
let
|
|
1017
|
-
const
|
|
1018
|
-
|
|
1019
|
-
title:
|
|
1020
|
-
Math.min(
|
|
1021
|
-
|
|
1016
|
+
], u = 100;
|
|
1017
|
+
let g = 0;
|
|
1018
|
+
const w = () => {
|
|
1019
|
+
g += u, t.open({
|
|
1020
|
+
title: o("inventory.ingredient.import.progress", [
|
|
1021
|
+
Math.min(g, i.length),
|
|
1022
|
+
i.length
|
|
1022
1023
|
])
|
|
1023
1024
|
});
|
|
1024
1025
|
};
|
|
1025
|
-
for (const
|
|
1026
|
-
|
|
1026
|
+
for (const b of i.chunk(100))
|
|
1027
|
+
w(), await a.importTemplates(b);
|
|
1027
1028
|
t.open({
|
|
1028
|
-
title:
|
|
1029
|
+
title: o("inventory.ingredient.import.success"),
|
|
1029
1030
|
type: "success"
|
|
1030
1031
|
});
|
|
1031
|
-
} catch (
|
|
1032
|
+
} catch (i) {
|
|
1032
1033
|
t.open({
|
|
1033
|
-
title:
|
|
1034
|
-
message:
|
|
1034
|
+
title: o("inventory.ingredient.import.error.failed"),
|
|
1035
|
+
message: o("inventory.ingredient.import.error.systemMessage", [i == null ? void 0 : i.message]),
|
|
1035
1036
|
type: "error"
|
|
1036
|
-
}), console.error("Error in importing skus", p,
|
|
1037
|
+
}), console.error("Error in importing skus", p, i);
|
|
1037
1038
|
} finally {
|
|
1038
1039
|
c.fetchTemplates();
|
|
1039
1040
|
}
|
|
@@ -1041,16 +1042,16 @@ const xt = ve("transferTemplateActions", () => {
|
|
|
1041
1042
|
function _() {
|
|
1042
1043
|
const p = We(c.templates);
|
|
1043
1044
|
t.open({
|
|
1044
|
-
title:
|
|
1045
|
-
message:
|
|
1045
|
+
title: o("inventory.ingredient.export.success"),
|
|
1046
|
+
message: o("inventory.ingredient.export.filename", [p]),
|
|
1046
1047
|
type: "success"
|
|
1047
1048
|
});
|
|
1048
1049
|
}
|
|
1049
1050
|
return {
|
|
1050
|
-
createTemplate:
|
|
1051
|
+
createTemplate: d,
|
|
1051
1052
|
viewTemplate: v,
|
|
1052
|
-
updateTemplate:
|
|
1053
|
-
deleteTemplate:
|
|
1053
|
+
updateTemplate: h,
|
|
1054
|
+
deleteTemplate: y,
|
|
1054
1055
|
getTemplateId: x,
|
|
1055
1056
|
importTemplates: r,
|
|
1056
1057
|
exportTemplates: _,
|
|
@@ -1058,34 +1059,34 @@ const xt = ve("transferTemplateActions", () => {
|
|
|
1058
1059
|
templateDetailsProps: m
|
|
1059
1060
|
};
|
|
1060
1061
|
});
|
|
1061
|
-
function
|
|
1062
|
-
const { skuById: t } = Q(),
|
|
1063
|
-
return
|
|
1062
|
+
function de(e) {
|
|
1063
|
+
const { skuById: t } = Q(), s = X(e);
|
|
1064
|
+
return s.purchaseOrder.items = e.purchaseOrder.items.filter((c) => t[c.sku._id]), s;
|
|
1064
1065
|
}
|
|
1065
1066
|
const $e = ve(
|
|
1066
1067
|
"transferTemplateTable",
|
|
1067
1068
|
function() {
|
|
1068
|
-
const { t } =
|
|
1069
|
-
async function
|
|
1070
|
-
|
|
1069
|
+
const { t } = ee(), s = xt(), c = C(!1), a = C(new Array()), n = be(), f = Q();
|
|
1070
|
+
async function o() {
|
|
1071
|
+
a.value = [], c.value = !0;
|
|
1071
1072
|
try {
|
|
1072
|
-
const [
|
|
1073
|
+
const [y] = await Promise.all([
|
|
1073
1074
|
n.readTemplates(),
|
|
1074
|
-
|
|
1075
|
+
f.readInventory()
|
|
1075
1076
|
]).delayed(1e3);
|
|
1076
|
-
|
|
1077
|
-
} catch (
|
|
1078
|
-
console.log("Something went wrong when fetching templates:",
|
|
1077
|
+
a.value = y.map(de);
|
|
1078
|
+
} catch (y) {
|
|
1079
|
+
console.log("Something went wrong when fetching templates:", y);
|
|
1079
1080
|
} finally {
|
|
1080
1081
|
c.value = !1;
|
|
1081
1082
|
}
|
|
1082
1083
|
}
|
|
1083
|
-
async function l(
|
|
1084
|
-
if (!
|
|
1084
|
+
async function l(y) {
|
|
1085
|
+
if (!a.value.find((m) => m._id)) {
|
|
1085
1086
|
c.value = !0;
|
|
1086
1087
|
try {
|
|
1087
|
-
|
|
1088
|
-
await n.getTemplate(
|
|
1088
|
+
a.value = [
|
|
1089
|
+
await n.getTemplate(y).then(de).delayed(1e3)
|
|
1089
1090
|
];
|
|
1090
1091
|
} catch (m) {
|
|
1091
1092
|
console.log("Something went wrong when fetching templates:", m);
|
|
@@ -1094,14 +1095,14 @@ const $e = ve(
|
|
|
1094
1095
|
}
|
|
1095
1096
|
}
|
|
1096
1097
|
}
|
|
1097
|
-
function
|
|
1098
|
-
switch (m =
|
|
1099
|
-
case
|
|
1100
|
-
return
|
|
1101
|
-
case
|
|
1102
|
-
return
|
|
1103
|
-
case
|
|
1104
|
-
return
|
|
1098
|
+
function d(y, m) {
|
|
1099
|
+
switch (m = X(m), y) {
|
|
1100
|
+
case N.Details:
|
|
1101
|
+
return s.viewTemplate(m);
|
|
1102
|
+
case N.Edit:
|
|
1103
|
+
return s.updateTemplate(m);
|
|
1104
|
+
case N.Delete:
|
|
1105
|
+
return s.deleteTemplate(m, c, o);
|
|
1105
1106
|
}
|
|
1106
1107
|
}
|
|
1107
1108
|
return {
|
|
@@ -1110,8 +1111,8 @@ const $e = ve(
|
|
|
1110
1111
|
id: "_id",
|
|
1111
1112
|
accessorKey: "_id",
|
|
1112
1113
|
header: () => t("inventory.transfer.table.createdAt"),
|
|
1113
|
-
cell(
|
|
1114
|
-
return Me(`${
|
|
1114
|
+
cell(y) {
|
|
1115
|
+
return Me(`${y.getValue()}`);
|
|
1115
1116
|
},
|
|
1116
1117
|
enableSorting: !0
|
|
1117
1118
|
},
|
|
@@ -1131,18 +1132,18 @@ const $e = ve(
|
|
|
1131
1132
|
width: "10rem",
|
|
1132
1133
|
textAlign: "right"
|
|
1133
1134
|
},
|
|
1134
|
-
cell(
|
|
1135
|
-
const m = Number(
|
|
1136
|
-
return m === 0 || v ?
|
|
1137
|
-
|
|
1138
|
-
|
|
1135
|
+
cell(y) {
|
|
1136
|
+
const m = Number(y.getValue()) || 0, v = y.row.original.purchaseOrder.items.some(xe);
|
|
1137
|
+
return m === 0 || v ? Y("div", { class: "flex justify-end gap-4 items-center" }, [
|
|
1138
|
+
Y(
|
|
1139
|
+
le.FmTooltip,
|
|
1139
1140
|
{},
|
|
1140
1141
|
{
|
|
1141
1142
|
content() {
|
|
1142
1143
|
return v ? "The template is invalid due to invalid unit on some of the items. Please update this template." : "The template is invalid due to deleted ingredients. Please update this template.";
|
|
1143
1144
|
},
|
|
1144
1145
|
default() {
|
|
1145
|
-
return
|
|
1146
|
+
return Y(le.FmIcon, {
|
|
1146
1147
|
name: "error",
|
|
1147
1148
|
color: "system-error-300",
|
|
1148
1149
|
size: "sm"
|
|
@@ -1158,9 +1159,9 @@ const $e = ve(
|
|
|
1158
1159
|
id: "enabledLocations",
|
|
1159
1160
|
accessorKey: "purchaseOrder.locations.length",
|
|
1160
1161
|
header: () => "Enabled outlets",
|
|
1161
|
-
cell(
|
|
1162
|
+
cell(y) {
|
|
1162
1163
|
var v;
|
|
1163
|
-
const m = (v =
|
|
1164
|
+
const m = (v = y.row.original.locations) == null ? void 0 : v.length;
|
|
1164
1165
|
return m ? `${m}` : "All";
|
|
1165
1166
|
},
|
|
1166
1167
|
enableSorting: !1,
|
|
@@ -1178,13 +1179,13 @@ const $e = ve(
|
|
|
1178
1179
|
},
|
|
1179
1180
|
{
|
|
1180
1181
|
id: "action",
|
|
1181
|
-
cell(
|
|
1182
|
-
const m =
|
|
1183
|
-
W[
|
|
1184
|
-
W[
|
|
1185
|
-
W[
|
|
1182
|
+
cell(y) {
|
|
1183
|
+
const m = y.row.original, v = [
|
|
1184
|
+
W[N.Details],
|
|
1185
|
+
W[N.Edit],
|
|
1186
|
+
W[N.Delete]
|
|
1186
1187
|
];
|
|
1187
|
-
return Le(v, (x) =>
|
|
1188
|
+
return Le(v, (x) => d(x, m));
|
|
1188
1189
|
},
|
|
1189
1190
|
enableSorting: !1,
|
|
1190
1191
|
size: 40,
|
|
@@ -1194,15 +1195,15 @@ const $e = ve(
|
|
|
1194
1195
|
}
|
|
1195
1196
|
}
|
|
1196
1197
|
],
|
|
1197
|
-
templates:
|
|
1198
|
+
templates: a,
|
|
1198
1199
|
loading: c,
|
|
1199
|
-
fetchTemplates:
|
|
1200
|
+
fetchTemplates: o,
|
|
1200
1201
|
loadTemplate: l
|
|
1201
1202
|
};
|
|
1202
1203
|
}
|
|
1203
1204
|
);
|
|
1204
|
-
function Rt(e, t,
|
|
1205
|
-
const c = (
|
|
1205
|
+
function Rt(e, t, s) {
|
|
1206
|
+
const c = (s == null ? void 0 : s.abbrev) ?? t.abbrev;
|
|
1206
1207
|
return `${P(e, !1)} ${c}`;
|
|
1207
1208
|
}
|
|
1208
1209
|
export {
|