@feedmepos/mf-inventory-portal 0.0.23-dev.12 → 0.0.23-dev.14

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 (57) hide show
  1. package/dist/{App-DASBZyvh.js → App-C6g4MWwq.js} +3 -3
  2. package/dist/{ApprovalView-DHF6ZNbm.js → ApprovalView-BK8XFPbW.js} +4 -4
  3. package/dist/{BindingsDialog-D9qKxyAg.js → BindingsDialog-Dyt5XjYv.js} +2 -2
  4. package/dist/{BindingsPicker-CeBoqXz8.js → BindingsPicker-Oc6mY2X8.js} +2 -2
  5. package/dist/{BindingsTable-Dd5xRj10.js → BindingsTable-Bd3XOxR2.js} +4 -4
  6. package/dist/ClosingDraftView-ByE3m27z.js +939 -0
  7. package/dist/{ClosingTemplateView-CSXAdVxc.js → ClosingTemplateView-CMwTAa6I.js} +10 -10
  8. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BST01iWL.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-C8Svc7L9.js} +4 -4
  9. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BH2P7EWu.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-6-Um-FOb.js} +2 -2
  10. package/dist/{FmMultiselectDialog-CS4NySsZ.js → FmMultiselectDialog-D8iilrSP.js} +3 -3
  11. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-C7jj8lh2.js → FmUnitInput.vue_vue_type_script_setup_true_lang-D5hUkg2Q.js} +2 -2
  12. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-B_bOROW1.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-Cd9aCR0V.js} +1 -1
  13. package/dist/{IngredientGroupView-D8YdtFuI.js → IngredientGroupView-D5Y8HnMX.js} +5 -5
  14. package/dist/{IngredientsView-Dwi7AdEC.js → IngredientsView-Bw49qYtR.js} +9 -9
  15. package/dist/{IntegrationView-cRXTwH66.js → IntegrationView-BxaJS_Ic.js} +4 -4
  16. package/dist/{InventoryBindingForm-Bn8LLL7Z.js → InventoryBindingForm-a9nsrEgo.js} +1 -1
  17. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-jXdc2zeS.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-Dj3ykTHY.js} +5 -5
  18. package/dist/{InventoryBindingSummary-eUAU5Z7o.js → InventoryBindingSummary-BdvlBlBa.js} +1 -1
  19. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DP9gkO9u.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BIFLCYHD.js} +1 -1
  20. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DjdvK5YG.js → PremiumBadge.vue_vue_type_script_setup_true_lang-gqJ2wFO2.js} +2 -2
  21. package/dist/{PurchaseOrderPrintPreview-RsvtuTgm.js → PurchaseOrderPrintPreview-DsWVxI5o.js} +1 -1
  22. package/dist/{ReceiveRequestView-BVYXX41L.js → ReceiveRequestView-C7I6nYFr.js} +18 -18
  23. package/dist/{RecipeView-BFj61pLR.js → RecipeView-DNf5Pdsx.js} +7 -7
  24. package/dist/{StockView-B8DHNq-I.js → StockView-BvtciIRT.js} +13 -13
  25. package/dist/{SupplierView-DE5glObY.js → SupplierView-Co0xIPuQ.js} +10 -10
  26. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-CAR2rHAz.js → TransferDetails.vue_vue_type_script_setup_true_lang-WlrPIph9.js} +321 -320
  27. package/dist/{TransferTemplateView-DaY-24XT.js → TransferTemplateView-BWuxHMCo.js} +14 -14
  28. package/dist/{UnitView-Bqh-DD8a.js → UnitView-DV1gTkKx.js} +5 -5
  29. package/dist/{WarehouseView-KOZF8E0j.js → WarehouseView-1nJhKxZf.js} +4 -4
  30. package/dist/api/netsuite.d.ts +1 -1
  31. package/dist/{app-CCmjyIGj.js → app-BxXrau2Y.js} +8 -8
  32. package/dist/app.js +1 -1
  33. package/dist/{date2-Bts8EH96.js → date2-BiwqC0aG.js} +1 -1
  34. package/dist/{dayjs.min-Bwx_xAqf.js → dayjs.min-BG6ShXQ2.js} +1 -1
  35. package/dist/{decimal-Cw3aj2HA.js → decimal-E0BNizw5.js} +1 -1
  36. package/dist/{defineDeepModel-DF4IooaB.js → defineDeepModel-35Pm_1zc.js} +1 -1
  37. package/dist/{feature-DUVlpk0T.js → feature-DEUGLUcC.js} +1 -1
  38. package/dist/{format-time-from-id-DRL6XFTy.js → format-time-from-id-C-CoKHdr.js} +1 -1
  39. package/dist/{format-unit-display-h-7i16En.js → format-unit-display-BTpv4xQq.js} +8 -8
  40. package/dist/{fuzzy-Csk59ocn.js → fuzzy-DnuAv442.js} +1 -1
  41. package/dist/{index-C49C9tXF.js → index-C-Tfi09A.js} +1 -1
  42. package/dist/{index-BUdfAMv8.js → index-CvuJB9Kj.js} +1 -1
  43. package/dist/{index-rrLxN15a.js → index-DAeQwHBr.js} +1 -1
  44. package/dist/{netsuite-Cgj-Fs7U.js → netsuite-B_j6HAOr.js} +44 -43
  45. package/dist/{rules-CSQd5FJv.js → rules-DQHD3_tG.js} +2 -2
  46. package/dist/{stock-DOndmj1b.js → stock-UdvZOkMj.js} +2 -2
  47. package/dist/stores/integration/netsuite.d.ts +1 -1
  48. package/dist/{supplier-Bv3Jvn8o.js → supplier-DPLyaiL4.js} +1 -1
  49. package/dist/tsconfig.app.tsbuildinfo +1 -1
  50. package/dist/{use-inventory-binding-dialog-C7br2QA4.js → use-inventory-binding-dialog-D5f_LR61.js} +2 -2
  51. package/dist/{use-template-enabled-locations-2-eX5uS542.js → use-template-enabled-locations-2-C7I0IWxW.js} +2 -2
  52. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +6 -2
  53. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +4 -1
  54. package/dist/{xlsx-wOJHnWy6.js → xlsx-CtEy_Z3G.js} +1 -1
  55. package/dist/{xlsx.util-C4ZYbcNA.js → xlsx.util-CNlpT1T7.js} +1 -1
  56. package/package.json +3 -3
  57. package/dist/ClosingDraftView-TbFoEdiB.js +0 -767
@@ -1,767 +0,0 @@
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-BH2P7EWu.js";
3
- import { useI18n as be } from "@feedmepos/mf-common";
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-CCmjyIGj.js";
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 ue, k as Oe, c as de, t as He } from "./rules-CSQd5FJv.js";
8
- import { D as me, R as W } from "./row-action.enum-7rGLGZ5v.js";
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-DRL6XFTy.js";
11
- import { d as N } from "./date2-Bts8EH96.js";
12
- import { u as We } from "./stock-DOndmj1b.js";
13
- const Ae = ze((C, e) => {
14
- function m() {
15
- return te().currentLocation.dbName;
16
- }
17
- return {
18
- async getDraft(d) {
19
- const i = m(), p = `${C.inventoryBackendUrl}/${i}/closing-draft/${d}`;
20
- return e.get(p);
21
- },
22
- async readDrafts() {
23
- const d = m(), i = `${C.inventoryBackendUrl}/${d}/closing-draft`;
24
- return e.get(i);
25
- },
26
- async runOperation(d) {
27
- const i = m(), p = `${C.inventoryBackendUrl}/${i}/closing-draft/run-operation`;
28
- return e.post(p, d);
29
- }
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__ */ ee({
32
- __name: "ClosingDraftAction",
33
- props: {
34
- draft: {},
35
- action: {},
36
- onCancel: { type: Function },
37
- onFinished: { type: Function }
38
- },
39
- setup(C) {
40
- const e = C, m = z(), d = Ae(), i = De(), p = z(!1);
41
- async function v() {
42
- p.value = !0;
43
- try {
44
- await d.runOperation({
45
- _id: e.draft._id,
46
- _rev: e.draft._rev ?? "",
47
- action: e.action,
48
- data: {
49
- remark: m.value
50
- }
51
- }).delayed(500), i.open({
52
- title: "Success",
53
- message: "Action submitted",
54
- type: "success"
55
- }), e.onFinished();
56
- } catch (h) {
57
- i.open({
58
- title: "Something went wrong",
59
- message: "Unable to submit actino. Please try again",
60
- type: "error"
61
- }), console.error("error on submit closing draft aciont", h);
62
- } finally {
63
- p.value = !1;
64
- }
65
- }
66
- return (h, u) => {
67
- const y = P("FmTextField"), j = P("FmButton"), o = P("FmForm");
68
- return R(), O(o, {
69
- onValidationSuccess: v,
70
- class: "flex flex-col gap-32",
71
- disabled: p.value
72
- }, {
73
- default: K(() => [
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
- ]),
79
- b(y, {
80
- modelValue: m.value,
81
- "onUpdate:modelValue": u[0] || (u[0] = (l) => m.value = l),
82
- label: "Remark",
83
- "label-mark": "required",
84
- rules: [c(Ee)()]
85
- }, null, 8, ["modelValue", "rules"]),
86
- r("div", Qe, [
87
- b(j, {
88
- label: "Cancel",
89
- variant: "tertiary",
90
- onClick: u[1] || (u[1] = (l) => h.onCancel())
91
- }),
92
- b(j, {
93
- label: h.action == c(M).enum.approveDraft ? "Approve" : "Reject",
94
- type: "submit",
95
- variant: h.action == c(M).enum.approveDraft ? "primary" : "destructive",
96
- loading: p.value
97
- }, null, 8, ["label", "variant", "loading"])
98
- ])
99
- ]),
100
- _: 1
101
- }, 8, ["disabled"]);
102
- };
103
- }
104
- }), Q = _e(
105
- "closingDraftActions",
106
- function() {
107
- const e = Pe(), m = z(!1), d = z();
108
- function i(u) {
109
- const y = {
110
- draft: u
111
- };
112
- d.value = y, m.value = !0;
113
- }
114
- function p(u) {
115
- }
116
- function v(u, y) {
117
- e.open({
118
- title: "Approve draft",
119
- contentComponent: fe,
120
- contentComponentProps: {
121
- draft: u,
122
- action: M.enum.approveDraft,
123
- onFinished: () => {
124
- e.close(), y == null || y();
125
- },
126
- onCancel: () => e.close()
127
- }
128
- });
129
- }
130
- function h(u, y) {
131
- e.open({
132
- title: "Reject draft",
133
- contentComponent: fe,
134
- contentComponentProps: {
135
- draft: u,
136
- action: M.enum.rejectDraft,
137
- onFinished: () => {
138
- e.close(), y == null || y();
139
- },
140
- onCancel: () => e.close()
141
- }
142
- });
143
- }
144
- return {
145
- viewDraft: i,
146
- approveDraft: v,
147
- rejectDraft: h,
148
- exportDraft: p,
149
- viewClosingDraftShow: m,
150
- viewClosingDraftProps: d
151
- };
152
- }
153
- );
154
- function Ce(C) {
155
- switch (C) {
156
- case "DRAFT":
157
- return "fm-status-badge-draft";
158
- case "PROCESSING":
159
- return "fm-status-badge-processing";
160
- case "FAILED":
161
- return "fm-status-badge-cancel";
162
- case "COMPLETED":
163
- return "fm-status-badge-complete";
164
- }
165
- }
166
- const Xe = _e("closingTable", function() {
167
- const { t: e } = be(), m = Q(), d = z(new Array()), i = z(!1), p = te(), v = Ae();
168
- async function h() {
169
- if (d.value = [], !!p._currentLocation) {
170
- i.value = !0;
171
- try {
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
- } finally {
177
- i.value = !1;
178
- }
179
- }
180
- }
181
- async function u(o) {
182
- if (!d.value.find((l) => l._id) && p._currentLocation) {
183
- i.value = !0;
184
- try {
185
- const [l] = await Promise.all([
186
- v.getDraft(o),
187
- new Promise((_) => setTimeout(_, 1e3))
188
- ]);
189
- d.value = [l];
190
- } catch (l) {
191
- console.log("Something went wrong when fetching drafts:", l);
192
- } finally {
193
- i.value = !1;
194
- }
195
- }
196
- }
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
- case M.enum.approveDraft:
204
- return m.approveDraft(l);
205
- case M.enum.rejectDraft:
206
- return m.rejectDraft(l);
207
- }
208
- }
209
- return {
210
- columnDefs: [
211
- {
212
- id: "_id",
213
- accessorKey: "_id",
214
- header: () => e("inventory.closing.table.createdAt"),
215
- cell(o) {
216
- return Ge(`${o.getValue()}`);
217
- },
218
- enableSorting: !0
219
- },
220
- {
221
- id: "updatedAt",
222
- accessorFn: (o) => N(o.updatedAt),
223
- header: () => "Updated at",
224
- enableSorting: !0,
225
- size: 200
226
- },
227
- {
228
- id: "updatedBy",
229
- accessorKey: "updatedBy.name",
230
- header: () => "Last update by",
231
- enableSorting: !0,
232
- size: 200
233
- },
234
- {
235
- id: "noOfItems",
236
- accessorKey: "items.length",
237
- header: () => e("inventory.closing.table.noOfItems"),
238
- enableSorting: !1,
239
- meta: {
240
- width: "10rem",
241
- textAlign: "right"
242
- }
243
- },
244
- {
245
- id: "recentRemark",
246
- accessorFn: (o) => {
247
- var l;
248
- return (o == null ? void 0 : o.approveRemark) ?? ((l = o == null ? void 0 : o.rejectionHistory) == null ? void 0 : l.computeFirst((_) => _.rejectRemark));
249
- },
250
- header: () => "Recent remark"
251
- },
252
- {
253
- id: "status",
254
- accessorFn: (o) => o.status,
255
- header: () => e("inventory.closing.table.status"),
256
- enableSorting: !1,
257
- cell(o) {
258
- const _ = o.row.original.status;
259
- return ie(
260
- "div",
261
- {
262
- class: "flex"
263
- },
264
- ie(
265
- "div",
266
- {
267
- class: ["fm-status-badge", Ce(_)]
268
- },
269
- he(_)
270
- )
271
- );
272
- }
273
- },
274
- {
275
- id: "action",
276
- cell(o) {
277
- const l = o.row.original, _ = [
278
- me[W.Details],
279
- me[W.Export]
280
- ], Y = [
281
- {
282
- translationKey: "inventory.closing.draft.approveDraft",
283
- color: "text-fm-color-typo-primary",
284
- value: M.enum.approveDraft
285
- },
286
- {
287
- translationKey: "inventory.closing.draft.rejectDraft",
288
- color: "text-fm-color-typo-error",
289
- value: M.enum.rejectDraft
290
- }
291
- ];
292
- return Ye(
293
- [..._, ...l.status === J.enum.DRAFT ? Y : []],
294
- (E) => y(E, l)
295
- );
296
- },
297
- enableSorting: !1,
298
- size: 40,
299
- meta: {
300
- cellClass: "",
301
- headerClass: ""
302
- }
303
- }
304
- ],
305
- drafts: d,
306
- loading: i,
307
- fetchDrafts: h,
308
- loadDraft: u
309
- };
310
- }), et = { class: "w-full flex flex-col gap-32" }, tt = { class: "flex justify-between" }, at = { class: "inline-flex rounded-md items-center gap-4 justify-center h-[22px] px-8 bg-fm-color-neutral-gray-100 fm-status-badge fm-status-badge-receiving" }, nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ot = { class: "flex gap-1" }, st = { class: "fm-typo-en-body-lg-600" }, rt = { class: "flex flex-col gap-16" }, lt = {
311
- key: 0,
312
- class: "w-full flex flex-col items-center"
313
- }, it = { class: "flex items-center gap-8" }, ct = {
314
- key: 1,
315
- class: "overflow-x-auto"
316
- }, ut = { class: "flex gap-8" }, dt = /* @__PURE__ */ ee({
317
- __name: "ClosingDraftDialog",
318
- props: {
319
- show: { type: Boolean },
320
- draft: {}
321
- },
322
- setup(C) {
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(() => {
324
- var a;
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;
327
- });
328
- xe(_), ke(
329
- () => e.show,
330
- (t) => {
331
- t && _();
332
- }
333
- );
334
- const o = de(0), l = de(100);
335
- async function _() {
336
- var a, s, n;
337
- p.value = !0;
338
- const t = ((a = e.draft) == null ? void 0 : a.status) === J.enum.COMPLETED;
339
- try {
340
- if (await y.init(), t) {
341
- const f = e.draft.closingId;
342
- if (!f) {
343
- u.open({
344
- title: "Something went wrong",
345
- message: "Closing draft is completed but closing document cannot be found.",
346
- type: "error"
347
- }), console.error("Closing draft is completed but closing document cannot be found.", {
348
- draftId: (s = e.draft) == null ? void 0 : s._id
349
- });
350
- return;
351
- }
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) {
357
- u.open({
358
- title: "Something went wrong",
359
- message: "Something went wrong when fetching info. Please try again.",
360
- type: "error"
361
- }), console.error("error on fetch stock balances", f);
362
- } finally {
363
- p.value = !1;
364
- }
365
- }
366
- const Y = F(
367
- () => v.value.groupBy(
368
- (t) => t.id,
369
- (t) => t.balance
370
- )
371
- ), E = F(() => {
372
- var a;
373
- return (((a = e.draft) == null ? void 0 : a.items) ?? []).groupBy((s) => s.sku._id);
374
- }), L = F(() => {
375
- const t = j.value.reduce((s, n) => Math.max(
376
- s,
377
- n.unit.measurements.filter((f) => !f.name.toLocaleLowerCase().includes("inactive")).length
378
- ), 0);
379
- return [
380
- {
381
- id: "code",
382
- accessorKey: "code",
383
- header: () => "Code",
384
- size: 200
385
- },
386
- {
387
- id: "name",
388
- accessorKey: "name",
389
- header: () => "Name",
390
- size: 300
391
- },
392
- {
393
- id: "baseUnit",
394
- accessorKey: "baseUnit",
395
- header: () => "Base unit",
396
- size: 200
397
- },
398
- {
399
- id: "baseUnitAmount",
400
- accessorKey: "baseUnitAmount",
401
- header: () => "Base unit amount",
402
- size: 200
403
- },
404
- ...Array.from({ length: t }).flatMap((s, n) => {
405
- const f = `measurementAbbrev${n}`, D = `measurementAmount${n}`;
406
- return [
407
- {
408
- id: D,
409
- accessorKey: D,
410
- header: () => `Sub unit amount ${n + 1}`,
411
- size: 200,
412
- meta: {
413
- textAlign: "right"
414
- }
415
- },
416
- {
417
- id: f,
418
- accessorKey: f,
419
- header: () => `Sub unit ${n + 1}`,
420
- size: 200
421
- }
422
- ];
423
- }),
424
- {
425
- id: "systemBalance",
426
- accessorKey: "systemBalance",
427
- header: () => "System balance",
428
- size: 200,
429
- meta: {
430
- textAlign: "right"
431
- }
432
- },
433
- {
434
- id: "physicalBalance",
435
- accessorKey: "physicalBalance",
436
- header: () => "Physical balance",
437
- size: 200,
438
- meta: {
439
- textAlign: "right"
440
- }
441
- },
442
- {
443
- id: "adjustedBalance",
444
- accessorKey: "adjustedBalance",
445
- header: () => "Adjusted balance",
446
- size: 200,
447
- meta: {
448
- textAlign: "right"
449
- }
450
- },
451
- {
452
- id: "adjustedDiffPercentage",
453
- accessorKey: "adjustedDiffPercentage",
454
- header: () => "Diff (%)",
455
- size: 200,
456
- cell(s) {
457
- var n;
458
- return (n = s.row.original.adjustedDiffPercentage) == null ? void 0 : n.toFixed(2);
459
- },
460
- meta: {
461
- textAlign: "right"
462
- }
463
- }
464
- ];
465
- }), $ = F(() => L.value.map((t) => t.size ?? 0).reduce((t, a) => t + a));
466
- function X(t) {
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);
471
- }, +B(t.baseAmount));
472
- return He(s, t.baseAmount.precision);
473
- }
474
- const A = F(() => j.value.map((t) => {
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;
477
- if (!a)
478
- return {
479
- code: t.code,
480
- name: t.name,
481
- baseUnit: t.unit.abbrev,
482
- baseUnitAmount: 0,
483
- systemBalance: +B(s),
484
- physicalBalance: 0,
485
- adjustedBalance: -+B(s),
486
- adjustedDiffPercentage: -100
487
- };
488
- const n = X(a), f = Ie(n, s), D = s.amount === 0 ? null : Ve(f, s), x = D ? ue(D, l) : null;
489
- return {
490
- code: t.code,
491
- name: t.name,
492
- baseUnit: t.unit.abbrev,
493
- baseUnitAmount: +B(a.baseAmount),
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),
498
- adjustedDiffPercentage: x ? +B(Oe(x, 2)) : null
499
- };
500
- })), w = F(() => {
501
- var a, s;
502
- if (!e.draft) return [];
503
- const t = e.draft.approvedAt ? {
504
- action: `Approve at ${N(e.draft.approvedAt)}`,
505
- // actionAt: props.draft.approvedAt,
506
- actionBy: e.draft.approvedBy,
507
- remark: e.draft.approveRemark
508
- } : (a = e.draft.rejectionHistory) == null ? void 0 : a.computeFirst((n) => ({
509
- action: `Reject at ${N(n.rejectedAt)}`,
510
- // actionAt: e.rejectedAt,
511
- actionBy: n.rejectedBy,
512
- remark: n.rejectRemark
513
- }));
514
- return [
515
- {
516
- label: "Created at",
517
- value: N(e.draft.createdAt)
518
- },
519
- {
520
- label: "Created by",
521
- value: e.draft.createdBy.name
522
- },
523
- {
524
- label: "Updated at",
525
- value: N(e.draft.updatedAt)
526
- },
527
- {
528
- label: "Updated by",
529
- value: e.draft.updatedBy.name
530
- },
531
- {
532
- label: "Effective at",
533
- value: N(e.draft.effectiveAt ?? e.draft.updatedAt)
534
- },
535
- t ? {
536
- label: "Last action",
537
- value: t.action
538
- } : null,
539
- t && t.actionBy ? {
540
- label: "Last action by",
541
- value: (s = t.actionBy) == null ? void 0 : s.name
542
- } : null,
543
- t && t.remark ? {
544
- label: "Action remark",
545
- value: t.remark
546
- } : null
547
- ].filter((n) => n).map((n) => n);
548
- });
549
- return (t, a) => {
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, {
552
- "dismiss-away": "",
553
- "max-width": 900,
554
- "model-value": c(i),
555
- "onUpdate:modelValue": a[3] || (a[3] = (g) => pe(i) ? i.value = g : null),
556
- header: "Closing details"
557
- }, {
558
- "side-sheet-footer": K(() => {
559
- var g, S;
560
- return [
561
- r("div", ut, [
562
- ((g = e.draft) == null ? void 0 : g.status) === c(J).enum.DRAFT ? (R(), O(x, {
563
- key: 0,
564
- label: "Approve",
565
- onClick: a[0] || (a[0] = () => e.draft && c(d).approveDraft(e.draft))
566
- })) : ce("", !0),
567
- ((S = e.draft) == null ? void 0 : S.status) === c(J).enum.DRAFT ? (R(), O(x, {
568
- key: 1,
569
- label: "Reject",
570
- variant: "destructive",
571
- onClick: a[1] || (a[1] = () => e.draft && c(d).rejectDraft(e.draft))
572
- })) : ce("", !0),
573
- b(x, {
574
- label: "Close",
575
- variant: "tertiary",
576
- onClick: a[2] || (a[2] = (k) => i.value = !1)
577
- })
578
- ])
579
- ];
580
- }),
581
- default: K(() => [
582
- r("div", et, [
583
- b(n, {
584
- variant: "outlined",
585
- class: "flex flex-col gap-8 px-12 py-16"
586
- }, {
587
- default: K(() => {
588
- var g, S;
589
- return [
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)
597
- ])
598
- ])
599
- ]),
600
- b(s),
601
- (R(!0), V(ve, null, Se(w.value, (k, T) => (R(), V("div", {
602
- class: "flex flex-col gap-4",
603
- key: T
604
- }, [
605
- r("div", nt, [
606
- r("div", ot, H(k.label), 1)
607
- ]),
608
- r("div", st, H(k.value), 1)
609
- ]))), 128))
610
- ];
611
- }),
612
- _: 1
613
- }),
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" })
621
- ]),
622
- a[5] || (a[5] = r("div", { class: "fm-typo-en-body-lg-600 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
623
- ]),
624
- a[7] || (a[7] = r("div", { class: "h-80" }, null, -1))
625
- ])) : (R(), V("div", ct, [
626
- r("div", {
627
- style: ye({ width: `${$.value}px` })
628
- }, [
629
- b(D, {
630
- "column-defs": L.value,
631
- "row-data": A.value
632
- }, null, 8, ["column-defs", "row-data"])
633
- ], 4)
634
- ]))
635
- ])
636
- ])
637
- ]),
638
- _: 1
639
- }, 8, ["model-value"]);
640
- };
641
- }
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({
643
- __name: "ClosingDraftView",
644
- setup(C) {
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);
648
- function _(L) {
649
- switch (L) {
650
- case "refresh":
651
- return v.fetchDrafts();
652
- }
653
- }
654
- function Y(L) {
655
- return L;
656
- }
657
- const E = F(() => o.value ? [
658
- {
659
- label: "Refresh",
660
- value: "refresh",
661
- isPrimary: !1
662
- }
663
- ] : [
664
- {
665
- label: "Refresh",
666
- value: "refresh",
667
- isPrimary: !1
668
- }
669
- ]);
670
- return (L, $) => {
671
- const X = P("FmTable");
672
- return R(), V(ve, null, [
673
- b($e, {
674
- title: c(e)("inventory.closing.draft.title"),
675
- actions: E.value,
676
- "onClick:action": _
677
- }, {
678
- default: K(() => [
679
- r("div", {
680
- class: ge([
681
- "flex flex-col gap-8 max-h-full",
682
- {
683
- "p-0": o.value,
684
- "px-24 ": !o.value
685
- }
686
- ])
687
- }, [
688
- b(Re, {
689
- "change-location": "",
690
- searchable: "",
691
- search: j.value,
692
- "onUpdate:search": $[0] || ($[0] = (A) => j.value = A)
693
- }, null, 8, ["search"]),
694
- b(X, {
695
- style: ye(c(h).tableHeight),
696
- "column-defs": c(v).columnDefs,
697
- "row-data": c(v).drafts,
698
- "search-value": j.value,
699
- loading: y.value,
700
- onRowClick: $[1] || ($[1] = (A) => c(m)(A.original)),
701
- "page-size": l.value
702
- }, {
703
- "list-row": K((A) => [
704
- b(qe, {
705
- row: A,
706
- onRowClick: (w) => c(m)(w)
707
- }, {
708
- default: K((w) => {
709
- var t, a, s, n, f, D, x, U, g, S, k, T, I, q, ae, ne, oe, se, G, re;
710
- return [
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)
717
- }, null, 8, ["render", "props"])
718
- ]),
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)
723
- }, null, 8, ["render", "props"])
724
- ]),
725
- r("div", vt, H([
726
- ...A.original.items.slice(0, 3).map((we) => we.sku.name),
727
- ...A.original.items.length >= 3 ? [`and ${A.original.items.length - 3} more items`] : []
728
- ].join(", ")), 1),
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)
733
- }, null, 8, ["render", "props"])
734
- ])
735
- ]),
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)
740
- }, null, 8, ["render", "props"])
741
- ])
742
- ])
743
- ];
744
- }),
745
- _: 2
746
- }, 1032, ["row", "onRowClick"])
747
- ]),
748
- _: 1
749
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
750
- ], 2)
751
- ]),
752
- _: 1
753
- }, 8, ["title", "actions"]),
754
- (R(), O(Be, { to: "body" }, [
755
- b(dt, Fe(c(d), {
756
- show: c(i),
757
- "onUpdate:show": $[2] || ($[2] = (A) => pe(i) ? i.value = A : null),
758
- onSubmitted: $[3] || ($[3] = (A) => c(v).fetchDrafts())
759
- }), null, 16, ["show"])
760
- ]))
761
- ], 64);
762
- };
763
- }
764
- });
765
- export {
766
- jt as default
767
- };