@feedmepos/mf-inventory-portal 1.2.51-dev.1 → 1.2.52

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 (103) hide show
  1. package/dist/{App-bY_YcLwH.js → App--VMK_Bqt.js} +70 -75
  2. package/dist/{ApprovalView-vzIiBqt2.js → ApprovalView-3g89b2Ya.js} +34 -34
  3. package/dist/{BindingsDialog-DCh2ORem.js → BindingsDialog-C_qcIKUI.js} +2 -2
  4. package/dist/{BindingsPicker-DcNG03p-.js → BindingsPicker-CPrS3J1t.js} +2 -2
  5. package/dist/{BindingsTable-B_Yaq-z3.js → BindingsTable-C5PCH5Vf.js} +4 -4
  6. package/dist/{ClosingDraftView-C0T8cWEB.js → ClosingDraftView-CiJV5d7M.js} +399 -413
  7. package/dist/{ClosingHistoryView-DkKAjh7T.js → ClosingHistoryView-CvOfQF2y.js} +27 -27
  8. package/dist/{ClosingTemplateView-DpH1EyW5.js → ClosingTemplateView-BWvaFiHB.js} +524 -512
  9. package/dist/{DeliveryOrderPrintPreview-B2ecLaLu.js → DeliveryOrderPrintPreview-C9ZI8EVy.js} +1 -1
  10. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DVOt7pfR.js +231 -0
  11. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-kVpsL4cx.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DLdaN3XH.js} +12 -12
  12. package/dist/FmMultiselectDialog-CMGvzBur.js +598 -0
  13. package/dist/{FmMultiselectDialog-DGUwruxs.js → FmMultiselectDialog-M5xxjK0u.js} +1 -1
  14. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-CRTG3VFo.js → FmUnitInput.vue_vue_type_script_setup_true_lang-CnHJwYtN.js} +3 -3
  15. package/dist/{ImportView-Bk4Z7nGh.js → ImportView-DeW2True.js} +7 -7
  16. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BEJ19Uej.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BYSKI3Qs.js} +1 -1
  17. package/dist/{IngredientGroupView-8GHMMOux.js → IngredientGroupView-BjZqH3dV.js} +107 -108
  18. package/dist/{IngredientsView-DbmODx-v.js → IngredientsView-BU-dONim.js} +125 -126
  19. package/dist/{IntegrationView-DC0O_Lk4.js → IntegrationView-6m61Ipf9.js} +80 -80
  20. package/dist/{InventoryBindingForm-ln0q25n_.js → InventoryBindingForm-C-QzGErT.js} +1 -1
  21. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CFgk9rSe.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-B25u_7kJ.js} +21 -21
  22. package/dist/{InventoryBindingSummary-BlNXhS4v.js → InventoryBindingSummary-CJbJDI2o.js} +1 -1
  23. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BY_mXqPr.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-RgGlAX33.js} +1 -1
  24. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BhNjwE3X.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DhsCTTsf.js} +2 -2
  25. package/dist/{PublishView-5GkTzxbi.js → PublishView-BGIPKR3R.js} +3 -3
  26. package/dist/{PurchaseOrderPrintPreview-Dj5lJ5Ou.js → PurchaseOrderPrintPreview-DNYxm9VZ.js} +1 -1
  27. package/dist/ReceiveRequestView-BkwCM2gx.js +2913 -0
  28. package/dist/{RecipeView-OLPRwnVx.js → RecipeView-ImuvouoQ.js} +82 -83
  29. package/dist/{StockView-TcA5zJqr.js → StockView-DX-M79i4.js} +112 -113
  30. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DZ6TDkKR.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BU9OphZT.js} +1 -1
  31. package/dist/{SupplierView-77qI9YCg.js → SupplierView-DwOXRHIm.js} +27 -28
  32. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-_8YeihNH.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-CFNAl2zj.js} +2 -2
  33. package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-cfFHDIwQ.js +162 -0
  34. package/dist/TemplatePublishDialog.vue_vue_type_script_setup_true_lang-C-fJgXX4.js +201 -0
  35. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-7BoFD5wV.js → TransferDetails.vue_vue_type_script_setup_true_lang-vKznrul-.js} +659 -658
  36. package/dist/{TransferTemplateView-CI0U36Tr.js → TransferTemplateView-B6Lynxx7.js} +81 -82
  37. package/dist/{UnitView-fNFFUNlb.js → UnitView-CPl1rpkV.js} +19 -20
  38. package/dist/{WarehouseView-BAXgnZnO.js → WarehouseView-705pfGhw.js} +20 -21
  39. package/dist/WastageTemplateView-DAEt9fAW.js +2382 -0
  40. package/dist/api/adjustment-template.d.ts +1 -0
  41. package/dist/api/closing-template.d.ts +1 -0
  42. package/dist/api/netsuite.d.ts +0 -8
  43. package/dist/app-uBuHtW8m.js +8127 -0
  44. package/dist/{app-CddcvygU.js → app-yA2GcbOF.js} +4405 -4505
  45. package/dist/app.d.ts +1 -52
  46. package/dist/app.js +1 -1
  47. package/dist/closing-template-C_fOjY8b.js +125 -0
  48. package/dist/components/FmInventoryTableToolbar.vue.d.ts +0 -8
  49. package/dist/components/FmMultiselectDialogProps.d.ts +0 -5
  50. package/dist/components/TemplatePublishDialog.d.ts +2 -0
  51. package/dist/cypress/component/receive-request/KDI-15-total-price-currency.cy.d.ts +2 -0
  52. package/dist/{date2-CVZy20Q_.js → date2-CGBF6K5g.js} +1 -1
  53. package/dist/{dayjs.min-NrRtjg32.js → dayjs.min-CcXVb3N8.js} +26 -26
  54. package/dist/{decimal-Du3Grkk9.js → decimal-o3WVGEo3.js} +2 -2
  55. package/dist/{defineDeepModel-DgRoiQBp.js → defineDeepModel-DHrbJI5Q.js} +1 -1
  56. package/dist/{duplicate-template-DvnZ4BW6.js → duplicate-template-BpR6oQr0.js} +1 -1
  57. package/dist/{feature-CTA18HlL.js → feature-D8BhYTHO.js} +6178 -8906
  58. package/dist/{format-time-from-id-6kt1RMWs.js → format-time-from-id-0_5FFMRS.js} +1 -1
  59. package/dist/{format-unit-display-mVJ-nuJe.js → format-unit-display-Cgf9ziiC.js} +11 -11
  60. package/dist/{import-export.helper-DWwlJy7N.js → import-export.helper-zE76m0Lr.js} +5 -5
  61. package/dist/{index-BEcj1jGd.js → index-2ApGEdTo.js} +3 -3
  62. package/dist/{index-BfcdagSF.js → index-B23iGYnZ.js} +1 -1
  63. package/dist/{index-By-jyWOP.js → index-CbyU93I-.js} +1 -1
  64. package/dist/{lodash-D0COOw3m.js → lodash-6pJVv_NM.js} +1 -1
  65. package/dist/netsuite-CPg7U65w.js +5131 -0
  66. package/dist/{purchase-order-template-CJCmABzP.js → purchase-order-template-Dx0eXO5h.js} +1 -1
  67. package/dist/router/name.d.ts +0 -1
  68. package/dist/{rules-hQBVd1Mn.js → rules-BDCrcRdu.js} +9 -9
  69. package/dist/{stock-B6QW-S14.js → stock-0PfUUvpN.js} +1 -1
  70. package/dist/{stock-4xGaezEy.js → stock-DBheIzMc.js} +3 -3
  71. package/dist/stores/feature.d.ts +2 -4
  72. package/dist/stores/integration/netsuite.d.ts +0 -5
  73. package/dist/style.css +1 -1
  74. package/dist/{supplier-C-dmFnqw.js → supplier-BJv4rrs8.js} +2 -2
  75. package/dist/tsconfig.app.tsbuildinfo +1 -1
  76. package/dist/{use-ingredient-select-dialog-DgYSZDN8.js → use-ingredient-select-dialog-CubGF9kW.js} +2 -2
  77. package/dist/{use-inventory-binding-dialog-CnYcA_Fo.js → use-inventory-binding-dialog-GiYf-Jn5.js} +2 -2
  78. package/dist/{use-template-enabled-locations-2-B_aZrMUU.js → use-template-enabled-locations-2-1-PoWVif.js} +2 -2
  79. package/dist/views/adjustment-template/wastage-template/actions.d.ts +4 -1
  80. package/dist/views/ingredients/helper/calculate-default-cost.d.ts +9 -0
  81. package/dist/views/receive-request/components/transfer-form/TransferForm2.vue.d.ts +22 -0
  82. package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +0 -714
  83. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +1 -8
  84. package/dist/views/stock/components/StockRecordCard.vue.d.ts +1 -1
  85. package/dist/{vue-i18n-BCEDBY4T.js → vue-i18n-Cb65g8p9.js} +524 -524
  86. package/dist/{xlsx-CJsXiiEq.js → xlsx-C7pOdYp2.js} +398 -398
  87. package/dist/{xlsx.util-CSudzOii.js → xlsx.util-Boe3rV7g.js} +1 -1
  88. package/package.json +5 -5
  89. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CI4z5XYQ.js +0 -188
  90. package/dist/FmMultiselectDialog-BviFuAM5.js +0 -618
  91. package/dist/ReceiveRequestView-BAYczSpW.js +0 -2913
  92. package/dist/SurchargeView-CxW2ZZ8a.js +0 -460
  93. package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js +0 -84
  94. package/dist/TemplatePublishDialog.vue_vue_type_script_setup_true_lang-ByPIjcED.js +0 -155
  95. package/dist/WastageTemplateView-C5qCXWqZ.js +0 -2328
  96. package/dist/api/surcharge.d.ts +0 -31
  97. package/dist/app-DiX-EfV6.js +0 -8167
  98. package/dist/closing-template-DxdLqlb1.js +0 -117
  99. package/dist/component-DpCUABT3.js +0 -82
  100. package/dist/netsuite-3LgQ5ztL.js +0 -5402
  101. package/dist/stores/surcharge.d.ts +0 -18
  102. package/dist/surcharge-Db4IiSEQ.js +0 -71
  103. package/dist/views/surcharge/SurchargeView.vue.d.ts +0 -2
@@ -1,57 +1,69 @@
1
- import { ref as R, h as P, defineComponent as K, resolveComponent as E, openBlock as $, createElementBlock as D, createElementVNode as _, normalizeClass as q, createTextVNode as ae, toDisplayString as I, unref as u, createCommentVNode as O, createVNode as C, withCtx as V, Fragment as j, renderList as Z, computed as L, watch as Pe, createSlots as Ee, createBlock as N, isRef as Ye, normalizeStyle as Ge, Teleport as Ke, normalizeProps as We, guardReactiveProps as qe, mergeProps as Je } from "vue";
1
+ import { ref as R, h as P, defineComponent as K, resolveComponent as E, openBlock as $, createElementBlock as D, createElementVNode as _, normalizeClass as q, createTextVNode as ae, toDisplayString as I, unref as d, createCommentVNode as O, createVNode as C, withCtx as V, Fragment as j, renderList as Z, computed as L, watch as Pe, createSlots as Ee, createBlock as N, isRef as Ye, normalizeStyle as Ge, Teleport as Ke, normalizeProps as We, guardReactiveProps as qe, mergeProps as Je } from "vue";
2
2
  import { u as Xe, _ as Qe } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
3
3
  import { useI18n as W, useCoreStore as de } from "@feedmepos/mf-common";
4
4
  import { useDialog as pe, useDialogChild as Ze, useSnackbar as ce, FmButtonVariant as oe, components as Y, FmAdvancedSort as et, useProxiedModel as tt, useBreakpoints as nt } from "@feedmepos/ui-library";
5
5
  import { defineStore as Ve, storeToRefs as Ue } from "pinia";
6
6
  import { F as G } from "./form-mode.enum-BKiNVH6A.js";
7
- import { a as me } from "./closing-template-DxdLqlb1.js";
8
- import { u as fe, c as Ne, a as ve, n as ot } from "./app-CddcvygU.js";
9
- import { t as re, a as ge, d as ye, s as Le, r as st } from "./xlsx.util-CSudzOii.js";
7
+ import { a as me } from "./closing-template-C_fOjY8b.js";
8
+ import { u as fe, c as Ne, a as ve, n as ot } from "./app-yA2GcbOF.js";
9
+ import { t as re, a as ge, d as ye, s as Le, r as st } from "./xlsx.util-Boe3rV7g.js";
10
10
  import { F as lt } from "./FmDroppableField-J0xUsOTV.js";
11
- import { f as Be, a as le } from "./date2-CVZy20Q_.js";
11
+ import { f as Be, a as le } from "./date2-CGBF6K5g.js";
12
12
  import { D as se, R as z } from "./row-action.enum-BcW_L_nE.js";
13
- import { c as at } from "./component-DpCUABT3.js";
14
- import { f as rt } from "./format-time-from-id-6kt1RMWs.js";
15
- import { _ as it } from "./TemplatePublishDialog.vue_vue_type_script_setup_true_lang-ByPIjcED.js";
16
- import { u as ct } from "./netsuite-3LgQ5ztL.js";
17
- import { u as mt } from "./duplicate-template-DvnZ4BW6.js";
18
- import { _ as ut } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-kVpsL4cx.js";
19
- import { R as dt, A as pt } from "./rules-hQBVd1Mn.js";
20
- import { u as ft } from "./use-ingredient-select-dialog-DgYSZDN8.js";
21
- import { d as vt } from "./defineDeepModel-DgRoiQBp.js";
22
- import { F as X, _ as ze } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
23
- import { u as gt } from "./use-template-enabled-locations-2-B_aZrMUU.js";
24
- import { _ as yt } from "./SystemTrailDialog.vue_vue_type_script_setup_true_lang-_8YeihNH.js";
13
+ import { c as at, F as X, _ as ze } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-cfFHDIwQ.js";
14
+ import { f as rt } from "./format-time-from-id-0_5FFMRS.js";
15
+ import { _ as it } from "./TemplatePublishDialog.vue_vue_type_script_setup_true_lang-C-fJgXX4.js";
16
+ import { u as ct } from "./netsuite-CPg7U65w.js";
17
+ import { u as mt } from "./duplicate-template-BpR6oQr0.js";
18
+ import { _ as ut } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DLdaN3XH.js";
19
+ import { R as dt, A as pt } from "./rules-BDCrcRdu.js";
20
+ import { u as ft } from "./use-ingredient-select-dialog-CubGF9kW.js";
21
+ import { d as vt } from "./defineDeepModel-DHrbJI5Q.js";
22
+ import { u as gt } from "./use-template-enabled-locations-2-1-PoWVif.js";
23
+ import { _ as yt } from "./SystemTrailDialog.vue_vue_type_script_setup_true_lang-CFNAl2zj.js";
25
24
  import { _ as ht } from "./_plugin-vue_export-helper-CHgC5LLL.js";
26
25
  const ue = Ve(
27
26
  "closingTemplateTable",
28
27
  function() {
29
- const { t: r } = W(), l = pe(), d = R({}), t = ie(), n = R({}), f = R(new Array()), b = R(!1), c = fe(), a = me();
30
- function g(s) {
31
- const v = {
32
- title: s.name,
33
- doc: s,
28
+ const { t: r } = W(), a = pe(), u = R({}), t = ie(), n = R({}), p = R(new Array()), b = R(!1), c = fe(), l = me();
29
+ function g(o) {
30
+ const f = {
31
+ title: o.name,
32
+ doc: o,
34
33
  controller: {
35
- publishAll: async (T) => {
36
- const e = T || s.locations, k = await a.publishSingleDoc(
37
- s._id,
34
+ publishAll: async (k) => {
35
+ const e = k || o.locations, T = await l.publishSingleDoc(
36
+ o._id,
38
37
  e == null ? void 0 : e.map((M) => M.dbName)
39
38
  );
40
- return d.value = k.publishedRevByLocation || {}, d.value;
39
+ return u.value = T.publishedRevByLocation || {}, u.value;
41
40
  },
42
- publishAtLocation: async (T) => {
43
- const e = await a.publishSingleDoc(s._id, [T.dbName]);
44
- return d.value = e.publishedRevByLocation || {}, d.value;
41
+ publishAtLocation: async (k) => {
42
+ const e = await l.publishSingleDoc(o._id, [k.dbName]);
43
+ return u.value = e.publishedRevByLocation || {}, u.value;
44
+ },
45
+ unpublishAll: async (k) => {
46
+ const e = k || o.locations, T = await l.unpublishSingleDoc(
47
+ o._id,
48
+ e == null ? void 0 : e.map((M) => M.dbName)
49
+ );
50
+ return u.value = T.publishedRevByLocation || {}, u.value;
51
+ },
52
+ unpublishAtLocation: async (k) => {
53
+ const e = await l.unpublishSingleDoc(o._id, [
54
+ k.dbName
55
+ ]);
56
+ return u.value = e.publishedRevByLocation || {}, u.value;
45
57
  }
46
58
  },
47
- initialPublishedRev: d.value,
59
+ initialPublishedRev: u.value,
48
60
  locations: c.locations,
49
- enabledLocations: s.locations
61
+ enabledLocations: o.locations
50
62
  };
51
- l.open({
63
+ a.open({
52
64
  title: "Publish template",
53
65
  contentComponent: it,
54
- contentComponentProps: v,
66
+ contentComponentProps: f,
55
67
  closeButton: !0,
56
68
  primaryActions: {
57
69
  text: r("common.close"),
@@ -61,50 +73,50 @@ const ue = Ve(
61
73
  });
62
74
  }
63
75
  async function i() {
64
- if (f.value = [], !!c._currentLocation) {
76
+ if (p.value = [], !!c._currentLocation) {
65
77
  b.value = !0;
66
78
  try {
67
- const [s, v, T] = await Promise.all([
68
- a.readTemplates(),
69
- a.getRecentPublishingJob(),
70
- a.getRecentPublishInfo()
79
+ const [o, f, k] = await Promise.all([
80
+ l.readTemplates(),
81
+ l.getRecentPublishingJob(),
82
+ l.getRecentPublishInfo()
71
83
  ]).delayed(1e3);
72
- f.value = s, n.value = v, d.value = T.publishedRevByLocation || {};
73
- } catch (s) {
74
- console.log("Something went wrong when fetching templates:", s);
84
+ p.value = o, n.value = f, u.value = k.publishedRevByLocation || {};
85
+ } catch (o) {
86
+ console.log("Something went wrong when fetching templates:", o);
75
87
  } finally {
76
88
  b.value = !1;
77
89
  }
78
90
  }
79
91
  }
80
- async function h(s) {
81
- if (!f.value.find((v) => v._id) && c._currentLocation) {
92
+ async function h(o) {
93
+ if (!p.value.find((f) => f._id) && c._currentLocation) {
82
94
  b.value = !0;
83
95
  try {
84
- const [v] = await Promise.all([
85
- a.getTemplate(s),
86
- new Promise((T) => setTimeout(T, 1e3))
96
+ const [f] = await Promise.all([
97
+ l.getTemplate(o),
98
+ new Promise((k) => setTimeout(k, 1e3))
87
99
  ]);
88
- f.value = [v];
89
- } catch (v) {
90
- console.log("Something went wrong when fetching templates:", v);
100
+ p.value = [f];
101
+ } catch (f) {
102
+ console.log("Something went wrong when fetching templates:", f);
91
103
  } finally {
92
104
  b.value = !1;
93
105
  }
94
106
  }
95
107
  }
96
- function w(s, v) {
97
- switch (v = Ne(v), s) {
108
+ function w(o, f) {
109
+ switch (f = Ne(f), o) {
98
110
  case z.Details:
99
- return t.viewTemplate(v);
111
+ return t.viewTemplate(f);
100
112
  case z.Edit:
101
- return t.updateTemplate(v);
113
+ return t.updateTemplate(f);
102
114
  case z.Delete:
103
- return t.deleteTemplate(v, b, i);
115
+ return t.deleteTemplate(f, b, i);
104
116
  case z.Publish:
105
- return g(v);
117
+ return g(f);
106
118
  case z.Duplicate:
107
- return t.duplicateTemplate(v, b, i);
119
+ return t.duplicateTemplate(f, b, i);
108
120
  }
109
121
  }
110
122
  return {
@@ -113,8 +125,8 @@ const ue = Ve(
113
125
  id: "_id",
114
126
  accessorKey: "_id",
115
127
  header: () => r("inventory.closing.table.createdAt"),
116
- cell(s) {
117
- return rt(`${s.getValue()}`);
128
+ cell(o) {
129
+ return rt(`${o.getValue()}`);
118
130
  },
119
131
  enableSorting: !0
120
132
  },
@@ -139,10 +151,10 @@ const ue = Ve(
139
151
  id: "enabledLocations",
140
152
  accessorKey: "locations.length",
141
153
  header: () => r("inventory.closing.table.enabledOutlets"),
142
- cell(s) {
143
- var T;
144
- const v = (T = s.row.original.locations) == null ? void 0 : T.length;
145
- return v ? `${v}` : "All";
154
+ cell(o) {
155
+ var k;
156
+ const f = (k = o.row.original.locations) == null ? void 0 : k.length;
157
+ return f ? `${f}` : "All";
146
158
  },
147
159
  enableSorting: !1,
148
160
  meta: {
@@ -161,8 +173,8 @@ const ue = Ve(
161
173
  id: "status",
162
174
  header: () => r("inventory.adjustment.template.table.status"),
163
175
  enableSorting: !1,
164
- cell(s) {
165
- const v = s.row.original, T = v._rev, e = s.row.original.locations || c.locations, M = e.filter((p) => !!(d.value[p.dbName] || []).find((x) => x._id === v._id && x._rev === T)).length === e.length;
176
+ cell(o) {
177
+ const f = o.row.original, k = f._rev, e = o.row.original.locations || c.locations, M = e.filter((v) => !!(u.value[v.dbName] || []).find((x) => x._id === f._id && x._rev === k)).length === e.length;
166
178
  return P(
167
179
  "div",
168
180
  {
@@ -183,14 +195,14 @@ const ue = Ve(
183
195
  },
184
196
  {
185
197
  id: "action",
186
- cell(s) {
187
- const v = s.row.original, T = [
198
+ cell(o) {
199
+ const f = o.row.original, k = [
188
200
  se[z.Edit],
189
201
  se[z.Duplicate],
190
202
  se[z.Delete],
191
203
  se[z.Publish]
192
204
  ];
193
- return at(T, (e) => w(e, v));
205
+ return at(k, (e) => w(e, f));
194
206
  },
195
207
  enableSorting: !1,
196
208
  size: 40,
@@ -201,7 +213,7 @@ const ue = Ve(
201
213
  }
202
214
  ],
203
215
  recentPublish: n,
204
- templates: f,
216
+ templates: p,
205
217
  loading: b,
206
218
  fetchTemplates: i,
207
219
  loadTemplate: h
@@ -210,17 +222,17 @@ const ue = Ve(
210
222
  );
211
223
  var he = /* @__PURE__ */ ((m) => (m.Ingredients = "Ingredients", m))(he || {});
212
224
  function He(m) {
213
- const r = m.sku, l = new Set(m.disabledMeasurements);
225
+ const r = m.sku, a = new Set(m.disabledMeasurements);
214
226
  return [
215
227
  {
216
228
  code: r.code,
217
229
  name: r.name,
218
230
  unit: r.unit.abbrev,
219
- enabled: !l.has(r.unit._id)
231
+ enabled: !a.has(r.unit._id)
220
232
  },
221
233
  ...r.unit.measurements.map((n) => ({
222
234
  unit: n.abbrev,
223
- enabled: !l.has(n.id)
235
+ enabled: !a.has(n.id)
224
236
  }))
225
237
  ];
226
238
  }
@@ -246,45 +258,45 @@ function Oe() {
246
258
  }
247
259
  function bt(m) {
248
260
  var b;
249
- const l = de().currentBusiness.value, t = (b = m.map((c) => {
261
+ const a = de().currentBusiness.value, t = (b = m.map((c) => {
250
262
  var y;
251
- const a = c.items.flatMap(He), g = Oe(), i = [
263
+ const l = c.items.flatMap(He), g = Oe(), i = [
252
264
  ["Template ID", c._id],
253
265
  ["Template name", c.name],
254
- ["Business name", l == null ? void 0 : l.name],
255
- ["Business ID", l == null ? void 0 : l._id],
256
- ["Menu version", l == null ? void 0 : l.menuVersion],
266
+ ["Business name", a == null ? void 0 : a.name],
267
+ ["Business ID", a == null ? void 0 : a._id],
268
+ ["Menu version", a == null ? void 0 : a.menuVersion],
257
269
  [
258
270
  "Locations",
259
- ...(y = c.locations) != null && y.length ? c.locations.map((s) => `${s.name} (${s.dbName})`) : ["All"]
271
+ ...(y = c.locations) != null && y.length ? c.locations.map((o) => `${o.name} (${o.dbName})`) : ["All"]
260
272
  ],
261
273
  ["Reference", c.ref ?? ""],
262
274
  [],
263
- g.map((s) => s.name),
264
- ...a.map((s) => g.map((v) => s[v.id]))
265
- ], h = g.map((s) => `system:${s.id}`), w = re(i, h);
275
+ g.map((o) => o.name),
276
+ ...l.map((o) => g.map((f) => o[f.id]))
277
+ ], h = g.map((o) => `system:${o.id}`), w = re(i, h);
266
278
  return { name: c.name, sheet: w };
267
279
  }).reduce(
268
- (c, a) => {
280
+ (c, l) => {
269
281
  var i;
270
- const g = a.name.slice(0, 12);
271
- return (i = c.sheetOccurence)[g] ?? (i[g] = 0), c.sheetOccurence[g] += 1, c.sheets[`${g} (${c.sheetOccurence[g]})`] = a.sheet, c;
282
+ const g = l.name.slice(0, 12);
283
+ return (i = c.sheetOccurence)[g] ?? (i[g] = 0), c.sheetOccurence[g] += 1, c.sheets[`${g} (${c.sheetOccurence[g]})`] = l.sheet, c;
272
284
  },
273
285
  {
274
286
  sheets: {},
275
287
  sheetOccurence: {}
276
288
  }
277
- )) == null ? void 0 : b.sheets, n = `${l == null ? void 0 : l.name} closing templates (${Be(/* @__PURE__ */ new Date())}).xlsx`, f = ge(t);
278
- return ye(f, n), n;
289
+ )) == null ? void 0 : b.sheets, n = `${a == null ? void 0 : a.name} closing templates (${Be(/* @__PURE__ */ new Date())}).xlsx`, p = ge(t);
290
+ return ye(p, n), n;
279
291
  }
280
292
  function _t(m) {
281
293
  de().currentBusiness.value;
282
- const l = 3, d = (i) => {
294
+ const a = 3, u = (i) => {
283
295
  const h = [], w = i.sku, y = new Set(i.disabledMeasurements || []);
284
296
  y.has(w.unit._id) || h.push(w.unit.abbrev);
285
- for (const s of w.unit.measurements) {
286
- if (h.length >= l) break;
287
- y.has(s.id) || h.push(s.abbrev);
297
+ for (const o of w.unit.measurements) {
298
+ if (h.length >= a) break;
299
+ y.has(o.id) || h.push(o.abbrev);
288
300
  }
289
301
  return h;
290
302
  }, t = ["#", "Code", "Name", "UOM"], n = [
@@ -293,44 +305,44 @@ function _t(m) {
293
305
  [],
294
306
  t,
295
307
  ...m.items.map((i, h) => {
296
- const w = d(i);
308
+ const w = u(i);
297
309
  return [
298
310
  h + 1,
299
311
  // Index starting from 1
300
312
  i.sku.code,
301
313
  i.sku.name,
302
314
  // Add UOM columns (up to MAX_UOM_COLUMNS)
303
- ...Array(l).fill("").map(
304
- (y, s) => w[s] ? `_____ ${w[s]}` : ""
315
+ ...Array(a).fill("").map(
316
+ (y, o) => w[o] ? `_____ ${w[o]}` : ""
305
317
  )
306
318
  ];
307
319
  })
308
- ], f = re(n, t);
309
- if (f["!ref"]) {
320
+ ], p = re(n, t);
321
+ if (p["!ref"]) {
310
322
  const i = {
311
323
  top: { style: "thin", color: { rgb: "000000" } },
312
324
  bottom: { style: "thin", color: { rgb: "000000" } },
313
325
  left: { style: "thin", color: { rgb: "000000" } },
314
326
  right: { style: "thin", color: { rgb: "000000" } }
315
- }, h = 4, w = h + m.items.length, y = t.map((s, v) => String.fromCharCode(65 + v));
316
- for (let s = h; s <= w; s++)
317
- y.forEach((v) => {
318
- const T = `${v}${s}`;
319
- f[T] || (f[T] = { t: "s", v: "" }), f[T].s = {
327
+ }, h = 4, w = h + m.items.length, y = t.map((o, f) => String.fromCharCode(65 + f));
328
+ for (let o = h; o <= w; o++)
329
+ y.forEach((f) => {
330
+ const k = `${f}${o}`;
331
+ p[k] || (p[k] = { t: "s", v: "" }), p[k].s = {
320
332
  border: i
321
333
  };
322
334
  });
323
335
  }
324
- f["!cols"] = [
336
+ p["!cols"] = [
325
337
  { wch: 5 },
326
338
  // Index column - narrow
327
339
  { wch: 15 },
328
340
  // Code column
329
341
  { wch: 30 },
330
342
  // Name column - adjusted for more columns
331
- ...Array.from({ length: l }, () => ({ wch: 15 }))
343
+ ...Array.from({ length: a }, () => ({ wch: 15 }))
332
344
  // UOM columns
333
- ], f["!margins"] = {
345
+ ], p["!margins"] = {
334
346
  left: 0.7,
335
347
  right: 0.7,
336
348
  top: 0.75,
@@ -338,11 +350,11 @@ function _t(m) {
338
350
  header: 0.3,
339
351
  footer: 0.3
340
352
  };
341
- const c = m.name.slice(0, 31), a = ge({ [c]: f }), g = `${m.name} - Closing Template (${Be(/* @__PURE__ */ new Date())}).xlsx`;
342
- return ye(a, g), g;
353
+ const c = m.name.slice(0, 31), l = ge({ [c]: p }), g = `${m.name} - Closing Template (${Be(/* @__PURE__ */ new Date())}).xlsx`;
354
+ return ye(l, g), g;
343
355
  }
344
356
  function xt() {
345
- const m = de(), r = ve(), l = ct(), d = He({
357
+ const m = de(), r = ve(), a = ct(), u = He({
346
358
  sku: {
347
359
  unit: {
348
360
  _id: "",
@@ -355,7 +367,7 @@ function xt() {
355
367
  _id: "",
356
368
  name: "Sugar"
357
369
  }
358
- })[0], t = m.currentBusiness.value, n = Oe(), f = [
370
+ })[0], t = m.currentBusiness.value, n = Oe(), p = [
359
371
  ["Template ID (leave empty to create new)", ""],
360
372
  ["Template Name", "New template"],
361
373
  ["Business name", t == null ? void 0 : t.name],
@@ -369,24 +381,24 @@ function xt() {
369
381
  ["Reference:"],
370
382
  [],
371
383
  n.map((y) => y.name),
372
- n.map((y) => d[y.id])
373
- ], b = n.map((y) => `system:${y.id}`), c = re(f, b), a = l.isEnabled ? l.state.setting.childItems ?? [] : [], g = a.reduce(
374
- (y, s) => {
375
- var M, p;
376
- const v = (M = l.netSuiteItemIdToSkuId.get(s.parentNetSuiteId)) == null ? void 0 : M[0], T = (p = l.netSuiteMeasurementIdToMeasurementId.get(
377
- s.unitOfMeasureId
378
- )) == null ? void 0 : p[0];
379
- if (!s.externalId)
384
+ n.map((y) => u[y.id])
385
+ ], b = n.map((y) => `system:${y.id}`), c = re(p, b), l = a.isEnabled ? a.state.setting.childItems ?? [] : [], g = l.reduce(
386
+ (y, o) => {
387
+ var M, v;
388
+ const f = (M = a.netSuiteItemIdToSkuId.get(o.parentNetSuiteId)) == null ? void 0 : M[0], k = (v = a.netSuiteMeasurementIdToMeasurementId.get(
389
+ o.unitOfMeasureId
390
+ )) == null ? void 0 : v[0];
391
+ if (!o.externalId)
380
392
  return y;
381
- if (!v)
382
- return console.error(`Item ${s.externalId} cannot be mapped to parent FdoInventorySku.`, s), y;
383
- const e = r.skuById[v], k = e.unit.measurements.find((o) => o.id === T);
384
- return k ? (y[s.externalId] = {
393
+ if (!f)
394
+ return console.error(`Item ${o.externalId} cannot be mapped to parent FdoInventorySku.`, o), y;
395
+ const e = r.skuById[f], T = e.unit.measurements.find((s) => s.id === k);
396
+ return T ? (y[o.externalId] = {
385
397
  sku: e,
386
- measurement: k
398
+ measurement: T
387
399
  }, y) : (console.error(
388
- `Item ${s.externalId} found parent FdoInventorySku of ${e.code} ${e.name} but the measurement of netsuite id ${s.unitOfMeasureId} cannot be found.`,
389
- s
400
+ `Item ${o.externalId} found parent FdoInventorySku of ${e.code} ${e.name} but the measurement of netsuite id ${o.unitOfMeasureId} cannot be found.`,
401
+ o
390
402
  ), y);
391
403
  },
392
404
  {}
@@ -394,18 +406,18 @@ function xt() {
394
406
  [
395
407
  ...r.skus.flatMap((y) => [
396
408
  [y.code, y.name, y.unit.abbrev, !0],
397
- ...y.unit.measurements.map((v) => [
409
+ ...y.unit.measurements.map((f) => [
398
410
  "",
399
411
  "",
400
- v.abbrev,
401
- !v.abbrev.toLocaleLowerCase("en-us").includes("inactive")
412
+ f.abbrev,
413
+ !f.abbrev.toLocaleLowerCase("en-us").includes("inactive")
402
414
  ])
403
415
  ]),
404
- ...Object.entries(g).map(([y, { sku: s, measurement: v }]) => [
405
- s.code,
406
- s.name,
407
- v.abbrev,
408
- !v.abbrev.toLocaleLowerCase("en-us").includes("inactive"),
416
+ ...Object.entries(g).map(([y, { sku: o, measurement: f }]) => [
417
+ o.code,
418
+ o.name,
419
+ f.abbrev,
420
+ !f.abbrev.toLocaleLowerCase("en-us").includes("inactive"),
409
421
  y
410
422
  ])
411
423
  ],
@@ -414,7 +426,7 @@ function xt() {
414
426
  "Name",
415
427
  "Units",
416
428
  "Enabled (true/false)",
417
- ...a.length ? ["Netsuite Parent"] : []
429
+ ...l.length ? ["Netsuite Parent"] : []
418
430
  ]
419
431
  ), h = ge({
420
432
  Template: c,
@@ -425,20 +437,20 @@ function xt() {
425
437
  function wt(m) {
426
438
  if (!m.length || `${m[0]}`.toLocaleLowerCase() === "all")
427
439
  return [];
428
- const r = /(.*) \(((warehouse_|restaurant_).{24,})\)/, d = fe().locationByDbName;
440
+ const r = /(.*) \(((warehouse_|restaurant_).{24,})\)/, u = fe().locationByDbName;
429
441
  return m.map((t) => {
430
- const n = new Array(), f = t.trim(), b = r.exec(f);
442
+ const n = new Array(), p = t.trim(), b = r.exec(p);
431
443
  if (!b)
432
- return n.push(`Enabled location value of ${f} cannot be read.`), {
444
+ return n.push(`Enabled location value of ${p} cannot be read.`), {
433
445
  errors: n
434
446
  };
435
- const c = b[1], a = b[2], g = d[a];
447
+ const c = b[1], l = b[2], g = u[l];
436
448
  return g ? (c !== g.name && n.push(
437
- `Location id ${a} has non-matching name. Found ${c} but expected ${g.name}`
449
+ `Location id ${l} has non-matching name. Found ${c} but expected ${g.name}`
438
450
  ), {
439
451
  errors: n,
440
452
  location: g
441
- }) : (n.push(`Location (${c}) of id ${a} is not found.`), {
453
+ }) : (n.push(`Location (${c}) of id ${l} is not found.`), {
442
454
  errors: n
443
455
  });
444
456
  });
@@ -446,94 +458,94 @@ function wt(m) {
446
458
  function kt(m) {
447
459
  const [
448
460
  r,
449
- l,
450
- d,
461
+ a,
462
+ u,
451
463
  t,
452
464
  n,
453
- f,
465
+ p,
454
466
  b,
455
467
  c
456
468
  ] = Le(m);
457
469
  return {
458
- id: `${l[1] ?? ""}`.trim(),
459
- name: `${d[1] ?? ""}`.trim(),
460
- locations: b.slice(1).map((a) => `${a}`.trim()).filter((a) => a),
470
+ id: `${a[1] ?? ""}`.trim(),
471
+ name: `${u[1] ?? ""}`.trim(),
472
+ locations: b.slice(1).map((l) => `${l}`.trim()).filter((l) => l),
461
473
  reference: `${c[1] ?? ""}`.trim()
462
474
  };
463
475
  }
464
476
  function Tt(m) {
465
477
  const [
466
478
  r,
467
- l,
468
- d,
479
+ a,
480
+ u,
469
481
  t,
470
482
  n,
471
- f,
483
+ p,
472
484
  b,
473
485
  c,
474
- a,
486
+ l,
475
487
  g,
476
488
  ...i
477
489
  ] = Le(m);
478
- if (!r || !r.length || r.some((v) => v.length && !v.startsWith("system:")))
490
+ if (!r || !r.length || r.some((f) => f.length && !f.startsWith("system:")))
479
491
  throw new Error("Missing meta header. Excel file does not come from the template.");
480
- const h = r.map((v) => v.split(":")[1]), y = ["code", "name", "unit", "enabled"].filter((v) => !h.includes(v));
492
+ const h = r.map((f) => f.split(":")[1]), y = ["code", "name", "unit", "enabled"].filter((f) => !h.includes(f));
481
493
  if (y.length)
482
494
  throw new Error(
483
495
  `Missing meta headers (${y.join()}). Excel file does not come from the template.`
484
496
  );
485
- return i.map((v, T) => {
497
+ return i.map((f, k) => {
486
498
  const e = {};
487
- for (const k in h) {
488
- const M = h[k];
489
- Object.assign(e, { [M]: v[k] });
499
+ for (const T in h) {
500
+ const M = h[T];
501
+ Object.assign(e, { [M]: f[T] });
490
502
  }
491
503
  return {
492
- index: T,
504
+ index: k,
493
505
  data: e
494
506
  };
495
507
  });
496
508
  }
497
509
  function $t(m) {
498
510
  return m.reduce(
499
- (r, l) => {
511
+ (r, a) => {
500
512
  var n;
501
- const d = l.data, t = l.index;
502
- return d.unit && (d.code ? r.result.push({ parent: l, children: [] }) : r.result.length ? (n = r.result.at(-1)) == null || n.children.push(l) : r.errors.push(`Cannot find parent for row ${t + 9}`)), r;
513
+ const u = a.data, t = a.index;
514
+ return u.unit && (u.code ? r.result.push({ parent: a, children: [] }) : r.result.length ? (n = r.result.at(-1)) == null || n.children.push(a) : r.errors.push(`Cannot find parent for row ${t + 9}`)), r;
503
515
  },
504
516
  { result: new Array(), errors: new Array() }
505
517
  );
506
518
  }
507
519
  function Ct(m) {
508
- const r = m.parent.data, l = new Array(), t = ve().skuByCode[r.code ?? ""];
520
+ const r = m.parent.data, a = new Array(), t = ve().skuByCode[r.code ?? ""];
509
521
  if (!t)
510
- return l.push(`Cannot find ingredient of code ${r.code} ${r.name}`), { errors: l };
522
+ return a.push(`Cannot find ingredient of code ${r.code} ${r.name}`), { errors: a };
511
523
  const n = {
512
524
  sku: t
513
- }, f = /* @__PURE__ */ new Set([t.unit._id, ...t.unit.measurements.map((c) => c.id)]), b = t.unit.measurements.find((c) => c.abbrev === r.unit);
514
- r.unit !== t.unit.abbrev && !b ? l.push(
525
+ }, p = /* @__PURE__ */ new Set([t.unit._id, ...t.unit.measurements.map((c) => c.id)]), b = t.unit.measurements.find((c) => c.abbrev === r.unit);
526
+ r.unit !== t.unit.abbrev && !b ? a.push(
515
527
  `Cannot find measurement unit of ${r.unit} for (${r.code}) ${r.name}.`
516
- ) : (r.enabled === !0 || `${r.enabled}`.toLocaleLowerCase() === "true") && f.delete(t.unit._id);
528
+ ) : (r.enabled === !0 || `${r.enabled}`.toLocaleLowerCase() === "true") && p.delete(t.unit._id);
517
529
  for (const c of m.children) {
518
- const a = c.data, g = a.unit === t.unit.abbrev ? t.unit : void 0, i = t.unit.measurements.find((h) => h.abbrev === a.unit);
530
+ const l = c.data, g = l.unit === t.unit.abbrev ? t.unit : void 0, i = t.unit.measurements.find((h) => h.abbrev === l.unit);
519
531
  if (!i && !g) {
520
- l.push(
521
- `Cannot find measurement unit of ${a.unit} for (${r.code}) ${r.name}.`
532
+ a.push(
533
+ `Cannot find measurement unit of ${l.unit} for (${r.code}) ${r.name}.`
522
534
  );
523
535
  continue;
524
536
  }
525
- (a.enabled === !0 || `${a.enabled}`.toLocaleLowerCase() === "true") && f.delete((i == null ? void 0 : i.id) ?? (g == null ? void 0 : g._id) ?? "");
537
+ (l.enabled === !0 || `${l.enabled}`.toLocaleLowerCase() === "true") && p.delete((i == null ? void 0 : i.id) ?? (g == null ? void 0 : g._id) ?? "");
526
538
  }
527
- return f.has(t.unit._id) && n.sku.unit.measurements.every((c) => f.has(c.id)) && l.push(`Ingredient ${t.code} - ${t.name} must have at least one unit enabled.`), n.disabledMeasurements = [...f], { errors: l, templateItem: n };
539
+ return p.has(t.unit._id) && n.sku.unit.measurements.every((c) => p.has(c.id)) && a.push(`Ingredient ${t.code} - ${t.name} must have at least one unit enabled.`), n.disabledMeasurements = [...p], { errors: a, templateItem: n };
528
540
  }
529
541
  function It(m) {
530
542
  const r = m.SheetNames.filter(
531
543
  (n) => !Object.values(he).map(String).includes(n)
532
- ), d = ue().templates, t = ot(d, "_id");
544
+ ), u = ue().templates, t = ot(u, "_id");
533
545
  try {
534
546
  return r.reduce(
535
- (n, f) => {
536
- const b = new Array(), c = m.Sheets[f], a = kt(c), g = wt(a.locations), i = g.filter((e) => e.location).map((e) => e.location);
547
+ (n, p) => {
548
+ const b = new Array(), c = m.Sheets[p], l = kt(c), g = wt(l.locations), i = g.filter((e) => e.location).map((e) => e.location);
537
549
  b.push(...g.flatMap((e) => e.errors));
538
550
  const h = Tt(c).filter(
539
551
  (e) => e.data.code || e.data.unit
@@ -543,51 +555,51 @@ function It(m) {
543
555
  (e) => Ct(e)
544
556
  );
545
557
  b.push(...y.flatMap((e) => e.errors));
546
- const s = y.filter((e) => e.templateItem).map((e) => e.templateItem);
547
- if (a.id) {
548
- const e = t[a.id];
558
+ const o = y.filter((e) => e.templateItem).map((e) => e.templateItem);
559
+ if (l.id) {
560
+ const e = t[l.id];
549
561
  if (!e) {
550
562
  const M = {
551
- _id: a.id,
563
+ _id: l.id,
552
564
  _rev: "",
553
- name: a.name || `(unnamed from sheet ${f || "<unnamed sheet>"})`,
565
+ name: l.name || `(unnamed from sheet ${p || "<unnamed sheet>"})`,
554
566
  items: []
555
567
  };
556
- return b.push(`Template ID ${a.id} is not found.`), n.importUpdateResult.push({
568
+ return b.push(`Template ID ${l.id} is not found.`), n.importUpdateResult.push({
557
569
  type: "update",
558
570
  original: M,
559
571
  template: M,
560
- excelSheetName: f,
572
+ excelSheetName: p,
561
573
  errors: b
562
574
  }), n;
563
575
  }
564
- const k = {
576
+ const T = {
565
577
  type: "update",
566
578
  original: e,
567
579
  template: {
568
580
  ...e,
569
- name: a.name,
581
+ name: l.name,
570
582
  locations: i.length ? i : null,
571
- ref: a.reference,
572
- items: s
583
+ ref: l.reference,
584
+ items: o
573
585
  },
574
- excelSheetName: f,
586
+ excelSheetName: p,
575
587
  errors: b
576
588
  };
577
- return n.importUpdateResult.push(k), n;
589
+ return n.importUpdateResult.push(T), n;
578
590
  }
579
- const T = {
591
+ const k = {
580
592
  type: "create",
581
593
  template: {
582
- name: a.name,
594
+ name: l.name,
583
595
  locations: i.length ? i : null,
584
- ref: a.reference,
585
- items: s
596
+ ref: l.reference,
597
+ items: o
586
598
  },
587
- excelSheetName: f,
599
+ excelSheetName: p,
588
600
  errors: b
589
601
  };
590
- return n.importCreateResult.push(T), n;
602
+ return n.importCreateResult.push(k), n;
591
603
  },
592
604
  {
593
605
  invalidExcel: !1,
@@ -618,26 +630,26 @@ const St = { class: "flex items-center gap-12 pl-8" }, Dt = { class: "flex flex-
618
630
  },
619
631
  setup(m) {
620
632
  const { t: r } = W();
621
- return (l, d) => {
622
- var f, b, c;
633
+ return (a, u) => {
634
+ var p, b, c;
623
635
  const t = E("FmIcon"), n = E("FmTooltip");
624
636
  return $(), D("div", St, [
625
- d[0] || (d[0] = _("div", null, "•", -1)),
637
+ u[0] || (u[0] = _("div", null, "•", -1)),
626
638
  _("div", Dt, [
627
639
  _("div", Mt, [
628
640
  _("div", {
629
641
  class: q({
630
- "text-fm-color-system-error-300": l.errors.length
642
+ "text-fm-color-system-error-300": a.errors.length
631
643
  })
632
644
  }, [
633
- ae(I(l.name) + " ", 1),
634
- l.type === "create" ? ($(), D("span", Ft, "(" + I(u(r)("inventory.closing.template.import.new")) + ")", 1)) : O("", !0)
645
+ ae(I(a.name) + " ", 1),
646
+ a.type === "create" ? ($(), D("span", Ft, "(" + I(d(r)("inventory.closing.template.import.new")) + ")", 1)) : O("", !0)
635
647
  ], 2),
636
- l.errors.length ? ($(), D("div", Rt, [
648
+ a.errors.length ? ($(), D("div", Rt, [
637
649
  C(n, { "z-index": 50 }, {
638
650
  content: V(() => [
639
651
  _("ol", null, [
640
- ($(!0), D(j, null, Z(l.errors, (a, g) => ($(), D("li", { key: g }, I(a), 1))), 128))
652
+ ($(!0), D(j, null, Z(a.errors, (l, g) => ($(), D("li", { key: g }, I(l), 1))), 128))
641
653
  ])
642
654
  ]),
643
655
  default: V(() => [
@@ -655,11 +667,11 @@ const St = { class: "flex items-center gap-12 pl-8" }, Dt = { class: "flex flex-
655
667
  class: q([
656
668
  "fm-typo-en-body-sm-400",
657
669
  {
658
- "text-fm-color-system-error-200": l.errors.length,
659
- "text-fm-color-typo-secondary": !l.errors.length
670
+ "text-fm-color-system-error-200": a.errors.length,
671
+ "text-fm-color-typo-secondary": !a.errors.length
660
672
  }
661
673
  ])
662
- }, I((f = l.locations) != null && f.length ? u(r)("inventory.closing.template.import.nLocations", { count: (b = l.locations) == null ? void 0 : b.length }) : u(r)("inventory.closing.template.import.allLocations")) + ", " + I(u(r)("inventory.closing.template.import.nItems", { count: (c = l.items) == null ? void 0 : c.length })), 3)
674
+ }, I((p = a.locations) != null && p.length ? d(r)("inventory.closing.template.import.nLocations", { count: (b = a.locations) == null ? void 0 : b.length }) : d(r)("inventory.closing.template.import.allLocations")) + ", " + I(d(r)("inventory.closing.template.import.nItems", { count: (c = a.items) == null ? void 0 : c.length })), 3)
663
675
  ])
664
676
  ]);
665
677
  };
@@ -679,13 +691,13 @@ const St = { class: "flex items-center gap-12 pl-8" }, Dt = { class: "flex flex-
679
691
  }, Ot = { class: "fm-typo-en-body-lg-600" }, jt = /* @__PURE__ */ K({
680
692
  __name: "ClosingTemplateImport",
681
693
  setup(m) {
682
- const r = R(null), l = Ze(), d = ce(), t = R(!1), n = R(!1), f = R(new Array()), b = R([]), c = R([]), a = L(
683
- () => !!f.value.length || b.value.some((w) => w.errors.length) || c.value.some((w) => w.errors.length)
694
+ const r = R(null), a = Ze(), u = ce(), t = R(!1), n = R(!1), p = R(new Array()), b = R([]), c = R([]), l = L(
695
+ () => !!p.value.length || b.value.some((w) => w.errors.length) || c.value.some((w) => w.errors.length)
684
696
  ), g = L(
685
697
  () => !!b.value.length || !!c.value.length
686
698
  ), { t: i } = W();
687
699
  async function h(w) {
688
- f.value = [], b.value = [], c.value = [];
700
+ p.value = [], b.value = [], c.value = [];
689
701
  try {
690
702
  t.value = !0;
691
703
  const [y] = await Promise.all([
@@ -696,29 +708,29 @@ const St = { class: "flex items-center gap-12 pl-8" }, Dt = { class: "flex flex-
696
708
  if (!y.SheetNames.filter(
697
709
  (e) => !Object.values(he).map(String).includes(e)
698
710
  ).find((e) => e)) {
699
- f.value.push(i("inventory.ingredient.import.fileError.noSheet"));
711
+ p.value.push(i("inventory.ingredient.import.fileError.noSheet"));
700
712
  return;
701
713
  }
702
- const T = It(y);
703
- if (T.invalidExcel) {
704
- f.value.push(
705
- T.invalidExcelMessage ?? i("inventory.ingredient.import.fileError.invalidExcel")
714
+ const k = It(y);
715
+ if (k.invalidExcel) {
716
+ p.value.push(
717
+ k.invalidExcelMessage ?? i("inventory.ingredient.import.fileError.invalidExcel")
706
718
  );
707
719
  return;
708
720
  }
709
- if (b.value = T.importCreateResult, c.value = T.importUpdateResult, !b.value.length && !c.value.length) {
710
- f.value.push(i("inventory.ingredient.import.fileError.noData"));
721
+ if (b.value = k.importCreateResult, c.value = k.importUpdateResult, !b.value.length && !c.value.length) {
722
+ p.value.push(i("inventory.ingredient.import.fileError.noData"));
711
723
  return;
712
724
  }
713
- l.emitData(T);
725
+ a.emitData(k);
714
726
  } catch (y) {
715
- d.open({
727
+ u.open({
716
728
  title: i("inventory.ingredient.import.fileError.unableToRead"),
717
729
  message: y == null ? void 0 : y.message,
718
730
  type: "error"
719
731
  }), console.error("Error in reading file", y);
720
732
  } finally {
721
- f.value.length && d.open({
733
+ p.value.length && u.open({
722
734
  title: i("inventory.ingredient.import.fileError.invalidExcel"),
723
735
  type: "error"
724
736
  }), t.value = !1;
@@ -727,17 +739,17 @@ const St = { class: "flex items-center gap-12 pl-8" }, Dt = { class: "flex flex-
727
739
  return Pe(r, (w) => {
728
740
  w && h(w);
729
741
  }), (w, y) => {
730
- const s = E("FmCircularProgress"), v = E("FmIcon"), T = E("FmButton");
742
+ const o = E("FmCircularProgress"), f = E("FmIcon"), k = E("FmButton");
731
743
  return $(), D("div", At, [
732
- _("div", Pt, I(u(i)("inventory.closing.template.import.message")), 1),
744
+ _("div", Pt, I(d(i)("inventory.closing.template.import.message")), 1),
733
745
  n.value ? ($(), D("div", Et, [
734
746
  _("div", null, [
735
- C(s, {
747
+ C(o, {
736
748
  size: "md",
737
749
  color: "neutral-gray-200"
738
750
  })
739
751
  ]),
740
- _("div", Vt, I(u(i)("inventory.formField.loading")), 1)
752
+ _("div", Vt, I(d(i)("inventory.formField.loading")), 1)
741
753
  ])) : ($(), D(j, { key: 1 }, [
742
754
  C(lt, {
743
755
  class: q({
@@ -746,8 +758,8 @@ const St = { class: "flex items-center gap-12 pl-8" }, Dt = { class: "flex flex-
746
758
  }),
747
759
  accept: ".xlsx",
748
760
  onFileUpload: y[0] || (y[0] = (e) => r.value = e),
749
- label: u(i)("inventory.ingredient.import.uploadTemplate"),
750
- "button-label": u(i)("inventory.ingredient.import.selectFile")
761
+ label: d(i)("inventory.ingredient.import.uploadTemplate"),
762
+ "button-label": d(i)("inventory.ingredient.import.selectFile")
751
763
  }, Ee({ _: 2 }, [
752
764
  r.value ? {
753
765
  name: "default",
@@ -758,20 +770,20 @@ const St = { class: "flex items-center gap-12 pl-8" }, Dt = { class: "flex flex-
758
770
  "fm-corner-radius-md p-16 flex items-center gap-16",
759
771
  {
760
772
  "border border-fm-color-neutral-gray-100": t.value,
761
- "border border-fm-color-neutral-gray-200": !t.value && !a.value,
762
- "border border-fm-color-system-error-200": a.value
773
+ "border border-fm-color-neutral-gray-200": !t.value && !l.value,
774
+ "border border-fm-color-system-error-200": l.value
763
775
  }
764
776
  ])
765
777
  }, [
766
- t.value ? ($(), N(s, {
778
+ t.value ? ($(), N(o, {
767
779
  key: 0,
768
780
  size: "md",
769
781
  color: "neutral-gray-200"
770
- })) : ($(), N(v, {
782
+ })) : ($(), N(f, {
771
783
  key: 1,
772
- name: a.value ? "error" : "attach_file",
784
+ name: l.value ? "error" : "attach_file",
773
785
  outline: "",
774
- color: a.value ? "system-error-300" : void 0
786
+ color: l.value ? "system-error-300" : void 0
775
787
  }, null, 8, ["name", "color"])),
776
788
  _("div", {
777
789
  class: q([
@@ -785,25 +797,25 @@ const St = { class: "flex items-center gap-12 pl-8" }, Dt = { class: "flex flex-
785
797
  _("div", Nt, I(r.value.name), 1)
786
798
  ], 2),
787
799
  t.value ? O("", !0) : ($(), D("div", Lt, [
788
- C(T, {
789
- label: u(i)("inventory.ingredient.import.replaceFile"),
790
- variant: a.value ? "destructive" : "secondary",
791
- "prepend-icon": a.value ? void 0 : "autorenew",
800
+ C(k, {
801
+ label: d(i)("inventory.ingredient.import.replaceFile"),
802
+ variant: l.value ? "destructive" : "secondary",
803
+ "prepend-icon": l.value ? void 0 : "autorenew",
792
804
  onClick: e
793
805
  }, null, 8, ["label", "variant", "prepend-icon", "onClick"])
794
806
  ]))
795
807
  ], 2),
796
- f.value.length ? ($(), D("div", Bt, [
797
- ($(!0), D(j, null, Z(f.value, (k, M) => ($(), D("div", {
808
+ p.value.length ? ($(), D("div", Bt, [
809
+ ($(!0), D(j, null, Z(p.value, (T, M) => ($(), D("div", {
798
810
  key: M,
799
811
  class: "flex gap-8 items-center"
800
812
  }, [
801
- C(v, {
813
+ C(f, {
802
814
  name: "error",
803
815
  size: "sm",
804
816
  color: "system-error-300"
805
817
  }),
806
- _("div", zt, I(k), 1)
818
+ _("div", zt, I(T), 1)
807
819
  ]))), 128))
808
820
  ])) : O("", !0)
809
821
  ])
@@ -812,9 +824,9 @@ const St = { class: "flex items-center gap-12 pl-8" }, Dt = { class: "flex flex-
812
824
  } : void 0
813
825
  ]), 1032, ["class", "label", "button-label"]),
814
826
  g.value ? ($(), D("div", Ht, [
815
- _("div", Ot, I(u(i)("inventory.ingredient.import.summary")), 1),
816
- ($(!0), D(j, null, Z(b.value, (e, k) => ($(), N(Ae, {
817
- key: k,
827
+ _("div", Ot, I(d(i)("inventory.ingredient.import.summary")), 1),
828
+ ($(!0), D(j, null, Z(b.value, (e, T) => ($(), N(Ae, {
829
+ key: T,
818
830
  name: e.template.name,
819
831
  locations: e.template.locations,
820
832
  items: e.template.items,
@@ -835,7 +847,7 @@ const St = { class: "flex items-center gap-12 pl-8" }, Dt = { class: "flex flex-
835
847
  };
836
848
  }
837
849
  }), ie = Ve("closingTemplateActions", () => {
838
- const { t: m } = W(), r = pe(), l = ce(), d = me(), t = mt(), n = ue(), { loading: f } = Ue(n), b = R({});
850
+ const { t: m } = W(), r = pe(), a = ce(), u = me(), t = mt(), n = ue(), { loading: p } = Ue(n), b = R({});
839
851
  function c() {
840
852
  b.value = {
841
853
  mode: G.CREATE,
@@ -845,17 +857,17 @@ const St = { class: "flex items-center gap-12 pl-8" }, Dt = { class: "flex flex-
845
857
  }
846
858
  };
847
859
  }
848
- function a(e) {
860
+ function l(e) {
849
861
  b.value = {
850
862
  mode: G.UPDATE,
851
863
  modelValue: e,
852
864
  show: !0,
853
- "onUpdate:show"(k) {
854
- b.value.show = k;
865
+ "onUpdate:show"(T) {
866
+ b.value.show = T;
855
867
  }
856
868
  };
857
869
  }
858
- function g(e, k, M) {
870
+ function g(e, T, M) {
859
871
  r.open({
860
872
  title: `Confirm deleting template ${e.name}?`,
861
873
  message: "Deleted template can no longer be retrieved",
@@ -870,34 +882,34 @@ const St = { class: "flex items-center gap-12 pl-8" }, Dt = { class: "flex flex-
870
882
  close: !0
871
883
  }
872
884
  }).onPrimary(async () => {
873
- l.open({
885
+ a.open({
874
886
  title: `Deleting ${e.name}`,
875
887
  type: "info"
876
888
  });
877
889
  try {
878
- k.value = !0;
879
- const [p] = await Promise.allSettled([
880
- d.deleteTemplate(e),
881
- new Promise((o) => setTimeout(o, 1e3))
890
+ T.value = !0;
891
+ const [v] = await Promise.allSettled([
892
+ u.deleteTemplate(e),
893
+ new Promise((s) => setTimeout(s, 1e3))
882
894
  ]);
883
- if (p.status === "rejected") throw p.reason;
884
- l.open({
885
- title: `Deleted ${e.name}`,
895
+ if (v.status === "rejected") throw v.reason;
896
+ a.open({
897
+ title: `Deleted "${e.name}"`,
886
898
  type: "success"
887
899
  });
888
- } catch (p) {
889
- l.open({
890
- title: `Unable to delete ${e.name}`,
891
- message: `See error from server: ${p}`,
900
+ } catch (v) {
901
+ a.open({
902
+ title: `Unable to delete "${e.name}"`,
903
+ message: v.message,
892
904
  type: "error"
893
- }), console.error("error on deleting closing template", p);
905
+ });
894
906
  } finally {
895
- k.value = !1, M();
907
+ T.value = !1, M();
896
908
  }
897
909
  });
898
910
  }
899
- function i(e, k, M) {
900
- let p;
911
+ function i(e, T, M) {
912
+ let v;
901
913
  r.open({
902
914
  title: `Confirm duplicating template "${e.name}"?`,
903
915
  message: "Duplicated template can be edited after creation",
@@ -914,10 +926,10 @@ const St = { class: "flex items-center gap-12 pl-8" }, Dt = { class: "flex flex-
914
926
  contentComponent: K({
915
927
  props: ["modelValue"],
916
928
  emits: ["update:modelValue"],
917
- setup(o) {
929
+ setup(s) {
918
930
  return () => P(Y.FmTextField, {
919
- modelValue: o.modelValue,
920
- "onUpdate:modelValue": (x) => p = x,
931
+ modelValue: s.modelValue,
932
+ "onUpdate:modelValue": (x) => v = x,
921
933
  label: "New Template Name",
922
934
  size: "md",
923
935
  variant: "primary"
@@ -925,29 +937,29 @@ const St = { class: "flex items-center gap-12 pl-8" }, Dt = { class: "flex flex-
925
937
  }
926
938
  })
927
939
  }).onPrimary(async () => {
928
- l.open({
940
+ a.open({
929
941
  title: `Duplicating "${e.name}"`,
930
942
  type: "info"
931
943
  });
932
944
  try {
933
- k.value = !0;
934
- const [o] = await Promise.allSettled([
935
- t.duplicateClosingTemplate(e._id, p),
945
+ T.value = !0;
946
+ const [s] = await Promise.allSettled([
947
+ t.duplicateClosingTemplate(e._id, v),
936
948
  new Promise((x) => setTimeout(x, 1e3))
937
949
  ]);
938
- if (o.status === "rejected") throw o.reason;
939
- l.open({
950
+ if (s.status === "rejected") throw s.reason;
951
+ a.open({
940
952
  title: `Duplicated "${e.name}"`,
941
953
  type: "success"
942
954
  });
943
- } catch (o) {
944
- l.open({
955
+ } catch (s) {
956
+ a.open({
945
957
  title: `Unable to duplicate "${e.name}"`,
946
- message: `See error from server: ${o}`,
958
+ message: `See error from server: ${s}`,
947
959
  type: "error"
948
- }), console.error("error on duplicating closing template", o);
960
+ }), console.error("error on duplicating closing template", s);
949
961
  } finally {
950
- k.value = !1, M();
962
+ T.value = !1, M();
951
963
  }
952
964
  });
953
965
  }
@@ -956,45 +968,45 @@ const St = { class: "flex items-center gap-12 pl-8" }, Dt = { class: "flex flex-
956
968
  h.value = {
957
969
  template: e,
958
970
  show: !0,
959
- "onUpdate:show"(k) {
960
- h.value.show = k;
971
+ "onUpdate:show"(T) {
972
+ h.value.show = T;
961
973
  },
962
974
  "onAction:edit"() {
963
- h.value.show = !1, a(Ne(e));
975
+ h.value.show = !1, l(Ne(e));
964
976
  }
965
977
  };
966
978
  }
967
979
  function y() {
968
980
  if (!n.templates.length) {
969
- l.open({
981
+ a.open({
970
982
  title: "No data to export",
971
983
  type: "error"
972
984
  });
973
985
  return;
974
986
  }
975
987
  const e = bt(n.templates);
976
- l.open({
988
+ a.open({
977
989
  title: m("inventory.ingredient.export.success"),
978
990
  message: m("inventory.ingredient.export.filename", [e]),
979
991
  type: "success"
980
992
  });
981
993
  }
982
- function s(e) {
994
+ function o(e) {
983
995
  if (!e.items.length) {
984
- l.open({
996
+ a.open({
985
997
  title: "No items in template to export",
986
998
  type: "error"
987
999
  });
988
1000
  return;
989
1001
  }
990
- const k = _t(e);
991
- l.open({
1002
+ const T = _t(e);
1003
+ a.open({
992
1004
  title: m("inventory.ingredient.export.success"),
993
- message: m("inventory.ingredient.export.filename", [k]),
1005
+ message: m("inventory.ingredient.export.filename", [T]),
994
1006
  type: "success"
995
1007
  });
996
1008
  }
997
- function v() {
1009
+ function f() {
998
1010
  n.loading || r.open({
999
1011
  title: m("inventory.ingredient.import.title"),
1000
1012
  contentComponent: jt,
@@ -1015,35 +1027,35 @@ const St = { class: "flex items-center gap-12 pl-8" }, Dt = { class: "flex flex-
1015
1027
  }
1016
1028
  }).onPrimary((e) => {
1017
1029
  if (!e) {
1018
- l.open({
1030
+ a.open({
1019
1031
  title: m("inventory.ingredient.import.error.noData"),
1020
1032
  type: "error"
1021
1033
  });
1022
1034
  return;
1023
1035
  }
1024
1036
  if (!e.importCreateResult.length && !e.importUpdateResult.length) {
1025
- l.open({
1037
+ a.open({
1026
1038
  title: m("inventory.ingredient.import.error.invalidContent"),
1027
1039
  message: m("inventory.ingredient.import.error.noImportData"),
1028
1040
  type: "error"
1029
1041
  });
1030
1042
  return;
1031
1043
  }
1032
- if (e.importCreateResult.some((k) => k.errors.length) || e.importUpdateResult.some((k) => k.errors.length)) {
1033
- l.open({
1044
+ if (e.importCreateResult.some((T) => T.errors.length) || e.importUpdateResult.some((T) => T.errors.length)) {
1045
+ a.open({
1034
1046
  title: m("inventory.ingredient.import.error.invalidContent"),
1035
1047
  message: m("inventory.ingredient.import.error.hasErrors"),
1036
1048
  type: "error"
1037
1049
  });
1038
1050
  return;
1039
1051
  }
1040
- r.close(), T(e);
1052
+ r.close(), k(e);
1041
1053
  }).onTertiary(xt);
1042
1054
  }
1043
- async function T(e) {
1044
- f.value = !0;
1055
+ async function k(e) {
1056
+ p.value = !0;
1045
1057
  try {
1046
- const k = [
1058
+ const T = [
1047
1059
  ...e.importCreateResult.map(
1048
1060
  (x) => x.template
1049
1061
  ),
@@ -1051,40 +1063,40 @@ const St = { class: "flex items-center gap-12 pl-8" }, Dt = { class: "flex flex-
1051
1063
  (x) => x.template
1052
1064
  )
1053
1065
  ], M = 100;
1054
- let p = 0;
1055
- const o = () => {
1056
- p += M, l.open({
1066
+ let v = 0;
1067
+ const s = () => {
1068
+ v += M, a.open({
1057
1069
  title: m("inventory.ingredient.import.progress", [
1058
- Math.min(p, k.length),
1059
- k.length
1070
+ Math.min(v, T.length),
1071
+ T.length
1060
1072
  ])
1061
1073
  });
1062
1074
  };
1063
- for (const x of k.chunk(100))
1064
- o(), await d.importTemplates(x);
1065
- l.open({
1075
+ for (const x of T.chunk(100))
1076
+ s(), await u.importTemplates(x);
1077
+ a.open({
1066
1078
  title: m("inventory.ingredient.import.success"),
1067
1079
  type: "success"
1068
1080
  });
1069
- } catch (k) {
1070
- l.open({
1081
+ } catch (T) {
1082
+ a.open({
1071
1083
  title: m("inventory.ingredient.import.error.failed"),
1072
- message: m("inventory.ingredient.import.error.systemMessage", [k == null ? void 0 : k.message]),
1084
+ message: m("inventory.ingredient.import.error.systemMessage", [T == null ? void 0 : T.message]),
1073
1085
  type: "error"
1074
- }), console.error("Error in importing skus", e, k);
1086
+ }), console.error("Error in importing skus", e, T);
1075
1087
  } finally {
1076
- f.value = !1, n.fetchTemplates();
1088
+ p.value = !1, n.fetchTemplates();
1077
1089
  }
1078
1090
  }
1079
1091
  return {
1080
1092
  createTemplate: c,
1081
1093
  viewTemplate: w,
1082
- updateTemplate: a,
1094
+ updateTemplate: l,
1083
1095
  deleteTemplate: g,
1084
1096
  duplicateTemplate: i,
1085
1097
  exportTemplates: y,
1086
- exportSingleTemplate: s,
1087
- importTemplates: v,
1098
+ exportSingleTemplate: o,
1099
+ importTemplates: f,
1088
1100
  templateDialogProps: b,
1089
1101
  templateDetailsProps: h
1090
1102
  };
@@ -1093,7 +1105,7 @@ var Q = /* @__PURE__ */ ((m) => (m.Name = "Name", m.Unit = "Unit", m.Delete = "D
1093
1105
  function Yt(m) {
1094
1106
  return {
1095
1107
  columnDefs: L(() => {
1096
- const l = m.items.map((t) => t.sku.unit.measurements.length).reduce((t, n) => Math.max(t, n), 0);
1108
+ const a = m.items.map((t) => t.sku.unit.measurements.length).reduce((t, n) => Math.max(t, n), 0);
1097
1109
  return [
1098
1110
  {
1099
1111
  id: "Name",
@@ -1132,14 +1144,14 @@ function Yt(m) {
1132
1144
  minSize: 200,
1133
1145
  maxSize: 400,
1134
1146
  cell(t) {
1135
- var f, b, c;
1147
+ var p, b, c;
1136
1148
  const n = t.row.original;
1137
1149
  return P("div", { class: "flex items-center gap-32" }, [
1138
1150
  P(
1139
1151
  Y.FmFormGroup,
1140
1152
  {
1141
1153
  value: n.sku.unit._id,
1142
- modelValue: !((f = n.disabledMeasurements) != null && f.includes(n.sku.unit._id))
1154
+ modelValue: !((p = n.disabledMeasurements) != null && p.includes(n.sku.unit._id))
1143
1155
  },
1144
1156
  P(
1145
1157
  "div",
@@ -1152,14 +1164,14 @@ function Yt(m) {
1152
1164
  value: n.sku.unit._id,
1153
1165
  modelValue: !((b = n.disabledMeasurements) != null && b.includes(n.sku.unit._id)),
1154
1166
  disabled: m.disabled || !((c = n.disabledMeasurements) != null && c.includes(n.sku.unit._id)) && n.sku.unit.measurements.every(
1155
- (a) => {
1167
+ (l) => {
1156
1168
  var g;
1157
- return (g = n.disabledMeasurements) == null ? void 0 : g.includes(a.id);
1169
+ return (g = n.disabledMeasurements) == null ? void 0 : g.includes(l.id);
1158
1170
  }
1159
1171
  ),
1160
- "onUpdate:modelValue"(a) {
1172
+ "onUpdate:modelValue"(l) {
1161
1173
  var g;
1162
- if (a)
1174
+ if (l)
1163
1175
  m.updateItem({
1164
1176
  ...n,
1165
1177
  disabledMeasurements: (g = n.disabledMeasurements) == null ? void 0 : g.filter(
@@ -1194,8 +1206,8 @@ function Yt(m) {
1194
1206
  ]
1195
1207
  )
1196
1208
  ),
1197
- ...Array.from({ length: Math.max(l, 0) }).map((a, g) => {
1198
- var w, y, s, v;
1209
+ ...Array.from({ length: Math.max(a, 0) }).map((l, g) => {
1210
+ var w, y, o, f;
1199
1211
  const i = t.row.original, h = i.sku.unit.measurements[g];
1200
1212
  return h ? P(
1201
1213
  Y.FmFormGroup,
@@ -1213,24 +1225,24 @@ function Yt(m) {
1213
1225
  P(Y.FmCheckbox, {
1214
1226
  value: h.id,
1215
1227
  modelValue: !((y = i.disabledMeasurements) != null && y.includes(h.id)),
1216
- disabled: m.disabled || !((s = i.disabledMeasurements) != null && s.includes(h.id)) && ((v = i.disabledMeasurements) == null ? void 0 : v.includes(i.sku.unit._id)) && i.sku.unit.measurements.filter((T) => T.id != h.id).every((T) => {
1228
+ disabled: m.disabled || !((o = i.disabledMeasurements) != null && o.includes(h.id)) && ((f = i.disabledMeasurements) == null ? void 0 : f.includes(i.sku.unit._id)) && i.sku.unit.measurements.filter((k) => k.id != h.id).every((k) => {
1217
1229
  var e;
1218
- return (e = i.disabledMeasurements) == null ? void 0 : e.includes(T.id);
1230
+ return (e = i.disabledMeasurements) == null ? void 0 : e.includes(k.id);
1219
1231
  }),
1220
- "onUpdate:modelValue"(T) {
1232
+ "onUpdate:modelValue"(k) {
1221
1233
  var e;
1222
- if (T)
1234
+ if (k)
1223
1235
  m.updateItem({
1224
1236
  ...i,
1225
1237
  disabledMeasurements: (e = i.disabledMeasurements) == null ? void 0 : e.filter(
1226
- (k) => k !== h.id
1238
+ (T) => T !== h.id
1227
1239
  )
1228
1240
  });
1229
1241
  else {
1230
- const k = i.disabledMeasurements ?? [];
1242
+ const T = i.disabledMeasurements ?? [];
1231
1243
  m.updateItem({
1232
1244
  ...i,
1233
- disabledMeasurements: [...k, h.id]
1245
+ disabledMeasurements: [...T, h.id]
1234
1246
  });
1235
1247
  }
1236
1248
  }
@@ -1298,32 +1310,32 @@ const Gt = { class: "flex flex-col gap-16 py-12" }, Kt = { class: "flex" }, Wt =
1298
1310
  row: {}
1299
1311
  },
1300
1312
  setup(m) {
1301
- const r = m, l = L(() => r.row), d = L(
1302
- () => l.value.getVisibleCells().filter((t) => t.column.id !== Q.Name && t.column.id !== Q.Delete)
1313
+ const r = m, a = L(() => r.row), u = L(
1314
+ () => a.value.getVisibleCells().filter((t) => t.column.id !== Q.Name && t.column.id !== Q.Delete)
1303
1315
  );
1304
1316
  return (t, n) => {
1305
- var f, b, c, a, g;
1317
+ var p, b, c, l, g;
1306
1318
  return $(), D("div", Gt, [
1307
1319
  _("div", Kt, [
1308
1320
  _("div", Wt, [
1309
- _("div", qt, I(l.value.original.sku.name), 1),
1310
- _("div", Jt, I(l.value.original.sku.code), 1)
1321
+ _("div", qt, I(a.value.original.sku.name), 1),
1322
+ _("div", Jt, I(a.value.original.sku.code), 1)
1311
1323
  ]),
1312
1324
  _("div", null, [
1313
- C(u(X), {
1314
- render: (c = (b = (f = t.cellByColId[u(Q).Delete]) == null ? void 0 : f.column) == null ? void 0 : b.columnDef) == null ? void 0 : c.cell,
1315
- props: (g = (a = t.cellByColId[u(Q).Delete]) == null ? void 0 : a.getContext) == null ? void 0 : g.call(a)
1325
+ C(d(X), {
1326
+ render: (c = (b = (p = t.cellByColId[d(Q).Delete]) == null ? void 0 : p.column) == null ? void 0 : b.columnDef) == null ? void 0 : c.cell,
1327
+ props: (g = (l = t.cellByColId[d(Q).Delete]) == null ? void 0 : l.getContext) == null ? void 0 : g.call(l)
1316
1328
  }, null, 8, ["render", "props"])
1317
1329
  ])
1318
1330
  ]),
1319
1331
  _("div", Xt, [
1320
1332
  n[0] || (n[0] = _("div", { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, null, -1)),
1321
- ($(!0), D(j, null, Z(d.value, (i) => {
1333
+ ($(!0), D(j, null, Z(u.value, (i) => {
1322
1334
  var h, w, y;
1323
1335
  return $(), D("div", {
1324
1336
  key: i.id
1325
1337
  }, [
1326
- C(u(X), {
1338
+ C(d(X), {
1327
1339
  render: (w = (h = i.column) == null ? void 0 : h.columnDef) == null ? void 0 : w.cell,
1328
1340
  props: (y = i.getContext) == null ? void 0 : y.call(i)
1329
1341
  }, null, 8, ["render", "props"])
@@ -1340,86 +1352,86 @@ const Gt = { class: "flex flex-col gap-16 py-12" }, Kt = { class: "flex" }, Wt =
1340
1352
  disabled: { type: Boolean }
1341
1353
  },
1342
1354
  setup(m, { expose: r }) {
1343
- const l = m, d = vt(), { t } = W(), n = ve(), {
1344
- promptSelectLocations: f,
1355
+ const a = m, u = vt(), { t } = W(), n = ve(), {
1356
+ promptSelectLocations: p,
1345
1357
  columnDefs: b,
1346
1358
  rowData: c
1347
1359
  } = gt({
1348
1360
  getLocations() {
1349
- return d.locations;
1361
+ return u.locations;
1350
1362
  },
1351
- setLocations(p) {
1352
- d.locations = p;
1363
+ setLocations(v) {
1364
+ u.locations = v;
1353
1365
  }
1354
- }), a = R(), g = R(""), i = R(null), h = R(!1), w = [
1366
+ }), l = R(), g = R(""), i = R(null), h = R(!1), w = [
1355
1367
  {
1356
1368
  key: "name",
1357
1369
  label: "Name",
1358
- getter: (p) => {
1359
- var o;
1360
- return (o = p.sku) == null ? void 0 : o.name;
1370
+ getter: (v) => {
1371
+ var s;
1372
+ return (s = v.sku) == null ? void 0 : s.name;
1361
1373
  }
1362
1374
  },
1363
1375
  {
1364
1376
  key: "code",
1365
1377
  label: "Code",
1366
- getter: (p) => {
1367
- var o;
1368
- return (o = p.sku) == null ? void 0 : o.code;
1378
+ getter: (v) => {
1379
+ var s;
1380
+ return (s = v.sku) == null ? void 0 : s.code;
1369
1381
  }
1370
1382
  }
1371
- ], y = R([]), s = L(() => d.items.map((p, o) => ({ item: p, originalIndex: o })).sort((p, o) => {
1372
- const x = p.item.position ?? p.originalIndex, F = o.item.position ?? o.originalIndex;
1383
+ ], y = R([]), o = L(() => u.items.map((v, s) => ({ item: v, originalIndex: s })).sort((v, s) => {
1384
+ const x = v.item.position ?? v.originalIndex, F = s.item.position ?? s.originalIndex;
1373
1385
  return x - F;
1374
- }).map(({ item: p }) => p));
1375
- function v() {
1376
- h.value ? d.items = y.value.map(({ id: p, label: o, ...x }, F) => ({
1386
+ }).map(({ item: v }) => v));
1387
+ function f() {
1388
+ h.value ? u.items = y.value.map(({ id: v, label: s, ...x }, F) => ({
1377
1389
  ...x,
1378
1390
  position: F
1379
- })) : y.value = s.value.map((p) => ({
1380
- ...p,
1381
- id: p.sku._id,
1382
- label: `${p.sku.code} ${p.sku.name}`
1391
+ })) : y.value = o.value.map((v) => ({
1392
+ ...v,
1393
+ id: v.sku._id,
1394
+ label: `${v.sku.code} ${v.sku.name}`
1383
1395
  })), h.value = !h.value;
1384
1396
  }
1385
1397
  r({
1386
1398
  validateInputs: () => {
1387
- var p, o;
1388
- (o = (p = a.value) == null ? void 0 : p.validateInputs) == null || o.call(p);
1399
+ var v, s;
1400
+ (s = (v = l.value) == null ? void 0 : v.validateInputs) == null || s.call(v);
1389
1401
  },
1390
1402
  resetInputsValidation: () => {
1391
- var p, o;
1392
- (o = (p = a.value) == null ? void 0 : p.resetInputsValidation) == null || o.call(p);
1403
+ var v, s;
1404
+ (s = (v = l.value) == null ? void 0 : v.resetInputsValidation) == null || s.call(v);
1393
1405
  },
1394
1406
  resetInputs: () => {
1395
- var p, o;
1396
- (o = (p = a.value) == null ? void 0 : p.resetInputs) == null || o.call(p);
1407
+ var v, s;
1408
+ (s = (v = l.value) == null ? void 0 : v.resetInputs) == null || s.call(v);
1397
1409
  }
1398
1410
  });
1399
- const T = Yt({
1400
- updateItem: (p) => {
1401
- d.items = d.items.map((o) => o.sku._id !== p.sku._id ? o : p);
1411
+ const k = Yt({
1412
+ updateItem: (v) => {
1413
+ u.items = u.items.map((s) => s.sku._id !== v.sku._id ? s : v);
1402
1414
  },
1403
- deleteItem: (p) => {
1404
- d.items = d.items.filter((o) => o.sku._id !== p.sku._id);
1415
+ deleteItem: (v) => {
1416
+ u.items = u.items.filter((s) => s.sku._id !== v.sku._id);
1405
1417
  },
1406
1418
  get items() {
1407
- return s.value;
1419
+ return o.value;
1408
1420
  },
1409
1421
  get disabled() {
1410
- return l.disabled;
1422
+ return a.disabled;
1411
1423
  }
1412
- }), e = L(() => T.columnDefs.value), { promptSelectIngredients: k } = ft();
1424
+ }), e = L(() => k.columnDefs.value), { promptSelectIngredients: T } = ft();
1413
1425
  async function M() {
1414
- const o = n.skus.map((S) => ({
1426
+ const s = n.skus.map((S) => ({
1415
1427
  label: S.name,
1416
1428
  sublabel: S.code,
1417
1429
  value: S
1418
1430
  })).filter((S) => {
1419
1431
  var U;
1420
- return (U = d.items) == null ? void 0 : U.find((H) => H.sku._id === S.value._id);
1421
- }).map((S) => S.value), x = d.items ?? [], F = await k(
1422
- o.map((S) => S._id),
1432
+ return (U = u.items) == null ? void 0 : U.find((H) => H.sku._id === S.value._id);
1433
+ }).map((S) => S.value), x = u.items ?? [], F = await T(
1434
+ s.map((S) => S._id),
1423
1435
  (S) => {
1424
1436
  const U = n.skuById[S], H = x.find((A) => A.sku._id === U._id);
1425
1437
  return H || {
@@ -1427,101 +1439,101 @@ const Gt = { class: "flex flex-col gap-16 py-12" }, Kt = { class: "flex" }, Wt =
1427
1439
  };
1428
1440
  }
1429
1441
  );
1430
- F && (F.sort((S, U) => S.sku.code.localeCompare(U.sku.code)), d.items = F);
1442
+ F && (F.sort((S, U) => S.sku.code.localeCompare(U.sku.code)), u.items = F);
1431
1443
  }
1432
- return (p, o) => {
1444
+ return (v, s) => {
1433
1445
  const x = E("FmTextField"), F = E("FmButton"), S = E("FmTable"), U = E("FmIcon"), H = E("FmFormGroup"), B = E("FmForm");
1434
1446
  return $(), N(B, {
1435
1447
  ref_key: "formRef",
1436
- ref: a,
1448
+ ref: l,
1437
1449
  class: "flex flex-col gap-32",
1438
- disabled: p.disabled
1450
+ disabled: v.disabled
1439
1451
  }, {
1440
1452
  default: V(() => [
1441
1453
  _("div", Zt, [
1442
1454
  _("div", en, [
1443
1455
  C(x, {
1444
- label: u(t)("inventory.closing.form.name"),
1456
+ label: d(t)("inventory.closing.form.name"),
1445
1457
  "label-mark": "required",
1446
- modelValue: u(d).name,
1447
- "onUpdate:modelValue": o[0] || (o[0] = (A) => u(d).name = A),
1448
- rules: [u(dt)()]
1458
+ modelValue: d(u).name,
1459
+ "onUpdate:modelValue": s[0] || (s[0] = (A) => d(u).name = A),
1460
+ rules: [d(dt)()]
1449
1461
  }, null, 8, ["label", "modelValue", "rules"]),
1450
1462
  C(x, {
1451
- label: u(t)("inventory.closing.form.reference"),
1463
+ label: d(t)("inventory.closing.form.reference"),
1452
1464
  "label-mark": "optional",
1453
- modelValue: u(d).ref,
1454
- "onUpdate:modelValue": o[1] || (o[1] = (A) => u(d).ref = A)
1465
+ modelValue: d(u).ref,
1466
+ "onUpdate:modelValue": s[1] || (s[1] = (A) => d(u).ref = A)
1455
1467
  }, null, 8, ["label", "modelValue"])
1456
1468
  ])
1457
1469
  ]),
1458
1470
  _("div", tn, [
1459
1471
  _("div", nn, [
1460
- _("div", on, I(u(t)("inventory.closing.form.locations")), 1),
1472
+ _("div", on, I(d(t)("inventory.closing.form.locations")), 1),
1461
1473
  C(F, {
1462
- disabled: p.disabled,
1463
- label: u(t)("inventory.closing.form.selectLocation"),
1474
+ disabled: v.disabled,
1475
+ label: d(t)("inventory.closing.form.selectLocation"),
1464
1476
  "prepend-icon": "add",
1465
1477
  variant: "plain",
1466
1478
  class: "border-2 rounded-lg border-fm-color-primary",
1467
- onClick: u(f)
1479
+ onClick: d(p)
1468
1480
  }, null, 8, ["disabled", "label", "onClick"])
1469
1481
  ]),
1470
1482
  C(S, {
1471
- "column-defs": u(b),
1472
- "row-data": u(c),
1483
+ "column-defs": d(b),
1484
+ "row-data": d(c),
1473
1485
  "shrink-at": 9999,
1474
- onRowClick: u(f),
1486
+ onRowClick: d(p),
1475
1487
  "hide-footer": ""
1476
1488
  }, null, 8, ["column-defs", "row-data", "onRowClick"])
1477
1489
  ]),
1478
1490
  _("div", sn, [
1479
1491
  _("div", ln, [
1480
- _("div", an, I(u(t)("inventory.closing.form.items.title")), 1),
1492
+ _("div", an, I(d(t)("inventory.closing.form.items.title")), 1),
1481
1493
  _("div", rn, [
1482
- u(d).items.length > 0 ? ($(), N(F, {
1494
+ d(u).items.length > 0 ? ($(), N(F, {
1483
1495
  key: 0,
1484
- disabled: p.disabled,
1485
- label: h.value ? u(t)("inventory.common.done") : u(t)("inventory.common.rearrange"),
1496
+ disabled: v.disabled,
1497
+ label: h.value ? d(t)("inventory.common.done") : d(t)("inventory.common.rearrange"),
1486
1498
  "prepend-icon": h.value ? "check" : "swap_vert",
1487
1499
  variant: h.value ? "primary" : "secondary",
1488
1500
  class: q(["border-2 rounded-lg", h.value ? "" : "border-fm-color-secondary"]),
1489
- onClick: v,
1501
+ onClick: f,
1490
1502
  size: "md"
1491
1503
  }, null, 8, ["disabled", "label", "prepend-icon", "variant", "class"])) : O("", !0),
1492
1504
  h.value ? O("", !0) : ($(), N(F, {
1493
1505
  key: 1,
1494
- disabled: p.disabled,
1495
- label: u(t)("inventory.closing.form.items.addItem"),
1506
+ disabled: v.disabled,
1507
+ label: d(t)("inventory.closing.form.items.addItem"),
1496
1508
  "prepend-icon": "add",
1497
1509
  variant: "plain",
1498
1510
  class: "border-2 rounded-lg border-fm-color-primary",
1499
- onClick: o[2] || (o[2] = (A) => M()),
1511
+ onClick: s[2] || (s[2] = (A) => M()),
1500
1512
  size: "md"
1501
1513
  }, null, 8, ["disabled", "label"]))
1502
1514
  ])
1503
1515
  ]),
1504
1516
  h.value ? ($(), D("div", cn, [
1505
- C(u(et), {
1517
+ C(d(et), {
1506
1518
  modelValue: y.value,
1507
- "onUpdate:modelValue": o[3] || (o[3] = (A) => y.value = A),
1519
+ "onUpdate:modelValue": s[3] || (s[3] = (A) => y.value = A),
1508
1520
  "sort-fields": w,
1509
- "left-column-label": u(t)("inventory.closing.form.items.availableItems"),
1510
- "right-column-label": u(t)("inventory.closing.form.items.organizedGroups"),
1521
+ "left-column-label": d(t)("inventory.closing.form.items.availableItems"),
1522
+ "right-column-label": d(t)("inventory.closing.form.items.organizedGroups"),
1511
1523
  height: "600px"
1512
1524
  }, null, 8, ["modelValue", "left-column-label", "right-column-label"])
1513
1525
  ])) : ($(), D(j, { key: 1 }, [
1514
1526
  C(x, {
1515
- placeholder: u(t)("inventory.formField.filterItems"),
1527
+ placeholder: d(t)("inventory.formField.filterItems"),
1516
1528
  modelValue: g.value,
1517
- "onUpdate:modelValue": o[5] || (o[5] = (A) => g.value = A)
1529
+ "onUpdate:modelValue": s[5] || (s[5] = (A) => g.value = A)
1518
1530
  }, Ee({ _: 2 }, [
1519
1531
  g.value ? {
1520
1532
  name: "append",
1521
1533
  fn: V(() => [
1522
1534
  C(U, {
1523
1535
  name: "close",
1524
- onClick: o[4] || (o[4] = (A) => g.value = ""),
1536
+ onClick: s[4] || (s[4] = (A) => g.value = ""),
1525
1537
  class: "cursor-pointer"
1526
1538
  })
1527
1539
  ]),
@@ -1535,15 +1547,15 @@ const Gt = { class: "flex flex-col gap-16 py-12" }, Kt = { class: "flex" }, Wt =
1535
1547
  ($(), N(S, {
1536
1548
  "search-value": g.value,
1537
1549
  "column-defs": e.value,
1538
- "row-data": s.value,
1539
- key: s.value.map((A) => A.sku._id).join("."),
1540
- "hide-footer": s.value.length <= 10,
1541
- "page-size": Math.min(10, s.value.length)
1550
+ "row-data": o.value,
1551
+ key: o.value.map((A) => A.sku._id).join("."),
1552
+ "hide-footer": o.value.length <= 10,
1553
+ "page-size": Math.min(10, o.value.length)
1542
1554
  }, {
1543
1555
  "list-row": V((A) => [
1544
1556
  ($(), N(ze, {
1545
1557
  row: A,
1546
- key: s.value.map((J) => J.sku._id).join(".")
1558
+ key: o.value.map((J) => J.sku._id).join(".")
1547
1559
  }, {
1548
1560
  default: V((J) => [
1549
1561
  C(Qt, {
@@ -1559,8 +1571,8 @@ const Gt = { class: "flex flex-col gap-16 py-12" }, Kt = { class: "flex" }, Wt =
1559
1571
  ], 512)
1560
1572
  ], 64)),
1561
1573
  C(H, {
1562
- "model-value": u(d).items.length,
1563
- rules: [u(pt)(1)]
1574
+ "model-value": d(u).items.length,
1575
+ rules: [d(pt)(1)]
1564
1576
  }, null, 8, ["model-value", "rules"])
1565
1577
  ])
1566
1578
  ]),
@@ -1576,9 +1588,9 @@ const Gt = { class: "flex flex-col gap-16 py-12" }, Kt = { class: "flex" }, Wt =
1576
1588
  show: { type: Boolean }
1577
1589
  },
1578
1590
  emits: ["update:show", "submitted"],
1579
- setup(m, { expose: r, emit: l }) {
1580
- var p;
1581
- const d = m, t = l, n = me(), f = ie(), b = ce(), { t: c } = W(), a = tt(d, "show");
1591
+ setup(m, { expose: r, emit: a }) {
1592
+ var v;
1593
+ const u = m, t = a, n = me(), p = ie(), b = ce(), { t: c } = W(), l = tt(u, "show");
1582
1594
  function g() {
1583
1595
  return {
1584
1596
  _id: "",
@@ -1586,16 +1598,16 @@ const Gt = { class: "flex flex-col gap-16 py-12" }, Kt = { class: "flex" }, Wt =
1586
1598
  items: []
1587
1599
  };
1588
1600
  }
1589
- const i = R(d.modelValue ?? g()), h = R(((p = d.modelValue) == null ? void 0 : p._id) ?? `${Math.random()}`);
1601
+ const i = R(u.modelValue ?? g()), h = R(((v = u.modelValue) == null ? void 0 : v._id) ?? `${Math.random()}`);
1590
1602
  Pe(
1591
- () => d.show,
1592
- (o) => {
1603
+ () => u.show,
1604
+ (s) => {
1593
1605
  var x;
1594
- o && (i.value = d.modelValue ?? g(), h.value = ((x = d.modelValue) == null ? void 0 : x._id) ?? `${Math.random()}`);
1606
+ s && (i.value = u.modelValue ?? g(), h.value = ((x = u.modelValue) == null ? void 0 : x._id) ?? `${Math.random()}`);
1595
1607
  }
1596
1608
  );
1597
1609
  const w = R(!1), y = L(() => {
1598
- switch (d.mode) {
1610
+ switch (u.mode) {
1599
1611
  case G.READ:
1600
1612
  return "";
1601
1613
  case G.CREATE:
@@ -1604,27 +1616,27 @@ const Gt = { class: "flex flex-col gap-16 py-12" }, Kt = { class: "flex" }, Wt =
1604
1616
  return c("inventory.closing.template.update.title");
1605
1617
  }
1606
1618
  return "";
1607
- }), s = R();
1619
+ }), o = R();
1608
1620
  r({
1609
1621
  validateInputs: () => {
1610
- var o, x;
1611
- (x = (o = s.value) == null ? void 0 : o.validateInputs) == null || x.call(o);
1622
+ var s, x;
1623
+ (x = (s = o.value) == null ? void 0 : s.validateInputs) == null || x.call(s);
1612
1624
  },
1613
1625
  resetInputsValidation: () => {
1614
- var o, x;
1615
- (x = (o = s.value) == null ? void 0 : o.resetInputsValidation) == null || x.call(o);
1626
+ var s, x;
1627
+ (x = (s = o.value) == null ? void 0 : s.resetInputsValidation) == null || x.call(s);
1616
1628
  },
1617
1629
  resetInputs: () => {
1618
- var o, x;
1619
- (x = (o = s.value) == null ? void 0 : o.resetInputs) == null || x.call(o);
1630
+ var s, x;
1631
+ (x = (s = o.value) == null ? void 0 : s.resetInputs) == null || x.call(s);
1620
1632
  }
1621
1633
  });
1622
- async function v() {
1623
- const o = i.value;
1624
- if (o) {
1634
+ async function f() {
1635
+ const s = i.value;
1636
+ if (s) {
1625
1637
  w.value = !0;
1626
1638
  try {
1627
- await n.createTemplate(o), await new Promise((x) => setTimeout(x, 1e3)), b.open({
1639
+ await n.createTemplate(s), await new Promise((x) => setTimeout(x, 1e3)), b.open({
1628
1640
  title: c("inventory.closing.template.create.success"),
1629
1641
  message: c("inventory.closing.template.create.successMessage"),
1630
1642
  type: "success"
@@ -1640,14 +1652,14 @@ const Gt = { class: "flex flex-col gap-16 py-12" }, Kt = { class: "flex" }, Wt =
1640
1652
  }
1641
1653
  }
1642
1654
  }
1643
- async function T() {
1644
- const o = i.value;
1645
- if (o) {
1646
- w.value = !0, delete o.updatedAt;
1655
+ async function k() {
1656
+ const s = i.value;
1657
+ if (s) {
1658
+ w.value = !0, delete s.updatedAt;
1647
1659
  try {
1648
1660
  await n.updateTemplate({
1649
- ...o,
1650
- _rev: o._rev ?? ""
1661
+ ...s,
1662
+ _rev: s._rev ?? ""
1651
1663
  }), await new Promise((x) => setTimeout(x, 1e3)), b.open({
1652
1664
  title: c("inventory.closing.template.update.success"),
1653
1665
  message: c("inventory.closing.template.update.successMessage"),
@@ -1665,25 +1677,25 @@ const Gt = { class: "flex flex-col gap-16 py-12" }, Kt = { class: "flex" }, Wt =
1665
1677
  }
1666
1678
  }
1667
1679
  function e() {
1668
- switch (d.mode) {
1680
+ switch (u.mode) {
1669
1681
  case G.CREATE:
1670
- return v();
1682
+ return f();
1671
1683
  case G.UPDATE:
1672
- return T();
1684
+ return k();
1673
1685
  }
1674
1686
  }
1675
- function k() {
1676
- var o, x;
1677
- (x = (o = s.value) == null ? void 0 : o.validateInputs) == null || x.call(o);
1687
+ function T() {
1688
+ var s, x;
1689
+ (x = (s = o.value) == null ? void 0 : s.validateInputs) == null || x.call(s);
1678
1690
  }
1679
1691
  function M() {
1680
- i.value && f.exportSingleTemplate(i.value);
1692
+ i.value && p.exportSingleTemplate(i.value);
1681
1693
  }
1682
- return (o, x) => {
1694
+ return (s, x) => {
1683
1695
  const F = E("FmMenuDivider"), S = E("FmCard"), U = E("FmButton"), H = E("FmSideSheet");
1684
1696
  return $(), N(H, {
1685
- modelValue: u(a),
1686
- "onUpdate:modelValue": x[2] || (x[2] = (B) => Ye(a) ? a.value = B : null),
1697
+ modelValue: d(l),
1698
+ "onUpdate:modelValue": x[2] || (x[2] = (B) => Ye(l) ? l.value = B : null),
1687
1699
  "dismiss-away": "",
1688
1700
  "close-button": "",
1689
1701
  "max-width": 9999
@@ -1703,15 +1715,15 @@ const Gt = { class: "flex flex-col gap-16 py-12" }, Kt = { class: "flex" }, Wt =
1703
1715
  var B;
1704
1716
  return [
1705
1717
  _("div", pn, [
1706
- _("div", fn, I(u(c)("inventory.transfer.template.details.templateSummary")), 1)
1718
+ _("div", fn, I(d(c)("inventory.transfer.template.details.templateSummary")), 1)
1707
1719
  ]),
1708
1720
  C(F),
1709
1721
  _("div", vn, [
1710
1722
  _("div", gn, [
1711
- _("div", yn, I(u(c)("inventory.transfer.receiveRequest.details.updatedAt")), 1),
1723
+ _("div", yn, I(d(c)("inventory.transfer.receiveRequest.details.updatedAt")), 1),
1712
1724
  _("div", hn, [
1713
1725
  _("div", bn, [
1714
- ae(I(u(le)(i.value.updatedAt)) + " ", 1),
1726
+ ae(I(d(le)(i.value.updatedAt)) + " ", 1),
1715
1727
  (B = i.value.updatedBy) != null && B.name ? ($(), D(j, { key: 0 }, [
1716
1728
  ae(" (" + I(i.value.updatedBy.name) + ") ", 1)
1717
1729
  ], 64)) : O("", !0)
@@ -1729,7 +1741,7 @@ const Gt = { class: "flex flex-col gap-16 py-12" }, Kt = { class: "flex" }, Wt =
1729
1741
  ($(), N(mn, {
1730
1742
  class: "w-full",
1731
1743
  ref_key: "formRef",
1732
- ref: s,
1744
+ ref: o,
1733
1745
  onValidationSuccess: e,
1734
1746
  "model-value": i.value,
1735
1747
  "onUpdate:modelValue": x[0] || (x[0] = (B) => i.value = B),
@@ -1741,21 +1753,21 @@ const Gt = { class: "flex flex-col gap-16 py-12" }, Kt = { class: "flex" }, Wt =
1741
1753
  _("div", _n, [
1742
1754
  C(U, {
1743
1755
  loading: w.value,
1744
- label: u(c)("common.save"),
1745
- onClick: k
1756
+ label: d(c)("common.save"),
1757
+ onClick: T
1746
1758
  }, null, 8, ["loading", "label"]),
1747
- o.mode === u(G).UPDATE ? ($(), N(U, {
1759
+ s.mode === d(G).UPDATE ? ($(), N(U, {
1748
1760
  key: 0,
1749
1761
  disabled: w.value,
1750
1762
  variant: "secondary",
1751
- label: u(c)("inventory.common.export"),
1763
+ label: d(c)("inventory.common.export"),
1752
1764
  "prepend-icon": "download",
1753
1765
  onClick: M
1754
1766
  }, null, 8, ["disabled", "label"])) : O("", !0),
1755
1767
  C(U, {
1756
1768
  disabled: w.value,
1757
1769
  variant: "tertiary",
1758
- label: u(c)("common.close"),
1770
+ label: d(c)("common.close"),
1759
1771
  onClick: x[1] || (x[1] = (B) => t("update:show", !1))
1760
1772
  }, null, 8, ["disabled", "label"])
1761
1773
  ])
@@ -1781,35 +1793,35 @@ const Tn = /* @__PURE__ */ ht(wn, [["render", kn]]), $n = { class: "flex flex-co
1781
1793
  __name: "ClosingTemplatePublish",
1782
1794
  emits: ["close"],
1783
1795
  setup(m, { emit: r }) {
1784
- const l = R(!1), d = ce(), t = me(), n = ue(), { t: f } = W(), b = r;
1796
+ const a = R(!1), u = ce(), t = me(), n = ue(), { t: p } = W(), b = r;
1785
1797
  async function c() {
1786
- l.value = !0;
1798
+ a.value = !0;
1787
1799
  try {
1788
- await t.startNewPublish().delayed(1e3), d.open({
1800
+ await t.startNewPublish().delayed(1e3), u.open({
1789
1801
  title: "Success",
1790
1802
  message: "You may refresh after a while to review publish status",
1791
1803
  type: "success"
1792
1804
  }), i();
1793
1805
  } catch (h) {
1794
- d.open({
1806
+ u.open({
1795
1807
  title: "Something went wrong",
1796
1808
  message: "Please try again",
1797
1809
  type: "error"
1798
1810
  }), console.error("error on creating publish task", h);
1799
1811
  } finally {
1800
- l.value = !1;
1812
+ a.value = !1;
1801
1813
  }
1802
1814
  }
1803
- const a = L(() => n.recentPublish.recentJob), g = L(
1804
- () => n.templates.length && (!a.value || a.value.outlets.length === a.value.completed.length)
1815
+ const l = L(() => n.recentPublish.recentJob), g = L(
1816
+ () => n.templates.length && (!l.value || l.value.outlets.length === l.value.completed.length)
1805
1817
  );
1806
1818
  function i() {
1807
1819
  b("close");
1808
1820
  }
1809
1821
  return (h, w) => {
1810
- const y = E("FmCircularProgress"), s = E("i18n-t"), v = E("FmButton");
1822
+ const y = E("FmCircularProgress"), o = E("i18n-t"), f = E("FmButton");
1811
1823
  return $(), D("div", $n, [
1812
- u(n).templates.length ? l.value ? ($(), D("div", In, [
1824
+ d(n).templates.length ? a.value ? ($(), D("div", In, [
1813
1825
  _("div", null, [
1814
1826
  C(y, {
1815
1827
  size: "md",
@@ -1817,50 +1829,50 @@ const Tn = /* @__PURE__ */ ht(wn, [["render", kn]]), $n = { class: "flex flex-co
1817
1829
  })
1818
1830
  ]),
1819
1831
  _("div", Sn, [
1820
- _("span", null, I(u(f)("inventory.closing.template.publish.publishing")), 1)
1832
+ _("span", null, I(d(p)("inventory.closing.template.publish.publishing")), 1)
1821
1833
  ])
1822
- ])) : a.value ? a.value.outlets.length === a.value.completed.length ? ($(), D("div", Mn, [
1823
- C(s, {
1834
+ ])) : l.value ? l.value.outlets.length === l.value.completed.length ? ($(), D("div", Mn, [
1835
+ C(o, {
1824
1836
  keypath: "inventory.closing.template.publish.recentlyPublishedAt",
1825
1837
  tag: "p"
1826
1838
  }, {
1827
1839
  started: V(() => [
1828
- _("span", Fn, I(u(le)(new Date(a.value.createdAt))), 1)
1840
+ _("span", Fn, I(d(le)(new Date(l.value.createdAt))), 1)
1829
1841
  ]),
1830
1842
  finished: V(() => [
1831
- _("span", Rn, I(u(le)(new Date(a.value.updatedAt))), 1)
1843
+ _("span", Rn, I(d(le)(new Date(l.value.updatedAt))), 1)
1832
1844
  ]),
1833
1845
  _: 1
1834
1846
  }),
1835
- _("p", null, I(u(f)("inventory.closing.template.publish.message")), 1)
1847
+ _("p", null, I(d(p)("inventory.closing.template.publish.message")), 1)
1836
1848
  ])) : ($(), D("div", An, [
1837
- C(s, {
1849
+ C(o, {
1838
1850
  keypath: "inventory.closing.template.publish.stillPublishing",
1839
1851
  tag: "p"
1840
1852
  }, {
1841
1853
  started: V(() => [
1842
- _("span", Pn, I(u(le)(new Date(a.value.createdAt))), 1)
1854
+ _("span", Pn, I(d(le)(new Date(l.value.createdAt))), 1)
1843
1855
  ]),
1844
1856
  progress: V(() => [
1845
- _("span", En, " (" + I(a.value.completed.length) + "/" + I(a.value.outlets.length) + " completed) ", 1)
1857
+ _("span", En, " (" + I(l.value.completed.length) + "/" + I(l.value.outlets.length) + " completed) ", 1)
1846
1858
  ]),
1847
1859
  _: 1
1848
1860
  }),
1849
- ae(" Your recent publishing task is still pending (" + I(a.value.completed.length) + " / " + I(a.value.outlets.length) + "). Please wait until all publishing task has completed. ", 1)
1861
+ ae(" Your recent publishing task is still pending (" + I(l.value.completed.length) + " / " + I(l.value.outlets.length) + "). Please wait until all publishing task has completed. ", 1)
1850
1862
  ])) : ($(), D("div", Dn, [
1851
- _("p", null, I(u(f)("inventory.closing.template.publish.noRecentActivity")), 1),
1852
- _("p", null, I(u(f)("inventory.closing.template.publish.message")), 1)
1863
+ _("p", null, I(d(p)("inventory.closing.template.publish.noRecentActivity")), 1),
1864
+ _("p", null, I(d(p)("inventory.closing.template.publish.message")), 1)
1853
1865
  ])) : ($(), D("div", Cn, [
1854
- _("p", null, I(u(f)("inventory.closing.template.publish.nothingToPublish")), 1)
1866
+ _("p", null, I(d(p)("inventory.closing.template.publish.nothingToPublish")), 1)
1855
1867
  ])),
1856
1868
  _("div", Vn, [
1857
- C(v, {
1869
+ C(f, {
1858
1870
  disabled: !g.value,
1859
- loading: l.value,
1871
+ loading: a.value,
1860
1872
  label: "Publish to all outlets",
1861
1873
  onClick: c
1862
1874
  }, null, 8, ["disabled", "loading"]),
1863
- C(v, {
1875
+ C(f, {
1864
1876
  variant: "tertiary",
1865
1877
  label: "Close",
1866
1878
  onClick: i
@@ -1869,16 +1881,16 @@ const Tn = /* @__PURE__ */ ht(wn, [["render", kn]]), $n = { class: "flex flex-co
1869
1881
  ]);
1870
1882
  };
1871
1883
  }
1872
- }), Nn = { class: "flex-1 flex flex-col gap-8" }, Ln = { class: "flex flex-col" }, Bn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, zn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Hn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, On = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, go = /* @__PURE__ */ K({
1884
+ }), Nn = { class: "flex-1 flex flex-col gap-8" }, Ln = { class: "flex flex-col" }, Bn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, zn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Hn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, On = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, vo = /* @__PURE__ */ K({
1873
1885
  __name: "ClosingTemplateView",
1874
1886
  setup(m) {
1875
- const { t: r } = W(), { createTemplate: l, updateTemplate: d, exportTemplates: t, importTemplates: n } = ie(), { templateDialogProps: f, templateDetailsProps: b } = Ue(ie()), c = fe(), a = pe(), g = ue(), i = Xe(), { breakpoints: h } = nt();
1887
+ const { t: r } = W(), { createTemplate: a, updateTemplate: u, exportTemplates: t, importTemplates: n } = ie(), { templateDialogProps: p, templateDetailsProps: b } = Ue(ie()), c = fe(), l = pe(), g = ue(), i = Xe(), { breakpoints: h } = nt();
1876
1888
  c.watchLocation(g.fetchTemplates);
1877
- const w = L(() => g.loading), y = R(""), s = L(() => h.value.xs || h.value.sm), v = L(() => s.value ? 10 : 20);
1878
- function T(p) {
1879
- switch (p) {
1889
+ const w = L(() => g.loading), y = R(""), o = L(() => h.value.xs || h.value.sm), f = L(() => o.value ? 10 : 20);
1890
+ function k(v) {
1891
+ switch (v) {
1880
1892
  case z.Add:
1881
- return l();
1893
+ return a();
1882
1894
  case "publish":
1883
1895
  return e();
1884
1896
  case "import":
@@ -1890,20 +1902,20 @@ const Tn = /* @__PURE__ */ ht(wn, [["render", kn]]), $n = { class: "flex flex-co
1890
1902
  }
1891
1903
  }
1892
1904
  function e() {
1893
- a.open({
1905
+ l.open({
1894
1906
  title: "Publish closing templates",
1895
1907
  contentComponent: Un,
1896
1908
  contentComponentProps: {
1897
1909
  onClose() {
1898
- a.close();
1910
+ l.close();
1899
1911
  }
1900
1912
  }
1901
1913
  });
1902
1914
  }
1903
- function k(p) {
1904
- return p;
1915
+ function T(v) {
1916
+ return v;
1905
1917
  }
1906
- const M = L(() => s.value ? [
1918
+ const M = L(() => o.value ? [
1907
1919
  {
1908
1920
  label: r("inventory.closing.template.create.title"),
1909
1921
  value: z.Add,
@@ -1958,42 +1970,42 @@ const Tn = /* @__PURE__ */ ht(wn, [["render", kn]]), $n = { class: "flex flex-co
1958
1970
  isPrimary: !1
1959
1971
  }
1960
1972
  ]);
1961
- return (p, o) => {
1973
+ return (v, s) => {
1962
1974
  const x = E("FmTable");
1963
1975
  return $(), D(j, null, [
1964
1976
  C(Qe, {
1965
- title: u(r)("inventory.closing.template.title"),
1977
+ title: d(r)("inventory.closing.template.title"),
1966
1978
  actions: M.value,
1967
- "onClick:action": T
1979
+ "onClick:action": k
1968
1980
  }, {
1969
1981
  default: V(() => [
1970
1982
  _("div", {
1971
1983
  class: q([
1972
1984
  "flex flex-col gap-8 max-h-full",
1973
1985
  {
1974
- "p-0": s.value,
1975
- "px-24 ": !s.value
1986
+ "p-0": o.value,
1987
+ "px-24 ": !o.value
1976
1988
  }
1977
1989
  ])
1978
1990
  }, [
1979
1991
  C(ut, {
1980
1992
  searchable: "",
1981
1993
  search: y.value,
1982
- "onUpdate:search": o[0] || (o[0] = (F) => y.value = F)
1994
+ "onUpdate:search": s[0] || (s[0] = (F) => y.value = F)
1983
1995
  }, null, 8, ["search"]),
1984
1996
  C(x, {
1985
- style: Ge(u(i).tableHeight),
1986
- "column-defs": u(g).columnDefs,
1987
- "row-data": u(g).templates,
1997
+ style: Ge(d(i).tableHeight),
1998
+ "column-defs": d(g).columnDefs,
1999
+ "row-data": d(g).templates,
1988
2000
  "search-value": y.value,
1989
2001
  loading: w.value,
1990
- onRowClick: o[1] || (o[1] = (F) => u(d)(F.original)),
1991
- "page-size": v.value
2002
+ onRowClick: s[1] || (s[1] = (F) => d(u)(F.original)),
2003
+ "page-size": f.value
1992
2004
  }, {
1993
2005
  "list-row": V((F) => [
1994
2006
  C(ze, {
1995
2007
  row: F,
1996
- onRowClick: (S) => u(d)(S)
2008
+ onRowClick: (S) => d(u)(S)
1997
2009
  }, {
1998
2010
  default: V((S) => {
1999
2011
  var U, H, B, A, J, be, _e, xe, ee, we, ke, Te, $e, Ce, Ie, te, Se, De, Me, Fe, ne, Re;
@@ -2001,33 +2013,33 @@ const Tn = /* @__PURE__ */ ht(wn, [["render", kn]]), $n = { class: "flex flex-co
2001
2013
  _("div", Nn, [
2002
2014
  _("div", Ln, [
2003
2015
  _("div", Bn, [
2004
- C(u(X), {
2016
+ C(d(X), {
2005
2017
  render: (B = (H = (U = S._id) == null ? void 0 : U.column) == null ? void 0 : H.columnDef) == null ? void 0 : B.cell,
2006
2018
  props: (J = (A = S._id) == null ? void 0 : A.getContext) == null ? void 0 : J.call(A)
2007
2019
  }, null, 8, ["render", "props"])
2008
2020
  ]),
2009
2021
  _("div", zn, [
2010
- C(u(X), {
2022
+ C(d(X), {
2011
2023
  render: (xe = (_e = (be = S.name) == null ? void 0 : be.column) == null ? void 0 : _e.columnDef) == null ? void 0 : xe.cell,
2012
2024
  props: (we = (ee = S.name) == null ? void 0 : ee.getContext) == null ? void 0 : we.call(ee)
2013
2025
  }, null, 8, ["render", "props"])
2014
2026
  ]),
2015
- _("div", null, I((ke = F.original.locations) != null && ke.length ? u(r)("inventory.closing.table.enabledForN", {
2027
+ _("div", null, I((ke = F.original.locations) != null && ke.length ? d(r)("inventory.closing.table.enabledForN", {
2016
2028
  count: ((Te = F.original.locations) == null ? void 0 : Te.length) ?? 0
2017
- }) : u(r)("inventory.closing.table.enabledForAll")), 1),
2029
+ }) : d(r)("inventory.closing.table.enabledForAll")), 1),
2018
2030
  _("div", Hn, I([
2019
2031
  ...F.original.items.slice(0, 3).map((je) => je.sku.name),
2020
2032
  ...F.original.items.length >= 3 ? [`and ${F.original.items.length - 3} more items`] : []
2021
2033
  ].join(", ")), 1),
2022
2034
  _("div", On, [
2023
- C(u(X), {
2035
+ C(d(X), {
2024
2036
  render: (Ie = (Ce = ($e = S.ref) == null ? void 0 : $e.column) == null ? void 0 : Ce.columnDef) == null ? void 0 : Ie.cell,
2025
2037
  props: (Se = (te = S.ref) == null ? void 0 : te.getContext) == null ? void 0 : Se.call(te)
2026
2038
  }, null, 8, ["render", "props"])
2027
2039
  ])
2028
2040
  ]),
2029
2041
  _("div", null, [
2030
- C(u(X), {
2042
+ C(d(X), {
2031
2043
  render: (Fe = (Me = (De = S.status) == null ? void 0 : De.column) == null ? void 0 : Me.columnDef) == null ? void 0 : Fe.cell,
2032
2044
  props: (Re = (ne = S.status) == null ? void 0 : ne.getContext) == null ? void 0 : Re.call(ne)
2033
2045
  }, null, 8, ["render", "props"])
@@ -2045,9 +2057,9 @@ const Tn = /* @__PURE__ */ ht(wn, [["render", kn]]), $n = { class: "flex flex-co
2045
2057
  _: 1
2046
2058
  }, 8, ["title", "actions"]),
2047
2059
  ($(), N(Ke, { to: "body" }, [
2048
- C(Tn, We(qe(u(b))), null, 16),
2049
- C(xn, Je(u(f), {
2050
- onSubmitted: o[2] || (o[2] = (F) => u(g).fetchTemplates())
2060
+ C(Tn, We(qe(d(b))), null, 16),
2061
+ C(xn, Je(d(p), {
2062
+ onSubmitted: s[2] || (s[2] = (F) => d(g).fetchTemplates())
2051
2063
  }), null, 16)
2052
2064
  ]))
2053
2065
  ], 64);
@@ -2055,5 +2067,5 @@ const Tn = /* @__PURE__ */ ht(wn, [["render", kn]]), $n = { class: "flex flex-co
2055
2067
  }
2056
2068
  });
2057
2069
  export {
2058
- go as default
2070
+ vo as default
2059
2071
  };