@feedmepos/mf-inventory-portal 0.0.23-dev.22 → 0.0.23-dev.24

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 (45) hide show
  1. package/dist/{App-B3Lc5sQ1.js → App-dQy0_X6Q.js} +3 -3
  2. package/dist/{ApprovalView-BS3jKVhn.js → ApprovalView-CxwAuXae.js} +2 -2
  3. package/dist/{BindingsDialog-CJsZBmYf.js → BindingsDialog-BX8J03Uc.js} +2 -2
  4. package/dist/{BindingsPicker-DDa3F7UG.js → BindingsPicker-CAW_3sSv.js} +1 -1
  5. package/dist/{BindingsTable-Cd43pT6-.js → BindingsTable-7UmxSmdW.js} +1 -1
  6. package/dist/ClosingDraftView-DukJAMlK.js +1135 -0
  7. package/dist/{ClosingTemplateView-BPMd73x8.js → ClosingTemplateView-Dm7_gMTo.js} +216 -217
  8. package/dist/{FmDroppableField-B0MCjb6f.js → FmDroppableField-BqZcDO2v.js} +1 -1
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-QKDk7BQ1.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DN3N20Nb.js} +3 -3
  10. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DWG1kbH5.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BrPRiS_u.js} +1 -1
  11. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-B7dXsfLJ.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-Bln1lReW.js} +1 -1
  12. package/dist/{IngredientGroupView-D8g5285H.js → IngredientGroupView-BKIJHeh9.js} +1 -1
  13. package/dist/{IngredientsView-D3EBTVpL.js → IngredientsView-Blnohl3I.js} +7 -7
  14. package/dist/{IntegrationView-BQt35u9_.js → IntegrationView-Dna4bUA7.js} +2 -2
  15. package/dist/{InventoryBindingForm-Cbh3Q5K4.js → InventoryBindingForm-D6HSF8Wn.js} +1 -1
  16. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-DD7zMo0u.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CnWvwNjJ.js} +3 -3
  17. package/dist/{InventoryBindingSummary-Z3YFpRpr.js → InventoryBindingSummary-CNNCv8NX.js} +1 -1
  18. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C8Pgb4za.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CrMkMTAt.js} +1 -1
  19. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CyCkwMSc.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Cw3E2NKS.js} +2 -2
  20. package/dist/{PurchaseOrderPrintPreview-5LKgnQqy.js → PurchaseOrderPrintPreview-PEN03dZK.js} +1 -1
  21. package/dist/{ReceiveRequestView-kHwlmbsq.js → ReceiveRequestView-rTUhjMLY.js} +146 -143
  22. package/dist/{RecipeView-CmhMcFYW.js → RecipeView-V1hx1AUG.js} +4 -4
  23. package/dist/{StockView-bpoymhya.js → StockView-B5nDn8nO.js} +7 -7
  24. package/dist/{SupplierView--_H4vORF.js → SupplierView-DyyRxm6k.js} +7 -7
  25. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-DLivaday.js → TransferDetails.vue_vue_type_script_setup_true_lang-D6oZOwHL.js} +5 -5
  26. package/dist/{TransferTemplateView-COB5dMBd.js → TransferTemplateView-OTR9Re51.js} +7 -7
  27. package/dist/{UnitView-CGkMkxTB.js → UnitView-DGhm1JXD.js} +3 -3
  28. package/dist/{WarehouseView-DPiXq2vK.js → WarehouseView-DMAvFisd.js} +1 -1
  29. package/dist/{app-DGULB4V9.js → app-DQRbwx-z.js} +2224 -2192
  30. package/dist/app.js +1 -1
  31. package/dist/{decimal-HQR2xIiL.js → decimal-DuJEFEYp.js} +1 -1
  32. package/dist/{feature-BINaF_1s.js → feature-BRqas45f.js} +1 -1
  33. package/dist/{format-unit-display-XShcYaSo.js → format-unit-display-G6VtlQe7.js} +5 -5
  34. package/dist/{index-CTfao5ul.js → index-D3f51k-I.js} +1 -1
  35. package/dist/{netsuite-DsCeD02V.js → netsuite-D4b5JceM.js} +1 -1
  36. package/dist/{stock-OVllFFZj.js → stock-DZkj2LE0.js} +1 -1
  37. package/dist/{supplier-DSinhYHO.js → supplier-Cm5Cw3u7.js} +1 -1
  38. package/dist/tsconfig.app.tsbuildinfo +1 -1
  39. package/dist/{use-inventory-binding-dialog-BBSRiAlY.js → use-inventory-binding-dialog-DCt0wUiw.js} +1 -1
  40. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +178 -8
  41. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +1498 -478
  42. package/dist/{xlsx-CHmlVmKD.js → xlsx-9Gc42bxv.js} +1 -1
  43. package/dist/{xlsx.util-DZmuhVz8.js → xlsx.util-CEvUL8mk.js} +1 -1
  44. package/package.json +1 -1
  45. package/dist/ClosingDraftView-nWXh50Xp.js +0 -1116
@@ -0,0 +1,1135 @@
1
+ import { defineComponent as fe, ref as z, resolveComponent as U, openBlock as w, createBlock as ne, withCtx as Z, createElementVNode as o, createTextVNode as ye, toDisplayString as I, unref as b, createVNode as _, h as N, computed as T, onMounted as Ue, watch as He, isRef as xe, createCommentVNode as te, createElementBlock as F, Fragment as J, normalizeClass as ae, renderList as ce, normalizeStyle as De, Teleport as Ie, mergeProps as ze } from "vue";
2
+ import { N as Ee, u as pe, a9 as O, k as Le, y as ve, h as S, t as Ne, z as se, n as Oe, aa as Ae, ab as _e, a0 as we, ac as ke, ad as oe, a6 as Ke, a8 as q, K as Ce, D as be, f as ie, e as Ve, d as Ye, a as Ge, p as qe, q as Ze, r as We, s as Je, v as ue } from "./app-DQRbwx-z.js";
3
+ import { useCoreStore as Qe, useI18n as je } from "@feedmepos/mf-common";
4
+ import { useSnackbar as ge, useDialog as Xe, useProxiedModel as et, components as de, useBreakpoints as tt } from "@feedmepos/ui-library";
5
+ import { defineStore as Se, storeToRefs as at } from "pinia";
6
+ import { t as nt, d as ot } from "./xlsx.util-CEvUL8mk.js";
7
+ import { u as Be } from "./stock-DZkj2LE0.js";
8
+ import { E as st } from "./empty-placeholder-wf6-BWE8.js";
9
+ const Fe = Ee((a, l) => {
10
+ function e() {
11
+ return pe().currentLocation.dbName;
12
+ }
13
+ return {
14
+ async getDraft(c) {
15
+ const d = e(), v = `${a.inventoryBackendUrl}/${d}/closing-draft/${c}`;
16
+ return l.get(v);
17
+ },
18
+ async readDrafts() {
19
+ const c = e(), d = `${a.inventoryBackendUrl}/${c}/closing-draft`;
20
+ return l.get(d);
21
+ },
22
+ async runOperation(c) {
23
+ const d = e(), v = `${a.inventoryBackendUrl}/${d}/closing-draft/run-operation`;
24
+ return l.post(v, c);
25
+ }
26
+ };
27
+ }), rt = { class: "fm-typo-en-body-lg-400" }, lt = { class: "fm-typo-en-body-lg-600" }, ct = { class: "flex gap-12 py-8 justify-end w-full" }, he = /* @__PURE__ */ fe({
28
+ __name: "ClosingDraftAction",
29
+ props: {
30
+ draft: {},
31
+ action: {},
32
+ onCancel: { type: Function },
33
+ onFinished: { type: Function }
34
+ },
35
+ setup(a) {
36
+ const l = a, e = z(), c = Fe(), d = ge(), v = z(!1);
37
+ async function i() {
38
+ v.value = !0;
39
+ try {
40
+ await c.runOperation({
41
+ _id: l.draft._id,
42
+ _rev: l.draft._rev ?? "",
43
+ action: l.action,
44
+ data: {
45
+ remark: e.value
46
+ }
47
+ }).delayed(500), d.open({
48
+ title: "Success",
49
+ message: "Action submitted",
50
+ type: "success"
51
+ }), l.onFinished();
52
+ } catch (f) {
53
+ d.open({
54
+ title: "Something went wrong",
55
+ message: "Unable to submit actino. Please try again",
56
+ type: "error"
57
+ }), console.error("error on submit closing draft aciont", f);
58
+ } finally {
59
+ v.value = !1;
60
+ }
61
+ }
62
+ return (f, y) => {
63
+ const B = U("FmTextField"), R = U("FmButton"), $ = U("FmForm");
64
+ return w(), ne($, {
65
+ onValidationSuccess: i,
66
+ class: "flex flex-col gap-32",
67
+ disabled: v.value
68
+ }, {
69
+ default: Z(() => [
70
+ o("div", rt, [
71
+ y[2] || (y[2] = ye(" You are about to ")),
72
+ o("span", lt, I(f.action == b(O).enum.approveDraft ? "approve" : "reject"), 1),
73
+ y[3] || (y[3] = ye(" this draft. Please provider a remark to justify this action. "))
74
+ ]),
75
+ _(B, {
76
+ modelValue: e.value,
77
+ "onUpdate:modelValue": y[0] || (y[0] = (r) => e.value = r),
78
+ label: "Remark",
79
+ "label-mark": "required",
80
+ rules: [b(Le)()]
81
+ }, null, 8, ["modelValue", "rules"]),
82
+ o("div", ct, [
83
+ _(R, {
84
+ label: "Cancel",
85
+ variant: "tertiary",
86
+ onClick: y[1] || (y[1] = (r) => f.onCancel())
87
+ }),
88
+ _(R, {
89
+ label: f.action == b(O).enum.approveDraft ? "Approve" : "Reject",
90
+ type: "submit",
91
+ variant: f.action == b(O).enum.approveDraft ? "primary" : "destructive",
92
+ loading: v.value
93
+ }, null, 8, ["label", "variant", "loading"])
94
+ ])
95
+ ]),
96
+ _: 1
97
+ }, 8, ["disabled"]);
98
+ };
99
+ }
100
+ }), it = se(0);
101
+ function $e(a) {
102
+ const l = a.measurementsAmounts.groupBy((c) => c.measurement.id), e = a.sku.unit.measurements.reduce((c, d) => {
103
+ var f, y;
104
+ const v = ((y = (f = l.get(d.id)) == null ? void 0 : f[0]) == null ? void 0 : y.amount) ?? it, i = ve(d.conversion, v);
105
+ return c + +S(i);
106
+ }, +S(a.baseAmount));
107
+ return Ne(e, a.baseAmount.precision);
108
+ }
109
+ const ut = se(0), dt = se(100);
110
+ function mt(a, l) {
111
+ const e = $e(a), c = Ae(e, l), d = l.amount === 0 ? null : _e(c, l), v = d ? ve(d, dt) : null;
112
+ return {
113
+ code: a.sku.code,
114
+ name: a.sku.name,
115
+ baseUnit: a.sku.unit.abbrev,
116
+ baseUnitAmount: +S(a.baseAmount),
117
+ ...a.measurementsAmounts.filter((f) => Re(f.measurement)).reduce(
118
+ (f, y, B) => (f[`measurementAbbrev${B}`] = `(${y.measurement.abbrev}) × ${S(y.measurement.conversion)}`, f[`measurementAmount${B}`] = +S(y.amount), f),
119
+ {}
120
+ ),
121
+ systemBalance: +S(l),
122
+ physicalBalance: +S(e),
123
+ adjustedAmount: +S(c),
124
+ adjustedDiffPercentage: v ? +S(we(v, 2)) : null
125
+ };
126
+ }
127
+ function Re(a) {
128
+ return !a.abbrev.toLocaleLowerCase().includes("inactive");
129
+ }
130
+ function ft(a) {
131
+ return a.reduce((l, e) => l + e.sku.unit.measurements.filter(Re).length, 0);
132
+ }
133
+ function pt(a) {
134
+ return [
135
+ {
136
+ id: "code",
137
+ name: "Code"
138
+ },
139
+ {
140
+ id: "name",
141
+ name: "Name"
142
+ },
143
+ {
144
+ id: "unit",
145
+ name: "Base unit amount"
146
+ },
147
+ {
148
+ id: "baseUnit",
149
+ name: "Base unit"
150
+ },
151
+ ...Array.from({ length: a }).flatMap((e, c) => [
152
+ {
153
+ id: `measurementAmount${c}`,
154
+ name: `UOM amount ${c + 1}`
155
+ },
156
+ {
157
+ id: `measurementAbbrev${c}`,
158
+ name: `UOM ${c + 1}`
159
+ }
160
+ ]),
161
+ {
162
+ id: "physicalBalance",
163
+ name: "Total balance"
164
+ },
165
+ {
166
+ id: "systemBalance",
167
+ name: "System balance"
168
+ },
169
+ {
170
+ id: "adjustedAmount",
171
+ name: "Adjusted amount"
172
+ },
173
+ {
174
+ id: "adjustedDiffPercentage",
175
+ name: "Diff (%)"
176
+ }
177
+ ];
178
+ }
179
+ function vt(a, l) {
180
+ var r, s, p, H, M, j, Q;
181
+ const e = l.groupBy(
182
+ (h) => h.id,
183
+ (h) => h.balance
184
+ ), c = a.items.map((h) => {
185
+ var K;
186
+ const k = ((K = e.get(h.sku._id)) == null ? void 0 : K[0]) ?? ut;
187
+ return mt(h, k);
188
+ }), d = ft(a.items), i = Qe().currentBusiness.value, f = pt(d), y = [
189
+ ["Business name:", i == null ? void 0 : i.name],
190
+ ["Business ID:", i == null ? void 0 : i._id],
191
+ ["Menu version", i == null ? void 0 : i.menuVersion],
192
+ ["Created at", new Date(a.createdAt)],
193
+ ["Created by", (r = a.createdBy) == null ? void 0 : r.name],
194
+ ["Updated at", new Date(a.updatedAt)],
195
+ ["Updated by", (s = a.updatedBy) == null ? void 0 : s.name],
196
+ ["Recent action", a.approvedAt ? "Approve" : a.rejectionHistory ? "Reject" : ""],
197
+ [
198
+ "Action by",
199
+ a.approvedAt ? (p = a.approvedBy) == null ? void 0 : p.name : a.rejectionHistory ? (M = (H = a.rejectionHistory[0]) == null ? void 0 : H.rejectedBy) == null ? void 0 : M.name : ""
200
+ ],
201
+ [
202
+ "Action at",
203
+ a.approvedAt ? new Date(a.approvedAt) : a.rejectionHistory ? new Date((j = a.rejectionHistory[0]) == null ? void 0 : j.rejectedAt) : ""
204
+ ],
205
+ [
206
+ "Action remark",
207
+ a.approvedAt ? a.approveRemark : a.rejectionHistory ? new Date((Q = a.rejectionHistory[0]) == null ? void 0 : Q.rejectRemark) : ""
208
+ ],
209
+ [],
210
+ f.map((h) => h.name),
211
+ ...c.map((h) => f.map((k) => h[k.id]))
212
+ ], B = f.map((h) => `system:${h.id}`), R = nt(y, B), $ = `[${i == null ? void 0 : i.name}] closing draft (${Oe(new Date(a.updatedAt))}).xlsx`;
213
+ return ot(R, $), $;
214
+ }
215
+ const me = Se(
216
+ "closingDraftActions",
217
+ function() {
218
+ const l = Xe(), e = ge(), c = ke(), d = Be(), v = z(!1), i = z();
219
+ function f(s) {
220
+ const p = {
221
+ draft: s
222
+ };
223
+ i.value = p, v.value = !0;
224
+ }
225
+ async function y(s) {
226
+ var H;
227
+ if (s.status === oe.enum.COMPLETED) {
228
+ const M = s.closingId;
229
+ if (!M)
230
+ return e.open({
231
+ title: "Something went wrong",
232
+ message: "Closing draft is completed but closing document cannot be found.",
233
+ type: "error"
234
+ }), console.error("Closing draft is completed but closing document cannot be found.", {
235
+ draftId: s == null ? void 0 : s._id
236
+ }), [];
237
+ const j = await c.getClosingById(M);
238
+ return (j == null ? void 0 : j.skus) ?? [];
239
+ } else
240
+ return await d.readStockBalance(), ((H = d.stockBalance) == null ? void 0 : H.skus) ?? [];
241
+ }
242
+ async function B(s, p) {
243
+ p || (e.open({
244
+ title: "Exporting",
245
+ message: "Fetching data..."
246
+ }), p = await y(s)), vt(s, p);
247
+ }
248
+ function R(s, p) {
249
+ l.open({
250
+ title: "Approve draft",
251
+ contentComponent: he,
252
+ contentComponentProps: {
253
+ draft: s,
254
+ action: O.enum.approveDraft,
255
+ onFinished: () => {
256
+ l.close(), p == null || p();
257
+ },
258
+ onCancel: () => l.close()
259
+ }
260
+ });
261
+ }
262
+ function $(s, p) {
263
+ l.open({
264
+ title: "Reject draft",
265
+ contentComponent: he,
266
+ contentComponentProps: {
267
+ draft: s,
268
+ action: O.enum.rejectDraft,
269
+ onFinished: () => {
270
+ l.close(), p == null || p();
271
+ },
272
+ onCancel: () => l.close()
273
+ }
274
+ });
275
+ }
276
+ function r() {
277
+ v.value = !1;
278
+ }
279
+ return {
280
+ viewDraft: f,
281
+ closeDraftDialog: r,
282
+ approveDraft: R,
283
+ rejectDraft: $,
284
+ exportDraft: B,
285
+ viewClosingDraftShow: v,
286
+ viewClosingDraftProps: i
287
+ };
288
+ }
289
+ );
290
+ function Me(a) {
291
+ switch (a) {
292
+ case "DRAFT":
293
+ return "fm-status-badge-draft";
294
+ case "PROCESSING":
295
+ return "fm-status-badge-processing";
296
+ case "FAILED":
297
+ return "fm-status-badge-cancel";
298
+ case "COMPLETED":
299
+ return "fm-status-badge-complete";
300
+ }
301
+ }
302
+ const gt = Se("closingTable", function() {
303
+ const { t: l } = je(), e = me(), c = z(new Array()), d = z(!1), v = pe(), i = Fe();
304
+ async function f() {
305
+ if (c.value = [], !!v._currentLocation) {
306
+ d.value = !0;
307
+ try {
308
+ const [r] = await Promise.all([i.readDrafts()]).delayed(1e3);
309
+ c.value = r.reverse();
310
+ } catch (r) {
311
+ console.log("Something went wrong when fetching drafts:", r);
312
+ } finally {
313
+ d.value = !1;
314
+ }
315
+ }
316
+ }
317
+ async function y(r) {
318
+ if (!c.value.find((s) => s._id) && v._currentLocation) {
319
+ d.value = !0;
320
+ try {
321
+ const [s] = await Promise.all([
322
+ i.getDraft(r),
323
+ new Promise((p) => setTimeout(p, 1e3))
324
+ ]);
325
+ c.value = [s];
326
+ } catch (s) {
327
+ console.log("Something went wrong when fetching drafts:", s);
328
+ } finally {
329
+ d.value = !1;
330
+ }
331
+ }
332
+ }
333
+ function B() {
334
+ e.closeDraftDialog(), f();
335
+ }
336
+ function R(r, s) {
337
+ switch (s = Ye(s), r) {
338
+ case ie.Details:
339
+ return e.viewDraft(s);
340
+ case ie.Export:
341
+ return e.exportDraft(s);
342
+ case O.enum.approveDraft:
343
+ return e.approveDraft(s, B);
344
+ case O.enum.rejectDraft:
345
+ return e.rejectDraft(s, B);
346
+ }
347
+ }
348
+ return {
349
+ columnDefs: [
350
+ {
351
+ id: "_id",
352
+ accessorKey: "_id",
353
+ header: () => l("inventory.closing.table.createdAt"),
354
+ cell(r) {
355
+ return Ke(`${r.getValue()}`);
356
+ },
357
+ enableSorting: !0
358
+ },
359
+ {
360
+ id: "updatedAt",
361
+ accessorFn: (r) => q(r.updatedAt),
362
+ header: () => "Updated at",
363
+ enableSorting: !0,
364
+ size: 200
365
+ },
366
+ {
367
+ id: "updatedBy",
368
+ accessorKey: "updatedBy.name",
369
+ header: () => "Last update by",
370
+ enableSorting: !0,
371
+ size: 200
372
+ },
373
+ {
374
+ id: "noOfItems",
375
+ accessorFn: (r) => {
376
+ var s;
377
+ return r.items.length + (((s = r.negativeStockItems) == null ? void 0 : s.length) ?? 0);
378
+ },
379
+ header: () => l("inventory.closing.table.noOfItems"),
380
+ enableSorting: !1,
381
+ meta: {
382
+ width: "10rem",
383
+ textAlign: "right"
384
+ }
385
+ },
386
+ {
387
+ id: "recentRemark",
388
+ accessorFn: (r) => {
389
+ var s;
390
+ return (r == null ? void 0 : r.approveRemark) ?? ((s = r == null ? void 0 : r.rejectionHistory) == null ? void 0 : s.computeFirst((p) => p.rejectRemark));
391
+ },
392
+ header: () => "Recent remark"
393
+ },
394
+ {
395
+ id: "status",
396
+ accessorFn: (r) => r.status,
397
+ header: () => l("inventory.closing.table.status"),
398
+ enableSorting: !1,
399
+ cell(r) {
400
+ const p = r.row.original.status;
401
+ return N(
402
+ "div",
403
+ {
404
+ class: "flex"
405
+ },
406
+ N(
407
+ "div",
408
+ {
409
+ class: ["fm-status-badge", Me(p)]
410
+ },
411
+ Ce(p)
412
+ )
413
+ );
414
+ }
415
+ },
416
+ {
417
+ id: "action",
418
+ cell(r) {
419
+ const s = r.row.original, p = [
420
+ be[ie.Details],
421
+ be[ie.Export]
422
+ ], H = [
423
+ {
424
+ translationKey: "inventory.closing.draft.approveDraft",
425
+ color: "text-fm-color-typo-primary",
426
+ value: O.enum.approveDraft
427
+ },
428
+ {
429
+ translationKey: "inventory.closing.draft.rejectDraft",
430
+ color: "text-fm-color-typo-error",
431
+ value: O.enum.rejectDraft
432
+ }
433
+ ];
434
+ return Ve(
435
+ [...p, ...s.status === oe.enum.DRAFT ? H : []],
436
+ (M) => R(M, s)
437
+ );
438
+ },
439
+ enableSorting: !1,
440
+ size: 40,
441
+ meta: {
442
+ cellClass: "",
443
+ headerClass: ""
444
+ }
445
+ }
446
+ ],
447
+ drafts: c,
448
+ loading: d,
449
+ fetchDrafts: f,
450
+ loadDraft: y
451
+ };
452
+ }), yt = { class: "w-full flex flex-col gap-32" }, bt = { class: "flex justify-between" }, ht = { class: "flex" }, xt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Dt = { class: "flex gap-1" }, At = { class: "fm-typo-en-body-lg-600" }, _t = { class: "flex flex-col gap-16" }, wt = { class: "flex" }, kt = { key: 0 }, Ct = {
453
+ key: 0,
454
+ class: "w-full flex flex-col items-center"
455
+ }, jt = { class: "flex items-center gap-8" }, St = {
456
+ key: 1,
457
+ class: "overflow-x-auto"
458
+ }, Bt = {
459
+ key: 1,
460
+ class: "flex-1 xs:w-screen xs:max-w-full"
461
+ }, Ft = {
462
+ key: 0,
463
+ class: "flex flex-col items-center gap-8 h-full"
464
+ }, $t = ["src"], Rt = {
465
+ key: 1,
466
+ class: "px-4 flex flex-col"
467
+ }, Mt = { class: "flex gap-12 content-stretch" }, Tt = {
468
+ class: "flex flex-col w-24",
469
+ name: "circles"
470
+ }, Pt = { class: "flex-1 flex flex-col items-center" }, Ut = { class: "flex-1 flex flex-col items-center" }, Ht = {
471
+ class: "py-12 flex flex-col gap-4",
472
+ name: "received-at header"
473
+ }, It = { class: "fm-typo-en-body-lg-400" }, zt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Et = { class: "flex gap-12 content-stretch" }, Lt = {
474
+ class: "flex flex-col w-24",
475
+ name: "circles"
476
+ }, Nt = { class: "flex-1 flex flex-col items-center" }, Ot = {
477
+ class: "py-12 flex flex-col gap-4 flex-1",
478
+ name: "delivery details"
479
+ }, Kt = { class: "flex flex-col gap-8" }, Vt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Yt = { class: "flex flex-col gap-4" }, Gt = { class: "flex gap-8" }, qt = /* @__PURE__ */ fe({
480
+ __name: "ClosingDraftDialog",
481
+ props: {
482
+ show: { type: Boolean },
483
+ draft: {}
484
+ },
485
+ emits: ["submitted"],
486
+ setup(a, { emit: l }) {
487
+ const e = a, c = Be(), d = me(), v = et(e, "show"), i = z(!1), f = z(new Array()), y = ke(), B = ge(), R = Ge(), $ = l, r = T(() => {
488
+ var n, t;
489
+ return [
490
+ ...((n = e.draft) == null ? void 0 : n.items) ?? [],
491
+ ...((t = e.draft) == null ? void 0 : t.negativeStockItems) ?? []
492
+ ];
493
+ }), s = T(() => {
494
+ const n = r.value.map((t) => t.sku);
495
+ return n.sort((t, m) => t.code.localeCompare(m.code)), n;
496
+ }), p = T(() => r.value.groupBy(
497
+ (t) => t.sku._id,
498
+ (t) => t.measurementsAmounts.filter((m) => !m.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((m) => m.measurement.id)
499
+ ));
500
+ Ue(j), He(
501
+ () => e.show,
502
+ (n) => {
503
+ n && (V.value = ee[0], j());
504
+ }
505
+ );
506
+ const H = se(0), M = se(100);
507
+ async function j() {
508
+ var t, m, u;
509
+ i.value = !0;
510
+ const n = ((t = e.draft) == null ? void 0 : t.status) === oe.enum.COMPLETED;
511
+ try {
512
+ if (await R.init(), n) {
513
+ const x = e.draft.closingId;
514
+ if (!x) {
515
+ B.open({
516
+ title: "Something went wrong",
517
+ message: "Closing draft is completed but closing document cannot be found.",
518
+ type: "error"
519
+ }), console.error("Closing draft is completed but closing document cannot be found.", {
520
+ draftId: (m = e.draft) == null ? void 0 : m._id
521
+ });
522
+ return;
523
+ }
524
+ const g = await y.getClosingById(x);
525
+ f.value = (g == null ? void 0 : g.skus) ?? [];
526
+ } else
527
+ await c.readStockBalance(), f.value = ((u = c.stockBalance) == null ? void 0 : u.skus) ?? [];
528
+ } catch (x) {
529
+ B.open({
530
+ title: "Something went wrong",
531
+ message: "Something went wrong when fetching info. Please try again.",
532
+ type: "error"
533
+ }), console.error("error on fetch stock balances", x);
534
+ } finally {
535
+ i.value = !1;
536
+ }
537
+ }
538
+ const Q = T(
539
+ () => f.value.groupBy(
540
+ (n) => n.id,
541
+ (n) => n.balance
542
+ )
543
+ ), h = T(() => r.value.groupBy((n) => n.sku._id));
544
+ function k(n) {
545
+ return N(
546
+ de.FmTooltip,
547
+ { zIndex: 51, placement: "left", class: "w-full flex justify-end" },
548
+ {
549
+ default() {
550
+ return n;
551
+ },
552
+ content() {
553
+ return "Differences are calculated using this formula: (Adjusted / System) × 100%";
554
+ }
555
+ }
556
+ );
557
+ }
558
+ const K = T(() => {
559
+ const n = s.value.reduce((m, u) => {
560
+ var x, g, P, Y;
561
+ return console.log(
562
+ "Measurement counts",
563
+ u.unit.name,
564
+ u.unit.abbrev,
565
+ (g = (x = p.value) == null ? void 0 : x.get(u._id)) == null ? void 0 : g[0].length
566
+ ), Math.max(m, ((Y = (P = p.value) == null ? void 0 : P.get(u._id)) == null ? void 0 : Y[0].length) ?? 0);
567
+ }, 0);
568
+ return [
569
+ {
570
+ id: "code",
571
+ accessorKey: "code",
572
+ header: () => "Code",
573
+ size: 200
574
+ },
575
+ {
576
+ id: "name",
577
+ accessorKey: "name",
578
+ header: () => "Name",
579
+ size: 300
580
+ },
581
+ {
582
+ id: "baseUnitAmount",
583
+ accessorKey: "baseUnitAmount",
584
+ header: () => k("Base unit amount"),
585
+ size: 200,
586
+ meta: {
587
+ textAlign: "right"
588
+ }
589
+ },
590
+ {
591
+ id: "baseUnit",
592
+ accessorKey: "baseUnit",
593
+ header: () => "Base unit",
594
+ size: 200
595
+ },
596
+ ...Array.from({ length: n }).flatMap((m, u) => {
597
+ const x = `measurementAbbrev${u}`, g = `measurementAmount${u}`;
598
+ return [
599
+ {
600
+ id: g,
601
+ accessorKey: g,
602
+ header: () => k(`UOM amount ${u + 1}`),
603
+ size: 200,
604
+ meta: {
605
+ textAlign: "right"
606
+ }
607
+ },
608
+ {
609
+ id: x,
610
+ accessorKey: x,
611
+ header: () => `UOM ${u + 1}`,
612
+ size: 200
613
+ }
614
+ ];
615
+ }),
616
+ {
617
+ id: "physicalBalance",
618
+ accessorKey: "physicalBalance",
619
+ header: () => k("Total balance"),
620
+ size: 200,
621
+ meta: {
622
+ textAlign: "right"
623
+ }
624
+ },
625
+ {
626
+ id: "systemBalance",
627
+ accessorKey: "systemBalance",
628
+ header: () => k("System balance"),
629
+ size: 200,
630
+ meta: {
631
+ textAlign: "right"
632
+ }
633
+ },
634
+ {
635
+ id: "adjustedAmount",
636
+ accessorKey: "adjustedAmount",
637
+ header: () => k("Adjusted amount"),
638
+ size: 200,
639
+ meta: {
640
+ textAlign: "right"
641
+ }
642
+ },
643
+ {
644
+ id: "adjustedDiffPercentage",
645
+ accessorKey: "adjustedDiffPercentage",
646
+ header: () => N(
647
+ de.FmTooltip,
648
+ { zIndex: 51, placement: "left", class: "w-full flex justify-end" },
649
+ {
650
+ default() {
651
+ return N("div", { class: "flex items-center gap-4" }, [
652
+ "Diff (%)",
653
+ N(de.FmIcon, { name: "info", color: "neutral-gray-400", size: "sm" })
654
+ ]);
655
+ },
656
+ content() {
657
+ return "Differences are calculated using this formula: (Adjusted / System) × 100%";
658
+ }
659
+ }
660
+ ),
661
+ size: 200,
662
+ cell(m) {
663
+ const u = m.row.original.adjustedDiffPercentage;
664
+ if (!u) return "N/A";
665
+ const x = u.toFixed(2);
666
+ if (x === "0.00")
667
+ return N("div", { class: "flex items-center gap-4 justify-end" }, ["0.00"]);
668
+ const g = u > 0;
669
+ return N("div", { class: "flex items-center gap-4 justify-end" }, [
670
+ N(de.FmIcon, {
671
+ name: g ? "arrow_drop_up" : "arrow_drop_down",
672
+ color: g ? "system-success-300" : "system-error-300",
673
+ size: "md"
674
+ }),
675
+ x
676
+ ]);
677
+ },
678
+ meta: {
679
+ textAlign: "right"
680
+ }
681
+ }
682
+ ];
683
+ }), re = T(() => K.value.map((n) => n.size ?? 0).reduce((n, t) => n + t)), le = T(() => s.value.map((n) => {
684
+ var L, W;
685
+ const t = (L = h.value.get(n._id)) == null ? void 0 : L[0], m = ((W = Q.value.get(n._id)) == null ? void 0 : W[0]) ?? H;
686
+ if (!t)
687
+ return {
688
+ code: n.code,
689
+ name: n.name,
690
+ baseUnit: n.unit.abbrev,
691
+ baseUnitAmount: 0,
692
+ systemBalance: +S(m),
693
+ physicalBalance: 0,
694
+ adjustedAmount: -+S(m),
695
+ adjustedDiffPercentage: -100
696
+ };
697
+ const u = $e(t), x = Ae(u, m), g = m.amount === 0 ? null : _e(x, {
698
+ ...m,
699
+ amount: Math.abs(m.amount)
700
+ }), P = g ? ve(g, M) : null;
701
+ return {
702
+ code: n.code,
703
+ name: n.name,
704
+ baseUnit: n.unit.abbrev,
705
+ baseUnitAmount: +S(t.baseAmount),
706
+ ...t.measurementsAmounts.filter((A) => {
707
+ var D, C, G;
708
+ return (G = (C = (D = p.value) == null ? void 0 : D.get(n._id)) == null ? void 0 : C[0]) == null ? void 0 : G.includes(A.measurement.id);
709
+ }).reduce((A, D, C) => (A[`measurementAbbrev${C}`] = `(${D.measurement.abbrev}) × ${S(D.measurement.conversion)}`, A[`measurementAmount${C}`] = +S(D.amount), A), {}),
710
+ systemBalance: +S(m),
711
+ physicalBalance: +S(u),
712
+ adjustedAmount: +S(x),
713
+ adjustedDiffPercentage: P ? +S(we(P, 2)) : null
714
+ };
715
+ })), X = T(() => {
716
+ var t, m;
717
+ if (!e.draft) return [];
718
+ const n = e.draft.approvedAt ? {
719
+ action: `Approve at ${q(e.draft.approvedAt)}`,
720
+ // actionAt: props.draft.approvedAt,
721
+ actionBy: e.draft.approvedBy,
722
+ remark: e.draft.approveRemark
723
+ } : (t = e.draft.rejectionHistory) == null ? void 0 : t.computeFirst((u) => ({
724
+ action: `Reject at ${q(u.rejectedAt)}`,
725
+ // actionAt: e.rejectedAt,
726
+ actionBy: u.rejectedBy,
727
+ remark: u.rejectRemark
728
+ }));
729
+ return [
730
+ {
731
+ label: "Created at",
732
+ value: q(e.draft.createdAt)
733
+ },
734
+ {
735
+ label: "Created by",
736
+ value: e.draft.createdBy.name
737
+ },
738
+ {
739
+ label: "Updated at",
740
+ value: q(e.draft.updatedAt)
741
+ },
742
+ {
743
+ label: "Updated by",
744
+ value: e.draft.updatedBy.name
745
+ },
746
+ {
747
+ label: "Effective at",
748
+ value: q(e.draft.effectiveAt ?? e.draft.updatedAt)
749
+ },
750
+ n ? {
751
+ label: "Last action",
752
+ value: n.action
753
+ } : null,
754
+ n && n.actionBy ? {
755
+ label: "Last action by",
756
+ value: (m = n.actionBy) == null ? void 0 : m.name
757
+ } : null,
758
+ n && n.remark ? {
759
+ label: "Action remark",
760
+ value: n.remark
761
+ } : null
762
+ ].filter((u) => u).map((u) => u);
763
+ }), ee = [
764
+ {
765
+ label: "Overview",
766
+ value: "overview"
767
+ },
768
+ {
769
+ label: "Action history",
770
+ value: "history"
771
+ }
772
+ ], V = z(ee[0]), E = T(() => {
773
+ var t, m, u, x;
774
+ return [
775
+ ...(((t = e.draft) == null ? void 0 : t.rejectionHistory) ?? []).map(
776
+ (g) => ({
777
+ header: "Reject",
778
+ date: q(g.rejectedAt),
779
+ info: [
780
+ {
781
+ label: "Rejected by",
782
+ values: [g.rejectedBy.name]
783
+ },
784
+ {
785
+ label: "Rejection remark",
786
+ values: [g.rejectRemark]
787
+ }
788
+ ]
789
+ })
790
+ ),
791
+ ...(m = e.draft) != null && m.approvedBy ? [
792
+ {
793
+ header: "Approve",
794
+ date: e.draft.approvedAt ? q(e.draft.approvedAt) : "",
795
+ info: [
796
+ {
797
+ label: "Approved by",
798
+ values: [(u = e.draft) == null ? void 0 : u.approvedBy.name]
799
+ },
800
+ {
801
+ label: "Approval remark",
802
+ values: [((x = e.draft) == null ? void 0 : x.approveRemark) ?? ""]
803
+ }
804
+ ]
805
+ }
806
+ ] : []
807
+ ];
808
+ });
809
+ return (n, t) => {
810
+ const m = U("FmButtonGroup"), u = U("FmMenuDivider"), x = U("FmCard"), g = U("FmButton"), P = U("FmCircularProgress"), Y = U("FmTable"), L = U("FmSpacer"), W = U("FmSideSheet");
811
+ return w(), ne(W, {
812
+ "dismiss-away": "",
813
+ "max-width": 900,
814
+ "model-value": b(v),
815
+ "onUpdate:modelValue": t[5] || (t[5] = (A) => xe(v) ? v.value = A : null),
816
+ header: "Closing details"
817
+ }, {
818
+ "side-sheet-footer": Z(() => {
819
+ var A, D;
820
+ return [
821
+ o("div", Gt, [
822
+ ((A = e.draft) == null ? void 0 : A.status) === b(oe).enum.DRAFT ? (w(), ne(g, {
823
+ key: 0,
824
+ label: "Approve",
825
+ onClick: t[2] || (t[2] = () => e.draft && b(d).approveDraft(e.draft, () => $("submitted")))
826
+ })) : te("", !0),
827
+ ((D = e.draft) == null ? void 0 : D.status) === b(oe).enum.DRAFT ? (w(), ne(g, {
828
+ key: 1,
829
+ label: "Reject",
830
+ variant: "destructive",
831
+ onClick: t[3] || (t[3] = () => e.draft && b(d).rejectDraft(e.draft, () => $("submitted")))
832
+ })) : te("", !0),
833
+ _(g, {
834
+ label: "Close",
835
+ variant: "tertiary",
836
+ onClick: t[4] || (t[4] = (C) => v.value = !1)
837
+ })
838
+ ])
839
+ ];
840
+ }),
841
+ default: Z(() => [
842
+ o("div", yt, [
843
+ o("div", null, [
844
+ _(m, {
845
+ items: ee,
846
+ modelValue: V.value,
847
+ "onUpdate:modelValue": t[0] || (t[0] = (A) => V.value = A)
848
+ }, null, 8, ["modelValue"])
849
+ ]),
850
+ V.value.value === "overview" ? (w(), F(J, { key: 0 }, [
851
+ _(x, {
852
+ variant: "outlined",
853
+ class: "flex flex-col gap-8 px-12 py-16"
854
+ }, {
855
+ default: Z(() => {
856
+ var A, D;
857
+ return [
858
+ o("div", bt, [
859
+ t[6] || (t[6] = o("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
860
+ o("div", ht, [
861
+ o("div", {
862
+ class: ae(["fm-status-badge", b(Me)(((A = n.draft) == null ? void 0 : A.status) ?? "DRAFT")])
863
+ }, I(b(Ce)(((D = n.draft) == null ? void 0 : D.status) ?? "")), 3)
864
+ ])
865
+ ]),
866
+ _(u),
867
+ (w(!0), F(J, null, ce(X.value, (C, G) => (w(), F("div", {
868
+ class: "flex flex-col gap-4",
869
+ key: G
870
+ }, [
871
+ o("div", xt, [
872
+ o("div", Dt, I(C.label), 1)
873
+ ]),
874
+ o("div", At, I(C.value), 1)
875
+ ]))), 128))
876
+ ];
877
+ }),
878
+ _: 1
879
+ }),
880
+ o("div", _t, [
881
+ o("div", wt, [
882
+ t[7] || (t[7] = o("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
883
+ i.value ? te("", !0) : (w(), F("div", kt, [
884
+ _(g, {
885
+ label: "Export data",
886
+ "prepend-icon": "download",
887
+ variant: "secondary",
888
+ "text-color": "primary",
889
+ "bg-color": "transparent",
890
+ "border-color": "primary",
891
+ onClick: t[1] || (t[1] = (A) => n.draft ? b(d).exportDraft(n.draft, f.value) : null)
892
+ })
893
+ ]))
894
+ ]),
895
+ i.value ? (w(), F("div", Ct, [
896
+ t[9] || (t[9] = o("div", { class: "h-80" }, null, -1)),
897
+ o("div", jt, [
898
+ o("div", null, [
899
+ _(P, { size: "md" })
900
+ ]),
901
+ t[8] || (t[8] = o("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
902
+ ]),
903
+ t[10] || (t[10] = o("div", { class: "h-80" }, null, -1))
904
+ ])) : (w(), F("div", St, [
905
+ o("div", {
906
+ style: De({ width: `${re.value}px` })
907
+ }, [
908
+ _(Y, {
909
+ "column-defs": K.value,
910
+ "row-data": le.value
911
+ }, null, 8, ["column-defs", "row-data"])
912
+ ], 4)
913
+ ]))
914
+ ])
915
+ ], 64)) : te("", !0),
916
+ V.value.value === "history" ? (w(), F("div", Bt, [
917
+ E.value.length ? (w(), F("div", Rt, [
918
+ (w(!0), F(J, null, ce(E.value, (A, D) => (w(), F(J, { key: D }, [
919
+ o("div", Mt, [
920
+ o("div", Tt, [
921
+ o("div", Pt, [
922
+ o("div", {
923
+ class: ae([
924
+ {
925
+ "bg-fm-color-primary": D !== 0,
926
+ "bg-white": D === 0
927
+ },
928
+ "w-[2px] h-full"
929
+ ])
930
+ }, null, 2)
931
+ ]),
932
+ t[13] || (t[13] = o("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
933
+ o("div", Ut, [
934
+ o("div", {
935
+ class: ae([
936
+ {
937
+ "bg-fm-color-primary": D < E.value.length - 1,
938
+ "bg-white": D >= E.value.length - 1
939
+ },
940
+ "w-[2px] h-full"
941
+ ])
942
+ }, null, 2)
943
+ ])
944
+ ]),
945
+ o("div", Ht, [
946
+ o("div", It, I(A.header), 1),
947
+ o("div", zt, I(A.date), 1)
948
+ ])
949
+ ]),
950
+ o("div", Et, [
951
+ o("div", Lt, [
952
+ o("div", Nt, [
953
+ o("div", {
954
+ class: ae([
955
+ {
956
+ "bg-fm-color-primary": D < E.value.length - 1,
957
+ "bg-white": D >= E.value.length - 1
958
+ },
959
+ "w-[2px] h-full"
960
+ ])
961
+ }, null, 2)
962
+ ])
963
+ ]),
964
+ o("div", Ot, [
965
+ _(x, {
966
+ variant: "outlined",
967
+ class: "py-12 px-16"
968
+ }, {
969
+ default: Z(() => [
970
+ o("div", Kt, [
971
+ (w(!0), F(J, null, ce(A.info, (C, G) => (w(), F("div", {
972
+ key: G,
973
+ class: "flex flex-col gap-4"
974
+ }, [
975
+ o("div", Vt, I(C == null ? void 0 : C.label), 1),
976
+ o("div", Yt, [
977
+ (w(!0), F(J, null, ce(C == null ? void 0 : C.values, (Te, Pe) => (w(), F("div", {
978
+ key: Pe,
979
+ class: "fm-typo-en-body-lg-600"
980
+ }, I(Te), 1))), 128))
981
+ ])
982
+ ]))), 128))
983
+ ])
984
+ ]),
985
+ _: 2
986
+ }, 1024)
987
+ ])
988
+ ])
989
+ ], 64))), 128))
990
+ ])) : (w(), F("div", Ft, [
991
+ _(L),
992
+ o("div", null, [
993
+ o("img", {
994
+ src: b(st),
995
+ alt: "List is empty"
996
+ }, null, 8, $t)
997
+ ]),
998
+ t[11] || (t[11] = o("div", { class: "fm-typo-en-body-lg-600" }, I("No records found"), -1)),
999
+ t[12] || (t[12] = o("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, I("You can track approval and rejection history here"), -1)),
1000
+ _(L),
1001
+ _(L)
1002
+ ]))
1003
+ ])) : te("", !0)
1004
+ ])
1005
+ ]),
1006
+ _: 1
1007
+ }, 8, ["model-value"]);
1008
+ };
1009
+ }
1010
+ }), Zt = { class: "flex-1 flex flex-col gap-8" }, Wt = { class: "flex flex-col" }, Jt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Qt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Xt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, ea = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, ia = /* @__PURE__ */ fe({
1011
+ __name: "ClosingDraftView",
1012
+ setup(a) {
1013
+ const { t: l } = je(), { viewDraft: e } = me(), { viewClosingDraftProps: c, viewClosingDraftShow: d } = at(me()), v = pe(), i = gt(), f = qe(), { breakpoints: y } = tt();
1014
+ v.watchLocation(i.fetchDrafts);
1015
+ const B = T(() => i.loading), R = z(""), $ = T(() => y.value.xs || y.value.sm), r = T(() => $.value ? 10 : 20);
1016
+ function s(M) {
1017
+ switch (M) {
1018
+ case "refresh":
1019
+ return i.fetchDrafts();
1020
+ }
1021
+ }
1022
+ function p(M) {
1023
+ return M;
1024
+ }
1025
+ const H = T(() => $.value ? [
1026
+ {
1027
+ label: "Refresh",
1028
+ value: "refresh",
1029
+ isPrimary: !1
1030
+ }
1031
+ ] : [
1032
+ {
1033
+ label: "Refresh",
1034
+ value: "refresh",
1035
+ isPrimary: !1
1036
+ }
1037
+ ]);
1038
+ return (M, j) => {
1039
+ const Q = U("FmTable");
1040
+ return w(), F(J, null, [
1041
+ _(Ze, {
1042
+ title: b(l)("inventory.closing.draft.title"),
1043
+ actions: H.value,
1044
+ "onClick:action": s
1045
+ }, {
1046
+ default: Z(() => [
1047
+ o("div", {
1048
+ class: ae([
1049
+ "flex flex-col gap-8 max-h-full",
1050
+ {
1051
+ "p-0": $.value,
1052
+ "px-24 ": !$.value
1053
+ }
1054
+ ])
1055
+ }, [
1056
+ _(We, {
1057
+ "change-location": "",
1058
+ searchable: "",
1059
+ search: R.value,
1060
+ "onUpdate:search": j[0] || (j[0] = (h) => R.value = h)
1061
+ }, null, 8, ["search"]),
1062
+ _(Q, {
1063
+ style: De(b(f).tableHeight),
1064
+ "column-defs": b(i).columnDefs,
1065
+ "row-data": b(i).drafts,
1066
+ "search-value": R.value,
1067
+ loading: B.value,
1068
+ onRowClick: j[1] || (j[1] = (h) => b(e)(h.original)),
1069
+ "page-size": r.value
1070
+ }, {
1071
+ "list-row": Z((h) => [
1072
+ _(Je, {
1073
+ row: h,
1074
+ onRowClick: (k) => b(e)(k)
1075
+ }, {
1076
+ default: Z((k) => {
1077
+ var K, re, le, X, ee, V, E, n, t, m, u, x, g, P, Y, L, W, A, D, C;
1078
+ return [
1079
+ o("div", Zt, [
1080
+ o("div", Wt, [
1081
+ o("div", Jt, [
1082
+ _(b(ue), {
1083
+ render: (le = (re = (K = k._id) == null ? void 0 : K.column) == null ? void 0 : re.columnDef) == null ? void 0 : le.cell,
1084
+ props: (ee = (X = k._id) == null ? void 0 : X.getContext) == null ? void 0 : ee.call(X)
1085
+ }, null, 8, ["render", "props"])
1086
+ ]),
1087
+ o("div", Qt, [
1088
+ _(b(ue), {
1089
+ render: (n = (E = (V = k.name) == null ? void 0 : V.column) == null ? void 0 : E.columnDef) == null ? void 0 : n.cell,
1090
+ props: (m = (t = k.name) == null ? void 0 : t.getContext) == null ? void 0 : m.call(t)
1091
+ }, null, 8, ["render", "props"])
1092
+ ]),
1093
+ o("div", Xt, I([
1094
+ ...h.original.items.slice(0, 3).map((G) => G.sku.name),
1095
+ ...h.original.items.length >= 3 ? [`and ${h.original.items.length - 3} more items`] : []
1096
+ ].join(", ")), 1),
1097
+ o("div", ea, [
1098
+ _(b(ue), {
1099
+ render: (g = (x = (u = k.ref) == null ? void 0 : u.column) == null ? void 0 : x.columnDef) == null ? void 0 : g.cell,
1100
+ props: (Y = (P = k.ref) == null ? void 0 : P.getContext) == null ? void 0 : Y.call(P)
1101
+ }, null, 8, ["render", "props"])
1102
+ ])
1103
+ ]),
1104
+ o("div", null, [
1105
+ _(b(ue), {
1106
+ render: (A = (W = (L = k.status) == null ? void 0 : L.column) == null ? void 0 : W.columnDef) == null ? void 0 : A.cell,
1107
+ props: (C = (D = k.status) == null ? void 0 : D.getContext) == null ? void 0 : C.call(D)
1108
+ }, null, 8, ["render", "props"])
1109
+ ])
1110
+ ])
1111
+ ];
1112
+ }),
1113
+ _: 2
1114
+ }, 1032, ["row", "onRowClick"])
1115
+ ]),
1116
+ _: 1
1117
+ }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
1118
+ ], 2)
1119
+ ]),
1120
+ _: 1
1121
+ }, 8, ["title", "actions"]),
1122
+ (w(), ne(Ie, { to: "body" }, [
1123
+ _(qt, ze(b(c), {
1124
+ show: b(d),
1125
+ "onUpdate:show": j[2] || (j[2] = (h) => xe(d) ? d.value = h : null),
1126
+ onSubmitted: j[3] || (j[3] = () => (d.value = !1, b(i).fetchDrafts()))
1127
+ }), null, 16, ["show"])
1128
+ ]))
1129
+ ], 64);
1130
+ };
1131
+ }
1132
+ });
1133
+ export {
1134
+ ia as default
1135
+ };