@feedmepos/mf-inventory-portal 0.0.23-dev.41 → 0.0.23-dev.43
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-DW2K97Bb.js → App-C8wsA5dN.js} +104 -99
- package/dist/{ApprovalView-BgSxdrwt.js → ApprovalView-ZV8rwQp1.js} +18 -18
- package/dist/{BindingsDialog-CQtusdvp.js → BindingsDialog-Sbtijb1i.js} +2 -2
- package/dist/{BindingsPicker-BnEjRAah.js → BindingsPicker-wnlrCohJ.js} +1 -1
- package/dist/{BindingsTable-DpTPAef_.js → BindingsTable-BZCI3MS6.js} +1 -1
- package/dist/{ClosingDraftView-CXKYLCZS.js → ClosingDraftView-DyKbXVev.js} +494 -459
- package/dist/{ClosingTemplateView-CMTJHywt.js → ClosingTemplateView-DJr6D7iw.js} +1 -1
- package/dist/{FmCustomAttribute.vue_vue_type_script_setup_true_lang-zOmcCdDR.js → FmCustomAttribute.vue_vue_type_script_setup_true_lang-B1mRTbf9.js} +4 -4
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-mAPA5_sB.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BUiVV1lj.js} +7 -7
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BjNpfucZ.js → FmUnitInput.vue_vue_type_script_setup_true_lang-qU9EBVED.js} +29 -29
- package/dist/{IngredientGroupView-CrEfiZvn.js → IngredientGroupView-BWeMME4-.js} +1 -1
- package/dist/{IngredientsView-BB8LQlU9.js → IngredientsView-BRxpBv77.js} +14 -15
- package/dist/{IntegrationView-D2wTkDyX.js → IntegrationView-DZqL0Ekt.js} +1 -1
- package/dist/{InventoryBindingForm-DW7rJDc1.js → InventoryBindingForm-C2zDhhfZ.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-Ci8UI1eQ.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-BhaK3zOk.js} +44 -44
- package/dist/{InventoryBindingSummary-B40KofiI.js → InventoryBindingSummary-CJP0sf4N.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DD7VT9MS.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Dplylu1K.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BGuXTfn6.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CC1nuQKm.js} +6 -6
- package/dist/{PurchaseOrderPrintPreview-DQmx28Be.js → PurchaseOrderPrintPreview-C5afxprc.js} +5 -5
- package/dist/{ReceiveRequestView-CJknzKfd.js → ReceiveRequestView-DzbcqmMA.js} +19 -20
- package/dist/{RecipeView-D5oWQ9Yd.js → RecipeView-8koCeNhZ.js} +25 -25
- package/dist/{StockView-U59PHCy2.js → StockView-C3Ef3mQz.js} +30 -31
- package/dist/{SupplierView-CLjjpTNZ.js → SupplierView-BHuYKWgW.js} +11 -12
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-DLDDXnyG.js → TransferDetails.vue_vue_type_script_setup_true_lang-8rCAz5GA.js} +104 -104
- package/dist/{TransferTemplateView-CFoVrPIX.js → TransferTemplateView-u1u-VV-i.js} +63 -64
- package/dist/{UnitView-CAopphN_.js → UnitView-ucQ_K9ot.js} +3 -3
- package/dist/{WarehouseView-DUZku5U6.js → WarehouseView-CCwLKR3J.js} +111 -111
- package/dist/{app-0klJzLit.js → app-BvW6mdJl.js} +12411 -11415
- package/dist/app.js +1 -1
- package/dist/{decimal-Cu4rlnvU.js → decimal-hD6H0C0M.js} +1 -1
- package/dist/{format-unit-display-CMa5UhY1.js → format-unit-display-BfYIFIft.js} +27 -27
- package/dist/{index-BJaMpEVJ.js → index-BQUuh_Xy.js} +88 -88
- package/dist/{index-HTBqkVVr.js → index-y9SmouGG.js} +3 -3
- package/dist/{stock-CB4yNRMO.js → stock-CHW2fGsm.js} +3 -3
- package/dist/stores/feature.d.ts +37 -2
- package/dist/stores/location.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/{supplier-biIIXGyr.js → supplier-CCUVm2qD.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-inventory-binding-dialog-BopoOOxB.js → use-inventory-binding-dialog-B8Cgp_x2.js} +1 -1
- package/package.json +1 -1
- package/dist/feature-C1wCaXKQ.js +0 -946
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { X as Ne, u as
|
|
3
|
-
import { useCoreStore as at, useI18n as
|
|
4
|
-
import { useSnackbar as
|
|
5
|
-
import { defineStore as
|
|
6
|
-
import { u as $e } from "./stock-
|
|
1
|
+
import { defineComponent as ye, ref as O, resolveComponent as E, openBlock as _, createBlock as ne, withCtx as N, createElementVNode as o, createTextVNode as ge, toDisplayString as L, unref as h, createVNode as D, h as $, computed as M, onMounted as He, watch as ze, isRef as _e, createElementBlock as F, Fragment as W, createCommentVNode as le, normalizeClass as ie, renderList as ue, normalizeStyle as we, Teleport as Ee, mergeProps as Le } from "vue";
|
|
2
|
+
import { X as Ne, u as be, af as q, m as Oe, K as he, j as C, t as Ve, L as ce, q as Ke, r as Ye, s as Ge, ag as ke, ah as je, a3 as Ce, ai as Se, aj as oe, a9 as qe, ae as X, V as Be, D as De, i as de, h as Ze, f as We, a as Xe, z as Je, _ as Qe, B as et, E as tt, G as me } from "./app-BvW6mdJl.js";
|
|
3
|
+
import { useCoreStore as at, useI18n as Fe } from "@feedmepos/mf-common";
|
|
4
|
+
import { useSnackbar as Ae, useDialog as nt, useProxiedModel as ot, components as ae, useBreakpoints as st } from "@feedmepos/ui-library";
|
|
5
|
+
import { defineStore as Re, storeToRefs as rt } from "pinia";
|
|
6
|
+
import { u as $e } from "./stock-CHW2fGsm.js";
|
|
7
7
|
import { E as lt } from "./empty-placeholder-wf6-BWE8.js";
|
|
8
|
-
const
|
|
8
|
+
const Te = Ne((n, d) => {
|
|
9
9
|
function e() {
|
|
10
|
-
return
|
|
10
|
+
return be().currentLocation.dbName;
|
|
11
11
|
}
|
|
12
12
|
return {
|
|
13
13
|
async getDraft(u) {
|
|
14
|
-
const m = e(),
|
|
15
|
-
return d.get(
|
|
14
|
+
const m = e(), g = `${n.inventoryBackendUrl}/${m}/closing-draft/${u}`;
|
|
15
|
+
return d.get(g);
|
|
16
16
|
},
|
|
17
17
|
async readDrafts() {
|
|
18
18
|
const u = e(), m = `${n.inventoryBackendUrl}/${u}/closing-draft`;
|
|
19
19
|
return d.get(m);
|
|
20
20
|
},
|
|
21
21
|
async runOperation(u) {
|
|
22
|
-
const m = e(),
|
|
23
|
-
return d.post(
|
|
22
|
+
const m = e(), g = `${n.inventoryBackendUrl}/${m}/closing-draft/run-operation`;
|
|
23
|
+
return d.post(g, u);
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
-
}), it = { class: "fm-typo-en-body-lg-400" }, ct = { class: "fm-typo-en-body-lg-600" }, ut = { class: "flex gap-12 py-8 justify-end w-full" },
|
|
26
|
+
}), it = { class: "fm-typo-en-body-lg-400" }, ct = { class: "fm-typo-en-body-lg-600" }, ut = { class: "flex gap-12 py-8 justify-end w-full" }, xe = /* @__PURE__ */ ye({
|
|
27
27
|
__name: "ClosingDraftAction",
|
|
28
28
|
props: {
|
|
29
29
|
draft: {},
|
|
@@ -32,9 +32,9 @@ const Re = Ne((n, d) => {
|
|
|
32
32
|
onFinished: { type: Function }
|
|
33
33
|
},
|
|
34
34
|
setup(n) {
|
|
35
|
-
const d = n, e = O(), u =
|
|
36
|
-
async function
|
|
37
|
-
|
|
35
|
+
const d = n, e = O(), u = Te(), m = Ae(), g = O(!1);
|
|
36
|
+
async function x() {
|
|
37
|
+
g.value = !0;
|
|
38
38
|
try {
|
|
39
39
|
await u.runOperation({
|
|
40
40
|
_id: d.draft._id,
|
|
@@ -55,40 +55,40 @@ const Re = Ne((n, d) => {
|
|
|
55
55
|
type: "error"
|
|
56
56
|
}), console.error("error on submit closing draft aciont", l);
|
|
57
57
|
} finally {
|
|
58
|
-
|
|
58
|
+
g.value = !1;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
return (l,
|
|
62
|
-
const
|
|
63
|
-
return _(), ne(
|
|
64
|
-
onValidationSuccess:
|
|
61
|
+
return (l, b) => {
|
|
62
|
+
const R = E("FmTextField"), P = E("FmButton"), T = E("FmForm");
|
|
63
|
+
return _(), ne(T, {
|
|
64
|
+
onValidationSuccess: x,
|
|
65
65
|
class: "flex flex-col gap-32",
|
|
66
|
-
disabled:
|
|
66
|
+
disabled: g.value
|
|
67
67
|
}, {
|
|
68
68
|
default: N(() => [
|
|
69
69
|
o("div", it, [
|
|
70
|
-
|
|
71
|
-
o("span", ct,
|
|
72
|
-
|
|
70
|
+
b[2] || (b[2] = ge(" You are about to ")),
|
|
71
|
+
o("span", ct, L(l.action == h(q).enum.approveDraft ? "approve" : "reject"), 1),
|
|
72
|
+
b[3] || (b[3] = ge(" this draft. Please provider a remark to justify this action. "))
|
|
73
73
|
]),
|
|
74
|
-
D(
|
|
74
|
+
D(R, {
|
|
75
75
|
modelValue: e.value,
|
|
76
|
-
"onUpdate:modelValue":
|
|
76
|
+
"onUpdate:modelValue": b[0] || (b[0] = (r) => e.value = r),
|
|
77
77
|
label: "Remark",
|
|
78
78
|
"label-mark": "required",
|
|
79
79
|
rules: [h(Oe)()]
|
|
80
80
|
}, null, 8, ["modelValue", "rules"]),
|
|
81
81
|
o("div", ut, [
|
|
82
|
-
D(
|
|
82
|
+
D(P, {
|
|
83
83
|
label: "Cancel",
|
|
84
84
|
variant: "tertiary",
|
|
85
|
-
onClick:
|
|
85
|
+
onClick: b[1] || (b[1] = (r) => l.onCancel())
|
|
86
86
|
}),
|
|
87
|
-
D(
|
|
88
|
-
label: l.action == h(
|
|
87
|
+
D(P, {
|
|
88
|
+
label: l.action == h(q).enum.approveDraft ? "Approve" : "Reject",
|
|
89
89
|
type: "submit",
|
|
90
|
-
variant: l.action == h(
|
|
91
|
-
loading:
|
|
90
|
+
variant: l.action == h(q).enum.approveDraft ? "primary" : "destructive",
|
|
91
|
+
loading: g.value
|
|
92
92
|
}, null, 8, ["label", "variant", "loading"])
|
|
93
93
|
])
|
|
94
94
|
]),
|
|
@@ -97,41 +97,41 @@ const Re = Ne((n, d) => {
|
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
}), dt = ce(0);
|
|
100
|
-
function
|
|
100
|
+
function Me(n) {
|
|
101
101
|
const d = n.measurementsAmounts.groupBy((u) => u.measurement.id), e = n.sku.unit.measurements.reduce((u, m) => {
|
|
102
|
-
var l,
|
|
103
|
-
const
|
|
104
|
-
return u + +
|
|
105
|
-
}, +
|
|
102
|
+
var l, b;
|
|
103
|
+
const g = ((b = (l = d.get(m.id)) == null ? void 0 : l[0]) == null ? void 0 : b.amount) ?? dt, x = he(m.conversion, g);
|
|
104
|
+
return u + +C(x);
|
|
105
|
+
}, +C(n.baseAmount));
|
|
106
106
|
return Ve(e, n.baseAmount.precision);
|
|
107
107
|
}
|
|
108
108
|
const mt = ce(0), ft = ce(100);
|
|
109
109
|
function pt(n, d) {
|
|
110
|
-
const e =
|
|
110
|
+
const e = Me(n), u = ke(e, d), m = d.amount === 0 ? null : je(u, {
|
|
111
111
|
...d,
|
|
112
112
|
amount: Math.abs(d.amount)
|
|
113
|
-
}),
|
|
113
|
+
}), g = m ? he(m, ft) : null;
|
|
114
114
|
return {
|
|
115
115
|
code: n.sku.code,
|
|
116
116
|
name: n.sku.name,
|
|
117
117
|
baseUnit: n.sku.unit.abbrev,
|
|
118
|
-
baseUnitAmount: +
|
|
119
|
-
...n.measurementsAmounts.filter((l) =>
|
|
120
|
-
(l,
|
|
118
|
+
baseUnitAmount: +C(n.baseAmount),
|
|
119
|
+
...n.measurementsAmounts.filter((l) => Pe(l.measurement)).reduce(
|
|
120
|
+
(l, b, R) => (l[`measurementAbbrev${R}`] = `(${b.measurement.abbrev}) × ${C(b.measurement.conversion)}`, l[`measurementAmount${R}`] = +C(b.amount), l),
|
|
121
121
|
{}
|
|
122
122
|
),
|
|
123
|
-
systemBalance: +
|
|
124
|
-
physicalBalance: +
|
|
125
|
-
adjustedAmount: +
|
|
126
|
-
adjustedDiffPercentage:
|
|
123
|
+
systemBalance: +C(d),
|
|
124
|
+
physicalBalance: +C(e),
|
|
125
|
+
adjustedAmount: +C(u),
|
|
126
|
+
adjustedDiffPercentage: g ? +C(Ce(g, 2)) : null
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function Pe(n) {
|
|
130
130
|
return !n.abbrev.toLocaleLowerCase().includes("inactive");
|
|
131
131
|
}
|
|
132
132
|
function vt(n) {
|
|
133
133
|
return n.reduce(
|
|
134
|
-
(d, e) => Math.max(d, e.sku.unit.measurements.filter(
|
|
134
|
+
(d, e) => Math.max(d, e.sku.unit.measurements.filter(Pe).length),
|
|
135
135
|
0
|
|
136
136
|
);
|
|
137
137
|
}
|
|
@@ -182,56 +182,56 @@ function gt(n) {
|
|
|
182
182
|
];
|
|
183
183
|
}
|
|
184
184
|
function yt(n, d) {
|
|
185
|
-
var s,
|
|
185
|
+
var s, v, U, S, w, V, B;
|
|
186
186
|
const e = d.groupBy(
|
|
187
|
-
(
|
|
188
|
-
(
|
|
189
|
-
), u = [...n.items, ...n.negativeStockItems ?? []], m = u.map((
|
|
190
|
-
var
|
|
191
|
-
const
|
|
192
|
-
return pt(
|
|
193
|
-
}),
|
|
187
|
+
(y) => y.id,
|
|
188
|
+
(y) => y.balance
|
|
189
|
+
), u = [...n.items, ...n.negativeStockItems ?? []], m = u.map((y) => {
|
|
190
|
+
var J;
|
|
191
|
+
const K = ((J = e.get(y.sku._id)) == null ? void 0 : J[0]) ?? mt;
|
|
192
|
+
return pt(y, K);
|
|
193
|
+
}), g = vt(u), l = at().currentBusiness.value, b = gt(g), R = [
|
|
194
194
|
["Business name:", l == null ? void 0 : l.name],
|
|
195
195
|
["Business ID:", l == null ? void 0 : l._id],
|
|
196
196
|
["Menu version", l == null ? void 0 : l.menuVersion],
|
|
197
197
|
["Created at", new Date(n.createdAt)],
|
|
198
198
|
["Created by", (s = n.createdBy) == null ? void 0 : s.name],
|
|
199
199
|
["Updated at", new Date(n.updatedAt)],
|
|
200
|
-
["Updated by", (
|
|
200
|
+
["Updated by", (v = n.updatedBy) == null ? void 0 : v.name],
|
|
201
201
|
["Recent action", n.approvedAt ? "Approve" : n.rejectionHistory ? "Reject" : ""],
|
|
202
202
|
[
|
|
203
203
|
"Action by",
|
|
204
|
-
n.approvedAt ? (
|
|
204
|
+
n.approvedAt ? (U = n.approvedBy) == null ? void 0 : U.name : n.rejectionHistory ? (w = (S = n.rejectionHistory[0]) == null ? void 0 : S.rejectedBy) == null ? void 0 : w.name : ""
|
|
205
205
|
],
|
|
206
206
|
[
|
|
207
207
|
"Action at",
|
|
208
|
-
n.approvedAt ? new Date(n.approvedAt) : n.rejectionHistory ? new Date((
|
|
208
|
+
n.approvedAt ? new Date(n.approvedAt) : n.rejectionHistory ? new Date((V = n.rejectionHistory[0]) == null ? void 0 : V.rejectedAt) : ""
|
|
209
209
|
],
|
|
210
210
|
[
|
|
211
211
|
"Action remark",
|
|
212
|
-
n.approvedAt ? n.approveRemark : n.rejectionHistory ? new Date((
|
|
212
|
+
n.approvedAt ? n.approveRemark : n.rejectionHistory ? new Date((B = n.rejectionHistory[0]) == null ? void 0 : B.rejectRemark) : ""
|
|
213
213
|
],
|
|
214
214
|
[],
|
|
215
|
-
|
|
216
|
-
...m.map((
|
|
217
|
-
],
|
|
218
|
-
return Ge(
|
|
215
|
+
b.map((y) => y.name),
|
|
216
|
+
...m.map((y) => b.map((K) => y[K.id]))
|
|
217
|
+
], P = b.map((y) => `system:${y.id}`), T = Ke(R, P), r = `[${l == null ? void 0 : l.name}] closing draft (${Ye(new Date(n.updatedAt))}).xlsx`;
|
|
218
|
+
return Ge(T, r), r;
|
|
219
219
|
}
|
|
220
|
-
const
|
|
220
|
+
const pe = Re(
|
|
221
221
|
"closingDraftActions",
|
|
222
222
|
function() {
|
|
223
|
-
const d = nt(), e =
|
|
223
|
+
const d = nt(), e = Ae(), u = Se(), m = $e(), g = O(!1), x = O();
|
|
224
224
|
function l(s) {
|
|
225
|
-
const
|
|
225
|
+
const v = {
|
|
226
226
|
draft: s
|
|
227
227
|
};
|
|
228
|
-
|
|
228
|
+
x.value = v, g.value = !0;
|
|
229
229
|
}
|
|
230
|
-
async function
|
|
231
|
-
var
|
|
230
|
+
async function b(s) {
|
|
231
|
+
var U;
|
|
232
232
|
if (s.status === oe.enum.COMPLETED) {
|
|
233
|
-
const
|
|
234
|
-
if (!
|
|
233
|
+
const S = s.closingId;
|
|
234
|
+
if (!S)
|
|
235
235
|
return e.open({
|
|
236
236
|
title: "Something went wrong",
|
|
237
237
|
message: "Closing draft is completed but closing document cannot be found.",
|
|
@@ -239,60 +239,60 @@ const fe = Fe(
|
|
|
239
239
|
}), console.error("Closing draft is completed but closing document cannot be found.", {
|
|
240
240
|
draftId: s == null ? void 0 : s._id
|
|
241
241
|
}), [];
|
|
242
|
-
const
|
|
243
|
-
return (
|
|
242
|
+
const w = await u.getClosingById(S);
|
|
243
|
+
return (w == null ? void 0 : w.skus) ?? [];
|
|
244
244
|
} else
|
|
245
|
-
return await m.readStockBalance(), ((
|
|
245
|
+
return await m.readStockBalance(), ((U = m.stockBalance) == null ? void 0 : U.skus) ?? [];
|
|
246
246
|
}
|
|
247
|
-
async function
|
|
248
|
-
|
|
247
|
+
async function R(s, v) {
|
|
248
|
+
v || (e.open({
|
|
249
249
|
title: "Exporting",
|
|
250
250
|
message: "Fetching data..."
|
|
251
|
-
}),
|
|
251
|
+
}), v = await b(s)), yt(s, v);
|
|
252
252
|
}
|
|
253
|
-
function
|
|
253
|
+
function P(s, v) {
|
|
254
254
|
d.open({
|
|
255
255
|
title: "Approve draft",
|
|
256
|
-
contentComponent:
|
|
256
|
+
contentComponent: xe,
|
|
257
257
|
contentComponentProps: {
|
|
258
258
|
draft: s,
|
|
259
|
-
action:
|
|
259
|
+
action: q.enum.approveDraft,
|
|
260
260
|
onFinished: () => {
|
|
261
|
-
d.close(),
|
|
261
|
+
d.close(), v == null || v();
|
|
262
262
|
},
|
|
263
263
|
onCancel: () => d.close()
|
|
264
264
|
}
|
|
265
265
|
});
|
|
266
266
|
}
|
|
267
|
-
function
|
|
267
|
+
function T(s, v) {
|
|
268
268
|
d.open({
|
|
269
269
|
title: "Reject draft",
|
|
270
|
-
contentComponent:
|
|
270
|
+
contentComponent: xe,
|
|
271
271
|
contentComponentProps: {
|
|
272
272
|
draft: s,
|
|
273
|
-
action:
|
|
273
|
+
action: q.enum.rejectDraft,
|
|
274
274
|
onFinished: () => {
|
|
275
|
-
d.close(),
|
|
275
|
+
d.close(), v == null || v();
|
|
276
276
|
},
|
|
277
277
|
onCancel: () => d.close()
|
|
278
278
|
}
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
281
|
function r() {
|
|
282
|
-
|
|
282
|
+
g.value = !1;
|
|
283
283
|
}
|
|
284
284
|
return {
|
|
285
285
|
viewDraft: l,
|
|
286
286
|
closeDraftDialog: r,
|
|
287
|
-
approveDraft:
|
|
288
|
-
rejectDraft:
|
|
289
|
-
exportDraft:
|
|
290
|
-
viewClosingDraftShow:
|
|
291
|
-
viewClosingDraftProps:
|
|
287
|
+
approveDraft: P,
|
|
288
|
+
rejectDraft: T,
|
|
289
|
+
exportDraft: R,
|
|
290
|
+
viewClosingDraftShow: g,
|
|
291
|
+
viewClosingDraftProps: x
|
|
292
292
|
};
|
|
293
293
|
}
|
|
294
294
|
);
|
|
295
|
-
function
|
|
295
|
+
function fe(n) {
|
|
296
296
|
switch (n) {
|
|
297
297
|
case "DRAFT":
|
|
298
298
|
return "fm-status-badge-draft";
|
|
@@ -304,166 +304,197 @@ function Pe(n) {
|
|
|
304
304
|
return "fm-status-badge-complete";
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
const bt =
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
307
|
+
const bt = Re(
|
|
308
|
+
"closingDraftTable",
|
|
309
|
+
function() {
|
|
310
|
+
const { t: d } = Fe(), e = pe(), u = O(new Array()), m = O(!1), g = be(), x = Te();
|
|
311
|
+
async function l() {
|
|
312
|
+
if (u.value = [], !!g._currentLocation) {
|
|
313
|
+
m.value = !0;
|
|
314
|
+
try {
|
|
315
|
+
const [r] = await Promise.all([x.readDrafts()]).delayed(1e3);
|
|
316
|
+
u.value = r.reverse();
|
|
317
|
+
} catch (r) {
|
|
318
|
+
console.log("Something went wrong when fetching drafts:", r);
|
|
319
|
+
} finally {
|
|
320
|
+
m.value = !1;
|
|
321
|
+
}
|
|
319
322
|
}
|
|
320
323
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
324
|
+
async function b(r) {
|
|
325
|
+
if (!u.value.find((s) => s._id) && g._currentLocation) {
|
|
326
|
+
m.value = !0;
|
|
327
|
+
try {
|
|
328
|
+
const [s] = await Promise.all([
|
|
329
|
+
x.getDraft(r),
|
|
330
|
+
new Promise((v) => setTimeout(v, 1e3))
|
|
331
|
+
]);
|
|
332
|
+
u.value = [s];
|
|
333
|
+
} catch (s) {
|
|
334
|
+
console.log("Something went wrong when fetching drafts:", s);
|
|
335
|
+
} finally {
|
|
336
|
+
m.value = !1;
|
|
337
|
+
}
|
|
335
338
|
}
|
|
336
339
|
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
e.closeDraftDialog(), l();
|
|
340
|
-
}
|
|
341
|
-
function T(r, s) {
|
|
342
|
-
switch (s = We(s), r) {
|
|
343
|
-
case de.Details:
|
|
344
|
-
return e.viewDraft(s);
|
|
345
|
-
case de.Export:
|
|
346
|
-
return e.exportDraft(s);
|
|
347
|
-
case G.enum.approveDraft:
|
|
348
|
-
return e.approveDraft(s, B);
|
|
349
|
-
case G.enum.rejectDraft:
|
|
350
|
-
return e.rejectDraft(s, B);
|
|
340
|
+
function R() {
|
|
341
|
+
e.closeDraftDialog(), l();
|
|
351
342
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
343
|
+
function P(r, s) {
|
|
344
|
+
switch (s = We(s), r) {
|
|
345
|
+
case de.Details:
|
|
346
|
+
return e.viewDraft(s);
|
|
347
|
+
case de.Export:
|
|
348
|
+
return e.exportDraft(s);
|
|
349
|
+
case q.enum.approveDraft:
|
|
350
|
+
return e.approveDraft(s, R);
|
|
351
|
+
case q.enum.rejectDraft:
|
|
352
|
+
return e.rejectDraft(s, R);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return {
|
|
356
|
+
columnDefs: [
|
|
357
|
+
{
|
|
358
|
+
id: "_id",
|
|
359
|
+
accessorKey: "_id",
|
|
360
|
+
header: () => d("inventory.closing.table.createdAt"),
|
|
361
|
+
cell(r) {
|
|
362
|
+
return qe(`${r.getValue()}`);
|
|
363
|
+
},
|
|
364
|
+
enableSorting: !0
|
|
361
365
|
},
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
enableSorting: !0,
|
|
369
|
-
size: 200
|
|
370
|
-
},
|
|
371
|
-
{
|
|
372
|
-
id: "updatedBy",
|
|
373
|
-
accessorKey: "updatedBy.name",
|
|
374
|
-
header: () => "Last update by",
|
|
375
|
-
enableSorting: !0,
|
|
376
|
-
size: 200
|
|
377
|
-
},
|
|
378
|
-
{
|
|
379
|
-
id: "noOfItems",
|
|
380
|
-
accessorFn: (r) => {
|
|
381
|
-
var s;
|
|
382
|
-
return r.items.length + (((s = r.negativeStockItems) == null ? void 0 : s.length) ?? 0);
|
|
366
|
+
{
|
|
367
|
+
id: "updatedAt",
|
|
368
|
+
accessorFn: (r) => X(r.updatedAt),
|
|
369
|
+
header: () => "Updated at",
|
|
370
|
+
enableSorting: !0,
|
|
371
|
+
size: 200
|
|
383
372
|
},
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
},
|
|
391
|
-
{
|
|
392
|
-
id: "recentRemark",
|
|
393
|
-
accessorFn: (r) => {
|
|
394
|
-
var s;
|
|
395
|
-
return (r == null ? void 0 : r.approveRemark) ?? ((s = r == null ? void 0 : r.rejectionHistory) == null ? void 0 : s.computeFirst((p) => p.rejectRemark));
|
|
373
|
+
{
|
|
374
|
+
id: "updatedBy",
|
|
375
|
+
accessorKey: "updatedBy.name",
|
|
376
|
+
header: () => "Last update by",
|
|
377
|
+
enableSorting: !0,
|
|
378
|
+
size: 200
|
|
396
379
|
},
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
"
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
380
|
+
{
|
|
381
|
+
id: "noOfItems",
|
|
382
|
+
accessorFn: (r) => {
|
|
383
|
+
var s;
|
|
384
|
+
return r.items.length + (((s = r.negativeStockItems) == null ? void 0 : s.length) ?? 0);
|
|
385
|
+
},
|
|
386
|
+
header: () => d("inventory.closing.table.noOfItems"),
|
|
387
|
+
enableSorting: !1,
|
|
388
|
+
meta: {
|
|
389
|
+
width: "10rem",
|
|
390
|
+
textAlign: "right"
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
id: "recentRemark",
|
|
395
|
+
accessorFn: (r) => {
|
|
396
|
+
var s;
|
|
397
|
+
return (r == null ? void 0 : r.approveRemark) ?? ((s = r == null ? void 0 : r.rejectionHistory) == null ? void 0 : s.computeFirst((v) => v.rejectRemark)) ?? r.remark;
|
|
398
|
+
},
|
|
399
|
+
header: () => "Recent remark"
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
id: "status",
|
|
403
|
+
accessorFn: (r) => r.status,
|
|
404
|
+
header: () => d("inventory.closing.table.status"),
|
|
405
|
+
enableSorting: !1,
|
|
406
|
+
cell(r) {
|
|
407
|
+
var V;
|
|
408
|
+
const s = r.row.original, v = s.status, U = new Date(s.updatedAt), S = (V = s == null ? void 0 : s.rejectionHistory) == null ? void 0 : V.computeFirst((B) => B.rejectedAt), w = S ? new Date(S) : null;
|
|
409
|
+
return v === "DRAFT" && w ? w.getTime() > U.getTime() ? $(
|
|
412
410
|
"div",
|
|
413
411
|
{
|
|
414
|
-
class:
|
|
412
|
+
class: "flex"
|
|
415
413
|
},
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
414
|
+
$(
|
|
415
|
+
"div",
|
|
416
|
+
{
|
|
417
|
+
class: ["fm-status-badge", fe("FAILED")]
|
|
418
|
+
},
|
|
419
|
+
"Rejected"
|
|
420
|
+
)
|
|
421
|
+
) : $(
|
|
422
|
+
"div",
|
|
423
|
+
{
|
|
424
|
+
class: "flex"
|
|
425
|
+
},
|
|
426
|
+
$(
|
|
427
|
+
"div",
|
|
428
|
+
{
|
|
429
|
+
class: ["fm-status-badge", fe("PROCESSING")]
|
|
430
|
+
},
|
|
431
|
+
"Updated"
|
|
432
|
+
)
|
|
433
|
+
) : $(
|
|
434
|
+
"div",
|
|
435
|
+
{
|
|
436
|
+
class: "flex"
|
|
437
|
+
},
|
|
438
|
+
$(
|
|
439
|
+
"div",
|
|
440
|
+
{
|
|
441
|
+
class: ["fm-status-badge", fe(v)]
|
|
442
|
+
},
|
|
443
|
+
Be(v)
|
|
444
|
+
)
|
|
445
|
+
);
|
|
446
|
+
}
|
|
443
447
|
},
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
448
|
+
{
|
|
449
|
+
id: "action",
|
|
450
|
+
cell(r) {
|
|
451
|
+
const s = r.row.original, v = [
|
|
452
|
+
De[de.Details],
|
|
453
|
+
De[de.Export]
|
|
454
|
+
], U = [
|
|
455
|
+
{
|
|
456
|
+
translationKey: "inventory.closing.draft.approveDraft",
|
|
457
|
+
color: "text-fm-color-typo-primary",
|
|
458
|
+
value: q.enum.approveDraft
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
translationKey: "inventory.closing.draft.rejectDraft",
|
|
462
|
+
color: "text-fm-color-typo-error",
|
|
463
|
+
value: q.enum.rejectDraft
|
|
464
|
+
}
|
|
465
|
+
];
|
|
466
|
+
return Ze(
|
|
467
|
+
[
|
|
468
|
+
...v,
|
|
469
|
+
...s.status === oe.enum.DRAFT ? U : []
|
|
470
|
+
],
|
|
471
|
+
(S) => P(S, s)
|
|
472
|
+
);
|
|
473
|
+
},
|
|
474
|
+
enableSorting: !1,
|
|
475
|
+
size: 40,
|
|
476
|
+
meta: {
|
|
477
|
+
cellClass: "",
|
|
478
|
+
headerClass: ""
|
|
479
|
+
}
|
|
449
480
|
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
}
|
|
457
|
-
|
|
481
|
+
],
|
|
482
|
+
drafts: u,
|
|
483
|
+
loading: m,
|
|
484
|
+
fetchDrafts: l,
|
|
485
|
+
loadDraft: b
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
), ht = { class: "w-full flex flex-col gap-32" }, At = { class: "flex justify-between" }, Dt = { class: "flex" }, xt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _t = { class: "flex gap-1" }, wt = { class: "fm-typo-en-body-lg-600" }, kt = { class: "flex flex-col gap-16" }, jt = { class: "flex" }, Ct = { key: 0 }, St = {
|
|
458
489
|
key: 0,
|
|
459
490
|
class: "w-full flex flex-col items-center"
|
|
460
491
|
}, Bt = { class: "flex items-center gap-8" }, Ft = {
|
|
461
492
|
key: 1,
|
|
462
493
|
class: "overflow-x-auto"
|
|
463
|
-
},
|
|
494
|
+
}, Rt = {
|
|
464
495
|
key: 1,
|
|
465
496
|
class: "flex-1 xs:w-screen xs:max-w-full"
|
|
466
|
-
},
|
|
497
|
+
}, $t = {
|
|
467
498
|
key: 0,
|
|
468
499
|
class: "flex flex-col items-center gap-8 h-full"
|
|
469
500
|
}, Tt = ["src"], Mt = {
|
|
@@ -472,7 +503,7 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
472
503
|
}, Pt = { class: "flex gap-12 content-stretch" }, It = {
|
|
473
504
|
class: "flex flex-col w-24",
|
|
474
505
|
name: "circles"
|
|
475
|
-
}, Ut = { class: "flex-1 flex flex-col items-center" },
|
|
506
|
+
}, Ut = { class: "flex-1 flex flex-col items-center" }, Ht = { class: "flex-1 flex flex-col items-center" }, zt = {
|
|
476
507
|
class: "py-12 flex flex-col gap-4",
|
|
477
508
|
name: "received-at header"
|
|
478
509
|
}, Et = { class: "fm-typo-en-body-lg-400" }, Lt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Nt = { class: "flex gap-12 content-stretch" }, Ot = {
|
|
@@ -481,7 +512,7 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
481
512
|
}, Vt = { class: "flex-1 flex flex-col items-center" }, Kt = {
|
|
482
513
|
class: "py-12 flex flex-col gap-4 flex-1",
|
|
483
514
|
name: "delivery details"
|
|
484
|
-
}, Yt = { class: "flex flex-col gap-8" }, Gt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, qt = { class: "flex flex-col gap-4" }, Zt = { class: "flex gap-8" }, Wt = /* @__PURE__ */
|
|
515
|
+
}, Yt = { class: "flex flex-col gap-8" }, Gt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, qt = { class: "flex flex-col gap-4" }, Zt = { class: "flex gap-8" }, Wt = /* @__PURE__ */ ye({
|
|
485
516
|
__name: "ClosingDraftDialog",
|
|
486
517
|
props: {
|
|
487
518
|
show: { type: Boolean },
|
|
@@ -489,65 +520,65 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
489
520
|
},
|
|
490
521
|
emits: ["submitted"],
|
|
491
522
|
setup(n, { emit: d }) {
|
|
492
|
-
const e = n, u = $e(), m =
|
|
523
|
+
const e = n, u = $e(), m = pe(), g = ot(e, "show"), x = O(!1), l = O(new Array()), b = Se(), R = Ae(), P = Xe(), T = d, r = M(() => {
|
|
493
524
|
var a, t;
|
|
494
525
|
return [
|
|
495
526
|
...((a = e.draft) == null ? void 0 : a.items) ?? [],
|
|
496
527
|
...((t = e.draft) == null ? void 0 : t.negativeStockItems) ?? []
|
|
497
528
|
];
|
|
498
|
-
}), s =
|
|
529
|
+
}), s = M(() => {
|
|
499
530
|
const a = r.value.map((t) => t.sku);
|
|
500
|
-
return a.sort((t,
|
|
501
|
-
}),
|
|
531
|
+
return a.sort((t, i) => t.code.localeCompare(i.code)), a;
|
|
532
|
+
}), v = M(() => r.value.groupBy(
|
|
502
533
|
(t) => t.sku._id,
|
|
503
|
-
(t) => t.measurementsAmounts.filter((
|
|
534
|
+
(t) => t.measurementsAmounts.filter((i) => !i.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((i) => i.measurement.id)
|
|
504
535
|
));
|
|
505
|
-
|
|
536
|
+
He(w), ze(
|
|
506
537
|
() => e.show,
|
|
507
538
|
(a) => {
|
|
508
|
-
a && (
|
|
539
|
+
a && (Z.value = te[0], w());
|
|
509
540
|
}
|
|
510
541
|
);
|
|
511
|
-
const
|
|
512
|
-
async function
|
|
513
|
-
var t,
|
|
514
|
-
|
|
542
|
+
const U = ce(0), S = ce(100);
|
|
543
|
+
async function w() {
|
|
544
|
+
var t, i, f;
|
|
545
|
+
x.value = !0;
|
|
515
546
|
const a = ((t = e.draft) == null ? void 0 : t.status) === oe.enum.COMPLETED;
|
|
516
547
|
try {
|
|
517
|
-
if (await
|
|
518
|
-
const
|
|
519
|
-
if (!
|
|
520
|
-
|
|
548
|
+
if (await P.init(), a) {
|
|
549
|
+
const c = e.draft.closingId;
|
|
550
|
+
if (!c) {
|
|
551
|
+
R.open({
|
|
521
552
|
title: "Something went wrong",
|
|
522
553
|
message: "Closing draft is completed but closing document cannot be found.",
|
|
523
554
|
type: "error"
|
|
524
555
|
}), console.error("Closing draft is completed but closing document cannot be found.", {
|
|
525
|
-
draftId: (
|
|
556
|
+
draftId: (i = e.draft) == null ? void 0 : i._id
|
|
526
557
|
});
|
|
527
558
|
return;
|
|
528
559
|
}
|
|
529
|
-
const
|
|
530
|
-
l.value = (
|
|
560
|
+
const p = await b.getClosingById(c);
|
|
561
|
+
l.value = (p == null ? void 0 : p.skus) ?? [];
|
|
531
562
|
} else
|
|
532
|
-
await u.readStockBalance(), l.value = ((
|
|
533
|
-
} catch (
|
|
534
|
-
|
|
563
|
+
await u.readStockBalance(), l.value = ((f = u.stockBalance) == null ? void 0 : f.skus) ?? [];
|
|
564
|
+
} catch (c) {
|
|
565
|
+
R.open({
|
|
535
566
|
title: "Something went wrong",
|
|
536
567
|
message: "Something went wrong when fetching info. Please try again.",
|
|
537
568
|
type: "error"
|
|
538
|
-
}), console.error("error on fetch stock balances",
|
|
569
|
+
}), console.error("error on fetch stock balances", c);
|
|
539
570
|
} finally {
|
|
540
|
-
|
|
571
|
+
x.value = !1;
|
|
541
572
|
}
|
|
542
573
|
}
|
|
543
|
-
const
|
|
574
|
+
const V = M(
|
|
544
575
|
() => l.value.groupBy(
|
|
545
576
|
(a) => a.id,
|
|
546
577
|
(a) => a.balance
|
|
547
578
|
)
|
|
548
|
-
),
|
|
549
|
-
function
|
|
550
|
-
return
|
|
579
|
+
), B = M(() => r.value.groupBy((a) => a.sku._id));
|
|
580
|
+
function y(a) {
|
|
581
|
+
return $(
|
|
551
582
|
ae.FmTooltip,
|
|
552
583
|
{ zIndex: 51, placement: "left", class: "w-full flex justify-end" },
|
|
553
584
|
{
|
|
@@ -560,15 +591,15 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
560
591
|
}
|
|
561
592
|
);
|
|
562
593
|
}
|
|
563
|
-
const
|
|
564
|
-
const a = s.value.reduce((
|
|
565
|
-
var
|
|
594
|
+
const K = M(() => {
|
|
595
|
+
const a = s.value.reduce((i, f) => {
|
|
596
|
+
var c, p, I, j;
|
|
566
597
|
return console.log(
|
|
567
598
|
"Measurement counts",
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
(
|
|
571
|
-
), Math.max(
|
|
599
|
+
f.unit.name,
|
|
600
|
+
f.unit.abbrev,
|
|
601
|
+
(p = (c = v.value) == null ? void 0 : c.get(f._id)) == null ? void 0 : p[0].length
|
|
602
|
+
), Math.max(i, ((j = (I = v.value) == null ? void 0 : I.get(f._id)) == null ? void 0 : j[0].length) ?? 0);
|
|
572
603
|
}, 0);
|
|
573
604
|
return [
|
|
574
605
|
{
|
|
@@ -576,9 +607,9 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
576
607
|
accessorKey: "code",
|
|
577
608
|
header: () => "Code",
|
|
578
609
|
size: 200,
|
|
579
|
-
cell(
|
|
580
|
-
const
|
|
581
|
-
return typeof
|
|
610
|
+
cell(i) {
|
|
611
|
+
const f = i.row.original.adjustedDiffPercentage;
|
|
612
|
+
return typeof f == "number" && Math.abs(f) > 10 ? $(
|
|
582
613
|
ae.FmTooltip,
|
|
583
614
|
{
|
|
584
615
|
zIndex: 51
|
|
@@ -588,13 +619,13 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
588
619
|
return "Adjustment difference is more than 10%.";
|
|
589
620
|
},
|
|
590
621
|
default() {
|
|
591
|
-
return
|
|
592
|
-
|
|
593
|
-
`${
|
|
622
|
+
return $("div", { class: "flex items-center gap-4 justify-start w-full" }, [
|
|
623
|
+
$(ae.FmIcon, { size: "sm", color: "system-error-300", name: "error" }),
|
|
624
|
+
`${i.getValue()}`
|
|
594
625
|
]);
|
|
595
626
|
}
|
|
596
627
|
}
|
|
597
|
-
) :
|
|
628
|
+
) : i.getValue();
|
|
598
629
|
}
|
|
599
630
|
},
|
|
600
631
|
{
|
|
@@ -606,7 +637,7 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
606
637
|
{
|
|
607
638
|
id: "baseUnitAmount",
|
|
608
639
|
accessorKey: "baseUnitAmount",
|
|
609
|
-
header: () =>
|
|
640
|
+
header: () => y("Base unit amount"),
|
|
610
641
|
size: 200,
|
|
611
642
|
meta: {
|
|
612
643
|
textAlign: "right"
|
|
@@ -618,22 +649,22 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
618
649
|
header: () => "Base unit",
|
|
619
650
|
size: 200
|
|
620
651
|
},
|
|
621
|
-
...Array.from({ length: a }).flatMap((
|
|
622
|
-
const
|
|
652
|
+
...Array.from({ length: a }).flatMap((i, f) => {
|
|
653
|
+
const c = `measurementAbbrev${f}`, p = `measurementAmount${f}`;
|
|
623
654
|
return [
|
|
624
655
|
{
|
|
625
|
-
id:
|
|
626
|
-
accessorKey:
|
|
627
|
-
header: () =>
|
|
656
|
+
id: p,
|
|
657
|
+
accessorKey: p,
|
|
658
|
+
header: () => y(`UOM amount ${f + 1}`),
|
|
628
659
|
size: 200,
|
|
629
660
|
meta: {
|
|
630
661
|
textAlign: "right"
|
|
631
662
|
}
|
|
632
663
|
},
|
|
633
664
|
{
|
|
634
|
-
id:
|
|
635
|
-
accessorKey:
|
|
636
|
-
header: () => `UOM ${
|
|
665
|
+
id: c,
|
|
666
|
+
accessorKey: c,
|
|
667
|
+
header: () => `UOM ${f + 1}`,
|
|
637
668
|
size: 200
|
|
638
669
|
}
|
|
639
670
|
];
|
|
@@ -641,7 +672,7 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
641
672
|
{
|
|
642
673
|
id: "physicalBalance",
|
|
643
674
|
accessorKey: "physicalBalance",
|
|
644
|
-
header: () =>
|
|
675
|
+
header: () => y("Total balance"),
|
|
645
676
|
size: 200,
|
|
646
677
|
meta: {
|
|
647
678
|
textAlign: "right"
|
|
@@ -650,7 +681,7 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
650
681
|
{
|
|
651
682
|
id: "systemBalance",
|
|
652
683
|
accessorKey: "systemBalance",
|
|
653
|
-
header: () =>
|
|
684
|
+
header: () => y("System balance"),
|
|
654
685
|
size: 200,
|
|
655
686
|
meta: {
|
|
656
687
|
textAlign: "right"
|
|
@@ -659,7 +690,7 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
659
690
|
{
|
|
660
691
|
id: "adjustedAmount",
|
|
661
692
|
accessorKey: "adjustedAmount",
|
|
662
|
-
header: () =>
|
|
693
|
+
header: () => y("Adjusted amount"),
|
|
663
694
|
size: 200,
|
|
664
695
|
meta: {
|
|
665
696
|
textAlign: "right"
|
|
@@ -668,14 +699,14 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
668
699
|
{
|
|
669
700
|
id: "adjustedDiffPercentage",
|
|
670
701
|
accessorKey: "adjustedDiffPercentage",
|
|
671
|
-
header: () =>
|
|
702
|
+
header: () => $(
|
|
672
703
|
ae.FmTooltip,
|
|
673
704
|
{ zIndex: 51, placement: "left", class: "w-full flex justify-end" },
|
|
674
705
|
{
|
|
675
706
|
default() {
|
|
676
|
-
return
|
|
707
|
+
return $("div", { class: "flex items-center gap-4" }, [
|
|
677
708
|
"Diff (%)",
|
|
678
|
-
|
|
709
|
+
$(ae.FmIcon, { name: "info", color: "neutral-gray-400", size: "sm" })
|
|
679
710
|
]);
|
|
680
711
|
},
|
|
681
712
|
content() {
|
|
@@ -684,20 +715,20 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
684
715
|
}
|
|
685
716
|
),
|
|
686
717
|
size: 200,
|
|
687
|
-
cell(
|
|
688
|
-
const
|
|
689
|
-
if (!
|
|
690
|
-
const
|
|
691
|
-
if (
|
|
692
|
-
return
|
|
693
|
-
const
|
|
694
|
-
return
|
|
695
|
-
|
|
696
|
-
name:
|
|
697
|
-
color:
|
|
718
|
+
cell(i) {
|
|
719
|
+
const f = i.row.original.adjustedDiffPercentage;
|
|
720
|
+
if (!f) return "N/A";
|
|
721
|
+
const c = f.toFixed(2);
|
|
722
|
+
if (c === "0.00")
|
|
723
|
+
return $("div", { class: "flex items-center gap-4 justify-end" }, ["0.00"]);
|
|
724
|
+
const p = f > 0;
|
|
725
|
+
return $("div", { class: "flex items-center gap-4 justify-end" }, [
|
|
726
|
+
$(ae.FmIcon, {
|
|
727
|
+
name: p ? "arrow_drop_up" : "arrow_drop_down",
|
|
728
|
+
color: p ? "system-success-300" : "system-error-300",
|
|
698
729
|
size: "md"
|
|
699
730
|
}),
|
|
700
|
-
|
|
731
|
+
c
|
|
701
732
|
]);
|
|
702
733
|
},
|
|
703
734
|
meta: {
|
|
@@ -705,56 +736,60 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
705
736
|
}
|
|
706
737
|
}
|
|
707
738
|
];
|
|
708
|
-
}),
|
|
709
|
-
var
|
|
710
|
-
const t = (
|
|
739
|
+
}), J = M(() => K.value.map((a) => a.size ?? 0).reduce((a, t) => a + t)), se = M(() => s.value.map((a) => {
|
|
740
|
+
var G, Q;
|
|
741
|
+
const t = (G = B.value.get(a._id)) == null ? void 0 : G[0], i = ((Q = V.value.get(a._id)) == null ? void 0 : Q[0]) ?? U;
|
|
711
742
|
if (!t)
|
|
712
743
|
return {
|
|
713
744
|
code: a.code,
|
|
714
745
|
name: a.name,
|
|
715
746
|
baseUnit: a.unit.abbrev,
|
|
716
747
|
baseUnitAmount: 0,
|
|
717
|
-
systemBalance: +
|
|
748
|
+
systemBalance: +C(i),
|
|
718
749
|
physicalBalance: 0,
|
|
719
|
-
adjustedAmount: -+
|
|
750
|
+
adjustedAmount: -+C(i),
|
|
720
751
|
adjustedDiffPercentage: -100
|
|
721
752
|
};
|
|
722
|
-
const
|
|
723
|
-
...
|
|
724
|
-
amount: Math.abs(
|
|
725
|
-
}),
|
|
753
|
+
const f = Me(t), c = ke(f, i), p = i.amount === 0 ? null : je(c, {
|
|
754
|
+
...i,
|
|
755
|
+
amount: Math.abs(i.amount)
|
|
756
|
+
}), I = p ? he(p, S) : null;
|
|
726
757
|
return {
|
|
727
758
|
code: a.code,
|
|
728
759
|
name: a.name,
|
|
729
760
|
baseUnit: a.unit.abbrev,
|
|
730
|
-
baseUnitAmount: +
|
|
731
|
-
...t.measurementsAmounts.filter((
|
|
732
|
-
var
|
|
733
|
-
return (
|
|
734
|
-
}).reduce((
|
|
735
|
-
systemBalance: +
|
|
736
|
-
physicalBalance: +
|
|
737
|
-
adjustedAmount: +
|
|
738
|
-
adjustedDiffPercentage:
|
|
761
|
+
baseUnitAmount: +C(t.baseAmount),
|
|
762
|
+
...t.measurementsAmounts.filter((H) => {
|
|
763
|
+
var A, k, z;
|
|
764
|
+
return (z = (k = (A = v.value) == null ? void 0 : A.get(a._id)) == null ? void 0 : k[0]) == null ? void 0 : z.includes(H.measurement.id);
|
|
765
|
+
}).reduce((H, A, k) => (H[`measurementAbbrev${k}`] = `(${A.measurement.abbrev}) × ${C(A.measurement.conversion)}`, H[`measurementAmount${k}`] = +C(A.amount), H), {}),
|
|
766
|
+
systemBalance: +C(i),
|
|
767
|
+
physicalBalance: +C(f),
|
|
768
|
+
adjustedAmount: +C(c),
|
|
769
|
+
adjustedDiffPercentage: I ? +C(Ce(I, 2)) : null
|
|
739
770
|
};
|
|
740
|
-
})), ee =
|
|
741
|
-
var t,
|
|
771
|
+
})), ee = M(() => {
|
|
772
|
+
var t, i, f;
|
|
742
773
|
if (!e.draft) return [];
|
|
743
774
|
const a = e.draft.approvedAt ? {
|
|
744
|
-
action: `Approve at ${
|
|
775
|
+
action: `Approve at ${X(e.draft.approvedAt)}`,
|
|
745
776
|
// actionAt: props.draft.approvedAt,
|
|
746
777
|
actionBy: e.draft.approvedBy,
|
|
747
778
|
remark: e.draft.approveRemark
|
|
748
|
-
} : (t = e.draft.rejectionHistory) == null ? void 0 : t.computeFirst((
|
|
749
|
-
action: `Reject at ${
|
|
779
|
+
} : (t = e.draft.rejectionHistory) == null ? void 0 : t.computeFirst((c) => ({
|
|
780
|
+
action: `Reject at ${X(c.rejectedAt)}`,
|
|
750
781
|
// actionAt: e.rejectedAt,
|
|
751
|
-
actionBy:
|
|
752
|
-
remark:
|
|
782
|
+
actionBy: c.rejectedBy,
|
|
783
|
+
remark: c.rejectRemark
|
|
753
784
|
}));
|
|
754
785
|
return [
|
|
786
|
+
{
|
|
787
|
+
label: "Using template",
|
|
788
|
+
value: ((i = e.draft.usingTemplates.find((c) => c)) == null ? void 0 : i.name) ?? "None"
|
|
789
|
+
},
|
|
755
790
|
{
|
|
756
791
|
label: "Created at",
|
|
757
|
-
value:
|
|
792
|
+
value: X(e.draft.createdAt)
|
|
758
793
|
},
|
|
759
794
|
{
|
|
760
795
|
label: "Created by",
|
|
@@ -762,7 +797,7 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
762
797
|
},
|
|
763
798
|
{
|
|
764
799
|
label: "Updated at",
|
|
765
|
-
value:
|
|
800
|
+
value: X(e.draft.updatedAt)
|
|
766
801
|
},
|
|
767
802
|
{
|
|
768
803
|
label: "Updated by",
|
|
@@ -770,7 +805,7 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
770
805
|
},
|
|
771
806
|
{
|
|
772
807
|
label: "Effective at",
|
|
773
|
-
value:
|
|
808
|
+
value: X(e.draft.effectiveAt ?? e.draft.updatedAt)
|
|
774
809
|
},
|
|
775
810
|
e.draft.remark ? {
|
|
776
811
|
label: "Remark",
|
|
@@ -782,13 +817,13 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
782
817
|
} : null,
|
|
783
818
|
a && a.actionBy ? {
|
|
784
819
|
label: "Last action by",
|
|
785
|
-
value: (
|
|
820
|
+
value: (f = a.actionBy) == null ? void 0 : f.name
|
|
786
821
|
} : null,
|
|
787
822
|
a && a.remark ? {
|
|
788
823
|
label: "Action remark",
|
|
789
824
|
value: a.remark
|
|
790
825
|
} : null
|
|
791
|
-
].filter((
|
|
826
|
+
].filter((c) => c).map((c) => c);
|
|
792
827
|
}), te = [
|
|
793
828
|
{
|
|
794
829
|
label: "Overview",
|
|
@@ -798,97 +833,97 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
798
833
|
label: "Action history",
|
|
799
834
|
value: "history"
|
|
800
835
|
}
|
|
801
|
-
],
|
|
802
|
-
var t,
|
|
836
|
+
], Z = O(te[0]), Y = M(() => {
|
|
837
|
+
var t, i, f, c;
|
|
803
838
|
return [
|
|
804
839
|
...(((t = e.draft) == null ? void 0 : t.rejectionHistory) ?? []).map(
|
|
805
|
-
(
|
|
840
|
+
(p) => ({
|
|
806
841
|
header: "Reject",
|
|
807
|
-
date:
|
|
842
|
+
date: X(p.rejectedAt),
|
|
808
843
|
info: [
|
|
809
844
|
{
|
|
810
845
|
label: "Rejected by",
|
|
811
|
-
values: [
|
|
846
|
+
values: [p.rejectedBy.name]
|
|
812
847
|
},
|
|
813
848
|
{
|
|
814
849
|
label: "Rejection remark",
|
|
815
|
-
values: [
|
|
850
|
+
values: [p.rejectRemark]
|
|
816
851
|
}
|
|
817
852
|
]
|
|
818
853
|
})
|
|
819
854
|
),
|
|
820
|
-
...(
|
|
855
|
+
...(i = e.draft) != null && i.approvedBy ? [
|
|
821
856
|
{
|
|
822
857
|
header: "Approve",
|
|
823
|
-
date: e.draft.approvedAt ?
|
|
858
|
+
date: e.draft.approvedAt ? X(e.draft.approvedAt) : "",
|
|
824
859
|
info: [
|
|
825
860
|
{
|
|
826
861
|
label: "Approved by",
|
|
827
|
-
values: [(
|
|
862
|
+
values: [(f = e.draft) == null ? void 0 : f.approvedBy.name]
|
|
828
863
|
},
|
|
829
864
|
{
|
|
830
865
|
label: "Approval remark",
|
|
831
|
-
values: [((
|
|
866
|
+
values: [((c = e.draft) == null ? void 0 : c.approveRemark) ?? ""]
|
|
832
867
|
}
|
|
833
868
|
]
|
|
834
869
|
}
|
|
835
870
|
] : []
|
|
836
871
|
];
|
|
837
|
-
}), re =
|
|
838
|
-
var
|
|
839
|
-
if (((
|
|
840
|
-
const a = se.value.some((
|
|
872
|
+
}), re = M(() => {
|
|
873
|
+
var c, p, I;
|
|
874
|
+
if (((c = e.draft) == null ? void 0 : c.status) !== oe.enum.DRAFT) return "Status is not draft.";
|
|
875
|
+
const a = se.value.some((j) => j.physicalBalance < 0), t = ((I = (p = u.stockBalance.skus) == null ? void 0 : p.filter((j) => j.balance.amount < 0)) == null ? void 0 : I.map((j) => j.id)) ?? [], i = new Set(s.value.map((j) => j._id)), f = t.filter((j) => !i.has(j)).length;
|
|
841
876
|
return [
|
|
842
877
|
a ? "Negative total exist." : null,
|
|
843
|
-
|
|
844
|
-
].filter((
|
|
878
|
+
f ? "Negative stock is not included in this draft. Reopen draft in POS and apply changes." : null
|
|
879
|
+
].filter((j) => j).join(" ");
|
|
845
880
|
});
|
|
846
881
|
return (a, t) => {
|
|
847
|
-
const
|
|
848
|
-
return _(), ne(
|
|
882
|
+
const i = E("FmButtonGroup"), f = E("FmMenuDivider"), c = E("FmCard"), p = E("FmButton"), I = E("FmCircularProgress"), j = E("FmTable"), G = E("FmSpacer"), Q = E("FmTooltip"), H = E("FmSideSheet");
|
|
883
|
+
return _(), ne(H, {
|
|
849
884
|
"dismiss-away": "",
|
|
850
885
|
"max-width": 900,
|
|
851
|
-
"model-value": h(
|
|
852
|
-
"onUpdate:modelValue": t[6] || (t[6] = (
|
|
886
|
+
"model-value": h(g),
|
|
887
|
+
"onUpdate:modelValue": t[6] || (t[6] = (A) => _e(g) ? g.value = A : null),
|
|
853
888
|
header: "Closing details"
|
|
854
889
|
}, {
|
|
855
890
|
"side-sheet-footer": N(() => {
|
|
856
|
-
var
|
|
891
|
+
var A, k;
|
|
857
892
|
return [
|
|
858
893
|
o("div", Zt, [
|
|
859
|
-
((
|
|
860
|
-
re.value ? (_(), ne(
|
|
894
|
+
((A = e.draft) == null ? void 0 : A.status) === h(oe).enum.DRAFT ? (_(), F(W, { key: 0 }, [
|
|
895
|
+
re.value ? (_(), ne(Q, {
|
|
861
896
|
key: 0,
|
|
862
897
|
"z-index": 51
|
|
863
898
|
}, {
|
|
864
899
|
content: N(() => [
|
|
865
|
-
|
|
900
|
+
ge(L(re.value), 1)
|
|
866
901
|
]),
|
|
867
902
|
default: N(() => [
|
|
868
|
-
D(
|
|
903
|
+
D(p, {
|
|
869
904
|
disabled: "",
|
|
870
905
|
key: "approve key",
|
|
871
906
|
label: "Approve",
|
|
872
|
-
onClick: t[2] || (t[2] = () => e.draft && h(m).approveDraft(e.draft, () =>
|
|
907
|
+
onClick: t[2] || (t[2] = () => e.draft && h(m).approveDraft(e.draft, () => T("submitted")))
|
|
873
908
|
})
|
|
874
909
|
]),
|
|
875
910
|
_: 1
|
|
876
|
-
})) : (_(), ne(
|
|
911
|
+
})) : (_(), ne(p, {
|
|
877
912
|
key: "approve key",
|
|
878
913
|
label: "Approve",
|
|
879
|
-
onClick: t[3] || (t[3] = () => e.draft && h(m).approveDraft(e.draft, () =>
|
|
914
|
+
onClick: t[3] || (t[3] = () => e.draft && h(m).approveDraft(e.draft, () => T("submitted")))
|
|
880
915
|
}))
|
|
881
916
|
], 64)) : le("", !0),
|
|
882
|
-
((
|
|
917
|
+
((k = e.draft) == null ? void 0 : k.status) === h(oe).enum.DRAFT ? (_(), ne(p, {
|
|
883
918
|
key: 1,
|
|
884
919
|
label: "Reject",
|
|
885
920
|
variant: "destructive",
|
|
886
|
-
onClick: t[4] || (t[4] = () => e.draft && h(m).rejectDraft(e.draft, () =>
|
|
921
|
+
onClick: t[4] || (t[4] = () => e.draft && h(m).rejectDraft(e.draft, () => T("submitted")))
|
|
887
922
|
})) : le("", !0),
|
|
888
|
-
D(
|
|
923
|
+
D(p, {
|
|
889
924
|
label: "Close",
|
|
890
925
|
variant: "tertiary",
|
|
891
|
-
onClick: t[5] || (t[5] = (
|
|
926
|
+
onClick: t[5] || (t[5] = (z) => g.value = !1)
|
|
892
927
|
})
|
|
893
928
|
])
|
|
894
929
|
];
|
|
@@ -896,110 +931,110 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
896
931
|
default: N(() => [
|
|
897
932
|
o("div", ht, [
|
|
898
933
|
o("div", null, [
|
|
899
|
-
D(
|
|
934
|
+
D(i, {
|
|
900
935
|
items: te,
|
|
901
|
-
modelValue:
|
|
902
|
-
"onUpdate:modelValue": t[0] || (t[0] = (
|
|
936
|
+
modelValue: Z.value,
|
|
937
|
+
"onUpdate:modelValue": t[0] || (t[0] = (A) => Z.value = A)
|
|
903
938
|
}, null, 8, ["modelValue"])
|
|
904
939
|
]),
|
|
905
|
-
|
|
906
|
-
D(
|
|
940
|
+
Z.value.value === "overview" ? (_(), F(W, { key: 0 }, [
|
|
941
|
+
D(c, {
|
|
907
942
|
variant: "outlined",
|
|
908
943
|
class: "flex flex-col gap-8 px-12 py-16"
|
|
909
944
|
}, {
|
|
910
945
|
default: N(() => {
|
|
911
|
-
var
|
|
946
|
+
var A, k;
|
|
912
947
|
return [
|
|
913
|
-
o("div",
|
|
948
|
+
o("div", At, [
|
|
914
949
|
t[7] || (t[7] = o("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
|
|
915
950
|
o("div", Dt, [
|
|
916
951
|
o("div", {
|
|
917
|
-
class: ie(["fm-status-badge", h(
|
|
918
|
-
},
|
|
952
|
+
class: ie(["fm-status-badge", h(fe)(((A = a.draft) == null ? void 0 : A.status) ?? "DRAFT")])
|
|
953
|
+
}, L(h(Be)(((k = a.draft) == null ? void 0 : k.status) ?? "")), 3)
|
|
919
954
|
])
|
|
920
955
|
]),
|
|
921
|
-
D(
|
|
922
|
-
(_(!0),
|
|
956
|
+
D(f),
|
|
957
|
+
(_(!0), F(W, null, ue(ee.value, (z, ve) => (_(), F("div", {
|
|
923
958
|
class: "flex flex-col gap-4",
|
|
924
|
-
key:
|
|
959
|
+
key: ve
|
|
925
960
|
}, [
|
|
926
|
-
o("div",
|
|
927
|
-
o("div", _t,
|
|
961
|
+
o("div", xt, [
|
|
962
|
+
o("div", _t, L(z.label), 1)
|
|
928
963
|
]),
|
|
929
|
-
o("div", wt,
|
|
964
|
+
o("div", wt, L(z.value), 1)
|
|
930
965
|
]))), 128))
|
|
931
966
|
];
|
|
932
967
|
}),
|
|
933
968
|
_: 1
|
|
934
969
|
}),
|
|
935
970
|
o("div", kt, [
|
|
936
|
-
o("div",
|
|
971
|
+
o("div", jt, [
|
|
937
972
|
t[8] || (t[8] = o("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
|
|
938
|
-
|
|
939
|
-
D(
|
|
973
|
+
x.value ? le("", !0) : (_(), F("div", Ct, [
|
|
974
|
+
D(p, {
|
|
940
975
|
label: "Export data",
|
|
941
976
|
"prepend-icon": "download",
|
|
942
977
|
variant: "secondary",
|
|
943
978
|
"text-color": "primary",
|
|
944
979
|
"bg-color": "transparent",
|
|
945
980
|
"border-color": "primary",
|
|
946
|
-
onClick: t[1] || (t[1] = (
|
|
981
|
+
onClick: t[1] || (t[1] = (A) => a.draft ? h(m).exportDraft(a.draft, l.value) : null)
|
|
947
982
|
})
|
|
948
983
|
]))
|
|
949
984
|
]),
|
|
950
|
-
|
|
985
|
+
x.value ? (_(), F("div", St, [
|
|
951
986
|
t[10] || (t[10] = o("div", { class: "h-80" }, null, -1)),
|
|
952
987
|
o("div", Bt, [
|
|
953
988
|
o("div", null, [
|
|
954
|
-
D(
|
|
989
|
+
D(I, { size: "md" })
|
|
955
990
|
]),
|
|
956
991
|
t[9] || (t[9] = o("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
|
|
957
992
|
]),
|
|
958
993
|
t[11] || (t[11] = o("div", { class: "h-80" }, null, -1))
|
|
959
|
-
])) : (_(),
|
|
994
|
+
])) : (_(), F("div", Ft, [
|
|
960
995
|
o("div", {
|
|
961
|
-
style:
|
|
996
|
+
style: we({ width: `${J.value}px` })
|
|
962
997
|
}, [
|
|
963
|
-
D(
|
|
964
|
-
"column-defs":
|
|
998
|
+
D(j, {
|
|
999
|
+
"column-defs": K.value,
|
|
965
1000
|
"row-data": se.value
|
|
966
1001
|
}, null, 8, ["column-defs", "row-data"])
|
|
967
1002
|
], 4)
|
|
968
1003
|
]))
|
|
969
1004
|
])
|
|
970
1005
|
], 64)) : le("", !0),
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
(_(!0),
|
|
1006
|
+
Z.value.value === "history" ? (_(), F("div", Rt, [
|
|
1007
|
+
Y.value.length ? (_(), F("div", Mt, [
|
|
1008
|
+
(_(!0), F(W, null, ue(Y.value, (A, k) => (_(), F(W, { key: k }, [
|
|
974
1009
|
o("div", Pt, [
|
|
975
1010
|
o("div", It, [
|
|
976
1011
|
o("div", Ut, [
|
|
977
1012
|
o("div", {
|
|
978
1013
|
class: ie([
|
|
979
1014
|
{
|
|
980
|
-
"bg-fm-color-primary":
|
|
981
|
-
"bg-white":
|
|
1015
|
+
"bg-fm-color-primary": k !== 0,
|
|
1016
|
+
"bg-white": k === 0
|
|
982
1017
|
},
|
|
983
1018
|
"w-[2px] h-full"
|
|
984
1019
|
])
|
|
985
1020
|
}, null, 2)
|
|
986
1021
|
]),
|
|
987
1022
|
t[14] || (t[14] = o("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
|
|
988
|
-
o("div",
|
|
1023
|
+
o("div", Ht, [
|
|
989
1024
|
o("div", {
|
|
990
1025
|
class: ie([
|
|
991
1026
|
{
|
|
992
|
-
"bg-fm-color-primary":
|
|
993
|
-
"bg-white":
|
|
1027
|
+
"bg-fm-color-primary": k < Y.value.length - 1,
|
|
1028
|
+
"bg-white": k >= Y.value.length - 1
|
|
994
1029
|
},
|
|
995
1030
|
"w-[2px] h-full"
|
|
996
1031
|
])
|
|
997
1032
|
}, null, 2)
|
|
998
1033
|
])
|
|
999
1034
|
]),
|
|
1000
|
-
o("div",
|
|
1001
|
-
o("div", Et,
|
|
1002
|
-
o("div", Lt,
|
|
1035
|
+
o("div", zt, [
|
|
1036
|
+
o("div", Et, L(A.header), 1),
|
|
1037
|
+
o("div", Lt, L(A.date), 1)
|
|
1003
1038
|
])
|
|
1004
1039
|
]),
|
|
1005
1040
|
o("div", Nt, [
|
|
@@ -1008,8 +1043,8 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
1008
1043
|
o("div", {
|
|
1009
1044
|
class: ie([
|
|
1010
1045
|
{
|
|
1011
|
-
"bg-fm-color-primary":
|
|
1012
|
-
"bg-white":
|
|
1046
|
+
"bg-fm-color-primary": k < Y.value.length - 1,
|
|
1047
|
+
"bg-white": k >= Y.value.length - 1
|
|
1013
1048
|
},
|
|
1014
1049
|
"w-[2px] h-full"
|
|
1015
1050
|
])
|
|
@@ -1017,22 +1052,22 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
1017
1052
|
])
|
|
1018
1053
|
]),
|
|
1019
1054
|
o("div", Kt, [
|
|
1020
|
-
D(
|
|
1055
|
+
D(c, {
|
|
1021
1056
|
variant: "outlined",
|
|
1022
1057
|
class: "py-12 px-16"
|
|
1023
1058
|
}, {
|
|
1024
1059
|
default: N(() => [
|
|
1025
1060
|
o("div", Yt, [
|
|
1026
|
-
(_(!0),
|
|
1027
|
-
key:
|
|
1061
|
+
(_(!0), F(W, null, ue(A.info, (z, ve) => (_(), F("div", {
|
|
1062
|
+
key: ve,
|
|
1028
1063
|
class: "flex flex-col gap-4"
|
|
1029
1064
|
}, [
|
|
1030
|
-
o("div", Gt,
|
|
1065
|
+
o("div", Gt, L(z == null ? void 0 : z.label), 1),
|
|
1031
1066
|
o("div", qt, [
|
|
1032
|
-
(_(!0),
|
|
1067
|
+
(_(!0), F(W, null, ue(z == null ? void 0 : z.values, (Ie, Ue) => (_(), F("div", {
|
|
1033
1068
|
key: Ue,
|
|
1034
1069
|
class: "fm-typo-en-body-lg-600"
|
|
1035
|
-
},
|
|
1070
|
+
}, L(Ie), 1))), 128))
|
|
1036
1071
|
])
|
|
1037
1072
|
]))), 128))
|
|
1038
1073
|
])
|
|
@@ -1042,18 +1077,18 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
1042
1077
|
])
|
|
1043
1078
|
])
|
|
1044
1079
|
], 64))), 128))
|
|
1045
|
-
])) : (_(),
|
|
1046
|
-
D(
|
|
1080
|
+
])) : (_(), F("div", $t, [
|
|
1081
|
+
D(G),
|
|
1047
1082
|
o("div", null, [
|
|
1048
1083
|
o("img", {
|
|
1049
1084
|
src: h(lt),
|
|
1050
1085
|
alt: "List is empty"
|
|
1051
1086
|
}, null, 8, Tt)
|
|
1052
1087
|
]),
|
|
1053
|
-
t[12] || (t[12] = o("div", { class: "fm-typo-en-body-lg-600" },
|
|
1054
|
-
t[13] || (t[13] = o("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" },
|
|
1055
|
-
D(
|
|
1056
|
-
D(
|
|
1088
|
+
t[12] || (t[12] = o("div", { class: "fm-typo-en-body-lg-600" }, L("No records found"), -1)),
|
|
1089
|
+
t[13] || (t[13] = o("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, L("You can track approval and rejection history here"), -1)),
|
|
1090
|
+
D(G),
|
|
1091
|
+
D(G)
|
|
1057
1092
|
]))
|
|
1058
1093
|
])) : le("", !0)
|
|
1059
1094
|
])
|
|
@@ -1062,22 +1097,22 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
1062
1097
|
}, 8, ["model-value"]);
|
|
1063
1098
|
};
|
|
1064
1099
|
}
|
|
1065
|
-
}), Xt = { class: "flex-1 flex flex-col gap-8" }, Jt = { class: "flex flex-col" }, Qt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ea = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, ta = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, aa = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, ua = /* @__PURE__ */
|
|
1100
|
+
}), Xt = { class: "flex-1 flex flex-col gap-8" }, Jt = { class: "flex flex-col" }, Qt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ea = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, ta = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, aa = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, ua = /* @__PURE__ */ ye({
|
|
1066
1101
|
__name: "ClosingDraftView",
|
|
1067
1102
|
setup(n) {
|
|
1068
|
-
const { t: d } =
|
|
1069
|
-
|
|
1070
|
-
const
|
|
1071
|
-
function s(
|
|
1072
|
-
switch (
|
|
1103
|
+
const { t: d } = Fe(), { viewDraft: e } = pe(), { viewClosingDraftProps: u, viewClosingDraftShow: m } = rt(pe()), g = be(), x = bt(), l = Je(), { breakpoints: b } = st();
|
|
1104
|
+
g.watchLocation(x.fetchDrafts);
|
|
1105
|
+
const R = M(() => x.loading), P = O(""), T = M(() => b.value.xs || b.value.sm), r = M(() => T.value ? 10 : 20);
|
|
1106
|
+
function s(S) {
|
|
1107
|
+
switch (S) {
|
|
1073
1108
|
case "refresh":
|
|
1074
|
-
return
|
|
1109
|
+
return x.fetchDrafts();
|
|
1075
1110
|
}
|
|
1076
1111
|
}
|
|
1077
|
-
function
|
|
1078
|
-
return
|
|
1112
|
+
function v(S) {
|
|
1113
|
+
return S;
|
|
1079
1114
|
}
|
|
1080
|
-
const
|
|
1115
|
+
const U = M(() => T.value ? [
|
|
1081
1116
|
{
|
|
1082
1117
|
label: "Refresh",
|
|
1083
1118
|
value: "refresh",
|
|
@@ -1090,12 +1125,12 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
1090
1125
|
isPrimary: !1
|
|
1091
1126
|
}
|
|
1092
1127
|
]);
|
|
1093
|
-
return (
|
|
1094
|
-
const
|
|
1095
|
-
return _(),
|
|
1128
|
+
return (S, w) => {
|
|
1129
|
+
const V = E("FmTable");
|
|
1130
|
+
return _(), F(W, null, [
|
|
1096
1131
|
D(Qe, {
|
|
1097
1132
|
title: h(d)("inventory.closing.draft.title"),
|
|
1098
|
-
actions:
|
|
1133
|
+
actions: U.value,
|
|
1099
1134
|
"onClick:action": s
|
|
1100
1135
|
}, {
|
|
1101
1136
|
default: N(() => [
|
|
@@ -1103,63 +1138,63 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
1103
1138
|
class: ie([
|
|
1104
1139
|
"flex flex-col gap-8 max-h-full",
|
|
1105
1140
|
{
|
|
1106
|
-
"p-0":
|
|
1107
|
-
"px-24 ": !
|
|
1141
|
+
"p-0": T.value,
|
|
1142
|
+
"px-24 ": !T.value
|
|
1108
1143
|
}
|
|
1109
1144
|
])
|
|
1110
1145
|
}, [
|
|
1111
1146
|
D(et, {
|
|
1112
1147
|
"change-location": "",
|
|
1113
1148
|
searchable: "",
|
|
1114
|
-
search:
|
|
1115
|
-
"onUpdate:search":
|
|
1149
|
+
search: P.value,
|
|
1150
|
+
"onUpdate:search": w[0] || (w[0] = (B) => P.value = B)
|
|
1116
1151
|
}, null, 8, ["search"]),
|
|
1117
|
-
D(
|
|
1118
|
-
style:
|
|
1119
|
-
"column-defs": h(
|
|
1120
|
-
"row-data": h(
|
|
1121
|
-
"search-value":
|
|
1122
|
-
loading:
|
|
1123
|
-
onRowClick:
|
|
1152
|
+
D(V, {
|
|
1153
|
+
style: we(h(l).tableHeight),
|
|
1154
|
+
"column-defs": h(x).columnDefs,
|
|
1155
|
+
"row-data": h(x).drafts,
|
|
1156
|
+
"search-value": P.value,
|
|
1157
|
+
loading: R.value,
|
|
1158
|
+
onRowClick: w[1] || (w[1] = (B) => h(e)(B.original)),
|
|
1124
1159
|
"page-size": r.value
|
|
1125
1160
|
}, {
|
|
1126
|
-
"list-row": N((
|
|
1161
|
+
"list-row": N((B) => [
|
|
1127
1162
|
D(tt, {
|
|
1128
|
-
row:
|
|
1129
|
-
onRowClick: (
|
|
1163
|
+
row: B,
|
|
1164
|
+
onRowClick: (y) => h(e)(y)
|
|
1130
1165
|
}, {
|
|
1131
|
-
default: N((
|
|
1132
|
-
var
|
|
1166
|
+
default: N((y) => {
|
|
1167
|
+
var K, J, se, ee, te, Z, Y, re, a, t, i, f, c, p, I, j, G, Q, H, A;
|
|
1133
1168
|
return [
|
|
1134
1169
|
o("div", Xt, [
|
|
1135
1170
|
o("div", Jt, [
|
|
1136
1171
|
o("div", Qt, [
|
|
1137
1172
|
D(h(me), {
|
|
1138
|
-
render: (se = (
|
|
1139
|
-
props: (te = (ee =
|
|
1173
|
+
render: (se = (J = (K = y._id) == null ? void 0 : K.column) == null ? void 0 : J.columnDef) == null ? void 0 : se.cell,
|
|
1174
|
+
props: (te = (ee = y._id) == null ? void 0 : ee.getContext) == null ? void 0 : te.call(ee)
|
|
1140
1175
|
}, null, 8, ["render", "props"])
|
|
1141
1176
|
]),
|
|
1142
1177
|
o("div", ea, [
|
|
1143
1178
|
D(h(me), {
|
|
1144
|
-
render: (re = (
|
|
1145
|
-
props: (t = (a =
|
|
1179
|
+
render: (re = (Y = (Z = y.name) == null ? void 0 : Z.column) == null ? void 0 : Y.columnDef) == null ? void 0 : re.cell,
|
|
1180
|
+
props: (t = (a = y.name) == null ? void 0 : a.getContext) == null ? void 0 : t.call(a)
|
|
1146
1181
|
}, null, 8, ["render", "props"])
|
|
1147
1182
|
]),
|
|
1148
|
-
o("div", ta,
|
|
1149
|
-
|
|
1150
|
-
|
|
1183
|
+
o("div", ta, L([
|
|
1184
|
+
...B.original.items.slice(0, 3).map((k) => k.sku.name),
|
|
1185
|
+
...B.original.items.length >= 3 ? [`and ${B.original.items.length - 3} more items`] : []
|
|
1151
1186
|
].join(", ")), 1),
|
|
1152
1187
|
o("div", aa, [
|
|
1153
1188
|
D(h(me), {
|
|
1154
|
-
render: (
|
|
1155
|
-
props: (
|
|
1189
|
+
render: (c = (f = (i = y.ref) == null ? void 0 : i.column) == null ? void 0 : f.columnDef) == null ? void 0 : c.cell,
|
|
1190
|
+
props: (I = (p = y.ref) == null ? void 0 : p.getContext) == null ? void 0 : I.call(p)
|
|
1156
1191
|
}, null, 8, ["render", "props"])
|
|
1157
1192
|
])
|
|
1158
1193
|
]),
|
|
1159
1194
|
o("div", null, [
|
|
1160
1195
|
D(h(me), {
|
|
1161
|
-
render: (
|
|
1162
|
-
props: (
|
|
1196
|
+
render: (Q = (G = (j = y.status) == null ? void 0 : j.column) == null ? void 0 : G.columnDef) == null ? void 0 : Q.cell,
|
|
1197
|
+
props: (A = (H = y.status) == null ? void 0 : H.getContext) == null ? void 0 : A.call(H)
|
|
1163
1198
|
}, null, 8, ["render", "props"])
|
|
1164
1199
|
])
|
|
1165
1200
|
])
|
|
@@ -1177,8 +1212,8 @@ const bt = Fe("closingDraftTable", function() {
|
|
|
1177
1212
|
(_(), ne(Ee, { to: "body" }, [
|
|
1178
1213
|
D(Wt, Le(h(u), {
|
|
1179
1214
|
show: h(m),
|
|
1180
|
-
"onUpdate:show":
|
|
1181
|
-
onSubmitted:
|
|
1215
|
+
"onUpdate:show": w[2] || (w[2] = (B) => _e(m) ? m.value = B : null),
|
|
1216
|
+
onSubmitted: w[3] || (w[3] = () => (m.value = !1, h(x).fetchDrafts()))
|
|
1182
1217
|
}), null, 16, ["show"])
|
|
1183
1218
|
]))
|
|
1184
1219
|
], 64);
|