@feedmepos/mf-inventory-portal 0.0.23-dev.10 → 0.0.23-dev.11

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 (52) hide show
  1. package/dist/{App-DDxwfi6I.js → App-CnnjA4H4.js} +3 -3
  2. package/dist/{ApprovalView-7rpIigm0.js → ApprovalView-Clai9UES.js} +4 -4
  3. package/dist/{BindingsDialog-DbyzX6mw.js → BindingsDialog-ECRq-a_Q.js} +2 -2
  4. package/dist/{BindingsPicker-FZfhZr5O.js → BindingsPicker-gJDidADv.js} +2 -2
  5. package/dist/{BindingsTable-Bk2770OV.js → BindingsTable-D6ioxeXz.js} +4 -4
  6. package/dist/{ClosingDraftView-D9CnCwak.js → ClosingDraftView-B8N64LZI.js} +221 -226
  7. package/dist/{ClosingTemplateView-DkpHmTtx.js → ClosingTemplateView-CaUeooGj.js} +10 -10
  8. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DjBiov5r.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-uft3uG9u.js} +4 -4
  9. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CBC214tP.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-rGlc83Tl.js} +2 -2
  10. package/dist/{FmMultiselectDialog-CK6xwOeG.js → FmMultiselectDialog-D2VZq_SC.js} +3 -3
  11. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-IFTMUhET.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BkSsILaj.js} +2 -2
  12. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-D0otwOX8.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DmCx7l0A.js} +1 -1
  13. package/dist/{IngredientGroupView-D5XtVfIQ.js → IngredientGroupView-DDcfDKEL.js} +5 -5
  14. package/dist/{IngredientsView-c7WnQiTv.js → IngredientsView-BJ0QLPGa.js} +9 -9
  15. package/dist/{IntegrationView-CHkhMxVM.js → IntegrationView-Db4c193L.js} +4 -4
  16. package/dist/{InventoryBindingForm-BUZ9MS5V.js → InventoryBindingForm-Ck6G43tJ.js} +1 -1
  17. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-YIRre_Km.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-BICjEfVj.js} +5 -5
  18. package/dist/{InventoryBindingSummary-BUi0mjeC.js → InventoryBindingSummary-C70T-6vl.js} +1 -1
  19. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CpYtHPFH.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-ySrpI9SA.js} +1 -1
  20. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-D8IH1X1o.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BJrDVd2w.js} +2 -2
  21. package/dist/{PurchaseOrderPrintPreview-BLuoVz5N.js → PurchaseOrderPrintPreview-AXrBcV0Q.js} +1 -1
  22. package/dist/{ReceiveRequestView-BNM5JdQO.js → ReceiveRequestView-DlDk6Gc6.js} +18 -18
  23. package/dist/{RecipeView-DxRumcLY.js → RecipeView-Bf1OwZbb.js} +7 -7
  24. package/dist/{StockView-CZyeg3sX.js → StockView-TLS7B8wJ.js} +13 -13
  25. package/dist/{SupplierView-C2XLbf27.js → SupplierView-CNE6MdFy.js} +10 -10
  26. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-BQG6UzUU.js → TransferDetails.vue_vue_type_script_setup_true_lang-B6QAj_vv.js} +9 -9
  27. package/dist/{TransferTemplateView-BCxZCU0i.js → TransferTemplateView-Bo1y3pa5.js} +13 -13
  28. package/dist/{UnitView-uGpE4txg.js → UnitView-DlIzZxZ5.js} +5 -5
  29. package/dist/{WarehouseView-DvQVmixr.js → WarehouseView-B99Jg6ew.js} +4 -4
  30. package/dist/{app-BaOENyRY.js → app-CwNOTQ4A.js} +11 -9
  31. package/dist/app.d.ts +2 -0
  32. package/dist/app.js +1 -1
  33. package/dist/{date2-CfGU3sHq.js → date2-Db1Subbn.js} +1 -1
  34. package/dist/{dayjs.min-BMk-E1IO.js → dayjs.min-D2ZVdp6D.js} +1 -1
  35. package/dist/{decimal-BkLhxOFS.js → decimal-8uiyGVkt.js} +1 -1
  36. package/dist/{defineDeepModel-Cy-_HBnw.js → defineDeepModel-CD4-KtSv.js} +1 -1
  37. package/dist/{feature-GoxrdjJJ.js → feature-DeKonYra.js} +1 -1
  38. package/dist/{format-time-from-id-96hwVl9P.js → format-time-from-id-CwBTG5Th.js} +1 -1
  39. package/dist/{format-unit-display-Cp0DBbM8.js → format-unit-display-CDvyarbC.js} +8 -8
  40. package/dist/{fuzzy-CBGiL1wK.js → fuzzy-BPC5Od1q.js} +1 -1
  41. package/dist/{index-CoL8wxbn.js → index-6eGmxJ_I.js} +1 -1
  42. package/dist/{index-S7yfliEo.js → index-COz_RG7T.js} +1 -1
  43. package/dist/{index-0HEhOwKT.js → index-DbWbhlG2.js} +1 -1
  44. package/dist/{netsuite-D3VPLW8O.js → netsuite-CdG4gf6-.js} +1 -1
  45. package/dist/{rules-DxLLla7a.js → rules-BnT0wI2r.js} +2 -2
  46. package/dist/{stock-BbFKtx1y.js → stock-1LWJVxgR.js} +2 -2
  47. package/dist/{supplier-gGovyyjr.js → supplier-BhENB1Iz.js} +1 -1
  48. package/dist/{use-inventory-binding-dialog-DIBMf_9-.js → use-inventory-binding-dialog-D3d0npyv.js} +2 -2
  49. package/dist/{use-template-enabled-locations-2-Bof9JMYI.js → use-template-enabled-locations-2-Cfm1wj38.js} +2 -2
  50. package/dist/{xlsx-DOnDmayp.js → xlsx-BaQ41UOe.js} +1 -1
  51. package/dist/{xlsx.util-BqsQd9YP.js → xlsx.util-DddmoQM4.js} +1 -1
  52. package/package.json +3 -3
@@ -1,34 +1,34 @@
1
- import { defineComponent as te, ref as z, resolveComponent as T, openBlock as R, createBlock as H, withCtx as K, createElementVNode as s, createTextVNode as ie, toDisplayString as Y, unref as c, createVNode as D, h as ce, computed as F, onMounted as xe, watch as ke, isRef as pe, createCommentVNode as ue, normalizeClass as ge, createElementBlock as O, Fragment as ve, renderList as Se, normalizeStyle as ye, Teleport as Be, mergeProps as Fe } from "vue";
2
- import { u as je, _ as $e, a as Re } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CBC214tP.js";
1
+ import { defineComponent as ee, ref as z, resolveComponent as P, openBlock as R, createBlock as O, withCtx as K, createElementVNode as r, createTextVNode as le, toDisplayString as H, unref as c, createVNode as b, h as ie, computed as F, onMounted as xe, watch as ke, isRef as pe, createCommentVNode as ce, normalizeClass as ge, createElementBlock as V, Fragment as ve, renderList as Se, normalizeStyle as ye, Teleport as Be, mergeProps as Fe } from "vue";
2
+ import { u as je, _ as $e, a as Re } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-rGlc83Tl.js";
3
3
  import { useI18n as be } from "@feedmepos/mf-common";
4
- import { useSnackbar as De, useDialog as Te, useProxiedModel as Pe, useBreakpoints as Me } from "@feedmepos/ui-library";
5
- import { k as ze, u as ae, p as M, s as he, q as J, c as Ue, r as Le, a as Ke } from "./app-BaOENyRY.js";
4
+ import { useSnackbar as De, useDialog as Pe, useProxiedModel as Te, useBreakpoints as Me } from "@feedmepos/ui-library";
5
+ import { k as ze, u as te, p as M, s as he, q as J, c as Ue, r as Le, a as Ke } from "./app-CwNOTQ4A.js";
6
6
  import { defineStore as _e, storeToRefs as Ne } from "pinia";
7
- import { R as Ee, a as B, l as Ie, m as Ve, b as de, k as Oe, c as me, t as He } from "./rules-DxLLla7a.js";
8
- import { D as ee, R as V } from "./row-action.enum-7rGLGZ5v.js";
7
+ import { R as Ee, a as B, l as Ie, m as Ve, b as ue, k as Oe, c as de, t as He } from "./rules-BnT0wI2r.js";
8
+ import { D as me, R as W } from "./row-action.enum-7rGLGZ5v.js";
9
9
  import { c as Ye, _ as qe, F as Z } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
10
- import { f as Ge } from "./format-time-from-id-96hwVl9P.js";
11
- import { d as N } from "./date2-CfGU3sHq.js";
12
- import { u as We } from "./stock-BbFKtx1y.js";
10
+ import { f as Ge } from "./format-time-from-id-CwBTG5Th.js";
11
+ import { d as N } from "./date2-Db1Subbn.js";
12
+ import { u as We } from "./stock-1LWJVxgR.js";
13
13
  const Ae = ze((C, e) => {
14
- function p() {
15
- return ae().currentLocation.dbName;
14
+ function m() {
15
+ return te().currentLocation.dbName;
16
16
  }
17
17
  return {
18
18
  async getDraft(d) {
19
- const i = p(), g = `${C.inventoryBackendUrl}/${i}/closing-draft/${d}`;
20
- return e.get(g);
19
+ const i = m(), p = `${C.inventoryBackendUrl}/${i}/closing-draft/${d}`;
20
+ return e.get(p);
21
21
  },
22
22
  async readDrafts() {
23
- const d = p(), i = `${C.inventoryBackendUrl}/${d}/closing-draft`;
23
+ const d = m(), i = `${C.inventoryBackendUrl}/${d}/closing-draft`;
24
24
  return e.get(i);
25
25
  },
26
26
  async runOperation(d) {
27
- const i = p(), g = `${C.inventoryBackendUrl}/${i}/closing-draft/run-operation`;
28
- return e.post(g, d);
27
+ const i = m(), p = `${C.inventoryBackendUrl}/${i}/closing-draft/run-operation`;
28
+ return e.post(p, d);
29
29
  }
30
30
  };
31
- }), Ze = { class: "fm-typo-en-body-lg-400" }, Je = { class: "fm-typo-en-body-lg-600" }, Qe = { class: "flex gap-12 py-8 justify-end w-full" }, fe = /* @__PURE__ */ te({
31
+ }), Ze = { class: "fm-typo-en-body-lg-400" }, Je = { class: "fm-typo-en-body-lg-600" }, Qe = { class: "flex gap-12 py-8 justify-end w-full" }, fe = /* @__PURE__ */ ee({
32
32
  __name: "ClosingDraftAction",
33
33
  props: {
34
34
  draft: {},
@@ -37,16 +37,16 @@ const Ae = ze((C, e) => {
37
37
  onFinished: { type: Function }
38
38
  },
39
39
  setup(C) {
40
- const e = C, p = z(), d = Ae(), i = De(), g = z(!1);
41
- async function b() {
42
- g.value = !0;
40
+ const e = C, m = z(), d = Ae(), i = De(), p = z(!1);
41
+ async function v() {
42
+ p.value = !0;
43
43
  try {
44
44
  await d.runOperation({
45
45
  _id: e.draft._id,
46
46
  _rev: e.draft._rev ?? "",
47
47
  action: e.action,
48
48
  data: {
49
- remark: p.value
49
+ remark: m.value
50
50
  }
51
51
  }).delayed(500), i.open({
52
52
  title: "Success",
@@ -60,40 +60,40 @@ const Ae = ze((C, e) => {
60
60
  type: "error"
61
61
  }), console.error("error on submit closing draft aciont", h);
62
62
  } finally {
63
- g.value = !1;
63
+ p.value = !1;
64
64
  }
65
65
  }
66
66
  return (h, u) => {
67
- const v = T("FmTextField"), j = T("FmButton"), n = T("FmForm");
68
- return R(), H(n, {
69
- onValidationSuccess: b,
67
+ const y = P("FmTextField"), j = P("FmButton"), o = P("FmForm");
68
+ return R(), O(o, {
69
+ onValidationSuccess: v,
70
70
  class: "flex flex-col gap-32",
71
- disabled: g.value
71
+ disabled: p.value
72
72
  }, {
73
73
  default: K(() => [
74
- s("div", Ze, [
75
- u[2] || (u[2] = ie(" You are about to ")),
76
- s("span", Je, Y(h.action == c(M).enum.approveDraft ? "approve" : "reject"), 1),
77
- u[3] || (u[3] = ie(" this draft. Please provider a remark to justify this action. "))
74
+ r("div", Ze, [
75
+ u[2] || (u[2] = le(" You are about to ")),
76
+ r("span", Je, H(h.action == c(M).enum.approveDraft ? "approve" : "reject"), 1),
77
+ u[3] || (u[3] = le(" this draft. Please provider a remark to justify this action. "))
78
78
  ]),
79
- D(v, {
80
- modelValue: p.value,
81
- "onUpdate:modelValue": u[0] || (u[0] = (l) => p.value = l),
79
+ b(y, {
80
+ modelValue: m.value,
81
+ "onUpdate:modelValue": u[0] || (u[0] = (l) => m.value = l),
82
82
  label: "Remark",
83
83
  "label-mark": "required",
84
84
  rules: [c(Ee)()]
85
85
  }, null, 8, ["modelValue", "rules"]),
86
- s("div", Qe, [
87
- D(j, {
86
+ r("div", Qe, [
87
+ b(j, {
88
88
  label: "Cancel",
89
89
  variant: "tertiary",
90
90
  onClick: u[1] || (u[1] = (l) => h.onCancel())
91
91
  }),
92
- D(j, {
92
+ b(j, {
93
93
  label: h.action == c(M).enum.approveDraft ? "Approve" : "Reject",
94
94
  type: "submit",
95
95
  variant: h.action == c(M).enum.approveDraft ? "primary" : "destructive",
96
- loading: g.value
96
+ loading: p.value
97
97
  }, null, 8, ["label", "variant", "loading"])
98
98
  ])
99
99
  ]),
@@ -104,16 +104,16 @@ const Ae = ze((C, e) => {
104
104
  }), Q = _e(
105
105
  "closingDraftActions",
106
106
  function() {
107
- const e = Te(), p = z(!1), d = z();
107
+ const e = Pe(), m = z(!1), d = z();
108
108
  function i(u) {
109
- const v = {
109
+ const y = {
110
110
  draft: u
111
111
  };
112
- d.value = v, p.value = !0;
112
+ d.value = y, m.value = !0;
113
113
  }
114
- function g(u) {
114
+ function p(u) {
115
115
  }
116
- function b(u, v) {
116
+ function v(u, y) {
117
117
  e.open({
118
118
  title: "Approve draft",
119
119
  contentComponent: fe,
@@ -121,13 +121,13 @@ const Ae = ze((C, e) => {
121
121
  draft: u,
122
122
  action: M.enum.approveDraft,
123
123
  onFinished: () => {
124
- e.close(), v == null || v();
124
+ e.close(), y == null || y();
125
125
  },
126
126
  onCancel: () => e.close()
127
127
  }
128
128
  });
129
129
  }
130
- function h(u, v) {
130
+ function h(u, y) {
131
131
  e.open({
132
132
  title: "Reject draft",
133
133
  contentComponent: fe,
@@ -135,7 +135,7 @@ const Ae = ze((C, e) => {
135
135
  draft: u,
136
136
  action: M.enum.rejectDraft,
137
137
  onFinished: () => {
138
- e.close(), v == null || v();
138
+ e.close(), y == null || y();
139
139
  },
140
140
  onCancel: () => e.close()
141
141
  }
@@ -143,10 +143,10 @@ const Ae = ze((C, e) => {
143
143
  }
144
144
  return {
145
145
  viewDraft: i,
146
- approveDraft: b,
146
+ approveDraft: v,
147
147
  rejectDraft: h,
148
- exportDraft: g,
149
- viewClosingDraftShow: p,
148
+ exportDraft: p,
149
+ viewClosingDraftShow: m,
150
150
  viewClosingDraftProps: d
151
151
  };
152
152
  }
@@ -164,26 +164,26 @@ function Ce(C) {
164
164
  }
165
165
  }
166
166
  const Xe = _e("closingTable", function() {
167
- const { t: e } = be(), p = Q(), d = z(new Array()), i = z(!1), g = ae(), b = Ae();
167
+ const { t: e } = be(), m = Q(), d = z(new Array()), i = z(!1), p = te(), v = Ae();
168
168
  async function h() {
169
- if (d.value = [], !!g._currentLocation) {
169
+ if (d.value = [], !!p._currentLocation) {
170
170
  i.value = !0;
171
171
  try {
172
- const [n] = await Promise.all([b.readDrafts()]).delayed(1e3);
173
- d.value = n.reverse();
174
- } catch (n) {
175
- console.log("Something went wrong when fetching drafts:", n);
172
+ const [o] = await Promise.all([v.readDrafts()]).delayed(1e3);
173
+ d.value = o.reverse();
174
+ } catch (o) {
175
+ console.log("Something went wrong when fetching drafts:", o);
176
176
  } finally {
177
177
  i.value = !1;
178
178
  }
179
179
  }
180
180
  }
181
- async function u(n) {
182
- if (!d.value.find((l) => l._id) && g._currentLocation) {
181
+ async function u(o) {
182
+ if (!d.value.find((l) => l._id) && p._currentLocation) {
183
183
  i.value = !0;
184
184
  try {
185
185
  const [l] = await Promise.all([
186
- b.getDraft(n),
186
+ v.getDraft(o),
187
187
  new Promise((_) => setTimeout(_, 1e3))
188
188
  ]);
189
189
  d.value = [l];
@@ -194,16 +194,16 @@ const Xe = _e("closingTable", function() {
194
194
  }
195
195
  }
196
196
  }
197
- function v(n, l) {
198
- switch (l = Ue(l), n) {
199
- case V.Details:
200
- return p.viewDraft(l);
201
- case V.Export:
202
- return p.exportDraft(l);
197
+ function y(o, l) {
198
+ switch (l = Ue(l), o) {
199
+ case W.Details:
200
+ return m.viewDraft(l);
201
+ case W.Export:
202
+ return m.exportDraft(l);
203
203
  case M.enum.approveDraft:
204
- return p.approveDraft(l);
204
+ return m.approveDraft(l);
205
205
  case M.enum.rejectDraft:
206
- return p.rejectDraft(l);
206
+ return m.rejectDraft(l);
207
207
  }
208
208
  }
209
209
  return {
@@ -212,14 +212,14 @@ const Xe = _e("closingTable", function() {
212
212
  id: "_id",
213
213
  accessorKey: "_id",
214
214
  header: () => e("inventory.closing.table.createdAt"),
215
- cell(n) {
216
- return Ge(`${n.getValue()}`);
215
+ cell(o) {
216
+ return Ge(`${o.getValue()}`);
217
217
  },
218
218
  enableSorting: !0
219
219
  },
220
220
  {
221
221
  id: "updatedAt",
222
- accessorFn: (n) => N(n.updatedAt),
222
+ accessorFn: (o) => N(o.updatedAt),
223
223
  header: () => "Updated at",
224
224
  enableSorting: !0,
225
225
  size: 200
@@ -243,25 +243,25 @@ const Xe = _e("closingTable", function() {
243
243
  },
244
244
  {
245
245
  id: "recentRemark",
246
- accessorFn: (n) => {
246
+ accessorFn: (o) => {
247
247
  var l;
248
- return (n == null ? void 0 : n.approveRemark) ?? ((l = n == null ? void 0 : n.rejectionHistory) == null ? void 0 : l.computeFirst((_) => _.rejectRemark));
248
+ return (o == null ? void 0 : o.approveRemark) ?? ((l = o == null ? void 0 : o.rejectionHistory) == null ? void 0 : l.computeFirst((_) => _.rejectRemark));
249
249
  },
250
250
  header: () => "Recent remark"
251
251
  },
252
252
  {
253
253
  id: "status",
254
- accessorFn: (n) => n.status,
254
+ accessorFn: (o) => o.status,
255
255
  header: () => e("inventory.closing.table.status"),
256
256
  enableSorting: !1,
257
- cell(n) {
258
- const _ = n.row.original.status;
259
- return ce(
257
+ cell(o) {
258
+ const _ = o.row.original.status;
259
+ return ie(
260
260
  "div",
261
261
  {
262
262
  class: "flex"
263
263
  },
264
- ce(
264
+ ie(
265
265
  "div",
266
266
  {
267
267
  class: ["fm-status-badge", Ce(_)]
@@ -273,12 +273,11 @@ const Xe = _e("closingTable", function() {
273
273
  },
274
274
  {
275
275
  id: "action",
276
- cell(n) {
277
- const l = n.row.original, _ = [
278
- ee[V.Edit],
279
- ee[V.Delete],
280
- ee[V.Export]
281
- ], q = [
276
+ cell(o) {
277
+ const l = o.row.original, _ = [
278
+ me[W.Details],
279
+ me[W.Export]
280
+ ], Y = [
282
281
  {
283
282
  translationKey: "inventory.closing.draft.approveDraft",
284
283
  color: "text-fm-color-typo-primary",
@@ -291,8 +290,8 @@ const Xe = _e("closingTable", function() {
291
290
  }
292
291
  ];
293
292
  return Ye(
294
- [..._, ...l.status === J.enum.DRAFT ? q : []],
295
- (E) => v(E, l)
293
+ [..._, ...l.status === J.enum.DRAFT ? Y : []],
294
+ (E) => y(E, l)
296
295
  );
297
296
  },
298
297
  enableSorting: !1,
@@ -314,17 +313,17 @@ const Xe = _e("closingTable", function() {
314
313
  }, it = { class: "flex items-center gap-8" }, ct = {
315
314
  key: 1,
316
315
  class: "overflow-x-auto"
317
- }, ut = { class: "flex gap-8" }, dt = /* @__PURE__ */ te({
316
+ }, ut = { class: "flex gap-8" }, dt = /* @__PURE__ */ ee({
318
317
  __name: "ClosingDraftDialog",
319
318
  props: {
320
319
  show: { type: Boolean },
321
320
  draft: {}
322
321
  },
323
322
  setup(C) {
324
- const e = C, p = We(), d = Q(), i = Pe(e, "show"), g = z(!1), b = z(new Array()), h = Le(), u = De(), v = Ke(), j = F(() => {
323
+ const e = C, m = We(), d = Q(), i = Te(e, "show"), p = z(!1), v = z(new Array()), h = Le(), u = De(), y = Ke(), j = F(() => {
325
324
  var a;
326
- const t = ((a = e.draft) == null ? void 0 : a.items.map((r) => r.sku)) ?? [];
327
- return t.sort((r, o) => r.code.localeCompare(o.code)), t;
325
+ const t = ((a = e.draft) == null ? void 0 : a.items.map((s) => s.sku)) ?? [];
326
+ return t.sort((s, n) => s.code.localeCompare(n.code)), t;
328
327
  });
329
328
  xe(_), ke(
330
329
  () => e.show,
@@ -332,58 +331,50 @@ const Xe = _e("closingTable", function() {
332
331
  t && _();
333
332
  }
334
333
  );
335
- const n = me(0), l = me(100);
334
+ const o = de(0), l = de(100);
336
335
  async function _() {
337
- var a, r, o;
338
- g.value = !0;
336
+ var a, s, n;
337
+ p.value = !0;
339
338
  const t = ((a = e.draft) == null ? void 0 : a.status) === J.enum.COMPLETED;
340
339
  try {
341
- if (await v.init(), t) {
342
- const m = e.draft.closingId;
343
- if (!m) {
340
+ if (await y.init(), t) {
341
+ const f = e.draft.closingId;
342
+ if (!f) {
344
343
  u.open({
345
344
  title: "Something went wrong",
346
345
  message: "Closing draft is completed but closing document cannot be found.",
347
346
  type: "error"
348
347
  }), console.error("Closing draft is completed but closing document cannot be found.", {
349
- draftId: (r = e.draft) == null ? void 0 : r._id
348
+ draftId: (s = e.draft) == null ? void 0 : s._id
350
349
  });
351
350
  return;
352
351
  }
353
- const f = await h.getClosingById(m);
354
- b.value = (f == null ? void 0 : f.skus) ?? [];
355
- } else {
356
- await p.readStockBalance();
357
- const m = (((o = p.stockBalance) == null ? void 0 : o.skus) ?? []).groupBy(
358
- (f) => f.id,
359
- (f) => f.balance
360
- );
361
- b.value = v.skus.map(
362
- (f) => m[f._id] ?? n
363
- );
364
- }
365
- } catch (m) {
352
+ const D = await h.getClosingById(f);
353
+ v.value = (D == null ? void 0 : D.skus) ?? [];
354
+ } else
355
+ await m.readStockBalance(), v.value = ((n = m.stockBalance) == null ? void 0 : n.skus) ?? [];
356
+ } catch (f) {
366
357
  u.open({
367
358
  title: "Something went wrong",
368
359
  message: "Something went wrong when fetching info. Please try again.",
369
360
  type: "error"
370
- }), console.error("error on fetch stock balances", m);
361
+ }), console.error("error on fetch stock balances", f);
371
362
  } finally {
372
- g.value = !1;
363
+ p.value = !1;
373
364
  }
374
365
  }
375
- const q = F(
376
- () => b.value.groupBy(
366
+ const Y = F(
367
+ () => v.value.groupBy(
377
368
  (t) => t.id,
378
369
  (t) => t.balance
379
370
  )
380
371
  ), E = F(() => {
381
372
  var a;
382
- return (((a = e.draft) == null ? void 0 : a.items) ?? []).groupBy((r) => r.sku._id);
373
+ return (((a = e.draft) == null ? void 0 : a.items) ?? []).groupBy((s) => s.sku._id);
383
374
  }), L = F(() => {
384
- const t = j.value.reduce((r, o) => Math.max(
385
- r,
386
- o.unit.measurements.filter((m) => !m.name.toLocaleLowerCase().includes("inactive")).length
375
+ const t = j.value.reduce((s, n) => Math.max(
376
+ s,
377
+ n.unit.measurements.filter((f) => !f.name.toLocaleLowerCase().includes("inactive")).length
387
378
  ), 0);
388
379
  return [
389
380
  {
@@ -410,22 +401,22 @@ const Xe = _e("closingTable", function() {
410
401
  header: () => "Base unit amount",
411
402
  size: 200
412
403
  },
413
- ...Array.from({ length: t }).flatMap((r, o) => {
414
- const m = `measurementAbbrev${o}`, f = `measurementAmount${o}`;
404
+ ...Array.from({ length: t }).flatMap((s, n) => {
405
+ const f = `measurementAbbrev${n}`, D = `measurementAmount${n}`;
415
406
  return [
416
407
  {
417
- id: f,
418
- accessorKey: f,
419
- header: () => `Sub unit amount ${o + 1}`,
408
+ id: D,
409
+ accessorKey: D,
410
+ header: () => `Sub unit amount ${n + 1}`,
420
411
  size: 200,
421
412
  meta: {
422
413
  textAlign: "right"
423
414
  }
424
415
  },
425
416
  {
426
- id: m,
427
- accessorKey: m,
428
- header: () => `Sub unit ${o + 1}`,
417
+ id: f,
418
+ accessorKey: f,
419
+ header: () => `Sub unit ${n + 1}`,
429
420
  size: 200
430
421
  }
431
422
  ];
@@ -462,6 +453,10 @@ const Xe = _e("closingTable", function() {
462
453
  accessorKey: "adjustedDiffPercentage",
463
454
  header: () => "Diff (%)",
464
455
  size: 200,
456
+ cell(s) {
457
+ var n;
458
+ return (n = s.row.original.adjustedDiffPercentage) == null ? void 0 : n.toFixed(2);
459
+ },
465
460
  meta: {
466
461
  textAlign: "right"
467
462
  }
@@ -469,52 +464,52 @@ const Xe = _e("closingTable", function() {
469
464
  ];
470
465
  }), $ = F(() => L.value.map((t) => t.size ?? 0).reduce((t, a) => t + a));
471
466
  function X(t) {
472
- const a = t.measurementsAmounts.groupBy((o) => o.measurement.id), r = t.sku.unit.measurements.reduce((o, m) => {
473
- var U, y;
474
- const f = ((y = (U = a.get(m.id)) == null ? void 0 : U[0]) == null ? void 0 : y.amount) ?? n, x = de(m.conversion, f);
475
- return o + +B(x);
467
+ const a = t.measurementsAmounts.groupBy((n) => n.measurement.id), s = t.sku.unit.measurements.reduce((n, f) => {
468
+ var U, g;
469
+ const D = ((g = (U = a.get(f.id)) == null ? void 0 : U[0]) == null ? void 0 : g.amount) ?? o, x = ue(f.conversion, D);
470
+ return n + +B(x);
476
471
  }, +B(t.baseAmount));
477
- return He(r, t.baseAmount.precision);
472
+ return He(s, t.baseAmount.precision);
478
473
  }
479
474
  const A = F(() => j.value.map((t) => {
480
- var y, S;
481
- const a = (y = E.value.get(t._id)) == null ? void 0 : y[0], r = ((S = q.value.get(t._id)) == null ? void 0 : S[0]) ?? n;
475
+ var g, S;
476
+ const a = (g = E.value.get(t._id)) == null ? void 0 : g[0], s = ((S = Y.value.get(t._id)) == null ? void 0 : S[0]) ?? o;
482
477
  if (!a)
483
478
  return {
484
479
  code: t.code,
485
480
  name: t.name,
486
481
  baseUnit: t.unit.abbrev,
487
482
  baseUnitAmount: 0,
488
- systemBalance: +B(r),
483
+ systemBalance: +B(s),
489
484
  physicalBalance: 0,
490
- adjustedBalance: -+B(r),
485
+ adjustedBalance: -+B(s),
491
486
  adjustedDiffPercentage: -100
492
487
  };
493
- const o = X(a), m = Ie(o, r), f = r.amount === 0 ? null : Ve(m, r), x = f ? de(f, l) : null;
488
+ const n = X(a), f = Ie(n, s), D = s.amount === 0 ? null : Ve(f, s), x = D ? ue(D, l) : null;
494
489
  return {
495
490
  code: t.code,
496
491
  name: t.name,
497
492
  baseUnit: t.unit.abbrev,
498
493
  baseUnitAmount: +B(a.baseAmount),
499
- ...a.measurementsAmounts.reduce((k, P, I) => (P.measurement.name.toLocaleLowerCase().includes("inactive") || (k[`measurementAbbrev${I}`] = `(${P.measurement.abbrev}) × ${B(P.measurement.conversion)}`, k[`measurementAmount${I}`] = +B(P.amount)), k), {}),
500
- systemBalance: +B(r),
501
- physicalBalance: +B(o),
502
- adjustedBalance: +B(m),
494
+ ...a.measurementsAmounts.reduce((k, T, I) => (T.measurement.name.toLocaleLowerCase().includes("inactive") || (k[`measurementAbbrev${I}`] = `(${T.measurement.abbrev}) × ${B(T.measurement.conversion)}`, k[`measurementAmount${I}`] = +B(T.amount)), k), {}),
495
+ systemBalance: +B(s),
496
+ physicalBalance: +B(n),
497
+ adjustedBalance: +B(f),
503
498
  adjustedDiffPercentage: x ? +B(Oe(x, 2)) : null
504
499
  };
505
500
  })), w = F(() => {
506
- var a, r;
501
+ var a, s;
507
502
  if (!e.draft) return [];
508
503
  const t = e.draft.approvedAt ? {
509
504
  action: `Approve at ${N(e.draft.approvedAt)}`,
510
505
  // actionAt: props.draft.approvedAt,
511
506
  actionBy: e.draft.approvedBy,
512
507
  remark: e.draft.approveRemark
513
- } : (a = e.draft.rejectionHistory) == null ? void 0 : a.computeFirst((o) => ({
514
- action: `Reject at ${N(o.rejectedAt)}`,
508
+ } : (a = e.draft.rejectionHistory) == null ? void 0 : a.computeFirst((n) => ({
509
+ action: `Reject at ${N(n.rejectedAt)}`,
515
510
  // actionAt: e.rejectedAt,
516
- actionBy: o.rejectedBy,
517
- remark: o.rejectRemark
511
+ actionBy: n.rejectedBy,
512
+ remark: n.rejectRemark
518
513
  }));
519
514
  return [
520
515
  {
@@ -543,39 +538,39 @@ const Xe = _e("closingTable", function() {
543
538
  } : null,
544
539
  t && t.actionBy ? {
545
540
  label: "Last action by",
546
- value: (r = t.actionBy) == null ? void 0 : r.name
541
+ value: (s = t.actionBy) == null ? void 0 : s.name
547
542
  } : null,
548
543
  t && t.remark ? {
549
544
  label: "Action remark",
550
545
  value: t.remark
551
546
  } : null
552
- ].filter((o) => o).map((o) => o);
547
+ ].filter((n) => n).map((n) => n);
553
548
  });
554
549
  return (t, a) => {
555
- const r = T("FmMenuDivider"), o = T("FmCard"), m = T("FmCircularProgress"), f = T("FmTable"), x = T("FmButton"), U = T("FmSideSheet");
556
- return R(), H(U, {
550
+ const s = P("FmMenuDivider"), n = P("FmCard"), f = P("FmCircularProgress"), D = P("FmTable"), x = P("FmButton"), U = P("FmSideSheet");
551
+ return R(), O(U, {
557
552
  "dismiss-away": "",
558
553
  "max-width": 900,
559
554
  "model-value": c(i),
560
- "onUpdate:modelValue": a[3] || (a[3] = (y) => pe(i) ? i.value = y : null),
555
+ "onUpdate:modelValue": a[3] || (a[3] = (g) => pe(i) ? i.value = g : null),
561
556
  header: "Closing details"
562
557
  }, {
563
558
  "side-sheet-footer": K(() => {
564
- var y, S;
559
+ var g, S;
565
560
  return [
566
- s("div", ut, [
567
- ((y = e.draft) == null ? void 0 : y.status) === c(J).enum.DRAFT ? (R(), H(x, {
561
+ r("div", ut, [
562
+ ((g = e.draft) == null ? void 0 : g.status) === c(J).enum.DRAFT ? (R(), O(x, {
568
563
  key: 0,
569
564
  label: "Approve",
570
565
  onClick: a[0] || (a[0] = () => e.draft && c(d).approveDraft(e.draft))
571
- })) : ue("", !0),
572
- ((S = e.draft) == null ? void 0 : S.status) === c(J).enum.DRAFT ? (R(), H(x, {
566
+ })) : ce("", !0),
567
+ ((S = e.draft) == null ? void 0 : S.status) === c(J).enum.DRAFT ? (R(), O(x, {
573
568
  key: 1,
574
569
  label: "Reject",
575
570
  variant: "destructive",
576
571
  onClick: a[1] || (a[1] = () => e.draft && c(d).rejectDraft(e.draft))
577
- })) : ue("", !0),
578
- D(x, {
572
+ })) : ce("", !0),
573
+ b(x, {
579
574
  label: "Close",
580
575
  variant: "tertiary",
581
576
  onClick: a[2] || (a[2] = (k) => i.value = !1)
@@ -584,54 +579,54 @@ const Xe = _e("closingTable", function() {
584
579
  ];
585
580
  }),
586
581
  default: K(() => [
587
- s("div", et, [
588
- D(o, {
582
+ r("div", et, [
583
+ b(n, {
589
584
  variant: "outlined",
590
585
  class: "flex flex-col gap-8 px-12 py-16"
591
586
  }, {
592
587
  default: K(() => {
593
- var y, S;
588
+ var g, S;
594
589
  return [
595
- s("div", tt, [
596
- a[4] || (a[4] = s("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
597
- s("div", null, [
598
- s("div", at, [
599
- s("div", {
600
- class: ge(c(Ce)(((y = t.draft) == null ? void 0 : y.status) ?? "DRAFT"))
601
- }, Y(c(he)(((S = t.draft) == null ? void 0 : S.status) ?? "")), 3)
590
+ r("div", tt, [
591
+ a[4] || (a[4] = r("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
592
+ r("div", null, [
593
+ r("div", at, [
594
+ r("div", {
595
+ class: ge(c(Ce)(((g = t.draft) == null ? void 0 : g.status) ?? "DRAFT"))
596
+ }, H(c(he)(((S = t.draft) == null ? void 0 : S.status) ?? "")), 3)
602
597
  ])
603
598
  ])
604
599
  ]),
605
- D(r),
606
- (R(!0), O(ve, null, Se(w.value, (k, P) => (R(), O("div", {
600
+ b(s),
601
+ (R(!0), V(ve, null, Se(w.value, (k, T) => (R(), V("div", {
607
602
  class: "flex flex-col gap-4",
608
- key: P
603
+ key: T
609
604
  }, [
610
- s("div", nt, [
611
- s("div", ot, Y(k.label), 1)
605
+ r("div", nt, [
606
+ r("div", ot, H(k.label), 1)
612
607
  ]),
613
- s("div", st, Y(k.value), 1)
608
+ r("div", st, H(k.value), 1)
614
609
  ]))), 128))
615
610
  ];
616
611
  }),
617
612
  _: 1
618
613
  }),
619
- s("div", rt, [
620
- a[8] || (a[8] = s("div", { class: "fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, "Closing items", -1)),
621
- g.value ? (R(), O("div", lt, [
622
- a[6] || (a[6] = s("div", { class: "h-80" }, null, -1)),
623
- s("div", it, [
624
- s("div", null, [
625
- D(m, { size: "md" })
614
+ r("div", rt, [
615
+ a[8] || (a[8] = r("div", { class: "fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, "Closing items", -1)),
616
+ p.value ? (R(), V("div", lt, [
617
+ a[6] || (a[6] = r("div", { class: "h-80" }, null, -1)),
618
+ r("div", it, [
619
+ r("div", null, [
620
+ b(f, { size: "md" })
626
621
  ]),
627
- a[5] || (a[5] = s("div", { class: "fm-typo-en-body-lg-600 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
622
+ a[5] || (a[5] = r("div", { class: "fm-typo-en-body-lg-600 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
628
623
  ]),
629
- a[7] || (a[7] = s("div", { class: "h-80" }, null, -1))
630
- ])) : (R(), O("div", ct, [
631
- s("div", {
624
+ a[7] || (a[7] = r("div", { class: "h-80" }, null, -1))
625
+ ])) : (R(), V("div", ct, [
626
+ r("div", {
632
627
  style: ye({ width: `${$.value}px` })
633
628
  }, [
634
- D(f, {
629
+ b(D, {
635
630
  "column-defs": L.value,
636
631
  "row-data": A.value
637
632
  }, null, 8, ["column-defs", "row-data"])
@@ -644,22 +639,22 @@ const Xe = _e("closingTable", function() {
644
639
  }, 8, ["model-value"]);
645
640
  };
646
641
  }
647
- }), mt = { class: "flex-1 flex flex-col gap-8" }, ft = { class: "flex flex-col" }, pt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, gt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, vt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, yt = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, jt = /* @__PURE__ */ te({
642
+ }), mt = { class: "flex-1 flex flex-col gap-8" }, ft = { class: "flex flex-col" }, pt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, gt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, vt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, yt = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, jt = /* @__PURE__ */ ee({
648
643
  __name: "ClosingDraftView",
649
644
  setup(C) {
650
- const { t: e } = be(), { viewDraft: p } = Q(), { viewClosingDraftProps: d, viewClosingDraftShow: i } = Ne(Q()), g = ae(), b = Xe(), h = je(), { breakpoints: u } = Me();
651
- g.watchLocation(b.fetchDrafts);
652
- const v = F(() => b.loading), j = z(""), n = F(() => u.value.xs || u.value.sm), l = F(() => n.value ? 10 : 20);
645
+ const { t: e } = be(), { viewDraft: m } = Q(), { viewClosingDraftProps: d, viewClosingDraftShow: i } = Ne(Q()), p = te(), v = Xe(), h = je(), { breakpoints: u } = Me();
646
+ p.watchLocation(v.fetchDrafts);
647
+ const y = F(() => v.loading), j = z(""), o = F(() => u.value.xs || u.value.sm), l = F(() => o.value ? 10 : 20);
653
648
  function _(L) {
654
649
  switch (L) {
655
650
  case "refresh":
656
- return b.fetchDrafts();
651
+ return v.fetchDrafts();
657
652
  }
658
653
  }
659
- function q(L) {
654
+ function Y(L) {
660
655
  return L;
661
656
  }
662
- const E = F(() => n.value ? [
657
+ const E = F(() => o.value ? [
663
658
  {
664
659
  label: "Refresh",
665
660
  value: "refresh",
@@ -673,75 +668,75 @@ const Xe = _e("closingTable", function() {
673
668
  }
674
669
  ]);
675
670
  return (L, $) => {
676
- const X = T("FmTable");
677
- return R(), O(ve, null, [
678
- D($e, {
671
+ const X = P("FmTable");
672
+ return R(), V(ve, null, [
673
+ b($e, {
679
674
  title: c(e)("inventory.closing.draft.title"),
680
675
  actions: E.value,
681
676
  "onClick:action": _
682
677
  }, {
683
678
  default: K(() => [
684
- s("div", {
679
+ r("div", {
685
680
  class: ge([
686
681
  "flex flex-col gap-8 max-h-full",
687
682
  {
688
- "p-0": n.value,
689
- "px-24 ": !n.value
683
+ "p-0": o.value,
684
+ "px-24 ": !o.value
690
685
  }
691
686
  ])
692
687
  }, [
693
- D(Re, {
688
+ b(Re, {
694
689
  "change-location": "",
695
690
  searchable: "",
696
691
  search: j.value,
697
692
  "onUpdate:search": $[0] || ($[0] = (A) => j.value = A)
698
693
  }, null, 8, ["search"]),
699
- D(X, {
694
+ b(X, {
700
695
  style: ye(c(h).tableHeight),
701
- "column-defs": c(b).columnDefs,
702
- "row-data": c(b).drafts,
696
+ "column-defs": c(v).columnDefs,
697
+ "row-data": c(v).drafts,
703
698
  "search-value": j.value,
704
- loading: v.value,
705
- onRowClick: $[1] || ($[1] = (A) => c(p)(A.original)),
699
+ loading: y.value,
700
+ onRowClick: $[1] || ($[1] = (A) => c(m)(A.original)),
706
701
  "page-size": l.value
707
702
  }, {
708
703
  "list-row": K((A) => [
709
- D(qe, {
704
+ b(qe, {
710
705
  row: A,
711
- onRowClick: (w) => c(p)(w)
706
+ onRowClick: (w) => c(m)(w)
712
707
  }, {
713
708
  default: K((w) => {
714
- var t, a, r, o, m, f, x, U, y, S, k, P, I, G, ne, oe, se, re, W, le;
709
+ var t, a, s, n, f, D, x, U, g, S, k, T, I, q, ae, ne, oe, se, G, re;
715
710
  return [
716
- s("div", mt, [
717
- s("div", ft, [
718
- s("div", pt, [
719
- D(c(Z), {
720
- render: (r = (a = (t = w._id) == null ? void 0 : t.column) == null ? void 0 : a.columnDef) == null ? void 0 : r.cell,
721
- props: (m = (o = w._id) == null ? void 0 : o.getContext) == null ? void 0 : m.call(o)
711
+ r("div", mt, [
712
+ r("div", ft, [
713
+ r("div", pt, [
714
+ b(c(Z), {
715
+ render: (s = (a = (t = w._id) == null ? void 0 : t.column) == null ? void 0 : a.columnDef) == null ? void 0 : s.cell,
716
+ props: (f = (n = w._id) == null ? void 0 : n.getContext) == null ? void 0 : f.call(n)
722
717
  }, null, 8, ["render", "props"])
723
718
  ]),
724
- s("div", gt, [
725
- D(c(Z), {
726
- render: (U = (x = (f = w.name) == null ? void 0 : f.column) == null ? void 0 : x.columnDef) == null ? void 0 : U.cell,
727
- props: (S = (y = w.name) == null ? void 0 : y.getContext) == null ? void 0 : S.call(y)
719
+ r("div", gt, [
720
+ b(c(Z), {
721
+ render: (U = (x = (D = w.name) == null ? void 0 : D.column) == null ? void 0 : x.columnDef) == null ? void 0 : U.cell,
722
+ props: (S = (g = w.name) == null ? void 0 : g.getContext) == null ? void 0 : S.call(g)
728
723
  }, null, 8, ["render", "props"])
729
724
  ]),
730
- s("div", vt, Y([
725
+ r("div", vt, H([
731
726
  ...A.original.items.slice(0, 3).map((we) => we.sku.name),
732
727
  ...A.original.items.length >= 3 ? [`and ${A.original.items.length - 3} more items`] : []
733
728
  ].join(", ")), 1),
734
- s("div", yt, [
735
- D(c(Z), {
736
- render: (I = (P = (k = w.ref) == null ? void 0 : k.column) == null ? void 0 : P.columnDef) == null ? void 0 : I.cell,
737
- props: (ne = (G = w.ref) == null ? void 0 : G.getContext) == null ? void 0 : ne.call(G)
729
+ r("div", yt, [
730
+ b(c(Z), {
731
+ render: (I = (T = (k = w.ref) == null ? void 0 : k.column) == null ? void 0 : T.columnDef) == null ? void 0 : I.cell,
732
+ props: (ae = (q = w.ref) == null ? void 0 : q.getContext) == null ? void 0 : ae.call(q)
738
733
  }, null, 8, ["render", "props"])
739
734
  ])
740
735
  ]),
741
- s("div", null, [
742
- D(c(Z), {
743
- render: (re = (se = (oe = w.status) == null ? void 0 : oe.column) == null ? void 0 : se.columnDef) == null ? void 0 : re.cell,
744
- props: (le = (W = w.status) == null ? void 0 : W.getContext) == null ? void 0 : le.call(W)
736
+ r("div", null, [
737
+ b(c(Z), {
738
+ render: (se = (oe = (ne = w.status) == null ? void 0 : ne.column) == null ? void 0 : oe.columnDef) == null ? void 0 : se.cell,
739
+ props: (re = (G = w.status) == null ? void 0 : G.getContext) == null ? void 0 : re.call(G)
745
740
  }, null, 8, ["render", "props"])
746
741
  ])
747
742
  ])
@@ -756,11 +751,11 @@ const Xe = _e("closingTable", function() {
756
751
  ]),
757
752
  _: 1
758
753
  }, 8, ["title", "actions"]),
759
- (R(), H(Be, { to: "body" }, [
760
- D(dt, Fe(c(d), {
754
+ (R(), O(Be, { to: "body" }, [
755
+ b(dt, Fe(c(d), {
761
756
  show: c(i),
762
757
  "onUpdate:show": $[2] || ($[2] = (A) => pe(i) ? i.value = A : null),
763
- onSubmitted: $[3] || ($[3] = (A) => c(b).fetchDrafts())
758
+ onSubmitted: $[3] || ($[3] = (A) => c(v).fetchDrafts())
764
759
  }), null, 16, ["show"])
765
760
  ]))
766
761
  ], 64);