@feedmepos/mf-inventory-portal 1.4.4-dev.1 → 1.4.4
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.
- package/dist/App-anowWIyY.js +310 -0
- package/dist/{ApprovalView-BA13wbQ-.js → ApprovalView-BJr2MwMI.js} +7 -7
- package/dist/{BindingsDialog-DMzMv881.js → BindingsDialog-CKO2TaFT.js} +2 -2
- package/dist/{BindingsPicker-BGxYZDn_.js → BindingsPicker-DFJgELVH.js} +2 -2
- package/dist/{BindingsTable-D7I6KyIQ.js → BindingsTable-D5TMN4hM.js} +3 -3
- package/dist/ClosingDraftView-BPmQPlyp.js +3183 -0
- package/dist/{ClosingHistoryView-DQoNfb5z.js → ClosingHistoryView-fFW-MZ_W.js} +5 -5
- package/dist/{ClosingTemplateView-Ckq2Veyq.js → ClosingTemplateView-DXP0LEj8.js} +14 -14
- package/dist/{DefaultView-BYIk34PR.js → DefaultView-x0X6PJAp.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-BgHL-gvt.js → DeliveryOrderPrintPreview-CBn1fkbg.js} +2 -2
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-yqA2fgtH.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-B3ij1Mjc.js} +2 -2
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Bvma2A4K.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BJDOinO3.js} +2 -2
- package/dist/{FmMultiselectDialog-BmTCvmlw.js → FmMultiselectDialog-BXJ5WXXx.js} +2 -2
- package/dist/{FmMultiselectDialog-VPcV-FQV.js → FmMultiselectDialog-INzDv0RH.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-7dkCTYcT.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DrafKRjT.js} +4 -4
- package/dist/{ImportView-gzF9CWtM.js → ImportView-C0QRED_s.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BJKxFdjv.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DOn2dhiJ.js} +1 -1
- package/dist/{IngredientGroupView-DkoVLdIi.js → IngredientGroupView-BUvPthyd.js} +5 -5
- package/dist/{IngredientsView-NBpaVLDo.js → IngredientsView-B2lvin5v.js} +15 -15
- package/dist/{IntegrationExplorerView-D4P5Sxcm.js → IntegrationExplorerView-xrjN_n-a.js} +5 -5
- package/dist/{IntegrationView-B5YN8TEE.js → IntegrationView-D7GvuUGl.js} +13 -13
- package/dist/{InventoryBindingForm-B7VMypYy.js → InventoryBindingForm-CNQJBAKD.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-DziCetjY.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-C9g_VOEM.js} +5 -5
- package/dist/{InventoryBindingSummary-B9Vy49tr.js → InventoryBindingSummary-Dtrn-RiR.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DXbiPSqB.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DYVAYA3n.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-7ikbnzXX.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CoO4z-TZ.js} +1 -1
- package/dist/{PublishView-BwmWveBB.js → PublishView-C8xM1NfC.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-kajF_P0m.js → PurchaseOrderPrintPreview-Webj56Jb.js} +2 -2
- package/dist/{ReceiveRequestView-DHYEENEf.js → ReceiveRequestView-DjqhlTeD.js} +2286 -2286
- package/dist/{RecipeView-BHwVXfLJ.js → RecipeView-sTFOjW1W.js} +17 -17
- package/dist/{SettingsView-AdpIDPVs.js → SettingsView-C6yufn7C.js} +4 -4
- package/dist/StockView-CKb7U9G_.js +2484 -0
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-B3az_NVO.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-COT76WC8.js} +1 -1
- package/dist/{SupplierView-D7Nr2RxT.js → SupplierView-VAN0SR-W.js} +12 -12
- package/dist/{SurchargeView-vJimp1Cv.js → SurchargeView-BRehKy4B.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-CinFL3QM.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-C3caC1m0.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-D2SvRBN6.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CGLDsUIH.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-DlEjTd8E.js → TransferDetails.vue_vue_type_script_setup_true_lang-DDMj287I.js} +20 -20
- package/dist/{TransferTemplateView-C6RmjS-v.js → TransferTemplateView-zYOnXwwi.js} +18 -18
- package/dist/{UnitCostHistoryView-aC4aPr3L.js → UnitCostHistoryView-CynLSUqm.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-CuP7FMd1.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-shDeBgWH.js} +4 -4
- package/dist/{UnitView-BCGMlHCV.js → UnitView-Cdanl0L-.js} +7 -7
- package/dist/{WarehouseView-O3gc_PiU.js → WarehouseView-BQJjyGbp.js} +5 -5
- package/dist/{WastageTemplateView-H9PA6ryl.js → WastageTemplateView-DS6c5eWa.js} +14 -14
- package/dist/api/sse.d.ts +15 -3
- package/dist/{app-CItiJtFw.js → app-BHZUr8QU.js} +35 -13
- package/dist/app.d.ts +24 -0
- package/dist/app.js +1 -1
- package/dist/{closing-template-Cwj3O7Lm.js → closing-template-Cc74GsZk.js} +1 -1
- package/dist/composable/useSseClient.d.ts +4 -5
- package/dist/{date2-D00juOhc.js → date2-B3oBITLt.js} +1 -1
- package/dist/{dayjs.min-DmEufB_X.js → dayjs.min-VlCfBoGw.js} +1 -1
- package/dist/{decimal-Cfx4iNIN.js → decimal-CC8SRMMj.js} +2 -2
- package/dist/{defineDeepModel-Dn4pcA76.js → defineDeepModel-Brn6vLtZ.js} +1 -1
- package/dist/{duplicate-template-3GCMrDdJ.js → duplicate-template-BT9iI3MQ.js} +1 -1
- package/dist/{export-Taxbki8U.js → export-CcLlmt3Q.js} +2 -2
- package/dist/{feature-CWFT4m6D.js → feature-BjGQyaTy.js} +2 -2
- package/dist/{format-time-from-id-DBU5YJL6.js → format-time-from-id--G-xmwZG.js} +1 -1
- package/dist/{format-unit-display-Bcg7Sa60.js → format-unit-display-DLKArjS9.js} +11 -11
- package/dist/{import-export.helper-DDM-pvFO.js → import-export.helper-IdG-dQWC.js} +6 -6
- package/dist/{index-DK0BNrfa.js → index-CLDPjo4U.js} +1 -1
- package/dist/{index-BMhosF1x.js → index-CzxNTPQW.js} +3 -3
- package/dist/{index-DHnHIq4-.js → index-DeMPzMlu.js} +1 -1
- package/dist/{inventory-core-dart.default-B8aW6vKZ.js → inventory-core-dart.default-_HyF0msS.js} +1 -1
- package/dist/{lodash-raCw-gUe.js → lodash-wdTPpJR4.js} +1 -1
- package/dist/{lz-string-eBAqN_g9.js → lz-string-CiOe-IOa.js} +1 -1
- package/dist/{netsuite-uRj2P-EH.js → netsuite-BcvKTHWn.js} +6 -5
- package/dist/{number-C9o5tPfP.js → number-DEkRlbDc.js} +3 -3
- package/dist/{predefined-templates-YPJMW8GJ.js → predefined-templates-aTcwfLP-.js} +1 -1
- package/dist/{purchase-order-template-B6aV2vdS.js → purchase-order-template-E2KBeDJZ.js} +1 -1
- package/dist/{recalculationUtils-BiZ-pU6y.js → recalculationUtils-ft9Xbq4D.js} +1 -1
- package/dist/{rules-01UCJome.js → rules-CoadU_Kt.js} +2 -2
- package/dist/{stock-SuApOj2U.js → stock-BP1UCYpf.js} +3 -3
- package/dist/{stock-DTp9AhdZ.js → stock-BZs2m7fO.js} +1 -1
- package/dist/{supplier-D60bDAuZ.js → supplier-DMg1aTdz.js} +2 -2
- package/dist/{surcharge-BWwSWZ1U.js → surcharge-sd7msuB5.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-B4zci6JI.js → use-ingredient-select-dialog-B-AFJRYz.js} +2 -2
- package/dist/{use-inventory-binding-dialog-CgSz72ZS.js → use-inventory-binding-dialog-Ch7HPbh-.js} +2 -2
- package/dist/{use-template-enabled-locations-DVLHfYM9.js → use-template-enabled-locations-Dz85x8MM.js} +2 -2
- package/dist/{use-transfer-locations-POSn3UDi.js → use-transfer-locations-D2GAkvh4.js} +2 -2
- package/dist/{useHrmPermission-B9ffPr7i.js → useHrmPermission-CPjPQKIJ.js} +1 -1
- package/dist/{useNavigationMenu-dJYOEiud.js → useNavigationMenu-BPy-eLXg.js} +2 -2
- package/dist/useSseClient-CK86U3Y2.js +502 -0
- package/dist/views/stock/components/dialog/AdjustedItemFormProps.d.ts +1 -0
- package/dist/{vue-i18n-CqFS0F9S.js → vue-i18n-C2oCa59F.js} +297 -297
- package/dist/{xlsx-BY0_-lpm.js → xlsx-DM4nr4wg.js} +398 -398
- package/dist/{xlsx.util-DR3_mTtm.js → xlsx.util-BYnsljpI.js} +3 -3
- package/package.json +4 -4
- package/dist/App-_rrlFpzI.js +0 -309
- package/dist/ClosingDraftView-osqh-QJ1.js +0 -3649
- package/dist/StockView-C5AtoijI.js +0 -2439
|
@@ -0,0 +1,3183 @@
|
|
|
1
|
+
import { defineComponent as je, ref as O, computed as P, onMounted as ft, resolveComponent as q, openBlock as w, createElementBlock as R, Fragment as ie, createTextVNode as me, createBlock as te, withCtx as Q, createElementVNode as o, toDisplayString as L, unref as i, createVNode as F, createCommentVNode as K, h as $, watch as Ne, renderList as ke, onUnmounted as tn, reactive as Tt, isRef as pt, normalizeClass as Ce, normalizeStyle as Ut, createSlots as nn, Teleport as an, mergeProps as on } from "vue";
|
|
2
|
+
import { u as sn, _ as rn } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-sUxHOj47.js";
|
|
3
|
+
import { useCoreStore as Pt, useI18n as nt } from "@feedmepos/mf-common";
|
|
4
|
+
import { useSnackbar as Le, useDialog as ln, components as _e, useProxiedModel as Vt, useBreakpoints as cn } from "@feedmepos/ui-library";
|
|
5
|
+
import { m as un, u as ze, L as re, w as ee, q as Mt, s as Be, M as De, B as Te, c as dn, a as vt, j as mn } from "./app-BHZUr8QU.js";
|
|
6
|
+
import { defineStore as Nt, storeToRefs as fn } from "pinia";
|
|
7
|
+
import { b as et, e as Et, f as pn, a as Ae } from "./date2-B3oBITLt.js";
|
|
8
|
+
import { R as vn } from "./rules-CoadU_Kt.js";
|
|
9
|
+
import { e as yt, a as mt, t as Lt, c as Ee, l as zt, m as Ot, j as Ht, k as Yt, o as ne } from "./number-DEkRlbDc.js";
|
|
10
|
+
import { b as yn, d as gn } from "./xlsx.util-BYnsljpI.js";
|
|
11
|
+
import { u as bn } from "./stock-BP1UCYpf.js";
|
|
12
|
+
import { u as at } from "./stock-BZs2m7fO.js";
|
|
13
|
+
import { D as jt, R as Pe } from "./row-action.enum-DQ9bJ_uv.js";
|
|
14
|
+
import { c as hn } from "./component-kqxARxvM.js";
|
|
15
|
+
import { f as _n } from "./format-time-from-id--G-xmwZG.js";
|
|
16
|
+
import { f as kn } from "./recalculationUtils-ft9Xbq4D.js";
|
|
17
|
+
import { _ as wn } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BJDOinO3.js";
|
|
18
|
+
import { _ as xn } from "./empty-placeholder-B0QU467o.js";
|
|
19
|
+
import { F as ut } from "./FmAdminBadge-DjnBAgyv.js";
|
|
20
|
+
import { u as Dn } from "./vue-i18n-C2oCa59F.js";
|
|
21
|
+
import { F as An } from "./decimal-CC8SRMMj.js";
|
|
22
|
+
import { u as Cn } from "./useSseClient-CK86U3Y2.js";
|
|
23
|
+
import { r as Sn, u as Je, w as $n } from "./xlsx-DM4nr4wg.js";
|
|
24
|
+
import { d as Fn } from "./dayjs.min-VlCfBoGw.js";
|
|
25
|
+
import { F as In } from "./FmDroppableField-J0xUsOTV.js";
|
|
26
|
+
import { _ as Bn } from "./FmConfirmationButton.vue_vue_type_script_setup_true_lang-DLrMEGFR.js";
|
|
27
|
+
import { _ as Tn, F as Ze } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
|
|
28
|
+
const Oe = un((t, n) => {
|
|
29
|
+
function e() {
|
|
30
|
+
return ze().currentLocation.dbName;
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
getDbName: e,
|
|
34
|
+
async getDraft(s) {
|
|
35
|
+
const m = e(), u = `${t.inventoryBackendUrl}/${m}/closing-draft/${s}`;
|
|
36
|
+
return n.get(u);
|
|
37
|
+
},
|
|
38
|
+
async readDrafts() {
|
|
39
|
+
const s = e(), m = `${t.inventoryBackendUrl}/${s}/closing-draft`;
|
|
40
|
+
return n.get(m);
|
|
41
|
+
},
|
|
42
|
+
async runOperation(s) {
|
|
43
|
+
const m = e(), u = `${t.inventoryBackendUrl}/${m}/closing-draft/run-operation`;
|
|
44
|
+
return n.post(u, s);
|
|
45
|
+
},
|
|
46
|
+
async runOperationV1(s) {
|
|
47
|
+
const m = e(), u = `${t.inventoryBackendUrl}/${m}/closing-draft/v1/run-operation`;
|
|
48
|
+
return n.post(u, s);
|
|
49
|
+
},
|
|
50
|
+
async sync(s) {
|
|
51
|
+
const m = e(), u = `${t.inventoryBackendUrl}/${m}/closing-draft/sync`;
|
|
52
|
+
return n.post(u, s);
|
|
53
|
+
},
|
|
54
|
+
async cloneDraft(s) {
|
|
55
|
+
const m = e(), u = `${t.inventoryBackendUrl}/${m}/closing-draft/${s}/clone`;
|
|
56
|
+
return n.post(u, {});
|
|
57
|
+
},
|
|
58
|
+
async createQuickModeDraftWithItems(s) {
|
|
59
|
+
const m = e(), u = `${t.inventoryBackendUrl}/${m}/closing-draft/quick-mode/new-with-items`;
|
|
60
|
+
return n.post(u, s);
|
|
61
|
+
},
|
|
62
|
+
initializeStockSnapshot(s, m) {
|
|
63
|
+
const u = e(), a = `${t.inventoryBackendUrl}/${u}/closing-draft/${encodeURIComponent(s)}/initialize-stock-snapshot`;
|
|
64
|
+
return n.post(a, { effectiveAt: m });
|
|
65
|
+
},
|
|
66
|
+
async getRefreshBalanceStatus(s, m) {
|
|
67
|
+
const u = e(), a = `${t.inventoryBackendUrl}/${u}/closing-draft/${s}/refresh-balance/status?closingDraftRevision=${encodeURIComponent(m)}`;
|
|
68
|
+
return n.get(a);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}), jn = { class: "fm-typo-en-body-lg-400" }, Rn = { class: "fm-typo-en-body-lg-600" }, Un = {
|
|
72
|
+
key: 0,
|
|
73
|
+
class: "flex flex-col"
|
|
74
|
+
}, Pn = {
|
|
75
|
+
key: 0,
|
|
76
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-error mt-4"
|
|
77
|
+
}, Vn = { class: "flex gap-12 py-8 justify-end w-full" }, dt = /* @__PURE__ */ je({
|
|
78
|
+
__name: "ClosingDraftAction",
|
|
79
|
+
props: {
|
|
80
|
+
draft: {},
|
|
81
|
+
action: {},
|
|
82
|
+
onCancel: { type: Function },
|
|
83
|
+
onFinished: { type: Function }
|
|
84
|
+
},
|
|
85
|
+
setup(t) {
|
|
86
|
+
const n = t, e = O(), s = Oe(), m = Le(), u = O(!1), a = O(null), v = O(!1), x = P(() => {
|
|
87
|
+
switch (n.action) {
|
|
88
|
+
case re.enum.approveDraft:
|
|
89
|
+
return "Approve";
|
|
90
|
+
case re.enum.rejectDraft:
|
|
91
|
+
return "Reject";
|
|
92
|
+
case re.enum.markAsFailed:
|
|
93
|
+
return "Mark as Failed";
|
|
94
|
+
}
|
|
95
|
+
throw new Error(`Unknown action: ${n.action}`);
|
|
96
|
+
}), I = P(() => {
|
|
97
|
+
switch (n.action) {
|
|
98
|
+
case re.enum.approveDraft:
|
|
99
|
+
return "primary";
|
|
100
|
+
case re.enum.rejectDraft:
|
|
101
|
+
return "destructive";
|
|
102
|
+
case re.enum.markAsFailed:
|
|
103
|
+
return "destructive";
|
|
104
|
+
}
|
|
105
|
+
throw new Error(`Unknown action: ${n.action}`);
|
|
106
|
+
});
|
|
107
|
+
ft(() => {
|
|
108
|
+
if (n.draft.effectiveAt)
|
|
109
|
+
a.value = new Date(n.draft.effectiveAt);
|
|
110
|
+
else {
|
|
111
|
+
const b = new Date(n.draft.createdAt);
|
|
112
|
+
b.setHours(23, 59, 59, 999), a.value = b;
|
|
113
|
+
}
|
|
114
|
+
v.value = !0;
|
|
115
|
+
});
|
|
116
|
+
const d = P({
|
|
117
|
+
get() {
|
|
118
|
+
return a.value === null ? "" : et(a.value);
|
|
119
|
+
},
|
|
120
|
+
set(b) {
|
|
121
|
+
if (b) {
|
|
122
|
+
const y = /* @__PURE__ */ new Date(`${b} ${j.value}`);
|
|
123
|
+
y.setSeconds(59, 999), a.value = y;
|
|
124
|
+
} else
|
|
125
|
+
a.value = null;
|
|
126
|
+
}
|
|
127
|
+
}), j = P({
|
|
128
|
+
get() {
|
|
129
|
+
return a.value === null ? "" : Et(a.value);
|
|
130
|
+
},
|
|
131
|
+
set(b) {
|
|
132
|
+
if (b) {
|
|
133
|
+
const y = /* @__PURE__ */ new Date(`${d.value} ${b}`);
|
|
134
|
+
y.setSeconds(59, 999), a.value = y;
|
|
135
|
+
} else
|
|
136
|
+
a.value = null;
|
|
137
|
+
}
|
|
138
|
+
}), M = P(() => a.value ? a.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
|
|
139
|
+
async function N(b) {
|
|
140
|
+
u.value = !0;
|
|
141
|
+
try {
|
|
142
|
+
b ? await s.runOperationV1({
|
|
143
|
+
_id: n.draft._id,
|
|
144
|
+
_rev: n.draft._rev ?? "",
|
|
145
|
+
action: n.action,
|
|
146
|
+
data: {
|
|
147
|
+
effectiveAt: a.value ? a.value.toISOString() : null,
|
|
148
|
+
remark: e.value
|
|
149
|
+
}
|
|
150
|
+
}).delayed(500) : await s.runOperation({
|
|
151
|
+
_id: n.draft._id,
|
|
152
|
+
_rev: n.draft._rev ?? "",
|
|
153
|
+
action: n.action,
|
|
154
|
+
data: {
|
|
155
|
+
effectiveAt: a.value ? a.value.toISOString() : null,
|
|
156
|
+
remark: e.value
|
|
157
|
+
}
|
|
158
|
+
}).delayed(500), m.open({
|
|
159
|
+
title: "Success",
|
|
160
|
+
message: "Action submitted",
|
|
161
|
+
type: "success"
|
|
162
|
+
}), n.onFinished();
|
|
163
|
+
} catch (y) {
|
|
164
|
+
m.open({
|
|
165
|
+
title: "Something went wrong",
|
|
166
|
+
message: (y == null ? void 0 : y.message) ?? "Unable to submit action. Please try again",
|
|
167
|
+
type: "error"
|
|
168
|
+
}), console.error("error on submit closing draft action", y);
|
|
169
|
+
} finally {
|
|
170
|
+
u.value = !1;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return (b, y) => {
|
|
174
|
+
const E = q("FmLabel"), p = q("FmDatePicker"), r = q("FmTimePicker"), l = q("FmTextField"), _ = q("FmButton"), A = q("FmForm");
|
|
175
|
+
return v.value ? (w(), te(A, {
|
|
176
|
+
key: 1,
|
|
177
|
+
onValidationSuccess: N,
|
|
178
|
+
class: "flex flex-col gap-32",
|
|
179
|
+
disabled: u.value
|
|
180
|
+
}, {
|
|
181
|
+
default: Q(() => [
|
|
182
|
+
o("div", jn, [
|
|
183
|
+
y[4] || (y[4] = me(" You are about to ")),
|
|
184
|
+
o("span", Rn, L(x.value), 1),
|
|
185
|
+
y[5] || (y[5] = me(" this draft. Please provide a remark to justify this action. "))
|
|
186
|
+
]),
|
|
187
|
+
b.action === i(re).enum.approveDraft ? (w(), R("div", Un, [
|
|
188
|
+
F(E, { class: "fm-typo-en-body-lg-600" }, {
|
|
189
|
+
default: Q(() => y[6] || (y[6] = [
|
|
190
|
+
me("Closing Date")
|
|
191
|
+
])),
|
|
192
|
+
_: 1
|
|
193
|
+
}),
|
|
194
|
+
F(p, {
|
|
195
|
+
modelValue: d.value,
|
|
196
|
+
"onUpdate:modelValue": y[0] || (y[0] = (B) => d.value = B),
|
|
197
|
+
max: i(et)(/* @__PURE__ */ new Date())
|
|
198
|
+
}, null, 8, ["modelValue", "max"]),
|
|
199
|
+
F(E, { class: "fm-typo-en-body-lg-600" }, {
|
|
200
|
+
default: Q(() => y[7] || (y[7] = [
|
|
201
|
+
me("Closing Time")
|
|
202
|
+
])),
|
|
203
|
+
_: 1
|
|
204
|
+
}),
|
|
205
|
+
F(r, {
|
|
206
|
+
modelValue: j.value,
|
|
207
|
+
"onUpdate:modelValue": y[1] || (y[1] = (B) => j.value = B)
|
|
208
|
+
}, null, 8, ["modelValue"]),
|
|
209
|
+
M.value ? (w(), R("div", Pn, " Cannot select future date ")) : K("", !0)
|
|
210
|
+
])) : K("", !0),
|
|
211
|
+
F(l, {
|
|
212
|
+
modelValue: e.value,
|
|
213
|
+
"onUpdate:modelValue": y[2] || (y[2] = (B) => e.value = B),
|
|
214
|
+
label: "Remark",
|
|
215
|
+
"label-mark": "required",
|
|
216
|
+
rules: [i(vn)()]
|
|
217
|
+
}, null, 8, ["modelValue", "rules"]),
|
|
218
|
+
o("div", Vn, [
|
|
219
|
+
F(_, {
|
|
220
|
+
label: "Cancel",
|
|
221
|
+
variant: "tertiary",
|
|
222
|
+
onClick: y[3] || (y[3] = (B) => b.onCancel())
|
|
223
|
+
}),
|
|
224
|
+
F(_, {
|
|
225
|
+
label: x.value,
|
|
226
|
+
type: "submit",
|
|
227
|
+
variant: I.value,
|
|
228
|
+
loading: u.value
|
|
229
|
+
}, null, 8, ["label", "variant", "loading"])
|
|
230
|
+
])
|
|
231
|
+
]),
|
|
232
|
+
_: 1
|
|
233
|
+
}, 8, ["disabled"])) : (w(), R(ie, { key: 0 }, [
|
|
234
|
+
me("Loading")
|
|
235
|
+
], 64));
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
}), Mn = Ee(0);
|
|
239
|
+
function Kt(t) {
|
|
240
|
+
const n = t.measurementsAmounts.groupBy((s) => s.measurement.id), e = t.sku.unit.measurements.reduce((s, m) => {
|
|
241
|
+
var v, x;
|
|
242
|
+
const u = ((x = (v = n.get(m.id)) == null ? void 0 : v[0]) == null ? void 0 : x.amount) ?? Mn, a = yt(m.conversion, u);
|
|
243
|
+
return s + +mt(a);
|
|
244
|
+
}, +mt(t.baseAmount));
|
|
245
|
+
return Lt(e, t.baseAmount.precision);
|
|
246
|
+
}
|
|
247
|
+
const Nn = Ee(0), En = Ee(100);
|
|
248
|
+
function Ln(t, n, e, s, m, u, a, v) {
|
|
249
|
+
var H, se, V, C, le;
|
|
250
|
+
const x = Kt(t), I = s ?? x, d = zt(I, n), j = n.amount === 0 ? null : Ot(d, {
|
|
251
|
+
...n,
|
|
252
|
+
amount: Math.abs(n.amount)
|
|
253
|
+
}), M = j ? yt(j, En) : null, N = ((H = t.sku.defaultCost) == null ? void 0 : H.costPerUnit) ?? { amount: 0, precision: 0 }, b = Number(ee.toFormatString({ value: N })), y = ((V = (se = t.sku.defaultCost) == null ? void 0 : se.measurement) == null ? void 0 : V.conversion) ?? {
|
|
254
|
+
amount: 1,
|
|
255
|
+
precision: 0
|
|
256
|
+
}, E = Number(
|
|
257
|
+
ee.toFormatString({ value: y })
|
|
258
|
+
), p = m ? Number(ee.toFormatString({ value: m })) : 0, r = Number(ee.toFormatString({ value: n })), l = Number(ee.toFormatString({ value: I })), _ = l - r, A = _ * b / E, B = l * b / E, W = r * b / E, ae = {};
|
|
259
|
+
return a && u && a.forEach((D) => {
|
|
260
|
+
const Z = { amount: 0, precision: 0 }, J = u[D];
|
|
261
|
+
if (J) {
|
|
262
|
+
const fe = Ht(Z, J);
|
|
263
|
+
ae[`adjustment_${D}`] = mt(fe);
|
|
264
|
+
} else
|
|
265
|
+
ae[`adjustment_${D}`] = "0";
|
|
266
|
+
}), {
|
|
267
|
+
code: t.sku.code,
|
|
268
|
+
name: t.sku.name,
|
|
269
|
+
baseUnit: t.sku.unit.abbrev,
|
|
270
|
+
costUnit: ((le = (C = t.sku.defaultCost) == null ? void 0 : C.measurement) == null ? void 0 : le.abbrev) ?? null,
|
|
271
|
+
baseUnitAmount: Number(ee.toFormatString({ value: t.baseAmount })),
|
|
272
|
+
...t.measurementsAmounts.filter(
|
|
273
|
+
(D) => zn(D.measurement) && e.includes(D.measurement.id)
|
|
274
|
+
).reduce(
|
|
275
|
+
(D, Z, J) => (D[`measurementAbbrev${J}`] = `(${Z.measurement.abbrev}) × ${ee.toFormatString({ value: Z.measurement.conversion })}`, D[`measurementAmount${J}`] = Number(ee.toFormatString({ value: Z.amount })), D),
|
|
276
|
+
{}
|
|
277
|
+
),
|
|
278
|
+
systemBalance: r,
|
|
279
|
+
physicalBalance: l,
|
|
280
|
+
adjustedAmount: Number(ee.toFormatString({ value: d })),
|
|
281
|
+
adjustedDiffPercentage: M ? Number(
|
|
282
|
+
ee.toFormatString({
|
|
283
|
+
value: Yt(M, 2)
|
|
284
|
+
})
|
|
285
|
+
) : null,
|
|
286
|
+
costPerUnit: b,
|
|
287
|
+
opening: p,
|
|
288
|
+
...ae,
|
|
289
|
+
varianceQty: _,
|
|
290
|
+
varianceInCost: A,
|
|
291
|
+
stockTakeValue: B,
|
|
292
|
+
systemValue: W,
|
|
293
|
+
// Include custom attribute values
|
|
294
|
+
...(v ?? []).reduce(
|
|
295
|
+
(D, Z) => {
|
|
296
|
+
var fe;
|
|
297
|
+
const J = (fe = t.sku.customAttributes) == null ? void 0 : fe[Z];
|
|
298
|
+
return D[`customAttr_${Z}`] = J != null ? String(J) : null, D;
|
|
299
|
+
},
|
|
300
|
+
{}
|
|
301
|
+
)
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
function zn(t) {
|
|
305
|
+
return !t.abbrev.toLocaleLowerCase().includes("inactive");
|
|
306
|
+
}
|
|
307
|
+
function On(t) {
|
|
308
|
+
const n = Wt(t);
|
|
309
|
+
return t.reduce(
|
|
310
|
+
(e, s) => {
|
|
311
|
+
var m;
|
|
312
|
+
return Math.max(e, ((m = n == null ? void 0 : n.get(s.sku._id)) == null ? void 0 : m[0].length) ?? 0);
|
|
313
|
+
},
|
|
314
|
+
0
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
function Wt(t) {
|
|
318
|
+
return t.groupBy(
|
|
319
|
+
(n) => n.sku._id,
|
|
320
|
+
(n) => n.measurementsAmounts.filter((e) => !e.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((e) => e.measurement.id)
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
function Hn(t, n = [], e = []) {
|
|
324
|
+
const s = Mt(), m = s === "MYR" ? "RM" : s;
|
|
325
|
+
return [
|
|
326
|
+
{
|
|
327
|
+
id: "code",
|
|
328
|
+
name: "Code"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
id: "name",
|
|
332
|
+
name: "Name"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
id: "baseUnit",
|
|
336
|
+
name: "Base unit"
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
id: "costPerUnit",
|
|
340
|
+
name: "Cost per unit"
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
id: "costUnit",
|
|
344
|
+
name: "UOM"
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
id: "opening",
|
|
348
|
+
name: "Opening (B/F)"
|
|
349
|
+
},
|
|
350
|
+
// Dynamic adjustment type columns
|
|
351
|
+
...n.map((a) => ({
|
|
352
|
+
id: `adjustment_${a}`,
|
|
353
|
+
name: Be(a)
|
|
354
|
+
})),
|
|
355
|
+
{
|
|
356
|
+
id: "systemBalance",
|
|
357
|
+
name: "System balance (Qty)"
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
id: "physicalBalance",
|
|
361
|
+
name: "Stock take (Qty)"
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
id: "adjustedAmount",
|
|
365
|
+
name: "Variance"
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
id: "varianceInCost",
|
|
369
|
+
name: `Variance (${m})`
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
id: "adjustedDiffPercentage",
|
|
373
|
+
name: "Variance (%)"
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
id: "stockTakeValue",
|
|
377
|
+
name: `Stock take value (${m})`
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
id: "systemValue",
|
|
381
|
+
name: `System value (${m})`
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
id: "baseUnitAmount",
|
|
385
|
+
name: "Base unit amount"
|
|
386
|
+
},
|
|
387
|
+
...Array.from({ length: t }).flatMap((a, v) => [
|
|
388
|
+
{
|
|
389
|
+
id: `measurementAmount${v}`,
|
|
390
|
+
name: `UOM amount ${v + 1}`
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
id: `measurementAbbrev${v}`,
|
|
394
|
+
name: `UOM ${v + 1}`
|
|
395
|
+
}
|
|
396
|
+
]),
|
|
397
|
+
// Dynamic custom attribute columns
|
|
398
|
+
...e.map((a) => ({
|
|
399
|
+
id: `customAttr_${a}`,
|
|
400
|
+
name: Be(a)
|
|
401
|
+
}))
|
|
402
|
+
];
|
|
403
|
+
}
|
|
404
|
+
function Yn(t, n, e, s = []) {
|
|
405
|
+
var ae, oe, H, se, V, C, le;
|
|
406
|
+
const m = n.groupBy(
|
|
407
|
+
(D) => D.id,
|
|
408
|
+
(D) => D.balance
|
|
409
|
+
), u = e.groupBy(
|
|
410
|
+
(D) => D.id,
|
|
411
|
+
(D) => D.balance
|
|
412
|
+
), a = /* @__PURE__ */ new Map();
|
|
413
|
+
if (t.opening)
|
|
414
|
+
for (const D of t.opening)
|
|
415
|
+
a.set(D.skuId, D.balance);
|
|
416
|
+
const v = /* @__PURE__ */ new Set(), x = /* @__PURE__ */ new Map();
|
|
417
|
+
if (t.adjustmentSnapshot)
|
|
418
|
+
for (const D of t.adjustmentSnapshot)
|
|
419
|
+
D.adjustmentsByType && (Object.keys(D.adjustmentsByType).forEach((Z) => v.add(Z)), x.set(D.skuId, D.adjustmentsByType));
|
|
420
|
+
const I = ["receive", "sales", "wastage"], d = [];
|
|
421
|
+
I.forEach((D) => {
|
|
422
|
+
v.has(D) && (d.push(D), v.delete(D));
|
|
423
|
+
});
|
|
424
|
+
const j = Array.from(v).sort(), M = [...d, ...j], N = [...t.items, ...t.negativeStockItems ?? []], b = Wt(N), y = N.map((D) => {
|
|
425
|
+
var we, $e, Fe;
|
|
426
|
+
const Z = ((we = m.get(D.sku._id)) == null ? void 0 : we[0]) ?? Nn, J = (($e = b == null ? void 0 : b.get(D.sku._id)) == null ? void 0 : $e[0]) ?? [], fe = a.get(D.sku._id), Se = x.get(D.sku._id);
|
|
427
|
+
return Ln(
|
|
428
|
+
D,
|
|
429
|
+
Z,
|
|
430
|
+
J,
|
|
431
|
+
(Fe = u.get(D.sku._id)) == null ? void 0 : Fe[0],
|
|
432
|
+
fe,
|
|
433
|
+
Se,
|
|
434
|
+
M,
|
|
435
|
+
s
|
|
436
|
+
);
|
|
437
|
+
}), E = On(N), r = Pt().currentBusiness.value, l = Hn(E, M, s), _ = [
|
|
438
|
+
["Business name:", r == null ? void 0 : r.name],
|
|
439
|
+
["Business ID:", r == null ? void 0 : r._id],
|
|
440
|
+
["Menu version", r == null ? void 0 : r.menuVersion],
|
|
441
|
+
["Created at", new Date(t.createdAt)],
|
|
442
|
+
["Created by", (ae = t.createdBy) == null ? void 0 : ae.name],
|
|
443
|
+
["Updated at", new Date(t.updatedAt)],
|
|
444
|
+
["Updated by", (oe = t.updatedBy) == null ? void 0 : oe.name],
|
|
445
|
+
["Recent action", t.approvedAt ? "Approve" : t.rejectionHistory ? "Reject" : ""],
|
|
446
|
+
[
|
|
447
|
+
"Action by",
|
|
448
|
+
t.approvedAt ? (H = t.approvedBy) == null ? void 0 : H.name : t.rejectionHistory ? (V = (se = t.rejectionHistory[0]) == null ? void 0 : se.rejectedBy) == null ? void 0 : V.name : ""
|
|
449
|
+
],
|
|
450
|
+
[
|
|
451
|
+
"Action at",
|
|
452
|
+
t.approvedAt ? new Date(t.approvedAt) : t.rejectionHistory ? new Date((C = t.rejectionHistory[0]) == null ? void 0 : C.rejectedAt) : ""
|
|
453
|
+
],
|
|
454
|
+
[
|
|
455
|
+
"Action remark",
|
|
456
|
+
t.approvedAt ? t.approveRemark : t.rejectionHistory ? new Date((le = t.rejectionHistory[0]) == null ? void 0 : le.rejectRemark) : ""
|
|
457
|
+
],
|
|
458
|
+
[],
|
|
459
|
+
l.map((D) => D.name),
|
|
460
|
+
...y.map((D) => l.map((Z) => D[Z.id]))
|
|
461
|
+
], A = l.map((D) => `system:${D.id}`), B = yn(_, A), W = `[${r == null ? void 0 : r.name}] closing draft (${pn(new Date(t.updatedAt))}).xlsx`;
|
|
462
|
+
return gn(B, W), W;
|
|
463
|
+
}
|
|
464
|
+
const Kn = { class: "flex flex-col" }, Wn = {
|
|
465
|
+
key: 0,
|
|
466
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-error mt-4"
|
|
467
|
+
}, qn = { class: "flex gap-12 py-8 justify-end w-full" }, Gn = /* @__PURE__ */ je({
|
|
468
|
+
__name: "RefreshBalanceAction",
|
|
469
|
+
props: {
|
|
470
|
+
draft: {},
|
|
471
|
+
onCancel: { type: Function },
|
|
472
|
+
onFinished: { type: Function }
|
|
473
|
+
},
|
|
474
|
+
setup(t) {
|
|
475
|
+
const n = t;
|
|
476
|
+
at();
|
|
477
|
+
const e = O(!1), s = O(null), m = O(!1);
|
|
478
|
+
ft(() => {
|
|
479
|
+
if (n.draft.effectiveAt)
|
|
480
|
+
s.value = new Date(n.draft.effectiveAt);
|
|
481
|
+
else {
|
|
482
|
+
const I = new Date(n.draft.createdAt);
|
|
483
|
+
I.setHours(23, 59, 59, 999), s.value = I;
|
|
484
|
+
}
|
|
485
|
+
m.value = !0;
|
|
486
|
+
});
|
|
487
|
+
const u = P({
|
|
488
|
+
get() {
|
|
489
|
+
return s.value === null ? "" : et(s.value);
|
|
490
|
+
},
|
|
491
|
+
set(I) {
|
|
492
|
+
if (I) {
|
|
493
|
+
const d = /* @__PURE__ */ new Date(`${I} ${a.value}`);
|
|
494
|
+
d.setSeconds(59, 999), s.value = d;
|
|
495
|
+
} else
|
|
496
|
+
s.value = null;
|
|
497
|
+
}
|
|
498
|
+
}), a = P({
|
|
499
|
+
get() {
|
|
500
|
+
return s.value === null ? "" : Et(s.value);
|
|
501
|
+
},
|
|
502
|
+
set(I) {
|
|
503
|
+
if (I) {
|
|
504
|
+
const d = /* @__PURE__ */ new Date(`${u.value} ${I}`);
|
|
505
|
+
d.setSeconds(59, 999), s.value = d;
|
|
506
|
+
} else
|
|
507
|
+
s.value = null;
|
|
508
|
+
}
|
|
509
|
+
}), v = P(() => s.value ? s.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
|
|
510
|
+
async function x() {
|
|
511
|
+
e.value = !0, n.onFinished(s.value.toISOString());
|
|
512
|
+
}
|
|
513
|
+
return (I, d) => {
|
|
514
|
+
const j = q("FmLabel"), M = q("FmDatePicker"), N = q("FmTimePicker"), b = q("FmButton"), y = q("FmForm");
|
|
515
|
+
return m.value ? (w(), te(y, {
|
|
516
|
+
key: 1,
|
|
517
|
+
onValidationSuccess: x,
|
|
518
|
+
class: "flex flex-col gap-32",
|
|
519
|
+
disabled: e.value
|
|
520
|
+
}, {
|
|
521
|
+
default: Q(() => [
|
|
522
|
+
d[5] || (d[5] = o("div", { class: "fm-typo-en-body-lg-400" }, [
|
|
523
|
+
o("p", null, [
|
|
524
|
+
me(" Performing "),
|
|
525
|
+
o("span", { class: "fm-typo-en-body-lg-600" }, '"Refresh Balance"'),
|
|
526
|
+
me(" until closing effective date and time. ")
|
|
527
|
+
]),
|
|
528
|
+
o("p", { class: "mt-2" }, [
|
|
529
|
+
me(" Please note that this action will "),
|
|
530
|
+
o("b", null, "update"),
|
|
531
|
+
me(" the effective date and time. ")
|
|
532
|
+
])
|
|
533
|
+
], -1)),
|
|
534
|
+
o("div", Kn, [
|
|
535
|
+
F(j, { class: "fm-typo-en-body-lg-600" }, {
|
|
536
|
+
default: Q(() => d[3] || (d[3] = [
|
|
537
|
+
me("Closing Date")
|
|
538
|
+
])),
|
|
539
|
+
_: 1
|
|
540
|
+
}),
|
|
541
|
+
F(M, {
|
|
542
|
+
modelValue: u.value,
|
|
543
|
+
"onUpdate:modelValue": d[0] || (d[0] = (E) => u.value = E),
|
|
544
|
+
max: i(et)(/* @__PURE__ */ new Date())
|
|
545
|
+
}, null, 8, ["modelValue", "max"]),
|
|
546
|
+
F(j, { class: "fm-typo-en-body-lg-600" }, {
|
|
547
|
+
default: Q(() => d[4] || (d[4] = [
|
|
548
|
+
me("Closing Time")
|
|
549
|
+
])),
|
|
550
|
+
_: 1
|
|
551
|
+
}),
|
|
552
|
+
F(N, {
|
|
553
|
+
modelValue: a.value,
|
|
554
|
+
"onUpdate:modelValue": d[1] || (d[1] = (E) => a.value = E)
|
|
555
|
+
}, null, 8, ["modelValue"]),
|
|
556
|
+
v.value ? (w(), R("div", Wn, " Cannot select future date ")) : K("", !0)
|
|
557
|
+
]),
|
|
558
|
+
o("div", qn, [
|
|
559
|
+
F(b, {
|
|
560
|
+
label: "Cancel",
|
|
561
|
+
variant: "tertiary",
|
|
562
|
+
onClick: d[2] || (d[2] = (E) => I.onCancel())
|
|
563
|
+
}),
|
|
564
|
+
F(b, {
|
|
565
|
+
label: "Refresh balance",
|
|
566
|
+
type: "submit",
|
|
567
|
+
variant: "primary",
|
|
568
|
+
loading: e.value,
|
|
569
|
+
disabled: v.value
|
|
570
|
+
}, null, 8, ["loading", "disabled"])
|
|
571
|
+
])
|
|
572
|
+
]),
|
|
573
|
+
_: 1
|
|
574
|
+
}, 8, ["disabled"])) : (w(), R(ie, { key: 0 }, [
|
|
575
|
+
me("Loading")
|
|
576
|
+
], 64));
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
}), tt = Nt(
|
|
580
|
+
"closingDraftActions",
|
|
581
|
+
function() {
|
|
582
|
+
const n = ln(), e = Le(), s = at(), m = Oe(), u = bn(), a = O(!1), v = O();
|
|
583
|
+
function x(l) {
|
|
584
|
+
const _ = {
|
|
585
|
+
draft: l
|
|
586
|
+
};
|
|
587
|
+
v.value = _, a.value = !0;
|
|
588
|
+
}
|
|
589
|
+
async function I(l) {
|
|
590
|
+
var A;
|
|
591
|
+
if (l.status === De.enum.COMPLETED) {
|
|
592
|
+
const B = l.closingAdjustmentId;
|
|
593
|
+
if (!B)
|
|
594
|
+
return e.open({
|
|
595
|
+
title: "Something went wrong",
|
|
596
|
+
message: "Closing draft is completed but closing document cannot be found.",
|
|
597
|
+
type: "error"
|
|
598
|
+
}), console.error("Closing draft is completed but closing document cannot be found.", {
|
|
599
|
+
draftId: l._id
|
|
600
|
+
}), [];
|
|
601
|
+
const W = await s.readAdjustmentById(B);
|
|
602
|
+
return ((W == null ? void 0 : W.skus) ?? []).map((oe) => ({
|
|
603
|
+
id: oe.sku._id,
|
|
604
|
+
balance: oe.fromBalance,
|
|
605
|
+
costs: oe.fromCostBalances
|
|
606
|
+
}));
|
|
607
|
+
} else
|
|
608
|
+
return await u.readStockBalance(), ((A = u.stockBalance) == null ? void 0 : A.skus) ?? [];
|
|
609
|
+
}
|
|
610
|
+
async function d(l, _, A, B) {
|
|
611
|
+
_ || (e.open({
|
|
612
|
+
title: "Exporting",
|
|
613
|
+
message: "Fetching data..."
|
|
614
|
+
}), _ = await I(l)), Yn(l, _, A ?? [], B ?? []);
|
|
615
|
+
}
|
|
616
|
+
function j(l, _, A) {
|
|
617
|
+
n.open({
|
|
618
|
+
title: "Approve draft",
|
|
619
|
+
contentComponent: dt,
|
|
620
|
+
contentComponentProps: {
|
|
621
|
+
draft: l,
|
|
622
|
+
action: re.enum.approveDraft,
|
|
623
|
+
onFinished: () => {
|
|
624
|
+
n.close(), _ == null || _();
|
|
625
|
+
},
|
|
626
|
+
onCancel: () => {
|
|
627
|
+
n.close();
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}).onClose(() => {
|
|
631
|
+
A == null || A();
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
function M(l, _) {
|
|
635
|
+
n.open({
|
|
636
|
+
title: "Reject draft",
|
|
637
|
+
contentComponent: dt,
|
|
638
|
+
contentComponentProps: {
|
|
639
|
+
draft: l,
|
|
640
|
+
action: re.enum.rejectDraft,
|
|
641
|
+
onFinished: () => {
|
|
642
|
+
n.close(), _ == null || _();
|
|
643
|
+
},
|
|
644
|
+
onCancel: () => n.close()
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
function N(l, _) {
|
|
649
|
+
n.open({
|
|
650
|
+
title: "Mark draft as failed",
|
|
651
|
+
contentComponent: dt,
|
|
652
|
+
contentComponentProps: {
|
|
653
|
+
draft: l,
|
|
654
|
+
action: re.enum.markAsFailed,
|
|
655
|
+
onFinished: () => {
|
|
656
|
+
n.close(), _ == null || _();
|
|
657
|
+
},
|
|
658
|
+
onCancel: () => n.close()
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
async function b(l, _) {
|
|
663
|
+
await m.sync({
|
|
664
|
+
_id: l._id,
|
|
665
|
+
_rev: l._rev ?? "",
|
|
666
|
+
action: re.enum.approveDraft,
|
|
667
|
+
data: {
|
|
668
|
+
remark: l.remark ?? ""
|
|
669
|
+
}
|
|
670
|
+
}).delayed(500), e.open({
|
|
671
|
+
title: "Success",
|
|
672
|
+
message: "Sync requested",
|
|
673
|
+
type: "success"
|
|
674
|
+
}), _ == null || _();
|
|
675
|
+
}
|
|
676
|
+
function y() {
|
|
677
|
+
a.value = !1;
|
|
678
|
+
}
|
|
679
|
+
async function E(l, _, A) {
|
|
680
|
+
await n.open({
|
|
681
|
+
title: "Refresh balance",
|
|
682
|
+
contentComponent: Gn,
|
|
683
|
+
contentComponentProps: {
|
|
684
|
+
draft: l,
|
|
685
|
+
onFinished: (B) => {
|
|
686
|
+
n.close(), A == null || A(B);
|
|
687
|
+
},
|
|
688
|
+
onCancel: async () => {
|
|
689
|
+
n.close(), _ == null || _();
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
async function p(l) {
|
|
695
|
+
await n.open({
|
|
696
|
+
title: "Invalidate closing draft cache",
|
|
697
|
+
message: "It will invalidate opening and stock movement cache for this draft.",
|
|
698
|
+
primaryActions: { text: "Proceed", close: !0 },
|
|
699
|
+
secondaryActions: { text: "Cancel", close: !0 }
|
|
700
|
+
}).onPrimary(async () => {
|
|
701
|
+
await s.recalculation.scheduleInvalidateClosingDraftCache([l._id]), e.open({
|
|
702
|
+
title: "Success",
|
|
703
|
+
message: "Invalidate cache requested",
|
|
704
|
+
type: "success"
|
|
705
|
+
});
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
async function r(l, _) {
|
|
709
|
+
try {
|
|
710
|
+
e.open({
|
|
711
|
+
title: "Cloning",
|
|
712
|
+
message: "Creating a copy of the draft..."
|
|
713
|
+
}), await m.cloneDraft(l._id), e.open({
|
|
714
|
+
title: "Success",
|
|
715
|
+
message: "Draft cloned successfully",
|
|
716
|
+
type: "success"
|
|
717
|
+
}), _ == null || _();
|
|
718
|
+
} catch (A) {
|
|
719
|
+
e.open({
|
|
720
|
+
title: "Error",
|
|
721
|
+
message: (A == null ? void 0 : A.message) || "Failed to clone draft",
|
|
722
|
+
type: "error"
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
return {
|
|
727
|
+
viewDraft: x,
|
|
728
|
+
closeDraftDialog: y,
|
|
729
|
+
approveDraft: j,
|
|
730
|
+
rejectDraft: M,
|
|
731
|
+
markAsFailed: N,
|
|
732
|
+
syncDraft: b,
|
|
733
|
+
exportDraft: d,
|
|
734
|
+
refreshBalance: E,
|
|
735
|
+
cloneDraft: r,
|
|
736
|
+
viewClosingDraftShow: a,
|
|
737
|
+
viewClosingDraftProps: v,
|
|
738
|
+
invalidateDraftCache: p
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
);
|
|
742
|
+
function Xe(t) {
|
|
743
|
+
switch (t) {
|
|
744
|
+
case "DRAFT":
|
|
745
|
+
return "fm-status-badge-draft";
|
|
746
|
+
case "PROCESSING":
|
|
747
|
+
return "fm-status-badge-processing";
|
|
748
|
+
case "FAILED":
|
|
749
|
+
return "fm-status-badge-cancel";
|
|
750
|
+
case "COMPLETED":
|
|
751
|
+
return "fm-status-badge-complete";
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
const qt = Nt(
|
|
755
|
+
"closingDraftTable",
|
|
756
|
+
function() {
|
|
757
|
+
const { t: n } = nt(), e = Pt(), s = tt(), m = O(new Array()), u = O(0), a = O(!1), v = ze(), x = Oe();
|
|
758
|
+
async function I() {
|
|
759
|
+
if (m.value = [], !!v._currentLocation) {
|
|
760
|
+
a.value = !0;
|
|
761
|
+
try {
|
|
762
|
+
const [p] = await Promise.all([x.readDrafts()]).delayed(1e3);
|
|
763
|
+
m.value = j(p.reverse());
|
|
764
|
+
} catch (p) {
|
|
765
|
+
console.log("Something went wrong when fetching drafts:", p);
|
|
766
|
+
} finally {
|
|
767
|
+
a.value = !1;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
async function d(p) {
|
|
772
|
+
if (!m.value.find((r) => r._id) && v._currentLocation) {
|
|
773
|
+
a.value = !0;
|
|
774
|
+
try {
|
|
775
|
+
const [r] = await Promise.all([
|
|
776
|
+
x.getDraft(p),
|
|
777
|
+
new Promise((l) => setTimeout(l, 1e3))
|
|
778
|
+
]);
|
|
779
|
+
m.value = j([r]);
|
|
780
|
+
} catch (r) {
|
|
781
|
+
console.log("Something went wrong when fetching drafts:", r);
|
|
782
|
+
} finally {
|
|
783
|
+
a.value = !1;
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
function j(p) {
|
|
788
|
+
const r = kn(
|
|
789
|
+
p.filter((l) => !!l.closingId).map((l) => ({ closingId: l.closingId, draftCreatedAt: new Date(Te(l._id)) }))
|
|
790
|
+
);
|
|
791
|
+
return p.map((l) => ({
|
|
792
|
+
...l,
|
|
793
|
+
closingIdDisplay: l.closingId ? r.get(l.closingId) ?? null : null
|
|
794
|
+
}));
|
|
795
|
+
}
|
|
796
|
+
function M(p) {
|
|
797
|
+
m.value = m.value.map((r) => r._id === p._id ? {
|
|
798
|
+
...p,
|
|
799
|
+
_rev: p._rev,
|
|
800
|
+
closingIdDisplay: r.closingIdDisplay
|
|
801
|
+
} : r), u.value++;
|
|
802
|
+
}
|
|
803
|
+
function N(p) {
|
|
804
|
+
var _, A;
|
|
805
|
+
const r = p.items.length + (((_ = p.negativeStockItems) == null ? void 0 : _.length) ?? 0), l = (p == null ? void 0 : p.approveRemark) ?? ((A = p == null ? void 0 : p.rejectionHistory) == null ? void 0 : A.computeFirst((B) => B.rejectRemark)) ?? p.remark ?? "";
|
|
806
|
+
return { count: r, remark: l };
|
|
807
|
+
}
|
|
808
|
+
function b() {
|
|
809
|
+
s.closeDraftDialog(), I();
|
|
810
|
+
}
|
|
811
|
+
function y(p, r) {
|
|
812
|
+
switch (r = dn(r), p) {
|
|
813
|
+
case Pe.Details:
|
|
814
|
+
return s.viewDraft(r);
|
|
815
|
+
case Pe.Export:
|
|
816
|
+
return s.exportDraft(r);
|
|
817
|
+
case re.enum.approveDraft:
|
|
818
|
+
return s.approveDraft(r, b);
|
|
819
|
+
case re.enum.rejectDraft:
|
|
820
|
+
return s.rejectDraft(r, b);
|
|
821
|
+
case re.enum.markAsFailed:
|
|
822
|
+
return s.markAsFailed(r, b);
|
|
823
|
+
case Pe.Duplicate:
|
|
824
|
+
return s.cloneDraft(r, b);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
return {
|
|
828
|
+
columnDefs: [
|
|
829
|
+
{
|
|
830
|
+
id: "_id",
|
|
831
|
+
accessorKey: "_id",
|
|
832
|
+
header: () => n("inventory.closing.table.createdAt"),
|
|
833
|
+
cell(p) {
|
|
834
|
+
return _n(`${p.getValue()}`);
|
|
835
|
+
},
|
|
836
|
+
sortingFn: (p, r) => new Date(Te(p.original._id)).getTime() - new Date(Te(r.original._id)).getTime(),
|
|
837
|
+
enableSorting: !0
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
id: "closingId",
|
|
841
|
+
accessorFn: (p) => p.closingIdDisplay,
|
|
842
|
+
size: 160,
|
|
843
|
+
header: () => n("inventory.closing.draft.table.id"),
|
|
844
|
+
cell(p) {
|
|
845
|
+
return p.getValue();
|
|
846
|
+
},
|
|
847
|
+
enableSorting: !0
|
|
848
|
+
},
|
|
849
|
+
{
|
|
850
|
+
accessorKey: "effectiveAt",
|
|
851
|
+
header: () => n("inventory.closing.draft.table.effectiveAt"),
|
|
852
|
+
cell(p) {
|
|
853
|
+
const r = p.row.original;
|
|
854
|
+
let l = p.getValue();
|
|
855
|
+
return l || (l = Te(r._id)), Ae(l);
|
|
856
|
+
},
|
|
857
|
+
enableSorting: !0,
|
|
858
|
+
size: 230
|
|
859
|
+
},
|
|
860
|
+
{
|
|
861
|
+
id: "description",
|
|
862
|
+
accessorFn: (p) => {
|
|
863
|
+
const { count: r, remark: l } = N(p);
|
|
864
|
+
return `${r} ${l}`;
|
|
865
|
+
},
|
|
866
|
+
header: () => n("inventory.closing.draft.table.description"),
|
|
867
|
+
enableSorting: !0,
|
|
868
|
+
size: 350,
|
|
869
|
+
cell(p) {
|
|
870
|
+
const { count: r, remark: l } = N(p.row.original), _ = (A, B) => $("div", { class: "flex gap-4" }, [
|
|
871
|
+
$(
|
|
872
|
+
"span",
|
|
873
|
+
{ class: "fm-typo-en-body-sm-600 text-fm-color-typo-primary" },
|
|
874
|
+
`${A}:`
|
|
875
|
+
),
|
|
876
|
+
$(
|
|
877
|
+
"span",
|
|
878
|
+
{
|
|
879
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary",
|
|
880
|
+
style: "white-space: pre-wrap; word-break: break-word;"
|
|
881
|
+
},
|
|
882
|
+
`${B}`
|
|
883
|
+
)
|
|
884
|
+
]);
|
|
885
|
+
return $("div", { class: "flex flex-col gap-2", style: "width: 300px;" }, [
|
|
886
|
+
_(n("inventory.closing.draft.table.items"), r),
|
|
887
|
+
l ? _(n("inventory.closing.draft.table.remark"), l) : null
|
|
888
|
+
]);
|
|
889
|
+
}
|
|
890
|
+
},
|
|
891
|
+
{
|
|
892
|
+
id: "status",
|
|
893
|
+
accessorFn: (p) => p.status,
|
|
894
|
+
header: () => n("inventory.closing.table.status"),
|
|
895
|
+
enableSorting: !1,
|
|
896
|
+
cell(p) {
|
|
897
|
+
var W;
|
|
898
|
+
const r = p.row.original, l = r.status, _ = new Date(r.updatedAt), A = (W = r == null ? void 0 : r.rejectionHistory) == null ? void 0 : W.computeFirst((ae) => ae.rejectedAt), B = A ? new Date(A) : null;
|
|
899
|
+
return l === "DRAFT" && B ? B.getTime() > _.getTime() ? $(
|
|
900
|
+
"div",
|
|
901
|
+
{
|
|
902
|
+
class: "flex"
|
|
903
|
+
},
|
|
904
|
+
$(
|
|
905
|
+
"div",
|
|
906
|
+
{
|
|
907
|
+
class: ["fm-status-badge", Xe("FAILED")]
|
|
908
|
+
},
|
|
909
|
+
"Rejected"
|
|
910
|
+
)
|
|
911
|
+
) : $(
|
|
912
|
+
"div",
|
|
913
|
+
{
|
|
914
|
+
class: "flex"
|
|
915
|
+
},
|
|
916
|
+
$(
|
|
917
|
+
"div",
|
|
918
|
+
{
|
|
919
|
+
class: ["fm-status-badge", Xe("PROCESSING")]
|
|
920
|
+
},
|
|
921
|
+
"Updated"
|
|
922
|
+
)
|
|
923
|
+
) : $(
|
|
924
|
+
"div",
|
|
925
|
+
{
|
|
926
|
+
class: "flex"
|
|
927
|
+
},
|
|
928
|
+
$(
|
|
929
|
+
"div",
|
|
930
|
+
{
|
|
931
|
+
class: ["fm-status-badge", Xe(l)]
|
|
932
|
+
},
|
|
933
|
+
Be(l)
|
|
934
|
+
)
|
|
935
|
+
);
|
|
936
|
+
}
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
id: "updatedAt",
|
|
940
|
+
accessorFn: (p) => p.updatedAt,
|
|
941
|
+
header: () => n("inventory.closing.draft.table.lastUpdate"),
|
|
942
|
+
enableSorting: !0,
|
|
943
|
+
size: 200,
|
|
944
|
+
cell(p) {
|
|
945
|
+
var l;
|
|
946
|
+
const r = p.row.original;
|
|
947
|
+
return $("div", { class: "flex flex-col" }, [
|
|
948
|
+
$(
|
|
949
|
+
"div",
|
|
950
|
+
{ class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" },
|
|
951
|
+
((l = r.updatedBy) == null ? void 0 : l.name) ?? ""
|
|
952
|
+
),
|
|
953
|
+
$(
|
|
954
|
+
"div",
|
|
955
|
+
{ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
|
|
956
|
+
Ae(r.updatedAt)
|
|
957
|
+
)
|
|
958
|
+
]);
|
|
959
|
+
}
|
|
960
|
+
},
|
|
961
|
+
{
|
|
962
|
+
id: "action",
|
|
963
|
+
cell(p) {
|
|
964
|
+
var W;
|
|
965
|
+
const r = p.row.original, l = ((W = e.sessionUser.value) == null ? void 0 : W.role.isAdmin) ?? !1, _ = [
|
|
966
|
+
jt[Pe.Details],
|
|
967
|
+
jt[Pe.Export]
|
|
968
|
+
], A = [
|
|
969
|
+
{
|
|
970
|
+
translationKey: "inventory.closing.draft.approveDraft",
|
|
971
|
+
color: "text-fm-color-typo-primary",
|
|
972
|
+
value: re.enum.approveDraft
|
|
973
|
+
},
|
|
974
|
+
{
|
|
975
|
+
translationKey: "inventory.closing.draft.rejectDraft",
|
|
976
|
+
color: "text-fm-color-typo-error",
|
|
977
|
+
value: re.enum.rejectDraft
|
|
978
|
+
},
|
|
979
|
+
{
|
|
980
|
+
translationKey: "inventory.closing.draft.markAsFailed",
|
|
981
|
+
color: "text-fm-color-typo-error",
|
|
982
|
+
value: re.enum.markAsFailed
|
|
983
|
+
}
|
|
984
|
+
], B = l && r.status !== De.enum.DRAFT ? [
|
|
985
|
+
{
|
|
986
|
+
translationKey: "inventory.closing.draft.cloneDraft",
|
|
987
|
+
color: "text-fm-color-typo-primary",
|
|
988
|
+
value: Pe.Duplicate
|
|
989
|
+
}
|
|
990
|
+
] : [];
|
|
991
|
+
return hn(
|
|
992
|
+
[
|
|
993
|
+
..._,
|
|
994
|
+
...r.status === De.enum.DRAFT ? A : []
|
|
995
|
+
],
|
|
996
|
+
(ae) => y(ae, r),
|
|
997
|
+
B
|
|
998
|
+
);
|
|
999
|
+
},
|
|
1000
|
+
enableSorting: !1,
|
|
1001
|
+
size: 40,
|
|
1002
|
+
meta: {
|
|
1003
|
+
cellClass: "",
|
|
1004
|
+
headerClass: ""
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
],
|
|
1008
|
+
drafts: m,
|
|
1009
|
+
loading: a,
|
|
1010
|
+
tableKey: u,
|
|
1011
|
+
fetchDrafts: I,
|
|
1012
|
+
loadDraft: d,
|
|
1013
|
+
updateDraftRef: M
|
|
1014
|
+
};
|
|
1015
|
+
}
|
|
1016
|
+
), Qn = { class: "fm-typo-en-heading-lg-600" }, Zn = { class: "py-4" }, Jn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, Xn = { key: 0 }, ea = { class: "mt-4 flex gap-4" }, ta = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, na = { key: 0 }, aa = {
|
|
1017
|
+
key: 0,
|
|
1018
|
+
class: "mb-4"
|
|
1019
|
+
}, oa = { class: "flex flex-col gap-1 max-h-200 overflow-auto w-full" }, sa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ra = {
|
|
1020
|
+
key: 0,
|
|
1021
|
+
class: "text-fm-color-system-success-300 mr-1"
|
|
1022
|
+
}, la = {
|
|
1023
|
+
key: 1,
|
|
1024
|
+
class: "text-fm-color-system-error-300 mr-1"
|
|
1025
|
+
}, ia = { class: "fm-typo-en-body-md-400" }, ca = { class: "mt-4 flex gap-4" }, ua = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, da = {
|
|
1026
|
+
key: 0,
|
|
1027
|
+
class: "flex gap-4"
|
|
1028
|
+
}, ma = /* @__PURE__ */ je({
|
|
1029
|
+
__name: "ClosingDraftApprovalDialog",
|
|
1030
|
+
props: {
|
|
1031
|
+
show: { type: Boolean },
|
|
1032
|
+
refreshing: { type: Boolean },
|
|
1033
|
+
approving: { type: Boolean },
|
|
1034
|
+
draft: {}
|
|
1035
|
+
},
|
|
1036
|
+
emits: ["update:show", "refresh", "approve"],
|
|
1037
|
+
setup(t, { emit: n }) {
|
|
1038
|
+
const { FmStepper: e, FmStep: s, FmDialog: m, FmButton: u } = _e, { t: a } = Dn(), v = vt(), x = t, I = n, d = P(
|
|
1039
|
+
() => {
|
|
1040
|
+
var V, C;
|
|
1041
|
+
return ((V = x.draft) == null ? void 0 : V.stockSnapshot) && ((C = x.draft) == null ? void 0 : C.stockSnapshot) !== void 0;
|
|
1042
|
+
}
|
|
1043
|
+
), j = P(() => {
|
|
1044
|
+
var le, D, Z;
|
|
1045
|
+
const V = ((le = x.draft) == null ? void 0 : le.items.map((J) => ({
|
|
1046
|
+
id: J.sku._id,
|
|
1047
|
+
code: J.sku.code,
|
|
1048
|
+
name: J.sku.name
|
|
1049
|
+
}))) ?? [], C = ((Z = (D = x.draft) == null ? void 0 : D.negativeStockItems) == null ? void 0 : Z.map((J) => ({
|
|
1050
|
+
id: J.sku._id,
|
|
1051
|
+
code: J.sku.code,
|
|
1052
|
+
name: J.sku.name
|
|
1053
|
+
}))) ?? [];
|
|
1054
|
+
return [...V, ...C].reduce(
|
|
1055
|
+
(J, fe) => (J[fe.id] = fe, J),
|
|
1056
|
+
{}
|
|
1057
|
+
);
|
|
1058
|
+
}), M = P(
|
|
1059
|
+
() => {
|
|
1060
|
+
var V, C, le;
|
|
1061
|
+
return (((le = (C = (V = x.draft) == null ? void 0 : V.stockSnapshot) == null ? void 0 : C.filter((D) => D.balance.amount < 0)) == null ? void 0 : le.map((D) => {
|
|
1062
|
+
const Z = v.skuById[D.id];
|
|
1063
|
+
return Z ? {
|
|
1064
|
+
id: Z._id,
|
|
1065
|
+
code: Z.code,
|
|
1066
|
+
name: Z.name
|
|
1067
|
+
} : null;
|
|
1068
|
+
})) ?? []).filter((D) => D !== null);
|
|
1069
|
+
}
|
|
1070
|
+
), N = P(() => {
|
|
1071
|
+
var V;
|
|
1072
|
+
return d.value ? ((V = M.value) == null ? void 0 : V.filter((C) => !j.value[C.id]).map((C) => C.id)) ?? [] : [];
|
|
1073
|
+
}), b = P({
|
|
1074
|
+
get: () => x.show,
|
|
1075
|
+
set: (V) => I("update:show", V)
|
|
1076
|
+
}), y = O(1), E = () => y.value > 1, p = () => y.value > 2, r = () => !1;
|
|
1077
|
+
function l(V) {
|
|
1078
|
+
return V === 1 ? d.value : V === 2 ? N.value.length == 0 : !1;
|
|
1079
|
+
}
|
|
1080
|
+
const _ = P(() => !d.value || N.value.length > 0);
|
|
1081
|
+
function A(V) {
|
|
1082
|
+
let C = V + 1;
|
|
1083
|
+
for (; C <= 3 && l(C); ) C++;
|
|
1084
|
+
return C > 3 ? 3 : C;
|
|
1085
|
+
}
|
|
1086
|
+
function B(V) {
|
|
1087
|
+
let C = V - 1;
|
|
1088
|
+
for (; C >= 1 && l(C); ) C--;
|
|
1089
|
+
return C < 1 ? 1 : C;
|
|
1090
|
+
}
|
|
1091
|
+
function W() {
|
|
1092
|
+
return d.value ? _.value ? 3 : 2 : 1;
|
|
1093
|
+
}
|
|
1094
|
+
Ne(
|
|
1095
|
+
() => x.show,
|
|
1096
|
+
(V) => {
|
|
1097
|
+
V && (y.value = W());
|
|
1098
|
+
}
|
|
1099
|
+
), Ne(
|
|
1100
|
+
() => d.value,
|
|
1101
|
+
(V) => {
|
|
1102
|
+
V && y.value === 1 && (y.value = A(1));
|
|
1103
|
+
}
|
|
1104
|
+
), Ne(
|
|
1105
|
+
() => N.value.length,
|
|
1106
|
+
(V) => {
|
|
1107
|
+
V === 0 && y.value === 2 && (y.value = A(2));
|
|
1108
|
+
}
|
|
1109
|
+
);
|
|
1110
|
+
function ae() {
|
|
1111
|
+
I("refresh");
|
|
1112
|
+
}
|
|
1113
|
+
function oe() {
|
|
1114
|
+
y.value < 3 && (y.value = A(y.value));
|
|
1115
|
+
}
|
|
1116
|
+
function H() {
|
|
1117
|
+
y.value > 1 && (y.value = B(y.value));
|
|
1118
|
+
}
|
|
1119
|
+
function se() {
|
|
1120
|
+
I("approve");
|
|
1121
|
+
}
|
|
1122
|
+
return (V, C) => {
|
|
1123
|
+
const le = q("FmIcon");
|
|
1124
|
+
return w(), te(i(m), {
|
|
1125
|
+
modelValue: b.value,
|
|
1126
|
+
"onUpdate:modelValue": C[1] || (C[1] = (D) => b.value = D),
|
|
1127
|
+
"max-width": 600
|
|
1128
|
+
}, {
|
|
1129
|
+
"dialog-header": Q(() => [
|
|
1130
|
+
o("div", Qn, L(i(a)("inventory.closing.approval.title")), 1)
|
|
1131
|
+
]),
|
|
1132
|
+
default: Q(() => [
|
|
1133
|
+
o("div", Zn, [
|
|
1134
|
+
F(i(e), {
|
|
1135
|
+
modelValue: y.value,
|
|
1136
|
+
"onUpdate:modelValue": C[0] || (C[0] = (D) => y.value = D),
|
|
1137
|
+
orientation: "vertical"
|
|
1138
|
+
}, {
|
|
1139
|
+
default: Q(() => [
|
|
1140
|
+
F(i(s), {
|
|
1141
|
+
value: 1,
|
|
1142
|
+
title: i(a)("inventory.closing.approval.step.generateReport.title"),
|
|
1143
|
+
complete: E
|
|
1144
|
+
}, {
|
|
1145
|
+
default: Q(() => [
|
|
1146
|
+
o("div", Jn, L(i(a)("inventory.closing.approval.step.generateReport.description")), 1),
|
|
1147
|
+
y.value === 1 ? (w(), R("div", Xn, [
|
|
1148
|
+
F(i(u), {
|
|
1149
|
+
label: i(a)("inventory.stock.stock_balance.refreshBalance"),
|
|
1150
|
+
"prepend-icon": "refresh",
|
|
1151
|
+
variant: "secondary",
|
|
1152
|
+
loading: V.refreshing,
|
|
1153
|
+
onClick: ae
|
|
1154
|
+
}, null, 8, ["label", "loading"]),
|
|
1155
|
+
o("div", ea, [
|
|
1156
|
+
F(i(u), {
|
|
1157
|
+
label: i(a)("inventory.common.continue"),
|
|
1158
|
+
disabled: !d.value,
|
|
1159
|
+
onClick: oe
|
|
1160
|
+
}, null, 8, ["label", "disabled"])
|
|
1161
|
+
])
|
|
1162
|
+
])) : K("", !0)
|
|
1163
|
+
]),
|
|
1164
|
+
_: 1
|
|
1165
|
+
}, 8, ["title"]),
|
|
1166
|
+
F(i(s), {
|
|
1167
|
+
value: 2,
|
|
1168
|
+
title: i(a)("inventory.closing.approval.step.negativeItems.title"),
|
|
1169
|
+
disabled: () => !d.value,
|
|
1170
|
+
complete: p
|
|
1171
|
+
}, {
|
|
1172
|
+
default: Q(() => [
|
|
1173
|
+
o("div", ta, L(M.value.length > 0 ? `${i(a)("inventory.closing.approval.step.negativeItems.resolveMessage")} [${i(a)("inventory.closing.approval.step.negativeItems.itemsHeader")} (${N.value.length})]` : i(a)("inventory.closing.approval.step.negativeItems.noItemsMessage")), 1),
|
|
1174
|
+
y.value === 2 ? (w(), R("div", na, [
|
|
1175
|
+
M.value.length > 0 ? (w(), R("div", aa, [
|
|
1176
|
+
C[2] || (C[2] = o("div", { class: "fm-typo-en-body-md-600 mb-2" }, null, -1)),
|
|
1177
|
+
o("div", oa, [
|
|
1178
|
+
(w(!0), R(ie, null, ke(M.value, (D) => (w(), R("div", {
|
|
1179
|
+
key: D.id,
|
|
1180
|
+
class: "flex gap-8"
|
|
1181
|
+
}, [
|
|
1182
|
+
o("div", sa, [
|
|
1183
|
+
j.value[D.id] ? (w(), R("span", ra, [
|
|
1184
|
+
F(le, {
|
|
1185
|
+
name: "check_circle",
|
|
1186
|
+
size: "sm"
|
|
1187
|
+
})
|
|
1188
|
+
])) : (w(), R("span", la, [
|
|
1189
|
+
F(le, {
|
|
1190
|
+
name: "error",
|
|
1191
|
+
size: "sm"
|
|
1192
|
+
})
|
|
1193
|
+
])),
|
|
1194
|
+
me(" " + L(D.code), 1)
|
|
1195
|
+
]),
|
|
1196
|
+
o("div", ia, L(D.name), 1)
|
|
1197
|
+
]))), 128))
|
|
1198
|
+
])
|
|
1199
|
+
])) : K("", !0),
|
|
1200
|
+
o("div", ca, [
|
|
1201
|
+
F(i(u), {
|
|
1202
|
+
label: i(a)("inventory.common.back"),
|
|
1203
|
+
variant: "secondary",
|
|
1204
|
+
onClick: H
|
|
1205
|
+
}, null, 8, ["label"]),
|
|
1206
|
+
F(i(u), {
|
|
1207
|
+
label: i(a)("inventory.common.continue"),
|
|
1208
|
+
disabled: _.value,
|
|
1209
|
+
onClick: oe
|
|
1210
|
+
}, null, 8, ["label", "disabled"])
|
|
1211
|
+
])
|
|
1212
|
+
])) : K("", !0)
|
|
1213
|
+
]),
|
|
1214
|
+
_: 1
|
|
1215
|
+
}, 8, ["title", "disabled"]),
|
|
1216
|
+
F(i(s), {
|
|
1217
|
+
value: 3,
|
|
1218
|
+
title: i(a)("inventory.closing.approval.step.approval.title"),
|
|
1219
|
+
disabled: () => _.value,
|
|
1220
|
+
complete: r
|
|
1221
|
+
}, {
|
|
1222
|
+
default: Q(() => [
|
|
1223
|
+
o("div", ua, L(i(a)("inventory.closing.approval.step.approval.warning")), 1),
|
|
1224
|
+
y.value === 3 ? (w(), R("div", da, [
|
|
1225
|
+
F(i(u), {
|
|
1226
|
+
label: i(a)("inventory.common.back"),
|
|
1227
|
+
variant: "secondary",
|
|
1228
|
+
onClick: H
|
|
1229
|
+
}, null, 8, ["label"]),
|
|
1230
|
+
F(i(u), {
|
|
1231
|
+
label: i(a)("inventory.common.approve"),
|
|
1232
|
+
variant: "destructive",
|
|
1233
|
+
disabled: _.value,
|
|
1234
|
+
loading: V.approving,
|
|
1235
|
+
onClick: se
|
|
1236
|
+
}, null, 8, ["label", "disabled", "loading"])
|
|
1237
|
+
])) : K("", !0)
|
|
1238
|
+
]),
|
|
1239
|
+
_: 1
|
|
1240
|
+
}, 8, ["title", "disabled"])
|
|
1241
|
+
]),
|
|
1242
|
+
_: 1
|
|
1243
|
+
}, 8, ["modelValue"])
|
|
1244
|
+
])
|
|
1245
|
+
]),
|
|
1246
|
+
_: 1
|
|
1247
|
+
}, 8, ["modelValue"]);
|
|
1248
|
+
};
|
|
1249
|
+
}
|
|
1250
|
+
});
|
|
1251
|
+
function fa(t) {
|
|
1252
|
+
const n = Oe(), e = Cn(), s = Le(), m = O(!1), u = O(null);
|
|
1253
|
+
let a = !1, v = null, x = !1;
|
|
1254
|
+
function I() {
|
|
1255
|
+
N();
|
|
1256
|
+
const b = t.closingDraftId.value, y = t.currentRev.value;
|
|
1257
|
+
!b || !y || (a = !1, v = {
|
|
1258
|
+
type: "closing-draft",
|
|
1259
|
+
params: {
|
|
1260
|
+
draftId: b,
|
|
1261
|
+
locationId: n.getDbName(),
|
|
1262
|
+
closingDraftRevision: y
|
|
1263
|
+
}
|
|
1264
|
+
}, e.addStream(v, d).then((E) => {
|
|
1265
|
+
E != null && E.initialState && d(E.initialState);
|
|
1266
|
+
}).catch((E) => {
|
|
1267
|
+
console.error("Failed to add stream subscription", E);
|
|
1268
|
+
}));
|
|
1269
|
+
}
|
|
1270
|
+
async function d(b) {
|
|
1271
|
+
var y;
|
|
1272
|
+
if (console.log("handleRefreshStatus", { status: b, isCleanedUp: a, hasActiveRefresh: x }), a || !b) {
|
|
1273
|
+
u.value = b, m.value = !1;
|
|
1274
|
+
return;
|
|
1275
|
+
}
|
|
1276
|
+
if (!(b.closingDraftId && b.closingDraftId !== t.closingDraftId.value)) {
|
|
1277
|
+
if (u.value = b, b.message === "processing" || !b.completedAt && !b.message) {
|
|
1278
|
+
x = !0, m.value = !0;
|
|
1279
|
+
return;
|
|
1280
|
+
}
|
|
1281
|
+
if (b.message === "completed" || b.completedAt) {
|
|
1282
|
+
if (!x) {
|
|
1283
|
+
m.value = !1;
|
|
1284
|
+
return;
|
|
1285
|
+
}
|
|
1286
|
+
x = !1, await j();
|
|
1287
|
+
return;
|
|
1288
|
+
}
|
|
1289
|
+
x = !1, m.value = !1, s.open({
|
|
1290
|
+
title: "Refresh failed",
|
|
1291
|
+
message: "Failed to refresh stock balance. Please try again.",
|
|
1292
|
+
type: "error"
|
|
1293
|
+
}), (y = t.onError) == null || y.call(t, b.message ?? "Unknown error");
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
async function j() {
|
|
1297
|
+
const b = t.closingDraftId.value;
|
|
1298
|
+
if (!b) {
|
|
1299
|
+
m.value = !1;
|
|
1300
|
+
return;
|
|
1301
|
+
}
|
|
1302
|
+
try {
|
|
1303
|
+
const y = await n.getDraft(b);
|
|
1304
|
+
m.value = !1, t.onCompleted(y), s.open({
|
|
1305
|
+
title: "Balance refreshed",
|
|
1306
|
+
message: "Stock balance has been recalculated.",
|
|
1307
|
+
type: "success"
|
|
1308
|
+
});
|
|
1309
|
+
} catch {
|
|
1310
|
+
m.value = !1, s.open({
|
|
1311
|
+
title: "Refresh completed",
|
|
1312
|
+
message: "Balance was refreshed but failed to load updated data. Please reload.",
|
|
1313
|
+
type: "warning"
|
|
1314
|
+
});
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
async function M(b) {
|
|
1318
|
+
if (t.closingDraftId.value) {
|
|
1319
|
+
m.value = !0, x = !0, u.value = {
|
|
1320
|
+
requestId: "",
|
|
1321
|
+
closingDraftId: t.closingDraftId.value,
|
|
1322
|
+
closingDraftRevision: t.currentRev.value ?? "",
|
|
1323
|
+
message: "processing",
|
|
1324
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1325
|
+
};
|
|
1326
|
+
try {
|
|
1327
|
+
await n.initializeStockSnapshot(t.closingDraftId.value, b);
|
|
1328
|
+
} catch (y) {
|
|
1329
|
+
x = !1, m.value = !1, s.open({
|
|
1330
|
+
title: "Refresh failed",
|
|
1331
|
+
message: "Failed to start stock balance refresh. Please try again.",
|
|
1332
|
+
type: "error"
|
|
1333
|
+
}), console.error("error starting refresh", y);
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
function N() {
|
|
1338
|
+
a = !0, v && (e.removeStream(v, d).catch((b) => {
|
|
1339
|
+
console.error("Failed to remove stream subscription", b);
|
|
1340
|
+
}), v = null), m.value = !1, x = !1, u.value = null;
|
|
1341
|
+
}
|
|
1342
|
+
return tn(() => {
|
|
1343
|
+
N();
|
|
1344
|
+
}), {
|
|
1345
|
+
refreshing: m,
|
|
1346
|
+
refreshStatus: u,
|
|
1347
|
+
startListening: I,
|
|
1348
|
+
startRefresh: M,
|
|
1349
|
+
cleanup: N
|
|
1350
|
+
};
|
|
1351
|
+
}
|
|
1352
|
+
const pa = { class: "w-full flex flex-col gap-32" }, va = { class: "flex flex-col gap-4" }, ya = { class: "flex justify-between" }, ga = { class: "flex" }, ba = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, ha = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _a = { class: "flex gap-1" }, ka = {
|
|
1353
|
+
class: "fm-typo-en-body-lg-600",
|
|
1354
|
+
style: { "white-space": "pre-wrap", "word-break": "break-word" }
|
|
1355
|
+
}, wa = { class: "flex flex-col gap-16" }, xa = { class: "flex items-center" }, Da = {
|
|
1356
|
+
key: 0,
|
|
1357
|
+
class: "flex gap-8"
|
|
1358
|
+
}, Aa = {
|
|
1359
|
+
key: 0,
|
|
1360
|
+
class: "w-full flex flex-col items-center"
|
|
1361
|
+
}, Ca = { class: "flex items-center gap-8" }, Sa = { class: "flex flex-col gap-8" }, $a = { class: "flex gap-8" }, Fa = {
|
|
1362
|
+
key: 0,
|
|
1363
|
+
class: "flex gap-8"
|
|
1364
|
+
}, Ia = {
|
|
1365
|
+
key: 1,
|
|
1366
|
+
class: "flex gap-8 flex-wrap"
|
|
1367
|
+
}, Ba = { class: "overflow-x-auto" }, Ta = {
|
|
1368
|
+
key: 1,
|
|
1369
|
+
class: "flex-1 xs:w-screen xs:max-w-full"
|
|
1370
|
+
}, ja = {
|
|
1371
|
+
key: 0,
|
|
1372
|
+
class: "flex flex-col items-center gap-8 h-full"
|
|
1373
|
+
}, Ra = ["src"], Ua = {
|
|
1374
|
+
key: 1,
|
|
1375
|
+
class: "px-4 flex flex-col"
|
|
1376
|
+
}, Pa = { class: "flex gap-12 content-stretch" }, Va = {
|
|
1377
|
+
class: "flex flex-col w-24",
|
|
1378
|
+
name: "circles"
|
|
1379
|
+
}, Ma = { class: "flex-1 flex flex-col items-center" }, Na = { class: "flex-1 flex flex-col items-center" }, Ea = {
|
|
1380
|
+
class: "py-12 flex flex-col gap-4",
|
|
1381
|
+
name: "received-at header"
|
|
1382
|
+
}, La = { class: "fm-typo-en-body-lg-400" }, za = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Oa = { class: "flex gap-12 content-stretch" }, Ha = {
|
|
1383
|
+
class: "flex flex-col w-24",
|
|
1384
|
+
name: "circles"
|
|
1385
|
+
}, Ya = { class: "flex-1 flex flex-col items-center" }, Ka = {
|
|
1386
|
+
class: "py-12 flex flex-col gap-4 flex-1",
|
|
1387
|
+
name: "delivery details"
|
|
1388
|
+
}, Wa = { class: "flex flex-col gap-8" }, qa = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Ga = { class: "flex flex-col gap-4" }, Qa = { class: "flex items-center justify-between gap-8 w-full" }, Za = { class: "flex items-center gap-8" }, Ja = { class: "flex flex-col items-end" }, Xa = { class: "text-2xl font-semibold" }, Rt = "N/A", eo = /* @__PURE__ */ je({
|
|
1389
|
+
__name: "ClosingDraftDialog",
|
|
1390
|
+
props: {
|
|
1391
|
+
show: { type: Boolean },
|
|
1392
|
+
draft: {}
|
|
1393
|
+
},
|
|
1394
|
+
emits: ["submitted", "refresh"],
|
|
1395
|
+
setup(t, { emit: n }) {
|
|
1396
|
+
const e = t, s = P(() => {
|
|
1397
|
+
const f = Mt();
|
|
1398
|
+
return f === "MYR" ? "RM" : f;
|
|
1399
|
+
}), m = qt(), u = P(() => {
|
|
1400
|
+
var f, c;
|
|
1401
|
+
return (f = e.draft) != null && f.closingId ? ((c = m.drafts.find((k) => k._id === e.draft._id)) == null ? void 0 : c.closingIdDisplay) ?? null : null;
|
|
1402
|
+
}), a = tt(), v = Vt(e, "show"), x = O(!1), I = O(!1), d = O(new Array()), j = O(new Array()), M = O([]), N = at(), b = Le(), y = vt(), E = ze(), p = Tt({}), r = P(() => new Set(
|
|
1403
|
+
y.skus.filter((f) => {
|
|
1404
|
+
var c;
|
|
1405
|
+
return p[(c = f.customAttributes) == null ? void 0 : c.tag];
|
|
1406
|
+
}).map((f) => f._id)
|
|
1407
|
+
)), l = n, _ = P(() => {
|
|
1408
|
+
var f;
|
|
1409
|
+
return (f = e.draft) == null ? void 0 : f._id;
|
|
1410
|
+
}), A = P(() => {
|
|
1411
|
+
var f;
|
|
1412
|
+
return (f = e.draft) == null ? void 0 : f._rev;
|
|
1413
|
+
}), {
|
|
1414
|
+
refreshing: B,
|
|
1415
|
+
startListening: W,
|
|
1416
|
+
startRefresh: ae,
|
|
1417
|
+
cleanup: oe
|
|
1418
|
+
} = fa({
|
|
1419
|
+
closingDraftId: _,
|
|
1420
|
+
currentRev: A,
|
|
1421
|
+
onCompleted: (f) => {
|
|
1422
|
+
l("refresh", f), d.value = f.stockSnapshot ?? [], v.value = !1;
|
|
1423
|
+
}
|
|
1424
|
+
}), H = B, se = O({
|
|
1425
|
+
templateItem: !0,
|
|
1426
|
+
nonTemplateItem: !0
|
|
1427
|
+
}), V = P(() => {
|
|
1428
|
+
var c, k;
|
|
1429
|
+
const f = [...((c = e.draft) == null ? void 0 : c.items) ?? [], ...((k = e.draft) == null ? void 0 : k.negativeStockItems) ?? []];
|
|
1430
|
+
return r.value.size ? f.filter((g) => r.value.has(g.sku._id)) : f;
|
|
1431
|
+
}), C = P(() => {
|
|
1432
|
+
const f = V.value.map((c) => c.sku);
|
|
1433
|
+
return f.sort((c, k) => c.code.localeCompare(k.code)), f;
|
|
1434
|
+
}), le = P(() => V.value.groupBy(
|
|
1435
|
+
(c) => c.sku._id,
|
|
1436
|
+
(c) => c.measurementsAmounts.filter((k) => !k.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((k) => k.measurement.id)
|
|
1437
|
+
));
|
|
1438
|
+
ft(fe), Ne(
|
|
1439
|
+
() => e.show,
|
|
1440
|
+
async (f) => {
|
|
1441
|
+
if (!f) {
|
|
1442
|
+
oe();
|
|
1443
|
+
return;
|
|
1444
|
+
}
|
|
1445
|
+
Me.value = lt[0], fe(), se.value = {
|
|
1446
|
+
templateItem: !0,
|
|
1447
|
+
nonTemplateItem: !0
|
|
1448
|
+
}, W();
|
|
1449
|
+
},
|
|
1450
|
+
{ immediate: !0 }
|
|
1451
|
+
);
|
|
1452
|
+
const D = P(() => gt.value.reduce((f, c) => f + Number(c.stockTakeValue), 0)), Z = Ee(0), J = Ee(100);
|
|
1453
|
+
async function fe() {
|
|
1454
|
+
var c, k, g, h;
|
|
1455
|
+
if (!E._currentLocation) return;
|
|
1456
|
+
x.value = !0;
|
|
1457
|
+
const f = ((c = e.draft) == null ? void 0 : c.status) === De.enum.COMPLETED;
|
|
1458
|
+
j.value = [];
|
|
1459
|
+
try {
|
|
1460
|
+
if (await y.init(), f) {
|
|
1461
|
+
const X = e.draft.closingAdjustmentId;
|
|
1462
|
+
if (!X) {
|
|
1463
|
+
b.open({
|
|
1464
|
+
title: "Something went wrong",
|
|
1465
|
+
message: "Closing draft is completed but closing document cannot be found.",
|
|
1466
|
+
type: "error"
|
|
1467
|
+
}), console.error("Closing draft is completed but closing document cannot be found.", {
|
|
1468
|
+
draftId: (k = e.draft) == null ? void 0 : k._id
|
|
1469
|
+
});
|
|
1470
|
+
return;
|
|
1471
|
+
}
|
|
1472
|
+
const G = await N.readAdjustmentById(X), ve = (G == null ? void 0 : G.skus) ?? [];
|
|
1473
|
+
for (const ge of ve) {
|
|
1474
|
+
const Ie = {
|
|
1475
|
+
id: ge.sku._id,
|
|
1476
|
+
balance: ge.fromBalance,
|
|
1477
|
+
costs: ge.fromCostBalances
|
|
1478
|
+
}, U = {
|
|
1479
|
+
id: ge.sku._id,
|
|
1480
|
+
balance: ge.toBalance,
|
|
1481
|
+
costs: ge.toCostBalances
|
|
1482
|
+
};
|
|
1483
|
+
d.value.push(Ie), j.value.push(U);
|
|
1484
|
+
}
|
|
1485
|
+
} else
|
|
1486
|
+
d.value = ((g = e.draft) == null ? void 0 : g.stockSnapshot) ?? [];
|
|
1487
|
+
const S = /* @__PURE__ */ new Set();
|
|
1488
|
+
if ((h = e.draft) != null && h.adjustmentSnapshot)
|
|
1489
|
+
for (const X of e.draft.adjustmentSnapshot)
|
|
1490
|
+
X.adjustmentsByType && Object.keys(X.adjustmentsByType).forEach((G) => {
|
|
1491
|
+
S.add(G);
|
|
1492
|
+
});
|
|
1493
|
+
const T = ["receive", "sales", "wastage"], z = [];
|
|
1494
|
+
T.forEach((X) => {
|
|
1495
|
+
S.has(X) && (z.push(X), S.delete(X));
|
|
1496
|
+
});
|
|
1497
|
+
const Y = Array.from(S).sort();
|
|
1498
|
+
M.value = [...z, ...Y];
|
|
1499
|
+
} catch (S) {
|
|
1500
|
+
b.open({
|
|
1501
|
+
title: "Something went wrong",
|
|
1502
|
+
message: "Something went wrong when fetching info. Please try again.",
|
|
1503
|
+
type: "error"
|
|
1504
|
+
}), console.error("error on fetch stock balances", S);
|
|
1505
|
+
} finally {
|
|
1506
|
+
x.value = !1;
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
async function Se() {
|
|
1510
|
+
var c, k;
|
|
1511
|
+
if (!(((c = e.draft) == null ? void 0 : c.effectiveAt) ?? (e.draft ? Te((k = e.draft) == null ? void 0 : k._id) : null))) {
|
|
1512
|
+
b.open({
|
|
1513
|
+
title: "Cannot refresh",
|
|
1514
|
+
message: "Effective date is not available for this draft.",
|
|
1515
|
+
type: "error"
|
|
1516
|
+
});
|
|
1517
|
+
return;
|
|
1518
|
+
}
|
|
1519
|
+
await a.refreshBalance(
|
|
1520
|
+
e.draft,
|
|
1521
|
+
() => {
|
|
1522
|
+
},
|
|
1523
|
+
async (g) => {
|
|
1524
|
+
await ae(g);
|
|
1525
|
+
}
|
|
1526
|
+
);
|
|
1527
|
+
}
|
|
1528
|
+
async function we() {
|
|
1529
|
+
var c, k;
|
|
1530
|
+
if (!(((c = e.draft) == null ? void 0 : c.effectiveAt) ?? (e.draft ? Te((k = e.draft) == null ? void 0 : k._id) : null))) {
|
|
1531
|
+
b.open({
|
|
1532
|
+
title: "Cannot refresh",
|
|
1533
|
+
message: "Effective date is not available for this draft.",
|
|
1534
|
+
type: "error"
|
|
1535
|
+
});
|
|
1536
|
+
return;
|
|
1537
|
+
}
|
|
1538
|
+
await a.invalidateDraftCache(e.draft);
|
|
1539
|
+
}
|
|
1540
|
+
const $e = P(
|
|
1541
|
+
() => d.value.groupBy(
|
|
1542
|
+
(f) => f.id,
|
|
1543
|
+
(f) => f.balance
|
|
1544
|
+
)
|
|
1545
|
+
), Fe = P(() => V.value.groupBy((f) => f.sku._id)), He = P(() => {
|
|
1546
|
+
var f;
|
|
1547
|
+
return (f = e.draft) != null && f.adjustmentSnapshot ? new Map(e.draft.adjustmentSnapshot.map((c) => [c.skuId, c.adjustmentsByType])) : /* @__PURE__ */ new Map();
|
|
1548
|
+
}), Ye = P(() => {
|
|
1549
|
+
var f;
|
|
1550
|
+
return (f = e.draft) != null && f.opening ? new Map(e.draft.opening.map((c) => [c.skuId, c.balance])) : /* @__PURE__ */ new Map();
|
|
1551
|
+
});
|
|
1552
|
+
function ue(f, c) {
|
|
1553
|
+
return $(
|
|
1554
|
+
_e.FmTooltip,
|
|
1555
|
+
{ zIndex: 51, placement: "left", class: "w-full flex justify-end" },
|
|
1556
|
+
{
|
|
1557
|
+
default() {
|
|
1558
|
+
return f;
|
|
1559
|
+
},
|
|
1560
|
+
content() {
|
|
1561
|
+
return c || f;
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
);
|
|
1565
|
+
}
|
|
1566
|
+
const Ve = P(() => {
|
|
1567
|
+
const f = C.value.reduce((k, g) => {
|
|
1568
|
+
var h, S;
|
|
1569
|
+
return Math.max(k, ((S = (h = le.value) == null ? void 0 : h.get(g._id)) == null ? void 0 : S[0].length) ?? 0);
|
|
1570
|
+
}, 0);
|
|
1571
|
+
return [
|
|
1572
|
+
{
|
|
1573
|
+
id: "sku",
|
|
1574
|
+
accessorFn: (k) => `${k.code} ${k.name}`,
|
|
1575
|
+
header: () => "Name",
|
|
1576
|
+
size: 350,
|
|
1577
|
+
cell(k) {
|
|
1578
|
+
const g = k.row.original, h = g.adjustedDiffPercentage, S = typeof h == "number" && Math.abs(h) > 10, T = $("div", { class: "flex flex-col gap-4" }, [
|
|
1579
|
+
$(
|
|
1580
|
+
"div",
|
|
1581
|
+
{
|
|
1582
|
+
class: [
|
|
1583
|
+
"line-clamp-1 fm-typo-en-body-lg-400",
|
|
1584
|
+
S ? " text-fm-color-system-error-300" : "text-fm-color-typo-primary"
|
|
1585
|
+
]
|
|
1586
|
+
},
|
|
1587
|
+
g.name
|
|
1588
|
+
),
|
|
1589
|
+
$(
|
|
1590
|
+
"div",
|
|
1591
|
+
{
|
|
1592
|
+
class: [
|
|
1593
|
+
"line-clamp-1 fm-typo-en-body-md-400",
|
|
1594
|
+
S ? " text-fm-color-system-error-300" : "text-fm-color-typo-secondary"
|
|
1595
|
+
]
|
|
1596
|
+
},
|
|
1597
|
+
g.code
|
|
1598
|
+
)
|
|
1599
|
+
]);
|
|
1600
|
+
return $(
|
|
1601
|
+
_e.FmTooltip,
|
|
1602
|
+
{
|
|
1603
|
+
zIndex: 51
|
|
1604
|
+
},
|
|
1605
|
+
{
|
|
1606
|
+
content() {
|
|
1607
|
+
return S ? "Adjustment difference is more than 10%." : `${g.code} - ${g.name}`;
|
|
1608
|
+
},
|
|
1609
|
+
default() {
|
|
1610
|
+
return $("div", { class: "flex items-center gap-4 justify-start w-full" }, [
|
|
1611
|
+
T
|
|
1612
|
+
]);
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
);
|
|
1616
|
+
}
|
|
1617
|
+
},
|
|
1618
|
+
// Dynamic custom attribute columns (toggled by user)
|
|
1619
|
+
...bt.value.map(
|
|
1620
|
+
(k) => ({
|
|
1621
|
+
id: `customAttr_${k}`,
|
|
1622
|
+
accessorFn: (g) => g.customAttributeValues[k],
|
|
1623
|
+
header: () => ue(Be(k)),
|
|
1624
|
+
size: 160,
|
|
1625
|
+
cell(g) {
|
|
1626
|
+
const h = g.row.original.customAttributeValues[k];
|
|
1627
|
+
return h == null ? "N/A" : typeof h == "number" ? $("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(h)) : $("div", { class: "text-right fm-typo-en-body-lg-400" }, String(h));
|
|
1628
|
+
},
|
|
1629
|
+
meta: {
|
|
1630
|
+
textAlign: "right"
|
|
1631
|
+
}
|
|
1632
|
+
})
|
|
1633
|
+
),
|
|
1634
|
+
{
|
|
1635
|
+
id: "costPerUnit",
|
|
1636
|
+
accessorKey: "costPerUnit",
|
|
1637
|
+
header: () => ue("Cost per unit"),
|
|
1638
|
+
size: 160,
|
|
1639
|
+
cell(k) {
|
|
1640
|
+
const g = k.row.original.costPerUnit;
|
|
1641
|
+
return $("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(g));
|
|
1642
|
+
},
|
|
1643
|
+
meta: {
|
|
1644
|
+
textAlign: "right"
|
|
1645
|
+
}
|
|
1646
|
+
},
|
|
1647
|
+
{
|
|
1648
|
+
id: "costUnit",
|
|
1649
|
+
header: () => "UOM",
|
|
1650
|
+
size: 120,
|
|
1651
|
+
cell(k) {
|
|
1652
|
+
var z;
|
|
1653
|
+
const g = k.row.original, h = g.costUnit, S = g.baseUnit, T = h ?? S;
|
|
1654
|
+
if (h && h !== S) {
|
|
1655
|
+
const Y = C.value.find((G) => G._id === g.id), X = (z = Y == null ? void 0 : Y.defaultCost) == null ? void 0 : z.measurement;
|
|
1656
|
+
if (X) {
|
|
1657
|
+
const G = X.conversion.amount / Math.pow(10, X.conversion.precision);
|
|
1658
|
+
return $("div", { class: "flex flex-col" }, [
|
|
1659
|
+
$(
|
|
1660
|
+
"span",
|
|
1661
|
+
{ class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
|
|
1662
|
+
T
|
|
1663
|
+
),
|
|
1664
|
+
$("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, [
|
|
1665
|
+
"1 ",
|
|
1666
|
+
$("span", { class: "fm-typo-en-body-sm-600" }, h),
|
|
1667
|
+
` = ${G} `,
|
|
1668
|
+
$("span", { class: "fm-typo-en-body-sm-600" }, S)
|
|
1669
|
+
])
|
|
1670
|
+
]);
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
return T;
|
|
1674
|
+
}
|
|
1675
|
+
},
|
|
1676
|
+
{
|
|
1677
|
+
id: "opening",
|
|
1678
|
+
accessorKey: "opening",
|
|
1679
|
+
header: () => ue("Opening (B/F)", "The opening balance brought forward from previous period."),
|
|
1680
|
+
size: 150,
|
|
1681
|
+
cell(k) {
|
|
1682
|
+
const g = k.row.original.opening;
|
|
1683
|
+
return $("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(g));
|
|
1684
|
+
},
|
|
1685
|
+
meta: {
|
|
1686
|
+
textAlign: "right"
|
|
1687
|
+
}
|
|
1688
|
+
},
|
|
1689
|
+
// Dynamic adjustment type columns
|
|
1690
|
+
...M.value.map(
|
|
1691
|
+
(k) => ({
|
|
1692
|
+
id: `adjustment_${k}`,
|
|
1693
|
+
accessorFn: (g) => g.adjustmentAmounts[k] ?? { amount: 0, precision: 0 },
|
|
1694
|
+
header: () => ue(Be(k)),
|
|
1695
|
+
size: 150,
|
|
1696
|
+
cell(g) {
|
|
1697
|
+
const h = g.row.original.adjustmentAmounts[k] ?? { amount: 0, precision: 0 };
|
|
1698
|
+
return $("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(h));
|
|
1699
|
+
},
|
|
1700
|
+
meta: {
|
|
1701
|
+
textAlign: "right"
|
|
1702
|
+
}
|
|
1703
|
+
})
|
|
1704
|
+
),
|
|
1705
|
+
{
|
|
1706
|
+
id: "systemBalance",
|
|
1707
|
+
accessorKey: "systemBalance",
|
|
1708
|
+
header: () => ue("System Balance", "The system calculated balance before stock take."),
|
|
1709
|
+
size: 200,
|
|
1710
|
+
cell(k) {
|
|
1711
|
+
const g = k.row.original.systemBalance;
|
|
1712
|
+
return $("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(g));
|
|
1713
|
+
},
|
|
1714
|
+
meta: {
|
|
1715
|
+
textAlign: "right"
|
|
1716
|
+
}
|
|
1717
|
+
},
|
|
1718
|
+
{
|
|
1719
|
+
id: "physicalBalance",
|
|
1720
|
+
accessorFn: (k) => {
|
|
1721
|
+
var h;
|
|
1722
|
+
const g = (h = j.value.find((S) => S.id === k.id)) == null ? void 0 : h.balance;
|
|
1723
|
+
return g ? An.toDouble(g) : k.physicalBalance;
|
|
1724
|
+
},
|
|
1725
|
+
header: () => ue("Stock Take balance", "The physical balance recorded during stock take."),
|
|
1726
|
+
cell(k) {
|
|
1727
|
+
var Y;
|
|
1728
|
+
const g = k.row.original, h = ee.fromNumber(g.physicalBalance);
|
|
1729
|
+
let S = !0;
|
|
1730
|
+
const T = (Y = j.value.find((X) => X.id === g.id)) == null ? void 0 : Y.balance;
|
|
1731
|
+
let z;
|
|
1732
|
+
return T && !ee.equals({ a: h, b: T }) ? (S = !1, z = ne(T)) : z = ne(g.physicalBalance), $("div", { class: "flex flex-col" }, [
|
|
1733
|
+
$(
|
|
1734
|
+
"span",
|
|
1735
|
+
{ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
|
|
1736
|
+
z
|
|
1737
|
+
),
|
|
1738
|
+
S ? null : $(
|
|
1739
|
+
"span",
|
|
1740
|
+
{ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
|
|
1741
|
+
`Draft: ${ne(g.physicalBalance)}`
|
|
1742
|
+
)
|
|
1743
|
+
]);
|
|
1744
|
+
},
|
|
1745
|
+
size: 200,
|
|
1746
|
+
meta: {
|
|
1747
|
+
textAlign: "right"
|
|
1748
|
+
}
|
|
1749
|
+
},
|
|
1750
|
+
{
|
|
1751
|
+
id: "adjustedAmount",
|
|
1752
|
+
accessorKey: "adjustedAmount",
|
|
1753
|
+
header: () => ue("Variance", "The difference between Stock Take balance and System Balance."),
|
|
1754
|
+
size: 200,
|
|
1755
|
+
cell(k) {
|
|
1756
|
+
const g = k.row.original.adjustedAmount;
|
|
1757
|
+
return $("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(g));
|
|
1758
|
+
},
|
|
1759
|
+
meta: {
|
|
1760
|
+
textAlign: "right"
|
|
1761
|
+
}
|
|
1762
|
+
},
|
|
1763
|
+
{
|
|
1764
|
+
id: "varianceInCost",
|
|
1765
|
+
accessorKey: "varianceInCost",
|
|
1766
|
+
header: () => ue(`Variance (${s.value})`),
|
|
1767
|
+
size: 150,
|
|
1768
|
+
cell(k) {
|
|
1769
|
+
const g = k.row.original.varianceInCost;
|
|
1770
|
+
return $("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(g));
|
|
1771
|
+
},
|
|
1772
|
+
meta: {
|
|
1773
|
+
textAlign: "right"
|
|
1774
|
+
}
|
|
1775
|
+
},
|
|
1776
|
+
{
|
|
1777
|
+
id: "adjustedDiffPercentage",
|
|
1778
|
+
accessorKey: "adjustedDiffPercentage",
|
|
1779
|
+
header: () => ue(
|
|
1780
|
+
"Variance (%)",
|
|
1781
|
+
"Difference between Stock Take balance and System Balance in percentage."
|
|
1782
|
+
),
|
|
1783
|
+
size: 200,
|
|
1784
|
+
cell(k) {
|
|
1785
|
+
const g = k.row.original.adjustedDiffPercentage;
|
|
1786
|
+
if (g == null)
|
|
1787
|
+
return $(
|
|
1788
|
+
"div",
|
|
1789
|
+
{ class: "flex items-center gap-4 justify-end fm-typo-en-body-lg-400" },
|
|
1790
|
+
Rt
|
|
1791
|
+
);
|
|
1792
|
+
const h = ne(g);
|
|
1793
|
+
if (g === 0)
|
|
1794
|
+
return $("div", { class: "flex items-center gap-4 justify-end fm-typo-en-body-lg-400" }, [
|
|
1795
|
+
ne(0)
|
|
1796
|
+
]);
|
|
1797
|
+
const S = g > 0;
|
|
1798
|
+
return $("div", { class: "flex items-center gap-4 justify-end fm-typo-en-body-lg-400" }, [
|
|
1799
|
+
$(_e.FmIcon, {
|
|
1800
|
+
name: S ? "arrow_drop_up" : "arrow_drop_down",
|
|
1801
|
+
color: S ? "system-success-300" : "system-error-300",
|
|
1802
|
+
size: "md"
|
|
1803
|
+
}),
|
|
1804
|
+
h
|
|
1805
|
+
]);
|
|
1806
|
+
},
|
|
1807
|
+
meta: {
|
|
1808
|
+
textAlign: "right"
|
|
1809
|
+
}
|
|
1810
|
+
},
|
|
1811
|
+
{
|
|
1812
|
+
id: "stockTakeValue",
|
|
1813
|
+
accessorKey: "stockTakeValue",
|
|
1814
|
+
header: () => ue(`Stock take value (${s.value})`),
|
|
1815
|
+
size: 180,
|
|
1816
|
+
cell(k) {
|
|
1817
|
+
var X;
|
|
1818
|
+
const g = k.row.original, h = g.stockTakeValue, S = C.value.find((G) => G._id === g.id), T = (X = S == null ? void 0 : S.defaultCost) == null ? void 0 : X.measurement, z = g.physicalBalance, Y = g.costPerUnit;
|
|
1819
|
+
if (T) {
|
|
1820
|
+
const G = ee.toFormatString({ value: T.conversion }), ve = `${ne(z, { minPrecision: 2, maxPrecision: 4 })} ${g.baseUnit} ÷ ${G} × ${Y} ${s.value}`;
|
|
1821
|
+
return $(
|
|
1822
|
+
_e.FmTooltip,
|
|
1823
|
+
{ zIndex: 51 },
|
|
1824
|
+
{
|
|
1825
|
+
content() {
|
|
1826
|
+
return ve;
|
|
1827
|
+
},
|
|
1828
|
+
default() {
|
|
1829
|
+
return $(
|
|
1830
|
+
"div",
|
|
1831
|
+
{ class: "text-right w-full fm-typo-en-body-lg-400" },
|
|
1832
|
+
ne(h)
|
|
1833
|
+
);
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
);
|
|
1837
|
+
} else {
|
|
1838
|
+
const G = `${ne(z, { minPrecision: 2, maxPrecision: 4 })} ${g.baseUnit} × ${Y} ${s.value}`;
|
|
1839
|
+
return $(
|
|
1840
|
+
_e.FmTooltip,
|
|
1841
|
+
{ zIndex: 51 },
|
|
1842
|
+
{
|
|
1843
|
+
content() {
|
|
1844
|
+
return G;
|
|
1845
|
+
},
|
|
1846
|
+
default() {
|
|
1847
|
+
return $(
|
|
1848
|
+
"div",
|
|
1849
|
+
{ class: "text-right w-full fm-typo-en-body-lg-400" },
|
|
1850
|
+
ne(h)
|
|
1851
|
+
);
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
);
|
|
1855
|
+
}
|
|
1856
|
+
},
|
|
1857
|
+
meta: {
|
|
1858
|
+
textAlign: "right"
|
|
1859
|
+
}
|
|
1860
|
+
},
|
|
1861
|
+
{
|
|
1862
|
+
id: "systemValue",
|
|
1863
|
+
accessorKey: "systemValue",
|
|
1864
|
+
header: () => ue(`System value (${s.value})`),
|
|
1865
|
+
size: 180,
|
|
1866
|
+
cell(k) {
|
|
1867
|
+
var X;
|
|
1868
|
+
const g = k.row.original, h = g.systemValue, S = C.value.find((G) => G._id === g.id), T = (X = S == null ? void 0 : S.defaultCost) == null ? void 0 : X.measurement, z = g.systemBalance, Y = g.costPerUnit;
|
|
1869
|
+
if (T) {
|
|
1870
|
+
const G = ee.toFormatString({ value: T.conversion }), ve = `${ne(z, { minPrecision: 2, maxPrecision: 4 })} ${g.baseUnit} ÷ ${G} × ${Y} ${s.value}`;
|
|
1871
|
+
return $(
|
|
1872
|
+
_e.FmTooltip,
|
|
1873
|
+
{ zIndex: 51 },
|
|
1874
|
+
{
|
|
1875
|
+
content() {
|
|
1876
|
+
return ve;
|
|
1877
|
+
},
|
|
1878
|
+
default() {
|
|
1879
|
+
return $(
|
|
1880
|
+
"div",
|
|
1881
|
+
{ class: "text-right fm-typo-en-body-lg-400" },
|
|
1882
|
+
ne(h)
|
|
1883
|
+
);
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
);
|
|
1887
|
+
} else {
|
|
1888
|
+
const G = `${ne(z, { minPrecision: 2, maxPrecision: 4 })} ${g.baseUnit} × ${Y} ${s.value}`;
|
|
1889
|
+
return $(
|
|
1890
|
+
_e.FmTooltip,
|
|
1891
|
+
{ zIndex: 51 },
|
|
1892
|
+
{
|
|
1893
|
+
content() {
|
|
1894
|
+
return G;
|
|
1895
|
+
},
|
|
1896
|
+
default() {
|
|
1897
|
+
return $(
|
|
1898
|
+
"div",
|
|
1899
|
+
{ class: "text-right fm-typo-en-body-lg-400" },
|
|
1900
|
+
ne(h)
|
|
1901
|
+
);
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
);
|
|
1905
|
+
}
|
|
1906
|
+
},
|
|
1907
|
+
meta: {
|
|
1908
|
+
textAlign: "right"
|
|
1909
|
+
}
|
|
1910
|
+
},
|
|
1911
|
+
{
|
|
1912
|
+
id: "physicalBalances",
|
|
1913
|
+
header: () => "Amounts",
|
|
1914
|
+
enableSorting: !1,
|
|
1915
|
+
cell(k) {
|
|
1916
|
+
const g = k.row.original, h = (T, z) => $(
|
|
1917
|
+
_e.FmTooltip,
|
|
1918
|
+
{ zIndex: 50 },
|
|
1919
|
+
{
|
|
1920
|
+
default() {
|
|
1921
|
+
return $(
|
|
1922
|
+
"div",
|
|
1923
|
+
{
|
|
1924
|
+
class: "fm-typo-en-body-lg-400 py-4 px-8 border-1 border-fm-color-typo-secondary fm-corner-radius-md line-clamp-1"
|
|
1925
|
+
},
|
|
1926
|
+
[
|
|
1927
|
+
$("span", { class: "text-fm-color-typo-primary" }, `${T} `),
|
|
1928
|
+
$(
|
|
1929
|
+
"span",
|
|
1930
|
+
{
|
|
1931
|
+
class: "text-fm-color-typo-secondary",
|
|
1932
|
+
style: { maxWidth: "80px" }
|
|
1933
|
+
},
|
|
1934
|
+
z
|
|
1935
|
+
)
|
|
1936
|
+
]
|
|
1937
|
+
);
|
|
1938
|
+
},
|
|
1939
|
+
content() {
|
|
1940
|
+
return `${T} ${z}`;
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
);
|
|
1944
|
+
let S = Array.from({ length: f }).map((T, z) => {
|
|
1945
|
+
if (!g[`measurementAmount${z}`])
|
|
1946
|
+
return null;
|
|
1947
|
+
const Y = g[`measurementAmount${z}`], X = g[`measurementAbbrev${z}`];
|
|
1948
|
+
return h(Y, X);
|
|
1949
|
+
}).filter((T) => T);
|
|
1950
|
+
return (g.baseUnitAmount || !S.length) && (S = [h(g.baseUnitAmount, g.baseUnit), ...S]), $(
|
|
1951
|
+
"div",
|
|
1952
|
+
{
|
|
1953
|
+
class: "flex gap-8 flex-nowrap",
|
|
1954
|
+
style: {
|
|
1955
|
+
minWidth: `${120 * S.length}px`
|
|
1956
|
+
}
|
|
1957
|
+
},
|
|
1958
|
+
S
|
|
1959
|
+
);
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
];
|
|
1963
|
+
}), ot = P(() => Ve.value.map((f) => f.size ?? 0).reduce((f, c) => f + c)), st = O(""), gt = P(() => {
|
|
1964
|
+
var k, g;
|
|
1965
|
+
const f = ((g = (k = e.draft) == null ? void 0 : k.negativeStockItems) == null ? void 0 : g.reduce(
|
|
1966
|
+
(h, S) => (h[S.sku._id] = S, h),
|
|
1967
|
+
{}
|
|
1968
|
+
)) ?? {};
|
|
1969
|
+
return C.value.map((h) => {
|
|
1970
|
+
var kt, wt, xt, Dt, At, Ct, St, $t, Ft, It, Bt;
|
|
1971
|
+
const S = (kt = Fe.value.get(h._id)) == null ? void 0 : kt[0], T = ((wt = $e.value.get(h._id)) == null ? void 0 : wt[0]) ?? Z, z = ((xt = h.defaultCost) == null ? void 0 : xt.costPerUnit) ?? Z, Y = Number(ee.toFormatString({ value: z })), X = ((At = (Dt = h.defaultCost) == null ? void 0 : Dt.measurement) == null ? void 0 : At.conversion) ?? {
|
|
1972
|
+
amount: 1,
|
|
1973
|
+
precision: 0
|
|
1974
|
+
}, G = Number(
|
|
1975
|
+
ee.toFormatString({ value: X })
|
|
1976
|
+
), ve = Ye.value.get(h._id), ge = ve ? Number(ee.toFormatString({ value: ve })) : 0, Ie = He.value.get(h._id), U = {};
|
|
1977
|
+
if (M.value.forEach((de) => {
|
|
1978
|
+
const be = U[de] ?? { amount: 0, precision: 0 }, he = Ie == null ? void 0 : Ie[de];
|
|
1979
|
+
he && (U[de] = Ht(be, he));
|
|
1980
|
+
}), !S) {
|
|
1981
|
+
const de = Number(ee.toFormatString({ value: T })), be = 0 - de, he = be * Y / G, Qe = 0, en = de * Y / G;
|
|
1982
|
+
return {
|
|
1983
|
+
id: h._id,
|
|
1984
|
+
code: h.code,
|
|
1985
|
+
name: h.name,
|
|
1986
|
+
costUnit: ((St = (Ct = h.defaultCost) == null ? void 0 : Ct.measurement) == null ? void 0 : St.abbrev) ?? null,
|
|
1987
|
+
baseUnit: h.unit.abbrev,
|
|
1988
|
+
baseUnitAmount: 0,
|
|
1989
|
+
systemBalance: de,
|
|
1990
|
+
physicalBalance: 0,
|
|
1991
|
+
adjustedAmount: -de,
|
|
1992
|
+
adjustedDiffPercentage: -100,
|
|
1993
|
+
isTemplateItem: !f[h._id],
|
|
1994
|
+
costPerUnit: Y,
|
|
1995
|
+
opening: ge,
|
|
1996
|
+
varianceQty: be,
|
|
1997
|
+
varianceInCost: he,
|
|
1998
|
+
stockTakeValue: Qe,
|
|
1999
|
+
systemValue: en,
|
|
2000
|
+
adjustmentAmounts: U,
|
|
2001
|
+
customAttributeValues: h.customAttributes ?? {}
|
|
2002
|
+
};
|
|
2003
|
+
}
|
|
2004
|
+
const ce = Kt(S), pe = (Ft = ($t = j.value) == null ? void 0 : $t.find(
|
|
2005
|
+
(de) => de.id === h._id
|
|
2006
|
+
)) == null ? void 0 : Ft.balance, xe = zt(
|
|
2007
|
+
pe ?? ce,
|
|
2008
|
+
T
|
|
2009
|
+
), Ue = T.amount === 0 ? null : Ot(xe, {
|
|
2010
|
+
...T,
|
|
2011
|
+
amount: Math.abs(T.amount)
|
|
2012
|
+
}), Ge = Ue ? yt(Ue, J) : null, it = Number(ee.toFormatString({ value: T })), ct = Number(ee.toFormatString({ value: ce })), _t = ct - it, Zt = _t * Y / G, Jt = ct * Y / G, Xt = it * Y / G;
|
|
2013
|
+
return {
|
|
2014
|
+
id: h._id,
|
|
2015
|
+
code: h.code,
|
|
2016
|
+
name: h.name,
|
|
2017
|
+
costUnit: ((Bt = (It = h.defaultCost) == null ? void 0 : It.measurement) == null ? void 0 : Bt.abbrev) ?? null,
|
|
2018
|
+
baseUnit: h.unit.abbrev,
|
|
2019
|
+
baseUnitAmount: Number(ee.toFormatString({ value: S.baseAmount })),
|
|
2020
|
+
...S.measurementsAmounts.filter((de) => {
|
|
2021
|
+
var be, he, Qe;
|
|
2022
|
+
return (Qe = (he = (be = le.value) == null ? void 0 : be.get(h._id)) == null ? void 0 : he[0]) == null ? void 0 : Qe.includes(de.measurement.id);
|
|
2023
|
+
}).reduce((de, be, he) => (de[`measurementAbbrev${he}`] = `(${be.measurement.abbrev}) × ${ee.toFormatString({ value: be.measurement.conversion })}`, de[`measurementAmount${he}`] = Number(ee.toFormatString({ value: be.amount })), de), {}),
|
|
2024
|
+
systemBalance: it,
|
|
2025
|
+
physicalBalance: ct,
|
|
2026
|
+
adjustedAmount: Number(ee.toFormatString({ value: xe })),
|
|
2027
|
+
adjustedDiffPercentage: Ge ? Number(
|
|
2028
|
+
ee.toFormatString({
|
|
2029
|
+
value: Yt(Ge, 2)
|
|
2030
|
+
})
|
|
2031
|
+
) : null,
|
|
2032
|
+
isTemplateItem: !f[h._id],
|
|
2033
|
+
costPerUnit: Y,
|
|
2034
|
+
opening: ge,
|
|
2035
|
+
varianceQty: _t,
|
|
2036
|
+
varianceInCost: Zt,
|
|
2037
|
+
stockTakeValue: Jt,
|
|
2038
|
+
systemValue: Xt,
|
|
2039
|
+
adjustmentAmounts: U,
|
|
2040
|
+
customAttributeValues: h.customAttributes ?? {}
|
|
2041
|
+
};
|
|
2042
|
+
}).filter((h) => !!(h.isTemplateItem && se.value.templateItem || !h.isTemplateItem && se.value.nonTemplateItem));
|
|
2043
|
+
}), rt = P(() => {
|
|
2044
|
+
const f = /* @__PURE__ */ new Set();
|
|
2045
|
+
for (const c of C.value)
|
|
2046
|
+
if (c.customAttributes)
|
|
2047
|
+
for (const k of Object.keys(c.customAttributes))
|
|
2048
|
+
k !== "tag" && f.add(k);
|
|
2049
|
+
return Array.from(f).sort();
|
|
2050
|
+
}), Ke = Tt({}), bt = P(
|
|
2051
|
+
() => rt.value.filter((f) => Ke[f])
|
|
2052
|
+
), Gt = P(() => {
|
|
2053
|
+
var c, k, g, h, S;
|
|
2054
|
+
if (!e.draft) return [];
|
|
2055
|
+
const f = e.draft.approvedAt ? {
|
|
2056
|
+
action: `Approve at ${Ae(e.draft.approvedAt)}`,
|
|
2057
|
+
// actionAt: props.draft.approvedAt,
|
|
2058
|
+
actionBy: e.draft.approvedBy,
|
|
2059
|
+
remark: e.draft.approveRemark
|
|
2060
|
+
} : (c = e.draft.rejectionHistory) == null ? void 0 : c.computeFirst((T) => ({
|
|
2061
|
+
action: `Reject at ${Ae(T.rejectedAt)}`,
|
|
2062
|
+
// actionAt: e.rejectedAt,
|
|
2063
|
+
actionBy: T.rejectedBy,
|
|
2064
|
+
remark: T.rejectRemark
|
|
2065
|
+
}));
|
|
2066
|
+
return [
|
|
2067
|
+
u.value ? {
|
|
2068
|
+
label: "ID",
|
|
2069
|
+
value: u.value
|
|
2070
|
+
} : null,
|
|
2071
|
+
{
|
|
2072
|
+
label: "Location",
|
|
2073
|
+
value: ((k = E._currentLocation) == null ? void 0 : k.name) ?? Rt
|
|
2074
|
+
},
|
|
2075
|
+
{
|
|
2076
|
+
label: "Created at",
|
|
2077
|
+
value: Ae(e.draft.createdAt)
|
|
2078
|
+
},
|
|
2079
|
+
{
|
|
2080
|
+
label: "Created by",
|
|
2081
|
+
value: e.draft.createdBy.name
|
|
2082
|
+
},
|
|
2083
|
+
{
|
|
2084
|
+
label: "Updated at",
|
|
2085
|
+
value: Ae(e.draft.updatedAt)
|
|
2086
|
+
},
|
|
2087
|
+
{
|
|
2088
|
+
label: "Updated by",
|
|
2089
|
+
value: e.draft.updatedBy.name
|
|
2090
|
+
},
|
|
2091
|
+
{
|
|
2092
|
+
label: "Effective at",
|
|
2093
|
+
value: Ae(e.draft.effectiveAt ?? Te((g = e.draft) == null ? void 0 : g._id))
|
|
2094
|
+
},
|
|
2095
|
+
{
|
|
2096
|
+
label: "Using template",
|
|
2097
|
+
value: ((h = e.draft.usingTemplates.find((T) => T)) == null ? void 0 : h.name) ?? "None"
|
|
2098
|
+
},
|
|
2099
|
+
e.draft.remark ? {
|
|
2100
|
+
label: "Remark",
|
|
2101
|
+
value: e.draft.remark
|
|
2102
|
+
} : null,
|
|
2103
|
+
f ? {
|
|
2104
|
+
label: "Last action",
|
|
2105
|
+
value: f.action
|
|
2106
|
+
} : null,
|
|
2107
|
+
f && f.actionBy ? {
|
|
2108
|
+
label: "Last action by",
|
|
2109
|
+
value: (S = f.actionBy) == null ? void 0 : S.name
|
|
2110
|
+
} : null,
|
|
2111
|
+
f && f.remark ? {
|
|
2112
|
+
label: "Action remark",
|
|
2113
|
+
value: f.remark
|
|
2114
|
+
} : null
|
|
2115
|
+
].filter((T) => T).map((T) => T);
|
|
2116
|
+
}), lt = [
|
|
2117
|
+
{
|
|
2118
|
+
label: "Overview",
|
|
2119
|
+
value: "overview"
|
|
2120
|
+
},
|
|
2121
|
+
{
|
|
2122
|
+
label: "Action history",
|
|
2123
|
+
value: "history"
|
|
2124
|
+
}
|
|
2125
|
+
], Me = O(lt[0]), Re = P(() => {
|
|
2126
|
+
var g, h, S;
|
|
2127
|
+
const f = ((g = e.draft) == null ? void 0 : g.activityLogs) ?? [], c = ((h = e.draft) == null ? void 0 : h.rejectionHistory) ?? [];
|
|
2128
|
+
for (const T of c)
|
|
2129
|
+
f.find(
|
|
2130
|
+
(Y) => `${Y.action}_${Y.performedAt}` == `${re.enum.rejectDraft}_${T.rejectedAt}`
|
|
2131
|
+
) || f.push({
|
|
2132
|
+
action: re.enum.rejectDraft,
|
|
2133
|
+
performedAt: T.rejectedAt,
|
|
2134
|
+
performedBy: T.rejectedBy,
|
|
2135
|
+
remark: T.rejectRemark
|
|
2136
|
+
});
|
|
2137
|
+
return (S = e.draft) != null && S.approvedAt && (f.find(
|
|
2138
|
+
(z) => {
|
|
2139
|
+
var Y;
|
|
2140
|
+
return `${z.action}_${z.performedAt}` == `${re.enum.approveDraft}_${(Y = e.draft) == null ? void 0 : Y.approvedAt}`;
|
|
2141
|
+
}
|
|
2142
|
+
) || f.push({
|
|
2143
|
+
action: re.enum.approveDraft,
|
|
2144
|
+
performedAt: e.draft.approvedAt,
|
|
2145
|
+
performedBy: e.draft.approvedBy ?? { name: "Unknown", id: "unknown" },
|
|
2146
|
+
remark: e.draft.approveRemark
|
|
2147
|
+
})), f.sort((T, z) => new Date(z.performedAt).getTime() - new Date(T.performedAt).getTime()).map(
|
|
2148
|
+
(T) => ({
|
|
2149
|
+
header: Be(T.action),
|
|
2150
|
+
date: Ae(T.performedAt),
|
|
2151
|
+
info: [
|
|
2152
|
+
{
|
|
2153
|
+
label: "Performed by",
|
|
2154
|
+
values: [T.performedBy.name]
|
|
2155
|
+
},
|
|
2156
|
+
{
|
|
2157
|
+
label: "Remark",
|
|
2158
|
+
values: [T.remark ?? ""]
|
|
2159
|
+
}
|
|
2160
|
+
]
|
|
2161
|
+
})
|
|
2162
|
+
);
|
|
2163
|
+
}), We = O(!1), qe = O(!1), ht = P(() => {
|
|
2164
|
+
var f;
|
|
2165
|
+
return ((f = e.draft) == null ? void 0 : f.status) !== De.enum.DRAFT ? "Status is not draft." : null;
|
|
2166
|
+
});
|
|
2167
|
+
function Qt() {
|
|
2168
|
+
e.draft && (qe.value = !0, a.approveDraft(
|
|
2169
|
+
e.draft,
|
|
2170
|
+
() => {
|
|
2171
|
+
qe.value = !1, We.value = !1, l("submitted");
|
|
2172
|
+
},
|
|
2173
|
+
() => {
|
|
2174
|
+
qe.value = !1;
|
|
2175
|
+
}
|
|
2176
|
+
));
|
|
2177
|
+
}
|
|
2178
|
+
return (f, c) => {
|
|
2179
|
+
const k = q("FmButtonGroup"), g = q("FmMenuDivider"), h = q("FmCard"), S = q("FmButton"), T = q("FmCircularProgress"), z = q("FmChip"), Y = q("FmTextField"), X = q("FmIcon"), G = q("FmTable"), ve = q("FmSpacer"), ge = q("FmTooltip"), Ie = q("FmSideSheet");
|
|
2180
|
+
return w(), R(ie, null, [
|
|
2181
|
+
F(Ie, {
|
|
2182
|
+
"dismiss-away": "",
|
|
2183
|
+
"max-width": 9999,
|
|
2184
|
+
"model-value": i(v),
|
|
2185
|
+
"onUpdate:modelValue": c[9] || (c[9] = (U) => pt(v) ? v.value = U : null),
|
|
2186
|
+
header: "Closing details"
|
|
2187
|
+
}, {
|
|
2188
|
+
"side-sheet-footer": Q(() => {
|
|
2189
|
+
var U, ce, pe, xe;
|
|
2190
|
+
return [
|
|
2191
|
+
o("div", Qa, [
|
|
2192
|
+
o("div", Za, [
|
|
2193
|
+
((U = e.draft) == null ? void 0 : U.status) === i(De).enum.DRAFT ? (w(), R(ie, { key: 0 }, [
|
|
2194
|
+
ht.value ? (w(), te(ge, {
|
|
2195
|
+
key: 0,
|
|
2196
|
+
"z-index": 51,
|
|
2197
|
+
placement: "right"
|
|
2198
|
+
}, {
|
|
2199
|
+
content: Q(() => [
|
|
2200
|
+
me(L(ht.value), 1)
|
|
2201
|
+
]),
|
|
2202
|
+
default: Q(() => [
|
|
2203
|
+
F(S, {
|
|
2204
|
+
disabled: "",
|
|
2205
|
+
key: "approve key",
|
|
2206
|
+
label: "Approve"
|
|
2207
|
+
})
|
|
2208
|
+
]),
|
|
2209
|
+
_: 1
|
|
2210
|
+
})) : (w(), te(S, {
|
|
2211
|
+
key: "approve key",
|
|
2212
|
+
label: "Approve",
|
|
2213
|
+
onClick: c[5] || (c[5] = (Ue) => We.value = !0)
|
|
2214
|
+
}))
|
|
2215
|
+
], 64)) : K("", !0),
|
|
2216
|
+
((ce = e.draft) == null ? void 0 : ce.status) === i(De).enum.DRAFT ? (w(), te(S, {
|
|
2217
|
+
key: 1,
|
|
2218
|
+
label: "Reject",
|
|
2219
|
+
variant: "destructive",
|
|
2220
|
+
onClick: c[6] || (c[6] = () => e.draft && i(a).rejectDraft(e.draft, () => l("submitted")))
|
|
2221
|
+
})) : K("", !0),
|
|
2222
|
+
F(S, {
|
|
2223
|
+
label: "Close",
|
|
2224
|
+
variant: "tertiary",
|
|
2225
|
+
onClick: c[7] || (c[7] = (Ue) => v.value = !1)
|
|
2226
|
+
}),
|
|
2227
|
+
(pe = e.draft) != null && pe.approvedAt && ((xe = e.draft) == null ? void 0 : xe.status) !== i(De).enum.COMPLETED ? (w(), te(ut, { key: 2 }, {
|
|
2228
|
+
default: Q(() => [
|
|
2229
|
+
F(S, {
|
|
2230
|
+
label: "Sync",
|
|
2231
|
+
loading: I.value,
|
|
2232
|
+
onClick: c[8] || (c[8] = () => {
|
|
2233
|
+
e.draft && (I.value = !0, i(a).syncDraft(e.draft, () => {
|
|
2234
|
+
I.value = !1, l("submitted");
|
|
2235
|
+
}));
|
|
2236
|
+
})
|
|
2237
|
+
}, null, 8, ["loading"])
|
|
2238
|
+
]),
|
|
2239
|
+
_: 1
|
|
2240
|
+
})) : K("", !0)
|
|
2241
|
+
]),
|
|
2242
|
+
o("div", Ja, [
|
|
2243
|
+
c[21] || (c[21] = o("div", { class: "text-xs text-gray-500 uppercase tracking-wide" }, "Total stock take value", -1)),
|
|
2244
|
+
o("div", Xa, L(s.value) + " " + L(D.value.toFixed(2)), 1)
|
|
2245
|
+
])
|
|
2246
|
+
])
|
|
2247
|
+
];
|
|
2248
|
+
}),
|
|
2249
|
+
default: Q(() => [
|
|
2250
|
+
o("div", pa, [
|
|
2251
|
+
o("div", null, [
|
|
2252
|
+
F(k, {
|
|
2253
|
+
items: lt,
|
|
2254
|
+
modelValue: Me.value,
|
|
2255
|
+
"onUpdate:modelValue": c[0] || (c[0] = (U) => Me.value = U)
|
|
2256
|
+
}, null, 8, ["modelValue"])
|
|
2257
|
+
]),
|
|
2258
|
+
Me.value.value === "overview" ? (w(), R(ie, { key: 0 }, [
|
|
2259
|
+
F(ut, { selectable: "" }, {
|
|
2260
|
+
default: Q(() => {
|
|
2261
|
+
var U;
|
|
2262
|
+
return [
|
|
2263
|
+
o("div", va, [
|
|
2264
|
+
c[11] || (c[11] = o("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, [
|
|
2265
|
+
o("div", { class: "flex gap-1" }, "Draft ID")
|
|
2266
|
+
], -1)),
|
|
2267
|
+
me(" " + L((U = f.draft) == null ? void 0 : U._id), 1)
|
|
2268
|
+
])
|
|
2269
|
+
];
|
|
2270
|
+
}),
|
|
2271
|
+
_: 1
|
|
2272
|
+
}),
|
|
2273
|
+
F(h, {
|
|
2274
|
+
variant: "outlined",
|
|
2275
|
+
class: "flex flex-col gap-8 px-12 py-16"
|
|
2276
|
+
}, {
|
|
2277
|
+
default: Q(() => {
|
|
2278
|
+
var U, ce;
|
|
2279
|
+
return [
|
|
2280
|
+
o("div", ya, [
|
|
2281
|
+
c[12] || (c[12] = o("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
|
|
2282
|
+
o("div", ga, [
|
|
2283
|
+
o("div", {
|
|
2284
|
+
class: Ce(["fm-status-badge", i(Xe)(((U = f.draft) == null ? void 0 : U.status) ?? "DRAFT")])
|
|
2285
|
+
}, L(i(Be)(((ce = f.draft) == null ? void 0 : ce.status) ?? "")), 3)
|
|
2286
|
+
])
|
|
2287
|
+
]),
|
|
2288
|
+
F(g),
|
|
2289
|
+
o("div", ba, [
|
|
2290
|
+
(w(!0), R(ie, null, ke(Gt.value, (pe, xe) => (w(), R("div", {
|
|
2291
|
+
class: "flex flex-col gap-4",
|
|
2292
|
+
key: xe
|
|
2293
|
+
}, [
|
|
2294
|
+
o("div", ha, [
|
|
2295
|
+
o("div", _a, L(pe.label), 1)
|
|
2296
|
+
]),
|
|
2297
|
+
o("div", ka, L(pe.value), 1)
|
|
2298
|
+
]))), 128))
|
|
2299
|
+
])
|
|
2300
|
+
];
|
|
2301
|
+
}),
|
|
2302
|
+
_: 1
|
|
2303
|
+
}),
|
|
2304
|
+
o("div", wa, [
|
|
2305
|
+
o("div", xa, [
|
|
2306
|
+
c[13] || (c[13] = o("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
|
|
2307
|
+
x.value ? K("", !0) : (w(), R("div", Da, [
|
|
2308
|
+
f.draft && f.draft.status !== i(De).enum.COMPLETED ? (w(), te(S, {
|
|
2309
|
+
key: 0,
|
|
2310
|
+
label: "Refresh balance",
|
|
2311
|
+
"prepend-icon": "refresh",
|
|
2312
|
+
variant: "secondary",
|
|
2313
|
+
"text-color": "primary",
|
|
2314
|
+
"bg-color": "transparent",
|
|
2315
|
+
"border-color": "primary",
|
|
2316
|
+
loading: i(H),
|
|
2317
|
+
onClick: Se
|
|
2318
|
+
}, null, 8, ["loading"])) : K("", !0),
|
|
2319
|
+
F(ut, null, {
|
|
2320
|
+
default: Q(() => [
|
|
2321
|
+
F(S, {
|
|
2322
|
+
label: "Invalidate Draft Cache",
|
|
2323
|
+
"prepend-icon": "refresh",
|
|
2324
|
+
variant: "secondary",
|
|
2325
|
+
"text-color": "primary",
|
|
2326
|
+
"bg-color": "transparent",
|
|
2327
|
+
"border-color": "primary",
|
|
2328
|
+
loading: i(H),
|
|
2329
|
+
onClick: we
|
|
2330
|
+
}, null, 8, ["loading"])
|
|
2331
|
+
]),
|
|
2332
|
+
_: 1
|
|
2333
|
+
}),
|
|
2334
|
+
F(S, {
|
|
2335
|
+
label: "Export data",
|
|
2336
|
+
"prepend-icon": "download",
|
|
2337
|
+
variant: "secondary",
|
|
2338
|
+
"text-color": "primary",
|
|
2339
|
+
"bg-color": "transparent",
|
|
2340
|
+
"border-color": "primary",
|
|
2341
|
+
onClick: c[1] || (c[1] = (U) => f.draft ? i(a).exportDraft(
|
|
2342
|
+
f.draft,
|
|
2343
|
+
d.value,
|
|
2344
|
+
j.value,
|
|
2345
|
+
bt.value
|
|
2346
|
+
) : null)
|
|
2347
|
+
})
|
|
2348
|
+
]))
|
|
2349
|
+
]),
|
|
2350
|
+
x.value ? (w(), R("div", Aa, [
|
|
2351
|
+
c[15] || (c[15] = o("div", { class: "h-80" }, null, -1)),
|
|
2352
|
+
o("div", Ca, [
|
|
2353
|
+
o("div", null, [
|
|
2354
|
+
F(T, { size: "md" })
|
|
2355
|
+
]),
|
|
2356
|
+
c[14] || (c[14] = o("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
|
|
2357
|
+
]),
|
|
2358
|
+
c[16] || (c[16] = o("div", { class: "h-80" }, null, -1))
|
|
2359
|
+
])) : (w(), R(ie, { key: 1 }, [
|
|
2360
|
+
o("div", Sa, [
|
|
2361
|
+
o("div", $a, [
|
|
2362
|
+
F(z, {
|
|
2363
|
+
label: "Template Item(s)",
|
|
2364
|
+
selected: se.value.templateItem,
|
|
2365
|
+
onClick: c[2] || (c[2] = (U) => se.value.templateItem = !se.value.templateItem)
|
|
2366
|
+
}, null, 8, ["selected"]),
|
|
2367
|
+
F(z, {
|
|
2368
|
+
label: "Non-template Item(s)",
|
|
2369
|
+
selected: se.value.nonTemplateItem,
|
|
2370
|
+
onClick: c[3] || (c[3] = (U) => se.value.nonTemplateItem = !se.value.nonTemplateItem)
|
|
2371
|
+
}, null, 8, ["selected"])
|
|
2372
|
+
]),
|
|
2373
|
+
F(Y, {
|
|
2374
|
+
modelValue: st.value,
|
|
2375
|
+
"onUpdate:modelValue": c[4] || (c[4] = (U) => st.value = U),
|
|
2376
|
+
placeholder: "Filter items"
|
|
2377
|
+
}, null, 8, ["modelValue"])
|
|
2378
|
+
]),
|
|
2379
|
+
i(y).skuTags.size ? (w(), R("div", Fa, [
|
|
2380
|
+
(w(!0), R(ie, null, ke(i(y).skuTags.keys(), (U) => (w(), te(z, {
|
|
2381
|
+
key: `${U}`,
|
|
2382
|
+
label: `${U}`,
|
|
2383
|
+
selectable: "",
|
|
2384
|
+
selected: p[`${U}`],
|
|
2385
|
+
onClick: (ce) => p[`${U}`] = !p[`${U}`]
|
|
2386
|
+
}, {
|
|
2387
|
+
default: Q(() => [
|
|
2388
|
+
p[`${U}`] ? (w(), te(X, {
|
|
2389
|
+
key: 0,
|
|
2390
|
+
name: "check",
|
|
2391
|
+
class: "text-white",
|
|
2392
|
+
size: "sm"
|
|
2393
|
+
})) : K("", !0),
|
|
2394
|
+
o("span", {
|
|
2395
|
+
class: Ce([
|
|
2396
|
+
"",
|
|
2397
|
+
{
|
|
2398
|
+
"text-white fm-typo-en-body-md-600": p[`${U}`],
|
|
2399
|
+
"text-fm-color-typo-primary fm-typo-en-body-md-400": !p[`${U}`]
|
|
2400
|
+
}
|
|
2401
|
+
])
|
|
2402
|
+
}, L(U), 3)
|
|
2403
|
+
]),
|
|
2404
|
+
_: 2
|
|
2405
|
+
}, 1032, ["label", "selected", "onClick"]))), 128))
|
|
2406
|
+
])) : K("", !0),
|
|
2407
|
+
rt.value.length ? (w(), R("div", Ia, [
|
|
2408
|
+
c[17] || (c[17] = o("span", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary self-center" }, "Extra columns:", -1)),
|
|
2409
|
+
(w(!0), R(ie, null, ke(rt.value, (U) => (w(), te(z, {
|
|
2410
|
+
key: U,
|
|
2411
|
+
label: U,
|
|
2412
|
+
selectable: "",
|
|
2413
|
+
selected: Ke[U],
|
|
2414
|
+
onClick: (ce) => Ke[U] = !Ke[U]
|
|
2415
|
+
}, null, 8, ["label", "selected", "onClick"]))), 128))
|
|
2416
|
+
])) : K("", !0),
|
|
2417
|
+
o("div", Ba, [
|
|
2418
|
+
o("div", {
|
|
2419
|
+
style: Ut({ height: "600px", minWidth: `${ot.value}px` })
|
|
2420
|
+
}, [
|
|
2421
|
+
F(G, {
|
|
2422
|
+
"column-defs": Ve.value,
|
|
2423
|
+
"row-data": gt.value,
|
|
2424
|
+
"search-value": st.value
|
|
2425
|
+
}, null, 8, ["column-defs", "row-data", "search-value"])
|
|
2426
|
+
], 4)
|
|
2427
|
+
])
|
|
2428
|
+
], 64))
|
|
2429
|
+
])
|
|
2430
|
+
], 64)) : K("", !0),
|
|
2431
|
+
Me.value.value === "history" ? (w(), R("div", Ta, [
|
|
2432
|
+
Re.value.length ? (w(), R("div", Ua, [
|
|
2433
|
+
(w(!0), R(ie, null, ke(Re.value, (U, ce) => (w(), R(ie, { key: ce }, [
|
|
2434
|
+
o("div", Pa, [
|
|
2435
|
+
o("div", Va, [
|
|
2436
|
+
o("div", Ma, [
|
|
2437
|
+
o("div", {
|
|
2438
|
+
class: Ce([
|
|
2439
|
+
{
|
|
2440
|
+
"bg-fm-color-primary": ce !== 0,
|
|
2441
|
+
"bg-white": ce === 0
|
|
2442
|
+
},
|
|
2443
|
+
"w-[2px] h-full"
|
|
2444
|
+
])
|
|
2445
|
+
}, null, 2)
|
|
2446
|
+
]),
|
|
2447
|
+
c[20] || (c[20] = o("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
|
|
2448
|
+
o("div", Na, [
|
|
2449
|
+
o("div", {
|
|
2450
|
+
class: Ce([
|
|
2451
|
+
{
|
|
2452
|
+
"bg-fm-color-primary": ce < Re.value.length - 1,
|
|
2453
|
+
"bg-white": ce >= Re.value.length - 1
|
|
2454
|
+
},
|
|
2455
|
+
"w-[2px] h-full"
|
|
2456
|
+
])
|
|
2457
|
+
}, null, 2)
|
|
2458
|
+
])
|
|
2459
|
+
]),
|
|
2460
|
+
o("div", Ea, [
|
|
2461
|
+
o("div", La, L(U.header), 1),
|
|
2462
|
+
o("div", za, L(U.date), 1)
|
|
2463
|
+
])
|
|
2464
|
+
]),
|
|
2465
|
+
o("div", Oa, [
|
|
2466
|
+
o("div", Ha, [
|
|
2467
|
+
o("div", Ya, [
|
|
2468
|
+
o("div", {
|
|
2469
|
+
class: Ce([
|
|
2470
|
+
{
|
|
2471
|
+
"bg-fm-color-primary": ce < Re.value.length - 1,
|
|
2472
|
+
"bg-white": ce >= Re.value.length - 1
|
|
2473
|
+
},
|
|
2474
|
+
"w-[2px] h-full"
|
|
2475
|
+
])
|
|
2476
|
+
}, null, 2)
|
|
2477
|
+
])
|
|
2478
|
+
]),
|
|
2479
|
+
o("div", Ka, [
|
|
2480
|
+
F(h, {
|
|
2481
|
+
variant: "outlined",
|
|
2482
|
+
class: "py-12 px-16"
|
|
2483
|
+
}, {
|
|
2484
|
+
default: Q(() => [
|
|
2485
|
+
o("div", Wa, [
|
|
2486
|
+
(w(!0), R(ie, null, ke(U.info, (pe, xe) => (w(), R("div", {
|
|
2487
|
+
key: xe,
|
|
2488
|
+
class: "flex flex-col gap-4"
|
|
2489
|
+
}, [
|
|
2490
|
+
o("div", qa, L(pe == null ? void 0 : pe.label), 1),
|
|
2491
|
+
o("div", Ga, [
|
|
2492
|
+
(w(!0), R(ie, null, ke(pe == null ? void 0 : pe.values, (Ue, Ge) => (w(), R("div", {
|
|
2493
|
+
key: Ge,
|
|
2494
|
+
class: "fm-typo-en-body-lg-600"
|
|
2495
|
+
}, L(Ue), 1))), 128))
|
|
2496
|
+
])
|
|
2497
|
+
]))), 128))
|
|
2498
|
+
])
|
|
2499
|
+
]),
|
|
2500
|
+
_: 2
|
|
2501
|
+
}, 1024)
|
|
2502
|
+
])
|
|
2503
|
+
])
|
|
2504
|
+
], 64))), 128))
|
|
2505
|
+
])) : (w(), R("div", ja, [
|
|
2506
|
+
F(ve),
|
|
2507
|
+
o("div", null, [
|
|
2508
|
+
o("img", {
|
|
2509
|
+
src: i(xn),
|
|
2510
|
+
alt: "List is empty"
|
|
2511
|
+
}, null, 8, Ra)
|
|
2512
|
+
]),
|
|
2513
|
+
c[18] || (c[18] = o("div", { class: "fm-typo-en-body-lg-600" }, L("No records found"), -1)),
|
|
2514
|
+
c[19] || (c[19] = o("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, L("You can track approval and rejection history here"), -1)),
|
|
2515
|
+
F(ve),
|
|
2516
|
+
F(ve)
|
|
2517
|
+
]))
|
|
2518
|
+
])) : K("", !0)
|
|
2519
|
+
])
|
|
2520
|
+
]),
|
|
2521
|
+
_: 1
|
|
2522
|
+
}, 8, ["model-value"]),
|
|
2523
|
+
i(v) && e.draft ? (w(), te(ma, {
|
|
2524
|
+
key: 0,
|
|
2525
|
+
show: We.value,
|
|
2526
|
+
"onUpdate:show": c[10] || (c[10] = (U) => We.value = U),
|
|
2527
|
+
refreshing: i(H),
|
|
2528
|
+
approving: qe.value,
|
|
2529
|
+
draft: e.draft,
|
|
2530
|
+
onRefresh: Se,
|
|
2531
|
+
onApprove: Qt
|
|
2532
|
+
}, null, 8, ["show", "refreshing", "approving", "draft"])) : K("", !0)
|
|
2533
|
+
], 64);
|
|
2534
|
+
};
|
|
2535
|
+
}
|
|
2536
|
+
});
|
|
2537
|
+
var ye = /* @__PURE__ */ ((t) => (t.ready = "ready", t.negative = "negative", t.systemNegative = "systemNegative", t))(ye || {});
|
|
2538
|
+
async function to(t) {
|
|
2539
|
+
return new Promise((n, e) => {
|
|
2540
|
+
const s = new FileReader();
|
|
2541
|
+
s.onload = (m) => {
|
|
2542
|
+
var u;
|
|
2543
|
+
try {
|
|
2544
|
+
const a = (u = m.target) == null ? void 0 : u.result, v = Sn(a, { type: "array" }), x = v.SheetNames[0], I = v.Sheets[x], d = Je.sheet_to_json(I, {
|
|
2545
|
+
header: 1,
|
|
2546
|
+
defval: ""
|
|
2547
|
+
}), j = (r) => String(r).trim().toLowerCase().replace(/^\uFEFF/, ""), M = d.findIndex(
|
|
2548
|
+
(r) => r.some((l) => j(l) === "code")
|
|
2549
|
+
);
|
|
2550
|
+
if (M === -1) {
|
|
2551
|
+
n([]);
|
|
2552
|
+
return;
|
|
2553
|
+
}
|
|
2554
|
+
const N = d[M], b = N.findIndex((r) => j(r) === "code"), y = N.findIndex((r) => j(r) === "balance");
|
|
2555
|
+
if (b === -1 || y === -1) {
|
|
2556
|
+
e(
|
|
2557
|
+
new Error(
|
|
2558
|
+
`Missing required columns: ${b === -1 ? '"Code" ' : ""}${y === -1 ? '"Balance"' : ""}.`.trim()
|
|
2559
|
+
)
|
|
2560
|
+
);
|
|
2561
|
+
return;
|
|
2562
|
+
}
|
|
2563
|
+
const p = d.slice(M + 1).filter((r) => String(r[b]).trim()).map((r) => ({
|
|
2564
|
+
itemCode: String(r[b]).trim(),
|
|
2565
|
+
quantity: Number(r[y]) || 0
|
|
2566
|
+
}));
|
|
2567
|
+
n(p);
|
|
2568
|
+
} catch (a) {
|
|
2569
|
+
e(a);
|
|
2570
|
+
}
|
|
2571
|
+
}, s.onerror = e, s.readAsArrayBuffer(t);
|
|
2572
|
+
});
|
|
2573
|
+
}
|
|
2574
|
+
function no(t) {
|
|
2575
|
+
const n = /* @__PURE__ */ new Map();
|
|
2576
|
+
return t.forEach((e) => {
|
|
2577
|
+
const s = n.get(e.itemCode) || 0;
|
|
2578
|
+
n.set(e.itemCode, s + e.quantity);
|
|
2579
|
+
}), n;
|
|
2580
|
+
}
|
|
2581
|
+
function ao(t, n) {
|
|
2582
|
+
const e = [], s = [];
|
|
2583
|
+
for (const [m, u] of n.entries()) {
|
|
2584
|
+
const a = t[m];
|
|
2585
|
+
if (!a) {
|
|
2586
|
+
s.push(m);
|
|
2587
|
+
continue;
|
|
2588
|
+
}
|
|
2589
|
+
const v = u < 0 ? "negative" : "ready";
|
|
2590
|
+
e.push({
|
|
2591
|
+
sku: a,
|
|
2592
|
+
physicalCount: u,
|
|
2593
|
+
// Note: filled by composable after readStockBalance()
|
|
2594
|
+
systemBalance: { amount: 0, precision: 0 },
|
|
2595
|
+
variance: u - 0,
|
|
2596
|
+
status: v
|
|
2597
|
+
});
|
|
2598
|
+
}
|
|
2599
|
+
return { mergedItems: e, unrecognisedItemCodes: s };
|
|
2600
|
+
}
|
|
2601
|
+
function oo(t, n) {
|
|
2602
|
+
const e = t.filter((x) => !x.isInactive), s = Fn().format("YYYY-MM-DD"), m = `${n} - ${s}.csv`, u = [
|
|
2603
|
+
["Code", "Name", "Balance"],
|
|
2604
|
+
...e.map((x) => [x.code, x.name, ""])
|
|
2605
|
+
], a = Je.aoa_to_sheet(u), v = Je.book_new();
|
|
2606
|
+
Je.book_append_sheet(v, a, "Template"), $n(v, m, { bookType: "csv" });
|
|
2607
|
+
}
|
|
2608
|
+
function so() {
|
|
2609
|
+
const t = O([]), n = O([]), e = O(!1), s = vt(), m = ze(), u = at(), a = P(
|
|
2610
|
+
() => t.value.some((d) => d.status === ye.negative)
|
|
2611
|
+
);
|
|
2612
|
+
async function v(d) {
|
|
2613
|
+
t.value = [], n.value = [], e.value = !0;
|
|
2614
|
+
try {
|
|
2615
|
+
const j = await to(d), M = no(j), N = s.skuByCode, { mergedItems: b, unrecognisedItemCodes: y } = ao(
|
|
2616
|
+
N,
|
|
2617
|
+
M
|
|
2618
|
+
), E = await u.readStockBalance(), p = E.skus ?? [];
|
|
2619
|
+
p.length === 0 && console.warn(
|
|
2620
|
+
"No SKU balances found when importing closing draft. All system balances will be set to 0.",
|
|
2621
|
+
{
|
|
2622
|
+
stockBalance: E
|
|
2623
|
+
}
|
|
2624
|
+
);
|
|
2625
|
+
const r = new Map(
|
|
2626
|
+
p.map((_) => [_.id, _.balance])
|
|
2627
|
+
), l = new Set(b.map((_) => _.sku._id));
|
|
2628
|
+
t.value = b.map((_) => {
|
|
2629
|
+
const A = r.get(_.sku._id) ?? { amount: 0, precision: 0 }, B = A.amount / Math.pow(10, A.precision);
|
|
2630
|
+
return { ..._, systemBalance: A, variance: _.physicalCount - B };
|
|
2631
|
+
});
|
|
2632
|
+
for (const _ of Object.values(s.skuByCode)) {
|
|
2633
|
+
if (l.has(_._id)) continue;
|
|
2634
|
+
const A = r.get(_._id);
|
|
2635
|
+
if (!A) continue;
|
|
2636
|
+
const B = A.amount / Math.pow(10, A.precision);
|
|
2637
|
+
B >= 0 || t.value.push({
|
|
2638
|
+
sku: _,
|
|
2639
|
+
physicalCount: 0,
|
|
2640
|
+
systemBalance: A,
|
|
2641
|
+
variance: 0 - B,
|
|
2642
|
+
status: ye.systemNegative
|
|
2643
|
+
});
|
|
2644
|
+
}
|
|
2645
|
+
n.value = y;
|
|
2646
|
+
} catch (j) {
|
|
2647
|
+
t.value = [], n.value = [], console.error("Error processing uploaded file", { error: j });
|
|
2648
|
+
} finally {
|
|
2649
|
+
e.value = !1;
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
async function x() {
|
|
2653
|
+
const d = Oe(), j = t.value.filter((p) => p.status === ye.ready), M = t.value.filter(
|
|
2654
|
+
(p) => p.status === ye.systemNegative
|
|
2655
|
+
), N = (p) => ({
|
|
2656
|
+
sku: {
|
|
2657
|
+
_id: p.sku._id,
|
|
2658
|
+
code: p.sku.code,
|
|
2659
|
+
name: p.sku.name,
|
|
2660
|
+
unit: p.sku.unit
|
|
2661
|
+
},
|
|
2662
|
+
baseAmount: Lt(p.physicalCount, p.sku.unit.precision),
|
|
2663
|
+
measurementsAmounts: []
|
|
2664
|
+
}), b = j.map(N), y = M.map(N), E = {
|
|
2665
|
+
effectiveAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2666
|
+
items: b,
|
|
2667
|
+
negativeStockItems: y
|
|
2668
|
+
};
|
|
2669
|
+
return await d.createQuickModeDraftWithItems(E);
|
|
2670
|
+
}
|
|
2671
|
+
function I() {
|
|
2672
|
+
var j;
|
|
2673
|
+
const d = ((j = m.currentLocation) == null ? void 0 : j.name) ?? "template";
|
|
2674
|
+
oo(s.skus, d);
|
|
2675
|
+
}
|
|
2676
|
+
return { mergedItems: t, unrecognisedItemCodes: n, hasBlockingErrors: a, isLoading: e, onFileUpload: v, submit: x, downloadTemplate: I };
|
|
2677
|
+
}
|
|
2678
|
+
const ro = { class: "flex flex-col gap-16" }, lo = {
|
|
2679
|
+
key: 0,
|
|
2680
|
+
class: "px-16 py-12 rounded-8 bg-fm-color-danger-weak text-fm-color-danger-default"
|
|
2681
|
+
}, io = { key: 1 }, co = { class: "fm-typo-en-label-md-400 cursor-pointer" }, uo = { class: "mt-8 flex flex-col gap-4" }, mo = { key: 2 }, fo = { class: "fm-typo-en-label-md-400 cursor-pointer" }, po = { class: "mt-8 flex flex-col gap-4" }, vo = /* @__PURE__ */ je({
|
|
2682
|
+
__name: "ClosingDraftCreatePreviewTable",
|
|
2683
|
+
props: {
|
|
2684
|
+
items: {},
|
|
2685
|
+
unrecognisedItemCodes: {}
|
|
2686
|
+
},
|
|
2687
|
+
setup(t) {
|
|
2688
|
+
const n = t, { t: e } = nt(), s = P(
|
|
2689
|
+
() => n.items.filter((v) => v.status === ye.negative)
|
|
2690
|
+
), m = P(
|
|
2691
|
+
() => n.items.filter((v) => v.status === ye.systemNegative)
|
|
2692
|
+
), u = P(() => ({
|
|
2693
|
+
[ye.negative]: {
|
|
2694
|
+
bgColor: "bg-fm-color-danger-weak",
|
|
2695
|
+
textColor: "text-fm-color-danger-default",
|
|
2696
|
+
icon: "🚫",
|
|
2697
|
+
label: e("inventory.closing.draft.createDraft.previewTable.status.negative")
|
|
2698
|
+
},
|
|
2699
|
+
[ye.systemNegative]: {
|
|
2700
|
+
bgColor: "bg-fm-color-warning-weak",
|
|
2701
|
+
textColor: "text-fm-color-warning-default",
|
|
2702
|
+
icon: "⚠️",
|
|
2703
|
+
label: e("inventory.closing.draft.createDraft.previewTable.status.systemNegative")
|
|
2704
|
+
}
|
|
2705
|
+
})), a = [
|
|
2706
|
+
{
|
|
2707
|
+
id: "name",
|
|
2708
|
+
header: () => e("inventory.ingredient.name"),
|
|
2709
|
+
cell: (v) => v.row.original.sku.name
|
|
2710
|
+
},
|
|
2711
|
+
{
|
|
2712
|
+
id: "uom",
|
|
2713
|
+
header: () => e("inventory.closing.draft.createDraft.previewTable.uom"),
|
|
2714
|
+
size: 80,
|
|
2715
|
+
cell: (v) => v.row.original.sku.unit.abbrev
|
|
2716
|
+
},
|
|
2717
|
+
{
|
|
2718
|
+
id: "systemBalance",
|
|
2719
|
+
header: () => e("inventory.closing.draft.createDraft.previewTable.systemBalance"),
|
|
2720
|
+
size: 180,
|
|
2721
|
+
cell: (v) => {
|
|
2722
|
+
const x = v.row.original;
|
|
2723
|
+
return $("div", ne(x.systemBalance));
|
|
2724
|
+
}
|
|
2725
|
+
},
|
|
2726
|
+
{
|
|
2727
|
+
id: "physicalCount",
|
|
2728
|
+
header: () => e("inventory.closing.draft.createDraft.previewTable.stockTakeBalance"),
|
|
2729
|
+
cell: (v) => {
|
|
2730
|
+
const x = v.row.original;
|
|
2731
|
+
return $("div", ne(x.physicalCount));
|
|
2732
|
+
}
|
|
2733
|
+
},
|
|
2734
|
+
{
|
|
2735
|
+
id: "variance",
|
|
2736
|
+
header: () => e("inventory.closing.draft.createDraft.previewTable.variance"),
|
|
2737
|
+
cell: (v) => {
|
|
2738
|
+
const I = v.row.original.variance, d = I < 0 ? "text-fm-color-danger-default" : I > 0 ? "text-fm-color-success-default" : "";
|
|
2739
|
+
return $("span", { class: d }, ne(I));
|
|
2740
|
+
}
|
|
2741
|
+
},
|
|
2742
|
+
{
|
|
2743
|
+
id: "variancePercentage",
|
|
2744
|
+
header: () => e("inventory.closing.draft.createDraft.previewTable.variancePercentage"),
|
|
2745
|
+
size: 130,
|
|
2746
|
+
cell: (v) => {
|
|
2747
|
+
const x = v.row.original, I = x.systemBalance.amount / Math.pow(10, x.systemBalance.precision), d = I === 0 ? null : Math.max(
|
|
2748
|
+
-100,
|
|
2749
|
+
Math.min(100, Math.round(x.variance / Math.abs(I) * 1e4) / 100)
|
|
2750
|
+
);
|
|
2751
|
+
if (d === null)
|
|
2752
|
+
return $(
|
|
2753
|
+
"div",
|
|
2754
|
+
{ class: "flex items-center gap-4 justify-end fm-typo-en-body-md-400" },
|
|
2755
|
+
e("inventory.closing.draft.createDraft.previewTable.notApplicable")
|
|
2756
|
+
);
|
|
2757
|
+
const j = `${ne(d)}`;
|
|
2758
|
+
if (d === 0)
|
|
2759
|
+
return $(
|
|
2760
|
+
"div",
|
|
2761
|
+
{ class: "flex items-center gap-4 justify-end fm-typo-en-body-md-400" },
|
|
2762
|
+
j
|
|
2763
|
+
);
|
|
2764
|
+
const M = d > 0;
|
|
2765
|
+
return $("div", { class: "flex items-center gap-4 justify-end fm-typo-en-body-md-400" }, [
|
|
2766
|
+
$(_e.FmIcon, {
|
|
2767
|
+
name: M ? "arrow_drop_up" : "arrow_drop_down",
|
|
2768
|
+
color: M ? "system-success-300" : "system-error-300",
|
|
2769
|
+
size: "md"
|
|
2770
|
+
}),
|
|
2771
|
+
j
|
|
2772
|
+
]);
|
|
2773
|
+
}
|
|
2774
|
+
},
|
|
2775
|
+
{
|
|
2776
|
+
id: "status",
|
|
2777
|
+
header: () => e("inventory.common.status"),
|
|
2778
|
+
cell: (v) => {
|
|
2779
|
+
const x = v.row.original.status, I = u.value[x];
|
|
2780
|
+
return I ? $(
|
|
2781
|
+
"span",
|
|
2782
|
+
{
|
|
2783
|
+
class: `px-8 py-2 rounded-4 ${I.bgColor} ${I.textColor} fm-typo-en-label-sm-400`
|
|
2784
|
+
},
|
|
2785
|
+
`${I.icon} ${I.label}`
|
|
2786
|
+
) : null;
|
|
2787
|
+
}
|
|
2788
|
+
}
|
|
2789
|
+
];
|
|
2790
|
+
return (v, x) => {
|
|
2791
|
+
const I = q("FmTable");
|
|
2792
|
+
return w(), R("div", ro, [
|
|
2793
|
+
s.value.length > 0 ? (w(), R("div", lo, [
|
|
2794
|
+
me(L(i(e)("inventory.closing.draft.createDraft.previewTable.cannotSubmitNegative")) + " ", 1),
|
|
2795
|
+
o("strong", null, L(s.value.map((d) => d.sku.code).join(", ")), 1)
|
|
2796
|
+
])) : K("", !0),
|
|
2797
|
+
m.value.length > 0 ? (w(), R("details", io, [
|
|
2798
|
+
o("summary", co, L(i(e)("inventory.closing.draft.createDraft.previewTable.systemNegativeNote", [m.value.length])), 1),
|
|
2799
|
+
o("ul", uo, [
|
|
2800
|
+
(w(!0), R(ie, null, ke(m.value, (d) => (w(), R("li", {
|
|
2801
|
+
key: d.sku._id,
|
|
2802
|
+
class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
2803
|
+
}, L(d.sku.code), 1))), 128))
|
|
2804
|
+
])
|
|
2805
|
+
])) : K("", !0),
|
|
2806
|
+
v.unrecognisedItemCodes.length > 0 ? (w(), R("details", mo, [
|
|
2807
|
+
o("summary", fo, L(i(e)("inventory.closing.draft.createDraft.previewTable.unrecognisedNote", [v.unrecognisedItemCodes.length])), 1),
|
|
2808
|
+
o("ul", po, [
|
|
2809
|
+
(w(!0), R(ie, null, ke(v.unrecognisedItemCodes, (d) => (w(), R("li", {
|
|
2810
|
+
key: d,
|
|
2811
|
+
class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
2812
|
+
}, L(d), 1))), 128))
|
|
2813
|
+
])
|
|
2814
|
+
])) : K("", !0),
|
|
2815
|
+
F(I, {
|
|
2816
|
+
"row-data": n.items,
|
|
2817
|
+
"column-defs": a,
|
|
2818
|
+
pagination: { pageSize: 20 }
|
|
2819
|
+
}, null, 8, ["row-data"])
|
|
2820
|
+
]);
|
|
2821
|
+
};
|
|
2822
|
+
}
|
|
2823
|
+
}), yo = { class: "flex flex-col gap-16" }, go = { class: "flex flex-col gap-8" }, bo = { class: "fm-typo-en-body-lg-600" }, ho = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _o = { class: "fm-corner-radius-md p-16 flex items-center gap-16 border border-fm-color-border-default" }, ko = { class: "flex flex-col flex-1 gap-4" }, wo = { class: "fm-typo-en-body-md-600" }, xo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Do = {
|
|
2824
|
+
key: 0,
|
|
2825
|
+
class: "flex flex-col gap-8"
|
|
2826
|
+
}, Ao = { class: "fm-typo-en-body-lg-600" }, Co = {
|
|
2827
|
+
key: 0,
|
|
2828
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-system-error-300 flex items-center gap-8"
|
|
2829
|
+
}, So = { class: "grid grid-cols-[repeat(3,1fr)] gap-12" }, $o = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary flex items-center gap-4" }, Fo = { class: "flex items-center gap-8 w-full" }, Io = /* @__PURE__ */ je({
|
|
2830
|
+
__name: "ClosingDraftCreateSideSheet",
|
|
2831
|
+
props: {
|
|
2832
|
+
show: { type: Boolean }
|
|
2833
|
+
},
|
|
2834
|
+
emits: ["update:show", "submitted"],
|
|
2835
|
+
setup(t, { emit: n }) {
|
|
2836
|
+
const e = t, s = n, m = Vt(e, "show"), { t: u } = nt(), a = Le(), v = O("upload"), x = O(null), I = O(!1), { mergedItems: d, unrecognisedItemCodes: j, hasBlockingErrors: M, isLoading: N, onFileUpload: b, submit: y, downloadTemplate: E } = so(), p = P(
|
|
2837
|
+
() => x.value && !N.value && d.value.length > 0
|
|
2838
|
+
), r = P(() => {
|
|
2839
|
+
const B = d.value.filter(
|
|
2840
|
+
(H) => H.status === ye.ready
|
|
2841
|
+
).length, W = d.value.filter(
|
|
2842
|
+
(H) => H.status === ye.negative
|
|
2843
|
+
).length, ae = d.value.filter(
|
|
2844
|
+
(H) => H.status === ye.systemNegative
|
|
2845
|
+
).length, oe = d.value.filter((H) => H.variance !== 0).length;
|
|
2846
|
+
return [
|
|
2847
|
+
{ label: u("inventory.closing.draft.createDraft.summary.totalItems"), value: d.value.length },
|
|
2848
|
+
{ label: u("inventory.closing.draft.createDraft.summary.itemsWithCount"), value: B },
|
|
2849
|
+
{
|
|
2850
|
+
label: u("inventory.closing.draft.createDraft.summary.unrecognisedItems"),
|
|
2851
|
+
value: j.value.length,
|
|
2852
|
+
isWarning: j.value.length > 0
|
|
2853
|
+
},
|
|
2854
|
+
{ label: u("inventory.closing.draft.createDraft.summary.itemsWithVariance"), value: oe },
|
|
2855
|
+
{ label: u("inventory.closing.draft.createDraft.summary.negativeCounts"), value: W, isError: W > 0 },
|
|
2856
|
+
{
|
|
2857
|
+
label: u("inventory.closing.draft.createDraft.summary.systemNegative"),
|
|
2858
|
+
value: ae,
|
|
2859
|
+
isWarning: ae > 0
|
|
2860
|
+
}
|
|
2861
|
+
];
|
|
2862
|
+
});
|
|
2863
|
+
async function l(B) {
|
|
2864
|
+
x.value = B, await b(B);
|
|
2865
|
+
}
|
|
2866
|
+
async function _() {
|
|
2867
|
+
I.value = !0;
|
|
2868
|
+
try {
|
|
2869
|
+
await y(), A(), s("submitted"), a.open({
|
|
2870
|
+
title: "Success",
|
|
2871
|
+
message: "Closing draft created successfully",
|
|
2872
|
+
type: "success"
|
|
2873
|
+
});
|
|
2874
|
+
} catch (B) {
|
|
2875
|
+
console.error("Failed to create closing draft", { error: B }), a.open({
|
|
2876
|
+
title: "Something went wrong",
|
|
2877
|
+
message: "Failed to create closing draft. Please try again",
|
|
2878
|
+
type: "error"
|
|
2879
|
+
});
|
|
2880
|
+
} finally {
|
|
2881
|
+
I.value = !1;
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
Ne(m, (B) => {
|
|
2885
|
+
B || (v.value = "upload", x.value = null);
|
|
2886
|
+
});
|
|
2887
|
+
function A() {
|
|
2888
|
+
m.value = !1;
|
|
2889
|
+
}
|
|
2890
|
+
return (B, W) => {
|
|
2891
|
+
const ae = q("FmCircularProgress"), oe = q("FmIcon"), H = q("FmButton"), se = q("FmCard"), V = q("FmSideSheet");
|
|
2892
|
+
return w(), te(V, {
|
|
2893
|
+
"dismiss-away": "",
|
|
2894
|
+
"max-width": 9999,
|
|
2895
|
+
"model-value": i(m),
|
|
2896
|
+
"onUpdate:modelValue": W[2] || (W[2] = (C) => pt(m) ? m.value = C : null),
|
|
2897
|
+
header: i(u)("inventory.closing.draft.createDraft.title")
|
|
2898
|
+
}, {
|
|
2899
|
+
default: Q(() => [
|
|
2900
|
+
o("div", yo, [
|
|
2901
|
+
v.value === "upload" ? (w(), R(ie, { key: 0 }, [
|
|
2902
|
+
o("div", go, [
|
|
2903
|
+
o("div", bo, L(i(u)("inventory.closing.draft.createDraft.importCsv")), 1),
|
|
2904
|
+
o("div", ho, L(i(u)("inventory.closing.draft.createDraft.uploadDescription")), 1),
|
|
2905
|
+
F(In, {
|
|
2906
|
+
class: Ce({ "h-[200px]": !x.value }),
|
|
2907
|
+
accept: ".csv",
|
|
2908
|
+
disabled: i(N),
|
|
2909
|
+
onFileUpload: l
|
|
2910
|
+
}, nn({ _: 2 }, [
|
|
2911
|
+
x.value ? {
|
|
2912
|
+
name: "default",
|
|
2913
|
+
fn: Q(({ openFileDialog: C }) => [
|
|
2914
|
+
o("div", _o, [
|
|
2915
|
+
i(N) ? (w(), te(ae, {
|
|
2916
|
+
key: 0,
|
|
2917
|
+
size: "md",
|
|
2918
|
+
color: "neutral-gray-200"
|
|
2919
|
+
})) : (w(), te(oe, {
|
|
2920
|
+
key: 1,
|
|
2921
|
+
name: "check_circle",
|
|
2922
|
+
color: "system-success-400",
|
|
2923
|
+
size: "lg"
|
|
2924
|
+
})),
|
|
2925
|
+
o("div", ko, [
|
|
2926
|
+
o("div", wo, L(x.value.name), 1),
|
|
2927
|
+
o("div", xo, L(i(N) ? i(u)("inventory.closing.draft.createDraft.processing") : i(u)("inventory.closing.draft.createDraft.itemsLoaded", [i(d).length])), 1)
|
|
2928
|
+
]),
|
|
2929
|
+
i(N) ? K("", !0) : (w(), te(H, {
|
|
2930
|
+
key: 2,
|
|
2931
|
+
label: i(u)("inventory.closing.draft.createDraft.replaceFile"),
|
|
2932
|
+
variant: "secondary",
|
|
2933
|
+
"prepend-icon": "autorenew",
|
|
2934
|
+
onClick: C
|
|
2935
|
+
}, null, 8, ["label", "onClick"]))
|
|
2936
|
+
])
|
|
2937
|
+
]),
|
|
2938
|
+
key: "0"
|
|
2939
|
+
} : void 0
|
|
2940
|
+
]), 1032, ["class", "disabled"])
|
|
2941
|
+
]),
|
|
2942
|
+
p.value ? (w(), R("div", Do, [
|
|
2943
|
+
o("div", Ao, L(i(u)("inventory.closing.draft.createDraft.importSummary")), 1),
|
|
2944
|
+
i(M) ? (w(), R("div", Co, [
|
|
2945
|
+
F(oe, {
|
|
2946
|
+
name: "error",
|
|
2947
|
+
size: "sm",
|
|
2948
|
+
color: "system-error-300"
|
|
2949
|
+
}),
|
|
2950
|
+
o("span", null, L(i(u)("inventory.closing.draft.createDraft.reviewIssues")), 1)
|
|
2951
|
+
])) : K("", !0),
|
|
2952
|
+
F(se, {
|
|
2953
|
+
variant: "outlined",
|
|
2954
|
+
class: "flex flex-col gap-12 px-16 py-12"
|
|
2955
|
+
}, {
|
|
2956
|
+
default: Q(() => [
|
|
2957
|
+
o("div", So, [
|
|
2958
|
+
(w(!0), R(ie, null, ke(r.value, (C) => (w(), R("div", {
|
|
2959
|
+
key: C.label,
|
|
2960
|
+
class: "flex flex-col gap-4"
|
|
2961
|
+
}, [
|
|
2962
|
+
o("div", $o, [
|
|
2963
|
+
C.isError ? (w(), te(oe, {
|
|
2964
|
+
key: 0,
|
|
2965
|
+
name: "error",
|
|
2966
|
+
size: "sm",
|
|
2967
|
+
color: "system-error-300"
|
|
2968
|
+
})) : K("", !0),
|
|
2969
|
+
C.isWarning && !C.isError ? (w(), te(oe, {
|
|
2970
|
+
key: 1,
|
|
2971
|
+
name: "warning",
|
|
2972
|
+
size: "sm",
|
|
2973
|
+
color: "system-warning-300"
|
|
2974
|
+
})) : K("", !0),
|
|
2975
|
+
o("span", null, L(C.label), 1)
|
|
2976
|
+
]),
|
|
2977
|
+
o("div", {
|
|
2978
|
+
class: Ce([
|
|
2979
|
+
"fm-typo-en-body-lg-600",
|
|
2980
|
+
{
|
|
2981
|
+
"text-fm-color-system-error-300": C.isError,
|
|
2982
|
+
"text-fm-color-system-warning-300": C.isWarning && !C.isError
|
|
2983
|
+
}
|
|
2984
|
+
])
|
|
2985
|
+
}, L(C.value), 3)
|
|
2986
|
+
]))), 128))
|
|
2987
|
+
])
|
|
2988
|
+
]),
|
|
2989
|
+
_: 1
|
|
2990
|
+
})
|
|
2991
|
+
])) : K("", !0)
|
|
2992
|
+
], 64)) : K("", !0),
|
|
2993
|
+
v.value === "preview" ? (w(), te(vo, {
|
|
2994
|
+
key: 1,
|
|
2995
|
+
items: i(d),
|
|
2996
|
+
"unrecognised-item-codes": i(j)
|
|
2997
|
+
}, null, 8, ["items", "unrecognised-item-codes"])) : K("", !0)
|
|
2998
|
+
])
|
|
2999
|
+
]),
|
|
3000
|
+
"side-sheet-footer": Q(() => [
|
|
3001
|
+
o("div", Fo, [
|
|
3002
|
+
v.value === "preview" ? (w(), te(H, {
|
|
3003
|
+
key: 0,
|
|
3004
|
+
variant: "secondary",
|
|
3005
|
+
label: i(u)("inventory.common.back"),
|
|
3006
|
+
"prepend-icon": "arrow_back",
|
|
3007
|
+
onClick: W[0] || (W[0] = (C) => v.value = "upload")
|
|
3008
|
+
}, null, 8, ["label"])) : K("", !0),
|
|
3009
|
+
v.value === "upload" ? (w(), te(H, {
|
|
3010
|
+
key: 1,
|
|
3011
|
+
variant: "primary",
|
|
3012
|
+
label: i(u)("inventory.common.next"),
|
|
3013
|
+
disabled: !x.value || i(N),
|
|
3014
|
+
onClick: W[1] || (W[1] = (C) => v.value = "preview")
|
|
3015
|
+
}, null, 8, ["label", "disabled"])) : K("", !0),
|
|
3016
|
+
v.value === "preview" ? (w(), te(Bn, {
|
|
3017
|
+
key: 2,
|
|
3018
|
+
label: i(u)("inventory.closing.draft.createDraft.submit"),
|
|
3019
|
+
disabled: i(M) || i(d).length === 0 || I.value,
|
|
3020
|
+
loading: I.value,
|
|
3021
|
+
"confirm-title": i(u)("inventory.closing.draft.createDraft.confirmTitle"),
|
|
3022
|
+
"confirm-message": i(u)("inventory.closing.draft.createDraft.confirmMessage"),
|
|
3023
|
+
onConfirm: _
|
|
3024
|
+
}, null, 8, ["label", "disabled", "loading", "confirm-title", "confirm-message"])) : K("", !0),
|
|
3025
|
+
F(H, {
|
|
3026
|
+
variant: "tertiary",
|
|
3027
|
+
label: i(u)("inventory.common.close"),
|
|
3028
|
+
onClick: A
|
|
3029
|
+
}, null, 8, ["label"]),
|
|
3030
|
+
v.value === "upload" ? (w(), te(H, {
|
|
3031
|
+
key: 3,
|
|
3032
|
+
class: "ml-auto",
|
|
3033
|
+
variant: "secondary",
|
|
3034
|
+
label: i(u)("inventory.closing.draft.createDraft.downloadTemplate"),
|
|
3035
|
+
"prepend-icon": "download",
|
|
3036
|
+
onClick: i(E)
|
|
3037
|
+
}, null, 8, ["label", "onClick"])) : K("", !0)
|
|
3038
|
+
])
|
|
3039
|
+
]),
|
|
3040
|
+
_: 1
|
|
3041
|
+
}, 8, ["model-value", "header"]);
|
|
3042
|
+
};
|
|
3043
|
+
}
|
|
3044
|
+
}), Bo = { class: "flex-1 flex flex-col gap-8" }, To = { class: "flex flex-col" }, jo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ro = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Uo = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, Po = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, ms = /* @__PURE__ */ je({
|
|
3045
|
+
__name: "ClosingDraftView",
|
|
3046
|
+
setup(t) {
|
|
3047
|
+
const { t: n } = nt(), { viewDraft: e } = tt(), { viewClosingDraftProps: s, viewClosingDraftShow: m } = fn(tt()), u = ze(), a = qt(), v = sn(), { breakpoints: x } = cn();
|
|
3048
|
+
u.watchLocation(a.fetchDrafts);
|
|
3049
|
+
const I = P(() => a.loading), d = O(""), j = O(!1), M = P(() => x.value.xs || x.value.sm), N = P(() => M.value ? 10 : 20), b = P(
|
|
3050
|
+
() => {
|
|
3051
|
+
var r;
|
|
3052
|
+
return ((r = u.currentLocation) == null ? void 0 : r.type) === mn.enum.warehouse;
|
|
3053
|
+
}
|
|
3054
|
+
);
|
|
3055
|
+
function y(r) {
|
|
3056
|
+
switch (r) {
|
|
3057
|
+
case "add":
|
|
3058
|
+
return j.value = !0;
|
|
3059
|
+
case "refresh":
|
|
3060
|
+
return a.fetchDrafts();
|
|
3061
|
+
}
|
|
3062
|
+
}
|
|
3063
|
+
function E(r) {
|
|
3064
|
+
return r;
|
|
3065
|
+
}
|
|
3066
|
+
const p = P(() => {
|
|
3067
|
+
const r = {
|
|
3068
|
+
label: n("inventory.closing.draft.createDraft.title"),
|
|
3069
|
+
value: "add",
|
|
3070
|
+
isPrimary: !0,
|
|
3071
|
+
prependIcon: "add"
|
|
3072
|
+
}, l = {
|
|
3073
|
+
label: n("inventory.common.refresh"),
|
|
3074
|
+
value: "refresh",
|
|
3075
|
+
isPrimary: !1
|
|
3076
|
+
};
|
|
3077
|
+
return [...b.value ? [r] : [], l];
|
|
3078
|
+
});
|
|
3079
|
+
return (r, l) => {
|
|
3080
|
+
const _ = q("FmTable");
|
|
3081
|
+
return w(), R(ie, null, [
|
|
3082
|
+
F(rn, {
|
|
3083
|
+
title: i(n)("inventory.closing.draft.title"),
|
|
3084
|
+
actions: p.value,
|
|
3085
|
+
"onClick:action": y
|
|
3086
|
+
}, {
|
|
3087
|
+
default: Q(() => [
|
|
3088
|
+
o("div", {
|
|
3089
|
+
class: Ce([
|
|
3090
|
+
"flex flex-col gap-8 max-h-full",
|
|
3091
|
+
{
|
|
3092
|
+
"p-0": M.value,
|
|
3093
|
+
"px-24 ": !M.value
|
|
3094
|
+
}
|
|
3095
|
+
])
|
|
3096
|
+
}, [
|
|
3097
|
+
F(wn, {
|
|
3098
|
+
"change-location": "",
|
|
3099
|
+
searchable: "",
|
|
3100
|
+
search: d.value,
|
|
3101
|
+
"onUpdate:search": l[0] || (l[0] = (A) => d.value = A)
|
|
3102
|
+
}, null, 8, ["search"]),
|
|
3103
|
+
(w(), te(_, {
|
|
3104
|
+
key: i(a).tableKey,
|
|
3105
|
+
style: Ut(i(v).tableHeight),
|
|
3106
|
+
"column-defs": i(a).columnDefs,
|
|
3107
|
+
"row-data": i(a).drafts,
|
|
3108
|
+
"search-value": d.value,
|
|
3109
|
+
loading: I.value,
|
|
3110
|
+
onRowClick: l[1] || (l[1] = (A) => i(e)(A.original)),
|
|
3111
|
+
"page-size": N.value
|
|
3112
|
+
}, {
|
|
3113
|
+
"list-row": Q((A) => [
|
|
3114
|
+
F(Tn, {
|
|
3115
|
+
row: A,
|
|
3116
|
+
onRowClick: (B) => i(e)(B)
|
|
3117
|
+
}, {
|
|
3118
|
+
default: Q((B) => {
|
|
3119
|
+
var W, ae, oe, H, se, V, C, le, D, Z, J, fe, Se, we, $e, Fe, He, Ye, ue, Ve;
|
|
3120
|
+
return [
|
|
3121
|
+
o("div", Bo, [
|
|
3122
|
+
o("div", To, [
|
|
3123
|
+
o("div", jo, [
|
|
3124
|
+
F(i(Ze), {
|
|
3125
|
+
render: (oe = (ae = (W = B._id) == null ? void 0 : W.column) == null ? void 0 : ae.columnDef) == null ? void 0 : oe.cell,
|
|
3126
|
+
props: (se = (H = B._id) == null ? void 0 : H.getContext) == null ? void 0 : se.call(H)
|
|
3127
|
+
}, null, 8, ["render", "props"])
|
|
3128
|
+
]),
|
|
3129
|
+
o("div", Ro, [
|
|
3130
|
+
F(i(Ze), {
|
|
3131
|
+
render: (le = (C = (V = B.name) == null ? void 0 : V.column) == null ? void 0 : C.columnDef) == null ? void 0 : le.cell,
|
|
3132
|
+
props: (Z = (D = B.name) == null ? void 0 : D.getContext) == null ? void 0 : Z.call(D)
|
|
3133
|
+
}, null, 8, ["render", "props"])
|
|
3134
|
+
]),
|
|
3135
|
+
o("div", Uo, L([
|
|
3136
|
+
...A.original.items.slice(0, 3).map((ot) => ot.sku.name),
|
|
3137
|
+
...A.original.items.length >= 3 ? [`and ${A.original.items.length - 3} more items`] : []
|
|
3138
|
+
].join(", ")), 1),
|
|
3139
|
+
o("div", Po, [
|
|
3140
|
+
F(i(Ze), {
|
|
3141
|
+
render: (Se = (fe = (J = B.ref) == null ? void 0 : J.column) == null ? void 0 : fe.columnDef) == null ? void 0 : Se.cell,
|
|
3142
|
+
props: ($e = (we = B.ref) == null ? void 0 : we.getContext) == null ? void 0 : $e.call(we)
|
|
3143
|
+
}, null, 8, ["render", "props"])
|
|
3144
|
+
])
|
|
3145
|
+
]),
|
|
3146
|
+
o("div", null, [
|
|
3147
|
+
F(i(Ze), {
|
|
3148
|
+
render: (Ye = (He = (Fe = B.status) == null ? void 0 : Fe.column) == null ? void 0 : He.columnDef) == null ? void 0 : Ye.cell,
|
|
3149
|
+
props: (Ve = (ue = B.status) == null ? void 0 : ue.getContext) == null ? void 0 : Ve.call(ue)
|
|
3150
|
+
}, null, 8, ["render", "props"])
|
|
3151
|
+
])
|
|
3152
|
+
])
|
|
3153
|
+
];
|
|
3154
|
+
}),
|
|
3155
|
+
_: 2
|
|
3156
|
+
}, 1032, ["row", "onRowClick"])
|
|
3157
|
+
]),
|
|
3158
|
+
_: 1
|
|
3159
|
+
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
3160
|
+
], 2)
|
|
3161
|
+
]),
|
|
3162
|
+
_: 1
|
|
3163
|
+
}, 8, ["title", "actions"]),
|
|
3164
|
+
F(Io, {
|
|
3165
|
+
show: j.value,
|
|
3166
|
+
"onUpdate:show": l[2] || (l[2] = (A) => j.value = A),
|
|
3167
|
+
onSubmitted: i(a).fetchDrafts
|
|
3168
|
+
}, null, 8, ["show", "onSubmitted"]),
|
|
3169
|
+
(w(), te(an, { to: "body" }, [
|
|
3170
|
+
F(eo, on(i(s), {
|
|
3171
|
+
show: i(m),
|
|
3172
|
+
"onUpdate:show": l[3] || (l[3] = (A) => pt(m) ? m.value = A : null),
|
|
3173
|
+
onSubmitted: l[4] || (l[4] = () => (m.value = !1, i(a).fetchDrafts())),
|
|
3174
|
+
onRefresh: l[5] || (l[5] = (A) => i(a).updateDraftRef(A))
|
|
3175
|
+
}), null, 16, ["show"])
|
|
3176
|
+
]))
|
|
3177
|
+
], 64);
|
|
3178
|
+
};
|
|
3179
|
+
}
|
|
3180
|
+
});
|
|
3181
|
+
export {
|
|
3182
|
+
ms as default
|
|
3183
|
+
};
|