@feedmepos/mf-inventory-portal 1.2.22-dev.2 → 1.2.22-dev.3

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 (50) hide show
  1. package/dist/{App-DtwLZ9Ng.js → App-aHs88TEq.js} +1 -1
  2. package/dist/{ApprovalView-DTiPzA1y.js → ApprovalView-DBZQsKg9.js} +2 -2
  3. package/dist/{BindingsDialog--1wB_TX2.js → BindingsDialog-arTYvJn2.js} +2 -2
  4. package/dist/{BindingsPicker-JjZfjlvz.js → BindingsPicker-Bm0s6sKE.js} +1 -1
  5. package/dist/{BindingsTable-M2CGWdTD.js → BindingsTable-DXlM-qDU.js} +1 -1
  6. package/dist/ClosingDraftView-DVB02I09.js +1888 -0
  7. package/dist/{ClosingTemplateView-B1TVIzzy.js → ClosingTemplateView-k8EkjlIJ.js} +2 -2
  8. package/dist/{DeliveryOrderPrintPreview-CUXfCixj.js → DeliveryOrderPrintPreview-CSv5FOby.js} +1 -1
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Bdw3Q4Dz.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-D0BKSSSp.js} +3 -3
  10. package/dist/{FmMultiselectDialog-CyYcvvyg.js → FmMultiselectDialog-DOf8rbVD.js} +1 -1
  11. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-D-FDSjxY.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BZX05ToS.js} +1 -1
  12. package/dist/{ImportView-BR7JpsG8.js → ImportView-6ckPf1Ll.js} +2 -2
  13. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-Bae5DUA9.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-QK12Klz5.js} +1 -1
  14. package/dist/{IngredientGroupView-c6XH5Fzg.js → IngredientGroupView-D2RuwnJ3.js} +2 -2
  15. package/dist/{IngredientsView-D4JiQ6Bp.js → IngredientsView-CZIyrGJ0.js} +7 -7
  16. package/dist/{IntegrationView-BdOTe6FG.js → IntegrationView-D9JrR8Hb.js} +3 -3
  17. package/dist/{InventoryBindingForm-kqrZutMr.js → InventoryBindingForm-6QGOGZlB.js} +1 -1
  18. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-DZ-Mr8-U.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DG_WKGVU.js} +3 -3
  19. package/dist/{InventoryBindingSummary-D4p9cOiy.js → InventoryBindingSummary-CoeODKLp.js} +1 -1
  20. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Bj_2aQiY.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Ovi_bWlF.js} +1 -1
  21. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CX9H2gLU.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CaKjg0eV.js} +1 -1
  22. package/dist/{PublishView-DcQQtuF8.js → PublishView-BLtshSks.js} +1 -1
  23. package/dist/{PurchaseOrderPrintPreview-Ueo4Yftu.js → PurchaseOrderPrintPreview-DCLjVNlh.js} +1 -1
  24. package/dist/{ReceiveRequestView-Cikz66hY.js → ReceiveRequestView-DdJ3_qMY.js} +8 -8
  25. package/dist/{RecipeView-DL1kKy2w.js → RecipeView-DYFDguU9.js} +3 -3
  26. package/dist/{StockView-DzaCcxc5.js → StockView-DyUrO7Y0.js} +7 -7
  27. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DP5AFZM2.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Bj05qEWl.js} +1 -1
  28. package/dist/{SupplierView-CJuI_jPc.js → SupplierView-BYDbDGfd.js} +4 -4
  29. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-BoZEbHkN.js → TransferDetails.vue_vue_type_script_setup_true_lang-DuaHM-Wk.js} +5 -5
  30. package/dist/{TransferTemplateView-DiGdnr0-.js → TransferTemplateView-db5L1CIZ.js} +7 -7
  31. package/dist/{UnitView-CA2isH5r.js → UnitView-4ygzmFTY.js} +3 -3
  32. package/dist/{WarehouseView-BMUJN1D1.js → WarehouseView-D-b-t21n.js} +1 -1
  33. package/dist/{app-DdrL4md8.js → app-BDiHcGqi.js} +28748 -28983
  34. package/dist/app.js +1 -1
  35. package/dist/{decimal-DJjE7Vf3.js → decimal-C-phHxE7.js} +1 -1
  36. package/dist/{format-unit-display-CK-PNM0G.js → format-unit-display-MVZRrkkD.js} +3 -3
  37. package/dist/{import-export.helper-CJeCekEB.js → import-export.helper-C3camZX5.js} +1 -1
  38. package/dist/{index-Crgf6sCC.js → index-B60G756h.js} +1 -1
  39. package/dist/{index-D4F6boO1.js → index-B6zknB--.js} +1 -1
  40. package/dist/{purchase-order-template-BOLP3UzN.js → purchase-order-template-Bkz_Xjv5.js} +1 -1
  41. package/dist/{stock-DqL6z9wL.js → stock-DnawcaKQ.js} +1 -1
  42. package/dist/{supplier-CW3GGX9U.js → supplier-Bq0fMcn0.js} +1 -1
  43. package/dist/tsconfig.app.tsbuildinfo +1 -1
  44. package/dist/{use-ingredient-select-dialog-CrCo-DHA.js → use-ingredient-select-dialog-BH2O0eEN.js} +1 -1
  45. package/dist/{use-inventory-binding-dialog-RdX9Q4q9.js → use-inventory-binding-dialog-CI_pMWSk.js} +1 -1
  46. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +56 -0
  47. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +468 -0
  48. package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +8 -1
  49. package/package.json +4 -4
  50. package/dist/ClosingDraftView-B800NjEZ.js +0 -1739
@@ -1,1739 +0,0 @@
1
- import { defineComponent as Te, ref as V, computed as U, onMounted as Ue, resolveComponent as P, openBlock as w, createElementBlock as L, Fragment as J, createTextVNode as Z, createBlock as Q, withCtx as O, createElementVNode as o, toDisplayString as q, unref as F, createVNode as k, createCommentVNode as ee, h as T, reactive as nt, watch as ot, isRef as Ye, normalizeClass as be, renderList as _e, normalizeStyle as Ke, Teleport as st, mergeProps as rt } from "vue";
2
- import { aa as lt, u as Ie, ax as E, am as Ge, ay as We, r as ct, Z as Ee, n as N, t as it, a0 as he, W as ut, Y as dt, X as mt, az as qe, aA as Ze, ah as Je, aB as re, an as ft, ac as Me, ab as le, a6 as Le, D as Oe, j as Se, i as pt, f as vt, a as yt, $ as Fe, G as gt, I as bt, J as At, K as Dt, L as je } from "./app-DdrL4md8.js";
3
- import { useCoreStore as kt, useI18n as Xe } from "@feedmepos/mf-common";
4
- import { useSnackbar as He, useDialog as _t, useProxiedModel as ht, components as ge, useBreakpoints as xt } from "@feedmepos/ui-library";
5
- import { defineStore as Qe, storeToRefs as wt } from "pinia";
6
- import { a as Ve, u as et } from "./stock-DqL6z9wL.js";
7
- import { E as Ct } from "./empty-placeholder-wf6-BWE8.js";
8
- const Re = lt((l, s) => {
9
- function e() {
10
- return Ie().currentLocation.dbName;
11
- }
12
- return {
13
- async getDraft(u) {
14
- const p = e(), _ = `${l.inventoryBackendUrl}/${p}/closing-draft/${u}`;
15
- return s.get(_);
16
- },
17
- async readDrafts() {
18
- const u = e(), p = `${l.inventoryBackendUrl}/${u}/closing-draft`;
19
- return s.get(p);
20
- },
21
- async runOperation(u) {
22
- const p = e(), _ = `${l.inventoryBackendUrl}/${p}/closing-draft/run-operation`;
23
- return s.post(_, u);
24
- },
25
- async sync(u) {
26
- const p = e(), _ = `${l.inventoryBackendUrl}/${p}/closing-draft/sync`;
27
- return s.post(_, u);
28
- }
29
- };
30
- }), St = { class: "fm-typo-en-body-lg-400" }, Ft = { class: "fm-typo-en-body-lg-600" }, jt = {
31
- key: 0,
32
- class: "flex flex-col"
33
- }, Bt = { class: "flex gap-12 py-8 justify-end w-full" }, Pe = /* @__PURE__ */ Te({
34
- __name: "ClosingDraftAction",
35
- props: {
36
- draft: {},
37
- action: {},
38
- onCancel: { type: Function },
39
- onFinished: { type: Function }
40
- },
41
- setup(l) {
42
- const s = l, e = V(), u = Re(), p = He(), _ = V(!1), m = V(null), R = V(!1), C = U(() => {
43
- switch (s.action) {
44
- case E.enum.approveDraft:
45
- return "Approve";
46
- case E.enum.rejectDraft:
47
- return "Reject";
48
- case E.enum.markAsFailed:
49
- return "Mark as Failed";
50
- }
51
- throw new Error(`Unknown action: ${s.action}`);
52
- }), x = U(() => {
53
- switch (s.action) {
54
- case E.enum.approveDraft:
55
- return "primary";
56
- case E.enum.rejectDraft:
57
- return "destructive";
58
- case E.enum.markAsFailed:
59
- return "destructive";
60
- }
61
- throw new Error(`Unknown action: ${s.action}`);
62
- });
63
- Ue(() => {
64
- if (s.draft.effectiveAt)
65
- m.value = new Date(s.draft.effectiveAt);
66
- else {
67
- const n = new Date(s.draft.createdAt);
68
- n.setHours(23, 59, 59, 999), m.value = n;
69
- }
70
- R.value = !0;
71
- });
72
- const v = U({
73
- get() {
74
- return m.value === null ? "" : Ge(m.value);
75
- },
76
- set(n) {
77
- if (n) {
78
- const a = /* @__PURE__ */ new Date(`${n} ${I.value}`);
79
- a.setSeconds(59, 999), m.value = a;
80
- } else
81
- m.value = null;
82
- }
83
- }), I = U({
84
- get() {
85
- return m.value === null ? "" : We(m.value);
86
- },
87
- set(n) {
88
- if (n) {
89
- const a = /* @__PURE__ */ new Date(`${v.value} ${n}`);
90
- a.setSeconds(59, 999), m.value = a;
91
- } else
92
- m.value = null;
93
- }
94
- });
95
- async function Y() {
96
- _.value = !0;
97
- try {
98
- await u.runOperation({
99
- _id: s.draft._id,
100
- _rev: s.draft._rev ?? "",
101
- action: s.action,
102
- data: {
103
- effectiveAt: m.value ? m.value.toISOString() : null,
104
- remark: e.value
105
- }
106
- }).delayed(500), p.open({
107
- title: "Success",
108
- message: "Action submitted",
109
- type: "success"
110
- }), s.onFinished();
111
- } catch (n) {
112
- p.open({
113
- title: "Something went wrong",
114
- message: "Unable to submit action. Please try again",
115
- type: "error"
116
- }), console.error("error on submit closing draft action", n);
117
- } finally {
118
- _.value = !1;
119
- }
120
- }
121
- return (n, a) => {
122
- const j = P("FmLabel"), M = P("FmDatePicker"), f = P("FmTimePicker"), g = P("FmTextField"), b = P("FmButton"), $ = P("FmForm");
123
- return R.value ? (w(), Q($, {
124
- key: 1,
125
- onValidationSuccess: Y,
126
- class: "flex flex-col gap-32",
127
- disabled: _.value
128
- }, {
129
- default: O(() => [
130
- o("div", St, [
131
- a[4] || (a[4] = Z(" You are about to ")),
132
- o("span", Ft, q(C.value), 1),
133
- a[5] || (a[5] = Z(" this draft. Please provide a remark to justify this action. "))
134
- ]),
135
- n.action === F(E).enum.approveDraft ? (w(), L("div", jt, [
136
- k(j, { class: "fm-typo-en-body-lg-600" }, {
137
- default: O(() => a[6] || (a[6] = [
138
- Z("Closing Date")
139
- ])),
140
- _: 1
141
- }),
142
- k(M, {
143
- modelValue: v.value,
144
- "onUpdate:modelValue": a[0] || (a[0] = (H) => v.value = H)
145
- }, null, 8, ["modelValue"]),
146
- k(j, { class: "fm-typo-en-body-lg-600" }, {
147
- default: O(() => a[7] || (a[7] = [
148
- Z("Closing Time")
149
- ])),
150
- _: 1
151
- }),
152
- k(f, {
153
- modelValue: I.value,
154
- "onUpdate:modelValue": a[1] || (a[1] = (H) => I.value = H)
155
- }, null, 8, ["modelValue"])
156
- ])) : ee("", !0),
157
- k(g, {
158
- modelValue: e.value,
159
- "onUpdate:modelValue": a[2] || (a[2] = (H) => e.value = H),
160
- label: "Remark",
161
- "label-mark": "required",
162
- rules: [F(ct)()]
163
- }, null, 8, ["modelValue", "rules"]),
164
- o("div", Bt, [
165
- k(b, {
166
- label: "Cancel",
167
- variant: "tertiary",
168
- onClick: a[3] || (a[3] = (H) => n.onCancel())
169
- }),
170
- k(b, {
171
- label: C.value,
172
- type: "submit",
173
- variant: x.value,
174
- loading: _.value
175
- }, null, 8, ["label", "variant", "loading"])
176
- ])
177
- ]),
178
- _: 1
179
- }, 8, ["disabled"])) : (w(), L(J, { key: 0 }, [
180
- Z("Loading")
181
- ], 64));
182
- };
183
- }
184
- }), $t = he(0);
185
- function tt(l) {
186
- const s = l.measurementsAmounts.groupBy((u) => u.measurement.id), e = l.sku.unit.measurements.reduce((u, p) => {
187
- var R, C;
188
- const _ = ((C = (R = s.get(p.id)) == null ? void 0 : R[0]) == null ? void 0 : C.amount) ?? $t, m = Ee(p.conversion, _);
189
- return u + +N(m);
190
- }, +N(l.baseAmount));
191
- return it(e, l.baseAmount.precision);
192
- }
193
- const Tt = he(0), It = he(100);
194
- function Rt(l, s, e, u) {
195
- const p = tt(l), _ = u ?? p, m = qe(_, s), R = s.amount === 0 ? null : Ze(m, {
196
- ...s,
197
- amount: Math.abs(s.amount)
198
- }), C = R ? Ee(R, It) : null;
199
- return {
200
- code: l.sku.code,
201
- name: l.sku.name,
202
- baseUnit: l.sku.unit.abbrev,
203
- baseUnitAmount: +N(l.baseAmount),
204
- ...l.measurementsAmounts.filter(
205
- (v) => Pt(v.measurement) && e.includes(v.measurement.id)
206
- ).reduce(
207
- (v, I, Y) => (v[`measurementAbbrev${Y}`] = `(${I.measurement.abbrev}) × ${N(I.measurement.conversion)}`, v[`measurementAmount${Y}`] = +N(I.amount), v),
208
- {}
209
- ),
210
- systemBalance: +N(s),
211
- physicalBalance: +N(_),
212
- adjustedAmount: +N(m),
213
- adjustedDiffPercentage: C ? +N(Je(C, 2)) : null
214
- };
215
- }
216
- function Pt(l) {
217
- return !l.abbrev.toLocaleLowerCase().includes("inactive");
218
- }
219
- function Mt(l) {
220
- const s = at(l);
221
- return l.reduce(
222
- (e, u) => {
223
- var p;
224
- return Math.max(e, ((p = s == null ? void 0 : s.get(u.sku._id)) == null ? void 0 : p[0].length) ?? 0);
225
- },
226
- 0
227
- );
228
- }
229
- function at(l) {
230
- return l.groupBy(
231
- (s) => s.sku._id,
232
- (s) => s.measurementsAmounts.filter((e) => !e.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((e) => e.measurement.id)
233
- );
234
- }
235
- function Lt(l) {
236
- return [
237
- {
238
- id: "code",
239
- name: "Code"
240
- },
241
- {
242
- id: "name",
243
- name: "Name"
244
- },
245
- {
246
- id: "systemBalance",
247
- name: "Balance"
248
- },
249
- {
250
- id: "physicalBalance",
251
- name: "Actual balance"
252
- },
253
- {
254
- id: "adjustedAmount",
255
- name: "Adjusted balance"
256
- },
257
- {
258
- id: "adjustedDiffPercentage",
259
- name: "Diff (%)"
260
- },
261
- {
262
- id: "baseUnitAmount",
263
- name: "Base unit amount"
264
- },
265
- {
266
- id: "baseUnit",
267
- name: "Base unit"
268
- },
269
- ...Array.from({ length: l }).flatMap((e, u) => [
270
- {
271
- id: `measurementAmount${u}`,
272
- name: `UOM amount ${u + 1}`
273
- },
274
- {
275
- id: `measurementAbbrev${u}`,
276
- name: `UOM ${u + 1}`
277
- }
278
- ])
279
- ];
280
- }
281
- function Ut(l, s, e) {
282
- var M, f, g, b, $, H, te;
283
- const u = s.groupBy(
284
- (B) => B.id,
285
- (B) => B.balance
286
- ), p = e.groupBy(
287
- (B) => B.id,
288
- (B) => B.balance
289
- ), _ = [...l.items, ...l.negativeStockItems ?? []], m = at(_), R = _.map((B) => {
290
- var ie, ue, de;
291
- const X = ((ie = u.get(B.sku._id)) == null ? void 0 : ie[0]) ?? Tt, ce = ((ue = m == null ? void 0 : m.get(B.sku._id)) == null ? void 0 : ue[0]) ?? [];
292
- return Rt(
293
- B,
294
- X,
295
- ce,
296
- (de = p.get(B.sku._id)) == null ? void 0 : de[0]
297
- );
298
- }), C = Mt(_), v = kt().currentBusiness.value, I = Lt(C), Y = [
299
- ["Business name:", v == null ? void 0 : v.name],
300
- ["Business ID:", v == null ? void 0 : v._id],
301
- ["Menu version", v == null ? void 0 : v.menuVersion],
302
- ["Created at", new Date(l.createdAt)],
303
- ["Created by", (M = l.createdBy) == null ? void 0 : M.name],
304
- ["Updated at", new Date(l.updatedAt)],
305
- ["Updated by", (f = l.updatedBy) == null ? void 0 : f.name],
306
- ["Recent action", l.approvedAt ? "Approve" : l.rejectionHistory ? "Reject" : ""],
307
- [
308
- "Action by",
309
- l.approvedAt ? (g = l.approvedBy) == null ? void 0 : g.name : l.rejectionHistory ? ($ = (b = l.rejectionHistory[0]) == null ? void 0 : b.rejectedBy) == null ? void 0 : $.name : ""
310
- ],
311
- [
312
- "Action at",
313
- l.approvedAt ? new Date(l.approvedAt) : l.rejectionHistory ? new Date((H = l.rejectionHistory[0]) == null ? void 0 : H.rejectedAt) : ""
314
- ],
315
- [
316
- "Action remark",
317
- l.approvedAt ? l.approveRemark : l.rejectionHistory ? new Date((te = l.rejectionHistory[0]) == null ? void 0 : te.rejectRemark) : ""
318
- ],
319
- [],
320
- I.map((B) => B.name),
321
- ...R.map((B) => I.map((X) => B[X.id]))
322
- ], n = I.map((B) => `system:${B.id}`), a = ut(Y, n), j = `[${v == null ? void 0 : v.name}] closing draft (${dt(new Date(l.updatedAt))}).xlsx`;
323
- return mt(a, j), j;
324
- }
325
- const Et = { class: "flex flex-col" }, Ht = { class: "flex gap-12 py-8 justify-end w-full" }, Vt = /* @__PURE__ */ Te({
326
- __name: "RefreshBalanceAction",
327
- props: {
328
- draft: {},
329
- onCancel: { type: Function },
330
- onFinished: { type: Function }
331
- },
332
- setup(l) {
333
- const s = l;
334
- Ve();
335
- const e = V(!1), u = V(null), p = V(!1);
336
- Ue(() => {
337
- if (s.draft.effectiveAt)
338
- u.value = new Date(s.draft.effectiveAt);
339
- else {
340
- const C = new Date(s.draft.createdAt);
341
- C.setHours(23, 59, 59, 999), u.value = C;
342
- }
343
- p.value = !0;
344
- });
345
- const _ = U({
346
- get() {
347
- return u.value === null ? "" : Ge(u.value);
348
- },
349
- set(C) {
350
- if (C) {
351
- const x = /* @__PURE__ */ new Date(`${C} ${m.value}`);
352
- x.setSeconds(59, 999), u.value = x;
353
- } else
354
- u.value = null;
355
- }
356
- }), m = U({
357
- get() {
358
- return u.value === null ? "" : We(u.value);
359
- },
360
- set(C) {
361
- if (C) {
362
- const x = /* @__PURE__ */ new Date(`${_.value} ${C}`);
363
- x.setSeconds(59, 999), u.value = x;
364
- } else
365
- u.value = null;
366
- }
367
- });
368
- async function R() {
369
- e.value = !0, s.onFinished(u.value.toISOString());
370
- }
371
- return (C, x) => {
372
- const v = P("FmLabel"), I = P("FmDatePicker"), Y = P("FmTimePicker"), n = P("FmButton"), a = P("FmForm");
373
- return p.value ? (w(), Q(a, {
374
- key: 1,
375
- onValidationSuccess: R,
376
- class: "flex flex-col gap-32",
377
- disabled: e.value
378
- }, {
379
- default: O(() => [
380
- x[5] || (x[5] = o("div", { class: "fm-typo-en-body-lg-400" }, [
381
- o("p", null, [
382
- Z(" Performing "),
383
- o("span", { class: "fm-typo-en-body-lg-600" }, '"Refresh Balance"'),
384
- Z(" until closing effective date and time. ")
385
- ]),
386
- o("p", { class: "mt-2" }, [
387
- Z(" Please note that this action will "),
388
- o("b", null, "update"),
389
- Z(" the effective date and time. ")
390
- ])
391
- ], -1)),
392
- o("div", Et, [
393
- k(v, { class: "fm-typo-en-body-lg-600" }, {
394
- default: O(() => x[3] || (x[3] = [
395
- Z("Closing Date")
396
- ])),
397
- _: 1
398
- }),
399
- k(I, {
400
- modelValue: _.value,
401
- "onUpdate:modelValue": x[0] || (x[0] = (j) => _.value = j)
402
- }, null, 8, ["modelValue"]),
403
- k(v, { class: "fm-typo-en-body-lg-600" }, {
404
- default: O(() => x[4] || (x[4] = [
405
- Z("Closing Time")
406
- ])),
407
- _: 1
408
- }),
409
- k(Y, {
410
- modelValue: m.value,
411
- "onUpdate:modelValue": x[1] || (x[1] = (j) => m.value = j)
412
- }, null, 8, ["modelValue"])
413
- ]),
414
- o("div", Ht, [
415
- k(n, {
416
- label: "Cancel",
417
- variant: "tertiary",
418
- onClick: x[2] || (x[2] = (j) => C.onCancel())
419
- }),
420
- k(n, {
421
- label: "Refresh balance",
422
- type: "submit",
423
- variant: "primary",
424
- loading: e.value
425
- }, null, 8, ["loading"])
426
- ])
427
- ]),
428
- _: 1
429
- }, 8, ["disabled"])) : (w(), L(J, { key: 0 }, [
430
- Z("Loading")
431
- ], 64));
432
- };
433
- }
434
- }), $e = Qe(
435
- "closingDraftActions",
436
- function() {
437
- const s = _t(), e = He(), u = Ve(), p = Re(), _ = et(), m = V(!1), R = V();
438
- function C(f) {
439
- const g = {
440
- draft: f
441
- };
442
- R.value = g, m.value = !0;
443
- }
444
- async function x(f) {
445
- var b;
446
- if (f.status === re.enum.COMPLETED) {
447
- const $ = f.closingAdjustmentId;
448
- if (!$)
449
- return e.open({
450
- title: "Something went wrong",
451
- message: "Closing draft is completed but closing document cannot be found.",
452
- type: "error"
453
- }), console.error("Closing draft is completed but closing document cannot be found.", {
454
- draftId: f._id
455
- }), [];
456
- const H = await u.readAdjustmentById($);
457
- return ((H == null ? void 0 : H.skus) ?? []).map((B) => ({
458
- id: B.sku._id,
459
- balance: B.fromBalance,
460
- costs: B.fromCostBalances
461
- }));
462
- } else
463
- return await _.readStockBalance(), ((b = _.stockBalance) == null ? void 0 : b.skus) ?? [];
464
- }
465
- async function v(f, g, b) {
466
- g || (e.open({
467
- title: "Exporting",
468
- message: "Fetching data..."
469
- }), g = await x(f)), Ut(f, g, b ?? []);
470
- }
471
- function I(f, g) {
472
- s.open({
473
- title: "Approve draft",
474
- contentComponent: Pe,
475
- contentComponentProps: {
476
- draft: f,
477
- action: E.enum.approveDraft,
478
- onFinished: () => {
479
- s.close(), g == null || g();
480
- },
481
- onCancel: () => s.close()
482
- }
483
- });
484
- }
485
- function Y(f, g) {
486
- s.open({
487
- title: "Reject draft",
488
- contentComponent: Pe,
489
- contentComponentProps: {
490
- draft: f,
491
- action: E.enum.rejectDraft,
492
- onFinished: () => {
493
- s.close(), g == null || g();
494
- },
495
- onCancel: () => s.close()
496
- }
497
- });
498
- }
499
- function n(f, g) {
500
- s.open({
501
- title: "Mark draft as failed",
502
- contentComponent: Pe,
503
- contentComponentProps: {
504
- draft: f,
505
- action: E.enum.markAsFailed,
506
- onFinished: () => {
507
- s.close(), g == null || g();
508
- },
509
- onCancel: () => s.close()
510
- }
511
- });
512
- }
513
- async function a(f, g) {
514
- await p.sync({
515
- _id: f._id,
516
- _rev: f._rev ?? "",
517
- action: E.enum.approveDraft,
518
- data: {
519
- remark: f.remark ?? ""
520
- }
521
- }).delayed(500), e.open({
522
- title: "Success",
523
- message: "Sync requested",
524
- type: "success"
525
- }), g == null || g();
526
- }
527
- function j() {
528
- m.value = !1;
529
- }
530
- async function M(f, g, b) {
531
- await s.open({
532
- title: "Refresh balance",
533
- contentComponent: Vt,
534
- contentComponentProps: {
535
- draft: f,
536
- onFinished: ($) => {
537
- s.close(), b == null || b($);
538
- },
539
- onCancel: async () => {
540
- s.close(), g == null || g();
541
- }
542
- }
543
- });
544
- }
545
- return {
546
- viewDraft: C,
547
- closeDraftDialog: j,
548
- approveDraft: I,
549
- rejectDraft: Y,
550
- markAsFailed: n,
551
- syncDraft: a,
552
- exportDraft: v,
553
- refreshBalance: M,
554
- viewClosingDraftShow: m,
555
- viewClosingDraftProps: R
556
- };
557
- }
558
- );
559
- function Be(l) {
560
- switch (l) {
561
- case "DRAFT":
562
- return "fm-status-badge-draft";
563
- case "PROCESSING":
564
- return "fm-status-badge-processing";
565
- case "FAILED":
566
- return "fm-status-badge-cancel";
567
- case "COMPLETED":
568
- return "fm-status-badge-complete";
569
- }
570
- }
571
- const Nt = Qe(
572
- "closingDraftTable",
573
- function() {
574
- const { t: s } = Xe(), e = $e(), u = V(new Array()), p = V(!1), _ = Ie(), m = Re();
575
- async function R() {
576
- if (u.value = [], !!_._currentLocation) {
577
- p.value = !0;
578
- try {
579
- const [n] = await Promise.all([m.readDrafts()]).delayed(1e3);
580
- u.value = n.reverse();
581
- } catch (n) {
582
- console.log("Something went wrong when fetching drafts:", n);
583
- } finally {
584
- p.value = !1;
585
- }
586
- }
587
- }
588
- async function C(n) {
589
- if (!u.value.find((a) => a._id) && _._currentLocation) {
590
- p.value = !0;
591
- try {
592
- const [a] = await Promise.all([
593
- m.getDraft(n),
594
- new Promise((j) => setTimeout(j, 1e3))
595
- ]);
596
- u.value = [a];
597
- } catch (a) {
598
- console.log("Something went wrong when fetching drafts:", a);
599
- } finally {
600
- p.value = !1;
601
- }
602
- }
603
- }
604
- function x(n) {
605
- u.value = u.value.map((a) => a._id === n._id ? {
606
- ...n,
607
- _rev: a._rev
608
- } : a);
609
- }
610
- function v() {
611
- e.closeDraftDialog(), R();
612
- }
613
- function I(n, a) {
614
- switch (a = vt(a), n) {
615
- case Se.Details:
616
- return e.viewDraft(a);
617
- case Se.Export:
618
- return e.exportDraft(a);
619
- case E.enum.approveDraft:
620
- return e.approveDraft(a, v);
621
- case E.enum.rejectDraft:
622
- return e.rejectDraft(a, v);
623
- case E.enum.markAsFailed:
624
- return e.markAsFailed(a, v);
625
- }
626
- }
627
- return {
628
- columnDefs: [
629
- {
630
- id: "_id",
631
- accessorKey: "_id",
632
- header: () => s("inventory.closing.table.createdAt"),
633
- cell(n) {
634
- return ft(`${n.getValue()}`);
635
- },
636
- enableSorting: !0
637
- },
638
- {
639
- accessorKey: "effectiveAt",
640
- header: () => "Effective at",
641
- cell(n) {
642
- const a = n.row.original;
643
- let j = n.getValue();
644
- return j || (j = Me(a._id)), le(j);
645
- },
646
- enableSorting: !0,
647
- size: 200
648
- },
649
- {
650
- id: "updatedAt",
651
- accessorFn: (n) => le(n.updatedAt),
652
- header: () => "Updated at",
653
- enableSorting: !0,
654
- size: 200
655
- },
656
- {
657
- id: "updatedBy",
658
- accessorKey: "updatedBy.name",
659
- header: () => "Last update by",
660
- enableSorting: !0,
661
- size: 200
662
- },
663
- {
664
- id: "noOfItems",
665
- accessorFn: (n) => {
666
- var a;
667
- return n.items.length + (((a = n.negativeStockItems) == null ? void 0 : a.length) ?? 0);
668
- },
669
- header: () => s("inventory.closing.table.noOfItems"),
670
- enableSorting: !1,
671
- meta: {
672
- width: "10rem",
673
- textAlign: "right"
674
- }
675
- },
676
- {
677
- id: "recentRemark",
678
- accessorFn: (n) => {
679
- var a;
680
- return (n == null ? void 0 : n.approveRemark) ?? ((a = n == null ? void 0 : n.rejectionHistory) == null ? void 0 : a.computeFirst((j) => j.rejectRemark)) ?? n.remark;
681
- },
682
- header: () => "Recent remark"
683
- },
684
- {
685
- id: "status",
686
- accessorFn: (n) => n.status,
687
- header: () => s("inventory.closing.table.status"),
688
- enableSorting: !1,
689
- cell(n) {
690
- var b;
691
- const a = n.row.original, j = a.status, M = new Date(a.updatedAt), f = (b = a == null ? void 0 : a.rejectionHistory) == null ? void 0 : b.computeFirst(($) => $.rejectedAt), g = f ? new Date(f) : null;
692
- return j === "DRAFT" && g ? g.getTime() > M.getTime() ? T(
693
- "div",
694
- {
695
- class: "flex"
696
- },
697
- T(
698
- "div",
699
- {
700
- class: ["fm-status-badge", Be("FAILED")]
701
- },
702
- "Rejected"
703
- )
704
- ) : T(
705
- "div",
706
- {
707
- class: "flex"
708
- },
709
- T(
710
- "div",
711
- {
712
- class: ["fm-status-badge", Be("PROCESSING")]
713
- },
714
- "Updated"
715
- )
716
- ) : T(
717
- "div",
718
- {
719
- class: "flex"
720
- },
721
- T(
722
- "div",
723
- {
724
- class: ["fm-status-badge", Be(j)]
725
- },
726
- Le(j)
727
- )
728
- );
729
- }
730
- },
731
- {
732
- id: "action",
733
- cell(n) {
734
- const a = n.row.original, j = [
735
- Oe[Se.Details],
736
- Oe[Se.Export]
737
- ], M = [
738
- {
739
- translationKey: "inventory.closing.draft.approveDraft",
740
- color: "text-fm-color-typo-primary",
741
- value: E.enum.approveDraft
742
- },
743
- {
744
- translationKey: "inventory.closing.draft.rejectDraft",
745
- color: "text-fm-color-typo-error",
746
- value: E.enum.rejectDraft
747
- },
748
- {
749
- translationKey: "inventory.closing.draft.markAsFailed",
750
- color: "text-fm-color-typo-error",
751
- value: E.enum.markAsFailed
752
- }
753
- ];
754
- return pt(
755
- [
756
- ...j,
757
- ...a.status === re.enum.DRAFT ? M : []
758
- ],
759
- (f) => I(f, a)
760
- );
761
- },
762
- enableSorting: !1,
763
- size: 40,
764
- meta: {
765
- cellClass: "",
766
- headerClass: ""
767
- }
768
- }
769
- ],
770
- drafts: u,
771
- loading: p,
772
- fetchDrafts: R,
773
- loadDraft: C,
774
- updateDraftRef: x
775
- };
776
- }
777
- ), zt = { class: "w-full flex flex-col gap-32" }, Ot = { class: "flex justify-between" }, Yt = { class: "flex" }, Kt = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, Gt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Wt = { class: "flex gap-1" }, qt = { class: "fm-typo-en-body-lg-600" }, Zt = { class: "flex flex-col gap-16" }, Jt = { class: "flex items-center" }, Xt = {
778
- key: 0,
779
- class: "flex gap-8"
780
- }, Qt = {
781
- key: 0,
782
- class: "w-full flex flex-col items-center"
783
- }, ea = { class: "flex items-center gap-8" }, ta = { class: "flex flex-col gap-8" }, aa = { class: "flex gap-8" }, na = {
784
- key: 0,
785
- class: "flex gap-8"
786
- }, oa = { class: "overflow-x-auto" }, sa = {
787
- key: 1,
788
- class: "flex-1 xs:w-screen xs:max-w-full"
789
- }, ra = {
790
- key: 0,
791
- class: "flex flex-col items-center gap-8 h-full"
792
- }, la = ["src"], ca = {
793
- key: 1,
794
- class: "px-4 flex flex-col"
795
- }, ia = { class: "flex gap-12 content-stretch" }, ua = {
796
- class: "flex flex-col w-24",
797
- name: "circles"
798
- }, da = { class: "flex-1 flex flex-col items-center" }, ma = { class: "flex-1 flex flex-col items-center" }, fa = {
799
- class: "py-12 flex flex-col gap-4",
800
- name: "received-at header"
801
- }, pa = { class: "fm-typo-en-body-lg-400" }, va = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, ya = { class: "flex gap-12 content-stretch" }, ga = {
802
- class: "flex flex-col w-24",
803
- name: "circles"
804
- }, ba = { class: "flex-1 flex flex-col items-center" }, Aa = {
805
- class: "py-12 flex flex-col gap-4 flex-1",
806
- name: "delivery details"
807
- }, Da = { class: "flex flex-col gap-8" }, ka = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _a = { class: "flex flex-col gap-4" }, ha = { class: "flex gap-8" }, xa = /* @__PURE__ */ Te({
808
- __name: "ClosingDraftDialog",
809
- props: {
810
- show: { type: Boolean },
811
- draft: {}
812
- },
813
- emits: ["submitted", "refresh"],
814
- setup(l, { emit: s }) {
815
- const e = l, u = et(), p = $e(), _ = ht(e, "show"), m = V(!1), R = V(!1), C = V(!1), x = V(new Array()), v = V(new Array()), I = Ve(), Y = Re(), n = He(), a = yt(), j = Ie(), M = nt({}), f = U(() => new Set(
816
- a.skus.filter((r) => {
817
- var t;
818
- return M[(t = r.customAttributes) == null ? void 0 : t.tag];
819
- }).map((r) => r._id)
820
- )), g = s, b = V({
821
- templateItem: !0,
822
- nonTemplateItem: !0
823
- }), $ = U(() => {
824
- var t, y;
825
- const r = [...((t = e.draft) == null ? void 0 : t.items) ?? [], ...((y = e.draft) == null ? void 0 : y.negativeStockItems) ?? []];
826
- return f.value.size ? r.filter((d) => f.value.has(d.sku._id)) : r;
827
- }), H = U(() => {
828
- const r = $.value.map((t) => t.sku);
829
- return r.sort((t, y) => t.code.localeCompare(y.code)), r;
830
- }), te = U(() => $.value.groupBy(
831
- (t) => t.sku._id,
832
- (t) => t.measurementsAmounts.filter((y) => !y.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((y) => y.measurement.id)
833
- ));
834
- Ue(ce), ot(
835
- () => e.show,
836
- (r) => {
837
- r && (se.value = ve[0], ce(), b.value = {
838
- templateItem: !0,
839
- nonTemplateItem: !0
840
- });
841
- }
842
- );
843
- const B = he(0), X = he(100);
844
- async function ce() {
845
- var t, y, d;
846
- if (!j._currentLocation) return;
847
- m.value = !0;
848
- const r = ((t = e.draft) == null ? void 0 : t.status) === re.enum.COMPLETED;
849
- v.value = [];
850
- try {
851
- if (await a.init(), r) {
852
- const i = e.draft.closingAdjustmentId;
853
- if (!i) {
854
- n.open({
855
- title: "Something went wrong",
856
- message: "Closing draft is completed but closing document cannot be found.",
857
- type: "error"
858
- }), console.error("Closing draft is completed but closing document cannot be found.", {
859
- draftId: (y = e.draft) == null ? void 0 : y._id
860
- });
861
- return;
862
- }
863
- const c = await I.readAdjustmentById(i), A = (c == null ? void 0 : c.skus) ?? [];
864
- for (const h of A) {
865
- const D = {
866
- id: h.sku._id,
867
- balance: h.fromBalance,
868
- costs: h.fromCostBalances
869
- }, W = {
870
- id: h.sku._id,
871
- balance: h.toBalance,
872
- costs: h.toCostBalances
873
- };
874
- x.value.push(D), v.value.push(W);
875
- }
876
- } else
877
- x.value = ((d = e.draft) == null ? void 0 : d.stockSnapshot) ?? [];
878
- } catch (i) {
879
- n.open({
880
- title: "Something went wrong",
881
- message: "Something went wrong when fetching info. Please try again.",
882
- type: "error"
883
- }), console.error("error on fetch stock balances", i);
884
- } finally {
885
- m.value = !1;
886
- }
887
- }
888
- async function ie() {
889
- var t, y;
890
- if (!(((t = e.draft) == null ? void 0 : t.effectiveAt) ?? (e.draft ? Me((y = e.draft) == null ? void 0 : y._id) : null))) {
891
- n.open({
892
- title: "Cannot refresh",
893
- message: "Effective date is not available for this draft.",
894
- type: "error"
895
- });
896
- return;
897
- }
898
- await p.refreshBalance(
899
- e.draft,
900
- () => {
901
- },
902
- async (d) => {
903
- var h;
904
- R.value = !0;
905
- const i = (h = e.draft) == null ? void 0 : h._rev, c = 30, A = 2e3;
906
- try {
907
- await I.recalculation.scheduleCalculateStockSnapshotAtDate(d, e.draft._id);
908
- let D = null;
909
- for (let W = 0; W < c && (D = await Y.getDraft(e.draft._id).delayed(A), D._rev === i); W++)
910
- ;
911
- if (!D || D._rev === i) {
912
- n.open({
913
- title: "Refresh failed",
914
- message: "Failed to refresh stock balance. Please try again.",
915
- type: "error"
916
- }), console.error("error refreshing stock balances: there is no change in _rev");
917
- return;
918
- }
919
- g("refresh", D), x.value = D.stockSnapshot ?? [], n.open({
920
- title: "Balance refreshed",
921
- message: "Stock balance has been recalculated.",
922
- type: "success"
923
- });
924
- } catch (D) {
925
- n.open({
926
- title: "Refresh failed",
927
- message: "Failed to refresh stock balance. Please try again.",
928
- type: "error"
929
- }), console.error("error refreshing stock balances", D);
930
- } finally {
931
- R.value = !1;
932
- }
933
- }
934
- );
935
- }
936
- const ue = U(
937
- () => x.value.groupBy(
938
- (r) => r.id,
939
- (r) => r.balance
940
- )
941
- ), de = U(() => $.value.groupBy((r) => r.sku._id));
942
- function oe(r) {
943
- return T(
944
- ge.FmTooltip,
945
- { zIndex: 51, placement: "left", class: "w-full flex justify-end" },
946
- {
947
- default() {
948
- return r;
949
- },
950
- content() {
951
- return "Differences are calculated using this formula: (Adjusted / System) × 100%";
952
- }
953
- }
954
- );
955
- }
956
- const Ae = U(() => {
957
- const r = H.value.reduce((y, d) => {
958
- var i, c;
959
- return Math.max(y, ((c = (i = te.value) == null ? void 0 : i.get(d._id)) == null ? void 0 : c[0].length) ?? 0);
960
- }, 0);
961
- return [
962
- {
963
- id: "sku",
964
- accessorFn: (y) => `${y.code} ${y.name}`,
965
- header: () => "Name",
966
- size: 350,
967
- cell(y) {
968
- const d = y.row.original, i = d.adjustedDiffPercentage, c = typeof i == "number" && Math.abs(i) > 10, A = T("div", { class: "flex flex-col gap-4" }, [
969
- T(
970
- "div",
971
- {
972
- class: [
973
- "line-clamp-1 fm-typo-en-body-lg-400",
974
- c ? " text-fm-color-system-error-300" : "text-fm-color-typo-primary"
975
- ]
976
- },
977
- d.name
978
- ),
979
- T(
980
- "div",
981
- {
982
- class: [
983
- "line-clamp-1 fm-typo-en-body-md-400",
984
- c ? " text-fm-color-system-error-300" : "text-fm-color-typo-secondary"
985
- ]
986
- },
987
- d.code
988
- )
989
- ]);
990
- return T(
991
- ge.FmTooltip,
992
- {
993
- zIndex: 51
994
- },
995
- {
996
- content() {
997
- return c ? "Adjustment difference is more than 10%." : `${d.code} - ${d.name}`;
998
- },
999
- default() {
1000
- return T("div", { class: "flex items-center gap-4 justify-start w-full" }, [
1001
- A
1002
- ]);
1003
- }
1004
- }
1005
- );
1006
- }
1007
- },
1008
- {
1009
- id: "baseUnit",
1010
- header: () => "Base unit",
1011
- accessorKey: "baseUnit"
1012
- },
1013
- {
1014
- id: "physicalBalance",
1015
- accessorFn: (y) => {
1016
- var i;
1017
- const d = (i = v.value.find((c) => c.id === y.id)) == null ? void 0 : i.balance;
1018
- return d ? Fe.toFormatString({ value: d }) : y.physicalBalance;
1019
- },
1020
- header: () => oe("Actual balance"),
1021
- cell(y) {
1022
- var D;
1023
- const d = y.row.original, i = Fe.fromNumber(d.physicalBalance);
1024
- let c = !0, A = d.physicalBalance;
1025
- const h = (D = v.value.find((W) => W.id === d.id)) == null ? void 0 : D.balance;
1026
- return h && (Fe.equals({
1027
- a: i,
1028
- b: h
1029
- }) || (c = !1, A = Number(Fe.toFormatString({ value: h })))), T("div", { class: "flex flex-col" }, [
1030
- T(
1031
- "span",
1032
- { class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
1033
- A
1034
- ),
1035
- c ? null : T(
1036
- "span",
1037
- { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
1038
- `Draft: ${d.physicalBalance.toString()}`
1039
- )
1040
- ]);
1041
- },
1042
- size: 200,
1043
- meta: {
1044
- textAlign: "right"
1045
- }
1046
- },
1047
- {
1048
- id: "systemBalance",
1049
- accessorKey: "systemBalance",
1050
- header: () => oe("Balance"),
1051
- size: 200,
1052
- meta: {
1053
- textAlign: "right"
1054
- }
1055
- },
1056
- {
1057
- id: "adjustedAmount",
1058
- accessorKey: "adjustedAmount",
1059
- header: () => oe("Adjusted balance"),
1060
- size: 200,
1061
- meta: {
1062
- textAlign: "right"
1063
- }
1064
- },
1065
- {
1066
- id: "adjustedDiffPercentage",
1067
- accessorKey: "adjustedDiffPercentage",
1068
- header: () => T(
1069
- ge.FmTooltip,
1070
- { zIndex: 51, placement: "left", class: "w-full flex justify-end" },
1071
- {
1072
- default() {
1073
- return T("div", { class: "flex items-center gap-4" }, [
1074
- "Diff (%)",
1075
- T(ge.FmIcon, { name: "info", color: "neutral-gray-400", size: "sm" })
1076
- ]);
1077
- },
1078
- content() {
1079
- return "Differences are calculated using this formula: (Adjusted / System) × 100%";
1080
- }
1081
- }
1082
- ),
1083
- size: 200,
1084
- cell(y) {
1085
- const d = y.row.original.adjustedDiffPercentage;
1086
- if (!d) return "N/A";
1087
- const i = d.toFixed(2);
1088
- if (i === "0.00")
1089
- return T("div", { class: "flex items-center gap-4 justify-end" }, ["0.00"]);
1090
- const c = d > 0;
1091
- return T("div", { class: "flex items-center gap-4 justify-end" }, [
1092
- T(ge.FmIcon, {
1093
- name: c ? "arrow_drop_up" : "arrow_drop_down",
1094
- color: c ? "system-success-300" : "system-error-300",
1095
- size: "md"
1096
- }),
1097
- i
1098
- ]);
1099
- },
1100
- meta: {
1101
- textAlign: "right"
1102
- }
1103
- },
1104
- {
1105
- id: "physicalBalances",
1106
- header: () => "Amounts",
1107
- enableSorting: !1,
1108
- cell(y) {
1109
- const d = y.row.original, i = (A, h) => T(
1110
- ge.FmTooltip,
1111
- { zIndex: 50 },
1112
- {
1113
- default() {
1114
- return T(
1115
- "div",
1116
- {
1117
- class: "fm-typo-en-body-md-400 py-4 px-8 border-1 border-fm-color-typo-secondary fm-corner-radius-md line-clamp-1"
1118
- },
1119
- [
1120
- T("span", { class: "text-fm-color-typo-primary" }, `${A} `),
1121
- T(
1122
- "span",
1123
- {
1124
- class: "text-fm-color-typo-secondary",
1125
- style: { maxWidth: "80px" }
1126
- },
1127
- h
1128
- )
1129
- ]
1130
- );
1131
- },
1132
- content() {
1133
- return `${A} ${h}`;
1134
- }
1135
- }
1136
- );
1137
- let c = Array.from({ length: r }).map((A, h) => {
1138
- if (!d[`measurementAmount${h}`])
1139
- return null;
1140
- const D = d[`measurementAmount${h}`], W = d[`measurementAbbrev${h}`];
1141
- return i(D, W);
1142
- }).filter((A) => A);
1143
- return (d.baseUnitAmount || !c.length) && (c = [i(d.baseUnitAmount, d.baseUnit), ...c]), T(
1144
- "div",
1145
- {
1146
- class: "flex gap-8 flex-nowrap",
1147
- style: {
1148
- minWidth: `${120 * c.length}px`
1149
- }
1150
- },
1151
- c
1152
- );
1153
- }
1154
- }
1155
- ];
1156
- }), xe = U(() => Ae.value.map((r) => r.size ?? 0).reduce((r, t) => r + t)), fe = V(""), De = U(() => {
1157
- var y, d;
1158
- const r = ((d = (y = e.draft) == null ? void 0 : y.negativeStockItems) == null ? void 0 : d.reduce(
1159
- (i, c) => (i[c.sku._id] = c, i),
1160
- {}
1161
- )) ?? {};
1162
- return H.value.map((i) => {
1163
- var Ce, S, z, K;
1164
- const c = (Ce = de.value.get(i._id)) == null ? void 0 : Ce[0], A = ((S = ue.value.get(i._id)) == null ? void 0 : S[0]) ?? B;
1165
- if (!c)
1166
- return {
1167
- id: i._id,
1168
- code: i.code,
1169
- name: i.name,
1170
- baseUnit: i.unit.abbrev,
1171
- baseUnitAmount: 0,
1172
- systemBalance: +N(A),
1173
- physicalBalance: 0,
1174
- adjustedAmount: -+N(A),
1175
- adjustedDiffPercentage: -100,
1176
- isTemplateItem: !r[i._id]
1177
- };
1178
- const h = tt(c), D = (K = (z = v.value) == null ? void 0 : z.find(
1179
- (G) => G.id === i._id
1180
- )) == null ? void 0 : K.balance, W = qe(
1181
- D ?? h,
1182
- A
1183
- ), we = A.amount === 0 ? null : Ze(W, {
1184
- ...A,
1185
- amount: Math.abs(A.amount)
1186
- }), ye = we ? Ee(we, X) : null;
1187
- return {
1188
- id: i._id,
1189
- code: i.code,
1190
- name: i.name,
1191
- baseUnit: i.unit.abbrev,
1192
- baseUnitAmount: +N(c.baseAmount),
1193
- ...c.measurementsAmounts.filter((G) => {
1194
- var ne, me, ze;
1195
- return (ze = (me = (ne = te.value) == null ? void 0 : ne.get(i._id)) == null ? void 0 : me[0]) == null ? void 0 : ze.includes(G.measurement.id);
1196
- }).reduce((G, ne, me) => (G[`measurementAbbrev${me}`] = `(${ne.measurement.abbrev}) × ${N(ne.measurement.conversion)}`, G[`measurementAmount${me}`] = +N(ne.amount), G), {}),
1197
- systemBalance: +N(A),
1198
- physicalBalance: +N(h),
1199
- adjustedAmount: +N(W),
1200
- adjustedDiffPercentage: ye ? +N(Je(ye, 2)) : null,
1201
- isTemplateItem: !r[i._id]
1202
- };
1203
- }).filter((i) => !!(i.isTemplateItem && b.value.templateItem || !i.isTemplateItem && b.value.nonTemplateItem));
1204
- }), pe = U(() => {
1205
- var t, y, d, i;
1206
- if (!e.draft) return [];
1207
- const r = e.draft.approvedAt ? {
1208
- action: `Approve at ${le(e.draft.approvedAt)}`,
1209
- // actionAt: props.draft.approvedAt,
1210
- actionBy: e.draft.approvedBy,
1211
- remark: e.draft.approveRemark
1212
- } : (t = e.draft.rejectionHistory) == null ? void 0 : t.computeFirst((c) => ({
1213
- action: `Reject at ${le(c.rejectedAt)}`,
1214
- // actionAt: e.rejectedAt,
1215
- actionBy: c.rejectedBy,
1216
- remark: c.rejectRemark
1217
- }));
1218
- return [
1219
- {
1220
- label: "Created at",
1221
- value: le(e.draft.createdAt)
1222
- },
1223
- {
1224
- label: "Created by",
1225
- value: e.draft.createdBy.name
1226
- },
1227
- {
1228
- label: "Updated at",
1229
- value: le(e.draft.updatedAt)
1230
- },
1231
- {
1232
- label: "Updated by",
1233
- value: e.draft.updatedBy.name
1234
- },
1235
- {
1236
- label: "Effective at",
1237
- value: le(e.draft.effectiveAt ?? Me((y = e.draft) == null ? void 0 : y._id))
1238
- },
1239
- {
1240
- label: "Using template",
1241
- value: ((d = e.draft.usingTemplates.find((c) => c)) == null ? void 0 : d.name) ?? "None"
1242
- },
1243
- e.draft.remark ? {
1244
- label: "Remark",
1245
- value: e.draft.remark
1246
- } : null,
1247
- r ? {
1248
- label: "Last action",
1249
- value: r.action
1250
- } : null,
1251
- r && r.actionBy ? {
1252
- label: "Last action by",
1253
- value: (i = r.actionBy) == null ? void 0 : i.name
1254
- } : null,
1255
- r && r.remark ? {
1256
- label: "Action remark",
1257
- value: r.remark
1258
- } : null
1259
- ].filter((c) => c).map((c) => c);
1260
- }), ve = [
1261
- {
1262
- label: "Overview",
1263
- value: "overview"
1264
- },
1265
- {
1266
- label: "Action history",
1267
- value: "history"
1268
- }
1269
- ], se = V(ve[0]), ae = U(() => {
1270
- var d, i, c;
1271
- const r = ((d = e.draft) == null ? void 0 : d.activityLogs) ?? [], t = ((i = e.draft) == null ? void 0 : i.rejectionHistory) ?? [];
1272
- for (const A of t)
1273
- r.find(
1274
- (D) => `${D.action}_${D.performedAt}` == `${E.enum.rejectDraft}_${A.rejectedAt}`
1275
- ) || r.push({
1276
- action: E.enum.rejectDraft,
1277
- performedAt: A.rejectedAt,
1278
- performedBy: A.rejectedBy,
1279
- remark: A.rejectRemark
1280
- });
1281
- return (c = e.draft) != null && c.approvedAt && (r.find(
1282
- (h) => {
1283
- var D;
1284
- return `${h.action}_${h.performedAt}` == `${E.enum.approveDraft}_${(D = e.draft) == null ? void 0 : D.approvedAt}`;
1285
- }
1286
- ) || r.push({
1287
- action: E.enum.approveDraft,
1288
- performedAt: e.draft.approvedAt,
1289
- performedBy: e.draft.approvedBy ?? { name: "Unknown", id: "unknown" },
1290
- remark: e.draft.approveRemark
1291
- })), r.sort((A, h) => new Date(h.performedAt).getTime() - new Date(A.performedAt).getTime()).map(
1292
- (A) => ({
1293
- header: Le(A.action),
1294
- date: le(A.performedAt),
1295
- info: [
1296
- {
1297
- label: "Performed by",
1298
- values: [A.performedBy.name]
1299
- },
1300
- {
1301
- label: "Remark",
1302
- values: [A.remark ?? ""]
1303
- }
1304
- ]
1305
- })
1306
- );
1307
- }), ke = U(() => {
1308
- var i, c, A, h;
1309
- if ((i = e == null ? void 0 : e.draft) != null && i.approvedAt) return "Draft is already approved.";
1310
- if (((c = e.draft) == null ? void 0 : c.status) !== re.enum.DRAFT) return "Status is not draft.";
1311
- const r = De.value.some((D) => D.physicalBalance < 0), t = ((h = (A = u.stockBalance.skus) == null ? void 0 : A.filter((D) => D.balance.amount < 0)) == null ? void 0 : h.map((D) => D.id)) ?? [], y = new Set(H.value.map((D) => D._id)), d = t.filter((D) => !y.has(D)).length;
1312
- return [
1313
- r ? "Negative total exist." : null,
1314
- d ? "Negative stock is not included in this draft. Reopen draft in POS and apply changes." : null
1315
- ].filter((D) => D).join(" ");
1316
- });
1317
- return (r, t) => {
1318
- const y = P("FmButtonGroup"), d = P("FmMenuDivider"), i = P("FmCard"), c = P("FmButton"), A = P("FmCircularProgress"), h = P("FmChip"), D = P("FmTextField"), W = P("FmIcon"), we = P("FmTable"), ye = P("FmSpacer"), Ne = P("FmTooltip"), Ce = P("FmSideSheet");
1319
- return w(), Q(Ce, {
1320
- "dismiss-away": "",
1321
- "max-width": 9999,
1322
- "model-value": F(_),
1323
- "onUpdate:modelValue": t[10] || (t[10] = (S) => Ye(_) ? _.value = S : null),
1324
- header: "Closing details"
1325
- }, {
1326
- "side-sheet-footer": O(() => {
1327
- var S, z, K, G;
1328
- return [
1329
- o("div", ha, [
1330
- ((S = e.draft) == null ? void 0 : S.status) === F(re).enum.DRAFT ? (w(), L(J, { key: 0 }, [
1331
- ke.value ? (w(), Q(Ne, {
1332
- key: 0,
1333
- "z-index": 51
1334
- }, {
1335
- content: O(() => [
1336
- Z(q(ke.value), 1)
1337
- ]),
1338
- default: O(() => [
1339
- k(c, {
1340
- disabled: "",
1341
- key: "approve key",
1342
- label: "Approve",
1343
- onClick: t[5] || (t[5] = () => e.draft && F(p).approveDraft(e.draft, () => g("submitted")))
1344
- })
1345
- ]),
1346
- _: 1
1347
- })) : (w(), Q(c, {
1348
- key: "approve key",
1349
- label: "Approve",
1350
- onClick: t[6] || (t[6] = () => e.draft && F(p).approveDraft(e.draft, () => g("submitted")))
1351
- }))
1352
- ], 64)) : ee("", !0),
1353
- ((z = e.draft) == null ? void 0 : z.status) === F(re).enum.DRAFT ? (w(), Q(c, {
1354
- key: 1,
1355
- label: "Reject",
1356
- variant: "destructive",
1357
- onClick: t[7] || (t[7] = () => e.draft && F(p).rejectDraft(e.draft, () => g("submitted")))
1358
- })) : ee("", !0),
1359
- (K = e.draft) != null && K.approvedAt && ((G = e.draft) == null ? void 0 : G.status) !== F(re).enum.COMPLETED ? (w(), Q(c, {
1360
- key: 2,
1361
- label: "Sync",
1362
- loading: C.value,
1363
- onClick: t[8] || (t[8] = () => {
1364
- e.draft && (C.value = !0, F(p).syncDraft(e.draft, () => {
1365
- C.value = !1, g("submitted");
1366
- }));
1367
- })
1368
- }, null, 8, ["loading"])) : ee("", !0),
1369
- k(c, {
1370
- label: "Close",
1371
- variant: "tertiary",
1372
- onClick: t[9] || (t[9] = (ne) => _.value = !1)
1373
- })
1374
- ])
1375
- ];
1376
- }),
1377
- default: O(() => [
1378
- o("div", zt, [
1379
- o("div", null, [
1380
- k(y, {
1381
- items: ve,
1382
- modelValue: se.value,
1383
- "onUpdate:modelValue": t[0] || (t[0] = (S) => se.value = S)
1384
- }, null, 8, ["modelValue"])
1385
- ]),
1386
- se.value.value === "overview" ? (w(), L(J, { key: 0 }, [
1387
- k(i, {
1388
- variant: "outlined",
1389
- class: "flex flex-col gap-8 px-12 py-16"
1390
- }, {
1391
- default: O(() => {
1392
- var S, z;
1393
- return [
1394
- o("div", Ot, [
1395
- t[11] || (t[11] = o("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
1396
- o("div", Yt, [
1397
- o("div", {
1398
- class: be(["fm-status-badge", F(Be)(((S = r.draft) == null ? void 0 : S.status) ?? "DRAFT")])
1399
- }, q(F(Le)(((z = r.draft) == null ? void 0 : z.status) ?? "")), 3)
1400
- ])
1401
- ]),
1402
- k(d),
1403
- o("div", Kt, [
1404
- (w(!0), L(J, null, _e(pe.value, (K, G) => (w(), L("div", {
1405
- class: "flex flex-col gap-4",
1406
- key: G
1407
- }, [
1408
- o("div", Gt, [
1409
- o("div", Wt, q(K.label), 1)
1410
- ]),
1411
- o("div", qt, q(K.value), 1)
1412
- ]))), 128))
1413
- ])
1414
- ];
1415
- }),
1416
- _: 1
1417
- }),
1418
- o("div", Zt, [
1419
- o("div", Jt, [
1420
- t[12] || (t[12] = o("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
1421
- m.value ? ee("", !0) : (w(), L("div", Xt, [
1422
- r.draft && r.draft.status !== F(re).enum.COMPLETED ? (w(), Q(c, {
1423
- key: 0,
1424
- label: "Refresh balance",
1425
- "prepend-icon": "refresh",
1426
- variant: "secondary",
1427
- "text-color": "primary",
1428
- "bg-color": "transparent",
1429
- "border-color": "primary",
1430
- loading: R.value,
1431
- onClick: ie
1432
- }, null, 8, ["loading"])) : ee("", !0),
1433
- k(c, {
1434
- label: "Export data",
1435
- "prepend-icon": "download",
1436
- variant: "secondary",
1437
- "text-color": "primary",
1438
- "bg-color": "transparent",
1439
- "border-color": "primary",
1440
- onClick: t[1] || (t[1] = (S) => r.draft ? F(p).exportDraft(
1441
- r.draft,
1442
- x.value,
1443
- v.value
1444
- ) : null)
1445
- })
1446
- ]))
1447
- ]),
1448
- m.value ? (w(), L("div", Qt, [
1449
- t[14] || (t[14] = o("div", { class: "h-80" }, null, -1)),
1450
- o("div", ea, [
1451
- o("div", null, [
1452
- k(A, { size: "md" })
1453
- ]),
1454
- t[13] || (t[13] = o("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
1455
- ]),
1456
- t[15] || (t[15] = o("div", { class: "h-80" }, null, -1))
1457
- ])) : (w(), L(J, { key: 1 }, [
1458
- o("div", ta, [
1459
- o("div", aa, [
1460
- k(h, {
1461
- label: "Template Item(s)",
1462
- selected: b.value.templateItem,
1463
- onClick: t[2] || (t[2] = (S) => b.value.templateItem = !b.value.templateItem)
1464
- }, null, 8, ["selected"]),
1465
- k(h, {
1466
- label: "Non-template Item(s)",
1467
- selected: b.value.nonTemplateItem,
1468
- onClick: t[3] || (t[3] = (S) => b.value.nonTemplateItem = !b.value.nonTemplateItem)
1469
- }, null, 8, ["selected"])
1470
- ]),
1471
- k(D, {
1472
- modelValue: fe.value,
1473
- "onUpdate:modelValue": t[4] || (t[4] = (S) => fe.value = S),
1474
- placeholder: "Filter items"
1475
- }, null, 8, ["modelValue"])
1476
- ]),
1477
- F(a).skuTags.size ? (w(), L("div", na, [
1478
- (w(!0), L(J, null, _e(F(a).skuTags.keys(), (S) => (w(), Q(h, {
1479
- key: `${S}`,
1480
- label: `${S}`,
1481
- selectable: "",
1482
- selected: M[`${S}`],
1483
- onClick: (z) => M[`${S}`] = !M[`${S}`]
1484
- }, {
1485
- default: O(() => [
1486
- M[`${S}`] ? (w(), Q(W, {
1487
- key: 0,
1488
- name: "check",
1489
- class: "text-white",
1490
- size: "sm"
1491
- })) : ee("", !0),
1492
- o("span", {
1493
- class: be([
1494
- "",
1495
- {
1496
- "text-white fm-typo-en-body-md-600": M[`${S}`],
1497
- "text-fm-color-typo-primary fm-typo-en-body-md-400": !M[`${S}`]
1498
- }
1499
- ])
1500
- }, q(S), 3)
1501
- ]),
1502
- _: 2
1503
- }, 1032, ["label", "selected", "onClick"]))), 128))
1504
- ])) : ee("", !0),
1505
- o("div", oa, [
1506
- o("div", {
1507
- style: Ke({ minWidth: `${xe.value}px` })
1508
- }, [
1509
- k(we, {
1510
- "column-defs": Ae.value,
1511
- "row-data": De.value,
1512
- "search-value": fe.value
1513
- }, null, 8, ["column-defs", "row-data", "search-value"])
1514
- ], 4)
1515
- ])
1516
- ], 64))
1517
- ])
1518
- ], 64)) : ee("", !0),
1519
- se.value.value === "history" ? (w(), L("div", sa, [
1520
- ae.value.length ? (w(), L("div", ca, [
1521
- (w(!0), L(J, null, _e(ae.value, (S, z) => (w(), L(J, { key: z }, [
1522
- o("div", ia, [
1523
- o("div", ua, [
1524
- o("div", da, [
1525
- o("div", {
1526
- class: be([
1527
- {
1528
- "bg-fm-color-primary": z !== 0,
1529
- "bg-white": z === 0
1530
- },
1531
- "w-[2px] h-full"
1532
- ])
1533
- }, null, 2)
1534
- ]),
1535
- t[18] || (t[18] = o("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
1536
- o("div", ma, [
1537
- o("div", {
1538
- class: be([
1539
- {
1540
- "bg-fm-color-primary": z < ae.value.length - 1,
1541
- "bg-white": z >= ae.value.length - 1
1542
- },
1543
- "w-[2px] h-full"
1544
- ])
1545
- }, null, 2)
1546
- ])
1547
- ]),
1548
- o("div", fa, [
1549
- o("div", pa, q(S.header), 1),
1550
- o("div", va, q(S.date), 1)
1551
- ])
1552
- ]),
1553
- o("div", ya, [
1554
- o("div", ga, [
1555
- o("div", ba, [
1556
- o("div", {
1557
- class: be([
1558
- {
1559
- "bg-fm-color-primary": z < ae.value.length - 1,
1560
- "bg-white": z >= ae.value.length - 1
1561
- },
1562
- "w-[2px] h-full"
1563
- ])
1564
- }, null, 2)
1565
- ])
1566
- ]),
1567
- o("div", Aa, [
1568
- k(i, {
1569
- variant: "outlined",
1570
- class: "py-12 px-16"
1571
- }, {
1572
- default: O(() => [
1573
- o("div", Da, [
1574
- (w(!0), L(J, null, _e(S.info, (K, G) => (w(), L("div", {
1575
- key: G,
1576
- class: "flex flex-col gap-4"
1577
- }, [
1578
- o("div", ka, q(K == null ? void 0 : K.label), 1),
1579
- o("div", _a, [
1580
- (w(!0), L(J, null, _e(K == null ? void 0 : K.values, (ne, me) => (w(), L("div", {
1581
- key: me,
1582
- class: "fm-typo-en-body-lg-600"
1583
- }, q(ne), 1))), 128))
1584
- ])
1585
- ]))), 128))
1586
- ])
1587
- ]),
1588
- _: 2
1589
- }, 1024)
1590
- ])
1591
- ])
1592
- ], 64))), 128))
1593
- ])) : (w(), L("div", ra, [
1594
- k(ye),
1595
- o("div", null, [
1596
- o("img", {
1597
- src: F(Ct),
1598
- alt: "List is empty"
1599
- }, null, 8, la)
1600
- ]),
1601
- t[16] || (t[16] = o("div", { class: "fm-typo-en-body-lg-600" }, q("No records found"), -1)),
1602
- t[17] || (t[17] = o("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, q("You can track approval and rejection history here"), -1)),
1603
- k(ye),
1604
- k(ye)
1605
- ]))
1606
- ])) : ee("", !0)
1607
- ])
1608
- ]),
1609
- _: 1
1610
- }, 8, ["model-value"]);
1611
- };
1612
- }
1613
- }), wa = { class: "flex-1 flex flex-col gap-8" }, Ca = { class: "flex flex-col" }, Sa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Fa = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, ja = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, Ba = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, Ua = /* @__PURE__ */ Te({
1614
- __name: "ClosingDraftView",
1615
- setup(l) {
1616
- const { t: s } = Xe(), { viewDraft: e } = $e(), { viewClosingDraftProps: u, viewClosingDraftShow: p } = wt($e()), _ = Ie(), m = Nt(), R = gt(), { breakpoints: C } = xt();
1617
- _.watchLocation(m.fetchDrafts);
1618
- const x = U(() => m.loading), v = V(""), I = U(() => C.value.xs || C.value.sm), Y = U(() => I.value ? 10 : 20);
1619
- function n(M) {
1620
- switch (M) {
1621
- case "refresh":
1622
- return m.fetchDrafts();
1623
- }
1624
- }
1625
- function a(M) {
1626
- return M;
1627
- }
1628
- const j = U(() => I.value ? [
1629
- {
1630
- label: s("inventory.common.refresh"),
1631
- value: "refresh",
1632
- isPrimary: !1
1633
- }
1634
- ] : [
1635
- {
1636
- label: s("inventory.common.refresh"),
1637
- value: "refresh",
1638
- isPrimary: !1
1639
- }
1640
- ]);
1641
- return (M, f) => {
1642
- const g = P("FmTable");
1643
- return w(), L(J, null, [
1644
- k(bt, {
1645
- title: F(s)("inventory.closing.draft.title"),
1646
- actions: j.value,
1647
- "onClick:action": n
1648
- }, {
1649
- default: O(() => [
1650
- o("div", {
1651
- class: be([
1652
- "flex flex-col gap-8 max-h-full",
1653
- {
1654
- "p-0": I.value,
1655
- "px-24 ": !I.value
1656
- }
1657
- ])
1658
- }, [
1659
- k(At, {
1660
- "change-location": "",
1661
- searchable: "",
1662
- search: v.value,
1663
- "onUpdate:search": f[0] || (f[0] = (b) => v.value = b)
1664
- }, null, 8, ["search"]),
1665
- k(g, {
1666
- style: Ke(F(R).tableHeight),
1667
- "column-defs": F(m).columnDefs,
1668
- "row-data": F(m).drafts,
1669
- "search-value": v.value,
1670
- loading: x.value,
1671
- onRowClick: f[1] || (f[1] = (b) => F(e)(b.original)),
1672
- "page-size": Y.value
1673
- }, {
1674
- "list-row": O((b) => [
1675
- k(Dt, {
1676
- row: b,
1677
- onRowClick: ($) => F(e)($)
1678
- }, {
1679
- default: O(($) => {
1680
- var H, te, B, X, ce, ie, ue, de, oe, Ae, xe, fe, De, pe, ve, se, ae, ke, r, t;
1681
- return [
1682
- o("div", wa, [
1683
- o("div", Ca, [
1684
- o("div", Sa, [
1685
- k(F(je), {
1686
- render: (B = (te = (H = $._id) == null ? void 0 : H.column) == null ? void 0 : te.columnDef) == null ? void 0 : B.cell,
1687
- props: (ce = (X = $._id) == null ? void 0 : X.getContext) == null ? void 0 : ce.call(X)
1688
- }, null, 8, ["render", "props"])
1689
- ]),
1690
- o("div", Fa, [
1691
- k(F(je), {
1692
- render: (de = (ue = (ie = $.name) == null ? void 0 : ie.column) == null ? void 0 : ue.columnDef) == null ? void 0 : de.cell,
1693
- props: (Ae = (oe = $.name) == null ? void 0 : oe.getContext) == null ? void 0 : Ae.call(oe)
1694
- }, null, 8, ["render", "props"])
1695
- ]),
1696
- o("div", ja, q([
1697
- ...b.original.items.slice(0, 3).map((y) => y.sku.name),
1698
- ...b.original.items.length >= 3 ? [`and ${b.original.items.length - 3} more items`] : []
1699
- ].join(", ")), 1),
1700
- o("div", Ba, [
1701
- k(F(je), {
1702
- render: (De = (fe = (xe = $.ref) == null ? void 0 : xe.column) == null ? void 0 : fe.columnDef) == null ? void 0 : De.cell,
1703
- props: (ve = (pe = $.ref) == null ? void 0 : pe.getContext) == null ? void 0 : ve.call(pe)
1704
- }, null, 8, ["render", "props"])
1705
- ])
1706
- ]),
1707
- o("div", null, [
1708
- k(F(je), {
1709
- render: (ke = (ae = (se = $.status) == null ? void 0 : se.column) == null ? void 0 : ae.columnDef) == null ? void 0 : ke.cell,
1710
- props: (t = (r = $.status) == null ? void 0 : r.getContext) == null ? void 0 : t.call(r)
1711
- }, null, 8, ["render", "props"])
1712
- ])
1713
- ])
1714
- ];
1715
- }),
1716
- _: 2
1717
- }, 1032, ["row", "onRowClick"])
1718
- ]),
1719
- _: 1
1720
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
1721
- ], 2)
1722
- ]),
1723
- _: 1
1724
- }, 8, ["title", "actions"]),
1725
- (w(), Q(st, { to: "body" }, [
1726
- k(xa, rt(F(u), {
1727
- show: F(p),
1728
- "onUpdate:show": f[2] || (f[2] = (b) => Ye(p) ? p.value = b : null),
1729
- onSubmitted: f[3] || (f[3] = () => (p.value = !1, F(m).fetchDrafts())),
1730
- onRefresh: f[4] || (f[4] = (b) => F(m).updateDraftRef(b))
1731
- }), null, 16, ["show"])
1732
- ]))
1733
- ], 64);
1734
- };
1735
- }
1736
- });
1737
- export {
1738
- Ua as default
1739
- };