@feedmepos/mf-inventory-portal 0.0.22-dev.41 → 0.0.22-dev.42

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 (44) hide show
  1. package/dist/{ApprovalView-DKqwRFlF.js → ApprovalView-5YpqaJKy.js} +3 -3
  2. package/dist/{BindingsDialog-CtMSqEuE.js → BindingsDialog-lGoLNJyU.js} +1 -1
  3. package/dist/{BindingsPicker-DCLNF1PL.js → BindingsPicker-CdvkacXh.js} +1 -1
  4. package/dist/{BindingsTable-6ndQuHeA.js → BindingsTable-B8G9Ckdk.js} +1 -1
  5. package/dist/ClosingTemplateView-Dcy08dPm.js +1775 -0
  6. package/dist/FmDroppableField-DeW5xBTW.js +154 -0
  7. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BUGB0uk3.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DBpTwDEI.js} +3 -3
  8. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CM93v-jp.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-cSTp7zUx.js} +1 -1
  9. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-SNp8etCc.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DFHzlUVu.js} +1 -1
  10. package/dist/{IngredientsView-B1jGkWYN.js → IngredientsView-DKJjOK_4.js} +5 -5
  11. package/dist/IntegrationView-CgqU4EBV.js +1141 -0
  12. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-mZQlrYaY.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-gvpXGm1X.js} +1 -1
  13. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BEFmqnHk.js → PremiumBadge.vue_vue_type_script_setup_true_lang-B3JDjoOu.js} +2 -2
  14. package/dist/{PurchaseOrderPrintPreview-DTQViYuX.js → PurchaseOrderPrintPreview-olI-JfjI.js} +1 -1
  15. package/dist/{ReceiveRequestView-CNRixgQu.js → ReceiveRequestView-flhI8D2c.js} +10 -10
  16. package/dist/{RecipeView-HStPC5pE.js → RecipeView-CoMyQ92u.js} +4 -4
  17. package/dist/{StockView-JO3NtkX9.js → StockView-Dae47pLA.js} +5 -5
  18. package/dist/{SupplierView-gtaS4K3U.js → SupplierView-CxYZUHrc.js} +3 -3
  19. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-dPt3qbcX.js → TransferDetails.vue_vue_type_script_setup_true_lang-DoEEedkk.js} +5 -5
  20. package/dist/TransferTemplateView-DdB7z0b4.js +1302 -0
  21. package/dist/{UnitView-dbInWUk4.js → UnitView-B0E2nG3J.js} +4 -4
  22. package/dist/{WarehouseView-BlTBvLF0.js → WarehouseView-NQ2JwyWK.js} +2 -2
  23. package/dist/{app-TB3IWuaU.js → app-tiUQG6R0.js} +3917 -3873
  24. package/dist/app.d.ts +50 -3
  25. package/dist/app.js +1 -1
  26. package/dist/components/FmMultiselectDialog.vue.d.ts +3 -9
  27. package/dist/{decimal-BRAYgPnN.js → decimal-BOvNv58m.js} +1 -1
  28. package/dist/{defineDeepModel-DrEk5Fhq.js → defineDeepModel-CNgIKGt8.js} +1 -1
  29. package/dist/{format-time-from-id-kpVYfVQb.js → format-time-from-id-DWlH-AZV.js} +1 -1
  30. package/dist/format-unit-display-DIhXvTxN.js +1195 -0
  31. package/dist/stores/netsuite.d.ts +1 -1
  32. package/dist/style.css +1 -1
  33. package/dist/{supplier-CJcqHpaM.js → supplier-rpkSwf7L.js} +1 -1
  34. package/dist/tsconfig.app.tsbuildinfo +1 -1
  35. package/dist/{use-template-enabled-locations-2-DyD24laW.js → use-template-enabled-locations-2-BrK8SKvw.js} +1 -1
  36. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +7 -5
  37. package/dist/{xlsx-Dd5ckm6-.js → xlsx-DGqkxpZX.js} +1 -1
  38. package/dist/{xlsx.util-qlqvEcJz.js → xlsx.util-CvycJwUf.js} +1 -1
  39. package/package.json +1 -1
  40. package/dist/ClosingTemplateView-BPrDQ_8-.js +0 -1688
  41. package/dist/FmDroppableField-DQFPEiJn.js +0 -152
  42. package/dist/IntegrationView-Bu0waSjB.js +0 -1141
  43. package/dist/TransferTemplateView-C0pjLfbz.js +0 -2054
  44. package/dist/purchase-order-transaction-type-ZMNa__2l.js +0 -348
@@ -0,0 +1,1775 @@
1
+ import { ref as S, h as F, defineComponent as O, resolveComponent as M, openBlock as w, createElementBlock as C, createElementVNode as h, normalizeClass as G, createTextVNode as Pe, toDisplayString as $, unref as p, createCommentVNode as W, createVNode as k, withCtx as I, Fragment as j, renderList as q, computed as A, watch as Ee, createSlots as We, createBlock as N, isRef as qe, normalizeStyle as Xe, Teleport as Qe, normalizeProps as Ze, guardReactiveProps as et, mergeProps as tt } from "vue";
2
+ import { u as nt, _ as ot, a as st } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-cSTp7zUx.js";
3
+ import { useCoreStore as ie, useI18n as B } from "@feedmepos/mf-common";
4
+ import { useDialogChild as lt, useSnackbar as te, useDialog as ce, FmButtonVariant as Ie, components as L, useProxiedModel as at, useBreakpoints as rt } from "@feedmepos/ui-library";
5
+ import { defineStore as Ue, storeToRefs as Ve } from "pinia";
6
+ import { D as Re, R as z, F as H } from "./row-action.enum-PMKMRrZR.js";
7
+ import { n as it, i as me, c as Ne, f as ct, u as ue, h as mt, R as ut, A as dt, y as pt, X as ft, Y as le } from "./app-tiUQG6R0.js";
8
+ import { a as ae, b as Be, d as Le, s as ze, r as gt } from "./xlsx.util-CvycJwUf.js";
9
+ import { F as vt } from "./FmDroppableField-DeW5xBTW.js";
10
+ import { c as yt, F as K, _ as He } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
11
+ import { f as ht } from "./format-time-from-id-DWlH-AZV.js";
12
+ import "vue-router";
13
+ import { d as bt } from "./defineDeepModel-CNgIKGt8.js";
14
+ import { u as _t } from "./use-template-enabled-locations-2-BrK8SKvw.js";
15
+ const ne = it((r, s) => {
16
+ function o() {
17
+ var e;
18
+ return `business_${((e = ie().currentBusiness.value) == null ? void 0 : e._id) ?? ""}`;
19
+ }
20
+ return {
21
+ async getRecentPublishingJob() {
22
+ const n = o(), t = `${r.inventoryBackendUrl}/${n}/closing-template/publish/recent`;
23
+ return s.get(t);
24
+ },
25
+ async startNewPublish() {
26
+ const n = o(), t = `${r.inventoryBackendUrl}/${n}/closing-template/publish`;
27
+ return s.post(t);
28
+ },
29
+ async getTemplate(n) {
30
+ const t = o(), e = `${r.inventoryBackendUrl}/${t}/closing-template/${n}`;
31
+ return s.get(e);
32
+ },
33
+ async readTemplates() {
34
+ const n = o(), t = `${r.inventoryBackendUrl}/${n}/closing-template`;
35
+ return s.get(t);
36
+ },
37
+ async createTemplate(n) {
38
+ const t = o(), e = `${r.inventoryBackendUrl}/${t}/closing-template`;
39
+ return s.post(e, n);
40
+ },
41
+ async updateTemplate(n) {
42
+ const t = o(), e = `${r.inventoryBackendUrl}/${t}/closing-template`;
43
+ return s.put(e, n);
44
+ },
45
+ async deleteTemplate(n) {
46
+ const t = o(), e = `${r.inventoryBackendUrl}/${t}/closing-template`;
47
+ return s.delete(e, { _id: n._id, _rev: n._rev });
48
+ },
49
+ async importTemplates(n) {
50
+ const t = o(), e = `${r.inventoryBackendUrl}/${t}/closing-template/import`;
51
+ return s.post(e, n);
52
+ }
53
+ };
54
+ }), oe = Ue(
55
+ "closingTable",
56
+ function() {
57
+ const { t: s } = B(), o = re(), n = S({}), t = S(new Array()), e = S(!1), f = me(), i = ne();
58
+ async function m() {
59
+ if (t.value = [], !!f._currentLocation) {
60
+ e.value = !0;
61
+ try {
62
+ const [_, y] = await Promise.all([
63
+ i.readTemplates(),
64
+ i.getRecentPublishingJob()
65
+ ]).delayed(1e3);
66
+ t.value = _, n.value = y;
67
+ } catch (_) {
68
+ console.log("Something went wrong when fetching templates:", _);
69
+ } finally {
70
+ e.value = !1;
71
+ }
72
+ }
73
+ }
74
+ async function c(_) {
75
+ if (!t.value.find((y) => y._id) && f._currentLocation) {
76
+ e.value = !0;
77
+ try {
78
+ const [y] = await Promise.all([
79
+ i.getTemplate(_),
80
+ new Promise((a) => setTimeout(a, 1e3))
81
+ ]);
82
+ t.value = [y];
83
+ } catch (y) {
84
+ console.log("Something went wrong when fetching templates:", y);
85
+ } finally {
86
+ e.value = !1;
87
+ }
88
+ }
89
+ }
90
+ function u(_, y) {
91
+ switch (y = Ne(y), _) {
92
+ case z.Details:
93
+ return o.viewTemplate(y);
94
+ case z.Edit:
95
+ return o.updateTemplate(y);
96
+ case z.Delete:
97
+ return o.deleteTemplate(y, e, m);
98
+ }
99
+ }
100
+ return {
101
+ columnDefs: [
102
+ {
103
+ id: "_id",
104
+ accessorKey: "_id",
105
+ header: () => s("inventory.closing.table.createdAt"),
106
+ cell(_) {
107
+ return ht(`${_.getValue()}`);
108
+ },
109
+ enableSorting: !0
110
+ },
111
+ {
112
+ id: "name",
113
+ accessorKey: "name",
114
+ header: () => s("inventory.closing.table.name"),
115
+ enableSorting: !0,
116
+ size: 200
117
+ },
118
+ {
119
+ id: "noOfItems",
120
+ accessorKey: "items.length",
121
+ header: () => s("inventory.closing.table.noOfItems"),
122
+ enableSorting: !1,
123
+ meta: {
124
+ width: "10rem",
125
+ textAlign: "right"
126
+ }
127
+ },
128
+ {
129
+ id: "enabledLocations",
130
+ accessorKey: "locations.length",
131
+ header: () => s("inventory.closing.table.enabledOutlets"),
132
+ cell(_) {
133
+ var a;
134
+ const y = (a = _.row.original.locations) == null ? void 0 : a.length;
135
+ return y ? `${y}` : "All";
136
+ },
137
+ enableSorting: !1,
138
+ meta: {
139
+ width: "10rem",
140
+ textAlign: "right"
141
+ }
142
+ },
143
+ {
144
+ id: "ref",
145
+ accessorKey: "ref",
146
+ header: () => s("inventory.closing.table.reference"),
147
+ enableSorting: !1,
148
+ size: "auto"
149
+ },
150
+ {
151
+ id: "status",
152
+ header: () => s("inventory.closing.table.status"),
153
+ enableSorting: !1,
154
+ cell(_) {
155
+ var T;
156
+ const y = _.row.original, a = y._rev, l = (T = n.value.publishedRevs) == null ? void 0 : T[y._id], v = a === l;
157
+ return F(
158
+ "div",
159
+ {
160
+ class: "flex"
161
+ },
162
+ F(
163
+ "div",
164
+ {
165
+ class: [
166
+ "fm-status-badge",
167
+ v ? "fm-status-badge-success-secondary" : "fm-status-badge-info-secondary"
168
+ ]
169
+ },
170
+ v ? "Published" : "Unpublished"
171
+ )
172
+ );
173
+ }
174
+ },
175
+ {
176
+ id: "action",
177
+ cell(_) {
178
+ const y = _.row.original, a = [
179
+ Re[z.Edit],
180
+ Re[z.Delete]
181
+ ];
182
+ return yt(a, (l) => u(l, y));
183
+ },
184
+ enableSorting: !1,
185
+ size: 40,
186
+ meta: {
187
+ cellClass: "",
188
+ headerClass: ""
189
+ }
190
+ }
191
+ ],
192
+ recentPublish: n,
193
+ templates: t,
194
+ loading: e,
195
+ fetchTemplates: m,
196
+ loadTemplate: c
197
+ };
198
+ }
199
+ );
200
+ var de = /* @__PURE__ */ ((r) => (r.Ingredients = "Ingredients", r))(de || {});
201
+ function je(r) {
202
+ const s = r.sku, o = new Set(r.disabledMeasurements);
203
+ return [
204
+ {
205
+ code: s.code,
206
+ name: s.name,
207
+ unit: s.unit.abbrev,
208
+ enabled: !o.has(s.unit._id)
209
+ },
210
+ ...s.unit.measurements.map((e) => ({
211
+ unit: e.abbrev,
212
+ enabled: !o.has(e.id)
213
+ }))
214
+ ];
215
+ }
216
+ function Oe() {
217
+ return [
218
+ {
219
+ id: "code",
220
+ name: "Code"
221
+ },
222
+ {
223
+ id: "name",
224
+ name: "Name"
225
+ },
226
+ {
227
+ id: "unit",
228
+ name: "Unit"
229
+ },
230
+ {
231
+ id: "enabled",
232
+ name: "Enabled"
233
+ }
234
+ ];
235
+ }
236
+ function xt(r) {
237
+ var i;
238
+ const o = ie().currentBusiness.value, t = (i = r.map((m) => {
239
+ var a;
240
+ const c = m.items.flatMap(je), u = Oe(), g = [
241
+ ["Template ID", m._id],
242
+ ["Template name", m.name],
243
+ ["Business name", o == null ? void 0 : o.name],
244
+ ["Business ID", o == null ? void 0 : o._id],
245
+ ["Menu version", o == null ? void 0 : o.menuVersion],
246
+ [
247
+ "Locations",
248
+ ...(a = m.locations) != null && a.length ? [m.locations.map((l) => `${l.name} (${l.dbName})`)] : ["All"]
249
+ ],
250
+ ["Reference", m.ref ?? ""],
251
+ [],
252
+ u.map((l) => l.name),
253
+ ...c.map((l) => u.map((v) => l[v.id]))
254
+ ], _ = u.map((l) => `system:${l.id}`), y = ae(g, _);
255
+ return { name: m.name, sheet: y };
256
+ }).reduce(
257
+ (m, c) => {
258
+ var g;
259
+ const u = c.name.slice(0, 12);
260
+ return (g = m.sheetOccurence)[u] ?? (g[u] = 0), m.sheetOccurence[u] += 1, m.sheets[`${u} (${m.sheetOccurence[u]})`] = c.sheet, m;
261
+ },
262
+ {
263
+ sheets: {},
264
+ sheetOccurence: {}
265
+ }
266
+ )) == null ? void 0 : i.sheets, e = `${o == null ? void 0 : o.name} closing templates (${ct(/* @__PURE__ */ new Date())}).xlsx`, f = Be(t);
267
+ return Le(f, e), e;
268
+ }
269
+ function wt() {
270
+ const r = ie(), s = ue(), o = je({
271
+ sku: {
272
+ unit: {
273
+ _id: "",
274
+ name: "Unit",
275
+ abbrev: "Unit",
276
+ precision: 0,
277
+ measurements: []
278
+ },
279
+ code: "ING001",
280
+ _id: "",
281
+ name: "Sugar"
282
+ }
283
+ })[0], n = r.currentBusiness.value, t = Oe(), e = [
284
+ ["Template ID (leave empty to create new)", ""],
285
+ ["Template Name", "New template"],
286
+ ["Business name", n == null ? void 0 : n.name],
287
+ ["Business ID", n == null ? void 0 : n._id],
288
+ ["Menu version", n == null ? void 0 : n.menuVersion],
289
+ [
290
+ "Location codes (leave empty to enable all)",
291
+ "Example outlet (restaurant_xxx)",
292
+ "Example outlet 2 (restaurant_xxx)"
293
+ ],
294
+ ["Reference:"],
295
+ [],
296
+ t.map((g) => g.name),
297
+ t.map((g) => o[g.id])
298
+ ], f = t.map((g) => `system:${g.id}`), i = ae(e, f), m = ae(
299
+ s.skus.flatMap((g) => [[g.code, g.name, g.unit.abbrev], ...g.unit.measurements.map((y) => ["", "", y.abbrev])]),
300
+ ["Code", "Name", "Units", "Enabled (true/false)"]
301
+ ), c = Be({
302
+ Template: i,
303
+ Ingredients: m
304
+ }), u = `${n == null ? void 0 : n.name} transfer templates import.xlsx`;
305
+ return Le(c, u), u;
306
+ }
307
+ function kt(r) {
308
+ if (!r.length || `${r[0]}`.toLocaleLowerCase() === "all")
309
+ return [];
310
+ const s = /(.*) \(((warehouse_|restaurant_).{24,})\)/, n = me().locationByDbName;
311
+ return r.map((t) => {
312
+ const e = new Array(), f = t.trim(), i = s.exec(f);
313
+ if (!i)
314
+ return e.push(`Enabled location value of ${f} cannot be read.`), {
315
+ errors: e
316
+ };
317
+ const m = i[1], c = i[2], u = n[c];
318
+ return u ? (m !== u.name && e.push(
319
+ `Location id ${c} has non-matching name. Found ${m} but expected ${u.name}`
320
+ ), {
321
+ errors: e,
322
+ location: u
323
+ }) : (e.push(`Location (${m}) of id ${c} is not found.`), {
324
+ errors: e
325
+ });
326
+ });
327
+ }
328
+ function Tt(r) {
329
+ const [
330
+ s,
331
+ o,
332
+ n,
333
+ t,
334
+ e,
335
+ f,
336
+ i,
337
+ m
338
+ ] = ze(r);
339
+ return {
340
+ id: `${o[1] ?? ""}`.trim(),
341
+ name: `${n[1] ?? ""}`.trim(),
342
+ locations: i.slice(1).map((c) => `${c}`.trim()).filter((c) => c),
343
+ reference: `${m[1] ?? ""}`.trim()
344
+ };
345
+ }
346
+ function $t(r) {
347
+ const [
348
+ s,
349
+ o,
350
+ n,
351
+ t,
352
+ e,
353
+ f,
354
+ i,
355
+ m,
356
+ c,
357
+ u,
358
+ ...g
359
+ ] = ze(r);
360
+ if (!s || !s.length || s.some((v) => v.length && !v.startsWith("system:")))
361
+ throw new Error("Missing meta header. Excel file does not come from the template.");
362
+ const _ = s.map((v) => v.split(":")[1]), a = ["code", "name", "unit", "enabled"].filter((v) => !_.includes(v));
363
+ if (a.length)
364
+ throw new Error(
365
+ `Missing meta headers (${a.join()}). Excel file does not come from the template.`
366
+ );
367
+ return g.map((v, T) => {
368
+ const d = {};
369
+ for (const D in _) {
370
+ const b = _[D];
371
+ Object.assign(d, { [b]: v[D] });
372
+ }
373
+ return {
374
+ index: T,
375
+ data: d
376
+ };
377
+ });
378
+ }
379
+ function Ct(r) {
380
+ return r.reduce(
381
+ (s, o) => {
382
+ var e;
383
+ const n = o.data, t = o.index;
384
+ return n.unit && (n.code ? s.result.push({ parent: o, children: [] }) : s.result.length ? (e = s.result.at(-1)) == null || e.children.push(o) : s.errors.push(`Cannot find parent for row ${t + 9}`)), s;
385
+ },
386
+ { result: new Array(), errors: new Array() }
387
+ );
388
+ }
389
+ function Dt(r) {
390
+ const s = r.parent.data, o = new Array(), t = ue().skuByCode[s.code ?? ""];
391
+ if (!t)
392
+ return o.push(`Cannot find ingredient of code ${s.code} ${s.name}`), { errors: o };
393
+ const e = {
394
+ sku: t
395
+ };
396
+ s.unit !== t.unit.abbrev ? o.push(
397
+ `Expected base unit ${t.unit.abbrev} for (${s.code}) ${s.name} but got ${s.unit} instead.`
398
+ ) : (!s.enabled || `${s.enabled}`.toLocaleLowerCase() === "false") && (e.disabledMeasurements ?? (e.disabledMeasurements = []), e.disabledMeasurements.push(t.unit._id));
399
+ for (const i of r.children) {
400
+ const m = i.data, c = t.unit.measurements.find((u) => u.abbrev === m.unit);
401
+ if (!c) {
402
+ o.push(
403
+ `Cannot find measurement unit of ${m.unit} for (${s.code}) ${s.name}.`
404
+ );
405
+ continue;
406
+ }
407
+ (!m.enabled || `${m.enabled}`.toLocaleLowerCase() === "false") && (e.disabledMeasurements ?? (e.disabledMeasurements = []), e.disabledMeasurements.push(c.id));
408
+ }
409
+ const f = new Set(e.disabledMeasurements);
410
+ return f.has(t.unit._id) && e.sku.unit.measurements.every((i) => f.has(i.id)) && o.push(`Ingredient ${t.code} - ${t.name} must have at least one unit enabled.`), { errors: o, templateItem: e };
411
+ }
412
+ function St(r) {
413
+ const s = r.SheetNames.filter(
414
+ (e) => !Object.values(de).map(String).includes(e)
415
+ ), n = oe().templates, t = mt(n, "_id");
416
+ try {
417
+ return s.reduce(
418
+ (e, f) => {
419
+ const i = new Array(), m = r.Sheets[f], c = Tt(m), u = kt(c.locations), g = u.filter((d) => d.location).map((d) => d.location);
420
+ i.push(...u.flatMap((d) => d.errors));
421
+ const _ = $t(m).filter(
422
+ (d) => d.data.code || d.data.unit
423
+ ), y = Ct(_);
424
+ i.push(...y.errors);
425
+ const a = y.result.map(
426
+ (d) => Dt(d)
427
+ );
428
+ i.push(...a.flatMap((d) => d.errors));
429
+ const l = a.filter((d) => d.templateItem).map((d) => d.templateItem);
430
+ if (c.id) {
431
+ const d = t[c.id];
432
+ if (!d) {
433
+ const b = {
434
+ _id: c.id,
435
+ _rev: "",
436
+ name: c.name || `(unnamed from sheet ${f || "<unnamed sheet>"})`,
437
+ items: []
438
+ };
439
+ return i.push(`Template ID ${c.id} is not found.`), e.importUpdateResult.push({
440
+ type: "update",
441
+ original: b,
442
+ template: b,
443
+ excelSheetName: f,
444
+ errors: i
445
+ }), e;
446
+ }
447
+ const D = {
448
+ type: "update",
449
+ original: d,
450
+ template: {
451
+ ...d,
452
+ name: c.name,
453
+ locations: g.length ? g : null,
454
+ ref: c.reference,
455
+ items: l
456
+ },
457
+ excelSheetName: f,
458
+ errors: i
459
+ };
460
+ return e.importUpdateResult.push(D), e;
461
+ }
462
+ const T = {
463
+ type: "create",
464
+ template: {
465
+ name: c.id,
466
+ locations: g,
467
+ ref: c.reference,
468
+ items: l
469
+ },
470
+ excelSheetName: f,
471
+ errors: i
472
+ };
473
+ return e.importCreateResult.push(T), e;
474
+ },
475
+ {
476
+ invalidExcel: !1,
477
+ importCreateResult: new Array(),
478
+ importUpdateResult: new Array()
479
+ }
480
+ );
481
+ } catch (e) {
482
+ return {
483
+ invalidExcel: !0,
484
+ invalidExcelMessage: (e == null ? void 0 : e.message) ?? "Invalid excel",
485
+ importCreateResult: [],
486
+ importUpdateResult: []
487
+ };
488
+ }
489
+ }
490
+ const Mt = { class: "flex items-center gap-12 pl-8" }, Ft = { class: "flex flex-col" }, It = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" }, Rt = {
491
+ key: 0,
492
+ class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
493
+ }, At = { key: 0 }, Ae = /* @__PURE__ */ O({
494
+ __name: "ClosingTemplateImportItem",
495
+ props: {
496
+ type: {},
497
+ name: {},
498
+ locations: {},
499
+ items: {},
500
+ errors: {}
501
+ },
502
+ setup(r) {
503
+ const { t: s } = B();
504
+ return (o, n) => {
505
+ var f, i, m;
506
+ const t = M("FmIcon"), e = M("FmTooltip");
507
+ return w(), C("div", Mt, [
508
+ n[0] || (n[0] = h("div", null, "•", -1)),
509
+ h("div", Ft, [
510
+ h("div", It, [
511
+ h("div", {
512
+ class: G({
513
+ "text-fm-color-system-error-300": o.errors.length
514
+ })
515
+ }, [
516
+ Pe($(o.name) + " ", 1),
517
+ o.type === "create" ? (w(), C("span", Rt, "(" + $(p(s)("inventory.closing.template.import.new")) + ")", 1)) : W("", !0)
518
+ ], 2),
519
+ o.errors.length ? (w(), C("div", At, [
520
+ k(e, { "z-index": 50 }, {
521
+ content: I(() => [
522
+ h("ol", null, [
523
+ (w(!0), C(j, null, q(o.errors, (c, u) => (w(), C("li", { key: u }, $(c), 1))), 128))
524
+ ])
525
+ ]),
526
+ default: I(() => [
527
+ k(t, {
528
+ name: "error",
529
+ size: "sm",
530
+ color: "system-error-300"
531
+ })
532
+ ]),
533
+ _: 1
534
+ })
535
+ ])) : W("", !0)
536
+ ]),
537
+ h("div", {
538
+ class: G([
539
+ "fm-typo-en-body-sm-400",
540
+ {
541
+ "text-fm-color-system-error-200": o.errors.length,
542
+ "text-fm-color-typo-secondary": !o.errors.length
543
+ }
544
+ ])
545
+ }, $((f = o.locations) != null && f.length ? p(s)("inventory.closing.template.import.nLocations", { count: (i = o.locations) == null ? void 0 : i.length }) : p(s)("inventory.closing.template.import.allLocations")) + ", " + $(p(s)("inventory.closing.template.import.nItems", { count: (m = o.items) == null ? void 0 : m.length })), 3)
546
+ ])
547
+ ]);
548
+ };
549
+ }
550
+ }), Pt = { class: "flex flex-col gap-24" }, Et = { class: "fm-typo-en-body-md-400" }, Ut = {
551
+ key: 0,
552
+ class: "flex items-center gap-8"
553
+ }, Vt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Nt = { class: "flex flex-col gap-8" }, Bt = { class: "line-clamp-2 text-ellipsis break-all" }, Lt = {
554
+ key: 2,
555
+ class: "shrink-0"
556
+ }, zt = {
557
+ key: 0,
558
+ class: "flex flex-col"
559
+ }, Ht = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, jt = {
560
+ key: 0,
561
+ class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
562
+ }, Ot = { class: "fm-typo-en-body-lg-600" }, Yt = /* @__PURE__ */ O({
563
+ __name: "ClosingTemplateImport",
564
+ setup(r) {
565
+ const s = S(null), o = lt(), n = te(), t = S(!1), e = S(!1), f = S(new Array()), i = S([]), m = S([]), c = A(
566
+ () => !!f.value.length || i.value.some((y) => y.errors.length) || m.value.some((y) => y.errors.length)
567
+ ), u = A(
568
+ () => !!i.value.length || !!m.value.length
569
+ ), { t: g } = B();
570
+ async function _(y) {
571
+ f.value = [], i.value = [], m.value = [];
572
+ try {
573
+ t.value = !0;
574
+ const [a] = await Promise.all([
575
+ gt(y),
576
+ // fake buffer
577
+ new Promise((d) => setTimeout(d, 1e3))
578
+ ]);
579
+ if (!a.SheetNames.filter(
580
+ (d) => !Object.values(de).map(String).includes(d)
581
+ ).find((d) => d)) {
582
+ f.value.push(g("inventory.ingredient.import.fileError.noSheet"));
583
+ return;
584
+ }
585
+ const T = St(a);
586
+ if (T.invalidExcel) {
587
+ f.value.push(
588
+ T.invalidExcelMessage ?? g("inventory.ingredient.import.fileError.invalidExcel")
589
+ );
590
+ return;
591
+ }
592
+ if (i.value = T.importCreateResult, m.value = T.importUpdateResult, !i.value.length && !m.value.length) {
593
+ f.value.push(g("inventory.ingredient.import.fileError.noData"));
594
+ return;
595
+ }
596
+ o.emitData(T);
597
+ } catch (a) {
598
+ n.open({
599
+ title: g("inventory.ingredient.import.fileError.unableToRead"),
600
+ message: a == null ? void 0 : a.message,
601
+ type: "error"
602
+ }), console.error("Error in reading file", a);
603
+ } finally {
604
+ f.value.length && n.open({
605
+ title: g("inventory.ingredient.import.fileError.invalidExcel"),
606
+ type: "error"
607
+ }), t.value = !1;
608
+ }
609
+ }
610
+ return Ee(s, (y) => {
611
+ y && _(y);
612
+ }), (y, a) => {
613
+ const l = M("FmCircularProgress"), v = M("FmIcon"), T = M("FmButton");
614
+ return w(), C("div", Pt, [
615
+ h("div", Et, $(p(g)("inventory.closing.template.import.message")), 1),
616
+ e.value ? (w(), C("div", Ut, [
617
+ h("div", null, [
618
+ k(l, {
619
+ size: "md",
620
+ color: "neutral-gray-200"
621
+ })
622
+ ]),
623
+ h("div", Vt, $(p(g)("inventory.formField.loading")), 1)
624
+ ])) : (w(), C(j, { key: 1 }, [
625
+ k(vt, {
626
+ class: G({
627
+ "w-full": !0,
628
+ "h-[200px]": !s.value
629
+ }),
630
+ accept: ".xlsx",
631
+ onFileUpload: a[0] || (a[0] = (d) => s.value = d),
632
+ label: p(g)("inventory.ingredient.import.uploadTemplate"),
633
+ "button-label": p(g)("inventory.ingredient.import.selectFile")
634
+ }, We({ _: 2 }, [
635
+ s.value ? {
636
+ name: "default",
637
+ fn: I(({ openFileDialog: d }) => [
638
+ h("div", Nt, [
639
+ h("div", {
640
+ class: G([
641
+ "fm-corner-radius-md p-16 flex items-center gap-16",
642
+ {
643
+ "border border-fm-color-neutral-gray-100": t.value,
644
+ "border border-fm-color-neutral-gray-200": !t.value && !c.value,
645
+ "border border-fm-color-system-error-200": c.value
646
+ }
647
+ ])
648
+ }, [
649
+ t.value ? (w(), N(l, {
650
+ key: 0,
651
+ size: "md",
652
+ color: "neutral-gray-200"
653
+ })) : (w(), N(v, {
654
+ key: 1,
655
+ name: c.value ? "error" : "attach_file",
656
+ outline: "",
657
+ color: c.value ? "system-error-300" : void 0
658
+ }, null, 8, ["name", "color"])),
659
+ h("div", {
660
+ class: G([
661
+ "fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center",
662
+ {
663
+ "text-fm-color-typo-disabled": t.value,
664
+ "text-fm-color-typo-primary": !t.value
665
+ }
666
+ ])
667
+ }, [
668
+ h("div", Bt, $(s.value.name), 1)
669
+ ], 2),
670
+ t.value ? W("", !0) : (w(), C("div", Lt, [
671
+ k(T, {
672
+ label: p(g)("inventory.ingredient.import.replaceFile"),
673
+ variant: c.value ? "destructive" : "secondary",
674
+ "prepend-icon": c.value ? void 0 : "autorenew",
675
+ onClick: d
676
+ }, null, 8, ["label", "variant", "prepend-icon", "onClick"])
677
+ ]))
678
+ ], 2),
679
+ f.value.length ? (w(), C("div", zt, [
680
+ (w(!0), C(j, null, q(f.value, (D, b) => (w(), C("div", {
681
+ key: b,
682
+ class: "flex gap-8 items-center"
683
+ }, [
684
+ k(v, {
685
+ name: "error",
686
+ size: "sm",
687
+ color: "system-error-300"
688
+ }),
689
+ h("div", Ht, $(D), 1)
690
+ ]))), 128))
691
+ ])) : W("", !0)
692
+ ])
693
+ ]),
694
+ key: "0"
695
+ } : void 0
696
+ ]), 1032, ["class", "label", "button-label"]),
697
+ u.value ? (w(), C("div", jt, [
698
+ h("div", Ot, $(p(g)("inventory.ingredient.import.summary")), 1),
699
+ (w(!0), C(j, null, q(i.value, (d, D) => (w(), N(Ae, {
700
+ key: D,
701
+ name: d.template.name,
702
+ locations: d.template.locations,
703
+ items: d.template.items,
704
+ errors: d.errors,
705
+ type: "create"
706
+ }, null, 8, ["name", "locations", "items", "errors"]))), 128)),
707
+ (w(!0), C(j, null, q(m.value, (d) => (w(), N(Ae, {
708
+ key: d.template._id,
709
+ name: d.template.name,
710
+ locations: d.template.locations,
711
+ items: d.template.items,
712
+ errors: d.errors,
713
+ type: "update"
714
+ }, null, 8, ["name", "locations", "items", "errors"]))), 128))
715
+ ])) : W("", !0)
716
+ ], 64))
717
+ ]);
718
+ };
719
+ }
720
+ }), re = Ue("closingTemplateActions", () => {
721
+ const { t: r } = B(), s = ce(), o = te(), n = ne(), t = oe(), { loading: e } = Ve(t), f = S({});
722
+ function i() {
723
+ f.value = {
724
+ mode: H.CREATE,
725
+ show: !0,
726
+ "onUpdate:show"(l) {
727
+ f.value.show = l;
728
+ }
729
+ };
730
+ }
731
+ function m(l) {
732
+ f.value = {
733
+ mode: H.UPDATE,
734
+ modelValue: l,
735
+ show: !0,
736
+ "onUpdate:show"(v) {
737
+ f.value.show = v;
738
+ }
739
+ };
740
+ }
741
+ function c(l, v, T) {
742
+ s.open({
743
+ title: `Confirm deleting template ${l.name}?`,
744
+ message: "Deleted template can no longer be retrieved",
745
+ primaryActions: {
746
+ text: "Delete",
747
+ variant: Ie.Destructive,
748
+ close: !0
749
+ },
750
+ secondaryActions: {
751
+ text: "Cancel",
752
+ variant: Ie.Plain,
753
+ close: !0
754
+ }
755
+ }).onPrimary(async () => {
756
+ o.open({
757
+ title: `Deleting ${l.name}`,
758
+ type: "info"
759
+ });
760
+ try {
761
+ v.value = !0;
762
+ const [d] = await Promise.allSettled([
763
+ n.deleteTemplate(l),
764
+ new Promise((D) => setTimeout(D, 1e3))
765
+ ]);
766
+ if (d.status === "rejected") throw d.reason;
767
+ o.open({
768
+ title: `Deleted ${l.name}`,
769
+ type: "success"
770
+ });
771
+ } catch (d) {
772
+ o.open({
773
+ title: `Unable to delete ${l.name}`,
774
+ message: `See error from server: ${d}`,
775
+ type: "error"
776
+ }), console.error("error on deleting closing template", d);
777
+ } finally {
778
+ v.value = !1, T();
779
+ }
780
+ });
781
+ }
782
+ const u = S({});
783
+ function g(l) {
784
+ u.value = {
785
+ template: l,
786
+ show: !0,
787
+ "onUpdate:show"(v) {
788
+ u.value.show = v;
789
+ },
790
+ "onAction:edit"() {
791
+ u.value.show = !1, m(Ne(l));
792
+ }
793
+ };
794
+ }
795
+ function _() {
796
+ const l = xt(t.templates);
797
+ o.open({
798
+ title: r("inventory.ingredient.export.success"),
799
+ message: r("inventory.ingredient.export.filename", [l]),
800
+ type: "success"
801
+ });
802
+ }
803
+ function y() {
804
+ t.loading || s.open({
805
+ title: r("inventory.ingredient.import.title"),
806
+ contentComponent: Yt,
807
+ overlay: !0,
808
+ closeButton: !0,
809
+ primaryActions: {
810
+ text: r("common.import"),
811
+ close: !1
812
+ },
813
+ secondaryActions: {
814
+ text: r("common.close"),
815
+ close: !0
816
+ },
817
+ tertiaryActions: {
818
+ text: r("inventory.ingredient.import.actions.downloadTemplate"),
819
+ close: !1,
820
+ variant: "plain"
821
+ }
822
+ }).onPrimary((l) => {
823
+ if (!l) {
824
+ o.open({
825
+ title: r("inventory.ingredient.import.error.noData"),
826
+ type: "error"
827
+ });
828
+ return;
829
+ }
830
+ if (!l.importCreateResult.length && !l.importUpdateResult.length) {
831
+ o.open({
832
+ title: r("inventory.ingredient.import.error.invalidContent"),
833
+ message: r("inventory.ingredient.import.error.noImportData"),
834
+ type: "error"
835
+ });
836
+ return;
837
+ }
838
+ if (l.importCreateResult.some((v) => v.errors.length) || l.importUpdateResult.some((v) => v.errors.length)) {
839
+ o.open({
840
+ title: r("inventory.ingredient.import.error.invalidContent"),
841
+ message: r("inventory.ingredient.import.error.hasErrors"),
842
+ type: "error"
843
+ });
844
+ return;
845
+ }
846
+ s.close(), a(l);
847
+ }).onTertiary(wt);
848
+ }
849
+ async function a(l) {
850
+ e.value = !0;
851
+ try {
852
+ const v = [
853
+ ...l.importCreateResult.map(
854
+ (b) => b.template
855
+ ),
856
+ ...l.importUpdateResult.map(
857
+ (b) => b.template
858
+ )
859
+ ], T = 100;
860
+ let d = 0;
861
+ const D = () => {
862
+ d += T, o.open({
863
+ title: r("inventory.ingredient.import.progress", [
864
+ Math.min(d, v.length),
865
+ v.length
866
+ ])
867
+ });
868
+ };
869
+ for (const b of v.chunk(100))
870
+ D(), await n.importTemplates(b);
871
+ o.open({
872
+ title: r("inventory.ingredient.import.success"),
873
+ type: "success"
874
+ });
875
+ } catch (v) {
876
+ o.open({
877
+ title: r("inventory.ingredient.import.error.failed"),
878
+ message: r("inventory.ingredient.import.error.systemMessage", [v == null ? void 0 : v.message]),
879
+ type: "error"
880
+ }), console.error("Error in importing skus", l, v);
881
+ } finally {
882
+ e.value = !1, t.fetchTemplates();
883
+ }
884
+ }
885
+ return {
886
+ createTemplate: i,
887
+ viewTemplate: g,
888
+ updateTemplate: m,
889
+ deleteTemplate: c,
890
+ exportTemplates: _,
891
+ importTemplates: y,
892
+ templateDialogProps: f,
893
+ templateDetailsProps: u
894
+ };
895
+ });
896
+ var J = /* @__PURE__ */ ((r) => (r.Name = "Name", r.Unit = "Unit", r.Delete = "Delete", r))(J || {});
897
+ function Kt(r) {
898
+ return {
899
+ columnDefs: A(() => {
900
+ const o = r.items.map((t) => t.sku.unit.measurements.length).reduce((t, e) => Math.max(t, e), 0);
901
+ return [
902
+ {
903
+ id: "Name",
904
+ header: () => "Name",
905
+ enableSorting: !1,
906
+ size: 400,
907
+ cell(t) {
908
+ const e = t.row.original;
909
+ return F(
910
+ "div",
911
+ {
912
+ class: "flex flex-col"
913
+ },
914
+ [
915
+ F(
916
+ "span",
917
+ { class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary line-clamp-1" },
918
+ e.sku.name
919
+ ),
920
+ F(
921
+ "span",
922
+ { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary line-clamp-1" },
923
+ e.sku.code
924
+ )
925
+ ]
926
+ );
927
+ }
928
+ },
929
+ {
930
+ id: "Unit",
931
+ header: () => "Enable unit",
932
+ enableSorting: !1,
933
+ size: "auto",
934
+ cell(t) {
935
+ var f, i, m;
936
+ const e = t.row.original;
937
+ return F(
938
+ L.FmFormGroup,
939
+ {
940
+ value: e.sku.unit._id,
941
+ modelValue: !((f = e.disabledMeasurements) != null && f.includes(e.sku.unit._id))
942
+ },
943
+ F(
944
+ "div",
945
+ {
946
+ class: "flex items-center gap-4"
947
+ },
948
+ [
949
+ F(L.FmCheckbox, {
950
+ value: e.sku.unit._id,
951
+ modelValue: !((i = e.disabledMeasurements) != null && i.includes(e.sku.unit._id)),
952
+ disabled: r.disabled || !((m = e.disabledMeasurements) != null && m.includes(e.sku.unit._id)) && e.sku.unit.measurements.every(
953
+ (c) => {
954
+ var u;
955
+ return (u = e.disabledMeasurements) == null ? void 0 : u.includes(c.id);
956
+ }
957
+ ),
958
+ "onUpdate:modelValue"(c) {
959
+ var u;
960
+ if (c)
961
+ r.updateItem({
962
+ ...e,
963
+ disabledMeasurements: (u = e.disabledMeasurements) == null ? void 0 : u.filter(
964
+ (g) => g !== e.sku.unit._id
965
+ )
966
+ });
967
+ else {
968
+ const g = e.disabledMeasurements ?? [];
969
+ r.updateItem({
970
+ ...e,
971
+ disabledMeasurements: [...g, e.sku.unit._id]
972
+ });
973
+ }
974
+ }
975
+ }),
976
+ F(
977
+ L.FmTooltip,
978
+ { zIndex: 51 },
979
+ {
980
+ content() {
981
+ return e.sku.unit.abbrev;
982
+ },
983
+ default() {
984
+ return F(
985
+ "div",
986
+ { class: "line-clamp-2 fm-typo-en-body-lg-400" },
987
+ e.sku.unit.abbrev
988
+ );
989
+ }
990
+ }
991
+ )
992
+ ]
993
+ )
994
+ );
995
+ }
996
+ },
997
+ ...Array.from({ length: Math.max(o, 0) }).map(
998
+ (t, e) => ({
999
+ id: `measurement${e}`,
1000
+ header: () => "",
1001
+ enableSorting: !1,
1002
+ size: "auto",
1003
+ cell(f) {
1004
+ var c, u, g, _;
1005
+ const i = f.row.original, m = i.sku.unit.measurements[e];
1006
+ return m ? F(
1007
+ L.FmFormGroup,
1008
+ {
1009
+ modelValue: !((c = i.disabledMeasurements) != null && c.includes(m.id)),
1010
+ value: m.id
1011
+ },
1012
+ F(
1013
+ "div",
1014
+ {
1015
+ class: "flex items-center gap-4"
1016
+ },
1017
+ [
1018
+ F(L.FmCheckbox, {
1019
+ value: m.id,
1020
+ modelValue: !((u = i.disabledMeasurements) != null && u.includes(m.id)),
1021
+ disabled: r.disabled || !((g = i.disabledMeasurements) != null && g.includes(m.id)) && ((_ = i.disabledMeasurements) == null ? void 0 : _.includes(i.sku.unit._id)) && i.sku.unit.measurements.filter((y) => y.id != m.id).every((y) => {
1022
+ var a;
1023
+ return (a = i.disabledMeasurements) == null ? void 0 : a.includes(y.id);
1024
+ }),
1025
+ "onUpdate:modelValue"(y) {
1026
+ var a;
1027
+ if (y)
1028
+ r.updateItem({
1029
+ ...i,
1030
+ disabledMeasurements: (a = i.disabledMeasurements) == null ? void 0 : a.filter(
1031
+ (l) => l !== m.id
1032
+ )
1033
+ });
1034
+ else {
1035
+ const l = i.disabledMeasurements ?? [];
1036
+ r.updateItem({
1037
+ ...i,
1038
+ disabledMeasurements: [...l, m.id]
1039
+ });
1040
+ }
1041
+ }
1042
+ }),
1043
+ F(
1044
+ L.FmTooltip,
1045
+ { zIndex: 51 },
1046
+ {
1047
+ content() {
1048
+ return m.abbrev;
1049
+ },
1050
+ default() {
1051
+ return F(
1052
+ "div",
1053
+ { class: "line-clamp-2 fm-typo-en-body-lg-400" },
1054
+ m.abbrev
1055
+ );
1056
+ }
1057
+ }
1058
+ )
1059
+ ]
1060
+ )
1061
+ ) : null;
1062
+ }
1063
+ })
1064
+ ),
1065
+ {
1066
+ id: "Delete",
1067
+ header: "",
1068
+ cell(t) {
1069
+ const e = t.row.original;
1070
+ return F(
1071
+ "div",
1072
+ { class: "w-full flex justify-end" },
1073
+ F(L.FmButton, {
1074
+ class: "delete-button",
1075
+ key: e.sku._id,
1076
+ type: "button",
1077
+ icon: "delete",
1078
+ variant: "tertiary",
1079
+ size: "md",
1080
+ disabled: r.disabled,
1081
+ onClick: () => {
1082
+ r.deleteItem(e);
1083
+ }
1084
+ })
1085
+ );
1086
+ },
1087
+ enableSorting: !1,
1088
+ size: 40,
1089
+ meta: {
1090
+ cellClass: "",
1091
+ headerClass: ""
1092
+ }
1093
+ }
1094
+ ];
1095
+ })
1096
+ };
1097
+ }
1098
+ const Gt = { class: "flex flex-col gap-16 py-12" }, Jt = { class: "flex" }, Wt = { class: "flex-1 flex flex-col" }, qt = { class: "fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, Xt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Qt = { class: "flex flex-col gap-4" }, Zt = /* @__PURE__ */ O({
1099
+ __name: "ClosingTemplateItem",
1100
+ props: {
1101
+ cellByColId: {},
1102
+ row: {}
1103
+ },
1104
+ setup(r) {
1105
+ const s = r, o = A(() => s.row), n = A(
1106
+ () => o.value.getVisibleCells().filter((t) => t.column.id !== J.Name && t.column.id !== J.Delete)
1107
+ );
1108
+ return (t, e) => {
1109
+ var f, i, m, c, u;
1110
+ return w(), C("div", Gt, [
1111
+ h("div", Jt, [
1112
+ h("div", Wt, [
1113
+ h("div", qt, $(o.value.original.sku.name), 1),
1114
+ h("div", Xt, $(o.value.original.sku.code), 1)
1115
+ ]),
1116
+ h("div", null, [
1117
+ k(p(K), {
1118
+ render: (m = (i = (f = t.cellByColId[p(J).Delete]) == null ? void 0 : f.column) == null ? void 0 : i.columnDef) == null ? void 0 : m.cell,
1119
+ props: (u = (c = t.cellByColId[p(J).Delete]) == null ? void 0 : c.getContext) == null ? void 0 : u.call(c)
1120
+ }, null, 8, ["render", "props"])
1121
+ ])
1122
+ ]),
1123
+ h("div", Qt, [
1124
+ e[0] || (e[0] = h("div", { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, null, -1)),
1125
+ (w(!0), C(j, null, q(n.value, (g) => {
1126
+ var _, y, a;
1127
+ return w(), C("div", {
1128
+ key: g.id
1129
+ }, [
1130
+ k(p(K), {
1131
+ render: (y = (_ = g.column) == null ? void 0 : _.columnDef) == null ? void 0 : y.cell,
1132
+ props: (a = g.getContext) == null ? void 0 : a.call(g)
1133
+ }, null, 8, ["render", "props"])
1134
+ ]);
1135
+ }), 128))
1136
+ ])
1137
+ ]);
1138
+ };
1139
+ }
1140
+ }), en = { class: "flex flex-col gap-16" }, tn = { class: "flex flex-col gap-24" }, nn = { class: "flex flex-col gap-16" }, on = { class: "flex items-center" }, sn = { class: "flex-1 fm-typo-en-title-sm-600" }, ln = { class: "flex flex-col gap-16" }, an = { class: "flex items-center" }, rn = { class: "flex-1 gap-8 fm-typo-en-title-sm-600" }, cn = /* @__PURE__ */ O({
1141
+ __name: "ClosingTemplateForm",
1142
+ props: {
1143
+ modelValue: {},
1144
+ disabled: { type: Boolean }
1145
+ },
1146
+ setup(r, { expose: s }) {
1147
+ const o = r, n = bt(), { t } = B(), e = ue(), f = ce(), {
1148
+ promptSelectLocations: i,
1149
+ columnDefs: m,
1150
+ rowData: c
1151
+ } = _t({
1152
+ getLocations() {
1153
+ return n.locations;
1154
+ },
1155
+ setLocations(a) {
1156
+ n.locations = a;
1157
+ }
1158
+ }), u = S();
1159
+ s({
1160
+ validateInputs: () => {
1161
+ var a, l;
1162
+ (l = (a = u.value) == null ? void 0 : a.validateInputs) == null || l.call(a);
1163
+ },
1164
+ resetInputsValidation: () => {
1165
+ var a, l;
1166
+ (l = (a = u.value) == null ? void 0 : a.resetInputsValidation) == null || l.call(a);
1167
+ },
1168
+ resetInputs: () => {
1169
+ var a, l;
1170
+ (l = (a = u.value) == null ? void 0 : a.resetInputs) == null || l.call(a);
1171
+ }
1172
+ });
1173
+ const g = Kt({
1174
+ updateItem: (a) => {
1175
+ n.items = n.items.map((l) => l.sku._id !== a.sku._id ? l : a);
1176
+ },
1177
+ deleteItem: (a) => {
1178
+ n.items = n.items.filter((l) => l.sku._id !== a.sku._id);
1179
+ },
1180
+ get items() {
1181
+ return n.items;
1182
+ },
1183
+ get disabled() {
1184
+ return o.disabled;
1185
+ }
1186
+ }), _ = A(() => g.columnDefs.value);
1187
+ function y() {
1188
+ const a = e.skus.map((v) => ({
1189
+ label: v.name,
1190
+ sublabel: v.code,
1191
+ value: v
1192
+ })), l = a.filter((v) => {
1193
+ var T;
1194
+ return (T = n.items) == null ? void 0 : T.find((d) => d.sku._id === v.value._id);
1195
+ }).map((v) => v.value);
1196
+ f.open({
1197
+ title: t("inventory.closing.form.items.selectItem"),
1198
+ closeButton: !0,
1199
+ contentComponent: pt,
1200
+ contentComponentProps: {
1201
+ modelValue: l,
1202
+ items: a,
1203
+ virtualScroll: !0
1204
+ },
1205
+ primaryActions: {
1206
+ text: t("common.confirm"),
1207
+ close: !0
1208
+ },
1209
+ secondaryActions: {
1210
+ text: t("common.close"),
1211
+ close: !0,
1212
+ variant: "tertiary"
1213
+ }
1214
+ }).onPrimary((v) => {
1215
+ const T = n.items ?? [], d = v.map((D) => {
1216
+ const b = T.find((P) => P.sku._id === D._id);
1217
+ return b || {
1218
+ sku: D
1219
+ };
1220
+ });
1221
+ d.sort((D, b) => D.sku.code.localeCompare(b.sku.code)), n.items = d;
1222
+ });
1223
+ }
1224
+ return (a, l) => {
1225
+ const v = M("FmTextField"), T = M("FmButton"), d = M("FmTable"), D = M("FmFormGroup"), b = M("FmForm");
1226
+ return w(), N(b, {
1227
+ ref_key: "formRef",
1228
+ ref: u,
1229
+ class: "flex flex-col gap-32",
1230
+ disabled: a.disabled
1231
+ }, {
1232
+ default: I(() => [
1233
+ h("div", en, [
1234
+ h("div", tn, [
1235
+ k(v, {
1236
+ label: p(t)("inventory.closing.form.name"),
1237
+ "label-mark": "required",
1238
+ modelValue: p(n).name,
1239
+ "onUpdate:modelValue": l[0] || (l[0] = (x) => p(n).name = x),
1240
+ rules: [p(ut)()]
1241
+ }, null, 8, ["label", "modelValue", "rules"]),
1242
+ k(v, {
1243
+ label: p(t)("inventory.closing.form.reference"),
1244
+ "label-mark": "optional",
1245
+ modelValue: p(n).ref,
1246
+ "onUpdate:modelValue": l[1] || (l[1] = (x) => p(n).ref = x)
1247
+ }, null, 8, ["label", "modelValue"])
1248
+ ])
1249
+ ]),
1250
+ h("div", nn, [
1251
+ h("div", on, [
1252
+ h("div", sn, $(p(t)("inventory.closing.form.locations")), 1),
1253
+ k(T, {
1254
+ disabled: a.disabled,
1255
+ label: p(t)("inventory.closing.form.selectLocation"),
1256
+ "prepend-icon": "add",
1257
+ variant: "plain",
1258
+ class: "border-2 rounded-lg border-fm-color-primary",
1259
+ onClick: p(i)
1260
+ }, null, 8, ["disabled", "label", "onClick"])
1261
+ ]),
1262
+ k(d, {
1263
+ "column-defs": p(m),
1264
+ "row-data": p(c),
1265
+ "shrink-at": 9999,
1266
+ onRowClick: p(i),
1267
+ "hide-footer": ""
1268
+ }, null, 8, ["column-defs", "row-data", "onRowClick"])
1269
+ ]),
1270
+ h("div", ln, [
1271
+ h("div", an, [
1272
+ h("div", rn, $(p(t)("inventory.closing.form.items.title")), 1),
1273
+ k(T, {
1274
+ disabled: a.disabled,
1275
+ label: p(t)("inventory.closing.form.items.addItem"),
1276
+ "prepend-icon": "add",
1277
+ variant: "plain",
1278
+ class: "border-2 rounded-lg border-fm-color-primary",
1279
+ onClick: l[2] || (l[2] = (x) => y()),
1280
+ size: "md"
1281
+ }, null, 8, ["disabled", "label"])
1282
+ ]),
1283
+ (w(), N(d, {
1284
+ "column-defs": _.value,
1285
+ "row-data": p(n).items,
1286
+ key: p(n).items.map((x) => x.sku._id).join("."),
1287
+ "hide-footer": "",
1288
+ "page-size": p(n).items.length
1289
+ }, {
1290
+ "list-row": I((x) => [
1291
+ (w(), N(He, {
1292
+ row: x,
1293
+ key: p(n).items.map((P) => P.sku._id).join(".")
1294
+ }, {
1295
+ default: I((P) => [
1296
+ k(Zt, {
1297
+ row: x,
1298
+ "cell-by-col-id": P
1299
+ }, null, 8, ["row", "cell-by-col-id"])
1300
+ ]),
1301
+ _: 2
1302
+ }, 1032, ["row"]))
1303
+ ]),
1304
+ _: 1
1305
+ }, 8, ["column-defs", "row-data", "page-size"])),
1306
+ k(D, {
1307
+ "model-value": p(n).items.length,
1308
+ rules: [p(dt)(1)]
1309
+ }, null, 8, ["model-value", "rules"])
1310
+ ])
1311
+ ]),
1312
+ _: 1
1313
+ }, 8, ["disabled"]);
1314
+ };
1315
+ }
1316
+ }), mn = { class: "flex items-center" }, un = { class: "fm-typo-en-title-md-600" }, dn = { class: "flex gap-4" }, pn = /* @__PURE__ */ O({
1317
+ __name: "ClosingTemplateDialog",
1318
+ props: {
1319
+ mode: {},
1320
+ modelValue: {},
1321
+ show: { type: Boolean }
1322
+ },
1323
+ emits: ["update:show", "submitted"],
1324
+ setup(r, { expose: s, emit: o }) {
1325
+ var D;
1326
+ const n = r, t = o, e = ne(), f = te(), { t: i } = B(), m = at(n, "show");
1327
+ function c() {
1328
+ return {
1329
+ _id: "",
1330
+ name: "",
1331
+ items: []
1332
+ };
1333
+ }
1334
+ const u = S(n.modelValue ?? c()), g = S(((D = n.modelValue) == null ? void 0 : D._id) ?? `${Math.random()}`);
1335
+ Ee(
1336
+ () => n.show,
1337
+ (b) => {
1338
+ var x;
1339
+ b && (u.value = n.modelValue ?? c(), g.value = ((x = n.modelValue) == null ? void 0 : x._id) ?? `${Math.random()}`);
1340
+ }
1341
+ );
1342
+ const _ = S(!1), y = A(() => {
1343
+ switch (n.mode) {
1344
+ case H.READ:
1345
+ return "";
1346
+ case H.CREATE:
1347
+ return i("inventory.closing.template.create.title");
1348
+ case H.UPDATE:
1349
+ return i("inventory.closing.template.update.title");
1350
+ }
1351
+ return "";
1352
+ }), a = S();
1353
+ s({
1354
+ validateInputs: () => {
1355
+ var b, x;
1356
+ (x = (b = a.value) == null ? void 0 : b.validateInputs) == null || x.call(b);
1357
+ },
1358
+ resetInputsValidation: () => {
1359
+ var b, x;
1360
+ (x = (b = a.value) == null ? void 0 : b.resetInputsValidation) == null || x.call(b);
1361
+ },
1362
+ resetInputs: () => {
1363
+ var b, x;
1364
+ (x = (b = a.value) == null ? void 0 : b.resetInputs) == null || x.call(b);
1365
+ }
1366
+ });
1367
+ async function l() {
1368
+ const b = u.value;
1369
+ if (b) {
1370
+ _.value = !0;
1371
+ try {
1372
+ await e.createTemplate(b), await new Promise((x) => setTimeout(x, 1e3)), f.open({
1373
+ title: i("inventory.closing.template.create.success"),
1374
+ message: i("inventory.closing.template.create.successMessage"),
1375
+ type: "success"
1376
+ }), t("update:show", !1), t("submitted");
1377
+ } catch (x) {
1378
+ f.open({
1379
+ title: i("inventory.closing.template.create.error"),
1380
+ message: i("inventory.closing.template.create.errorMessage"),
1381
+ type: "error"
1382
+ }), console.error("Error in creating closing template", x);
1383
+ } finally {
1384
+ _.value = !1;
1385
+ }
1386
+ }
1387
+ }
1388
+ async function v() {
1389
+ const b = u.value;
1390
+ if (b) {
1391
+ _.value = !0;
1392
+ try {
1393
+ await e.updateTemplate({
1394
+ ...b,
1395
+ _rev: b._rev ?? ""
1396
+ }), await new Promise((x) => setTimeout(x, 1e3)), f.open({
1397
+ title: i("inventory.closing.template.update.success"),
1398
+ message: i("inventory.closing.template.update.successMessage"),
1399
+ type: "success"
1400
+ }), t("update:show", !1), t("submitted");
1401
+ } catch (x) {
1402
+ f.open({
1403
+ title: i("inventory.closing.template.update.error"),
1404
+ message: i("inventory.closing.template.update.errorMessage"),
1405
+ type: "error"
1406
+ }), console.error("Error in updating closing template", x);
1407
+ } finally {
1408
+ _.value = !1;
1409
+ }
1410
+ }
1411
+ }
1412
+ function T() {
1413
+ switch (n.mode) {
1414
+ case H.CREATE:
1415
+ return l();
1416
+ case H.UPDATE:
1417
+ return v();
1418
+ }
1419
+ }
1420
+ function d() {
1421
+ var b, x;
1422
+ (x = (b = a.value) == null ? void 0 : b.validateInputs) == null || x.call(b);
1423
+ }
1424
+ return (b, x) => {
1425
+ const P = M("FmButton"), se = M("FmSideSheet");
1426
+ return w(), N(se, {
1427
+ modelValue: p(m),
1428
+ "onUpdate:modelValue": x[2] || (x[2] = (Y) => qe(m) ? m.value = Y : null),
1429
+ "dismiss-away": "",
1430
+ "close-button": "",
1431
+ "max-width": 800
1432
+ }, {
1433
+ "side-sheet-header": I(() => [
1434
+ h("div", mn, [
1435
+ h("div", un, $(y.value), 1)
1436
+ ])
1437
+ ]),
1438
+ default: I(() => [
1439
+ (w(), N(cn, {
1440
+ class: "w-full",
1441
+ ref_key: "formRef",
1442
+ ref: a,
1443
+ onValidationSuccess: T,
1444
+ "model-value": u.value,
1445
+ "onUpdate:modelValue": x[0] || (x[0] = (Y) => u.value = Y),
1446
+ disabled: _.value,
1447
+ key: g.value
1448
+ }, null, 8, ["model-value", "disabled"]))
1449
+ ]),
1450
+ "side-sheet-footer": I(() => [
1451
+ h("div", dn, [
1452
+ k(P, {
1453
+ loading: _.value,
1454
+ label: p(i)("common.save"),
1455
+ onClick: d
1456
+ }, null, 8, ["loading", "label"]),
1457
+ k(P, {
1458
+ disabled: _.value,
1459
+ variant: "tertiary",
1460
+ label: p(i)("common.close"),
1461
+ onClick: x[1] || (x[1] = (Y) => t("update:show", !1))
1462
+ }, null, 8, ["disabled", "label"])
1463
+ ])
1464
+ ]),
1465
+ _: 1
1466
+ }, 8, ["modelValue"]);
1467
+ };
1468
+ }
1469
+ }), fn = {};
1470
+ function gn(r, s) {
1471
+ return w(), C("div");
1472
+ }
1473
+ const vn = /* @__PURE__ */ ft(fn, [["render", gn]]), yn = { class: "flex flex-col gap-40" }, hn = { key: 0 }, bn = {
1474
+ key: 1,
1475
+ class: "flex gap-8 items-center"
1476
+ }, _n = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary" }, xn = {
1477
+ key: 2,
1478
+ class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary"
1479
+ }, wn = {
1480
+ key: 3,
1481
+ class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary flex flex-col gap-12"
1482
+ }, kn = { class: "fm-typo-en-body-md-600" }, Tn = { class: "fm-typo-en-body-md-600" }, $n = { key: 4 }, Cn = { class: "fm-typo-en-body-md-600" }, Dn = { class: "fm-typo-en-body-md-600" }, Sn = { class: "flex sm:flex-col xs:flex-col justify-end gap-8 w-full mb-16" }, Mn = /* @__PURE__ */ O({
1483
+ __name: "ClosingTemplatePublish",
1484
+ emits: ["close"],
1485
+ setup(r, { emit: s }) {
1486
+ const o = S(!1), n = te(), t = ne(), e = oe(), { t: f } = B(), i = s;
1487
+ async function m() {
1488
+ o.value = !0;
1489
+ try {
1490
+ await t.startNewPublish().delayed(1e3), n.open({
1491
+ title: "Success",
1492
+ message: "You may refresh after a while to review publish status",
1493
+ type: "success"
1494
+ }), g();
1495
+ } catch (_) {
1496
+ n.open({
1497
+ title: "Something went wrong",
1498
+ message: "Please try again",
1499
+ type: "error"
1500
+ }), console.error("error on creating publish task", _);
1501
+ } finally {
1502
+ o.value = !1;
1503
+ }
1504
+ }
1505
+ const c = A(() => e.recentPublish.recentJob), u = A(
1506
+ () => e.templates.length && (!c.value || c.value.outlets.length === c.value.completed.length)
1507
+ );
1508
+ function g() {
1509
+ i("close");
1510
+ }
1511
+ return (_, y) => {
1512
+ const a = M("FmCircularProgress"), l = M("i18n-t"), v = M("FmButton");
1513
+ return w(), C("div", yn, [
1514
+ p(e).templates.length ? o.value ? (w(), C("div", bn, [
1515
+ h("div", null, [
1516
+ k(a, {
1517
+ size: "md",
1518
+ color: "neutral-gray-300"
1519
+ })
1520
+ ]),
1521
+ h("div", _n, [
1522
+ h("span", null, $(p(f)("inventory.closing.template.publish.publishing")), 1)
1523
+ ])
1524
+ ])) : c.value ? c.value.outlets.length === c.value.completed.length ? (w(), C("div", wn, [
1525
+ k(l, {
1526
+ keypath: "inventory.closing.template.publish.recentlyPublishedAt",
1527
+ tag: "p"
1528
+ }, {
1529
+ started: I(() => [
1530
+ h("span", kn, $(p(le)(new Date(c.value.createdAt))), 1)
1531
+ ]),
1532
+ finished: I(() => [
1533
+ h("span", Tn, $(p(le)(new Date(c.value.updatedAt))), 1)
1534
+ ]),
1535
+ _: 1
1536
+ }),
1537
+ h("p", null, $(p(f)("inventory.closing.template.publish.message")), 1)
1538
+ ])) : (w(), C("div", $n, [
1539
+ k(l, {
1540
+ keypath: "inventory.closing.template.publish.stillPublishing",
1541
+ tag: "p"
1542
+ }, {
1543
+ started: I(() => [
1544
+ h("span", Cn, $(p(le)(new Date(c.value.createdAt))), 1)
1545
+ ]),
1546
+ progress: I(() => [
1547
+ h("span", Dn, " (" + $(c.value.completed.length) + "/" + $(c.value.outlets.length) + " completed) ", 1)
1548
+ ]),
1549
+ _: 1
1550
+ }),
1551
+ Pe(" Your recent publishing task is still pending (" + $(c.value.completed.length) + " / " + $(c.value.outlets.length) + "). Please wait until all publishing task has completed. ", 1)
1552
+ ])) : (w(), C("div", xn, [
1553
+ h("p", null, $(p(f)("inventory.closing.template.publish.noRecentActivity")), 1),
1554
+ h("p", null, $(p(f)("inventory.closing.template.publish.message")), 1)
1555
+ ])) : (w(), C("div", hn, [
1556
+ h("p", null, $(p(f)("inventory.closing.template.publish.nothingToPublish")), 1)
1557
+ ])),
1558
+ h("div", Sn, [
1559
+ k(v, {
1560
+ disabled: !u.value,
1561
+ loading: o.value,
1562
+ label: "Publish to all outlets",
1563
+ onClick: m
1564
+ }, null, 8, ["disabled", "loading"]),
1565
+ k(v, {
1566
+ variant: "tertiary",
1567
+ label: "Close",
1568
+ onClick: g
1569
+ })
1570
+ ])
1571
+ ]);
1572
+ };
1573
+ }
1574
+ }), Fn = { class: "flex-1 flex flex-col gap-8" }, In = { class: "flex flex-col" }, Rn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, An = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Pn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, En = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, qn = /* @__PURE__ */ O({
1575
+ __name: "ClosingTemplateView",
1576
+ setup(r) {
1577
+ const { t: s } = B(), { createTemplate: o, updateTemplate: n, exportTemplates: t, importTemplates: e } = re(), { templateDialogProps: f, templateDetailsProps: i } = Ve(re()), m = me(), c = ce(), u = oe(), g = nt(), { breakpoints: _ } = rt();
1578
+ m.watchLocation(u.fetchTemplates);
1579
+ const y = A(() => u.loading), a = S(""), l = A(() => _.value.xs || _.value.sm), v = A(() => l.value ? 10 : 20);
1580
+ function T(E) {
1581
+ switch (E) {
1582
+ case z.Add:
1583
+ return o();
1584
+ case "publish":
1585
+ return d();
1586
+ }
1587
+ }
1588
+ function d() {
1589
+ c.open({
1590
+ title: "Publish closing templates",
1591
+ contentComponent: Mn,
1592
+ contentComponentProps: {
1593
+ onClose() {
1594
+ c.close();
1595
+ }
1596
+ }
1597
+ });
1598
+ }
1599
+ function D(E) {
1600
+ return E;
1601
+ }
1602
+ const b = A(() => {
1603
+ const E = [
1604
+ {
1605
+ label: s("inventory.closing.template.create.title"),
1606
+ value: z.Add,
1607
+ isPrimary: !0,
1608
+ prependIcon: "add"
1609
+ }
1610
+ ];
1611
+ return l.value ? E : [
1612
+ ...E,
1613
+ {
1614
+ label: "Publish",
1615
+ value: "publish",
1616
+ isPrimary: !1
1617
+ }
1618
+ ];
1619
+ }), x = A(() => {
1620
+ const E = [
1621
+ {
1622
+ icon: "refresh",
1623
+ onClick: u.fetchTemplates
1624
+ }
1625
+ ];
1626
+ return l.value ? [...E, { icon: "more_vert", onClick: () => P.value = !0 }] : [
1627
+ ...E,
1628
+ {
1629
+ icon: "upload_file",
1630
+ onClick: e
1631
+ },
1632
+ {
1633
+ icon: "ios_share",
1634
+ onClick: t
1635
+ }
1636
+ ];
1637
+ }), P = S(!1), se = [
1638
+ {
1639
+ value: "import",
1640
+ label: s("common.import")
1641
+ },
1642
+ {
1643
+ value: "export",
1644
+ label: s("common.export")
1645
+ },
1646
+ {
1647
+ value: "publish",
1648
+ label: s("inventory.closing.template.publish.title")
1649
+ }
1650
+ ];
1651
+ function Y(E) {
1652
+ switch (P.value = !1, E) {
1653
+ case "import":
1654
+ return e();
1655
+ case "export":
1656
+ return t();
1657
+ case "publish":
1658
+ return d();
1659
+ }
1660
+ }
1661
+ return (E, U) => {
1662
+ const Ye = M("FmTable"), Ke = M("FmCollapsibleTabs"), Ge = M("FmBottomSheet");
1663
+ return w(), C(j, null, [
1664
+ k(ot, {
1665
+ title: p(s)("inventory.closing.template.title"),
1666
+ actions: b.value,
1667
+ "onClick:action": T
1668
+ }, {
1669
+ default: I(() => [
1670
+ h("div", {
1671
+ class: G([
1672
+ "flex flex-col gap-8 max-h-full",
1673
+ {
1674
+ "p-0": l.value,
1675
+ "px-24 ": !l.value
1676
+ }
1677
+ ])
1678
+ }, [
1679
+ k(st, {
1680
+ searchable: "",
1681
+ search: a.value,
1682
+ "onUpdate:search": U[0] || (U[0] = (R) => a.value = R),
1683
+ actions: x.value
1684
+ }, null, 8, ["search", "actions"]),
1685
+ k(Ye, {
1686
+ style: Xe(p(g).tableHeight),
1687
+ "column-defs": p(u).columnDefs,
1688
+ "row-data": p(u).templates,
1689
+ "search-value": a.value,
1690
+ loading: y.value,
1691
+ onRowClick: U[1] || (U[1] = (R) => p(n)(R.original)),
1692
+ "page-size": v.value
1693
+ }, {
1694
+ "list-row": I((R) => [
1695
+ k(He, {
1696
+ row: R,
1697
+ onRowClick: (V) => p(n)(V)
1698
+ }, {
1699
+ default: I((V) => {
1700
+ var pe, fe, ge, X, ve, ye, he, be, Q, _e, xe, we, ke, Te, $e, Z, Ce, De, Se, Me, ee, Fe;
1701
+ return [
1702
+ h("div", Fn, [
1703
+ h("div", In, [
1704
+ h("div", Rn, [
1705
+ k(p(K), {
1706
+ render: (ge = (fe = (pe = V._id) == null ? void 0 : pe.column) == null ? void 0 : fe.columnDef) == null ? void 0 : ge.cell,
1707
+ props: (ve = (X = V._id) == null ? void 0 : X.getContext) == null ? void 0 : ve.call(X)
1708
+ }, null, 8, ["render", "props"])
1709
+ ]),
1710
+ h("div", An, [
1711
+ k(p(K), {
1712
+ render: (be = (he = (ye = V.name) == null ? void 0 : ye.column) == null ? void 0 : he.columnDef) == null ? void 0 : be.cell,
1713
+ props: (_e = (Q = V.name) == null ? void 0 : Q.getContext) == null ? void 0 : _e.call(Q)
1714
+ }, null, 8, ["render", "props"])
1715
+ ]),
1716
+ h("div", null, $((xe = R.original.locations) != null && xe.length ? p(s)("inventory.closing.table.enabledForN", {
1717
+ count: ((we = R.original.locations) == null ? void 0 : we.length) ?? 0
1718
+ }) : p(s)("inventory.closing.table.enabledForAll")), 1),
1719
+ h("div", Pn, $([
1720
+ ...R.original.items.slice(0, 3).map((Je) => Je.sku.name),
1721
+ ...R.original.items.length >= 3 ? [`and ${R.original.items.length - 3} more items`] : []
1722
+ ].join(", ")), 1),
1723
+ h("div", En, [
1724
+ k(p(K), {
1725
+ render: ($e = (Te = (ke = V.ref) == null ? void 0 : ke.column) == null ? void 0 : Te.columnDef) == null ? void 0 : $e.cell,
1726
+ props: (Ce = (Z = V.ref) == null ? void 0 : Z.getContext) == null ? void 0 : Ce.call(Z)
1727
+ }, null, 8, ["render", "props"])
1728
+ ])
1729
+ ]),
1730
+ h("div", null, [
1731
+ k(p(K), {
1732
+ render: (Me = (Se = (De = V.status) == null ? void 0 : De.column) == null ? void 0 : Se.columnDef) == null ? void 0 : Me.cell,
1733
+ props: (Fe = (ee = V.status) == null ? void 0 : ee.getContext) == null ? void 0 : Fe.call(ee)
1734
+ }, null, 8, ["render", "props"])
1735
+ ])
1736
+ ])
1737
+ ];
1738
+ }),
1739
+ _: 2
1740
+ }, 1032, ["row", "onRowClick"])
1741
+ ]),
1742
+ _: 1
1743
+ }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
1744
+ ], 2)
1745
+ ]),
1746
+ _: 1
1747
+ }, 8, ["title", "actions"]),
1748
+ (w(), N(Qe, { to: "body" }, [
1749
+ k(vn, Ze(et(p(i))), null, 16),
1750
+ k(pn, tt(p(f), {
1751
+ onSubmitted: U[2] || (U[2] = (R) => p(u).fetchTemplates())
1752
+ }), null, 16),
1753
+ k(Ge, {
1754
+ "dismiss-away": "",
1755
+ "no-header": "",
1756
+ modelValue: P.value,
1757
+ "onUpdate:modelValue": U[4] || (U[4] = (R) => P.value = R)
1758
+ }, {
1759
+ default: I(() => [
1760
+ k(Ke, {
1761
+ class: "pb-8",
1762
+ items: se,
1763
+ "onUpdate:modelValue": U[3] || (U[3] = (R) => Y(R))
1764
+ })
1765
+ ]),
1766
+ _: 1
1767
+ }, 8, ["modelValue"])
1768
+ ]))
1769
+ ], 64);
1770
+ };
1771
+ }
1772
+ });
1773
+ export {
1774
+ qn as default
1775
+ };