@feedmepos/mf-inventory-portal 0.0.23-dev.41 → 0.0.23-dev.43

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