@feedmepos/mf-inventory-portal 1.1.2 → 1.1.3-dev.2
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-BhEtjLqO.js → App-Y70p19Gp.js} +1 -1
- package/dist/ApprovalView-BVyt_mNb.js +219 -0
- package/dist/{BindingsDialog-CX3Hu_r6.js → BindingsDialog-BULs3OTl.js} +4 -4
- package/dist/{BindingsPicker-BbinQ8Hl.js → BindingsPicker-DpAk5M6U.js} +1 -1
- package/dist/{BindingsTable-DxlSz6Ev.js → BindingsTable-DzQzbNFw.js} +4 -4
- package/dist/ClosingDraftView-BpRIs-2B.js +1676 -0
- package/dist/{ClosingTemplateView-CB9_JOl4.js → ClosingTemplateView-B-kRLpTZ.js} +487 -473
- package/dist/{DeliveryOrderPrintPreview-BlE3fIAT.js → DeliveryOrderPrintPreview-CSZndykZ.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DxKFFyWs.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CDvzOUsD.js} +3 -3
- package/dist/{FmMultiselectDialog-DcviKwNR.js → FmMultiselectDialog-DSJ2MFmR.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-CepHeClt.js → FmUnitInput.vue_vue_type_script_setup_true_lang-XUPKPUMs.js} +1 -1
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-Dg8VdQzg.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-c0_HwN-t.js} +1 -1
- package/dist/{IngredientGroupView-EE8lN8JL.js → IngredientGroupView-DQ-EBjd-.js} +2 -2
- package/dist/{IngredientsView-BkDpHVvn.js → IngredientsView-CQgltl5_.js} +4 -4
- package/dist/{IntegrationView-Bj7sb1gO.js → IntegrationView-CNcVeIFO.js} +1170 -1141
- package/dist/{InventoryBindingForm-BkazprFH.js → InventoryBindingForm-BuKXc_Sa.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BbQqYyzL.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DQaufX7H.js} +3 -3
- package/dist/{InventoryBindingSummary-D0XiOdR4.js → InventoryBindingSummary-D68_zXou.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Pf8BPDZw.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-d2nPZ3lt.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-D2Tx3xSj.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DkRWn5u5.js} +1 -1
- package/dist/{PublishView-BUIcrw8m.js → PublishView-CpQ71JIU.js} +18 -18
- package/dist/{PurchaseOrderPrintPreview-lO7Bilm5.js → PurchaseOrderPrintPreview-DZo7aY7C.js} +1 -1
- package/dist/{ReceiveRequestView-BZV-8Ib3.js → ReceiveRequestView-C4546P-_.js} +697 -694
- package/dist/{RecipeView-2Tm12Zuk.js → RecipeView-BRwqCYV9.js} +3 -3
- package/dist/{StockView-DaWS_HQl.js → StockView-cvnJr_oX.js} +6 -6
- package/dist/{SupplierView-nfxqynuY.js → SupplierView-DwS-SiXQ.js} +648 -646
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-B2NLmIxb.js +2280 -0
- package/dist/{TransferTemplateView-CGjfCELA.js → TransferTemplateView-CGKjXln1.js} +6 -6
- package/dist/{UnitView-Cm5WuuEN.js → UnitView-BabatKhp.js} +3 -3
- package/dist/{WarehouseView-BSLX0g3B.js → WarehouseView-BtEuG-Iw.js} +1 -1
- package/dist/api/duplicate-template.d.ts +3 -3
- package/dist/api/netsuite.d.ts +1 -0
- package/dist/{app-CnDLBWW7.js → app-cN81pzZd.js} +23769 -23459
- package/dist/app.d.ts +9 -0
- package/dist/app.js +5 -5
- package/dist/{decimal-DmezA5YT.js → decimal-CC3JyA3f.js} +1 -1
- package/dist/{format-unit-display-Bcq6wldv.js → format-unit-display-B7SHcLn9.js} +216 -202
- package/dist/{index-C476dvi7.js → index-D-5LSVee.js} +2686 -2650
- package/dist/{index-R97nRHsF.js → index-DldWujwI.js} +1 -1
- package/dist/{stock-Dd0YSjSF.js → stock-DBkA5bTB.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{supplier-C4s3SHui.js → supplier-C_xP9tgW.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-DaXBOLhz.js → use-ingredient-select-dialog-mXti22kH.js} +1 -1
- package/dist/{use-inventory-binding-dialog-CsFwoUbg.js → use-inventory-binding-dialog-0b-ngROc.js} +1 -1
- package/dist/views/closing-draft/components/closing-draft-action/RefreshBalanceAction.vue.d.ts +19 -0
- package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +4 -1
- package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +8 -0
- package/dist/views/receive-request/composables/fn.d.ts +32 -0
- package/dist/{vue-i18n-CdkMdZ30.js → vue-i18n-DB3u4gQS.js} +492 -492
- package/package.json +4 -4
- package/dist/ApprovalView-BHIVSsbz.js +0 -213
- package/dist/ClosingDraftView-B5gQ2k-T.js +0 -1520
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-g74nRiM0.js +0 -2213
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { a3 as
|
|
2
|
-
import { useCoreStore as
|
|
3
|
-
import { useDialogChild as
|
|
4
|
-
import { defineStore as
|
|
5
|
-
import { defineComponent as
|
|
1
|
+
import { a3 as Ae, a as q, T as Ie, ag as M, s as De, ah as he, v as ve, u as J, j as B, w as Oe, aK as ce, x as ge, b as te, t as G, Y as Z, aJ as Fe, aB as Pe, a0 as Ue, y as Me, z as Be, ai as Le, e as me, f as re, R as ue, a2 as Qe, af as He, D as j, i as I, h as Ve } from "./app-cN81pzZd.js";
|
|
2
|
+
import { useCoreStore as ne, useI18n as oe } from "@feedmepos/mf-common";
|
|
3
|
+
import { useDialogChild as qe, useSnackbar as be, useDialog as je, FmButtonVariant as z, components as X } from "@feedmepos/ui-library";
|
|
4
|
+
import { defineStore as xe } from "pinia";
|
|
5
|
+
import { defineComponent as ae, resolveComponent as Q, openBlock as _, createElementBlock as k, createElementVNode as C, normalizeClass as H, createTextVNode as ze, toDisplayString as D, unref as A, createCommentVNode as V, createVNode as P, withCtx as ee, Fragment as L, renderList as Y, ref as R, onMounted as Ke, computed as de, watch as Ye, createSlots as We, createBlock as K, h as W } from "vue";
|
|
6
6
|
import { useRouter as Ge } from "vue-router";
|
|
7
|
-
import { u as
|
|
8
|
-
const
|
|
7
|
+
import { u as se } from "./supplier-C_xP9tgW.js";
|
|
8
|
+
const Te = Ae((e, t) => {
|
|
9
9
|
function s() {
|
|
10
10
|
var o;
|
|
11
|
-
return `business_${((o =
|
|
11
|
+
return `business_${((o = ne().currentBusiness.value) == null ? void 0 : o._id) ?? ""}`;
|
|
12
12
|
}
|
|
13
13
|
return {
|
|
14
14
|
async getTemplate(l) {
|
|
@@ -37,14 +37,14 @@ const Se = Ie((e, t) => {
|
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
});
|
|
40
|
-
function
|
|
41
|
-
const t =
|
|
40
|
+
function Se(e) {
|
|
41
|
+
const t = q(), s = e.sku, l = t.skuById[s._id];
|
|
42
42
|
if (l.unit._id !== s.unit._id) return !0;
|
|
43
43
|
const i = e.measurement;
|
|
44
44
|
return i ? !t.unitById[l.unit._id].measurements.find((c) => c.id === i.id) : !1;
|
|
45
45
|
}
|
|
46
|
-
var
|
|
47
|
-
const
|
|
46
|
+
var N = /* @__PURE__ */ ((e) => (e.PURCHASE = "PURCHASE", e.TRANSFER = "TRANSFER", e))(N || {}), ie = /* @__PURE__ */ ((e) => (e.Source = "Source", e.Destination = "Destination", e.Ingredient = "Ingredient", e))(ie || {});
|
|
47
|
+
const pe = Ie(0);
|
|
48
48
|
function _e(e) {
|
|
49
49
|
var l;
|
|
50
50
|
const t = e.sku;
|
|
@@ -54,8 +54,8 @@ function _e(e) {
|
|
|
54
54
|
name: t.name,
|
|
55
55
|
unit: ((l = t.unit.measurements.find((i) => i.id === t.trackingMeasurement)) == null ? void 0 : l.abbrev) ?? t.unit.abbrev,
|
|
56
56
|
defaultQuantity: +B(e.quantity),
|
|
57
|
-
minimumQuantity: +B(e.minimumQuantity ??
|
|
58
|
-
maximumQuantity: +B(e.maximumQuantity ??
|
|
57
|
+
minimumQuantity: +B(e.minimumQuantity ?? pe),
|
|
58
|
+
maximumQuantity: +B(e.maximumQuantity ?? pe),
|
|
59
59
|
quantityStep: +B(e.quantityStep)
|
|
60
60
|
};
|
|
61
61
|
}
|
|
@@ -97,8 +97,8 @@ function $e() {
|
|
|
97
97
|
}
|
|
98
98
|
function Je(e) {
|
|
99
99
|
var c;
|
|
100
|
-
const s =
|
|
101
|
-
var
|
|
100
|
+
const s = ne().currentBusiness.value, i = (c = e.map((a) => {
|
|
101
|
+
var b;
|
|
102
102
|
const m = a.purchaseOrder.items.map((r) => _e(r)), h = $e(), d = [
|
|
103
103
|
["Template ID", a._id],
|
|
104
104
|
["Template name", a.name],
|
|
@@ -107,7 +107,7 @@ function Je(e) {
|
|
|
107
107
|
["Menu version", s == null ? void 0 : s.menuVersion],
|
|
108
108
|
[
|
|
109
109
|
"Purchase/Transfer",
|
|
110
|
-
typeof a.purchaseOrder.supplier.internal == "string" ?
|
|
110
|
+
typeof a.purchaseOrder.supplier.internal == "string" ? N.TRANSFER : N.PURCHASE
|
|
111
111
|
],
|
|
112
112
|
[
|
|
113
113
|
"Transfer from",
|
|
@@ -118,7 +118,7 @@ function Je(e) {
|
|
|
118
118
|
],
|
|
119
119
|
[
|
|
120
120
|
"Locations",
|
|
121
|
-
...(
|
|
121
|
+
...(b = a.locations) != null && b.length ? a.locations.map((r) => `${r.name} (${r.dbName})`) : ["All"]
|
|
122
122
|
],
|
|
123
123
|
["Reference", a.purchaseOrder.ref ?? ""],
|
|
124
124
|
["Remark", a.purchaseOrder.remark ?? ""],
|
|
@@ -137,11 +137,11 @@ function Je(e) {
|
|
|
137
137
|
sheets: {},
|
|
138
138
|
sheetOccurence: {}
|
|
139
139
|
}
|
|
140
|
-
)) == null ? void 0 : c.sheets, o = `${s == null ? void 0 : s.name} transfer templates (${De(/* @__PURE__ */ new Date())}).xlsx`, f =
|
|
141
|
-
return
|
|
140
|
+
)) == null ? void 0 : c.sheets, o = `${s == null ? void 0 : s.name} transfer templates (${De(/* @__PURE__ */ new Date())}).xlsx`, f = he(i);
|
|
141
|
+
return ve(f, o), o;
|
|
142
142
|
}
|
|
143
143
|
function Ze() {
|
|
144
|
-
const e =
|
|
144
|
+
const e = ne(), t = se(), s = J(), l = q(), i = e.currentBusiness.value, o = _e({
|
|
145
145
|
sku: {
|
|
146
146
|
unit: {
|
|
147
147
|
_id: "",
|
|
@@ -207,13 +207,13 @@ function Ze() {
|
|
|
207
207
|
r.address.country
|
|
208
208
|
]),
|
|
209
209
|
...s.locations.map((r) => {
|
|
210
|
-
var x,
|
|
210
|
+
var x, $, T, p, n, y;
|
|
211
211
|
return [
|
|
212
212
|
`${r.name} (${r.dbName})`,
|
|
213
213
|
"Transfer",
|
|
214
214
|
(x = r.doc.profile.address) == null ? void 0 : x.line1,
|
|
215
|
-
(
|
|
216
|
-
(
|
|
215
|
+
($ = r.doc.profile.address) == null ? void 0 : $.line2,
|
|
216
|
+
(T = r.doc.profile.address) == null ? void 0 : T.city,
|
|
217
217
|
(p = r.doc.profile.address) == null ? void 0 : p.postcode,
|
|
218
218
|
(n = r.doc.profile.address) == null ? void 0 : n.state,
|
|
219
219
|
(y = r.doc.profile.address) == null ? void 0 : y.country
|
|
@@ -223,12 +223,12 @@ function Ze() {
|
|
|
223
223
|
["Name", "Type", "Line 1", "Line 2", "City", "Postal", "State", "Country"]
|
|
224
224
|
), d = M(
|
|
225
225
|
s.locations.map((r) => {
|
|
226
|
-
var x,
|
|
226
|
+
var x, $, T, p, n, y;
|
|
227
227
|
return [
|
|
228
228
|
`${r.name} (${r.dbName})`,
|
|
229
229
|
(x = r.doc.profile.address) == null ? void 0 : x.line1,
|
|
230
|
-
(
|
|
231
|
-
(
|
|
230
|
+
($ = r.doc.profile.address) == null ? void 0 : $.line2,
|
|
231
|
+
(T = r.doc.profile.address) == null ? void 0 : T.city,
|
|
232
232
|
(p = r.doc.profile.address) == null ? void 0 : p.postcode,
|
|
233
233
|
(n = r.doc.profile.address) == null ? void 0 : n.state,
|
|
234
234
|
(y = r.doc.profile.address) == null ? void 0 : y.country
|
|
@@ -243,16 +243,16 @@ function Ze() {
|
|
|
243
243
|
...r.unit.measurements.map((x) => x.abbrev)
|
|
244
244
|
]),
|
|
245
245
|
["Code", "Name", "Base unit", "Measurements"]
|
|
246
|
-
), v =
|
|
246
|
+
), v = he({
|
|
247
247
|
Template: m,
|
|
248
248
|
Source: h,
|
|
249
249
|
Destination: d,
|
|
250
250
|
Ingredient: u
|
|
251
|
-
}),
|
|
252
|
-
return
|
|
251
|
+
}), b = `${i == null ? void 0 : i.name} transfer templates import.xlsx`;
|
|
252
|
+
return ve(v, b), b;
|
|
253
253
|
}
|
|
254
254
|
function Xe(e, t) {
|
|
255
|
-
const s = new Array(), l = /(.*) \(((supplier_|warehouse_|restaurant_).{24,})\)/, o =
|
|
255
|
+
const s = new Array(), l = /(.*) \(((supplier_|warehouse_|restaurant_).{24,})\)/, o = J().locationByDbName, c = se().supplierById, a = e.trim(), m = l.exec(a);
|
|
256
256
|
if (!m)
|
|
257
257
|
return s.push(`Transfer from location value of ${a} cannot be read.`), {
|
|
258
258
|
errors: s
|
|
@@ -260,7 +260,7 @@ function Xe(e, t) {
|
|
|
260
260
|
const h = m[1], d = m[2];
|
|
261
261
|
let u;
|
|
262
262
|
if (d.startsWith("supplier"))
|
|
263
|
-
u = c[d], t !==
|
|
263
|
+
u = c[d], t !== N.PURCHASE && s.push(`Expected transfer type Purchase but found ${t} instead.`);
|
|
264
264
|
else {
|
|
265
265
|
const v = o[d];
|
|
266
266
|
if (!v)
|
|
@@ -280,7 +280,7 @@ function Xe(e, t) {
|
|
|
280
280
|
postcode: "",
|
|
281
281
|
coordinates: [0, 0]
|
|
282
282
|
},
|
|
283
|
-
internal: d.split("_")[0] === "restaurant" ?
|
|
283
|
+
internal: d.split("_")[0] === "restaurant" ? ce.enum.restaurant : ce.enum.warehouse,
|
|
284
284
|
phoneNumber: v.doc.profile.phoneNo ?? "",
|
|
285
285
|
email: v.doc.profile.email ?? "",
|
|
286
286
|
_rev: "",
|
|
@@ -296,7 +296,7 @@ function Xe(e, t) {
|
|
|
296
296
|
function et(e) {
|
|
297
297
|
if (!e.length || `${e[0]}`.toLocaleLowerCase() === "all")
|
|
298
298
|
return [];
|
|
299
|
-
const t = /(.*) \(((warehouse_|restaurant_).{24,})\)/, l =
|
|
299
|
+
const t = /(.*) \(((warehouse_|restaurant_).{24,})\)/, l = J().locationByDbName;
|
|
300
300
|
return e.map((i) => {
|
|
301
301
|
const o = new Array(), f = i.trim(), c = t.exec(f);
|
|
302
302
|
if (!c)
|
|
@@ -327,11 +327,11 @@ function tt(e) {
|
|
|
327
327
|
m,
|
|
328
328
|
h,
|
|
329
329
|
d
|
|
330
|
-
] =
|
|
330
|
+
] = ge(e);
|
|
331
331
|
return {
|
|
332
332
|
id: `${s[1] ?? ""}`.trim(),
|
|
333
333
|
name: `${l[1] ?? ""}`.trim(),
|
|
334
|
-
type: `${c[1] ?? ""}`.trim().toLocaleLowerCase() === "transfer" ?
|
|
334
|
+
type: `${c[1] ?? ""}`.trim().toLocaleLowerCase() === "transfer" ? N.TRANSFER : N.PURCHASE,
|
|
335
335
|
transferFrom: `${a[1] ?? ""}`.trim(),
|
|
336
336
|
locations: m.slice(1).map((u) => `${u}`.trim()).filter((u) => u),
|
|
337
337
|
reference: `${h[1] ?? ""}`.trim(),
|
|
@@ -353,11 +353,11 @@ function rt(e) {
|
|
|
353
353
|
d,
|
|
354
354
|
u,
|
|
355
355
|
v,
|
|
356
|
-
...
|
|
357
|
-
] =
|
|
356
|
+
...b
|
|
357
|
+
] = ge(e);
|
|
358
358
|
if (!t || !t.length || t.some((p) => p.length && !p.startsWith("system:")))
|
|
359
359
|
throw new Error("Missing meta header. Excel file does not come from the template.");
|
|
360
|
-
const r = t.map((p) => p.split(":")[1]),
|
|
360
|
+
const r = t.map((p) => p.split(":")[1]), $ = [
|
|
361
361
|
"code",
|
|
362
362
|
"name",
|
|
363
363
|
"unit",
|
|
@@ -366,15 +366,15 @@ function rt(e) {
|
|
|
366
366
|
"maximumQuantity",
|
|
367
367
|
"quantityStep"
|
|
368
368
|
].filter((p) => !r.includes(p));
|
|
369
|
-
if (
|
|
369
|
+
if ($.length)
|
|
370
370
|
throw new Error(
|
|
371
|
-
`Missing meta headers (${
|
|
371
|
+
`Missing meta headers (${$.join()}). Excel file does not come from the template.`
|
|
372
372
|
);
|
|
373
|
-
return
|
|
373
|
+
return b.map((p, n) => {
|
|
374
374
|
const y = {};
|
|
375
|
-
for (const
|
|
376
|
-
const
|
|
377
|
-
Object.assign(y, { [
|
|
375
|
+
for (const S in r) {
|
|
376
|
+
const w = r[S];
|
|
377
|
+
Object.assign(y, { [w]: p[S] });
|
|
378
378
|
}
|
|
379
379
|
return {
|
|
380
380
|
index: n,
|
|
@@ -383,7 +383,7 @@ function rt(e) {
|
|
|
383
383
|
});
|
|
384
384
|
}
|
|
385
385
|
function nt(e, t, s) {
|
|
386
|
-
const l = e === "" ? null :
|
|
386
|
+
const l = e === "" ? null : G(e, s), i = t === "" ? null : G(t, s), o = l && i && l.amount > i.amount;
|
|
387
387
|
return {
|
|
388
388
|
min: l,
|
|
389
389
|
max: i,
|
|
@@ -391,7 +391,7 @@ function nt(e, t, s) {
|
|
|
391
391
|
};
|
|
392
392
|
}
|
|
393
393
|
function ot(e, t, s) {
|
|
394
|
-
const l =
|
|
394
|
+
const l = q(), i = te(), o = l.skuByCode[e.code], f = new Array();
|
|
395
395
|
if (!o)
|
|
396
396
|
return f.push(`Cannot find ingredient with code (${e.code}) ${e.name}.`), {
|
|
397
397
|
index: t,
|
|
@@ -426,25 +426,25 @@ function ot(e, t, s) {
|
|
|
426
426
|
templateItem: n
|
|
427
427
|
};
|
|
428
428
|
}
|
|
429
|
-
const m =
|
|
429
|
+
const m = G(
|
|
430
430
|
e.quantityStep,
|
|
431
|
-
|
|
431
|
+
Z(c, a)
|
|
432
432
|
);
|
|
433
433
|
(Number.isNaN(Number(e.quantityStep)) || Number(e.quantityStep) <= 0) && f.push("Amount step must be more than 0");
|
|
434
|
-
const h =
|
|
434
|
+
const h = Fe(m), d = nt(
|
|
435
435
|
e.minimumQuantity,
|
|
436
436
|
e.maximumQuantity,
|
|
437
|
-
|
|
437
|
+
Z(c, a)
|
|
438
438
|
), u = d.min, v = d.max;
|
|
439
439
|
d.compareError && f.push(d.compareError);
|
|
440
|
-
const
|
|
440
|
+
const b = Pe(+e.minimumQuantity, +e.maximumQuantity), r = G(
|
|
441
441
|
e.defaultQuantity,
|
|
442
|
-
|
|
442
|
+
Z(c, a)
|
|
443
443
|
), x = h(r);
|
|
444
444
|
typeof x == "string" && f.push(`Default amount: ${x}`);
|
|
445
|
-
const
|
|
446
|
-
typeof
|
|
447
|
-
const
|
|
445
|
+
const $ = d.min && d.max ? b(`${e.defaultQuantity}`) : null;
|
|
446
|
+
typeof $ == "string" && f.push(`Default amount: ${$}`);
|
|
447
|
+
const T = {
|
|
448
448
|
sku: o,
|
|
449
449
|
code: e.overrideCode || o.code,
|
|
450
450
|
name: e.name || o.name,
|
|
@@ -457,12 +457,12 @@ function ot(e, t, s) {
|
|
|
457
457
|
return {
|
|
458
458
|
index: t,
|
|
459
459
|
errors: f,
|
|
460
|
-
templateItem:
|
|
460
|
+
templateItem: T
|
|
461
461
|
};
|
|
462
462
|
}
|
|
463
463
|
function at(e) {
|
|
464
464
|
const t = e.SheetNames.filter(
|
|
465
|
-
(o) => !Object.values(
|
|
465
|
+
(o) => !Object.values(ie).map(String).includes(o)
|
|
466
466
|
), l = Ce().templates, i = Oe(l, "_id");
|
|
467
467
|
try {
|
|
468
468
|
return t.reduce(
|
|
@@ -472,8 +472,8 @@ function at(e) {
|
|
|
472
472
|
c.push(...h.errors);
|
|
473
473
|
const d = h.from, u = et(m.locations), v = u.filter((n) => n.location).map((n) => n.location);
|
|
474
474
|
c.push(...u.flatMap((n) => n.errors));
|
|
475
|
-
const
|
|
476
|
-
(n, y) => ot(n.data, y,
|
|
475
|
+
const b = rt(a).filter((n) => n.data.code), r = b.map(
|
|
476
|
+
(n, y) => ot(n.data, y, b)
|
|
477
477
|
);
|
|
478
478
|
c.push(
|
|
479
479
|
...r.flatMap(
|
|
@@ -484,7 +484,7 @@ function at(e) {
|
|
|
484
484
|
if (m.id) {
|
|
485
485
|
const n = i[m.id];
|
|
486
486
|
if (!n) {
|
|
487
|
-
const
|
|
487
|
+
const S = {
|
|
488
488
|
_id: m.id,
|
|
489
489
|
_rev: "",
|
|
490
490
|
name: m.name || `(unnamed from sheet ${f || "<unnamed sheet>"})`,
|
|
@@ -492,8 +492,8 @@ function at(e) {
|
|
|
492
492
|
};
|
|
493
493
|
return c.push(`Template ID ${m.id} is not found.`), o.importUpdateResult.push({
|
|
494
494
|
type: "update",
|
|
495
|
-
original:
|
|
496
|
-
template:
|
|
495
|
+
original: S,
|
|
496
|
+
template: S,
|
|
497
497
|
excelSheetName: f,
|
|
498
498
|
errors: c
|
|
499
499
|
}), o;
|
|
@@ -518,7 +518,7 @@ function at(e) {
|
|
|
518
518
|
};
|
|
519
519
|
return o.importUpdateResult.push(y), o;
|
|
520
520
|
}
|
|
521
|
-
const
|
|
521
|
+
const T = {
|
|
522
522
|
type: "create",
|
|
523
523
|
template: {
|
|
524
524
|
name: m.name,
|
|
@@ -533,7 +533,7 @@ function at(e) {
|
|
|
533
533
|
excelSheetName: f,
|
|
534
534
|
errors: c
|
|
535
535
|
};
|
|
536
|
-
return o.importCreateResult.push(
|
|
536
|
+
return o.importCreateResult.push(T), o;
|
|
537
537
|
},
|
|
538
538
|
{
|
|
539
539
|
invalidExcel: !1,
|
|
@@ -575,7 +575,7 @@ function st() {
|
|
|
575
575
|
const it = { class: "flex items-center gap-12 pl-8" }, lt = { class: "flex flex-col" }, ct = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" }, mt = { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, ut = {
|
|
576
576
|
key: 0,
|
|
577
577
|
class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
|
|
578
|
-
}, dt = { key: 0 },
|
|
578
|
+
}, dt = { key: 0 }, fe = /* @__PURE__ */ ae({
|
|
579
579
|
__name: "TransferTemplateImportItem",
|
|
580
580
|
props: {
|
|
581
581
|
type: {},
|
|
@@ -589,7 +589,7 @@ const it = { class: "flex items-center gap-12 pl-8" }, lt = { class: "flex flex-
|
|
|
589
589
|
return (t, s) => {
|
|
590
590
|
var o, f, c;
|
|
591
591
|
const l = Q("FmIcon"), i = Q("FmTooltip");
|
|
592
|
-
return
|
|
592
|
+
return _(), k("div", it, [
|
|
593
593
|
s[0] || (s[0] = C("div", null, "•", -1)),
|
|
594
594
|
C("div", lt, [
|
|
595
595
|
C("div", ct, [
|
|
@@ -600,17 +600,17 @@ const it = { class: "flex items-center gap-12 pl-8" }, lt = { class: "flex flex-
|
|
|
600
600
|
}, [
|
|
601
601
|
ze(D(t.name) + " ", 1),
|
|
602
602
|
C("span", mt, " (" + D(A(Ue)(`${t.transferType}`)) + ") ", 1),
|
|
603
|
-
t.type === "create" ? (
|
|
603
|
+
t.type === "create" ? (_(), k("span", ut, "(new)")) : V("", !0)
|
|
604
604
|
], 2),
|
|
605
|
-
t.errors.length ? (
|
|
606
|
-
|
|
607
|
-
content:
|
|
605
|
+
t.errors.length ? (_(), k("div", dt, [
|
|
606
|
+
P(i, { "z-index": 50 }, {
|
|
607
|
+
content: ee(() => [
|
|
608
608
|
C("ol", null, [
|
|
609
|
-
(
|
|
609
|
+
(_(!0), k(L, null, Y(t.errors, (a, m) => (_(), k("li", { key: m }, D(a), 1))), 128))
|
|
610
610
|
])
|
|
611
611
|
]),
|
|
612
|
-
default:
|
|
613
|
-
|
|
612
|
+
default: ee(() => [
|
|
613
|
+
P(l, {
|
|
614
614
|
name: "error",
|
|
615
615
|
size: "sm",
|
|
616
616
|
color: "system-error-300"
|
|
@@ -618,7 +618,7 @@ const it = { class: "flex items-center gap-12 pl-8" }, lt = { class: "flex flex-
|
|
|
618
618
|
]),
|
|
619
619
|
_: 1
|
|
620
620
|
})
|
|
621
|
-
])) :
|
|
621
|
+
])) : V("", !0)
|
|
622
622
|
]),
|
|
623
623
|
C("div", {
|
|
624
624
|
class: H([
|
|
@@ -645,10 +645,10 @@ const it = { class: "flex items-center gap-12 pl-8" }, lt = { class: "flex flex-
|
|
|
645
645
|
}, bt = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, xt = {
|
|
646
646
|
key: 0,
|
|
647
647
|
class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
|
|
648
|
-
},
|
|
648
|
+
}, Tt = { class: "fm-typo-en-body-lg-600" }, St = /* @__PURE__ */ ae({
|
|
649
649
|
__name: "TransferTemplateImport",
|
|
650
650
|
setup(e) {
|
|
651
|
-
const t =
|
|
651
|
+
const t = R(null), s = qe(), l = be(), i = R(!1), o = R(!1), f = se();
|
|
652
652
|
Ke(async () => {
|
|
653
653
|
o.value = !0;
|
|
654
654
|
try {
|
|
@@ -663,38 +663,38 @@ const it = { class: "flex items-center gap-12 pl-8" }, lt = { class: "flex flex-
|
|
|
663
663
|
o.value = !1;
|
|
664
664
|
}
|
|
665
665
|
});
|
|
666
|
-
const c =
|
|
667
|
-
() => !!c.value.length || a.value.some((
|
|
668
|
-
), d =
|
|
666
|
+
const c = R(new Array()), a = R([]), m = R([]), h = de(
|
|
667
|
+
() => !!c.value.length || a.value.some((b) => b.errors.length) || m.value.some((b) => b.errors.length)
|
|
668
|
+
), d = de(
|
|
669
669
|
() => !!a.value.length || !!m.value.length
|
|
670
|
-
), { t: u } =
|
|
671
|
-
async function v(
|
|
670
|
+
), { t: u } = oe();
|
|
671
|
+
async function v(b) {
|
|
672
672
|
c.value = [], a.value = [], m.value = [];
|
|
673
673
|
try {
|
|
674
674
|
i.value = !0;
|
|
675
675
|
const [r] = await Promise.all([
|
|
676
|
-
Be(
|
|
676
|
+
Be(b),
|
|
677
677
|
// fake buffer
|
|
678
678
|
new Promise((p) => setTimeout(p, 1e3))
|
|
679
679
|
]);
|
|
680
680
|
if (!r.SheetNames.filter(
|
|
681
|
-
(p) => !Object.values(
|
|
681
|
+
(p) => !Object.values(ie).map(String).includes(p)
|
|
682
682
|
).find((p) => p)) {
|
|
683
683
|
c.value.push(u("inventory.ingredient.import.fileError.noSheet"));
|
|
684
684
|
return;
|
|
685
685
|
}
|
|
686
|
-
const
|
|
687
|
-
if (
|
|
686
|
+
const T = at(r);
|
|
687
|
+
if (T.invalidExcel) {
|
|
688
688
|
c.value.push(
|
|
689
|
-
|
|
689
|
+
T.invalidExcelMessage ?? u("inventory.ingredient.import.fileError.invalidExcel")
|
|
690
690
|
);
|
|
691
691
|
return;
|
|
692
692
|
}
|
|
693
|
-
if (a.value =
|
|
693
|
+
if (a.value = T.importCreateResult, m.value = T.importUpdateResult, !a.value.length && !m.value.length) {
|
|
694
694
|
c.value.push(u("inventory.ingredient.import.fileError.noData"));
|
|
695
695
|
return;
|
|
696
696
|
}
|
|
697
|
-
s.emitData(
|
|
697
|
+
s.emitData(T);
|
|
698
698
|
} catch (r) {
|
|
699
699
|
l.open({
|
|
700
700
|
title: u("inventory.ingredient.import.fileError.unableToRead"),
|
|
@@ -708,22 +708,22 @@ const it = { class: "flex items-center gap-12 pl-8" }, lt = { class: "flex flex-
|
|
|
708
708
|
}), i.value = !1;
|
|
709
709
|
}
|
|
710
710
|
}
|
|
711
|
-
return Ye(t, (
|
|
712
|
-
|
|
713
|
-
}), (
|
|
714
|
-
const x = Q("FmCircularProgress"),
|
|
715
|
-
return
|
|
711
|
+
return Ye(t, (b) => {
|
|
712
|
+
b && v(b);
|
|
713
|
+
}), (b, r) => {
|
|
714
|
+
const x = Q("FmCircularProgress"), $ = Q("FmIcon"), T = Q("FmButton");
|
|
715
|
+
return _(), k("div", pt, [
|
|
716
716
|
r[2] || (r[2] = C("div", { class: "fm-typo-en-body-md-400" }, "Import transfer templates from excel sheets.", -1)),
|
|
717
|
-
o.value ? (
|
|
717
|
+
o.value ? (_(), k("div", ft, [
|
|
718
718
|
C("div", null, [
|
|
719
|
-
|
|
719
|
+
P(x, {
|
|
720
720
|
size: "md",
|
|
721
721
|
color: "neutral-gray-200"
|
|
722
722
|
})
|
|
723
723
|
]),
|
|
724
724
|
r[1] || (r[1] = C("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "Loading...", -1))
|
|
725
|
-
])) : (
|
|
726
|
-
|
|
725
|
+
])) : (_(), k(L, { key: 1 }, [
|
|
726
|
+
P(Me, {
|
|
727
727
|
class: H({
|
|
728
728
|
"w-full": !0,
|
|
729
729
|
"h-[200px]": !t.value
|
|
@@ -735,7 +735,7 @@ const it = { class: "flex items-center gap-12 pl-8" }, lt = { class: "flex flex-
|
|
|
735
735
|
}, We({ _: 2 }, [
|
|
736
736
|
t.value ? {
|
|
737
737
|
name: "default",
|
|
738
|
-
fn:
|
|
738
|
+
fn: ee(({ openFileDialog: p }) => [
|
|
739
739
|
C("div", yt, [
|
|
740
740
|
C("div", {
|
|
741
741
|
class: H([
|
|
@@ -747,11 +747,11 @@ const it = { class: "flex items-center gap-12 pl-8" }, lt = { class: "flex flex-
|
|
|
747
747
|
}
|
|
748
748
|
])
|
|
749
749
|
}, [
|
|
750
|
-
i.value ? (
|
|
750
|
+
i.value ? (_(), K(x, {
|
|
751
751
|
key: 0,
|
|
752
752
|
size: "md",
|
|
753
753
|
color: "neutral-gray-200"
|
|
754
|
-
})) : (
|
|
754
|
+
})) : (_(), K($, {
|
|
755
755
|
key: 1,
|
|
756
756
|
name: h.value ? "error" : "attach_file",
|
|
757
757
|
outline: "",
|
|
@@ -768,8 +768,8 @@ const it = { class: "flex items-center gap-12 pl-8" }, lt = { class: "flex flex-
|
|
|
768
768
|
}, [
|
|
769
769
|
C("div", ht, D(t.value.name), 1)
|
|
770
770
|
], 2),
|
|
771
|
-
i.value ?
|
|
772
|
-
|
|
771
|
+
i.value ? V("", !0) : (_(), k("div", vt, [
|
|
772
|
+
P(T, {
|
|
773
773
|
label: A(u)("inventory.ingredient.import.replaceFile"),
|
|
774
774
|
variant: h.value ? "destructive" : "secondary",
|
|
775
775
|
"prepend-icon": h.value ? void 0 : "autorenew",
|
|
@@ -777,45 +777,45 @@ const it = { class: "flex items-center gap-12 pl-8" }, lt = { class: "flex flex-
|
|
|
777
777
|
}, null, 8, ["label", "variant", "prepend-icon", "onClick"])
|
|
778
778
|
]))
|
|
779
779
|
], 2),
|
|
780
|
-
c.value.length ? (
|
|
781
|
-
(
|
|
780
|
+
c.value.length ? (_(), k("div", gt, [
|
|
781
|
+
(_(!0), k(L, null, Y(c.value, (n, y) => (_(), k("div", {
|
|
782
782
|
key: y,
|
|
783
783
|
class: "flex gap-8 items-center"
|
|
784
784
|
}, [
|
|
785
|
-
|
|
785
|
+
P($, {
|
|
786
786
|
name: "error",
|
|
787
787
|
size: "sm",
|
|
788
788
|
color: "system-error-300"
|
|
789
789
|
}),
|
|
790
790
|
C("div", bt, D(n), 1)
|
|
791
791
|
]))), 128))
|
|
792
|
-
])) :
|
|
792
|
+
])) : V("", !0)
|
|
793
793
|
])
|
|
794
794
|
]),
|
|
795
795
|
key: "0"
|
|
796
796
|
} : void 0
|
|
797
797
|
]), 1032, ["class", "label", "button-label"]),
|
|
798
|
-
d.value ? (
|
|
799
|
-
C("div",
|
|
800
|
-
(
|
|
798
|
+
d.value ? (_(), k("div", xt, [
|
|
799
|
+
C("div", Tt, D(A(u)("inventory.ingredient.import.summary")), 1),
|
|
800
|
+
(_(!0), k(L, null, Y(a.value, (p, n) => (_(), K(fe, {
|
|
801
801
|
key: n,
|
|
802
802
|
name: p.template.name,
|
|
803
|
-
"transfer-type": typeof p.template.purchaseOrder.supplier.internal == "string" ? A(
|
|
803
|
+
"transfer-type": typeof p.template.purchaseOrder.supplier.internal == "string" ? A(N).TRANSFER : A(N).PURCHASE,
|
|
804
804
|
locations: p.template.locations,
|
|
805
805
|
items: p.template.purchaseOrder.items,
|
|
806
806
|
errors: p.errors,
|
|
807
807
|
type: "create"
|
|
808
808
|
}, null, 8, ["name", "transfer-type", "locations", "items", "errors"]))), 128)),
|
|
809
|
-
(
|
|
809
|
+
(_(!0), k(L, null, Y(m.value, (p) => (_(), K(fe, {
|
|
810
810
|
key: p.template._id,
|
|
811
811
|
name: p.template.name,
|
|
812
|
-
"transfer-type": typeof p.template.purchaseOrder.supplier.internal == "string" ? A(
|
|
812
|
+
"transfer-type": typeof p.template.purchaseOrder.supplier.internal == "string" ? A(N).TRANSFER : A(N).PURCHASE,
|
|
813
813
|
locations: p.template.locations,
|
|
814
814
|
items: p.template.purchaseOrder.items,
|
|
815
815
|
errors: p.errors,
|
|
816
816
|
type: "update"
|
|
817
817
|
}, null, 8, ["name", "transfer-type", "locations", "items", "errors"]))), 128))
|
|
818
|
-
])) :
|
|
818
|
+
])) : V("", !0)
|
|
819
819
|
], 64))
|
|
820
820
|
]);
|
|
821
821
|
};
|
|
@@ -823,7 +823,7 @@ const it = { class: "flex items-center gap-12 pl-8" }, lt = { class: "flex flex-
|
|
|
823
823
|
});
|
|
824
824
|
function _t(e) {
|
|
825
825
|
var o, f;
|
|
826
|
-
const t =
|
|
826
|
+
const t = te();
|
|
827
827
|
if (!t.isEnabled) return !0;
|
|
828
828
|
if (!e.internal) {
|
|
829
829
|
const c = t.getNetSuiteVendor(e._id), a = c == null ? void 0 : c.subsidiaryId, m = (o = t.currentVendorSubsidiary(e._id)) == null ? void 0 : o.id;
|
|
@@ -832,11 +832,11 @@ function _t(e) {
|
|
|
832
832
|
const s = t.getNetSuiteLocation(`${e.internal}_${e._id}`), l = t.getLocationSubsidiary(s == null ? void 0 : s.netSuiteId).id, i = (f = t.currentLocationSubsidiary()) == null ? void 0 : f.id;
|
|
833
833
|
return l && l == i;
|
|
834
834
|
}
|
|
835
|
-
const $t =
|
|
836
|
-
const e = je(), t =
|
|
835
|
+
const $t = xe("transferTemplateActions", () => {
|
|
836
|
+
const e = je(), t = be(), s = J(), l = Ce(), i = Le(), o = Te(), f = te(), c = Ge(), { t: a } = oe(), m = R({});
|
|
837
837
|
function h() {
|
|
838
838
|
m.value = {
|
|
839
|
-
mode:
|
|
839
|
+
mode: me.CREATE,
|
|
840
840
|
show: !0,
|
|
841
841
|
"onUpdate:show"(n) {
|
|
842
842
|
m.value.show = n;
|
|
@@ -845,7 +845,7 @@ const $t = be("transferTemplateActions", () => {
|
|
|
845
845
|
}
|
|
846
846
|
function d(n) {
|
|
847
847
|
m.value = {
|
|
848
|
-
mode:
|
|
848
|
+
mode: me.UPDATE,
|
|
849
849
|
modelValue: n,
|
|
850
850
|
show: !0,
|
|
851
851
|
"onUpdate:show"(y) {
|
|
@@ -853,7 +853,7 @@ const $t = be("transferTemplateActions", () => {
|
|
|
853
853
|
}
|
|
854
854
|
};
|
|
855
855
|
}
|
|
856
|
-
function u(n, y,
|
|
856
|
+
function u(n, y, S) {
|
|
857
857
|
e.open({
|
|
858
858
|
title: `Confirm deleting template ${n.name}?`,
|
|
859
859
|
message: "Deleted template can no longer be retrieved",
|
|
@@ -874,27 +874,28 @@ const $t = be("transferTemplateActions", () => {
|
|
|
874
874
|
});
|
|
875
875
|
try {
|
|
876
876
|
y.value = !0;
|
|
877
|
-
const [
|
|
877
|
+
const [w] = await Promise.allSettled([
|
|
878
878
|
o.deleteTemplate(n),
|
|
879
|
-
new Promise((
|
|
879
|
+
new Promise((E) => setTimeout(E, 1e3))
|
|
880
880
|
]);
|
|
881
|
-
if (
|
|
881
|
+
if (w.status === "rejected") throw w.reason;
|
|
882
882
|
t.open({
|
|
883
883
|
title: `Deleted ${n.name}`,
|
|
884
884
|
type: "success"
|
|
885
885
|
});
|
|
886
|
-
} catch (
|
|
886
|
+
} catch (w) {
|
|
887
887
|
t.open({
|
|
888
888
|
title: `Unable to delete ${n.name}`,
|
|
889
|
-
message: `See error from server: ${
|
|
889
|
+
message: `See error from server: ${w}`,
|
|
890
890
|
type: "error"
|
|
891
|
-
}), console.error("error on deleting purchase order template",
|
|
891
|
+
}), console.error("error on deleting purchase order template", w);
|
|
892
892
|
} finally {
|
|
893
|
-
y.value = !1,
|
|
893
|
+
y.value = !1, S();
|
|
894
894
|
}
|
|
895
895
|
});
|
|
896
896
|
}
|
|
897
|
-
function v(n, y,
|
|
897
|
+
function v(n, y, S) {
|
|
898
|
+
let w;
|
|
898
899
|
e.open({
|
|
899
900
|
title: `Confirm duplicating template "${n.name}"?`,
|
|
900
901
|
message: "Duplicated template can be edited and used independently",
|
|
@@ -907,7 +908,20 @@ const $t = be("transferTemplateActions", () => {
|
|
|
907
908
|
text: "Cancel",
|
|
908
909
|
variant: z.Plain,
|
|
909
910
|
close: !0
|
|
910
|
-
}
|
|
911
|
+
},
|
|
912
|
+
contentComponent: ae({
|
|
913
|
+
props: ["modelValue"],
|
|
914
|
+
emits: ["update:modelValue"],
|
|
915
|
+
setup(E) {
|
|
916
|
+
return () => W(X.FmTextField, {
|
|
917
|
+
modelValue: E.modelValue,
|
|
918
|
+
"onUpdate:modelValue": (g) => w = g,
|
|
919
|
+
label: "New Template Name",
|
|
920
|
+
size: "md",
|
|
921
|
+
variant: "primary"
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
})
|
|
911
925
|
}).onPrimary(async () => {
|
|
912
926
|
t.open({
|
|
913
927
|
title: `Duplicating ${n.name}`,
|
|
@@ -915,47 +929,47 @@ const $t = be("transferTemplateActions", () => {
|
|
|
915
929
|
});
|
|
916
930
|
try {
|
|
917
931
|
y.value = !0;
|
|
918
|
-
const [
|
|
919
|
-
i.duplicatePurchaseOrderTemplate(n._id),
|
|
920
|
-
new Promise((
|
|
932
|
+
const [E] = await Promise.allSettled([
|
|
933
|
+
i.duplicatePurchaseOrderTemplate(n._id, w),
|
|
934
|
+
new Promise((g) => setTimeout(g, 1e3))
|
|
921
935
|
]);
|
|
922
|
-
if (
|
|
936
|
+
if (E.status === "rejected") throw E.reason;
|
|
923
937
|
t.open({
|
|
924
938
|
title: `Duplicated ${n.name}`,
|
|
925
939
|
type: "success"
|
|
926
940
|
});
|
|
927
|
-
} catch (
|
|
941
|
+
} catch (E) {
|
|
928
942
|
t.open({
|
|
929
943
|
title: `Unable to duplicate ${n.name}`,
|
|
930
|
-
message: `See error from server: ${
|
|
944
|
+
message: `See error from server: ${E}`,
|
|
931
945
|
type: "error"
|
|
932
|
-
}), console.error("error on duplicating purchase order template",
|
|
946
|
+
}), console.error("error on duplicating purchase order template", E);
|
|
933
947
|
} finally {
|
|
934
|
-
y.value = !1,
|
|
948
|
+
y.value = !1, S();
|
|
935
949
|
}
|
|
936
950
|
});
|
|
937
951
|
}
|
|
938
|
-
const
|
|
952
|
+
const b = R({});
|
|
939
953
|
function r(n) {
|
|
940
|
-
|
|
954
|
+
b.value = {
|
|
941
955
|
template: n,
|
|
942
956
|
show: !0,
|
|
943
957
|
"onUpdate:show"(y) {
|
|
944
|
-
|
|
958
|
+
b.value.show = y;
|
|
945
959
|
},
|
|
946
960
|
"onAction:edit"() {
|
|
947
|
-
|
|
961
|
+
b.value.show = !1, d(re(n));
|
|
948
962
|
}
|
|
949
963
|
};
|
|
950
964
|
}
|
|
951
965
|
function x() {
|
|
952
|
-
const { promise: n, resolve: y } = Promise.withResolvers(),
|
|
953
|
-
y(
|
|
954
|
-
},
|
|
955
|
-
var O,
|
|
956
|
-
return ((O =
|
|
966
|
+
const { promise: n, resolve: y } = Promise.withResolvers(), S = (g) => {
|
|
967
|
+
y(g);
|
|
968
|
+
}, w = l.templates.filter((g) => {
|
|
969
|
+
var O, F;
|
|
970
|
+
return ((O = g.purchaseOrder.supplier) == null ? void 0 : O._id) === s.currentLocation.doc._id ? !1 : (F = g.locations) != null && F.length ? g.locations.find((U) => U.doc._id === s.currentLocation.doc._id) : !0;
|
|
957
971
|
});
|
|
958
|
-
if (!
|
|
972
|
+
if (!w.length)
|
|
959
973
|
return e.open({
|
|
960
974
|
title: "Select one template",
|
|
961
975
|
message: "There is no available template in your business. Configure a new template?",
|
|
@@ -968,26 +982,26 @@ const $t = be("transferTemplateActions", () => {
|
|
|
968
982
|
close: !0
|
|
969
983
|
}
|
|
970
984
|
}).onPrimary(() => {
|
|
971
|
-
c.push({ name:
|
|
972
|
-
}).onSecondary(() =>
|
|
973
|
-
const
|
|
974
|
-
var
|
|
975
|
-
const O = !
|
|
976
|
-
`${
|
|
977
|
-
) : f.getNetSuiteVendor(
|
|
978
|
-
location is ${(
|
|
985
|
+
c.push({ name: ue.TRANSFER_TEMPLATE }), S(void 0);
|
|
986
|
+
}).onSecondary(() => S(void 0)).onClose(() => S(void 0)), n;
|
|
987
|
+
const E = w.map((g) => {
|
|
988
|
+
var le;
|
|
989
|
+
const O = !g.purchaseOrder.items.length || g.purchaseOrder.items.some(Se), F = !_t(g.purchaseOrder.supplier), U = g.purchaseOrder.supplier.internal ? f.getNetSuiteLocation(
|
|
990
|
+
`${g.purchaseOrder.supplier.internal}_${g.purchaseOrder.supplier._id}`
|
|
991
|
+
) : f.getNetSuiteVendor(g.purchaseOrder.supplier._id), ke = F ? `The subsidiary of the request
|
|
992
|
+
location is ${(le = f.getLocationSubsidiary(U == null ? void 0 : U.netSuiteId)) == null ? void 0 : le.fullName}.` : void 0, Ee = O || F, Re = O ? "This template is invalid. Update this template." : F ? ke : void 0, Ne = `${g.purchaseOrder.supplier.internal ? "Transfer" : "Purchase"} from ${g.purchaseOrder.supplier.name}`;
|
|
979
993
|
return {
|
|
980
|
-
label:
|
|
981
|
-
value:
|
|
994
|
+
label: g.name,
|
|
995
|
+
value: g._id,
|
|
982
996
|
disabled: Ee,
|
|
983
|
-
sublabel: Re ??
|
|
997
|
+
sublabel: Re ?? Ne
|
|
984
998
|
};
|
|
985
999
|
});
|
|
986
|
-
return
|
|
1000
|
+
return E.sort((g, O) => +!!g.disabled - +!!O.disabled), e.open({
|
|
987
1001
|
title: "Select one template",
|
|
988
1002
|
contentComponent: Qe,
|
|
989
1003
|
contentComponentProps: {
|
|
990
|
-
items:
|
|
1004
|
+
items: E,
|
|
991
1005
|
singleSelect: !0
|
|
992
1006
|
},
|
|
993
1007
|
primaryActions: {
|
|
@@ -1002,14 +1016,14 @@ const $t = be("transferTemplateActions", () => {
|
|
|
1002
1016
|
text: "Templates",
|
|
1003
1017
|
close: !0
|
|
1004
1018
|
}
|
|
1005
|
-
}).onPrimary((
|
|
1006
|
-
c.push({ name:
|
|
1007
|
-
}).onClose(() =>
|
|
1019
|
+
}).onPrimary((g) => Array.isArray(g) ? S(g[0]) : null).onSecondary(() => S(void 0)).onTertiary(() => {
|
|
1020
|
+
c.push({ name: ue.TRANSFER_TEMPLATE }), S(void 0);
|
|
1021
|
+
}).onClose(() => S(void 0)), n;
|
|
1008
1022
|
}
|
|
1009
|
-
function
|
|
1023
|
+
function $() {
|
|
1010
1024
|
e.open({
|
|
1011
1025
|
title: a("inventory.ingredient.import.title"),
|
|
1012
|
-
contentComponent:
|
|
1026
|
+
contentComponent: St,
|
|
1013
1027
|
overlay: !0,
|
|
1014
1028
|
closeButton: !0,
|
|
1015
1029
|
primaryActions: {
|
|
@@ -1049,30 +1063,30 @@ const $t = be("transferTemplateActions", () => {
|
|
|
1049
1063
|
});
|
|
1050
1064
|
return;
|
|
1051
1065
|
}
|
|
1052
|
-
e.close(),
|
|
1066
|
+
e.close(), T(n);
|
|
1053
1067
|
}).onTertiary(Ze);
|
|
1054
1068
|
}
|
|
1055
|
-
async function
|
|
1069
|
+
async function T(n) {
|
|
1056
1070
|
try {
|
|
1057
1071
|
const y = [
|
|
1058
1072
|
...n.importCreateResult.map(
|
|
1059
|
-
(
|
|
1073
|
+
(g) => g.template
|
|
1060
1074
|
),
|
|
1061
1075
|
...n.importUpdateResult.map(
|
|
1062
|
-
(
|
|
1076
|
+
(g) => g.template
|
|
1063
1077
|
)
|
|
1064
|
-
],
|
|
1065
|
-
let
|
|
1066
|
-
const
|
|
1067
|
-
|
|
1078
|
+
], S = 100;
|
|
1079
|
+
let w = 0;
|
|
1080
|
+
const E = () => {
|
|
1081
|
+
w += S, t.open({
|
|
1068
1082
|
title: a("inventory.ingredient.import.progress", [
|
|
1069
|
-
Math.min(
|
|
1083
|
+
Math.min(w, y.length),
|
|
1070
1084
|
y.length
|
|
1071
1085
|
])
|
|
1072
1086
|
});
|
|
1073
1087
|
};
|
|
1074
|
-
for (const
|
|
1075
|
-
|
|
1088
|
+
for (const g of y.chunk(100))
|
|
1089
|
+
E(), await o.importTemplates(g);
|
|
1076
1090
|
t.open({
|
|
1077
1091
|
title: a("inventory.ingredient.import.success"),
|
|
1078
1092
|
type: "success"
|
|
@@ -1102,20 +1116,20 @@ const $t = be("transferTemplateActions", () => {
|
|
|
1102
1116
|
deleteTemplate: u,
|
|
1103
1117
|
duplicateTemplate: v,
|
|
1104
1118
|
getTemplateId: x,
|
|
1105
|
-
importTemplates:
|
|
1119
|
+
importTemplates: $,
|
|
1106
1120
|
exportTemplates: p,
|
|
1107
1121
|
templateDialogProps: m,
|
|
1108
|
-
templateDetailsProps:
|
|
1122
|
+
templateDetailsProps: b
|
|
1109
1123
|
};
|
|
1110
1124
|
});
|
|
1111
|
-
function
|
|
1112
|
-
const { skuById: t } =
|
|
1125
|
+
function ye(e) {
|
|
1126
|
+
const { skuById: t } = q(), s = re(e);
|
|
1113
1127
|
return s.purchaseOrder.items = e.purchaseOrder.items.filter((l) => t[l.sku._id]), s;
|
|
1114
1128
|
}
|
|
1115
|
-
const Ce =
|
|
1129
|
+
const Ce = xe(
|
|
1116
1130
|
"transferTemplateTable",
|
|
1117
1131
|
function() {
|
|
1118
|
-
const { t } =
|
|
1132
|
+
const { t } = oe(), s = $t(), l = R(!1), i = R(new Array()), o = Te(), f = q();
|
|
1119
1133
|
async function c() {
|
|
1120
1134
|
i.value = [], l.value = !0;
|
|
1121
1135
|
try {
|
|
@@ -1123,7 +1137,7 @@ const Ce = be(
|
|
|
1123
1137
|
o.readTemplates(),
|
|
1124
1138
|
f.readInventory()
|
|
1125
1139
|
]).delayed(1e3);
|
|
1126
|
-
i.value = d.map(
|
|
1140
|
+
i.value = d.map(ye);
|
|
1127
1141
|
} catch (d) {
|
|
1128
1142
|
console.log("Something went wrong when fetching templates:", d);
|
|
1129
1143
|
} finally {
|
|
@@ -1135,7 +1149,7 @@ const Ce = be(
|
|
|
1135
1149
|
l.value = !0;
|
|
1136
1150
|
try {
|
|
1137
1151
|
i.value = [
|
|
1138
|
-
await o.getTemplate(d).then(
|
|
1152
|
+
await o.getTemplate(d).then(ye).delayed(1e3)
|
|
1139
1153
|
];
|
|
1140
1154
|
} catch (u) {
|
|
1141
1155
|
console.log("Something went wrong when fetching templates:", u);
|
|
@@ -1145,14 +1159,14 @@ const Ce = be(
|
|
|
1145
1159
|
}
|
|
1146
1160
|
}
|
|
1147
1161
|
function m(d, u) {
|
|
1148
|
-
switch (u =
|
|
1149
|
-
case
|
|
1162
|
+
switch (u = re(u), d) {
|
|
1163
|
+
case I.Details:
|
|
1150
1164
|
return s.viewTemplate(u);
|
|
1151
|
-
case
|
|
1165
|
+
case I.Edit:
|
|
1152
1166
|
return s.updateTemplate(u);
|
|
1153
|
-
case
|
|
1167
|
+
case I.Delete:
|
|
1154
1168
|
return s.deleteTemplate(u, l, c);
|
|
1155
|
-
case
|
|
1169
|
+
case I.Duplicate:
|
|
1156
1170
|
return s.duplicateTemplate(u, l, c);
|
|
1157
1171
|
}
|
|
1158
1172
|
}
|
|
@@ -1191,17 +1205,17 @@ const Ce = be(
|
|
|
1191
1205
|
textAlign: "right"
|
|
1192
1206
|
},
|
|
1193
1207
|
cell(d) {
|
|
1194
|
-
const u = Number(d.getValue()) || 0, v = d.row.original.purchaseOrder.items.some(
|
|
1195
|
-
return u === 0 || v ?
|
|
1196
|
-
|
|
1197
|
-
|
|
1208
|
+
const u = Number(d.getValue()) || 0, v = d.row.original.purchaseOrder.items.some(Se);
|
|
1209
|
+
return u === 0 || v ? W("div", { class: "flex justify-end gap-4 items-center" }, [
|
|
1210
|
+
W(
|
|
1211
|
+
X.FmTooltip,
|
|
1198
1212
|
{},
|
|
1199
1213
|
{
|
|
1200
1214
|
content() {
|
|
1201
1215
|
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.";
|
|
1202
1216
|
},
|
|
1203
1217
|
default() {
|
|
1204
|
-
return
|
|
1218
|
+
return W(X.FmIcon, {
|
|
1205
1219
|
name: "error",
|
|
1206
1220
|
color: "system-error-300",
|
|
1207
1221
|
size: "sm"
|
|
@@ -1239,12 +1253,12 @@ const Ce = be(
|
|
|
1239
1253
|
id: "action",
|
|
1240
1254
|
cell(d) {
|
|
1241
1255
|
const u = d.row.original, v = [
|
|
1242
|
-
j[
|
|
1243
|
-
j[
|
|
1244
|
-
j[
|
|
1245
|
-
j[
|
|
1256
|
+
j[I.Details],
|
|
1257
|
+
j[I.Edit],
|
|
1258
|
+
j[I.Duplicate],
|
|
1259
|
+
j[I.Delete]
|
|
1246
1260
|
];
|
|
1247
|
-
return
|
|
1261
|
+
return Ve(v, (b) => m(b, u));
|
|
1248
1262
|
},
|
|
1249
1263
|
enableSorting: !1,
|
|
1250
1264
|
size: 40,
|
|
@@ -1266,10 +1280,10 @@ function Dt(e, t, s) {
|
|
|
1266
1280
|
return `${B(e, !1)} ${l}`;
|
|
1267
1281
|
}
|
|
1268
1282
|
export {
|
|
1269
|
-
|
|
1270
|
-
|
|
1283
|
+
N as P,
|
|
1284
|
+
Te as a,
|
|
1271
1285
|
$t as b,
|
|
1272
1286
|
Dt as f,
|
|
1273
|
-
|
|
1287
|
+
Se as t,
|
|
1274
1288
|
Ce as u
|
|
1275
1289
|
};
|