@feedmepos/mf-inventory-portal 1.2.26 → 1.2.28
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-DPWPePDs.js → App-BpTp4tTy.js} +1 -1
- package/dist/{ApprovalView-B11j1iq7.js → ApprovalView-BiCWMNPZ.js} +2 -2
- package/dist/{BindingsDialog-C5MYJ3Jv.js → BindingsDialog-AwpEPK6d.js} +2 -2
- package/dist/{BindingsPicker-2Urvd2_k.js → BindingsPicker-BRPue7Be.js} +1 -1
- package/dist/{BindingsTable-CsoxQAtZ.js → BindingsTable-9ERKT3nZ.js} +1 -1
- package/dist/ClosingDraftView-DIvddbOy.js +2077 -0
- package/dist/{ClosingHistoryView-AHTYxrq8.js → ClosingHistoryView-BYv0GXGj.js} +115 -113
- package/dist/{ClosingTemplateView-293Z2vbh.js → ClosingTemplateView-Co9-71Qd.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-C1XFdLH4.js → DeliveryOrderPrintPreview-BgCGQYlJ.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-twX7qUdT.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Cl-BXK9c.js} +3 -3
- package/dist/{FmMultiselectDialog-CZ7XTZls.js → FmMultiselectDialog-A5K1fbiJ.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-ezKgTjVr.js → FmUnitInput.vue_vue_type_script_setup_true_lang-D57Jmy3H.js} +1 -1
- package/dist/{ImportView-C5rAMFpn.js → ImportView-BCtms71i.js} +2 -2
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BpOZHYxx.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-B3DFrMFL.js} +1 -1
- package/dist/{IngredientGroupView-Dpdiv-Bm.js → IngredientGroupView-CAewASse.js} +2 -2
- package/dist/{IngredientsView-ByaSyrOC.js → IngredientsView-DtJ1dBPf.js} +7 -7
- package/dist/{IntegrationView-DtK_QcIr.js → IntegrationView-CaBB8Izb.js} +3 -3
- package/dist/{InventoryBindingForm-Dz_Zd3-I.js → InventoryBindingForm-BU7kUZSz.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BekOkiyz.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-Ds__y-Lo.js} +3 -3
- package/dist/{InventoryBindingSummary-C6NPyThG.js → InventoryBindingSummary-XFDK1dPw.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DqtwxjUK.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CMgRJ85E.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BuSgeMSz.js → PremiumBadge.vue_vue_type_script_setup_true_lang-6I4HFx0j.js} +1 -1
- package/dist/{PublishView-C_n1VAQZ.js → PublishView-CBEuARad.js} +1 -1
- package/dist/{PurchaseOrderPrintPreview-CbCxKLFR.js → PurchaseOrderPrintPreview-THSwoyZV.js} +1 -1
- package/dist/{ReceiveRequestView-RZtPnFRM.js → ReceiveRequestView-D4E0DHhj.js} +8 -8
- package/dist/{RecipeView-CG1EDuM2.js → RecipeView-DrJOwiZG.js} +3 -3
- package/dist/{StockView-DocheY2H.js → StockView-DdhoiUs5.js} +8 -8
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-B_G1Xn3r.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-ze5NJ_-a.js} +1 -1
- package/dist/{SupplierView-Cc7Yk3Bg.js → SupplierView-CBZEt5ub.js} +4 -4
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-DgwAEHYe.js → TransferDetails.vue_vue_type_script_setup_true_lang-BWPYiDXh.js} +5 -5
- package/dist/{TransferTemplateView-CFxajiqU.js → TransferTemplateView-BPKx5laO.js} +7 -7
- package/dist/{UnitView-CVF1SjRM.js → UnitView-Cd9dZhGB.js} +3 -3
- package/dist/{WarehouseView-C7Cd8yoz.js → WarehouseView-Cycp5mC8.js} +1 -1
- package/dist/{app-B6xEJFwV.js → app-DzPAqMfV.js} +13 -13
- package/dist/app.js +1 -1
- package/dist/{decimal--zX3YISg.js → decimal-B6b_BCrz.js} +1 -1
- package/dist/{format-unit-display-BsHrCcqV.js → format-unit-display-D6UHEBQy.js} +3 -3
- package/dist/{import-export.helper-DVlYpCKN.js → import-export.helper-D7FUv1ZN.js} +1 -1
- package/dist/{index-v6xO2bR0.js → index-7Gffcntc.js} +1 -1
- package/dist/{index-DwWvp8DJ.js → index-CqxJHYsC.js} +1 -1
- package/dist/{purchase-order-template-B6Lnanis.js → purchase-order-template-CmXUb_MT.js} +1 -1
- package/dist/{stock-kk7c27VO.js → stock-BYRT4p1b.js} +1 -1
- package/dist/{stock-cbSPPFhq.js → stock-GesfiBWR.js} +2 -2
- package/dist/{supplier-Bxwn_Txs.js → supplier-LrosKW2Q.js} +1 -1
- package/dist/{use-ingredient-select-dialog-Bhvgmzhv.js → use-ingredient-select-dialog-BhVF0zwr.js} +1 -1
- package/dist/{use-inventory-binding-dialog-BSgySUNp.js → use-inventory-binding-dialog-CApue-hU.js} +1 -1
- package/package.json +3 -3
- package/dist/ClosingDraftView-BqZkAqFU.js +0 -2060
|
@@ -0,0 +1,2077 @@
|
|
|
1
|
+
import { defineComponent as Ee, ref as H, computed as V, onMounted as We, resolveComponent as z, openBlock as F, createElementBlock as E, Fragment as re, createTextVNode as ne, createBlock as ue, withCtx as W, createElementVNode as i, toDisplayString as ae, unref as $, createVNode as _, createCommentVNode as le, h as A, reactive as Bt, watch as Tt, isRef as ft, normalizeClass as Se, renderList as $e, normalizeStyle as pt, Teleport as jt, mergeProps as It } from "vue";
|
|
2
|
+
import { aa as Ut, u as ze, ax as Y, am as Le, ay as vt, r as Pt, Z as qe, n as Qe, t as Mt, a0 as Be, W as Rt, Y as Vt, X as Lt, az as gt, aA as yt, $ as R, ah as bt, aB as ht, aC as he, an as Nt, ac as Ge, ab as ke, a6 as Re, D as dt, j as Pe, i as Et, f as zt, a as Ot, a9 as Ht, h as Yt, G as Kt, I as Qt, J as Gt, K as Wt, L as Me } from "./app-DzPAqMfV.js";
|
|
3
|
+
import { useCoreStore as qt, useI18n as kt } from "@feedmepos/mf-common";
|
|
4
|
+
import { useSnackbar as Ze, useDialog as Zt, useProxiedModel as Jt, components as be, useBreakpoints as Xt } from "@feedmepos/ui-library";
|
|
5
|
+
import { defineStore as xt, storeToRefs as ea } from "pinia";
|
|
6
|
+
import { u as Dt } from "./stock-GesfiBWR.js";
|
|
7
|
+
import { u as Je } from "./stock-BYRT4p1b.js";
|
|
8
|
+
import { E as ta } from "./empty-placeholder-wf6-BWE8.js";
|
|
9
|
+
const Oe = Ut((s, o) => {
|
|
10
|
+
function e() {
|
|
11
|
+
return ze().currentLocation.dbName;
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
async getDraft(m) {
|
|
15
|
+
const x = e(), h = `${s.inventoryBackendUrl}/${x}/closing-draft/${m}`;
|
|
16
|
+
return o.get(h);
|
|
17
|
+
},
|
|
18
|
+
async readDrafts() {
|
|
19
|
+
const m = e(), x = `${s.inventoryBackendUrl}/${m}/closing-draft`;
|
|
20
|
+
return o.get(x);
|
|
21
|
+
},
|
|
22
|
+
async runOperation(m) {
|
|
23
|
+
const x = e(), h = `${s.inventoryBackendUrl}/${x}/closing-draft/run-operation`;
|
|
24
|
+
return o.post(h, m);
|
|
25
|
+
},
|
|
26
|
+
async runOperationV1(m) {
|
|
27
|
+
const x = e(), h = `${s.inventoryBackendUrl}/${x}/closing-draft/v1/run-operation`;
|
|
28
|
+
return o.post(h, m);
|
|
29
|
+
},
|
|
30
|
+
async sync(m) {
|
|
31
|
+
const x = e(), h = `${s.inventoryBackendUrl}/${x}/closing-draft/sync`;
|
|
32
|
+
return o.post(h, m);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}), aa = { class: "fm-typo-en-body-lg-400" }, na = { class: "fm-typo-en-body-lg-600" }, oa = {
|
|
36
|
+
key: 0,
|
|
37
|
+
class: "flex flex-col"
|
|
38
|
+
}, sa = {
|
|
39
|
+
key: 0,
|
|
40
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-error mt-4"
|
|
41
|
+
}, ra = { class: "flex gap-12 py-8 justify-end w-full" }, Ke = /* @__PURE__ */ Ee({
|
|
42
|
+
__name: "ClosingDraftAction",
|
|
43
|
+
props: {
|
|
44
|
+
draft: {},
|
|
45
|
+
action: {},
|
|
46
|
+
onCancel: { type: Function },
|
|
47
|
+
onFinished: { type: Function }
|
|
48
|
+
},
|
|
49
|
+
setup(s) {
|
|
50
|
+
const o = s, e = H(), m = Oe(), x = Ze(), h = H(!1), g = H(null), P = H(!1), L = V(() => {
|
|
51
|
+
switch (o.action) {
|
|
52
|
+
case Y.enum.approveDraft:
|
|
53
|
+
return "Approve";
|
|
54
|
+
case Y.enum.rejectDraft:
|
|
55
|
+
return "Reject";
|
|
56
|
+
case Y.enum.markAsFailed:
|
|
57
|
+
return "Mark as Failed";
|
|
58
|
+
}
|
|
59
|
+
throw new Error(`Unknown action: ${o.action}`);
|
|
60
|
+
}), M = V(() => {
|
|
61
|
+
switch (o.action) {
|
|
62
|
+
case Y.enum.approveDraft:
|
|
63
|
+
return "primary";
|
|
64
|
+
case Y.enum.rejectDraft:
|
|
65
|
+
return "destructive";
|
|
66
|
+
case Y.enum.markAsFailed:
|
|
67
|
+
return "destructive";
|
|
68
|
+
}
|
|
69
|
+
throw new Error(`Unknown action: ${o.action}`);
|
|
70
|
+
});
|
|
71
|
+
We(() => {
|
|
72
|
+
if (o.draft.effectiveAt)
|
|
73
|
+
g.value = new Date(o.draft.effectiveAt);
|
|
74
|
+
else {
|
|
75
|
+
const c = new Date(o.draft.createdAt);
|
|
76
|
+
c.setHours(23, 59, 59, 999), g.value = c;
|
|
77
|
+
}
|
|
78
|
+
P.value = !0;
|
|
79
|
+
});
|
|
80
|
+
const k = V({
|
|
81
|
+
get() {
|
|
82
|
+
return g.value === null ? "" : Le(g.value);
|
|
83
|
+
},
|
|
84
|
+
set(c) {
|
|
85
|
+
if (c) {
|
|
86
|
+
const u = /* @__PURE__ */ new Date(`${c} ${N.value}`);
|
|
87
|
+
u.setSeconds(59, 999), g.value = u;
|
|
88
|
+
} else
|
|
89
|
+
g.value = null;
|
|
90
|
+
}
|
|
91
|
+
}), N = V({
|
|
92
|
+
get() {
|
|
93
|
+
return g.value === null ? "" : vt(g.value);
|
|
94
|
+
},
|
|
95
|
+
set(c) {
|
|
96
|
+
if (c) {
|
|
97
|
+
const u = /* @__PURE__ */ new Date(`${k.value} ${c}`);
|
|
98
|
+
u.setSeconds(59, 999), g.value = u;
|
|
99
|
+
} else
|
|
100
|
+
g.value = null;
|
|
101
|
+
}
|
|
102
|
+
}), B = V(() => g.value ? g.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
|
|
103
|
+
async function v(c) {
|
|
104
|
+
h.value = !0;
|
|
105
|
+
try {
|
|
106
|
+
c ? await m.runOperation({
|
|
107
|
+
_id: o.draft._id,
|
|
108
|
+
_rev: o.draft._rev ?? "",
|
|
109
|
+
action: o.action,
|
|
110
|
+
data: {
|
|
111
|
+
effectiveAt: g.value ? g.value.toISOString() : null,
|
|
112
|
+
remark: e.value
|
|
113
|
+
}
|
|
114
|
+
}).delayed(500) : await m.runOperationV1({
|
|
115
|
+
_id: o.draft._id,
|
|
116
|
+
_rev: o.draft._rev ?? "",
|
|
117
|
+
action: o.action,
|
|
118
|
+
data: {
|
|
119
|
+
effectiveAt: g.value ? g.value.toISOString() : null,
|
|
120
|
+
remark: e.value
|
|
121
|
+
}
|
|
122
|
+
}).delayed(500), x.open({
|
|
123
|
+
title: "Success",
|
|
124
|
+
message: "Action submitted",
|
|
125
|
+
type: "success"
|
|
126
|
+
}), o.onFinished();
|
|
127
|
+
} catch (u) {
|
|
128
|
+
x.open({
|
|
129
|
+
title: "Something went wrong",
|
|
130
|
+
message: (u == null ? void 0 : u.message) ?? "Unable to submit action. Please try again",
|
|
131
|
+
type: "error"
|
|
132
|
+
}), console.error("error on submit closing draft action", u);
|
|
133
|
+
} finally {
|
|
134
|
+
h.value = !1;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return (c, u) => {
|
|
138
|
+
const I = z("FmLabel"), y = z("FmDatePicker"), b = z("FmTimePicker"), C = z("FmTextField"), T = z("FmButton"), O = z("FmForm");
|
|
139
|
+
return P.value ? (F(), ue(O, {
|
|
140
|
+
key: 1,
|
|
141
|
+
onValidationSuccess: v,
|
|
142
|
+
class: "flex flex-col gap-32",
|
|
143
|
+
disabled: h.value
|
|
144
|
+
}, {
|
|
145
|
+
default: W(() => [
|
|
146
|
+
i("div", aa, [
|
|
147
|
+
u[5] || (u[5] = ne(" You are about to ")),
|
|
148
|
+
i("span", na, ae(L.value), 1),
|
|
149
|
+
u[6] || (u[6] = ne(" this draft. Please provide a remark to justify this action. "))
|
|
150
|
+
]),
|
|
151
|
+
c.action === $(Y).enum.approveDraft ? (F(), E("div", oa, [
|
|
152
|
+
_(I, { class: "fm-typo-en-body-lg-600" }, {
|
|
153
|
+
default: W(() => u[7] || (u[7] = [
|
|
154
|
+
ne("Closing Date")
|
|
155
|
+
])),
|
|
156
|
+
_: 1
|
|
157
|
+
}),
|
|
158
|
+
_(y, {
|
|
159
|
+
modelValue: k.value,
|
|
160
|
+
"onUpdate:modelValue": u[0] || (u[0] = (K) => k.value = K),
|
|
161
|
+
max: $(Le)(/* @__PURE__ */ new Date())
|
|
162
|
+
}, null, 8, ["modelValue", "max"]),
|
|
163
|
+
_(I, { class: "fm-typo-en-body-lg-600" }, {
|
|
164
|
+
default: W(() => u[8] || (u[8] = [
|
|
165
|
+
ne("Closing Time")
|
|
166
|
+
])),
|
|
167
|
+
_: 1
|
|
168
|
+
}),
|
|
169
|
+
_(b, {
|
|
170
|
+
modelValue: N.value,
|
|
171
|
+
"onUpdate:modelValue": u[1] || (u[1] = (K) => N.value = K)
|
|
172
|
+
}, null, 8, ["modelValue"]),
|
|
173
|
+
B.value ? (F(), E("div", sa, " Cannot select future date ")) : le("", !0)
|
|
174
|
+
])) : le("", !0),
|
|
175
|
+
_(C, {
|
|
176
|
+
modelValue: e.value,
|
|
177
|
+
"onUpdate:modelValue": u[2] || (u[2] = (K) => e.value = K),
|
|
178
|
+
label: "Remark",
|
|
179
|
+
"label-mark": "required",
|
|
180
|
+
rules: [$(Pt)()]
|
|
181
|
+
}, null, 8, ["modelValue", "rules"]),
|
|
182
|
+
i("div", ra, [
|
|
183
|
+
_(T, {
|
|
184
|
+
label: "Cancel",
|
|
185
|
+
variant: "tertiary",
|
|
186
|
+
onClick: u[3] || (u[3] = (K) => c.onCancel())
|
|
187
|
+
}),
|
|
188
|
+
_(T, {
|
|
189
|
+
label: L.value,
|
|
190
|
+
type: "submit",
|
|
191
|
+
variant: M.value,
|
|
192
|
+
loading: h.value,
|
|
193
|
+
disabled: B.value
|
|
194
|
+
}, null, 8, ["label", "variant", "loading", "disabled"]),
|
|
195
|
+
_(T, {
|
|
196
|
+
label: "Online Approve (Beta)",
|
|
197
|
+
type: "button",
|
|
198
|
+
onClick: u[4] || (u[4] = (K) => v(!0)),
|
|
199
|
+
variant: M.value,
|
|
200
|
+
loading: h.value,
|
|
201
|
+
disabled: B.value
|
|
202
|
+
}, null, 8, ["variant", "loading", "disabled"])
|
|
203
|
+
])
|
|
204
|
+
]),
|
|
205
|
+
_: 1
|
|
206
|
+
}, 8, ["disabled"])) : (F(), E(re, { key: 0 }, [
|
|
207
|
+
ne("Loading")
|
|
208
|
+
], 64));
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
}), la = Be(0);
|
|
212
|
+
function At(s) {
|
|
213
|
+
const o = s.measurementsAmounts.groupBy((m) => m.measurement.id), e = s.sku.unit.measurements.reduce((m, x) => {
|
|
214
|
+
var P, L;
|
|
215
|
+
const h = ((L = (P = o.get(x.id)) == null ? void 0 : P[0]) == null ? void 0 : L.amount) ?? la, g = qe(x.conversion, h);
|
|
216
|
+
return m + +Qe(g);
|
|
217
|
+
}, +Qe(s.baseAmount));
|
|
218
|
+
return Mt(e, s.baseAmount.precision);
|
|
219
|
+
}
|
|
220
|
+
const ia = Be(0), ca = Be(100), _t = "N/A";
|
|
221
|
+
function ua(s, o, e, m, x, h) {
|
|
222
|
+
var Q, Z, w, X, me;
|
|
223
|
+
const g = At(s), P = m ?? g, L = gt(P, o), M = o.amount === 0 ? null : yt(L, {
|
|
224
|
+
...o,
|
|
225
|
+
amount: Math.abs(o.amount)
|
|
226
|
+
}), k = M ? qe(M, ca) : null, N = ((Q = s.sku.defaultCost) == null ? void 0 : Q.costPerUnit) ?? { amount: 0, precision: 0 }, B = Number(R.toFormatString({ value: N })), v = ((w = (Z = s.sku.defaultCost) == null ? void 0 : Z.measurement) == null ? void 0 : w.conversion) ?? {
|
|
227
|
+
amount: 1,
|
|
228
|
+
precision: 0
|
|
229
|
+
}, c = Number(
|
|
230
|
+
R.toFormatString({ value: v })
|
|
231
|
+
), u = x ? Number(R.toFormatString({ value: x })) : 0, I = Number(R.toFormatString({ value: o })), y = Number(R.toFormatString({ value: P })), b = I - y, C = b * B / c, T = y * B / c, O = I * B / c;
|
|
232
|
+
return {
|
|
233
|
+
code: s.sku.code,
|
|
234
|
+
name: s.sku.name,
|
|
235
|
+
baseUnit: s.sku.unit.abbrev,
|
|
236
|
+
costUnit: ((me = (X = s.sku.defaultCost) == null ? void 0 : X.measurement) == null ? void 0 : me.abbrev) ?? null,
|
|
237
|
+
baseUnitAmount: Number(R.toFormatString({ value: s.baseAmount })),
|
|
238
|
+
...s.measurementsAmounts.filter(
|
|
239
|
+
(ee) => ma(ee.measurement) && e.includes(ee.measurement.id)
|
|
240
|
+
).reduce(
|
|
241
|
+
(ee, oe, de) => (ee[`measurementAbbrev${de}`] = `(${oe.measurement.abbrev}) × ${R.toFormatString({ value: oe.measurement.conversion })}`, ee[`measurementAmount${de}`] = Number(R.toFormatString({ value: oe.amount })), ee),
|
|
242
|
+
{}
|
|
243
|
+
),
|
|
244
|
+
systemBalance: I,
|
|
245
|
+
physicalBalance: y,
|
|
246
|
+
adjustedAmount: Number(R.toFormatString({ value: L })),
|
|
247
|
+
adjustedDiffPercentage: k ? Number(
|
|
248
|
+
R.toFormatString({
|
|
249
|
+
value: bt(k, 2)
|
|
250
|
+
})
|
|
251
|
+
) : null,
|
|
252
|
+
costPerUnit: B,
|
|
253
|
+
opening: u,
|
|
254
|
+
adjustmentTypes: h ?? _t,
|
|
255
|
+
varianceQty: b,
|
|
256
|
+
varianceInCost: C,
|
|
257
|
+
stockTakeValue: T,
|
|
258
|
+
systemValue: O
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
function ma(s) {
|
|
262
|
+
return !s.abbrev.toLocaleLowerCase().includes("inactive");
|
|
263
|
+
}
|
|
264
|
+
function da(s) {
|
|
265
|
+
const o = wt(s);
|
|
266
|
+
return s.reduce(
|
|
267
|
+
(e, m) => {
|
|
268
|
+
var x;
|
|
269
|
+
return Math.max(e, ((x = o == null ? void 0 : o.get(m.sku._id)) == null ? void 0 : x[0].length) ?? 0);
|
|
270
|
+
},
|
|
271
|
+
0
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
function wt(s) {
|
|
275
|
+
return s.groupBy(
|
|
276
|
+
(o) => o.sku._id,
|
|
277
|
+
(o) => o.measurementsAmounts.filter((e) => !e.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((e) => e.measurement.id)
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
function fa(s) {
|
|
281
|
+
const o = ht(), e = o === "MYR" ? "RM" : o;
|
|
282
|
+
return [
|
|
283
|
+
{
|
|
284
|
+
id: "code",
|
|
285
|
+
name: "Code"
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
id: "name",
|
|
289
|
+
name: "Name"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
id: "baseUnit",
|
|
293
|
+
name: "Base unit"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
id: "costPerUnit",
|
|
297
|
+
name: "Cost per unit"
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
id: "costUnit",
|
|
301
|
+
name: "UOM"
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
id: "opening",
|
|
305
|
+
name: "Opening (B/F)"
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
id: "adjustmentTypes",
|
|
309
|
+
name: "Type"
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
id: "varianceQty",
|
|
313
|
+
name: "Variance (Qty)"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
id: "varianceInCost",
|
|
317
|
+
name: `Variance (${e})`
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
id: "physicalBalance",
|
|
321
|
+
name: "Stock take (Qty)"
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
id: "systemBalance",
|
|
325
|
+
name: "System balance (Qty)"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
id: "stockTakeValue",
|
|
329
|
+
name: `Stock take value (${e})`
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
id: "systemValue",
|
|
333
|
+
name: `System value (${e})`
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
id: "adjustedAmount",
|
|
337
|
+
name: "Adjusted balance"
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
id: "adjustedDiffPercentage",
|
|
341
|
+
name: "Diff (%)"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
id: "baseUnitAmount",
|
|
345
|
+
name: "Base unit amount"
|
|
346
|
+
},
|
|
347
|
+
...Array.from({ length: s }).flatMap((x, h) => [
|
|
348
|
+
{
|
|
349
|
+
id: `measurementAmount${h}`,
|
|
350
|
+
name: `UOM amount ${h + 1}`
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
id: `measurementAbbrev${h}`,
|
|
354
|
+
name: `UOM ${h + 1}`
|
|
355
|
+
}
|
|
356
|
+
])
|
|
357
|
+
];
|
|
358
|
+
}
|
|
359
|
+
function pa(s, o, e) {
|
|
360
|
+
var b, C, T, O, K, Q, Z;
|
|
361
|
+
const m = o.groupBy(
|
|
362
|
+
(w) => w.id,
|
|
363
|
+
(w) => w.balance
|
|
364
|
+
), x = e.groupBy(
|
|
365
|
+
(w) => w.id,
|
|
366
|
+
(w) => w.balance
|
|
367
|
+
), h = /* @__PURE__ */ new Map();
|
|
368
|
+
if (s.opening)
|
|
369
|
+
for (const w of s.opening)
|
|
370
|
+
h.set(w.skuId, w.balance);
|
|
371
|
+
const g = /* @__PURE__ */ new Map();
|
|
372
|
+
if (s.adjustmentSnapshot)
|
|
373
|
+
for (const w of s.adjustmentSnapshot) {
|
|
374
|
+
const X = Object.keys(w.adjustmentsByType).join(", ");
|
|
375
|
+
g.set(w.skuId, X || _t);
|
|
376
|
+
}
|
|
377
|
+
const P = [...s.items, ...s.negativeStockItems ?? []], L = wt(P), M = P.map((w) => {
|
|
378
|
+
var de, xe, De;
|
|
379
|
+
const X = ((de = m.get(w.sku._id)) == null ? void 0 : de[0]) ?? ia, me = ((xe = L == null ? void 0 : L.get(w.sku._id)) == null ? void 0 : xe[0]) ?? [], ee = h.get(w.sku._id), oe = g.get(w.sku._id);
|
|
380
|
+
return ua(
|
|
381
|
+
w,
|
|
382
|
+
X,
|
|
383
|
+
me,
|
|
384
|
+
(De = x.get(w.sku._id)) == null ? void 0 : De[0],
|
|
385
|
+
ee,
|
|
386
|
+
oe
|
|
387
|
+
);
|
|
388
|
+
}), k = da(P), B = qt().currentBusiness.value, v = fa(k), c = [
|
|
389
|
+
["Business name:", B == null ? void 0 : B.name],
|
|
390
|
+
["Business ID:", B == null ? void 0 : B._id],
|
|
391
|
+
["Menu version", B == null ? void 0 : B.menuVersion],
|
|
392
|
+
["Created at", new Date(s.createdAt)],
|
|
393
|
+
["Created by", (b = s.createdBy) == null ? void 0 : b.name],
|
|
394
|
+
["Updated at", new Date(s.updatedAt)],
|
|
395
|
+
["Updated by", (C = s.updatedBy) == null ? void 0 : C.name],
|
|
396
|
+
["Recent action", s.approvedAt ? "Approve" : s.rejectionHistory ? "Reject" : ""],
|
|
397
|
+
[
|
|
398
|
+
"Action by",
|
|
399
|
+
s.approvedAt ? (T = s.approvedBy) == null ? void 0 : T.name : s.rejectionHistory ? (K = (O = s.rejectionHistory[0]) == null ? void 0 : O.rejectedBy) == null ? void 0 : K.name : ""
|
|
400
|
+
],
|
|
401
|
+
[
|
|
402
|
+
"Action at",
|
|
403
|
+
s.approvedAt ? new Date(s.approvedAt) : s.rejectionHistory ? new Date((Q = s.rejectionHistory[0]) == null ? void 0 : Q.rejectedAt) : ""
|
|
404
|
+
],
|
|
405
|
+
[
|
|
406
|
+
"Action remark",
|
|
407
|
+
s.approvedAt ? s.approveRemark : s.rejectionHistory ? new Date((Z = s.rejectionHistory[0]) == null ? void 0 : Z.rejectRemark) : ""
|
|
408
|
+
],
|
|
409
|
+
[],
|
|
410
|
+
v.map((w) => w.name),
|
|
411
|
+
...M.map((w) => v.map((X) => w[X.id]))
|
|
412
|
+
], u = v.map((w) => `system:${w.id}`), I = Rt(c, u), y = `[${B == null ? void 0 : B.name}] closing draft (${Vt(new Date(s.updatedAt))}).xlsx`;
|
|
413
|
+
return Lt(I, y), y;
|
|
414
|
+
}
|
|
415
|
+
const va = { class: "flex flex-col" }, ga = {
|
|
416
|
+
key: 0,
|
|
417
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-error mt-4"
|
|
418
|
+
}, ya = { class: "flex gap-12 py-8 justify-end w-full" }, ba = /* @__PURE__ */ Ee({
|
|
419
|
+
__name: "RefreshBalanceAction",
|
|
420
|
+
props: {
|
|
421
|
+
draft: {},
|
|
422
|
+
onCancel: { type: Function },
|
|
423
|
+
onFinished: { type: Function }
|
|
424
|
+
},
|
|
425
|
+
setup(s) {
|
|
426
|
+
const o = s;
|
|
427
|
+
Je();
|
|
428
|
+
const e = H(!1), m = H(null), x = H(!1);
|
|
429
|
+
We(() => {
|
|
430
|
+
if (o.draft.effectiveAt)
|
|
431
|
+
m.value = new Date(o.draft.effectiveAt);
|
|
432
|
+
else {
|
|
433
|
+
const M = new Date(o.draft.createdAt);
|
|
434
|
+
M.setHours(23, 59, 59, 999), m.value = M;
|
|
435
|
+
}
|
|
436
|
+
x.value = !0;
|
|
437
|
+
});
|
|
438
|
+
const h = V({
|
|
439
|
+
get() {
|
|
440
|
+
return m.value === null ? "" : Le(m.value);
|
|
441
|
+
},
|
|
442
|
+
set(M) {
|
|
443
|
+
if (M) {
|
|
444
|
+
const k = /* @__PURE__ */ new Date(`${M} ${g.value}`);
|
|
445
|
+
k.setSeconds(59, 999), m.value = k;
|
|
446
|
+
} else
|
|
447
|
+
m.value = null;
|
|
448
|
+
}
|
|
449
|
+
}), g = V({
|
|
450
|
+
get() {
|
|
451
|
+
return m.value === null ? "" : vt(m.value);
|
|
452
|
+
},
|
|
453
|
+
set(M) {
|
|
454
|
+
if (M) {
|
|
455
|
+
const k = /* @__PURE__ */ new Date(`${h.value} ${M}`);
|
|
456
|
+
k.setSeconds(59, 999), m.value = k;
|
|
457
|
+
} else
|
|
458
|
+
m.value = null;
|
|
459
|
+
}
|
|
460
|
+
}), P = V(() => m.value ? m.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
|
|
461
|
+
async function L() {
|
|
462
|
+
e.value = !0, o.onFinished(m.value.toISOString());
|
|
463
|
+
}
|
|
464
|
+
return (M, k) => {
|
|
465
|
+
const N = z("FmLabel"), B = z("FmDatePicker"), v = z("FmTimePicker"), c = z("FmButton"), u = z("FmForm");
|
|
466
|
+
return x.value ? (F(), ue(u, {
|
|
467
|
+
key: 1,
|
|
468
|
+
onValidationSuccess: L,
|
|
469
|
+
class: "flex flex-col gap-32",
|
|
470
|
+
disabled: e.value
|
|
471
|
+
}, {
|
|
472
|
+
default: W(() => [
|
|
473
|
+
k[5] || (k[5] = i("div", { class: "fm-typo-en-body-lg-400" }, [
|
|
474
|
+
i("p", null, [
|
|
475
|
+
ne(" Performing "),
|
|
476
|
+
i("span", { class: "fm-typo-en-body-lg-600" }, '"Refresh Balance"'),
|
|
477
|
+
ne(" until closing effective date and time. ")
|
|
478
|
+
]),
|
|
479
|
+
i("p", { class: "mt-2" }, [
|
|
480
|
+
ne(" Please note that this action will "),
|
|
481
|
+
i("b", null, "update"),
|
|
482
|
+
ne(" the effective date and time. ")
|
|
483
|
+
])
|
|
484
|
+
], -1)),
|
|
485
|
+
i("div", va, [
|
|
486
|
+
_(N, { class: "fm-typo-en-body-lg-600" }, {
|
|
487
|
+
default: W(() => k[3] || (k[3] = [
|
|
488
|
+
ne("Closing Date")
|
|
489
|
+
])),
|
|
490
|
+
_: 1
|
|
491
|
+
}),
|
|
492
|
+
_(B, {
|
|
493
|
+
modelValue: h.value,
|
|
494
|
+
"onUpdate:modelValue": k[0] || (k[0] = (I) => h.value = I),
|
|
495
|
+
max: $(Le)(/* @__PURE__ */ new Date())
|
|
496
|
+
}, null, 8, ["modelValue", "max"]),
|
|
497
|
+
_(N, { class: "fm-typo-en-body-lg-600" }, {
|
|
498
|
+
default: W(() => k[4] || (k[4] = [
|
|
499
|
+
ne("Closing Time")
|
|
500
|
+
])),
|
|
501
|
+
_: 1
|
|
502
|
+
}),
|
|
503
|
+
_(v, {
|
|
504
|
+
modelValue: g.value,
|
|
505
|
+
"onUpdate:modelValue": k[1] || (k[1] = (I) => g.value = I)
|
|
506
|
+
}, null, 8, ["modelValue"]),
|
|
507
|
+
P.value ? (F(), E("div", ga, " Cannot select future date ")) : le("", !0)
|
|
508
|
+
]),
|
|
509
|
+
i("div", ya, [
|
|
510
|
+
_(c, {
|
|
511
|
+
label: "Cancel",
|
|
512
|
+
variant: "tertiary",
|
|
513
|
+
onClick: k[2] || (k[2] = (I) => M.onCancel())
|
|
514
|
+
}),
|
|
515
|
+
_(c, {
|
|
516
|
+
label: "Refresh balance",
|
|
517
|
+
type: "submit",
|
|
518
|
+
variant: "primary",
|
|
519
|
+
loading: e.value,
|
|
520
|
+
disabled: P.value
|
|
521
|
+
}, null, 8, ["loading", "disabled"])
|
|
522
|
+
])
|
|
523
|
+
]),
|
|
524
|
+
_: 1
|
|
525
|
+
}, 8, ["disabled"])) : (F(), E(re, { key: 0 }, [
|
|
526
|
+
ne("Loading")
|
|
527
|
+
], 64));
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
}), Ne = xt(
|
|
531
|
+
"closingDraftActions",
|
|
532
|
+
function() {
|
|
533
|
+
const o = Zt(), e = Ze(), m = Je(), x = Oe(), h = Dt(), g = H(!1), P = H();
|
|
534
|
+
function L(y) {
|
|
535
|
+
const b = {
|
|
536
|
+
draft: y
|
|
537
|
+
};
|
|
538
|
+
P.value = b, g.value = !0;
|
|
539
|
+
}
|
|
540
|
+
async function M(y) {
|
|
541
|
+
var C;
|
|
542
|
+
if (y.status === he.enum.COMPLETED) {
|
|
543
|
+
const T = y.closingAdjustmentId;
|
|
544
|
+
if (!T)
|
|
545
|
+
return e.open({
|
|
546
|
+
title: "Something went wrong",
|
|
547
|
+
message: "Closing draft is completed but closing document cannot be found.",
|
|
548
|
+
type: "error"
|
|
549
|
+
}), console.error("Closing draft is completed but closing document cannot be found.", {
|
|
550
|
+
draftId: y._id
|
|
551
|
+
}), [];
|
|
552
|
+
const O = await m.readAdjustmentById(T);
|
|
553
|
+
return ((O == null ? void 0 : O.skus) ?? []).map((Q) => ({
|
|
554
|
+
id: Q.sku._id,
|
|
555
|
+
balance: Q.fromBalance,
|
|
556
|
+
costs: Q.fromCostBalances
|
|
557
|
+
}));
|
|
558
|
+
} else
|
|
559
|
+
return await h.readStockBalance(), ((C = h.stockBalance) == null ? void 0 : C.skus) ?? [];
|
|
560
|
+
}
|
|
561
|
+
async function k(y, b, C) {
|
|
562
|
+
b || (e.open({
|
|
563
|
+
title: "Exporting",
|
|
564
|
+
message: "Fetching data..."
|
|
565
|
+
}), b = await M(y)), pa(y, b, C ?? []);
|
|
566
|
+
}
|
|
567
|
+
function N(y, b) {
|
|
568
|
+
o.open({
|
|
569
|
+
title: "Approve draft",
|
|
570
|
+
contentComponent: Ke,
|
|
571
|
+
contentComponentProps: {
|
|
572
|
+
draft: y,
|
|
573
|
+
action: Y.enum.approveDraft,
|
|
574
|
+
onFinished: () => {
|
|
575
|
+
o.close(), b == null || b();
|
|
576
|
+
},
|
|
577
|
+
onCancel: () => o.close()
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
function B(y, b) {
|
|
582
|
+
o.open({
|
|
583
|
+
title: "Reject draft",
|
|
584
|
+
contentComponent: Ke,
|
|
585
|
+
contentComponentProps: {
|
|
586
|
+
draft: y,
|
|
587
|
+
action: Y.enum.rejectDraft,
|
|
588
|
+
onFinished: () => {
|
|
589
|
+
o.close(), b == null || b();
|
|
590
|
+
},
|
|
591
|
+
onCancel: () => o.close()
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
function v(y, b) {
|
|
596
|
+
o.open({
|
|
597
|
+
title: "Mark draft as failed",
|
|
598
|
+
contentComponent: Ke,
|
|
599
|
+
contentComponentProps: {
|
|
600
|
+
draft: y,
|
|
601
|
+
action: Y.enum.markAsFailed,
|
|
602
|
+
onFinished: () => {
|
|
603
|
+
o.close(), b == null || b();
|
|
604
|
+
},
|
|
605
|
+
onCancel: () => o.close()
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
async function c(y, b) {
|
|
610
|
+
await x.sync({
|
|
611
|
+
_id: y._id,
|
|
612
|
+
_rev: y._rev ?? "",
|
|
613
|
+
action: Y.enum.approveDraft,
|
|
614
|
+
data: {
|
|
615
|
+
remark: y.remark ?? ""
|
|
616
|
+
}
|
|
617
|
+
}).delayed(500), e.open({
|
|
618
|
+
title: "Success",
|
|
619
|
+
message: "Sync requested",
|
|
620
|
+
type: "success"
|
|
621
|
+
}), b == null || b();
|
|
622
|
+
}
|
|
623
|
+
function u() {
|
|
624
|
+
g.value = !1;
|
|
625
|
+
}
|
|
626
|
+
async function I(y, b, C) {
|
|
627
|
+
await o.open({
|
|
628
|
+
title: "Refresh balance",
|
|
629
|
+
contentComponent: ba,
|
|
630
|
+
contentComponentProps: {
|
|
631
|
+
draft: y,
|
|
632
|
+
onFinished: (T) => {
|
|
633
|
+
o.close(), C == null || C(T);
|
|
634
|
+
},
|
|
635
|
+
onCancel: async () => {
|
|
636
|
+
o.close(), b == null || b();
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
return {
|
|
642
|
+
viewDraft: L,
|
|
643
|
+
closeDraftDialog: u,
|
|
644
|
+
approveDraft: N,
|
|
645
|
+
rejectDraft: B,
|
|
646
|
+
markAsFailed: v,
|
|
647
|
+
syncDraft: c,
|
|
648
|
+
exportDraft: k,
|
|
649
|
+
refreshBalance: I,
|
|
650
|
+
viewClosingDraftShow: g,
|
|
651
|
+
viewClosingDraftProps: P
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
);
|
|
655
|
+
function Ve(s) {
|
|
656
|
+
switch (s) {
|
|
657
|
+
case "DRAFT":
|
|
658
|
+
return "fm-status-badge-draft";
|
|
659
|
+
case "PROCESSING":
|
|
660
|
+
return "fm-status-badge-processing";
|
|
661
|
+
case "FAILED":
|
|
662
|
+
return "fm-status-badge-cancel";
|
|
663
|
+
case "COMPLETED":
|
|
664
|
+
return "fm-status-badge-complete";
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
const ha = xt(
|
|
668
|
+
"closingDraftTable",
|
|
669
|
+
function() {
|
|
670
|
+
const { t: o } = kt(), e = Ne(), m = H(new Array()), x = H(!1), h = ze(), g = Oe();
|
|
671
|
+
async function P() {
|
|
672
|
+
if (m.value = [], !!h._currentLocation) {
|
|
673
|
+
x.value = !0;
|
|
674
|
+
try {
|
|
675
|
+
const [v] = await Promise.all([g.readDrafts()]).delayed(1e3);
|
|
676
|
+
m.value = v.reverse();
|
|
677
|
+
} catch (v) {
|
|
678
|
+
console.log("Something went wrong when fetching drafts:", v);
|
|
679
|
+
} finally {
|
|
680
|
+
x.value = !1;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
async function L(v) {
|
|
685
|
+
if (!m.value.find((c) => c._id) && h._currentLocation) {
|
|
686
|
+
x.value = !0;
|
|
687
|
+
try {
|
|
688
|
+
const [c] = await Promise.all([
|
|
689
|
+
g.getDraft(v),
|
|
690
|
+
new Promise((u) => setTimeout(u, 1e3))
|
|
691
|
+
]);
|
|
692
|
+
m.value = [c];
|
|
693
|
+
} catch (c) {
|
|
694
|
+
console.log("Something went wrong when fetching drafts:", c);
|
|
695
|
+
} finally {
|
|
696
|
+
x.value = !1;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
function M(v) {
|
|
701
|
+
m.value = m.value.map((c) => c._id === v._id ? {
|
|
702
|
+
...v,
|
|
703
|
+
_rev: c._rev
|
|
704
|
+
} : c);
|
|
705
|
+
}
|
|
706
|
+
function k() {
|
|
707
|
+
e.closeDraftDialog(), P();
|
|
708
|
+
}
|
|
709
|
+
function N(v, c) {
|
|
710
|
+
switch (c = zt(c), v) {
|
|
711
|
+
case Pe.Details:
|
|
712
|
+
return e.viewDraft(c);
|
|
713
|
+
case Pe.Export:
|
|
714
|
+
return e.exportDraft(c);
|
|
715
|
+
case Y.enum.approveDraft:
|
|
716
|
+
return e.approveDraft(c, k);
|
|
717
|
+
case Y.enum.rejectDraft:
|
|
718
|
+
return e.rejectDraft(c, k);
|
|
719
|
+
case Y.enum.markAsFailed:
|
|
720
|
+
return e.markAsFailed(c, k);
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
return {
|
|
724
|
+
columnDefs: [
|
|
725
|
+
{
|
|
726
|
+
id: "_id",
|
|
727
|
+
accessorKey: "_id",
|
|
728
|
+
header: () => o("inventory.closing.table.createdAt"),
|
|
729
|
+
cell(v) {
|
|
730
|
+
return Nt(`${v.getValue()}`);
|
|
731
|
+
},
|
|
732
|
+
enableSorting: !0
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
accessorKey: "effectiveAt",
|
|
736
|
+
header: () => "Effective at",
|
|
737
|
+
cell(v) {
|
|
738
|
+
const c = v.row.original;
|
|
739
|
+
let u = v.getValue();
|
|
740
|
+
return u || (u = Ge(c._id)), ke(u);
|
|
741
|
+
},
|
|
742
|
+
enableSorting: !0,
|
|
743
|
+
size: 200
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
id: "updatedAt",
|
|
747
|
+
accessorFn: (v) => ke(v.updatedAt),
|
|
748
|
+
header: () => "Updated at",
|
|
749
|
+
enableSorting: !0,
|
|
750
|
+
size: 200
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
id: "updatedBy",
|
|
754
|
+
accessorKey: "updatedBy.name",
|
|
755
|
+
header: () => "Last update by",
|
|
756
|
+
enableSorting: !0,
|
|
757
|
+
size: 200
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
id: "noOfItems",
|
|
761
|
+
accessorFn: (v) => {
|
|
762
|
+
var c;
|
|
763
|
+
return v.items.length + (((c = v.negativeStockItems) == null ? void 0 : c.length) ?? 0);
|
|
764
|
+
},
|
|
765
|
+
header: () => o("inventory.closing.table.noOfItems"),
|
|
766
|
+
enableSorting: !1,
|
|
767
|
+
meta: {
|
|
768
|
+
width: "10rem",
|
|
769
|
+
textAlign: "right"
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
{
|
|
773
|
+
id: "recentRemark",
|
|
774
|
+
accessorFn: (v) => {
|
|
775
|
+
var c;
|
|
776
|
+
return (v == null ? void 0 : v.approveRemark) ?? ((c = v == null ? void 0 : v.rejectionHistory) == null ? void 0 : c.computeFirst((u) => u.rejectRemark)) ?? v.remark;
|
|
777
|
+
},
|
|
778
|
+
header: () => "Recent remark"
|
|
779
|
+
},
|
|
780
|
+
{
|
|
781
|
+
id: "status",
|
|
782
|
+
accessorFn: (v) => v.status,
|
|
783
|
+
header: () => o("inventory.closing.table.status"),
|
|
784
|
+
enableSorting: !1,
|
|
785
|
+
cell(v) {
|
|
786
|
+
var C;
|
|
787
|
+
const c = v.row.original, u = c.status, I = new Date(c.updatedAt), y = (C = c == null ? void 0 : c.rejectionHistory) == null ? void 0 : C.computeFirst((T) => T.rejectedAt), b = y ? new Date(y) : null;
|
|
788
|
+
return u === "DRAFT" && b ? b.getTime() > I.getTime() ? A(
|
|
789
|
+
"div",
|
|
790
|
+
{
|
|
791
|
+
class: "flex"
|
|
792
|
+
},
|
|
793
|
+
A(
|
|
794
|
+
"div",
|
|
795
|
+
{
|
|
796
|
+
class: ["fm-status-badge", Ve("FAILED")]
|
|
797
|
+
},
|
|
798
|
+
"Rejected"
|
|
799
|
+
)
|
|
800
|
+
) : A(
|
|
801
|
+
"div",
|
|
802
|
+
{
|
|
803
|
+
class: "flex"
|
|
804
|
+
},
|
|
805
|
+
A(
|
|
806
|
+
"div",
|
|
807
|
+
{
|
|
808
|
+
class: ["fm-status-badge", Ve("PROCESSING")]
|
|
809
|
+
},
|
|
810
|
+
"Updated"
|
|
811
|
+
)
|
|
812
|
+
) : A(
|
|
813
|
+
"div",
|
|
814
|
+
{
|
|
815
|
+
class: "flex"
|
|
816
|
+
},
|
|
817
|
+
A(
|
|
818
|
+
"div",
|
|
819
|
+
{
|
|
820
|
+
class: ["fm-status-badge", Ve(u)]
|
|
821
|
+
},
|
|
822
|
+
Re(u)
|
|
823
|
+
)
|
|
824
|
+
);
|
|
825
|
+
}
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
id: "action",
|
|
829
|
+
cell(v) {
|
|
830
|
+
const c = v.row.original, u = [
|
|
831
|
+
dt[Pe.Details],
|
|
832
|
+
dt[Pe.Export]
|
|
833
|
+
], I = [
|
|
834
|
+
{
|
|
835
|
+
translationKey: "inventory.closing.draft.approveDraft",
|
|
836
|
+
color: "text-fm-color-typo-primary",
|
|
837
|
+
value: Y.enum.approveDraft
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
translationKey: "inventory.closing.draft.rejectDraft",
|
|
841
|
+
color: "text-fm-color-typo-error",
|
|
842
|
+
value: Y.enum.rejectDraft
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
translationKey: "inventory.closing.draft.markAsFailed",
|
|
846
|
+
color: "text-fm-color-typo-error",
|
|
847
|
+
value: Y.enum.markAsFailed
|
|
848
|
+
}
|
|
849
|
+
];
|
|
850
|
+
return Et(
|
|
851
|
+
[
|
|
852
|
+
...u,
|
|
853
|
+
...c.status === he.enum.DRAFT ? I : []
|
|
854
|
+
],
|
|
855
|
+
(y) => N(y, c)
|
|
856
|
+
);
|
|
857
|
+
},
|
|
858
|
+
enableSorting: !1,
|
|
859
|
+
size: 40,
|
|
860
|
+
meta: {
|
|
861
|
+
cellClass: "",
|
|
862
|
+
headerClass: ""
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
],
|
|
866
|
+
drafts: m,
|
|
867
|
+
loading: x,
|
|
868
|
+
fetchDrafts: P,
|
|
869
|
+
loadDraft: L,
|
|
870
|
+
updateDraftRef: M
|
|
871
|
+
};
|
|
872
|
+
}
|
|
873
|
+
), ka = { class: "w-full flex flex-col gap-32" }, xa = { class: "flex justify-between" }, Da = { class: "flex" }, Aa = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, _a = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, wa = { class: "flex gap-1" }, Sa = { class: "fm-typo-en-body-lg-600" }, Fa = { class: "flex flex-col gap-16" }, Ca = { class: "flex items-center" }, $a = {
|
|
874
|
+
key: 0,
|
|
875
|
+
class: "flex gap-8"
|
|
876
|
+
}, Ba = {
|
|
877
|
+
key: 0,
|
|
878
|
+
class: "w-full flex flex-col items-center"
|
|
879
|
+
}, Ta = { class: "flex items-center gap-8" }, ja = { class: "flex flex-col gap-8" }, Ia = { class: "flex gap-8" }, Ua = {
|
|
880
|
+
key: 0,
|
|
881
|
+
class: "flex gap-8"
|
|
882
|
+
}, Pa = { class: "overflow-x-auto" }, Ma = {
|
|
883
|
+
key: 1,
|
|
884
|
+
class: "flex-1 xs:w-screen xs:max-w-full"
|
|
885
|
+
}, Ra = {
|
|
886
|
+
key: 0,
|
|
887
|
+
class: "flex flex-col items-center gap-8 h-full"
|
|
888
|
+
}, Va = ["src"], La = {
|
|
889
|
+
key: 1,
|
|
890
|
+
class: "px-4 flex flex-col"
|
|
891
|
+
}, Na = { class: "flex gap-12 content-stretch" }, Ea = {
|
|
892
|
+
class: "flex flex-col w-24",
|
|
893
|
+
name: "circles"
|
|
894
|
+
}, za = { class: "flex-1 flex flex-col items-center" }, Oa = { class: "flex-1 flex flex-col items-center" }, Ha = {
|
|
895
|
+
class: "py-12 flex flex-col gap-4",
|
|
896
|
+
name: "received-at header"
|
|
897
|
+
}, Ya = { class: "fm-typo-en-body-lg-400" }, Ka = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Qa = { class: "flex gap-12 content-stretch" }, Ga = {
|
|
898
|
+
class: "flex flex-col w-24",
|
|
899
|
+
name: "circles"
|
|
900
|
+
}, Wa = { class: "flex-1 flex flex-col items-center" }, qa = {
|
|
901
|
+
class: "py-12 flex flex-col gap-4 flex-1",
|
|
902
|
+
name: "delivery details"
|
|
903
|
+
}, Za = { class: "flex flex-col gap-8" }, Ja = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Xa = { class: "flex flex-col gap-4" }, en = { class: "flex gap-8" }, tn = "N/A", an = /* @__PURE__ */ Ee({
|
|
904
|
+
__name: "ClosingDraftDialog",
|
|
905
|
+
props: {
|
|
906
|
+
show: { type: Boolean },
|
|
907
|
+
draft: {}
|
|
908
|
+
},
|
|
909
|
+
emits: ["submitted", "refresh"],
|
|
910
|
+
setup(s, { emit: o }) {
|
|
911
|
+
const e = s, m = V(() => {
|
|
912
|
+
const r = ht();
|
|
913
|
+
return r === "MYR" ? "RM" : r;
|
|
914
|
+
}), x = Dt(), h = Ne(), g = Jt(e, "show"), P = H(!1), L = H(!1), M = H(!1), k = H(new Array()), N = H(new Array()), B = H([]), v = Je(), c = Oe(), u = Ze(), I = Ot(), y = ze(), b = Bt({}), C = V(() => new Set(
|
|
915
|
+
I.skus.filter((r) => {
|
|
916
|
+
var t;
|
|
917
|
+
return b[(t = r.customAttributes) == null ? void 0 : t.tag];
|
|
918
|
+
}).map((r) => r._id)
|
|
919
|
+
)), T = o, O = H({
|
|
920
|
+
templateItem: !0,
|
|
921
|
+
nonTemplateItem: !0
|
|
922
|
+
}), K = V(() => {
|
|
923
|
+
var t, d;
|
|
924
|
+
const r = [...((t = e.draft) == null ? void 0 : t.items) ?? [], ...((d = e.draft) == null ? void 0 : d.negativeStockItems) ?? []];
|
|
925
|
+
return C.value.size ? r.filter((a) => C.value.has(a.sku._id)) : r;
|
|
926
|
+
}), Q = V(() => {
|
|
927
|
+
const r = K.value.map((t) => t.sku);
|
|
928
|
+
return r.sort((t, d) => t.code.localeCompare(d.code)), r;
|
|
929
|
+
}), Z = V(() => K.value.groupBy(
|
|
930
|
+
(t) => t.sku._id,
|
|
931
|
+
(t) => t.measurementsAmounts.filter((d) => !d.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((d) => d.measurement.id)
|
|
932
|
+
));
|
|
933
|
+
We(me), Tt(
|
|
934
|
+
() => e.show,
|
|
935
|
+
(r) => {
|
|
936
|
+
r && (ge.value = ve[0], me(), O.value = {
|
|
937
|
+
templateItem: !0,
|
|
938
|
+
nonTemplateItem: !0
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
);
|
|
942
|
+
const w = Be(0), X = Be(100);
|
|
943
|
+
async function me() {
|
|
944
|
+
var t, d, a, n;
|
|
945
|
+
if (!y._currentLocation) return;
|
|
946
|
+
P.value = !0;
|
|
947
|
+
const r = ((t = e.draft) == null ? void 0 : t.status) === he.enum.COMPLETED;
|
|
948
|
+
N.value = [];
|
|
949
|
+
try {
|
|
950
|
+
if (await I.init(), r) {
|
|
951
|
+
const j = e.draft.closingAdjustmentId;
|
|
952
|
+
if (!j) {
|
|
953
|
+
u.open({
|
|
954
|
+
title: "Something went wrong",
|
|
955
|
+
message: "Closing draft is completed but closing document cannot be found.",
|
|
956
|
+
type: "error"
|
|
957
|
+
}), console.error("Closing draft is completed but closing document cannot be found.", {
|
|
958
|
+
draftId: (d = e.draft) == null ? void 0 : d._id
|
|
959
|
+
});
|
|
960
|
+
return;
|
|
961
|
+
}
|
|
962
|
+
const U = await v.readAdjustmentById(j), se = (U == null ? void 0 : U.skus) ?? [];
|
|
963
|
+
for (const ie of se) {
|
|
964
|
+
const _e = {
|
|
965
|
+
id: ie.sku._id,
|
|
966
|
+
balance: ie.fromBalance,
|
|
967
|
+
costs: ie.fromCostBalances
|
|
968
|
+
}, S = {
|
|
969
|
+
id: ie.sku._id,
|
|
970
|
+
balance: ie.toBalance,
|
|
971
|
+
costs: ie.toCostBalances
|
|
972
|
+
};
|
|
973
|
+
k.value.push(_e), N.value.push(S);
|
|
974
|
+
}
|
|
975
|
+
} else
|
|
976
|
+
k.value = ((a = e.draft) == null ? void 0 : a.stockSnapshot) ?? [];
|
|
977
|
+
const l = /* @__PURE__ */ new Set();
|
|
978
|
+
if ((n = e.draft) != null && n.adjustmentSnapshot)
|
|
979
|
+
for (const j of e.draft.adjustmentSnapshot)
|
|
980
|
+
j.adjustmentsByType && Object.keys(j.adjustmentsByType).forEach((U) => l.add(U));
|
|
981
|
+
const f = ["receive", "sales", "wastage"], D = [];
|
|
982
|
+
f.forEach((j) => {
|
|
983
|
+
l.has(j) && (D.push(j), l.delete(j));
|
|
984
|
+
});
|
|
985
|
+
const p = Array.from(l).sort();
|
|
986
|
+
B.value = [...D, ...p];
|
|
987
|
+
} catch (l) {
|
|
988
|
+
u.open({
|
|
989
|
+
title: "Something went wrong",
|
|
990
|
+
message: "Something went wrong when fetching info. Please try again.",
|
|
991
|
+
type: "error"
|
|
992
|
+
}), console.error("error on fetch stock balances", l);
|
|
993
|
+
} finally {
|
|
994
|
+
P.value = !1;
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
async function ee() {
|
|
998
|
+
var t, d;
|
|
999
|
+
if (!(((t = e.draft) == null ? void 0 : t.effectiveAt) ?? (e.draft ? Ge((d = e.draft) == null ? void 0 : d._id) : null))) {
|
|
1000
|
+
u.open({
|
|
1001
|
+
title: "Cannot refresh",
|
|
1002
|
+
message: "Effective date is not available for this draft.",
|
|
1003
|
+
type: "error"
|
|
1004
|
+
});
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
1007
|
+
await h.refreshBalance(
|
|
1008
|
+
e.draft,
|
|
1009
|
+
() => {
|
|
1010
|
+
},
|
|
1011
|
+
async (a) => {
|
|
1012
|
+
var D;
|
|
1013
|
+
L.value = !0;
|
|
1014
|
+
const n = (D = e.draft) == null ? void 0 : D._rev, l = 30, f = 2e3;
|
|
1015
|
+
try {
|
|
1016
|
+
await v.recalculation.scheduleCalculateStockSnapshotAtDate(a, e.draft._id);
|
|
1017
|
+
let p = null;
|
|
1018
|
+
for (let j = 0; j < l && (p = await c.getDraft(e.draft._id).delayed(f), p._rev === n); j++)
|
|
1019
|
+
;
|
|
1020
|
+
if (!p || p._rev === n) {
|
|
1021
|
+
u.open({
|
|
1022
|
+
title: "Refresh failed",
|
|
1023
|
+
message: "Failed to refresh stock balance. Please try again.",
|
|
1024
|
+
type: "error"
|
|
1025
|
+
}), console.error("error refreshing stock balances: there is no change in _rev");
|
|
1026
|
+
return;
|
|
1027
|
+
}
|
|
1028
|
+
T("refresh", p), k.value = p.stockSnapshot ?? [], u.open({
|
|
1029
|
+
title: "Balance refreshed",
|
|
1030
|
+
message: "Stock balance has been recalculated.",
|
|
1031
|
+
type: "success"
|
|
1032
|
+
}), g.value = !1;
|
|
1033
|
+
} catch (p) {
|
|
1034
|
+
u.open({
|
|
1035
|
+
title: "Refresh failed",
|
|
1036
|
+
message: "Failed to refresh stock balance. Please try again.",
|
|
1037
|
+
type: "error"
|
|
1038
|
+
}), console.error("error refreshing stock balances", p);
|
|
1039
|
+
} finally {
|
|
1040
|
+
L.value = !1;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
);
|
|
1044
|
+
}
|
|
1045
|
+
const oe = V(
|
|
1046
|
+
() => k.value.groupBy(
|
|
1047
|
+
(r) => r.id,
|
|
1048
|
+
(r) => r.balance
|
|
1049
|
+
)
|
|
1050
|
+
), de = V(() => K.value.groupBy((r) => r.sku._id)), xe = V(() => {
|
|
1051
|
+
var r;
|
|
1052
|
+
return (r = e.draft) != null && r.adjustmentSnapshot ? new Map(e.draft.adjustmentSnapshot.map((t) => [t.skuId, t.adjustmentsByType])) : /* @__PURE__ */ new Map();
|
|
1053
|
+
}), De = V(() => {
|
|
1054
|
+
var r;
|
|
1055
|
+
return (r = e.draft) != null && r.opening ? new Map(e.draft.opening.map((t) => [t.skuId, t.balance])) : /* @__PURE__ */ new Map();
|
|
1056
|
+
});
|
|
1057
|
+
function te(r, t) {
|
|
1058
|
+
return A(
|
|
1059
|
+
be.FmTooltip,
|
|
1060
|
+
{ zIndex: 51, placement: "left", class: "w-full flex justify-end" },
|
|
1061
|
+
{
|
|
1062
|
+
default() {
|
|
1063
|
+
return r;
|
|
1064
|
+
},
|
|
1065
|
+
content() {
|
|
1066
|
+
return t || r;
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
);
|
|
1070
|
+
}
|
|
1071
|
+
const Ae = V(() => {
|
|
1072
|
+
const r = Q.value.reduce((d, a) => {
|
|
1073
|
+
var n, l;
|
|
1074
|
+
return Math.max(d, ((l = (n = Z.value) == null ? void 0 : n.get(a._id)) == null ? void 0 : l[0].length) ?? 0);
|
|
1075
|
+
}, 0);
|
|
1076
|
+
return [
|
|
1077
|
+
{
|
|
1078
|
+
id: "sku",
|
|
1079
|
+
accessorFn: (d) => `${d.code} ${d.name}`,
|
|
1080
|
+
header: () => "Name",
|
|
1081
|
+
size: 350,
|
|
1082
|
+
cell(d) {
|
|
1083
|
+
const a = d.row.original, n = a.adjustedDiffPercentage, l = typeof n == "number" && Math.abs(n) > 10, f = A("div", { class: "flex flex-col gap-4" }, [
|
|
1084
|
+
A(
|
|
1085
|
+
"div",
|
|
1086
|
+
{
|
|
1087
|
+
class: [
|
|
1088
|
+
"line-clamp-1 fm-typo-en-body-lg-400",
|
|
1089
|
+
l ? " text-fm-color-system-error-300" : "text-fm-color-typo-primary"
|
|
1090
|
+
]
|
|
1091
|
+
},
|
|
1092
|
+
a.name
|
|
1093
|
+
),
|
|
1094
|
+
A(
|
|
1095
|
+
"div",
|
|
1096
|
+
{
|
|
1097
|
+
class: [
|
|
1098
|
+
"line-clamp-1 fm-typo-en-body-md-400",
|
|
1099
|
+
l ? " text-fm-color-system-error-300" : "text-fm-color-typo-secondary"
|
|
1100
|
+
]
|
|
1101
|
+
},
|
|
1102
|
+
a.code
|
|
1103
|
+
)
|
|
1104
|
+
]);
|
|
1105
|
+
return A(
|
|
1106
|
+
be.FmTooltip,
|
|
1107
|
+
{
|
|
1108
|
+
zIndex: 51
|
|
1109
|
+
},
|
|
1110
|
+
{
|
|
1111
|
+
content() {
|
|
1112
|
+
return l ? "Adjustment difference is more than 10%." : `${a.code} - ${a.name}`;
|
|
1113
|
+
},
|
|
1114
|
+
default() {
|
|
1115
|
+
return A("div", { class: "flex items-center gap-4 justify-start w-full" }, [
|
|
1116
|
+
f
|
|
1117
|
+
]);
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
);
|
|
1121
|
+
}
|
|
1122
|
+
},
|
|
1123
|
+
{
|
|
1124
|
+
id: "costPerUnit",
|
|
1125
|
+
accessorKey: "costPerUnit",
|
|
1126
|
+
header: () => te("Cost per unit"),
|
|
1127
|
+
size: 160,
|
|
1128
|
+
cell(d) {
|
|
1129
|
+
const a = d.row.original.costPerUnit;
|
|
1130
|
+
return A("div", { class: "text-right" }, a.toFixed(2));
|
|
1131
|
+
},
|
|
1132
|
+
meta: {
|
|
1133
|
+
textAlign: "right"
|
|
1134
|
+
}
|
|
1135
|
+
},
|
|
1136
|
+
{
|
|
1137
|
+
id: "costUnit",
|
|
1138
|
+
header: () => "UOM",
|
|
1139
|
+
size: 120,
|
|
1140
|
+
cell(d) {
|
|
1141
|
+
var D;
|
|
1142
|
+
const a = d.row.original, n = a.costUnit, l = a.baseUnit, f = n ?? l;
|
|
1143
|
+
if (n && n !== l) {
|
|
1144
|
+
const p = Q.value.find((U) => U._id === a.id), j = (D = p == null ? void 0 : p.defaultCost) == null ? void 0 : D.measurement;
|
|
1145
|
+
if (j) {
|
|
1146
|
+
const U = j.conversion.amount / Math.pow(10, j.conversion.precision);
|
|
1147
|
+
return A("div", { class: "flex flex-col" }, [
|
|
1148
|
+
A(
|
|
1149
|
+
"span",
|
|
1150
|
+
{ class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
|
|
1151
|
+
f
|
|
1152
|
+
),
|
|
1153
|
+
A("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, [
|
|
1154
|
+
"1 ",
|
|
1155
|
+
A("span", { class: "fm-typo-en-body-sm-600" }, n),
|
|
1156
|
+
` = ${U} `,
|
|
1157
|
+
A("span", { class: "fm-typo-en-body-sm-600" }, l)
|
|
1158
|
+
])
|
|
1159
|
+
]);
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
return f;
|
|
1163
|
+
}
|
|
1164
|
+
},
|
|
1165
|
+
{
|
|
1166
|
+
id: "opening",
|
|
1167
|
+
accessorKey: "opening",
|
|
1168
|
+
header: () => te("Opening (B/F)", "The opening balance brought forward from previous period."),
|
|
1169
|
+
size: 150,
|
|
1170
|
+
cell(d) {
|
|
1171
|
+
const a = d.row.original.opening;
|
|
1172
|
+
return A("div", { class: "text-right" }, a.toFixed(2));
|
|
1173
|
+
},
|
|
1174
|
+
meta: {
|
|
1175
|
+
textAlign: "right"
|
|
1176
|
+
}
|
|
1177
|
+
},
|
|
1178
|
+
// Dynamic adjustment type columns
|
|
1179
|
+
...B.value.map(
|
|
1180
|
+
(d) => ({
|
|
1181
|
+
id: `adjustment_${d}`,
|
|
1182
|
+
accessorFn: (a) => a.adjustmentAmounts[d] ?? { amount: 0, precision: 0 },
|
|
1183
|
+
header: () => te(Re(d)),
|
|
1184
|
+
size: 150,
|
|
1185
|
+
cell(a) {
|
|
1186
|
+
const n = a.row.original.adjustmentAmounts[d] ?? { amount: 0, precision: 0 };
|
|
1187
|
+
return A("div", { class: "text-right" }, Qe(n));
|
|
1188
|
+
},
|
|
1189
|
+
meta: {
|
|
1190
|
+
textAlign: "right"
|
|
1191
|
+
}
|
|
1192
|
+
})
|
|
1193
|
+
),
|
|
1194
|
+
{
|
|
1195
|
+
id: "systemBalance",
|
|
1196
|
+
accessorKey: "systemBalance",
|
|
1197
|
+
header: () => te("System Balance", "The system calculated balance before stock take."),
|
|
1198
|
+
size: 200,
|
|
1199
|
+
meta: {
|
|
1200
|
+
textAlign: "right"
|
|
1201
|
+
}
|
|
1202
|
+
},
|
|
1203
|
+
{
|
|
1204
|
+
id: "physicalBalance",
|
|
1205
|
+
accessorFn: (d) => {
|
|
1206
|
+
var n;
|
|
1207
|
+
const a = (n = N.value.find((l) => l.id === d.id)) == null ? void 0 : n.balance;
|
|
1208
|
+
return a ? R.toFormatString({ value: a }) : d.physicalBalance;
|
|
1209
|
+
},
|
|
1210
|
+
header: () => te("Stock Take balance", "The physical balance recorded during stock take."),
|
|
1211
|
+
cell(d) {
|
|
1212
|
+
var p;
|
|
1213
|
+
const a = d.row.original, n = R.fromNumber(a.physicalBalance);
|
|
1214
|
+
let l = !0, f = a.physicalBalance;
|
|
1215
|
+
const D = (p = N.value.find((j) => j.id === a.id)) == null ? void 0 : p.balance;
|
|
1216
|
+
return D && (R.equals({
|
|
1217
|
+
a: n,
|
|
1218
|
+
b: D
|
|
1219
|
+
}) || (l = !1, f = Number(R.toFormatString({ value: D })))), A("div", { class: "flex flex-col" }, [
|
|
1220
|
+
A(
|
|
1221
|
+
"span",
|
|
1222
|
+
{ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
|
|
1223
|
+
f
|
|
1224
|
+
),
|
|
1225
|
+
l ? null : A(
|
|
1226
|
+
"span",
|
|
1227
|
+
{ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
|
|
1228
|
+
`Draft: ${a.physicalBalance.toString()}`
|
|
1229
|
+
)
|
|
1230
|
+
]);
|
|
1231
|
+
},
|
|
1232
|
+
size: 200,
|
|
1233
|
+
meta: {
|
|
1234
|
+
textAlign: "right"
|
|
1235
|
+
}
|
|
1236
|
+
},
|
|
1237
|
+
{
|
|
1238
|
+
id: "adjustedAmount",
|
|
1239
|
+
accessorKey: "adjustedAmount",
|
|
1240
|
+
header: () => te("Variance", "The difference between Stock Take balance and System Balance."),
|
|
1241
|
+
size: 200,
|
|
1242
|
+
meta: {
|
|
1243
|
+
textAlign: "right"
|
|
1244
|
+
}
|
|
1245
|
+
},
|
|
1246
|
+
{
|
|
1247
|
+
id: "varianceInCost",
|
|
1248
|
+
accessorKey: "varianceInCost",
|
|
1249
|
+
header: () => te(`Variance (${m.value})`),
|
|
1250
|
+
size: 150,
|
|
1251
|
+
cell(d) {
|
|
1252
|
+
const a = d.row.original.varianceInCost;
|
|
1253
|
+
return A(
|
|
1254
|
+
"div",
|
|
1255
|
+
{ class: "text-right" },
|
|
1256
|
+
a.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })
|
|
1257
|
+
);
|
|
1258
|
+
},
|
|
1259
|
+
meta: {
|
|
1260
|
+
textAlign: "right"
|
|
1261
|
+
}
|
|
1262
|
+
},
|
|
1263
|
+
{
|
|
1264
|
+
id: "adjustedDiffPercentage",
|
|
1265
|
+
accessorKey: "adjustedDiffPercentage",
|
|
1266
|
+
header: () => te(
|
|
1267
|
+
"Variance (%)",
|
|
1268
|
+
"Difference between Stock Take balance and System Balance in percentage."
|
|
1269
|
+
),
|
|
1270
|
+
size: 200,
|
|
1271
|
+
cell(d) {
|
|
1272
|
+
const a = d.row.original.adjustedDiffPercentage;
|
|
1273
|
+
if (!a) return tn;
|
|
1274
|
+
const n = a.toFixed(2);
|
|
1275
|
+
if (n === "0.00")
|
|
1276
|
+
return A("div", { class: "flex items-center gap-4 justify-end" }, ["0.00"]);
|
|
1277
|
+
const l = a > 0;
|
|
1278
|
+
return A("div", { class: "flex items-center gap-4 justify-end" }, [
|
|
1279
|
+
A(be.FmIcon, {
|
|
1280
|
+
name: l ? "arrow_drop_up" : "arrow_drop_down",
|
|
1281
|
+
color: l ? "system-success-300" : "system-error-300",
|
|
1282
|
+
size: "md"
|
|
1283
|
+
}),
|
|
1284
|
+
n
|
|
1285
|
+
]);
|
|
1286
|
+
},
|
|
1287
|
+
meta: {
|
|
1288
|
+
textAlign: "right"
|
|
1289
|
+
}
|
|
1290
|
+
},
|
|
1291
|
+
{
|
|
1292
|
+
id: "stockTakeValue",
|
|
1293
|
+
accessorKey: "stockTakeValue",
|
|
1294
|
+
header: () => te(`Stock take value (${m.value})`),
|
|
1295
|
+
size: 180,
|
|
1296
|
+
cell(d) {
|
|
1297
|
+
var j;
|
|
1298
|
+
const a = d.row.original, n = a.stockTakeValue, l = Q.value.find((U) => U._id === a.id), f = (j = l == null ? void 0 : l.defaultCost) == null ? void 0 : j.measurement, D = a.physicalBalance, p = a.costPerUnit;
|
|
1299
|
+
if (f) {
|
|
1300
|
+
const U = R.toFormatString({ value: f.conversion }), se = `${D.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${a.baseUnit} ÷ ${U} × ${p} ${m.value}`;
|
|
1301
|
+
return A(
|
|
1302
|
+
be.FmTooltip,
|
|
1303
|
+
{ zIndex: 51 },
|
|
1304
|
+
{
|
|
1305
|
+
content() {
|
|
1306
|
+
return se;
|
|
1307
|
+
},
|
|
1308
|
+
default() {
|
|
1309
|
+
return A(
|
|
1310
|
+
"div",
|
|
1311
|
+
{ class: "text-right" },
|
|
1312
|
+
n.toLocaleString("en-US", {
|
|
1313
|
+
minimumFractionDigits: 2,
|
|
1314
|
+
maximumFractionDigits: 4
|
|
1315
|
+
})
|
|
1316
|
+
);
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
);
|
|
1320
|
+
} else {
|
|
1321
|
+
const U = `${D.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${a.baseUnit} × ${p} ${m.value}`;
|
|
1322
|
+
return A(
|
|
1323
|
+
be.FmTooltip,
|
|
1324
|
+
{ zIndex: 51 },
|
|
1325
|
+
{
|
|
1326
|
+
content() {
|
|
1327
|
+
return U;
|
|
1328
|
+
},
|
|
1329
|
+
default() {
|
|
1330
|
+
return A(
|
|
1331
|
+
"div",
|
|
1332
|
+
{ class: "text-right" },
|
|
1333
|
+
n.toLocaleString("en-US", {
|
|
1334
|
+
minimumFractionDigits: 2,
|
|
1335
|
+
maximumFractionDigits: 4
|
|
1336
|
+
})
|
|
1337
|
+
);
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
);
|
|
1341
|
+
}
|
|
1342
|
+
},
|
|
1343
|
+
meta: {
|
|
1344
|
+
textAlign: "right"
|
|
1345
|
+
}
|
|
1346
|
+
},
|
|
1347
|
+
{
|
|
1348
|
+
id: "systemValue",
|
|
1349
|
+
accessorKey: "systemValue",
|
|
1350
|
+
header: () => te(`System value (${m.value})`),
|
|
1351
|
+
size: 180,
|
|
1352
|
+
cell(d) {
|
|
1353
|
+
var j;
|
|
1354
|
+
const a = d.row.original, n = a.systemValue, l = Q.value.find((U) => U._id === a.id), f = (j = l == null ? void 0 : l.defaultCost) == null ? void 0 : j.measurement, D = a.systemBalance, p = a.costPerUnit;
|
|
1355
|
+
if (f) {
|
|
1356
|
+
const U = R.toFormatString({ value: f.conversion }), se = `${D.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${a.baseUnit} ÷ ${U} × ${p} ${m.value}`;
|
|
1357
|
+
return A(
|
|
1358
|
+
be.FmTooltip,
|
|
1359
|
+
{ zIndex: 51 },
|
|
1360
|
+
{
|
|
1361
|
+
content() {
|
|
1362
|
+
return se;
|
|
1363
|
+
},
|
|
1364
|
+
default() {
|
|
1365
|
+
return A(
|
|
1366
|
+
"div",
|
|
1367
|
+
{ class: "text-right" },
|
|
1368
|
+
n.toLocaleString("en-US", {
|
|
1369
|
+
minimumFractionDigits: 2,
|
|
1370
|
+
maximumFractionDigits: 4
|
|
1371
|
+
})
|
|
1372
|
+
);
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
);
|
|
1376
|
+
} else {
|
|
1377
|
+
const U = `${D.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${a.baseUnit} × ${p} ${m.value}`;
|
|
1378
|
+
return A(
|
|
1379
|
+
be.FmTooltip,
|
|
1380
|
+
{ zIndex: 51 },
|
|
1381
|
+
{
|
|
1382
|
+
content() {
|
|
1383
|
+
return U;
|
|
1384
|
+
},
|
|
1385
|
+
default() {
|
|
1386
|
+
return A(
|
|
1387
|
+
"div",
|
|
1388
|
+
{ class: "text-right" },
|
|
1389
|
+
n.toLocaleString("en-US", {
|
|
1390
|
+
minimumFractionDigits: 2,
|
|
1391
|
+
maximumFractionDigits: 4
|
|
1392
|
+
})
|
|
1393
|
+
);
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
);
|
|
1397
|
+
}
|
|
1398
|
+
},
|
|
1399
|
+
meta: {
|
|
1400
|
+
textAlign: "right"
|
|
1401
|
+
}
|
|
1402
|
+
},
|
|
1403
|
+
{
|
|
1404
|
+
id: "physicalBalances",
|
|
1405
|
+
header: () => "Amounts",
|
|
1406
|
+
enableSorting: !1,
|
|
1407
|
+
cell(d) {
|
|
1408
|
+
const a = d.row.original, n = (f, D) => A(
|
|
1409
|
+
be.FmTooltip,
|
|
1410
|
+
{ zIndex: 50 },
|
|
1411
|
+
{
|
|
1412
|
+
default() {
|
|
1413
|
+
return A(
|
|
1414
|
+
"div",
|
|
1415
|
+
{
|
|
1416
|
+
class: "fm-typo-en-body-md-400 py-4 px-8 border-1 border-fm-color-typo-secondary fm-corner-radius-md line-clamp-1"
|
|
1417
|
+
},
|
|
1418
|
+
[
|
|
1419
|
+
A("span", { class: "text-fm-color-typo-primary" }, `${f} `),
|
|
1420
|
+
A(
|
|
1421
|
+
"span",
|
|
1422
|
+
{
|
|
1423
|
+
class: "text-fm-color-typo-secondary",
|
|
1424
|
+
style: { maxWidth: "80px" }
|
|
1425
|
+
},
|
|
1426
|
+
D
|
|
1427
|
+
)
|
|
1428
|
+
]
|
|
1429
|
+
);
|
|
1430
|
+
},
|
|
1431
|
+
content() {
|
|
1432
|
+
return `${f} ${D}`;
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
);
|
|
1436
|
+
let l = Array.from({ length: r }).map((f, D) => {
|
|
1437
|
+
if (!a[`measurementAmount${D}`])
|
|
1438
|
+
return null;
|
|
1439
|
+
const p = a[`measurementAmount${D}`], j = a[`measurementAbbrev${D}`];
|
|
1440
|
+
return n(p, j);
|
|
1441
|
+
}).filter((f) => f);
|
|
1442
|
+
return (a.baseUnitAmount || !l.length) && (l = [n(a.baseUnitAmount, a.baseUnit), ...l]), A(
|
|
1443
|
+
"div",
|
|
1444
|
+
{
|
|
1445
|
+
class: "flex gap-8 flex-nowrap",
|
|
1446
|
+
style: {
|
|
1447
|
+
minWidth: `${120 * l.length}px`
|
|
1448
|
+
}
|
|
1449
|
+
},
|
|
1450
|
+
l
|
|
1451
|
+
);
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
];
|
|
1455
|
+
}), Te = V(() => Ae.value.map((r) => r.size ?? 0).reduce((r, t) => r + t)), we = H(""), Fe = V(() => {
|
|
1456
|
+
var d, a;
|
|
1457
|
+
const r = ((a = (d = e.draft) == null ? void 0 : d.negativeStockItems) == null ? void 0 : a.reduce(
|
|
1458
|
+
(n, l) => (n[l.sku._id] = l, n),
|
|
1459
|
+
{}
|
|
1460
|
+
)) ?? {};
|
|
1461
|
+
return Q.value.map((n) => {
|
|
1462
|
+
var tt, at, nt, ot, st, rt, lt, it, ct, ut, mt;
|
|
1463
|
+
const l = (tt = de.value.get(n._id)) == null ? void 0 : tt[0], f = ((at = oe.value.get(n._id)) == null ? void 0 : at[0]) ?? w, D = ((nt = n.defaultCost) == null ? void 0 : nt.costPerUnit) ?? w, p = Number(R.toFormatString({ value: D })), j = ((st = (ot = n.defaultCost) == null ? void 0 : ot.measurement) == null ? void 0 : st.conversion) ?? {
|
|
1464
|
+
amount: 1,
|
|
1465
|
+
precision: 0
|
|
1466
|
+
}, U = Number(
|
|
1467
|
+
R.toFormatString({ value: j })
|
|
1468
|
+
), se = De.value.get(n._id), ie = se ? Number(R.toFormatString({ value: se })) : 0, _e = xe.value.get(n._id), S = {};
|
|
1469
|
+
if (B.value.forEach((q) => {
|
|
1470
|
+
const ce = S[q] ?? { amount: 0, precision: 0 }, fe = _e == null ? void 0 : _e[q];
|
|
1471
|
+
fe && (S[q] = Ht(ce, fe));
|
|
1472
|
+
}), !l) {
|
|
1473
|
+
const q = Number(R.toFormatString({ value: f })), ce = q - 0, fe = ce * p / U, Ue = 0, $t = q * p / U;
|
|
1474
|
+
return {
|
|
1475
|
+
id: n._id,
|
|
1476
|
+
code: n.code,
|
|
1477
|
+
name: n.name,
|
|
1478
|
+
costUnit: ((lt = (rt = n.defaultCost) == null ? void 0 : rt.measurement) == null ? void 0 : lt.abbrev) ?? null,
|
|
1479
|
+
baseUnit: n.unit.abbrev,
|
|
1480
|
+
baseUnitAmount: 0,
|
|
1481
|
+
systemBalance: q,
|
|
1482
|
+
physicalBalance: 0,
|
|
1483
|
+
adjustedAmount: -q,
|
|
1484
|
+
adjustedDiffPercentage: -100,
|
|
1485
|
+
isTemplateItem: !r[n._id],
|
|
1486
|
+
costPerUnit: p,
|
|
1487
|
+
opening: ie,
|
|
1488
|
+
varianceQty: ce,
|
|
1489
|
+
varianceInCost: fe,
|
|
1490
|
+
stockTakeValue: Ue,
|
|
1491
|
+
systemValue: $t,
|
|
1492
|
+
adjustmentAmounts: S
|
|
1493
|
+
};
|
|
1494
|
+
}
|
|
1495
|
+
const G = At(l), J = (ct = (it = N.value) == null ? void 0 : it.find(
|
|
1496
|
+
(q) => q.id === n._id
|
|
1497
|
+
)) == null ? void 0 : ct.balance, pe = gt(
|
|
1498
|
+
J ?? G,
|
|
1499
|
+
f
|
|
1500
|
+
), Ce = f.amount === 0 ? null : yt(pe, {
|
|
1501
|
+
...f,
|
|
1502
|
+
amount: Math.abs(f.amount)
|
|
1503
|
+
}), Ie = Ce ? qe(Ce, X) : null, He = Number(R.toFormatString({ value: f })), Ye = Number(R.toFormatString({ value: G })), et = He - Ye, St = et * p / U, Ft = Ye * p / U, Ct = He * p / U;
|
|
1504
|
+
return {
|
|
1505
|
+
id: n._id,
|
|
1506
|
+
code: n.code,
|
|
1507
|
+
name: n.name,
|
|
1508
|
+
costUnit: ((mt = (ut = n.defaultCost) == null ? void 0 : ut.measurement) == null ? void 0 : mt.abbrev) ?? null,
|
|
1509
|
+
baseUnit: n.unit.abbrev,
|
|
1510
|
+
baseUnitAmount: Number(R.toFormatString({ value: l.baseAmount })),
|
|
1511
|
+
...l.measurementsAmounts.filter((q) => {
|
|
1512
|
+
var ce, fe, Ue;
|
|
1513
|
+
return (Ue = (fe = (ce = Z.value) == null ? void 0 : ce.get(n._id)) == null ? void 0 : fe[0]) == null ? void 0 : Ue.includes(q.measurement.id);
|
|
1514
|
+
}).reduce((q, ce, fe) => (q[`measurementAbbrev${fe}`] = `(${ce.measurement.abbrev}) × ${R.toFormatString({ value: ce.measurement.conversion })}`, q[`measurementAmount${fe}`] = Number(R.toFormatString({ value: ce.amount })), q), {}),
|
|
1515
|
+
systemBalance: He,
|
|
1516
|
+
physicalBalance: Ye,
|
|
1517
|
+
adjustedAmount: Number(R.toFormatString({ value: pe })),
|
|
1518
|
+
adjustedDiffPercentage: Ie ? Number(
|
|
1519
|
+
R.toFormatString({
|
|
1520
|
+
value: bt(Ie, 2)
|
|
1521
|
+
})
|
|
1522
|
+
) : null,
|
|
1523
|
+
isTemplateItem: !r[n._id],
|
|
1524
|
+
costPerUnit: p,
|
|
1525
|
+
opening: ie,
|
|
1526
|
+
varianceQty: et,
|
|
1527
|
+
varianceInCost: St,
|
|
1528
|
+
stockTakeValue: Ft,
|
|
1529
|
+
systemValue: Ct,
|
|
1530
|
+
adjustmentAmounts: S
|
|
1531
|
+
};
|
|
1532
|
+
}).filter((n) => !!(n.isTemplateItem && O.value.templateItem || !n.isTemplateItem && O.value.nonTemplateItem));
|
|
1533
|
+
}), je = V(() => {
|
|
1534
|
+
var t, d, a, n, l;
|
|
1535
|
+
if (!e.draft) return [];
|
|
1536
|
+
const r = e.draft.approvedAt ? {
|
|
1537
|
+
action: `Approve at ${ke(e.draft.approvedAt)}`,
|
|
1538
|
+
// actionAt: props.draft.approvedAt,
|
|
1539
|
+
actionBy: e.draft.approvedBy,
|
|
1540
|
+
remark: e.draft.approveRemark
|
|
1541
|
+
} : (t = e.draft.rejectionHistory) == null ? void 0 : t.computeFirst((f) => ({
|
|
1542
|
+
action: `Reject at ${ke(f.rejectedAt)}`,
|
|
1543
|
+
// actionAt: e.rejectedAt,
|
|
1544
|
+
actionBy: f.rejectedBy,
|
|
1545
|
+
remark: f.rejectRemark
|
|
1546
|
+
}));
|
|
1547
|
+
return [
|
|
1548
|
+
{
|
|
1549
|
+
label: "Location",
|
|
1550
|
+
value: ((d = y._currentLocation) == null ? void 0 : d.name) ?? "N/A"
|
|
1551
|
+
},
|
|
1552
|
+
{
|
|
1553
|
+
label: "Created at",
|
|
1554
|
+
value: ke(e.draft.createdAt)
|
|
1555
|
+
},
|
|
1556
|
+
{
|
|
1557
|
+
label: "Created by",
|
|
1558
|
+
value: e.draft.createdBy.name
|
|
1559
|
+
},
|
|
1560
|
+
{
|
|
1561
|
+
label: "Updated at",
|
|
1562
|
+
value: ke(e.draft.updatedAt)
|
|
1563
|
+
},
|
|
1564
|
+
{
|
|
1565
|
+
label: "Updated by",
|
|
1566
|
+
value: e.draft.updatedBy.name
|
|
1567
|
+
},
|
|
1568
|
+
{
|
|
1569
|
+
label: "Effective at",
|
|
1570
|
+
value: ke(e.draft.effectiveAt ?? Ge((a = e.draft) == null ? void 0 : a._id))
|
|
1571
|
+
},
|
|
1572
|
+
{
|
|
1573
|
+
label: "Using template",
|
|
1574
|
+
value: ((n = e.draft.usingTemplates.find((f) => f)) == null ? void 0 : n.name) ?? "None"
|
|
1575
|
+
},
|
|
1576
|
+
e.draft.remark ? {
|
|
1577
|
+
label: "Remark",
|
|
1578
|
+
value: e.draft.remark
|
|
1579
|
+
} : null,
|
|
1580
|
+
r ? {
|
|
1581
|
+
label: "Last action",
|
|
1582
|
+
value: r.action
|
|
1583
|
+
} : null,
|
|
1584
|
+
r && r.actionBy ? {
|
|
1585
|
+
label: "Last action by",
|
|
1586
|
+
value: (l = r.actionBy) == null ? void 0 : l.name
|
|
1587
|
+
} : null,
|
|
1588
|
+
r && r.remark ? {
|
|
1589
|
+
label: "Action remark",
|
|
1590
|
+
value: r.remark
|
|
1591
|
+
} : null
|
|
1592
|
+
].filter((f) => f).map((f) => f);
|
|
1593
|
+
}), ve = [
|
|
1594
|
+
{
|
|
1595
|
+
label: "Overview",
|
|
1596
|
+
value: "overview"
|
|
1597
|
+
},
|
|
1598
|
+
{
|
|
1599
|
+
label: "Action history",
|
|
1600
|
+
value: "history"
|
|
1601
|
+
}
|
|
1602
|
+
], ge = H(ve[0]), ye = V(() => {
|
|
1603
|
+
var a, n, l;
|
|
1604
|
+
const r = ((a = e.draft) == null ? void 0 : a.activityLogs) ?? [], t = ((n = e.draft) == null ? void 0 : n.rejectionHistory) ?? [];
|
|
1605
|
+
for (const f of t)
|
|
1606
|
+
r.find(
|
|
1607
|
+
(p) => `${p.action}_${p.performedAt}` == `${Y.enum.rejectDraft}_${f.rejectedAt}`
|
|
1608
|
+
) || r.push({
|
|
1609
|
+
action: Y.enum.rejectDraft,
|
|
1610
|
+
performedAt: f.rejectedAt,
|
|
1611
|
+
performedBy: f.rejectedBy,
|
|
1612
|
+
remark: f.rejectRemark
|
|
1613
|
+
});
|
|
1614
|
+
return (l = e.draft) != null && l.approvedAt && (r.find(
|
|
1615
|
+
(D) => {
|
|
1616
|
+
var p;
|
|
1617
|
+
return `${D.action}_${D.performedAt}` == `${Y.enum.approveDraft}_${(p = e.draft) == null ? void 0 : p.approvedAt}`;
|
|
1618
|
+
}
|
|
1619
|
+
) || r.push({
|
|
1620
|
+
action: Y.enum.approveDraft,
|
|
1621
|
+
performedAt: e.draft.approvedAt,
|
|
1622
|
+
performedBy: e.draft.approvedBy ?? { name: "Unknown", id: "unknown" },
|
|
1623
|
+
remark: e.draft.approveRemark
|
|
1624
|
+
})), r.sort((f, D) => new Date(D.performedAt).getTime() - new Date(f.performedAt).getTime()).map(
|
|
1625
|
+
(f) => ({
|
|
1626
|
+
header: Re(f.action),
|
|
1627
|
+
date: ke(f.performedAt),
|
|
1628
|
+
info: [
|
|
1629
|
+
{
|
|
1630
|
+
label: "Performed by",
|
|
1631
|
+
values: [f.performedBy.name]
|
|
1632
|
+
},
|
|
1633
|
+
{
|
|
1634
|
+
label: "Remark",
|
|
1635
|
+
values: [f.remark ?? ""]
|
|
1636
|
+
}
|
|
1637
|
+
]
|
|
1638
|
+
})
|
|
1639
|
+
);
|
|
1640
|
+
}), Xe = V(() => {
|
|
1641
|
+
var n, l, f, D;
|
|
1642
|
+
if (!((n = e.draft) != null && n.stockSnapshot)) return "Stock snapshot is not available.";
|
|
1643
|
+
if (((l = e.draft) == null ? void 0 : l.status) !== he.enum.DRAFT) return "Status is not draft.";
|
|
1644
|
+
const r = Fe.value.some((p) => p.physicalBalance < 0), t = ((D = (f = x.stockBalance.skus) == null ? void 0 : f.filter((p) => p.balance.amount < 0)) == null ? void 0 : D.map((p) => p.id)) ?? [], d = new Set(Q.value.map((p) => p._id)), a = t.filter((p) => !d.has(p)).length;
|
|
1645
|
+
return [
|
|
1646
|
+
r ? "Negative total exist." : null,
|
|
1647
|
+
a ? "Negative stock is not included in this draft. Please commit the draft to include these stocks." : null
|
|
1648
|
+
].filter((p) => p).join(" ");
|
|
1649
|
+
});
|
|
1650
|
+
return (r, t) => {
|
|
1651
|
+
const d = z("FmButtonGroup"), a = z("FmMenuDivider"), n = z("FmCard"), l = z("FmButton"), f = z("FmCircularProgress"), D = z("FmChip"), p = z("FmTextField"), j = z("FmIcon"), U = z("FmTable"), se = z("FmSpacer"), ie = z("FmTooltip"), _e = z("FmSideSheet");
|
|
1652
|
+
return F(), ue(_e, {
|
|
1653
|
+
"dismiss-away": "",
|
|
1654
|
+
"max-width": 9999,
|
|
1655
|
+
"model-value": $(g),
|
|
1656
|
+
"onUpdate:modelValue": t[10] || (t[10] = (S) => ft(g) ? g.value = S : null),
|
|
1657
|
+
header: "Closing details"
|
|
1658
|
+
}, {
|
|
1659
|
+
"side-sheet-footer": W(() => {
|
|
1660
|
+
var S, G, J, pe;
|
|
1661
|
+
return [
|
|
1662
|
+
i("div", en, [
|
|
1663
|
+
((S = e.draft) == null ? void 0 : S.status) === $(he).enum.DRAFT ? (F(), E(re, { key: 0 }, [
|
|
1664
|
+
Xe.value ? (F(), ue(ie, {
|
|
1665
|
+
key: 0,
|
|
1666
|
+
"z-index": 51,
|
|
1667
|
+
placement: "right"
|
|
1668
|
+
}, {
|
|
1669
|
+
content: W(() => [
|
|
1670
|
+
ne(ae(Xe.value), 1)
|
|
1671
|
+
]),
|
|
1672
|
+
default: W(() => [
|
|
1673
|
+
_(l, {
|
|
1674
|
+
disabled: "",
|
|
1675
|
+
key: "approve key",
|
|
1676
|
+
label: "Approve",
|
|
1677
|
+
onClick: t[5] || (t[5] = () => e.draft && $(h).approveDraft(e.draft, () => T("submitted")))
|
|
1678
|
+
})
|
|
1679
|
+
]),
|
|
1680
|
+
_: 1
|
|
1681
|
+
})) : (F(), ue(l, {
|
|
1682
|
+
key: "approve key",
|
|
1683
|
+
label: "Approve",
|
|
1684
|
+
onClick: t[6] || (t[6] = () => e.draft && $(h).approveDraft(e.draft, () => T("submitted")))
|
|
1685
|
+
}))
|
|
1686
|
+
], 64)) : le("", !0),
|
|
1687
|
+
((G = e.draft) == null ? void 0 : G.status) === $(he).enum.DRAFT ? (F(), ue(l, {
|
|
1688
|
+
key: 1,
|
|
1689
|
+
label: "Reject",
|
|
1690
|
+
variant: "destructive",
|
|
1691
|
+
onClick: t[7] || (t[7] = () => e.draft && $(h).rejectDraft(e.draft, () => T("submitted")))
|
|
1692
|
+
})) : le("", !0),
|
|
1693
|
+
(J = e.draft) != null && J.approvedAt && ((pe = e.draft) == null ? void 0 : pe.status) !== $(he).enum.COMPLETED ? (F(), ue(Yt, { key: 2 }, {
|
|
1694
|
+
default: W(() => [
|
|
1695
|
+
_(l, {
|
|
1696
|
+
label: "Sync",
|
|
1697
|
+
loading: M.value,
|
|
1698
|
+
onClick: t[8] || (t[8] = () => {
|
|
1699
|
+
e.draft && (M.value = !0, $(h).syncDraft(e.draft, () => {
|
|
1700
|
+
M.value = !1, T("submitted");
|
|
1701
|
+
}));
|
|
1702
|
+
})
|
|
1703
|
+
}, null, 8, ["loading"])
|
|
1704
|
+
]),
|
|
1705
|
+
_: 1
|
|
1706
|
+
})) : le("", !0),
|
|
1707
|
+
_(l, {
|
|
1708
|
+
label: "Close",
|
|
1709
|
+
variant: "tertiary",
|
|
1710
|
+
onClick: t[9] || (t[9] = (Ce) => g.value = !1)
|
|
1711
|
+
})
|
|
1712
|
+
])
|
|
1713
|
+
];
|
|
1714
|
+
}),
|
|
1715
|
+
default: W(() => [
|
|
1716
|
+
i("div", ka, [
|
|
1717
|
+
i("div", null, [
|
|
1718
|
+
_(d, {
|
|
1719
|
+
items: ve,
|
|
1720
|
+
modelValue: ge.value,
|
|
1721
|
+
"onUpdate:modelValue": t[0] || (t[0] = (S) => ge.value = S)
|
|
1722
|
+
}, null, 8, ["modelValue"])
|
|
1723
|
+
]),
|
|
1724
|
+
ge.value.value === "overview" ? (F(), E(re, { key: 0 }, [
|
|
1725
|
+
_(n, {
|
|
1726
|
+
variant: "outlined",
|
|
1727
|
+
class: "flex flex-col gap-8 px-12 py-16"
|
|
1728
|
+
}, {
|
|
1729
|
+
default: W(() => {
|
|
1730
|
+
var S, G;
|
|
1731
|
+
return [
|
|
1732
|
+
i("div", xa, [
|
|
1733
|
+
t[11] || (t[11] = i("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
|
|
1734
|
+
i("div", Da, [
|
|
1735
|
+
i("div", {
|
|
1736
|
+
class: Se(["fm-status-badge", $(Ve)(((S = r.draft) == null ? void 0 : S.status) ?? "DRAFT")])
|
|
1737
|
+
}, ae($(Re)(((G = r.draft) == null ? void 0 : G.status) ?? "")), 3)
|
|
1738
|
+
])
|
|
1739
|
+
]),
|
|
1740
|
+
_(a),
|
|
1741
|
+
i("div", Aa, [
|
|
1742
|
+
(F(!0), E(re, null, $e(je.value, (J, pe) => (F(), E("div", {
|
|
1743
|
+
class: "flex flex-col gap-4",
|
|
1744
|
+
key: pe
|
|
1745
|
+
}, [
|
|
1746
|
+
i("div", _a, [
|
|
1747
|
+
i("div", wa, ae(J.label), 1)
|
|
1748
|
+
]),
|
|
1749
|
+
i("div", Sa, ae(J.value), 1)
|
|
1750
|
+
]))), 128))
|
|
1751
|
+
])
|
|
1752
|
+
];
|
|
1753
|
+
}),
|
|
1754
|
+
_: 1
|
|
1755
|
+
}),
|
|
1756
|
+
i("div", Fa, [
|
|
1757
|
+
i("div", Ca, [
|
|
1758
|
+
t[12] || (t[12] = i("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
|
|
1759
|
+
P.value ? le("", !0) : (F(), E("div", $a, [
|
|
1760
|
+
r.draft && r.draft.status !== $(he).enum.COMPLETED ? (F(), ue(l, {
|
|
1761
|
+
key: 0,
|
|
1762
|
+
label: "Refresh balance",
|
|
1763
|
+
"prepend-icon": "refresh",
|
|
1764
|
+
variant: "secondary",
|
|
1765
|
+
"text-color": "primary",
|
|
1766
|
+
"bg-color": "transparent",
|
|
1767
|
+
"border-color": "primary",
|
|
1768
|
+
loading: L.value,
|
|
1769
|
+
onClick: ee
|
|
1770
|
+
}, null, 8, ["loading"])) : le("", !0),
|
|
1771
|
+
_(l, {
|
|
1772
|
+
label: "Export data",
|
|
1773
|
+
"prepend-icon": "download",
|
|
1774
|
+
variant: "secondary",
|
|
1775
|
+
"text-color": "primary",
|
|
1776
|
+
"bg-color": "transparent",
|
|
1777
|
+
"border-color": "primary",
|
|
1778
|
+
onClick: t[1] || (t[1] = (S) => r.draft ? $(h).exportDraft(
|
|
1779
|
+
r.draft,
|
|
1780
|
+
k.value,
|
|
1781
|
+
N.value
|
|
1782
|
+
) : null)
|
|
1783
|
+
})
|
|
1784
|
+
]))
|
|
1785
|
+
]),
|
|
1786
|
+
P.value ? (F(), E("div", Ba, [
|
|
1787
|
+
t[14] || (t[14] = i("div", { class: "h-80" }, null, -1)),
|
|
1788
|
+
i("div", Ta, [
|
|
1789
|
+
i("div", null, [
|
|
1790
|
+
_(f, { size: "md" })
|
|
1791
|
+
]),
|
|
1792
|
+
t[13] || (t[13] = i("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
|
|
1793
|
+
]),
|
|
1794
|
+
t[15] || (t[15] = i("div", { class: "h-80" }, null, -1))
|
|
1795
|
+
])) : (F(), E(re, { key: 1 }, [
|
|
1796
|
+
i("div", ja, [
|
|
1797
|
+
i("div", Ia, [
|
|
1798
|
+
_(D, {
|
|
1799
|
+
label: "Template Item(s)",
|
|
1800
|
+
selected: O.value.templateItem,
|
|
1801
|
+
onClick: t[2] || (t[2] = (S) => O.value.templateItem = !O.value.templateItem)
|
|
1802
|
+
}, null, 8, ["selected"]),
|
|
1803
|
+
_(D, {
|
|
1804
|
+
label: "Non-template Item(s)",
|
|
1805
|
+
selected: O.value.nonTemplateItem,
|
|
1806
|
+
onClick: t[3] || (t[3] = (S) => O.value.nonTemplateItem = !O.value.nonTemplateItem)
|
|
1807
|
+
}, null, 8, ["selected"])
|
|
1808
|
+
]),
|
|
1809
|
+
_(p, {
|
|
1810
|
+
modelValue: we.value,
|
|
1811
|
+
"onUpdate:modelValue": t[4] || (t[4] = (S) => we.value = S),
|
|
1812
|
+
placeholder: "Filter items"
|
|
1813
|
+
}, null, 8, ["modelValue"])
|
|
1814
|
+
]),
|
|
1815
|
+
$(I).skuTags.size ? (F(), E("div", Ua, [
|
|
1816
|
+
(F(!0), E(re, null, $e($(I).skuTags.keys(), (S) => (F(), ue(D, {
|
|
1817
|
+
key: `${S}`,
|
|
1818
|
+
label: `${S}`,
|
|
1819
|
+
selectable: "",
|
|
1820
|
+
selected: b[`${S}`],
|
|
1821
|
+
onClick: (G) => b[`${S}`] = !b[`${S}`]
|
|
1822
|
+
}, {
|
|
1823
|
+
default: W(() => [
|
|
1824
|
+
b[`${S}`] ? (F(), ue(j, {
|
|
1825
|
+
key: 0,
|
|
1826
|
+
name: "check",
|
|
1827
|
+
class: "text-white",
|
|
1828
|
+
size: "sm"
|
|
1829
|
+
})) : le("", !0),
|
|
1830
|
+
i("span", {
|
|
1831
|
+
class: Se([
|
|
1832
|
+
"",
|
|
1833
|
+
{
|
|
1834
|
+
"text-white fm-typo-en-body-md-600": b[`${S}`],
|
|
1835
|
+
"text-fm-color-typo-primary fm-typo-en-body-md-400": !b[`${S}`]
|
|
1836
|
+
}
|
|
1837
|
+
])
|
|
1838
|
+
}, ae(S), 3)
|
|
1839
|
+
]),
|
|
1840
|
+
_: 2
|
|
1841
|
+
}, 1032, ["label", "selected", "onClick"]))), 128))
|
|
1842
|
+
])) : le("", !0),
|
|
1843
|
+
i("div", Pa, [
|
|
1844
|
+
i("div", {
|
|
1845
|
+
style: pt({ minWidth: `${Te.value}px` })
|
|
1846
|
+
}, [
|
|
1847
|
+
_(U, {
|
|
1848
|
+
"column-defs": Ae.value,
|
|
1849
|
+
"row-data": Fe.value,
|
|
1850
|
+
"search-value": we.value
|
|
1851
|
+
}, null, 8, ["column-defs", "row-data", "search-value"])
|
|
1852
|
+
], 4)
|
|
1853
|
+
])
|
|
1854
|
+
], 64))
|
|
1855
|
+
])
|
|
1856
|
+
], 64)) : le("", !0),
|
|
1857
|
+
ge.value.value === "history" ? (F(), E("div", Ma, [
|
|
1858
|
+
ye.value.length ? (F(), E("div", La, [
|
|
1859
|
+
(F(!0), E(re, null, $e(ye.value, (S, G) => (F(), E(re, { key: G }, [
|
|
1860
|
+
i("div", Na, [
|
|
1861
|
+
i("div", Ea, [
|
|
1862
|
+
i("div", za, [
|
|
1863
|
+
i("div", {
|
|
1864
|
+
class: Se([
|
|
1865
|
+
{
|
|
1866
|
+
"bg-fm-color-primary": G !== 0,
|
|
1867
|
+
"bg-white": G === 0
|
|
1868
|
+
},
|
|
1869
|
+
"w-[2px] h-full"
|
|
1870
|
+
])
|
|
1871
|
+
}, null, 2)
|
|
1872
|
+
]),
|
|
1873
|
+
t[18] || (t[18] = i("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
|
|
1874
|
+
i("div", Oa, [
|
|
1875
|
+
i("div", {
|
|
1876
|
+
class: Se([
|
|
1877
|
+
{
|
|
1878
|
+
"bg-fm-color-primary": G < ye.value.length - 1,
|
|
1879
|
+
"bg-white": G >= ye.value.length - 1
|
|
1880
|
+
},
|
|
1881
|
+
"w-[2px] h-full"
|
|
1882
|
+
])
|
|
1883
|
+
}, null, 2)
|
|
1884
|
+
])
|
|
1885
|
+
]),
|
|
1886
|
+
i("div", Ha, [
|
|
1887
|
+
i("div", Ya, ae(S.header), 1),
|
|
1888
|
+
i("div", Ka, ae(S.date), 1)
|
|
1889
|
+
])
|
|
1890
|
+
]),
|
|
1891
|
+
i("div", Qa, [
|
|
1892
|
+
i("div", Ga, [
|
|
1893
|
+
i("div", Wa, [
|
|
1894
|
+
i("div", {
|
|
1895
|
+
class: Se([
|
|
1896
|
+
{
|
|
1897
|
+
"bg-fm-color-primary": G < ye.value.length - 1,
|
|
1898
|
+
"bg-white": G >= ye.value.length - 1
|
|
1899
|
+
},
|
|
1900
|
+
"w-[2px] h-full"
|
|
1901
|
+
])
|
|
1902
|
+
}, null, 2)
|
|
1903
|
+
])
|
|
1904
|
+
]),
|
|
1905
|
+
i("div", qa, [
|
|
1906
|
+
_(n, {
|
|
1907
|
+
variant: "outlined",
|
|
1908
|
+
class: "py-12 px-16"
|
|
1909
|
+
}, {
|
|
1910
|
+
default: W(() => [
|
|
1911
|
+
i("div", Za, [
|
|
1912
|
+
(F(!0), E(re, null, $e(S.info, (J, pe) => (F(), E("div", {
|
|
1913
|
+
key: pe,
|
|
1914
|
+
class: "flex flex-col gap-4"
|
|
1915
|
+
}, [
|
|
1916
|
+
i("div", Ja, ae(J == null ? void 0 : J.label), 1),
|
|
1917
|
+
i("div", Xa, [
|
|
1918
|
+
(F(!0), E(re, null, $e(J == null ? void 0 : J.values, (Ce, Ie) => (F(), E("div", {
|
|
1919
|
+
key: Ie,
|
|
1920
|
+
class: "fm-typo-en-body-lg-600"
|
|
1921
|
+
}, ae(Ce), 1))), 128))
|
|
1922
|
+
])
|
|
1923
|
+
]))), 128))
|
|
1924
|
+
])
|
|
1925
|
+
]),
|
|
1926
|
+
_: 2
|
|
1927
|
+
}, 1024)
|
|
1928
|
+
])
|
|
1929
|
+
])
|
|
1930
|
+
], 64))), 128))
|
|
1931
|
+
])) : (F(), E("div", Ra, [
|
|
1932
|
+
_(se),
|
|
1933
|
+
i("div", null, [
|
|
1934
|
+
i("img", {
|
|
1935
|
+
src: $(ta),
|
|
1936
|
+
alt: "List is empty"
|
|
1937
|
+
}, null, 8, Va)
|
|
1938
|
+
]),
|
|
1939
|
+
t[16] || (t[16] = i("div", { class: "fm-typo-en-body-lg-600" }, ae("No records found"), -1)),
|
|
1940
|
+
t[17] || (t[17] = i("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, ae("You can track approval and rejection history here"), -1)),
|
|
1941
|
+
_(se),
|
|
1942
|
+
_(se)
|
|
1943
|
+
]))
|
|
1944
|
+
])) : le("", !0)
|
|
1945
|
+
])
|
|
1946
|
+
]),
|
|
1947
|
+
_: 1
|
|
1948
|
+
}, 8, ["model-value"]);
|
|
1949
|
+
};
|
|
1950
|
+
}
|
|
1951
|
+
}), nn = { class: "flex-1 flex flex-col gap-8" }, on = { class: "flex flex-col" }, sn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, rn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, ln = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, cn = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, kn = /* @__PURE__ */ Ee({
|
|
1952
|
+
__name: "ClosingDraftView",
|
|
1953
|
+
setup(s) {
|
|
1954
|
+
const { t: o } = kt(), { viewDraft: e } = Ne(), { viewClosingDraftProps: m, viewClosingDraftShow: x } = ea(Ne()), h = ze(), g = ha(), P = Kt(), { breakpoints: L } = Xt();
|
|
1955
|
+
h.watchLocation(g.fetchDrafts);
|
|
1956
|
+
const M = V(() => g.loading), k = H(""), N = V(() => L.value.xs || L.value.sm), B = V(() => N.value ? 10 : 20);
|
|
1957
|
+
function v(I) {
|
|
1958
|
+
switch (I) {
|
|
1959
|
+
case "refresh":
|
|
1960
|
+
return g.fetchDrafts();
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
function c(I) {
|
|
1964
|
+
return I;
|
|
1965
|
+
}
|
|
1966
|
+
const u = V(() => N.value ? [
|
|
1967
|
+
{
|
|
1968
|
+
label: o("inventory.common.refresh"),
|
|
1969
|
+
value: "refresh",
|
|
1970
|
+
isPrimary: !1
|
|
1971
|
+
}
|
|
1972
|
+
] : [
|
|
1973
|
+
{
|
|
1974
|
+
label: o("inventory.common.refresh"),
|
|
1975
|
+
value: "refresh",
|
|
1976
|
+
isPrimary: !1
|
|
1977
|
+
}
|
|
1978
|
+
]);
|
|
1979
|
+
return (I, y) => {
|
|
1980
|
+
const b = z("FmTable");
|
|
1981
|
+
return F(), E(re, null, [
|
|
1982
|
+
_(Qt, {
|
|
1983
|
+
title: $(o)("inventory.closing.draft.title"),
|
|
1984
|
+
actions: u.value,
|
|
1985
|
+
"onClick:action": v
|
|
1986
|
+
}, {
|
|
1987
|
+
default: W(() => [
|
|
1988
|
+
i("div", {
|
|
1989
|
+
class: Se([
|
|
1990
|
+
"flex flex-col gap-8 max-h-full",
|
|
1991
|
+
{
|
|
1992
|
+
"p-0": N.value,
|
|
1993
|
+
"px-24 ": !N.value
|
|
1994
|
+
}
|
|
1995
|
+
])
|
|
1996
|
+
}, [
|
|
1997
|
+
_(Gt, {
|
|
1998
|
+
"change-location": "",
|
|
1999
|
+
searchable: "",
|
|
2000
|
+
search: k.value,
|
|
2001
|
+
"onUpdate:search": y[0] || (y[0] = (C) => k.value = C)
|
|
2002
|
+
}, null, 8, ["search"]),
|
|
2003
|
+
_(b, {
|
|
2004
|
+
style: pt($(P).tableHeight),
|
|
2005
|
+
"column-defs": $(g).columnDefs,
|
|
2006
|
+
"row-data": $(g).drafts,
|
|
2007
|
+
"search-value": k.value,
|
|
2008
|
+
loading: M.value,
|
|
2009
|
+
onRowClick: y[1] || (y[1] = (C) => $(e)(C.original)),
|
|
2010
|
+
"page-size": B.value
|
|
2011
|
+
}, {
|
|
2012
|
+
"list-row": W((C) => [
|
|
2013
|
+
_(Wt, {
|
|
2014
|
+
row: C,
|
|
2015
|
+
onRowClick: (T) => $(e)(T)
|
|
2016
|
+
}, {
|
|
2017
|
+
default: W((T) => {
|
|
2018
|
+
var O, K, Q, Z, w, X, me, ee, oe, de, xe, De, te, Ae, Te, we, Fe, je, ve, ge;
|
|
2019
|
+
return [
|
|
2020
|
+
i("div", nn, [
|
|
2021
|
+
i("div", on, [
|
|
2022
|
+
i("div", sn, [
|
|
2023
|
+
_($(Me), {
|
|
2024
|
+
render: (Q = (K = (O = T._id) == null ? void 0 : O.column) == null ? void 0 : K.columnDef) == null ? void 0 : Q.cell,
|
|
2025
|
+
props: (w = (Z = T._id) == null ? void 0 : Z.getContext) == null ? void 0 : w.call(Z)
|
|
2026
|
+
}, null, 8, ["render", "props"])
|
|
2027
|
+
]),
|
|
2028
|
+
i("div", rn, [
|
|
2029
|
+
_($(Me), {
|
|
2030
|
+
render: (ee = (me = (X = T.name) == null ? void 0 : X.column) == null ? void 0 : me.columnDef) == null ? void 0 : ee.cell,
|
|
2031
|
+
props: (de = (oe = T.name) == null ? void 0 : oe.getContext) == null ? void 0 : de.call(oe)
|
|
2032
|
+
}, null, 8, ["render", "props"])
|
|
2033
|
+
]),
|
|
2034
|
+
i("div", ln, ae([
|
|
2035
|
+
...C.original.items.slice(0, 3).map((ye) => ye.sku.name),
|
|
2036
|
+
...C.original.items.length >= 3 ? [`and ${C.original.items.length - 3} more items`] : []
|
|
2037
|
+
].join(", ")), 1),
|
|
2038
|
+
i("div", cn, [
|
|
2039
|
+
_($(Me), {
|
|
2040
|
+
render: (te = (De = (xe = T.ref) == null ? void 0 : xe.column) == null ? void 0 : De.columnDef) == null ? void 0 : te.cell,
|
|
2041
|
+
props: (Te = (Ae = T.ref) == null ? void 0 : Ae.getContext) == null ? void 0 : Te.call(Ae)
|
|
2042
|
+
}, null, 8, ["render", "props"])
|
|
2043
|
+
])
|
|
2044
|
+
]),
|
|
2045
|
+
i("div", null, [
|
|
2046
|
+
_($(Me), {
|
|
2047
|
+
render: (je = (Fe = (we = T.status) == null ? void 0 : we.column) == null ? void 0 : Fe.columnDef) == null ? void 0 : je.cell,
|
|
2048
|
+
props: (ge = (ve = T.status) == null ? void 0 : ve.getContext) == null ? void 0 : ge.call(ve)
|
|
2049
|
+
}, null, 8, ["render", "props"])
|
|
2050
|
+
])
|
|
2051
|
+
])
|
|
2052
|
+
];
|
|
2053
|
+
}),
|
|
2054
|
+
_: 2
|
|
2055
|
+
}, 1032, ["row", "onRowClick"])
|
|
2056
|
+
]),
|
|
2057
|
+
_: 1
|
|
2058
|
+
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
|
|
2059
|
+
], 2)
|
|
2060
|
+
]),
|
|
2061
|
+
_: 1
|
|
2062
|
+
}, 8, ["title", "actions"]),
|
|
2063
|
+
(F(), ue(jt, { to: "body" }, [
|
|
2064
|
+
_(an, It($(m), {
|
|
2065
|
+
show: $(x),
|
|
2066
|
+
"onUpdate:show": y[2] || (y[2] = (C) => ft(x) ? x.value = C : null),
|
|
2067
|
+
onSubmitted: y[3] || (y[3] = () => (x.value = !1, $(g).fetchDrafts())),
|
|
2068
|
+
onRefresh: y[4] || (y[4] = (C) => $(g).updateDraftRef(C))
|
|
2069
|
+
}), null, 16, ["show"])
|
|
2070
|
+
]))
|
|
2071
|
+
], 64);
|
|
2072
|
+
};
|
|
2073
|
+
}
|
|
2074
|
+
});
|
|
2075
|
+
export {
|
|
2076
|
+
kn as default
|
|
2077
|
+
};
|