@feedmepos/mf-inventory-portal 0.0.25-dev.9 → 0.0.26-dev.1

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 (116) hide show
  1. package/dist/{App-9zSE_swt.js → App-CipfIdtR.js} +71 -72
  2. package/dist/ApprovalView-IC33yBg7.js +143 -0
  3. package/dist/{BindingsDialog-eGbOIQkw.js → BindingsDialog-EN6Kbnu7.js} +2 -2
  4. package/dist/{BindingsPicker-CVXrd29s.js → BindingsPicker-DQ_LEoqq.js} +3 -3
  5. package/dist/BindingsTable-DGXpAyM4.js +120 -0
  6. package/dist/ClosingDraftView-DR9xsW9I.js +1348 -0
  7. package/dist/ClosingTemplateView-CC1T7ovX.js +1804 -0
  8. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-C9un0wCK.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CovzlB-s.js} +43 -43
  9. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BRSABJnM.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BxEtsFXp.js} +29 -29
  10. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DeRvrF7O.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-B8H6vFJ5.js} +1 -1
  11. package/dist/{IngredientGroupView-ZWCOAljO.js → IngredientGroupView-DRPbXH8d.js} +24 -24
  12. package/dist/IngredientsView-DSHcH30X.js +1731 -0
  13. package/dist/{IntegrationView-DO3Ambro.js → IntegrationView-BgACk-jP.js} +605 -669
  14. package/dist/{InventoryBindingForm-BjtFP29c.js → InventoryBindingForm-Fs-CHoT-.js} +1 -1
  15. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CFMZ4VsK.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DVHQjAEC.js} +63 -63
  16. package/dist/{InventoryBindingSummary-C6DkVX-B.js → InventoryBindingSummary-CHWMtGtk.js} +1 -1
  17. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-nb1t6u2V.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Cu9V-8Cf.js} +1 -1
  18. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BcMAXo4F.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CyVRCAqv.js} +12 -12
  19. package/dist/PublishView-CI7o5a0F.js +222 -0
  20. package/dist/{PurchaseOrderPrintPreview-_MCAsdw9.js → PurchaseOrderPrintPreview-CO4a811o.js} +1 -1
  21. package/dist/ReceiveRequestView-KH5wY5BA.js +2562 -0
  22. package/dist/{RecipeView-dmmjklwh.js → RecipeView-DxVbUxOG.js} +47 -47
  23. package/dist/StockView-CiHPAaYh.js +1840 -0
  24. package/dist/{SupplierView-CO5460uC.js → SupplierView-DPj87kld.js} +448 -461
  25. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CfPPCFh8.js +1566 -0
  26. package/dist/TransferTemplateView-3W29v8hd.js +1420 -0
  27. package/dist/{UnitView-DbYzxCXF.js → UnitView-WCtNQFf8.js} +23 -23
  28. package/dist/{WarehouseView-BII4SEVC.js → WarehouseView-tgFFbQY7.js} +40 -40
  29. package/dist/api/bill.d.ts +12 -2
  30. package/dist/api/closing-draft.d.ts +1 -0
  31. package/dist/api/inventory.d.ts +8 -7
  32. package/dist/api/netsuite.d.ts +22 -5
  33. package/dist/api/purchase-order.d.ts +6 -1
  34. package/dist/api/stock.d.ts +1 -0
  35. package/dist/{app-IM1yJnE8.js → app-Ba80HxT3.js} +38448 -34777
  36. package/dist/app.d.ts +965 -120
  37. package/dist/app.js +1 -1
  38. package/dist/components/FmDroppableField.vue.d.ts +1 -1
  39. package/dist/components/FmMultiselectDialog.d.ts +23 -0
  40. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +1 -1
  41. package/dist/components/shell/inventory/binding-ui.vue.d.ts +1 -1
  42. package/dist/{decimal-DQUpCN-B.js → decimal-DFqusYHB.js} +1 -1
  43. package/dist/{format-unit-display-COuIZISg.js → format-unit-display-Bsod5Ra6.js} +232 -238
  44. package/dist/helper/country.d.ts +1 -0
  45. package/dist/helper/fuzzy.d.ts +1 -1
  46. package/dist/helper/number.d.ts +1 -1
  47. package/dist/index-0ekVGPtB.js +12197 -0
  48. package/dist/index-ZAEVHtfa.js +84 -0
  49. package/dist/{stock-BJUTiXXk.js → stock-Cn6EQvTz.js} +29 -25
  50. package/dist/stores/feature.d.ts +11 -6
  51. package/dist/stores/helper/generate-backend-urls.d.ts +0 -1
  52. package/dist/stores/integration/index.d.ts +2 -0
  53. package/dist/stores/integration/netsuite.d.ts +22 -5
  54. package/dist/stores/inventory.d.ts +141 -8
  55. package/dist/stores/location.d.ts +0 -9
  56. package/dist/stores/stock.d.ts +5 -0
  57. package/dist/stores/warehouse.d.ts +4 -7
  58. package/dist/style.css +1 -1
  59. package/dist/{supplier-CM-qQVyI.js → supplier-P1gi71dg.js} +4 -4
  60. package/dist/tsconfig.app.tsbuildinfo +1 -1
  61. package/dist/{use-ingredient-select-dialog-Cn79xFNg.js → use-ingredient-select-dialog-BW5imbB5.js} +1 -1
  62. package/dist/{use-inventory-binding-dialog-zwOG19YV.js → use-inventory-binding-dialog-BYxb8nXg.js} +1 -1
  63. package/dist/views/adjustment-template/wastage-template/actions.d.ts +0 -24
  64. package/dist/views/adjustment-template/wastage-template/table.d.ts +0 -24
  65. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +92 -8
  66. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +4 -1
  67. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +552 -48
  68. package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +1 -1
  69. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +1 -1
  70. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +12 -36
  71. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +12 -36
  72. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +3 -3
  73. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +2 -2
  74. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -1
  75. package/dist/views/receive-request/components/netsuite/NetSuiteProps.d.ts +2 -0
  76. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +4 -1
  77. package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +2 -0
  78. package/dist/views/receive-request/components/transfer-form/SparkIcon.vue.d.ts +1 -1
  79. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +529 -489
  80. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +8 -4
  81. package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +382 -2
  82. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +5 -2
  83. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +1238 -972
  84. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +1080 -1003
  85. package/dist/views/receive-request/import/XilnexImportDialog.vue.d.ts +22 -0
  86. package/dist/views/receive-request/import/XilnexImportForm.vue.d.ts +17 -0
  87. package/dist/views/receive-request/import/XilnexResult.vue.d.ts +17 -0
  88. package/dist/views/receive-request/import/export.d.ts +14 -0
  89. package/dist/views/receive-request/import/props.d.ts +7 -0
  90. package/dist/views/stock/components/StockRecordCard.vue.d.ts +6 -1
  91. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +6 -4
  92. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +220 -0
  93. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations-2.d.ts +0 -8
  94. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +0 -1
  95. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +7 -2
  96. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +530 -530
  97. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +530 -530
  98. package/dist/views/transfer-template/composables/useTransferTemplateHelper.d.ts +305 -0
  99. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +8 -14
  100. package/dist/vue-i18n-CjtRsQMl.js +2365 -0
  101. package/package.json +7 -7
  102. package/dist/ApprovalView-C2tg-wsm.js +0 -138
  103. package/dist/BindingsTable-CCsQEFnu.js +0 -145
  104. package/dist/ClosingDraftView-BI8b3CJ9.js +0 -1225
  105. package/dist/ClosingTemplateView-miJnC-ML.js +0 -1859
  106. package/dist/IngredientsView-5-pSX6y_.js +0 -1718
  107. package/dist/PublishView-DOMQdIJ7.js +0 -192
  108. package/dist/ReceiveRequestView-902hWGtz.js +0 -1877
  109. package/dist/StockView-C4lEYLXU.js +0 -7847
  110. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-D6sZDCEY.js +0 -1328
  111. package/dist/TransferTemplateView-C9UwNTnY.js +0 -1371
  112. package/dist/components/FmAutocompleteTextField.vue.d.ts +0 -31
  113. package/dist/feature-DMBVVBsQ.js +0 -1005
  114. package/dist/index-CIrsMt6f.js +0 -35546
  115. package/dist/views/dev/components/AutocompleteTextField.vue.d.ts +0 -2
  116. package/dist/vue-i18n-CzPFJ9JY.js +0 -2365
@@ -1,65 +1,65 @@
1
- import { W as Ee, a as q, K as Ie, ad as U, q as Ae, ae as fe, r as ye, u as W, i as B, s as Ne, aG as ae, v as he, b as J, t as V, O as j, aF as Oe, ay as De, T as Fe, w as Pe, x as Ue, d as se, e as X, R as ie, H as Be, ac as Me, D as G, h as D, f as Le } from "./app-IM1yJnE8.js";
2
- import { useCoreStore as ee, useI18n as te } from "@feedmepos/mf-common";
3
- import { useDialogChild as Qe, useSnackbar as ve, useDialog as He, FmButtonVariant as le, components as ce } from "@feedmepos/ui-library";
4
- import { defineStore as ge } from "pinia";
5
- import { defineComponent as be, resolveComponent as L, openBlock as T, createElementBlock as w, createElementVNode as $, normalizeClass as Q, createTextVNode as qe, toDisplayString as I, unref as E, createCommentVNode as H, createVNode as F, withCtx as Z, Fragment as M, renderList as K, ref as C, onMounted as Ve, computed as me, watch as je, createSlots as ze, createBlock as z, h as Y } from "vue";
1
+ import { Y as Ee, a as H, L as Ie, ab as P, s as Ae, ac as pe, v as fe, u as K, j as U, w as Ne, aD as oe, x as ye, b as J, t as q, Q as V, aC as De, av as Oe, W as Fe, y as Pe, z as Ue, e as ae, f as Z, R as se, J as Be, aa as Me, D as W, i as D, h as Le } from "./app-Ba80HxT3.js";
2
+ import { useCoreStore as X, useI18n as ee } from "@feedmepos/mf-common";
3
+ import { useDialogChild as Qe, useSnackbar as he, useDialog as He, FmButtonVariant as ie, components as le } from "@feedmepos/ui-library";
4
+ import { defineStore as ve } from "pinia";
5
+ import { defineComponent as ge, resolveComponent as M, openBlock as T, createElementBlock as w, createElementVNode as $, normalizeClass as L, createTextVNode as qe, toDisplayString as I, unref as E, createCommentVNode as Q, createVNode as O, withCtx as G, Fragment as B, renderList as z, ref as C, onMounted as Ve, computed as ce, watch as je, createSlots as ze, createBlock as j, h as Y } from "vue";
6
6
  import { useRouter as Ke } from "vue-router";
7
- import { u as re } from "./supplier-CM-qQVyI.js";
8
- const Se = Ee((e, t) => {
9
- function a() {
7
+ import { u as te } from "./supplier-P1gi71dg.js";
8
+ const be = Ee((e, t) => {
9
+ function i() {
10
10
  var n;
11
- return `business_${((n = ee().currentBusiness.value) == null ? void 0 : n._id) ?? ""}`;
11
+ return `business_${((n = X().currentBusiness.value) == null ? void 0 : n._id) ?? ""}`;
12
12
  }
13
13
  return {
14
14
  async getTemplate(c) {
15
- const s = a(), n = `${e.inventoryBackendUrl}/${s}/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 = a(), s = `${e.inventoryBackendUrl}/${c}/purchase-order-template`;
20
- return t.get(s);
19
+ const c = i(), a = `${e.inventoryBackendUrl}/${c}/purchase-order-template`;
20
+ return t.get(a);
21
21
  },
22
22
  async createTemplate(c) {
23
- const s = a(), n = `${e.inventoryBackendUrl}/${s}/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 s = a(), n = `${e.inventoryBackendUrl}/${s}/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 s = a(), n = `${e.inventoryBackendUrl}/${s}/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 s = a(), n = `${e.inventoryBackendUrl}/${s}/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(), a = e.sku, c = t.skuById[a._id];
42
- if (c.unit._id !== a.unit._id) return !0;
43
- const s = e.measurement;
44
- return s ? !t.unitById[c.unit._id].measurements.find((o) => o.id === s.id) : !1;
40
+ function Se(e) {
41
+ const t = H(), i = e.sku, c = t.skuById[i._id];
42
+ if (c.unit._id !== i.unit._id) return !0;
43
+ const a = e.measurement;
44
+ return a ? !t.unitById[c.unit._id].measurements.find((o) => o.id === a.id) : !1;
45
45
  }
46
- var R = /* @__PURE__ */ ((e) => (e.PURCHASE = "PURCHASE", e.TRANSFER = "TRANSFER", e))(R || {}), ne = /* @__PURE__ */ ((e) => (e.Source = "Source", e.Destination = "Destination", e.Ingredient = "Ingredient", e))(ne || {});
47
- const ue = Ie(0);
48
- function Te(e) {
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
+ const me = Ie(0);
48
+ function xe(e) {
49
49
  var c;
50
50
  const t = e.sku;
51
51
  return {
52
52
  code: t.code,
53
53
  overrideCode: e.code,
54
54
  name: t.name,
55
- unit: ((c = t.unit.measurements.find((s) => s.id === t.trackingMeasurement)) == null ? void 0 : c.abbrev) ?? t.unit.abbrev,
56
- defaultQuantity: +B(e.quantity),
57
- minimumQuantity: +B(e.minimumQuantity ?? ue),
58
- maximumQuantity: +B(e.maximumQuantity ?? ue),
59
- quantityStep: +B(e.quantityStep)
55
+ unit: ((c = t.unit.measurements.find((a) => a.id === t.trackingMeasurement)) == null ? void 0 : c.abbrev) ?? t.unit.abbrev,
56
+ defaultQuantity: +U(e.quantity),
57
+ minimumQuantity: +U(e.minimumQuantity ?? me),
58
+ maximumQuantity: +U(e.maximumQuantity ?? me),
59
+ quantityStep: +U(e.quantityStep)
60
60
  };
61
61
  }
62
- function _e() {
62
+ function Te() {
63
63
  return [
64
64
  {
65
65
  id: "code",
@@ -97,14 +97,14 @@ function _e() {
97
97
  }
98
98
  function We(e) {
99
99
  var o;
100
- const a = ee().currentBusiness.value, s = (o = e.map((l) => {
100
+ const i = X().currentBusiness.value, a = (o = e.map((l) => {
101
101
  var b;
102
- const d = l.purchaseOrder.items.map((r) => Te(r)), h = _e(), y = [
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", a == null ? void 0 : a.name],
106
- ["Business ID", a == null ? void 0 : a._id],
107
- ["Menu version", a == null ? void 0 : a.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
110
  typeof l.purchaseOrder.supplier.internal == "string" ? R.TRANSFER : R.PURCHASE
@@ -125,7 +125,7 @@ function We(e) {
125
125
  [],
126
126
  h.map((r) => r.name),
127
127
  ...d.map((r) => h.map((x) => r[x.id]))
128
- ], m = h.map((r) => `system:${r.id}`), v = U(y, m);
128
+ ], m = h.map((r) => `system:${r.id}`), v = P(y, m);
129
129
  return { name: l.name, sheet: v };
130
130
  }).reduce(
131
131
  (l, d) => {
@@ -137,11 +137,11 @@ function We(e) {
137
137
  sheets: {},
138
138
  sheetOccurence: {}
139
139
  }
140
- )) == null ? void 0 : o.sheets, n = `${a == null ? void 0 : a.name} transfer templates (${Ae(/* @__PURE__ */ new Date())}).xlsx`, f = fe(s);
141
- return ye(f, n), n;
140
+ )) == null ? void 0 : o.sheets, n = `${i == null ? void 0 : i.name} transfer templates (${Ae(/* @__PURE__ */ new Date())}).xlsx`, f = pe(a);
141
+ return fe(f, n), n;
142
142
  }
143
- function Ge() {
144
- const e = ee(), t = re(), a = W(), c = q(), s = e.currentBusiness.value, n = Te({
143
+ function Ye() {
144
+ const e = X(), t = te(), i = K(), c = H(), a = e.currentBusiness.value, n = xe({
145
145
  sku: {
146
146
  unit: {
147
147
  _id: "",
@@ -172,12 +172,12 @@ function Ge() {
172
172
  amount: 1,
173
173
  precision: 0
174
174
  }
175
- }), f = _e(), o = [
175
+ }), f = Te(), o = [
176
176
  ["Template ID (leave empty to create new)"],
177
177
  ["Template Name", "New template"],
178
- ["Business name", s == null ? void 0 : s.name],
179
- ["Business ID", s == null ? void 0 : s._id],
180
- ["Menu version", s == null ? void 0 : s.menuVersion],
178
+ ["Business name", a == null ? void 0 : a.name],
179
+ ["Business ID", a == null ? void 0 : a._id],
180
+ ["Menu version", a == null ? void 0 : a.menuVersion],
181
181
  ["Purchase/Transfer", "Purchase"],
182
182
  [
183
183
  "Transfer from",
@@ -194,7 +194,7 @@ function Ge() {
194
194
  [],
195
195
  f.map((r) => r.name),
196
196
  f.map((r) => n[r.id])
197
- ], l = f.map((r) => `system:${r.id}`), d = U(o, l), h = U(
197
+ ], l = f.map((r) => `system:${r.id}`), d = P(o, l), h = P(
198
198
  [
199
199
  ...t.businessSuppliers.map((r) => [
200
200
  `${r.name} (${r._id})`,
@@ -206,36 +206,36 @@ function Ge() {
206
206
  r.address.state,
207
207
  r.address.country
208
208
  ]),
209
- ...a.locations.map((r) => {
210
- var x, _, u, i, p, S;
209
+ ...i.locations.map((r) => {
210
+ var x, _, u, s, p, S;
211
211
  return [
212
212
  `${r.name} (${r.dbName})`,
213
213
  "Transfer",
214
214
  (x = r.doc.profile.address) == null ? void 0 : x.line1,
215
215
  (_ = r.doc.profile.address) == null ? void 0 : _.line2,
216
216
  (u = r.doc.profile.address) == null ? void 0 : u.city,
217
- (i = r.doc.profile.address) == null ? void 0 : i.postcode,
217
+ (s = r.doc.profile.address) == null ? void 0 : s.postcode,
218
218
  (p = r.doc.profile.address) == null ? void 0 : p.state,
219
219
  (S = r.doc.profile.address) == null ? void 0 : S.country
220
220
  ];
221
221
  })
222
222
  ],
223
223
  ["Name", "Type", "Line 1", "Line 2", "City", "Postal", "State", "Country"]
224
- ), y = U(
225
- a.locations.map((r) => {
226
- var x, _, u, i, p, S;
224
+ ), y = P(
225
+ i.locations.map((r) => {
226
+ var x, _, u, s, p, S;
227
227
  return [
228
228
  `${r.name} (${r.dbName})`,
229
229
  (x = r.doc.profile.address) == null ? void 0 : x.line1,
230
230
  (_ = r.doc.profile.address) == null ? void 0 : _.line2,
231
231
  (u = r.doc.profile.address) == null ? void 0 : u.city,
232
- (i = r.doc.profile.address) == null ? void 0 : i.postcode,
232
+ (s = r.doc.profile.address) == null ? void 0 : s.postcode,
233
233
  (p = r.doc.profile.address) == null ? void 0 : p.state,
234
234
  (S = r.doc.profile.address) == null ? void 0 : S.country
235
235
  ];
236
236
  }),
237
237
  ["Name", "Line 1", "Line 2", "City", "Postal", "State", "Country"]
238
- ), m = U(
238
+ ), m = P(
239
239
  c.skus.map((r) => [
240
240
  r.code,
241
241
  r.name,
@@ -243,31 +243,31 @@ function Ge() {
243
243
  ...r.unit.measurements.map((x) => x.abbrev)
244
244
  ]),
245
245
  ["Code", "Name", "Base unit", "Measurements"]
246
- ), v = fe({
246
+ ), v = pe({
247
247
  Template: d,
248
248
  Source: h,
249
249
  Destination: y,
250
250
  Ingredient: m
251
- }), b = `${s == null ? void 0 : s.name} transfer templates import.xlsx`;
252
- return ye(v, b), b;
251
+ }), b = `${a == null ? void 0 : a.name} transfer templates import.xlsx`;
252
+ return fe(v, b), b;
253
253
  }
254
- function Ye(e, t) {
255
- const a = new Array(), c = /(.*) \(((supplier_|warehouse_|restaurant_).{24,})\)/, n = W().locationByDbName, o = re().supplierById, l = e.trim(), d = c.exec(l);
254
+ function Ge(e, t) {
255
+ const i = new Array(), c = /(.*) \(((supplier_|warehouse_|restaurant_).{24,})\)/, n = K().locationByDbName, o = te().supplierById, l = e.trim(), d = c.exec(l);
256
256
  if (!d)
257
- return a.push(`Transfer from location value of ${l} cannot be read.`), {
258
- errors: a
257
+ return i.push(`Transfer from location value of ${l} cannot be read.`), {
258
+ errors: i
259
259
  };
260
260
  const h = d[1], y = d[2];
261
261
  let m;
262
262
  if (y.startsWith("supplier"))
263
- m = o[y], t !== R.PURCHASE && a.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.`);
264
264
  else {
265
265
  const v = n[y];
266
266
  if (!v)
267
- return a.push(`Location (${h}) of id ${y} is not found.`), {
268
- errors: a
267
+ return i.push(`Location (${h}) of id ${y} is not found.`), {
268
+ errors: i
269
269
  };
270
- h !== v.name && a.push(
270
+ h !== v.name && i.push(
271
271
  `Location id ${y} has non-matching name. Found ${h} but expected ${v.name}`
272
272
  ), m = {
273
273
  _id: v.doc._id,
@@ -280,7 +280,7 @@ function Ye(e, t) {
280
280
  postcode: "",
281
281
  coordinates: [0, 0]
282
282
  },
283
- internal: y.split("_")[0] === "restaurant" ? ae.enum.restaurant : ae.enum.warehouse,
283
+ internal: y.split("_")[0] === "restaurant" ? oe.enum.restaurant : oe.enum.warehouse,
284
284
  phoneNumber: v.doc.profile.phoneNo ?? "",
285
285
  email: v.doc.profile.email ?? "",
286
286
  _rev: "",
@@ -290,15 +290,15 @@ function Ye(e, t) {
290
290
  }
291
291
  return {
292
292
  from: m,
293
- errors: a
293
+ errors: i
294
294
  };
295
295
  }
296
- function Ze(e) {
296
+ function Je(e) {
297
297
  if (!e.length || `${e[0]}`.toLocaleLowerCase() === "all")
298
298
  return [];
299
- const t = /(.*) \(((warehouse_|restaurant_).{24,})\)/, c = W().locationByDbName;
300
- return e.map((s) => {
301
- const n = new Array(), f = s.trim(), o = t.exec(f);
299
+ const t = /(.*) \(((warehouse_|restaurant_).{24,})\)/, c = K().locationByDbName;
300
+ return e.map((a) => {
301
+ const n = new Array(), f = a.trim(), o = t.exec(f);
302
302
  if (!o)
303
303
  return n.push(`Enabled location value of ${f} cannot be read.`), {
304
304
  errors: n
@@ -314,12 +314,12 @@ function Ze(e) {
314
314
  });
315
315
  });
316
316
  }
317
- function Je(e) {
317
+ function Ze(e) {
318
318
  const [
319
319
  t,
320
- a,
320
+ i,
321
321
  c,
322
- s,
322
+ a,
323
323
  n,
324
324
  f,
325
325
  o,
@@ -327,9 +327,9 @@ function Je(e) {
327
327
  d,
328
328
  h,
329
329
  y
330
- ] = he(e);
330
+ ] = ye(e);
331
331
  return {
332
- id: `${a[1] ?? ""}`.trim(),
332
+ id: `${i[1] ?? ""}`.trim(),
333
333
  name: `${c[1] ?? ""}`.trim(),
334
334
  type: `${o[1] ?? ""}`.trim().toLocaleLowerCase() === "transfer" ? R.TRANSFER : R.PURCHASE,
335
335
  transferFrom: `${l[1] ?? ""}`.trim(),
@@ -341,9 +341,9 @@ function Je(e) {
341
341
  function Xe(e) {
342
342
  const [
343
343
  t,
344
- a,
344
+ i,
345
345
  c,
346
- s,
346
+ a,
347
347
  n,
348
348
  f,
349
349
  o,
@@ -354,10 +354,10 @@ function Xe(e) {
354
354
  m,
355
355
  v,
356
356
  ...b
357
- ] = he(e);
358
- if (!t || !t.length || t.some((i) => i.length && !i.startsWith("system:")))
357
+ ] = ye(e);
358
+ if (!t || !t.length || t.some((s) => s.length && !s.startsWith("system:")))
359
359
  throw new Error("Missing meta header. Excel file does not come from the template.");
360
- const r = t.map((i) => i.split(":")[1]), _ = [
360
+ const r = t.map((s) => s.split(":")[1]), _ = [
361
361
  "code",
362
362
  "name",
363
363
  "unit",
@@ -365,16 +365,16 @@ function Xe(e) {
365
365
  "minimumQuantity",
366
366
  "maximumQuantity",
367
367
  "quantityStep"
368
- ].filter((i) => !r.includes(i));
368
+ ].filter((s) => !r.includes(s));
369
369
  if (_.length)
370
370
  throw new Error(
371
371
  `Missing meta headers (${_.join()}). Excel file does not come from the template.`
372
372
  );
373
- return b.map((i, p) => {
373
+ return b.map((s, p) => {
374
374
  const S = {};
375
375
  for (const k in r) {
376
376
  const g = r[k];
377
- Object.assign(S, { [g]: i[k] });
377
+ Object.assign(S, { [g]: s[k] });
378
378
  }
379
379
  return {
380
380
  index: p,
@@ -382,14 +382,14 @@ function Xe(e) {
382
382
  };
383
383
  });
384
384
  }
385
- function et(e, t, a) {
386
- const c = q(), s = J(), n = c.skuByCode[e.code], f = new Array();
385
+ function et(e, t, i) {
386
+ const c = H(), a = J(), n = c.skuByCode[e.code], f = new Array();
387
387
  if (!n)
388
388
  return f.push(`Cannot find ingredient with code (${e.code}) ${e.name}.`), {
389
389
  index: t,
390
390
  errors: f
391
391
  };
392
- if (a.filter((u) => u.data.code === e.code).length > 1)
392
+ if (i.filter((u) => u.data.code === e.code).length > 1)
393
393
  return f.push(`Ingredient ${e.code} is defined twice.`), {
394
394
  index: t,
395
395
  errors: f
@@ -398,7 +398,7 @@ function et(e, t, a) {
398
398
  if (o.abbrev !== e.unit && !l) {
399
399
  const u = `Cannot find unit measurement of symbol ${e.unit || "[empty]"} for ingredient (${e.code}) ${e.name}.`;
400
400
  f.push(u);
401
- const i = {
401
+ const s = {
402
402
  sku: n,
403
403
  code: e.overrideCode || n.code,
404
404
  name: n.name,
@@ -408,34 +408,34 @@ function et(e, t, a) {
408
408
  minimumQuantity: { amount: 0, precision: 0 },
409
409
  maximumQuantity: { amount: 0, precision: 0 }
410
410
  };
411
- if (s.isEnabled) {
412
- const p = s.getItemPKTCode(n);
413
- p && (i.code = p);
411
+ if (a.isEnabled) {
412
+ const p = a.getItemPKTCode(n);
413
+ p && (s.code = p);
414
414
  }
415
415
  return {
416
416
  index: t,
417
417
  errors: f,
418
- templateItem: i
418
+ templateItem: s
419
419
  };
420
420
  }
421
- const d = V(
421
+ const d = q(
422
422
  e.quantityStep,
423
- j(o, l)
423
+ V(o, l)
424
424
  );
425
425
  (Number.isNaN(Number(e.quantityStep)) || Number(e.quantityStep) <= 0) && f.push("Amount step must be more than 0");
426
- const h = Oe(d), y = V(
426
+ const h = De(d), y = q(
427
427
  e.minimumQuantity,
428
- j(o, l)
428
+ V(o, l)
429
429
  );
430
430
  h(y);
431
- const m = V(
431
+ const m = q(
432
432
  e.maximumQuantity,
433
- j(o, l)
433
+ V(o, l)
434
434
  );
435
435
  h(m), +e.minimumQuantity > +e.maximumQuantity && f.push("Minimum amount must be less than or equal to maximum amount");
436
- const v = De(+e.minimumQuantity, +e.maximumQuantity), b = V(
436
+ const v = Oe(+e.minimumQuantity, +e.maximumQuantity), b = q(
437
437
  e.defaultQuantity,
438
- j(o, l)
438
+ V(o, l)
439
439
  ), r = h(b), x = v(`${e.defaultQuantity}`);
440
440
  typeof r == "string" && f.push(`Default amount: ${r}`), typeof x == "string" && f.push(`Default amount: ${x}`);
441
441
  const _ = {
@@ -456,15 +456,15 @@ function et(e, t, a) {
456
456
  }
457
457
  function tt(e) {
458
458
  const t = e.SheetNames.filter(
459
- (n) => !Object.values(ne).map(String).includes(n)
460
- ), c = we().templates, s = Ne(c, "_id");
459
+ (n) => !Object.values(re).map(String).includes(n)
460
+ ), c = $e().templates, a = Ne(c, "_id");
461
461
  try {
462
462
  return t.reduce(
463
463
  (n, f) => {
464
- var i;
465
- const o = new Array(), l = e.Sheets[f], d = Je(l), h = Ye(d.transferFrom, d.type);
464
+ var s;
465
+ const o = new Array(), l = e.Sheets[f], d = Ze(l), h = Ge(d.transferFrom, d.type);
466
466
  o.push(...h.errors);
467
- const y = h.from, m = Ze(d.locations), v = m.filter((p) => p.location).map((p) => p.location);
467
+ const y = h.from, m = Je(d.locations), v = m.filter((p) => p.location).map((p) => p.location);
468
468
  o.push(...m.flatMap((p) => p.errors));
469
469
  const b = Xe(l).filter((p) => p.data.code), r = b.map(
470
470
  (p, S) => et(p.data, S, b)
@@ -476,7 +476,7 @@ function tt(e) {
476
476
  );
477
477
  const x = r.filter((p) => p.templateItem).map((p) => p.templateItem);
478
478
  if (d.id) {
479
- const p = s[d.id];
479
+ const p = a[d.id];
480
480
  if (!p) {
481
481
  const k = {
482
482
  _id: d.id,
@@ -501,7 +501,7 @@ function tt(e) {
501
501
  locations: v.length ? v : null,
502
502
  purchaseOrder: {
503
503
  ...p.purchaseOrder,
504
- supplier: y ?? ((i = p.purchaseOrder) == null ? void 0 : i.supplier),
504
+ supplier: y ?? ((s = p.purchaseOrder) == null ? void 0 : s.supplier),
505
505
  ref: d.reference,
506
506
  remark: d.remark,
507
507
  items: x
@@ -518,7 +518,7 @@ function tt(e) {
518
518
  name: d.name,
519
519
  locations: v.length ? v : null,
520
520
  purchaseOrder: {
521
- supplier: y ?? $e(),
521
+ supplier: y ?? _e(),
522
522
  ref: d.reference,
523
523
  remark: d.remark,
524
524
  items: x
@@ -544,7 +544,7 @@ function tt(e) {
544
544
  };
545
545
  }
546
546
  }
547
- function $e() {
547
+ function _e() {
548
548
  return {
549
549
  _id: "",
550
550
  name: "",
@@ -563,13 +563,13 @@ function rt() {
563
563
  remark: void 0,
564
564
  ref: void 0,
565
565
  items: [],
566
- supplier: $e()
566
+ supplier: _e()
567
567
  };
568
568
  }
569
569
  const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-col" }, at = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" }, st = { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, it = {
570
570
  key: 0,
571
571
  class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
572
- }, lt = { key: 0 }, de = /* @__PURE__ */ be({
572
+ }, lt = { key: 0 }, ue = /* @__PURE__ */ ge({
573
573
  __name: "TransferTemplateImportItem",
574
574
  props: {
575
575
  type: {},
@@ -580,31 +580,31 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
580
580
  errors: {}
581
581
  },
582
582
  setup(e) {
583
- return (t, a) => {
583
+ return (t, i) => {
584
584
  var n, f, o;
585
- const c = L("FmIcon"), s = L("FmTooltip");
585
+ const c = M("FmIcon"), a = M("FmTooltip");
586
586
  return T(), w("div", nt, [
587
- a[0] || (a[0] = $("div", null, "•", -1)),
587
+ i[0] || (i[0] = $("div", null, "•", -1)),
588
588
  $("div", ot, [
589
589
  $("div", at, [
590
590
  $("div", {
591
- class: Q({
591
+ class: L({
592
592
  "text-fm-color-system-error-300": t.errors.length
593
593
  })
594
594
  }, [
595
595
  qe(I(t.name) + " ", 1),
596
596
  $("span", st, " (" + I(E(Fe)(`${t.transferType}`)) + ") ", 1),
597
- t.type === "create" ? (T(), w("span", it, "(new)")) : H("", !0)
597
+ t.type === "create" ? (T(), w("span", it, "(new)")) : Q("", !0)
598
598
  ], 2),
599
599
  t.errors.length ? (T(), w("div", lt, [
600
- F(s, { "z-index": 50 }, {
601
- content: Z(() => [
600
+ O(a, { "z-index": 50 }, {
601
+ content: G(() => [
602
602
  $("ol", null, [
603
- (T(!0), w(M, null, K(t.errors, (l, d) => (T(), w("li", { key: d }, I(l), 1))), 128))
603
+ (T(!0), w(B, null, z(t.errors, (l, d) => (T(), w("li", { key: d }, I(l), 1))), 128))
604
604
  ])
605
605
  ]),
606
- default: Z(() => [
607
- F(c, {
606
+ default: G(() => [
607
+ O(c, {
608
608
  name: "error",
609
609
  size: "sm",
610
610
  color: "system-error-300"
@@ -612,10 +612,10 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
612
612
  ]),
613
613
  _: 1
614
614
  })
615
- ])) : H("", !0)
615
+ ])) : Q("", !0)
616
616
  ]),
617
617
  $("div", {
618
- class: Q([
618
+ class: L([
619
619
  "fm-typo-en-body-sm-400",
620
620
  {
621
621
  "text-fm-color-system-error-200": t.errors.length,
@@ -639,10 +639,10 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
639
639
  }, yt = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, ht = {
640
640
  key: 0,
641
641
  class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
642
- }, vt = { class: "fm-typo-en-body-lg-600" }, gt = /* @__PURE__ */ be({
642
+ }, vt = { class: "fm-typo-en-body-lg-600" }, gt = /* @__PURE__ */ ge({
643
643
  __name: "TransferTemplateImport",
644
644
  setup(e) {
645
- const t = C(null), a = Qe(), c = ve(), s = C(!1), n = C(!1), f = re();
645
+ const t = C(null), i = Qe(), c = he(), a = C(!1), n = C(!1), f = te();
646
646
  Ve(async () => {
647
647
  n.value = !0;
648
648
  try {
@@ -657,23 +657,23 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
657
657
  n.value = !1;
658
658
  }
659
659
  });
660
- const o = C(new Array()), l = C([]), d = C([]), h = me(
660
+ const o = C(new Array()), l = C([]), d = C([]), h = ce(
661
661
  () => !!o.value.length || l.value.some((b) => b.errors.length) || d.value.some((b) => b.errors.length)
662
- ), y = me(
662
+ ), y = ce(
663
663
  () => !!l.value.length || !!d.value.length
664
- ), { t: m } = te();
664
+ ), { t: m } = ee();
665
665
  async function v(b) {
666
666
  o.value = [], l.value = [], d.value = [];
667
667
  try {
668
- s.value = !0;
668
+ a.value = !0;
669
669
  const [r] = await Promise.all([
670
670
  Ue(b),
671
671
  // fake buffer
672
- new Promise((i) => setTimeout(i, 1e3))
672
+ new Promise((s) => setTimeout(s, 1e3))
673
673
  ]);
674
674
  if (!r.SheetNames.filter(
675
- (i) => !Object.values(ne).map(String).includes(i)
676
- ).find((i) => i)) {
675
+ (s) => !Object.values(re).map(String).includes(s)
676
+ ).find((s) => s)) {
677
677
  o.value.push(m("inventory.ingredient.import.fileError.noSheet"));
678
678
  return;
679
679
  }
@@ -688,7 +688,7 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
688
688
  o.value.push(m("inventory.ingredient.import.fileError.noData"));
689
689
  return;
690
690
  }
691
- a.emitData(u);
691
+ i.emitData(u);
692
692
  } catch (r) {
693
693
  c.open({
694
694
  title: m("inventory.ingredient.import.fileError.unableToRead"),
@@ -699,91 +699,91 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
699
699
  o.value.length && c.open({
700
700
  title: m("inventory.ingredient.import.fileError.invalidExcel"),
701
701
  type: "error"
702
- }), s.value = !1;
702
+ }), a.value = !1;
703
703
  }
704
704
  }
705
705
  return je(t, (b) => {
706
706
  b && v(b);
707
707
  }), (b, r) => {
708
- const x = L("FmCircularProgress"), _ = L("FmIcon"), u = L("FmButton");
708
+ const x = M("FmCircularProgress"), _ = M("FmIcon"), u = M("FmButton");
709
709
  return T(), w("div", ct, [
710
710
  r[2] || (r[2] = $("div", { class: "fm-typo-en-body-md-400" }, "Import transfer templates from excel sheets.", -1)),
711
711
  n.value ? (T(), w("div", mt, [
712
712
  $("div", null, [
713
- F(x, {
713
+ O(x, {
714
714
  size: "md",
715
715
  color: "neutral-gray-200"
716
716
  })
717
717
  ]),
718
718
  r[1] || (r[1] = $("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "Loading...", -1))
719
- ])) : (T(), w(M, { key: 1 }, [
720
- F(Pe, {
721
- class: Q({
719
+ ])) : (T(), w(B, { key: 1 }, [
720
+ O(Pe, {
721
+ class: L({
722
722
  "w-full": !0,
723
723
  "h-[200px]": !t.value
724
724
  }),
725
725
  accept: ".xlsx",
726
- onFileUpload: r[0] || (r[0] = (i) => t.value = i),
726
+ onFileUpload: r[0] || (r[0] = (s) => t.value = s),
727
727
  label: E(m)("inventory.ingredient.import.uploadTemplate"),
728
728
  "button-label": E(m)("inventory.ingredient.import.selectFile")
729
729
  }, ze({ _: 2 }, [
730
730
  t.value ? {
731
731
  name: "default",
732
- fn: Z(({ openFileDialog: i }) => [
732
+ fn: G(({ openFileDialog: s }) => [
733
733
  $("div", ut, [
734
734
  $("div", {
735
- class: Q([
735
+ class: L([
736
736
  "fm-corner-radius-md p-16 flex items-center gap-16",
737
737
  {
738
- "border border-fm-color-neutral-gray-100": s.value,
739
- "border border-fm-color-neutral-gray-200": !s.value && !h.value,
738
+ "border border-fm-color-neutral-gray-100": a.value,
739
+ "border border-fm-color-neutral-gray-200": !a.value && !h.value,
740
740
  "border border-fm-color-system-error-200": h.value
741
741
  }
742
742
  ])
743
743
  }, [
744
- s.value ? (T(), z(x, {
744
+ a.value ? (T(), j(x, {
745
745
  key: 0,
746
746
  size: "md",
747
747
  color: "neutral-gray-200"
748
- })) : (T(), z(_, {
748
+ })) : (T(), j(_, {
749
749
  key: 1,
750
750
  name: h.value ? "error" : "attach_file",
751
751
  outline: "",
752
752
  color: h.value ? "system-error-300" : void 0
753
753
  }, null, 8, ["name", "color"])),
754
754
  $("div", {
755
- class: Q([
755
+ class: L([
756
756
  "fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center",
757
757
  {
758
- "text-fm-color-typo-disabled": s.value,
759
- "text-fm-color-typo-primary": !s.value
758
+ "text-fm-color-typo-disabled": a.value,
759
+ "text-fm-color-typo-primary": !a.value
760
760
  }
761
761
  ])
762
762
  }, [
763
763
  $("div", dt, I(t.value.name), 1)
764
764
  ], 2),
765
- s.value ? H("", !0) : (T(), w("div", pt, [
766
- F(u, {
765
+ a.value ? Q("", !0) : (T(), w("div", pt, [
766
+ O(u, {
767
767
  label: E(m)("inventory.ingredient.import.replaceFile"),
768
768
  variant: h.value ? "destructive" : "secondary",
769
769
  "prepend-icon": h.value ? void 0 : "autorenew",
770
- onClick: i
770
+ onClick: s
771
771
  }, null, 8, ["label", "variant", "prepend-icon", "onClick"])
772
772
  ]))
773
773
  ], 2),
774
774
  o.value.length ? (T(), w("div", ft, [
775
- (T(!0), w(M, null, K(o.value, (p, S) => (T(), w("div", {
775
+ (T(!0), w(B, null, z(o.value, (p, S) => (T(), w("div", {
776
776
  key: S,
777
777
  class: "flex gap-8 items-center"
778
778
  }, [
779
- F(_, {
779
+ O(_, {
780
780
  name: "error",
781
781
  size: "sm",
782
782
  color: "system-error-300"
783
783
  }),
784
784
  $("div", yt, I(p), 1)
785
785
  ]))), 128))
786
- ])) : H("", !0)
786
+ ])) : Q("", !0)
787
787
  ])
788
788
  ]),
789
789
  key: "0"
@@ -791,25 +791,25 @@ const nt = { class: "flex items-center gap-12 pl-8" }, ot = { class: "flex flex-
791
791
  ]), 1032, ["class", "label", "button-label"]),
792
792
  y.value ? (T(), w("div", ht, [
793
793
  $("div", vt, I(E(m)("inventory.ingredient.import.summary")), 1),
794
- (T(!0), w(M, null, K(l.value, (i, p) => (T(), z(de, {
794
+ (T(!0), w(B, null, z(l.value, (s, p) => (T(), j(ue, {
795
795
  key: p,
796
- name: i.template.name,
797
- "transfer-type": typeof i.template.purchaseOrder.supplier.internal == "string" ? E(R).TRANSFER : E(R).PURCHASE,
798
- locations: i.template.locations,
799
- items: i.template.purchaseOrder.items,
800
- errors: i.errors,
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,
801
801
  type: "create"
802
802
  }, null, 8, ["name", "transfer-type", "locations", "items", "errors"]))), 128)),
803
- (T(!0), w(M, null, K(d.value, (i) => (T(), z(de, {
804
- key: i.template._id,
805
- name: i.template.name,
806
- "transfer-type": typeof i.template.purchaseOrder.supplier.internal == "string" ? E(R).TRANSFER : E(R).PURCHASE,
807
- locations: i.template.locations,
808
- items: i.template.purchaseOrder.items,
809
- errors: i.errors,
803
+ (T(!0), w(B, null, z(d.value, (s) => (T(), j(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,
810
810
  type: "update"
811
811
  }, null, 8, ["name", "transfer-type", "locations", "items", "errors"]))), 128))
812
- ])) : H("", !0)
812
+ ])) : Q("", !0)
813
813
  ], 64))
814
814
  ]);
815
815
  };
@@ -823,14 +823,14 @@ function bt(e) {
823
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;
824
824
  return l && l == d;
825
825
  }
826
- const a = t.getNetSuiteLocation(`${e.internal}_${e._id}`), c = t.getLocationSubsidiary(a == null ? void 0 : a.netSuiteId).id, s = (f = t.currentLocationSubsidiary()) == null ? void 0 : f.id;
827
- return c && c == s;
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;
827
+ return c && c == a;
828
828
  }
829
- const St = ge("transferTemplateActions", () => {
830
- const e = He(), t = ve(), a = W(), c = we(), s = Se(), n = J(), f = Ke(), { t: o } = te(), l = C({});
829
+ const St = ve("transferTemplateActions", () => {
830
+ const e = He(), t = he(), i = K(), c = $e(), a = be(), n = J(), f = Ke(), { t: o } = ee(), l = C({});
831
831
  function d() {
832
832
  l.value = {
833
- mode: se.CREATE,
833
+ mode: ae.CREATE,
834
834
  show: !0,
835
835
  "onUpdate:show"(u) {
836
836
  l.value.show = u;
@@ -839,26 +839,26 @@ const St = ge("transferTemplateActions", () => {
839
839
  }
840
840
  function h(u) {
841
841
  l.value = {
842
- mode: se.UPDATE,
842
+ mode: ae.UPDATE,
843
843
  modelValue: u,
844
844
  show: !0,
845
- "onUpdate:show"(i) {
846
- l.value.show = i;
845
+ "onUpdate:show"(s) {
846
+ l.value.show = s;
847
847
  }
848
848
  };
849
849
  }
850
- function y(u, i, p) {
850
+ function y(u, s, p) {
851
851
  e.open({
852
852
  title: `Confirm deleting template ${u.name}?`,
853
853
  message: "Deleted template can no longer be retrieved",
854
854
  primaryActions: {
855
855
  text: "Delete",
856
- variant: le.Destructive,
856
+ variant: ie.Destructive,
857
857
  close: !0
858
858
  },
859
859
  secondaryActions: {
860
860
  text: "Cancel",
861
- variant: le.Plain,
861
+ variant: ie.Plain,
862
862
  close: !0
863
863
  }
864
864
  }).onPrimary(async () => {
@@ -867,9 +867,9 @@ const St = ge("transferTemplateActions", () => {
867
867
  type: "info"
868
868
  });
869
869
  try {
870
- i.value = !0;
870
+ s.value = !0;
871
871
  const [S] = await Promise.allSettled([
872
- s.deleteTemplate(u),
872
+ a.deleteTemplate(u),
873
873
  new Promise((k) => setTimeout(k, 1e3))
874
874
  ]);
875
875
  if (S.status === "rejected") throw S.reason;
@@ -884,7 +884,7 @@ const St = ge("transferTemplateActions", () => {
884
884
  type: "error"
885
885
  }), console.error("error on deleting purchase order template", S);
886
886
  } finally {
887
- i.value = !1, p();
887
+ s.value = !1, p();
888
888
  }
889
889
  });
890
890
  }
@@ -893,26 +893,20 @@ const St = ge("transferTemplateActions", () => {
893
893
  m.value = {
894
894
  template: u,
895
895
  show: !0,
896
- "onUpdate:show"(i) {
897
- m.value.show = i;
896
+ "onUpdate:show"(s) {
897
+ m.value.show = s;
898
898
  },
899
899
  "onAction:edit"() {
900
- m.value.show = !1, h(X(u));
900
+ m.value.show = !1, h(Z(u));
901
901
  }
902
902
  };
903
903
  }
904
904
  function b() {
905
- const { promise: u, resolve: i } = Promise.withResolvers(), p = (g) => {
906
- i(g);
905
+ const { promise: u, resolve: s } = Promise.withResolvers(), p = (g) => {
906
+ s(g);
907
907
  }, S = c.templates.filter((g) => {
908
- var A, N, O;
909
- if (((A = g.purchaseOrder.supplier) == null ? void 0 : A._id) === a.currentLocation.doc._id) return !1;
910
- if (!((N = g.locations) != null && N.length)) return !0;
911
- if (g.locationTags) {
912
- const P = (O = a.currentLocation.doc.customAttributes) == null ? void 0 : O.tag;
913
- if (g.locationTags.includes(P)) return !0;
914
- }
915
- return g.locations.find((P) => P.doc._id === a.currentLocation.doc._id);
908
+ var A, N;
909
+ return ((A = g.purchaseOrder.supplier) == null ? void 0 : A._id) === i.currentLocation.doc._id ? !1 : (N = g.locations) != null && N.length ? g.locations.find((F) => F.doc._id === i.currentLocation.doc._id) : !0;
916
910
  });
917
911
  if (!S.length)
918
912
  return e.open({
@@ -927,14 +921,14 @@ const St = ge("transferTemplateActions", () => {
927
921
  close: !0
928
922
  }
929
923
  }).onPrimary(() => {
930
- f.push({ name: ie.TRANSFER_TEMPLATE }), p(void 0);
924
+ f.push({ name: se.TRANSFER_TEMPLATE }), p(void 0);
931
925
  }).onSecondary(() => p(void 0)).onClose(() => p(void 0)), u;
932
926
  const k = S.map((g) => {
933
- var oe;
934
- const A = !g.purchaseOrder.items.length || g.purchaseOrder.items.some(xe), N = !bt(g.purchaseOrder.supplier), O = g.purchaseOrder.supplier.internal ? n.getNetSuiteLocation(
927
+ var ne;
928
+ const A = !g.purchaseOrder.items.length || g.purchaseOrder.items.some(Se), N = !bt(g.purchaseOrder.supplier), F = g.purchaseOrder.supplier.internal ? n.getNetSuiteLocation(
935
929
  `${g.purchaseOrder.supplier.internal}_${g.purchaseOrder.supplier._id}`
936
- ) : n.getNetSuiteVendor(g.purchaseOrder.supplier._id), P = N ? `The subsidiary of the request
937
- location is ${(oe = n.getLocationSubsidiary(O == null ? void 0 : O.netSuiteId)) == null ? void 0 : oe.fullName}.` : void 0, ke = A || N, Ce = A ? "This template is invalid. Update this template." : N ? P : void 0, Re = `${g.purchaseOrder.supplier.internal ? "Transfer" : "Purchase"} from ${g.purchaseOrder.supplier.name}`;
930
+ ) : n.getNetSuiteVendor(g.purchaseOrder.supplier._id), we = N ? `The subsidiary of the request
931
+ location is ${(ne = n.getLocationSubsidiary(F == null ? void 0 : F.netSuiteId)) == null ? void 0 : ne.fullName}.` : void 0, ke = A || N, Ce = A ? "This template is invalid. Update this template." : N ? we : void 0, Re = `${g.purchaseOrder.supplier.internal ? "Transfer" : "Purchase"} from ${g.purchaseOrder.supplier.name}`;
938
932
  return {
939
933
  label: g.name,
940
934
  value: g._id,
@@ -962,7 +956,7 @@ const St = ge("transferTemplateActions", () => {
962
956
  close: !0
963
957
  }
964
958
  }).onPrimary((g) => Array.isArray(g) ? p(g[0]) : null).onSecondary(() => p(void 0)).onTertiary(() => {
965
- f.push({ name: ie.TRANSFER_TEMPLATE }), p(void 0);
959
+ f.push({ name: se.TRANSFER_TEMPLATE }), p(void 0);
966
960
  }).onClose(() => p(void 0)), u;
967
961
  }
968
962
  function r() {
@@ -1000,7 +994,7 @@ const St = ge("transferTemplateActions", () => {
1000
994
  });
1001
995
  return;
1002
996
  }
1003
- if (u.importCreateResult.some((i) => i.errors.length) || u.importUpdateResult.some((i) => i.errors.length)) {
997
+ if (u.importCreateResult.some((s) => s.errors.length) || u.importUpdateResult.some((s) => s.errors.length)) {
1004
998
  t.open({
1005
999
  title: o("inventory.ingredient.import.error.invalidContent"),
1006
1000
  message: o("inventory.ingredient.import.error.hasErrors"),
@@ -1009,11 +1003,11 @@ const St = ge("transferTemplateActions", () => {
1009
1003
  return;
1010
1004
  }
1011
1005
  e.close(), x(u);
1012
- }).onTertiary(Ge);
1006
+ }).onTertiary(Ye);
1013
1007
  }
1014
1008
  async function x(u) {
1015
1009
  try {
1016
- const i = [
1010
+ const s = [
1017
1011
  ...u.importCreateResult.map(
1018
1012
  (g) => g.template
1019
1013
  ),
@@ -1025,23 +1019,23 @@ const St = ge("transferTemplateActions", () => {
1025
1019
  const k = () => {
1026
1020
  S += p, t.open({
1027
1021
  title: o("inventory.ingredient.import.progress", [
1028
- Math.min(S, i.length),
1029
- i.length
1022
+ Math.min(S, s.length),
1023
+ s.length
1030
1024
  ])
1031
1025
  });
1032
1026
  };
1033
- for (const g of i.chunk(100))
1034
- k(), await s.importTemplates(g);
1027
+ for (const g of s.chunk(100))
1028
+ k(), await a.importTemplates(g);
1035
1029
  t.open({
1036
1030
  title: o("inventory.ingredient.import.success"),
1037
1031
  type: "success"
1038
1032
  });
1039
- } catch (i) {
1033
+ } catch (s) {
1040
1034
  t.open({
1041
1035
  title: o("inventory.ingredient.import.error.failed"),
1042
- message: o("inventory.ingredient.import.error.systemMessage", [i == null ? void 0 : i.message]),
1036
+ message: o("inventory.ingredient.import.error.systemMessage", [s == null ? void 0 : s.message]),
1043
1037
  type: "error"
1044
- }), console.error("Error in importing skus", u, i);
1038
+ }), console.error("Error in importing skus", u, s);
1045
1039
  } finally {
1046
1040
  c.fetchTemplates();
1047
1041
  }
@@ -1066,22 +1060,22 @@ const St = ge("transferTemplateActions", () => {
1066
1060
  templateDetailsProps: m
1067
1061
  };
1068
1062
  });
1069
- function pe(e) {
1070
- const { skuById: t } = q(), a = X(e);
1071
- return a.purchaseOrder.items = e.purchaseOrder.items.filter((c) => t[c.sku._id]), a;
1063
+ function de(e) {
1064
+ const { skuById: t } = H(), i = Z(e);
1065
+ return i.purchaseOrder.items = e.purchaseOrder.items.filter((c) => t[c.sku._id]), i;
1072
1066
  }
1073
- const we = ge(
1067
+ const $e = ve(
1074
1068
  "transferTemplateTable",
1075
1069
  function() {
1076
- const { t } = te(), a = St(), c = C(!1), s = C(new Array()), n = Se(), f = q();
1070
+ const { t } = ee(), i = St(), c = C(!1), a = C(new Array()), n = be(), f = H();
1077
1071
  async function o() {
1078
- s.value = [], c.value = !0;
1072
+ a.value = [], c.value = !0;
1079
1073
  try {
1080
1074
  const [y] = await Promise.all([
1081
1075
  n.readTemplates(),
1082
1076
  f.readInventory()
1083
1077
  ]).delayed(1e3);
1084
- s.value = y.map(pe);
1078
+ a.value = y.map(de);
1085
1079
  } catch (y) {
1086
1080
  console.log("Something went wrong when fetching templates:", y);
1087
1081
  } finally {
@@ -1089,11 +1083,11 @@ const we = ge(
1089
1083
  }
1090
1084
  }
1091
1085
  async function l(y) {
1092
- if (!s.value.find((m) => m._id)) {
1086
+ if (!a.value.find((m) => m._id)) {
1093
1087
  c.value = !0;
1094
1088
  try {
1095
- s.value = [
1096
- await n.getTemplate(y).then(pe).delayed(1e3)
1089
+ a.value = [
1090
+ await n.getTemplate(y).then(de).delayed(1e3)
1097
1091
  ];
1098
1092
  } catch (m) {
1099
1093
  console.log("Something went wrong when fetching templates:", m);
@@ -1103,13 +1097,13 @@ const we = ge(
1103
1097
  }
1104
1098
  }
1105
1099
  function d(y, m) {
1106
- switch (m = X(m), y) {
1100
+ switch (m = Z(m), y) {
1107
1101
  case D.Details:
1108
- return a.viewTemplate(m);
1102
+ return i.viewTemplate(m);
1109
1103
  case D.Edit:
1110
- return a.updateTemplate(m);
1104
+ return i.updateTemplate(m);
1111
1105
  case D.Delete:
1112
- return a.deleteTemplate(m, c, o);
1106
+ return i.deleteTemplate(m, c, o);
1113
1107
  }
1114
1108
  }
1115
1109
  return {
@@ -1140,17 +1134,17 @@ const we = ge(
1140
1134
  textAlign: "right"
1141
1135
  },
1142
1136
  cell(y) {
1143
- const m = Number(y.getValue()) || 0, v = y.row.original.purchaseOrder.items.some(xe);
1137
+ const m = Number(y.getValue()) || 0, v = y.row.original.purchaseOrder.items.some(Se);
1144
1138
  return m === 0 || v ? Y("div", { class: "flex justify-end gap-4 items-center" }, [
1145
1139
  Y(
1146
- ce.FmTooltip,
1140
+ le.FmTooltip,
1147
1141
  {},
1148
1142
  {
1149
1143
  content() {
1150
1144
  return v ? "The template is invalid due to invalid unit on some of the items. Please update this template." : "The template is invalid due to deleted ingredients. Please update this template.";
1151
1145
  },
1152
1146
  default() {
1153
- return Y(ce.FmIcon, {
1147
+ return Y(le.FmIcon, {
1154
1148
  name: "error",
1155
1149
  color: "system-error-300",
1156
1150
  size: "sm"
@@ -1188,9 +1182,9 @@ const we = ge(
1188
1182
  id: "action",
1189
1183
  cell(y) {
1190
1184
  const m = y.row.original, v = [
1191
- G[D.Details],
1192
- G[D.Edit],
1193
- G[D.Delete]
1185
+ W[D.Details],
1186
+ W[D.Edit],
1187
+ W[D.Delete]
1194
1188
  ];
1195
1189
  return Le(v, (b) => d(b, m));
1196
1190
  },
@@ -1202,22 +1196,22 @@ const we = ge(
1202
1196
  }
1203
1197
  }
1204
1198
  ],
1205
- templates: s,
1199
+ templates: a,
1206
1200
  loading: c,
1207
1201
  fetchTemplates: o,
1208
1202
  loadTemplate: l
1209
1203
  };
1210
1204
  }
1211
1205
  );
1212
- function Et(e, t, a) {
1213
- const c = (a == null ? void 0 : a.abbrev) ?? t.abbrev;
1214
- return `${B(e, !1)} ${c}`;
1206
+ function Et(e, t, i) {
1207
+ const c = (i == null ? void 0 : i.abbrev) ?? t.abbrev;
1208
+ return `${U(e, !1)} ${c}`;
1215
1209
  }
1216
1210
  export {
1217
1211
  R as P,
1218
- Se as a,
1212
+ be as a,
1219
1213
  St as b,
1220
1214
  Et as f,
1221
- xe as t,
1222
- we as u
1215
+ Se as t,
1216
+ $e as u
1223
1217
  };