@feedmepos/mf-inventory-portal 0.0.23-dev.19 → 0.0.23-dev.20
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-DY01VbHo.js → App-N2myASr3.js} +44 -41
- package/dist/{ApprovalView-DtwXb5T7.js → ApprovalView-B87DpnNq.js} +20 -23
- package/dist/{BindingsDialog-ClnnwUTV.js → BindingsDialog-DehCgt1T.js} +7 -7
- package/dist/{BindingsPicker-DbdkXiHx.js → BindingsPicker-BBtJ3rBB.js} +7 -8
- package/dist/{BindingsTable-Cqh3Ku0d.js → BindingsTable-CfHuy-K1.js} +16 -20
- package/dist/{ClosingDraftView-CzuMTeC1.js → ClosingDraftView-BYZ1mZrG.js} +190 -196
- package/dist/{ClosingTemplateView-CVQlOya4.js → ClosingTemplateView-CAL9jYaf.js} +49 -60
- package/dist/{FmDroppableField-8RzKjEdL.js → FmDroppableField-CC7RiBoR.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BO1wCa9i.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-C4G9LaXv.js} +24 -25
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-sgvBxxkn.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BBf7jmJz.js} +56 -57
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-D7uvrzFU.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DjTvrLPs.js} +7 -7
- package/dist/{IngredientGroupView-DgDZnggI.js → IngredientGroupView-X0ST4tW9.js} +30 -37
- package/dist/{IngredientsView-SuCckJrj.js → IngredientsView-BUJXzpVr.js} +106 -112
- package/dist/{IntegrationView-CZQoHCkX.js → IntegrationView-QbuIwjec.js} +63 -65
- package/dist/{InventoryBindingForm-C-E3EINv.js → InventoryBindingForm-C1BR_h_3.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-B3nsmCuj.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CRwcFskQ.js} +18 -20
- package/dist/{InventoryBindingSummary-DNiOKfO8.js → InventoryBindingSummary-gn3Gq1ok.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CdYa8Pv2.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-GY3FFm5_.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BwxgZ-vM.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DVwtuUg9.js} +8 -8
- package/dist/{PurchaseOrderPrintPreview-C6i2S9L-.js → PurchaseOrderPrintPreview-FuOYaO56.js} +13 -14
- package/dist/{ReceiveRequestView-BABjGvIn.js → ReceiveRequestView-BNz1brve.js} +66 -75
- package/dist/{RecipeView-CoMcIuHu.js → RecipeView-DRKTODfC.js} +58 -64
- package/dist/{StockView-DhJshtaj.js → StockView-DnMcfkGG.js} +80 -87
- package/dist/{SupplierView-hQtDIQzE.js → SupplierView-DAnnWZUN.js} +45 -52
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-DsJUSZsm.js → TransferDetails.vue_vue_type_script_setup_true_lang-BBARPa0S.js} +103 -110
- package/dist/{TransferTemplateView-GzwT4hp-.js → TransferTemplateView-2qlKwwKg.js} +217 -227
- package/dist/{UnitView-CRMF6RWu.js → UnitView-u5wZGetF.js} +103 -108
- package/dist/{WarehouseView-AVEDff0v.js → WarehouseView-Z80N7FJV.js} +77 -84
- package/dist/api/adjustment-template.d.ts +23 -0
- package/dist/app-Fc2FPGhO.js +58871 -0
- package/dist/app.d.ts +51 -0
- package/dist/app.js +2 -2
- package/dist/components/FmMultiselectDialogProps.d.ts +1 -0
- package/dist/composable/defineDeepModel.d.ts +1 -1
- package/dist/{decimal-N5ymnwhP.js → decimal-BDD-e5Lb.js} +1 -1
- package/dist/{feature-Bfq8yWgS.js → feature-BMEyYowI.js} +1 -1
- package/dist/{format-unit-display-CXawcmvj.js → format-unit-display-DvlR_z--.js} +205 -212
- package/dist/{index-CcCqc9jx.js → index-CR22QBdu.js} +1 -1
- package/dist/{netsuite-DX6L1oLu.js → netsuite-CqMWgzKo.js} +9 -9
- package/dist/router/name.d.ts +1 -0
- package/dist/{stock-Btlxmf8R.js → stock-sIy40ix1.js} +7 -8
- package/dist/style.css +1 -1
- package/dist/supplier-Cf24JqTH.js +77 -0
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-inventory-binding-dialog-BFqxWNzX.js → use-inventory-binding-dialog-Br9Uv9o8.js} +10 -11
- package/dist/views/adjustment-template/wastage-template/WastageTemplateDetails.vue.d.ts +2 -0
- package/dist/views/adjustment-template/wastage-template/WastageTemplateDialog.vue.d.ts +22 -0
- package/dist/views/adjustment-template/wastage-template/WastageTemplatePublish.vue.d.ts +6 -0
- package/dist/views/adjustment-template/wastage-template/WastageTemplateView.vue.d.ts +2 -0
- package/dist/views/adjustment-template/wastage-template/actions.d.ts +1295 -0
- package/dist/views/adjustment-template/wastage-template/form/WastageTemplateForm.vue.d.ts +16 -0
- package/dist/views/adjustment-template/wastage-template/form/WastageTemplateItemTable.vue.d.ts +35 -0
- package/dist/views/adjustment-template/wastage-template/form/useAdjustmentTemplateItems.d.ts +20 -0
- package/dist/views/adjustment-template/wastage-template/props.d.ts +29 -0
- package/dist/views/adjustment-template/wastage-template/table.d.ts +1273 -0
- package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +2 -2
- package/dist/views/stock/helper/compute-summary-total.d.ts +2 -2
- package/dist/{xlsx-C3L2eW52.js → xlsx-sL0sD2HQ.js} +1 -1
- package/dist/{xlsx.util-CJKLCuWK.js → xlsx.util-D2Tdwf8J.js} +1 -1
- package/package.json +3 -3
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-m92y5x0G.js +0 -436
- package/dist/FmMultiselectDialog-Jr9uL_z_.js +0 -415
- package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js +0 -135
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
- package/dist/app-ww5ibHkL.js +0 -33540
- package/dist/date2-D5MTVjlP.js +0 -117
- package/dist/dayjs.min-7pwGJ2aW.js +0 -282
- package/dist/defineDeepModel-DJODEpcR.js +0 -13
- package/dist/form-mode.enum-BKiNVH6A.js +0 -4
- package/dist/format-time-from-id-0UkRUr39.js +0 -15
- package/dist/fuzzy-DdOiOd-q.js +0 -41
- package/dist/index-Cin_fxtb.js +0 -45
- package/dist/index-gvJJ-xRY.js +0 -22283
- package/dist/row-action.enum-7rGLGZ5v.js +0 -55
- package/dist/rules-C83wiSGb.js +0 -203
- package/dist/supplier-CSzla-9I.js +0 -77
- package/dist/use-template-enabled-locations-2-CUkqC-cd.js +0 -86
|
@@ -1,71 +1,64 @@
|
|
|
1
|
-
import { D as W,
|
|
2
|
-
import { c as Ce } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
|
|
3
|
-
import { k as Ie, a as L, u as z, i as Ae, A as ne, s as Ne, c as Z, R as oe } from "./app-ww5ibHkL.js";
|
|
4
|
-
import { f as De } from "./format-time-from-id-0UkRUr39.js";
|
|
1
|
+
import { N as Ce, a as L, z as Ie, n as Ne, u as z, h as O, o as Ae, av as ne, t as H, G as q, au as De, ap as Fe, K as Oe, c as oe, d as Z, R as ae, x as Pe, a6 as Ue, D as W, f as A, e as Me } from "./app-Fc2FPGhO.js";
|
|
5
2
|
import { useCoreStore as J, useI18n as X } from "@feedmepos/mf-common";
|
|
6
|
-
import { useDialogChild as
|
|
3
|
+
import { useDialogChild as Be, useSnackbar as de, useDialog as Qe, FmButtonVariant as se, components as ie } from "@feedmepos/ui-library";
|
|
7
4
|
import { defineStore as pe } from "pinia";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { F as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
import { f as Ke } from "./date2-D5MTVjlP.js";
|
|
16
|
-
import { u as ee } from "./supplier-CSzla-9I.js";
|
|
17
|
-
import { u as ge } from "./netsuite-DX6L1oLu.js";
|
|
18
|
-
const be = Ie((e, r) => {
|
|
5
|
+
import { defineComponent as fe, resolveComponent as M, openBlock as T, createElementBlock as w, createElementVNode as $, normalizeClass as B, createTextVNode as Le, toDisplayString as I, unref as C, createCommentVNode as Q, createVNode as D, withCtx as G, Fragment as P, renderList as j, ref as E, onMounted as He, computed as le, watch as qe, createSlots as Ve, createBlock as V, h as Y } from "vue";
|
|
6
|
+
import { useRouter as je } from "vue-router";
|
|
7
|
+
import { a as U, b as ye, d as he, s as ve, r as ze } from "./xlsx.util-D2Tdwf8J.js";
|
|
8
|
+
import { F as Ke } from "./FmDroppableField-CC7RiBoR.js";
|
|
9
|
+
import { u as ee } from "./supplier-Cf24JqTH.js";
|
|
10
|
+
import { u as ge } from "./netsuite-CqMWgzKo.js";
|
|
11
|
+
const be = Ce((e, r) => {
|
|
19
12
|
function i() {
|
|
20
13
|
var n;
|
|
21
14
|
return `business_${((n = J().currentBusiness.value) == null ? void 0 : n._id) ?? ""}`;
|
|
22
15
|
}
|
|
23
16
|
return {
|
|
24
|
-
async getTemplate(
|
|
25
|
-
const a = i(), n = `${e.inventoryBackendUrl}/${a}/purchase-order-template/${
|
|
17
|
+
async getTemplate(m) {
|
|
18
|
+
const a = i(), n = `${e.inventoryBackendUrl}/${a}/purchase-order-template/${m}`;
|
|
26
19
|
return r.get(n);
|
|
27
20
|
},
|
|
28
21
|
async readTemplates() {
|
|
29
|
-
const
|
|
22
|
+
const m = i(), a = `${e.inventoryBackendUrl}/${m}/purchase-order-template`;
|
|
30
23
|
return r.get(a);
|
|
31
24
|
},
|
|
32
|
-
async createTemplate(
|
|
25
|
+
async createTemplate(m) {
|
|
33
26
|
const a = i(), n = `${e.inventoryBackendUrl}/${a}/purchase-order-template`;
|
|
34
|
-
return r.post(n,
|
|
27
|
+
return r.post(n, m);
|
|
35
28
|
},
|
|
36
|
-
async updateTemplate(
|
|
29
|
+
async updateTemplate(m) {
|
|
37
30
|
const a = i(), n = `${e.inventoryBackendUrl}/${a}/purchase-order-template`;
|
|
38
|
-
return r.put(n,
|
|
31
|
+
return r.put(n, m);
|
|
39
32
|
},
|
|
40
|
-
async deleteTemplate(
|
|
33
|
+
async deleteTemplate(m) {
|
|
41
34
|
const a = i(), n = `${e.inventoryBackendUrl}/${a}/purchase-order-template`;
|
|
42
|
-
return r.delete(n, { _id:
|
|
35
|
+
return r.delete(n, { _id: m._id, _rev: m._rev });
|
|
43
36
|
},
|
|
44
|
-
async importTemplates(
|
|
37
|
+
async importTemplates(m) {
|
|
45
38
|
const a = i(), n = `${e.inventoryBackendUrl}/${a}/purchase-order-template/import`;
|
|
46
|
-
return r.post(n,
|
|
39
|
+
return r.post(n, m);
|
|
47
40
|
}
|
|
48
41
|
};
|
|
49
42
|
});
|
|
50
|
-
function
|
|
51
|
-
const r = L(), i = e.sku,
|
|
52
|
-
if (
|
|
43
|
+
function xe(e) {
|
|
44
|
+
const r = L(), i = e.sku, m = r.skuById[i._id];
|
|
45
|
+
if (m.unit._id !== i.unit._id) return !0;
|
|
53
46
|
const a = e.measurement;
|
|
54
|
-
return a ? !r.unitById[
|
|
47
|
+
return a ? !r.unitById[m.unit._id].measurements.find((s) => s.id === a.id) : !1;
|
|
55
48
|
}
|
|
56
|
-
var
|
|
57
|
-
const
|
|
58
|
-
function
|
|
59
|
-
var
|
|
49
|
+
var R = /* @__PURE__ */ ((e) => (e.PURCHASE = "PURCHASE", e.TRANSFER = "TRANSFER", e))(R || {}), te = /* @__PURE__ */ ((e) => (e.Source = "Source", e.Destination = "Destination", e.Ingredient = "Ingredient", e))(te || {});
|
|
50
|
+
const ce = Ie(0);
|
|
51
|
+
function Se(e) {
|
|
52
|
+
var m;
|
|
60
53
|
const r = e.sku;
|
|
61
54
|
return {
|
|
62
55
|
code: r.code,
|
|
63
56
|
name: r.name,
|
|
64
|
-
unit: ((
|
|
65
|
-
defaultQuantity: +
|
|
66
|
-
minimumQuantity: +
|
|
67
|
-
maximumQuantity: +
|
|
68
|
-
quantityStep: +
|
|
57
|
+
unit: ((m = r.unit.measurements.find((a) => a.id === r.trackingMeasurement)) == null ? void 0 : m.abbrev) ?? r.unit.abbrev,
|
|
58
|
+
defaultQuantity: +O(e.quantity),
|
|
59
|
+
minimumQuantity: +O(e.minimumQuantity ?? ce),
|
|
60
|
+
maximumQuantity: +O(e.maximumQuantity ?? ce),
|
|
61
|
+
quantityStep: +O(e.quantityStep)
|
|
69
62
|
};
|
|
70
63
|
}
|
|
71
64
|
function Te() {
|
|
@@ -104,7 +97,7 @@ function We(e) {
|
|
|
104
97
|
var s;
|
|
105
98
|
const i = J().currentBusiness.value, a = (s = e.map((l) => {
|
|
106
99
|
var f;
|
|
107
|
-
const
|
|
100
|
+
const c = l.purchaseOrder.items.map(Se), h = Te(), b = [
|
|
108
101
|
["Template ID", l._id],
|
|
109
102
|
["Template name", l.name],
|
|
110
103
|
["Business name", i == null ? void 0 : i.name],
|
|
@@ -112,7 +105,7 @@ function We(e) {
|
|
|
112
105
|
["Menu version", i == null ? void 0 : i.menuVersion],
|
|
113
106
|
[
|
|
114
107
|
"Purchase/Transfer",
|
|
115
|
-
typeof l.purchaseOrder.supplier.internal == "string" ?
|
|
108
|
+
typeof l.purchaseOrder.supplier.internal == "string" ? R.TRANSFER : R.PURCHASE
|
|
116
109
|
],
|
|
117
110
|
[
|
|
118
111
|
"Transfer from",
|
|
@@ -126,24 +119,24 @@ function We(e) {
|
|
|
126
119
|
["Remark", l.purchaseOrder.remark ?? ""],
|
|
127
120
|
[],
|
|
128
121
|
h.map((t) => t.name),
|
|
129
|
-
...
|
|
130
|
-
], v = h.map((t) => `system:${t.id}`), y =
|
|
122
|
+
...c.map((t) => h.map((S) => t[S.id]))
|
|
123
|
+
], v = h.map((t) => `system:${t.id}`), y = U(b, v);
|
|
131
124
|
return { name: l.name, sheet: y };
|
|
132
125
|
}).reduce(
|
|
133
|
-
(l,
|
|
126
|
+
(l, c) => {
|
|
134
127
|
var b;
|
|
135
|
-
const h =
|
|
136
|
-
return (b = l.sheetOccurence)[h] ?? (b[h] = 0), l.sheetOccurence[h] += 1, l.sheets[`${h} (${l.sheetOccurence[h]})`] =
|
|
128
|
+
const h = c.name.slice(0, 12);
|
|
129
|
+
return (b = l.sheetOccurence)[h] ?? (b[h] = 0), l.sheetOccurence[h] += 1, l.sheets[`${h} (${l.sheetOccurence[h]})`] = c.sheet, l;
|
|
137
130
|
},
|
|
138
131
|
{
|
|
139
132
|
sheets: {},
|
|
140
133
|
sheetOccurence: {}
|
|
141
134
|
}
|
|
142
|
-
)) == null ? void 0 : s.sheets, n = `${i == null ? void 0 : i.name} transfer templates (${
|
|
135
|
+
)) == null ? void 0 : s.sheets, n = `${i == null ? void 0 : i.name} transfer templates (${Ne(/* @__PURE__ */ new Date())}).xlsx`, p = ye(a);
|
|
143
136
|
return he(p, n), n;
|
|
144
137
|
}
|
|
145
138
|
function Ye() {
|
|
146
|
-
const e = J(), r = ee(), i = z(),
|
|
139
|
+
const e = J(), r = ee(), i = z(), m = L(), a = e.currentBusiness.value, n = Se({
|
|
147
140
|
sku: {
|
|
148
141
|
unit: {
|
|
149
142
|
_id: "",
|
|
@@ -196,7 +189,7 @@ function Ye() {
|
|
|
196
189
|
[],
|
|
197
190
|
p.map((t) => t.name),
|
|
198
191
|
p.map((t) => n[t.id])
|
|
199
|
-
], l = p.map((t) => `system:${t.id}`),
|
|
192
|
+
], l = p.map((t) => `system:${t.id}`), c = U(s, l), h = U(
|
|
200
193
|
[
|
|
201
194
|
...r.businessSuppliers.map((t) => [
|
|
202
195
|
`${t.name} (${t._id})`,
|
|
@@ -209,44 +202,44 @@ function Ye() {
|
|
|
209
202
|
t.address.country
|
|
210
203
|
]),
|
|
211
204
|
...i.locations.map((t) => {
|
|
212
|
-
var
|
|
205
|
+
var S, _, d, o, u, x;
|
|
213
206
|
return [
|
|
214
207
|
`${t.name} (${t.dbName})`,
|
|
215
208
|
"Transfer",
|
|
216
|
-
(
|
|
209
|
+
(S = t.doc.profile.address) == null ? void 0 : S.line1,
|
|
217
210
|
(_ = t.doc.profile.address) == null ? void 0 : _.line2,
|
|
218
211
|
(d = t.doc.profile.address) == null ? void 0 : d.city,
|
|
219
212
|
(o = t.doc.profile.address) == null ? void 0 : o.postcode,
|
|
220
213
|
(u = t.doc.profile.address) == null ? void 0 : u.state,
|
|
221
|
-
(
|
|
214
|
+
(x = t.doc.profile.address) == null ? void 0 : x.country
|
|
222
215
|
];
|
|
223
216
|
})
|
|
224
217
|
],
|
|
225
218
|
["Name", "Type", "Line 1", "Line 2", "City", "Postal", "State", "Country"]
|
|
226
|
-
), b =
|
|
219
|
+
), b = U(
|
|
227
220
|
i.locations.map((t) => {
|
|
228
|
-
var
|
|
221
|
+
var S, _, d, o, u, x;
|
|
229
222
|
return [
|
|
230
223
|
`${t.name} (${t.dbName})`,
|
|
231
|
-
(
|
|
224
|
+
(S = t.doc.profile.address) == null ? void 0 : S.line1,
|
|
232
225
|
(_ = t.doc.profile.address) == null ? void 0 : _.line2,
|
|
233
226
|
(d = t.doc.profile.address) == null ? void 0 : d.city,
|
|
234
227
|
(o = t.doc.profile.address) == null ? void 0 : o.postcode,
|
|
235
228
|
(u = t.doc.profile.address) == null ? void 0 : u.state,
|
|
236
|
-
(
|
|
229
|
+
(x = t.doc.profile.address) == null ? void 0 : x.country
|
|
237
230
|
];
|
|
238
231
|
}),
|
|
239
232
|
["Name", "Line 1", "Line 2", "City", "Postal", "State", "Country"]
|
|
240
|
-
), v =
|
|
241
|
-
|
|
233
|
+
), v = U(
|
|
234
|
+
m.skus.map((t) => [
|
|
242
235
|
t.code,
|
|
243
236
|
t.name,
|
|
244
237
|
t.unit.abbrev,
|
|
245
|
-
...t.unit.measurements.map((
|
|
238
|
+
...t.unit.measurements.map((S) => S.abbrev)
|
|
246
239
|
]),
|
|
247
240
|
["Code", "Name", "Base unit", "Measurements"]
|
|
248
241
|
), y = ye({
|
|
249
|
-
Template:
|
|
242
|
+
Template: c,
|
|
250
243
|
Source: h,
|
|
251
244
|
Destination: b,
|
|
252
245
|
Ingredient: v
|
|
@@ -254,15 +247,15 @@ function Ye() {
|
|
|
254
247
|
return he(y, f), f;
|
|
255
248
|
}
|
|
256
249
|
function Ge(e, r) {
|
|
257
|
-
const i = new Array(),
|
|
258
|
-
if (!
|
|
250
|
+
const i = new Array(), m = /(.*) \(((supplier_|warehouse_|restaurant_).{24,})\)/, n = z().locationByDbName, s = ee().supplierById, l = e.trim(), c = m.exec(l);
|
|
251
|
+
if (!c)
|
|
259
252
|
return i.push(`Transfer from location value of ${l} cannot be read.`), {
|
|
260
253
|
errors: i
|
|
261
254
|
};
|
|
262
|
-
const h =
|
|
255
|
+
const h = c[1], b = c[2];
|
|
263
256
|
let v;
|
|
264
257
|
if (b.startsWith("supplier"))
|
|
265
|
-
v = s[b], r !==
|
|
258
|
+
v = s[b], r !== R.PURCHASE && i.push(`Expected transfer type Purchase but found ${r} instead.`);
|
|
266
259
|
else {
|
|
267
260
|
const y = n[b];
|
|
268
261
|
if (!y)
|
|
@@ -298,20 +291,20 @@ function Ge(e, r) {
|
|
|
298
291
|
function Ze(e) {
|
|
299
292
|
if (!e.length || `${e[0]}`.toLocaleLowerCase() === "all")
|
|
300
293
|
return [];
|
|
301
|
-
const r = /(.*) \(((warehouse_|restaurant_).{24,})\)/,
|
|
294
|
+
const r = /(.*) \(((warehouse_|restaurant_).{24,})\)/, m = z().locationByDbName;
|
|
302
295
|
return e.map((a) => {
|
|
303
296
|
const n = new Array(), p = a.trim(), s = r.exec(p);
|
|
304
297
|
if (!s)
|
|
305
298
|
return n.push(`Enabled location value of ${p} cannot be read.`), {
|
|
306
299
|
errors: n
|
|
307
300
|
};
|
|
308
|
-
const l = s[1],
|
|
301
|
+
const l = s[1], c = s[2], h = m[c];
|
|
309
302
|
return h ? (l !== h.name && n.push(
|
|
310
|
-
`Location id ${
|
|
303
|
+
`Location id ${c} has non-matching name. Found ${l} but expected ${h.name}`
|
|
311
304
|
), {
|
|
312
305
|
errors: n,
|
|
313
306
|
location: h
|
|
314
|
-
}) : (n.push(`Location (${l}) of id ${
|
|
307
|
+
}) : (n.push(`Location (${l}) of id ${c} is not found.`), {
|
|
315
308
|
errors: n
|
|
316
309
|
});
|
|
317
310
|
});
|
|
@@ -320,22 +313,22 @@ function Je(e) {
|
|
|
320
313
|
const [
|
|
321
314
|
r,
|
|
322
315
|
i,
|
|
323
|
-
|
|
316
|
+
m,
|
|
324
317
|
a,
|
|
325
318
|
n,
|
|
326
319
|
p,
|
|
327
320
|
s,
|
|
328
321
|
l,
|
|
329
|
-
|
|
322
|
+
c,
|
|
330
323
|
h,
|
|
331
324
|
b
|
|
332
325
|
] = ve(e);
|
|
333
326
|
return {
|
|
334
327
|
id: `${i[1] ?? ""}`.trim(),
|
|
335
|
-
name: `${
|
|
336
|
-
type: `${s[1] ?? ""}`.trim().toLocaleLowerCase() === "transfer" ?
|
|
328
|
+
name: `${m[1] ?? ""}`.trim(),
|
|
329
|
+
type: `${s[1] ?? ""}`.trim().toLocaleLowerCase() === "transfer" ? R.TRANSFER : R.PURCHASE,
|
|
337
330
|
transferFrom: `${l[1] ?? ""}`.trim(),
|
|
338
|
-
locations:
|
|
331
|
+
locations: c.slice(1).map((v) => `${v}`.trim()).filter((v) => v),
|
|
339
332
|
reference: `${h[1] ?? ""}`.trim(),
|
|
340
333
|
remark: `${b[1] ?? ""}`.trim()
|
|
341
334
|
};
|
|
@@ -344,13 +337,13 @@ function Xe(e) {
|
|
|
344
337
|
const [
|
|
345
338
|
r,
|
|
346
339
|
i,
|
|
347
|
-
|
|
340
|
+
m,
|
|
348
341
|
a,
|
|
349
342
|
n,
|
|
350
343
|
p,
|
|
351
344
|
s,
|
|
352
345
|
l,
|
|
353
|
-
|
|
346
|
+
c,
|
|
354
347
|
h,
|
|
355
348
|
b,
|
|
356
349
|
v,
|
|
@@ -373,14 +366,14 @@ function Xe(e) {
|
|
|
373
366
|
`Missing meta headers (${_.join()}). Excel file does not come from the template.`
|
|
374
367
|
);
|
|
375
368
|
return f.map((o, u) => {
|
|
376
|
-
const
|
|
369
|
+
const x = {};
|
|
377
370
|
for (const k in t) {
|
|
378
371
|
const g = t[k];
|
|
379
|
-
Object.assign(
|
|
372
|
+
Object.assign(x, { [g]: o[k] });
|
|
380
373
|
}
|
|
381
374
|
return {
|
|
382
375
|
index: u,
|
|
383
|
-
data:
|
|
376
|
+
data: x
|
|
384
377
|
};
|
|
385
378
|
});
|
|
386
379
|
}
|
|
@@ -416,26 +409,26 @@ function et(e, r, i) {
|
|
|
416
409
|
templateItem: u
|
|
417
410
|
};
|
|
418
411
|
}
|
|
419
|
-
const l =
|
|
412
|
+
const l = H(
|
|
420
413
|
e.quantityStep,
|
|
421
|
-
|
|
414
|
+
q(p, s)
|
|
422
415
|
);
|
|
423
416
|
(Number.isNaN(Number(e.quantityStep)) || Number(e.quantityStep) <= 0) && n.push("Amount step must be more than 0");
|
|
424
|
-
const
|
|
417
|
+
const c = De(l), h = H(
|
|
425
418
|
e.minimumQuantity,
|
|
426
|
-
|
|
427
|
-
), b =
|
|
419
|
+
q(p, s)
|
|
420
|
+
), b = c(h);
|
|
428
421
|
typeof b == "string" && n.push(`Minimum amount: ${b}`);
|
|
429
|
-
const v =
|
|
422
|
+
const v = H(
|
|
430
423
|
e.maximumQuantity,
|
|
431
|
-
|
|
432
|
-
), y =
|
|
424
|
+
q(p, s)
|
|
425
|
+
), y = c(v);
|
|
433
426
|
typeof y == "string" && n.push(`Maximum amount: ${y}`), +e.minimumQuantity > +e.maximumQuantity && n.push("Minimum amount must be less than or equal to maximum amount");
|
|
434
|
-
const f =
|
|
427
|
+
const f = Fe(+e.minimumQuantity, +e.maximumQuantity), t = H(
|
|
435
428
|
e.defaultQuantity,
|
|
436
|
-
|
|
437
|
-
),
|
|
438
|
-
typeof
|
|
429
|
+
q(p, s)
|
|
430
|
+
), S = c(t), _ = f(`${e.defaultQuantity}`);
|
|
431
|
+
typeof S == "string" && n.push(`Default amount: ${S}`), typeof _ == "string" && n.push(`Default amount: ${_}`);
|
|
439
432
|
const d = {
|
|
440
433
|
sku: a,
|
|
441
434
|
code: a.code,
|
|
@@ -455,34 +448,34 @@ function et(e, r, i) {
|
|
|
455
448
|
function tt(e) {
|
|
456
449
|
const r = e.SheetNames.filter(
|
|
457
450
|
(n) => !Object.values(te).map(String).includes(n)
|
|
458
|
-
),
|
|
451
|
+
), m = $e().templates, a = Ae(m, "_id");
|
|
459
452
|
try {
|
|
460
453
|
return r.reduce(
|
|
461
454
|
(n, p) => {
|
|
462
455
|
var o;
|
|
463
|
-
const s = new Array(), l = e.Sheets[p],
|
|
456
|
+
const s = new Array(), l = e.Sheets[p], c = Je(l), h = Ge(c.transferFrom, c.type);
|
|
464
457
|
s.push(...h.errors);
|
|
465
|
-
const b = h.from, v = Ze(
|
|
458
|
+
const b = h.from, v = Ze(c.locations), y = v.filter((u) => u.location).map((u) => u.location);
|
|
466
459
|
s.push(...v.flatMap((u) => u.errors));
|
|
467
460
|
const f = Xe(l).filter((u) => u.data.code), t = f.map(
|
|
468
|
-
(u,
|
|
461
|
+
(u, x) => et(u.data, x, f)
|
|
469
462
|
);
|
|
470
463
|
s.push(
|
|
471
464
|
...t.flatMap(
|
|
472
|
-
(u) => u.errors.map((
|
|
465
|
+
(u) => u.errors.map((x) => `(Excel row ${u.index + 14}) ${x}`)
|
|
473
466
|
)
|
|
474
467
|
);
|
|
475
|
-
const
|
|
476
|
-
if (
|
|
477
|
-
const u = a[
|
|
468
|
+
const S = t.filter((u) => u.templateItem).map((u) => u.templateItem);
|
|
469
|
+
if (c.id) {
|
|
470
|
+
const u = a[c.id];
|
|
478
471
|
if (!u) {
|
|
479
472
|
const k = {
|
|
480
|
-
_id:
|
|
473
|
+
_id: c.id,
|
|
481
474
|
_rev: "",
|
|
482
|
-
name:
|
|
475
|
+
name: c.name || `(unnamed from sheet ${p || "<unnamed sheet>"})`,
|
|
483
476
|
purchaseOrder: rt()
|
|
484
477
|
};
|
|
485
|
-
return s.push(`Template ID ${
|
|
478
|
+
return s.push(`Template ID ${c.id} is not found.`), n.importUpdateResult.push({
|
|
486
479
|
type: "update",
|
|
487
480
|
original: k,
|
|
488
481
|
template: k,
|
|
@@ -490,36 +483,36 @@ function tt(e) {
|
|
|
490
483
|
errors: s
|
|
491
484
|
}), n;
|
|
492
485
|
}
|
|
493
|
-
const
|
|
486
|
+
const x = {
|
|
494
487
|
type: "update",
|
|
495
488
|
original: u,
|
|
496
489
|
template: {
|
|
497
490
|
...u,
|
|
498
|
-
name:
|
|
491
|
+
name: c.name,
|
|
499
492
|
locations: y.length ? y : null,
|
|
500
493
|
purchaseOrder: {
|
|
501
494
|
...u.purchaseOrder,
|
|
502
495
|
supplier: b ?? ((o = u.purchaseOrder) == null ? void 0 : o.supplier),
|
|
503
|
-
ref:
|
|
504
|
-
remark:
|
|
505
|
-
items:
|
|
496
|
+
ref: c.reference,
|
|
497
|
+
remark: c.remark,
|
|
498
|
+
items: S
|
|
506
499
|
}
|
|
507
500
|
},
|
|
508
501
|
excelSheetName: p,
|
|
509
502
|
errors: s
|
|
510
503
|
};
|
|
511
|
-
return n.importUpdateResult.push(
|
|
504
|
+
return n.importUpdateResult.push(x), n;
|
|
512
505
|
}
|
|
513
506
|
const d = {
|
|
514
507
|
type: "create",
|
|
515
508
|
template: {
|
|
516
|
-
name:
|
|
509
|
+
name: c.id,
|
|
517
510
|
locations: y,
|
|
518
511
|
purchaseOrder: {
|
|
519
512
|
supplier: b ?? _e(),
|
|
520
|
-
ref:
|
|
521
|
-
remark:
|
|
522
|
-
items:
|
|
513
|
+
ref: c.reference,
|
|
514
|
+
remark: c.remark,
|
|
515
|
+
items: S
|
|
523
516
|
}
|
|
524
517
|
},
|
|
525
518
|
excelSheetName: p,
|
|
@@ -567,7 +560,7 @@ function rt() {
|
|
|
567
560
|
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 = {
|
|
568
561
|
key: 0,
|
|
569
562
|
class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
|
|
570
|
-
}, lt = { key: 0 },
|
|
563
|
+
}, lt = { key: 0 }, me = /* @__PURE__ */ fe({
|
|
571
564
|
__name: "TransferTemplateImportItem",
|
|
572
565
|
props: {
|
|
573
566
|
type: {},
|
|
@@ -580,29 +573,29 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
580
573
|
setup(e) {
|
|
581
574
|
return (r, i) => {
|
|
582
575
|
var n, p, s;
|
|
583
|
-
const
|
|
576
|
+
const m = M("FmIcon"), a = M("FmTooltip");
|
|
584
577
|
return T(), w("div", nt, [
|
|
585
578
|
i[0] || (i[0] = $("div", null, "•", -1)),
|
|
586
579
|
$("div", ot, [
|
|
587
580
|
$("div", at, [
|
|
588
581
|
$("div", {
|
|
589
|
-
class:
|
|
582
|
+
class: B({
|
|
590
583
|
"text-fm-color-system-error-300": r.errors.length
|
|
591
584
|
})
|
|
592
585
|
}, [
|
|
593
|
-
|
|
594
|
-
$("span", st, " (" + I(C(
|
|
586
|
+
Le(I(r.name) + " ", 1),
|
|
587
|
+
$("span", st, " (" + I(C(Oe)(`${r.transferType}`)) + ") ", 1),
|
|
595
588
|
r.type === "create" ? (T(), w("span", it, "(new)")) : Q("", !0)
|
|
596
589
|
], 2),
|
|
597
590
|
r.errors.length ? (T(), w("div", lt, [
|
|
598
591
|
D(a, { "z-index": 50 }, {
|
|
599
592
|
content: G(() => [
|
|
600
593
|
$("ol", null, [
|
|
601
|
-
(T(!0), w(
|
|
594
|
+
(T(!0), w(P, null, j(r.errors, (l, c) => (T(), w("li", { key: c }, I(l), 1))), 128))
|
|
602
595
|
])
|
|
603
596
|
]),
|
|
604
597
|
default: G(() => [
|
|
605
|
-
D(
|
|
598
|
+
D(m, {
|
|
606
599
|
name: "error",
|
|
607
600
|
size: "sm",
|
|
608
601
|
color: "system-error-300"
|
|
@@ -613,7 +606,7 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
613
606
|
])) : Q("", !0)
|
|
614
607
|
]),
|
|
615
608
|
$("div", {
|
|
616
|
-
class:
|
|
609
|
+
class: B([
|
|
617
610
|
"fm-typo-en-body-sm-400",
|
|
618
611
|
{
|
|
619
612
|
"text-fm-color-system-error-200": r.errors.length,
|
|
@@ -625,7 +618,7 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
625
618
|
]);
|
|
626
619
|
};
|
|
627
620
|
}
|
|
628
|
-
}),
|
|
621
|
+
}), ct = { class: "flex flex-col gap-24" }, mt = {
|
|
629
622
|
key: 0,
|
|
630
623
|
class: "flex items-center gap-8"
|
|
631
624
|
}, ut = { class: "flex flex-col gap-8" }, dt = { class: "line-clamp-2 text-ellipsis break-all" }, pt = {
|
|
@@ -640,13 +633,13 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
640
633
|
}, vt = { class: "fm-typo-en-body-lg-600" }, gt = /* @__PURE__ */ fe({
|
|
641
634
|
__name: "TransferTemplateImport",
|
|
642
635
|
setup(e) {
|
|
643
|
-
const r =
|
|
644
|
-
|
|
636
|
+
const r = E(null), i = Be(), m = de(), a = E(!1), n = E(!1), p = ee();
|
|
637
|
+
He(async () => {
|
|
645
638
|
n.value = !0;
|
|
646
639
|
try {
|
|
647
640
|
await p.readSuppliers().delayed(1e3);
|
|
648
641
|
} catch {
|
|
649
|
-
|
|
642
|
+
m.open({
|
|
650
643
|
title: "Something went wrong.",
|
|
651
644
|
message: "Error at reading suppliers list. Please try again.",
|
|
652
645
|
type: "error"
|
|
@@ -655,17 +648,17 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
655
648
|
n.value = !1;
|
|
656
649
|
}
|
|
657
650
|
});
|
|
658
|
-
const s =
|
|
659
|
-
() => !!s.value.length || l.value.some((f) => f.errors.length) ||
|
|
651
|
+
const s = E(new Array()), l = E([]), c = E([]), h = le(
|
|
652
|
+
() => !!s.value.length || l.value.some((f) => f.errors.length) || c.value.some((f) => f.errors.length)
|
|
660
653
|
), b = le(
|
|
661
|
-
() => !!l.value.length || !!
|
|
654
|
+
() => !!l.value.length || !!c.value.length
|
|
662
655
|
), { t: v } = X();
|
|
663
656
|
async function y(f) {
|
|
664
|
-
s.value = [], l.value = [],
|
|
657
|
+
s.value = [], l.value = [], c.value = [];
|
|
665
658
|
try {
|
|
666
659
|
a.value = !0;
|
|
667
660
|
const [t] = await Promise.all([
|
|
668
|
-
|
|
661
|
+
ze(f),
|
|
669
662
|
// fake buffer
|
|
670
663
|
new Promise((o) => setTimeout(o, 1e3))
|
|
671
664
|
]);
|
|
@@ -682,41 +675,41 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
682
675
|
);
|
|
683
676
|
return;
|
|
684
677
|
}
|
|
685
|
-
if (l.value = d.importCreateResult,
|
|
678
|
+
if (l.value = d.importCreateResult, c.value = d.importUpdateResult, !l.value.length && !c.value.length) {
|
|
686
679
|
s.value.push(v("inventory.ingredient.import.fileError.noData"));
|
|
687
680
|
return;
|
|
688
681
|
}
|
|
689
682
|
i.emitData(d);
|
|
690
683
|
} catch (t) {
|
|
691
|
-
|
|
684
|
+
m.open({
|
|
692
685
|
title: v("inventory.ingredient.import.fileError.unableToRead"),
|
|
693
686
|
message: t == null ? void 0 : t.message,
|
|
694
687
|
type: "error"
|
|
695
688
|
}), console.error("Error in reading file", t);
|
|
696
689
|
} finally {
|
|
697
|
-
s.value.length &&
|
|
690
|
+
s.value.length && m.open({
|
|
698
691
|
title: v("inventory.ingredient.import.fileError.invalidExcel"),
|
|
699
692
|
type: "error"
|
|
700
693
|
}), a.value = !1;
|
|
701
694
|
}
|
|
702
695
|
}
|
|
703
|
-
return
|
|
696
|
+
return qe(r, (f) => {
|
|
704
697
|
f && y(f);
|
|
705
698
|
}), (f, t) => {
|
|
706
|
-
const
|
|
707
|
-
return T(), w("div",
|
|
699
|
+
const S = M("FmCircularProgress"), _ = M("FmIcon"), d = M("FmButton");
|
|
700
|
+
return T(), w("div", ct, [
|
|
708
701
|
t[2] || (t[2] = $("div", { class: "fm-typo-en-body-md-400" }, "Import transfer templates from excel sheets.", -1)),
|
|
709
|
-
n.value ? (T(), w("div",
|
|
702
|
+
n.value ? (T(), w("div", mt, [
|
|
710
703
|
$("div", null, [
|
|
711
|
-
D(
|
|
704
|
+
D(S, {
|
|
712
705
|
size: "md",
|
|
713
706
|
color: "neutral-gray-200"
|
|
714
707
|
})
|
|
715
708
|
]),
|
|
716
709
|
t[1] || (t[1] = $("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "Loading...", -1))
|
|
717
|
-
])) : (T(), w(
|
|
718
|
-
D(
|
|
719
|
-
class:
|
|
710
|
+
])) : (T(), w(P, { key: 1 }, [
|
|
711
|
+
D(Ke, {
|
|
712
|
+
class: B({
|
|
720
713
|
"w-full": !0,
|
|
721
714
|
"h-[200px]": !r.value
|
|
722
715
|
}),
|
|
@@ -724,13 +717,13 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
724
717
|
onFileUpload: t[0] || (t[0] = (o) => r.value = o),
|
|
725
718
|
label: C(v)("inventory.ingredient.import.uploadTemplate"),
|
|
726
719
|
"button-label": C(v)("inventory.ingredient.import.selectFile")
|
|
727
|
-
},
|
|
720
|
+
}, Ve({ _: 2 }, [
|
|
728
721
|
r.value ? {
|
|
729
722
|
name: "default",
|
|
730
723
|
fn: G(({ openFileDialog: o }) => [
|
|
731
724
|
$("div", ut, [
|
|
732
725
|
$("div", {
|
|
733
|
-
class:
|
|
726
|
+
class: B([
|
|
734
727
|
"fm-corner-radius-md p-16 flex items-center gap-16",
|
|
735
728
|
{
|
|
736
729
|
"border border-fm-color-neutral-gray-100": a.value,
|
|
@@ -739,18 +732,18 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
739
732
|
}
|
|
740
733
|
])
|
|
741
734
|
}, [
|
|
742
|
-
a.value ? (T(),
|
|
735
|
+
a.value ? (T(), V(S, {
|
|
743
736
|
key: 0,
|
|
744
737
|
size: "md",
|
|
745
738
|
color: "neutral-gray-200"
|
|
746
|
-
})) : (T(),
|
|
739
|
+
})) : (T(), V(_, {
|
|
747
740
|
key: 1,
|
|
748
741
|
name: h.value ? "error" : "attach_file",
|
|
749
742
|
outline: "",
|
|
750
743
|
color: h.value ? "system-error-300" : void 0
|
|
751
744
|
}, null, 8, ["name", "color"])),
|
|
752
745
|
$("div", {
|
|
753
|
-
class:
|
|
746
|
+
class: B([
|
|
754
747
|
"fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center",
|
|
755
748
|
{
|
|
756
749
|
"text-fm-color-typo-disabled": a.value,
|
|
@@ -770,8 +763,8 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
770
763
|
]))
|
|
771
764
|
], 2),
|
|
772
765
|
s.value.length ? (T(), w("div", ft, [
|
|
773
|
-
(T(!0), w(
|
|
774
|
-
key:
|
|
766
|
+
(T(!0), w(P, null, j(s.value, (u, x) => (T(), w("div", {
|
|
767
|
+
key: x,
|
|
775
768
|
class: "flex gap-8 items-center"
|
|
776
769
|
}, [
|
|
777
770
|
D(_, {
|
|
@@ -789,19 +782,19 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
|
|
|
789
782
|
]), 1032, ["class", "label", "button-label"]),
|
|
790
783
|
b.value ? (T(), w("div", ht, [
|
|
791
784
|
$("div", vt, I(C(v)("inventory.ingredient.import.summary")), 1),
|
|
792
|
-
(T(!0), w(
|
|
785
|
+
(T(!0), w(P, null, j(l.value, (o, u) => (T(), V(me, {
|
|
793
786
|
key: u,
|
|
794
787
|
name: o.template.name,
|
|
795
|
-
"transfer-type": typeof o.template.purchaseOrder.supplier.internal == "string" ? C(
|
|
788
|
+
"transfer-type": typeof o.template.purchaseOrder.supplier.internal == "string" ? C(R).TRANSFER : C(R).PURCHASE,
|
|
796
789
|
locations: o.template.locations,
|
|
797
790
|
items: o.template.purchaseOrder.items,
|
|
798
791
|
errors: o.errors,
|
|
799
792
|
type: "create"
|
|
800
793
|
}, null, 8, ["name", "transfer-type", "locations", "items", "errors"]))), 128)),
|
|
801
|
-
(T(!0), w(
|
|
794
|
+
(T(!0), w(P, null, j(c.value, (o) => (T(), V(me, {
|
|
802
795
|
key: o.template._id,
|
|
803
796
|
name: o.template.name,
|
|
804
|
-
"transfer-type": typeof o.template.purchaseOrder.supplier.internal == "string" ? C(
|
|
797
|
+
"transfer-type": typeof o.template.purchaseOrder.supplier.internal == "string" ? C(R).TRANSFER : C(R).PURCHASE,
|
|
805
798
|
locations: o.template.locations,
|
|
806
799
|
items: o.template.purchaseOrder.items,
|
|
807
800
|
errors: o.errors,
|
|
@@ -818,17 +811,17 @@ function bt(e) {
|
|
|
818
811
|
const r = ge();
|
|
819
812
|
if (!r.isEnabled) return !0;
|
|
820
813
|
if (!e.internal) {
|
|
821
|
-
const s = r.getNetSuiteVendor(e._id), l = s == null ? void 0 : s.subsidiaryId,
|
|
822
|
-
return l && l ==
|
|
814
|
+
const s = r.getNetSuiteVendor(e._id), l = s == null ? void 0 : s.subsidiaryId, c = (n = r.currentVendorSubsidiary(e._id)) == null ? void 0 : n.id;
|
|
815
|
+
return l && l == c;
|
|
823
816
|
}
|
|
824
|
-
const i = r.getNetSuiteLocation(`${e.internal}_${e._id}`),
|
|
825
|
-
return
|
|
817
|
+
const i = r.getNetSuiteLocation(`${e.internal}_${e._id}`), m = r.getLocationSubsidiary(i == null ? void 0 : i.netSuiteId).id, a = (p = r.currentLocationSubsidiary()) == null ? void 0 : p.id;
|
|
818
|
+
return m && m == a;
|
|
826
819
|
}
|
|
827
|
-
const
|
|
828
|
-
const e =
|
|
829
|
-
function
|
|
820
|
+
const xt = pe("transferTemplateActions", () => {
|
|
821
|
+
const e = Qe(), r = de(), i = z(), m = $e(), a = be(), n = ge(), p = je(), { t: s } = X(), l = E({});
|
|
822
|
+
function c() {
|
|
830
823
|
l.value = {
|
|
831
|
-
mode:
|
|
824
|
+
mode: oe.CREATE,
|
|
832
825
|
show: !0,
|
|
833
826
|
"onUpdate:show"(d) {
|
|
834
827
|
l.value.show = d;
|
|
@@ -837,7 +830,7 @@ const St = pe("transferTemplateActions", () => {
|
|
|
837
830
|
}
|
|
838
831
|
function h(d) {
|
|
839
832
|
l.value = {
|
|
840
|
-
mode:
|
|
833
|
+
mode: oe.UPDATE,
|
|
841
834
|
modelValue: d,
|
|
842
835
|
show: !0,
|
|
843
836
|
"onUpdate:show"(o) {
|
|
@@ -851,12 +844,12 @@ const St = pe("transferTemplateActions", () => {
|
|
|
851
844
|
message: "Deleted template can no longer be retrieved",
|
|
852
845
|
primaryActions: {
|
|
853
846
|
text: "Delete",
|
|
854
|
-
variant:
|
|
847
|
+
variant: se.Destructive,
|
|
855
848
|
close: !0
|
|
856
849
|
},
|
|
857
850
|
secondaryActions: {
|
|
858
851
|
text: "Cancel",
|
|
859
|
-
variant:
|
|
852
|
+
variant: se.Plain,
|
|
860
853
|
close: !0
|
|
861
854
|
}
|
|
862
855
|
}).onPrimary(async () => {
|
|
@@ -866,27 +859,27 @@ const St = pe("transferTemplateActions", () => {
|
|
|
866
859
|
});
|
|
867
860
|
try {
|
|
868
861
|
o.value = !0;
|
|
869
|
-
const [
|
|
862
|
+
const [x] = await Promise.allSettled([
|
|
870
863
|
a.deleteTemplate(d),
|
|
871
864
|
new Promise((k) => setTimeout(k, 1e3))
|
|
872
865
|
]);
|
|
873
|
-
if (
|
|
866
|
+
if (x.status === "rejected") throw x.reason;
|
|
874
867
|
r.open({
|
|
875
868
|
title: `Deleted ${d.name}`,
|
|
876
869
|
type: "success"
|
|
877
870
|
});
|
|
878
|
-
} catch (
|
|
871
|
+
} catch (x) {
|
|
879
872
|
r.open({
|
|
880
873
|
title: `Unable to delete ${d.name}`,
|
|
881
|
-
message: `See error from server: ${
|
|
874
|
+
message: `See error from server: ${x}`,
|
|
882
875
|
type: "error"
|
|
883
|
-
}), console.error("error on deleting purchase order template",
|
|
876
|
+
}), console.error("error on deleting purchase order template", x);
|
|
884
877
|
} finally {
|
|
885
878
|
o.value = !1, u();
|
|
886
879
|
}
|
|
887
880
|
});
|
|
888
881
|
}
|
|
889
|
-
const v =
|
|
882
|
+
const v = E({});
|
|
890
883
|
function y(d) {
|
|
891
884
|
v.value = {
|
|
892
885
|
template: d,
|
|
@@ -902,13 +895,13 @@ const St = pe("transferTemplateActions", () => {
|
|
|
902
895
|
function f() {
|
|
903
896
|
const { promise: d, resolve: o } = Promise.withResolvers(), u = (g) => {
|
|
904
897
|
o(g);
|
|
905
|
-
},
|
|
898
|
+
}, x = m.templates.filter(
|
|
906
899
|
(g) => {
|
|
907
|
-
var
|
|
908
|
-
return (!g.locations || g.locations.find((F) => F.doc._id === i.currentLocation.doc._id)) && ((
|
|
900
|
+
var N;
|
|
901
|
+
return (!g.locations || g.locations.find((F) => F.doc._id === i.currentLocation.doc._id)) && ((N = g.purchaseOrder.supplier) == null ? void 0 : N._id) !== i.currentLocation.doc._id;
|
|
909
902
|
}
|
|
910
903
|
);
|
|
911
|
-
if (!
|
|
904
|
+
if (!x.length)
|
|
912
905
|
return e.open({
|
|
913
906
|
title: "Select one template",
|
|
914
907
|
message: "There is no available template in your business. Configure a new template?",
|
|
@@ -921,24 +914,24 @@ const St = pe("transferTemplateActions", () => {
|
|
|
921
914
|
close: !0
|
|
922
915
|
}
|
|
923
916
|
}).onPrimary(() => {
|
|
924
|
-
p.push({ name:
|
|
917
|
+
p.push({ name: ae.TRANSFER_TEMPLATE }), u(void 0);
|
|
925
918
|
}).onSecondary(() => u(void 0)).onClose(() => u(void 0)), d;
|
|
926
|
-
const k =
|
|
919
|
+
const k = x.map((g) => {
|
|
927
920
|
var re;
|
|
928
|
-
const
|
|
921
|
+
const N = !g.purchaseOrder.items.length || g.purchaseOrder.items.some(xe), F = !bt(g.purchaseOrder.supplier), K = g.purchaseOrder.supplier.internal ? n.getNetSuiteLocation(
|
|
929
922
|
`${g.purchaseOrder.supplier.internal}_${g.purchaseOrder.supplier._id}`
|
|
930
923
|
) : n.getNetSuiteVendor(g.purchaseOrder.supplier._id), we = F ? `The subsidiary of the request
|
|
931
|
-
location is ${(re = n.getLocationSubsidiary(K == null ? void 0 : K.netSuiteId)) == null ? void 0 : re.fullName}.` : void 0, ke =
|
|
924
|
+
location is ${(re = n.getLocationSubsidiary(K == null ? void 0 : K.netSuiteId)) == null ? void 0 : re.fullName}.` : void 0, ke = N || F, Ee = N ? "This template is invalid. Update this template." : F ? we : void 0, Re = `${g.purchaseOrder.supplier.internal ? "Transfer" : "Purchase"} from ${g.purchaseOrder.supplier.name}`;
|
|
932
925
|
return {
|
|
933
926
|
label: g.name,
|
|
934
927
|
value: g._id,
|
|
935
928
|
disabled: ke,
|
|
936
|
-
sublabel:
|
|
929
|
+
sublabel: Ee ?? Re
|
|
937
930
|
};
|
|
938
931
|
});
|
|
939
|
-
return k.sort((g,
|
|
932
|
+
return k.sort((g, N) => +!!g.disabled - +!!N.disabled), e.open({
|
|
940
933
|
title: "Select one template",
|
|
941
|
-
contentComponent:
|
|
934
|
+
contentComponent: Pe,
|
|
942
935
|
contentComponentProps: {
|
|
943
936
|
items: k,
|
|
944
937
|
singleSelect: !0
|
|
@@ -956,7 +949,7 @@ const St = pe("transferTemplateActions", () => {
|
|
|
956
949
|
close: !0
|
|
957
950
|
}
|
|
958
951
|
}).onPrimary((g) => Array.isArray(g) ? u(g[0]) : null).onSecondary(() => u(void 0)).onTertiary(() => {
|
|
959
|
-
p.push({ name:
|
|
952
|
+
p.push({ name: ae.TRANSFER_TEMPLATE }), u(void 0);
|
|
960
953
|
}).onClose(() => u(void 0)), d;
|
|
961
954
|
}
|
|
962
955
|
function t() {
|
|
@@ -1002,10 +995,10 @@ const St = pe("transferTemplateActions", () => {
|
|
|
1002
995
|
});
|
|
1003
996
|
return;
|
|
1004
997
|
}
|
|
1005
|
-
e.close(),
|
|
998
|
+
e.close(), S(d);
|
|
1006
999
|
}).onTertiary(Ye);
|
|
1007
1000
|
}
|
|
1008
|
-
async function
|
|
1001
|
+
async function S(d) {
|
|
1009
1002
|
try {
|
|
1010
1003
|
const o = [
|
|
1011
1004
|
...d.importCreateResult.map(
|
|
@@ -1015,11 +1008,11 @@ const St = pe("transferTemplateActions", () => {
|
|
|
1015
1008
|
(g) => g.template
|
|
1016
1009
|
)
|
|
1017
1010
|
], u = 100;
|
|
1018
|
-
let
|
|
1011
|
+
let x = 0;
|
|
1019
1012
|
const k = () => {
|
|
1020
|
-
|
|
1013
|
+
x += u, r.open({
|
|
1021
1014
|
title: s("inventory.ingredient.import.progress", [
|
|
1022
|
-
Math.min(
|
|
1015
|
+
Math.min(x, o.length),
|
|
1023
1016
|
o.length
|
|
1024
1017
|
])
|
|
1025
1018
|
});
|
|
@@ -1037,11 +1030,11 @@ const St = pe("transferTemplateActions", () => {
|
|
|
1037
1030
|
type: "error"
|
|
1038
1031
|
}), console.error("Error in importing skus", d, o);
|
|
1039
1032
|
} finally {
|
|
1040
|
-
|
|
1033
|
+
m.fetchTemplates();
|
|
1041
1034
|
}
|
|
1042
1035
|
}
|
|
1043
1036
|
function _() {
|
|
1044
|
-
const d = We(
|
|
1037
|
+
const d = We(m.templates);
|
|
1045
1038
|
r.open({
|
|
1046
1039
|
title: s("inventory.ingredient.export.success"),
|
|
1047
1040
|
message: s("inventory.ingredient.export.filename", [d]),
|
|
@@ -1049,7 +1042,7 @@ const St = pe("transferTemplateActions", () => {
|
|
|
1049
1042
|
});
|
|
1050
1043
|
}
|
|
1051
1044
|
return {
|
|
1052
|
-
createTemplate:
|
|
1045
|
+
createTemplate: c,
|
|
1053
1046
|
viewTemplate: y,
|
|
1054
1047
|
updateTemplate: h,
|
|
1055
1048
|
deleteTemplate: b,
|
|
@@ -1062,13 +1055,13 @@ const St = pe("transferTemplateActions", () => {
|
|
|
1062
1055
|
});
|
|
1063
1056
|
function ue(e) {
|
|
1064
1057
|
const { skuById: r } = L(), i = Z(e);
|
|
1065
|
-
return i.purchaseOrder.items = e.purchaseOrder.items.filter((
|
|
1058
|
+
return i.purchaseOrder.items = e.purchaseOrder.items.filter((m) => r[m.sku._id]), i;
|
|
1066
1059
|
}
|
|
1067
1060
|
const $e = pe(
|
|
1068
1061
|
"transferTemplateTable",
|
|
1069
1062
|
function() {
|
|
1070
|
-
const { t: r } = X(), { viewTemplate: i, updateTemplate:
|
|
1071
|
-
async function
|
|
1063
|
+
const { t: r } = X(), { viewTemplate: i, updateTemplate: m, deleteTemplate: a } = xt(), n = E(!1), p = E(new Array()), s = be(), l = L();
|
|
1064
|
+
async function c() {
|
|
1072
1065
|
p.value = [], n.value = !0;
|
|
1073
1066
|
try {
|
|
1074
1067
|
const [y] = await Promise.all([
|
|
@@ -1098,12 +1091,12 @@ const $e = pe(
|
|
|
1098
1091
|
}
|
|
1099
1092
|
function b(y, f) {
|
|
1100
1093
|
switch (f = Z(f), y) {
|
|
1101
|
-
case
|
|
1094
|
+
case A.Details:
|
|
1102
1095
|
return i(f);
|
|
1103
|
-
case
|
|
1104
|
-
return
|
|
1105
|
-
case
|
|
1106
|
-
return a(f, n,
|
|
1096
|
+
case A.Edit:
|
|
1097
|
+
return m(f);
|
|
1098
|
+
case A.Delete:
|
|
1099
|
+
return a(f, n, c);
|
|
1107
1100
|
}
|
|
1108
1101
|
}
|
|
1109
1102
|
return {
|
|
@@ -1113,7 +1106,7 @@ const $e = pe(
|
|
|
1113
1106
|
accessorKey: "_id",
|
|
1114
1107
|
header: () => r("inventory.transfer.table.createdAt"),
|
|
1115
1108
|
cell(y) {
|
|
1116
|
-
return
|
|
1109
|
+
return Ue(`${y.getValue()}`);
|
|
1117
1110
|
},
|
|
1118
1111
|
enableSorting: !0
|
|
1119
1112
|
},
|
|
@@ -1134,17 +1127,17 @@ const $e = pe(
|
|
|
1134
1127
|
textAlign: "right"
|
|
1135
1128
|
},
|
|
1136
1129
|
cell(y) {
|
|
1137
|
-
const f = Number(y.getValue()) || 0, t = y.row.original.purchaseOrder.items.some(
|
|
1130
|
+
const f = Number(y.getValue()) || 0, t = y.row.original.purchaseOrder.items.some(xe);
|
|
1138
1131
|
return f === 0 || t ? Y("div", { class: "flex justify-end gap-4 items-center" }, [
|
|
1139
1132
|
Y(
|
|
1140
|
-
|
|
1133
|
+
ie.FmTooltip,
|
|
1141
1134
|
{},
|
|
1142
1135
|
{
|
|
1143
1136
|
content() {
|
|
1144
1137
|
return t ? "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.";
|
|
1145
1138
|
},
|
|
1146
1139
|
default() {
|
|
1147
|
-
return Y(
|
|
1140
|
+
return Y(ie.FmIcon, {
|
|
1148
1141
|
name: "error",
|
|
1149
1142
|
color: "system-error-300",
|
|
1150
1143
|
size: "sm"
|
|
@@ -1182,11 +1175,11 @@ const $e = pe(
|
|
|
1182
1175
|
id: "action",
|
|
1183
1176
|
cell(y) {
|
|
1184
1177
|
const f = y.row.original, t = [
|
|
1185
|
-
W[
|
|
1186
|
-
W[
|
|
1187
|
-
W[
|
|
1178
|
+
W[A.Details],
|
|
1179
|
+
W[A.Edit],
|
|
1180
|
+
W[A.Delete]
|
|
1188
1181
|
];
|
|
1189
|
-
return
|
|
1182
|
+
return Me(t, (S) => b(S, f));
|
|
1190
1183
|
},
|
|
1191
1184
|
enableSorting: !1,
|
|
1192
1185
|
size: 40,
|
|
@@ -1198,20 +1191,20 @@ const $e = pe(
|
|
|
1198
1191
|
],
|
|
1199
1192
|
templates: p,
|
|
1200
1193
|
loading: n,
|
|
1201
|
-
fetchTemplates:
|
|
1194
|
+
fetchTemplates: c,
|
|
1202
1195
|
loadTemplate: h
|
|
1203
1196
|
};
|
|
1204
1197
|
}
|
|
1205
1198
|
);
|
|
1206
|
-
function
|
|
1207
|
-
const
|
|
1208
|
-
return `${
|
|
1199
|
+
function At(e, r, i) {
|
|
1200
|
+
const m = (i == null ? void 0 : i.abbrev) ?? r.abbrev;
|
|
1201
|
+
return `${O(e, !1)} ${m}`;
|
|
1209
1202
|
}
|
|
1210
1203
|
export {
|
|
1211
|
-
|
|
1204
|
+
R as P,
|
|
1212
1205
|
be as a,
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1206
|
+
xt as b,
|
|
1207
|
+
At as f,
|
|
1208
|
+
xe as t,
|
|
1216
1209
|
$e as u
|
|
1217
1210
|
};
|