@feedmepos/mf-inventory-portal 0.0.25-dev.7 → 0.0.25-dev.9
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-qJehfAde.js → App-9zSE_swt.js} +35 -34
- package/dist/{ApprovalView-BuqKIEPL.js → ApprovalView-C2tg-wsm.js} +18 -18
- package/dist/{BindingsDialog-BrF-YAJ2.js → BindingsDialog-eGbOIQkw.js} +6 -6
- package/dist/{BindingsPicker-DK41dcoG.js → BindingsPicker-CVXrd29s.js} +3 -3
- package/dist/{BindingsTable-DxlRhKzN.js → BindingsTable-CCsQEFnu.js} +6 -6
- package/dist/{ClosingDraftView-CpGQMN37.js → ClosingDraftView-BI8b3CJ9.js} +47 -47
- package/dist/ClosingTemplateView-miJnC-ML.js +1859 -0
- package/dist/FmCustomAttribute.vue_vue_type_script_setup_true_lang-D-IWRjRD.js +34 -0
- package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-C9un0wCK.js +211 -0
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-3LU_3Y8h.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BRSABJnM.js} +52 -52
- package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-DeRvrF7O.js +51 -0
- package/dist/{IngredientGroupView-Bjv9Kih7.js → IngredientGroupView-ZWCOAljO.js} +1 -1
- package/dist/{IngredientsView-ChJbe-U_.js → IngredientsView-5-pSX6y_.js} +394 -382
- package/dist/{IntegrationView-Cmh47qP7.js → IntegrationView-DO3Ambro.js} +660 -623
- package/dist/{InventoryBindingForm-GmcCTBqN.js → InventoryBindingForm-BjtFP29c.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CQrjMOFh.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CFMZ4VsK.js} +55 -55
- package/dist/{InventoryBindingSummary-w1pFGR3C.js → InventoryBindingSummary-C6DkVX-B.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Cxr2xhRR.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-nb1t6u2V.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CzxVUAC8.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BcMAXo4F.js} +15 -15
- package/dist/{PublishView-pWAEdGLi.js → PublishView-DOMQdIJ7.js} +7 -7
- package/dist/{PurchaseOrderPrintPreview-CZczBXL2.js → PurchaseOrderPrintPreview-_MCAsdw9.js} +1 -1
- package/dist/{ReceiveRequestView-tWyQCrIN.js → ReceiveRequestView-902hWGtz.js} +56 -55
- package/dist/{RecipeView-Dy1BBW3o.js → RecipeView-dmmjklwh.js} +32 -31
- package/dist/{index-cY9fiIBU.js → StockView-C4lEYLXU.js} +3577 -1764
- package/dist/{SupplierView-BUs8xZPq.js → SupplierView-CO5460uC.js} +12 -11
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-BA0HIuSW.js → TransferDetails.vue_vue_type_script_setup_true_lang-D6sZDCEY.js} +195 -194
- package/dist/TransferTemplateView-C9UwNTnY.js +1371 -0
- package/dist/{UnitView-GBK0ovxt.js → UnitView-DbYzxCXF.js} +14 -14
- package/dist/{WarehouseView-CXoj99HO.js → WarehouseView-BII4SEVC.js} +332 -314
- package/dist/api/inventory.d.ts +7 -6
- package/dist/{app-Du-JrqLm.js → app-IM1yJnE8.js} +15144 -15889
- package/dist/app.js +1 -1
- package/dist/components/FmAutocompleteTextField.vue.d.ts +31 -0
- package/dist/components/FmCustomAttribute.vue.d.ts +3 -8
- package/dist/components/FmLockableField.vue.d.ts +3 -0
- package/dist/components/FmMultiselectDialog.vue.d.ts +9 -1
- package/dist/components/FmMultiselectDialogProps.d.ts +2 -0
- package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +1 -1
- package/dist/components/shell/inventory/binding-ui.vue.d.ts +1 -1
- package/dist/{decimal-BXePRNLM.js → decimal-DQUpCN-B.js} +1 -1
- package/dist/feature-DMBVVBsQ.js +1005 -0
- package/dist/{format-unit-display-BdC0fMRb.js → format-unit-display-COuIZISg.js} +242 -238
- package/dist/helper/fuzzy.d.ts +10 -0
- package/dist/index-CIrsMt6f.js +35546 -0
- package/dist/{stock-CE5Qq59r.js → stock-BJUTiXXk.js} +3 -3
- package/dist/stores/inventory.d.ts +8 -8
- package/dist/stores/location.d.ts +9 -0
- package/dist/stores/warehouse.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/{supplier-Cy-jlD0j.js → supplier-CM-qQVyI.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/use-ingredient-select-dialog-Cn79xFNg.js +51 -0
- package/dist/{use-inventory-binding-dialog-nHDQBRL3.js → use-inventory-binding-dialog-zwOG19YV.js} +1 -1
- package/dist/views/adjustment-template/wastage-template/actions.d.ts +24 -0
- package/dist/views/adjustment-template/wastage-template/table.d.ts +24 -0
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +8 -4
- package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +48 -24
- package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +1 -1
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +36 -12
- package/dist/views/closing-template/composables/use-closing-template-table.d.ts +36 -12
- package/dist/views/dev/components/AutocompleteTextField.vue.d.ts +2 -0
- package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +3 -3
- package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +2 -2
- package/dist/views/ingredients/composables/use-ingredient-select-dialog.d.ts +16 -0
- package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -1
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +25 -17
- package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +2 -2
- package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +1 -1
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +36 -24
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +36 -24
- package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +2 -2
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations-2.d.ts +8 -0
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +1 -0
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +1 -1
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +36 -12
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +36 -12
- package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +2 -0
- package/dist/{vue-i18n-DIA7c33f.js → vue-i18n-CzPFJ9JY.js} +2 -2
- package/package.json +2 -2
- package/dist/ClosingTemplateView-4l891KsC.js +0 -1819
- package/dist/FmCustomAttribute.vue_vue_type_script_setup_true_lang-CyHyOhG6.js +0 -142
- package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DRqpc9k0.js +0 -286
- package/dist/StockView-B0c0FiPr.js +0 -1817
- package/dist/TransferTemplateView-MSbvSo96.js +0 -1286
- package/dist/components/FmCustomAttribute2.vue.d.ts +0 -18
- package/dist/index-irnhqIWw.js +0 -29202
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useCoreStore as
|
|
3
|
-
import { useDialogChild as Qe, useSnackbar as
|
|
4
|
-
import { defineStore as
|
|
5
|
-
import { defineComponent as
|
|
1
|
+
import { W as Ee, a as q, K as Ie, ad as U, q as Ae, ae as fe, r as ye, u as W, i as B, s as Ne, aG as ae, v as he, b as J, t as V, O as j, aF as Oe, ay as De, T as Fe, w as Pe, x as Ue, d as se, e as X, R as ie, H as Be, ac as Me, D as G, h as D, f as Le } from "./app-IM1yJnE8.js";
|
|
2
|
+
import { useCoreStore as ee, useI18n as te } from "@feedmepos/mf-common";
|
|
3
|
+
import { useDialogChild as Qe, useSnackbar as ve, useDialog as He, FmButtonVariant as le, components as ce } from "@feedmepos/ui-library";
|
|
4
|
+
import { defineStore as ge } from "pinia";
|
|
5
|
+
import { defineComponent as be, resolveComponent as L, openBlock as T, createElementBlock as w, createElementVNode as $, normalizeClass as Q, createTextVNode as qe, toDisplayString as I, unref as E, createCommentVNode as H, createVNode as F, withCtx as Z, Fragment as M, renderList as K, ref as C, onMounted as Ve, computed as me, watch as je, createSlots as ze, createBlock as z, h as Y } from "vue";
|
|
6
6
|
import { useRouter as Ke } from "vue-router";
|
|
7
|
-
import { u as
|
|
8
|
-
const
|
|
9
|
-
function
|
|
7
|
+
import { u as re } from "./supplier-CM-qQVyI.js";
|
|
8
|
+
const Se = Ee((e, t) => {
|
|
9
|
+
function a() {
|
|
10
10
|
var n;
|
|
11
|
-
return `business_${((n =
|
|
11
|
+
return `business_${((n = ee().currentBusiness.value) == null ? void 0 : n._id) ?? ""}`;
|
|
12
12
|
}
|
|
13
13
|
return {
|
|
14
14
|
async getTemplate(c) {
|
|
15
|
-
const
|
|
15
|
+
const s = a(), n = `${e.inventoryBackendUrl}/${s}/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 = a(), s = `${e.inventoryBackendUrl}/${c}/purchase-order-template`;
|
|
20
|
+
return t.get(s);
|
|
21
21
|
},
|
|
22
22
|
async createTemplate(c) {
|
|
23
|
-
const
|
|
23
|
+
const s = a(), n = `${e.inventoryBackendUrl}/${s}/purchase-order-template`;
|
|
24
24
|
return t.post(n, c);
|
|
25
25
|
},
|
|
26
26
|
async updateTemplate(c) {
|
|
27
|
-
const
|
|
27
|
+
const s = a(), n = `${e.inventoryBackendUrl}/${s}/purchase-order-template`;
|
|
28
28
|
return t.put(n, c);
|
|
29
29
|
},
|
|
30
30
|
async deleteTemplate(c) {
|
|
31
|
-
const
|
|
31
|
+
const s = a(), n = `${e.inventoryBackendUrl}/${s}/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 s = a(), n = `${e.inventoryBackendUrl}/${s}/purchase-order-template/import`;
|
|
36
36
|
return t.post(n, c);
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
});
|
|
40
|
-
function Se(e) {
|
|
41
|
-
const t = Q(), i = e.sku, c = t.skuById[i._id];
|
|
42
|
-
if (c.unit._id !== i.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
|
-
}
|
|
46
|
-
var R = /* @__PURE__ */ ((e) => (e.PURCHASE = "PURCHASE", e.TRANSFER = "TRANSFER", e))(R || {}), re = /* @__PURE__ */ ((e) => (e.Source = "Source", e.Destination = "Destination", e.Ingredient = "Ingredient", e))(re || {});
|
|
47
|
-
const me = Ie(0);
|
|
48
40
|
function xe(e) {
|
|
41
|
+
const t = q(), a = e.sku, c = t.skuById[a._id];
|
|
42
|
+
if (c.unit._id !== a.unit._id) return !0;
|
|
43
|
+
const s = e.measurement;
|
|
44
|
+
return s ? !t.unitById[c.unit._id].measurements.find((o) => o.id === s.id) : !1;
|
|
45
|
+
}
|
|
46
|
+
var R = /* @__PURE__ */ ((e) => (e.PURCHASE = "PURCHASE", e.TRANSFER = "TRANSFER", e))(R || {}), ne = /* @__PURE__ */ ((e) => (e.Source = "Source", e.Destination = "Destination", e.Ingredient = "Ingredient", e))(ne || {});
|
|
47
|
+
const ue = Ie(0);
|
|
48
|
+
function Te(e) {
|
|
49
49
|
var c;
|
|
50
50
|
const t = e.sku;
|
|
51
51
|
return {
|
|
52
52
|
code: t.code,
|
|
53
53
|
overrideCode: e.code,
|
|
54
54
|
name: t.name,
|
|
55
|
-
unit: ((c = t.unit.measurements.find((
|
|
56
|
-
defaultQuantity: +
|
|
57
|
-
minimumQuantity: +
|
|
58
|
-
maximumQuantity: +
|
|
59
|
-
quantityStep: +
|
|
55
|
+
unit: ((c = t.unit.measurements.find((s) => s.id === t.trackingMeasurement)) == null ? void 0 : c.abbrev) ?? t.unit.abbrev,
|
|
56
|
+
defaultQuantity: +B(e.quantity),
|
|
57
|
+
minimumQuantity: +B(e.minimumQuantity ?? ue),
|
|
58
|
+
maximumQuantity: +B(e.maximumQuantity ?? ue),
|
|
59
|
+
quantityStep: +B(e.quantityStep)
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function _e() {
|
|
63
63
|
return [
|
|
64
64
|
{
|
|
65
65
|
id: "code",
|
|
@@ -97,14 +97,14 @@ function Te() {
|
|
|
97
97
|
}
|
|
98
98
|
function We(e) {
|
|
99
99
|
var o;
|
|
100
|
-
const
|
|
100
|
+
const a = ee().currentBusiness.value, s = (o = e.map((l) => {
|
|
101
101
|
var b;
|
|
102
|
-
const d = l.purchaseOrder.items.map((r) =>
|
|
102
|
+
const d = l.purchaseOrder.items.map((r) => Te(r)), h = _e(), 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", a == null ? void 0 : a.name],
|
|
106
|
+
["Business ID", a == null ? void 0 : a._id],
|
|
107
|
+
["Menu version", a == null ? void 0 : a.menuVersion],
|
|
108
108
|
[
|
|
109
109
|
"Purchase/Transfer",
|
|
110
110
|
typeof l.purchaseOrder.supplier.internal == "string" ? R.TRANSFER : R.PURCHASE
|
|
@@ -125,7 +125,7 @@ function We(e) {
|
|
|
125
125
|
[],
|
|
126
126
|
h.map((r) => r.name),
|
|
127
127
|
...d.map((r) => h.map((x) => r[x.id]))
|
|
128
|
-
], m = h.map((r) => `system:${r.id}`), v =
|
|
128
|
+
], m = h.map((r) => `system:${r.id}`), v = U(y, m);
|
|
129
129
|
return { name: l.name, sheet: v };
|
|
130
130
|
}).reduce(
|
|
131
131
|
(l, d) => {
|
|
@@ -137,11 +137,11 @@ function We(e) {
|
|
|
137
137
|
sheets: {},
|
|
138
138
|
sheetOccurence: {}
|
|
139
139
|
}
|
|
140
|
-
)) == null ? void 0 : o.sheets, n = `${
|
|
141
|
-
return
|
|
140
|
+
)) == null ? void 0 : o.sheets, n = `${a == null ? void 0 : a.name} transfer templates (${Ae(/* @__PURE__ */ new Date())}).xlsx`, f = fe(s);
|
|
141
|
+
return ye(f, n), n;
|
|
142
142
|
}
|
|
143
|
-
function
|
|
144
|
-
const e =
|
|
143
|
+
function Ge() {
|
|
144
|
+
const e = ee(), t = re(), a = W(), c = q(), s = e.currentBusiness.value, n = Te({
|
|
145
145
|
sku: {
|
|
146
146
|
unit: {
|
|
147
147
|
_id: "",
|
|
@@ -172,12 +172,12 @@ function Ye() {
|
|
|
172
172
|
amount: 1,
|
|
173
173
|
precision: 0
|
|
174
174
|
}
|
|
175
|
-
}), f =
|
|
175
|
+
}), f = _e(), o = [
|
|
176
176
|
["Template ID (leave empty to create new)"],
|
|
177
177
|
["Template Name", "New template"],
|
|
178
|
-
["Business name",
|
|
179
|
-
["Business ID",
|
|
180
|
-
["Menu version",
|
|
178
|
+
["Business name", s == null ? void 0 : s.name],
|
|
179
|
+
["Business ID", s == null ? void 0 : s._id],
|
|
180
|
+
["Menu version", s == null ? void 0 : s.menuVersion],
|
|
181
181
|
["Purchase/Transfer", "Purchase"],
|
|
182
182
|
[
|
|
183
183
|
"Transfer from",
|
|
@@ -194,7 +194,7 @@ function Ye() {
|
|
|
194
194
|
[],
|
|
195
195
|
f.map((r) => r.name),
|
|
196
196
|
f.map((r) => n[r.id])
|
|
197
|
-
], l = f.map((r) => `system:${r.id}`), d =
|
|
197
|
+
], l = f.map((r) => `system:${r.id}`), d = U(o, l), h = U(
|
|
198
198
|
[
|
|
199
199
|
...t.businessSuppliers.map((r) => [
|
|
200
200
|
`${r.name} (${r._id})`,
|
|
@@ -206,36 +206,36 @@ function Ye() {
|
|
|
206
206
|
r.address.state,
|
|
207
207
|
r.address.country
|
|
208
208
|
]),
|
|
209
|
-
...
|
|
210
|
-
var x, _, u,
|
|
209
|
+
...a.locations.map((r) => {
|
|
210
|
+
var x, _, u, i, p, S;
|
|
211
211
|
return [
|
|
212
212
|
`${r.name} (${r.dbName})`,
|
|
213
213
|
"Transfer",
|
|
214
214
|
(x = r.doc.profile.address) == null ? void 0 : x.line1,
|
|
215
215
|
(_ = r.doc.profile.address) == null ? void 0 : _.line2,
|
|
216
216
|
(u = r.doc.profile.address) == null ? void 0 : u.city,
|
|
217
|
-
(
|
|
217
|
+
(i = r.doc.profile.address) == null ? void 0 : i.postcode,
|
|
218
218
|
(p = r.doc.profile.address) == null ? void 0 : p.state,
|
|
219
219
|
(S = r.doc.profile.address) == null ? void 0 : S.country
|
|
220
220
|
];
|
|
221
221
|
})
|
|
222
222
|
],
|
|
223
223
|
["Name", "Type", "Line 1", "Line 2", "City", "Postal", "State", "Country"]
|
|
224
|
-
), y =
|
|
225
|
-
|
|
226
|
-
var x, _, u,
|
|
224
|
+
), y = U(
|
|
225
|
+
a.locations.map((r) => {
|
|
226
|
+
var x, _, u, i, p, S;
|
|
227
227
|
return [
|
|
228
228
|
`${r.name} (${r.dbName})`,
|
|
229
229
|
(x = r.doc.profile.address) == null ? void 0 : x.line1,
|
|
230
230
|
(_ = r.doc.profile.address) == null ? void 0 : _.line2,
|
|
231
231
|
(u = r.doc.profile.address) == null ? void 0 : u.city,
|
|
232
|
-
(
|
|
232
|
+
(i = r.doc.profile.address) == null ? void 0 : i.postcode,
|
|
233
233
|
(p = r.doc.profile.address) == null ? void 0 : p.state,
|
|
234
234
|
(S = r.doc.profile.address) == null ? void 0 : S.country
|
|
235
235
|
];
|
|
236
236
|
}),
|
|
237
237
|
["Name", "Line 1", "Line 2", "City", "Postal", "State", "Country"]
|
|
238
|
-
), m =
|
|
238
|
+
), m = U(
|
|
239
239
|
c.skus.map((r) => [
|
|
240
240
|
r.code,
|
|
241
241
|
r.name,
|
|
@@ -243,31 +243,31 @@ function Ye() {
|
|
|
243
243
|
...r.unit.measurements.map((x) => x.abbrev)
|
|
244
244
|
]),
|
|
245
245
|
["Code", "Name", "Base unit", "Measurements"]
|
|
246
|
-
), v =
|
|
246
|
+
), v = fe({
|
|
247
247
|
Template: d,
|
|
248
248
|
Source: h,
|
|
249
249
|
Destination: y,
|
|
250
250
|
Ingredient: m
|
|
251
|
-
}), b = `${
|
|
252
|
-
return
|
|
251
|
+
}), b = `${s == null ? void 0 : s.name} transfer templates import.xlsx`;
|
|
252
|
+
return ye(v, b), b;
|
|
253
253
|
}
|
|
254
|
-
function
|
|
255
|
-
const
|
|
254
|
+
function Ye(e, t) {
|
|
255
|
+
const a = new Array(), c = /(.*) \(((supplier_|warehouse_|restaurant_).{24,})\)/, n = W().locationByDbName, o = re().supplierById, l = e.trim(), d = c.exec(l);
|
|
256
256
|
if (!d)
|
|
257
|
-
return
|
|
258
|
-
errors:
|
|
257
|
+
return a.push(`Transfer from location value of ${l} cannot be read.`), {
|
|
258
|
+
errors: a
|
|
259
259
|
};
|
|
260
260
|
const h = d[1], y = d[2];
|
|
261
261
|
let m;
|
|
262
262
|
if (y.startsWith("supplier"))
|
|
263
|
-
m = o[y], t !== R.PURCHASE &&
|
|
263
|
+
m = o[y], t !== R.PURCHASE && a.push(`Expected transfer type Purchase but found ${t} instead.`);
|
|
264
264
|
else {
|
|
265
265
|
const v = n[y];
|
|
266
266
|
if (!v)
|
|
267
|
-
return
|
|
268
|
-
errors:
|
|
267
|
+
return a.push(`Location (${h}) of id ${y} is not found.`), {
|
|
268
|
+
errors: a
|
|
269
269
|
};
|
|
270
|
-
h !== v.name &&
|
|
270
|
+
h !== v.name && a.push(
|
|
271
271
|
`Location id ${y} has non-matching name. Found ${h} but expected ${v.name}`
|
|
272
272
|
), m = {
|
|
273
273
|
_id: v.doc._id,
|
|
@@ -280,7 +280,7 @@ function Ge(e, t) {
|
|
|
280
280
|
postcode: "",
|
|
281
281
|
coordinates: [0, 0]
|
|
282
282
|
},
|
|
283
|
-
internal: y.split("_")[0] === "restaurant" ?
|
|
283
|
+
internal: y.split("_")[0] === "restaurant" ? ae.enum.restaurant : ae.enum.warehouse,
|
|
284
284
|
phoneNumber: v.doc.profile.phoneNo ?? "",
|
|
285
285
|
email: v.doc.profile.email ?? "",
|
|
286
286
|
_rev: "",
|
|
@@ -290,15 +290,15 @@ function Ge(e, t) {
|
|
|
290
290
|
}
|
|
291
291
|
return {
|
|
292
292
|
from: m,
|
|
293
|
-
errors:
|
|
293
|
+
errors: a
|
|
294
294
|
};
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function Ze(e) {
|
|
297
297
|
if (!e.length || `${e[0]}`.toLocaleLowerCase() === "all")
|
|
298
298
|
return [];
|
|
299
|
-
const t = /(.*) \(((warehouse_|restaurant_).{24,})\)/, c =
|
|
300
|
-
return e.map((
|
|
301
|
-
const n = new Array(), f =
|
|
299
|
+
const t = /(.*) \(((warehouse_|restaurant_).{24,})\)/, c = W().locationByDbName;
|
|
300
|
+
return e.map((s) => {
|
|
301
|
+
const n = new Array(), f = s.trim(), o = t.exec(f);
|
|
302
302
|
if (!o)
|
|
303
303
|
return n.push(`Enabled location value of ${f} cannot be read.`), {
|
|
304
304
|
errors: n
|
|
@@ -314,12 +314,12 @@ function Je(e) {
|
|
|
314
314
|
});
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
|
-
function
|
|
317
|
+
function Je(e) {
|
|
318
318
|
const [
|
|
319
319
|
t,
|
|
320
|
-
i,
|
|
321
|
-
c,
|
|
322
320
|
a,
|
|
321
|
+
c,
|
|
322
|
+
s,
|
|
323
323
|
n,
|
|
324
324
|
f,
|
|
325
325
|
o,
|
|
@@ -327,9 +327,9 @@ function Xe(e) {
|
|
|
327
327
|
d,
|
|
328
328
|
h,
|
|
329
329
|
y
|
|
330
|
-
] =
|
|
330
|
+
] = he(e);
|
|
331
331
|
return {
|
|
332
|
-
id: `${
|
|
332
|
+
id: `${a[1] ?? ""}`.trim(),
|
|
333
333
|
name: `${c[1] ?? ""}`.trim(),
|
|
334
334
|
type: `${o[1] ?? ""}`.trim().toLocaleLowerCase() === "transfer" ? R.TRANSFER : R.PURCHASE,
|
|
335
335
|
transferFrom: `${l[1] ?? ""}`.trim(),
|
|
@@ -338,12 +338,12 @@ function Xe(e) {
|
|
|
338
338
|
remark: `${y[1] ?? ""}`.trim()
|
|
339
339
|
};
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function Xe(e) {
|
|
342
342
|
const [
|
|
343
343
|
t,
|
|
344
|
-
i,
|
|
345
|
-
c,
|
|
346
344
|
a,
|
|
345
|
+
c,
|
|
346
|
+
s,
|
|
347
347
|
n,
|
|
348
348
|
f,
|
|
349
349
|
o,
|
|
@@ -354,10 +354,10 @@ function Ze(e) {
|
|
|
354
354
|
m,
|
|
355
355
|
v,
|
|
356
356
|
...b
|
|
357
|
-
] =
|
|
358
|
-
if (!t || !t.length || t.some((
|
|
357
|
+
] = he(e);
|
|
358
|
+
if (!t || !t.length || t.some((i) => i.length && !i.startsWith("system:")))
|
|
359
359
|
throw new Error("Missing meta header. Excel file does not come from the template.");
|
|
360
|
-
const r = t.map((
|
|
360
|
+
const r = t.map((i) => i.split(":")[1]), _ = [
|
|
361
361
|
"code",
|
|
362
362
|
"name",
|
|
363
363
|
"unit",
|
|
@@ -365,16 +365,16 @@ function Ze(e) {
|
|
|
365
365
|
"minimumQuantity",
|
|
366
366
|
"maximumQuantity",
|
|
367
367
|
"quantityStep"
|
|
368
|
-
].filter((
|
|
368
|
+
].filter((i) => !r.includes(i));
|
|
369
369
|
if (_.length)
|
|
370
370
|
throw new Error(
|
|
371
371
|
`Missing meta headers (${_.join()}). Excel file does not come from the template.`
|
|
372
372
|
);
|
|
373
|
-
return b.map((
|
|
373
|
+
return b.map((i, p) => {
|
|
374
374
|
const S = {};
|
|
375
375
|
for (const k in r) {
|
|
376
376
|
const g = r[k];
|
|
377
|
-
Object.assign(S, { [g]:
|
|
377
|
+
Object.assign(S, { [g]: i[k] });
|
|
378
378
|
}
|
|
379
379
|
return {
|
|
380
380
|
index: p,
|
|
@@ -382,14 +382,14 @@ function Ze(e) {
|
|
|
382
382
|
};
|
|
383
383
|
});
|
|
384
384
|
}
|
|
385
|
-
function et(e, t,
|
|
386
|
-
const c =
|
|
385
|
+
function et(e, t, a) {
|
|
386
|
+
const c = q(), s = J(), n = c.skuByCode[e.code], f = new Array();
|
|
387
387
|
if (!n)
|
|
388
388
|
return f.push(`Cannot find ingredient with code (${e.code}) ${e.name}.`), {
|
|
389
389
|
index: t,
|
|
390
390
|
errors: f
|
|
391
391
|
};
|
|
392
|
-
if (
|
|
392
|
+
if (a.filter((u) => u.data.code === e.code).length > 1)
|
|
393
393
|
return f.push(`Ingredient ${e.code} is defined twice.`), {
|
|
394
394
|
index: t,
|
|
395
395
|
errors: f
|
|
@@ -398,7 +398,7 @@ function et(e, t, i) {
|
|
|
398
398
|
if (o.abbrev !== e.unit && !l) {
|
|
399
399
|
const u = `Cannot find unit measurement of symbol ${e.unit || "[empty]"} for ingredient (${e.code}) ${e.name}.`;
|
|
400
400
|
f.push(u);
|
|
401
|
-
const
|
|
401
|
+
const i = {
|
|
402
402
|
sku: n,
|
|
403
403
|
code: e.overrideCode || n.code,
|
|
404
404
|
name: n.name,
|
|
@@ -408,34 +408,34 @@ function et(e, t, i) {
|
|
|
408
408
|
minimumQuantity: { amount: 0, precision: 0 },
|
|
409
409
|
maximumQuantity: { amount: 0, precision: 0 }
|
|
410
410
|
};
|
|
411
|
-
if (
|
|
412
|
-
const p =
|
|
413
|
-
p && (
|
|
411
|
+
if (s.isEnabled) {
|
|
412
|
+
const p = s.getItemPKTCode(n);
|
|
413
|
+
p && (i.code = p);
|
|
414
414
|
}
|
|
415
415
|
return {
|
|
416
416
|
index: t,
|
|
417
417
|
errors: f,
|
|
418
|
-
templateItem:
|
|
418
|
+
templateItem: i
|
|
419
419
|
};
|
|
420
420
|
}
|
|
421
|
-
const d =
|
|
421
|
+
const d = V(
|
|
422
422
|
e.quantityStep,
|
|
423
|
-
|
|
423
|
+
j(o, l)
|
|
424
424
|
);
|
|
425
425
|
(Number.isNaN(Number(e.quantityStep)) || Number(e.quantityStep) <= 0) && f.push("Amount step must be more than 0");
|
|
426
|
-
const h =
|
|
426
|
+
const h = Oe(d), y = V(
|
|
427
427
|
e.minimumQuantity,
|
|
428
|
-
|
|
428
|
+
j(o, l)
|
|
429
429
|
);
|
|
430
430
|
h(y);
|
|
431
|
-
const m =
|
|
431
|
+
const m = V(
|
|
432
432
|
e.maximumQuantity,
|
|
433
|
-
|
|
433
|
+
j(o, l)
|
|
434
434
|
);
|
|
435
435
|
h(m), +e.minimumQuantity > +e.maximumQuantity && f.push("Minimum amount must be less than or equal to maximum amount");
|
|
436
|
-
const v =
|
|
436
|
+
const v = De(+e.minimumQuantity, +e.maximumQuantity), b = V(
|
|
437
437
|
e.defaultQuantity,
|
|
438
|
-
|
|
438
|
+
j(o, l)
|
|
439
439
|
), r = h(b), x = v(`${e.defaultQuantity}`);
|
|
440
440
|
typeof r == "string" && f.push(`Default amount: ${r}`), typeof x == "string" && f.push(`Default amount: ${x}`);
|
|
441
441
|
const _ = {
|
|
@@ -456,17 +456,17 @@ function et(e, t, i) {
|
|
|
456
456
|
}
|
|
457
457
|
function tt(e) {
|
|
458
458
|
const t = e.SheetNames.filter(
|
|
459
|
-
(n) => !Object.values(
|
|
460
|
-
), c =
|
|
459
|
+
(n) => !Object.values(ne).map(String).includes(n)
|
|
460
|
+
), c = we().templates, s = Ne(c, "_id");
|
|
461
461
|
try {
|
|
462
462
|
return t.reduce(
|
|
463
463
|
(n, f) => {
|
|
464
|
-
var
|
|
465
|
-
const o = new Array(), l = e.Sheets[f], d =
|
|
464
|
+
var i;
|
|
465
|
+
const o = new Array(), l = e.Sheets[f], d = Je(l), h = Ye(d.transferFrom, d.type);
|
|
466
466
|
o.push(...h.errors);
|
|
467
|
-
const y = h.from, m =
|
|
467
|
+
const y = h.from, m = Ze(d.locations), v = m.filter((p) => p.location).map((p) => p.location);
|
|
468
468
|
o.push(...m.flatMap((p) => p.errors));
|
|
469
|
-
const b =
|
|
469
|
+
const b = Xe(l).filter((p) => p.data.code), r = b.map(
|
|
470
470
|
(p, S) => et(p.data, S, b)
|
|
471
471
|
);
|
|
472
472
|
o.push(
|
|
@@ -476,7 +476,7 @@ function tt(e) {
|
|
|
476
476
|
);
|
|
477
477
|
const x = r.filter((p) => p.templateItem).map((p) => p.templateItem);
|
|
478
478
|
if (d.id) {
|
|
479
|
-
const p =
|
|
479
|
+
const p = s[d.id];
|
|
480
480
|
if (!p) {
|
|
481
481
|
const k = {
|
|
482
482
|
_id: d.id,
|
|
@@ -501,7 +501,7 @@ function tt(e) {
|
|
|
501
501
|
locations: v.length ? v : null,
|
|
502
502
|
purchaseOrder: {
|
|
503
503
|
...p.purchaseOrder,
|
|
504
|
-
supplier: y ?? ((
|
|
504
|
+
supplier: y ?? ((i = p.purchaseOrder) == null ? void 0 : i.supplier),
|
|
505
505
|
ref: d.reference,
|
|
506
506
|
remark: d.remark,
|
|
507
507
|
items: x
|
|
@@ -518,7 +518,7 @@ function tt(e) {
|
|
|
518
518
|
name: d.name,
|
|
519
519
|
locations: v.length ? v : null,
|
|
520
520
|
purchaseOrder: {
|
|
521
|
-
supplier: y ??
|
|
521
|
+
supplier: y ?? $e(),
|
|
522
522
|
ref: d.reference,
|
|
523
523
|
remark: d.remark,
|
|
524
524
|
items: x
|
|
@@ -544,7 +544,7 @@ function tt(e) {
|
|
|
544
544
|
};
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
|
-
function
|
|
547
|
+
function $e() {
|
|
548
548
|
return {
|
|
549
549
|
_id: "",
|
|
550
550
|
name: "",
|
|
@@ -563,13 +563,13 @@ function rt() {
|
|
|
563
563
|
remark: void 0,
|
|
564
564
|
ref: void 0,
|
|
565
565
|
items: [],
|
|
566
|
-
supplier:
|
|
566
|
+
supplier: $e()
|
|
567
567
|
};
|
|
568
568
|
}
|
|
569
569
|
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 = {
|
|
570
570
|
key: 0,
|
|
571
571
|
class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
|
|
572
|
-
}, lt = { key: 0 },
|
|
572
|
+
}, lt = { key: 0 }, de = /* @__PURE__ */ be({
|
|
573
573
|
__name: "TransferTemplateImportItem",
|
|
574
574
|
props: {
|
|
575
575
|
type: {},
|
|
@@ -580,31 +580,31 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
580
580
|
errors: {}
|
|
581
581
|
},
|
|
582
582
|
setup(e) {
|
|
583
|
-
return (t,
|
|
583
|
+
return (t, a) => {
|
|
584
584
|
var n, f, o;
|
|
585
|
-
const c =
|
|
585
|
+
const c = L("FmIcon"), s = L("FmTooltip");
|
|
586
586
|
return T(), w("div", nt, [
|
|
587
|
-
|
|
587
|
+
a[0] || (a[0] = $("div", null, "•", -1)),
|
|
588
588
|
$("div", ot, [
|
|
589
589
|
$("div", at, [
|
|
590
590
|
$("div", {
|
|
591
|
-
class:
|
|
591
|
+
class: Q({
|
|
592
592
|
"text-fm-color-system-error-300": t.errors.length
|
|
593
593
|
})
|
|
594
594
|
}, [
|
|
595
595
|
qe(I(t.name) + " ", 1),
|
|
596
596
|
$("span", st, " (" + I(E(Fe)(`${t.transferType}`)) + ") ", 1),
|
|
597
|
-
t.type === "create" ? (T(), w("span", it, "(new)")) :
|
|
597
|
+
t.type === "create" ? (T(), w("span", it, "(new)")) : H("", !0)
|
|
598
598
|
], 2),
|
|
599
599
|
t.errors.length ? (T(), w("div", lt, [
|
|
600
|
-
|
|
601
|
-
content:
|
|
600
|
+
F(s, { "z-index": 50 }, {
|
|
601
|
+
content: Z(() => [
|
|
602
602
|
$("ol", null, [
|
|
603
|
-
(T(!0), w(
|
|
603
|
+
(T(!0), w(M, null, K(t.errors, (l, d) => (T(), w("li", { key: d }, I(l), 1))), 128))
|
|
604
604
|
])
|
|
605
605
|
]),
|
|
606
|
-
default:
|
|
607
|
-
|
|
606
|
+
default: Z(() => [
|
|
607
|
+
F(c, {
|
|
608
608
|
name: "error",
|
|
609
609
|
size: "sm",
|
|
610
610
|
color: "system-error-300"
|
|
@@ -612,10 +612,10 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
612
612
|
]),
|
|
613
613
|
_: 1
|
|
614
614
|
})
|
|
615
|
-
])) :
|
|
615
|
+
])) : H("", !0)
|
|
616
616
|
]),
|
|
617
617
|
$("div", {
|
|
618
|
-
class:
|
|
618
|
+
class: Q([
|
|
619
619
|
"fm-typo-en-body-sm-400",
|
|
620
620
|
{
|
|
621
621
|
"text-fm-color-system-error-200": t.errors.length,
|
|
@@ -639,10 +639,10 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
639
639
|
}, yt = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, ht = {
|
|
640
640
|
key: 0,
|
|
641
641
|
class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
|
|
642
|
-
}, vt = { class: "fm-typo-en-body-lg-600" }, gt = /* @__PURE__ */
|
|
642
|
+
}, vt = { class: "fm-typo-en-body-lg-600" }, gt = /* @__PURE__ */ be({
|
|
643
643
|
__name: "TransferTemplateImport",
|
|
644
644
|
setup(e) {
|
|
645
|
-
const t = C(null),
|
|
645
|
+
const t = C(null), a = Qe(), c = ve(), s = C(!1), n = C(!1), f = re();
|
|
646
646
|
Ve(async () => {
|
|
647
647
|
n.value = !0;
|
|
648
648
|
try {
|
|
@@ -657,23 +657,23 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
657
657
|
n.value = !1;
|
|
658
658
|
}
|
|
659
659
|
});
|
|
660
|
-
const o = C(new Array()), l = C([]), d = C([]), h =
|
|
660
|
+
const o = C(new Array()), l = C([]), d = C([]), h = me(
|
|
661
661
|
() => !!o.value.length || l.value.some((b) => b.errors.length) || d.value.some((b) => b.errors.length)
|
|
662
|
-
), y =
|
|
662
|
+
), y = me(
|
|
663
663
|
() => !!l.value.length || !!d.value.length
|
|
664
|
-
), { t: m } =
|
|
664
|
+
), { t: m } = te();
|
|
665
665
|
async function v(b) {
|
|
666
666
|
o.value = [], l.value = [], d.value = [];
|
|
667
667
|
try {
|
|
668
|
-
|
|
668
|
+
s.value = !0;
|
|
669
669
|
const [r] = await Promise.all([
|
|
670
670
|
Ue(b),
|
|
671
671
|
// fake buffer
|
|
672
|
-
new Promise((
|
|
672
|
+
new Promise((i) => setTimeout(i, 1e3))
|
|
673
673
|
]);
|
|
674
674
|
if (!r.SheetNames.filter(
|
|
675
|
-
(
|
|
676
|
-
).find((
|
|
675
|
+
(i) => !Object.values(ne).map(String).includes(i)
|
|
676
|
+
).find((i) => i)) {
|
|
677
677
|
o.value.push(m("inventory.ingredient.import.fileError.noSheet"));
|
|
678
678
|
return;
|
|
679
679
|
}
|
|
@@ -688,7 +688,7 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
688
688
|
o.value.push(m("inventory.ingredient.import.fileError.noData"));
|
|
689
689
|
return;
|
|
690
690
|
}
|
|
691
|
-
|
|
691
|
+
a.emitData(u);
|
|
692
692
|
} catch (r) {
|
|
693
693
|
c.open({
|
|
694
694
|
title: m("inventory.ingredient.import.fileError.unableToRead"),
|
|
@@ -699,91 +699,91 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
699
699
|
o.value.length && c.open({
|
|
700
700
|
title: m("inventory.ingredient.import.fileError.invalidExcel"),
|
|
701
701
|
type: "error"
|
|
702
|
-
}),
|
|
702
|
+
}), s.value = !1;
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
705
|
return je(t, (b) => {
|
|
706
706
|
b && v(b);
|
|
707
707
|
}), (b, r) => {
|
|
708
|
-
const x =
|
|
708
|
+
const x = L("FmCircularProgress"), _ = L("FmIcon"), u = L("FmButton");
|
|
709
709
|
return T(), w("div", ct, [
|
|
710
710
|
r[2] || (r[2] = $("div", { class: "fm-typo-en-body-md-400" }, "Import transfer templates from excel sheets.", -1)),
|
|
711
711
|
n.value ? (T(), w("div", mt, [
|
|
712
712
|
$("div", null, [
|
|
713
|
-
|
|
713
|
+
F(x, {
|
|
714
714
|
size: "md",
|
|
715
715
|
color: "neutral-gray-200"
|
|
716
716
|
})
|
|
717
717
|
]),
|
|
718
718
|
r[1] || (r[1] = $("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "Loading...", -1))
|
|
719
|
-
])) : (T(), w(
|
|
720
|
-
|
|
721
|
-
class:
|
|
719
|
+
])) : (T(), w(M, { key: 1 }, [
|
|
720
|
+
F(Pe, {
|
|
721
|
+
class: Q({
|
|
722
722
|
"w-full": !0,
|
|
723
723
|
"h-[200px]": !t.value
|
|
724
724
|
}),
|
|
725
725
|
accept: ".xlsx",
|
|
726
|
-
onFileUpload: r[0] || (r[0] = (
|
|
726
|
+
onFileUpload: r[0] || (r[0] = (i) => t.value = i),
|
|
727
727
|
label: E(m)("inventory.ingredient.import.uploadTemplate"),
|
|
728
728
|
"button-label": E(m)("inventory.ingredient.import.selectFile")
|
|
729
729
|
}, ze({ _: 2 }, [
|
|
730
730
|
t.value ? {
|
|
731
731
|
name: "default",
|
|
732
|
-
fn:
|
|
732
|
+
fn: Z(({ openFileDialog: i }) => [
|
|
733
733
|
$("div", ut, [
|
|
734
734
|
$("div", {
|
|
735
|
-
class:
|
|
735
|
+
class: Q([
|
|
736
736
|
"fm-corner-radius-md p-16 flex items-center gap-16",
|
|
737
737
|
{
|
|
738
|
-
"border border-fm-color-neutral-gray-100":
|
|
739
|
-
"border border-fm-color-neutral-gray-200": !
|
|
738
|
+
"border border-fm-color-neutral-gray-100": s.value,
|
|
739
|
+
"border border-fm-color-neutral-gray-200": !s.value && !h.value,
|
|
740
740
|
"border border-fm-color-system-error-200": h.value
|
|
741
741
|
}
|
|
742
742
|
])
|
|
743
743
|
}, [
|
|
744
|
-
|
|
744
|
+
s.value ? (T(), z(x, {
|
|
745
745
|
key: 0,
|
|
746
746
|
size: "md",
|
|
747
747
|
color: "neutral-gray-200"
|
|
748
|
-
})) : (T(),
|
|
748
|
+
})) : (T(), z(_, {
|
|
749
749
|
key: 1,
|
|
750
750
|
name: h.value ? "error" : "attach_file",
|
|
751
751
|
outline: "",
|
|
752
752
|
color: h.value ? "system-error-300" : void 0
|
|
753
753
|
}, null, 8, ["name", "color"])),
|
|
754
754
|
$("div", {
|
|
755
|
-
class:
|
|
755
|
+
class: Q([
|
|
756
756
|
"fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center",
|
|
757
757
|
{
|
|
758
|
-
"text-fm-color-typo-disabled":
|
|
759
|
-
"text-fm-color-typo-primary": !
|
|
758
|
+
"text-fm-color-typo-disabled": s.value,
|
|
759
|
+
"text-fm-color-typo-primary": !s.value
|
|
760
760
|
}
|
|
761
761
|
])
|
|
762
762
|
}, [
|
|
763
763
|
$("div", dt, I(t.value.name), 1)
|
|
764
764
|
], 2),
|
|
765
|
-
|
|
766
|
-
|
|
765
|
+
s.value ? H("", !0) : (T(), w("div", pt, [
|
|
766
|
+
F(u, {
|
|
767
767
|
label: E(m)("inventory.ingredient.import.replaceFile"),
|
|
768
768
|
variant: h.value ? "destructive" : "secondary",
|
|
769
769
|
"prepend-icon": h.value ? void 0 : "autorenew",
|
|
770
|
-
onClick:
|
|
770
|
+
onClick: i
|
|
771
771
|
}, null, 8, ["label", "variant", "prepend-icon", "onClick"])
|
|
772
772
|
]))
|
|
773
773
|
], 2),
|
|
774
774
|
o.value.length ? (T(), w("div", ft, [
|
|
775
|
-
(T(!0), w(
|
|
775
|
+
(T(!0), w(M, null, K(o.value, (p, S) => (T(), w("div", {
|
|
776
776
|
key: S,
|
|
777
777
|
class: "flex gap-8 items-center"
|
|
778
778
|
}, [
|
|
779
|
-
|
|
779
|
+
F(_, {
|
|
780
780
|
name: "error",
|
|
781
781
|
size: "sm",
|
|
782
782
|
color: "system-error-300"
|
|
783
783
|
}),
|
|
784
784
|
$("div", yt, I(p), 1)
|
|
785
785
|
]))), 128))
|
|
786
|
-
])) :
|
|
786
|
+
])) : H("", !0)
|
|
787
787
|
])
|
|
788
788
|
]),
|
|
789
789
|
key: "0"
|
|
@@ -791,25 +791,25 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
791
791
|
]), 1032, ["class", "label", "button-label"]),
|
|
792
792
|
y.value ? (T(), w("div", ht, [
|
|
793
793
|
$("div", vt, I(E(m)("inventory.ingredient.import.summary")), 1),
|
|
794
|
-
(T(!0), w(
|
|
794
|
+
(T(!0), w(M, null, K(l.value, (i, p) => (T(), z(de, {
|
|
795
795
|
key: p,
|
|
796
|
-
name:
|
|
797
|
-
"transfer-type": typeof
|
|
798
|
-
locations:
|
|
799
|
-
items:
|
|
800
|
-
errors:
|
|
796
|
+
name: i.template.name,
|
|
797
|
+
"transfer-type": typeof i.template.purchaseOrder.supplier.internal == "string" ? E(R).TRANSFER : E(R).PURCHASE,
|
|
798
|
+
locations: i.template.locations,
|
|
799
|
+
items: i.template.purchaseOrder.items,
|
|
800
|
+
errors: i.errors,
|
|
801
801
|
type: "create"
|
|
802
802
|
}, null, 8, ["name", "transfer-type", "locations", "items", "errors"]))), 128)),
|
|
803
|
-
(T(!0), w(
|
|
804
|
-
key:
|
|
805
|
-
name:
|
|
806
|
-
"transfer-type": typeof
|
|
807
|
-
locations:
|
|
808
|
-
items:
|
|
809
|
-
errors:
|
|
803
|
+
(T(!0), w(M, null, K(d.value, (i) => (T(), z(de, {
|
|
804
|
+
key: i.template._id,
|
|
805
|
+
name: i.template.name,
|
|
806
|
+
"transfer-type": typeof i.template.purchaseOrder.supplier.internal == "string" ? E(R).TRANSFER : E(R).PURCHASE,
|
|
807
|
+
locations: i.template.locations,
|
|
808
|
+
items: i.template.purchaseOrder.items,
|
|
809
|
+
errors: i.errors,
|
|
810
810
|
type: "update"
|
|
811
811
|
}, null, 8, ["name", "transfer-type", "locations", "items", "errors"]))), 128))
|
|
812
|
-
])) :
|
|
812
|
+
])) : H("", !0)
|
|
813
813
|
], 64))
|
|
814
814
|
]);
|
|
815
815
|
};
|
|
@@ -823,14 +823,14 @@ function bt(e) {
|
|
|
823
823
|
const o = t.getNetSuiteVendor(e._id), l = o == null ? void 0 : o.subsidiaryId, d = (n = t.currentVendorSubsidiary(e._id)) == null ? void 0 : n.id;
|
|
824
824
|
return l && l == d;
|
|
825
825
|
}
|
|
826
|
-
const
|
|
827
|
-
return c && c ==
|
|
826
|
+
const a = t.getNetSuiteLocation(`${e.internal}_${e._id}`), c = t.getLocationSubsidiary(a == null ? void 0 : a.netSuiteId).id, s = (f = t.currentLocationSubsidiary()) == null ? void 0 : f.id;
|
|
827
|
+
return c && c == s;
|
|
828
828
|
}
|
|
829
|
-
const St =
|
|
830
|
-
const e = He(), t =
|
|
829
|
+
const St = ge("transferTemplateActions", () => {
|
|
830
|
+
const e = He(), t = ve(), a = W(), c = we(), s = Se(), n = J(), f = Ke(), { t: o } = te(), l = C({});
|
|
831
831
|
function d() {
|
|
832
832
|
l.value = {
|
|
833
|
-
mode:
|
|
833
|
+
mode: se.CREATE,
|
|
834
834
|
show: !0,
|
|
835
835
|
"onUpdate:show"(u) {
|
|
836
836
|
l.value.show = u;
|
|
@@ -839,26 +839,26 @@ const St = ve("transferTemplateActions", () => {
|
|
|
839
839
|
}
|
|
840
840
|
function h(u) {
|
|
841
841
|
l.value = {
|
|
842
|
-
mode:
|
|
842
|
+
mode: se.UPDATE,
|
|
843
843
|
modelValue: u,
|
|
844
844
|
show: !0,
|
|
845
|
-
"onUpdate:show"(
|
|
846
|
-
l.value.show =
|
|
845
|
+
"onUpdate:show"(i) {
|
|
846
|
+
l.value.show = i;
|
|
847
847
|
}
|
|
848
848
|
};
|
|
849
849
|
}
|
|
850
|
-
function y(u,
|
|
850
|
+
function y(u, i, p) {
|
|
851
851
|
e.open({
|
|
852
852
|
title: `Confirm deleting template ${u.name}?`,
|
|
853
853
|
message: "Deleted template can no longer be retrieved",
|
|
854
854
|
primaryActions: {
|
|
855
855
|
text: "Delete",
|
|
856
|
-
variant:
|
|
856
|
+
variant: le.Destructive,
|
|
857
857
|
close: !0
|
|
858
858
|
},
|
|
859
859
|
secondaryActions: {
|
|
860
860
|
text: "Cancel",
|
|
861
|
-
variant:
|
|
861
|
+
variant: le.Plain,
|
|
862
862
|
close: !0
|
|
863
863
|
}
|
|
864
864
|
}).onPrimary(async () => {
|
|
@@ -867,9 +867,9 @@ const St = ve("transferTemplateActions", () => {
|
|
|
867
867
|
type: "info"
|
|
868
868
|
});
|
|
869
869
|
try {
|
|
870
|
-
|
|
870
|
+
i.value = !0;
|
|
871
871
|
const [S] = await Promise.allSettled([
|
|
872
|
-
|
|
872
|
+
s.deleteTemplate(u),
|
|
873
873
|
new Promise((k) => setTimeout(k, 1e3))
|
|
874
874
|
]);
|
|
875
875
|
if (S.status === "rejected") throw S.reason;
|
|
@@ -884,7 +884,7 @@ const St = ve("transferTemplateActions", () => {
|
|
|
884
884
|
type: "error"
|
|
885
885
|
}), console.error("error on deleting purchase order template", S);
|
|
886
886
|
} finally {
|
|
887
|
-
|
|
887
|
+
i.value = !1, p();
|
|
888
888
|
}
|
|
889
889
|
});
|
|
890
890
|
}
|
|
@@ -893,8 +893,8 @@ const St = ve("transferTemplateActions", () => {
|
|
|
893
893
|
m.value = {
|
|
894
894
|
template: u,
|
|
895
895
|
show: !0,
|
|
896
|
-
"onUpdate:show"(
|
|
897
|
-
m.value.show =
|
|
896
|
+
"onUpdate:show"(i) {
|
|
897
|
+
m.value.show = i;
|
|
898
898
|
},
|
|
899
899
|
"onAction:edit"() {
|
|
900
900
|
m.value.show = !1, h(X(u));
|
|
@@ -902,14 +902,18 @@ const St = ve("transferTemplateActions", () => {
|
|
|
902
902
|
};
|
|
903
903
|
}
|
|
904
904
|
function b() {
|
|
905
|
-
const { promise: u, resolve:
|
|
906
|
-
|
|
907
|
-
}, S = c.templates.filter(
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
905
|
+
const { promise: u, resolve: i } = Promise.withResolvers(), p = (g) => {
|
|
906
|
+
i(g);
|
|
907
|
+
}, S = c.templates.filter((g) => {
|
|
908
|
+
var A, N, O;
|
|
909
|
+
if (((A = g.purchaseOrder.supplier) == null ? void 0 : A._id) === a.currentLocation.doc._id) return !1;
|
|
910
|
+
if (!((N = g.locations) != null && N.length)) return !0;
|
|
911
|
+
if (g.locationTags) {
|
|
912
|
+
const P = (O = a.currentLocation.doc.customAttributes) == null ? void 0 : O.tag;
|
|
913
|
+
if (g.locationTags.includes(P)) return !0;
|
|
911
914
|
}
|
|
912
|
-
|
|
915
|
+
return g.locations.find((P) => P.doc._id === a.currentLocation.doc._id);
|
|
916
|
+
});
|
|
913
917
|
if (!S.length)
|
|
914
918
|
return e.open({
|
|
915
919
|
title: "Select one template",
|
|
@@ -923,14 +927,14 @@ const St = ve("transferTemplateActions", () => {
|
|
|
923
927
|
close: !0
|
|
924
928
|
}
|
|
925
929
|
}).onPrimary(() => {
|
|
926
|
-
f.push({ name:
|
|
930
|
+
f.push({ name: ie.TRANSFER_TEMPLATE }), p(void 0);
|
|
927
931
|
}).onSecondary(() => p(void 0)).onClose(() => p(void 0)), u;
|
|
928
932
|
const k = S.map((g) => {
|
|
929
|
-
var
|
|
930
|
-
const A = !g.purchaseOrder.items.length || g.purchaseOrder.items.some(
|
|
933
|
+
var oe;
|
|
934
|
+
const A = !g.purchaseOrder.items.length || g.purchaseOrder.items.some(xe), N = !bt(g.purchaseOrder.supplier), O = g.purchaseOrder.supplier.internal ? n.getNetSuiteLocation(
|
|
931
935
|
`${g.purchaseOrder.supplier.internal}_${g.purchaseOrder.supplier._id}`
|
|
932
|
-
) : n.getNetSuiteVendor(g.purchaseOrder.supplier._id),
|
|
933
|
-
location is ${(
|
|
936
|
+
) : n.getNetSuiteVendor(g.purchaseOrder.supplier._id), P = N ? `The subsidiary of the request
|
|
937
|
+
location is ${(oe = n.getLocationSubsidiary(O == null ? void 0 : O.netSuiteId)) == null ? void 0 : oe.fullName}.` : void 0, ke = A || N, Ce = A ? "This template is invalid. Update this template." : N ? P : void 0, Re = `${g.purchaseOrder.supplier.internal ? "Transfer" : "Purchase"} from ${g.purchaseOrder.supplier.name}`;
|
|
934
938
|
return {
|
|
935
939
|
label: g.name,
|
|
936
940
|
value: g._id,
|
|
@@ -958,7 +962,7 @@ const St = ve("transferTemplateActions", () => {
|
|
|
958
962
|
close: !0
|
|
959
963
|
}
|
|
960
964
|
}).onPrimary((g) => Array.isArray(g) ? p(g[0]) : null).onSecondary(() => p(void 0)).onTertiary(() => {
|
|
961
|
-
f.push({ name:
|
|
965
|
+
f.push({ name: ie.TRANSFER_TEMPLATE }), p(void 0);
|
|
962
966
|
}).onClose(() => p(void 0)), u;
|
|
963
967
|
}
|
|
964
968
|
function r() {
|
|
@@ -996,7 +1000,7 @@ const St = ve("transferTemplateActions", () => {
|
|
|
996
1000
|
});
|
|
997
1001
|
return;
|
|
998
1002
|
}
|
|
999
|
-
if (u.importCreateResult.some((
|
|
1003
|
+
if (u.importCreateResult.some((i) => i.errors.length) || u.importUpdateResult.some((i) => i.errors.length)) {
|
|
1000
1004
|
t.open({
|
|
1001
1005
|
title: o("inventory.ingredient.import.error.invalidContent"),
|
|
1002
1006
|
message: o("inventory.ingredient.import.error.hasErrors"),
|
|
@@ -1005,11 +1009,11 @@ const St = ve("transferTemplateActions", () => {
|
|
|
1005
1009
|
return;
|
|
1006
1010
|
}
|
|
1007
1011
|
e.close(), x(u);
|
|
1008
|
-
}).onTertiary(
|
|
1012
|
+
}).onTertiary(Ge);
|
|
1009
1013
|
}
|
|
1010
1014
|
async function x(u) {
|
|
1011
1015
|
try {
|
|
1012
|
-
const
|
|
1016
|
+
const i = [
|
|
1013
1017
|
...u.importCreateResult.map(
|
|
1014
1018
|
(g) => g.template
|
|
1015
1019
|
),
|
|
@@ -1021,23 +1025,23 @@ const St = ve("transferTemplateActions", () => {
|
|
|
1021
1025
|
const k = () => {
|
|
1022
1026
|
S += p, t.open({
|
|
1023
1027
|
title: o("inventory.ingredient.import.progress", [
|
|
1024
|
-
Math.min(S,
|
|
1025
|
-
|
|
1028
|
+
Math.min(S, i.length),
|
|
1029
|
+
i.length
|
|
1026
1030
|
])
|
|
1027
1031
|
});
|
|
1028
1032
|
};
|
|
1029
|
-
for (const g of
|
|
1030
|
-
k(), await
|
|
1033
|
+
for (const g of i.chunk(100))
|
|
1034
|
+
k(), await s.importTemplates(g);
|
|
1031
1035
|
t.open({
|
|
1032
1036
|
title: o("inventory.ingredient.import.success"),
|
|
1033
1037
|
type: "success"
|
|
1034
1038
|
});
|
|
1035
|
-
} catch (
|
|
1039
|
+
} catch (i) {
|
|
1036
1040
|
t.open({
|
|
1037
1041
|
title: o("inventory.ingredient.import.error.failed"),
|
|
1038
|
-
message: o("inventory.ingredient.import.error.systemMessage", [
|
|
1042
|
+
message: o("inventory.ingredient.import.error.systemMessage", [i == null ? void 0 : i.message]),
|
|
1039
1043
|
type: "error"
|
|
1040
|
-
}), console.error("Error in importing skus", u,
|
|
1044
|
+
}), console.error("Error in importing skus", u, i);
|
|
1041
1045
|
} finally {
|
|
1042
1046
|
c.fetchTemplates();
|
|
1043
1047
|
}
|
|
@@ -1062,22 +1066,22 @@ const St = ve("transferTemplateActions", () => {
|
|
|
1062
1066
|
templateDetailsProps: m
|
|
1063
1067
|
};
|
|
1064
1068
|
});
|
|
1065
|
-
function
|
|
1066
|
-
const { skuById: t } =
|
|
1067
|
-
return
|
|
1069
|
+
function pe(e) {
|
|
1070
|
+
const { skuById: t } = q(), a = X(e);
|
|
1071
|
+
return a.purchaseOrder.items = e.purchaseOrder.items.filter((c) => t[c.sku._id]), a;
|
|
1068
1072
|
}
|
|
1069
|
-
const
|
|
1073
|
+
const we = ge(
|
|
1070
1074
|
"transferTemplateTable",
|
|
1071
1075
|
function() {
|
|
1072
|
-
const { t } =
|
|
1076
|
+
const { t } = te(), a = St(), c = C(!1), s = C(new Array()), n = Se(), f = q();
|
|
1073
1077
|
async function o() {
|
|
1074
|
-
|
|
1078
|
+
s.value = [], c.value = !0;
|
|
1075
1079
|
try {
|
|
1076
1080
|
const [y] = await Promise.all([
|
|
1077
1081
|
n.readTemplates(),
|
|
1078
1082
|
f.readInventory()
|
|
1079
1083
|
]).delayed(1e3);
|
|
1080
|
-
|
|
1084
|
+
s.value = y.map(pe);
|
|
1081
1085
|
} catch (y) {
|
|
1082
1086
|
console.log("Something went wrong when fetching templates:", y);
|
|
1083
1087
|
} finally {
|
|
@@ -1085,11 +1089,11 @@ const $e = ve(
|
|
|
1085
1089
|
}
|
|
1086
1090
|
}
|
|
1087
1091
|
async function l(y) {
|
|
1088
|
-
if (!
|
|
1092
|
+
if (!s.value.find((m) => m._id)) {
|
|
1089
1093
|
c.value = !0;
|
|
1090
1094
|
try {
|
|
1091
|
-
|
|
1092
|
-
await n.getTemplate(y).then(
|
|
1095
|
+
s.value = [
|
|
1096
|
+
await n.getTemplate(y).then(pe).delayed(1e3)
|
|
1093
1097
|
];
|
|
1094
1098
|
} catch (m) {
|
|
1095
1099
|
console.log("Something went wrong when fetching templates:", m);
|
|
@@ -1100,12 +1104,12 @@ const $e = ve(
|
|
|
1100
1104
|
}
|
|
1101
1105
|
function d(y, m) {
|
|
1102
1106
|
switch (m = X(m), y) {
|
|
1103
|
-
case
|
|
1104
|
-
return
|
|
1105
|
-
case
|
|
1106
|
-
return
|
|
1107
|
-
case
|
|
1108
|
-
return
|
|
1107
|
+
case D.Details:
|
|
1108
|
+
return a.viewTemplate(m);
|
|
1109
|
+
case D.Edit:
|
|
1110
|
+
return a.updateTemplate(m);
|
|
1111
|
+
case D.Delete:
|
|
1112
|
+
return a.deleteTemplate(m, c, o);
|
|
1109
1113
|
}
|
|
1110
1114
|
}
|
|
1111
1115
|
return {
|
|
@@ -1136,17 +1140,17 @@ const $e = ve(
|
|
|
1136
1140
|
textAlign: "right"
|
|
1137
1141
|
},
|
|
1138
1142
|
cell(y) {
|
|
1139
|
-
const m = Number(y.getValue()) || 0, v = y.row.original.purchaseOrder.items.some(
|
|
1143
|
+
const m = Number(y.getValue()) || 0, v = y.row.original.purchaseOrder.items.some(xe);
|
|
1140
1144
|
return m === 0 || v ? Y("div", { class: "flex justify-end gap-4 items-center" }, [
|
|
1141
1145
|
Y(
|
|
1142
|
-
|
|
1146
|
+
ce.FmTooltip,
|
|
1143
1147
|
{},
|
|
1144
1148
|
{
|
|
1145
1149
|
content() {
|
|
1146
1150
|
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.";
|
|
1147
1151
|
},
|
|
1148
1152
|
default() {
|
|
1149
|
-
return Y(
|
|
1153
|
+
return Y(ce.FmIcon, {
|
|
1150
1154
|
name: "error",
|
|
1151
1155
|
color: "system-error-300",
|
|
1152
1156
|
size: "sm"
|
|
@@ -1184,9 +1188,9 @@ const $e = ve(
|
|
|
1184
1188
|
id: "action",
|
|
1185
1189
|
cell(y) {
|
|
1186
1190
|
const m = y.row.original, v = [
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1191
|
+
G[D.Details],
|
|
1192
|
+
G[D.Edit],
|
|
1193
|
+
G[D.Delete]
|
|
1190
1194
|
];
|
|
1191
1195
|
return Le(v, (b) => d(b, m));
|
|
1192
1196
|
},
|
|
@@ -1198,22 +1202,22 @@ const $e = ve(
|
|
|
1198
1202
|
}
|
|
1199
1203
|
}
|
|
1200
1204
|
],
|
|
1201
|
-
templates:
|
|
1205
|
+
templates: s,
|
|
1202
1206
|
loading: c,
|
|
1203
1207
|
fetchTemplates: o,
|
|
1204
1208
|
loadTemplate: l
|
|
1205
1209
|
};
|
|
1206
1210
|
}
|
|
1207
1211
|
);
|
|
1208
|
-
function Et(e, t,
|
|
1209
|
-
const c = (
|
|
1210
|
-
return `${
|
|
1212
|
+
function Et(e, t, a) {
|
|
1213
|
+
const c = (a == null ? void 0 : a.abbrev) ?? t.abbrev;
|
|
1214
|
+
return `${B(e, !1)} ${c}`;
|
|
1211
1215
|
}
|
|
1212
1216
|
export {
|
|
1213
1217
|
R as P,
|
|
1214
|
-
|
|
1218
|
+
Se as a,
|
|
1215
1219
|
St as b,
|
|
1216
1220
|
Et as f,
|
|
1217
|
-
|
|
1218
|
-
|
|
1221
|
+
xe as t,
|
|
1222
|
+
we as u
|
|
1219
1223
|
};
|