@feedmepos/mf-inventory-portal 0.0.25-dev.51 → 0.0.25-dev.53

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-Bf7Ef5j4.js → App-CjqJghCI.js} +34 -34
  2. package/dist/{ApprovalView-CTKJY1vM.js → ApprovalView-C42xNBr9.js} +13 -13
  3. package/dist/{BindingsDialog-Cb7aRRNk.js → BindingsDialog-DfShaOTO.js} +2 -2
  4. package/dist/{BindingsPicker-DOI78hCt.js → BindingsPicker-BZmmKaqZ.js} +1 -1
  5. package/dist/{BindingsTable-CZE4g-lw.js → BindingsTable-Dzk1x-qi.js} +1 -1
  6. package/dist/{ClosingDraftView-ChjnuJSG.js → ClosingDraftView-DpP-cqpM.js} +153 -153
  7. package/dist/{ClosingTemplateView-gSQqeQ_q.js → ClosingTemplateView-DSo8B_Cq.js} +242 -242
  8. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BMFxe5xn.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-JsmwiIQG.js} +3 -3
  9. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-PmKyuRhO.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DhicQW8Q.js} +1 -1
  10. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-CnRG4x74.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-feCBwmiz.js} +1 -1
  11. package/dist/{IngredientGroupView-CaF4rmHy.js → IngredientGroupView-p1jRflBc.js} +1 -1
  12. package/dist/{IngredientsView-CX_MSjT3.js → IngredientsView-KrhaER9Y.js} +4 -4
  13. package/dist/{IntegrationView-BRkcILmI.js → IntegrationView-CFXpiR1g.js} +2 -2
  14. package/dist/{InventoryBindingForm-BK7OBXJt.js → InventoryBindingForm-CaeO-fpj.js} +1 -1
  15. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-D81eO5Mu.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CPgkL2CW.js} +3 -3
  16. package/dist/{InventoryBindingSummary-B3m-PoE-.js → InventoryBindingSummary-NLY5i6ql.js} +1 -1
  17. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DsTKgxFv.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BTJ4Omyi.js} +1 -1
  18. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-8Sa_WUWa.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CEroADf4.js} +1 -1
  19. package/dist/{PublishView-DZR7-XFd.js → PublishView-DFTo5S0F.js} +54 -54
  20. package/dist/{PurchaseOrderPrintPreview-BT5Khjs6.js → PurchaseOrderPrintPreview-7YBYHbP6.js} +1 -1
  21. package/dist/{ReceiveRequestView-3nhyFqXE.js → ReceiveRequestView-BG5s-oS9.js} +11 -11
  22. package/dist/{RecipeView-R-lqVFmh.js → RecipeView-kc50YRZk.js} +3 -3
  23. package/dist/{StockView-Did7vk97.js → StockView-XymZfzq8.js} +9 -9
  24. package/dist/{SupplierView-BGHR6LD2.js → SupplierView-B2vB9f9I.js} +7 -7
  25. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-vjDgXu5D.js → TransferDetails.vue_vue_type_script_setup_true_lang-CsQoRock.js} +5 -5
  26. package/dist/{TransferTemplateView-Dh1iZbPZ.js → TransferTemplateView-OD4SE6qf.js} +159 -159
  27. package/dist/{UnitView-DE9WIvA-.js → UnitView-Bb8gEtVh.js} +3 -3
  28. package/dist/{WarehouseView-CgurMkHh.js → WarehouseView-BeGII5M9.js} +1 -1
  29. package/dist/{app-BoT0hU4y.js → app-CvTTGb1Y.js} +11624 -10851
  30. package/dist/app.d.ts +845 -0
  31. package/dist/app.js +1 -1
  32. package/dist/{decimal-CpTYRDjJ.js → decimal-XcUTkVCR.js} +1 -1
  33. package/dist/{feature-CW1D96VL.js → feature-Bv1NYHN4.js} +415 -421
  34. package/dist/{format-unit-display-D6lsq-iX.js → format-unit-display-BsM7BR8x.js} +2 -2
  35. package/dist/{index-tTGOQaym.js → index-j3NNoa4K.js} +1 -1
  36. package/dist/{index-TqOHI1Dk.js → index-xfhlIOM0.js} +1 -1
  37. package/dist/{stock-Cnh2comB.js → stock-DgLOMQ1X.js} +1 -1
  38. package/dist/{supplier-BY8xacQQ.js → supplier-B0HyUoxP.js} +1 -1
  39. package/dist/tsconfig.app.tsbuildinfo +1 -1
  40. package/dist/{use-ingredient-select-dialog-BwbzsMlI.js → use-ingredient-select-dialog-D9arr1HY.js} +1 -1
  41. package/dist/{use-inventory-binding-dialog-3srettA-.js → use-inventory-binding-dialog-DGnSxKpE.js} +1 -1
  42. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +88 -0
  43. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +528 -0
  44. package/dist/{vue-i18n-C9tRTjjd.js → vue-i18n-BFNEEDAX.js} +397 -397
  45. package/package.json +2 -2
@@ -1,30 +1,30 @@
1
1
  import { defineComponent as ke, ref as V, resolveComponent as E, openBlock as x, createBlock as X, 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 q, createCommentVNode as ne, normalizeClass as me, renderList as ve, normalizeStyle as Re, Teleport as qe, mergeProps as We } from "vue";
2
- import { X as Ze, u as we, ak as W, l as Je, J as je, i as P, t as Xe, K as ye, q as Qe, r as et, s as tt, al as Me, am as Pe, a7 as Ie, an as le, ad as at, aj as oe, V as Ue, D as Fe, h as xe, f as nt, e as ot, a as st, z as rt, _ as lt, B as ct, C as it, E as he } from "./app-BoT0hU4y.js";
2
+ import { X as Ze, u as we, ak as W, l as Je, J as je, i as P, t as Xe, K as ye, q as Qe, r as et, s as tt, al as Me, am as Pe, a7 as Ie, an as le, ad as at, aj as oe, V as Ue, D as Fe, h as xe, f as nt, e as ot, a as st, z as rt, _ as lt, B as ct, C as it, E as he } from "./app-CvTTGb1Y.js";
3
3
  import { useCoreStore as ut, useI18n as Ee } from "@feedmepos/mf-common";
4
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 { a as Le, u as ze } from "./stock-Cnh2comB.js";
6
+ import { a as Le, u as ze } from "./stock-DgLOMQ1X.js";
7
7
  import { E as vt } from "./empty-placeholder-wf6-BWE8.js";
8
- const Se = Ze((n, r) => {
8
+ const Se = Ze((n, s) => {
9
9
  function e() {
10
10
  return we().currentLocation.dbName;
11
11
  }
12
12
  return {
13
- async getDraft(i) {
14
- const u = e(), g = `${n.inventoryBackendUrl}/${u}/closing-draft/${i}`;
15
- return r.get(g);
13
+ async getDraft(d) {
14
+ const i = e(), g = `${n.inventoryBackendUrl}/${i}/closing-draft/${d}`;
15
+ return s.get(g);
16
16
  },
17
17
  async readDrafts() {
18
- const i = e(), u = `${n.inventoryBackendUrl}/${i}/closing-draft`;
19
- return r.get(u);
18
+ const d = e(), i = `${n.inventoryBackendUrl}/${d}/closing-draft`;
19
+ return s.get(i);
20
20
  },
21
- async runOperation(i) {
22
- const u = e(), g = `${n.inventoryBackendUrl}/${u}/closing-draft/run-operation`;
23
- return r.post(g, i);
21
+ async runOperation(d) {
22
+ const i = e(), g = `${n.inventoryBackendUrl}/${i}/closing-draft/run-operation`;
23
+ return s.post(g, d);
24
24
  },
25
- async sync(i) {
26
- const u = e(), g = `${n.inventoryBackendUrl}/${u}/closing-draft/sync`;
27
- return r.post(g, i);
25
+ async sync(d) {
26
+ const i = e(), g = `${n.inventoryBackendUrl}/${i}/closing-draft/sync`;
27
+ return s.post(g, d);
28
28
  }
29
29
  };
30
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({
@@ -36,24 +36,24 @@ const Se = Ze((n, r) => {
36
36
  onFinished: { type: Function }
37
37
  },
38
38
  setup(n) {
39
- const r = n, e = V(), i = Se(), u = Ce(), g = V(!1);
39
+ const s = n, e = V(), d = Se(), i = Ce(), g = V(!1);
40
40
  async function h() {
41
41
  g.value = !0;
42
42
  try {
43
- await i.runOperation({
44
- _id: r.draft._id,
45
- _rev: r.draft._rev ?? "",
46
- action: r.action,
43
+ await d.runOperation({
44
+ _id: s.draft._id,
45
+ _rev: s.draft._rev ?? "",
46
+ action: s.action,
47
47
  data: {
48
48
  remark: e.value
49
49
  }
50
- }).delayed(500), u.open({
50
+ }).delayed(500), i.open({
51
51
  title: "Success",
52
52
  message: "Action submitted",
53
53
  type: "success"
54
- }), r.onFinished();
54
+ }), s.onFinished();
55
55
  } catch (D) {
56
- u.open({
56
+ i.open({
57
57
  title: "Something went wrong",
58
58
  message: "Unable to submit actino. Please try again",
59
59
  type: "error"
@@ -77,7 +77,7 @@ const Se = Ze((n, r) => {
77
77
  ]),
78
78
  _(R, {
79
79
  modelValue: e.value,
80
- "onUpdate:modelValue": l[0] || (l[0] = (s) => e.value = s),
80
+ "onUpdate:modelValue": l[0] || (l[0] = (r) => e.value = r),
81
81
  label: "Remark",
82
82
  "label-mark": "required",
83
83
  rules: [y(Je)()]
@@ -86,7 +86,7 @@ const Se = Ze((n, r) => {
86
86
  _(M, {
87
87
  label: "Cancel",
88
88
  variant: "tertiary",
89
- onClick: l[1] || (l[1] = (s) => D.onCancel())
89
+ onClick: l[1] || (l[1] = (r) => D.onCancel())
90
90
  }),
91
91
  _(M, {
92
92
  label: D.action == y(W).enum.approveDraft ? "Approve" : "Reject",
@@ -102,18 +102,18 @@ const Se = Ze((n, r) => {
102
102
  }
103
103
  }), xt = ye(0);
104
104
  function Ne(n) {
105
- const r = n.measurementsAmounts.groupBy((i) => i.measurement.id), e = n.sku.unit.measurements.reduce((i, u) => {
105
+ const s = n.measurementsAmounts.groupBy((d) => d.measurement.id), e = n.sku.unit.measurements.reduce((d, i) => {
106
106
  var D, l;
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
- return i + +P(h);
107
+ const g = ((l = (D = s.get(i.id)) == null ? void 0 : D[0]) == null ? void 0 : l.amount) ?? xt, h = je(i.conversion, g);
108
+ return d + +P(h);
109
109
  }, +P(n.baseAmount));
110
110
  return Xe(e, n.baseAmount.precision);
111
111
  }
112
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
- ...r,
116
- amount: Math.abs(r.amount)
113
+ function _t(n, s, e) {
114
+ const d = Ne(n), i = Me(d, s), g = s.amount === 0 ? null : Pe(i, {
115
+ ...s,
116
+ amount: Math.abs(s.amount)
117
117
  }), h = g ? je(g, At) : null;
118
118
  return {
119
119
  code: n.sku.code,
@@ -126,9 +126,9 @@ function _t(n, r, e) {
126
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
- systemBalance: +P(r),
130
- physicalBalance: +P(i),
131
- adjustedAmount: +P(u),
129
+ systemBalance: +P(s),
130
+ physicalBalance: +P(d),
131
+ adjustedAmount: +P(i),
132
132
  adjustedDiffPercentage: h ? +P(Ie(h, 2)) : null
133
133
  };
134
134
  }
@@ -136,19 +136,19 @@ function Dt(n) {
136
136
  return !n.abbrev.toLocaleLowerCase().includes("inactive");
137
137
  }
138
138
  function kt(n) {
139
- const r = Oe(n);
139
+ const s = Oe(n);
140
140
  return n.reduce(
141
- (e, i) => {
142
- var u;
143
- return Math.max(e, ((u = r == null ? void 0 : r.get(i.sku._id)) == null ? void 0 : u[0].length) ?? 0);
141
+ (e, d) => {
142
+ var i;
143
+ return Math.max(e, ((i = s == null ? void 0 : s.get(d.sku._id)) == null ? void 0 : i[0].length) ?? 0);
144
144
  },
145
145
  0
146
146
  );
147
147
  }
148
148
  function Oe(n) {
149
149
  return n.groupBy(
150
- (r) => r.sku._id,
151
- (r) => r.measurementsAmounts.filter((e) => !e.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((e) => e.measurement.id)
150
+ (s) => s.sku._id,
151
+ (s) => s.measurementsAmounts.filter((e) => !e.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((e) => e.measurement.id)
152
152
  );
153
153
  }
154
154
  function wt(n) {
@@ -185,28 +185,28 @@ function wt(n) {
185
185
  id: "baseUnit",
186
186
  name: "Base unit"
187
187
  },
188
- ...Array.from({ length: n }).flatMap((e, i) => [
188
+ ...Array.from({ length: n }).flatMap((e, d) => [
189
189
  {
190
- id: `measurementAmount${i}`,
191
- name: `UOM amount ${i + 1}`
190
+ id: `measurementAmount${d}`,
191
+ name: `UOM amount ${d + 1}`
192
192
  },
193
193
  {
194
- id: `measurementAbbrev${i}`,
195
- name: `UOM ${i + 1}`
194
+ id: `measurementAbbrev${d}`,
195
+ name: `UOM ${d + 1}`
196
196
  }
197
197
  ])
198
198
  ];
199
199
  }
200
- function jt(n, r) {
200
+ function jt(n, s) {
201
201
  var B, b, v, F, N, C, I;
202
- const e = r.groupBy(
202
+ const e = s.groupBy(
203
203
  (w) => w.id,
204
204
  (w) => w.balance
205
- ), i = [...n.items, ...n.negativeStockItems ?? []], u = Oe(i), g = i.map((w) => {
205
+ ), d = [...n.items, ...n.negativeStockItems ?? []], i = Oe(d), g = d.map((w) => {
206
206
  var K, se;
207
- const Z = ((K = e.get(w.sku._id)) == null ? void 0 : K[0]) ?? ht, Q = ((se = u == null ? void 0 : u.get(w.sku._id)) == null ? void 0 : se[0]) ?? [];
207
+ const Z = ((K = e.get(w.sku._id)) == null ? void 0 : K[0]) ?? ht, Q = ((se = i == null ? void 0 : i.get(w.sku._id)) == null ? void 0 : se[0]) ?? [];
208
208
  return _t(w, Z, Q);
209
- }), h = kt(i), l = ut().currentBusiness.value, R = wt(h), M = [
209
+ }), h = kt(d), 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],
@@ -230,13 +230,13 @@ function jt(n, r) {
230
230
  [],
231
231
  R.map((w) => w.name),
232
232
  ...g.map((w) => R.map((Z) => w[Z.id]))
233
- ], U = R.map((w) => `system:${w.id}`), s = Qe(M, U), p = `[${l == null ? void 0 : l.name}] closing draft (${et(new Date(n.updatedAt))}).xlsx`;
234
- return tt(s, p), p;
233
+ ], U = R.map((w) => `system:${w.id}`), r = Qe(M, U), p = `[${l == null ? void 0 : l.name}] closing draft (${et(new Date(n.updatedAt))}).xlsx`;
234
+ return tt(r, p), p;
235
235
  }
236
236
  const _e = He(
237
237
  "closingDraftActions",
238
238
  function() {
239
- const r = dt(), e = Ce(), i = Le(), u = Se(), g = ze(), h = V(!1), D = V();
239
+ const s = dt(), e = Ce(), d = Le(), i = Se(), g = ze(), h = V(!1), D = V();
240
240
  function l(b) {
241
241
  const v = {
242
242
  draft: b
@@ -255,7 +255,7 @@ const _e = He(
255
255
  }), console.error("Closing draft is completed but closing document cannot be found.", {
256
256
  draftId: b._id
257
257
  }), [];
258
- const C = await i.readAdjustmentById(N);
258
+ const C = await d.readAdjustmentById(N);
259
259
  return ((C == null ? void 0 : C.skus) ?? []).map((w) => ({
260
260
  id: w.sku._id,
261
261
  balance: w.fromBalance,
@@ -271,35 +271,35 @@ const _e = He(
271
271
  }), v = await R(b)), jt(b, v);
272
272
  }
273
273
  function U(b, v) {
274
- r.open({
274
+ s.open({
275
275
  title: "Approve draft",
276
276
  contentComponent: $e,
277
277
  contentComponentProps: {
278
278
  draft: b,
279
279
  action: W.enum.approveDraft,
280
280
  onFinished: () => {
281
- r.close(), v == null || v();
281
+ s.close(), v == null || v();
282
282
  },
283
- onCancel: () => r.close()
283
+ onCancel: () => s.close()
284
284
  }
285
285
  });
286
286
  }
287
- function s(b, v) {
288
- r.open({
287
+ function r(b, v) {
288
+ s.open({
289
289
  title: "Reject draft",
290
290
  contentComponent: $e,
291
291
  contentComponentProps: {
292
292
  draft: b,
293
293
  action: W.enum.rejectDraft,
294
294
  onFinished: () => {
295
- r.close(), v == null || v();
295
+ s.close(), v == null || v();
296
296
  },
297
- onCancel: () => r.close()
297
+ onCancel: () => s.close()
298
298
  }
299
299
  });
300
300
  }
301
301
  async function p(b, v) {
302
- await u.sync({
302
+ await i.sync({
303
303
  _id: b._id,
304
304
  _rev: b._rev ?? "",
305
305
  action: W.enum.approveDraft,
@@ -319,7 +319,7 @@ const _e = He(
319
319
  viewDraft: l,
320
320
  closeDraftDialog: B,
321
321
  approveDraft: U,
322
- rejectDraft: s,
322
+ rejectDraft: r,
323
323
  syncDraft: p,
324
324
  exportDraft: M,
325
325
  viewClosingDraftShow: h,
@@ -342,41 +342,41 @@ function Ae(n) {
342
342
  const Ct = He(
343
343
  "closingDraftTable",
344
344
  function() {
345
- const { t: r } = Ee(), e = _e(), i = V(new Array()), u = V(!1), g = we(), h = Se();
345
+ const { t: s } = Ee(), e = _e(), d = V(new Array()), i = V(!1), g = we(), h = Se();
346
346
  async function D() {
347
- if (i.value = [], !!g._currentLocation) {
348
- u.value = !0;
347
+ if (d.value = [], !!g._currentLocation) {
348
+ i.value = !0;
349
349
  try {
350
- const [s] = await Promise.all([h.readDrafts()]).delayed(1e3);
351
- i.value = s.reverse();
352
- } catch (s) {
353
- console.log("Something went wrong when fetching drafts:", s);
350
+ const [r] = await Promise.all([h.readDrafts()]).delayed(1e3);
351
+ d.value = r.reverse();
352
+ } catch (r) {
353
+ console.log("Something went wrong when fetching drafts:", r);
354
354
  } finally {
355
- u.value = !1;
355
+ i.value = !1;
356
356
  }
357
357
  }
358
358
  }
359
- async function l(s) {
360
- if (!i.value.find((p) => p._id) && g._currentLocation) {
361
- u.value = !0;
359
+ async function l(r) {
360
+ if (!d.value.find((p) => p._id) && g._currentLocation) {
361
+ i.value = !0;
362
362
  try {
363
363
  const [p] = await Promise.all([
364
- h.getDraft(s),
364
+ h.getDraft(r),
365
365
  new Promise((B) => setTimeout(B, 1e3))
366
366
  ]);
367
- i.value = [p];
367
+ d.value = [p];
368
368
  } catch (p) {
369
369
  console.log("Something went wrong when fetching drafts:", p);
370
370
  } finally {
371
- u.value = !1;
371
+ i.value = !1;
372
372
  }
373
373
  }
374
374
  }
375
375
  function R() {
376
376
  e.closeDraftDialog(), D();
377
377
  }
378
- function M(s, p) {
379
- switch (p = ot(p), s) {
378
+ function M(r, p) {
379
+ switch (p = ot(p), r) {
380
380
  case xe.Details:
381
381
  return e.viewDraft(p);
382
382
  case xe.Export:
@@ -392,15 +392,15 @@ const Ct = He(
392
392
  {
393
393
  id: "_id",
394
394
  accessorKey: "_id",
395
- header: () => r("inventory.closing.table.createdAt"),
396
- cell(s) {
397
- return at(`${s.getValue()}`);
395
+ header: () => s("inventory.closing.table.createdAt"),
396
+ cell(r) {
397
+ return at(`${r.getValue()}`);
398
398
  },
399
399
  enableSorting: !0
400
400
  },
401
401
  {
402
402
  id: "updatedAt",
403
- accessorFn: (s) => oe(s.updatedAt),
403
+ accessorFn: (r) => oe(r.updatedAt),
404
404
  header: () => "Updated at",
405
405
  enableSorting: !0,
406
406
  size: 200
@@ -414,11 +414,11 @@ const Ct = He(
414
414
  },
415
415
  {
416
416
  id: "noOfItems",
417
- accessorFn: (s) => {
417
+ accessorFn: (r) => {
418
418
  var p;
419
- return s.items.length + (((p = s.negativeStockItems) == null ? void 0 : p.length) ?? 0);
419
+ return r.items.length + (((p = r.negativeStockItems) == null ? void 0 : p.length) ?? 0);
420
420
  },
421
- header: () => r("inventory.closing.table.noOfItems"),
421
+ header: () => s("inventory.closing.table.noOfItems"),
422
422
  enableSorting: !1,
423
423
  meta: {
424
424
  width: "10rem",
@@ -427,20 +427,20 @@ const Ct = He(
427
427
  },
428
428
  {
429
429
  id: "recentRemark",
430
- accessorFn: (s) => {
430
+ accessorFn: (r) => {
431
431
  var p;
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;
432
+ return (r == null ? void 0 : r.approveRemark) ?? ((p = r == null ? void 0 : r.rejectionHistory) == null ? void 0 : p.computeFirst((B) => B.rejectRemark)) ?? r.remark;
433
433
  },
434
434
  header: () => "Recent remark"
435
435
  },
436
436
  {
437
437
  id: "status",
438
- accessorFn: (s) => s.status,
439
- header: () => r("inventory.closing.table.status"),
438
+ accessorFn: (r) => r.status,
439
+ header: () => s("inventory.closing.table.status"),
440
440
  enableSorting: !1,
441
- cell(s) {
441
+ cell(r) {
442
442
  var N;
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;
443
+ const p = r.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
444
  return B === "DRAFT" && F ? F.getTime() > b.getTime() ? k(
445
445
  "div",
446
446
  {
@@ -482,8 +482,8 @@ const Ct = He(
482
482
  },
483
483
  {
484
484
  id: "action",
485
- cell(s) {
486
- const p = s.row.original, B = [
485
+ cell(r) {
486
+ const p = r.row.original, B = [
487
487
  Fe[xe.Details],
488
488
  Fe[xe.Export]
489
489
  ], b = [
@@ -514,8 +514,8 @@ const Ct = He(
514
514
  }
515
515
  }
516
516
  ],
517
- drafts: i,
518
- loading: u,
517
+ drafts: d,
518
+ loading: i,
519
519
  fetchDrafts: D,
520
520
  loadDraft: l
521
521
  };
@@ -554,13 +554,13 @@ const Ct = He(
554
554
  draft: {}
555
555
  },
556
556
  emits: ["submitted"],
557
- setup(n, { emit: r }) {
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(
557
+ setup(n, { emit: s }) {
558
+ const e = n, d = ze(), i = _e(), g = mt(e, "show"), h = V(!1), D = V(!1), l = V(new Array()), R = Le(), M = Ce(), U = st(), r = Ye({}), p = H(() => new Set(
559
559
  U.skus.filter((a) => {
560
560
  var t;
561
- return s[(t = a.customAttributes) == null ? void 0 : t.tag];
561
+ return r[(t = a.customAttributes) == null ? void 0 : t.tag];
562
562
  }).map((a) => a._id)
563
- )), B = r, b = H(() => {
563
+ )), B = s, b = H(() => {
564
564
  var t, c;
565
565
  const a = [...((t = e.draft) == null ? void 0 : t.items) ?? [], ...((c = e.draft) == null ? void 0 : c.negativeStockItems) ?? []];
566
566
  return p.value.size ? a.filter((m) => p.value.has(m.sku._id)) : a;
@@ -584,8 +584,8 @@ const Ct = He(
584
584
  const a = ((t = e.draft) == null ? void 0 : t.status) === le.enum.COMPLETED;
585
585
  try {
586
586
  if (await U.init(), a) {
587
- const d = e.draft.closingAdjustmentId;
588
- if (!d) {
587
+ const u = e.draft.closingAdjustmentId;
588
+ if (!u) {
589
589
  M.open({
590
590
  title: "Something went wrong",
591
591
  message: "Closing draft is completed but closing document cannot be found.",
@@ -595,20 +595,20 @@ const Ct = He(
595
595
  });
596
596
  return;
597
597
  }
598
- const f = await R.readAdjustmentById(d), j = (f == null ? void 0 : f.skus) ?? [];
598
+ const f = await R.readAdjustmentById(u), j = (f == null ? void 0 : f.skus) ?? [];
599
599
  l.value = j.map(($) => ({
600
600
  id: $.sku._id,
601
601
  balance: $.fromBalance,
602
602
  costs: $.fromCostBalances
603
603
  }));
604
604
  } else
605
- await i.readStockBalance(), l.value = ((m = i.stockBalance) == null ? void 0 : m.skus) ?? [];
606
- } catch (d) {
605
+ l.value = ((m = e.draft) == null ? void 0 : m.stockSnapshot) ?? [];
606
+ } catch (u) {
607
607
  M.open({
608
608
  title: "Something went wrong",
609
609
  message: "Something went wrong when fetching info. Please try again.",
610
610
  type: "error"
611
- }), console.error("error on fetch stock balances", d);
611
+ }), console.error("error on fetch stock balances", u);
612
612
  } finally {
613
613
  h.value = !1;
614
614
  }
@@ -635,8 +635,8 @@ const Ct = He(
635
635
  }
636
636
  const K = H(() => {
637
637
  const a = v.value.reduce((c, m) => {
638
- var d, f;
639
- return Math.max(c, ((f = (d = F.value) == null ? void 0 : d.get(m._id)) == null ? void 0 : f[0].length) ?? 0);
638
+ var u, f;
639
+ return Math.max(c, ((f = (u = F.value) == null ? void 0 : u.get(m._id)) == null ? void 0 : f[0].length) ?? 0);
640
640
  }, 0);
641
641
  return [
642
642
  {
@@ -645,7 +645,7 @@ const Ct = He(
645
645
  header: () => "Name",
646
646
  size: 350,
647
647
  cell(c) {
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" }, [
648
+ const m = c.row.original, u = m.adjustedDiffPercentage, f = typeof u == "number" && Math.abs(u) > 10, j = k("div", { class: "flex flex-col gap-4" }, [
649
649
  k(
650
650
  "div",
651
651
  {
@@ -739,8 +739,8 @@ const Ct = He(
739
739
  cell(c) {
740
740
  const m = c.row.original.adjustedDiffPercentage;
741
741
  if (!m) return "N/A";
742
- const d = m.toFixed(2);
743
- if (d === "0.00")
742
+ const u = m.toFixed(2);
743
+ if (u === "0.00")
744
744
  return k("div", { class: "flex items-center gap-4 justify-end" }, ["0.00"]);
745
745
  const f = m > 0;
746
746
  return k("div", { class: "flex items-center gap-4 justify-end" }, [
@@ -749,7 +749,7 @@ const Ct = He(
749
749
  color: f ? "system-success-300" : "system-error-300",
750
750
  size: "md"
751
751
  }),
752
- d
752
+ u
753
753
  ]);
754
754
  },
755
755
  meta: {
@@ -761,7 +761,7 @@ const Ct = He(
761
761
  header: () => "Amounts",
762
762
  enableSorting: !1,
763
763
  cell(c) {
764
- const m = c.row.original, d = (j, $) => k(
764
+ const m = c.row.original, u = (j, $) => k(
765
765
  de.FmTooltip,
766
766
  { zIndex: 50 },
767
767
  {
@@ -793,9 +793,9 @@ const Ct = He(
793
793
  if (!m[`measurementAmount${$}`])
794
794
  return null;
795
795
  const S = m[`measurementAmount${$}`], ie = m[`measurementAbbrev${$}`];
796
- return d(S, ie);
796
+ return u(S, ie);
797
797
  }).filter((j) => j);
798
- return (m.baseUnitAmount || !f.length) && (f = [d(m.baseUnitAmount, m.baseUnit), ...f]), k(
798
+ return (m.baseUnitAmount || !f.length) && (f = [u(m.baseUnitAmount, m.baseUnit), ...f]), k(
799
799
  "div",
800
800
  {
801
801
  class: "flex gap-8 flex-nowrap",
@@ -822,7 +822,7 @@ const Ct = He(
822
822
  adjustedAmount: -+P(c),
823
823
  adjustedDiffPercentage: -100
824
824
  };
825
- const m = Ne(t), d = Me(m, c), f = c.amount === 0 ? null : Pe(d, {
825
+ const m = Ne(t), u = Me(m, c), f = c.amount === 0 ? null : Pe(u, {
826
826
  ...c,
827
827
  amount: Math.abs(c.amount)
828
828
  }), j = f ? je(f, C) : null;
@@ -837,7 +837,7 @@ const Ct = He(
837
837
  }).reduce((ae, G, re) => (ae[`measurementAbbrev${re}`] = `(${G.measurement.abbrev}) × ${P(G.measurement.conversion)}`, ae[`measurementAmount${re}`] = +P(G.amount), ae), {}),
838
838
  systemBalance: +P(c),
839
839
  physicalBalance: +P(m),
840
- adjustedAmount: +P(d),
840
+ adjustedAmount: +P(u),
841
841
  adjustedDiffPercentage: j ? +P(Ie(j, 2)) : null
842
842
  };
843
843
  })), ge = H(() => {
@@ -848,11 +848,11 @@ const Ct = He(
848
848
  // actionAt: props.draft.approvedAt,
849
849
  actionBy: e.draft.approvedBy,
850
850
  remark: e.draft.approveRemark
851
- } : (t = e.draft.rejectionHistory) == null ? void 0 : t.computeFirst((d) => ({
852
- action: `Reject at ${oe(d.rejectedAt)}`,
851
+ } : (t = e.draft.rejectionHistory) == null ? void 0 : t.computeFirst((u) => ({
852
+ action: `Reject at ${oe(u.rejectedAt)}`,
853
853
  // actionAt: e.rejectedAt,
854
- actionBy: d.rejectedBy,
855
- remark: d.rejectRemark
854
+ actionBy: u.rejectedBy,
855
+ remark: u.rejectRemark
856
856
  }));
857
857
  return [
858
858
  {
@@ -877,7 +877,7 @@ const Ct = He(
877
877
  },
878
878
  {
879
879
  label: "Using template",
880
- value: ((c = e.draft.usingTemplates.find((d) => d)) == null ? void 0 : c.name) ?? "None"
880
+ value: ((c = e.draft.usingTemplates.find((u) => u)) == null ? void 0 : c.name) ?? "None"
881
881
  },
882
882
  e.draft.remark ? {
883
883
  label: "Remark",
@@ -895,7 +895,7 @@ const Ct = He(
895
895
  label: "Action remark",
896
896
  value: a.remark
897
897
  } : null
898
- ].filter((d) => d).map((d) => d);
898
+ ].filter((u) => u).map((u) => u);
899
899
  }), ee = [
900
900
  {
901
901
  label: "Overview",
@@ -906,7 +906,7 @@ const Ct = He(
906
906
  value: "history"
907
907
  }
908
908
  ], te = V(ee[0]), J = H(() => {
909
- var t, c, m, d;
909
+ var t, c, m, u;
910
910
  return [
911
911
  ...(((t = e.draft) == null ? void 0 : t.rejectionHistory) ?? []).map(
912
912
  (f) => ({
@@ -935,24 +935,24 @@ const Ct = He(
935
935
  },
936
936
  {
937
937
  label: "Approval remark",
938
- values: [((d = e.draft) == null ? void 0 : d.approveRemark) ?? ""]
938
+ values: [((u = e.draft) == null ? void 0 : u.approveRemark) ?? ""]
939
939
  }
940
940
  ]
941
941
  }
942
942
  ] : []
943
943
  ];
944
944
  }), pe = H(() => {
945
- var d, f, j, $;
946
- if ((d = e == null ? void 0 : e.draft) != null && d.approvedAt) return "Draft is already approved.";
945
+ var u, f, j, $;
946
+ if ((u = e == null ? void 0 : e.draft) != null && u.approvedAt) return "Draft is already approved.";
947
947
  if (((f = e.draft) == null ? void 0 : f.status) !== le.enum.DRAFT) return "Status is not draft.";
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;
948
+ const a = fe.value.some((S) => S.physicalBalance < 0), t = (($ = (j = d.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;
949
949
  return [
950
950
  a ? "Negative total exist." : null,
951
951
  m ? "Negative stock is not included in this draft. Reopen draft in POS and apply changes." : null
952
952
  ].filter((S) => S).join(" ");
953
953
  });
954
954
  return (a, t) => {
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");
955
+ const c = E("FmButtonGroup"), m = E("FmMenuDivider"), u = 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
956
  return x(), X(be, {
957
957
  "dismiss-away": "",
958
958
  "max-width": 9999,
@@ -977,28 +977,28 @@ const Ct = He(
977
977
  disabled: "",
978
978
  key: "approve key",
979
979
  label: "Approve",
980
- onClick: t[3] || (t[3] = () => e.draft && y(u).approveDraft(e.draft, () => B("submitted")))
980
+ onClick: t[3] || (t[3] = () => e.draft && y(i).approveDraft(e.draft, () => B("submitted")))
981
981
  })
982
982
  ]),
983
983
  _: 1
984
984
  })) : (x(), X(f, {
985
985
  key: "approve key",
986
986
  label: "Approve",
987
- onClick: t[4] || (t[4] = () => e.draft && y(u).approveDraft(e.draft, () => B("submitted")))
987
+ onClick: t[4] || (t[4] = () => e.draft && y(i).approveDraft(e.draft, () => B("submitted")))
988
988
  }))
989
989
  ], 64)) : ne("", !0),
990
990
  ((L = e.draft) == null ? void 0 : L.status) === y(le).enum.DRAFT ? (x(), X(f, {
991
991
  key: 1,
992
992
  label: "Reject",
993
993
  variant: "destructive",
994
- onClick: t[5] || (t[5] = () => e.draft && y(u).rejectDraft(e.draft, () => B("submitted")))
994
+ onClick: t[5] || (t[5] = () => e.draft && y(i).rejectDraft(e.draft, () => B("submitted")))
995
995
  })) : ne("", !0),
996
996
  (O = e.draft) != null && O.approvedAt && ((ue = e.draft) == null ? void 0 : ue.status) !== y(le).enum.COMPLETED ? (x(), X(f, {
997
997
  key: 2,
998
998
  label: "Sync",
999
999
  loading: D.value,
1000
1000
  onClick: t[6] || (t[6] = () => {
1001
- e.draft && (D.value = !0, y(u).syncDraft(e.draft, () => {
1001
+ e.draft && (D.value = !0, y(i).syncDraft(e.draft, () => {
1002
1002
  D.value = !1, B("submitted");
1003
1003
  }));
1004
1004
  })
@@ -1021,7 +1021,7 @@ const Ct = He(
1021
1021
  }, null, 8, ["modelValue"])
1022
1022
  ]),
1023
1023
  te.value.value === "overview" ? (x(), T(q, { key: 0 }, [
1024
- _(d, {
1024
+ _(u, {
1025
1025
  variant: "outlined",
1026
1026
  class: "flex flex-col gap-8 px-12 py-16"
1027
1027
  }, {
@@ -1063,7 +1063,7 @@ const Ct = He(
1063
1063
  "text-color": "primary",
1064
1064
  "bg-color": "transparent",
1065
1065
  "border-color": "primary",
1066
- onClick: t[1] || (t[1] = (A) => a.draft ? y(u).exportDraft(a.draft, l.value) : null)
1066
+ onClick: t[1] || (t[1] = (A) => a.draft ? y(i).exportDraft(a.draft, l.value) : null)
1067
1067
  })
1068
1068
  ]))
1069
1069
  ]),
@@ -1089,11 +1089,11 @@ const Ct = He(
1089
1089
  key: `${A}`,
1090
1090
  label: `${A}`,
1091
1091
  selectable: "",
1092
- selected: s[`${A}`],
1093
- onClick: (L) => s[`${A}`] = !s[`${A}`]
1092
+ selected: r[`${A}`],
1093
+ onClick: (L) => r[`${A}`] = !r[`${A}`]
1094
1094
  }, {
1095
1095
  default: Y(() => [
1096
- s[`${A}`] ? (x(), X(S, {
1096
+ r[`${A}`] ? (x(), X(S, {
1097
1097
  key: 0,
1098
1098
  name: "check",
1099
1099
  class: "text-white",
@@ -1103,8 +1103,8 @@ const Ct = He(
1103
1103
  class: me([
1104
1104
  "",
1105
1105
  {
1106
- "text-white fm-typo-en-body-md-600": s[`${A}`],
1107
- "text-fm-color-typo-primary fm-typo-en-body-md-400": !s[`${A}`]
1106
+ "text-white fm-typo-en-body-md-600": r[`${A}`],
1107
+ "text-fm-color-typo-primary fm-typo-en-body-md-400": !r[`${A}`]
1108
1108
  }
1109
1109
  ])
1110
1110
  }, z(A), 3)
@@ -1175,7 +1175,7 @@ const Ct = He(
1175
1175
  ])
1176
1176
  ]),
1177
1177
  o("div", aa, [
1178
- _(d, {
1178
+ _(u, {
1179
1179
  variant: "outlined",
1180
1180
  class: "py-12 px-16"
1181
1181
  }, {
@@ -1223,9 +1223,9 @@ const Ct = He(
1223
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({
1224
1224
  __name: "ClosingDraftView",
1225
1225
  setup(n) {
1226
- const { t: r } = Ee(), { viewDraft: e } = _e(), { viewClosingDraftProps: i, viewClosingDraftShow: u } = pt(_e()), g = we(), h = Ct(), D = rt(), { breakpoints: l } = ft();
1226
+ const { t: s } = Ee(), { viewDraft: e } = _e(), { viewClosingDraftProps: d, viewClosingDraftShow: i } = pt(_e()), g = we(), h = Ct(), D = rt(), { breakpoints: l } = ft();
1227
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);
1228
+ const R = H(() => h.loading), M = V(""), U = H(() => l.value.xs || l.value.sm), r = H(() => U.value ? 10 : 20);
1229
1229
  function p(v) {
1230
1230
  switch (v) {
1231
1231
  case "refresh":
@@ -1237,13 +1237,13 @@ const Ct = He(
1237
1237
  }
1238
1238
  const b = H(() => U.value ? [
1239
1239
  {
1240
- label: "Refresh",
1240
+ label: s("inventory.common.refresh"),
1241
1241
  value: "refresh",
1242
1242
  isPrimary: !1
1243
1243
  }
1244
1244
  ] : [
1245
1245
  {
1246
- label: "Refresh",
1246
+ label: s("inventory.common.refresh"),
1247
1247
  value: "refresh",
1248
1248
  isPrimary: !1
1249
1249
  }
@@ -1252,7 +1252,7 @@ const Ct = He(
1252
1252
  const N = E("FmTable");
1253
1253
  return x(), T(q, null, [
1254
1254
  _(lt, {
1255
- title: y(r)("inventory.closing.draft.title"),
1255
+ title: y(s)("inventory.closing.draft.title"),
1256
1256
  actions: b.value,
1257
1257
  "onClick:action": p
1258
1258
  }, {
@@ -1279,7 +1279,7 @@ const Ct = He(
1279
1279
  "search-value": M.value,
1280
1280
  loading: R.value,
1281
1281
  onRowClick: F[1] || (F[1] = (C) => y(e)(C.original)),
1282
- "page-size": s.value
1282
+ "page-size": r.value
1283
1283
  }, {
1284
1284
  "list-row": Y((C) => [
1285
1285
  _(it, {
@@ -1287,7 +1287,7 @@ const Ct = He(
1287
1287
  onRowClick: (I) => y(e)(I)
1288
1288
  }, {
1289
1289
  default: Y((I) => {
1290
- var w, Z, Q, K, se, ce, fe, ge, ee, te, J, pe, a, t, c, m, d, f, j, $;
1290
+ var w, Z, Q, K, se, ce, fe, ge, ee, te, J, pe, a, t, c, m, u, f, j, $;
1291
1291
  return [
1292
1292
  o("div", ca, [
1293
1293
  o("div", ia, [
@@ -1316,7 +1316,7 @@ const Ct = He(
1316
1316
  ]),
1317
1317
  o("div", null, [
1318
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,
1319
+ render: (f = (u = (m = I.status) == null ? void 0 : m.column) == null ? void 0 : u.columnDef) == null ? void 0 : f.cell,
1320
1320
  props: ($ = (j = I.status) == null ? void 0 : j.getContext) == null ? void 0 : $.call(j)
1321
1321
  }, null, 8, ["render", "props"])
1322
1322
  ])
@@ -1333,10 +1333,10 @@ const Ct = He(
1333
1333
  _: 1
1334
1334
  }, 8, ["title", "actions"]),
1335
1335
  (x(), X(qe, { to: "body" }, [
1336
- _(la, We(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
+ _(la, We(y(d), {
1337
+ show: y(i),
1338
+ "onUpdate:show": F[2] || (F[2] = (C) => Te(i) ? i.value = C : null),
1339
+ onSubmitted: F[3] || (F[3] = () => (i.value = !1, y(h).fetchDrafts()))
1340
1340
  }), null, 16, ["show"])
1341
1341
  ]))
1342
1342
  ], 64);