@feedmepos/mf-inventory-portal 0.0.25-dev.2 → 0.0.25-dev.21
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-D6WBVERc.js +278 -0
- package/dist/ApprovalView-BIBoagE8.js +146 -0
- package/dist/{BindingsDialog-qeGh3ND8.js → BindingsDialog-DHRRkK1Z.js} +6 -6
- package/dist/{BindingsPicker-SfiA8fmD.js → BindingsPicker-DohvMDDF.js} +3 -3
- package/dist/{BindingsTable-BjW-eJr6.js → BindingsTable-C_JwU9ei.js} +6 -6
- package/dist/ClosingDraftView-BBebhUj-.js +1308 -0
- package/dist/ClosingTemplateView-CXRN19-D.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-BJufUQNE.js +215 -0
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-5rldKjyh.js → FmUnitInput.vue_vue_type_script_setup_true_lang-C5Xk19jY.js} +52 -52
- package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-7HNI82u-.js +51 -0
- package/dist/{IngredientGroupView-CGyyFyvj.js → IngredientGroupView-l2bAc1Kj.js} +1 -1
- package/dist/{IngredientsView-BLKk-VxQ.js → IngredientsView-zDXt7KEx.js} +394 -382
- package/dist/{IntegrationView-C6gwvZ9b.js → IntegrationView-BYnlAPrP.js} +660 -623
- package/dist/{InventoryBindingForm-BB3ZN3Lx.js → InventoryBindingForm-BuweG4Vl.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-PT7Quw7j.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DgxN0U4N.js} +99 -99
- package/dist/{InventoryBindingSummary-yr0oie3c.js → InventoryBindingSummary-BpEo0JsK.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DjJGUE9a.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CcjzkzCt.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-O1mYRa5W.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Ej20iSHA.js} +15 -15
- package/dist/PublishView-DCZ0zIaP.js +222 -0
- package/dist/{PurchaseOrderPrintPreview-Q_9-KVNj.js → PurchaseOrderPrintPreview-Cag7UEvz.js} +1 -1
- package/dist/ReceiveRequestView-ChIJGA98.js +2319 -0
- package/dist/{RecipeView-DBfugmRY.js → RecipeView-bBshe0eF.js} +32 -31
- package/dist/{index-CgspzSQi.js → StockView-D6-oKpAC.js} +3577 -1764
- package/dist/{SupplierView-BQViPyfj.js → SupplierView-dyIcGp9Q.js} +12 -11
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-C_7wbQow.js +1771 -0
- package/dist/TransferTemplateView-D2rxV0k_.js +1660 -0
- package/dist/{UnitView-CrbFeWaB.js → UnitView-DVS5Az5c.js} +14 -14
- package/dist/{WarehouseView-Dy5GljxY.js → WarehouseView-CR03TpnA.js} +332 -314
- package/dist/api/closing-draft.d.ts +1 -0
- package/dist/api/inventory.d.ts +9 -6
- package/dist/api/purchase-order.d.ts +2 -1
- package/dist/{app-D0O4wr2X.js → app-oV9ISfFL.js} +28343 -28141
- 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.d.ts +46 -0
- package/dist/components/FmMultiselectDialog.vue.d.ts +20 -3
- package/dist/components/FmMultiselectDialogProps.d.ts +2 -0
- package/dist/components/MountListener.vue.d.ts +15 -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-CPGmj9BT.js → decimal-C7zgfr5G.js} +1 -1
- package/dist/feature-CDQQ-mV9.js +1003 -0
- package/dist/{format-unit-display-CMM6DZJj.js → format-unit-display-CVBzrNQ4.js} +334 -327
- package/dist/helper/fuzzy.d.ts +10 -0
- package/dist/index-0VS4cuk3.js +35546 -0
- package/dist/{stock-9nTT4Amy.js → stock-BIP_NIK_.js} +3 -3
- package/dist/stores/feature.d.ts +4 -7
- package/dist/stores/integration/netsuite.d.ts +5 -0
- package/dist/stores/inventory.d.ts +135 -8
- package/dist/stores/location.d.ts +100 -0
- package/dist/stores/warehouse.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/{supplier-CH4EwBZM.js → supplier-DUQ2VSMg.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/use-ingredient-select-dialog-VkU5_Aaj.js +51 -0
- package/dist/{use-inventory-binding-dialog-Dli3xtq4.js → use-inventory-binding-dialog-BXp0z3v_.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-actions.d.ts +4 -1
- package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +48 -24
- package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +1 -1
- 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/netsuite/NetSuiteProps.d.ts +2 -0
- package/dist/views/receive-request/components/transfer-details/TransferDetails.vue.d.ts +1387 -0
- package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +5 -1
- package/dist/views/receive-request/components/transfer-dialog/TransferDialogProps.d.ts +3 -0
- package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +1 -2
- package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +48 -2
- package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +490 -2
- package/dist/views/receive-request/components/transfer-form/components/TransferSubItemTable.vue.d.ts +72 -0
- package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +25 -2
- package/dist/views/receive-request/components/transfer-form/helpers/calculate-sub-item-total.helper.d.ts +4 -0
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +693 -35
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +684 -35
- package/dist/views/receive-request/helper/po-to-po-template.util.d.ts +1 -0
- package/dist/views/receive-request/helper/print-po.d.ts +9 -2
- package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +2 -2
- package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItem.vue.d.ts +270 -2
- package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +286 -0
- package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateSubItem.vue.d.ts +74 -0
- package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateSubItemTable.vue.d.ts +92 -0
- 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 +36 -2
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +456 -12
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +456 -12
- package/dist/views/transfer-template/helpers/location-to-po-supplier.util.d.ts +75 -0
- package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +2 -0
- package/dist/{vue-i18n-BcYt8MNZ.js → vue-i18n-CCd5_SRR.js} +212 -212
- package/package.json +3 -3
- package/dist/App-oKNdl2la.js +0 -276
- package/dist/ApprovalView-hDGkcBDy.js +0 -138
- package/dist/ClosingDraftView-CEeeL7W4.js +0 -1225
- package/dist/ClosingTemplateView-CkS9e0MV.js +0 -1819
- package/dist/FmCustomAttribute.vue_vue_type_script_setup_true_lang-CIBSvY0s.js +0 -142
- package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Dg_7ELeT.js +0 -286
- package/dist/PublishView-ByXdmuJL.js +0 -192
- package/dist/ReceiveRequestView-CApg7LGM.js +0 -1876
- package/dist/StockView-D6o_oUlz.js +0 -1817
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-D2skLe2M.js +0 -1327
- package/dist/TransferTemplateView-DVesObTd.js +0 -1284
- package/dist/components/FmCustomAttribute2.vue.d.ts +0 -18
- package/dist/index-P5iEcRw3.js +0 -29202
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +0 -2628
|
@@ -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, ax 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 Y, h as D, f as Le } from "./app-oV9ISfFL.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 G } 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-DUQ2VSMg.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
40
|
function xe(e) {
|
|
41
|
-
const t =
|
|
42
|
-
if (c.unit._id !==
|
|
43
|
-
const
|
|
44
|
-
return
|
|
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
45
|
}
|
|
46
|
-
var
|
|
47
|
-
const
|
|
48
|
-
function
|
|
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,17 +97,17 @@ function Te() {
|
|
|
97
97
|
}
|
|
98
98
|
function We(e) {
|
|
99
99
|
var o;
|
|
100
|
-
const
|
|
101
|
-
var
|
|
102
|
-
const d = l.purchaseOrder.items.map((r) =>
|
|
100
|
+
const a = ee().currentBusiness.value, s = (o = e.map((l) => {
|
|
101
|
+
var b;
|
|
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
|
-
typeof l.purchaseOrder.supplier.internal == "string" ?
|
|
110
|
+
typeof l.purchaseOrder.supplier.internal == "string" ? R.TRANSFER : R.PURCHASE
|
|
111
111
|
],
|
|
112
112
|
[
|
|
113
113
|
"Transfer from",
|
|
@@ -116,13 +116,16 @@ function We(e) {
|
|
|
116
116
|
l.purchaseOrder.supplier._id
|
|
117
117
|
].filter((r) => r).join("_")})`
|
|
118
118
|
],
|
|
119
|
-
[
|
|
119
|
+
[
|
|
120
|
+
"Locations",
|
|
121
|
+
...(b = l.locations) != null && b.length ? l.locations.map((r) => `${r.name} (${r.dbName})`) : ["All"]
|
|
122
|
+
],
|
|
120
123
|
["Reference", l.purchaseOrder.ref ?? ""],
|
|
121
124
|
["Remark", l.purchaseOrder.remark ?? ""],
|
|
122
125
|
[],
|
|
123
126
|
h.map((r) => r.name),
|
|
124
|
-
...d.map((r) => h.map((
|
|
125
|
-
], m = h.map((r) => `system:${r.id}`), v =
|
|
127
|
+
...d.map((r) => h.map((x) => r[x.id]))
|
|
128
|
+
], m = h.map((r) => `system:${r.id}`), v = U(y, m);
|
|
126
129
|
return { name: l.name, sheet: v };
|
|
127
130
|
}).reduce(
|
|
128
131
|
(l, d) => {
|
|
@@ -134,11 +137,11 @@ function We(e) {
|
|
|
134
137
|
sheets: {},
|
|
135
138
|
sheetOccurence: {}
|
|
136
139
|
}
|
|
137
|
-
)) == null ? void 0 : o.sheets, n = `${
|
|
138
|
-
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;
|
|
139
142
|
}
|
|
140
143
|
function Ye() {
|
|
141
|
-
const e =
|
|
144
|
+
const e = ee(), t = re(), a = W(), c = q(), s = e.currentBusiness.value, n = Te({
|
|
142
145
|
sku: {
|
|
143
146
|
unit: {
|
|
144
147
|
_id: "",
|
|
@@ -169,12 +172,12 @@ function Ye() {
|
|
|
169
172
|
amount: 1,
|
|
170
173
|
precision: 0
|
|
171
174
|
}
|
|
172
|
-
}), f =
|
|
175
|
+
}), f = _e(), o = [
|
|
173
176
|
["Template ID (leave empty to create new)"],
|
|
174
177
|
["Template Name", "New template"],
|
|
175
|
-
["Business name",
|
|
176
|
-
["Business ID",
|
|
177
|
-
["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],
|
|
178
181
|
["Purchase/Transfer", "Purchase"],
|
|
179
182
|
[
|
|
180
183
|
"Transfer from",
|
|
@@ -191,7 +194,7 @@ function Ye() {
|
|
|
191
194
|
[],
|
|
192
195
|
f.map((r) => r.name),
|
|
193
196
|
f.map((r) => n[r.id])
|
|
194
|
-
], l = f.map((r) => `system:${r.id}`), d =
|
|
197
|
+
], l = f.map((r) => `system:${r.id}`), d = U(o, l), h = U(
|
|
195
198
|
[
|
|
196
199
|
...t.businessSuppliers.map((r) => [
|
|
197
200
|
`${r.name} (${r._id})`,
|
|
@@ -203,68 +206,68 @@ function Ye() {
|
|
|
203
206
|
r.address.state,
|
|
204
207
|
r.address.country
|
|
205
208
|
]),
|
|
206
|
-
...
|
|
207
|
-
var
|
|
209
|
+
...a.locations.map((r) => {
|
|
210
|
+
var x, _, u, i, p, S;
|
|
208
211
|
return [
|
|
209
212
|
`${r.name} (${r.dbName})`,
|
|
210
213
|
"Transfer",
|
|
211
|
-
(
|
|
214
|
+
(x = r.doc.profile.address) == null ? void 0 : x.line1,
|
|
212
215
|
(_ = r.doc.profile.address) == null ? void 0 : _.line2,
|
|
213
|
-
(
|
|
216
|
+
(u = r.doc.profile.address) == null ? void 0 : u.city,
|
|
214
217
|
(i = r.doc.profile.address) == null ? void 0 : i.postcode,
|
|
215
|
-
(
|
|
216
|
-
(
|
|
218
|
+
(p = r.doc.profile.address) == null ? void 0 : p.state,
|
|
219
|
+
(S = r.doc.profile.address) == null ? void 0 : S.country
|
|
217
220
|
];
|
|
218
221
|
})
|
|
219
222
|
],
|
|
220
223
|
["Name", "Type", "Line 1", "Line 2", "City", "Postal", "State", "Country"]
|
|
221
|
-
), y =
|
|
222
|
-
|
|
223
|
-
var
|
|
224
|
+
), y = U(
|
|
225
|
+
a.locations.map((r) => {
|
|
226
|
+
var x, _, u, i, p, S;
|
|
224
227
|
return [
|
|
225
228
|
`${r.name} (${r.dbName})`,
|
|
226
|
-
(
|
|
229
|
+
(x = r.doc.profile.address) == null ? void 0 : x.line1,
|
|
227
230
|
(_ = r.doc.profile.address) == null ? void 0 : _.line2,
|
|
228
|
-
(
|
|
231
|
+
(u = r.doc.profile.address) == null ? void 0 : u.city,
|
|
229
232
|
(i = r.doc.profile.address) == null ? void 0 : i.postcode,
|
|
230
|
-
(
|
|
231
|
-
(
|
|
233
|
+
(p = r.doc.profile.address) == null ? void 0 : p.state,
|
|
234
|
+
(S = r.doc.profile.address) == null ? void 0 : S.country
|
|
232
235
|
];
|
|
233
236
|
}),
|
|
234
237
|
["Name", "Line 1", "Line 2", "City", "Postal", "State", "Country"]
|
|
235
|
-
), m =
|
|
238
|
+
), m = U(
|
|
236
239
|
c.skus.map((r) => [
|
|
237
240
|
r.code,
|
|
238
241
|
r.name,
|
|
239
242
|
r.unit.abbrev,
|
|
240
|
-
...r.unit.measurements.map((
|
|
243
|
+
...r.unit.measurements.map((x) => x.abbrev)
|
|
241
244
|
]),
|
|
242
245
|
["Code", "Name", "Base unit", "Measurements"]
|
|
243
|
-
), v =
|
|
246
|
+
), v = fe({
|
|
244
247
|
Template: d,
|
|
245
248
|
Source: h,
|
|
246
249
|
Destination: y,
|
|
247
250
|
Ingredient: m
|
|
248
|
-
}),
|
|
249
|
-
return
|
|
251
|
+
}), b = `${s == null ? void 0 : s.name} transfer templates import.xlsx`;
|
|
252
|
+
return ye(v, b), b;
|
|
250
253
|
}
|
|
251
254
|
function Ge(e, t) {
|
|
252
|
-
const
|
|
255
|
+
const a = new Array(), c = /(.*) \(((supplier_|warehouse_|restaurant_).{24,})\)/, n = W().locationByDbName, o = re().supplierById, l = e.trim(), d = c.exec(l);
|
|
253
256
|
if (!d)
|
|
254
|
-
return
|
|
255
|
-
errors:
|
|
257
|
+
return a.push(`Transfer from location value of ${l} cannot be read.`), {
|
|
258
|
+
errors: a
|
|
256
259
|
};
|
|
257
260
|
const h = d[1], y = d[2];
|
|
258
261
|
let m;
|
|
259
262
|
if (y.startsWith("supplier"))
|
|
260
|
-
m = o[y], t !==
|
|
263
|
+
m = o[y], t !== R.PURCHASE && a.push(`Expected transfer type Purchase but found ${t} instead.`);
|
|
261
264
|
else {
|
|
262
265
|
const v = n[y];
|
|
263
266
|
if (!v)
|
|
264
|
-
return
|
|
265
|
-
errors:
|
|
267
|
+
return a.push(`Location (${h}) of id ${y} is not found.`), {
|
|
268
|
+
errors: a
|
|
266
269
|
};
|
|
267
|
-
h !== v.name &&
|
|
270
|
+
h !== v.name && a.push(
|
|
268
271
|
`Location id ${y} has non-matching name. Found ${h} but expected ${v.name}`
|
|
269
272
|
), m = {
|
|
270
273
|
_id: v.doc._id,
|
|
@@ -277,7 +280,7 @@ function Ge(e, t) {
|
|
|
277
280
|
postcode: "",
|
|
278
281
|
coordinates: [0, 0]
|
|
279
282
|
},
|
|
280
|
-
internal: y.split("_")[0] === "restaurant" ?
|
|
283
|
+
internal: y.split("_")[0] === "restaurant" ? ae.enum.restaurant : ae.enum.warehouse,
|
|
281
284
|
phoneNumber: v.doc.profile.phoneNo ?? "",
|
|
282
285
|
email: v.doc.profile.email ?? "",
|
|
283
286
|
_rev: "",
|
|
@@ -287,15 +290,15 @@ function Ge(e, t) {
|
|
|
287
290
|
}
|
|
288
291
|
return {
|
|
289
292
|
from: m,
|
|
290
|
-
errors:
|
|
293
|
+
errors: a
|
|
291
294
|
};
|
|
292
295
|
}
|
|
293
|
-
function
|
|
296
|
+
function Ze(e) {
|
|
294
297
|
if (!e.length || `${e[0]}`.toLocaleLowerCase() === "all")
|
|
295
298
|
return [];
|
|
296
|
-
const t = /(.*) \(((warehouse_|restaurant_).{24,})\)/, c =
|
|
297
|
-
return e.map((
|
|
298
|
-
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);
|
|
299
302
|
if (!o)
|
|
300
303
|
return n.push(`Enabled location value of ${f} cannot be read.`), {
|
|
301
304
|
errors: n
|
|
@@ -311,12 +314,12 @@ function Je(e) {
|
|
|
311
314
|
});
|
|
312
315
|
});
|
|
313
316
|
}
|
|
314
|
-
function
|
|
317
|
+
function Je(e) {
|
|
315
318
|
const [
|
|
316
319
|
t,
|
|
317
|
-
s,
|
|
318
|
-
c,
|
|
319
320
|
a,
|
|
321
|
+
c,
|
|
322
|
+
s,
|
|
320
323
|
n,
|
|
321
324
|
f,
|
|
322
325
|
o,
|
|
@@ -324,23 +327,23 @@ function Xe(e) {
|
|
|
324
327
|
d,
|
|
325
328
|
h,
|
|
326
329
|
y
|
|
327
|
-
] =
|
|
330
|
+
] = he(e);
|
|
328
331
|
return {
|
|
329
|
-
id: `${
|
|
332
|
+
id: `${a[1] ?? ""}`.trim(),
|
|
330
333
|
name: `${c[1] ?? ""}`.trim(),
|
|
331
|
-
type: `${o[1] ?? ""}`.trim().toLocaleLowerCase() === "transfer" ?
|
|
334
|
+
type: `${o[1] ?? ""}`.trim().toLocaleLowerCase() === "transfer" ? R.TRANSFER : R.PURCHASE,
|
|
332
335
|
transferFrom: `${l[1] ?? ""}`.trim(),
|
|
333
336
|
locations: d.slice(1).map((m) => `${m}`.trim()).filter((m) => m),
|
|
334
337
|
reference: `${h[1] ?? ""}`.trim(),
|
|
335
338
|
remark: `${y[1] ?? ""}`.trim()
|
|
336
339
|
};
|
|
337
340
|
}
|
|
338
|
-
function
|
|
341
|
+
function Xe(e) {
|
|
339
342
|
const [
|
|
340
343
|
t,
|
|
341
|
-
s,
|
|
342
|
-
c,
|
|
343
344
|
a,
|
|
345
|
+
c,
|
|
346
|
+
s,
|
|
344
347
|
n,
|
|
345
348
|
f,
|
|
346
349
|
o,
|
|
@@ -350,8 +353,8 @@ function Ze(e) {
|
|
|
350
353
|
y,
|
|
351
354
|
m,
|
|
352
355
|
v,
|
|
353
|
-
...
|
|
354
|
-
] =
|
|
356
|
+
...b
|
|
357
|
+
] = he(e);
|
|
355
358
|
if (!t || !t.length || t.some((i) => i.length && !i.startsWith("system:")))
|
|
356
359
|
throw new Error("Missing meta header. Excel file does not come from the template.");
|
|
357
360
|
const r = t.map((i) => i.split(":")[1]), _ = [
|
|
@@ -367,26 +370,26 @@ function Ze(e) {
|
|
|
367
370
|
throw new Error(
|
|
368
371
|
`Missing meta headers (${_.join()}). Excel file does not come from the template.`
|
|
369
372
|
);
|
|
370
|
-
return
|
|
371
|
-
const
|
|
372
|
-
for (const
|
|
373
|
-
const
|
|
374
|
-
Object.assign(
|
|
373
|
+
return b.map((i, p) => {
|
|
374
|
+
const S = {};
|
|
375
|
+
for (const k in r) {
|
|
376
|
+
const g = r[k];
|
|
377
|
+
Object.assign(S, { [g]: i[k] });
|
|
375
378
|
}
|
|
376
379
|
return {
|
|
377
|
-
index:
|
|
378
|
-
data:
|
|
380
|
+
index: p,
|
|
381
|
+
data: S
|
|
379
382
|
};
|
|
380
383
|
});
|
|
381
384
|
}
|
|
382
|
-
function et(e, t,
|
|
383
|
-
const c =
|
|
385
|
+
function et(e, t, a) {
|
|
386
|
+
const c = q(), s = J(), n = c.skuByCode[e.code], f = new Array();
|
|
384
387
|
if (!n)
|
|
385
388
|
return f.push(`Cannot find ingredient with code (${e.code}) ${e.name}.`), {
|
|
386
389
|
index: t,
|
|
387
390
|
errors: f
|
|
388
391
|
};
|
|
389
|
-
if (
|
|
392
|
+
if (a.filter((u) => u.data.code === e.code).length > 1)
|
|
390
393
|
return f.push(`Ingredient ${e.code} is defined twice.`), {
|
|
391
394
|
index: t,
|
|
392
395
|
errors: f
|
|
@@ -395,7 +398,7 @@ function et(e, t, s) {
|
|
|
395
398
|
if (o.abbrev !== e.unit && !l) {
|
|
396
399
|
const u = `Cannot find unit measurement of symbol ${e.unit || "[empty]"} for ingredient (${e.code}) ${e.name}.`;
|
|
397
400
|
f.push(u);
|
|
398
|
-
const
|
|
401
|
+
const i = {
|
|
399
402
|
sku: n,
|
|
400
403
|
code: e.overrideCode || n.code,
|
|
401
404
|
name: n.name,
|
|
@@ -405,77 +408,77 @@ function et(e, t, s) {
|
|
|
405
408
|
minimumQuantity: { amount: 0, precision: 0 },
|
|
406
409
|
maximumQuantity: { amount: 0, precision: 0 }
|
|
407
410
|
};
|
|
408
|
-
if (
|
|
409
|
-
const
|
|
410
|
-
|
|
411
|
+
if (s.isEnabled) {
|
|
412
|
+
const p = s.getItemPKTCode(n);
|
|
413
|
+
p && (i.code = p);
|
|
411
414
|
}
|
|
412
415
|
return {
|
|
413
416
|
index: t,
|
|
414
417
|
errors: f,
|
|
415
|
-
templateItem:
|
|
418
|
+
templateItem: i
|
|
416
419
|
};
|
|
417
420
|
}
|
|
418
|
-
const d =
|
|
421
|
+
const d = V(
|
|
419
422
|
e.quantityStep,
|
|
420
|
-
|
|
423
|
+
j(o, l)
|
|
421
424
|
);
|
|
422
425
|
(Number.isNaN(Number(e.quantityStep)) || Number(e.quantityStep) <= 0) && f.push("Amount step must be more than 0");
|
|
423
|
-
const h =
|
|
426
|
+
const h = Oe(d), y = V(
|
|
424
427
|
e.minimumQuantity,
|
|
425
|
-
|
|
426
|
-
)
|
|
427
|
-
|
|
428
|
-
const
|
|
428
|
+
j(o, l)
|
|
429
|
+
);
|
|
430
|
+
h(y);
|
|
431
|
+
const m = V(
|
|
429
432
|
e.maximumQuantity,
|
|
430
|
-
|
|
431
|
-
)
|
|
432
|
-
|
|
433
|
-
const
|
|
433
|
+
j(o, l)
|
|
434
|
+
);
|
|
435
|
+
h(m), +e.minimumQuantity > +e.maximumQuantity && f.push("Minimum amount must be less than or equal to maximum amount");
|
|
436
|
+
const v = De(+e.minimumQuantity, +e.maximumQuantity), b = V(
|
|
434
437
|
e.defaultQuantity,
|
|
435
|
-
|
|
436
|
-
),
|
|
437
|
-
typeof
|
|
438
|
-
const
|
|
438
|
+
j(o, l)
|
|
439
|
+
), r = h(b), x = v(`${e.defaultQuantity}`);
|
|
440
|
+
typeof r == "string" && f.push(`Default amount: ${r}`), typeof x == "string" && f.push(`Default amount: ${x}`);
|
|
441
|
+
const _ = {
|
|
439
442
|
sku: n,
|
|
440
443
|
code: e.overrideCode || n.code,
|
|
441
444
|
name: e.name || n.name,
|
|
442
445
|
measurement: l,
|
|
443
|
-
quantity:
|
|
446
|
+
quantity: b,
|
|
444
447
|
quantityStep: d,
|
|
445
448
|
minimumQuantity: y,
|
|
446
|
-
maximumQuantity:
|
|
449
|
+
maximumQuantity: m
|
|
447
450
|
};
|
|
448
451
|
return {
|
|
449
452
|
index: t,
|
|
450
453
|
errors: f,
|
|
451
|
-
templateItem:
|
|
454
|
+
templateItem: _
|
|
452
455
|
};
|
|
453
456
|
}
|
|
454
457
|
function tt(e) {
|
|
455
458
|
const t = e.SheetNames.filter(
|
|
456
|
-
(n) => !Object.values(
|
|
457
|
-
), c =
|
|
459
|
+
(n) => !Object.values(ne).map(String).includes(n)
|
|
460
|
+
), c = we().templates, s = Ne(c, "_id");
|
|
458
461
|
try {
|
|
459
462
|
return t.reduce(
|
|
460
463
|
(n, f) => {
|
|
461
464
|
var i;
|
|
462
|
-
const o = new Array(), l = e.Sheets[f], d =
|
|
465
|
+
const o = new Array(), l = e.Sheets[f], d = Je(l), h = Ge(d.transferFrom, d.type);
|
|
463
466
|
o.push(...h.errors);
|
|
464
|
-
const y = h.from, m =
|
|
465
|
-
o.push(...m.flatMap((
|
|
466
|
-
const
|
|
467
|
-
(
|
|
467
|
+
const y = h.from, m = Ze(d.locations), v = m.filter((p) => p.location).map((p) => p.location);
|
|
468
|
+
o.push(...m.flatMap((p) => p.errors));
|
|
469
|
+
const b = Xe(l).filter((p) => p.data.code), r = b.map(
|
|
470
|
+
(p, S) => et(p.data, S, b)
|
|
468
471
|
);
|
|
469
472
|
o.push(
|
|
470
473
|
...r.flatMap(
|
|
471
|
-
(
|
|
474
|
+
(p) => p.errors.map((S) => `(Excel row ${p.index + 14}) ${S}`)
|
|
472
475
|
)
|
|
473
476
|
);
|
|
474
|
-
const
|
|
477
|
+
const x = r.filter((p) => p.templateItem).map((p) => p.templateItem);
|
|
475
478
|
if (d.id) {
|
|
476
|
-
const
|
|
477
|
-
if (!
|
|
478
|
-
const
|
|
479
|
+
const p = s[d.id];
|
|
480
|
+
if (!p) {
|
|
481
|
+
const k = {
|
|
479
482
|
_id: d.id,
|
|
480
483
|
_rev: "",
|
|
481
484
|
name: d.name || `(unnamed from sheet ${f || "<unnamed sheet>"})`,
|
|
@@ -483,48 +486,48 @@ function tt(e) {
|
|
|
483
486
|
};
|
|
484
487
|
return o.push(`Template ID ${d.id} is not found.`), n.importUpdateResult.push({
|
|
485
488
|
type: "update",
|
|
486
|
-
original:
|
|
487
|
-
template:
|
|
489
|
+
original: k,
|
|
490
|
+
template: k,
|
|
488
491
|
excelSheetName: f,
|
|
489
492
|
errors: o
|
|
490
493
|
}), n;
|
|
491
494
|
}
|
|
492
|
-
const
|
|
495
|
+
const S = {
|
|
493
496
|
type: "update",
|
|
494
|
-
original:
|
|
497
|
+
original: p,
|
|
495
498
|
template: {
|
|
496
|
-
...
|
|
499
|
+
...p,
|
|
497
500
|
name: d.name,
|
|
498
501
|
locations: v.length ? v : null,
|
|
499
502
|
purchaseOrder: {
|
|
500
|
-
...
|
|
501
|
-
supplier: y ?? ((i =
|
|
503
|
+
...p.purchaseOrder,
|
|
504
|
+
supplier: y ?? ((i = p.purchaseOrder) == null ? void 0 : i.supplier),
|
|
502
505
|
ref: d.reference,
|
|
503
506
|
remark: d.remark,
|
|
504
|
-
items:
|
|
507
|
+
items: x
|
|
505
508
|
}
|
|
506
509
|
},
|
|
507
510
|
excelSheetName: f,
|
|
508
511
|
errors: o
|
|
509
512
|
};
|
|
510
|
-
return n.importUpdateResult.push(
|
|
513
|
+
return n.importUpdateResult.push(S), n;
|
|
511
514
|
}
|
|
512
|
-
const
|
|
515
|
+
const u = {
|
|
513
516
|
type: "create",
|
|
514
517
|
template: {
|
|
515
518
|
name: d.name,
|
|
516
|
-
locations: v,
|
|
519
|
+
locations: v.length ? v : null,
|
|
517
520
|
purchaseOrder: {
|
|
518
|
-
supplier: y ??
|
|
521
|
+
supplier: y ?? $e(),
|
|
519
522
|
ref: d.reference,
|
|
520
523
|
remark: d.remark,
|
|
521
|
-
items:
|
|
524
|
+
items: x
|
|
522
525
|
}
|
|
523
526
|
},
|
|
524
527
|
excelSheetName: f,
|
|
525
528
|
errors: o
|
|
526
529
|
};
|
|
527
|
-
return n.importCreateResult.push(
|
|
530
|
+
return n.importCreateResult.push(u), n;
|
|
528
531
|
},
|
|
529
532
|
{
|
|
530
533
|
invalidExcel: !1,
|
|
@@ -541,7 +544,7 @@ function tt(e) {
|
|
|
541
544
|
};
|
|
542
545
|
}
|
|
543
546
|
}
|
|
544
|
-
function
|
|
547
|
+
function $e() {
|
|
545
548
|
return {
|
|
546
549
|
_id: "",
|
|
547
550
|
name: "",
|
|
@@ -560,13 +563,13 @@ function rt() {
|
|
|
560
563
|
remark: void 0,
|
|
561
564
|
ref: void 0,
|
|
562
565
|
items: [],
|
|
563
|
-
supplier:
|
|
566
|
+
supplier: $e()
|
|
564
567
|
};
|
|
565
568
|
}
|
|
566
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 = {
|
|
567
570
|
key: 0,
|
|
568
571
|
class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
|
|
569
|
-
}, lt = { key: 0 },
|
|
572
|
+
}, lt = { key: 0 }, de = /* @__PURE__ */ be({
|
|
570
573
|
__name: "TransferTemplateImportItem",
|
|
571
574
|
props: {
|
|
572
575
|
type: {},
|
|
@@ -577,31 +580,31 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
577
580
|
errors: {}
|
|
578
581
|
},
|
|
579
582
|
setup(e) {
|
|
580
|
-
return (t,
|
|
583
|
+
return (t, a) => {
|
|
581
584
|
var n, f, o;
|
|
582
|
-
const c =
|
|
583
|
-
return T(),
|
|
584
|
-
|
|
585
|
+
const c = L("FmIcon"), s = L("FmTooltip");
|
|
586
|
+
return T(), w("div", nt, [
|
|
587
|
+
a[0] || (a[0] = $("div", null, "•", -1)),
|
|
585
588
|
$("div", ot, [
|
|
586
589
|
$("div", at, [
|
|
587
590
|
$("div", {
|
|
588
|
-
class:
|
|
591
|
+
class: Q({
|
|
589
592
|
"text-fm-color-system-error-300": t.errors.length
|
|
590
593
|
})
|
|
591
594
|
}, [
|
|
592
595
|
qe(I(t.name) + " ", 1),
|
|
593
|
-
$("span", st, " (" + I(
|
|
594
|
-
t.type === "create" ? (T(),
|
|
596
|
+
$("span", st, " (" + I(E(Fe)(`${t.transferType}`)) + ") ", 1),
|
|
597
|
+
t.type === "create" ? (T(), w("span", it, "(new)")) : H("", !0)
|
|
595
598
|
], 2),
|
|
596
|
-
t.errors.length ? (T(),
|
|
597
|
-
|
|
598
|
-
content:
|
|
599
|
+
t.errors.length ? (T(), w("div", lt, [
|
|
600
|
+
F(s, { "z-index": 50 }, {
|
|
601
|
+
content: Z(() => [
|
|
599
602
|
$("ol", null, [
|
|
600
|
-
(T(!0),
|
|
603
|
+
(T(!0), w(M, null, K(t.errors, (l, d) => (T(), w("li", { key: d }, I(l), 1))), 128))
|
|
601
604
|
])
|
|
602
605
|
]),
|
|
603
|
-
default:
|
|
604
|
-
|
|
606
|
+
default: Z(() => [
|
|
607
|
+
F(c, {
|
|
605
608
|
name: "error",
|
|
606
609
|
size: "sm",
|
|
607
610
|
color: "system-error-300"
|
|
@@ -609,10 +612,10 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
609
612
|
]),
|
|
610
613
|
_: 1
|
|
611
614
|
})
|
|
612
|
-
])) :
|
|
615
|
+
])) : H("", !0)
|
|
613
616
|
]),
|
|
614
617
|
$("div", {
|
|
615
|
-
class:
|
|
618
|
+
class: Q([
|
|
616
619
|
"fm-typo-en-body-sm-400",
|
|
617
620
|
{
|
|
618
621
|
"text-fm-color-system-error-200": t.errors.length,
|
|
@@ -636,10 +639,10 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
636
639
|
}, yt = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, ht = {
|
|
637
640
|
key: 0,
|
|
638
641
|
class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
|
|
639
|
-
}, vt = { class: "fm-typo-en-body-lg-600" }, gt = /* @__PURE__ */
|
|
642
|
+
}, vt = { class: "fm-typo-en-body-lg-600" }, gt = /* @__PURE__ */ be({
|
|
640
643
|
__name: "TransferTemplateImport",
|
|
641
644
|
setup(e) {
|
|
642
|
-
const t = C(null),
|
|
645
|
+
const t = C(null), a = Qe(), c = ve(), s = C(!1), n = C(!1), f = re();
|
|
643
646
|
Ve(async () => {
|
|
644
647
|
n.value = !0;
|
|
645
648
|
try {
|
|
@@ -654,38 +657,38 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
654
657
|
n.value = !1;
|
|
655
658
|
}
|
|
656
659
|
});
|
|
657
|
-
const o = C(new Array()), l = C([]), d = C([]), h =
|
|
658
|
-
() => !!o.value.length || l.value.some((
|
|
659
|
-
), y =
|
|
660
|
+
const o = C(new Array()), l = C([]), d = C([]), h = me(
|
|
661
|
+
() => !!o.value.length || l.value.some((b) => b.errors.length) || d.value.some((b) => b.errors.length)
|
|
662
|
+
), y = me(
|
|
660
663
|
() => !!l.value.length || !!d.value.length
|
|
661
|
-
), { t: m } =
|
|
662
|
-
async function v(
|
|
664
|
+
), { t: m } = te();
|
|
665
|
+
async function v(b) {
|
|
663
666
|
o.value = [], l.value = [], d.value = [];
|
|
664
667
|
try {
|
|
665
|
-
|
|
668
|
+
s.value = !0;
|
|
666
669
|
const [r] = await Promise.all([
|
|
667
|
-
Ue(
|
|
670
|
+
Ue(b),
|
|
668
671
|
// fake buffer
|
|
669
672
|
new Promise((i) => setTimeout(i, 1e3))
|
|
670
673
|
]);
|
|
671
674
|
if (!r.SheetNames.filter(
|
|
672
|
-
(i) => !Object.values(
|
|
675
|
+
(i) => !Object.values(ne).map(String).includes(i)
|
|
673
676
|
).find((i) => i)) {
|
|
674
677
|
o.value.push(m("inventory.ingredient.import.fileError.noSheet"));
|
|
675
678
|
return;
|
|
676
679
|
}
|
|
677
|
-
const
|
|
678
|
-
if (
|
|
680
|
+
const u = tt(r);
|
|
681
|
+
if (u.invalidExcel) {
|
|
679
682
|
o.value.push(
|
|
680
|
-
|
|
683
|
+
u.invalidExcelMessage ?? m("inventory.ingredient.import.fileError.invalidExcel")
|
|
681
684
|
);
|
|
682
685
|
return;
|
|
683
686
|
}
|
|
684
|
-
if (l.value =
|
|
687
|
+
if (l.value = u.importCreateResult, d.value = u.importUpdateResult, !l.value.length && !d.value.length) {
|
|
685
688
|
o.value.push(m("inventory.ingredient.import.fileError.noData"));
|
|
686
689
|
return;
|
|
687
690
|
}
|
|
688
|
-
|
|
691
|
+
a.emitData(u);
|
|
689
692
|
} catch (r) {
|
|
690
693
|
c.open({
|
|
691
694
|
title: m("inventory.ingredient.import.fileError.unableToRead"),
|
|
@@ -696,117 +699,117 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
696
699
|
o.value.length && c.open({
|
|
697
700
|
title: m("inventory.ingredient.import.fileError.invalidExcel"),
|
|
698
701
|
type: "error"
|
|
699
|
-
}),
|
|
702
|
+
}), s.value = !1;
|
|
700
703
|
}
|
|
701
704
|
}
|
|
702
|
-
return je(t, (
|
|
703
|
-
|
|
704
|
-
}), (
|
|
705
|
-
const
|
|
706
|
-
return T(),
|
|
705
|
+
return je(t, (b) => {
|
|
706
|
+
b && v(b);
|
|
707
|
+
}), (b, r) => {
|
|
708
|
+
const x = L("FmCircularProgress"), _ = L("FmIcon"), u = L("FmButton");
|
|
709
|
+
return T(), w("div", ct, [
|
|
707
710
|
r[2] || (r[2] = $("div", { class: "fm-typo-en-body-md-400" }, "Import transfer templates from excel sheets.", -1)),
|
|
708
|
-
n.value ? (T(),
|
|
711
|
+
n.value ? (T(), w("div", mt, [
|
|
709
712
|
$("div", null, [
|
|
710
|
-
|
|
713
|
+
F(x, {
|
|
711
714
|
size: "md",
|
|
712
715
|
color: "neutral-gray-200"
|
|
713
716
|
})
|
|
714
717
|
]),
|
|
715
718
|
r[1] || (r[1] = $("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "Loading...", -1))
|
|
716
|
-
])) : (T(),
|
|
717
|
-
|
|
718
|
-
class:
|
|
719
|
+
])) : (T(), w(M, { key: 1 }, [
|
|
720
|
+
F(Pe, {
|
|
721
|
+
class: Q({
|
|
719
722
|
"w-full": !0,
|
|
720
723
|
"h-[200px]": !t.value
|
|
721
724
|
}),
|
|
722
725
|
accept: ".xlsx",
|
|
723
726
|
onFileUpload: r[0] || (r[0] = (i) => t.value = i),
|
|
724
|
-
label:
|
|
725
|
-
"button-label":
|
|
727
|
+
label: E(m)("inventory.ingredient.import.uploadTemplate"),
|
|
728
|
+
"button-label": E(m)("inventory.ingredient.import.selectFile")
|
|
726
729
|
}, ze({ _: 2 }, [
|
|
727
730
|
t.value ? {
|
|
728
731
|
name: "default",
|
|
729
|
-
fn:
|
|
732
|
+
fn: Z(({ openFileDialog: i }) => [
|
|
730
733
|
$("div", ut, [
|
|
731
734
|
$("div", {
|
|
732
|
-
class:
|
|
735
|
+
class: Q([
|
|
733
736
|
"fm-corner-radius-md p-16 flex items-center gap-16",
|
|
734
737
|
{
|
|
735
|
-
"border border-fm-color-neutral-gray-100":
|
|
736
|
-
"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,
|
|
737
740
|
"border border-fm-color-system-error-200": h.value
|
|
738
741
|
}
|
|
739
742
|
])
|
|
740
743
|
}, [
|
|
741
|
-
|
|
744
|
+
s.value ? (T(), z(x, {
|
|
742
745
|
key: 0,
|
|
743
746
|
size: "md",
|
|
744
747
|
color: "neutral-gray-200"
|
|
745
|
-
})) : (T(),
|
|
748
|
+
})) : (T(), z(_, {
|
|
746
749
|
key: 1,
|
|
747
750
|
name: h.value ? "error" : "attach_file",
|
|
748
751
|
outline: "",
|
|
749
752
|
color: h.value ? "system-error-300" : void 0
|
|
750
753
|
}, null, 8, ["name", "color"])),
|
|
751
754
|
$("div", {
|
|
752
|
-
class:
|
|
755
|
+
class: Q([
|
|
753
756
|
"fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center",
|
|
754
757
|
{
|
|
755
|
-
"text-fm-color-typo-disabled":
|
|
756
|
-
"text-fm-color-typo-primary": !
|
|
758
|
+
"text-fm-color-typo-disabled": s.value,
|
|
759
|
+
"text-fm-color-typo-primary": !s.value
|
|
757
760
|
}
|
|
758
761
|
])
|
|
759
762
|
}, [
|
|
760
763
|
$("div", dt, I(t.value.name), 1)
|
|
761
764
|
], 2),
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
label:
|
|
765
|
+
s.value ? H("", !0) : (T(), w("div", pt, [
|
|
766
|
+
F(u, {
|
|
767
|
+
label: E(m)("inventory.ingredient.import.replaceFile"),
|
|
765
768
|
variant: h.value ? "destructive" : "secondary",
|
|
766
769
|
"prepend-icon": h.value ? void 0 : "autorenew",
|
|
767
770
|
onClick: i
|
|
768
771
|
}, null, 8, ["label", "variant", "prepend-icon", "onClick"])
|
|
769
772
|
]))
|
|
770
773
|
], 2),
|
|
771
|
-
o.value.length ? (T(),
|
|
772
|
-
(T(!0),
|
|
773
|
-
key:
|
|
774
|
+
o.value.length ? (T(), w("div", ft, [
|
|
775
|
+
(T(!0), w(M, null, K(o.value, (p, S) => (T(), w("div", {
|
|
776
|
+
key: S,
|
|
774
777
|
class: "flex gap-8 items-center"
|
|
775
778
|
}, [
|
|
776
|
-
|
|
779
|
+
F(_, {
|
|
777
780
|
name: "error",
|
|
778
781
|
size: "sm",
|
|
779
782
|
color: "system-error-300"
|
|
780
783
|
}),
|
|
781
|
-
$("div", yt, I(
|
|
784
|
+
$("div", yt, I(p), 1)
|
|
782
785
|
]))), 128))
|
|
783
|
-
])) :
|
|
786
|
+
])) : H("", !0)
|
|
784
787
|
])
|
|
785
788
|
]),
|
|
786
789
|
key: "0"
|
|
787
790
|
} : void 0
|
|
788
791
|
]), 1032, ["class", "label", "button-label"]),
|
|
789
|
-
y.value ? (T(),
|
|
790
|
-
$("div", vt, I(
|
|
791
|
-
(T(!0),
|
|
792
|
-
key:
|
|
792
|
+
y.value ? (T(), w("div", ht, [
|
|
793
|
+
$("div", vt, I(E(m)("inventory.ingredient.import.summary")), 1),
|
|
794
|
+
(T(!0), w(M, null, K(l.value, (i, p) => (T(), z(de, {
|
|
795
|
+
key: p,
|
|
793
796
|
name: i.template.name,
|
|
794
|
-
"transfer-type": typeof i.template.purchaseOrder.supplier.internal == "string" ? R
|
|
797
|
+
"transfer-type": typeof i.template.purchaseOrder.supplier.internal == "string" ? E(R).TRANSFER : E(R).PURCHASE,
|
|
795
798
|
locations: i.template.locations,
|
|
796
799
|
items: i.template.purchaseOrder.items,
|
|
797
800
|
errors: i.errors,
|
|
798
801
|
type: "create"
|
|
799
802
|
}, null, 8, ["name", "transfer-type", "locations", "items", "errors"]))), 128)),
|
|
800
|
-
(T(!0),
|
|
803
|
+
(T(!0), w(M, null, K(d.value, (i) => (T(), z(de, {
|
|
801
804
|
key: i.template._id,
|
|
802
805
|
name: i.template.name,
|
|
803
|
-
"transfer-type": typeof i.template.purchaseOrder.supplier.internal == "string" ? R
|
|
806
|
+
"transfer-type": typeof i.template.purchaseOrder.supplier.internal == "string" ? E(R).TRANSFER : E(R).PURCHASE,
|
|
804
807
|
locations: i.template.locations,
|
|
805
808
|
items: i.template.purchaseOrder.items,
|
|
806
809
|
errors: i.errors,
|
|
807
810
|
type: "update"
|
|
808
811
|
}, null, 8, ["name", "transfer-type", "locations", "items", "errors"]))), 128))
|
|
809
|
-
])) :
|
|
812
|
+
])) : H("", !0)
|
|
810
813
|
], 64))
|
|
811
814
|
]);
|
|
812
815
|
};
|
|
@@ -820,94 +823,98 @@ function bt(e) {
|
|
|
820
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;
|
|
821
824
|
return l && l == d;
|
|
822
825
|
}
|
|
823
|
-
const
|
|
824
|
-
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;
|
|
825
828
|
}
|
|
826
|
-
const
|
|
827
|
-
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({});
|
|
828
831
|
function d() {
|
|
829
832
|
l.value = {
|
|
830
|
-
mode:
|
|
833
|
+
mode: se.CREATE,
|
|
831
834
|
show: !0,
|
|
832
|
-
"onUpdate:show"(
|
|
833
|
-
l.value.show =
|
|
835
|
+
"onUpdate:show"(u) {
|
|
836
|
+
l.value.show = u;
|
|
834
837
|
}
|
|
835
838
|
};
|
|
836
839
|
}
|
|
837
|
-
function h(
|
|
840
|
+
function h(u) {
|
|
838
841
|
l.value = {
|
|
839
|
-
mode:
|
|
840
|
-
modelValue:
|
|
842
|
+
mode: se.UPDATE,
|
|
843
|
+
modelValue: u,
|
|
841
844
|
show: !0,
|
|
842
845
|
"onUpdate:show"(i) {
|
|
843
846
|
l.value.show = i;
|
|
844
847
|
}
|
|
845
848
|
};
|
|
846
849
|
}
|
|
847
|
-
function y(
|
|
850
|
+
function y(u, i, p) {
|
|
848
851
|
e.open({
|
|
849
|
-
title: `Confirm deleting template ${
|
|
852
|
+
title: `Confirm deleting template ${u.name}?`,
|
|
850
853
|
message: "Deleted template can no longer be retrieved",
|
|
851
854
|
primaryActions: {
|
|
852
855
|
text: "Delete",
|
|
853
|
-
variant:
|
|
856
|
+
variant: le.Destructive,
|
|
854
857
|
close: !0
|
|
855
858
|
},
|
|
856
859
|
secondaryActions: {
|
|
857
860
|
text: "Cancel",
|
|
858
|
-
variant:
|
|
861
|
+
variant: le.Plain,
|
|
859
862
|
close: !0
|
|
860
863
|
}
|
|
861
864
|
}).onPrimary(async () => {
|
|
862
865
|
t.open({
|
|
863
|
-
title: `Deleting ${
|
|
866
|
+
title: `Deleting ${u.name}`,
|
|
864
867
|
type: "info"
|
|
865
868
|
});
|
|
866
869
|
try {
|
|
867
870
|
i.value = !0;
|
|
868
|
-
const [
|
|
869
|
-
|
|
870
|
-
new Promise((
|
|
871
|
+
const [S] = await Promise.allSettled([
|
|
872
|
+
s.deleteTemplate(u),
|
|
873
|
+
new Promise((k) => setTimeout(k, 1e3))
|
|
871
874
|
]);
|
|
872
|
-
if (
|
|
875
|
+
if (S.status === "rejected") throw S.reason;
|
|
873
876
|
t.open({
|
|
874
|
-
title: `Deleted ${
|
|
877
|
+
title: `Deleted ${u.name}`,
|
|
875
878
|
type: "success"
|
|
876
879
|
});
|
|
877
|
-
} catch (
|
|
880
|
+
} catch (S) {
|
|
878
881
|
t.open({
|
|
879
|
-
title: `Unable to delete ${
|
|
880
|
-
message: `See error from server: ${
|
|
882
|
+
title: `Unable to delete ${u.name}`,
|
|
883
|
+
message: `See error from server: ${S}`,
|
|
881
884
|
type: "error"
|
|
882
|
-
}), console.error("error on deleting purchase order template",
|
|
885
|
+
}), console.error("error on deleting purchase order template", S);
|
|
883
886
|
} finally {
|
|
884
|
-
i.value = !1,
|
|
887
|
+
i.value = !1, p();
|
|
885
888
|
}
|
|
886
889
|
});
|
|
887
890
|
}
|
|
888
891
|
const m = C({});
|
|
889
|
-
function v(
|
|
892
|
+
function v(u) {
|
|
890
893
|
m.value = {
|
|
891
|
-
template:
|
|
894
|
+
template: u,
|
|
892
895
|
show: !0,
|
|
893
896
|
"onUpdate:show"(i) {
|
|
894
897
|
m.value.show = i;
|
|
895
898
|
},
|
|
896
899
|
"onAction:edit"() {
|
|
897
|
-
m.value.show = !1, h(X(
|
|
900
|
+
m.value.show = !1, h(X(u));
|
|
898
901
|
}
|
|
899
902
|
};
|
|
900
903
|
}
|
|
901
|
-
function
|
|
902
|
-
const { promise:
|
|
903
|
-
i(
|
|
904
|
-
},
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
904
|
+
function b() {
|
|
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;
|
|
908
914
|
}
|
|
909
|
-
|
|
910
|
-
|
|
915
|
+
return g.locations.find((P) => P.doc._id === a.currentLocation.doc._id);
|
|
916
|
+
});
|
|
917
|
+
if (!S.length)
|
|
911
918
|
return e.open({
|
|
912
919
|
title: "Select one template",
|
|
913
920
|
message: "There is no available template in your business. Configure a new template?",
|
|
@@ -920,26 +927,26 @@ const xt = ve("transferTemplateActions", () => {
|
|
|
920
927
|
close: !0
|
|
921
928
|
}
|
|
922
929
|
}).onPrimary(() => {
|
|
923
|
-
f.push({ name:
|
|
924
|
-
}).onSecondary(() =>
|
|
925
|
-
const
|
|
926
|
-
var
|
|
927
|
-
const A = !
|
|
928
|
-
`${
|
|
929
|
-
) : n.getNetSuiteVendor(
|
|
930
|
-
location is ${(
|
|
930
|
+
f.push({ name: ie.TRANSFER_TEMPLATE }), p(void 0);
|
|
931
|
+
}).onSecondary(() => p(void 0)).onClose(() => p(void 0)), u;
|
|
932
|
+
const k = S.map((g) => {
|
|
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(
|
|
935
|
+
`${g.purchaseOrder.supplier.internal}_${g.purchaseOrder.supplier._id}`
|
|
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}`;
|
|
931
938
|
return {
|
|
932
|
-
label:
|
|
933
|
-
value:
|
|
939
|
+
label: g.name,
|
|
940
|
+
value: g._id,
|
|
934
941
|
disabled: ke,
|
|
935
|
-
sublabel: Ce ??
|
|
942
|
+
sublabel: Ce ?? Re
|
|
936
943
|
};
|
|
937
944
|
});
|
|
938
|
-
return
|
|
945
|
+
return k.sort((g, A) => +!!g.disabled - +!!A.disabled), e.open({
|
|
939
946
|
title: "Select one template",
|
|
940
947
|
contentComponent: Be,
|
|
941
948
|
contentComponentProps: {
|
|
942
|
-
items:
|
|
949
|
+
items: k,
|
|
943
950
|
singleSelect: !0
|
|
944
951
|
},
|
|
945
952
|
primaryActions: {
|
|
@@ -954,9 +961,9 @@ const xt = ve("transferTemplateActions", () => {
|
|
|
954
961
|
text: "Templates",
|
|
955
962
|
close: !0
|
|
956
963
|
}
|
|
957
|
-
}).onPrimary((
|
|
958
|
-
f.push({ name:
|
|
959
|
-
}).onClose(() =>
|
|
964
|
+
}).onPrimary((g) => Array.isArray(g) ? p(g[0]) : null).onSecondary(() => p(void 0)).onTertiary(() => {
|
|
965
|
+
f.push({ name: ie.TRANSFER_TEMPLATE }), p(void 0);
|
|
966
|
+
}).onClose(() => p(void 0)), u;
|
|
960
967
|
}
|
|
961
968
|
function r() {
|
|
962
969
|
e.open({
|
|
@@ -977,15 +984,15 @@ const xt = ve("transferTemplateActions", () => {
|
|
|
977
984
|
close: !1,
|
|
978
985
|
variant: "plain"
|
|
979
986
|
}
|
|
980
|
-
}).onPrimary((
|
|
981
|
-
if (!
|
|
987
|
+
}).onPrimary((u) => {
|
|
988
|
+
if (!u) {
|
|
982
989
|
t.open({
|
|
983
990
|
title: o("inventory.ingredient.import.error.noData"),
|
|
984
991
|
type: "error"
|
|
985
992
|
});
|
|
986
993
|
return;
|
|
987
994
|
}
|
|
988
|
-
if (!
|
|
995
|
+
if (!u.importCreateResult.length && !u.importUpdateResult.length) {
|
|
989
996
|
t.open({
|
|
990
997
|
title: o("inventory.ingredient.import.error.invalidContent"),
|
|
991
998
|
message: o("inventory.ingredient.import.error.noImportData"),
|
|
@@ -993,7 +1000,7 @@ const xt = ve("transferTemplateActions", () => {
|
|
|
993
1000
|
});
|
|
994
1001
|
return;
|
|
995
1002
|
}
|
|
996
|
-
if (
|
|
1003
|
+
if (u.importCreateResult.some((i) => i.errors.length) || u.importUpdateResult.some((i) => i.errors.length)) {
|
|
997
1004
|
t.open({
|
|
998
1005
|
title: o("inventory.ingredient.import.error.invalidContent"),
|
|
999
1006
|
message: o("inventory.ingredient.import.error.hasErrors"),
|
|
@@ -1001,30 +1008,30 @@ const xt = ve("transferTemplateActions", () => {
|
|
|
1001
1008
|
});
|
|
1002
1009
|
return;
|
|
1003
1010
|
}
|
|
1004
|
-
e.close(),
|
|
1011
|
+
e.close(), x(u);
|
|
1005
1012
|
}).onTertiary(Ye);
|
|
1006
1013
|
}
|
|
1007
|
-
async function
|
|
1014
|
+
async function x(u) {
|
|
1008
1015
|
try {
|
|
1009
1016
|
const i = [
|
|
1010
|
-
...
|
|
1011
|
-
(
|
|
1017
|
+
...u.importCreateResult.map(
|
|
1018
|
+
(g) => g.template
|
|
1012
1019
|
),
|
|
1013
|
-
...
|
|
1014
|
-
(
|
|
1020
|
+
...u.importUpdateResult.map(
|
|
1021
|
+
(g) => g.template
|
|
1015
1022
|
)
|
|
1016
|
-
],
|
|
1017
|
-
let
|
|
1018
|
-
const
|
|
1019
|
-
|
|
1023
|
+
], p = 100;
|
|
1024
|
+
let S = 0;
|
|
1025
|
+
const k = () => {
|
|
1026
|
+
S += p, t.open({
|
|
1020
1027
|
title: o("inventory.ingredient.import.progress", [
|
|
1021
|
-
Math.min(
|
|
1028
|
+
Math.min(S, i.length),
|
|
1022
1029
|
i.length
|
|
1023
1030
|
])
|
|
1024
1031
|
});
|
|
1025
1032
|
};
|
|
1026
|
-
for (const
|
|
1027
|
-
|
|
1033
|
+
for (const g of i.chunk(100))
|
|
1034
|
+
k(), await s.importTemplates(g);
|
|
1028
1035
|
t.open({
|
|
1029
1036
|
title: o("inventory.ingredient.import.success"),
|
|
1030
1037
|
type: "success"
|
|
@@ -1034,16 +1041,16 @@ const xt = ve("transferTemplateActions", () => {
|
|
|
1034
1041
|
title: o("inventory.ingredient.import.error.failed"),
|
|
1035
1042
|
message: o("inventory.ingredient.import.error.systemMessage", [i == null ? void 0 : i.message]),
|
|
1036
1043
|
type: "error"
|
|
1037
|
-
}), console.error("Error in importing skus",
|
|
1044
|
+
}), console.error("Error in importing skus", u, i);
|
|
1038
1045
|
} finally {
|
|
1039
1046
|
c.fetchTemplates();
|
|
1040
1047
|
}
|
|
1041
1048
|
}
|
|
1042
1049
|
function _() {
|
|
1043
|
-
const
|
|
1050
|
+
const u = We(c.templates);
|
|
1044
1051
|
t.open({
|
|
1045
1052
|
title: o("inventory.ingredient.export.success"),
|
|
1046
|
-
message: o("inventory.ingredient.export.filename", [
|
|
1053
|
+
message: o("inventory.ingredient.export.filename", [u]),
|
|
1047
1054
|
type: "success"
|
|
1048
1055
|
});
|
|
1049
1056
|
}
|
|
@@ -1052,29 +1059,29 @@ const xt = ve("transferTemplateActions", () => {
|
|
|
1052
1059
|
viewTemplate: v,
|
|
1053
1060
|
updateTemplate: h,
|
|
1054
1061
|
deleteTemplate: y,
|
|
1055
|
-
getTemplateId:
|
|
1062
|
+
getTemplateId: b,
|
|
1056
1063
|
importTemplates: r,
|
|
1057
1064
|
exportTemplates: _,
|
|
1058
1065
|
templateDialogProps: l,
|
|
1059
1066
|
templateDetailsProps: m
|
|
1060
1067
|
};
|
|
1061
1068
|
});
|
|
1062
|
-
function
|
|
1063
|
-
const { skuById: t } =
|
|
1064
|
-
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;
|
|
1065
1072
|
}
|
|
1066
|
-
const
|
|
1073
|
+
const we = ge(
|
|
1067
1074
|
"transferTemplateTable",
|
|
1068
1075
|
function() {
|
|
1069
|
-
const { t } =
|
|
1076
|
+
const { t } = te(), a = St(), c = C(!1), s = C(new Array()), n = Se(), f = q();
|
|
1070
1077
|
async function o() {
|
|
1071
|
-
|
|
1078
|
+
s.value = [], c.value = !0;
|
|
1072
1079
|
try {
|
|
1073
1080
|
const [y] = await Promise.all([
|
|
1074
1081
|
n.readTemplates(),
|
|
1075
1082
|
f.readInventory()
|
|
1076
1083
|
]).delayed(1e3);
|
|
1077
|
-
|
|
1084
|
+
s.value = y.map(pe);
|
|
1078
1085
|
} catch (y) {
|
|
1079
1086
|
console.log("Something went wrong when fetching templates:", y);
|
|
1080
1087
|
} finally {
|
|
@@ -1082,11 +1089,11 @@ const $e = ve(
|
|
|
1082
1089
|
}
|
|
1083
1090
|
}
|
|
1084
1091
|
async function l(y) {
|
|
1085
|
-
if (!
|
|
1092
|
+
if (!s.value.find((m) => m._id)) {
|
|
1086
1093
|
c.value = !0;
|
|
1087
1094
|
try {
|
|
1088
|
-
|
|
1089
|
-
await n.getTemplate(y).then(
|
|
1095
|
+
s.value = [
|
|
1096
|
+
await n.getTemplate(y).then(pe).delayed(1e3)
|
|
1090
1097
|
];
|
|
1091
1098
|
} catch (m) {
|
|
1092
1099
|
console.log("Something went wrong when fetching templates:", m);
|
|
@@ -1097,12 +1104,12 @@ const $e = ve(
|
|
|
1097
1104
|
}
|
|
1098
1105
|
function d(y, m) {
|
|
1099
1106
|
switch (m = X(m), y) {
|
|
1100
|
-
case
|
|
1101
|
-
return
|
|
1102
|
-
case
|
|
1103
|
-
return
|
|
1104
|
-
case
|
|
1105
|
-
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);
|
|
1106
1113
|
}
|
|
1107
1114
|
}
|
|
1108
1115
|
return {
|
|
@@ -1134,16 +1141,16 @@ const $e = ve(
|
|
|
1134
1141
|
},
|
|
1135
1142
|
cell(y) {
|
|
1136
1143
|
const m = Number(y.getValue()) || 0, v = y.row.original.purchaseOrder.items.some(xe);
|
|
1137
|
-
return m === 0 || v ?
|
|
1138
|
-
|
|
1139
|
-
|
|
1144
|
+
return m === 0 || v ? G("div", { class: "flex justify-end gap-4 items-center" }, [
|
|
1145
|
+
G(
|
|
1146
|
+
ce.FmTooltip,
|
|
1140
1147
|
{},
|
|
1141
1148
|
{
|
|
1142
1149
|
content() {
|
|
1143
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.";
|
|
1144
1151
|
},
|
|
1145
1152
|
default() {
|
|
1146
|
-
return
|
|
1153
|
+
return G(ce.FmIcon, {
|
|
1147
1154
|
name: "error",
|
|
1148
1155
|
color: "system-error-300",
|
|
1149
1156
|
size: "sm"
|
|
@@ -1181,11 +1188,11 @@ const $e = ve(
|
|
|
1181
1188
|
id: "action",
|
|
1182
1189
|
cell(y) {
|
|
1183
1190
|
const m = y.row.original, v = [
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1191
|
+
Y[D.Details],
|
|
1192
|
+
Y[D.Edit],
|
|
1193
|
+
Y[D.Delete]
|
|
1187
1194
|
];
|
|
1188
|
-
return Le(v, (
|
|
1195
|
+
return Le(v, (b) => d(b, m));
|
|
1189
1196
|
},
|
|
1190
1197
|
enableSorting: !1,
|
|
1191
1198
|
size: 40,
|
|
@@ -1195,22 +1202,22 @@ const $e = ve(
|
|
|
1195
1202
|
}
|
|
1196
1203
|
}
|
|
1197
1204
|
],
|
|
1198
|
-
templates:
|
|
1205
|
+
templates: s,
|
|
1199
1206
|
loading: c,
|
|
1200
1207
|
fetchTemplates: o,
|
|
1201
1208
|
loadTemplate: l
|
|
1202
1209
|
};
|
|
1203
1210
|
}
|
|
1204
1211
|
);
|
|
1205
|
-
function
|
|
1206
|
-
const c = (
|
|
1207
|
-
return `${
|
|
1212
|
+
function Et(e, t, a) {
|
|
1213
|
+
const c = (a == null ? void 0 : a.abbrev) ?? t.abbrev;
|
|
1214
|
+
return `${B(e, !1)} ${c}`;
|
|
1208
1215
|
}
|
|
1209
1216
|
export {
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1217
|
+
R as P,
|
|
1218
|
+
Se as a,
|
|
1219
|
+
St as b,
|
|
1220
|
+
Et as f,
|
|
1214
1221
|
xe as t,
|
|
1215
|
-
|
|
1222
|
+
we as u
|
|
1216
1223
|
};
|