@feedmepos/mf-inventory-portal 0.0.25-dev.39 → 0.0.25-dev.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/{App-B7L9LuKI.js → App-BqAbcrCa.js} +2 -2
  2. package/dist/{ApprovalView-P7uUdpuJ.js → ApprovalView-CstNyWuq.js} +19 -16
  3. package/dist/{BindingsDialog-E4j9FuOl.js → BindingsDialog-B2POgTvT.js} +2 -2
  4. package/dist/{BindingsPicker-3mrWImf-.js → BindingsPicker-Bp8wNAW0.js} +1 -1
  5. package/dist/{BindingsTable-DMoC7BEJ.js → BindingsTable-C5ToIwJw.js} +1 -1
  6. package/dist/{ClosingDraftView-hUFOQ9pI.js → ClosingDraftView-B5KgTQOB.js} +272 -268
  7. package/dist/{ClosingTemplateView-DGG2zD13.js → ClosingTemplateView-B6gT5-A_.js} +2 -2
  8. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BjYwi7Vb.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BcedQV1P.js} +37 -37
  9. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-B7CfRiCR.js → FmUnitInput.vue_vue_type_script_setup_true_lang-Bc6eTKR-.js} +22 -22
  10. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DH5ud0qJ.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-C76t4wed.js} +1 -1
  11. package/dist/{IngredientGroupView-D63u-gSo.js → IngredientGroupView-Bo18pDpd.js} +1 -1
  12. package/dist/{IngredientsView-DzzIoie9.js → IngredientsView-D4Tx5h1N.js} +4 -4
  13. package/dist/{IntegrationView-SO7nVoSn.js → IntegrationView-5cTVErK7.js} +23 -23
  14. package/dist/{InventoryBindingForm-CNBLyKuy.js → InventoryBindingForm-D_JUD2PF.js} +1 -1
  15. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-gcdA5y3h.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-Co33Sz1A.js} +3 -3
  16. package/dist/{InventoryBindingSummary-Cx5doszw.js → InventoryBindingSummary-DsQqzLxI.js} +1 -1
  17. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-uBLwHGx6.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CKCHqrFd.js} +1 -1
  18. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-U-MNov1N.js → PremiumBadge.vue_vue_type_script_setup_true_lang-NhSXPpV1.js} +3 -3
  19. package/dist/{PublishView-C7-F5H_l.js → PublishView-CVReC-7J.js} +2 -2
  20. package/dist/{PurchaseOrderPrintPreview-Cn1MGNQG.js → PurchaseOrderPrintPreview-kHtSdc_I.js} +1 -1
  21. package/dist/{ReceiveRequestView-1ltlDUjA.js → ReceiveRequestView-JJdBl6jR.js} +9 -9
  22. package/dist/{RecipeView-CFEr9txv.js → RecipeView-BAZzsPdQ.js} +3 -3
  23. package/dist/{StockView-BCuZoG8u.js → StockView-Dwzf7ewT.js} +7 -7
  24. package/dist/{SupplierView-BFZYyzZE.js → SupplierView-BoTsfsYX.js} +4 -4
  25. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-C2ZBmCNY.js +1564 -0
  26. package/dist/{TransferTemplateView-DAcRo6jQ.js → TransferTemplateView-BLO1uHet.js} +7 -7
  27. package/dist/{UnitView-IzqKR_Ue.js → UnitView-DfJ-huaQ.js} +3 -3
  28. package/dist/{WarehouseView-D_lYd_zi.js → WarehouseView-h5_GDAYM.js} +1 -1
  29. package/dist/{app-D8JtDgcD.js → app-CRWxxzQN.js} +4864 -4812
  30. package/dist/app.js +1 -1
  31. package/dist/{decimal-BzA7nhoj.js → decimal-BDt03-KF.js} +1 -1
  32. package/dist/{feature-DZpzqRzb.js → feature-D_c7uzcV.js} +1 -1
  33. package/dist/{format-unit-display-gJA_tWyb.js → format-unit-display-CsfojMpU.js} +2 -2
  34. package/dist/{index-4_4oJqYY.js → index-BbwuhE-c.js} +2 -2
  35. package/dist/{stock-Cw4_XPhT.js → stock-DSyF_gBG.js} +1 -1
  36. package/dist/{supplier-FQRxjLKh.js → supplier-BLqNIQG9.js} +1 -1
  37. package/dist/tsconfig.app.tsbuildinfo +1 -1
  38. package/dist/{use-ingredient-select-dialog-CxxnIrMR.js → use-ingredient-select-dialog-BSxFzWSk.js} +1 -1
  39. package/dist/{use-inventory-binding-dialog-C9t7UpkK.js → use-inventory-binding-dialog-DyIQsTTm.js} +1 -1
  40. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +2 -1
  41. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +2 -1
  42. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +4 -3
  43. package/dist/{vue-i18n-UenefCe4.js → vue-i18n-ZO6qpjnw.js} +270 -270
  44. package/package.json +3 -3
  45. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-XKOcF4q9.js +0 -1539
@@ -1,33 +1,33 @@
1
- import { defineComponent as ke, ref as V, resolveComponent as E, openBlock as x, createBlock as J, withCtx as Y, createElementVNode as o, createTextVNode as De, toDisplayString as z, unref as g, createVNode as _, h as k, reactive as Ve, computed as H, onMounted as Ye, watch as Ke, isRef as Te, createElementBlock as $, Fragment as W, createCommentVNode as ne, normalizeClass as me, renderList as ve, normalizeStyle as Re, Teleport as Ge, mergeProps as We } from "vue";
2
- import { W as qe, u as we, aj as q, l as Ze, J as Ce, i as P, t as Je, K as ye, p as Qe, q as Xe, r as et, ak as Me, al as Pe, a6 as Ie, am as tt, an as le, ac as at, ai as oe, T as Ue, D as Fe, h as xe, f as nt, e as ot, a as st, y as rt, _ as lt, z as ct, B as it, E as he } from "./app-D8JtDgcD.js";
1
+ import { defineComponent as ke, ref as V, resolveComponent as E, openBlock as x, createBlock as Q, withCtx as Y, createElementVNode as o, createTextVNode as De, toDisplayString as z, unref as y, createVNode as _, h as k, reactive as Ye, computed as H, onMounted as Ke, watch as Ge, isRef as Te, createElementBlock as T, Fragment as W, createCommentVNode as ne, normalizeClass as me, renderList as ve, normalizeStyle as Re, Teleport as We, mergeProps as qe } from "vue";
2
+ import { W as Ze, u as we, aj as q, l as Je, J as je, i as P, t as Qe, K as ye, p as Xe, q as et, r as tt, ak as Me, al as Pe, a6 as Ie, am as le, ac as at, ai as oe, T as Ue, D as Fe, h as xe, f as nt, e as ot, a as st, y as rt, _ as lt, z as ct, B as it, E as he } from "./app-CRWxxzQN.js";
3
3
  import { useCoreStore as ut, useI18n as Ee } from "@feedmepos/mf-common";
4
- import { useSnackbar as je, useDialog as dt, useProxiedModel as mt, components as de, useBreakpoints as ft } from "@feedmepos/ui-library";
4
+ import { useSnackbar as Ce, useDialog as dt, useProxiedModel as mt, components as de, useBreakpoints as ft } from "@feedmepos/ui-library";
5
5
  import { defineStore as He, storeToRefs as pt } from "pinia";
6
- import { u as Le, a as vt } from "./stock-Cw4_XPhT.js";
7
- import { E as yt } from "./empty-placeholder-wf6-BWE8.js";
8
- const Se = qe((n, r) => {
6
+ import { a as Le, u as ze } from "./stock-DSyF_gBG.js";
7
+ import { E as vt } from "./empty-placeholder-wf6-BWE8.js";
8
+ const Se = Ze((n, r) => {
9
9
  function e() {
10
10
  return we().currentLocation.dbName;
11
11
  }
12
12
  return {
13
13
  async getDraft(i) {
14
- const u = e(), b = `${n.inventoryBackendUrl}/${u}/closing-draft/${i}`;
15
- return r.get(b);
14
+ const u = e(), g = `${n.inventoryBackendUrl}/${u}/closing-draft/${i}`;
15
+ return r.get(g);
16
16
  },
17
17
  async readDrafts() {
18
18
  const i = e(), u = `${n.inventoryBackendUrl}/${i}/closing-draft`;
19
19
  return r.get(u);
20
20
  },
21
21
  async runOperation(i) {
22
- const u = e(), b = `${n.inventoryBackendUrl}/${u}/closing-draft/run-operation`;
23
- return r.post(b, i);
22
+ const u = e(), g = `${n.inventoryBackendUrl}/${u}/closing-draft/run-operation`;
23
+ return r.post(g, i);
24
24
  },
25
25
  async sync(i) {
26
- const u = e(), b = `${n.inventoryBackendUrl}/${u}/closing-draft/sync`;
27
- return r.post(b, i);
26
+ const u = e(), g = `${n.inventoryBackendUrl}/${u}/closing-draft/sync`;
27
+ return r.post(g, i);
28
28
  }
29
29
  };
30
- }), gt = { class: "fm-typo-en-body-lg-400" }, bt = { class: "fm-typo-en-body-lg-600" }, xt = { class: "flex gap-12 py-8 justify-end w-full" }, $e = /* @__PURE__ */ ke({
30
+ }), yt = { class: "fm-typo-en-body-lg-400" }, gt = { class: "fm-typo-en-body-lg-600" }, bt = { class: "flex gap-12 py-8 justify-end w-full" }, $e = /* @__PURE__ */ ke({
31
31
  __name: "ClosingDraftAction",
32
32
  props: {
33
33
  draft: {},
@@ -36,9 +36,9 @@ const Se = qe((n, r) => {
36
36
  onFinished: { type: Function }
37
37
  },
38
38
  setup(n) {
39
- const r = n, e = V(), i = Se(), u = je(), b = V(!1);
39
+ const r = n, e = V(), i = Se(), u = Ce(), g = V(!1);
40
40
  async function h() {
41
- b.value = !0;
41
+ g.value = !0;
42
42
  try {
43
43
  await i.runOperation({
44
44
  _id: r.draft._id,
@@ -59,40 +59,40 @@ const Se = qe((n, r) => {
59
59
  type: "error"
60
60
  }), console.error("error on submit closing draft aciont", D);
61
61
  } finally {
62
- b.value = !1;
62
+ g.value = !1;
63
63
  }
64
64
  }
65
65
  return (D, l) => {
66
- const T = E("FmTextField"), R = E("FmButton"), I = E("FmForm");
67
- return x(), J(I, {
66
+ const R = E("FmTextField"), M = E("FmButton"), U = E("FmForm");
67
+ return x(), Q(U, {
68
68
  onValidationSuccess: h,
69
69
  class: "flex flex-col gap-32",
70
- disabled: b.value
70
+ disabled: g.value
71
71
  }, {
72
72
  default: Y(() => [
73
- o("div", gt, [
73
+ o("div", yt, [
74
74
  l[2] || (l[2] = De(" You are about to ")),
75
- o("span", bt, z(D.action == g(q).enum.approveDraft ? "approve" : "reject"), 1),
75
+ o("span", gt, z(D.action == y(q).enum.approveDraft ? "approve" : "reject"), 1),
76
76
  l[3] || (l[3] = De(" this draft. Please provider a remark to justify this action. "))
77
77
  ]),
78
- _(T, {
78
+ _(R, {
79
79
  modelValue: e.value,
80
80
  "onUpdate:modelValue": l[0] || (l[0] = (s) => e.value = s),
81
81
  label: "Remark",
82
82
  "label-mark": "required",
83
- rules: [g(Ze)()]
83
+ rules: [y(Je)()]
84
84
  }, null, 8, ["modelValue", "rules"]),
85
- o("div", xt, [
86
- _(R, {
85
+ o("div", bt, [
86
+ _(M, {
87
87
  label: "Cancel",
88
88
  variant: "tertiary",
89
89
  onClick: l[1] || (l[1] = (s) => D.onCancel())
90
90
  }),
91
- _(R, {
92
- label: D.action == g(q).enum.approveDraft ? "Approve" : "Reject",
91
+ _(M, {
92
+ label: D.action == y(q).enum.approveDraft ? "Approve" : "Reject",
93
93
  type: "submit",
94
- variant: D.action == g(q).enum.approveDraft ? "primary" : "destructive",
95
- loading: b.value
94
+ variant: D.action == y(q).enum.approveDraft ? "primary" : "destructive",
95
+ loading: g.value
96
96
  }, null, 8, ["label", "variant", "loading"])
97
97
  ])
98
98
  ]),
@@ -100,30 +100,30 @@ const Se = qe((n, r) => {
100
100
  }, 8, ["disabled"]);
101
101
  };
102
102
  }
103
- }), ht = ye(0);
104
- function ze(n) {
103
+ }), xt = ye(0);
104
+ function Ne(n) {
105
105
  const r = n.measurementsAmounts.groupBy((i) => i.measurement.id), e = n.sku.unit.measurements.reduce((i, u) => {
106
106
  var D, l;
107
- const b = ((l = (D = r.get(u.id)) == null ? void 0 : D[0]) == null ? void 0 : l.amount) ?? ht, h = Ce(u.conversion, b);
107
+ const g = ((l = (D = r.get(u.id)) == null ? void 0 : D[0]) == null ? void 0 : l.amount) ?? xt, h = je(u.conversion, g);
108
108
  return i + +P(h);
109
109
  }, +P(n.baseAmount));
110
- return Je(e, n.baseAmount.precision);
110
+ return Qe(e, n.baseAmount.precision);
111
111
  }
112
- const At = ye(0), _t = ye(100);
113
- function Dt(n, r, e) {
114
- const i = ze(n), u = Me(i, r), b = r.amount === 0 ? null : Pe(u, {
112
+ const ht = ye(0), At = ye(100);
113
+ function _t(n, r, e) {
114
+ const i = Ne(n), u = Me(i, r), g = r.amount === 0 ? null : Pe(u, {
115
115
  ...r,
116
116
  amount: Math.abs(r.amount)
117
- }), h = b ? Ce(b, _t) : null;
117
+ }), h = g ? je(g, At) : null;
118
118
  return {
119
119
  code: n.sku.code,
120
120
  name: n.sku.name,
121
121
  baseUnit: n.sku.unit.abbrev,
122
122
  baseUnitAmount: +P(n.baseAmount),
123
123
  ...n.measurementsAmounts.filter(
124
- (l) => kt(l.measurement) && e.includes(l.measurement.id)
124
+ (l) => Dt(l.measurement) && e.includes(l.measurement.id)
125
125
  ).reduce(
126
- (l, T, R) => (l[`measurementAbbrev${R}`] = `(${T.measurement.abbrev}) × ${P(T.measurement.conversion)}`, l[`measurementAmount${R}`] = +P(T.amount), l),
126
+ (l, R, M) => (l[`measurementAbbrev${M}`] = `(${R.measurement.abbrev}) × ${P(R.measurement.conversion)}`, l[`measurementAmount${M}`] = +P(R.amount), l),
127
127
  {}
128
128
  ),
129
129
  systemBalance: +P(r),
@@ -132,11 +132,11 @@ function Dt(n, r, e) {
132
132
  adjustedDiffPercentage: h ? +P(Ie(h, 2)) : null
133
133
  };
134
134
  }
135
- function kt(n) {
135
+ function Dt(n) {
136
136
  return !n.abbrev.toLocaleLowerCase().includes("inactive");
137
137
  }
138
- function wt(n) {
139
- const r = Ne(n);
138
+ function kt(n) {
139
+ const r = Oe(n);
140
140
  return n.reduce(
141
141
  (e, i) => {
142
142
  var u;
@@ -145,13 +145,13 @@ function wt(n) {
145
145
  0
146
146
  );
147
147
  }
148
- function Ne(n) {
148
+ function Oe(n) {
149
149
  return n.groupBy(
150
150
  (r) => r.sku._id,
151
151
  (r) => r.measurementsAmounts.filter((e) => !e.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((e) => e.measurement.id)
152
152
  );
153
153
  }
154
- function Ct(n) {
154
+ function wt(n) {
155
155
  return [
156
156
  {
157
157
  id: "code",
@@ -198,26 +198,26 @@ function Ct(n) {
198
198
  ];
199
199
  }
200
200
  function jt(n, r) {
201
- var S, y, v, B, N, C, U;
201
+ var B, b, v, F, N, C, I;
202
202
  const e = r.groupBy(
203
- (M) => M.id,
204
- (M) => M.balance
205
- ), i = [...n.items, ...n.negativeStockItems ?? []], u = Ne(i), b = i.map((M) => {
203
+ (w) => w.id,
204
+ (w) => w.balance
205
+ ), i = [...n.items, ...n.negativeStockItems ?? []], u = Oe(i), g = i.map((w) => {
206
206
  var K, se;
207
- const Q = ((K = e.get(M.sku._id)) == null ? void 0 : K[0]) ?? At, X = ((se = u == null ? void 0 : u.get(M.sku._id)) == null ? void 0 : se[0]) ?? [];
208
- return Dt(M, Q, X);
209
- }), h = wt(i), l = ut().currentBusiness.value, T = Ct(h), R = [
207
+ const Z = ((K = e.get(w.sku._id)) == null ? void 0 : K[0]) ?? ht, X = ((se = u == null ? void 0 : u.get(w.sku._id)) == null ? void 0 : se[0]) ?? [];
208
+ return _t(w, Z, X);
209
+ }), h = kt(i), l = ut().currentBusiness.value, R = wt(h), M = [
210
210
  ["Business name:", l == null ? void 0 : l.name],
211
211
  ["Business ID:", l == null ? void 0 : l._id],
212
212
  ["Menu version", l == null ? void 0 : l.menuVersion],
213
213
  ["Created at", new Date(n.createdAt)],
214
- ["Created by", (S = n.createdBy) == null ? void 0 : S.name],
214
+ ["Created by", (B = n.createdBy) == null ? void 0 : B.name],
215
215
  ["Updated at", new Date(n.updatedAt)],
216
- ["Updated by", (y = n.updatedBy) == null ? void 0 : y.name],
216
+ ["Updated by", (b = n.updatedBy) == null ? void 0 : b.name],
217
217
  ["Recent action", n.approvedAt ? "Approve" : n.rejectionHistory ? "Reject" : ""],
218
218
  [
219
219
  "Action by",
220
- n.approvedAt ? (v = n.approvedBy) == null ? void 0 : v.name : n.rejectionHistory ? (N = (B = n.rejectionHistory[0]) == null ? void 0 : B.rejectedBy) == null ? void 0 : N.name : ""
220
+ n.approvedAt ? (v = n.approvedBy) == null ? void 0 : v.name : n.rejectionHistory ? (N = (F = n.rejectionHistory[0]) == null ? void 0 : F.rejectedBy) == null ? void 0 : N.name : ""
221
221
  ],
222
222
  [
223
223
  "Action at",
@@ -225,53 +225,57 @@ function jt(n, r) {
225
225
  ],
226
226
  [
227
227
  "Action remark",
228
- n.approvedAt ? n.approveRemark : n.rejectionHistory ? new Date((U = n.rejectionHistory[0]) == null ? void 0 : U.rejectRemark) : ""
228
+ n.approvedAt ? n.approveRemark : n.rejectionHistory ? new Date((I = n.rejectionHistory[0]) == null ? void 0 : I.rejectRemark) : ""
229
229
  ],
230
230
  [],
231
- T.map((M) => M.name),
232
- ...b.map((M) => T.map((Q) => M[Q.id]))
233
- ], I = T.map((M) => `system:${M.id}`), s = Qe(R, I), p = `[${l == null ? void 0 : l.name}] closing draft (${Xe(new Date(n.updatedAt))}).xlsx`;
234
- return et(s, p), p;
231
+ R.map((w) => w.name),
232
+ ...g.map((w) => R.map((Z) => w[Z.id]))
233
+ ], U = R.map((w) => `system:${w.id}`), s = Xe(M, U), p = `[${l == null ? void 0 : l.name}] closing draft (${et(new Date(n.updatedAt))}).xlsx`;
234
+ return tt(s, p), p;
235
235
  }
236
236
  const _e = He(
237
237
  "closingDraftActions",
238
238
  function() {
239
- const r = dt(), e = je(), i = tt(), u = Se(), b = Le(), h = V(!1), D = V();
240
- function l(y) {
239
+ const r = dt(), e = Ce(), i = Le(), u = Se(), g = ze(), h = V(!1), D = V();
240
+ function l(b) {
241
241
  const v = {
242
- draft: y
242
+ draft: b
243
243
  };
244
244
  D.value = v, h.value = !0;
245
245
  }
246
- async function T(y) {
247
- var B;
248
- if (y.status === le.enum.COMPLETED) {
249
- const N = y.closingId;
246
+ async function R(b) {
247
+ var F;
248
+ if (b.status === le.enum.COMPLETED) {
249
+ const N = b.closingAdjustmentId;
250
250
  if (!N)
251
251
  return e.open({
252
252
  title: "Something went wrong",
253
253
  message: "Closing draft is completed but closing document cannot be found.",
254
254
  type: "error"
255
255
  }), console.error("Closing draft is completed but closing document cannot be found.", {
256
- draftId: y == null ? void 0 : y._id
256
+ draftId: b._id
257
257
  }), [];
258
- const C = await i.getClosingById(N);
259
- return (C == null ? void 0 : C.skus) ?? [];
258
+ const C = await i.readAdjustmentById(N);
259
+ return ((C == null ? void 0 : C.skus) ?? []).map((w) => ({
260
+ id: w.sku._id,
261
+ balance: w.fromBalance,
262
+ costs: w.fromCostBalances
263
+ }));
260
264
  } else
261
- return await b.readStockBalance(), ((B = b.stockBalance) == null ? void 0 : B.skus) ?? [];
265
+ return await g.readStockBalance(), ((F = g.stockBalance) == null ? void 0 : F.skus) ?? [];
262
266
  }
263
- async function R(y, v) {
267
+ async function M(b, v) {
264
268
  v || (e.open({
265
269
  title: "Exporting",
266
270
  message: "Fetching data..."
267
- }), v = await T(y)), jt(y, v);
271
+ }), v = await R(b)), jt(b, v);
268
272
  }
269
- function I(y, v) {
273
+ function U(b, v) {
270
274
  r.open({
271
275
  title: "Approve draft",
272
276
  contentComponent: $e,
273
277
  contentComponentProps: {
274
- draft: y,
278
+ draft: b,
275
279
  action: q.enum.approveDraft,
276
280
  onFinished: () => {
277
281
  r.close(), v == null || v();
@@ -280,12 +284,12 @@ const _e = He(
280
284
  }
281
285
  });
282
286
  }
283
- function s(y, v) {
287
+ function s(b, v) {
284
288
  r.open({
285
289
  title: "Reject draft",
286
290
  contentComponent: $e,
287
291
  contentComponentProps: {
288
- draft: y,
292
+ draft: b,
289
293
  action: q.enum.rejectDraft,
290
294
  onFinished: () => {
291
295
  r.close(), v == null || v();
@@ -294,13 +298,13 @@ const _e = He(
294
298
  }
295
299
  });
296
300
  }
297
- async function p(y, v) {
301
+ async function p(b, v) {
298
302
  await u.sync({
299
- _id: y._id,
300
- _rev: y._rev ?? "",
303
+ _id: b._id,
304
+ _rev: b._rev ?? "",
301
305
  action: q.enum.approveDraft,
302
306
  data: {
303
- remark: y.remark ?? ""
307
+ remark: b.remark ?? ""
304
308
  }
305
309
  }).delayed(500), e.open({
306
310
  title: "Success",
@@ -308,16 +312,16 @@ const _e = He(
308
312
  type: "success"
309
313
  }), v == null || v();
310
314
  }
311
- function S() {
315
+ function B() {
312
316
  h.value = !1;
313
317
  }
314
318
  return {
315
319
  viewDraft: l,
316
- closeDraftDialog: S,
317
- approveDraft: I,
320
+ closeDraftDialog: B,
321
+ approveDraft: U,
318
322
  rejectDraft: s,
319
323
  syncDraft: p,
320
- exportDraft: R,
324
+ exportDraft: M,
321
325
  viewClosingDraftShow: h,
322
326
  viewClosingDraftProps: D
323
327
  };
@@ -335,12 +339,12 @@ function Ae(n) {
335
339
  return "fm-status-badge-complete";
336
340
  }
337
341
  }
338
- const St = He(
342
+ const Ct = He(
339
343
  "closingDraftTable",
340
344
  function() {
341
- const { t: r } = Ee(), e = _e(), i = V(new Array()), u = V(!1), b = we(), h = Se();
345
+ const { t: r } = Ee(), e = _e(), i = V(new Array()), u = V(!1), g = we(), h = Se();
342
346
  async function D() {
343
- if (i.value = [], !!b._currentLocation) {
347
+ if (i.value = [], !!g._currentLocation) {
344
348
  u.value = !0;
345
349
  try {
346
350
  const [s] = await Promise.all([h.readDrafts()]).delayed(1e3);
@@ -353,12 +357,12 @@ const St = He(
353
357
  }
354
358
  }
355
359
  async function l(s) {
356
- if (!i.value.find((p) => p._id) && b._currentLocation) {
360
+ if (!i.value.find((p) => p._id) && g._currentLocation) {
357
361
  u.value = !0;
358
362
  try {
359
363
  const [p] = await Promise.all([
360
364
  h.getDraft(s),
361
- new Promise((S) => setTimeout(S, 1e3))
365
+ new Promise((B) => setTimeout(B, 1e3))
362
366
  ]);
363
367
  i.value = [p];
364
368
  } catch (p) {
@@ -368,19 +372,19 @@ const St = He(
368
372
  }
369
373
  }
370
374
  }
371
- function T() {
375
+ function R() {
372
376
  e.closeDraftDialog(), D();
373
377
  }
374
- function R(s, p) {
378
+ function M(s, p) {
375
379
  switch (p = ot(p), s) {
376
380
  case xe.Details:
377
381
  return e.viewDraft(p);
378
382
  case xe.Export:
379
383
  return e.exportDraft(p);
380
384
  case q.enum.approveDraft:
381
- return e.approveDraft(p, T);
385
+ return e.approveDraft(p, R);
382
386
  case q.enum.rejectDraft:
383
- return e.rejectDraft(p, T);
387
+ return e.rejectDraft(p, R);
384
388
  }
385
389
  }
386
390
  return {
@@ -425,7 +429,7 @@ const St = He(
425
429
  id: "recentRemark",
426
430
  accessorFn: (s) => {
427
431
  var p;
428
- return (s == null ? void 0 : s.approveRemark) ?? ((p = s == null ? void 0 : s.rejectionHistory) == null ? void 0 : p.computeFirst((S) => S.rejectRemark)) ?? s.remark;
432
+ return (s == null ? void 0 : s.approveRemark) ?? ((p = s == null ? void 0 : s.rejectionHistory) == null ? void 0 : p.computeFirst((B) => B.rejectRemark)) ?? s.remark;
429
433
  },
430
434
  header: () => "Recent remark"
431
435
  },
@@ -436,8 +440,8 @@ const St = He(
436
440
  enableSorting: !1,
437
441
  cell(s) {
438
442
  var N;
439
- const p = s.row.original, S = p.status, y = new Date(p.updatedAt), v = (N = p == null ? void 0 : p.rejectionHistory) == null ? void 0 : N.computeFirst((C) => C.rejectedAt), B = v ? new Date(v) : null;
440
- return S === "DRAFT" && B ? B.getTime() > y.getTime() ? k(
443
+ const p = s.row.original, B = p.status, b = new Date(p.updatedAt), v = (N = p == null ? void 0 : p.rejectionHistory) == null ? void 0 : N.computeFirst((C) => C.rejectedAt), F = v ? new Date(v) : null;
444
+ return B === "DRAFT" && F ? F.getTime() > b.getTime() ? k(
441
445
  "div",
442
446
  {
443
447
  class: "flex"
@@ -469,9 +473,9 @@ const St = He(
469
473
  k(
470
474
  "div",
471
475
  {
472
- class: ["fm-status-badge", Ae(S)]
476
+ class: ["fm-status-badge", Ae(B)]
473
477
  },
474
- Ue(S)
478
+ Ue(B)
475
479
  )
476
480
  );
477
481
  }
@@ -479,10 +483,10 @@ const St = He(
479
483
  {
480
484
  id: "action",
481
485
  cell(s) {
482
- const p = s.row.original, S = [
486
+ const p = s.row.original, B = [
483
487
  Fe[xe.Details],
484
488
  Fe[xe.Export]
485
- ], y = [
489
+ ], b = [
486
490
  {
487
491
  translationKey: "inventory.closing.draft.approveDraft",
488
492
  color: "text-fm-color-typo-primary",
@@ -496,10 +500,10 @@ const St = He(
496
500
  ];
497
501
  return nt(
498
502
  [
499
- ...S,
500
- ...p.status === le.enum.DRAFT ? y : []
503
+ ...B,
504
+ ...p.status === le.enum.DRAFT ? b : []
501
505
  ],
502
- (v) => R(v, p)
506
+ (v) => M(v, p)
503
507
  );
504
508
  },
505
509
  enableSorting: !1,
@@ -516,34 +520,34 @@ const St = He(
516
520
  loadDraft: l
517
521
  };
518
522
  }
519
- ), Bt = { class: "w-full flex flex-col gap-32" }, Ft = { class: "flex justify-between" }, $t = { class: "flex" }, Tt = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, Rt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Mt = { class: "flex gap-1" }, Pt = { class: "fm-typo-en-body-lg-600" }, It = { class: "flex flex-col gap-16" }, Ut = { class: "flex items-center" }, Et = { key: 0 }, Ht = {
523
+ ), St = { class: "w-full flex flex-col gap-32" }, Bt = { class: "flex justify-between" }, Ft = { class: "flex" }, $t = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, Tt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Rt = { class: "flex gap-1" }, Mt = { class: "fm-typo-en-body-lg-600" }, Pt = { class: "flex flex-col gap-16" }, It = { class: "flex items-center" }, Ut = { key: 0 }, Et = {
520
524
  key: 0,
521
525
  class: "w-full flex flex-col items-center"
522
- }, Lt = { class: "flex items-center gap-8" }, zt = {
526
+ }, Ht = { class: "flex items-center gap-8" }, Lt = {
523
527
  key: 0,
524
528
  class: "flex gap-8"
525
- }, Nt = { class: "overflow-x-auto" }, Ot = {
529
+ }, zt = { class: "overflow-x-auto" }, Nt = {
526
530
  key: 1,
527
531
  class: "flex-1 xs:w-screen xs:max-w-full"
528
- }, Vt = {
532
+ }, Ot = {
529
533
  key: 0,
530
534
  class: "flex flex-col items-center gap-8 h-full"
531
- }, Yt = ["src"], Kt = {
535
+ }, Vt = ["src"], Yt = {
532
536
  key: 1,
533
537
  class: "px-4 flex flex-col"
534
- }, Gt = { class: "flex gap-12 content-stretch" }, Wt = {
538
+ }, Kt = { class: "flex gap-12 content-stretch" }, Gt = {
535
539
  class: "flex flex-col w-24",
536
540
  name: "circles"
537
- }, qt = { class: "flex-1 flex flex-col items-center" }, Zt = { class: "flex-1 flex flex-col items-center" }, Jt = {
541
+ }, Wt = { class: "flex-1 flex flex-col items-center" }, qt = { class: "flex-1 flex flex-col items-center" }, Zt = {
538
542
  class: "py-12 flex flex-col gap-4",
539
543
  name: "received-at header"
540
- }, Qt = { class: "fm-typo-en-body-lg-400" }, Xt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, ea = { class: "flex gap-12 content-stretch" }, ta = {
544
+ }, Jt = { class: "fm-typo-en-body-lg-400" }, Qt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Xt = { class: "flex gap-12 content-stretch" }, ea = {
541
545
  class: "flex flex-col w-24",
542
546
  name: "circles"
543
- }, aa = { class: "flex-1 flex flex-col items-center" }, na = {
547
+ }, ta = { class: "flex-1 flex flex-col items-center" }, aa = {
544
548
  class: "py-12 flex flex-col gap-4 flex-1",
545
549
  name: "delivery details"
546
- }, oa = { class: "flex flex-col gap-8" }, sa = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, ra = { class: "flex flex-col gap-4" }, la = { class: "flex gap-8" }, ca = /* @__PURE__ */ ke({
550
+ }, na = { class: "flex flex-col gap-8" }, oa = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, sa = { class: "flex flex-col gap-4" }, ra = { class: "flex gap-8" }, la = /* @__PURE__ */ ke({
547
551
  __name: "ClosingDraftDialog",
548
552
  props: {
549
553
  show: { type: Boolean },
@@ -551,38 +555,38 @@ const St = He(
551
555
  },
552
556
  emits: ["submitted"],
553
557
  setup(n, { emit: r }) {
554
- const e = n, i = Le(), u = _e(), b = mt(e, "show"), h = V(!1), D = V(!1), l = V(new Array()), T = vt(), R = je(), I = st(), s = Ve({}), p = H(() => new Set(
555
- I.skus.filter((a) => {
558
+ const e = n, i = ze(), u = _e(), g = mt(e, "show"), h = V(!1), D = V(!1), l = V(new Array()), R = Le(), M = Ce(), U = st(), s = Ye({}), p = H(() => new Set(
559
+ U.skus.filter((a) => {
556
560
  var t;
557
561
  return s[(t = a.customAttributes) == null ? void 0 : t.tag];
558
562
  }).map((a) => a._id)
559
- )), S = r, y = H(() => {
563
+ )), B = r, b = H(() => {
560
564
  var t, c;
561
565
  const a = [...((t = e.draft) == null ? void 0 : t.items) ?? [], ...((c = e.draft) == null ? void 0 : c.negativeStockItems) ?? []];
562
566
  return p.value.size ? a.filter((m) => p.value.has(m.sku._id)) : a;
563
567
  }), v = H(() => {
564
- const a = y.value.map((t) => t.sku);
568
+ const a = b.value.map((t) => t.sku);
565
569
  return a.sort((t, c) => t.code.localeCompare(c.code)), a;
566
- }), B = H(() => y.value.groupBy(
570
+ }), F = H(() => b.value.groupBy(
567
571
  (t) => t.sku._id,
568
572
  (t) => t.measurementsAmounts.filter((c) => !c.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((c) => c.measurement.id)
569
573
  ));
570
- Ye(U), Ke(
574
+ Ke(I), Ge(
571
575
  () => e.show,
572
576
  (a) => {
573
- a && (te.value = ee[0], U());
577
+ a && (te.value = ee[0], I());
574
578
  }
575
579
  );
576
580
  const N = ye(0), C = ye(100);
577
- async function U() {
581
+ async function I() {
578
582
  var t, c, m;
579
583
  h.value = !0;
580
584
  const a = ((t = e.draft) == null ? void 0 : t.status) === le.enum.COMPLETED;
581
585
  try {
582
- if (await I.init(), a) {
586
+ if (await U.init(), a) {
583
587
  const d = e.draft.closingAdjustmentId;
584
588
  if (!d) {
585
- R.open({
589
+ M.open({
586
590
  title: "Something went wrong",
587
591
  message: "Closing draft is completed but closing document cannot be found.",
588
592
  type: "error"
@@ -591,16 +595,16 @@ const St = He(
591
595
  });
592
596
  return;
593
597
  }
594
- const f = await T.readAdjustmentById(d), w = (f == null ? void 0 : f.skus) ?? [];
595
- l.value = w.map((F) => ({
596
- id: F.sku._id,
597
- balance: F.fromBalance,
598
- costs: F.fromCostBalances
598
+ const f = await R.readAdjustmentById(d), j = (f == null ? void 0 : f.skus) ?? [];
599
+ l.value = j.map(($) => ({
600
+ id: $.sku._id,
601
+ balance: $.fromBalance,
602
+ costs: $.fromCostBalances
599
603
  }));
600
604
  } else
601
605
  await i.readStockBalance(), l.value = ((m = i.stockBalance) == null ? void 0 : m.skus) ?? [];
602
606
  } catch (d) {
603
- R.open({
607
+ M.open({
604
608
  title: "Something went wrong",
605
609
  message: "Something went wrong when fetching info. Please try again.",
606
610
  type: "error"
@@ -609,12 +613,12 @@ const St = He(
609
613
  h.value = !1;
610
614
  }
611
615
  }
612
- const M = H(
616
+ const w = H(
613
617
  () => l.value.groupBy(
614
618
  (a) => a.id,
615
619
  (a) => a.balance
616
620
  )
617
- ), Q = H(() => y.value.groupBy((a) => a.sku._id));
621
+ ), Z = H(() => b.value.groupBy((a) => a.sku._id));
618
622
  function X(a) {
619
623
  return k(
620
624
  de.FmTooltip,
@@ -632,7 +636,7 @@ const St = He(
632
636
  const K = H(() => {
633
637
  const a = v.value.reduce((c, m) => {
634
638
  var d, f;
635
- return Math.max(c, ((f = (d = B.value) == null ? void 0 : d.get(m._id)) == null ? void 0 : f[0].length) ?? 0);
639
+ return Math.max(c, ((f = (d = F.value) == null ? void 0 : d.get(m._id)) == null ? void 0 : f[0].length) ?? 0);
636
640
  }, 0);
637
641
  return [
638
642
  {
@@ -641,7 +645,7 @@ const St = He(
641
645
  header: () => "Name",
642
646
  size: 350,
643
647
  cell(c) {
644
- const m = c.row.original, d = m.adjustedDiffPercentage, f = typeof d == "number" && Math.abs(d) > 10, w = k("div", { class: "flex flex-col gap-4" }, [
648
+ const m = c.row.original, d = m.adjustedDiffPercentage, f = typeof d == "number" && Math.abs(d) > 10, j = k("div", { class: "flex flex-col gap-4" }, [
645
649
  k(
646
650
  "div",
647
651
  {
@@ -674,7 +678,7 @@ const St = He(
674
678
  },
675
679
  default() {
676
680
  return k("div", { class: "flex items-center gap-4 justify-start w-full" }, [
677
- w
681
+ j
678
682
  ]);
679
683
  }
680
684
  }
@@ -757,7 +761,7 @@ const St = He(
757
761
  header: () => "Amounts",
758
762
  enableSorting: !1,
759
763
  cell(c) {
760
- const m = c.row.original, d = (w, F) => k(
764
+ const m = c.row.original, d = (j, $) => k(
761
765
  de.FmTooltip,
762
766
  { zIndex: 50 },
763
767
  {
@@ -768,29 +772,29 @@ const St = He(
768
772
  class: "fm-typo-en-body-md-400 py-4 px-8 border-1 border-fm-color-typo-secondary fm-corner-radius-md line-clamp-1"
769
773
  },
770
774
  [
771
- k("span", { class: "text-fm-color-typo-primary" }, `${w} `),
775
+ k("span", { class: "text-fm-color-typo-primary" }, `${j} `),
772
776
  k(
773
777
  "span",
774
778
  {
775
779
  class: "text-fm-color-typo-secondary",
776
780
  style: { maxWidth: "80px" }
777
781
  },
778
- F
782
+ $
779
783
  )
780
784
  ]
781
785
  );
782
786
  },
783
787
  content() {
784
- return `${w} ${F}`;
788
+ return `${j} ${$}`;
785
789
  }
786
790
  }
787
791
  );
788
- let f = Array.from({ length: a }).map((w, F) => {
789
- if (!m[`measurementAmount${F}`])
792
+ let f = Array.from({ length: a }).map((j, $) => {
793
+ if (!m[`measurementAmount${$}`])
790
794
  return null;
791
- const j = m[`measurementAmount${F}`], ie = m[`measurementAbbrev${F}`];
792
- return d(j, ie);
793
- }).filter((w) => w);
795
+ const S = m[`measurementAmount${$}`], ie = m[`measurementAbbrev${$}`];
796
+ return d(S, ie);
797
+ }).filter((j) => j);
794
798
  return (m.baseUnitAmount || !f.length) && (f = [d(m.baseUnitAmount, m.baseUnit), ...f]), k(
795
799
  "div",
796
800
  {
@@ -805,8 +809,8 @@ const St = He(
805
809
  }
806
810
  ];
807
811
  }), se = H(() => K.value.map((a) => a.size ?? 0).reduce((a, t) => a + t)), ce = V(""), fe = H(() => v.value.map((a) => {
808
- var j, ie;
809
- const t = (j = Q.value.get(a._id)) == null ? void 0 : j[0], c = ((ie = M.value.get(a._id)) == null ? void 0 : ie[0]) ?? N;
812
+ var S, ie;
813
+ const t = (S = Z.value.get(a._id)) == null ? void 0 : S[0], c = ((ie = w.value.get(a._id)) == null ? void 0 : ie[0]) ?? N;
810
814
  if (!t)
811
815
  return {
812
816
  code: a.code,
@@ -818,10 +822,10 @@ const St = He(
818
822
  adjustedAmount: -+P(c),
819
823
  adjustedDiffPercentage: -100
820
824
  };
821
- const m = ze(t), d = Me(m, c), f = c.amount === 0 ? null : Pe(d, {
825
+ const m = Ne(t), d = Me(m, c), f = c.amount === 0 ? null : Pe(d, {
822
826
  ...c,
823
827
  amount: Math.abs(c.amount)
824
- }), w = f ? Ce(f, C) : null;
828
+ }), j = f ? je(f, C) : null;
825
829
  return {
826
830
  code: a.code,
827
831
  name: a.name,
@@ -829,12 +833,12 @@ const St = He(
829
833
  baseUnitAmount: +P(t.baseAmount),
830
834
  ...t.measurementsAmounts.filter((ae) => {
831
835
  var G, re, be;
832
- return (be = (re = (G = B.value) == null ? void 0 : G.get(a._id)) == null ? void 0 : re[0]) == null ? void 0 : be.includes(ae.measurement.id);
836
+ return (be = (re = (G = F.value) == null ? void 0 : G.get(a._id)) == null ? void 0 : re[0]) == null ? void 0 : be.includes(ae.measurement.id);
833
837
  }).reduce((ae, G, re) => (ae[`measurementAbbrev${re}`] = `(${G.measurement.abbrev}) × ${P(G.measurement.conversion)}`, ae[`measurementAmount${re}`] = +P(G.amount), ae), {}),
834
838
  systemBalance: +P(c),
835
839
  physicalBalance: +P(m),
836
840
  adjustedAmount: +P(d),
837
- adjustedDiffPercentage: w ? +P(Ie(w, 2)) : null
841
+ adjustedDiffPercentage: j ? +P(Ie(j, 2)) : null
838
842
  };
839
843
  })), ge = H(() => {
840
844
  var t, c, m;
@@ -901,7 +905,7 @@ const St = He(
901
905
  label: "Action history",
902
906
  value: "history"
903
907
  }
904
- ], te = V(ee[0]), Z = H(() => {
908
+ ], te = V(ee[0]), J = H(() => {
905
909
  var t, c, m, d;
906
910
  return [
907
911
  ...(((t = e.draft) == null ? void 0 : t.rejectionHistory) ?? []).map(
@@ -938,30 +942,30 @@ const St = He(
938
942
  ] : []
939
943
  ];
940
944
  }), pe = H(() => {
941
- var d, f, w, F;
945
+ var d, f, j, $;
942
946
  if ((d = e == null ? void 0 : e.draft) != null && d.approvedAt) return "Draft is already approved.";
943
947
  if (((f = e.draft) == null ? void 0 : f.status) !== le.enum.DRAFT) return "Status is not draft.";
944
- const a = fe.value.some((j) => j.physicalBalance < 0), t = ((F = (w = i.stockBalance.skus) == null ? void 0 : w.filter((j) => j.balance.amount < 0)) == null ? void 0 : F.map((j) => j.id)) ?? [], c = new Set(v.value.map((j) => j._id)), m = t.filter((j) => !c.has(j)).length;
948
+ const a = fe.value.some((S) => S.physicalBalance < 0), t = (($ = (j = i.stockBalance.skus) == null ? void 0 : j.filter((S) => S.balance.amount < 0)) == null ? void 0 : $.map((S) => S.id)) ?? [], c = new Set(v.value.map((S) => S._id)), m = t.filter((S) => !c.has(S)).length;
945
949
  return [
946
950
  a ? "Negative total exist." : null,
947
951
  m ? "Negative stock is not included in this draft. Reopen draft in POS and apply changes." : null
948
- ].filter((j) => j).join(" ");
952
+ ].filter((S) => S).join(" ");
949
953
  });
950
954
  return (a, t) => {
951
- const c = E("FmButtonGroup"), m = E("FmMenuDivider"), d = E("FmCard"), f = E("FmButton"), w = E("FmCircularProgress"), F = E("FmTextField"), j = E("FmIcon"), ie = E("FmChip"), ae = E("FmTable"), G = E("FmSpacer"), re = E("FmTooltip"), be = E("FmSideSheet");
952
- return x(), J(be, {
955
+ const c = E("FmButtonGroup"), m = E("FmMenuDivider"), d = E("FmCard"), f = E("FmButton"), j = E("FmCircularProgress"), $ = E("FmTextField"), S = E("FmIcon"), ie = E("FmChip"), ae = E("FmTable"), G = E("FmSpacer"), re = E("FmTooltip"), be = E("FmSideSheet");
956
+ return x(), Q(be, {
953
957
  "dismiss-away": "",
954
958
  "max-width": 9999,
955
- "model-value": g(b),
956
- "onUpdate:modelValue": t[8] || (t[8] = (A) => Te(b) ? b.value = A : null),
959
+ "model-value": y(g),
960
+ "onUpdate:modelValue": t[8] || (t[8] = (A) => Te(g) ? g.value = A : null),
957
961
  header: "Closing details"
958
962
  }, {
959
963
  "side-sheet-footer": Y(() => {
960
964
  var A, L, O, ue;
961
965
  return [
962
- o("div", la, [
963
- ((A = e.draft) == null ? void 0 : A.status) === g(le).enum.DRAFT ? (x(), $(W, { key: 0 }, [
964
- pe.value ? (x(), J(re, {
966
+ o("div", ra, [
967
+ ((A = e.draft) == null ? void 0 : A.status) === y(le).enum.DRAFT ? (x(), T(W, { key: 0 }, [
968
+ pe.value ? (x(), Q(re, {
965
969
  key: 0,
966
970
  "z-index": 51
967
971
  }, {
@@ -973,42 +977,42 @@ const St = He(
973
977
  disabled: "",
974
978
  key: "approve key",
975
979
  label: "Approve",
976
- onClick: t[3] || (t[3] = () => e.draft && g(u).approveDraft(e.draft, () => S("submitted")))
980
+ onClick: t[3] || (t[3] = () => e.draft && y(u).approveDraft(e.draft, () => B("submitted")))
977
981
  })
978
982
  ]),
979
983
  _: 1
980
- })) : (x(), J(f, {
984
+ })) : (x(), Q(f, {
981
985
  key: "approve key",
982
986
  label: "Approve",
983
- onClick: t[4] || (t[4] = () => e.draft && g(u).approveDraft(e.draft, () => S("submitted")))
987
+ onClick: t[4] || (t[4] = () => e.draft && y(u).approveDraft(e.draft, () => B("submitted")))
984
988
  }))
985
989
  ], 64)) : ne("", !0),
986
- ((L = e.draft) == null ? void 0 : L.status) === g(le).enum.DRAFT ? (x(), J(f, {
990
+ ((L = e.draft) == null ? void 0 : L.status) === y(le).enum.DRAFT ? (x(), Q(f, {
987
991
  key: 1,
988
992
  label: "Reject",
989
993
  variant: "destructive",
990
- onClick: t[5] || (t[5] = () => e.draft && g(u).rejectDraft(e.draft, () => S("submitted")))
994
+ onClick: t[5] || (t[5] = () => e.draft && y(u).rejectDraft(e.draft, () => B("submitted")))
991
995
  })) : ne("", !0),
992
- (O = e.draft) != null && O.approvedAt && ((ue = e.draft) == null ? void 0 : ue.status) !== g(le).enum.COMPLETED ? (x(), J(f, {
996
+ (O = e.draft) != null && O.approvedAt && ((ue = e.draft) == null ? void 0 : ue.status) !== y(le).enum.COMPLETED ? (x(), Q(f, {
993
997
  key: 2,
994
998
  label: "Sync",
995
999
  loading: D.value,
996
1000
  onClick: t[6] || (t[6] = () => {
997
- e.draft && (D.value = !0, g(u).syncDraft(e.draft, () => {
998
- D.value = !1, S("submitted");
1001
+ e.draft && (D.value = !0, y(u).syncDraft(e.draft, () => {
1002
+ D.value = !1, B("submitted");
999
1003
  }));
1000
1004
  })
1001
1005
  }, null, 8, ["loading"])) : ne("", !0),
1002
1006
  _(f, {
1003
1007
  label: "Close",
1004
1008
  variant: "tertiary",
1005
- onClick: t[7] || (t[7] = (Be) => b.value = !1)
1009
+ onClick: t[7] || (t[7] = (Be) => g.value = !1)
1006
1010
  })
1007
1011
  ])
1008
1012
  ];
1009
1013
  }),
1010
1014
  default: Y(() => [
1011
- o("div", Bt, [
1015
+ o("div", St, [
1012
1016
  o("div", null, [
1013
1017
  _(c, {
1014
1018
  items: ee,
@@ -1016,7 +1020,7 @@ const St = He(
1016
1020
  "onUpdate:modelValue": t[0] || (t[0] = (A) => te.value = A)
1017
1021
  }, null, 8, ["modelValue"])
1018
1022
  ]),
1019
- te.value.value === "overview" ? (x(), $(W, { key: 0 }, [
1023
+ te.value.value === "overview" ? (x(), T(W, { key: 0 }, [
1020
1024
  _(d, {
1021
1025
  variant: "outlined",
1022
1026
  class: "flex flex-col gap-8 px-12 py-16"
@@ -1024,34 +1028,34 @@ const St = He(
1024
1028
  default: Y(() => {
1025
1029
  var A, L;
1026
1030
  return [
1027
- o("div", Ft, [
1031
+ o("div", Bt, [
1028
1032
  t[9] || (t[9] = o("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
1029
- o("div", $t, [
1033
+ o("div", Ft, [
1030
1034
  o("div", {
1031
- class: me(["fm-status-badge", g(Ae)(((A = a.draft) == null ? void 0 : A.status) ?? "DRAFT")])
1032
- }, z(g(Ue)(((L = a.draft) == null ? void 0 : L.status) ?? "")), 3)
1035
+ class: me(["fm-status-badge", y(Ae)(((A = a.draft) == null ? void 0 : A.status) ?? "DRAFT")])
1036
+ }, z(y(Ue)(((L = a.draft) == null ? void 0 : L.status) ?? "")), 3)
1033
1037
  ])
1034
1038
  ]),
1035
1039
  _(m),
1036
- o("div", Tt, [
1037
- (x(!0), $(W, null, ve(ge.value, (O, ue) => (x(), $("div", {
1040
+ o("div", $t, [
1041
+ (x(!0), T(W, null, ve(ge.value, (O, ue) => (x(), T("div", {
1038
1042
  class: "flex flex-col gap-4",
1039
1043
  key: ue
1040
1044
  }, [
1041
- o("div", Rt, [
1042
- o("div", Mt, z(O.label), 1)
1045
+ o("div", Tt, [
1046
+ o("div", Rt, z(O.label), 1)
1043
1047
  ]),
1044
- o("div", Pt, z(O.value), 1)
1048
+ o("div", Mt, z(O.value), 1)
1045
1049
  ]))), 128))
1046
1050
  ])
1047
1051
  ];
1048
1052
  }),
1049
1053
  _: 1
1050
1054
  }),
1051
- o("div", It, [
1052
- o("div", Ut, [
1055
+ o("div", Pt, [
1056
+ o("div", It, [
1053
1057
  t[10] || (t[10] = o("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
1054
- h.value ? ne("", !0) : (x(), $("div", Et, [
1058
+ h.value ? ne("", !0) : (x(), T("div", Ut, [
1055
1059
  _(f, {
1056
1060
  label: "Export data",
1057
1061
  "prepend-icon": "download",
@@ -1059,29 +1063,29 @@ const St = He(
1059
1063
  "text-color": "primary",
1060
1064
  "bg-color": "transparent",
1061
1065
  "border-color": "primary",
1062
- onClick: t[1] || (t[1] = (A) => a.draft ? g(u).exportDraft(a.draft, l.value) : null)
1066
+ onClick: t[1] || (t[1] = (A) => a.draft ? y(u).exportDraft(a.draft, l.value) : null)
1063
1067
  })
1064
1068
  ]))
1065
1069
  ]),
1066
- h.value ? (x(), $("div", Ht, [
1070
+ h.value ? (x(), T("div", Et, [
1067
1071
  t[12] || (t[12] = o("div", { class: "h-80" }, null, -1)),
1068
- o("div", Lt, [
1072
+ o("div", Ht, [
1069
1073
  o("div", null, [
1070
- _(w, { size: "md" })
1074
+ _(j, { size: "md" })
1071
1075
  ]),
1072
1076
  t[11] || (t[11] = o("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
1073
1077
  ]),
1074
1078
  t[13] || (t[13] = o("div", { class: "h-80" }, null, -1))
1075
- ])) : (x(), $(W, { key: 1 }, [
1079
+ ])) : (x(), T(W, { key: 1 }, [
1076
1080
  o("div", null, [
1077
- _(F, {
1081
+ _($, {
1078
1082
  modelValue: ce.value,
1079
1083
  "onUpdate:modelValue": t[2] || (t[2] = (A) => ce.value = A),
1080
1084
  placeholder: "Filter items"
1081
1085
  }, null, 8, ["modelValue"])
1082
1086
  ]),
1083
- g(I).skuTags.size ? (x(), $("div", zt, [
1084
- (x(!0), $(W, null, ve(g(I).skuTags.keys(), (A) => (x(), J(ie, {
1087
+ y(U).skuTags.size ? (x(), T("div", Lt, [
1088
+ (x(!0), T(W, null, ve(y(U).skuTags.keys(), (A) => (x(), Q(ie, {
1085
1089
  key: `${A}`,
1086
1090
  label: `${A}`,
1087
1091
  selectable: "",
@@ -1089,7 +1093,7 @@ const St = He(
1089
1093
  onClick: (L) => s[`${A}`] = !s[`${A}`]
1090
1094
  }, {
1091
1095
  default: Y(() => [
1092
- s[`${A}`] ? (x(), J(j, {
1096
+ s[`${A}`] ? (x(), Q(S, {
1093
1097
  key: 0,
1094
1098
  name: "check",
1095
1099
  class: "text-white",
@@ -1108,7 +1112,7 @@ const St = He(
1108
1112
  _: 2
1109
1113
  }, 1032, ["label", "selected", "onClick"]))), 128))
1110
1114
  ])) : ne("", !0),
1111
- o("div", Nt, [
1115
+ o("div", zt, [
1112
1116
  o("div", {
1113
1117
  style: Re({ minWidth: `${se.value}px` })
1114
1118
  }, [
@@ -1122,12 +1126,12 @@ const St = He(
1122
1126
  ], 64))
1123
1127
  ])
1124
1128
  ], 64)) : ne("", !0),
1125
- te.value.value === "history" ? (x(), $("div", Ot, [
1126
- Z.value.length ? (x(), $("div", Kt, [
1127
- (x(!0), $(W, null, ve(Z.value, (A, L) => (x(), $(W, { key: L }, [
1128
- o("div", Gt, [
1129
- o("div", Wt, [
1130
- o("div", qt, [
1129
+ te.value.value === "history" ? (x(), T("div", Nt, [
1130
+ J.value.length ? (x(), T("div", Yt, [
1131
+ (x(!0), T(W, null, ve(J.value, (A, L) => (x(), T(W, { key: L }, [
1132
+ o("div", Kt, [
1133
+ o("div", Gt, [
1134
+ o("div", Wt, [
1131
1135
  o("div", {
1132
1136
  class: me([
1133
1137
  {
@@ -1139,52 +1143,52 @@ const St = He(
1139
1143
  }, null, 2)
1140
1144
  ]),
1141
1145
  t[16] || (t[16] = o("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
1142
- o("div", Zt, [
1146
+ o("div", qt, [
1143
1147
  o("div", {
1144
1148
  class: me([
1145
1149
  {
1146
- "bg-fm-color-primary": L < Z.value.length - 1,
1147
- "bg-white": L >= Z.value.length - 1
1150
+ "bg-fm-color-primary": L < J.value.length - 1,
1151
+ "bg-white": L >= J.value.length - 1
1148
1152
  },
1149
1153
  "w-[2px] h-full"
1150
1154
  ])
1151
1155
  }, null, 2)
1152
1156
  ])
1153
1157
  ]),
1154
- o("div", Jt, [
1155
- o("div", Qt, z(A.header), 1),
1156
- o("div", Xt, z(A.date), 1)
1158
+ o("div", Zt, [
1159
+ o("div", Jt, z(A.header), 1),
1160
+ o("div", Qt, z(A.date), 1)
1157
1161
  ])
1158
1162
  ]),
1159
- o("div", ea, [
1160
- o("div", ta, [
1161
- o("div", aa, [
1163
+ o("div", Xt, [
1164
+ o("div", ea, [
1165
+ o("div", ta, [
1162
1166
  o("div", {
1163
1167
  class: me([
1164
1168
  {
1165
- "bg-fm-color-primary": L < Z.value.length - 1,
1166
- "bg-white": L >= Z.value.length - 1
1169
+ "bg-fm-color-primary": L < J.value.length - 1,
1170
+ "bg-white": L >= J.value.length - 1
1167
1171
  },
1168
1172
  "w-[2px] h-full"
1169
1173
  ])
1170
1174
  }, null, 2)
1171
1175
  ])
1172
1176
  ]),
1173
- o("div", na, [
1177
+ o("div", aa, [
1174
1178
  _(d, {
1175
1179
  variant: "outlined",
1176
1180
  class: "py-12 px-16"
1177
1181
  }, {
1178
1182
  default: Y(() => [
1179
- o("div", oa, [
1180
- (x(!0), $(W, null, ve(A.info, (O, ue) => (x(), $("div", {
1183
+ o("div", na, [
1184
+ (x(!0), T(W, null, ve(A.info, (O, ue) => (x(), T("div", {
1181
1185
  key: ue,
1182
1186
  class: "flex flex-col gap-4"
1183
1187
  }, [
1184
- o("div", sa, z(O == null ? void 0 : O.label), 1),
1185
- o("div", ra, [
1186
- (x(!0), $(W, null, ve(O == null ? void 0 : O.values, (Be, Oe) => (x(), $("div", {
1187
- key: Oe,
1188
+ o("div", oa, z(O == null ? void 0 : O.label), 1),
1189
+ o("div", sa, [
1190
+ (x(!0), T(W, null, ve(O == null ? void 0 : O.values, (Be, Ve) => (x(), T("div", {
1191
+ key: Ve,
1188
1192
  class: "fm-typo-en-body-lg-600"
1189
1193
  }, z(Be), 1))), 128))
1190
1194
  ])
@@ -1196,13 +1200,13 @@ const St = He(
1196
1200
  ])
1197
1201
  ])
1198
1202
  ], 64))), 128))
1199
- ])) : (x(), $("div", Vt, [
1203
+ ])) : (x(), T("div", Ot, [
1200
1204
  _(G),
1201
1205
  o("div", null, [
1202
1206
  o("img", {
1203
- src: g(yt),
1207
+ src: y(vt),
1204
1208
  alt: "List is empty"
1205
- }, null, 8, Yt)
1209
+ }, null, 8, Vt)
1206
1210
  ]),
1207
1211
  t[14] || (t[14] = o("div", { class: "fm-typo-en-body-lg-600" }, z("No records found"), -1)),
1208
1212
  t[15] || (t[15] = o("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, z("You can track approval and rejection history here"), -1)),
@@ -1216,22 +1220,22 @@ const St = He(
1216
1220
  }, 8, ["model-value"]);
1217
1221
  };
1218
1222
  }
1219
- }), ia = { class: "flex-1 flex flex-col gap-8" }, ua = { class: "flex flex-col" }, da = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ma = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, fa = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, pa = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, _a = /* @__PURE__ */ ke({
1223
+ }), ca = { class: "flex-1 flex flex-col gap-8" }, ia = { class: "flex flex-col" }, ua = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, da = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, ma = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, fa = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, Aa = /* @__PURE__ */ ke({
1220
1224
  __name: "ClosingDraftView",
1221
1225
  setup(n) {
1222
- const { t: r } = Ee(), { viewDraft: e } = _e(), { viewClosingDraftProps: i, viewClosingDraftShow: u } = pt(_e()), b = we(), h = St(), D = rt(), { breakpoints: l } = ft();
1223
- b.watchLocation(h.fetchDrafts);
1224
- const T = H(() => h.loading), R = V(""), I = H(() => l.value.xs || l.value.sm), s = H(() => I.value ? 10 : 20);
1226
+ const { t: r } = Ee(), { viewDraft: e } = _e(), { viewClosingDraftProps: i, viewClosingDraftShow: u } = pt(_e()), g = we(), h = Ct(), D = rt(), { breakpoints: l } = ft();
1227
+ g.watchLocation(h.fetchDrafts);
1228
+ const R = H(() => h.loading), M = V(""), U = H(() => l.value.xs || l.value.sm), s = H(() => U.value ? 10 : 20);
1225
1229
  function p(v) {
1226
1230
  switch (v) {
1227
1231
  case "refresh":
1228
1232
  return h.fetchDrafts();
1229
1233
  }
1230
1234
  }
1231
- function S(v) {
1235
+ function B(v) {
1232
1236
  return v;
1233
1237
  }
1234
- const y = H(() => I.value ? [
1238
+ const b = H(() => U.value ? [
1235
1239
  {
1236
1240
  label: "Refresh",
1237
1241
  value: "refresh",
@@ -1244,12 +1248,12 @@ const St = He(
1244
1248
  isPrimary: !1
1245
1249
  }
1246
1250
  ]);
1247
- return (v, B) => {
1251
+ return (v, F) => {
1248
1252
  const N = E("FmTable");
1249
- return x(), $(W, null, [
1253
+ return x(), T(W, null, [
1250
1254
  _(lt, {
1251
- title: g(r)("inventory.closing.draft.title"),
1252
- actions: y.value,
1255
+ title: y(r)("inventory.closing.draft.title"),
1256
+ actions: b.value,
1253
1257
  "onClick:action": p
1254
1258
  }, {
1255
1259
  default: Y(() => [
@@ -1257,63 +1261,63 @@ const St = He(
1257
1261
  class: me([
1258
1262
  "flex flex-col gap-8 max-h-full",
1259
1263
  {
1260
- "p-0": I.value,
1261
- "px-24 ": !I.value
1264
+ "p-0": U.value,
1265
+ "px-24 ": !U.value
1262
1266
  }
1263
1267
  ])
1264
1268
  }, [
1265
1269
  _(ct, {
1266
1270
  "change-location": "",
1267
1271
  searchable: "",
1268
- search: R.value,
1269
- "onUpdate:search": B[0] || (B[0] = (C) => R.value = C)
1272
+ search: M.value,
1273
+ "onUpdate:search": F[0] || (F[0] = (C) => M.value = C)
1270
1274
  }, null, 8, ["search"]),
1271
1275
  _(N, {
1272
- style: Re(g(D).tableHeight),
1273
- "column-defs": g(h).columnDefs,
1274
- "row-data": g(h).drafts,
1275
- "search-value": R.value,
1276
- loading: T.value,
1277
- onRowClick: B[1] || (B[1] = (C) => g(e)(C.original)),
1276
+ style: Re(y(D).tableHeight),
1277
+ "column-defs": y(h).columnDefs,
1278
+ "row-data": y(h).drafts,
1279
+ "search-value": M.value,
1280
+ loading: R.value,
1281
+ onRowClick: F[1] || (F[1] = (C) => y(e)(C.original)),
1278
1282
  "page-size": s.value
1279
1283
  }, {
1280
1284
  "list-row": Y((C) => [
1281
1285
  _(it, {
1282
1286
  row: C,
1283
- onRowClick: (U) => g(e)(U)
1287
+ onRowClick: (I) => y(e)(I)
1284
1288
  }, {
1285
- default: Y((U) => {
1286
- var M, Q, X, K, se, ce, fe, ge, ee, te, Z, pe, a, t, c, m, d, f, w, F;
1289
+ default: Y((I) => {
1290
+ var w, Z, X, K, se, ce, fe, ge, ee, te, J, pe, a, t, c, m, d, f, j, $;
1287
1291
  return [
1288
- o("div", ia, [
1289
- o("div", ua, [
1290
- o("div", da, [
1291
- _(g(he), {
1292
- render: (X = (Q = (M = U._id) == null ? void 0 : M.column) == null ? void 0 : Q.columnDef) == null ? void 0 : X.cell,
1293
- props: (se = (K = U._id) == null ? void 0 : K.getContext) == null ? void 0 : se.call(K)
1292
+ o("div", ca, [
1293
+ o("div", ia, [
1294
+ o("div", ua, [
1295
+ _(y(he), {
1296
+ render: (X = (Z = (w = I._id) == null ? void 0 : w.column) == null ? void 0 : Z.columnDef) == null ? void 0 : X.cell,
1297
+ props: (se = (K = I._id) == null ? void 0 : K.getContext) == null ? void 0 : se.call(K)
1294
1298
  }, null, 8, ["render", "props"])
1295
1299
  ]),
1296
- o("div", ma, [
1297
- _(g(he), {
1298
- render: (ge = (fe = (ce = U.name) == null ? void 0 : ce.column) == null ? void 0 : fe.columnDef) == null ? void 0 : ge.cell,
1299
- props: (te = (ee = U.name) == null ? void 0 : ee.getContext) == null ? void 0 : te.call(ee)
1300
+ o("div", da, [
1301
+ _(y(he), {
1302
+ render: (ge = (fe = (ce = I.name) == null ? void 0 : ce.column) == null ? void 0 : fe.columnDef) == null ? void 0 : ge.cell,
1303
+ props: (te = (ee = I.name) == null ? void 0 : ee.getContext) == null ? void 0 : te.call(ee)
1300
1304
  }, null, 8, ["render", "props"])
1301
1305
  ]),
1302
- o("div", fa, z([
1303
- ...C.original.items.slice(0, 3).map((j) => j.sku.name),
1306
+ o("div", ma, z([
1307
+ ...C.original.items.slice(0, 3).map((S) => S.sku.name),
1304
1308
  ...C.original.items.length >= 3 ? [`and ${C.original.items.length - 3} more items`] : []
1305
1309
  ].join(", ")), 1),
1306
- o("div", pa, [
1307
- _(g(he), {
1308
- render: (a = (pe = (Z = U.ref) == null ? void 0 : Z.column) == null ? void 0 : pe.columnDef) == null ? void 0 : a.cell,
1309
- props: (c = (t = U.ref) == null ? void 0 : t.getContext) == null ? void 0 : c.call(t)
1310
+ o("div", fa, [
1311
+ _(y(he), {
1312
+ render: (a = (pe = (J = I.ref) == null ? void 0 : J.column) == null ? void 0 : pe.columnDef) == null ? void 0 : a.cell,
1313
+ props: (c = (t = I.ref) == null ? void 0 : t.getContext) == null ? void 0 : c.call(t)
1310
1314
  }, null, 8, ["render", "props"])
1311
1315
  ])
1312
1316
  ]),
1313
1317
  o("div", null, [
1314
- _(g(he), {
1315
- render: (f = (d = (m = U.status) == null ? void 0 : m.column) == null ? void 0 : d.columnDef) == null ? void 0 : f.cell,
1316
- props: (F = (w = U.status) == null ? void 0 : w.getContext) == null ? void 0 : F.call(w)
1318
+ _(y(he), {
1319
+ render: (f = (d = (m = I.status) == null ? void 0 : m.column) == null ? void 0 : d.columnDef) == null ? void 0 : f.cell,
1320
+ props: ($ = (j = I.status) == null ? void 0 : j.getContext) == null ? void 0 : $.call(j)
1317
1321
  }, null, 8, ["render", "props"])
1318
1322
  ])
1319
1323
  ])
@@ -1328,11 +1332,11 @@ const St = He(
1328
1332
  ]),
1329
1333
  _: 1
1330
1334
  }, 8, ["title", "actions"]),
1331
- (x(), J(Ge, { to: "body" }, [
1332
- _(ca, We(g(i), {
1333
- show: g(u),
1334
- "onUpdate:show": B[2] || (B[2] = (C) => Te(u) ? u.value = C : null),
1335
- onSubmitted: B[3] || (B[3] = () => (u.value = !1, g(h).fetchDrafts()))
1335
+ (x(), Q(We, { to: "body" }, [
1336
+ _(la, qe(y(i), {
1337
+ show: y(u),
1338
+ "onUpdate:show": F[2] || (F[2] = (C) => Te(u) ? u.value = C : null),
1339
+ onSubmitted: F[3] || (F[3] = () => (u.value = !1, y(h).fetchDrafts()))
1336
1340
  }), null, 16, ["show"])
1337
1341
  ]))
1338
1342
  ], 64);
@@ -1340,5 +1344,5 @@ const St = He(
1340
1344
  }
1341
1345
  });
1342
1346
  export {
1343
- _a as default
1347
+ Aa as default
1344
1348
  };