@feedmepos/mf-inventory-portal 1.2.7-dev.8 → 1.2.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 (89) hide show
  1. package/dist/{App-DIqdK9d8.js → App-BtLCesbn.js} +1 -1
  2. package/dist/{ApprovalView-BKK_eDzO.js → ApprovalView-Ba4XBhGf.js} +68 -69
  3. package/dist/{BindingsDialog-BRzOVR30.js → BindingsDialog-BbBUniCu.js} +2 -2
  4. package/dist/{BindingsPicker-BtCdvAgU.js → BindingsPicker-C3q3ROku.js} +1 -1
  5. package/dist/{BindingsTable-DnS3ypzP.js → BindingsTable-BTxWMif_.js} +1 -1
  6. package/dist/{ClosingDraftView-BZLUoCOk.js → ClosingDraftView-DGITBnaY.js} +203 -203
  7. package/dist/ClosingTemplateView-eRvwxXBq.js +1908 -0
  8. package/dist/{DeliveryOrderPrintPreview-ClbyQK9l.js → DeliveryOrderPrintPreview-CUaHpblV.js} +8 -8
  9. package/dist/{FmAdminBadge-DcDyRj6K.js → FmAdminBadge-BdwGZY-f.js} +6 -6
  10. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-lDkElrkF.js +227 -0
  11. package/dist/{FmMultiselectDialog-CYPN-2of.js → FmMultiselectDialog-BETfHs3j.js} +1 -1
  12. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-C4QKxv_V.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BNdbeRQp.js} +23 -23
  13. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-Bollyyl1.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-VYMMcwLl.js} +1 -1
  14. package/dist/{IngredientGroupView-baNWf_60.js → IngredientGroupView-C4d9b3Td.js} +12 -12
  15. package/dist/IngredientsView-BvqWuIVT.js +1876 -0
  16. package/dist/{IntegrationView-CiwxB7rj.js → IntegrationView-CWFzRDWO.js} +1552 -1430
  17. package/dist/{InventoryBindingForm-BCY8vtGx.js → InventoryBindingForm-Cx0Prlq8.js} +1 -1
  18. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-hjbfvhVh.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-cpR3Sf2Y.js} +41 -41
  19. package/dist/{InventoryBindingSummary-CCPxd5ir.js → InventoryBindingSummary-l8XvpxVU.js} +1 -1
  20. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CmqDgde9.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BjRvIX-v.js} +1 -1
  21. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DnpRhNG0.js → PremiumBadge.vue_vue_type_script_setup_true_lang-gjuZveKy.js} +11 -11
  22. package/dist/{PublishView-CDrYaJX9.js → PublishView-D2iUnDan.js} +14 -14
  23. package/dist/{PurchaseOrderPrintPreview-QeqPa532.js → PurchaseOrderPrintPreview-DdLvM-wt.js} +11 -11
  24. package/dist/{ReceiveRequestView-C8NJ7ILf.js → ReceiveRequestView-DpF5ZzvH.js} +145 -148
  25. package/dist/{RecipeView-Bmvl_poR.js → RecipeView-Dvtm8o1Y.js} +49 -49
  26. package/dist/StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js +59 -0
  27. package/dist/StockView-CRDu_GQ_.js +2086 -0
  28. package/dist/{SupplierView-Dq3vMn5q.js → SupplierView-7GtIJ3Fz.js} +1015 -1133
  29. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DbmLtbZt.js +2494 -0
  30. package/dist/{TransferTemplateView-NTw0N3zX.js → TransferTemplateView-Cmvg-yvW.js} +130 -131
  31. package/dist/{UnitView-BFeT0jpH.js → UnitView-DjVm1iVX.js} +59 -59
  32. package/dist/WarehouseView-CBso3SXT.js +1034 -0
  33. package/dist/api/inventory.d.ts +0 -8
  34. package/dist/api/netsuite.d.ts +0 -3
  35. package/dist/api/purchase-order-template.d.ts +0 -1
  36. package/dist/api/purchase-order.d.ts +0 -2
  37. package/dist/api/warehouse.d.ts +1 -3
  38. package/dist/{app-D5vamHiS.js → app-Z-ylwRmy.js} +17113 -17876
  39. package/dist/app.d.ts +9 -96
  40. package/dist/app.js +3 -3
  41. package/dist/components/FmEnhancedSelect.vue.d.ts +30 -0
  42. package/dist/components/FmInventoryTableToolbar.vue.d.ts +2 -9
  43. package/dist/{decimal-BVxO-7VE.js → decimal-D1pJ2776.js} +1 -1
  44. package/dist/{format-unit-display-CvUKKMA2.js → format-unit-display-9BMm-8A4.js} +404 -372
  45. package/dist/{index-_TXzIRmu.js → index-BOl10vcm.js} +1 -1
  46. package/dist/{index-BmPwzWR6.js → index-rEIM0AVC.js} +1 -1
  47. package/dist/{stock-4-rgOZcm.js → stock-B8ewk80v.js} +1 -1
  48. package/dist/stores/feature.d.ts +0 -10
  49. package/dist/stores/integration/netsuite.d.ts +0 -19
  50. package/dist/stores/inventory.d.ts +0 -1
  51. package/dist/stores/location.d.ts +1 -57
  52. package/dist/stores/supplier.d.ts +0 -96
  53. package/dist/stores/warehouse.d.ts +0 -4
  54. package/dist/{supplier-BOW9xXhe.js → supplier-DLSXYY1o.js} +1 -1
  55. package/dist/tsconfig.app.tsbuildinfo +1 -1
  56. package/dist/{use-ingredient-select-dialog-DbJhveFq.js → use-ingredient-select-dialog-CTjwdY3T.js} +5 -5
  57. package/dist/{use-inventory-binding-dialog-BNY9P_Pg.js → use-inventory-binding-dialog-zXJB7MQY.js} +8 -8
  58. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +0 -24
  59. package/dist/views/ingredients/components/ingredient-form/IngredientFormProps.d.ts +0 -6
  60. package/dist/views/integration/components/netsuite/business/BusinessNetSuiteSideSheet.vue.d.ts +0 -2
  61. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +0 -1
  62. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +0 -60
  63. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +0 -10
  64. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +0 -94
  65. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +1 -72
  66. package/dist/views/supplier/components/SupplierForm.vue.d.ts +0 -8
  67. package/dist/views/supplier/components/SupplierSupplyItemField.vue.d.ts +0 -3
  68. package/dist/views/supplier/composables/use-supplier-table.d.ts +0 -4
  69. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +0 -8
  70. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +0 -16
  71. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +0 -48
  72. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +0 -48
  73. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +0 -8
  74. package/package.json +2 -2
  75. package/dist/ClosingTemplateView-BwDaPcHe.js +0 -1862
  76. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Da5zZ3ZF.js +0 -230
  77. package/dist/IngredientsView-B00A9orQ.js +0 -2306
  78. package/dist/StockView-H8EcBWrt.js +0 -2104
  79. package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-D-H0oT-V.js +0 -158
  80. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-r7U0Wgsm.js +0 -3058
  81. package/dist/WarehouseView-50a9WiLB.js +0 -1066
  82. package/dist/api/shipment.d.ts +0 -11
  83. package/dist/closing-template-C8n1siov.js +0 -53
  84. package/dist/components/netsuite/SubsidiaryTreeDialog.vue.d.ts +0 -2
  85. package/dist/purchase-order-template-CekjfB92.js +0 -41
  86. package/dist/views/receive-request/components/delivery-order-form/CreateForm.vue.d.ts +0 -16
  87. package/dist/views/receive-request/components/delivery-order-form/CreateFormProps.d.ts +0 -4
  88. package/dist/views/receive-request/components/delivery-order-form/EditForm.vue.d.ts +0 -16
  89. package/dist/views/receive-request/components/delivery-order-form/EditFormProps.d.ts +0 -4
@@ -1,34 +1,65 @@
1
- import { a as q, Z as Ae, an as U, z as Ne, ao as ye, B as he, u as Z, k as L, C as De, x as le, E as ve, b as te, t as G, w as J, aQ as Oe, aI as Fe, a4 as Pe, G as Me, H as Ue, ap as Le, e as ce, f as re, R as me, s as Be, al as Qe, D as j, i as N, h as He } from "./app-D5vamHiS.js";
2
- import { useCoreStore as ge, useI18n as ne } from "@feedmepos/mf-common";
3
- import { useDialogChild as Ve, useSnackbar as be, useDialog as qe, FmButtonVariant as z, components as X } from "@feedmepos/ui-library";
1
+ import { a4 as Ae, a as q, V as Ie, al as M, v as De, am as he, w as ve, u as Z, j as B, x as Oe, aO as ce, y as ge, b as te, t as G, Z as J, aN as Fe, aF as Pe, a1 as Ue, z as Me, B as Be, an as Le, e as me, f as re, R as ue, a3 as Qe, aj as He, D as j, i as I, h as Ve } from "./app-Z-ylwRmy.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
4
  import { defineStore as xe } from "pinia";
5
- import { u as Se } from "./purchase-order-template-CekjfB92.js";
6
- import { defineComponent as oe, resolveComponent as Q, openBlock as _, createElementBlock as E, createElementVNode as C, normalizeClass as H, createTextVNode as je, toDisplayString as D, unref as A, createCommentVNode as V, createVNode as P, withCtx as ee, Fragment as B, renderList as Y, ref as R, onMounted as ze, computed as ue, watch as Ke, createSlots as Ye, createBlock as K, h as W } from "vue";
7
- import { useRouter as We } from "vue-router";
8
- import { u as ae } from "./supplier-BOW9xXhe.js";
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 N, onMounted as Ke, computed as de, watch as Ye, createSlots as We, createBlock as K, h as W } from "vue";
6
+ import { useRouter as Ge } from "vue-router";
7
+ import { u as se } from "./supplier-DLSXYY1o.js";
8
+ const Se = Ae((e, t) => {
9
+ function s() {
10
+ var o;
11
+ return `business_${((o = ne().currentBusiness.value) == null ? void 0 : o._id) ?? ""}`;
12
+ }
13
+ return {
14
+ async getTemplate(l) {
15
+ const i = s(), o = `${e.inventoryBackendUrl}/${i}/purchase-order-template/${l}`;
16
+ return t.get(o);
17
+ },
18
+ async readTemplates() {
19
+ const l = s(), i = `${e.inventoryBackendUrl}/${l}/purchase-order-template`;
20
+ return t.get(i);
21
+ },
22
+ async createTemplate(l) {
23
+ const i = s(), o = `${e.inventoryBackendUrl}/${i}/purchase-order-template`;
24
+ return t.post(o, l);
25
+ },
26
+ async updateTemplate(l) {
27
+ const i = s(), o = `${e.inventoryBackendUrl}/${i}/purchase-order-template`;
28
+ return t.put(o, l);
29
+ },
30
+ async deleteTemplate(l) {
31
+ const i = s(), o = `${e.inventoryBackendUrl}/${i}/purchase-order-template`;
32
+ return t.delete(o, { _id: l._id, _rev: l._rev });
33
+ },
34
+ async importTemplates(l) {
35
+ const i = s(), o = `${e.inventoryBackendUrl}/${i}/purchase-order-template/import`;
36
+ return t.post(o, l);
37
+ }
38
+ };
39
+ });
9
40
  function Te(e) {
10
- const t = q(), a = e.sku, u = t.skuById[a._id];
11
- if (u.unit._id !== a.unit._id) return !0;
41
+ const t = q(), s = e.sku, l = t.skuById[s._id];
42
+ if (l.unit._id !== s.unit._id) return !0;
12
43
  const i = e.measurement;
13
- return i ? !t.unitById[u.unit._id].measurements.find((l) => l.id === i.id) : !1;
44
+ return i ? !t.unitById[l.unit._id].measurements.find((c) => c.id === i.id) : !1;
14
45
  }
15
- var I = /* @__PURE__ */ ((e) => (e.PURCHASE = "PURCHASE", e.TRANSFER = "TRANSFER", e))(I || {}), se = /* @__PURE__ */ ((e) => (e.Source = "Source", e.Destination = "Destination", e.Ingredient = "Ingredient", e))(se || {});
16
- const de = Ae(0);
46
+ var R = /* @__PURE__ */ ((e) => (e.PURCHASE = "PURCHASE", e.TRANSFER = "TRANSFER", e))(R || {}), ie = /* @__PURE__ */ ((e) => (e.Source = "Source", e.Destination = "Destination", e.Ingredient = "Ingredient", e))(ie || {});
47
+ const pe = Ie(0);
17
48
  function _e(e) {
18
- var u;
49
+ var l;
19
50
  const t = e.sku;
20
51
  return {
21
52
  code: t.code,
22
53
  overrideCode: e.code,
23
54
  name: t.name,
24
- unit: ((u = t.unit.measurements.find((i) => i.id === t.trackingMeasurement)) == null ? void 0 : u.abbrev) ?? t.unit.abbrev,
25
- defaultQuantity: +L(e.quantity),
26
- minimumQuantity: +L(e.minimumQuantity ?? de),
27
- maximumQuantity: +L(e.maximumQuantity ?? de),
28
- quantityStep: +L(e.quantityStep)
55
+ unit: ((l = t.unit.measurements.find((i) => i.id === t.trackingMeasurement)) == null ? void 0 : l.abbrev) ?? t.unit.abbrev,
56
+ defaultQuantity: +B(e.quantity),
57
+ minimumQuantity: +B(e.minimumQuantity ?? pe),
58
+ maximumQuantity: +B(e.maximumQuantity ?? pe),
59
+ quantityStep: +B(e.quantityStep)
29
60
  };
30
61
  }
31
- function we() {
62
+ function $e() {
32
63
  return [
33
64
  {
34
65
  id: "code",
@@ -64,53 +95,53 @@ function we() {
64
95
  }
65
96
  ];
66
97
  }
67
- function Ge(e) {
68
- var l;
69
- const a = ge().currentBusiness.value, i = (l = e.map((o) => {
98
+ function Ze(e) {
99
+ var c;
100
+ const s = ne().currentBusiness.value, i = (c = e.map((a) => {
70
101
  var b;
71
- const c = o.purchaseOrder.items.map((r) => _e(r)), h = we(), d = [
72
- ["Template ID", o._id],
73
- ["Template name", o.name],
74
- ["Business name", a == null ? void 0 : a.name],
75
- ["Business ID", a == null ? void 0 : a._id],
76
- ["Menu version", a == null ? void 0 : a.menuVersion],
102
+ const m = a.purchaseOrder.items.map((r) => _e(r)), h = $e(), d = [
103
+ ["Template ID", a._id],
104
+ ["Template name", a.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],
77
108
  [
78
109
  "Purchase/Transfer",
79
- typeof o.purchaseOrder.supplier.internal == "string" ? I.TRANSFER : I.PURCHASE
110
+ typeof a.purchaseOrder.supplier.internal == "string" ? R.TRANSFER : R.PURCHASE
80
111
  ],
81
112
  [
82
113
  "Transfer from",
83
- `${o.purchaseOrder.supplier.name} (${[
84
- o.purchaseOrder.supplier.internal,
85
- o.purchaseOrder.supplier._id
114
+ `${a.purchaseOrder.supplier.name} (${[
115
+ a.purchaseOrder.supplier.internal,
116
+ a.purchaseOrder.supplier._id
86
117
  ].filter((r) => r).join("_")})`
87
118
  ],
88
119
  [
89
120
  "Locations",
90
- ...(b = o.locations) != null && b.length ? o.locations.map((r) => `${r.name} (${r.dbName})`) : ["All"]
121
+ ...(b = a.locations) != null && b.length ? a.locations.map((r) => `${r.name} (${r.dbName})`) : ["All"]
91
122
  ],
92
- ["Reference", o.purchaseOrder.ref ?? ""],
93
- ["Remark", o.purchaseOrder.remark ?? ""],
123
+ ["Reference", a.purchaseOrder.ref ?? ""],
124
+ ["Remark", a.purchaseOrder.remark ?? ""],
94
125
  [],
95
126
  h.map((r) => r.name),
96
- ...c.map((r) => h.map((x) => r[x.id]))
97
- ], m = h.map((r) => `system:${r.id}`), v = U(d, m);
98
- return { name: o.name, sheet: v };
127
+ ...m.map((r) => h.map((x) => r[x.id]))
128
+ ], u = h.map((r) => `system:${r.id}`), v = M(d, u);
129
+ return { name: a.name, sheet: v };
99
130
  }).reduce(
100
- (o, c) => {
131
+ (a, m) => {
101
132
  var d;
102
- const h = c.name.slice(0, 12);
103
- return (d = o.sheetOccurence)[h] ?? (d[h] = 0), o.sheetOccurence[h] += 1, o.sheets[`${h} (${o.sheetOccurence[h]})`] = c.sheet, o;
133
+ const h = m.name.slice(0, 12);
134
+ return (d = a.sheetOccurence)[h] ?? (d[h] = 0), a.sheetOccurence[h] += 1, a.sheets[`${h} (${a.sheetOccurence[h]})`] = m.sheet, a;
104
135
  },
105
136
  {
106
137
  sheets: {},
107
138
  sheetOccurence: {}
108
139
  }
109
- )) == null ? void 0 : l.sheets, s = `${a == null ? void 0 : a.name} transfer templates (${Ne(/* @__PURE__ */ new Date())}).xlsx`, f = ye(i);
110
- return he(f, s), s;
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;
111
142
  }
112
- function Ze() {
113
- const e = ge(), t = ae(), a = Z(), u = q(), i = e.currentBusiness.value, s = _e({
143
+ function Je() {
144
+ const e = ne(), t = se(), s = Z(), l = q(), i = e.currentBusiness.value, o = _e({
114
145
  sku: {
115
146
  unit: {
116
147
  _id: "",
@@ -141,7 +172,7 @@ function Ze() {
141
172
  amount: 1,
142
173
  precision: 0
143
174
  }
144
- }), f = we(), l = [
175
+ }), f = $e(), c = [
145
176
  ["Template ID (leave empty to create new)"],
146
177
  ["Template Name", "New template"],
147
178
  ["Business name", i == null ? void 0 : i.name],
@@ -162,8 +193,8 @@ function Ze() {
162
193
  ["Remark"],
163
194
  [],
164
195
  f.map((r) => r.name),
165
- f.map((r) => s[r.id])
166
- ], o = f.map((r) => `system:${r.id}`), c = U(l, o), h = U(
196
+ f.map((r) => o[r.id])
197
+ ], a = f.map((r) => `system:${r.id}`), m = M(c, a), h = M(
167
198
  [
168
199
  ...t.businessSuppliers.map((r) => [
169
200
  `${r.name} (${r._id})`,
@@ -175,13 +206,13 @@ function Ze() {
175
206
  r.address.state,
176
207
  r.address.country
177
208
  ]),
178
- ...a.locations.map((r) => {
179
- var x, w, S, p, n, y;
209
+ ...s.locations.map((r) => {
210
+ var x, $, S, p, n, y;
180
211
  return [
181
212
  `${r.name} (${r.dbName})`,
182
213
  "Transfer",
183
214
  (x = r.doc.profile.address) == null ? void 0 : x.line1,
184
- (w = r.doc.profile.address) == null ? void 0 : w.line2,
215
+ ($ = r.doc.profile.address) == null ? void 0 : $.line2,
185
216
  (S = r.doc.profile.address) == null ? void 0 : S.city,
186
217
  (p = r.doc.profile.address) == null ? void 0 : p.postcode,
187
218
  (n = r.doc.profile.address) == null ? void 0 : n.state,
@@ -190,13 +221,13 @@ function Ze() {
190
221
  })
191
222
  ],
192
223
  ["Name", "Type", "Line 1", "Line 2", "City", "Postal", "State", "Country"]
193
- ), d = U(
194
- a.locations.map((r) => {
195
- var x, w, S, p, n, y;
224
+ ), d = M(
225
+ s.locations.map((r) => {
226
+ var x, $, S, p, n, y;
196
227
  return [
197
228
  `${r.name} (${r.dbName})`,
198
229
  (x = r.doc.profile.address) == null ? void 0 : x.line1,
199
- (w = r.doc.profile.address) == null ? void 0 : w.line2,
230
+ ($ = r.doc.profile.address) == null ? void 0 : $.line2,
200
231
  (S = r.doc.profile.address) == null ? void 0 : S.city,
201
232
  (p = r.doc.profile.address) == null ? void 0 : p.postcode,
202
233
  (n = r.doc.profile.address) == null ? void 0 : n.state,
@@ -204,41 +235,41 @@ function Ze() {
204
235
  ];
205
236
  }),
206
237
  ["Name", "Line 1", "Line 2", "City", "Postal", "State", "Country"]
207
- ), m = U(
208
- u.skus.map((r) => [
238
+ ), u = M(
239
+ l.skus.map((r) => [
209
240
  r.code,
210
241
  r.name,
211
242
  r.unit.abbrev,
212
243
  ...r.unit.measurements.map((x) => x.abbrev)
213
244
  ]),
214
245
  ["Code", "Name", "Base unit", "Measurements"]
215
- ), v = ye({
216
- Template: c,
246
+ ), v = he({
247
+ Template: m,
217
248
  Source: h,
218
249
  Destination: d,
219
- Ingredient: m
250
+ Ingredient: u
220
251
  }), b = `${i == null ? void 0 : i.name} transfer templates import.xlsx`;
221
- return he(v, b), b;
252
+ return ve(v, b), b;
222
253
  }
223
- function Je(e, t) {
224
- const a = new Array(), u = /(.*) \(((supplier_|warehouse_|restaurant_).{24,})\)/, s = Z().locationByDbName, l = ae().supplierById, o = e.trim(), c = u.exec(o);
225
- if (!c)
226
- return a.push(`Transfer from location value of ${o} cannot be read.`), {
227
- errors: a
254
+ function Xe(e, t) {
255
+ const s = new Array(), l = /(.*) \(((supplier_|warehouse_|restaurant_).{24,})\)/, o = Z().locationByDbName, c = se().supplierById, a = e.trim(), m = l.exec(a);
256
+ if (!m)
257
+ return s.push(`Transfer from location value of ${a} cannot be read.`), {
258
+ errors: s
228
259
  };
229
- const h = c[1], d = c[2];
230
- let m;
260
+ const h = m[1], d = m[2];
261
+ let u;
231
262
  if (d.startsWith("supplier"))
232
- m = l[d], t !== I.PURCHASE && a.push(`Expected transfer type Purchase but found ${t} instead.`);
263
+ u = c[d], t !== R.PURCHASE && s.push(`Expected transfer type Purchase but found ${t} instead.`);
233
264
  else {
234
- const v = s[d];
265
+ const v = o[d];
235
266
  if (!v)
236
- return a.push(`Location (${h}) of id ${d} is not found.`), {
237
- errors: a
267
+ return s.push(`Location (${h}) of id ${d} is not found.`), {
268
+ errors: s
238
269
  };
239
- h !== v.name && a.push(
270
+ h !== v.name && s.push(
240
271
  `Location id ${d} has non-matching name. Found ${h} but expected ${v.name}`
241
- ), m = {
272
+ ), u = {
242
273
  _id: v.doc._id,
243
274
  name: v.name,
244
275
  address: v.doc.profile.address ?? {
@@ -249,7 +280,7 @@ function Je(e, t) {
249
280
  postcode: "",
250
281
  coordinates: [0, 0]
251
282
  },
252
- internal: d.split("_")[0] === "restaurant" ? le.enum.restaurant : le.enum.warehouse,
283
+ internal: d.split("_")[0] === "restaurant" ? ce.enum.restaurant : ce.enum.warehouse,
253
284
  phoneNumber: v.doc.profile.phoneNo ?? "",
254
285
  email: v.doc.profile.email ?? "",
255
286
  _rev: "",
@@ -258,75 +289,75 @@ function Je(e, t) {
258
289
  };
259
290
  }
260
291
  return {
261
- from: m,
262
- errors: a
292
+ from: u,
293
+ errors: s
263
294
  };
264
295
  }
265
- function Xe(e) {
296
+ function et(e) {
266
297
  if (!e.length || `${e[0]}`.toLocaleLowerCase() === "all")
267
298
  return [];
268
- const t = /(.*) \(((warehouse_|restaurant_).{24,})\)/, u = Z().locationByDbName;
299
+ const t = /(.*) \(((warehouse_|restaurant_).{24,})\)/, l = Z().locationByDbName;
269
300
  return e.map((i) => {
270
- const s = new Array(), f = i.trim(), l = t.exec(f);
271
- if (!l)
272
- return s.push(`Enabled location value of ${f} cannot be read.`), {
273
- errors: s
301
+ const o = new Array(), f = i.trim(), c = t.exec(f);
302
+ if (!c)
303
+ return o.push(`Enabled location value of ${f} cannot be read.`), {
304
+ errors: o
274
305
  };
275
- const o = l[1], c = l[2], h = u[c];
276
- return h ? (o !== h.name && s.push(
277
- `Location id ${c} has non-matching name. Found ${o} but expected ${h.name}`
306
+ const a = c[1], m = c[2], h = l[m];
307
+ return h ? (a !== h.name && o.push(
308
+ `Location id ${m} has non-matching name. Found ${a} but expected ${h.name}`
278
309
  ), {
279
- errors: s,
310
+ errors: o,
280
311
  location: h
281
- }) : (s.push(`Location (${o}) of id ${c} is not found.`), {
282
- errors: s
312
+ }) : (o.push(`Location (${a}) of id ${m} is not found.`), {
313
+ errors: o
283
314
  });
284
315
  });
285
316
  }
286
- function et(e) {
317
+ function tt(e) {
287
318
  const [
288
319
  t,
289
- a,
290
- u,
291
- i,
292
320
  s,
293
- f,
294
321
  l,
322
+ i,
295
323
  o,
324
+ f,
296
325
  c,
326
+ a,
327
+ m,
297
328
  h,
298
329
  d
299
- ] = ve(e);
330
+ ] = ge(e);
300
331
  return {
301
- id: `${a[1] ?? ""}`.trim(),
302
- name: `${u[1] ?? ""}`.trim(),
303
- type: `${l[1] ?? ""}`.trim().toLocaleLowerCase() === "transfer" ? I.TRANSFER : I.PURCHASE,
304
- transferFrom: `${o[1] ?? ""}`.trim(),
305
- locations: c.slice(1).map((m) => `${m}`.trim()).filter((m) => m),
332
+ id: `${s[1] ?? ""}`.trim(),
333
+ name: `${l[1] ?? ""}`.trim(),
334
+ type: `${c[1] ?? ""}`.trim().toLocaleLowerCase() === "transfer" ? R.TRANSFER : R.PURCHASE,
335
+ transferFrom: `${a[1] ?? ""}`.trim(),
336
+ locations: m.slice(1).map((u) => `${u}`.trim()).filter((u) => u),
306
337
  reference: `${h[1] ?? ""}`.trim(),
307
338
  remark: `${d[1] ?? ""}`.trim()
308
339
  };
309
340
  }
310
- function tt(e) {
341
+ function rt(e) {
311
342
  const [
312
343
  t,
313
- a,
314
- u,
315
- i,
316
344
  s,
317
- f,
318
345
  l,
346
+ i,
319
347
  o,
348
+ f,
320
349
  c,
350
+ a,
351
+ m,
321
352
  h,
322
353
  d,
323
- m,
354
+ u,
324
355
  v,
325
356
  ...b
326
- ] = ve(e);
357
+ ] = ge(e);
327
358
  if (!t || !t.length || t.some((p) => p.length && !p.startsWith("system:")))
328
359
  throw new Error("Missing meta header. Excel file does not come from the template.");
329
- const r = t.map((p) => p.split(":")[1]), w = [
360
+ const r = t.map((p) => p.split(":")[1]), $ = [
330
361
  "code",
331
362
  "name",
332
363
  "unit",
@@ -335,15 +366,15 @@ function tt(e) {
335
366
  "maximumQuantity",
336
367
  "quantityStep"
337
368
  ].filter((p) => !r.includes(p));
338
- if (w.length)
369
+ if ($.length)
339
370
  throw new Error(
340
- `Missing meta headers (${w.join()}). Excel file does not come from the template.`
371
+ `Missing meta headers (${$.join()}). Excel file does not come from the template.`
341
372
  );
342
373
  return b.map((p, n) => {
343
374
  const y = {};
344
375
  for (const T in r) {
345
- const $ = r[T];
346
- Object.assign(y, { [$]: p[T] });
376
+ const w = r[T];
377
+ Object.assign(y, { [w]: p[T] });
347
378
  }
348
379
  return {
349
380
  index: n,
@@ -351,42 +382,42 @@ function tt(e) {
351
382
  };
352
383
  });
353
384
  }
354
- function rt(e, t, a) {
355
- const u = e === "" ? null : G(e, a), i = t === "" ? null : G(t, a), s = u && i && u.amount > i.amount;
385
+ function nt(e, t, s) {
386
+ const l = e === "" ? null : G(e, s), i = t === "" ? null : G(t, s), o = l && i && l.amount > i.amount;
356
387
  return {
357
- min: u,
388
+ min: l,
358
389
  max: i,
359
- compareError: s ? "Minimum amount must be less than or equal to maximum amount" : void 0
390
+ compareError: o ? "Minimum amount must be less than or equal to maximum amount" : void 0
360
391
  };
361
392
  }
362
- function nt(e, t, a) {
363
- const u = q(), i = te(), s = u.skuByCode[e.code], f = new Array();
364
- if (!s)
393
+ function ot(e, t, s) {
394
+ const l = q(), i = te(), o = l.skuByCode[e.code], f = new Array();
395
+ if (!o)
365
396
  return f.push(`Cannot find ingredient with code (${e.code}) ${e.name}.`), {
366
397
  index: t,
367
398
  errors: f
368
399
  };
369
- if (a.filter((p) => p.data.code === e.code).length > 1)
400
+ if (s.filter((p) => p.data.code === e.code).length > 1)
370
401
  return f.push(`Ingredient ${e.code} is defined twice.`), {
371
402
  index: t,
372
403
  errors: f
373
404
  };
374
- const l = s.unit, o = l == null ? void 0 : l.measurements.find((p) => p.abbrev === e.unit);
375
- if (l.abbrev !== e.unit && !o) {
405
+ const c = o.unit, a = c == null ? void 0 : c.measurements.find((p) => p.abbrev === e.unit);
406
+ if (c.abbrev !== e.unit && !a) {
376
407
  const p = `Cannot find unit measurement of symbol ${e.unit || "[empty]"} for ingredient (${e.code}) ${e.name}.`;
377
408
  f.push(p);
378
409
  const n = {
379
- sku: s,
380
- code: e.overrideCode || s.code,
381
- name: s.name,
382
- measurement: o,
410
+ sku: o,
411
+ code: e.overrideCode || o.code,
412
+ name: o.name,
413
+ measurement: a,
383
414
  quantity: { amount: 0, precision: 0 },
384
415
  quantityStep: { amount: 0, precision: 0 },
385
416
  minimumQuantity: { amount: 0, precision: 0 },
386
417
  maximumQuantity: { amount: 0, precision: 0 }
387
418
  };
388
419
  if (i.isEnabled) {
389
- const y = i.getItemCustomCode(s);
420
+ const y = i.getItemCustomCode(o);
390
421
  y && (n.code = y);
391
422
  }
392
423
  return {
@@ -395,32 +426,32 @@ function nt(e, t, a) {
395
426
  templateItem: n
396
427
  };
397
428
  }
398
- const c = G(
429
+ const m = G(
399
430
  e.quantityStep,
400
- J(l, o)
431
+ J(c, a)
401
432
  );
402
433
  (Number.isNaN(Number(e.quantityStep)) || Number(e.quantityStep) <= 0) && f.push("Amount step must be more than 0");
403
- const h = Oe(c), d = rt(
434
+ const h = Fe(m), d = nt(
404
435
  e.minimumQuantity,
405
436
  e.maximumQuantity,
406
- J(l, o)
407
- ), m = d.min, v = d.max;
437
+ J(c, a)
438
+ ), u = d.min, v = d.max;
408
439
  d.compareError && f.push(d.compareError);
409
- const b = Fe(+e.minimumQuantity, +e.maximumQuantity), r = G(
440
+ const b = Pe(+e.minimumQuantity, +e.maximumQuantity), r = G(
410
441
  e.defaultQuantity,
411
- J(l, o)
442
+ J(c, a)
412
443
  ), x = h(r);
413
444
  typeof x == "string" && f.push(`Default amount: ${x}`);
414
- const w = d.min && d.max ? b(`${e.defaultQuantity}`) : null;
415
- typeof w == "string" && f.push(`Default amount: ${w}`);
445
+ const $ = d.min && d.max ? b(`${e.defaultQuantity}`) : null;
446
+ typeof $ == "string" && f.push(`Default amount: ${$}`);
416
447
  const S = {
417
- sku: s,
418
- code: e.overrideCode || s.code,
419
- name: e.name || s.name,
420
- measurement: o,
448
+ sku: o,
449
+ code: e.overrideCode || o.code,
450
+ name: e.name || o.name,
451
+ measurement: a,
421
452
  quantity: r,
422
- quantityStep: c,
423
- minimumQuantity: m,
453
+ quantityStep: m,
454
+ minimumQuantity: u,
424
455
  maximumQuantity: v
425
456
  };
426
457
  return {
@@ -429,80 +460,80 @@ function nt(e, t, a) {
429
460
  templateItem: S
430
461
  };
431
462
  }
432
- function ot(e) {
463
+ function at(e) {
433
464
  const t = e.SheetNames.filter(
434
- (s) => !Object.values(se).map(String).includes(s)
435
- ), u = Ce().templates, i = De(u, "_id");
465
+ (o) => !Object.values(ie).map(String).includes(o)
466
+ ), l = Ce().templates, i = Oe(l, "_id");
436
467
  try {
437
468
  return t.reduce(
438
- (s, f) => {
469
+ (o, f) => {
439
470
  var p;
440
- const l = new Array(), o = e.Sheets[f], c = et(o), h = Je(c.transferFrom, c.type);
441
- l.push(...h.errors);
442
- const d = h.from, m = Xe(c.locations), v = m.filter((n) => n.location).map((n) => n.location);
443
- l.push(...m.flatMap((n) => n.errors));
444
- const b = tt(o).filter((n) => n.data.code), r = b.map(
445
- (n, y) => nt(n.data, y, b)
471
+ const c = new Array(), a = e.Sheets[f], m = tt(a), h = Xe(m.transferFrom, m.type);
472
+ c.push(...h.errors);
473
+ const d = h.from, u = et(m.locations), v = u.filter((n) => n.location).map((n) => n.location);
474
+ c.push(...u.flatMap((n) => n.errors));
475
+ const b = rt(a).filter((n) => n.data.code), r = b.map(
476
+ (n, y) => ot(n.data, y, b)
446
477
  );
447
- l.push(
478
+ c.push(
448
479
  ...r.flatMap(
449
480
  (n) => n.errors.map((y) => `(Excel row ${n.index + 14}) ${y}`)
450
481
  )
451
482
  );
452
483
  const x = r.filter((n) => n.templateItem).map((n) => n.templateItem);
453
- if (c.id) {
454
- const n = i[c.id];
484
+ if (m.id) {
485
+ const n = i[m.id];
455
486
  if (!n) {
456
487
  const T = {
457
- _id: c.id,
488
+ _id: m.id,
458
489
  _rev: "",
459
- name: c.name || `(unnamed from sheet ${f || "<unnamed sheet>"})`,
460
- purchaseOrder: at()
490
+ name: m.name || `(unnamed from sheet ${f || "<unnamed sheet>"})`,
491
+ purchaseOrder: st()
461
492
  };
462
- return l.push(`Template ID ${c.id} is not found.`), s.importUpdateResult.push({
493
+ return c.push(`Template ID ${m.id} is not found.`), o.importUpdateResult.push({
463
494
  type: "update",
464
495
  original: T,
465
496
  template: T,
466
497
  excelSheetName: f,
467
- errors: l
468
- }), s;
498
+ errors: c
499
+ }), o;
469
500
  }
470
501
  const y = {
471
502
  type: "update",
472
503
  original: n,
473
504
  template: {
474
505
  ...n,
475
- name: c.name,
506
+ name: m.name,
476
507
  locations: v.length ? v : null,
477
508
  purchaseOrder: {
478
509
  ...n.purchaseOrder,
479
510
  supplier: d ?? ((p = n.purchaseOrder) == null ? void 0 : p.supplier),
480
- ref: c.reference,
481
- remark: c.remark,
511
+ ref: m.reference,
512
+ remark: m.remark,
482
513
  items: x
483
514
  }
484
515
  },
485
516
  excelSheetName: f,
486
- errors: l
517
+ errors: c
487
518
  };
488
- return s.importUpdateResult.push(y), s;
519
+ return o.importUpdateResult.push(y), o;
489
520
  }
490
521
  const S = {
491
522
  type: "create",
492
523
  template: {
493
- name: c.name,
524
+ name: m.name,
494
525
  locations: v.length ? v : null,
495
526
  purchaseOrder: {
496
- supplier: d ?? $e(),
497
- ref: c.reference,
498
- remark: c.remark,
527
+ supplier: d ?? we(),
528
+ ref: m.reference,
529
+ remark: m.remark,
499
530
  items: x
500
531
  }
501
532
  },
502
533
  excelSheetName: f,
503
- errors: l
534
+ errors: c
504
535
  };
505
- return s.importCreateResult.push(S), s;
536
+ return o.importCreateResult.push(S), o;
506
537
  },
507
538
  {
508
539
  invalidExcel: !1,
@@ -510,16 +541,16 @@ function ot(e) {
510
541
  importUpdateResult: new Array()
511
542
  }
512
543
  );
513
- } catch (s) {
544
+ } catch (o) {
514
545
  return {
515
546
  invalidExcel: !0,
516
- invalidExcelMessage: (s == null ? void 0 : s.message) ?? "Invalid excel",
547
+ invalidExcelMessage: (o == null ? void 0 : o.message) ?? "Invalid excel",
517
548
  importCreateResult: [],
518
549
  importUpdateResult: []
519
550
  };
520
551
  }
521
552
  }
522
- function $e() {
553
+ function we() {
523
554
  return {
524
555
  _id: "",
525
556
  name: "",
@@ -533,18 +564,18 @@ function $e() {
533
564
  }
534
565
  };
535
566
  }
536
- function at() {
567
+ function st() {
537
568
  return {
538
569
  remark: void 0,
539
570
  ref: void 0,
540
571
  items: [],
541
- supplier: $e()
572
+ supplier: we()
542
573
  };
543
574
  }
544
- const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-col" }, lt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" }, ct = { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, mt = {
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 = {
545
576
  key: 0,
546
577
  class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
547
- }, ut = { key: 0 }, pe = /* @__PURE__ */ oe({
578
+ }, dt = { key: 0 }, fe = /* @__PURE__ */ ae({
548
579
  __name: "TransferTemplateImportItem",
549
580
  props: {
550
581
  type: {},
@@ -555,31 +586,31 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
555
586
  errors: {}
556
587
  },
557
588
  setup(e) {
558
- return (t, a) => {
559
- var s, f, l;
560
- const u = Q("FmIcon"), i = Q("FmTooltip");
561
- return _(), E("div", st, [
562
- a[0] || (a[0] = C("div", null, "•", -1)),
563
- C("div", it, [
564
- C("div", lt, [
589
+ return (t, s) => {
590
+ var o, f, c;
591
+ const l = Q("FmIcon"), i = Q("FmTooltip");
592
+ return _(), k("div", it, [
593
+ s[0] || (s[0] = C("div", null, "•", -1)),
594
+ C("div", lt, [
595
+ C("div", ct, [
565
596
  C("div", {
566
597
  class: H({
567
598
  "text-fm-color-system-error-300": t.errors.length
568
599
  })
569
600
  }, [
570
- je(D(t.name) + " ", 1),
571
- C("span", ct, " (" + D(A(Pe)(`${t.transferType}`)) + ") ", 1),
572
- t.type === "create" ? (_(), E("span", mt, "(new)")) : V("", !0)
601
+ ze(D(t.name) + " ", 1),
602
+ C("span", mt, " (" + D(A(Ue)(`${t.transferType}`)) + ") ", 1),
603
+ t.type === "create" ? (_(), k("span", ut, "(new)")) : V("", !0)
573
604
  ], 2),
574
- t.errors.length ? (_(), E("div", ut, [
605
+ t.errors.length ? (_(), k("div", dt, [
575
606
  P(i, { "z-index": 50 }, {
576
607
  content: ee(() => [
577
608
  C("ol", null, [
578
- (_(!0), E(B, null, Y(t.errors, (o, c) => (_(), E("li", { key: c }, D(o), 1))), 128))
609
+ (_(!0), k(L, null, Y(t.errors, (a, m) => (_(), k("li", { key: m }, D(a), 1))), 128))
579
610
  ])
580
611
  ]),
581
612
  default: ee(() => [
582
- P(u, {
613
+ P(l, {
583
614
  name: "error",
584
615
  size: "sm",
585
616
  color: "system-error-300"
@@ -597,93 +628,93 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
597
628
  "text-fm-color-typo-secondary": !t.errors.length
598
629
  }
599
630
  ])
600
- }, D((s = t.locations) != null && s.length ? `${(f = t.locations) == null ? void 0 : f.length} locations` : "All locations") + ", " + D(`${(l = t.items) == null ? void 0 : l.length} items`), 3)
631
+ }, D((o = t.locations) != null && o.length ? `${(f = t.locations) == null ? void 0 : f.length} locations` : "All locations") + ", " + D(`${(c = t.items) == null ? void 0 : c.length} items`), 3)
601
632
  ])
602
633
  ]);
603
634
  };
604
635
  }
605
- }), dt = { class: "flex flex-col gap-24" }, pt = {
636
+ }), pt = { class: "flex flex-col gap-24" }, ft = {
606
637
  key: 0,
607
638
  class: "flex items-center gap-8"
608
- }, ft = { class: "flex flex-col gap-8" }, yt = { class: "line-clamp-2 text-ellipsis break-all" }, ht = {
639
+ }, yt = { class: "flex flex-col gap-8" }, ht = { class: "line-clamp-2 text-ellipsis break-all" }, vt = {
609
640
  key: 2,
610
641
  class: "shrink-0"
611
- }, vt = {
642
+ }, gt = {
612
643
  key: 0,
613
644
  class: "flex flex-col"
614
- }, gt = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, bt = {
645
+ }, bt = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, xt = {
615
646
  key: 0,
616
647
  class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
617
- }, xt = { class: "fm-typo-en-body-lg-600" }, St = /* @__PURE__ */ oe({
648
+ }, St = { class: "fm-typo-en-body-lg-600" }, Tt = /* @__PURE__ */ ae({
618
649
  __name: "TransferTemplateImport",
619
650
  setup(e) {
620
- const t = R(null), a = Ve(), u = be(), i = R(!1), s = R(!1), f = ae();
621
- ze(async () => {
622
- s.value = !0;
651
+ const t = N(null), s = qe(), l = be(), i = N(!1), o = N(!1), f = se();
652
+ Ke(async () => {
653
+ o.value = !0;
623
654
  try {
624
655
  await f.readSuppliers().delayed(1e3);
625
656
  } catch {
626
- u.open({
657
+ l.open({
627
658
  title: "Something went wrong.",
628
659
  message: "Error at reading suppliers list. Please try again.",
629
660
  type: "error"
630
661
  });
631
662
  } finally {
632
- s.value = !1;
663
+ o.value = !1;
633
664
  }
634
665
  });
635
- const l = R(new Array()), o = R([]), c = R([]), h = ue(
636
- () => !!l.value.length || o.value.some((b) => b.errors.length) || c.value.some((b) => b.errors.length)
637
- ), d = ue(
638
- () => !!o.value.length || !!c.value.length
639
- ), { t: m } = ne();
666
+ const c = N(new Array()), a = N([]), m = N([]), h = de(
667
+ () => !!c.value.length || a.value.some((b) => b.errors.length) || m.value.some((b) => b.errors.length)
668
+ ), d = de(
669
+ () => !!a.value.length || !!m.value.length
670
+ ), { t: u } = oe();
640
671
  async function v(b) {
641
- l.value = [], o.value = [], c.value = [];
672
+ c.value = [], a.value = [], m.value = [];
642
673
  try {
643
674
  i.value = !0;
644
675
  const [r] = await Promise.all([
645
- Ue(b),
676
+ Be(b),
646
677
  // fake buffer
647
678
  new Promise((p) => setTimeout(p, 1e3))
648
679
  ]);
649
680
  if (!r.SheetNames.filter(
650
- (p) => !Object.values(se).map(String).includes(p)
681
+ (p) => !Object.values(ie).map(String).includes(p)
651
682
  ).find((p) => p)) {
652
- l.value.push(m("inventory.ingredient.import.fileError.noSheet"));
683
+ c.value.push(u("inventory.ingredient.import.fileError.noSheet"));
653
684
  return;
654
685
  }
655
- const S = ot(r);
686
+ const S = at(r);
656
687
  if (S.invalidExcel) {
657
- l.value.push(
658
- S.invalidExcelMessage ?? m("inventory.ingredient.import.fileError.invalidExcel")
688
+ c.value.push(
689
+ S.invalidExcelMessage ?? u("inventory.ingredient.import.fileError.invalidExcel")
659
690
  );
660
691
  return;
661
692
  }
662
- if (o.value = S.importCreateResult, c.value = S.importUpdateResult, !o.value.length && !c.value.length) {
663
- l.value.push(m("inventory.ingredient.import.fileError.noData"));
693
+ if (a.value = S.importCreateResult, m.value = S.importUpdateResult, !a.value.length && !m.value.length) {
694
+ c.value.push(u("inventory.ingredient.import.fileError.noData"));
664
695
  return;
665
696
  }
666
- a.emitData(S);
697
+ s.emitData(S);
667
698
  } catch (r) {
668
- u.open({
669
- title: m("inventory.ingredient.import.fileError.unableToRead"),
699
+ l.open({
700
+ title: u("inventory.ingredient.import.fileError.unableToRead"),
670
701
  message: r == null ? void 0 : r.message,
671
702
  type: "error"
672
703
  }), console.error("Error in reading file", r);
673
704
  } finally {
674
- l.value.length && u.open({
675
- title: m("inventory.ingredient.import.fileError.invalidExcel"),
705
+ c.value.length && l.open({
706
+ title: u("inventory.ingredient.import.fileError.invalidExcel"),
676
707
  type: "error"
677
708
  }), i.value = !1;
678
709
  }
679
710
  }
680
- return Ke(t, (b) => {
711
+ return Ye(t, (b) => {
681
712
  b && v(b);
682
713
  }), (b, r) => {
683
- const x = Q("FmCircularProgress"), w = Q("FmIcon"), S = Q("FmButton");
684
- return _(), E("div", dt, [
714
+ const x = Q("FmCircularProgress"), $ = Q("FmIcon"), S = Q("FmButton");
715
+ return _(), k("div", pt, [
685
716
  r[2] || (r[2] = C("div", { class: "fm-typo-en-body-md-400" }, "Import transfer templates from excel sheets.", -1)),
686
- s.value ? (_(), E("div", pt, [
717
+ o.value ? (_(), k("div", ft, [
687
718
  C("div", null, [
688
719
  P(x, {
689
720
  size: "md",
@@ -691,7 +722,7 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
691
722
  })
692
723
  ]),
693
724
  r[1] || (r[1] = C("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "Loading...", -1))
694
- ])) : (_(), E(B, { key: 1 }, [
725
+ ])) : (_(), k(L, { key: 1 }, [
695
726
  P(Me, {
696
727
  class: H({
697
728
  "w-full": !0,
@@ -699,13 +730,13 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
699
730
  }),
700
731
  accept: ".xlsx",
701
732
  onFileUpload: r[0] || (r[0] = (p) => t.value = p),
702
- label: A(m)("inventory.ingredient.import.uploadTemplate"),
703
- "button-label": A(m)("inventory.ingredient.import.selectFile")
704
- }, Ye({ _: 2 }, [
733
+ label: A(u)("inventory.ingredient.import.uploadTemplate"),
734
+ "button-label": A(u)("inventory.ingredient.import.selectFile")
735
+ }, We({ _: 2 }, [
705
736
  t.value ? {
706
737
  name: "default",
707
738
  fn: ee(({ openFileDialog: p }) => [
708
- C("div", ft, [
739
+ C("div", yt, [
709
740
  C("div", {
710
741
  class: H([
711
742
  "fm-corner-radius-md p-16 flex items-center gap-16",
@@ -720,7 +751,7 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
720
751
  key: 0,
721
752
  size: "md",
722
753
  color: "neutral-gray-200"
723
- })) : (_(), K(w, {
754
+ })) : (_(), K($, {
724
755
  key: 1,
725
756
  name: h.value ? "error" : "attach_file",
726
757
  outline: "",
@@ -735,28 +766,28 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
735
766
  }
736
767
  ])
737
768
  }, [
738
- C("div", yt, D(t.value.name), 1)
769
+ C("div", ht, D(t.value.name), 1)
739
770
  ], 2),
740
- i.value ? V("", !0) : (_(), E("div", ht, [
771
+ i.value ? V("", !0) : (_(), k("div", vt, [
741
772
  P(S, {
742
- label: A(m)("inventory.ingredient.import.replaceFile"),
773
+ label: A(u)("inventory.ingredient.import.replaceFile"),
743
774
  variant: h.value ? "destructive" : "secondary",
744
775
  "prepend-icon": h.value ? void 0 : "autorenew",
745
776
  onClick: p
746
777
  }, null, 8, ["label", "variant", "prepend-icon", "onClick"])
747
778
  ]))
748
779
  ], 2),
749
- l.value.length ? (_(), E("div", vt, [
750
- (_(!0), E(B, null, Y(l.value, (n, y) => (_(), E("div", {
780
+ c.value.length ? (_(), k("div", gt, [
781
+ (_(!0), k(L, null, Y(c.value, (n, y) => (_(), k("div", {
751
782
  key: y,
752
783
  class: "flex gap-8 items-center"
753
784
  }, [
754
- P(w, {
785
+ P($, {
755
786
  name: "error",
756
787
  size: "sm",
757
788
  color: "system-error-300"
758
789
  }),
759
- C("div", gt, D(n), 1)
790
+ C("div", bt, D(n), 1)
760
791
  ]))), 128))
761
792
  ])) : V("", !0)
762
793
  ])
@@ -764,21 +795,21 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
764
795
  key: "0"
765
796
  } : void 0
766
797
  ]), 1032, ["class", "label", "button-label"]),
767
- d.value ? (_(), E("div", bt, [
768
- C("div", xt, D(A(m)("inventory.ingredient.import.summary")), 1),
769
- (_(!0), E(B, null, Y(o.value, (p, n) => (_(), K(pe, {
798
+ d.value ? (_(), k("div", xt, [
799
+ C("div", St, D(A(u)("inventory.ingredient.import.summary")), 1),
800
+ (_(!0), k(L, null, Y(a.value, (p, n) => (_(), K(fe, {
770
801
  key: n,
771
802
  name: p.template.name,
772
- "transfer-type": typeof p.template.purchaseOrder.supplier.internal == "string" ? A(I).TRANSFER : A(I).PURCHASE,
803
+ "transfer-type": typeof p.template.purchaseOrder.supplier.internal == "string" ? A(R).TRANSFER : A(R).PURCHASE,
773
804
  locations: p.template.locations,
774
805
  items: p.template.purchaseOrder.items,
775
806
  errors: p.errors,
776
807
  type: "create"
777
808
  }, null, 8, ["name", "transfer-type", "locations", "items", "errors"]))), 128)),
778
- (_(!0), E(B, null, Y(c.value, (p) => (_(), K(pe, {
809
+ (_(!0), k(L, null, Y(m.value, (p) => (_(), K(fe, {
779
810
  key: p.template._id,
780
811
  name: p.template.name,
781
- "transfer-type": typeof p.template.purchaseOrder.supplier.internal == "string" ? A(I).TRANSFER : A(I).PURCHASE,
812
+ "transfer-type": typeof p.template.purchaseOrder.supplier.internal == "string" ? A(R).TRANSFER : A(R).PURCHASE,
782
813
  locations: p.template.locations,
783
814
  items: p.template.purchaseOrder.items,
784
815
  errors: p.errors,
@@ -790,39 +821,39 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
790
821
  };
791
822
  }
792
823
  });
793
- function Tt(e) {
794
- var s, f;
824
+ function _t(e) {
825
+ var o, f;
795
826
  const t = te();
796
827
  if (!t.isEnabled) return !0;
797
828
  if (!e.internal) {
798
- const l = t.getNetSuiteVendor(e._id), o = l == null ? void 0 : l.subsidiaryId, c = (s = t.currentVendorSubsidiary(e._id)) == null ? void 0 : s.id;
799
- return o && o == c;
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;
830
+ return a && a == m;
800
831
  }
801
- const a = t.getNetSuiteLocation(`${e.internal}_${e._id}`), u = t.getLocationSubsidiary(a == null ? void 0 : a.netSuiteId).id, i = (f = t.currentLocationSubsidiary()) == null ? void 0 : f.id;
802
- return u && u == i;
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
+ return l && l == i;
803
834
  }
804
- const _t = xe("transferTemplateActions", () => {
805
- const e = qe(), t = be(), a = Z(), u = Ce(), i = Le(), s = Se(), f = te(), l = We(), { t: o } = ne(), c = R({});
835
+ const $t = xe("transferTemplateActions", () => {
836
+ const e = je(), t = be(), s = Z(), l = Ce(), i = Le(), o = Se(), f = te(), c = Ge(), { t: a } = oe(), m = N({});
806
837
  function h() {
807
- c.value = {
808
- mode: ce.CREATE,
838
+ m.value = {
839
+ mode: me.CREATE,
809
840
  show: !0,
810
841
  "onUpdate:show"(n) {
811
- c.value.show = n;
842
+ m.value.show = n;
812
843
  }
813
844
  };
814
845
  }
815
846
  function d(n) {
816
- c.value = {
817
- mode: ce.UPDATE,
847
+ m.value = {
848
+ mode: me.UPDATE,
818
849
  modelValue: n,
819
850
  show: !0,
820
851
  "onUpdate:show"(y) {
821
- c.value.show = y;
852
+ m.value.show = y;
822
853
  }
823
854
  };
824
855
  }
825
- function m(n, y, T) {
856
+ function u(n, y, T) {
826
857
  e.open({
827
858
  title: `Confirm deleting template ${n.name}?`,
828
859
  message: "Deleted template can no longer be retrieved",
@@ -843,28 +874,28 @@ const _t = xe("transferTemplateActions", () => {
843
874
  });
844
875
  try {
845
876
  y.value = !0;
846
- const [$] = await Promise.allSettled([
847
- s.deleteTemplate(n),
848
- new Promise((k) => setTimeout(k, 1e3))
877
+ const [w] = await Promise.allSettled([
878
+ o.deleteTemplate(n),
879
+ new Promise((E) => setTimeout(E, 1e3))
849
880
  ]);
850
- if ($.status === "rejected") throw $.reason;
881
+ if (w.status === "rejected") throw w.reason;
851
882
  t.open({
852
883
  title: `Deleted ${n.name}`,
853
884
  type: "success"
854
885
  });
855
- } catch ($) {
886
+ } catch (w) {
856
887
  t.open({
857
888
  title: `Unable to delete ${n.name}`,
858
- message: `See error from server: ${$}`,
889
+ message: `See error from server: ${w}`,
859
890
  type: "error"
860
- }), console.error("error on deleting purchase order template", $);
891
+ }), console.error("error on deleting purchase order template", w);
861
892
  } finally {
862
893
  y.value = !1, T();
863
894
  }
864
895
  });
865
896
  }
866
897
  function v(n, y, T) {
867
- let $;
898
+ let w;
868
899
  e.open({
869
900
  title: `Confirm duplicating template "${n.name}"?`,
870
901
  message: "Duplicated template can be edited and used independently",
@@ -878,13 +909,13 @@ const _t = xe("transferTemplateActions", () => {
878
909
  variant: z.Plain,
879
910
  close: !0
880
911
  },
881
- contentComponent: oe({
912
+ contentComponent: ae({
882
913
  props: ["modelValue"],
883
914
  emits: ["update:modelValue"],
884
- setup(k) {
915
+ setup(E) {
885
916
  return () => W(X.FmTextField, {
886
- modelValue: k.modelValue,
887
- "onUpdate:modelValue": (g) => $ = g,
917
+ modelValue: E.modelValue,
918
+ "onUpdate:modelValue": (g) => w = g,
888
919
  label: "New Template Name",
889
920
  size: "md",
890
921
  variant: "primary"
@@ -898,27 +929,27 @@ const _t = xe("transferTemplateActions", () => {
898
929
  });
899
930
  try {
900
931
  y.value = !0;
901
- const [k] = await Promise.allSettled([
902
- i.duplicatePurchaseOrderTemplate(n._id, $),
932
+ const [E] = await Promise.allSettled([
933
+ i.duplicatePurchaseOrderTemplate(n._id, w),
903
934
  new Promise((g) => setTimeout(g, 1e3))
904
935
  ]);
905
- if (k.status === "rejected") throw k.reason;
936
+ if (E.status === "rejected") throw E.reason;
906
937
  t.open({
907
938
  title: `Duplicated ${n.name}`,
908
939
  type: "success"
909
940
  });
910
- } catch (k) {
941
+ } catch (E) {
911
942
  t.open({
912
943
  title: `Unable to duplicate ${n.name}`,
913
- message: `See error from server: ${k}`,
944
+ message: `See error from server: ${E}`,
914
945
  type: "error"
915
- }), console.error("error on duplicating purchase order template", k);
946
+ }), console.error("error on duplicating purchase order template", E);
916
947
  } finally {
917
948
  y.value = !1, T();
918
949
  }
919
950
  });
920
951
  }
921
- const b = R({});
952
+ const b = N({});
922
953
  function r(n) {
923
954
  b.value = {
924
955
  template: n,
@@ -934,11 +965,11 @@ const _t = xe("transferTemplateActions", () => {
934
965
  function x() {
935
966
  const { promise: n, resolve: y } = Promise.withResolvers(), T = (g) => {
936
967
  y(g);
937
- }, $ = u.templates.filter((g) => {
968
+ }, w = l.templates.filter((g) => {
938
969
  var O, F;
939
- return ((O = g.purchaseOrder.supplier) == null ? void 0 : O._id) === a.currentLocation.doc._id ? !1 : (F = g.locations) != null && F.length ? g.locations.find((M) => M.doc._id === a.currentLocation.doc._id) : !0;
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;
940
971
  });
941
- if (!$.length)
972
+ if (!w.length)
942
973
  return e.open({
943
974
  title: "Select one template",
944
975
  message: "There is no available template in your business. Configure a new template?",
@@ -951,26 +982,26 @@ const _t = xe("transferTemplateActions", () => {
951
982
  close: !0
952
983
  }
953
984
  }).onPrimary(() => {
954
- l.push({ name: me.TRANSFER_TEMPLATE }), T(void 0);
985
+ c.push({ name: ue.TRANSFER_TEMPLATE }), T(void 0);
955
986
  }).onSecondary(() => T(void 0)).onClose(() => T(void 0)), n;
956
- const k = $.map((g) => {
957
- var ie;
958
- const O = !g.purchaseOrder.items.length || g.purchaseOrder.items.some(Te), F = !Tt(g.purchaseOrder.supplier), M = g.purchaseOrder.supplier.internal ? f.getNetSuiteLocation(
987
+ const E = w.map((g) => {
988
+ var le;
989
+ const O = !g.purchaseOrder.items.length || g.purchaseOrder.items.some(Te), F = !_t(g.purchaseOrder.supplier), U = g.purchaseOrder.supplier.internal ? f.getNetSuiteLocation(
959
990
  `${g.purchaseOrder.supplier.internal}_${g.purchaseOrder.supplier._id}`
960
- ) : f.getNetSuiteVendor(g.purchaseOrder.supplier._id), Ee = F ? `The subsidiary of the request
961
- location is ${(ie = f.getLocationSubsidiary(M == null ? void 0 : M.netSuiteId)) == null ? void 0 : ie.fullName}.` : void 0, ke = O || F, Re = O ? "This template is invalid. Update this template." : F ? Ee : void 0, Ie = `${g.purchaseOrder.supplier.internal ? "Transfer" : "Purchase"} from ${g.purchaseOrder.supplier.name}`;
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, Ne = O ? "This template is invalid. Update this template." : F ? ke : void 0, Re = `${g.purchaseOrder.supplier.internal ? "Transfer" : "Purchase"} from ${g.purchaseOrder.supplier.name}`;
962
993
  return {
963
994
  label: g.name,
964
995
  value: g._id,
965
- disabled: ke,
966
- sublabel: Re ?? Ie
996
+ disabled: Ee,
997
+ sublabel: Ne ?? Re
967
998
  };
968
999
  });
969
- return k.sort((g, O) => +!!g.disabled - +!!O.disabled), e.open({
1000
+ return E.sort((g, O) => +!!g.disabled - +!!O.disabled), e.open({
970
1001
  title: "Select one template",
971
- contentComponent: Be,
1002
+ contentComponent: Qe,
972
1003
  contentComponentProps: {
973
- items: k,
1004
+ items: E,
974
1005
  singleSelect: !0
975
1006
  },
976
1007
  primaryActions: {
@@ -986,54 +1017,54 @@ const _t = xe("transferTemplateActions", () => {
986
1017
  close: !0
987
1018
  }
988
1019
  }).onPrimary((g) => Array.isArray(g) ? T(g[0]) : null).onSecondary(() => T(void 0)).onTertiary(() => {
989
- l.push({ name: me.TRANSFER_TEMPLATE }), T(void 0);
1020
+ c.push({ name: ue.TRANSFER_TEMPLATE }), T(void 0);
990
1021
  }).onClose(() => T(void 0)), n;
991
1022
  }
992
- function w() {
1023
+ function $() {
993
1024
  e.open({
994
- title: o("inventory.ingredient.import.title"),
995
- contentComponent: St,
1025
+ title: a("inventory.ingredient.import.title"),
1026
+ contentComponent: Tt,
996
1027
  overlay: !0,
997
1028
  closeButton: !0,
998
1029
  primaryActions: {
999
- text: o("common.import"),
1030
+ text: a("common.import"),
1000
1031
  close: !1
1001
1032
  },
1002
1033
  secondaryActions: {
1003
- text: o("common.close"),
1034
+ text: a("common.close"),
1004
1035
  close: !0
1005
1036
  },
1006
1037
  tertiaryActions: {
1007
- text: o("inventory.ingredient.import.actions.downloadTemplate"),
1038
+ text: a("inventory.ingredient.import.actions.downloadTemplate"),
1008
1039
  close: !1,
1009
1040
  variant: "plain"
1010
1041
  }
1011
1042
  }).onPrimary((n) => {
1012
1043
  if (!n) {
1013
1044
  t.open({
1014
- title: o("inventory.ingredient.import.error.noData"),
1045
+ title: a("inventory.ingredient.import.error.noData"),
1015
1046
  type: "error"
1016
1047
  });
1017
1048
  return;
1018
1049
  }
1019
1050
  if (!n.importCreateResult.length && !n.importUpdateResult.length) {
1020
1051
  t.open({
1021
- title: o("inventory.ingredient.import.error.invalidContent"),
1022
- message: o("inventory.ingredient.import.error.noImportData"),
1052
+ title: a("inventory.ingredient.import.error.invalidContent"),
1053
+ message: a("inventory.ingredient.import.error.noImportData"),
1023
1054
  type: "error"
1024
1055
  });
1025
1056
  return;
1026
1057
  }
1027
1058
  if (n.importCreateResult.some((y) => y.errors.length) || n.importUpdateResult.some((y) => y.errors.length)) {
1028
1059
  t.open({
1029
- title: o("inventory.ingredient.import.error.invalidContent"),
1030
- message: o("inventory.ingredient.import.error.hasErrors"),
1060
+ title: a("inventory.ingredient.import.error.invalidContent"),
1061
+ message: a("inventory.ingredient.import.error.hasErrors"),
1031
1062
  type: "error"
1032
1063
  });
1033
1064
  return;
1034
1065
  }
1035
1066
  e.close(), S(n);
1036
- }).onTertiary(Ze);
1067
+ }).onTertiary(Je);
1037
1068
  }
1038
1069
  async function S(n) {
1039
1070
  try {
@@ -1045,36 +1076,36 @@ const _t = xe("transferTemplateActions", () => {
1045
1076
  (g) => g.template
1046
1077
  )
1047
1078
  ], T = 100;
1048
- let $ = 0;
1049
- const k = () => {
1050
- $ += T, t.open({
1051
- title: o("inventory.ingredient.import.progress", [
1052
- Math.min($, y.length),
1079
+ let w = 0;
1080
+ const E = () => {
1081
+ w += T, t.open({
1082
+ title: a("inventory.ingredient.import.progress", [
1083
+ Math.min(w, y.length),
1053
1084
  y.length
1054
1085
  ])
1055
1086
  });
1056
1087
  };
1057
1088
  for (const g of y.chunk(100))
1058
- k(), await s.importTemplates(g);
1089
+ E(), await o.importTemplates(g);
1059
1090
  t.open({
1060
- title: o("inventory.ingredient.import.success"),
1091
+ title: a("inventory.ingredient.import.success"),
1061
1092
  type: "success"
1062
1093
  });
1063
1094
  } catch (y) {
1064
1095
  t.open({
1065
- title: o("inventory.ingredient.import.error.failed"),
1066
- message: o("inventory.ingredient.import.error.systemMessage", [y == null ? void 0 : y.message]),
1096
+ title: a("inventory.ingredient.import.error.failed"),
1097
+ message: a("inventory.ingredient.import.error.systemMessage", [y == null ? void 0 : y.message]),
1067
1098
  type: "error"
1068
1099
  }), console.error("Error in importing skus", n, y);
1069
1100
  } finally {
1070
- u.fetchTemplates();
1101
+ l.fetchTemplates();
1071
1102
  }
1072
1103
  }
1073
1104
  function p() {
1074
- const n = Ge(u.templates);
1105
+ const n = Ze(l.templates);
1075
1106
  t.open({
1076
- title: o("inventory.ingredient.export.success"),
1077
- message: o("inventory.ingredient.export.filename", [n]),
1107
+ title: a("inventory.ingredient.export.success"),
1108
+ message: a("inventory.ingredient.export.filename", [n]),
1078
1109
  type: "success"
1079
1110
  });
1080
1111
  }
@@ -1082,61 +1113,61 @@ const _t = xe("transferTemplateActions", () => {
1082
1113
  createTemplate: h,
1083
1114
  viewTemplate: r,
1084
1115
  updateTemplate: d,
1085
- deleteTemplate: m,
1116
+ deleteTemplate: u,
1086
1117
  duplicateTemplate: v,
1087
1118
  getTemplateId: x,
1088
- importTemplates: w,
1119
+ importTemplates: $,
1089
1120
  exportTemplates: p,
1090
- templateDialogProps: c,
1121
+ templateDialogProps: m,
1091
1122
  templateDetailsProps: b
1092
1123
  };
1093
1124
  });
1094
- function fe(e) {
1095
- const { skuById: t } = q(), a = re(e);
1096
- return a.purchaseOrder.items = e.purchaseOrder.items.filter((u) => t[u.sku._id]), a;
1125
+ function ye(e) {
1126
+ const { skuById: t } = q(), s = re(e);
1127
+ return s.purchaseOrder.items = e.purchaseOrder.items.filter((l) => t[l.sku._id]), s;
1097
1128
  }
1098
1129
  const Ce = xe(
1099
1130
  "transferTemplateTable",
1100
1131
  function() {
1101
- const { t } = ne(), a = _t(), u = R(!1), i = R(new Array()), s = Se(), f = q();
1102
- async function l() {
1103
- i.value = [], u.value = !0;
1132
+ const { t } = oe(), s = $t(), l = N(!1), i = N(new Array()), o = Se(), f = q();
1133
+ async function c() {
1134
+ i.value = [], l.value = !0;
1104
1135
  try {
1105
- f.isInventoryLoaded || await f.readInventory();
1106
- const [d] = await Promise.all([s.readTemplates()]).delayed(
1107
- 1e3
1108
- );
1109
- i.value = d.map(fe);
1136
+ const [d] = await Promise.all([
1137
+ o.readTemplates(),
1138
+ f.readInventory()
1139
+ ]).delayed(1e3);
1140
+ i.value = d.map(ye);
1110
1141
  } catch (d) {
1111
1142
  console.log("Something went wrong when fetching templates:", d);
1112
1143
  } finally {
1113
- u.value = !1;
1144
+ l.value = !1;
1114
1145
  }
1115
1146
  }
1116
- async function o(d) {
1117
- if (!i.value.find((m) => m._id)) {
1118
- u.value = !0;
1147
+ async function a(d) {
1148
+ if (!i.value.find((u) => u._id)) {
1149
+ l.value = !0;
1119
1150
  try {
1120
1151
  i.value = [
1121
- await s.getTemplate(d).then(fe).delayed(1e3)
1152
+ await o.getTemplate(d).then(ye).delayed(1e3)
1122
1153
  ];
1123
- } catch (m) {
1124
- console.log("Something went wrong when fetching templates:", m);
1154
+ } catch (u) {
1155
+ console.log("Something went wrong when fetching templates:", u);
1125
1156
  } finally {
1126
- u.value = !1;
1157
+ l.value = !1;
1127
1158
  }
1128
1159
  }
1129
1160
  }
1130
- function c(d, m) {
1131
- switch (m = re(m), d) {
1132
- case N.Details:
1133
- return a.viewTemplate(m);
1134
- case N.Edit:
1135
- return a.updateTemplate(m);
1136
- case N.Delete:
1137
- return a.deleteTemplate(m, u, l);
1138
- case N.Duplicate:
1139
- return a.duplicateTemplate(m, u, l);
1161
+ function m(d, u) {
1162
+ switch (u = re(u), d) {
1163
+ case I.Details:
1164
+ return s.viewTemplate(u);
1165
+ case I.Edit:
1166
+ return s.updateTemplate(u);
1167
+ case I.Delete:
1168
+ return s.deleteTemplate(u, l, c);
1169
+ case I.Duplicate:
1170
+ return s.duplicateTemplate(u, l, c);
1140
1171
  }
1141
1172
  }
1142
1173
  return {
@@ -1146,7 +1177,7 @@ const Ce = xe(
1146
1177
  accessorKey: "_id",
1147
1178
  header: () => t("inventory.transfer.table.createdAt"),
1148
1179
  cell(d) {
1149
- return Qe(`${d.getValue()}`);
1180
+ return He(`${d.getValue()}`);
1150
1181
  },
1151
1182
  enableSorting: !0
1152
1183
  },
@@ -1174,8 +1205,8 @@ const Ce = xe(
1174
1205
  textAlign: "right"
1175
1206
  },
1176
1207
  cell(d) {
1177
- const m = Number(d.getValue()) || 0, v = d.row.original.purchaseOrder.items.some(Te);
1178
- return m === 0 || v ? W("div", { class: "flex justify-end gap-4 items-center" }, [
1208
+ const u = Number(d.getValue()) || 0, v = d.row.original.purchaseOrder.items.some(Te);
1209
+ return u === 0 || v ? W("div", { class: "flex justify-end gap-4 items-center" }, [
1179
1210
  W(
1180
1211
  X.FmTooltip,
1181
1212
  {},
@@ -1192,8 +1223,8 @@ const Ce = xe(
1192
1223
  }
1193
1224
  }
1194
1225
  ),
1195
- m
1196
- ]) : m;
1226
+ u
1227
+ ]) : u;
1197
1228
  }
1198
1229
  },
1199
1230
  {
@@ -1202,8 +1233,8 @@ const Ce = xe(
1202
1233
  header: () => "Enabled outlets",
1203
1234
  cell(d) {
1204
1235
  var v;
1205
- const m = (v = d.row.original.locations) == null ? void 0 : v.length;
1206
- return m ? `${m}` : "All";
1236
+ const u = (v = d.row.original.locations) == null ? void 0 : v.length;
1237
+ return u ? `${u}` : "All";
1207
1238
  },
1208
1239
  enableSorting: !1,
1209
1240
  meta: {
@@ -1221,13 +1252,13 @@ const Ce = xe(
1221
1252
  {
1222
1253
  id: "action",
1223
1254
  cell(d) {
1224
- const m = d.row.original, v = [
1225
- j[N.Details],
1226
- j[N.Edit],
1227
- j[N.Duplicate],
1228
- j[N.Delete]
1255
+ const u = d.row.original, v = [
1256
+ j[I.Details],
1257
+ j[I.Edit],
1258
+ j[I.Duplicate],
1259
+ j[I.Delete]
1229
1260
  ];
1230
- return He(v, (b) => c(b, m));
1261
+ return Ve(v, (b) => m(b, u));
1231
1262
  },
1232
1263
  enableSorting: !1,
1233
1264
  size: 40,
@@ -1238,19 +1269,20 @@ const Ce = xe(
1238
1269
  }
1239
1270
  ],
1240
1271
  templates: i,
1241
- loading: u,
1242
- fetchTemplates: l,
1243
- loadTemplate: o
1272
+ loading: l,
1273
+ fetchTemplates: c,
1274
+ loadTemplate: a
1244
1275
  };
1245
1276
  }
1246
1277
  );
1247
- function Dt(e, t, a) {
1248
- const u = (a == null ? void 0 : a.abbrev) ?? t.abbrev;
1249
- return `${L(e, !1)} ${u}`;
1278
+ function Dt(e, t, s) {
1279
+ const l = (s == null ? void 0 : s.abbrev) ?? t.abbrev;
1280
+ return `${B(e, !1)} ${l}`;
1250
1281
  }
1251
1282
  export {
1252
- I as P,
1253
- _t as a,
1283
+ R as P,
1284
+ Se as a,
1285
+ $t as b,
1254
1286
  Dt as f,
1255
1287
  Te as t,
1256
1288
  Ce as u