@feedmepos/mf-inventory-portal 1.2.25-dev.2 → 1.2.25-dev.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-pG3igEbR.js → App-DfVozmjY.js} +1 -1
- package/dist/{ApprovalView-JoTq2Bdf.js → ApprovalView-CnfqSv9x.js} +2 -2
- package/dist/{BindingsDialog-D44lDz_m.js → BindingsDialog-kpsjxfQy.js} +2 -2
- package/dist/{BindingsPicker-BwaLwmiz.js → BindingsPicker-C-lqbpS5.js} +1 -1
- package/dist/{BindingsTable-C5y3yr5d.js → BindingsTable-C9gXT_I9.js} +1 -1
- package/dist/{ClosingDraftView-BxBEDZ8r.js → ClosingDraftView-CIzPb1jY.js} +424 -419
- package/dist/{ClosingHistoryView-DU0Dv4IW.js → ClosingHistoryView-tWDtp2Rs.js} +2 -2
- package/dist/{ClosingTemplateView-tigOzz56.js → ClosingTemplateView-DqS84ptv.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-BSxjnk3a.js → DeliveryOrderPrintPreview-BWi8-vGu.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-eUMrmGD4.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DbbA0bsv.js} +3 -3
- package/dist/{FmMultiselectDialog-s0EntbOX.js → FmMultiselectDialog-Yhn-TS1x.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DQuvByaf.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DayErKOZ.js} +1 -1
- package/dist/{ImportView-D6c6oNby.js → ImportView-DPgX-G_F.js} +2 -2
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-Ko8B7MYK.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-D7LbFPED.js} +1 -1
- package/dist/{IngredientGroupView-oCZpkxZO.js → IngredientGroupView-BfUAKH7v.js} +2 -2
- package/dist/{IngredientsView-C8WzhNAH.js → IngredientsView-BC7nWfsQ.js} +7 -7
- package/dist/{IntegrationView-DD1QWlE3.js → IntegrationView-BDxifTYa.js} +3 -3
- package/dist/{InventoryBindingForm-ChoO3SrA.js → InventoryBindingForm-CotArtis.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-DXe0VwF9.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-D2z8Sh-E.js} +3 -3
- package/dist/{InventoryBindingSummary-BGmUNPfu.js → InventoryBindingSummary-B-aThygZ.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DDXfvqWA.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CZhZ5fCR.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BwW92Whg.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Csk9pFuQ.js} +1 -1
- package/dist/{PublishView-CzS06kO-.js → PublishView-7DQ09qeB.js} +1 -1
- package/dist/{PurchaseOrderPrintPreview-YCg4lu_a.js → PurchaseOrderPrintPreview-BbcvYJ8n.js} +1 -1
- package/dist/{ReceiveRequestView-WjbYB-a0.js → ReceiveRequestView-FDyALvGT.js} +8 -8
- package/dist/{RecipeView-Cl4_vFBE.js → RecipeView-CEEoNYEk.js} +3 -3
- package/dist/{StockView-dyF-JQbP.js → StockView-BCRLEQFi.js} +8 -8
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-B-fQRg6q.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-C0_t8krY.js} +1 -1
- package/dist/{SupplierView-BN_pPxS7.js → SupplierView-BQdQ5IKV.js} +4 -4
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-DR9qQoBL.js → TransferDetails.vue_vue_type_script_setup_true_lang-BkGXaWid.js} +5 -5
- package/dist/{TransferTemplateView-CSA2wNJR.js → TransferTemplateView-DKQCZoDi.js} +7 -7
- package/dist/{UnitView-C69iwndm.js → UnitView-BwFWozmk.js} +3 -3
- package/dist/{WarehouseView-BkSvBJg_.js → WarehouseView-Bp3VfyqG.js} +1 -1
- package/dist/{app-NmiyG_NE.js → app-DTwVjf2G.js} +20153 -19327
- package/dist/app.js +1 -1
- package/dist/{decimal-B-SPLtwh.js → decimal-B0CqnvKJ.js} +1 -1
- package/dist/{format-unit-display-jXD4D_J4.js → format-unit-display-C9SRbqfx.js} +3 -3
- package/dist/{import-export.helper-BOFJJxVC.js → import-export.helper-ChSfbVTS.js} +1 -1
- package/dist/{index-BvtleP-f.js → index-DCJZYjJp.js} +1 -1
- package/dist/{index-DY1lwU0l.js → index-DHWgyDzu.js} +1 -1
- package/dist/{purchase-order-template-BNtdgrTt.js → purchase-order-template-hnS0QDeq.js} +1 -1
- package/dist/{stock-F2A8gqHx.js → stock-0CVWUWpZ.js} +1 -1
- package/dist/{stock-Basa-Xi7.js → stock-CP4PfKN1.js} +2 -2
- package/dist/{supplier-CBUmza-i.js → supplier-CR1HA06A.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-ogRof947.js → use-ingredient-select-dialog-CRROeO60.js} +1 -1
- package/dist/{use-inventory-binding-dialog-D9P4uH3I.js → use-inventory-binding-dialog-jkt1y1SA.js} +1 -1
- package/package.json +3 -3
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { defineComponent as He, ref as H, computed as V, onMounted as Ye, resolveComponent as U, openBlock as j, createElementBlock as L, Fragment as ee, createTextVNode as X, createBlock as se, withCtx as
|
|
2
|
-
import { aa as Ct, u as ze, ax as z, am as ct, ay as it, r as jt, Z as Qe, n as N, t as Bt, a0 as Be, W as Ft, Y as Tt, X as $t, az as ut, aA as dt, ah as mt, aB as pe, an as Mt, ac as Ke, ab as ve, a6 as Ue, D as st, j as Re, i as Rt, f as It, a as Pt, $ as Ie, a9 as Vt,
|
|
3
|
-
import { useCoreStore as
|
|
4
|
-
import { useSnackbar as Ge, useDialog as
|
|
5
|
-
import { defineStore as pt, storeToRefs as
|
|
6
|
-
import { u as vt } from "./stock-
|
|
7
|
-
import { u as We } from "./stock-
|
|
8
|
-
import { E as
|
|
9
|
-
const Ne = Ct((
|
|
1
|
+
import { defineComponent as He, ref as H, computed as V, onMounted as Ye, resolveComponent as U, openBlock as j, createElementBlock as L, Fragment as ee, createTextVNode as X, createBlock as se, withCtx as Y, createElementVNode as r, toDisplayString as J, unref as F, createVNode as h, createCommentVNode as de, h as T, reactive as _t, watch as Dt, isRef as rt, normalizeClass as De, renderList as je, normalizeStyle as lt, Teleport as wt, mergeProps as St } from "vue";
|
|
2
|
+
import { aa as Ct, u as ze, ax as z, am as ct, ay as it, r as jt, Z as Qe, n as N, t as Bt, a0 as Be, W as Ft, Y as Tt, X as $t, az as ut, aA as dt, ah as mt, aB as pe, an as Mt, ac as Ke, ab as ve, a6 as Ue, D as st, j as Re, i as Rt, f as It, a as Pt, $ as Ie, a9 as Vt, h as Ut, G as Lt, I as Et, J as Ht, K as zt, L as Pe } from "./app-DTwVjf2G.js";
|
|
3
|
+
import { useCoreStore as Nt, useI18n as ft } from "@feedmepos/mf-common";
|
|
4
|
+
import { useSnackbar as Ge, useDialog as Ot, useProxiedModel as Kt, components as Ve, useBreakpoints as Yt } from "@feedmepos/ui-library";
|
|
5
|
+
import { defineStore as pt, storeToRefs as Qt } from "pinia";
|
|
6
|
+
import { u as vt } from "./stock-CP4PfKN1.js";
|
|
7
|
+
import { u as We } from "./stock-0CVWUWpZ.js";
|
|
8
|
+
import { E as Gt } from "./empty-placeholder-wf6-BWE8.js";
|
|
9
|
+
const Ne = Ct((s, l) => {
|
|
10
10
|
function e() {
|
|
11
11
|
return ze().currentLocation.dbName;
|
|
12
12
|
}
|
|
13
13
|
return {
|
|
14
14
|
async getDraft(m) {
|
|
15
|
-
const p = e(),
|
|
16
|
-
return l.get(
|
|
15
|
+
const p = e(), _ = `${s.inventoryBackendUrl}/${p}/closing-draft/${m}`;
|
|
16
|
+
return l.get(_);
|
|
17
17
|
},
|
|
18
18
|
async readDrafts() {
|
|
19
|
-
const m = e(), p = `${
|
|
19
|
+
const m = e(), p = `${s.inventoryBackendUrl}/${m}/closing-draft`;
|
|
20
20
|
return l.get(p);
|
|
21
21
|
},
|
|
22
22
|
async runOperation(m) {
|
|
23
|
-
const p = e(),
|
|
24
|
-
return l.post(
|
|
23
|
+
const p = e(), _ = `${s.inventoryBackendUrl}/${p}/closing-draft/run-operation`;
|
|
24
|
+
return l.post(_, m);
|
|
25
25
|
},
|
|
26
26
|
async sync(m) {
|
|
27
|
-
const p = e(),
|
|
28
|
-
return l.post(
|
|
27
|
+
const p = e(), _ = `${s.inventoryBackendUrl}/${p}/closing-draft/sync`;
|
|
28
|
+
return l.post(_, m);
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
}),
|
|
31
|
+
}), Wt = { class: "fm-typo-en-body-lg-400" }, qt = { class: "fm-typo-en-body-lg-600" }, Zt = {
|
|
32
32
|
key: 0,
|
|
33
33
|
class: "flex flex-col"
|
|
34
|
-
},
|
|
34
|
+
}, Jt = { class: "flex gap-12 py-8 justify-end w-full" }, Oe = /* @__PURE__ */ He({
|
|
35
35
|
__name: "ClosingDraftAction",
|
|
36
36
|
props: {
|
|
37
37
|
draft: {},
|
|
@@ -39,8 +39,8 @@ const Ne = Ct((o, l) => {
|
|
|
39
39
|
onCancel: { type: Function },
|
|
40
40
|
onFinished: { type: Function }
|
|
41
41
|
},
|
|
42
|
-
setup(
|
|
43
|
-
const l =
|
|
42
|
+
setup(s) {
|
|
43
|
+
const l = s, e = H(), m = Ne(), p = Ge(), _ = H(!1), v = H(null), R = H(!1), S = V(() => {
|
|
44
44
|
switch (l.action) {
|
|
45
45
|
case z.enum.approveDraft:
|
|
46
46
|
return "Approve";
|
|
@@ -65,8 +65,8 @@ const Ne = Ct((o, l) => {
|
|
|
65
65
|
if (l.draft.effectiveAt)
|
|
66
66
|
v.value = new Date(l.draft.effectiveAt);
|
|
67
67
|
else {
|
|
68
|
-
const
|
|
69
|
-
|
|
68
|
+
const n = new Date(l.draft.createdAt);
|
|
69
|
+
n.setHours(23, 59, 59, 999), v.value = n;
|
|
70
70
|
}
|
|
71
71
|
R.value = !0;
|
|
72
72
|
});
|
|
@@ -74,9 +74,9 @@ const Ne = Ct((o, l) => {
|
|
|
74
74
|
get() {
|
|
75
75
|
return v.value === null ? "" : ct(v.value);
|
|
76
76
|
},
|
|
77
|
-
set(
|
|
78
|
-
if (
|
|
79
|
-
const a = /* @__PURE__ */ new Date(`${
|
|
77
|
+
set(n) {
|
|
78
|
+
if (n) {
|
|
79
|
+
const a = /* @__PURE__ */ new Date(`${n} ${P.value}`);
|
|
80
80
|
a.setSeconds(59, 999), v.value = a;
|
|
81
81
|
} else
|
|
82
82
|
v.value = null;
|
|
@@ -85,16 +85,16 @@ const Ne = Ct((o, l) => {
|
|
|
85
85
|
get() {
|
|
86
86
|
return v.value === null ? "" : it(v.value);
|
|
87
87
|
},
|
|
88
|
-
set(
|
|
89
|
-
if (
|
|
90
|
-
const a = /* @__PURE__ */ new Date(`${$.value} ${
|
|
88
|
+
set(n) {
|
|
89
|
+
if (n) {
|
|
90
|
+
const a = /* @__PURE__ */ new Date(`${$.value} ${n}`);
|
|
91
91
|
a.setSeconds(59, 999), v.value = a;
|
|
92
92
|
} else
|
|
93
93
|
v.value = null;
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
96
|
async function I() {
|
|
97
|
-
|
|
97
|
+
_.value = !0;
|
|
98
98
|
try {
|
|
99
99
|
await m.runOperation({
|
|
100
100
|
_id: l.draft._id,
|
|
@@ -109,70 +109,70 @@ const Ne = Ct((o, l) => {
|
|
|
109
109
|
message: "Action submitted",
|
|
110
110
|
type: "success"
|
|
111
111
|
}), l.onFinished();
|
|
112
|
-
} catch (
|
|
112
|
+
} catch (n) {
|
|
113
113
|
p.open({
|
|
114
114
|
title: "Something went wrong",
|
|
115
|
-
message: "Unable to submit action. Please try again",
|
|
115
|
+
message: (n == null ? void 0 : n.message) ?? "Unable to submit action. Please try again",
|
|
116
116
|
type: "error"
|
|
117
|
-
}), console.error("error on submit closing draft action",
|
|
117
|
+
}), console.error("error on submit closing draft action", n);
|
|
118
118
|
} finally {
|
|
119
|
-
|
|
119
|
+
_.value = !1;
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
return (
|
|
123
|
-
const
|
|
124
|
-
return R.value ? (j(), se(
|
|
122
|
+
return (n, a) => {
|
|
123
|
+
const D = U("FmLabel"), O = U("FmDatePicker"), f = U("FmTimePicker"), y = U("FmTextField"), A = U("FmButton"), w = U("FmForm");
|
|
124
|
+
return R.value ? (j(), se(w, {
|
|
125
125
|
key: 1,
|
|
126
126
|
onValidationSuccess: I,
|
|
127
127
|
class: "flex flex-col gap-32",
|
|
128
|
-
disabled:
|
|
128
|
+
disabled: _.value
|
|
129
129
|
}, {
|
|
130
|
-
default:
|
|
131
|
-
r("div",
|
|
130
|
+
default: Y(() => [
|
|
131
|
+
r("div", Wt, [
|
|
132
132
|
a[4] || (a[4] = X(" You are about to ")),
|
|
133
|
-
r("span",
|
|
133
|
+
r("span", qt, J(S.value), 1),
|
|
134
134
|
a[5] || (a[5] = X(" this draft. Please provide a remark to justify this action. "))
|
|
135
135
|
]),
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
default:
|
|
136
|
+
n.action === F(z).enum.approveDraft ? (j(), L("div", Zt, [
|
|
137
|
+
h(D, { class: "fm-typo-en-body-lg-600" }, {
|
|
138
|
+
default: Y(() => a[6] || (a[6] = [
|
|
139
139
|
X("Closing Date")
|
|
140
140
|
])),
|
|
141
141
|
_: 1
|
|
142
142
|
}),
|
|
143
|
-
|
|
143
|
+
h(O, {
|
|
144
144
|
modelValue: $.value,
|
|
145
145
|
"onUpdate:modelValue": a[0] || (a[0] = (M) => $.value = M)
|
|
146
146
|
}, null, 8, ["modelValue"]),
|
|
147
|
-
|
|
148
|
-
default:
|
|
147
|
+
h(D, { class: "fm-typo-en-body-lg-600" }, {
|
|
148
|
+
default: Y(() => a[7] || (a[7] = [
|
|
149
149
|
X("Closing Time")
|
|
150
150
|
])),
|
|
151
151
|
_: 1
|
|
152
152
|
}),
|
|
153
|
-
|
|
153
|
+
h(f, {
|
|
154
154
|
modelValue: P.value,
|
|
155
155
|
"onUpdate:modelValue": a[1] || (a[1] = (M) => P.value = M)
|
|
156
156
|
}, null, 8, ["modelValue"])
|
|
157
157
|
])) : de("", !0),
|
|
158
|
-
|
|
158
|
+
h(y, {
|
|
159
159
|
modelValue: e.value,
|
|
160
160
|
"onUpdate:modelValue": a[2] || (a[2] = (M) => e.value = M),
|
|
161
161
|
label: "Remark",
|
|
162
162
|
"label-mark": "required",
|
|
163
163
|
rules: [F(jt)()]
|
|
164
164
|
}, null, 8, ["modelValue", "rules"]),
|
|
165
|
-
r("div",
|
|
166
|
-
|
|
165
|
+
r("div", Jt, [
|
|
166
|
+
h(A, {
|
|
167
167
|
label: "Cancel",
|
|
168
168
|
variant: "tertiary",
|
|
169
|
-
onClick: a[3] || (a[3] = (M) =>
|
|
169
|
+
onClick: a[3] || (a[3] = (M) => n.onCancel())
|
|
170
170
|
}),
|
|
171
|
-
|
|
171
|
+
h(A, {
|
|
172
172
|
label: S.value,
|
|
173
173
|
type: "submit",
|
|
174
174
|
variant: k.value,
|
|
175
|
-
loading:
|
|
175
|
+
loading: _.value
|
|
176
176
|
}, null, 8, ["label", "variant", "loading"])
|
|
177
177
|
])
|
|
178
178
|
]),
|
|
@@ -182,52 +182,52 @@ const Ne = Ct((o, l) => {
|
|
|
182
182
|
], 64));
|
|
183
183
|
};
|
|
184
184
|
}
|
|
185
|
-
}),
|
|
186
|
-
function yt(
|
|
187
|
-
const l =
|
|
185
|
+
}), Xt = Be(0);
|
|
186
|
+
function yt(s) {
|
|
187
|
+
const l = s.measurementsAmounts.groupBy((m) => m.measurement.id), e = s.sku.unit.measurements.reduce((m, p) => {
|
|
188
188
|
var R, S;
|
|
189
|
-
const
|
|
189
|
+
const _ = ((S = (R = l.get(p.id)) == null ? void 0 : R[0]) == null ? void 0 : S.amount) ?? Xt, v = Qe(p.conversion, _);
|
|
190
190
|
return m + +N(v);
|
|
191
|
-
}, +N(
|
|
192
|
-
return Bt(e,
|
|
191
|
+
}, +N(s.baseAmount));
|
|
192
|
+
return Bt(e, s.baseAmount.precision);
|
|
193
193
|
}
|
|
194
|
-
const
|
|
195
|
-
function
|
|
196
|
-
var
|
|
197
|
-
const v = yt(
|
|
194
|
+
const ea = Be(0), ta = Be(100), gt = "N/A";
|
|
195
|
+
function aa(s, l, e, m, p, _) {
|
|
196
|
+
var w;
|
|
197
|
+
const v = yt(s), R = m ?? v, S = ut(R, l), k = l.amount === 0 ? null : dt(S, {
|
|
198
198
|
...l,
|
|
199
199
|
amount: Math.abs(l.amount)
|
|
200
|
-
}), $ = k ? Qe(k,
|
|
200
|
+
}), $ = k ? Qe(k, ta) : null, P = (w = s.sku.defaultCost) != null && w.costPerUnit ? s.sku.defaultCost.costPerUnit.amount / Math.pow(10, s.sku.defaultCost.costPerUnit.precision) : 0, I = p ? +N(p) : 0, n = +N(l), a = +N(R), D = n - a, O = D * P, f = a * P, y = n * P;
|
|
201
201
|
return {
|
|
202
|
-
code:
|
|
203
|
-
name:
|
|
204
|
-
baseUnit:
|
|
205
|
-
baseUnitAmount: +N(
|
|
206
|
-
...
|
|
207
|
-
(M) =>
|
|
202
|
+
code: s.sku.code,
|
|
203
|
+
name: s.sku.name,
|
|
204
|
+
baseUnit: s.sku.unit.abbrev,
|
|
205
|
+
baseUnitAmount: +N(s.baseAmount),
|
|
206
|
+
...s.measurementsAmounts.filter(
|
|
207
|
+
(M) => na(M.measurement) && e.includes(M.measurement.id)
|
|
208
208
|
).reduce(
|
|
209
209
|
(M, Z, W) => (M[`measurementAbbrev${W}`] = `(${Z.measurement.abbrev}) × ${N(Z.measurement.conversion)}`, M[`measurementAmount${W}`] = +N(Z.amount), M),
|
|
210
210
|
{}
|
|
211
211
|
),
|
|
212
|
-
systemBalance:
|
|
212
|
+
systemBalance: n,
|
|
213
213
|
physicalBalance: a,
|
|
214
214
|
adjustedAmount: +N(S),
|
|
215
215
|
adjustedDiffPercentage: $ ? +N(mt($, 2)) : null,
|
|
216
216
|
costPerUnit: P,
|
|
217
217
|
opening: I,
|
|
218
|
-
adjustmentTypes:
|
|
219
|
-
varianceQty:
|
|
218
|
+
adjustmentTypes: _ ?? gt,
|
|
219
|
+
varianceQty: D,
|
|
220
220
|
varianceRM: O,
|
|
221
221
|
stockTakeValue: f,
|
|
222
222
|
systemValue: y
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
|
-
function
|
|
226
|
-
return !
|
|
225
|
+
function na(s) {
|
|
226
|
+
return !s.abbrev.toLocaleLowerCase().includes("inactive");
|
|
227
227
|
}
|
|
228
|
-
function
|
|
229
|
-
const l = bt(
|
|
230
|
-
return
|
|
228
|
+
function oa(s) {
|
|
229
|
+
const l = bt(s);
|
|
230
|
+
return s.reduce(
|
|
231
231
|
(e, m) => {
|
|
232
232
|
var p;
|
|
233
233
|
return Math.max(e, ((p = l == null ? void 0 : l.get(m.sku._id)) == null ? void 0 : p[0].length) ?? 0);
|
|
@@ -235,13 +235,13 @@ function na(o) {
|
|
|
235
235
|
0
|
|
236
236
|
);
|
|
237
237
|
}
|
|
238
|
-
function bt(
|
|
239
|
-
return
|
|
238
|
+
function bt(s) {
|
|
239
|
+
return s.groupBy(
|
|
240
240
|
(l) => l.sku._id,
|
|
241
241
|
(l) => l.measurementsAmounts.filter((e) => !e.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((e) => e.measurement.id)
|
|
242
242
|
);
|
|
243
243
|
}
|
|
244
|
-
function
|
|
244
|
+
function sa(s) {
|
|
245
245
|
return [
|
|
246
246
|
{
|
|
247
247
|
id: "code",
|
|
@@ -303,7 +303,7 @@ function oa(o) {
|
|
|
303
303
|
id: "baseUnitAmount",
|
|
304
304
|
name: "Base unit amount"
|
|
305
305
|
},
|
|
306
|
-
...Array.from({ length:
|
|
306
|
+
...Array.from({ length: s }).flatMap((e, m) => [
|
|
307
307
|
{
|
|
308
308
|
id: `measurementAmount${m}`,
|
|
309
309
|
name: `UOM amount ${m + 1}`
|
|
@@ -315,71 +315,71 @@ function oa(o) {
|
|
|
315
315
|
])
|
|
316
316
|
];
|
|
317
317
|
}
|
|
318
|
-
function
|
|
319
|
-
var y,
|
|
318
|
+
function ra(s, l, e) {
|
|
319
|
+
var y, A, w, M, Z, W, re;
|
|
320
320
|
const m = l.groupBy(
|
|
321
321
|
(B) => B.id,
|
|
322
322
|
(B) => B.balance
|
|
323
323
|
), p = e.groupBy(
|
|
324
324
|
(B) => B.id,
|
|
325
325
|
(B) => B.balance
|
|
326
|
-
),
|
|
327
|
-
if (
|
|
328
|
-
for (const B of
|
|
329
|
-
|
|
326
|
+
), _ = /* @__PURE__ */ new Map();
|
|
327
|
+
if (s.opening)
|
|
328
|
+
for (const B of s.opening)
|
|
329
|
+
_.set(B.skuId, B.balance);
|
|
330
330
|
const v = /* @__PURE__ */ new Map();
|
|
331
|
-
if (
|
|
332
|
-
for (const B of
|
|
331
|
+
if (s.adjustmentSnapshot)
|
|
332
|
+
for (const B of s.adjustmentSnapshot) {
|
|
333
333
|
const te = Object.keys(B.adjustmentsByType).join(", ");
|
|
334
334
|
v.set(B.skuId, te || gt);
|
|
335
335
|
}
|
|
336
|
-
const R = [...
|
|
337
|
-
var ye, ge,
|
|
338
|
-
const te = ((ye = m.get(B.sku._id)) == null ? void 0 : ye[0]) ??
|
|
339
|
-
return
|
|
336
|
+
const R = [...s.items, ...s.negativeStockItems ?? []], S = bt(R), k = R.map((B) => {
|
|
337
|
+
var ye, ge, Q;
|
|
338
|
+
const te = ((ye = m.get(B.sku._id)) == null ? void 0 : ye[0]) ?? ea, be = ((ge = S == null ? void 0 : S.get(B.sku._id)) == null ? void 0 : ge[0]) ?? [], he = _.get(B.sku._id), fe = v.get(B.sku._id);
|
|
339
|
+
return aa(
|
|
340
340
|
B,
|
|
341
341
|
te,
|
|
342
342
|
be,
|
|
343
|
-
(
|
|
344
|
-
|
|
343
|
+
(Q = p.get(B.sku._id)) == null ? void 0 : Q[0],
|
|
344
|
+
he,
|
|
345
345
|
fe
|
|
346
346
|
);
|
|
347
|
-
}), $ =
|
|
347
|
+
}), $ = oa(R), I = Nt().currentBusiness.value, n = sa($), a = [
|
|
348
348
|
["Business name:", I == null ? void 0 : I.name],
|
|
349
349
|
["Business ID:", I == null ? void 0 : I._id],
|
|
350
350
|
["Menu version", I == null ? void 0 : I.menuVersion],
|
|
351
|
-
["Created at", new Date(
|
|
352
|
-
["Created by", (y =
|
|
353
|
-
["Updated at", new Date(
|
|
354
|
-
["Updated by", (
|
|
355
|
-
["Recent action",
|
|
351
|
+
["Created at", new Date(s.createdAt)],
|
|
352
|
+
["Created by", (y = s.createdBy) == null ? void 0 : y.name],
|
|
353
|
+
["Updated at", new Date(s.updatedAt)],
|
|
354
|
+
["Updated by", (A = s.updatedBy) == null ? void 0 : A.name],
|
|
355
|
+
["Recent action", s.approvedAt ? "Approve" : s.rejectionHistory ? "Reject" : ""],
|
|
356
356
|
[
|
|
357
357
|
"Action by",
|
|
358
|
-
|
|
358
|
+
s.approvedAt ? (w = s.approvedBy) == null ? void 0 : w.name : s.rejectionHistory ? (Z = (M = s.rejectionHistory[0]) == null ? void 0 : M.rejectedBy) == null ? void 0 : Z.name : ""
|
|
359
359
|
],
|
|
360
360
|
[
|
|
361
361
|
"Action at",
|
|
362
|
-
|
|
362
|
+
s.approvedAt ? new Date(s.approvedAt) : s.rejectionHistory ? new Date((W = s.rejectionHistory[0]) == null ? void 0 : W.rejectedAt) : ""
|
|
363
363
|
],
|
|
364
364
|
[
|
|
365
365
|
"Action remark",
|
|
366
|
-
|
|
366
|
+
s.approvedAt ? s.approveRemark : s.rejectionHistory ? new Date((re = s.rejectionHistory[0]) == null ? void 0 : re.rejectRemark) : ""
|
|
367
367
|
],
|
|
368
368
|
[],
|
|
369
|
-
|
|
370
|
-
...k.map((B) =>
|
|
371
|
-
],
|
|
369
|
+
n.map((B) => B.name),
|
|
370
|
+
...k.map((B) => n.map((te) => B[te.id]))
|
|
371
|
+
], D = n.map((B) => `system:${B.id}`), O = Ft(a, D), f = `[${I == null ? void 0 : I.name}] closing draft (${Tt(new Date(s.updatedAt))}).xlsx`;
|
|
372
372
|
return $t(O, f), f;
|
|
373
373
|
}
|
|
374
|
-
const
|
|
374
|
+
const la = { class: "flex flex-col" }, ca = { class: "flex gap-12 py-8 justify-end w-full" }, ia = /* @__PURE__ */ He({
|
|
375
375
|
__name: "RefreshBalanceAction",
|
|
376
376
|
props: {
|
|
377
377
|
draft: {},
|
|
378
378
|
onCancel: { type: Function },
|
|
379
379
|
onFinished: { type: Function }
|
|
380
380
|
},
|
|
381
|
-
setup(
|
|
382
|
-
const l =
|
|
381
|
+
setup(s) {
|
|
382
|
+
const l = s;
|
|
383
383
|
We();
|
|
384
384
|
const e = H(!1), m = H(null), p = H(!1);
|
|
385
385
|
Ye(() => {
|
|
@@ -391,7 +391,7 @@ const ra = { class: "flex flex-col" }, la = { class: "flex gap-12 py-8 justify-e
|
|
|
391
391
|
}
|
|
392
392
|
p.value = !0;
|
|
393
393
|
});
|
|
394
|
-
const
|
|
394
|
+
const _ = V({
|
|
395
395
|
get() {
|
|
396
396
|
return m.value === null ? "" : ct(m.value);
|
|
397
397
|
},
|
|
@@ -408,7 +408,7 @@ const ra = { class: "flex flex-col" }, la = { class: "flex gap-12 py-8 justify-e
|
|
|
408
408
|
},
|
|
409
409
|
set(S) {
|
|
410
410
|
if (S) {
|
|
411
|
-
const k = /* @__PURE__ */ new Date(`${
|
|
411
|
+
const k = /* @__PURE__ */ new Date(`${_.value} ${S}`);
|
|
412
412
|
k.setSeconds(59, 999), m.value = k;
|
|
413
413
|
} else
|
|
414
414
|
m.value = null;
|
|
@@ -418,14 +418,14 @@ const ra = { class: "flex flex-col" }, la = { class: "flex gap-12 py-8 justify-e
|
|
|
418
418
|
e.value = !0, l.onFinished(m.value.toISOString());
|
|
419
419
|
}
|
|
420
420
|
return (S, k) => {
|
|
421
|
-
const $ = U("FmLabel"), P = U("FmDatePicker"), I = U("FmTimePicker"),
|
|
421
|
+
const $ = U("FmLabel"), P = U("FmDatePicker"), I = U("FmTimePicker"), n = U("FmButton"), a = U("FmForm");
|
|
422
422
|
return p.value ? (j(), se(a, {
|
|
423
423
|
key: 1,
|
|
424
424
|
onValidationSuccess: R,
|
|
425
425
|
class: "flex flex-col gap-32",
|
|
426
426
|
disabled: e.value
|
|
427
427
|
}, {
|
|
428
|
-
default:
|
|
428
|
+
default: Y(() => [
|
|
429
429
|
k[5] || (k[5] = r("div", { class: "fm-typo-en-body-lg-400" }, [
|
|
430
430
|
r("p", null, [
|
|
431
431
|
X(" Performing "),
|
|
@@ -438,35 +438,35 @@ const ra = { class: "flex flex-col" }, la = { class: "flex gap-12 py-8 justify-e
|
|
|
438
438
|
X(" the effective date and time. ")
|
|
439
439
|
])
|
|
440
440
|
], -1)),
|
|
441
|
-
r("div",
|
|
442
|
-
|
|
443
|
-
default:
|
|
441
|
+
r("div", la, [
|
|
442
|
+
h($, { class: "fm-typo-en-body-lg-600" }, {
|
|
443
|
+
default: Y(() => k[3] || (k[3] = [
|
|
444
444
|
X("Closing Date")
|
|
445
445
|
])),
|
|
446
446
|
_: 1
|
|
447
447
|
}),
|
|
448
|
-
|
|
449
|
-
modelValue:
|
|
450
|
-
"onUpdate:modelValue": k[0] || (k[0] = (
|
|
448
|
+
h(P, {
|
|
449
|
+
modelValue: _.value,
|
|
450
|
+
"onUpdate:modelValue": k[0] || (k[0] = (D) => _.value = D)
|
|
451
451
|
}, null, 8, ["modelValue"]),
|
|
452
|
-
|
|
453
|
-
default:
|
|
452
|
+
h($, { class: "fm-typo-en-body-lg-600" }, {
|
|
453
|
+
default: Y(() => k[4] || (k[4] = [
|
|
454
454
|
X("Closing Time")
|
|
455
455
|
])),
|
|
456
456
|
_: 1
|
|
457
457
|
}),
|
|
458
|
-
|
|
458
|
+
h(I, {
|
|
459
459
|
modelValue: v.value,
|
|
460
|
-
"onUpdate:modelValue": k[1] || (k[1] = (
|
|
460
|
+
"onUpdate:modelValue": k[1] || (k[1] = (D) => v.value = D)
|
|
461
461
|
}, null, 8, ["modelValue"])
|
|
462
462
|
]),
|
|
463
|
-
r("div",
|
|
464
|
-
|
|
463
|
+
r("div", ca, [
|
|
464
|
+
h(n, {
|
|
465
465
|
label: "Cancel",
|
|
466
466
|
variant: "tertiary",
|
|
467
|
-
onClick: k[2] || (k[2] = (
|
|
467
|
+
onClick: k[2] || (k[2] = (D) => S.onCancel())
|
|
468
468
|
}),
|
|
469
|
-
|
|
469
|
+
h(n, {
|
|
470
470
|
label: "Refresh balance",
|
|
471
471
|
type: "submit",
|
|
472
472
|
variant: "primary",
|
|
@@ -483,7 +483,7 @@ const ra = { class: "flex flex-col" }, la = { class: "flex gap-12 py-8 justify-e
|
|
|
483
483
|
}), Ee = pt(
|
|
484
484
|
"closingDraftActions",
|
|
485
485
|
function() {
|
|
486
|
-
const l =
|
|
486
|
+
const l = Ot(), e = Ge(), m = We(), p = Ne(), _ = vt(), v = H(!1), R = H();
|
|
487
487
|
function S(f) {
|
|
488
488
|
const y = {
|
|
489
489
|
draft: f
|
|
@@ -491,10 +491,10 @@ const ra = { class: "flex flex-col" }, la = { class: "flex gap-12 py-8 justify-e
|
|
|
491
491
|
R.value = y, v.value = !0;
|
|
492
492
|
}
|
|
493
493
|
async function k(f) {
|
|
494
|
-
var
|
|
494
|
+
var A;
|
|
495
495
|
if (f.status === pe.enum.COMPLETED) {
|
|
496
|
-
const
|
|
497
|
-
if (!
|
|
496
|
+
const w = f.closingAdjustmentId;
|
|
497
|
+
if (!w)
|
|
498
498
|
return e.open({
|
|
499
499
|
title: "Something went wrong",
|
|
500
500
|
message: "Closing draft is completed but closing document cannot be found.",
|
|
@@ -502,20 +502,20 @@ const ra = { class: "flex flex-col" }, la = { class: "flex gap-12 py-8 justify-e
|
|
|
502
502
|
}), console.error("Closing draft is completed but closing document cannot be found.", {
|
|
503
503
|
draftId: f._id
|
|
504
504
|
}), [];
|
|
505
|
-
const M = await m.readAdjustmentById(
|
|
505
|
+
const M = await m.readAdjustmentById(w);
|
|
506
506
|
return ((M == null ? void 0 : M.skus) ?? []).map((W) => ({
|
|
507
507
|
id: W.sku._id,
|
|
508
508
|
balance: W.fromBalance,
|
|
509
509
|
costs: W.fromCostBalances
|
|
510
510
|
}));
|
|
511
511
|
} else
|
|
512
|
-
return await
|
|
512
|
+
return await _.readStockBalance(), ((A = _.stockBalance) == null ? void 0 : A.skus) ?? [];
|
|
513
513
|
}
|
|
514
|
-
async function $(f, y,
|
|
514
|
+
async function $(f, y, A) {
|
|
515
515
|
y || (e.open({
|
|
516
516
|
title: "Exporting",
|
|
517
517
|
message: "Fetching data..."
|
|
518
|
-
}), y = await k(f)),
|
|
518
|
+
}), y = await k(f)), ra(f, y, A ?? []);
|
|
519
519
|
}
|
|
520
520
|
function P(f, y) {
|
|
521
521
|
l.open({
|
|
@@ -545,7 +545,7 @@ const ra = { class: "flex flex-col" }, la = { class: "flex gap-12 py-8 justify-e
|
|
|
545
545
|
}
|
|
546
546
|
});
|
|
547
547
|
}
|
|
548
|
-
function
|
|
548
|
+
function n(f, y) {
|
|
549
549
|
l.open({
|
|
550
550
|
title: "Mark draft as failed",
|
|
551
551
|
contentComponent: Oe,
|
|
@@ -573,17 +573,17 @@ const ra = { class: "flex flex-col" }, la = { class: "flex gap-12 py-8 justify-e
|
|
|
573
573
|
type: "success"
|
|
574
574
|
}), y == null || y();
|
|
575
575
|
}
|
|
576
|
-
function
|
|
576
|
+
function D() {
|
|
577
577
|
v.value = !1;
|
|
578
578
|
}
|
|
579
|
-
async function O(f, y,
|
|
579
|
+
async function O(f, y, A) {
|
|
580
580
|
await l.open({
|
|
581
581
|
title: "Refresh balance",
|
|
582
|
-
contentComponent:
|
|
582
|
+
contentComponent: ia,
|
|
583
583
|
contentComponentProps: {
|
|
584
584
|
draft: f,
|
|
585
|
-
onFinished: (
|
|
586
|
-
l.close(),
|
|
585
|
+
onFinished: (w) => {
|
|
586
|
+
l.close(), A == null || A(w);
|
|
587
587
|
},
|
|
588
588
|
onCancel: async () => {
|
|
589
589
|
l.close(), y == null || y();
|
|
@@ -593,10 +593,10 @@ const ra = { class: "flex flex-col" }, la = { class: "flex gap-12 py-8 justify-e
|
|
|
593
593
|
}
|
|
594
594
|
return {
|
|
595
595
|
viewDraft: S,
|
|
596
|
-
closeDraftDialog:
|
|
596
|
+
closeDraftDialog: D,
|
|
597
597
|
approveDraft: P,
|
|
598
598
|
rejectDraft: I,
|
|
599
|
-
markAsFailed:
|
|
599
|
+
markAsFailed: n,
|
|
600
600
|
syncDraft: a,
|
|
601
601
|
exportDraft: $,
|
|
602
602
|
refreshBalance: O,
|
|
@@ -605,8 +605,8 @@ const ra = { class: "flex flex-col" }, la = { class: "flex gap-12 py-8 justify-e
|
|
|
605
605
|
};
|
|
606
606
|
}
|
|
607
607
|
);
|
|
608
|
-
function Le(
|
|
609
|
-
switch (
|
|
608
|
+
function Le(s) {
|
|
609
|
+
switch (s) {
|
|
610
610
|
case "DRAFT":
|
|
611
611
|
return "fm-status-badge-draft";
|
|
612
612
|
case "PROCESSING":
|
|
@@ -617,30 +617,30 @@ function Le(o) {
|
|
|
617
617
|
return "fm-status-badge-complete";
|
|
618
618
|
}
|
|
619
619
|
}
|
|
620
|
-
const
|
|
620
|
+
const ua = pt(
|
|
621
621
|
"closingDraftTable",
|
|
622
622
|
function() {
|
|
623
|
-
const { t: l } = ft(), e = Ee(), m = H(new Array()), p = H(!1),
|
|
623
|
+
const { t: l } = ft(), e = Ee(), m = H(new Array()), p = H(!1), _ = ze(), v = Ne();
|
|
624
624
|
async function R() {
|
|
625
|
-
if (m.value = [], !!
|
|
625
|
+
if (m.value = [], !!_._currentLocation) {
|
|
626
626
|
p.value = !0;
|
|
627
627
|
try {
|
|
628
|
-
const [
|
|
629
|
-
m.value =
|
|
630
|
-
} catch (
|
|
631
|
-
console.log("Something went wrong when fetching drafts:",
|
|
628
|
+
const [n] = await Promise.all([v.readDrafts()]).delayed(1e3);
|
|
629
|
+
m.value = n.reverse();
|
|
630
|
+
} catch (n) {
|
|
631
|
+
console.log("Something went wrong when fetching drafts:", n);
|
|
632
632
|
} finally {
|
|
633
633
|
p.value = !1;
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
636
|
}
|
|
637
|
-
async function S(
|
|
638
|
-
if (!m.value.find((a) => a._id) &&
|
|
637
|
+
async function S(n) {
|
|
638
|
+
if (!m.value.find((a) => a._id) && _._currentLocation) {
|
|
639
639
|
p.value = !0;
|
|
640
640
|
try {
|
|
641
641
|
const [a] = await Promise.all([
|
|
642
|
-
v.getDraft(
|
|
643
|
-
new Promise((
|
|
642
|
+
v.getDraft(n),
|
|
643
|
+
new Promise((D) => setTimeout(D, 1e3))
|
|
644
644
|
]);
|
|
645
645
|
m.value = [a];
|
|
646
646
|
} catch (a) {
|
|
@@ -650,17 +650,17 @@ const ia = pt(
|
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
652
|
}
|
|
653
|
-
function k(
|
|
654
|
-
m.value = m.value.map((a) => a._id ===
|
|
655
|
-
...
|
|
653
|
+
function k(n) {
|
|
654
|
+
m.value = m.value.map((a) => a._id === n._id ? {
|
|
655
|
+
...n,
|
|
656
656
|
_rev: a._rev
|
|
657
657
|
} : a);
|
|
658
658
|
}
|
|
659
659
|
function $() {
|
|
660
660
|
e.closeDraftDialog(), R();
|
|
661
661
|
}
|
|
662
|
-
function P(
|
|
663
|
-
switch (a = It(a),
|
|
662
|
+
function P(n, a) {
|
|
663
|
+
switch (a = It(a), n) {
|
|
664
664
|
case Re.Details:
|
|
665
665
|
return e.viewDraft(a);
|
|
666
666
|
case Re.Export:
|
|
@@ -679,25 +679,25 @@ const ia = pt(
|
|
|
679
679
|
id: "_id",
|
|
680
680
|
accessorKey: "_id",
|
|
681
681
|
header: () => l("inventory.closing.table.createdAt"),
|
|
682
|
-
cell(
|
|
683
|
-
return Mt(`${
|
|
682
|
+
cell(n) {
|
|
683
|
+
return Mt(`${n.getValue()}`);
|
|
684
684
|
},
|
|
685
685
|
enableSorting: !0
|
|
686
686
|
},
|
|
687
687
|
{
|
|
688
688
|
accessorKey: "effectiveAt",
|
|
689
689
|
header: () => "Effective at",
|
|
690
|
-
cell(
|
|
691
|
-
const a =
|
|
692
|
-
let
|
|
693
|
-
return
|
|
690
|
+
cell(n) {
|
|
691
|
+
const a = n.row.original;
|
|
692
|
+
let D = n.getValue();
|
|
693
|
+
return D || (D = Ke(a._id)), ve(D);
|
|
694
694
|
},
|
|
695
695
|
enableSorting: !0,
|
|
696
696
|
size: 200
|
|
697
697
|
},
|
|
698
698
|
{
|
|
699
699
|
id: "updatedAt",
|
|
700
|
-
accessorFn: (
|
|
700
|
+
accessorFn: (n) => ve(n.updatedAt),
|
|
701
701
|
header: () => "Updated at",
|
|
702
702
|
enableSorting: !0,
|
|
703
703
|
size: 200
|
|
@@ -711,9 +711,9 @@ const ia = pt(
|
|
|
711
711
|
},
|
|
712
712
|
{
|
|
713
713
|
id: "noOfItems",
|
|
714
|
-
accessorFn: (
|
|
714
|
+
accessorFn: (n) => {
|
|
715
715
|
var a;
|
|
716
|
-
return
|
|
716
|
+
return n.items.length + (((a = n.negativeStockItems) == null ? void 0 : a.length) ?? 0);
|
|
717
717
|
},
|
|
718
718
|
header: () => l("inventory.closing.table.noOfItems"),
|
|
719
719
|
enableSorting: !1,
|
|
@@ -724,21 +724,21 @@ const ia = pt(
|
|
|
724
724
|
},
|
|
725
725
|
{
|
|
726
726
|
id: "recentRemark",
|
|
727
|
-
accessorFn: (
|
|
727
|
+
accessorFn: (n) => {
|
|
728
728
|
var a;
|
|
729
|
-
return (
|
|
729
|
+
return (n == null ? void 0 : n.approveRemark) ?? ((a = n == null ? void 0 : n.rejectionHistory) == null ? void 0 : a.computeFirst((D) => D.rejectRemark)) ?? n.remark;
|
|
730
730
|
},
|
|
731
731
|
header: () => "Recent remark"
|
|
732
732
|
},
|
|
733
733
|
{
|
|
734
734
|
id: "status",
|
|
735
|
-
accessorFn: (
|
|
735
|
+
accessorFn: (n) => n.status,
|
|
736
736
|
header: () => l("inventory.closing.table.status"),
|
|
737
737
|
enableSorting: !1,
|
|
738
|
-
cell(
|
|
739
|
-
var
|
|
740
|
-
const a =
|
|
741
|
-
return
|
|
738
|
+
cell(n) {
|
|
739
|
+
var A;
|
|
740
|
+
const a = n.row.original, D = a.status, O = new Date(a.updatedAt), f = (A = a == null ? void 0 : a.rejectionHistory) == null ? void 0 : A.computeFirst((w) => w.rejectedAt), y = f ? new Date(f) : null;
|
|
741
|
+
return D === "DRAFT" && y ? y.getTime() > O.getTime() ? T(
|
|
742
742
|
"div",
|
|
743
743
|
{
|
|
744
744
|
class: "flex"
|
|
@@ -770,17 +770,17 @@ const ia = pt(
|
|
|
770
770
|
T(
|
|
771
771
|
"div",
|
|
772
772
|
{
|
|
773
|
-
class: ["fm-status-badge", Le(
|
|
773
|
+
class: ["fm-status-badge", Le(D)]
|
|
774
774
|
},
|
|
775
|
-
Ue(
|
|
775
|
+
Ue(D)
|
|
776
776
|
)
|
|
777
777
|
);
|
|
778
778
|
}
|
|
779
779
|
},
|
|
780
780
|
{
|
|
781
781
|
id: "action",
|
|
782
|
-
cell(
|
|
783
|
-
const a =
|
|
782
|
+
cell(n) {
|
|
783
|
+
const a = n.row.original, D = [
|
|
784
784
|
st[Re.Details],
|
|
785
785
|
st[Re.Export]
|
|
786
786
|
], O = [
|
|
@@ -802,7 +802,7 @@ const ia = pt(
|
|
|
802
802
|
];
|
|
803
803
|
return Rt(
|
|
804
804
|
[
|
|
805
|
-
...
|
|
805
|
+
...D,
|
|
806
806
|
...a.status === pe.enum.DRAFT ? O : []
|
|
807
807
|
],
|
|
808
808
|
(f) => P(f, a)
|
|
@@ -823,50 +823,50 @@ const ia = pt(
|
|
|
823
823
|
updateDraftRef: k
|
|
824
824
|
};
|
|
825
825
|
}
|
|
826
|
-
),
|
|
826
|
+
), da = { class: "w-full flex flex-col gap-32" }, ma = { class: "flex justify-between" }, fa = { class: "flex" }, pa = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, va = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ya = { class: "flex gap-1" }, ga = { class: "fm-typo-en-body-lg-600" }, ba = { class: "flex flex-col gap-16" }, ha = { class: "flex items-center" }, ka = {
|
|
827
827
|
key: 0,
|
|
828
828
|
class: "flex gap-8"
|
|
829
|
-
},
|
|
829
|
+
}, Aa = {
|
|
830
830
|
key: 0,
|
|
831
831
|
class: "w-full flex flex-col items-center"
|
|
832
|
-
},
|
|
832
|
+
}, xa = { class: "flex items-center gap-8" }, _a = { class: "flex flex-col gap-8" }, Da = { class: "flex gap-8" }, wa = {
|
|
833
833
|
key: 0,
|
|
834
834
|
class: "flex gap-8"
|
|
835
|
-
},
|
|
835
|
+
}, Sa = { class: "overflow-x-auto" }, Ca = {
|
|
836
836
|
key: 1,
|
|
837
837
|
class: "flex-1 xs:w-screen xs:max-w-full"
|
|
838
|
-
},
|
|
838
|
+
}, ja = {
|
|
839
839
|
key: 0,
|
|
840
840
|
class: "flex flex-col items-center gap-8 h-full"
|
|
841
|
-
},
|
|
841
|
+
}, Ba = ["src"], Fa = {
|
|
842
842
|
key: 1,
|
|
843
843
|
class: "px-4 flex flex-col"
|
|
844
|
-
},
|
|
844
|
+
}, Ta = { class: "flex gap-12 content-stretch" }, $a = {
|
|
845
845
|
class: "flex flex-col w-24",
|
|
846
846
|
name: "circles"
|
|
847
|
-
},
|
|
847
|
+
}, Ma = { class: "flex-1 flex flex-col items-center" }, Ra = { class: "flex-1 flex flex-col items-center" }, Ia = {
|
|
848
848
|
class: "py-12 flex flex-col gap-4",
|
|
849
849
|
name: "received-at header"
|
|
850
|
-
},
|
|
850
|
+
}, Pa = { class: "fm-typo-en-body-lg-400" }, Va = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Ua = { class: "flex gap-12 content-stretch" }, La = {
|
|
851
851
|
class: "flex flex-col w-24",
|
|
852
852
|
name: "circles"
|
|
853
|
-
},
|
|
853
|
+
}, Ea = { class: "flex-1 flex flex-col items-center" }, Ha = {
|
|
854
854
|
class: "py-12 flex flex-col gap-4 flex-1",
|
|
855
855
|
name: "delivery details"
|
|
856
|
-
},
|
|
856
|
+
}, za = { class: "flex flex-col gap-8" }, Na = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Oa = { class: "flex flex-col gap-4" }, Ka = { class: "flex gap-8" }, Ya = "N/A", Qa = /* @__PURE__ */ He({
|
|
857
857
|
__name: "ClosingDraftDialog",
|
|
858
858
|
props: {
|
|
859
859
|
show: { type: Boolean },
|
|
860
860
|
draft: {}
|
|
861
861
|
},
|
|
862
862
|
emits: ["submitted", "refresh"],
|
|
863
|
-
setup(
|
|
864
|
-
const e =
|
|
865
|
-
|
|
863
|
+
setup(s, { emit: l }) {
|
|
864
|
+
const e = s, m = vt(), p = Ee(), _ = Kt(e, "show"), v = H(!1), R = H(!1), S = H(!1), k = H(new Array()), $ = H(new Array()), P = H([]), I = We(), n = Ne(), a = Ge(), D = Pt(), O = ze(), f = _t({}), y = V(() => new Set(
|
|
865
|
+
D.skus.filter((c) => {
|
|
866
866
|
var t;
|
|
867
867
|
return f[(t = c.customAttributes) == null ? void 0 : t.tag];
|
|
868
868
|
}).map((c) => c._id)
|
|
869
|
-
)),
|
|
869
|
+
)), A = l, w = H({
|
|
870
870
|
templateItem: !0,
|
|
871
871
|
nonTemplateItem: !0
|
|
872
872
|
}), M = V(() => {
|
|
@@ -883,7 +883,7 @@ const ia = pt(
|
|
|
883
883
|
Ye(te), Dt(
|
|
884
884
|
() => e.show,
|
|
885
885
|
(c) => {
|
|
886
|
-
c && (le.value = xe[0], te(),
|
|
886
|
+
c && (le.value = xe[0], te(), w.value = {
|
|
887
887
|
templateItem: !0,
|
|
888
888
|
nonTemplateItem: !0
|
|
889
889
|
});
|
|
@@ -891,13 +891,13 @@ const ia = pt(
|
|
|
891
891
|
);
|
|
892
892
|
const re = Be(0), B = Be(100);
|
|
893
893
|
async function te() {
|
|
894
|
-
var t, d, i,
|
|
894
|
+
var t, d, i, o;
|
|
895
895
|
if (!O._currentLocation) return;
|
|
896
896
|
v.value = !0;
|
|
897
897
|
const c = ((t = e.draft) == null ? void 0 : t.status) === pe.enum.COMPLETED;
|
|
898
898
|
$.value = [];
|
|
899
899
|
try {
|
|
900
|
-
if (await
|
|
900
|
+
if (await D.init(), c) {
|
|
901
901
|
const E = e.draft.closingAdjustmentId;
|
|
902
902
|
if (!E) {
|
|
903
903
|
a.open({
|
|
@@ -925,15 +925,15 @@ const ia = pt(
|
|
|
925
925
|
} else
|
|
926
926
|
k.value = ((i = e.draft) == null ? void 0 : i.stockSnapshot) ?? [];
|
|
927
927
|
const u = /* @__PURE__ */ new Set();
|
|
928
|
-
if ((
|
|
928
|
+
if ((o = e.draft) != null && o.adjustmentSnapshot)
|
|
929
929
|
for (const E of e.draft.adjustmentSnapshot)
|
|
930
930
|
E.adjustmentsByType && Object.keys(E.adjustmentsByType).forEach((ae) => u.add(ae));
|
|
931
|
-
const g = ["receive", "sales", "wastage"],
|
|
931
|
+
const g = ["receive", "sales", "wastage"], x = [];
|
|
932
932
|
g.forEach((E) => {
|
|
933
|
-
u.has(E) && (
|
|
933
|
+
u.has(E) && (x.push(E), u.delete(E));
|
|
934
934
|
});
|
|
935
935
|
const b = Array.from(u).sort();
|
|
936
|
-
P.value = [...
|
|
936
|
+
P.value = [...x, ...b];
|
|
937
937
|
} catch (u) {
|
|
938
938
|
a.open({
|
|
939
939
|
title: "Something went wrong",
|
|
@@ -959,15 +959,15 @@ const ia = pt(
|
|
|
959
959
|
() => {
|
|
960
960
|
},
|
|
961
961
|
async (i) => {
|
|
962
|
-
var
|
|
962
|
+
var x;
|
|
963
963
|
R.value = !0;
|
|
964
|
-
const
|
|
964
|
+
const o = (x = e.draft) == null ? void 0 : x._rev, u = 30, g = 2e3;
|
|
965
965
|
try {
|
|
966
966
|
await I.recalculation.scheduleCalculateStockSnapshotAtDate(i, e.draft._id);
|
|
967
967
|
let b = null;
|
|
968
|
-
for (let E = 0; E < u && (b = await
|
|
968
|
+
for (let E = 0; E < u && (b = await n.getDraft(e.draft._id).delayed(g), b._rev === o); E++)
|
|
969
969
|
;
|
|
970
|
-
if (!b || b._rev ===
|
|
970
|
+
if (!b || b._rev === o) {
|
|
971
971
|
a.open({
|
|
972
972
|
title: "Refresh failed",
|
|
973
973
|
message: "Failed to refresh stock balance. Please try again.",
|
|
@@ -975,11 +975,11 @@ const ia = pt(
|
|
|
975
975
|
}), console.error("error refreshing stock balances: there is no change in _rev");
|
|
976
976
|
return;
|
|
977
977
|
}
|
|
978
|
-
|
|
978
|
+
A("refresh", b), k.value = b.stockSnapshot ?? [], a.open({
|
|
979
979
|
title: "Balance refreshed",
|
|
980
980
|
message: "Stock balance has been recalculated.",
|
|
981
981
|
type: "success"
|
|
982
|
-
});
|
|
982
|
+
}), _.value = !1;
|
|
983
983
|
} catch (b) {
|
|
984
984
|
a.open({
|
|
985
985
|
title: "Refresh failed",
|
|
@@ -992,7 +992,7 @@ const ia = pt(
|
|
|
992
992
|
}
|
|
993
993
|
);
|
|
994
994
|
}
|
|
995
|
-
const
|
|
995
|
+
const he = V(
|
|
996
996
|
() => k.value.groupBy(
|
|
997
997
|
(c) => c.id,
|
|
998
998
|
(c) => c.balance
|
|
@@ -1004,7 +1004,7 @@ const ia = pt(
|
|
|
1004
1004
|
var c;
|
|
1005
1005
|
return (c = e.draft) != null && c.opening ? new Map(e.draft.opening.map((t) => [t.skuId, t.balance])) : /* @__PURE__ */ new Map();
|
|
1006
1006
|
});
|
|
1007
|
-
function
|
|
1007
|
+
function Q(c, t) {
|
|
1008
1008
|
return T(
|
|
1009
1009
|
Ve.FmTooltip,
|
|
1010
1010
|
{ zIndex: 51, placement: "left", class: "w-full flex justify-end" },
|
|
@@ -1020,8 +1020,8 @@ const ia = pt(
|
|
|
1020
1020
|
}
|
|
1021
1021
|
const we = V(() => {
|
|
1022
1022
|
const c = Z.value.reduce((d, i) => {
|
|
1023
|
-
var
|
|
1024
|
-
return Math.max(d, ((u = (
|
|
1023
|
+
var o, u;
|
|
1024
|
+
return Math.max(d, ((u = (o = W.value) == null ? void 0 : o.get(i._id)) == null ? void 0 : u[0].length) ?? 0);
|
|
1025
1025
|
}, 0);
|
|
1026
1026
|
return [
|
|
1027
1027
|
{
|
|
@@ -1030,7 +1030,7 @@ const ia = pt(
|
|
|
1030
1030
|
header: () => "Name",
|
|
1031
1031
|
size: 350,
|
|
1032
1032
|
cell(d) {
|
|
1033
|
-
const i = d.row.original,
|
|
1033
|
+
const i = d.row.original, o = i.adjustedDiffPercentage, u = typeof o == "number" && Math.abs(o) > 10, g = T("div", { class: "flex flex-col gap-4" }, [
|
|
1034
1034
|
T(
|
|
1035
1035
|
"div",
|
|
1036
1036
|
{
|
|
@@ -1073,7 +1073,7 @@ const ia = pt(
|
|
|
1073
1073
|
{
|
|
1074
1074
|
id: "costPerUnit",
|
|
1075
1075
|
accessorKey: "costPerUnit",
|
|
1076
|
-
header: () =>
|
|
1076
|
+
header: () => Q("Cost per unit"),
|
|
1077
1077
|
size: 160,
|
|
1078
1078
|
cell(d) {
|
|
1079
1079
|
const i = d.row.original.costPerUnit;
|
|
@@ -1088,14 +1088,14 @@ const ia = pt(
|
|
|
1088
1088
|
header: () => "UOM",
|
|
1089
1089
|
size: 80,
|
|
1090
1090
|
cell(d) {
|
|
1091
|
-
const i = d.row.original.costUnit,
|
|
1092
|
-
return i ??
|
|
1091
|
+
const i = d.row.original.costUnit, o = d.row.original.baseUnit;
|
|
1092
|
+
return i ?? o;
|
|
1093
1093
|
}
|
|
1094
1094
|
},
|
|
1095
1095
|
{
|
|
1096
1096
|
id: "opening",
|
|
1097
1097
|
accessorKey: "opening",
|
|
1098
|
-
header: () =>
|
|
1098
|
+
header: () => Q("Opening (B/F)", "The opening balance brought forward from previous period."),
|
|
1099
1099
|
size: 150,
|
|
1100
1100
|
cell(d) {
|
|
1101
1101
|
const i = d.row.original.opening;
|
|
@@ -1110,11 +1110,11 @@ const ia = pt(
|
|
|
1110
1110
|
(d) => ({
|
|
1111
1111
|
id: `adjustment_${d}`,
|
|
1112
1112
|
accessorFn: (i) => i.adjustmentAmounts[d] ?? { amount: 0, precision: 0 },
|
|
1113
|
-
header: () =>
|
|
1113
|
+
header: () => Q(Ue(d)),
|
|
1114
1114
|
size: 150,
|
|
1115
1115
|
cell(i) {
|
|
1116
|
-
const
|
|
1117
|
-
return T("div", { class: "text-right" }, N(
|
|
1116
|
+
const o = i.row.original.adjustmentAmounts[d] ?? { amount: 0, precision: 0 };
|
|
1117
|
+
return T("div", { class: "text-right" }, N(o));
|
|
1118
1118
|
},
|
|
1119
1119
|
meta: {
|
|
1120
1120
|
textAlign: "right"
|
|
@@ -1124,7 +1124,7 @@ const ia = pt(
|
|
|
1124
1124
|
{
|
|
1125
1125
|
id: "systemBalance",
|
|
1126
1126
|
accessorKey: "systemBalance",
|
|
1127
|
-
header: () =>
|
|
1127
|
+
header: () => Q("System Balance", "The system calculated balance before stock take."),
|
|
1128
1128
|
size: 200,
|
|
1129
1129
|
meta: {
|
|
1130
1130
|
textAlign: "right"
|
|
@@ -1133,20 +1133,20 @@ const ia = pt(
|
|
|
1133
1133
|
{
|
|
1134
1134
|
id: "physicalBalance",
|
|
1135
1135
|
accessorFn: (d) => {
|
|
1136
|
-
var
|
|
1137
|
-
const i = (
|
|
1136
|
+
var o;
|
|
1137
|
+
const i = (o = $.value.find((u) => u.id === d.id)) == null ? void 0 : o.balance;
|
|
1138
1138
|
return i ? Ie.toFormatString({ value: i }) : d.physicalBalance;
|
|
1139
1139
|
},
|
|
1140
|
-
header: () =>
|
|
1140
|
+
header: () => Q("Stock Take balance", "The physical balance recorded during stock take."),
|
|
1141
1141
|
cell(d) {
|
|
1142
1142
|
var b;
|
|
1143
|
-
const i = d.row.original,
|
|
1143
|
+
const i = d.row.original, o = Ie.fromNumber(i.physicalBalance);
|
|
1144
1144
|
let u = !0, g = i.physicalBalance;
|
|
1145
|
-
const
|
|
1146
|
-
return
|
|
1147
|
-
a:
|
|
1148
|
-
b:
|
|
1149
|
-
}) || (u = !1, g = Number(Ie.toFormatString({ value:
|
|
1145
|
+
const x = (b = $.value.find((E) => E.id === i.id)) == null ? void 0 : b.balance;
|
|
1146
|
+
return x && (Ie.equals({
|
|
1147
|
+
a: o,
|
|
1148
|
+
b: x
|
|
1149
|
+
}) || (u = !1, g = Number(Ie.toFormatString({ value: x })))), T("div", { class: "flex flex-col" }, [
|
|
1150
1150
|
T(
|
|
1151
1151
|
"span",
|
|
1152
1152
|
{ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
|
|
@@ -1167,7 +1167,7 @@ const ia = pt(
|
|
|
1167
1167
|
{
|
|
1168
1168
|
id: "adjustedAmount",
|
|
1169
1169
|
accessorKey: "adjustedAmount",
|
|
1170
|
-
header: () =>
|
|
1170
|
+
header: () => Q("Variance", "The difference between Stock Take balance and System Balance."),
|
|
1171
1171
|
size: 200,
|
|
1172
1172
|
meta: {
|
|
1173
1173
|
textAlign: "right"
|
|
@@ -1176,7 +1176,7 @@ const ia = pt(
|
|
|
1176
1176
|
{
|
|
1177
1177
|
id: "varianceRM",
|
|
1178
1178
|
accessorKey: "varianceRM",
|
|
1179
|
-
header: () =>
|
|
1179
|
+
header: () => Q("Variance (RM)"),
|
|
1180
1180
|
size: 150,
|
|
1181
1181
|
cell(d) {
|
|
1182
1182
|
const i = d.row.original.varianceRM;
|
|
@@ -1189,16 +1189,16 @@ const ia = pt(
|
|
|
1189
1189
|
{
|
|
1190
1190
|
id: "adjustedDiffPercentage",
|
|
1191
1191
|
accessorKey: "adjustedDiffPercentage",
|
|
1192
|
-
header: () =>
|
|
1192
|
+
header: () => Q(
|
|
1193
1193
|
"Variance (%)",
|
|
1194
1194
|
"Difference between Stock Take balance and System Balance in percentage."
|
|
1195
1195
|
),
|
|
1196
1196
|
size: 200,
|
|
1197
1197
|
cell(d) {
|
|
1198
1198
|
const i = d.row.original.adjustedDiffPercentage;
|
|
1199
|
-
if (!i) return
|
|
1200
|
-
const
|
|
1201
|
-
if (
|
|
1199
|
+
if (!i) return Ya;
|
|
1200
|
+
const o = i.toFixed(2);
|
|
1201
|
+
if (o === "0.00")
|
|
1202
1202
|
return T("div", { class: "flex items-center gap-4 justify-end" }, ["0.00"]);
|
|
1203
1203
|
const u = i > 0;
|
|
1204
1204
|
return T("div", { class: "flex items-center gap-4 justify-end" }, [
|
|
@@ -1207,7 +1207,7 @@ const ia = pt(
|
|
|
1207
1207
|
color: u ? "system-success-300" : "system-error-300",
|
|
1208
1208
|
size: "md"
|
|
1209
1209
|
}),
|
|
1210
|
-
|
|
1210
|
+
o
|
|
1211
1211
|
]);
|
|
1212
1212
|
},
|
|
1213
1213
|
meta: {
|
|
@@ -1217,7 +1217,7 @@ const ia = pt(
|
|
|
1217
1217
|
{
|
|
1218
1218
|
id: "stockTakeValue",
|
|
1219
1219
|
accessorKey: "stockTakeValue",
|
|
1220
|
-
header: () =>
|
|
1220
|
+
header: () => Q("Stock take value (RM)"),
|
|
1221
1221
|
size: 180,
|
|
1222
1222
|
cell(d) {
|
|
1223
1223
|
const i = d.row.original.stockTakeValue;
|
|
@@ -1230,7 +1230,7 @@ const ia = pt(
|
|
|
1230
1230
|
{
|
|
1231
1231
|
id: "systemValue",
|
|
1232
1232
|
accessorKey: "systemValue",
|
|
1233
|
-
header: () =>
|
|
1233
|
+
header: () => Q("System value (RM)"),
|
|
1234
1234
|
size: 180,
|
|
1235
1235
|
cell(d) {
|
|
1236
1236
|
const i = d.row.original.systemValue;
|
|
@@ -1245,7 +1245,7 @@ const ia = pt(
|
|
|
1245
1245
|
header: () => "Amounts",
|
|
1246
1246
|
enableSorting: !1,
|
|
1247
1247
|
cell(d) {
|
|
1248
|
-
const i = d.row.original,
|
|
1248
|
+
const i = d.row.original, o = (g, x) => T(
|
|
1249
1249
|
Ve.FmTooltip,
|
|
1250
1250
|
{ zIndex: 50 },
|
|
1251
1251
|
{
|
|
@@ -1263,23 +1263,23 @@ const ia = pt(
|
|
|
1263
1263
|
class: "text-fm-color-typo-secondary",
|
|
1264
1264
|
style: { maxWidth: "80px" }
|
|
1265
1265
|
},
|
|
1266
|
-
|
|
1266
|
+
x
|
|
1267
1267
|
)
|
|
1268
1268
|
]
|
|
1269
1269
|
);
|
|
1270
1270
|
},
|
|
1271
1271
|
content() {
|
|
1272
|
-
return `${g} ${
|
|
1272
|
+
return `${g} ${x}`;
|
|
1273
1273
|
}
|
|
1274
1274
|
}
|
|
1275
1275
|
);
|
|
1276
|
-
let u = Array.from({ length: c }).map((g,
|
|
1277
|
-
if (!i[`measurementAmount${
|
|
1276
|
+
let u = Array.from({ length: c }).map((g, x) => {
|
|
1277
|
+
if (!i[`measurementAmount${x}`])
|
|
1278
1278
|
return null;
|
|
1279
|
-
const b = i[`measurementAmount${
|
|
1280
|
-
return
|
|
1279
|
+
const b = i[`measurementAmount${x}`], E = i[`measurementAbbrev${x}`];
|
|
1280
|
+
return o(b, E);
|
|
1281
1281
|
}).filter((g) => g);
|
|
1282
|
-
return (i.baseUnitAmount || !u.length) && (u = [
|
|
1282
|
+
return (i.baseUnitAmount || !u.length) && (u = [o(i.baseUnitAmount, i.baseUnit), ...u]), T(
|
|
1283
1283
|
"div",
|
|
1284
1284
|
{
|
|
1285
1285
|
class: "flex gap-8 flex-nowrap",
|
|
@@ -1292,33 +1292,33 @@ const ia = pt(
|
|
|
1292
1292
|
}
|
|
1293
1293
|
}
|
|
1294
1294
|
];
|
|
1295
|
-
}),
|
|
1295
|
+
}), ke = V(() => we.value.map((c) => c.size ?? 0).reduce((c, t) => c + t)), Ae = H(""), Se = V(() => {
|
|
1296
1296
|
var d, i;
|
|
1297
1297
|
const c = ((i = (d = e.draft) == null ? void 0 : d.negativeStockItems) == null ? void 0 : i.reduce(
|
|
1298
|
-
(
|
|
1298
|
+
(o, u) => (o[u.sku._id] = u, o),
|
|
1299
1299
|
{}
|
|
1300
1300
|
)) ?? {};
|
|
1301
|
-
return Z.value.map((
|
|
1301
|
+
return Z.value.map((o) => {
|
|
1302
1302
|
var qe, Ze, Je, Xe, et, tt, at, nt, ot;
|
|
1303
|
-
const u = (qe = fe.value.get(
|
|
1304
|
-
if (P.value.forEach((
|
|
1305
|
-
const oe = ce[
|
|
1306
|
-
ue && (ce[
|
|
1303
|
+
const u = (qe = fe.value.get(o._id)) == null ? void 0 : qe[0], g = ((Ze = he.value.get(o._id)) == null ? void 0 : Ze[0]) ?? re, x = (Je = o.defaultCost) != null && Je.costPerUnit ? o.defaultCost.costPerUnit.amount / Math.pow(10, o.defaultCost.costPerUnit.precision) : 0, b = ge.value.get(o._id), E = b ? +N(b) : 0, ae = ye.value.get(o._id), ce = {};
|
|
1304
|
+
if (P.value.forEach((G) => {
|
|
1305
|
+
const oe = ce[G] ?? { amount: 0, precision: 0 }, ue = ae == null ? void 0 : ae[G];
|
|
1306
|
+
ue && (ce[G] = Vt(oe, ue));
|
|
1307
1307
|
}), !u) {
|
|
1308
|
-
const
|
|
1308
|
+
const G = +N(g), oe = G - 0, ue = oe * x, Me = 0, xt = G * x;
|
|
1309
1309
|
return {
|
|
1310
|
-
id:
|
|
1311
|
-
code:
|
|
1312
|
-
name:
|
|
1313
|
-
costUnit: ((et = (Xe =
|
|
1314
|
-
baseUnit:
|
|
1310
|
+
id: o._id,
|
|
1311
|
+
code: o.code,
|
|
1312
|
+
name: o.name,
|
|
1313
|
+
costUnit: ((et = (Xe = o.defaultCost) == null ? void 0 : Xe.measurement) == null ? void 0 : et.abbrev) ?? null,
|
|
1314
|
+
baseUnit: o.unit.abbrev,
|
|
1315
1315
|
baseUnitAmount: 0,
|
|
1316
|
-
systemBalance:
|
|
1316
|
+
systemBalance: G,
|
|
1317
1317
|
physicalBalance: 0,
|
|
1318
|
-
adjustedAmount: -
|
|
1318
|
+
adjustedAmount: -G,
|
|
1319
1319
|
adjustedDiffPercentage: -100,
|
|
1320
|
-
isTemplateItem: !c[
|
|
1321
|
-
costPerUnit:
|
|
1320
|
+
isTemplateItem: !c[o._id],
|
|
1321
|
+
costPerUnit: x,
|
|
1322
1322
|
opening: E,
|
|
1323
1323
|
varianceQty: oe,
|
|
1324
1324
|
varianceRM: ue,
|
|
@@ -1328,41 +1328,41 @@ const ia = pt(
|
|
|
1328
1328
|
};
|
|
1329
1329
|
}
|
|
1330
1330
|
const ne = yt(u), Ce = (at = (tt = $.value) == null ? void 0 : tt.find(
|
|
1331
|
-
(
|
|
1331
|
+
(G) => G.id === o._id
|
|
1332
1332
|
)) == null ? void 0 : at.balance, C = ut(
|
|
1333
1333
|
Ce ?? ne,
|
|
1334
1334
|
g
|
|
1335
1335
|
), K = g.amount === 0 ? null : dt(C, {
|
|
1336
1336
|
...g,
|
|
1337
1337
|
amount: Math.abs(g.amount)
|
|
1338
|
-
}), q = K ? Qe(K, B) : null, ie = +N(g), _e = +N(ne), $e = ie - _e,
|
|
1338
|
+
}), q = K ? Qe(K, B) : null, ie = +N(g), _e = +N(ne), $e = ie - _e, ht = $e * x, kt = _e * x, At = ie * x;
|
|
1339
1339
|
return {
|
|
1340
|
-
id:
|
|
1341
|
-
code:
|
|
1342
|
-
name:
|
|
1343
|
-
costUnit: ((ot = (nt =
|
|
1344
|
-
baseUnit:
|
|
1340
|
+
id: o._id,
|
|
1341
|
+
code: o.code,
|
|
1342
|
+
name: o.name,
|
|
1343
|
+
costUnit: ((ot = (nt = o.defaultCost) == null ? void 0 : nt.measurement) == null ? void 0 : ot.abbrev) ?? null,
|
|
1344
|
+
baseUnit: o.unit.abbrev,
|
|
1345
1345
|
baseUnitAmount: +N(u.baseAmount),
|
|
1346
|
-
...u.measurementsAmounts.filter((
|
|
1346
|
+
...u.measurementsAmounts.filter((G) => {
|
|
1347
1347
|
var oe, ue, Me;
|
|
1348
|
-
return (Me = (ue = (oe = W.value) == null ? void 0 : oe.get(
|
|
1349
|
-
}).reduce((
|
|
1348
|
+
return (Me = (ue = (oe = W.value) == null ? void 0 : oe.get(o._id)) == null ? void 0 : ue[0]) == null ? void 0 : Me.includes(G.measurement.id);
|
|
1349
|
+
}).reduce((G, oe, ue) => (G[`measurementAbbrev${ue}`] = `(${oe.measurement.abbrev}) × ${N(oe.measurement.conversion)}`, G[`measurementAmount${ue}`] = +N(oe.amount), G), {}),
|
|
1350
1350
|
systemBalance: ie,
|
|
1351
1351
|
physicalBalance: _e,
|
|
1352
1352
|
adjustedAmount: +N(C),
|
|
1353
1353
|
adjustedDiffPercentage: q ? +N(mt(q, 2)) : null,
|
|
1354
|
-
isTemplateItem: !c[
|
|
1355
|
-
costPerUnit:
|
|
1354
|
+
isTemplateItem: !c[o._id],
|
|
1355
|
+
costPerUnit: x,
|
|
1356
1356
|
opening: E,
|
|
1357
1357
|
varianceQty: $e,
|
|
1358
|
-
varianceRM:
|
|
1359
|
-
stockTakeValue:
|
|
1358
|
+
varianceRM: ht,
|
|
1359
|
+
stockTakeValue: kt,
|
|
1360
1360
|
systemValue: At,
|
|
1361
1361
|
adjustmentAmounts: ce
|
|
1362
1362
|
};
|
|
1363
|
-
}).filter((
|
|
1363
|
+
}).filter((o) => !!(o.isTemplateItem && w.value.templateItem || !o.isTemplateItem && w.value.nonTemplateItem));
|
|
1364
1364
|
}), Fe = V(() => {
|
|
1365
|
-
var t, d, i,
|
|
1365
|
+
var t, d, i, o;
|
|
1366
1366
|
if (!e.draft) return [];
|
|
1367
1367
|
const c = e.draft.approvedAt ? {
|
|
1368
1368
|
action: `Approve at ${ve(e.draft.approvedAt)}`,
|
|
@@ -1410,7 +1410,7 @@ const ia = pt(
|
|
|
1410
1410
|
} : null,
|
|
1411
1411
|
c && c.actionBy ? {
|
|
1412
1412
|
label: "Last action by",
|
|
1413
|
-
value: (
|
|
1413
|
+
value: (o = c.actionBy) == null ? void 0 : o.name
|
|
1414
1414
|
} : null,
|
|
1415
1415
|
c && c.remark ? {
|
|
1416
1416
|
label: "Action remark",
|
|
@@ -1427,8 +1427,8 @@ const ia = pt(
|
|
|
1427
1427
|
value: "history"
|
|
1428
1428
|
}
|
|
1429
1429
|
], le = H(xe[0]), me = V(() => {
|
|
1430
|
-
var i,
|
|
1431
|
-
const c = ((i = e.draft) == null ? void 0 : i.activityLogs) ?? [], t = ((
|
|
1430
|
+
var i, o, u;
|
|
1431
|
+
const c = ((i = e.draft) == null ? void 0 : i.activityLogs) ?? [], t = ((o = e.draft) == null ? void 0 : o.rejectionHistory) ?? [];
|
|
1432
1432
|
for (const g of t)
|
|
1433
1433
|
c.find(
|
|
1434
1434
|
(b) => `${b.action}_${b.performedAt}` == `${z.enum.rejectDraft}_${g.rejectedAt}`
|
|
@@ -1439,16 +1439,16 @@ const ia = pt(
|
|
|
1439
1439
|
remark: g.rejectRemark
|
|
1440
1440
|
});
|
|
1441
1441
|
return (u = e.draft) != null && u.approvedAt && (c.find(
|
|
1442
|
-
(
|
|
1442
|
+
(x) => {
|
|
1443
1443
|
var b;
|
|
1444
|
-
return `${
|
|
1444
|
+
return `${x.action}_${x.performedAt}` == `${z.enum.approveDraft}_${(b = e.draft) == null ? void 0 : b.approvedAt}`;
|
|
1445
1445
|
}
|
|
1446
1446
|
) || c.push({
|
|
1447
1447
|
action: z.enum.approveDraft,
|
|
1448
1448
|
performedAt: e.draft.approvedAt,
|
|
1449
1449
|
performedBy: e.draft.approvedBy ?? { name: "Unknown", id: "unknown" },
|
|
1450
1450
|
remark: e.draft.approveRemark
|
|
1451
|
-
})), c.sort((g,
|
|
1451
|
+
})), c.sort((g, x) => new Date(x.performedAt).getTime() - new Date(g.performedAt).getTime()).map(
|
|
1452
1452
|
(g) => ({
|
|
1453
1453
|
header: Ue(g.action),
|
|
1454
1454
|
date: ve(g.performedAt),
|
|
@@ -1465,118 +1465,123 @@ const ia = pt(
|
|
|
1465
1465
|
})
|
|
1466
1466
|
);
|
|
1467
1467
|
}), Te = V(() => {
|
|
1468
|
-
var
|
|
1469
|
-
if ((
|
|
1468
|
+
var o, u, g, x;
|
|
1469
|
+
if (!((o = e.draft) != null && o.stockSnapshot)) return "Stock snapshot is not available.";
|
|
1470
1470
|
if (((u = e.draft) == null ? void 0 : u.status) !== pe.enum.DRAFT) return "Status is not draft.";
|
|
1471
|
-
const c = Se.value.some((b) => b.physicalBalance < 0), t = ((
|
|
1471
|
+
const c = Se.value.some((b) => b.physicalBalance < 0), t = ((x = (g = m.stockBalance.skus) == null ? void 0 : g.filter((b) => b.balance.amount < 0)) == null ? void 0 : x.map((b) => b.id)) ?? [], d = new Set(Z.value.map((b) => b._id)), i = t.filter((b) => !d.has(b)).length;
|
|
1472
1472
|
return [
|
|
1473
1473
|
c ? "Negative total exist." : null,
|
|
1474
|
-
i ? "Negative stock is not included in this draft.
|
|
1474
|
+
i ? "Negative stock is not included in this draft. Please commit the draft to include these stocks." : null
|
|
1475
1475
|
].filter((b) => b).join(" ");
|
|
1476
1476
|
});
|
|
1477
1477
|
return (c, t) => {
|
|
1478
|
-
const d = U("FmButtonGroup"), i = U("FmMenuDivider"),
|
|
1478
|
+
const d = U("FmButtonGroup"), i = U("FmMenuDivider"), o = U("FmCard"), u = U("FmButton"), g = U("FmCircularProgress"), x = U("FmChip"), b = U("FmTextField"), E = U("FmIcon"), ae = U("FmTable"), ce = U("FmSpacer"), ne = U("FmTooltip"), Ce = U("FmSideSheet");
|
|
1479
1479
|
return j(), se(Ce, {
|
|
1480
1480
|
"dismiss-away": "",
|
|
1481
1481
|
"max-width": 9999,
|
|
1482
|
-
"model-value": F(
|
|
1483
|
-
"onUpdate:modelValue": t[10] || (t[10] = (C) => rt(
|
|
1482
|
+
"model-value": F(_),
|
|
1483
|
+
"onUpdate:modelValue": t[10] || (t[10] = (C) => rt(_) ? _.value = C : null),
|
|
1484
1484
|
header: "Closing details"
|
|
1485
1485
|
}, {
|
|
1486
|
-
"side-sheet-footer":
|
|
1486
|
+
"side-sheet-footer": Y(() => {
|
|
1487
1487
|
var C, K, q, ie;
|
|
1488
1488
|
return [
|
|
1489
|
-
r("div",
|
|
1489
|
+
r("div", Ka, [
|
|
1490
1490
|
((C = e.draft) == null ? void 0 : C.status) === F(pe).enum.DRAFT ? (j(), L(ee, { key: 0 }, [
|
|
1491
1491
|
Te.value ? (j(), se(ne, {
|
|
1492
1492
|
key: 0,
|
|
1493
|
-
"z-index": 51
|
|
1493
|
+
"z-index": 51,
|
|
1494
|
+
placement: "right"
|
|
1494
1495
|
}, {
|
|
1495
|
-
content:
|
|
1496
|
+
content: Y(() => [
|
|
1496
1497
|
X(J(Te.value), 1)
|
|
1497
1498
|
]),
|
|
1498
|
-
default:
|
|
1499
|
-
|
|
1499
|
+
default: Y(() => [
|
|
1500
|
+
h(u, {
|
|
1500
1501
|
disabled: "",
|
|
1501
1502
|
key: "approve key",
|
|
1502
1503
|
label: "Approve",
|
|
1503
|
-
onClick: t[5] || (t[5] = () => e.draft && F(p).approveDraft(e.draft, () =>
|
|
1504
|
+
onClick: t[5] || (t[5] = () => e.draft && F(p).approveDraft(e.draft, () => A("submitted")))
|
|
1504
1505
|
})
|
|
1505
1506
|
]),
|
|
1506
1507
|
_: 1
|
|
1507
1508
|
})) : (j(), se(u, {
|
|
1508
1509
|
key: "approve key",
|
|
1509
1510
|
label: "Approve",
|
|
1510
|
-
onClick: t[6] || (t[6] = () => e.draft && F(p).approveDraft(e.draft, () =>
|
|
1511
|
+
onClick: t[6] || (t[6] = () => e.draft && F(p).approveDraft(e.draft, () => A("submitted")))
|
|
1511
1512
|
}))
|
|
1512
1513
|
], 64)) : de("", !0),
|
|
1513
1514
|
((K = e.draft) == null ? void 0 : K.status) === F(pe).enum.DRAFT ? (j(), se(u, {
|
|
1514
1515
|
key: 1,
|
|
1515
1516
|
label: "Reject",
|
|
1516
1517
|
variant: "destructive",
|
|
1517
|
-
onClick: t[7] || (t[7] = () => e.draft && F(p).rejectDraft(e.draft, () =>
|
|
1518
|
+
onClick: t[7] || (t[7] = () => e.draft && F(p).rejectDraft(e.draft, () => A("submitted")))
|
|
1519
|
+
})) : de("", !0),
|
|
1520
|
+
(q = e.draft) != null && q.approvedAt && ((ie = e.draft) == null ? void 0 : ie.status) !== F(pe).enum.COMPLETED ? (j(), se(Ut, { key: 2 }, {
|
|
1521
|
+
default: Y(() => [
|
|
1522
|
+
h(u, {
|
|
1523
|
+
label: "Sync",
|
|
1524
|
+
loading: S.value,
|
|
1525
|
+
onClick: t[8] || (t[8] = () => {
|
|
1526
|
+
e.draft && (S.value = !0, F(p).syncDraft(e.draft, () => {
|
|
1527
|
+
S.value = !1, A("submitted");
|
|
1528
|
+
}));
|
|
1529
|
+
})
|
|
1530
|
+
}, null, 8, ["loading"])
|
|
1531
|
+
]),
|
|
1532
|
+
_: 1
|
|
1518
1533
|
})) : de("", !0),
|
|
1519
|
-
(
|
|
1520
|
-
key: 2,
|
|
1521
|
-
label: "Sync",
|
|
1522
|
-
loading: S.value,
|
|
1523
|
-
onClick: t[8] || (t[8] = () => {
|
|
1524
|
-
e.draft && (S.value = !0, F(p).syncDraft(e.draft, () => {
|
|
1525
|
-
S.value = !1, h("submitted");
|
|
1526
|
-
}));
|
|
1527
|
-
})
|
|
1528
|
-
}, null, 8, ["loading"])) : de("", !0),
|
|
1529
|
-
x(u, {
|
|
1534
|
+
h(u, {
|
|
1530
1535
|
label: "Close",
|
|
1531
1536
|
variant: "tertiary",
|
|
1532
|
-
onClick: t[9] || (t[9] = (_e) =>
|
|
1537
|
+
onClick: t[9] || (t[9] = (_e) => _.value = !1)
|
|
1533
1538
|
})
|
|
1534
1539
|
])
|
|
1535
1540
|
];
|
|
1536
1541
|
}),
|
|
1537
|
-
default:
|
|
1538
|
-
r("div",
|
|
1542
|
+
default: Y(() => [
|
|
1543
|
+
r("div", da, [
|
|
1539
1544
|
r("div", null, [
|
|
1540
|
-
|
|
1545
|
+
h(d, {
|
|
1541
1546
|
items: xe,
|
|
1542
1547
|
modelValue: le.value,
|
|
1543
1548
|
"onUpdate:modelValue": t[0] || (t[0] = (C) => le.value = C)
|
|
1544
1549
|
}, null, 8, ["modelValue"])
|
|
1545
1550
|
]),
|
|
1546
1551
|
le.value.value === "overview" ? (j(), L(ee, { key: 0 }, [
|
|
1547
|
-
|
|
1552
|
+
h(o, {
|
|
1548
1553
|
variant: "outlined",
|
|
1549
1554
|
class: "flex flex-col gap-8 px-12 py-16"
|
|
1550
1555
|
}, {
|
|
1551
|
-
default:
|
|
1556
|
+
default: Y(() => {
|
|
1552
1557
|
var C, K;
|
|
1553
1558
|
return [
|
|
1554
|
-
r("div",
|
|
1559
|
+
r("div", ma, [
|
|
1555
1560
|
t[11] || (t[11] = r("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
|
|
1556
|
-
r("div",
|
|
1561
|
+
r("div", fa, [
|
|
1557
1562
|
r("div", {
|
|
1558
1563
|
class: De(["fm-status-badge", F(Le)(((C = c.draft) == null ? void 0 : C.status) ?? "DRAFT")])
|
|
1559
1564
|
}, J(F(Ue)(((K = c.draft) == null ? void 0 : K.status) ?? "")), 3)
|
|
1560
1565
|
])
|
|
1561
1566
|
]),
|
|
1562
|
-
|
|
1563
|
-
r("div",
|
|
1567
|
+
h(i),
|
|
1568
|
+
r("div", pa, [
|
|
1564
1569
|
(j(!0), L(ee, null, je(Fe.value, (q, ie) => (j(), L("div", {
|
|
1565
1570
|
class: "flex flex-col gap-4",
|
|
1566
1571
|
key: ie
|
|
1567
1572
|
}, [
|
|
1568
|
-
r("div",
|
|
1569
|
-
r("div",
|
|
1573
|
+
r("div", va, [
|
|
1574
|
+
r("div", ya, J(q.label), 1)
|
|
1570
1575
|
]),
|
|
1571
|
-
r("div",
|
|
1576
|
+
r("div", ga, J(q.value), 1)
|
|
1572
1577
|
]))), 128))
|
|
1573
1578
|
])
|
|
1574
1579
|
];
|
|
1575
1580
|
}),
|
|
1576
1581
|
_: 1
|
|
1577
1582
|
}),
|
|
1578
|
-
r("div",
|
|
1579
|
-
r("div",
|
|
1583
|
+
r("div", ba, [
|
|
1584
|
+
r("div", ha, [
|
|
1580
1585
|
t[12] || (t[12] = r("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
|
|
1581
1586
|
v.value ? de("", !0) : (j(), L("div", ka, [
|
|
1582
1587
|
c.draft && c.draft.status !== F(pe).enum.COMPLETED ? (j(), se(u, {
|
|
@@ -1590,7 +1595,7 @@ const ia = pt(
|
|
|
1590
1595
|
loading: R.value,
|
|
1591
1596
|
onClick: be
|
|
1592
1597
|
}, null, 8, ["loading"])) : de("", !0),
|
|
1593
|
-
|
|
1598
|
+
h(u, {
|
|
1594
1599
|
label: "Export data",
|
|
1595
1600
|
"prepend-icon": "download",
|
|
1596
1601
|
variant: "secondary",
|
|
@@ -1605,44 +1610,44 @@ const ia = pt(
|
|
|
1605
1610
|
})
|
|
1606
1611
|
]))
|
|
1607
1612
|
]),
|
|
1608
|
-
v.value ? (j(), L("div",
|
|
1613
|
+
v.value ? (j(), L("div", Aa, [
|
|
1609
1614
|
t[14] || (t[14] = r("div", { class: "h-80" }, null, -1)),
|
|
1610
|
-
r("div",
|
|
1615
|
+
r("div", xa, [
|
|
1611
1616
|
r("div", null, [
|
|
1612
|
-
|
|
1617
|
+
h(g, { size: "md" })
|
|
1613
1618
|
]),
|
|
1614
1619
|
t[13] || (t[13] = r("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
|
|
1615
1620
|
]),
|
|
1616
1621
|
t[15] || (t[15] = r("div", { class: "h-80" }, null, -1))
|
|
1617
1622
|
])) : (j(), L(ee, { key: 1 }, [
|
|
1618
|
-
r("div",
|
|
1619
|
-
r("div",
|
|
1620
|
-
x
|
|
1623
|
+
r("div", _a, [
|
|
1624
|
+
r("div", Da, [
|
|
1625
|
+
h(x, {
|
|
1621
1626
|
label: "Template Item(s)",
|
|
1622
|
-
selected:
|
|
1623
|
-
onClick: t[2] || (t[2] = (C) =>
|
|
1627
|
+
selected: w.value.templateItem,
|
|
1628
|
+
onClick: t[2] || (t[2] = (C) => w.value.templateItem = !w.value.templateItem)
|
|
1624
1629
|
}, null, 8, ["selected"]),
|
|
1625
|
-
x
|
|
1630
|
+
h(x, {
|
|
1626
1631
|
label: "Non-template Item(s)",
|
|
1627
|
-
selected:
|
|
1628
|
-
onClick: t[3] || (t[3] = (C) =>
|
|
1632
|
+
selected: w.value.nonTemplateItem,
|
|
1633
|
+
onClick: t[3] || (t[3] = (C) => w.value.nonTemplateItem = !w.value.nonTemplateItem)
|
|
1629
1634
|
}, null, 8, ["selected"])
|
|
1630
1635
|
]),
|
|
1631
|
-
|
|
1636
|
+
h(b, {
|
|
1632
1637
|
modelValue: Ae.value,
|
|
1633
1638
|
"onUpdate:modelValue": t[4] || (t[4] = (C) => Ae.value = C),
|
|
1634
1639
|
placeholder: "Filter items"
|
|
1635
1640
|
}, null, 8, ["modelValue"])
|
|
1636
1641
|
]),
|
|
1637
|
-
F(
|
|
1638
|
-
(j(!0), L(ee, null, je(F(
|
|
1642
|
+
F(D).skuTags.size ? (j(), L("div", wa, [
|
|
1643
|
+
(j(!0), L(ee, null, je(F(D).skuTags.keys(), (C) => (j(), se(x, {
|
|
1639
1644
|
key: `${C}`,
|
|
1640
1645
|
label: `${C}`,
|
|
1641
1646
|
selectable: "",
|
|
1642
1647
|
selected: f[`${C}`],
|
|
1643
1648
|
onClick: (K) => f[`${C}`] = !f[`${C}`]
|
|
1644
1649
|
}, {
|
|
1645
|
-
default:
|
|
1650
|
+
default: Y(() => [
|
|
1646
1651
|
f[`${C}`] ? (j(), se(E, {
|
|
1647
1652
|
key: 0,
|
|
1648
1653
|
name: "check",
|
|
@@ -1662,11 +1667,11 @@ const ia = pt(
|
|
|
1662
1667
|
_: 2
|
|
1663
1668
|
}, 1032, ["label", "selected", "onClick"]))), 128))
|
|
1664
1669
|
])) : de("", !0),
|
|
1665
|
-
r("div",
|
|
1670
|
+
r("div", Sa, [
|
|
1666
1671
|
r("div", {
|
|
1667
|
-
style: lt({ minWidth: `${
|
|
1672
|
+
style: lt({ minWidth: `${ke.value}px` })
|
|
1668
1673
|
}, [
|
|
1669
|
-
|
|
1674
|
+
h(ae, {
|
|
1670
1675
|
"column-defs": we.value,
|
|
1671
1676
|
"row-data": Se.value,
|
|
1672
1677
|
"search-value": Ae.value
|
|
@@ -1676,12 +1681,12 @@ const ia = pt(
|
|
|
1676
1681
|
], 64))
|
|
1677
1682
|
])
|
|
1678
1683
|
], 64)) : de("", !0),
|
|
1679
|
-
le.value.value === "history" ? (j(), L("div",
|
|
1680
|
-
me.value.length ? (j(), L("div",
|
|
1684
|
+
le.value.value === "history" ? (j(), L("div", Ca, [
|
|
1685
|
+
me.value.length ? (j(), L("div", Fa, [
|
|
1681
1686
|
(j(!0), L(ee, null, je(me.value, (C, K) => (j(), L(ee, { key: K }, [
|
|
1682
|
-
r("div",
|
|
1683
|
-
r("div",
|
|
1684
|
-
r("div",
|
|
1687
|
+
r("div", Ta, [
|
|
1688
|
+
r("div", $a, [
|
|
1689
|
+
r("div", Ma, [
|
|
1685
1690
|
r("div", {
|
|
1686
1691
|
class: De([
|
|
1687
1692
|
{
|
|
@@ -1693,7 +1698,7 @@ const ia = pt(
|
|
|
1693
1698
|
}, null, 2)
|
|
1694
1699
|
]),
|
|
1695
1700
|
t[18] || (t[18] = r("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
|
|
1696
|
-
r("div",
|
|
1701
|
+
r("div", Ra, [
|
|
1697
1702
|
r("div", {
|
|
1698
1703
|
class: De([
|
|
1699
1704
|
{
|
|
@@ -1705,14 +1710,14 @@ const ia = pt(
|
|
|
1705
1710
|
}, null, 2)
|
|
1706
1711
|
])
|
|
1707
1712
|
]),
|
|
1708
|
-
r("div",
|
|
1709
|
-
r("div",
|
|
1710
|
-
r("div",
|
|
1713
|
+
r("div", Ia, [
|
|
1714
|
+
r("div", Pa, J(C.header), 1),
|
|
1715
|
+
r("div", Va, J(C.date), 1)
|
|
1711
1716
|
])
|
|
1712
1717
|
]),
|
|
1713
|
-
r("div",
|
|
1714
|
-
r("div",
|
|
1715
|
-
r("div",
|
|
1718
|
+
r("div", Ua, [
|
|
1719
|
+
r("div", La, [
|
|
1720
|
+
r("div", Ea, [
|
|
1716
1721
|
r("div", {
|
|
1717
1722
|
class: De([
|
|
1718
1723
|
{
|
|
@@ -1724,19 +1729,19 @@ const ia = pt(
|
|
|
1724
1729
|
}, null, 2)
|
|
1725
1730
|
])
|
|
1726
1731
|
]),
|
|
1727
|
-
r("div",
|
|
1728
|
-
|
|
1732
|
+
r("div", Ha, [
|
|
1733
|
+
h(o, {
|
|
1729
1734
|
variant: "outlined",
|
|
1730
1735
|
class: "py-12 px-16"
|
|
1731
1736
|
}, {
|
|
1732
|
-
default:
|
|
1733
|
-
r("div",
|
|
1737
|
+
default: Y(() => [
|
|
1738
|
+
r("div", za, [
|
|
1734
1739
|
(j(!0), L(ee, null, je(C.info, (q, ie) => (j(), L("div", {
|
|
1735
1740
|
key: ie,
|
|
1736
1741
|
class: "flex flex-col gap-4"
|
|
1737
1742
|
}, [
|
|
1738
|
-
r("div",
|
|
1739
|
-
r("div",
|
|
1743
|
+
r("div", Na, J(q == null ? void 0 : q.label), 1),
|
|
1744
|
+
r("div", Oa, [
|
|
1740
1745
|
(j(!0), L(ee, null, je(q == null ? void 0 : q.values, (_e, $e) => (j(), L("div", {
|
|
1741
1746
|
key: $e,
|
|
1742
1747
|
class: "fm-typo-en-body-lg-600"
|
|
@@ -1750,18 +1755,18 @@ const ia = pt(
|
|
|
1750
1755
|
])
|
|
1751
1756
|
])
|
|
1752
1757
|
], 64))), 128))
|
|
1753
|
-
])) : (j(), L("div",
|
|
1754
|
-
|
|
1758
|
+
])) : (j(), L("div", ja, [
|
|
1759
|
+
h(ce),
|
|
1755
1760
|
r("div", null, [
|
|
1756
1761
|
r("img", {
|
|
1757
|
-
src: F(
|
|
1762
|
+
src: F(Gt),
|
|
1758
1763
|
alt: "List is empty"
|
|
1759
|
-
}, null, 8,
|
|
1764
|
+
}, null, 8, Ba)
|
|
1760
1765
|
]),
|
|
1761
1766
|
t[16] || (t[16] = r("div", { class: "fm-typo-en-body-lg-600" }, J("No records found"), -1)),
|
|
1762
1767
|
t[17] || (t[17] = r("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, J("You can track approval and rejection history here"), -1)),
|
|
1763
|
-
|
|
1764
|
-
|
|
1768
|
+
h(ce),
|
|
1769
|
+
h(ce)
|
|
1765
1770
|
]))
|
|
1766
1771
|
])) : de("", !0)
|
|
1767
1772
|
])
|
|
@@ -1770,13 +1775,13 @@ const ia = pt(
|
|
|
1770
1775
|
}, 8, ["model-value"]);
|
|
1771
1776
|
};
|
|
1772
1777
|
}
|
|
1773
|
-
}),
|
|
1778
|
+
}), Ga = { class: "flex-1 flex flex-col gap-8" }, Wa = { class: "flex flex-col" }, qa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Za = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Ja = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, Xa = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, dn = /* @__PURE__ */ He({
|
|
1774
1779
|
__name: "ClosingDraftView",
|
|
1775
|
-
setup(
|
|
1776
|
-
const { t: l } = ft(), { viewDraft: e } = Ee(), { viewClosingDraftProps: m, viewClosingDraftShow: p } =
|
|
1777
|
-
|
|
1780
|
+
setup(s) {
|
|
1781
|
+
const { t: l } = ft(), { viewDraft: e } = Ee(), { viewClosingDraftProps: m, viewClosingDraftShow: p } = Qt(Ee()), _ = ze(), v = ua(), R = Lt(), { breakpoints: S } = Yt();
|
|
1782
|
+
_.watchLocation(v.fetchDrafts);
|
|
1778
1783
|
const k = V(() => v.loading), $ = H(""), P = V(() => S.value.xs || S.value.sm), I = V(() => P.value ? 10 : 20);
|
|
1779
|
-
function
|
|
1784
|
+
function n(O) {
|
|
1780
1785
|
switch (O) {
|
|
1781
1786
|
case "refresh":
|
|
1782
1787
|
return v.fetchDrafts();
|
|
@@ -1785,7 +1790,7 @@ const ia = pt(
|
|
|
1785
1790
|
function a(O) {
|
|
1786
1791
|
return O;
|
|
1787
1792
|
}
|
|
1788
|
-
const
|
|
1793
|
+
const D = V(() => P.value ? [
|
|
1789
1794
|
{
|
|
1790
1795
|
label: l("inventory.common.refresh"),
|
|
1791
1796
|
value: "refresh",
|
|
@@ -1801,12 +1806,12 @@ const ia = pt(
|
|
|
1801
1806
|
return (O, f) => {
|
|
1802
1807
|
const y = U("FmTable");
|
|
1803
1808
|
return j(), L(ee, null, [
|
|
1804
|
-
|
|
1809
|
+
h(Et, {
|
|
1805
1810
|
title: F(l)("inventory.closing.draft.title"),
|
|
1806
|
-
actions:
|
|
1807
|
-
"onClick:action":
|
|
1811
|
+
actions: D.value,
|
|
1812
|
+
"onClick:action": n
|
|
1808
1813
|
}, {
|
|
1809
|
-
default:
|
|
1814
|
+
default: Y(() => [
|
|
1810
1815
|
r("div", {
|
|
1811
1816
|
class: De([
|
|
1812
1817
|
"flex flex-col gap-8 max-h-full",
|
|
@@ -1816,58 +1821,58 @@ const ia = pt(
|
|
|
1816
1821
|
}
|
|
1817
1822
|
])
|
|
1818
1823
|
}, [
|
|
1819
|
-
|
|
1824
|
+
h(Ht, {
|
|
1820
1825
|
"change-location": "",
|
|
1821
1826
|
searchable: "",
|
|
1822
1827
|
search: $.value,
|
|
1823
|
-
"onUpdate:search": f[0] || (f[0] = (
|
|
1828
|
+
"onUpdate:search": f[0] || (f[0] = (A) => $.value = A)
|
|
1824
1829
|
}, null, 8, ["search"]),
|
|
1825
|
-
|
|
1830
|
+
h(y, {
|
|
1826
1831
|
style: lt(F(R).tableHeight),
|
|
1827
1832
|
"column-defs": F(v).columnDefs,
|
|
1828
1833
|
"row-data": F(v).drafts,
|
|
1829
1834
|
"search-value": $.value,
|
|
1830
1835
|
loading: k.value,
|
|
1831
|
-
onRowClick: f[1] || (f[1] = (
|
|
1836
|
+
onRowClick: f[1] || (f[1] = (A) => F(e)(A.original)),
|
|
1832
1837
|
"page-size": I.value
|
|
1833
1838
|
}, {
|
|
1834
|
-
"list-row":
|
|
1835
|
-
|
|
1836
|
-
row:
|
|
1837
|
-
onRowClick: (
|
|
1839
|
+
"list-row": Y((A) => [
|
|
1840
|
+
h(zt, {
|
|
1841
|
+
row: A,
|
|
1842
|
+
onRowClick: (w) => F(e)(w)
|
|
1838
1843
|
}, {
|
|
1839
|
-
default:
|
|
1840
|
-
var M, Z, W, re, B, te, be,
|
|
1844
|
+
default: Y((w) => {
|
|
1845
|
+
var M, Z, W, re, B, te, be, he, fe, ye, ge, Q, we, ke, Ae, Se, Fe, xe, le, me;
|
|
1841
1846
|
return [
|
|
1842
|
-
r("div",
|
|
1843
|
-
r("div",
|
|
1844
|
-
r("div",
|
|
1845
|
-
|
|
1846
|
-
render: (W = (Z = (M =
|
|
1847
|
-
props: (B = (re =
|
|
1847
|
+
r("div", Ga, [
|
|
1848
|
+
r("div", Wa, [
|
|
1849
|
+
r("div", qa, [
|
|
1850
|
+
h(F(Pe), {
|
|
1851
|
+
render: (W = (Z = (M = w._id) == null ? void 0 : M.column) == null ? void 0 : Z.columnDef) == null ? void 0 : W.cell,
|
|
1852
|
+
props: (B = (re = w._id) == null ? void 0 : re.getContext) == null ? void 0 : B.call(re)
|
|
1848
1853
|
}, null, 8, ["render", "props"])
|
|
1849
1854
|
]),
|
|
1850
|
-
r("div",
|
|
1851
|
-
|
|
1852
|
-
render: (
|
|
1853
|
-
props: (ye = (fe =
|
|
1855
|
+
r("div", Za, [
|
|
1856
|
+
h(F(Pe), {
|
|
1857
|
+
render: (he = (be = (te = w.name) == null ? void 0 : te.column) == null ? void 0 : be.columnDef) == null ? void 0 : he.cell,
|
|
1858
|
+
props: (ye = (fe = w.name) == null ? void 0 : fe.getContext) == null ? void 0 : ye.call(fe)
|
|
1854
1859
|
}, null, 8, ["render", "props"])
|
|
1855
1860
|
]),
|
|
1856
|
-
r("div",
|
|
1857
|
-
...
|
|
1858
|
-
...
|
|
1861
|
+
r("div", Ja, J([
|
|
1862
|
+
...A.original.items.slice(0, 3).map((Te) => Te.sku.name),
|
|
1863
|
+
...A.original.items.length >= 3 ? [`and ${A.original.items.length - 3} more items`] : []
|
|
1859
1864
|
].join(", ")), 1),
|
|
1860
|
-
r("div",
|
|
1861
|
-
|
|
1862
|
-
render: (we = (
|
|
1863
|
-
props: (Ae = (
|
|
1865
|
+
r("div", Xa, [
|
|
1866
|
+
h(F(Pe), {
|
|
1867
|
+
render: (we = (Q = (ge = w.ref) == null ? void 0 : ge.column) == null ? void 0 : Q.columnDef) == null ? void 0 : we.cell,
|
|
1868
|
+
props: (Ae = (ke = w.ref) == null ? void 0 : ke.getContext) == null ? void 0 : Ae.call(ke)
|
|
1864
1869
|
}, null, 8, ["render", "props"])
|
|
1865
1870
|
])
|
|
1866
1871
|
]),
|
|
1867
1872
|
r("div", null, [
|
|
1868
|
-
|
|
1869
|
-
render: (xe = (Fe = (Se =
|
|
1870
|
-
props: (me = (le =
|
|
1873
|
+
h(F(Pe), {
|
|
1874
|
+
render: (xe = (Fe = (Se = w.status) == null ? void 0 : Se.column) == null ? void 0 : Fe.columnDef) == null ? void 0 : xe.cell,
|
|
1875
|
+
props: (me = (le = w.status) == null ? void 0 : le.getContext) == null ? void 0 : me.call(le)
|
|
1871
1876
|
}, null, 8, ["render", "props"])
|
|
1872
1877
|
])
|
|
1873
1878
|
])
|
|
@@ -1883,11 +1888,11 @@ const ia = pt(
|
|
|
1883
1888
|
_: 1
|
|
1884
1889
|
}, 8, ["title", "actions"]),
|
|
1885
1890
|
(j(), se(wt, { to: "body" }, [
|
|
1886
|
-
|
|
1891
|
+
h(Qa, St(F(m), {
|
|
1887
1892
|
show: F(p),
|
|
1888
|
-
"onUpdate:show": f[2] || (f[2] = (
|
|
1893
|
+
"onUpdate:show": f[2] || (f[2] = (A) => rt(p) ? p.value = A : null),
|
|
1889
1894
|
onSubmitted: f[3] || (f[3] = () => (p.value = !1, F(v).fetchDrafts())),
|
|
1890
|
-
onRefresh: f[4] || (f[4] = (
|
|
1895
|
+
onRefresh: f[4] || (f[4] = (A) => F(v).updateDraftRef(A))
|
|
1891
1896
|
}), null, 16, ["show"])
|
|
1892
1897
|
]))
|
|
1893
1898
|
], 64);
|
|
@@ -1895,5 +1900,5 @@ const ia = pt(
|
|
|
1895
1900
|
}
|
|
1896
1901
|
});
|
|
1897
1902
|
export {
|
|
1898
|
-
|
|
1903
|
+
dn as default
|
|
1899
1904
|
};
|