@feedmepos/mf-inventory-portal 0.0.23-dev.26 → 0.0.23-dev.27

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