@feedmepos/mf-inventory-portal 0.0.25-dev.6 → 0.0.25-dev.7

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.
Files changed (40) hide show
  1. package/dist/{App-CbfxkgwK.js → App-qJehfAde.js} +1 -1
  2. package/dist/{ApprovalView-ELDEWMap.js → ApprovalView-BuqKIEPL.js} +2 -2
  3. package/dist/{BindingsDialog-BtCjzX36.js → BindingsDialog-BrF-YAJ2.js} +2 -2
  4. package/dist/{BindingsPicker-DP6FdglZ.js → BindingsPicker-DK41dcoG.js} +1 -1
  5. package/dist/{BindingsTable-amcmKpj_.js → BindingsTable-DxlRhKzN.js} +1 -1
  6. package/dist/{ClosingDraftView-DO_14oDG.js → ClosingDraftView-CpGQMN37.js} +2 -2
  7. package/dist/{ClosingTemplateView-BMsQpdg7.js → ClosingTemplateView-4l891KsC.js} +3 -3
  8. package/dist/{FmCustomAttribute.vue_vue_type_script_setup_true_lang-DUXkuq24.js → FmCustomAttribute.vue_vue_type_script_setup_true_lang-CyHyOhG6.js} +1 -1
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BZQxtTDj.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DRqpc9k0.js} +3 -3
  10. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-iPM-EQny.js → FmUnitInput.vue_vue_type_script_setup_true_lang-3LU_3Y8h.js} +1 -1
  11. package/dist/{IngredientGroupView-Coo5z0LR.js → IngredientGroupView-Bjv9Kih7.js} +1 -1
  12. package/dist/{IngredientsView-CeQXaN2p.js → IngredientsView-ChJbe-U_.js} +3 -3
  13. package/dist/{IntegrationView-md4hgi8k.js → IntegrationView-Cmh47qP7.js} +1 -1
  14. package/dist/{InventoryBindingForm-CwsppNrg.js → InventoryBindingForm-GmcCTBqN.js} +1 -1
  15. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CLR61V6f.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CQrjMOFh.js} +3 -3
  16. package/dist/{InventoryBindingSummary-DMvVMPfD.js → InventoryBindingSummary-w1pFGR3C.js} +1 -1
  17. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-ByQXRxdh.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Cxr2xhRR.js} +1 -1
  18. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DPmIQEPN.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CzxVUAC8.js} +1 -1
  19. package/dist/{PublishView-27Kqj9Pl.js → PublishView-pWAEdGLi.js} +2 -2
  20. package/dist/{PurchaseOrderPrintPreview-aa4spvmG.js → PurchaseOrderPrintPreview-CZczBXL2.js} +1 -1
  21. package/dist/{ReceiveRequestView-D9U4Vea4.js → ReceiveRequestView-tWyQCrIN.js} +8 -8
  22. package/dist/{RecipeView-A8xhUvgI.js → RecipeView-Dy1BBW3o.js} +3 -3
  23. package/dist/{StockView-Dw3H-6FB.js → StockView-B0c0FiPr.js} +7 -7
  24. package/dist/{SupplierView-B5T1mml-.js → SupplierView-BUs8xZPq.js} +3 -3
  25. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-C8Q0rIlP.js → TransferDetails.vue_vue_type_script_setup_true_lang-BA0HIuSW.js} +3 -3
  26. package/dist/{TransferTemplateView-BByKikfy.js → TransferTemplateView-MSbvSo96.js} +162 -160
  27. package/dist/{UnitView-BPm-9Ouy.js → UnitView-GBK0ovxt.js} +3 -3
  28. package/dist/{WarehouseView-B6kMLEnU.js → WarehouseView-CXoj99HO.js} +1 -1
  29. package/dist/{app-DLEGCGlp.js → app-Du-JrqLm.js} +96 -96
  30. package/dist/app.js +1 -1
  31. package/dist/{decimal-Ivbuwf48.js → decimal-BXePRNLM.js} +1 -1
  32. package/dist/{format-unit-display-DWEQ-Uq0.js → format-unit-display-BdC0fMRb.js} +256 -253
  33. package/dist/{index-D9ACNHSL.js → index-cY9fiIBU.js} +1 -1
  34. package/dist/{index-CjaT65-H.js → index-irnhqIWw.js} +3 -3
  35. package/dist/{stock-IxIBNyKi.js → stock-CE5Qq59r.js} +1 -1
  36. package/dist/{supplier-5uoaiSy6.js → supplier-Cy-jlD0j.js} +1 -1
  37. package/dist/{use-inventory-binding-dialog-Bv4zc_sy.js → use-inventory-binding-dialog-nHDQBRL3.js} +1 -1
  38. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +0 -1
  39. package/dist/{vue-i18n-CW-Rmr2v.js → vue-i18n-DIA7c33f.js} +295 -295
  40. package/package.json +1 -1
@@ -1,51 +1,51 @@
1
- import { X as Re, a as Q, L as Ie, aa as F, r as Ae, ab as pe, s as fe, u as z, j as P, v as Ne, aC as oe, w as ye, b as J, t as H, P as q, aB as De, au as Oe, V as Fe, x as Pe, y as Ue, e as ae, f as X, R as se, J as Be, a9 as Me, D as W, i as N, h as Le } from "./app-DLEGCGlp.js";
1
+ import { X as Ee, a as Q, L as Ie, aa as F, r as Ae, ab as pe, s as fe, u as z, j as P, v as Ne, aC as oe, w as ye, b as J, t as H, P as q, aB as De, au as Oe, V as Fe, x as Pe, y as Ue, e as ae, f as X, R as se, J as Be, a9 as Me, D as W, i as N, h as Le } from "./app-Du-JrqLm.js";
2
2
  import { useCoreStore as Z, useI18n as ee } from "@feedmepos/mf-common";
3
3
  import { useDialogChild as Qe, useSnackbar as he, useDialog as He, FmButtonVariant as ie, components as le } from "@feedmepos/ui-library";
4
4
  import { defineStore as ve } from "pinia";
5
- import { defineComponent as ge, resolveComponent as B, openBlock as T, createElementBlock as k, createElementVNode as $, normalizeClass as M, createTextVNode as qe, toDisplayString as I, unref as R, createCommentVNode as L, createVNode as D, withCtx as G, Fragment as U, renderList as j, ref as C, onMounted as Ve, computed as ce, watch as je, createSlots as ze, createBlock as V, h as Y } from "vue";
5
+ import { defineComponent as ge, resolveComponent as B, openBlock as T, createElementBlock as w, createElementVNode as $, normalizeClass as M, createTextVNode as qe, toDisplayString as I, unref as E, createCommentVNode as L, createVNode as D, withCtx as G, Fragment as U, renderList as j, ref as C, onMounted as Ve, computed as ce, watch as je, createSlots as ze, createBlock as V, h as Y } from "vue";
6
6
  import { useRouter as Ke } from "vue-router";
7
- import { u as te } from "./supplier-5uoaiSy6.js";
8
- const be = Re((e, t) => {
9
- function s() {
7
+ import { u as te } from "./supplier-Cy-jlD0j.js";
8
+ const be = Ee((e, t) => {
9
+ function i() {
10
10
  var n;
11
11
  return `business_${((n = Z().currentBusiness.value) == null ? void 0 : n._id) ?? ""}`;
12
12
  }
13
13
  return {
14
14
  async getTemplate(c) {
15
- const a = s(), n = `${e.inventoryBackendUrl}/${a}/purchase-order-template/${c}`;
15
+ const a = i(), n = `${e.inventoryBackendUrl}/${a}/purchase-order-template/${c}`;
16
16
  return t.get(n);
17
17
  },
18
18
  async readTemplates() {
19
- const c = s(), a = `${e.inventoryBackendUrl}/${c}/purchase-order-template`;
19
+ const c = i(), a = `${e.inventoryBackendUrl}/${c}/purchase-order-template`;
20
20
  return t.get(a);
21
21
  },
22
22
  async createTemplate(c) {
23
- const a = s(), n = `${e.inventoryBackendUrl}/${a}/purchase-order-template`;
23
+ const a = i(), n = `${e.inventoryBackendUrl}/${a}/purchase-order-template`;
24
24
  return t.post(n, c);
25
25
  },
26
26
  async updateTemplate(c) {
27
- const a = s(), n = `${e.inventoryBackendUrl}/${a}/purchase-order-template`;
27
+ const a = i(), n = `${e.inventoryBackendUrl}/${a}/purchase-order-template`;
28
28
  return t.put(n, c);
29
29
  },
30
30
  async deleteTemplate(c) {
31
- const a = s(), n = `${e.inventoryBackendUrl}/${a}/purchase-order-template`;
31
+ const a = i(), n = `${e.inventoryBackendUrl}/${a}/purchase-order-template`;
32
32
  return t.delete(n, { _id: c._id, _rev: c._rev });
33
33
  },
34
34
  async importTemplates(c) {
35
- const a = s(), n = `${e.inventoryBackendUrl}/${a}/purchase-order-template/import`;
35
+ const a = i(), n = `${e.inventoryBackendUrl}/${a}/purchase-order-template/import`;
36
36
  return t.post(n, c);
37
37
  }
38
38
  };
39
39
  });
40
- function xe(e) {
41
- const t = Q(), s = e.sku, c = t.skuById[s._id];
42
- if (c.unit._id !== s.unit._id) return !0;
40
+ function Se(e) {
41
+ const t = Q(), i = e.sku, c = t.skuById[i._id];
42
+ if (c.unit._id !== i.unit._id) return !0;
43
43
  const a = e.measurement;
44
44
  return a ? !t.unitById[c.unit._id].measurements.find((o) => o.id === a.id) : !1;
45
45
  }
46
- var E = /* @__PURE__ */ ((e) => (e.PURCHASE = "PURCHASE", e.TRANSFER = "TRANSFER", e))(E || {}), re = /* @__PURE__ */ ((e) => (e.Source = "Source", e.Destination = "Destination", e.Ingredient = "Ingredient", e))(re || {});
46
+ var R = /* @__PURE__ */ ((e) => (e.PURCHASE = "PURCHASE", e.TRANSFER = "TRANSFER", e))(R || {}), re = /* @__PURE__ */ ((e) => (e.Source = "Source", e.Destination = "Destination", e.Ingredient = "Ingredient", e))(re || {});
47
47
  const me = Ie(0);
48
- function Se(e) {
48
+ function xe(e) {
49
49
  var c;
50
50
  const t = e.sku;
51
51
  return {
@@ -97,17 +97,17 @@ function Te() {
97
97
  }
98
98
  function We(e) {
99
99
  var o;
100
- const s = Z().currentBusiness.value, a = (o = e.map((l) => {
101
- var x;
102
- const d = l.purchaseOrder.items.map((r) => Se(r)), h = Te(), y = [
100
+ const i = Z().currentBusiness.value, a = (o = e.map((l) => {
101
+ var b;
102
+ const d = l.purchaseOrder.items.map((r) => xe(r)), h = Te(), y = [
103
103
  ["Template ID", l._id],
104
104
  ["Template name", l.name],
105
- ["Business name", s == null ? void 0 : s.name],
106
- ["Business ID", s == null ? void 0 : s._id],
107
- ["Menu version", s == null ? void 0 : s.menuVersion],
105
+ ["Business name", i == null ? void 0 : i.name],
106
+ ["Business ID", i == null ? void 0 : i._id],
107
+ ["Menu version", i == null ? void 0 : i.menuVersion],
108
108
  [
109
109
  "Purchase/Transfer",
110
- typeof l.purchaseOrder.supplier.internal == "string" ? E.TRANSFER : E.PURCHASE
110
+ typeof l.purchaseOrder.supplier.internal == "string" ? R.TRANSFER : R.PURCHASE
111
111
  ],
112
112
  [
113
113
  "Transfer from",
@@ -116,12 +116,15 @@ function We(e) {
116
116
  l.purchaseOrder.supplier._id
117
117
  ].filter((r) => r).join("_")})`
118
118
  ],
119
- ["Location codes", ...((x = l.locations) == null ? void 0 : x.map((r) => `${r.name} (${r.dbName})`)) ?? ["All"]],
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((S) => r[S.id]))
127
+ ...d.map((r) => h.map((x) => r[x.id]))
125
128
  ], m = h.map((r) => `system:${r.id}`), v = F(y, m);
126
129
  return { name: l.name, sheet: v };
127
130
  }).reduce(
@@ -134,11 +137,11 @@ function We(e) {
134
137
  sheets: {},
135
138
  sheetOccurence: {}
136
139
  }
137
- )) == null ? void 0 : o.sheets, n = `${s == null ? void 0 : s.name} transfer templates (${Ae(/* @__PURE__ */ new Date())}).xlsx`, f = pe(a);
140
+ )) == null ? void 0 : o.sheets, n = `${i == null ? void 0 : i.name} transfer templates (${Ae(/* @__PURE__ */ new Date())}).xlsx`, f = pe(a);
138
141
  return fe(f, n), n;
139
142
  }
140
143
  function Ye() {
141
- const e = Z(), t = te(), s = z(), c = Q(), a = e.currentBusiness.value, n = Se({
144
+ const e = Z(), t = te(), i = z(), c = Q(), a = e.currentBusiness.value, n = xe({
142
145
  sku: {
143
146
  unit: {
144
147
  _id: "",
@@ -203,32 +206,32 @@ function Ye() {
203
206
  r.address.state,
204
207
  r.address.country
205
208
  ]),
206
- ...s.locations.map((r) => {
207
- var S, _, p, i, u, g;
209
+ ...i.locations.map((r) => {
210
+ var x, _, u, s, p, S;
208
211
  return [
209
212
  `${r.name} (${r.dbName})`,
210
213
  "Transfer",
211
- (S = r.doc.profile.address) == null ? void 0 : S.line1,
214
+ (x = r.doc.profile.address) == null ? void 0 : x.line1,
212
215
  (_ = r.doc.profile.address) == null ? void 0 : _.line2,
213
- (p = r.doc.profile.address) == null ? void 0 : p.city,
214
- (i = r.doc.profile.address) == null ? void 0 : i.postcode,
215
- (u = r.doc.profile.address) == null ? void 0 : u.state,
216
- (g = r.doc.profile.address) == null ? void 0 : g.country
216
+ (u = r.doc.profile.address) == null ? void 0 : u.city,
217
+ (s = r.doc.profile.address) == null ? void 0 : s.postcode,
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
224
  ), y = F(
222
- s.locations.map((r) => {
223
- var S, _, p, i, u, g;
225
+ i.locations.map((r) => {
226
+ var x, _, u, s, p, S;
224
227
  return [
225
228
  `${r.name} (${r.dbName})`,
226
- (S = r.doc.profile.address) == null ? void 0 : S.line1,
229
+ (x = r.doc.profile.address) == null ? void 0 : x.line1,
227
230
  (_ = r.doc.profile.address) == null ? void 0 : _.line2,
228
- (p = r.doc.profile.address) == null ? void 0 : p.city,
229
- (i = r.doc.profile.address) == null ? void 0 : i.postcode,
230
- (u = r.doc.profile.address) == null ? void 0 : u.state,
231
- (g = r.doc.profile.address) == null ? void 0 : g.country
231
+ (u = r.doc.profile.address) == null ? void 0 : u.city,
232
+ (s = r.doc.profile.address) == null ? void 0 : s.postcode,
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"]
@@ -237,7 +240,7 @@ function Ye() {
237
240
  r.code,
238
241
  r.name,
239
242
  r.unit.abbrev,
240
- ...r.unit.measurements.map((S) => S.abbrev)
243
+ ...r.unit.measurements.map((x) => x.abbrev)
241
244
  ]),
242
245
  ["Code", "Name", "Base unit", "Measurements"]
243
246
  ), v = pe({
@@ -245,26 +248,26 @@ function Ye() {
245
248
  Source: h,
246
249
  Destination: y,
247
250
  Ingredient: m
248
- }), x = `${a == null ? void 0 : a.name} transfer templates import.xlsx`;
249
- return fe(v, x), x;
251
+ }), b = `${a == null ? void 0 : a.name} transfer templates import.xlsx`;
252
+ return fe(v, b), b;
250
253
  }
251
254
  function Ge(e, t) {
252
- const s = new Array(), c = /(.*) \(((supplier_|warehouse_|restaurant_).{24,})\)/, n = z().locationByDbName, o = te().supplierById, l = e.trim(), d = c.exec(l);
255
+ const i = new Array(), c = /(.*) \(((supplier_|warehouse_|restaurant_).{24,})\)/, n = z().locationByDbName, o = te().supplierById, l = e.trim(), d = c.exec(l);
253
256
  if (!d)
254
- return s.push(`Transfer from location value of ${l} cannot be read.`), {
255
- errors: s
257
+ return i.push(`Transfer from location value of ${l} cannot be read.`), {
258
+ errors: i
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 !== E.PURCHASE && s.push(`Expected transfer type Purchase but found ${t} instead.`);
263
+ m = o[y], t !== R.PURCHASE && i.push(`Expected transfer type Purchase but found ${t} instead.`);
261
264
  else {
262
265
  const v = n[y];
263
266
  if (!v)
264
- return s.push(`Location (${h}) of id ${y} is not found.`), {
265
- errors: s
267
+ return i.push(`Location (${h}) of id ${y} is not found.`), {
268
+ errors: i
266
269
  };
267
- h !== v.name && s.push(
270
+ h !== v.name && i.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,
@@ -287,7 +290,7 @@ function Ge(e, t) {
287
290
  }
288
291
  return {
289
292
  from: m,
290
- errors: s
293
+ errors: i
291
294
  };
292
295
  }
293
296
  function Je(e) {
@@ -314,7 +317,7 @@ function Je(e) {
314
317
  function Xe(e) {
315
318
  const [
316
319
  t,
317
- s,
320
+ i,
318
321
  c,
319
322
  a,
320
323
  n,
@@ -326,9 +329,9 @@ function Xe(e) {
326
329
  y
327
330
  ] = ye(e);
328
331
  return {
329
- id: `${s[1] ?? ""}`.trim(),
332
+ id: `${i[1] ?? ""}`.trim(),
330
333
  name: `${c[1] ?? ""}`.trim(),
331
- type: `${o[1] ?? ""}`.trim().toLocaleLowerCase() === "transfer" ? E.TRANSFER : E.PURCHASE,
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(),
@@ -338,7 +341,7 @@ function Xe(e) {
338
341
  function Ze(e) {
339
342
  const [
340
343
  t,
341
- s,
344
+ i,
342
345
  c,
343
346
  a,
344
347
  n,
@@ -350,11 +353,11 @@ function Ze(e) {
350
353
  y,
351
354
  m,
352
355
  v,
353
- ...x
356
+ ...b
354
357
  ] = ye(e);
355
- if (!t || !t.length || t.some((i) => i.length && !i.startsWith("system:")))
358
+ if (!t || !t.length || t.some((s) => s.length && !s.startsWith("system:")))
356
359
  throw new Error("Missing meta header. Excel file does not come from the template.");
357
- const r = t.map((i) => i.split(":")[1]), _ = [
360
+ const r = t.map((s) => s.split(":")[1]), _ = [
358
361
  "code",
359
362
  "name",
360
363
  "unit",
@@ -362,31 +365,31 @@ function Ze(e) {
362
365
  "minimumQuantity",
363
366
  "maximumQuantity",
364
367
  "quantityStep"
365
- ].filter((i) => !r.includes(i));
368
+ ].filter((s) => !r.includes(s));
366
369
  if (_.length)
367
370
  throw new Error(
368
371
  `Missing meta headers (${_.join()}). Excel file does not come from the template.`
369
372
  );
370
- return x.map((i, u) => {
371
- const g = {};
372
- for (const w in r) {
373
- const b = r[w];
374
- Object.assign(g, { [b]: i[w] });
373
+ return b.map((s, p) => {
374
+ const S = {};
375
+ for (const k in r) {
376
+ const g = r[k];
377
+ Object.assign(S, { [g]: s[k] });
375
378
  }
376
379
  return {
377
- index: u,
378
- data: g
380
+ index: p,
381
+ data: S
379
382
  };
380
383
  });
381
384
  }
382
- function et(e, t, s) {
385
+ function et(e, t, i) {
383
386
  const c = Q(), a = 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 (s.filter((u) => u.data.code === e.code).length > 1)
392
+ if (i.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 g = {
401
+ const s = {
399
402
  sku: n,
400
403
  code: e.overrideCode || n.code,
401
404
  name: n.name,
@@ -406,13 +409,13 @@ function et(e, t, s) {
406
409
  maximumQuantity: { amount: 0, precision: 0 }
407
410
  };
408
411
  if (a.isEnabled) {
409
- const w = a.getItemPKTCode(n);
410
- w && (g.code = w);
412
+ const p = a.getItemPKTCode(n);
413
+ p && (s.code = p);
411
414
  }
412
415
  return {
413
416
  index: t,
414
417
  errors: f,
415
- templateItem: g
418
+ templateItem: s
416
419
  };
417
420
  }
418
421
  const d = H(
@@ -423,32 +426,32 @@ function et(e, t, s) {
423
426
  const h = De(d), y = H(
424
427
  e.minimumQuantity,
425
428
  q(o, l)
426
- ), m = h(y);
427
- typeof m == "string" && f.push(`Minimum amount: ${m}`);
428
- const v = H(
429
+ );
430
+ h(y);
431
+ const m = H(
429
432
  e.maximumQuantity,
430
433
  q(o, l)
431
- ), x = h(v);
432
- typeof x == "string" && f.push(`Maximum amount: ${x}`), +e.minimumQuantity > +e.maximumQuantity && f.push("Minimum amount must be less than or equal to maximum amount");
433
- const r = Oe(+e.minimumQuantity, +e.maximumQuantity), S = H(
434
+ );
435
+ h(m), +e.minimumQuantity > +e.maximumQuantity && f.push("Minimum amount must be less than or equal to maximum amount");
436
+ const v = Oe(+e.minimumQuantity, +e.maximumQuantity), b = H(
434
437
  e.defaultQuantity,
435
438
  q(o, l)
436
- ), _ = h(S), p = r(`${e.defaultQuantity}`);
437
- typeof _ == "string" && f.push(`Default amount: ${_}`), typeof p == "string" && f.push(`Default amount: ${p}`);
438
- const i = {
439
+ ), 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: S,
446
+ quantity: b,
444
447
  quantityStep: d,
445
448
  minimumQuantity: y,
446
- maximumQuantity: v
449
+ maximumQuantity: m
447
450
  };
448
451
  return {
449
452
  index: t,
450
453
  errors: f,
451
- templateItem: i
454
+ templateItem: _
452
455
  };
453
456
  }
454
457
  function tt(e) {
@@ -458,24 +461,24 @@ function tt(e) {
458
461
  try {
459
462
  return t.reduce(
460
463
  (n, f) => {
461
- var i;
464
+ var s;
462
465
  const o = new Array(), l = e.Sheets[f], d = Xe(l), h = Ge(d.transferFrom, d.type);
463
466
  o.push(...h.errors);
464
- const y = h.from, m = Je(d.locations), v = m.filter((u) => u.location).map((u) => u.location);
465
- o.push(...m.flatMap((u) => u.errors));
466
- const x = Ze(l).filter((u) => u.data.code), r = x.map(
467
- (u, g) => et(u.data, g, x)
467
+ const y = h.from, m = Je(d.locations), v = m.filter((p) => p.location).map((p) => p.location);
468
+ o.push(...m.flatMap((p) => p.errors));
469
+ const b = Ze(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
- (u) => u.errors.map((g) => `(Excel row ${u.index + 14}) ${g}`)
474
+ (p) => p.errors.map((S) => `(Excel row ${p.index + 14}) ${S}`)
472
475
  )
473
476
  );
474
- const S = r.filter((u) => u.templateItem).map((u) => u.templateItem);
477
+ const x = r.filter((p) => p.templateItem).map((p) => p.templateItem);
475
478
  if (d.id) {
476
- const u = a[d.id];
477
- if (!u) {
478
- const w = {
479
+ const p = a[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: w,
487
- template: w,
489
+ original: k,
490
+ template: k,
488
491
  excelSheetName: f,
489
492
  errors: o
490
493
  }), n;
491
494
  }
492
- const g = {
495
+ const S = {
493
496
  type: "update",
494
- original: u,
497
+ original: p,
495
498
  template: {
496
- ...u,
499
+ ...p,
497
500
  name: d.name,
498
501
  locations: v.length ? v : null,
499
502
  purchaseOrder: {
500
- ...u.purchaseOrder,
501
- supplier: y ?? ((i = u.purchaseOrder) == null ? void 0 : i.supplier),
503
+ ...p.purchaseOrder,
504
+ supplier: y ?? ((s = p.purchaseOrder) == null ? void 0 : s.supplier),
502
505
  ref: d.reference,
503
506
  remark: d.remark,
504
- items: S
507
+ items: x
505
508
  }
506
509
  },
507
510
  excelSheetName: f,
508
511
  errors: o
509
512
  };
510
- return n.importUpdateResult.push(g), n;
513
+ return n.importUpdateResult.push(S), n;
511
514
  }
512
- const p = {
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
521
  supplier: y ?? _e(),
519
522
  ref: d.reference,
520
523
  remark: d.remark,
521
- items: S
524
+ items: x
522
525
  }
523
526
  },
524
527
  excelSheetName: f,
525
528
  errors: o
526
529
  };
527
- return n.importCreateResult.push(p), n;
530
+ return n.importCreateResult.push(u), n;
528
531
  },
529
532
  {
530
533
  invalidExcel: !1,
@@ -577,11 +580,11 @@ 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, s) => {
583
+ return (t, i) => {
581
584
  var n, f, o;
582
585
  const c = B("FmIcon"), a = B("FmTooltip");
583
- return T(), k("div", nt, [
584
- s[0] || (s[0] = $("div", null, "•", -1)),
586
+ return T(), w("div", nt, [
587
+ i[0] || (i[0] = $("div", null, "•", -1)),
585
588
  $("div", ot, [
586
589
  $("div", at, [
587
590
  $("div", {
@@ -590,14 +593,14 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
590
593
  })
591
594
  }, [
592
595
  qe(I(t.name) + " ", 1),
593
- $("span", st, " (" + I(R(Fe)(`${t.transferType}`)) + ") ", 1),
594
- t.type === "create" ? (T(), k("span", it, "(new)")) : L("", !0)
596
+ $("span", st, " (" + I(E(Fe)(`${t.transferType}`)) + ") ", 1),
597
+ t.type === "create" ? (T(), w("span", it, "(new)")) : L("", !0)
595
598
  ], 2),
596
- t.errors.length ? (T(), k("div", lt, [
599
+ t.errors.length ? (T(), w("div", lt, [
597
600
  D(a, { "z-index": 50 }, {
598
601
  content: G(() => [
599
602
  $("ol", null, [
600
- (T(!0), k(U, null, j(t.errors, (l, d) => (T(), k("li", { key: d }, I(l), 1))), 128))
603
+ (T(!0), w(U, null, j(t.errors, (l, d) => (T(), w("li", { key: d }, I(l), 1))), 128))
601
604
  ])
602
605
  ]),
603
606
  default: G(() => [
@@ -639,7 +642,7 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
639
642
  }, vt = { class: "fm-typo-en-body-lg-600" }, gt = /* @__PURE__ */ ge({
640
643
  __name: "TransferTemplateImport",
641
644
  setup(e) {
642
- const t = C(null), s = Qe(), c = he(), a = C(!1), n = C(!1), f = te();
645
+ const t = C(null), i = Qe(), c = he(), a = C(!1), n = C(!1), f = te();
643
646
  Ve(async () => {
644
647
  n.value = !0;
645
648
  try {
@@ -655,37 +658,37 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
655
658
  }
656
659
  });
657
660
  const o = C(new Array()), l = C([]), d = C([]), h = ce(
658
- () => !!o.value.length || l.value.some((x) => x.errors.length) || d.value.some((x) => x.errors.length)
661
+ () => !!o.value.length || l.value.some((b) => b.errors.length) || d.value.some((b) => b.errors.length)
659
662
  ), y = ce(
660
663
  () => !!l.value.length || !!d.value.length
661
664
  ), { t: m } = ee();
662
- async function v(x) {
665
+ async function v(b) {
663
666
  o.value = [], l.value = [], d.value = [];
664
667
  try {
665
668
  a.value = !0;
666
669
  const [r] = await Promise.all([
667
- Ue(x),
670
+ Ue(b),
668
671
  // fake buffer
669
- new Promise((i) => setTimeout(i, 1e3))
672
+ new Promise((s) => setTimeout(s, 1e3))
670
673
  ]);
671
674
  if (!r.SheetNames.filter(
672
- (i) => !Object.values(re).map(String).includes(i)
673
- ).find((i) => i)) {
675
+ (s) => !Object.values(re).map(String).includes(s)
676
+ ).find((s) => s)) {
674
677
  o.value.push(m("inventory.ingredient.import.fileError.noSheet"));
675
678
  return;
676
679
  }
677
- const p = tt(r);
678
- if (p.invalidExcel) {
680
+ const u = tt(r);
681
+ if (u.invalidExcel) {
679
682
  o.value.push(
680
- p.invalidExcelMessage ?? m("inventory.ingredient.import.fileError.invalidExcel")
683
+ u.invalidExcelMessage ?? m("inventory.ingredient.import.fileError.invalidExcel")
681
684
  );
682
685
  return;
683
686
  }
684
- if (l.value = p.importCreateResult, d.value = p.importUpdateResult, !l.value.length && !d.value.length) {
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
- s.emitData(p);
691
+ i.emitData(u);
689
692
  } catch (r) {
690
693
  c.open({
691
694
  title: m("inventory.ingredient.import.fileError.unableToRead"),
@@ -699,34 +702,34 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
699
702
  }), a.value = !1;
700
703
  }
701
704
  }
702
- return je(t, (x) => {
703
- x && v(x);
704
- }), (x, r) => {
705
- const S = B("FmCircularProgress"), _ = B("FmIcon"), p = B("FmButton");
706
- return T(), k("div", ct, [
705
+ return je(t, (b) => {
706
+ b && v(b);
707
+ }), (b, r) => {
708
+ const x = B("FmCircularProgress"), _ = B("FmIcon"), u = B("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(), k("div", mt, [
711
+ n.value ? (T(), w("div", mt, [
709
712
  $("div", null, [
710
- D(S, {
713
+ D(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(), k(U, { key: 1 }, [
719
+ ])) : (T(), w(U, { key: 1 }, [
717
720
  D(Pe, {
718
721
  class: M({
719
722
  "w-full": !0,
720
723
  "h-[200px]": !t.value
721
724
  }),
722
725
  accept: ".xlsx",
723
- onFileUpload: r[0] || (r[0] = (i) => t.value = i),
724
- label: R(m)("inventory.ingredient.import.uploadTemplate"),
725
- "button-label": R(m)("inventory.ingredient.import.selectFile")
726
+ onFileUpload: r[0] || (r[0] = (s) => t.value = s),
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: G(({ openFileDialog: i }) => [
732
+ fn: G(({ openFileDialog: s }) => [
730
733
  $("div", ut, [
731
734
  $("div", {
732
735
  class: M([
@@ -738,7 +741,7 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
738
741
  }
739
742
  ])
740
743
  }, [
741
- a.value ? (T(), V(S, {
744
+ a.value ? (T(), V(x, {
742
745
  key: 0,
743
746
  size: "md",
744
747
  color: "neutral-gray-200"
@@ -759,18 +762,18 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
759
762
  }, [
760
763
  $("div", dt, I(t.value.name), 1)
761
764
  ], 2),
762
- a.value ? L("", !0) : (T(), k("div", pt, [
763
- D(p, {
764
- label: R(m)("inventory.ingredient.import.replaceFile"),
765
+ a.value ? L("", !0) : (T(), w("div", pt, [
766
+ D(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
- onClick: i
770
+ onClick: s
768
771
  }, null, 8, ["label", "variant", "prepend-icon", "onClick"])
769
772
  ]))
770
773
  ], 2),
771
- o.value.length ? (T(), k("div", ft, [
772
- (T(!0), k(U, null, j(o.value, (u, g) => (T(), k("div", {
773
- key: g,
774
+ o.value.length ? (T(), w("div", ft, [
775
+ (T(!0), w(U, null, j(o.value, (p, S) => (T(), w("div", {
776
+ key: S,
774
777
  class: "flex gap-8 items-center"
775
778
  }, [
776
779
  D(_, {
@@ -778,7 +781,7 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
778
781
  size: "sm",
779
782
  color: "system-error-300"
780
783
  }),
781
- $("div", yt, I(u), 1)
784
+ $("div", yt, I(p), 1)
782
785
  ]))), 128))
783
786
  ])) : L("", !0)
784
787
  ])
@@ -786,24 +789,24 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
786
789
  key: "0"
787
790
  } : void 0
788
791
  ]), 1032, ["class", "label", "button-label"]),
789
- y.value ? (T(), k("div", ht, [
790
- $("div", vt, I(R(m)("inventory.ingredient.import.summary")), 1),
791
- (T(!0), k(U, null, j(l.value, (i, u) => (T(), V(ue, {
792
- key: u,
793
- name: i.template.name,
794
- "transfer-type": typeof i.template.purchaseOrder.supplier.internal == "string" ? R(E).TRANSFER : R(E).PURCHASE,
795
- locations: i.template.locations,
796
- items: i.template.purchaseOrder.items,
797
- errors: i.errors,
792
+ y.value ? (T(), w("div", ht, [
793
+ $("div", vt, I(E(m)("inventory.ingredient.import.summary")), 1),
794
+ (T(!0), w(U, null, j(l.value, (s, p) => (T(), V(ue, {
795
+ key: p,
796
+ name: s.template.name,
797
+ "transfer-type": typeof s.template.purchaseOrder.supplier.internal == "string" ? E(R).TRANSFER : E(R).PURCHASE,
798
+ locations: s.template.locations,
799
+ items: s.template.purchaseOrder.items,
800
+ errors: s.errors,
798
801
  type: "create"
799
802
  }, null, 8, ["name", "transfer-type", "locations", "items", "errors"]))), 128)),
800
- (T(!0), k(U, null, j(d.value, (i) => (T(), V(ue, {
801
- key: i.template._id,
802
- name: i.template.name,
803
- "transfer-type": typeof i.template.purchaseOrder.supplier.internal == "string" ? R(E).TRANSFER : R(E).PURCHASE,
804
- locations: i.template.locations,
805
- items: i.template.purchaseOrder.items,
806
- errors: i.errors,
803
+ (T(!0), w(U, null, j(d.value, (s) => (T(), V(ue, {
804
+ key: s.template._id,
805
+ name: s.template.name,
806
+ "transfer-type": typeof s.template.purchaseOrder.supplier.internal == "string" ? E(R).TRANSFER : E(R).PURCHASE,
807
+ locations: s.template.locations,
808
+ items: s.template.purchaseOrder.items,
809
+ errors: s.errors,
807
810
  type: "update"
808
811
  }, null, 8, ["name", "transfer-type", "locations", "items", "errors"]))), 128))
809
812
  ])) : L("", !0)
@@ -820,33 +823,33 @@ 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 s = t.getNetSuiteLocation(`${e.internal}_${e._id}`), c = t.getLocationSubsidiary(s == null ? void 0 : s.netSuiteId).id, a = (f = t.currentLocationSubsidiary()) == null ? void 0 : f.id;
826
+ const i = t.getNetSuiteLocation(`${e.internal}_${e._id}`), c = t.getLocationSubsidiary(i == null ? void 0 : i.netSuiteId).id, a = (f = t.currentLocationSubsidiary()) == null ? void 0 : f.id;
824
827
  return c && c == a;
825
828
  }
826
- const xt = ve("transferTemplateActions", () => {
827
- const e = He(), t = he(), s = z(), c = $e(), a = be(), n = J(), f = Ke(), { t: o } = ee(), l = C({});
829
+ const St = ve("transferTemplateActions", () => {
830
+ const e = He(), t = he(), i = z(), c = $e(), a = be(), n = J(), f = Ke(), { t: o } = ee(), l = C({});
828
831
  function d() {
829
832
  l.value = {
830
833
  mode: ae.CREATE,
831
834
  show: !0,
832
- "onUpdate:show"(p) {
833
- l.value.show = p;
835
+ "onUpdate:show"(u) {
836
+ l.value.show = u;
834
837
  }
835
838
  };
836
839
  }
837
- function h(p) {
840
+ function h(u) {
838
841
  l.value = {
839
842
  mode: ae.UPDATE,
840
- modelValue: p,
843
+ modelValue: u,
841
844
  show: !0,
842
- "onUpdate:show"(i) {
843
- l.value.show = i;
845
+ "onUpdate:show"(s) {
846
+ l.value.show = s;
844
847
  }
845
848
  };
846
849
  }
847
- function y(p, i, u) {
850
+ function y(u, s, p) {
848
851
  e.open({
849
- title: `Confirm deleting template ${p.name}?`,
852
+ title: `Confirm deleting template ${u.name}?`,
850
853
  message: "Deleted template can no longer be retrieved",
851
854
  primaryActions: {
852
855
  text: "Delete",
@@ -860,54 +863,54 @@ const xt = ve("transferTemplateActions", () => {
860
863
  }
861
864
  }).onPrimary(async () => {
862
865
  t.open({
863
- title: `Deleting ${p.name}`,
866
+ title: `Deleting ${u.name}`,
864
867
  type: "info"
865
868
  });
866
869
  try {
867
- i.value = !0;
868
- const [g] = await Promise.allSettled([
869
- a.deleteTemplate(p),
870
- new Promise((w) => setTimeout(w, 1e3))
870
+ s.value = !0;
871
+ const [S] = await Promise.allSettled([
872
+ a.deleteTemplate(u),
873
+ new Promise((k) => setTimeout(k, 1e3))
871
874
  ]);
872
- if (g.status === "rejected") throw g.reason;
875
+ if (S.status === "rejected") throw S.reason;
873
876
  t.open({
874
- title: `Deleted ${p.name}`,
877
+ title: `Deleted ${u.name}`,
875
878
  type: "success"
876
879
  });
877
- } catch (g) {
880
+ } catch (S) {
878
881
  t.open({
879
- title: `Unable to delete ${p.name}`,
880
- message: `See error from server: ${g}`,
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", g);
885
+ }), console.error("error on deleting purchase order template", S);
883
886
  } finally {
884
- i.value = !1, u();
887
+ s.value = !1, p();
885
888
  }
886
889
  });
887
890
  }
888
891
  const m = C({});
889
- function v(p) {
892
+ function v(u) {
890
893
  m.value = {
891
- template: p,
894
+ template: u,
892
895
  show: !0,
893
- "onUpdate:show"(i) {
894
- m.value.show = i;
896
+ "onUpdate:show"(s) {
897
+ m.value.show = s;
895
898
  },
896
899
  "onAction:edit"() {
897
- m.value.show = !1, h(X(p));
900
+ m.value.show = !1, h(X(u));
898
901
  }
899
902
  };
900
903
  }
901
- function x() {
902
- const { promise: p, resolve: i } = Promise.withResolvers(), u = (b) => {
903
- i(b);
904
- }, g = c.templates.filter(
905
- (b) => {
904
+ function b() {
905
+ const { promise: u, resolve: s } = Promise.withResolvers(), p = (g) => {
906
+ s(g);
907
+ }, S = c.templates.filter(
908
+ (g) => {
906
909
  var A;
907
- return (!b.locations || b.locations.find((O) => O.doc._id === s.currentLocation.doc._id)) && ((A = b.purchaseOrder.supplier) == null ? void 0 : A._id) !== s.currentLocation.doc._id;
910
+ return (!g.locations || g.locations.find((O) => O.doc._id === i.currentLocation.doc._id)) && ((A = g.purchaseOrder.supplier) == null ? void 0 : A._id) !== i.currentLocation.doc._id;
908
911
  }
909
912
  );
910
- if (!g.length)
913
+ if (!S.length)
911
914
  return e.open({
912
915
  title: "Select one template",
913
916
  message: "There is no available template in your business. Configure a new template?",
@@ -920,26 +923,26 @@ const xt = ve("transferTemplateActions", () => {
920
923
  close: !0
921
924
  }
922
925
  }).onPrimary(() => {
923
- f.push({ name: se.TRANSFER_TEMPLATE }), u(void 0);
924
- }).onSecondary(() => u(void 0)).onClose(() => u(void 0)), p;
925
- const w = g.map((b) => {
926
+ f.push({ name: se.TRANSFER_TEMPLATE }), p(void 0);
927
+ }).onSecondary(() => p(void 0)).onClose(() => p(void 0)), u;
928
+ const k = S.map((g) => {
926
929
  var ne;
927
- const A = !b.purchaseOrder.items.length || b.purchaseOrder.items.some(xe), O = !bt(b.purchaseOrder.supplier), K = b.purchaseOrder.supplier.internal ? n.getNetSuiteLocation(
928
- `${b.purchaseOrder.supplier.internal}_${b.purchaseOrder.supplier._id}`
929
- ) : n.getNetSuiteVendor(b.purchaseOrder.supplier._id), we = O ? `The subsidiary of the request
930
- location is ${(ne = n.getLocationSubsidiary(K == null ? void 0 : K.netSuiteId)) == null ? void 0 : ne.fullName}.` : void 0, ke = A || O, Ce = A ? "This template is invalid. Update this template." : O ? we : void 0, Ee = `${b.purchaseOrder.supplier.internal ? "Transfer" : "Purchase"} from ${b.purchaseOrder.supplier.name}`;
930
+ const A = !g.purchaseOrder.items.length || g.purchaseOrder.items.some(Se), O = !bt(g.purchaseOrder.supplier), K = g.purchaseOrder.supplier.internal ? n.getNetSuiteLocation(
931
+ `${g.purchaseOrder.supplier.internal}_${g.purchaseOrder.supplier._id}`
932
+ ) : n.getNetSuiteVendor(g.purchaseOrder.supplier._id), we = O ? `The subsidiary of the request
933
+ location is ${(ne = n.getLocationSubsidiary(K == null ? void 0 : K.netSuiteId)) == null ? void 0 : ne.fullName}.` : void 0, ke = A || O, Ce = A ? "This template is invalid. Update this template." : O ? we : void 0, Re = `${g.purchaseOrder.supplier.internal ? "Transfer" : "Purchase"} from ${g.purchaseOrder.supplier.name}`;
931
934
  return {
932
- label: b.name,
933
- value: b._id,
935
+ label: g.name,
936
+ value: g._id,
934
937
  disabled: ke,
935
- sublabel: Ce ?? Ee
938
+ sublabel: Ce ?? Re
936
939
  };
937
940
  });
938
- return w.sort((b, A) => +!!b.disabled - +!!A.disabled), e.open({
941
+ return k.sort((g, A) => +!!g.disabled - +!!A.disabled), e.open({
939
942
  title: "Select one template",
940
943
  contentComponent: Be,
941
944
  contentComponentProps: {
942
- items: w,
945
+ items: k,
943
946
  singleSelect: !0
944
947
  },
945
948
  primaryActions: {
@@ -954,9 +957,9 @@ const xt = ve("transferTemplateActions", () => {
954
957
  text: "Templates",
955
958
  close: !0
956
959
  }
957
- }).onPrimary((b) => Array.isArray(b) ? u(b[0]) : null).onSecondary(() => u(void 0)).onTertiary(() => {
958
- f.push({ name: se.TRANSFER_TEMPLATE }), u(void 0);
959
- }).onClose(() => u(void 0)), p;
960
+ }).onPrimary((g) => Array.isArray(g) ? p(g[0]) : null).onSecondary(() => p(void 0)).onTertiary(() => {
961
+ f.push({ name: se.TRANSFER_TEMPLATE }), p(void 0);
962
+ }).onClose(() => p(void 0)), u;
960
963
  }
961
964
  function r() {
962
965
  e.open({
@@ -977,15 +980,15 @@ const xt = ve("transferTemplateActions", () => {
977
980
  close: !1,
978
981
  variant: "plain"
979
982
  }
980
- }).onPrimary((p) => {
981
- if (!p) {
983
+ }).onPrimary((u) => {
984
+ if (!u) {
982
985
  t.open({
983
986
  title: o("inventory.ingredient.import.error.noData"),
984
987
  type: "error"
985
988
  });
986
989
  return;
987
990
  }
988
- if (!p.importCreateResult.length && !p.importUpdateResult.length) {
991
+ if (!u.importCreateResult.length && !u.importUpdateResult.length) {
989
992
  t.open({
990
993
  title: o("inventory.ingredient.import.error.invalidContent"),
991
994
  message: o("inventory.ingredient.import.error.noImportData"),
@@ -993,7 +996,7 @@ const xt = ve("transferTemplateActions", () => {
993
996
  });
994
997
  return;
995
998
  }
996
- if (p.importCreateResult.some((i) => i.errors.length) || p.importUpdateResult.some((i) => i.errors.length)) {
999
+ if (u.importCreateResult.some((s) => s.errors.length) || u.importUpdateResult.some((s) => s.errors.length)) {
997
1000
  t.open({
998
1001
  title: o("inventory.ingredient.import.error.invalidContent"),
999
1002
  message: o("inventory.ingredient.import.error.hasErrors"),
@@ -1001,49 +1004,49 @@ const xt = ve("transferTemplateActions", () => {
1001
1004
  });
1002
1005
  return;
1003
1006
  }
1004
- e.close(), S(p);
1007
+ e.close(), x(u);
1005
1008
  }).onTertiary(Ye);
1006
1009
  }
1007
- async function S(p) {
1010
+ async function x(u) {
1008
1011
  try {
1009
- const i = [
1010
- ...p.importCreateResult.map(
1011
- (b) => b.template
1012
+ const s = [
1013
+ ...u.importCreateResult.map(
1014
+ (g) => g.template
1012
1015
  ),
1013
- ...p.importUpdateResult.map(
1014
- (b) => b.template
1016
+ ...u.importUpdateResult.map(
1017
+ (g) => g.template
1015
1018
  )
1016
- ], u = 100;
1017
- let g = 0;
1018
- const w = () => {
1019
- g += u, t.open({
1019
+ ], p = 100;
1020
+ let S = 0;
1021
+ const k = () => {
1022
+ S += p, t.open({
1020
1023
  title: o("inventory.ingredient.import.progress", [
1021
- Math.min(g, i.length),
1022
- i.length
1024
+ Math.min(S, s.length),
1025
+ s.length
1023
1026
  ])
1024
1027
  });
1025
1028
  };
1026
- for (const b of i.chunk(100))
1027
- w(), await a.importTemplates(b);
1029
+ for (const g of s.chunk(100))
1030
+ k(), await a.importTemplates(g);
1028
1031
  t.open({
1029
1032
  title: o("inventory.ingredient.import.success"),
1030
1033
  type: "success"
1031
1034
  });
1032
- } catch (i) {
1035
+ } catch (s) {
1033
1036
  t.open({
1034
1037
  title: o("inventory.ingredient.import.error.failed"),
1035
- message: o("inventory.ingredient.import.error.systemMessage", [i == null ? void 0 : i.message]),
1038
+ message: o("inventory.ingredient.import.error.systemMessage", [s == null ? void 0 : s.message]),
1036
1039
  type: "error"
1037
- }), console.error("Error in importing skus", p, i);
1040
+ }), console.error("Error in importing skus", u, s);
1038
1041
  } finally {
1039
1042
  c.fetchTemplates();
1040
1043
  }
1041
1044
  }
1042
1045
  function _() {
1043
- const p = We(c.templates);
1046
+ const u = We(c.templates);
1044
1047
  t.open({
1045
1048
  title: o("inventory.ingredient.export.success"),
1046
- message: o("inventory.ingredient.export.filename", [p]),
1049
+ message: o("inventory.ingredient.export.filename", [u]),
1047
1050
  type: "success"
1048
1051
  });
1049
1052
  }
@@ -1052,7 +1055,7 @@ const xt = ve("transferTemplateActions", () => {
1052
1055
  viewTemplate: v,
1053
1056
  updateTemplate: h,
1054
1057
  deleteTemplate: y,
1055
- getTemplateId: x,
1058
+ getTemplateId: b,
1056
1059
  importTemplates: r,
1057
1060
  exportTemplates: _,
1058
1061
  templateDialogProps: l,
@@ -1060,13 +1063,13 @@ const xt = ve("transferTemplateActions", () => {
1060
1063
  };
1061
1064
  });
1062
1065
  function de(e) {
1063
- const { skuById: t } = Q(), s = X(e);
1064
- return s.purchaseOrder.items = e.purchaseOrder.items.filter((c) => t[c.sku._id]), s;
1066
+ const { skuById: t } = Q(), i = X(e);
1067
+ return i.purchaseOrder.items = e.purchaseOrder.items.filter((c) => t[c.sku._id]), i;
1065
1068
  }
1066
1069
  const $e = ve(
1067
1070
  "transferTemplateTable",
1068
1071
  function() {
1069
- const { t } = ee(), s = xt(), c = C(!1), a = C(new Array()), n = be(), f = Q();
1072
+ const { t } = ee(), i = St(), c = C(!1), a = C(new Array()), n = be(), f = Q();
1070
1073
  async function o() {
1071
1074
  a.value = [], c.value = !0;
1072
1075
  try {
@@ -1098,11 +1101,11 @@ const $e = ve(
1098
1101
  function d(y, m) {
1099
1102
  switch (m = X(m), y) {
1100
1103
  case N.Details:
1101
- return s.viewTemplate(m);
1104
+ return i.viewTemplate(m);
1102
1105
  case N.Edit:
1103
- return s.updateTemplate(m);
1106
+ return i.updateTemplate(m);
1104
1107
  case N.Delete:
1105
- return s.deleteTemplate(m, c, o);
1108
+ return i.deleteTemplate(m, c, o);
1106
1109
  }
1107
1110
  }
1108
1111
  return {
@@ -1133,7 +1136,7 @@ const $e = ve(
1133
1136
  textAlign: "right"
1134
1137
  },
1135
1138
  cell(y) {
1136
- const m = Number(y.getValue()) || 0, v = y.row.original.purchaseOrder.items.some(xe);
1139
+ const m = Number(y.getValue()) || 0, v = y.row.original.purchaseOrder.items.some(Se);
1137
1140
  return m === 0 || v ? Y("div", { class: "flex justify-end gap-4 items-center" }, [
1138
1141
  Y(
1139
1142
  le.FmTooltip,
@@ -1185,7 +1188,7 @@ const $e = ve(
1185
1188
  W[N.Edit],
1186
1189
  W[N.Delete]
1187
1190
  ];
1188
- return Le(v, (x) => d(x, m));
1191
+ return Le(v, (b) => d(b, m));
1189
1192
  },
1190
1193
  enableSorting: !1,
1191
1194
  size: 40,
@@ -1202,15 +1205,15 @@ const $e = ve(
1202
1205
  };
1203
1206
  }
1204
1207
  );
1205
- function Rt(e, t, s) {
1206
- const c = (s == null ? void 0 : s.abbrev) ?? t.abbrev;
1208
+ function Et(e, t, i) {
1209
+ const c = (i == null ? void 0 : i.abbrev) ?? t.abbrev;
1207
1210
  return `${P(e, !1)} ${c}`;
1208
1211
  }
1209
1212
  export {
1210
- E as P,
1213
+ R as P,
1211
1214
  be as a,
1212
- xt as b,
1213
- Rt as f,
1214
- xe as t,
1215
+ St as b,
1216
+ Et as f,
1217
+ Se as t,
1215
1218
  $e as u
1216
1219
  };