@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,2328 +0,0 @@
1
- import { ref as D, h as P, defineComponent as G, resolveComponent as E, openBlock as $, createElementBlock as M, createElementVNode as v, normalizeClass as Y, createTextVNode as X, toDisplayString as A, unref as x, createCommentVNode as z, createVNode as I, createBlock as O, Fragment as K, renderList as Q, computed as U, watch as pe, createSlots as Ue, withCtx as V, isRef as Le, normalizeStyle as Qe, Teleport as Xe, normalizeProps as Ze, guardReactiveProps as et, mergeProps as Ve } from "vue";
2
- import { u as tt, _ as nt } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
3
- import { useI18n as J, useCoreStore as Ne } from "@feedmepos/mf-common";
4
- import { D as ue, R as B } from "./row-action.enum-BcW_L_nE.js";
5
- import { _ as st } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-kVpsL4cx.js";
6
- import { useDialog as Z, useDialogChild as ot, useSnackbar as ee, FmButtonVariant as me, components as H, useProxiedModel as Be, useBreakpoints as at } from "@feedmepos/ui-library";
7
- import { defineStore as ze, storeToRefs as Oe } from "pinia";
8
- import { _ as lt, F as ce } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
9
- import { u as he, c as We, a as te, G as N, n as rt, D as fe } from "./app-CddcvygU.js";
10
- import { F as q } from "./form-mode.enum-BKiNVH6A.js";
11
- import { c as it } from "./component-DpCUABT3.js";
12
- import { f as ut } from "./format-time-from-id-6kt1RMWs.js";
13
- import { u as ne } from "./closing-template-DxdLqlb1.js";
14
- import { _ as mt } from "./TemplatePublishDialog.vue_vue_type_script_setup_true_lang-ByPIjcED.js";
15
- import { t as ve, a as He, d as Ke, s as Ye, r as ct } from "./xlsx.util-CSudzOii.js";
16
- import { f as dt, a as de } from "./date2-CVZy20Q_.js";
17
- import { u as pt } from "./netsuite-3LgQ5ztL.js";
18
- import { F as ft } from "./FmDroppableField-J0xUsOTV.js";
19
- import { u as vt } from "./duplicate-template-DvnZ4BW6.js";
20
- import { A as yt, R as Ge } from "./rules-hQBVd1Mn.js";
21
- import { d as ht } from "./defineDeepModel-DgRoiQBp.js";
22
- import { u as gt } from "./use-template-enabled-locations-2-B_aZrMUU.js";
23
- import { a as bt } from "./FmMultiselectDialog-BviFuAM5.js";
24
- import { _ as _t } from "./SystemTrailDialog.vue_vue_type_script_setup_true_lang-_8YeihNH.js";
25
- import { _ as xt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
26
- const se = ze(
27
- "wastageTable",
28
- function() {
29
- const { t: l } = J(), m = Z(), f = ye(), d = D({}), r = D(new Array()), c = D(!1), s = he(), n = ne(), o = D({}), u = D();
30
- async function h() {
31
- if (s._currentLocation)
32
- try {
33
- u.value = await n.getReasons();
34
- } catch (a) {
35
- console.log("Something went wrong when fetching reasons:", a);
36
- }
37
- }
38
- function y() {
39
- var e;
40
- if (!u.value) return !1;
41
- const a = (e = d.value.publishedRevs) == null ? void 0 : e[u.value._id];
42
- return u.value._rev === a;
43
- }
44
- function T(a) {
45
- const e = {
46
- title: a.name,
47
- doc: a,
48
- controller: {
49
- publishAll: async (i) => {
50
- const g = i || a.locations, C = await n.publishSingleDoc(
51
- a._id,
52
- g == null ? void 0 : g.map((S) => S.dbName)
53
- );
54
- return o.value = C.publishedRevByLocation || {}, o.value;
55
- },
56
- publishAtLocation: async (i) => {
57
- const g = await n.publishSingleDoc(a._id, [
58
- i.dbName
59
- ]);
60
- return o.value = g.publishedRevByLocation || {}, o.value;
61
- }
62
- },
63
- initialPublishedRev: o.value,
64
- locations: s.locations,
65
- enabledLocations: a.locations
66
- };
67
- m.open({
68
- title: "Publish template",
69
- contentComponent: mt,
70
- contentComponentProps: e,
71
- closeButton: !0,
72
- primaryActions: {
73
- text: l("common.close"),
74
- close: !0,
75
- variant: "tertiary"
76
- }
77
- });
78
- }
79
- async function w() {
80
- if (r.value = [], !!s._currentLocation) {
81
- c.value = !0;
82
- try {
83
- const [a, e, i] = await Promise.all([
84
- n.readTemplates(),
85
- n.getRecentPublishingJob(),
86
- n.getRecentPublishInfo()
87
- ]).delayed(1e3);
88
- r.value = a, d.value = e, o.value = (i == null ? void 0 : i.publishedRevByLocation) || {}, await h();
89
- } catch (a) {
90
- console.log("Something went wrong when fetching templates:", a);
91
- } finally {
92
- c.value = !1;
93
- }
94
- }
95
- }
96
- async function k(a) {
97
- if (!r.value.find((e) => e._id) && s._currentLocation) {
98
- c.value = !0;
99
- try {
100
- const [e] = await Promise.all([
101
- n.getTemplate(a),
102
- new Promise((i) => setTimeout(i, 1e3))
103
- ]);
104
- r.value = [e];
105
- } catch (e) {
106
- console.log("Something went wrong when fetching templates:", e);
107
- } finally {
108
- c.value = !1;
109
- }
110
- }
111
- }
112
- function b(a, e) {
113
- switch (e = We(e), a) {
114
- case B.Details:
115
- return f.viewTemplate(e);
116
- case B.Edit:
117
- return f.updateTemplate(e);
118
- case B.Delete:
119
- return f.deleteTemplate(e, c, w);
120
- case B.Publish:
121
- return T(e);
122
- case B.Duplicate:
123
- return f.duplicateTemplate(e, c, w);
124
- }
125
- }
126
- return {
127
- columnDefs: [
128
- {
129
- id: "_id",
130
- accessorKey: "_id",
131
- header: () => l("inventory.adjustment.template.table.createdAt"),
132
- cell(a) {
133
- return ut(`${a.getValue()}`);
134
- },
135
- enableSorting: !0
136
- },
137
- {
138
- id: "name",
139
- accessorKey: "name",
140
- header: () => l("inventory.adjustment.template.table.name"),
141
- enableSorting: !0,
142
- size: 200
143
- },
144
- {
145
- id: "noOfItems",
146
- accessorKey: "items.length",
147
- header: () => l("inventory.adjustment.template.table.noOfItems"),
148
- enableSorting: !1,
149
- meta: {
150
- width: "10rem",
151
- textAlign: "right"
152
- }
153
- },
154
- {
155
- id: "enabledLocations",
156
- accessorKey: "locations.length",
157
- header: () => l("inventory.adjustment.template.table.enabledOutlets"),
158
- cell(a) {
159
- var i;
160
- const e = (i = a.row.original.locations) == null ? void 0 : i.length;
161
- return e ? `${e}` : "All";
162
- },
163
- enableSorting: !1,
164
- meta: {
165
- width: "10rem",
166
- textAlign: "right"
167
- }
168
- },
169
- {
170
- id: "status",
171
- header: () => l("inventory.adjustment.template.table.status"),
172
- enableSorting: !1,
173
- cell(a) {
174
- const e = a.row.original, i = e._rev, g = a.row.original.locations || s.locations, S = g.filter((_) => !!(o.value[_.dbName] || []).find((R) => R._id === e._id && R._rev === i)).length === g.length;
175
- return P(
176
- "div",
177
- {
178
- class: "flex items-center gap-8"
179
- },
180
- P(
181
- "div",
182
- {
183
- class: [
184
- "fm-status-badge",
185
- S ? "fm-status-badge-success-secondary" : "fm-status-badge-info-secondary"
186
- ]
187
- },
188
- S ? "Published" : "Unpublished"
189
- )
190
- );
191
- }
192
- },
193
- {
194
- id: "action",
195
- cell(a) {
196
- const e = a.row.original, i = [
197
- ue[B.Edit],
198
- ue[B.Duplicate],
199
- ue[B.Delete],
200
- ue[B.Publish]
201
- ];
202
- return it(i, (g) => b(g, e));
203
- },
204
- enableSorting: !1,
205
- size: 40,
206
- meta: {
207
- cellClass: "",
208
- headerClass: ""
209
- }
210
- }
211
- ],
212
- recentPublish: d,
213
- templates: r,
214
- reasons: u,
215
- isReasonPublished: y,
216
- loading: c,
217
- fetchTemplates: w,
218
- loadTemplate: k
219
- };
220
- }
221
- );
222
- var ge = /* @__PURE__ */ ((p) => (p.Ingredients = "Ingredients", p))(ge || {});
223
- function Je(p, l, m) {
224
- var d, r, c;
225
- const f = [];
226
- if (p.type == N.Enum.sku) {
227
- const s = new Set(p.disabledMeasurements), n = (d = l.sku) == null ? void 0 : d.find((o) => o._id === p.id);
228
- if (n) {
229
- const o = {
230
- type: p.type,
231
- code: p.code,
232
- name: p.name,
233
- unit: n.unit.abbrev,
234
- enabled: !s.has(n.unit._id)
235
- };
236
- f.push(
237
- o,
238
- ...n.unit.measurements.map((u) => ({
239
- unit: u.abbrev,
240
- enabled: !s.has(u.id)
241
- }))
242
- );
243
- }
244
- }
245
- return p.type == N.Enum.recipe && ((r = l.recipe) != null && r.find((n) => n._id === p.id)) && f.push(p), p.type == N.Enum.menu && ((c = m == null ? void 0 : m.modules.item) != null && c.find((n) => n._id === p.id)) && f.push(p), f;
246
- }
247
- function qe() {
248
- return [
249
- {
250
- id: "code",
251
- name: "Code"
252
- },
253
- {
254
- id: "type",
255
- name: "Type"
256
- },
257
- {
258
- id: "name",
259
- name: "Name"
260
- },
261
- {
262
- id: "unit",
263
- name: "Unit"
264
- },
265
- {
266
- id: "enabled",
267
- name: "Enabled (Unit)"
268
- }
269
- ];
270
- }
271
- function wt(p) {
272
- var o;
273
- const l = Ne(), m = te(), f = m.menu.cache, d = l.currentBusiness.value, c = (o = p.map((u) => {
274
- var b;
275
- const h = u.items.flatMap(
276
- (t) => Je(t, m.state.inventory, f)
277
- ), y = qe(), T = [
278
- ["Template ID", u._id],
279
- ["Template name", u.name],
280
- ["Business name", d == null ? void 0 : d.name],
281
- ["Business ID", d == null ? void 0 : d._id],
282
- ["Menu version", d == null ? void 0 : d.menuVersion],
283
- [
284
- "Locations",
285
- ...(b = u.locations) != null && b.length ? u.locations.map((t) => `${t.name} (${t.dbName})`) : ["All"]
286
- ],
287
- // ['Reference', template.ref ?? ''],
288
- [],
289
- y.map((t) => t.name),
290
- ...h.map((t) => y.map((a) => t[a.id]))
291
- ], w = y.map((t) => `system:${t.id}`), k = ve(T, w);
292
- return { name: u.name, sheet: k };
293
- }).reduce(
294
- (u, h) => {
295
- var T;
296
- const y = h.name.slice(0, 12);
297
- return (T = u.sheetOccurence)[y] ?? (T[y] = 0), u.sheetOccurence[y] += 1, u.sheets[`${y} (${u.sheetOccurence[y]})`] = h.sheet, u;
298
- },
299
- {
300
- sheets: {},
301
- sheetOccurence: {}
302
- }
303
- )) == null ? void 0 : o.sheets, s = `${d == null ? void 0 : d.name} adjustment templates (${dt(/* @__PURE__ */ new Date())}).xlsx`, n = He(c);
304
- return Ke(n, s), s;
305
- }
306
- function Tt() {
307
- var b;
308
- const p = Ne(), l = te(), m = pt(), f = (b = l.state.inventory.sku) == null ? void 0 : b[0];
309
- if (!f)
310
- throw new Error("No inventory items");
311
- const r = Je(
312
- {
313
- type: N.Enum.sku,
314
- code: f.code,
315
- id: f._id,
316
- name: f.name
317
- },
318
- l.state.inventory,
319
- l.menu.cache
320
- )[0], c = p.currentBusiness.value, s = qe(), n = [
321
- ["Template ID (leave empty to create new)", ""],
322
- ["Template Name", "New template"],
323
- ["Business name", c == null ? void 0 : c.name],
324
- ["Business ID", c == null ? void 0 : c._id],
325
- ["Menu version", c == null ? void 0 : c.menuVersion],
326
- [
327
- "Location codes (leave empty to enable all)",
328
- "Example outlet (restaurant_xxx)",
329
- "Example outlet 2 (restaurant_xxx)"
330
- ],
331
- // ['Reference:'],
332
- [],
333
- s.map((t) => t.name),
334
- s.map((t) => r[t.id])
335
- ], o = s.map((t) => `system:${t.id}`), u = ve(n, o), h = m.isEnabled ? m.state.setting.childItems ?? [] : [], y = h.reduce(
336
- (t, a) => {
337
- var S, _;
338
- const e = (S = m.netSuiteItemIdToSkuId.get(a.parentNetSuiteId)) == null ? void 0 : S[0], i = (_ = m.netSuiteMeasurementIdToMeasurementId.get(
339
- a.unitOfMeasureId
340
- )) == null ? void 0 : _[0];
341
- if (!a.externalId)
342
- return t;
343
- if (!e)
344
- return console.error(`Item ${a.externalId} cannot be mapped to parent FdoInventorySku.`, a), t;
345
- const g = l.skuById[e], C = g.unit.measurements.find((F) => F.id === i);
346
- return C ? (t[a.externalId] = {
347
- sku: g,
348
- measurement: C
349
- }, t) : (console.error(
350
- `Item ${a.externalId} found parent FdoInventorySku of ${g.code} ${g.name} but the measurement of netsuite id ${a.unitOfMeasureId} cannot be found.`,
351
- a
352
- ), t);
353
- },
354
- {}
355
- ), T = ve(
356
- [
357
- ...l.skus.flatMap((t) => [
358
- [t.code, t.name, t.unit.abbrev, !0],
359
- ...t.unit.measurements.map((e) => [
360
- "",
361
- "",
362
- e.abbrev,
363
- !e.abbrev.toLocaleLowerCase("en-us").includes("inactive")
364
- ])
365
- ]),
366
- ...Object.entries(y).map(([t, { sku: a, measurement: e }]) => [
367
- a.code,
368
- a.name,
369
- e.abbrev,
370
- !e.abbrev.toLocaleLowerCase("en-us").includes("inactive"),
371
- t
372
- ])
373
- ],
374
- [
375
- "Code",
376
- "Type",
377
- "Name",
378
- "Units",
379
- "Enabled (true/false)",
380
- ...h.length ? ["Netsuite Parent"] : []
381
- ]
382
- ), w = He({
383
- Template: u,
384
- Ingredients: T
385
- }), k = `${c == null ? void 0 : c.name} transfer templates import.xlsx`;
386
- return Ke(w, k), k;
387
- }
388
- function kt(p) {
389
- if (!p.length || `${p[0]}`.toLocaleLowerCase() === "all")
390
- return [];
391
- const l = /(.*) \(((warehouse_|restaurant_).{24,})\)/, f = he().locationByDbName;
392
- return p.map((d) => {
393
- const r = new Array(), c = d.trim(), s = l.exec(c);
394
- if (!s)
395
- return r.push(`Enabled location value of ${c} cannot be read.`), {
396
- errors: r
397
- };
398
- const n = s[1], o = s[2], u = f[o];
399
- return u ? (n !== u.name && r.push(
400
- `Location id ${o} has non-matching name. Found ${n} but expected ${u.name}`
401
- ), {
402
- errors: r,
403
- location: u
404
- }) : (r.push(`Location (${n}) of id ${o} is not found.`), {
405
- errors: r
406
- });
407
- });
408
- }
409
- function $t(p) {
410
- const [
411
- l,
412
- m,
413
- f,
414
- d,
415
- r,
416
- c,
417
- s,
418
- n
419
- ] = Ye(p);
420
- return {
421
- id: `${m[1] ?? ""}`.trim(),
422
- name: `${f[1] ?? ""}`.trim(),
423
- locations: s.slice(1).map((o) => `${o}`.trim()).filter((o) => o),
424
- reference: `${n[1] ?? ""}`.trim()
425
- };
426
- }
427
- function St(p) {
428
- const [
429
- l,
430
- m,
431
- f,
432
- d,
433
- r,
434
- c,
435
- s,
436
- n,
437
- o,
438
- ...u
439
- ] = Ye(p);
440
- if (!l || !l.length || l.some((k) => k.length && !k.startsWith("system:")))
441
- throw new Error("Missing meta header. Excel file does not come from the template.");
442
- const h = l.map((k) => k.split(":")[1]), T = [
443
- "code",
444
- "type",
445
- "name",
446
- "unit",
447
- "enabled"
448
- ].filter((k) => !h.includes(k));
449
- if (T.length)
450
- throw new Error(
451
- `Missing meta headers (${T.join()}). Excel file does not come from the template.`
452
- );
453
- return u.map((k, b) => {
454
- const t = {};
455
- for (const a in h) {
456
- const e = h[a];
457
- Object.assign(t, { [e]: k[a] });
458
- }
459
- return {
460
- index: b,
461
- data: t
462
- };
463
- });
464
- }
465
- function It(p) {
466
- return p.reduce(
467
- (l, m) => {
468
- var r;
469
- const f = m.data, d = m.index;
470
- if (f.type == N.Enum.recipe)
471
- l.result.push({ parent: m, children: [] });
472
- else if (f.type == N.Enum.menu)
473
- f.code ? l.result.push({ parent: m, children: [] }) : l.errors.push(`Menu item row ${d + 9} does not have a code.`);
474
- else {
475
- if (!f.unit) return l;
476
- f.code ? l.result.push({ parent: m, children: [] }) : l.result.length ? (r = l.result.at(-1)) == null || r.children.push(m) : l.errors.push(`Cannot find parent for row ${d + 9}`);
477
- }
478
- return l;
479
- },
480
- { result: new Array(), errors: new Array() }
481
- );
482
- }
483
- function Ft(p) {
484
- var n;
485
- const l = p.parent.data, m = new Array(), f = te();
486
- if (p.parent.data.type == N.Enum.menu) {
487
- const o = f.menu.cache, u = (n = o == null ? void 0 : o.modules.item) == null ? void 0 : n.find((y) => y.code === l.code);
488
- if (!u)
489
- return m.push(`Cannot find menu module of id ${l.code}`), { errors: m };
490
- const h = {
491
- type: N.Enum.menu,
492
- code: u.code,
493
- id: u._id,
494
- name: u.name ?? ""
495
- };
496
- return { errors: m, templateItem: h };
497
- }
498
- if (p.parent.data.type == N.Enum.recipe) {
499
- const u = f.recipes.find((y) => y.name === l.name);
500
- if (!u)
501
- return m.push(`Cannot find recipe module of id ${l.code}`), { errors: m };
502
- const h = {
503
- type: N.Enum.recipe,
504
- id: u._id,
505
- name: u.name ?? ""
506
- };
507
- return { errors: m, templateItem: h };
508
- }
509
- const d = f.skuByCode[l.code ?? ""];
510
- if (!d)
511
- return m.push(`Cannot find ingredient of code [${l.code}] [${l.name}]`), { errors: m };
512
- const r = {
513
- type: N.Enum.sku,
514
- code: l.code,
515
- id: d._id,
516
- name: l.name ?? "",
517
- disabledMeasurements: []
518
- }, c = d.unit.measurements.find((o) => o.abbrev === l.unit);
519
- l.unit !== d.unit.abbrev && !c ? m.push(
520
- `Cannot find measurement unit of ${l.unit} for (${l.code}) ${l.name}.`
521
- ) : (!l.enabled || `${l.enabled}`.toLocaleLowerCase() === "false") && (r.disabledMeasurements ?? (r.disabledMeasurements = []), r.disabledMeasurements.push((c == null ? void 0 : c.id) ?? d.unit._id));
522
- for (const o of p.children) {
523
- const u = o.data, h = u.unit === d.unit.abbrev ? d.unit : void 0, y = d.unit.measurements.find((T) => T.abbrev === u.unit);
524
- if (!y && !h) {
525
- m.push(
526
- `Cannot find measurement unit of ${u.unit} for (${l.code}) ${l.name}.`
527
- );
528
- continue;
529
- }
530
- (!u.enabled || `${u.enabled}`.toLocaleLowerCase() === "false") && (r.disabledMeasurements ?? (r.disabledMeasurements = []), r.disabledMeasurements.push((y == null ? void 0 : y.id) ?? (h == null ? void 0 : h._id) ?? ""));
531
- }
532
- const s = new Set(r.disabledMeasurements);
533
- return s.has(d.unit._id) && d.unit.measurements.every((o) => s.has(o.id)) && m.push(`Ingredient ${d.code} - ${d.name} must have at least one unit enabled.`), { errors: m, templateItem: r };
534
- }
535
- function Ct(p) {
536
- const l = p.SheetNames.filter(
537
- (r) => !Object.values(ge).map(String).includes(r)
538
- ), f = se().templates, d = rt(f, "_id");
539
- try {
540
- return l.reduce(
541
- (c, s) => {
542
- const n = new Array(), o = p.Sheets[s], u = $t(o), h = kt(u.locations), y = h.filter((e) => e.location).map((e) => e.location);
543
- n.push(...h.flatMap((e) => e.errors));
544
- const T = St(o).filter((e) => {
545
- const i = e.data;
546
- return i.type == N.Enum.menu ? i.code : i.type == N.Enum.recipe ? i.name : e.data.code || e.data.unit;
547
- }), w = It(T);
548
- n.push(...w.errors);
549
- const k = w.result.map(
550
- (e) => Ft(e)
551
- );
552
- n.push(...k.flatMap((e) => e.errors));
553
- const b = k.filter((e) => e.templateItem).map((e) => e.templateItem);
554
- if (u.id) {
555
- const e = d[u.id];
556
- if (!e) {
557
- const g = {
558
- type: fe.Enum.WASTAGE,
559
- _id: u.id,
560
- _rev: "",
561
- name: u.name || `(unnamed from sheet ${s || "<unnamed sheet>"})`,
562
- items: []
563
- };
564
- return n.push(`Template ID ${u.id} is not found.`), c.importUpdateResult.push({
565
- type: "update",
566
- original: g,
567
- template: g,
568
- excelSheetName: s,
569
- errors: n
570
- }), c;
571
- }
572
- const i = {
573
- type: "update",
574
- original: e,
575
- template: {
576
- ...e,
577
- name: u.name,
578
- locations: y.length ? y : null,
579
- items: b
580
- },
581
- excelSheetName: s,
582
- errors: n
583
- };
584
- return c.importUpdateResult.push(i), c;
585
- }
586
- const a = {
587
- type: "create",
588
- template: {
589
- type: fe.Enum.WASTAGE,
590
- name: u.name,
591
- locations: y.length ? y : null,
592
- items: b
593
- },
594
- excelSheetName: s,
595
- errors: n
596
- };
597
- return c.importCreateResult.push(a), c;
598
- },
599
- {
600
- invalidExcel: !1,
601
- importCreateResult: new Array(),
602
- importUpdateResult: new Array()
603
- }
604
- );
605
- } catch (r) {
606
- return {
607
- invalidExcel: !0,
608
- invalidExcelMessage: (r == null ? void 0 : r.message) ?? "Invalid excel",
609
- importCreateResult: [],
610
- importUpdateResult: []
611
- };
612
- }
613
- }
614
- const At = { class: "flex" }, Mt = { class: "flex flex-col flex-1" }, Rt = { class: "flex flex-col" }, Dt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" }, Et = {
615
- key: 0,
616
- class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
617
- }, Pt = { key: 0 }, Vt = { class: "ml-auto" }, jt = { key: 0 }, je = /* @__PURE__ */ G({
618
- __name: "AdjustmentTemplateImportItem",
619
- props: {
620
- type: {},
621
- name: {},
622
- locations: {},
623
- items: {},
624
- errors: {}
625
- },
626
- setup(p) {
627
- const l = p, { t: m } = J(), f = D(!1), d = () => {
628
- l.errors.length && (f.value = !f.value);
629
- };
630
- return (r, c) => {
631
- var n, o, u;
632
- const s = E("FmIcon");
633
- return $(), M("div", At, [
634
- c[0] || (c[0] = v("div", null, "•", -1)),
635
- v("div", Mt, [
636
- v("div", {
637
- class: Y(["flex items-center gap-12 pl-8", {
638
- "cursor-pointer": r.errors.length
639
- }]),
640
- onClick: d
641
- }, [
642
- v("div", Rt, [
643
- v("div", Dt, [
644
- v("div", {
645
- class: Y({
646
- "text-fm-color-system-error-300": r.errors.length
647
- })
648
- }, [
649
- X(A(r.name) + " ", 1),
650
- r.type === "create" ? ($(), M("span", Et, "(" + A(x(m)("inventory.closing.template.import.new")) + ")", 1)) : z("", !0)
651
- ], 2),
652
- r.errors.length ? ($(), M("div", Pt, [
653
- I(s, {
654
- name: "error",
655
- size: "sm",
656
- color: "system-error-300"
657
- })
658
- ])) : z("", !0)
659
- ]),
660
- v("div", {
661
- class: Y([
662
- "fm-typo-en-body-sm-400",
663
- {
664
- "text-fm-color-system-error-200": r.errors.length,
665
- "text-fm-color-typo-secondary": !r.errors.length
666
- }
667
- ])
668
- }, A((n = r.locations) != null && n.length ? x(m)("inventory.closing.template.import.nLocations", { count: (o = r.locations) == null ? void 0 : o.length }) : x(m)("inventory.closing.template.import.allLocations")) + ", " + A(x(m)("inventory.closing.template.import.nItems", { count: (u = r.items) == null ? void 0 : u.length })), 3)
669
- ]),
670
- v("div", Vt, [
671
- r.errors.length ? ($(), O(s, {
672
- key: 0,
673
- name: f.value ? "keyboard_arrow_up" : "keyboard_arrow_down",
674
- size: "md"
675
- }, null, 8, ["name"])) : z("", !0)
676
- ])
677
- ], 2),
678
- f.value ? ($(), M("div", {
679
- key: 0,
680
- class: Y(["flex flex-col gap-4 pl-8 fm-typo-en-body-sm-400", {
681
- "text-fm-color-typo-secondary": !r.errors.length,
682
- "text-fm-color-system-error-300": r.errors.length
683
- }])
684
- }, [
685
- r.errors.length ? ($(), M("div", jt, [
686
- v("ol", null, [
687
- ($(!0), M(K, null, Q(r.errors, (h, y) => ($(), M("li", { key: y }, A(h), 1))), 128))
688
- ])
689
- ])) : z("", !0)
690
- ], 2)) : z("", !0)
691
- ])
692
- ]);
693
- };
694
- }
695
- }), Ut = { class: "flex flex-col gap-24" }, Lt = { class: "fm-typo-en-body-md-400" }, Nt = {
696
- key: 0,
697
- class: "flex items-center gap-8"
698
- }, Bt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, zt = { class: "flex flex-col gap-8" }, Ot = { class: "line-clamp-2 text-ellipsis break-all" }, Wt = {
699
- key: 2,
700
- class: "shrink-0"
701
- }, Ht = {
702
- key: 0,
703
- class: "flex flex-col"
704
- }, Kt = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, Yt = {
705
- key: 0,
706
- class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
707
- }, Gt = { class: "fm-typo-en-body-lg-600" }, Jt = /* @__PURE__ */ G({
708
- __name: "AdjustmentTemplateImport",
709
- setup(p) {
710
- const l = D(null), m = ot(), f = ee(), d = D(!1), r = D(!1), c = D(new Array()), s = D([]), n = D([]), o = U(
711
- () => !!c.value.length || s.value.some((T) => T.errors.length) || n.value.some((T) => T.errors.length)
712
- ), u = U(
713
- () => !!s.value.length || !!n.value.length
714
- ), { t: h } = J();
715
- async function y(T) {
716
- c.value = [], s.value = [], n.value = [];
717
- try {
718
- d.value = !0;
719
- const [w] = await Promise.all([
720
- ct(T),
721
- // fake buffer
722
- new Promise((a) => setTimeout(a, 1e3))
723
- ]);
724
- if (!w.SheetNames.filter(
725
- (a) => !Object.values(ge).map(String).includes(a)
726
- ).find((a) => a)) {
727
- c.value.push(h("inventory.ingredient.import.fileError.noSheet"));
728
- return;
729
- }
730
- const t = Ct(w);
731
- if (t.invalidExcel) {
732
- c.value.push(
733
- t.invalidExcelMessage ?? h("inventory.ingredient.import.fileError.invalidExcel")
734
- );
735
- return;
736
- }
737
- if (s.value = t.importCreateResult, n.value = t.importUpdateResult, !s.value.length && !n.value.length) {
738
- c.value.push(h("inventory.ingredient.import.fileError.noData"));
739
- return;
740
- }
741
- m.emitData(t);
742
- } catch (w) {
743
- f.open({
744
- title: h("inventory.ingredient.import.fileError.unableToRead"),
745
- message: w == null ? void 0 : w.message,
746
- type: "error"
747
- }), console.error("Error in reading file", w);
748
- } finally {
749
- c.value.length && f.open({
750
- title: h("inventory.ingredient.import.fileError.invalidExcel"),
751
- type: "error"
752
- }), d.value = !1;
753
- }
754
- }
755
- return pe(l, (T) => {
756
- T && y(T);
757
- }), (T, w) => {
758
- const k = E("FmCircularProgress"), b = E("FmIcon"), t = E("FmButton");
759
- return $(), M("div", Ut, [
760
- v("div", Lt, A(x(h)("inventory.adjustment.template.import.message")), 1),
761
- r.value ? ($(), M("div", Nt, [
762
- v("div", null, [
763
- I(k, {
764
- size: "md",
765
- color: "neutral-gray-200"
766
- })
767
- ]),
768
- v("div", Bt, A(x(h)("inventory.formField.loading")), 1)
769
- ])) : ($(), M(K, { key: 1 }, [
770
- I(ft, {
771
- class: Y({
772
- "w-full": !0,
773
- "h-[200px]": !l.value
774
- }),
775
- accept: ".xlsx",
776
- onFileUpload: w[0] || (w[0] = (a) => l.value = a),
777
- label: x(h)("inventory.ingredient.import.uploadTemplate"),
778
- "button-label": x(h)("inventory.ingredient.import.selectFile")
779
- }, Ue({ _: 2 }, [
780
- l.value ? {
781
- name: "default",
782
- fn: V(({ openFileDialog: a }) => [
783
- v("div", zt, [
784
- v("div", {
785
- class: Y([
786
- "fm-corner-radius-md p-16 flex items-center gap-16",
787
- {
788
- "border border-fm-color-neutral-gray-100": d.value,
789
- "border border-fm-color-neutral-gray-200": !d.value && !o.value,
790
- "border border-fm-color-system-error-200": o.value
791
- }
792
- ])
793
- }, [
794
- d.value ? ($(), O(k, {
795
- key: 0,
796
- size: "md",
797
- color: "neutral-gray-200"
798
- })) : ($(), O(b, {
799
- key: 1,
800
- name: o.value ? "error" : "attach_file",
801
- outline: "",
802
- color: o.value ? "system-error-300" : void 0
803
- }, null, 8, ["name", "color"])),
804
- v("div", {
805
- class: Y([
806
- "fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center",
807
- {
808
- "text-fm-color-typo-disabled": d.value,
809
- "text-fm-color-typo-primary": !d.value
810
- }
811
- ])
812
- }, [
813
- v("div", Ot, A(l.value.name), 1)
814
- ], 2),
815
- d.value ? z("", !0) : ($(), M("div", Wt, [
816
- I(t, {
817
- label: x(h)("inventory.ingredient.import.replaceFile"),
818
- variant: o.value ? "destructive" : "secondary",
819
- "prepend-icon": o.value ? void 0 : "autorenew",
820
- onClick: a
821
- }, null, 8, ["label", "variant", "prepend-icon", "onClick"])
822
- ]))
823
- ], 2),
824
- c.value.length ? ($(), M("div", Ht, [
825
- ($(!0), M(K, null, Q(c.value, (e, i) => ($(), M("div", {
826
- key: i,
827
- class: "flex gap-8 items-center"
828
- }, [
829
- I(b, {
830
- name: "error",
831
- size: "sm",
832
- color: "system-error-300"
833
- }),
834
- v("div", Kt, A(e), 1)
835
- ]))), 128))
836
- ])) : z("", !0)
837
- ])
838
- ]),
839
- key: "0"
840
- } : void 0
841
- ]), 1032, ["class", "label", "button-label"]),
842
- u.value ? ($(), M("div", Yt, [
843
- v("div", Gt, A(x(h)("inventory.ingredient.import.summary")), 1),
844
- ($(!0), M(K, null, Q(s.value, (a, e) => ($(), O(je, {
845
- key: e,
846
- name: a.template.name,
847
- locations: a.template.locations,
848
- items: a.template.items,
849
- errors: a.errors,
850
- type: "create"
851
- }, null, 8, ["name", "locations", "items", "errors"]))), 128)),
852
- ($(!0), M(K, null, Q(n.value, (a) => ($(), O(je, {
853
- key: a.template._id,
854
- name: a.template.name,
855
- locations: a.template.locations,
856
- items: a.template.items,
857
- errors: a.errors,
858
- type: "update"
859
- }, null, 8, ["name", "locations", "items", "errors"]))), 128))
860
- ])) : z("", !0)
861
- ], 64))
862
- ]);
863
- };
864
- }
865
- }), ye = ze("wastageTemplateAction", () => {
866
- const { t: p } = J(), l = Z(), m = ee(), f = ne(), d = vt(), r = se(), { loading: c } = Oe(r), s = D({});
867
- function n() {
868
- s.value = {
869
- mode: q.CREATE,
870
- show: !0,
871
- "onUpdate:show"(e) {
872
- s.value.show = e;
873
- }
874
- };
875
- }
876
- function o(e) {
877
- s.value = {
878
- mode: q.UPDATE,
879
- modelValue: e,
880
- show: !0,
881
- "onUpdate:show"(i) {
882
- s.value.show = i;
883
- }
884
- };
885
- }
886
- function u(e, i, g) {
887
- l.open({
888
- title: `Confirm deleting template ${e.name}?`,
889
- message: "Deleted template can no longer be retrieved",
890
- primaryActions: {
891
- text: "Delete",
892
- variant: me.Destructive,
893
- close: !0
894
- },
895
- secondaryActions: {
896
- text: "Cancel",
897
- variant: me.Plain,
898
- close: !0
899
- }
900
- }).onPrimary(async () => {
901
- m.open({
902
- title: `Deleting ${e.name}`,
903
- type: "info"
904
- });
905
- try {
906
- i.value = !0;
907
- const [C] = await Promise.allSettled([
908
- f.deleteTemplate(e),
909
- new Promise((S) => setTimeout(S, 1e3))
910
- ]);
911
- if (C.status === "rejected") throw C.reason;
912
- m.open({
913
- title: `Deleted ${e.name}`,
914
- type: "success"
915
- });
916
- } catch (C) {
917
- m.open({
918
- title: `Unable to delete ${e.name}`,
919
- message: `See error from server: ${C}`,
920
- type: "error"
921
- }), console.error("error on deleting adjustment template", C);
922
- } finally {
923
- i.value = !1, g();
924
- }
925
- });
926
- }
927
- function h(e, i, g) {
928
- let C;
929
- l.open({
930
- title: `Confirm duplicating template "${e.name}"?`,
931
- message: "Duplicated template can be edited after creation",
932
- primaryActions: {
933
- text: "Duplicate",
934
- variant: me.Destructive,
935
- close: !0
936
- },
937
- secondaryActions: {
938
- text: "Cancel",
939
- variant: me.Plain,
940
- close: !0
941
- },
942
- contentComponent: G({
943
- props: ["modelValue"],
944
- emits: ["update:modelValue"],
945
- setup(S) {
946
- return () => P(H.FmTextField, {
947
- modelValue: S.modelValue,
948
- "onUpdate:modelValue": (_) => C = _,
949
- label: "New Template Name",
950
- size: "md",
951
- variant: "primary"
952
- });
953
- }
954
- })
955
- }).onPrimary(async () => {
956
- m.open({
957
- title: `Duplicating "${e.name}"`,
958
- type: "info"
959
- });
960
- try {
961
- i.value = !0;
962
- const [S] = await Promise.allSettled([
963
- d.duplicateWastagetemplate(e._id, C),
964
- new Promise((_) => setTimeout(_, 1e3))
965
- ]);
966
- if (S.status === "rejected") throw S.reason;
967
- m.open({
968
- title: `Duplicated "${e.name}"`,
969
- type: "success"
970
- });
971
- } catch (S) {
972
- m.open({
973
- title: `Unable to duplicate "${e.name}"`,
974
- message: `See error from server: ${S}`,
975
- type: "error"
976
- }), console.error("error on duplicating adjustment template", S);
977
- } finally {
978
- i.value = !1, g();
979
- }
980
- });
981
- }
982
- const y = D({});
983
- function T(e) {
984
- y.value = {
985
- template: e,
986
- show: !0,
987
- "onUpdate:show"(i) {
988
- y.value.show = i;
989
- },
990
- "onAction:edit"() {
991
- y.value.show = !1, o(We(e));
992
- }
993
- };
994
- }
995
- function w() {
996
- if (!r.templates.length) {
997
- m.open({
998
- title: "No data to export",
999
- type: "error"
1000
- });
1001
- return;
1002
- }
1003
- const e = wt(r.templates);
1004
- m.open({
1005
- title: p("inventory.ingredient.export.success"),
1006
- message: p("inventory.ingredient.export.filename", [e]),
1007
- type: "success"
1008
- });
1009
- }
1010
- function k() {
1011
- r.loading || l.open({
1012
- title: p("inventory.adjustment.template.import.title"),
1013
- contentComponent: Jt,
1014
- overlay: !0,
1015
- closeButton: !0,
1016
- primaryActions: {
1017
- text: p("common.import"),
1018
- close: !1
1019
- },
1020
- secondaryActions: {
1021
- text: p("common.close"),
1022
- close: !0
1023
- },
1024
- tertiaryActions: {
1025
- text: p("inventory.ingredient.import.actions.downloadTemplate"),
1026
- close: !1,
1027
- variant: "plain"
1028
- }
1029
- }).onPrimary((e) => {
1030
- if (!e) {
1031
- m.open({
1032
- title: p("inventory.ingredient.import.error.noData"),
1033
- type: "error"
1034
- });
1035
- return;
1036
- }
1037
- if (!e.importCreateResult.length && !e.importUpdateResult.length) {
1038
- m.open({
1039
- title: p("inventory.ingredient.import.error.invalidContent"),
1040
- message: p("inventory.ingredient.import.error.noImportData"),
1041
- type: "error"
1042
- });
1043
- return;
1044
- }
1045
- if (e.importCreateResult.some((i) => i.errors.length) || e.importUpdateResult.some((i) => i.errors.length)) {
1046
- m.open({
1047
- title: p("inventory.ingredient.import.error.invalidContent"),
1048
- message: p("inventory.ingredient.import.error.hasErrors"),
1049
- type: "error"
1050
- });
1051
- return;
1052
- }
1053
- l.close(), b(e);
1054
- }).onTertiary(Tt);
1055
- }
1056
- async function b(e) {
1057
- c.value = !0;
1058
- try {
1059
- const i = [
1060
- ...e.importCreateResult.map(
1061
- (_) => _.template
1062
- ),
1063
- ...e.importUpdateResult.map(
1064
- (_) => _.template
1065
- )
1066
- ], g = 100;
1067
- let C = 0;
1068
- const S = () => {
1069
- C += g, m.open({
1070
- title: p("inventory.ingredient.import.progress", [
1071
- Math.min(C, i.length),
1072
- i.length
1073
- ])
1074
- });
1075
- };
1076
- for (const _ of i.chunk(100))
1077
- S(), await f.importTemplates(_);
1078
- m.open({
1079
- title: p("inventory.ingredient.import.success"),
1080
- type: "success"
1081
- });
1082
- } catch (i) {
1083
- m.open({
1084
- title: p("inventory.ingredient.import.error.failed"),
1085
- message: p("inventory.ingredient.import.error.systemMessage", [i == null ? void 0 : i.message]),
1086
- type: "error"
1087
- }), console.error("Error in importing skus", e, i);
1088
- } finally {
1089
- c.value = !1, r.fetchTemplates();
1090
- }
1091
- }
1092
- const t = D({});
1093
- function a() {
1094
- t.value = {
1095
- show: !0,
1096
- "onUpdate:show"(e) {
1097
- t.value.show = e;
1098
- }
1099
- };
1100
- }
1101
- return {
1102
- createTemplate: n,
1103
- viewTemplate: T,
1104
- updateTemplate: o,
1105
- deleteTemplate: u,
1106
- duplicateTemplate: h,
1107
- exportTemplates: w,
1108
- importTemplates: k,
1109
- viewReason: a,
1110
- templateDialogProps: s,
1111
- templateDetailsProps: y,
1112
- templateReasonProps: t
1113
- };
1114
- });
1115
- function qt(p) {
1116
- const l = te(), m = U(() => {
1117
- const r = /* @__PURE__ */ new Map();
1118
- for (const c of l.skus)
1119
- r.set(c._id, c);
1120
- return r;
1121
- }), f = U(() => {
1122
- const r = [];
1123
- for (const c of p.items)
1124
- c.type === "sku" && (m.value.get(c.id) || r.push(c));
1125
- return r;
1126
- });
1127
- return {
1128
- columnDefs: U(() => {
1129
- const r = p.items.map((s) => {
1130
- if (s.type !== "sku") return 0;
1131
- const n = m.value.get(s.id);
1132
- return n ? n.unit.measurements.length : 0;
1133
- }).reduce((s, n) => Math.max(s, n), 0);
1134
- return [
1135
- {
1136
- id: "Delete",
1137
- header: "",
1138
- cell(s) {
1139
- const n = s.row.original;
1140
- return P(
1141
- "div",
1142
- { class: "w-full flex justify-end" },
1143
- P(H.FmButton, {
1144
- class: "delete-button",
1145
- key: n.id,
1146
- type: "button",
1147
- icon: "delete",
1148
- variant: "tertiary",
1149
- size: "md",
1150
- disabled: p.disabled,
1151
- onClick: () => {
1152
- p.deleteItem(n);
1153
- }
1154
- })
1155
- );
1156
- },
1157
- enableSorting: !1,
1158
- size: 40,
1159
- meta: {
1160
- cellClass: "",
1161
- headerClass: ""
1162
- }
1163
- },
1164
- {
1165
- id: "Name",
1166
- header: () => "Name",
1167
- enableSorting: !1,
1168
- size: 400,
1169
- minSize: 400,
1170
- accessorFn: (s) => `${s.name} ${s.code}`,
1171
- cell(s) {
1172
- const n = s.row.original;
1173
- return P("div", { class: "flex", style: { minWidth: "400px" } }, [
1174
- P(
1175
- "div",
1176
- {
1177
- class: "flex flex-col grow"
1178
- },
1179
- [
1180
- P(
1181
- H.FmTooltip,
1182
- {
1183
- content: n.name,
1184
- placement: "top",
1185
- variant: "plain",
1186
- zIndex: 50
1187
- },
1188
- P(
1189
- "span",
1190
- {
1191
- class: "flex-auto fm-typo-en-body-lg-400 text-fm-color-typo-primary line-clamp-1"
1192
- },
1193
- n.name
1194
- )
1195
- ),
1196
- P(
1197
- "span",
1198
- { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary line-clamp-1" },
1199
- n.code ?? ""
1200
- )
1201
- ]
1202
- ),
1203
- P(
1204
- "div",
1205
- {
1206
- class: "flex flex-col justify-center"
1207
- },
1208
- [
1209
- P(
1210
- H.FmChip,
1211
- {
1212
- compact: !0
1213
- },
1214
- n.type === "sku" ? "Ingredient" : n.type === "recipe" ? "Recipe" : "Menu"
1215
- )
1216
- ]
1217
- )
1218
- ]);
1219
- }
1220
- },
1221
- {
1222
- id: "Unit",
1223
- header: () => "Enable unit",
1224
- enableSorting: !1,
1225
- minSize: 200,
1226
- maxSize: 400,
1227
- cell(s) {
1228
- var u, h, y;
1229
- const n = s.row.original;
1230
- if (n.type !== "sku") return P("span", "N/A");
1231
- const o = m.value.get(n.id);
1232
- return P("div", { class: "flex items-center gap-32" }, [
1233
- P(
1234
- H.FmFormGroup,
1235
- {
1236
- value: o.unit._id,
1237
- modelValue: !((u = n.disabledMeasurements) != null && u.includes(o.unit._id))
1238
- },
1239
- P(
1240
- "div",
1241
- {
1242
- class: "flex items-center gap-4",
1243
- style: { width: "120px" }
1244
- },
1245
- [
1246
- P(H.FmCheckbox, {
1247
- value: o.unit._id,
1248
- modelValue: !((h = n.disabledMeasurements) != null && h.includes(o.unit._id)),
1249
- disabled: p.disabled || !((y = n.disabledMeasurements) != null && y.includes(o.unit._id)) && o.unit.measurements.every(
1250
- (T) => {
1251
- var w;
1252
- return (w = n.disabledMeasurements) == null ? void 0 : w.includes(T.id);
1253
- }
1254
- ),
1255
- "onUpdate:modelValue"(T) {
1256
- var w;
1257
- if (console.log("active", T), T)
1258
- p.updateItem({
1259
- ...n,
1260
- disabledMeasurements: (w = n.disabledMeasurements) == null ? void 0 : w.filter(
1261
- (k) => k !== o.unit._id
1262
- )
1263
- });
1264
- else {
1265
- const k = n.disabledMeasurements ?? [];
1266
- p.updateItem({
1267
- ...n,
1268
- disabledMeasurements: [...k, o.unit._id]
1269
- });
1270
- }
1271
- }
1272
- }),
1273
- P(
1274
- H.FmTooltip,
1275
- { zIndex: 51 },
1276
- {
1277
- content() {
1278
- return m.value.get(n.id).unit.abbrev;
1279
- },
1280
- default() {
1281
- const T = m.value.get(n.id);
1282
- return P(
1283
- "div",
1284
- { class: "line-clamp-2 fm-typo-en-body-lg-400" },
1285
- T.unit.abbrev
1286
- );
1287
- }
1288
- }
1289
- )
1290
- ]
1291
- )
1292
- ),
1293
- ...Array.from({ length: Math.max(r, 0) }).map((T, w) => {
1294
- var a, e, i, g;
1295
- const k = s.row.original, b = m.value.get(k.id), t = b.unit.measurements[w];
1296
- return t ? P(
1297
- H.FmFormGroup,
1298
- {
1299
- modelValue: !((a = k.disabledMeasurements) != null && a.includes(t.id)),
1300
- value: t.id
1301
- },
1302
- P(
1303
- "div",
1304
- {
1305
- class: "flex items-center gap-4",
1306
- style: { width: "120px" }
1307
- },
1308
- [
1309
- P(H.FmCheckbox, {
1310
- value: t.id,
1311
- modelValue: !((e = k.disabledMeasurements) != null && e.includes(t.id)),
1312
- disabled: p.disabled || !((i = k.disabledMeasurements) != null && i.includes(t.id)) && ((g = k.disabledMeasurements) == null ? void 0 : g.includes(b.unit._id)) && b.unit.measurements.filter((C) => C.id != t.id).every((C) => {
1313
- var S;
1314
- return (S = k.disabledMeasurements) == null ? void 0 : S.includes(C.id);
1315
- }),
1316
- "onUpdate:modelValue"(C) {
1317
- var S;
1318
- if (console.log("active", C), C)
1319
- p.updateItem({
1320
- ...k,
1321
- disabledMeasurements: (S = k.disabledMeasurements) == null ? void 0 : S.filter(
1322
- (_) => _ !== t.id
1323
- )
1324
- });
1325
- else {
1326
- const _ = k.disabledMeasurements ?? [];
1327
- p.updateItem({
1328
- ...k,
1329
- disabledMeasurements: [..._, t.id]
1330
- });
1331
- }
1332
- }
1333
- }),
1334
- P(
1335
- H.FmTooltip,
1336
- { zIndex: 51 },
1337
- {
1338
- content() {
1339
- return t.abbrev;
1340
- },
1341
- default() {
1342
- return P(
1343
- "div",
1344
- { class: "line-clamp-2 fm-typo-en-body-lg-400" },
1345
- t.abbrev
1346
- );
1347
- }
1348
- }
1349
- )
1350
- ]
1351
- )
1352
- ) : null;
1353
- })
1354
- ]);
1355
- }
1356
- }
1357
- ];
1358
- }),
1359
- missingSKUs: f
1360
- };
1361
- }
1362
- const Qt = { class: "flex flex-col gap-16" }, Xt = { class: "flex items-center" }, Zt = { class: "flex-1 gap-8 fm-typo-en-title-sm-600" }, en = {
1363
- key: 0,
1364
- class: "flex flex-col gap-8 p-16 bg-fm-color-system-warning-100 border border-fm-color-system-warning-400 rounded-lg"
1365
- }, tn = { class: "fm-typo-en-title-xs-600 text-fm-color-system-warning-400 flex items-center gap-8" }, nn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary" }, sn = { class: "list-disc pl-20 mt-8" }, on = /* @__PURE__ */ G({
1366
- __name: "WastageTemplateItemTable",
1367
- props: {
1368
- modelValue: {},
1369
- disabled: { type: Boolean }
1370
- },
1371
- emits: ["update:modelValue"],
1372
- setup(p, { expose: l, emit: m }) {
1373
- const f = p, d = D(f.modelValue), { t: r } = J(), c = m, s = te(), n = Z(), o = D(), u = D("");
1374
- l({
1375
- validateInputs: () => {
1376
- var b, t;
1377
- (t = (b = o.value) == null ? void 0 : b.validateInputs) == null || t.call(b);
1378
- },
1379
- resetInputsValidation: () => {
1380
- var b, t;
1381
- (t = (b = o.value) == null ? void 0 : b.resetInputsValidation) == null || t.call(b);
1382
- },
1383
- resetInputs: () => {
1384
- var b, t;
1385
- (t = (b = o.value) == null ? void 0 : b.resetInputs) == null || t.call(b);
1386
- }
1387
- });
1388
- const h = qt({
1389
- updateItem: (b) => {
1390
- d.value = d.value.map((t) => t.id !== b.id ? t : b), c("update:modelValue", w.value);
1391
- },
1392
- deleteItem: (b) => {
1393
- d.value = d.value.filter((t) => t.id !== b.id), c("update:modelValue", w.value);
1394
- },
1395
- get items() {
1396
- return d.value;
1397
- },
1398
- get disabled() {
1399
- return f.disabled;
1400
- }
1401
- }), y = U(() => h.columnDefs.value), T = U(() => h.missingSKUs.value), w = U(() => {
1402
- const b = new Set(T.value.map((t) => t.id));
1403
- return d.value.filter((t) => !b.has(t.id));
1404
- });
1405
- pe(
1406
- () => w.value,
1407
- (b, t) => {
1408
- T.value.length > 0 && JSON.stringify(b) !== JSON.stringify(t) && c("update:modelValue", b);
1409
- },
1410
- { immediate: !0 }
1411
- );
1412
- function k() {
1413
- var S;
1414
- const b = s.skus.map((_) => {
1415
- var F, R;
1416
- return {
1417
- type: "sku",
1418
- name: _.name,
1419
- description: _.code,
1420
- data: _,
1421
- searchKeys: (F = _.customAttributes) != null && F.tag ? [(R = _.customAttributes) == null ? void 0 : R.tag] : void 0
1422
- };
1423
- }), t = s.recipes.map((_) => {
1424
- var F, R;
1425
- return {
1426
- type: "recipe",
1427
- name: _.name,
1428
- description: "",
1429
- data: _,
1430
- searchKeys: (F = _.customAttributes) != null && F.tag ? [(R = _.customAttributes) == null ? void 0 : R.tag] : void 0
1431
- };
1432
- }), a = ((S = s.menu.cache) == null ? void 0 : S.modules.item.map((_) => ({
1433
- type: "menu",
1434
- name: _.name,
1435
- description: `${_.code}`,
1436
- data: _
1437
- }))) ?? [], e = [...b, ...t, ...a].map((_) => {
1438
- var R;
1439
- const F = [_.type == "sku" ? "Ingredient" : _.type == "recipe" ? "Recipe" : "Menu"];
1440
- if (_.type == "sku" || _.type == "recipe") {
1441
- const j = (R = _.data.customAttributes) == null ? void 0 : R.tag;
1442
- j && F.push(j);
1443
- }
1444
- return {
1445
- label: _.name,
1446
- sublabel: _.description,
1447
- value: _,
1448
- tags: F,
1449
- searchKeys: _.searchKeys
1450
- };
1451
- }), i = /* @__PURE__ */ new Set();
1452
- e.forEach((_) => {
1453
- _.tags && _.tags.forEach((F) => {
1454
- i.add(F);
1455
- });
1456
- });
1457
- const g = i.size > 0 ? [
1458
- {
1459
- type: "string",
1460
- key: "tags",
1461
- entity: "item",
1462
- values: Array.from(i)
1463
- }
1464
- ] : [], C = e.filter((_) => d.value.find((F) => F.id === _.value.data._id)).map((_) => _.value);
1465
- n.open({
1466
- title: r("inventory.closing.form.items.selectItem"),
1467
- closeButton: !0,
1468
- contentComponent: bt,
1469
- contentComponentProps: {
1470
- modelValue: C,
1471
- items: e,
1472
- virtualScroll: !0,
1473
- filterAttributes: g
1474
- },
1475
- primaryActions: {
1476
- text: r("common.confirm"),
1477
- close: !0
1478
- },
1479
- secondaryActions: {
1480
- text: r("common.close"),
1481
- close: !0,
1482
- variant: "tertiary"
1483
- }
1484
- }).onPrimary((_) => {
1485
- const F = d.value ?? [], R = _.map((L) => {
1486
- const j = F.find((oe) => oe.id === L.data._id);
1487
- return j ? {
1488
- ...j
1489
- } : {
1490
- id: L.data._id,
1491
- name: L.name,
1492
- code: L.description,
1493
- type: L.type,
1494
- disabledMeasurements: []
1495
- };
1496
- });
1497
- R.sort((L, j) => L.name.localeCompare(j.name)), console.log(d.value), d.value = R, c("update:modelValue", w.value);
1498
- });
1499
- }
1500
- return (b, t) => {
1501
- const a = E("FmButton"), e = E("FmIcon"), i = E("FmTextField"), g = E("FmTable"), C = E("FmFormGroup");
1502
- return $(), M("div", Qt, [
1503
- v("div", Xt, [
1504
- v("div", Zt, A(x(r)("inventory.closing.form.items.title")), 1),
1505
- I(a, {
1506
- disabled: b.disabled,
1507
- label: x(r)("inventory.closing.form.items.addItem"),
1508
- "prepend-icon": "add",
1509
- variant: "plain",
1510
- class: "border-2 rounded-lg border-fm-color-primary",
1511
- onClick: t[0] || (t[0] = (S) => k()),
1512
- size: "md"
1513
- }, null, 8, ["disabled", "label"])
1514
- ]),
1515
- T.value.length > 0 ? ($(), M("div", en, [
1516
- v("div", tn, [
1517
- I(e, {
1518
- name: "warning",
1519
- size: "sm"
1520
- }),
1521
- t[3] || (t[3] = v("span", null, "Invalid items", -1))
1522
- ]),
1523
- v("div", nn, [
1524
- X(" The following " + A(T.value.length) + " item(s) no longer exist in the system and have been excluded: ", 1),
1525
- v("ul", sn, [
1526
- ($(!0), M(K, null, Q(T.value, (S) => ($(), M("li", {
1527
- key: S.id
1528
- }, "(" + A(S.code) + ") " + A(S.name), 1))), 128))
1529
- ])
1530
- ])
1531
- ])) : z("", !0),
1532
- I(i, {
1533
- placeholder: "Filter items",
1534
- modelValue: u.value,
1535
- "onUpdate:modelValue": t[2] || (t[2] = (S) => u.value = S)
1536
- }, Ue({ _: 2 }, [
1537
- u.value ? {
1538
- name: "append",
1539
- fn: V(() => [
1540
- I(e, {
1541
- name: "close",
1542
- onClick: t[1] || (t[1] = (S) => u.value = ""),
1543
- class: "cursor-pointer"
1544
- })
1545
- ]),
1546
- key: "0"
1547
- } : void 0
1548
- ]), 1032, ["modelValue"]),
1549
- ($(), O(g, {
1550
- "search-value": u.value,
1551
- "column-defs": y.value,
1552
- "row-data": w.value,
1553
- key: w.value.map((S) => S.id).join("."),
1554
- "hide-footer": w.value.length <= 10,
1555
- "page-size": Math.min(10, w.value.length)
1556
- }, null, 8, ["search-value", "column-defs", "row-data", "hide-footer", "page-size"])),
1557
- I(C, {
1558
- "model-value": w.value.length,
1559
- rules: [x(yt)(1)]
1560
- }, null, 8, ["model-value", "rules"])
1561
- ]);
1562
- };
1563
- }
1564
- }), an = { class: "flex flex-col gap-16" }, ln = { class: "flex flex-col gap-24" }, rn = { class: "flex flex-col gap-16" }, un = { class: "flex items-center" }, mn = { class: "flex-1 fm-typo-en-title-sm-600" }, cn = /* @__PURE__ */ G({
1565
- __name: "WastageTemplateForm",
1566
- props: {
1567
- modelValue: {},
1568
- disabled: { type: Boolean }
1569
- },
1570
- setup(p, { expose: l }) {
1571
- const m = ht(), { t: f } = J(), {
1572
- promptSelectLocations: d,
1573
- columnDefs: r,
1574
- rowData: c
1575
- } = gt({
1576
- getLocations() {
1577
- return m.locations;
1578
- },
1579
- setLocations(n) {
1580
- m.locations = n;
1581
- }
1582
- }), s = D();
1583
- return l({
1584
- validateInputs: () => {
1585
- var n, o;
1586
- (o = (n = s.value) == null ? void 0 : n.validateInputs) == null || o.call(n);
1587
- },
1588
- resetInputsValidation: () => {
1589
- var n, o;
1590
- (o = (n = s.value) == null ? void 0 : n.resetInputsValidation) == null || o.call(n);
1591
- },
1592
- resetInputs: () => {
1593
- var n, o;
1594
- (o = (n = s.value) == null ? void 0 : n.resetInputs) == null || o.call(n);
1595
- }
1596
- }), (n, o) => {
1597
- const u = E("FmTextField"), h = E("FmButton"), y = E("FmTable"), T = E("FmForm");
1598
- return $(), O(T, {
1599
- ref_key: "formRef",
1600
- ref: s,
1601
- class: "flex flex-col gap-32",
1602
- disabled: n.disabled
1603
- }, {
1604
- default: V(() => [
1605
- v("div", an, [
1606
- v("div", ln, [
1607
- I(u, {
1608
- label: x(f)("inventory.closing.form.name"),
1609
- "label-mark": "required",
1610
- modelValue: x(m).name,
1611
- "onUpdate:modelValue": o[0] || (o[0] = (w) => x(m).name = w),
1612
- rules: [x(Ge)()]
1613
- }, null, 8, ["label", "modelValue", "rules"])
1614
- ])
1615
- ]),
1616
- v("div", rn, [
1617
- v("div", un, [
1618
- v("div", mn, A(x(f)("inventory.closing.form.locations")), 1),
1619
- I(h, {
1620
- disabled: n.disabled,
1621
- label: x(f)("inventory.closing.form.selectLocation"),
1622
- "prepend-icon": "add",
1623
- variant: "plain",
1624
- class: "border-2 rounded-lg border-fm-color-primary",
1625
- onClick: x(d)
1626
- }, null, 8, ["disabled", "label", "onClick"])
1627
- ]),
1628
- I(y, {
1629
- "column-defs": x(r),
1630
- "row-data": x(c),
1631
- "shrink-at": 9999,
1632
- onRowClick: x(d),
1633
- "hide-footer": ""
1634
- }, null, 8, ["column-defs", "row-data", "onRowClick"])
1635
- ]),
1636
- I(on, {
1637
- "model-value": x(m).items,
1638
- "onUpdate:modelValue": o[1] || (o[1] = (w) => x(m).items = w)
1639
- }, null, 8, ["model-value"])
1640
- ]),
1641
- _: 1
1642
- }, 8, ["disabled"]);
1643
- };
1644
- }
1645
- }), dn = { class: "flex items-center" }, pn = { class: "fm-typo-en-title-md-600" }, fn = { class: "flex justify-between" }, vn = { class: "fm-typo-en-body-lg-600" }, yn = { class: "flex flex-col gap-8" }, hn = { class: "flex flex-col gap-4" }, gn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, bn = { class: "flex items-center gap-8" }, _n = { class: "fm-typo-en-body-lg-600" }, xn = { class: "flex gap-4" }, wn = /* @__PURE__ */ G({
1646
- __name: "WastageTemplateDialog",
1647
- props: {
1648
- mode: {},
1649
- modelValue: {},
1650
- show: { type: Boolean }
1651
- },
1652
- emits: ["update:show", "submitted"],
1653
- setup(p, { expose: l, emit: m }) {
1654
- var e;
1655
- const f = p, d = m, r = ne(), c = ee(), { t: s } = J(), n = Be(f, "show");
1656
- function o() {
1657
- return {
1658
- _id: "",
1659
- name: "",
1660
- type: fe.Enum.WASTAGE,
1661
- items: []
1662
- };
1663
- }
1664
- const u = D(f.modelValue ?? o()), h = D(((e = f.modelValue) == null ? void 0 : e._id) ?? `${Math.random()}`);
1665
- pe(
1666
- () => f.show,
1667
- (i) => {
1668
- var g;
1669
- i && (u.value = f.modelValue ?? o(), h.value = ((g = f.modelValue) == null ? void 0 : g._id) ?? `${Math.random()}`);
1670
- }
1671
- );
1672
- const y = D(!1), T = U(() => {
1673
- switch (f.mode) {
1674
- case q.READ:
1675
- return "";
1676
- case q.CREATE:
1677
- return s("inventory.adjustment.template.create.title");
1678
- case q.UPDATE:
1679
- return s("inventory.adjustment.template.update.title");
1680
- }
1681
- return "";
1682
- }), w = D();
1683
- l({
1684
- validateInputs: () => {
1685
- var i, g;
1686
- (g = (i = w.value) == null ? void 0 : i.validateInputs) == null || g.call(i);
1687
- },
1688
- resetInputsValidation: () => {
1689
- var i, g;
1690
- (g = (i = w.value) == null ? void 0 : i.resetInputsValidation) == null || g.call(i);
1691
- },
1692
- resetInputs: () => {
1693
- var i, g;
1694
- (g = (i = w.value) == null ? void 0 : i.resetInputs) == null || g.call(i);
1695
- }
1696
- });
1697
- async function k() {
1698
- const i = u.value;
1699
- if (i) {
1700
- y.value = !0;
1701
- try {
1702
- await r.createTemplate(i), await new Promise((g) => setTimeout(g, 1e3)), c.open({
1703
- title: s("inventory.adjustment.template.create.success"),
1704
- message: s("inventory.adjustment.template.create.successMessage"),
1705
- type: "success"
1706
- }), d("update:show", !1), d("submitted");
1707
- } catch (g) {
1708
- c.open({
1709
- title: s("inventory.adjustment.template.create.error"),
1710
- message: s("inventory.adjustment.template.create.errorMessage"),
1711
- type: "error"
1712
- }), console.error("Error in creating adjustment template", g);
1713
- } finally {
1714
- y.value = !1;
1715
- }
1716
- }
1717
- }
1718
- async function b() {
1719
- const i = u.value;
1720
- if (i) {
1721
- y.value = !0;
1722
- try {
1723
- await r.updateTemplate({
1724
- ...i,
1725
- _rev: i._rev ?? ""
1726
- }), await new Promise((g) => setTimeout(g, 1e3)), c.open({
1727
- title: s("inventory.adjustment.template.update.success"),
1728
- message: s("inventory.adjustment.template.update.successMessage"),
1729
- type: "success"
1730
- }), d("update:show", !1), d("submitted");
1731
- } catch (g) {
1732
- c.open({
1733
- title: s("inventory.adjustment.template.update.error"),
1734
- message: s("inventory.adjustment.template.update.errorMessage"),
1735
- type: "error"
1736
- }), console.error("Error in updating adjustment template", g);
1737
- } finally {
1738
- y.value = !1;
1739
- }
1740
- }
1741
- }
1742
- function t() {
1743
- switch (f.mode) {
1744
- case q.CREATE:
1745
- return k();
1746
- case q.UPDATE:
1747
- return b();
1748
- }
1749
- }
1750
- function a() {
1751
- var i, g;
1752
- (g = (i = w.value) == null ? void 0 : i.validateInputs) == null || g.call(i);
1753
- }
1754
- return (i, g) => {
1755
- const C = E("FmMenuDivider"), S = E("FmCard"), _ = E("FmButton"), F = E("FmSideSheet");
1756
- return $(), O(F, {
1757
- modelValue: x(n),
1758
- "onUpdate:modelValue": g[2] || (g[2] = (R) => Le(n) ? n.value = R : null),
1759
- "dismiss-away": "",
1760
- "close-button": "",
1761
- "max-width": 800
1762
- }, {
1763
- "side-sheet-header": V(() => [
1764
- v("div", dn, [
1765
- v("div", pn, A(T.value), 1)
1766
- ])
1767
- ]),
1768
- default: V(() => [
1769
- u.value.updatedAt ? ($(), M(K, { key: 0 }, [
1770
- u.value.updatedAt ? ($(), O(S, {
1771
- key: 0,
1772
- variant: "outlined",
1773
- class: "flex flex-col gap-8 px-12 py-16 mb-16"
1774
- }, {
1775
- default: V(() => {
1776
- var R;
1777
- return [
1778
- v("div", fn, [
1779
- v("div", vn, A(x(s)("inventory.transfer.template.details.templateSummary")), 1)
1780
- ]),
1781
- I(C),
1782
- v("div", yn, [
1783
- v("div", hn, [
1784
- v("div", gn, A(x(s)("inventory.transfer.receiveRequest.details.updatedAt")), 1),
1785
- v("div", bn, [
1786
- v("div", _n, [
1787
- X(A(x(de)(u.value.updatedAt)) + " ", 1),
1788
- (R = u.value.updatedBy) != null && R.name ? ($(), M(K, { key: 0 }, [
1789
- X(" (" + A(u.value.updatedBy.name) + ") ", 1)
1790
- ], 64)) : z("", !0)
1791
- ]),
1792
- I(_t, {
1793
- "adjustment-id": u.value._id
1794
- }, null, 8, ["adjustment-id"])
1795
- ])
1796
- ])
1797
- ])
1798
- ];
1799
- }),
1800
- _: 1
1801
- })) : z("", !0)
1802
- ], 64)) : z("", !0),
1803
- ($(), O(cn, {
1804
- class: "w-full",
1805
- ref_key: "formRef",
1806
- ref: w,
1807
- onValidationSuccess: t,
1808
- "model-value": u.value,
1809
- "onUpdate:modelValue": g[0] || (g[0] = (R) => u.value = R),
1810
- disabled: y.value,
1811
- key: h.value
1812
- }, null, 8, ["model-value", "disabled"]))
1813
- ]),
1814
- "side-sheet-footer": V(() => [
1815
- v("div", xn, [
1816
- I(_, {
1817
- loading: y.value,
1818
- label: x(s)("common.save"),
1819
- onClick: a
1820
- }, null, 8, ["loading", "label"]),
1821
- I(_, {
1822
- disabled: y.value,
1823
- variant: "tertiary",
1824
- label: x(s)("common.close"),
1825
- onClick: g[1] || (g[1] = (R) => d("update:show", !1))
1826
- }, null, 8, ["disabled", "label"])
1827
- ])
1828
- ]),
1829
- _: 1
1830
- }, 8, ["modelValue"]);
1831
- };
1832
- }
1833
- }), Tn = {};
1834
- function kn(p, l) {
1835
- return $(), M("div");
1836
- }
1837
- const $n = /* @__PURE__ */ xt(Tn, [["render", kn]]), Sn = { class: "flex flex-col gap-40" }, In = { key: 0 }, Fn = {
1838
- key: 1,
1839
- class: "flex gap-8 items-center"
1840
- }, Cn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary" }, An = {
1841
- key: 2,
1842
- class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary"
1843
- }, Mn = {
1844
- key: 3,
1845
- class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary flex flex-col gap-12"
1846
- }, Rn = { class: "fm-typo-en-body-md-600" }, Dn = { class: "fm-typo-en-body-md-600" }, En = { key: 4 }, Pn = { class: "fm-typo-en-body-md-600" }, Vn = { class: "fm-typo-en-body-md-600" }, jn = { class: "flex sm:flex-col xs:flex-col justify-end gap-8 w-full mb-16" }, Un = /* @__PURE__ */ G({
1847
- __name: "WastageTemplatePublish",
1848
- emits: ["close"],
1849
- setup(p, { emit: l }) {
1850
- const m = D(!1), f = ee(), d = ne(), r = se(), { t: c } = J(), s = l;
1851
- async function n() {
1852
- m.value = !0;
1853
- try {
1854
- await d.startNewPublish().delayed(1e3), f.open({
1855
- title: "Success",
1856
- message: "You may refresh after a while to review publish status",
1857
- type: "success"
1858
- }), h();
1859
- } catch (y) {
1860
- f.open({
1861
- title: "Something went wrong",
1862
- message: "Please try again",
1863
- type: "error"
1864
- }), console.error("error on creating publish task", y);
1865
- } finally {
1866
- m.value = !1;
1867
- }
1868
- }
1869
- const o = U(() => r.recentPublish.recentJob), u = U(
1870
- () => r.templates.length && (!o.value || o.value.outlets.length === o.value.completed.length)
1871
- );
1872
- function h() {
1873
- s("close");
1874
- }
1875
- return (y, T) => {
1876
- const w = E("FmCircularProgress"), k = E("i18n-t"), b = E("FmButton");
1877
- return $(), M("div", Sn, [
1878
- x(r).templates.length ? m.value ? ($(), M("div", Fn, [
1879
- v("div", null, [
1880
- I(w, {
1881
- size: "md",
1882
- color: "neutral-gray-300"
1883
- })
1884
- ]),
1885
- v("div", Cn, [
1886
- v("span", null, A(x(c)("inventory.adjustment.template.publish.publishing")), 1)
1887
- ])
1888
- ])) : o.value ? o.value.outlets.length === o.value.completed.length ? ($(), M("div", Mn, [
1889
- I(k, {
1890
- keypath: "inventory.adjustment.template.publish.recentlyPublishedAt",
1891
- tag: "p"
1892
- }, {
1893
- started: V(() => [
1894
- v("span", Rn, A(x(de)(new Date(o.value.createdAt))), 1)
1895
- ]),
1896
- finished: V(() => [
1897
- v("span", Dn, A(x(de)(new Date(o.value.updatedAt))), 1)
1898
- ]),
1899
- _: 1
1900
- }),
1901
- v("p", null, A(x(c)("inventory.adjustment.template.publish.message")), 1)
1902
- ])) : ($(), M("div", En, [
1903
- I(k, {
1904
- keypath: "inventory.adjustment.template.publish.stillPublishing",
1905
- tag: "p"
1906
- }, {
1907
- started: V(() => [
1908
- v("span", Pn, A(x(de)(new Date(o.value.createdAt))), 1)
1909
- ]),
1910
- progress: V(() => [
1911
- v("span", Vn, " (" + A(o.value.completed.length) + "/" + A(o.value.outlets.length) + " completed) ", 1)
1912
- ]),
1913
- _: 1
1914
- }),
1915
- X(" Your recent publishing task is still pending (" + A(o.value.completed.length) + " / " + A(o.value.outlets.length) + "). Please wait until all publishing task has completed. ", 1)
1916
- ])) : ($(), M("div", An, [
1917
- v("p", null, A(x(c)("inventory.adjustment.template.publish.noRecentActivity")), 1),
1918
- v("p", null, A(x(c)("inventory.adjustment.template.publish.message")), 1)
1919
- ])) : ($(), M("div", In, [
1920
- v("p", null, A(x(c)("inventory.adjustment.template.publish.nothingToPublish")), 1)
1921
- ])),
1922
- v("div", jn, [
1923
- I(b, {
1924
- disabled: !u.value,
1925
- loading: m.value,
1926
- label: "Publish to all outlets",
1927
- onClick: n
1928
- }, null, 8, ["disabled", "loading"]),
1929
- I(b, {
1930
- variant: "tertiary",
1931
- label: "Close",
1932
- onClick: h
1933
- })
1934
- ])
1935
- ]);
1936
- };
1937
- }
1938
- }), Ln = { class: "flex flex-col gap-16" }, Nn = { class: "flex" }, Bn = { class: "flex gap-24" }, zn = { class: "flex" }, On = { class: "flex-1" }, Wn = { class: "flex" }, Hn = { class: "flex gap-8 items-center justify-start" }, Kn = /* @__PURE__ */ G({
1939
- __name: "WastageTemplateReason",
1940
- props: {
1941
- show: { type: Boolean }
1942
- },
1943
- emits: ["update:show", "submitted"],
1944
- setup(p, { emit: l }) {
1945
- const m = p, f = Be(m, "show"), d = D(""), r = ee(), c = Z(), s = D([]), n = l, o = se(), u = ne(), h = D(!1);
1946
- pe(
1947
- () => m.show,
1948
- (t) => {
1949
- var a;
1950
- t && (s.value = ((a = o.reasons) == null ? void 0 : a.value) ?? []);
1951
- }
1952
- );
1953
- const y = (t) => {
1954
- if (s.value.indexOf(s.value[t]) === -1)
1955
- return;
1956
- const a = s.value[t];
1957
- if (a.trim() === "") {
1958
- s.value.splice(t, 1);
1959
- return;
1960
- }
1961
- c.open({
1962
- title: "Delete reason",
1963
- message: `Are you sure you want to delete this reason? "${a}"`,
1964
- primaryActions: {
1965
- text: "Delete",
1966
- close: !0,
1967
- variant: "destructive"
1968
- },
1969
- secondaryActions: {
1970
- text: "Cancel",
1971
- close: !0,
1972
- variant: "secondary"
1973
- }
1974
- }).onPrimary(() => {
1975
- s.value.splice(t, 1);
1976
- });
1977
- }, T = () => {
1978
- s.value.push("");
1979
- const t = d.value.trim();
1980
- if (t) {
1981
- if (s.value.some((a) => a === t)) {
1982
- r.open({
1983
- title: "Reason already exists",
1984
- message: "Please enter a different reason",
1985
- type: "error"
1986
- });
1987
- return;
1988
- }
1989
- d.value = "";
1990
- }
1991
- }, w = async () => {
1992
- const t = s.value.map((a) => a.trim()).filter((a) => a);
1993
- if (o.reasons) {
1994
- h.value = !0;
1995
- try {
1996
- await u.update({
1997
- _id: o.reasons._id,
1998
- _rev: o.reasons._rev,
1999
- value: t
2000
- }), r.open({
2001
- title: "Reasons updated",
2002
- message: "Reasons have been updated successfully",
2003
- type: "success"
2004
- }), n("update:show", !1), n("submitted");
2005
- } catch {
2006
- r.open({
2007
- title: "Error updating reasons",
2008
- message: "There was an error updating reasons",
2009
- type: "error"
2010
- });
2011
- } finally {
2012
- h.value = !1;
2013
- }
2014
- }
2015
- }, k = D(), b = () => {
2016
- var t, a;
2017
- (a = (t = k.value) == null ? void 0 : t.validateInputs) == null || a.call(t);
2018
- };
2019
- return (t, a) => {
2020
- const e = E("FmButton"), i = E("FmAvatar"), g = E("FmTextField"), C = E("FmList"), S = E("FmForm"), _ = E("FmSideSheet");
2021
- return $(), O(_, {
2022
- modelValue: x(f),
2023
- "onUpdate:modelValue": a[0] || (a[0] = (F) => Le(f) ? f.value = F : null),
2024
- header: "Reason for wastage",
2025
- "close-button": "",
2026
- "dismiss-away": !h.value,
2027
- "max-width": 500
2028
- }, {
2029
- default: V(() => [
2030
- I(S, {
2031
- ref_key: "formRef",
2032
- ref: k,
2033
- class: "flex flex-col gap-32",
2034
- blameFormChildOnValidationFailed: "",
2035
- onValidationSuccess: w
2036
- }, {
2037
- default: V(() => [
2038
- v("div", Ln, [
2039
- v("div", Nn, [
2040
- I(e, {
2041
- class: "ml-auto px-5",
2042
- variant: "primary",
2043
- label: "Add new reason",
2044
- size: "md",
2045
- onClick: T
2046
- })
2047
- ])
2048
- ]),
2049
- v("div", Bn, [
2050
- I(C, {
2051
- class: "w-full",
2052
- separator: ""
2053
- }, {
2054
- default: V(() => [
2055
- ($(!0), M(K, null, Q(s.value, (F, R) => ($(), M("div", {
2056
- key: R,
2057
- class: "flex items-center gap-8 px-1 py-2"
2058
- }, [
2059
- v("div", zn, [
2060
- I(i, {
2061
- initials: String(R + 1),
2062
- size: "sm"
2063
- }, null, 8, ["initials"])
2064
- ]),
2065
- v("div", On, [
2066
- I(g, {
2067
- class: "cursor-pointer text-fm-color-typo-tertiary",
2068
- modelValue: s.value[R],
2069
- "onUpdate:modelValue": (L) => s.value[R] = L,
2070
- maxLength: 500,
2071
- rules: [x(Ge)()]
2072
- }, null, 8, ["modelValue", "onUpdate:modelValue", "rules"])
2073
- ]),
2074
- v("div", Wn, [
2075
- I(e, {
2076
- variant: "tertiary",
2077
- size: "md",
2078
- "prepend-icon": "delete",
2079
- onClick: (L) => y(R)
2080
- }, null, 8, ["onClick"])
2081
- ])
2082
- ]))), 128))
2083
- ]),
2084
- _: 1
2085
- })
2086
- ])
2087
- ]),
2088
- _: 1
2089
- }, 512)
2090
- ]),
2091
- "side-sheet-footer": V(() => [
2092
- v("div", Hn, [
2093
- I(e, {
2094
- variant: "primary",
2095
- label: "Save",
2096
- size: "lg",
2097
- onClick: b,
2098
- disabled: h.value,
2099
- loading: h.value
2100
- }, null, 8, ["disabled", "loading"]),
2101
- I(e, {
2102
- variant: "secondary",
2103
- label: "Close",
2104
- size: "lg"
2105
- })
2106
- ])
2107
- ]),
2108
- _: 1
2109
- }, 8, ["modelValue", "dismiss-away"]);
2110
- };
2111
- }
2112
- }), Yn = { class: "flex items-center gap-5" }, Gn = { class: "flex items-center gap-2" }, Jn = { class: "flex-1 flex flex-col gap-8" }, qn = { class: "flex flex-col" }, Qn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Xn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Zn = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, $s = /* @__PURE__ */ G({
2113
- __name: "WastageTemplateView",
2114
- setup(p) {
2115
- const { t: l } = J(), { createTemplate: m, updateTemplate: f, exportTemplates: d, importTemplates: r, viewReason: c } = ye(), { templateDialogProps: s, templateDetailsProps: n, templateReasonProps: o } = Oe(
2116
- ye()
2117
- ), u = he(), h = Z(), y = se(), T = tt(), { breakpoints: w } = at();
2118
- u.watchLocation(y.fetchTemplates);
2119
- const k = U(() => y.loading), b = D(""), t = U(() => w.value.xs || w.value.sm), a = U(() => t.value ? 10 : 20);
2120
- function e(_) {
2121
- switch (_) {
2122
- case B.Add:
2123
- return m();
2124
- case "publish":
2125
- return i();
2126
- case "import":
2127
- return r();
2128
- case "export":
2129
- return d();
2130
- case "refresh":
2131
- return y.fetchTemplates();
2132
- }
2133
- }
2134
- function i() {
2135
- h.open({
2136
- title: "Publish wastage templates",
2137
- contentComponent: Un,
2138
- contentComponentProps: {
2139
- onClose() {
2140
- h.close();
2141
- }
2142
- }
2143
- });
2144
- }
2145
- function g(_) {
2146
- return _;
2147
- }
2148
- const C = U(() => t.value ? [
2149
- {
2150
- label: l("inventory.adjustment.template.create.title"),
2151
- value: B.Add,
2152
- isPrimary: !0,
2153
- prependIcon: "add"
2154
- },
2155
- {
2156
- label: l("inventory.common.refresh"),
2157
- value: "refresh",
2158
- isPrimary: !1
2159
- },
2160
- {
2161
- label: l("inventory.common.publish"),
2162
- value: "publish",
2163
- isPrimary: !1
2164
- },
2165
- {
2166
- label: l("inventory.common.import"),
2167
- value: "import",
2168
- isPrimary: !1
2169
- },
2170
- {
2171
- label: l("inventory.common.export"),
2172
- value: "export",
2173
- isPrimary: !1
2174
- }
2175
- ] : [
2176
- {
2177
- label: l("inventory.adjustment.template.create.title"),
2178
- value: B.Add,
2179
- isPrimary: !0,
2180
- prependIcon: "add"
2181
- },
2182
- {
2183
- label: l("inventory.common.publish"),
2184
- value: "publish",
2185
- isPrimary: !1
2186
- },
2187
- {
2188
- label: l("inventory.common.import"),
2189
- value: "import",
2190
- isPrimary: !1
2191
- },
2192
- {
2193
- label: l("inventory.common.refresh"),
2194
- value: "refresh",
2195
- isPrimary: !1
2196
- },
2197
- {
2198
- label: l("inventory.common.export"),
2199
- value: "export",
2200
- isPrimary: !1
2201
- }
2202
- ]), S = () => {
2203
- c();
2204
- };
2205
- return (_, F) => {
2206
- const R = E("FmButton"), L = E("FmTable");
2207
- return $(), M(K, null, [
2208
- I(nt, {
2209
- title: x(l)("inventory.adjustment.template.wastage.title"),
2210
- actions: C.value,
2211
- "onClick:action": e
2212
- }, {
2213
- default: V(() => [
2214
- v("div", {
2215
- class: Y([
2216
- "flex flex-col gap-8 max-h-full",
2217
- {
2218
- "p-0": t.value,
2219
- "px-24 ": !t.value
2220
- }
2221
- ])
2222
- }, [
2223
- v("div", Yn, [
2224
- I(R, {
2225
- class: "ml-auto",
2226
- "prepend-icon": "edit",
2227
- key: "Reason for wastage",
2228
- label: "Default label",
2229
- "bg-color": "neutral-gray-100",
2230
- "text-color": "neutral-gray-400",
2231
- onClick: S
2232
- }, {
2233
- default: V(() => [
2234
- v("div", Gn, [
2235
- F[4] || (F[4] = v("span", null, "Reasons", -1)),
2236
- v("div", {
2237
- class: Y([
2238
- "fm-status-badge",
2239
- x(y).isReasonPublished() ? "fm-status-badge-success-secondary" : "fm-status-badge-info-secondary"
2240
- ])
2241
- }, A(x(y).isReasonPublished() ? "Published" : "Unpublished"), 3)
2242
- ])
2243
- ]),
2244
- _: 1
2245
- }),
2246
- I(st, {
2247
- class: "flex-1",
2248
- searchable: "",
2249
- search: b.value,
2250
- "onUpdate:search": F[0] || (F[0] = (j) => b.value = j)
2251
- }, null, 8, ["search"])
2252
- ]),
2253
- I(L, {
2254
- style: Qe(x(T).tableHeight),
2255
- "column-defs": x(y).columnDefs,
2256
- "row-data": x(y).templates,
2257
- "search-value": b.value,
2258
- loading: k.value,
2259
- onRowClick: F[1] || (F[1] = (j) => x(f)(j.original)),
2260
- "page-size": a.value
2261
- }, {
2262
- "list-row": V((j) => [
2263
- I(lt, {
2264
- row: j,
2265
- onRowClick: (W) => x(f)(W)
2266
- }, {
2267
- default: V((W) => {
2268
- var oe, be, _e, ae, xe, we, Te, ke, le, $e, Se, Ie, Fe, Ce, Ae, re, Me, Re, De, Ee, ie, Pe;
2269
- return [
2270
- v("div", Jn, [
2271
- v("div", qn, [
2272
- v("div", Qn, [
2273
- I(x(ce), {
2274
- render: (_e = (be = (oe = W._id) == null ? void 0 : oe.column) == null ? void 0 : be.columnDef) == null ? void 0 : _e.cell,
2275
- props: (xe = (ae = W._id) == null ? void 0 : ae.getContext) == null ? void 0 : xe.call(ae)
2276
- }, null, 8, ["render", "props"])
2277
- ]),
2278
- v("div", Xn, [
2279
- I(x(ce), {
2280
- render: (ke = (Te = (we = W.name) == null ? void 0 : we.column) == null ? void 0 : Te.columnDef) == null ? void 0 : ke.cell,
2281
- props: ($e = (le = W.name) == null ? void 0 : le.getContext) == null ? void 0 : $e.call(le)
2282
- }, null, 8, ["render", "props"])
2283
- ]),
2284
- v("div", null, A((Se = j.original.locations) != null && Se.length ? x(l)("inventory.adjustment.template.table.enabledForN", {
2285
- count: ((Ie = j.original.locations) == null ? void 0 : Ie.length) ?? 0
2286
- }) : x(l)("inventory.adjustment.template.table.enabledForAll")), 1),
2287
- F[5] || (F[5] = v("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, null, -1)),
2288
- v("div", Zn, [
2289
- I(x(ce), {
2290
- render: (Ae = (Ce = (Fe = W.ref) == null ? void 0 : Fe.column) == null ? void 0 : Ce.columnDef) == null ? void 0 : Ae.cell,
2291
- props: (Me = (re = W.ref) == null ? void 0 : re.getContext) == null ? void 0 : Me.call(re)
2292
- }, null, 8, ["render", "props"])
2293
- ])
2294
- ]),
2295
- v("div", null, [
2296
- I(x(ce), {
2297
- render: (Ee = (De = (Re = W.status) == null ? void 0 : Re.column) == null ? void 0 : De.columnDef) == null ? void 0 : Ee.cell,
2298
- props: (Pe = (ie = W.status) == null ? void 0 : ie.getContext) == null ? void 0 : Pe.call(ie)
2299
- }, null, 8, ["render", "props"])
2300
- ])
2301
- ])
2302
- ];
2303
- }),
2304
- _: 2
2305
- }, 1032, ["row", "onRowClick"])
2306
- ]),
2307
- _: 1
2308
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
2309
- ], 2)
2310
- ]),
2311
- _: 1
2312
- }, 8, ["title", "actions"]),
2313
- ($(), O(Xe, { to: "body" }, [
2314
- I($n, Ze(et(x(n))), null, 16),
2315
- I(wn, Ve(x(s), {
2316
- onSubmitted: F[2] || (F[2] = (j) => x(y).fetchTemplates())
2317
- }), null, 16),
2318
- I(Kn, Ve(x(o), {
2319
- onSubmitted: F[3] || (F[3] = (j) => x(y).fetchTemplates())
2320
- }), null, 16)
2321
- ]))
2322
- ], 64);
2323
- };
2324
- }
2325
- });
2326
- export {
2327
- $s as default
2328
- };