@feedmepos/mf-inventory-portal 1.2.46-dev.2 → 1.2.46-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-DMaG_oAE.js → App-EK7lJDXt.js} +3 -3
- package/dist/{ApprovalView-BjLxJ1au.js → ApprovalView-5wa67Pp2.js} +5 -5
- package/dist/{BindingsDialog-C4Uxwoka.js → BindingsDialog-DNvqgfca.js} +2 -2
- package/dist/{BindingsPicker-BVgES0gy.js → BindingsPicker-B0In-fby.js} +2 -2
- package/dist/{BindingsTable-C4VcFxrj.js → BindingsTable-Dnj3lmqy.js} +3 -3
- package/dist/{ClosingDraftView-wArgE2um.js → ClosingDraftView-DMeJEGFR.js} +481 -480
- package/dist/{ClosingHistoryView-C1szWalX.js → ClosingHistoryView-CIzyFAlH.js} +3 -3
- package/dist/{ClosingTemplateView-C4Rd9GV-.js → ClosingTemplateView-6HX9oUcC.js} +14 -14
- package/dist/{DeliveryOrderPrintPreview-DWm_MrKB.js → DeliveryOrderPrintPreview-MWn3Ar1T.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DL8olW4F.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-C7YYLOYE.js} +4 -4
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-wcHAgT4a.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CQiU_sGW.js} +2 -2
- package/dist/{FmMultiselectDialog-BYAqA8l3.js → FmMultiselectDialog-BkjI4JGz.js} +1 -1
- package/dist/{FmMultiselectDialog-BKDKVNRn.js → FmMultiselectDialog-CtiU1Dtg.js} +2 -2
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BjIiy2y9.js → FmUnitInput.vue_vue_type_script_setup_true_lang-LyzPCbxS.js} +3 -3
- package/dist/{ImportView-Bb0I7-6I.js → ImportView-7iS_eKvv.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-B_SPL6nR.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BgY8Q64y.js} +1 -1
- package/dist/{IngredientGroupView-Du6mfcHB.js → IngredientGroupView-_U4bC7ki.js} +5 -5
- package/dist/{IngredientsView-CdV_l4WL.js → IngredientsView-vNdlqPpT.js} +14 -14
- package/dist/{IntegrationView-BBThO3R6.js → IntegrationView-cWl5050X.js} +12 -12
- package/dist/{InventoryBindingForm-AFwbVjGn.js → InventoryBindingForm-Bze5ZhbJ.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-wkB8LH6e.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CouXpFs-.js} +4 -4
- package/dist/{InventoryBindingSummary-BWr95tMD.js → InventoryBindingSummary-4bU5QfqT.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CxRvNVCT.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BpELQhv-.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-C6ZZjlbX.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CG5hkfB7.js} +2 -2
- package/dist/{PublishView-DaSoDd78.js → PublishView-Dl2oTfzU.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-DkvvSOcn.js → PurchaseOrderPrintPreview-GQjxju0E.js} +1 -1
- package/dist/{ReceiveRequestView-DwCpf9HO.js → ReceiveRequestView-B9aW_X5r.js} +18 -18
- package/dist/{RecipeView-3q0RzrRu.js → RecipeView-BRtYb-YG.js} +8 -8
- package/dist/{StockView-BcwnAz29.js → StockView-BA2ZFlTp.js} +15 -15
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang--6RZqwlj.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-g4FkX2mO.js} +1 -1
- package/dist/{SupplierView-kgYYQXjG.js → SupplierView-CmvDHCn1.js} +11 -11
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-CPkQZhpK.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-COP5SYtT.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DBktBW0y.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Cs93Vtov.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-B1RjR9N2.js → TransferDetails.vue_vue_type_script_setup_true_lang-De-0zviY.js} +14 -14
- package/dist/{TransferTemplateView-D_vP4vX_.js → TransferTemplateView-CJnlocMY.js} +15 -15
- package/dist/{UnitView-B-F6FFBx.js → UnitView-BL9YToD9.js} +6 -6
- package/dist/{WarehouseView-nFYZEjok.js → WarehouseView-C83stFZt.js} +5 -5
- package/dist/{WastageTemplateView-C8m40mTv.js → WastageTemplateView-BBZH-mKL.js} +14 -14
- package/dist/{app-Bjay8ZJ5.js → app-C41vbTKc.js} +7 -7
- package/dist/app.js +1 -1
- package/dist/{closing-template-D0V1OlDn.js → closing-template-Cgnip54N.js} +1 -1
- package/dist/{date2-B_lTiq7I.js → date2-CMZo42ry.js} +1 -1
- package/dist/{dayjs.min-DPBuQbfU.js → dayjs.min-VxvOpK4l.js} +1 -1
- package/dist/{decimal-xh0ZYCgf.js → decimal-Bny34Eba.js} +2 -2
- package/dist/{defineDeepModel-DAazpA4v.js → defineDeepModel-BAFlxgb7.js} +1 -1
- package/dist/{duplicate-template-DwXLpIlM.js → duplicate-template-BtuFXv7t.js} +1 -1
- package/dist/{feature-D79cNqw0.js → feature-DLwvVno7.js} +2 -2
- package/dist/{format-time-from-id-hy7GW498.js → format-time-from-id-CZXW775p.js} +1 -1
- package/dist/{format-unit-display-B7Pze8NK.js → format-unit-display-DuO3ios0.js} +10 -10
- package/dist/{import-export.helper-CA0D_5pE.js → import-export.helper-C_pu3Vto.js} +5 -5
- package/dist/{index-B1FuuUp7.js → index-B0PBI5Di.js} +1 -1
- package/dist/{index-D1G1ld2q.js → index-BprWbUJy.js} +1 -1
- package/dist/{index-BTnLxNd6.js → index-GSUBHLP8.js} +3 -3
- package/dist/{lodash-B1jOpPp1.js → lodash-hzb22w2h.js} +1 -1
- package/dist/{netsuite-CiMJPNpA.js → netsuite-yK572svg.js} +3 -3
- package/dist/{purchase-order-template-DjW49Dno.js → purchase-order-template-CAmTt86P.js} +1 -1
- package/dist/{rules-DjxvXDCJ.js → rules-D2ifX1qj.js} +3 -3
- package/dist/{stock-CDJQ4ioF.js → stock-BS7XBKNg.js} +1 -1
- package/dist/{stock-CDjjsIcF.js → stock-S6w8LDdV.js} +3 -3
- package/dist/{supplier-YSyo165N.js → supplier-CAFKaGyu.js} +2 -2
- package/dist/{use-ingredient-select-dialog-BMoC2DMg.js → use-ingredient-select-dialog-DuNV0Qev.js} +2 -2
- package/dist/{use-inventory-binding-dialog-CulgXM4W.js → use-inventory-binding-dialog-CXnHmvy1.js} +2 -2
- package/dist/{use-template-enabled-locations-2-dBtK63b9.js → use-template-enabled-locations-2-gzV64awF.js} +2 -2
- package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +3 -3
- package/dist/{vue-i18n-vRV47l8x.js → vue-i18n-ChDJFBbd.js} +321 -321
- package/dist/{xlsx-BG4nXAfB.js → xlsx-RW9YZaa8.js} +398 -398
- package/dist/{xlsx.util-DZQY0lcX.js → xlsx.util-D-mF9Cdj.js} +1 -1
- package/package.json +2 -2
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { defineComponent as Re, ref as Y, computed as M, onMounted as et, resolveComponent as K, openBlock as
|
|
1
|
+
import { defineComponent as Re, ref as Y, computed as M, onMounted as et, resolveComponent as K, openBlock as F, createElementBlock as P, Fragment as oe, createTextVNode as re, createBlock as ce, withCtx as O, createElementVNode as s, toDisplayString as Z, unref as g, createVNode as k, createCommentVNode as J, h as B, watch as ze, renderList as $e, reactive as Mt, isRef as bt, normalizeClass as Be, normalizeStyle as ht, Teleport as Lt, mergeProps as Nt } from "vue";
|
|
2
2
|
import { F as Je, u as Et, _ as zt } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
|
|
3
3
|
import { useCoreStore as kt, useI18n as _t } from "@feedmepos/mf-common";
|
|
4
4
|
import { useSnackbar as tt, useDialog as Ht, components as ge, useProxiedModel as Ot, useBreakpoints as Kt } from "@feedmepos/ui-library";
|
|
5
|
-
import { o as Yt, u as
|
|
5
|
+
import { o as Yt, u as qe, I as Q, s as E, J as Dt, K as be, A as He, v as Oe, c as Qt, a as qt } from "./app-C41vbTKc.js";
|
|
6
6
|
import { defineStore as xt, storeToRefs as Gt } from "pinia";
|
|
7
|
-
import { d as
|
|
8
|
-
import { R as Zt, f as at, a as Xe, t as Jt, d as Ue, o as
|
|
9
|
-
import { b as ea, d as ta } from "./xlsx.util-
|
|
10
|
-
import { u as
|
|
11
|
-
import { u as nt } from "./stock-
|
|
12
|
-
import { D as yt, R as
|
|
13
|
-
import { c as aa, _ as na, F as
|
|
14
|
-
import { f as oa } from "./format-time-from-id-
|
|
15
|
-
import { _ as sa } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-
|
|
7
|
+
import { d as Ye, e as At, f as Wt, a as ye } from "./date2-CMZo42ry.js";
|
|
8
|
+
import { R as Zt, f as at, a as Xe, t as Jt, d as Ue, o as St, p as wt, m as Ft, l as Xt } from "./rules-D2ifX1qj.js";
|
|
9
|
+
import { b as ea, d as ta } from "./xlsx.util-D-mF9Cdj.js";
|
|
10
|
+
import { u as Ct } from "./stock-S6w8LDdV.js";
|
|
11
|
+
import { u as nt } from "./stock-BS7XBKNg.js";
|
|
12
|
+
import { D as yt, R as Ce } from "./row-action.enum-BcW_L_nE.js";
|
|
13
|
+
import { c as aa, _ as na, F as Ee } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-cfFHDIwQ.js";
|
|
14
|
+
import { f as oa } from "./format-time-from-id-CZXW775p.js";
|
|
15
|
+
import { _ as sa } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CQiU_sGW.js";
|
|
16
16
|
import { E as ra } from "./empty-placeholder-wf6-BWE8.js";
|
|
17
|
-
import { u as la } from "./vue-i18n-
|
|
18
|
-
const
|
|
17
|
+
import { u as la } from "./vue-i18n-ChDJFBbd.js";
|
|
18
|
+
const Ge = Yt((i, r) => {
|
|
19
19
|
function e() {
|
|
20
|
-
return
|
|
20
|
+
return qe().currentLocation.dbName;
|
|
21
21
|
}
|
|
22
22
|
return {
|
|
23
23
|
async getDraft(d) {
|
|
24
|
-
const _ = e(), y = `${
|
|
24
|
+
const _ = e(), y = `${i.inventoryBackendUrl}/${_}/closing-draft/${d}`;
|
|
25
25
|
return r.get(y);
|
|
26
26
|
},
|
|
27
27
|
async readDrafts() {
|
|
28
|
-
const d = e(), _ = `${
|
|
28
|
+
const d = e(), _ = `${i.inventoryBackendUrl}/${d}/closing-draft`;
|
|
29
29
|
return r.get(_);
|
|
30
30
|
},
|
|
31
31
|
async runOperation(d) {
|
|
32
|
-
const _ = e(), y = `${
|
|
32
|
+
const _ = e(), y = `${i.inventoryBackendUrl}/${_}/closing-draft/run-operation`;
|
|
33
33
|
return r.post(y, d);
|
|
34
34
|
},
|
|
35
35
|
async runOperationV1(d) {
|
|
36
|
-
const _ = e(), y = `${
|
|
36
|
+
const _ = e(), y = `${i.inventoryBackendUrl}/${_}/closing-draft/v1/run-operation`;
|
|
37
37
|
return r.post(y, d);
|
|
38
38
|
},
|
|
39
39
|
async sync(d) {
|
|
40
|
-
const _ = e(), y = `${
|
|
40
|
+
const _ = e(), y = `${i.inventoryBackendUrl}/${_}/closing-draft/sync`;
|
|
41
41
|
return r.post(y, d);
|
|
42
42
|
},
|
|
43
43
|
async cloneDraft(d) {
|
|
44
|
-
const _ = e(), y = `${
|
|
44
|
+
const _ = e(), y = `${i.inventoryBackendUrl}/${_}/closing-draft/${d}/clone`;
|
|
45
45
|
return r.post(y, {});
|
|
46
46
|
}
|
|
47
47
|
};
|
|
@@ -59,8 +59,8 @@ const qe = Yt((c, r) => {
|
|
|
59
59
|
onCancel: { type: Function },
|
|
60
60
|
onFinished: { type: Function }
|
|
61
61
|
},
|
|
62
|
-
setup(
|
|
63
|
-
const r =
|
|
62
|
+
setup(i) {
|
|
63
|
+
const r = i, e = Y(), d = Ge(), _ = tt(), y = Y(!1), f = Y(null), j = Y(!1), V = M(() => {
|
|
64
64
|
switch (r.action) {
|
|
65
65
|
case Q.enum.approveDraft:
|
|
66
66
|
return "Approve";
|
|
@@ -70,7 +70,7 @@ const qe = Yt((c, r) => {
|
|
|
70
70
|
return "Mark as Failed";
|
|
71
71
|
}
|
|
72
72
|
throw new Error(`Unknown action: ${r.action}`);
|
|
73
|
-
}),
|
|
73
|
+
}), T = M(() => {
|
|
74
74
|
switch (r.action) {
|
|
75
75
|
case Q.enum.approveDraft:
|
|
76
76
|
return "primary";
|
|
@@ -88,11 +88,11 @@ const qe = Yt((c, r) => {
|
|
|
88
88
|
const m = new Date(r.draft.createdAt);
|
|
89
89
|
m.setHours(23, 59, 59, 999), f.value = m;
|
|
90
90
|
}
|
|
91
|
-
|
|
91
|
+
j.value = !0;
|
|
92
92
|
});
|
|
93
93
|
const x = M({
|
|
94
94
|
get() {
|
|
95
|
-
return f.value === null ? "" :
|
|
95
|
+
return f.value === null ? "" : Ye(f.value);
|
|
96
96
|
},
|
|
97
97
|
set(m) {
|
|
98
98
|
if (m) {
|
|
@@ -148,8 +148,8 @@ const qe = Yt((c, r) => {
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
return (m, t) => {
|
|
151
|
-
const S = K("FmLabel"),
|
|
152
|
-
return
|
|
151
|
+
const S = K("FmLabel"), R = K("FmDatePicker"), z = K("FmTimePicker"), h = K("FmTextField"), p = K("FmButton"), w = K("FmForm");
|
|
152
|
+
return j.value ? (F(), ce(w, {
|
|
153
153
|
key: 1,
|
|
154
154
|
onValidationSuccess: W,
|
|
155
155
|
class: "flex flex-col gap-32",
|
|
@@ -157,25 +157,25 @@ const qe = Yt((c, r) => {
|
|
|
157
157
|
}, {
|
|
158
158
|
default: O(() => [
|
|
159
159
|
s("div", ia, [
|
|
160
|
-
t[5] || (t[5] =
|
|
161
|
-
s("span", ca, Z(
|
|
162
|
-
t[6] || (t[6] =
|
|
160
|
+
t[5] || (t[5] = re(" You are about to ")),
|
|
161
|
+
s("span", ca, Z(V.value), 1),
|
|
162
|
+
t[6] || (t[6] = re(" this draft. Please provide a remark to justify this action. "))
|
|
163
163
|
]),
|
|
164
|
-
m.action === g(Q).enum.approveDraft ? (
|
|
164
|
+
m.action === g(Q).enum.approveDraft ? (F(), P("div", ua, [
|
|
165
165
|
k(S, { class: "fm-typo-en-body-lg-600" }, {
|
|
166
166
|
default: O(() => t[7] || (t[7] = [
|
|
167
|
-
|
|
167
|
+
re("Closing Date")
|
|
168
168
|
])),
|
|
169
169
|
_: 1
|
|
170
170
|
}),
|
|
171
|
-
k(
|
|
171
|
+
k(R, {
|
|
172
172
|
modelValue: x.value,
|
|
173
173
|
"onUpdate:modelValue": t[0] || (t[0] = (H) => x.value = H),
|
|
174
|
-
max: g(
|
|
174
|
+
max: g(Ye)(/* @__PURE__ */ new Date())
|
|
175
175
|
}, null, 8, ["modelValue", "max"]),
|
|
176
176
|
k(S, { class: "fm-typo-en-body-lg-600" }, {
|
|
177
177
|
default: O(() => t[8] || (t[8] = [
|
|
178
|
-
|
|
178
|
+
re("Closing Time")
|
|
179
179
|
])),
|
|
180
180
|
_: 1
|
|
181
181
|
}),
|
|
@@ -183,7 +183,7 @@ const qe = Yt((c, r) => {
|
|
|
183
183
|
modelValue: D.value,
|
|
184
184
|
"onUpdate:modelValue": t[1] || (t[1] = (H) => D.value = H)
|
|
185
185
|
}, null, 8, ["modelValue"]),
|
|
186
|
-
I.value ? (
|
|
186
|
+
I.value ? (F(), P("div", da, " Cannot select future date ")) : J("", !0)
|
|
187
187
|
])) : J("", !0),
|
|
188
188
|
k(h, {
|
|
189
189
|
modelValue: e.value,
|
|
@@ -198,13 +198,13 @@ const qe = Yt((c, r) => {
|
|
|
198
198
|
variant: "tertiary",
|
|
199
199
|
onClick: t[3] || (t[3] = (H) => m.onCancel())
|
|
200
200
|
}),
|
|
201
|
-
m.action === g(Q).enum.approveDraft ? (
|
|
201
|
+
m.action === g(Q).enum.approveDraft ? (F(), ce(Je, { key: 0 }, {
|
|
202
202
|
default: O(() => [
|
|
203
203
|
k(p, {
|
|
204
204
|
label: "Approve (Legacy)",
|
|
205
205
|
type: "button",
|
|
206
206
|
onClick: t[4] || (t[4] = (H) => W(!0)),
|
|
207
|
-
variant:
|
|
207
|
+
variant: T.value,
|
|
208
208
|
loading: y.value,
|
|
209
209
|
disabled: I.value
|
|
210
210
|
}, null, 8, ["variant", "loading", "disabled"])
|
|
@@ -212,58 +212,58 @@ const qe = Yt((c, r) => {
|
|
|
212
212
|
_: 1
|
|
213
213
|
})) : J("", !0),
|
|
214
214
|
k(p, {
|
|
215
|
-
label:
|
|
215
|
+
label: V.value,
|
|
216
216
|
type: "submit",
|
|
217
|
-
variant:
|
|
217
|
+
variant: T.value,
|
|
218
218
|
loading: y.value
|
|
219
219
|
}, null, 8, ["label", "variant", "loading"])
|
|
220
220
|
])
|
|
221
221
|
]),
|
|
222
222
|
_: 1
|
|
223
|
-
}, 8, ["disabled"])) : (
|
|
224
|
-
|
|
223
|
+
}, 8, ["disabled"])) : (F(), P(oe, { key: 0 }, [
|
|
224
|
+
re("Loading")
|
|
225
225
|
], 64));
|
|
226
226
|
};
|
|
227
227
|
}
|
|
228
228
|
}), fa = Ue(0);
|
|
229
|
-
function $t(
|
|
230
|
-
const r =
|
|
231
|
-
var
|
|
232
|
-
const y = ((
|
|
229
|
+
function $t(i) {
|
|
230
|
+
const r = i.measurementsAmounts.groupBy((d) => d.measurement.id), e = i.sku.unit.measurements.reduce((d, _) => {
|
|
231
|
+
var j, V;
|
|
232
|
+
const y = ((V = (j = r.get(_.id)) == null ? void 0 : j[0]) == null ? void 0 : V.amount) ?? fa, f = at(_.conversion, y);
|
|
233
233
|
return d + +Xe(f);
|
|
234
|
-
}, +Xe(
|
|
235
|
-
return Jt(e,
|
|
234
|
+
}, +Xe(i.baseAmount));
|
|
235
|
+
return Jt(e, i.baseAmount.precision);
|
|
236
236
|
}
|
|
237
237
|
const pa = Ue(0), va = Ue(100), Bt = "N/A";
|
|
238
|
-
function ga(
|
|
239
|
-
var q,
|
|
240
|
-
const f = $t(
|
|
238
|
+
function ga(i, r, e, d, _, y) {
|
|
239
|
+
var q, C, b, G, ne;
|
|
240
|
+
const f = $t(i), j = d ?? f, V = St(j, r), T = r.amount === 0 ? null : wt(V, {
|
|
241
241
|
...r,
|
|
242
242
|
amount: Math.abs(r.amount)
|
|
243
|
-
}), x =
|
|
243
|
+
}), x = T ? at(T, va) : null, D = ((q = i.sku.defaultCost) == null ? void 0 : q.costPerUnit) ?? { amount: 0, precision: 0 }, I = Number(E.toFormatString({ value: D })), W = ((b = (C = i.sku.defaultCost) == null ? void 0 : C.measurement) == null ? void 0 : b.conversion) ?? {
|
|
244
244
|
amount: 1,
|
|
245
245
|
precision: 0
|
|
246
246
|
}, m = Number(
|
|
247
247
|
E.toFormatString({ value: W })
|
|
248
|
-
), t = _ ? Number(E.toFormatString({ value: _ })) : 0, S = Number(E.toFormatString({ value: r })),
|
|
248
|
+
), t = _ ? Number(E.toFormatString({ value: _ })) : 0, S = Number(E.toFormatString({ value: r })), R = Number(E.toFormatString({ value: j })), z = S - R, h = z * I / m, p = R * I / m, w = S * I / m;
|
|
249
249
|
return {
|
|
250
|
-
code:
|
|
251
|
-
name:
|
|
252
|
-
baseUnit:
|
|
253
|
-
costUnit: ((ne = (G =
|
|
254
|
-
baseUnitAmount: Number(E.toFormatString({ value:
|
|
255
|
-
...
|
|
256
|
-
(
|
|
250
|
+
code: i.sku.code,
|
|
251
|
+
name: i.sku.name,
|
|
252
|
+
baseUnit: i.sku.unit.abbrev,
|
|
253
|
+
costUnit: ((ne = (G = i.sku.defaultCost) == null ? void 0 : G.measurement) == null ? void 0 : ne.abbrev) ?? null,
|
|
254
|
+
baseUnitAmount: Number(E.toFormatString({ value: i.baseAmount })),
|
|
255
|
+
...i.measurementsAmounts.filter(
|
|
256
|
+
(se) => ya(se.measurement) && e.includes(se.measurement.id)
|
|
257
257
|
).reduce(
|
|
258
|
-
(
|
|
258
|
+
(se, le, me) => (se[`measurementAbbrev${me}`] = `(${le.measurement.abbrev}) × ${E.toFormatString({ value: le.measurement.conversion })}`, se[`measurementAmount${me}`] = Number(E.toFormatString({ value: le.amount })), se),
|
|
259
259
|
{}
|
|
260
260
|
),
|
|
261
261
|
systemBalance: S,
|
|
262
|
-
physicalBalance:
|
|
263
|
-
adjustedAmount: Number(E.toFormatString({ value:
|
|
262
|
+
physicalBalance: R,
|
|
263
|
+
adjustedAmount: Number(E.toFormatString({ value: V })),
|
|
264
264
|
adjustedDiffPercentage: x ? Number(
|
|
265
265
|
E.toFormatString({
|
|
266
|
-
value:
|
|
266
|
+
value: Ft(x, 2)
|
|
267
267
|
})
|
|
268
268
|
) : null,
|
|
269
269
|
costPerUnit: I,
|
|
@@ -272,15 +272,15 @@ function ga(c, r, e, d, _, y) {
|
|
|
272
272
|
varianceQty: z,
|
|
273
273
|
varianceInCost: h,
|
|
274
274
|
stockTakeValue: p,
|
|
275
|
-
systemValue:
|
|
275
|
+
systemValue: w
|
|
276
276
|
};
|
|
277
277
|
}
|
|
278
|
-
function ya(
|
|
279
|
-
return !
|
|
278
|
+
function ya(i) {
|
|
279
|
+
return !i.abbrev.toLocaleLowerCase().includes("inactive");
|
|
280
280
|
}
|
|
281
|
-
function ba(
|
|
282
|
-
const r = Tt(
|
|
283
|
-
return
|
|
281
|
+
function ba(i) {
|
|
282
|
+
const r = Tt(i);
|
|
283
|
+
return i.reduce(
|
|
284
284
|
(e, d) => {
|
|
285
285
|
var _;
|
|
286
286
|
return Math.max(e, ((_ = r == null ? void 0 : r.get(d.sku._id)) == null ? void 0 : _[0].length) ?? 0);
|
|
@@ -288,13 +288,13 @@ function ba(c) {
|
|
|
288
288
|
0
|
|
289
289
|
);
|
|
290
290
|
}
|
|
291
|
-
function Tt(
|
|
292
|
-
return
|
|
291
|
+
function Tt(i) {
|
|
292
|
+
return i.groupBy(
|
|
293
293
|
(r) => r.sku._id,
|
|
294
294
|
(r) => r.measurementsAmounts.filter((e) => !e.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((e) => e.measurement.id)
|
|
295
295
|
);
|
|
296
296
|
}
|
|
297
|
-
function ha(
|
|
297
|
+
function ha(i) {
|
|
298
298
|
const r = Dt(), e = r === "MYR" ? "RM" : r;
|
|
299
299
|
return [
|
|
300
300
|
{
|
|
@@ -361,7 +361,7 @@ function ha(c) {
|
|
|
361
361
|
id: "baseUnitAmount",
|
|
362
362
|
name: "Base unit amount"
|
|
363
363
|
},
|
|
364
|
-
...Array.from({ length:
|
|
364
|
+
...Array.from({ length: i }).flatMap((_, y) => [
|
|
365
365
|
{
|
|
366
366
|
id: `measurementAmount${y}`,
|
|
367
367
|
name: `UOM amount ${y + 1}`
|
|
@@ -373,8 +373,8 @@ function ha(c) {
|
|
|
373
373
|
])
|
|
374
374
|
];
|
|
375
375
|
}
|
|
376
|
-
function ka(
|
|
377
|
-
var z, h, p,
|
|
376
|
+
function ka(i, r, e) {
|
|
377
|
+
var z, h, p, w, H, q, C;
|
|
378
378
|
const d = r.groupBy(
|
|
379
379
|
(b) => b.id,
|
|
380
380
|
(b) => b.balance
|
|
@@ -382,52 +382,52 @@ function ka(c, r, e) {
|
|
|
382
382
|
(b) => b.id,
|
|
383
383
|
(b) => b.balance
|
|
384
384
|
), y = /* @__PURE__ */ new Map();
|
|
385
|
-
if (
|
|
386
|
-
for (const b of
|
|
385
|
+
if (i.opening)
|
|
386
|
+
for (const b of i.opening)
|
|
387
387
|
y.set(b.skuId, b.balance);
|
|
388
388
|
const f = /* @__PURE__ */ new Map();
|
|
389
|
-
if (
|
|
390
|
-
for (const b of
|
|
389
|
+
if (i.adjustmentSnapshot)
|
|
390
|
+
for (const b of i.adjustmentSnapshot) {
|
|
391
391
|
const G = Object.keys(b.adjustmentsByType).join(", ");
|
|
392
392
|
f.set(b.skuId, G || Bt);
|
|
393
393
|
}
|
|
394
|
-
const
|
|
394
|
+
const j = [...i.items, ...i.negativeStockItems ?? []], V = Tt(j), T = j.map((b) => {
|
|
395
395
|
var me, he, ke;
|
|
396
|
-
const G = ((me = d.get(b.sku._id)) == null ? void 0 : me[0]) ?? pa, ne = ((he =
|
|
396
|
+
const G = ((me = d.get(b.sku._id)) == null ? void 0 : me[0]) ?? pa, ne = ((he = V == null ? void 0 : V.get(b.sku._id)) == null ? void 0 : he[0]) ?? [], se = y.get(b.sku._id), le = f.get(b.sku._id);
|
|
397
397
|
return ga(
|
|
398
398
|
b,
|
|
399
399
|
G,
|
|
400
400
|
ne,
|
|
401
401
|
(ke = _.get(b.sku._id)) == null ? void 0 : ke[0],
|
|
402
|
-
|
|
403
|
-
|
|
402
|
+
se,
|
|
403
|
+
le
|
|
404
404
|
);
|
|
405
|
-
}), x = ba(
|
|
405
|
+
}), x = ba(j), I = kt().currentBusiness.value, W = ha(x), m = [
|
|
406
406
|
["Business name:", I == null ? void 0 : I.name],
|
|
407
407
|
["Business ID:", I == null ? void 0 : I._id],
|
|
408
408
|
["Menu version", I == null ? void 0 : I.menuVersion],
|
|
409
|
-
["Created at", new Date(
|
|
410
|
-
["Created by", (z =
|
|
411
|
-
["Updated at", new Date(
|
|
412
|
-
["Updated by", (h =
|
|
413
|
-
["Recent action",
|
|
409
|
+
["Created at", new Date(i.createdAt)],
|
|
410
|
+
["Created by", (z = i.createdBy) == null ? void 0 : z.name],
|
|
411
|
+
["Updated at", new Date(i.updatedAt)],
|
|
412
|
+
["Updated by", (h = i.updatedBy) == null ? void 0 : h.name],
|
|
413
|
+
["Recent action", i.approvedAt ? "Approve" : i.rejectionHistory ? "Reject" : ""],
|
|
414
414
|
[
|
|
415
415
|
"Action by",
|
|
416
|
-
|
|
416
|
+
i.approvedAt ? (p = i.approvedBy) == null ? void 0 : p.name : i.rejectionHistory ? (H = (w = i.rejectionHistory[0]) == null ? void 0 : w.rejectedBy) == null ? void 0 : H.name : ""
|
|
417
417
|
],
|
|
418
418
|
[
|
|
419
419
|
"Action at",
|
|
420
|
-
|
|
420
|
+
i.approvedAt ? new Date(i.approvedAt) : i.rejectionHistory ? new Date((q = i.rejectionHistory[0]) == null ? void 0 : q.rejectedAt) : ""
|
|
421
421
|
],
|
|
422
422
|
[
|
|
423
423
|
"Action remark",
|
|
424
|
-
|
|
424
|
+
i.approvedAt ? i.approveRemark : i.rejectionHistory ? new Date((C = i.rejectionHistory[0]) == null ? void 0 : C.rejectRemark) : ""
|
|
425
425
|
],
|
|
426
426
|
[],
|
|
427
427
|
W.map((b) => b.name),
|
|
428
|
-
...
|
|
429
|
-
], t = W.map((b) => `system:${b.id}`), S = ea(m, t),
|
|
430
|
-
return ta(S,
|
|
428
|
+
...T.map((b) => W.map((G) => b[G.id]))
|
|
429
|
+
], t = W.map((b) => `system:${b.id}`), S = ea(m, t), R = `[${I == null ? void 0 : I.name}] closing draft (${Wt(new Date(i.updatedAt))}).xlsx`;
|
|
430
|
+
return ta(S, R), R;
|
|
431
431
|
}
|
|
432
432
|
const _a = { class: "flex flex-col" }, Da = {
|
|
433
433
|
key: 0,
|
|
@@ -439,26 +439,26 @@ const _a = { class: "flex flex-col" }, Da = {
|
|
|
439
439
|
onCancel: { type: Function },
|
|
440
440
|
onFinished: { type: Function }
|
|
441
441
|
},
|
|
442
|
-
setup(
|
|
443
|
-
const r =
|
|
442
|
+
setup(i) {
|
|
443
|
+
const r = i;
|
|
444
444
|
nt();
|
|
445
445
|
const e = Y(!1), d = Y(null), _ = Y(!1);
|
|
446
446
|
et(() => {
|
|
447
447
|
if (r.draft.effectiveAt)
|
|
448
448
|
d.value = new Date(r.draft.effectiveAt);
|
|
449
449
|
else {
|
|
450
|
-
const
|
|
451
|
-
|
|
450
|
+
const T = new Date(r.draft.createdAt);
|
|
451
|
+
T.setHours(23, 59, 59, 999), d.value = T;
|
|
452
452
|
}
|
|
453
453
|
_.value = !0;
|
|
454
454
|
});
|
|
455
455
|
const y = M({
|
|
456
456
|
get() {
|
|
457
|
-
return d.value === null ? "" :
|
|
457
|
+
return d.value === null ? "" : Ye(d.value);
|
|
458
458
|
},
|
|
459
|
-
set(
|
|
460
|
-
if (
|
|
461
|
-
const x = /* @__PURE__ */ new Date(`${
|
|
459
|
+
set(T) {
|
|
460
|
+
if (T) {
|
|
461
|
+
const x = /* @__PURE__ */ new Date(`${T} ${f.value}`);
|
|
462
462
|
x.setSeconds(59, 999), d.value = x;
|
|
463
463
|
} else
|
|
464
464
|
d.value = null;
|
|
@@ -467,53 +467,53 @@ const _a = { class: "flex flex-col" }, Da = {
|
|
|
467
467
|
get() {
|
|
468
468
|
return d.value === null ? "" : At(d.value);
|
|
469
469
|
},
|
|
470
|
-
set(
|
|
471
|
-
if (
|
|
472
|
-
const x = /* @__PURE__ */ new Date(`${y.value} ${
|
|
470
|
+
set(T) {
|
|
471
|
+
if (T) {
|
|
472
|
+
const x = /* @__PURE__ */ new Date(`${y.value} ${T}`);
|
|
473
473
|
x.setSeconds(59, 999), d.value = x;
|
|
474
474
|
} else
|
|
475
475
|
d.value = null;
|
|
476
476
|
}
|
|
477
|
-
}),
|
|
478
|
-
async function
|
|
477
|
+
}), j = M(() => d.value ? d.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
|
|
478
|
+
async function V() {
|
|
479
479
|
e.value = !0, r.onFinished(d.value.toISOString());
|
|
480
480
|
}
|
|
481
|
-
return (
|
|
481
|
+
return (T, x) => {
|
|
482
482
|
const D = K("FmLabel"), I = K("FmDatePicker"), W = K("FmTimePicker"), m = K("FmButton"), t = K("FmForm");
|
|
483
|
-
return _.value ? (
|
|
483
|
+
return _.value ? (F(), ce(t, {
|
|
484
484
|
key: 1,
|
|
485
|
-
onValidationSuccess:
|
|
485
|
+
onValidationSuccess: V,
|
|
486
486
|
class: "flex flex-col gap-32",
|
|
487
487
|
disabled: e.value
|
|
488
488
|
}, {
|
|
489
489
|
default: O(() => [
|
|
490
490
|
x[5] || (x[5] = s("div", { class: "fm-typo-en-body-lg-400" }, [
|
|
491
491
|
s("p", null, [
|
|
492
|
-
|
|
492
|
+
re(" Performing "),
|
|
493
493
|
s("span", { class: "fm-typo-en-body-lg-600" }, '"Refresh Balance"'),
|
|
494
|
-
|
|
494
|
+
re(" until closing effective date and time. ")
|
|
495
495
|
]),
|
|
496
496
|
s("p", { class: "mt-2" }, [
|
|
497
|
-
|
|
497
|
+
re(" Please note that this action will "),
|
|
498
498
|
s("b", null, "update"),
|
|
499
|
-
|
|
499
|
+
re(" the effective date and time. ")
|
|
500
500
|
])
|
|
501
501
|
], -1)),
|
|
502
502
|
s("div", _a, [
|
|
503
503
|
k(D, { class: "fm-typo-en-body-lg-600" }, {
|
|
504
504
|
default: O(() => x[3] || (x[3] = [
|
|
505
|
-
|
|
505
|
+
re("Closing Date")
|
|
506
506
|
])),
|
|
507
507
|
_: 1
|
|
508
508
|
}),
|
|
509
509
|
k(I, {
|
|
510
510
|
modelValue: y.value,
|
|
511
511
|
"onUpdate:modelValue": x[0] || (x[0] = (S) => y.value = S),
|
|
512
|
-
max: g(
|
|
512
|
+
max: g(Ye)(/* @__PURE__ */ new Date())
|
|
513
513
|
}, null, 8, ["modelValue", "max"]),
|
|
514
514
|
k(D, { class: "fm-typo-en-body-lg-600" }, {
|
|
515
515
|
default: O(() => x[4] || (x[4] = [
|
|
516
|
-
|
|
516
|
+
re("Closing Time")
|
|
517
517
|
])),
|
|
518
518
|
_: 1
|
|
519
519
|
}),
|
|
@@ -521,42 +521,42 @@ const _a = { class: "flex flex-col" }, Da = {
|
|
|
521
521
|
modelValue: f.value,
|
|
522
522
|
"onUpdate:modelValue": x[1] || (x[1] = (S) => f.value = S)
|
|
523
523
|
}, null, 8, ["modelValue"]),
|
|
524
|
-
|
|
524
|
+
j.value ? (F(), P("div", Da, " Cannot select future date ")) : J("", !0)
|
|
525
525
|
]),
|
|
526
526
|
s("div", xa, [
|
|
527
527
|
k(m, {
|
|
528
528
|
label: "Cancel",
|
|
529
529
|
variant: "tertiary",
|
|
530
|
-
onClick: x[2] || (x[2] = (S) =>
|
|
530
|
+
onClick: x[2] || (x[2] = (S) => T.onCancel())
|
|
531
531
|
}),
|
|
532
532
|
k(m, {
|
|
533
533
|
label: "Refresh balance",
|
|
534
534
|
type: "submit",
|
|
535
535
|
variant: "primary",
|
|
536
536
|
loading: e.value,
|
|
537
|
-
disabled:
|
|
537
|
+
disabled: j.value
|
|
538
538
|
}, null, 8, ["loading", "disabled"])
|
|
539
539
|
])
|
|
540
540
|
]),
|
|
541
541
|
_: 1
|
|
542
|
-
}, 8, ["disabled"])) : (
|
|
543
|
-
|
|
542
|
+
}, 8, ["disabled"])) : (F(), P(oe, { key: 0 }, [
|
|
543
|
+
re("Loading")
|
|
544
544
|
], 64));
|
|
545
545
|
};
|
|
546
546
|
}
|
|
547
|
-
}),
|
|
547
|
+
}), Qe = xt(
|
|
548
548
|
"closingDraftActions",
|
|
549
549
|
function() {
|
|
550
|
-
const r = Ht(), e = tt(), d = nt(), _ =
|
|
551
|
-
function
|
|
550
|
+
const r = Ht(), e = tt(), d = nt(), _ = Ge(), y = Ct(), f = Y(!1), j = Y();
|
|
551
|
+
function V(h) {
|
|
552
552
|
const p = {
|
|
553
553
|
draft: h
|
|
554
554
|
};
|
|
555
|
-
|
|
555
|
+
j.value = p, f.value = !0;
|
|
556
556
|
}
|
|
557
|
-
async function
|
|
558
|
-
var
|
|
559
|
-
if (h.status ===
|
|
557
|
+
async function T(h) {
|
|
558
|
+
var w;
|
|
559
|
+
if (h.status === be.enum.COMPLETED) {
|
|
560
560
|
const H = h.closingAdjustmentId;
|
|
561
561
|
if (!H)
|
|
562
562
|
return e.open({
|
|
@@ -573,15 +573,15 @@ const _a = { class: "flex flex-col" }, Da = {
|
|
|
573
573
|
costs: b.fromCostBalances
|
|
574
574
|
}));
|
|
575
575
|
} else
|
|
576
|
-
return await y.readStockBalance(), ((
|
|
576
|
+
return await y.readStockBalance(), ((w = y.stockBalance) == null ? void 0 : w.skus) ?? [];
|
|
577
577
|
}
|
|
578
|
-
async function x(h, p,
|
|
578
|
+
async function x(h, p, w) {
|
|
579
579
|
p || (e.open({
|
|
580
580
|
title: "Exporting",
|
|
581
581
|
message: "Fetching data..."
|
|
582
|
-
}), p = await
|
|
582
|
+
}), p = await T(h)), ka(h, p, w ?? []);
|
|
583
583
|
}
|
|
584
|
-
function D(h, p) {
|
|
584
|
+
function D(h, p, w) {
|
|
585
585
|
r.open({
|
|
586
586
|
title: "Approve draft",
|
|
587
587
|
contentComponent: Ze,
|
|
@@ -591,8 +591,12 @@ const _a = { class: "flex flex-col" }, Da = {
|
|
|
591
591
|
onFinished: () => {
|
|
592
592
|
r.close(), p == null || p();
|
|
593
593
|
},
|
|
594
|
-
onCancel: () =>
|
|
594
|
+
onCancel: () => {
|
|
595
|
+
r.close();
|
|
596
|
+
}
|
|
595
597
|
}
|
|
598
|
+
}).onClose(() => {
|
|
599
|
+
w == null || w();
|
|
596
600
|
});
|
|
597
601
|
}
|
|
598
602
|
function I(h, p) {
|
|
@@ -640,14 +644,14 @@ const _a = { class: "flex flex-col" }, Da = {
|
|
|
640
644
|
function t() {
|
|
641
645
|
f.value = !1;
|
|
642
646
|
}
|
|
643
|
-
async function S(h, p,
|
|
647
|
+
async function S(h, p, w) {
|
|
644
648
|
await r.open({
|
|
645
649
|
title: "Refresh balance",
|
|
646
650
|
contentComponent: Aa,
|
|
647
651
|
contentComponentProps: {
|
|
648
652
|
draft: h,
|
|
649
653
|
onFinished: (H) => {
|
|
650
|
-
r.close(),
|
|
654
|
+
r.close(), w == null || w(H);
|
|
651
655
|
},
|
|
652
656
|
onCancel: async () => {
|
|
653
657
|
r.close(), p == null || p();
|
|
@@ -655,7 +659,7 @@ const _a = { class: "flex flex-col" }, Da = {
|
|
|
655
659
|
}
|
|
656
660
|
});
|
|
657
661
|
}
|
|
658
|
-
async function
|
|
662
|
+
async function R(h) {
|
|
659
663
|
await r.open({
|
|
660
664
|
title: "Invalidate closing draft cache",
|
|
661
665
|
message: "It will invalidate opening and stock movement cache for this draft.",
|
|
@@ -679,16 +683,16 @@ const _a = { class: "flex flex-col" }, Da = {
|
|
|
679
683
|
message: "Draft cloned successfully",
|
|
680
684
|
type: "success"
|
|
681
685
|
}), p == null || p();
|
|
682
|
-
} catch (
|
|
686
|
+
} catch (w) {
|
|
683
687
|
e.open({
|
|
684
688
|
title: "Error",
|
|
685
|
-
message: (
|
|
689
|
+
message: (w == null ? void 0 : w.message) || "Failed to clone draft",
|
|
686
690
|
type: "error"
|
|
687
691
|
});
|
|
688
692
|
}
|
|
689
693
|
}
|
|
690
694
|
return {
|
|
691
|
-
viewDraft:
|
|
695
|
+
viewDraft: V,
|
|
692
696
|
closeDraftDialog: t,
|
|
693
697
|
approveDraft: D,
|
|
694
698
|
rejectDraft: I,
|
|
@@ -698,13 +702,13 @@ const _a = { class: "flex flex-col" }, Da = {
|
|
|
698
702
|
refreshBalance: S,
|
|
699
703
|
cloneDraft: z,
|
|
700
704
|
viewClosingDraftShow: f,
|
|
701
|
-
viewClosingDraftProps:
|
|
702
|
-
invalidateDraftCache:
|
|
705
|
+
viewClosingDraftProps: j,
|
|
706
|
+
invalidateDraftCache: R
|
|
703
707
|
};
|
|
704
708
|
}
|
|
705
709
|
);
|
|
706
|
-
function
|
|
707
|
-
switch (
|
|
710
|
+
function Ke(i) {
|
|
711
|
+
switch (i) {
|
|
708
712
|
case "DRAFT":
|
|
709
713
|
return "fm-status-badge-draft";
|
|
710
714
|
case "PROCESSING":
|
|
@@ -715,15 +719,15 @@ function Oe(c) {
|
|
|
715
719
|
return "fm-status-badge-complete";
|
|
716
720
|
}
|
|
717
721
|
}
|
|
718
|
-
const
|
|
722
|
+
const Sa = xt(
|
|
719
723
|
"closingDraftTable",
|
|
720
724
|
function() {
|
|
721
|
-
const { t: r } = _t(), e = kt(), d =
|
|
722
|
-
async function
|
|
725
|
+
const { t: r } = _t(), e = kt(), d = Qe(), _ = Y(new Array()), y = Y(!1), f = qe(), j = Ge();
|
|
726
|
+
async function V() {
|
|
723
727
|
if (_.value = [], !!f._currentLocation) {
|
|
724
728
|
y.value = !0;
|
|
725
729
|
try {
|
|
726
|
-
const [m] = await Promise.all([
|
|
730
|
+
const [m] = await Promise.all([j.readDrafts()]).delayed(1e3);
|
|
727
731
|
_.value = m.reverse();
|
|
728
732
|
} catch (m) {
|
|
729
733
|
console.log("Something went wrong when fetching drafts:", m);
|
|
@@ -732,12 +736,12 @@ const wa = xt(
|
|
|
732
736
|
}
|
|
733
737
|
}
|
|
734
738
|
}
|
|
735
|
-
async function
|
|
739
|
+
async function T(m) {
|
|
736
740
|
if (!_.value.find((t) => t._id) && f._currentLocation) {
|
|
737
741
|
y.value = !0;
|
|
738
742
|
try {
|
|
739
743
|
const [t] = await Promise.all([
|
|
740
|
-
|
|
744
|
+
j.getDraft(m),
|
|
741
745
|
new Promise((S) => setTimeout(S, 1e3))
|
|
742
746
|
]);
|
|
743
747
|
_.value = [t];
|
|
@@ -755,13 +759,13 @@ const wa = xt(
|
|
|
755
759
|
} : t);
|
|
756
760
|
}
|
|
757
761
|
function D() {
|
|
758
|
-
d.closeDraftDialog(),
|
|
762
|
+
d.closeDraftDialog(), V();
|
|
759
763
|
}
|
|
760
764
|
function I(m, t) {
|
|
761
765
|
switch (t = Qt(t), m) {
|
|
762
|
-
case
|
|
766
|
+
case Ce.Details:
|
|
763
767
|
return d.viewDraft(t);
|
|
764
|
-
case
|
|
768
|
+
case Ce.Export:
|
|
765
769
|
return d.exportDraft(t);
|
|
766
770
|
case Q.enum.approveDraft:
|
|
767
771
|
return d.approveDraft(t, D);
|
|
@@ -769,7 +773,7 @@ const wa = xt(
|
|
|
769
773
|
return d.rejectDraft(t, D);
|
|
770
774
|
case Q.enum.markAsFailed:
|
|
771
775
|
return d.markAsFailed(t, D);
|
|
772
|
-
case
|
|
776
|
+
case Ce.Duplicate:
|
|
773
777
|
return d.cloneDraft(t, D);
|
|
774
778
|
}
|
|
775
779
|
}
|
|
@@ -790,14 +794,14 @@ const wa = xt(
|
|
|
790
794
|
cell(m) {
|
|
791
795
|
const t = m.row.original;
|
|
792
796
|
let S = m.getValue();
|
|
793
|
-
return S || (S =
|
|
797
|
+
return S || (S = He(t._id)), ye(S);
|
|
794
798
|
},
|
|
795
799
|
enableSorting: !0,
|
|
796
800
|
size: 200
|
|
797
801
|
},
|
|
798
802
|
{
|
|
799
803
|
id: "updatedAt",
|
|
800
|
-
accessorFn: (m) =>
|
|
804
|
+
accessorFn: (m) => ye(m.updatedAt),
|
|
801
805
|
header: () => "Updated at",
|
|
802
806
|
enableSorting: !0,
|
|
803
807
|
size: 200
|
|
@@ -837,42 +841,42 @@ const wa = xt(
|
|
|
837
841
|
enableSorting: !1,
|
|
838
842
|
cell(m) {
|
|
839
843
|
var p;
|
|
840
|
-
const t = m.row.original, S = t.status,
|
|
841
|
-
return S === "DRAFT" && h ? h.getTime() >
|
|
844
|
+
const t = m.row.original, S = t.status, R = new Date(t.updatedAt), z = (p = t == null ? void 0 : t.rejectionHistory) == null ? void 0 : p.computeFirst((w) => w.rejectedAt), h = z ? new Date(z) : null;
|
|
845
|
+
return S === "DRAFT" && h ? h.getTime() > R.getTime() ? B(
|
|
842
846
|
"div",
|
|
843
847
|
{
|
|
844
848
|
class: "flex"
|
|
845
849
|
},
|
|
846
|
-
|
|
850
|
+
B(
|
|
847
851
|
"div",
|
|
848
852
|
{
|
|
849
|
-
class: ["fm-status-badge",
|
|
853
|
+
class: ["fm-status-badge", Ke("FAILED")]
|
|
850
854
|
},
|
|
851
855
|
"Rejected"
|
|
852
856
|
)
|
|
853
|
-
) :
|
|
857
|
+
) : B(
|
|
854
858
|
"div",
|
|
855
859
|
{
|
|
856
860
|
class: "flex"
|
|
857
861
|
},
|
|
858
|
-
|
|
862
|
+
B(
|
|
859
863
|
"div",
|
|
860
864
|
{
|
|
861
|
-
class: ["fm-status-badge",
|
|
865
|
+
class: ["fm-status-badge", Ke("PROCESSING")]
|
|
862
866
|
},
|
|
863
867
|
"Updated"
|
|
864
868
|
)
|
|
865
|
-
) :
|
|
869
|
+
) : B(
|
|
866
870
|
"div",
|
|
867
871
|
{
|
|
868
872
|
class: "flex"
|
|
869
873
|
},
|
|
870
|
-
|
|
874
|
+
B(
|
|
871
875
|
"div",
|
|
872
876
|
{
|
|
873
|
-
class: ["fm-status-badge",
|
|
877
|
+
class: ["fm-status-badge", Ke(S)]
|
|
874
878
|
},
|
|
875
|
-
|
|
879
|
+
Oe(S)
|
|
876
880
|
)
|
|
877
881
|
);
|
|
878
882
|
}
|
|
@@ -881,9 +885,9 @@ const wa = xt(
|
|
|
881
885
|
id: "action",
|
|
882
886
|
cell(m) {
|
|
883
887
|
var p;
|
|
884
|
-
const t = m.row.original, S = ((p = e.sessionUser.value) == null ? void 0 : p.role.isAdmin) ?? !1,
|
|
885
|
-
yt[
|
|
886
|
-
yt[
|
|
888
|
+
const t = m.row.original, S = ((p = e.sessionUser.value) == null ? void 0 : p.role.isAdmin) ?? !1, R = [
|
|
889
|
+
yt[Ce.Details],
|
|
890
|
+
yt[Ce.Export]
|
|
887
891
|
], z = [
|
|
888
892
|
{
|
|
889
893
|
translationKey: "inventory.closing.draft.approveDraft",
|
|
@@ -900,19 +904,19 @@ const wa = xt(
|
|
|
900
904
|
color: "text-fm-color-typo-error",
|
|
901
905
|
value: Q.enum.markAsFailed
|
|
902
906
|
}
|
|
903
|
-
], h = S && t.status !==
|
|
907
|
+
], h = S && t.status !== be.enum.DRAFT ? [
|
|
904
908
|
{
|
|
905
909
|
translationKey: "inventory.closing.draft.cloneDraft",
|
|
906
910
|
color: "text-fm-color-typo-primary",
|
|
907
|
-
value:
|
|
911
|
+
value: Ce.Duplicate
|
|
908
912
|
}
|
|
909
913
|
] : [];
|
|
910
914
|
return aa(
|
|
911
915
|
[
|
|
912
|
-
...
|
|
913
|
-
...t.status ===
|
|
916
|
+
...R,
|
|
917
|
+
...t.status === be.enum.DRAFT ? z : []
|
|
914
918
|
],
|
|
915
|
-
(
|
|
919
|
+
(w) => I(w, t),
|
|
916
920
|
h
|
|
917
921
|
);
|
|
918
922
|
},
|
|
@@ -926,15 +930,15 @@ const wa = xt(
|
|
|
926
930
|
],
|
|
927
931
|
drafts: _,
|
|
928
932
|
loading: y,
|
|
929
|
-
fetchDrafts:
|
|
930
|
-
loadDraft:
|
|
933
|
+
fetchDrafts: V,
|
|
934
|
+
loadDraft: T,
|
|
931
935
|
updateDraftRef: x
|
|
932
936
|
};
|
|
933
937
|
}
|
|
934
|
-
),
|
|
938
|
+
), wa = { class: "fm-typo-en-heading-lg-600" }, Fa = { class: "py-4" }, Ca = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, $a = { key: 0 }, Ba = { class: "mt-4 flex gap-4" }, Ta = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, ja = { key: 0 }, Ia = {
|
|
935
939
|
key: 0,
|
|
936
940
|
class: "mb-4"
|
|
937
|
-
}, Ua = { class: "flex flex-col gap-1 max-h-200 overflow-auto pr-4" }, Ra = { class: "fm-typo-en-body-md-400" },
|
|
941
|
+
}, Ua = { class: "flex flex-col gap-1 max-h-200 overflow-auto pr-4" }, Ra = { class: "fm-typo-en-body-md-400" }, Va = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Pa = { class: "mt-4 flex gap-4" }, Ma = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, La = {
|
|
938
942
|
key: 0,
|
|
939
943
|
class: "flex gap-4"
|
|
940
944
|
}, Na = /* @__PURE__ */ Re({
|
|
@@ -947,69 +951,69 @@ const wa = xt(
|
|
|
947
951
|
negativeItems: {}
|
|
948
952
|
},
|
|
949
953
|
emits: ["update:show", "refresh", "approve"],
|
|
950
|
-
setup(
|
|
951
|
-
const { FmStepper: e, FmStep: d, FmDialog: _, FmButton: y } = ge, { t: f } = la(),
|
|
952
|
-
var
|
|
953
|
-
return (((
|
|
954
|
+
setup(i, { emit: r }) {
|
|
955
|
+
const { FmStepper: e, FmStep: d, FmDialog: _, FmButton: y } = ge, { t: f } = la(), j = i, V = r, T = M(() => {
|
|
956
|
+
var C;
|
|
957
|
+
return (((C = j.negativeItems) == null ? void 0 : C.length) ?? 0) > 0;
|
|
954
958
|
}), x = M({
|
|
955
|
-
get: () =>
|
|
956
|
-
set: (
|
|
959
|
+
get: () => j.show,
|
|
960
|
+
set: (C) => V("update:show", C)
|
|
957
961
|
}), D = Y(1), I = () => D.value > 1, W = () => D.value > 2, m = () => !1;
|
|
958
|
-
function t(
|
|
959
|
-
return
|
|
962
|
+
function t(C) {
|
|
963
|
+
return C === 1 ? j.hasStockSnapshot : C === 2 ? !T.value : !1;
|
|
960
964
|
}
|
|
961
|
-
const S = M(() => !
|
|
962
|
-
function
|
|
963
|
-
let b =
|
|
965
|
+
const S = M(() => !j.hasStockSnapshot || T.value);
|
|
966
|
+
function R(C) {
|
|
967
|
+
let b = C + 1;
|
|
964
968
|
for (; b <= 3 && t(b); ) b++;
|
|
965
969
|
return b > 3 ? 3 : b;
|
|
966
970
|
}
|
|
967
|
-
function z(
|
|
968
|
-
let b =
|
|
971
|
+
function z(C) {
|
|
972
|
+
let b = C - 1;
|
|
969
973
|
for (; b >= 1 && t(b); ) b--;
|
|
970
974
|
return b < 1 ? 1 : b;
|
|
971
975
|
}
|
|
972
976
|
function h() {
|
|
973
|
-
return
|
|
977
|
+
return j.hasStockSnapshot ? T.value ? 2 : 3 : 1;
|
|
974
978
|
}
|
|
975
|
-
|
|
976
|
-
() =>
|
|
977
|
-
(
|
|
978
|
-
|
|
979
|
+
ze(
|
|
980
|
+
() => j.show,
|
|
981
|
+
(C) => {
|
|
982
|
+
C && (D.value = h());
|
|
979
983
|
}
|
|
980
|
-
),
|
|
981
|
-
() =>
|
|
982
|
-
(
|
|
983
|
-
|
|
984
|
+
), ze(
|
|
985
|
+
() => j.hasStockSnapshot,
|
|
986
|
+
(C) => {
|
|
987
|
+
C && D.value === 1 && (D.value = R(1));
|
|
984
988
|
}
|
|
985
|
-
),
|
|
986
|
-
() =>
|
|
987
|
-
(
|
|
988
|
-
!
|
|
989
|
+
), ze(
|
|
990
|
+
() => T.value,
|
|
991
|
+
(C) => {
|
|
992
|
+
!C && D.value === 2 && (D.value = R(2));
|
|
989
993
|
}
|
|
990
994
|
);
|
|
991
995
|
function p() {
|
|
992
|
-
|
|
996
|
+
V("refresh");
|
|
993
997
|
}
|
|
994
|
-
function
|
|
995
|
-
D.value < 3 && (D.value =
|
|
998
|
+
function w() {
|
|
999
|
+
D.value < 3 && (D.value = R(D.value));
|
|
996
1000
|
}
|
|
997
1001
|
function H() {
|
|
998
1002
|
D.value > 1 && (D.value = z(D.value));
|
|
999
1003
|
}
|
|
1000
1004
|
function q() {
|
|
1001
|
-
|
|
1005
|
+
V("approve");
|
|
1002
1006
|
}
|
|
1003
|
-
return (
|
|
1007
|
+
return (C, b) => (F(), ce(g(_), {
|
|
1004
1008
|
modelValue: x.value,
|
|
1005
1009
|
"onUpdate:modelValue": b[1] || (b[1] = (G) => x.value = G),
|
|
1006
1010
|
"max-width": 600
|
|
1007
1011
|
}, {
|
|
1008
1012
|
"dialog-header": O(() => [
|
|
1009
|
-
s("div",
|
|
1013
|
+
s("div", wa, Z(g(f)("inventory.closing.approval.title")), 1)
|
|
1010
1014
|
]),
|
|
1011
1015
|
default: O(() => [
|
|
1012
|
-
s("div",
|
|
1016
|
+
s("div", Fa, [
|
|
1013
1017
|
k(g(e), {
|
|
1014
1018
|
modelValue: D.value,
|
|
1015
1019
|
"onUpdate:modelValue": b[0] || (b[0] = (G) => D.value = G),
|
|
@@ -1022,20 +1026,20 @@ const wa = xt(
|
|
|
1022
1026
|
complete: I
|
|
1023
1027
|
}, {
|
|
1024
1028
|
default: O(() => [
|
|
1025
|
-
s("div",
|
|
1026
|
-
D.value === 1 ? (
|
|
1029
|
+
s("div", Ca, Z(g(f)("inventory.closing.approval.step.generateReport.description")), 1),
|
|
1030
|
+
D.value === 1 ? (F(), P("div", $a, [
|
|
1027
1031
|
k(g(y), {
|
|
1028
1032
|
label: g(f)("inventory.stock.stock_balance.refreshBalance"),
|
|
1029
1033
|
"prepend-icon": "refresh",
|
|
1030
1034
|
variant: "secondary",
|
|
1031
|
-
loading:
|
|
1035
|
+
loading: C.refreshing,
|
|
1032
1036
|
onClick: p
|
|
1033
1037
|
}, null, 8, ["label", "loading"]),
|
|
1034
1038
|
s("div", Ba, [
|
|
1035
1039
|
k(g(y), {
|
|
1036
1040
|
label: g(f)("inventory.common.continue"),
|
|
1037
|
-
disabled: !
|
|
1038
|
-
onClick:
|
|
1041
|
+
disabled: !C.hasStockSnapshot,
|
|
1042
|
+
onClick: w
|
|
1039
1043
|
}, null, 8, ["label", "disabled"])
|
|
1040
1044
|
])
|
|
1041
1045
|
])) : J("", !0)
|
|
@@ -1045,25 +1049,26 @@ const wa = xt(
|
|
|
1045
1049
|
k(g(d), {
|
|
1046
1050
|
value: 2,
|
|
1047
1051
|
title: g(f)("inventory.closing.approval.step.negativeItems.title"),
|
|
1052
|
+
disabled: () => !C.hasStockSnapshot,
|
|
1048
1053
|
complete: W
|
|
1049
1054
|
}, {
|
|
1050
1055
|
default: O(() => {
|
|
1051
1056
|
var G;
|
|
1052
1057
|
return [
|
|
1053
|
-
s("div", Ta, Z(
|
|
1054
|
-
D.value === 2 ? (
|
|
1055
|
-
|
|
1058
|
+
s("div", Ta, Z(T.value ? g(f)("inventory.closing.approval.step.negativeItems.resolveMessage") : g(f)("inventory.closing.approval.step.negativeItems.noItemsMessage")), 1),
|
|
1059
|
+
D.value === 2 ? (F(), P("div", ja, [
|
|
1060
|
+
T.value && (((G = C.negativeItems) == null ? void 0 : G.length) ?? 0) > 0 ? (F(), P("div", Ia, [
|
|
1056
1061
|
s("div", Ua, [
|
|
1057
|
-
(
|
|
1062
|
+
(F(!0), P(oe, null, $e(C.negativeItems, (ne) => (F(), P("div", {
|
|
1058
1063
|
key: ne.code,
|
|
1059
1064
|
class: "flex justify-between gap-8"
|
|
1060
1065
|
}, [
|
|
1061
1066
|
s("div", Ra, Z(ne.name), 1),
|
|
1062
|
-
s("div",
|
|
1067
|
+
s("div", Va, Z(ne.code), 1)
|
|
1063
1068
|
]))), 128))
|
|
1064
1069
|
])
|
|
1065
1070
|
])) : J("", !0),
|
|
1066
|
-
s("div",
|
|
1071
|
+
s("div", Pa, [
|
|
1067
1072
|
k(g(y), {
|
|
1068
1073
|
label: g(f)("inventory.common.back"),
|
|
1069
1074
|
variant: "secondary",
|
|
@@ -1071,23 +1076,24 @@ const wa = xt(
|
|
|
1071
1076
|
}, null, 8, ["label"]),
|
|
1072
1077
|
k(g(y), {
|
|
1073
1078
|
label: g(f)("inventory.common.continue"),
|
|
1074
|
-
disabled:
|
|
1075
|
-
onClick:
|
|
1079
|
+
disabled: T.value,
|
|
1080
|
+
onClick: w
|
|
1076
1081
|
}, null, 8, ["label", "disabled"])
|
|
1077
1082
|
])
|
|
1078
1083
|
])) : J("", !0)
|
|
1079
1084
|
];
|
|
1080
1085
|
}),
|
|
1081
1086
|
_: 1
|
|
1082
|
-
}, 8, ["title"]),
|
|
1087
|
+
}, 8, ["title", "disabled"]),
|
|
1083
1088
|
k(g(d), {
|
|
1084
1089
|
value: 3,
|
|
1085
1090
|
title: g(f)("inventory.closing.approval.step.approval.title"),
|
|
1091
|
+
disabled: () => !C.hasStockSnapshot || T.value,
|
|
1086
1092
|
complete: m
|
|
1087
1093
|
}, {
|
|
1088
1094
|
default: O(() => [
|
|
1089
1095
|
s("div", Ma, Z(g(f)("inventory.closing.approval.step.approval.warning")), 1),
|
|
1090
|
-
D.value === 3 ? (
|
|
1096
|
+
D.value === 3 ? (F(), P("div", La, [
|
|
1091
1097
|
k(g(y), {
|
|
1092
1098
|
label: g(f)("inventory.common.back"),
|
|
1093
1099
|
variant: "secondary",
|
|
@@ -1097,13 +1103,13 @@ const wa = xt(
|
|
|
1097
1103
|
label: g(f)("inventory.common.approve"),
|
|
1098
1104
|
variant: "destructive",
|
|
1099
1105
|
disabled: S.value,
|
|
1100
|
-
loading:
|
|
1106
|
+
loading: C.approving,
|
|
1101
1107
|
onClick: q
|
|
1102
1108
|
}, null, 8, ["label", "disabled", "loading"])
|
|
1103
1109
|
])) : J("", !0)
|
|
1104
1110
|
]),
|
|
1105
1111
|
_: 1
|
|
1106
|
-
}, 8, ["title"])
|
|
1112
|
+
}, 8, ["title", "disabled"])
|
|
1107
1113
|
]),
|
|
1108
1114
|
_: 1
|
|
1109
1115
|
}, 8, ["modelValue"])
|
|
@@ -1149,33 +1155,33 @@ const wa = xt(
|
|
|
1149
1155
|
draft: {}
|
|
1150
1156
|
},
|
|
1151
1157
|
emits: ["submitted", "refresh"],
|
|
1152
|
-
setup(
|
|
1153
|
-
const e =
|
|
1154
|
-
const
|
|
1155
|
-
return
|
|
1156
|
-
}), _ =
|
|
1157
|
-
S.skus.filter((
|
|
1158
|
+
setup(i, { emit: r }) {
|
|
1159
|
+
const e = i, d = M(() => {
|
|
1160
|
+
const c = Dt();
|
|
1161
|
+
return c === "MYR" ? "RM" : c;
|
|
1162
|
+
}), _ = Ct(), y = Qe(), f = Ot(e, "show"), j = Y(!1), V = Y(!1), T = Y(!1), x = Y(new Array()), D = Y(new Array()), I = Y([]), W = nt(), m = Ge(), t = tt(), S = qt(), R = qe(), z = Mt({}), h = M(() => new Set(
|
|
1163
|
+
S.skus.filter((c) => {
|
|
1158
1164
|
var a;
|
|
1159
|
-
return z[(a =
|
|
1160
|
-
}).map((
|
|
1161
|
-
)), p = r,
|
|
1165
|
+
return z[(a = c.customAttributes) == null ? void 0 : a.tag];
|
|
1166
|
+
}).map((c) => c._id)
|
|
1167
|
+
)), p = r, w = Y({
|
|
1162
1168
|
templateItem: !0,
|
|
1163
1169
|
nonTemplateItem: !0
|
|
1164
1170
|
}), H = M(() => {
|
|
1165
1171
|
var a, v;
|
|
1166
|
-
const
|
|
1167
|
-
return h.value.size ?
|
|
1172
|
+
const c = [...((a = e.draft) == null ? void 0 : a.items) ?? [], ...((v = e.draft) == null ? void 0 : v.negativeStockItems) ?? []];
|
|
1173
|
+
return h.value.size ? c.filter((n) => h.value.has(n.sku._id)) : c;
|
|
1168
1174
|
}), q = M(() => {
|
|
1169
|
-
const
|
|
1170
|
-
return
|
|
1171
|
-
}),
|
|
1175
|
+
const c = H.value.map((a) => a.sku);
|
|
1176
|
+
return c.sort((a, v) => a.code.localeCompare(v.code)), c;
|
|
1177
|
+
}), C = M(() => H.value.groupBy(
|
|
1172
1178
|
(a) => a.sku._id,
|
|
1173
1179
|
(a) => a.measurementsAmounts.filter((v) => !v.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((v) => v.measurement.id)
|
|
1174
1180
|
));
|
|
1175
|
-
et(ne),
|
|
1181
|
+
et(ne), ze(
|
|
1176
1182
|
() => e.show,
|
|
1177
|
-
(
|
|
1178
|
-
|
|
1183
|
+
(c) => {
|
|
1184
|
+
c && (_e.value = Se[0], ne(), w.value = {
|
|
1179
1185
|
templateItem: !0,
|
|
1180
1186
|
nonTemplateItem: !0
|
|
1181
1187
|
});
|
|
@@ -1184,12 +1190,12 @@ const wa = xt(
|
|
|
1184
1190
|
const b = Ue(0), G = Ue(100);
|
|
1185
1191
|
async function ne() {
|
|
1186
1192
|
var a, v, n, o;
|
|
1187
|
-
if (!
|
|
1188
|
-
|
|
1189
|
-
const
|
|
1193
|
+
if (!R._currentLocation) return;
|
|
1194
|
+
j.value = !0;
|
|
1195
|
+
const c = ((a = e.draft) == null ? void 0 : a.status) === be.enum.COMPLETED;
|
|
1190
1196
|
D.value = [];
|
|
1191
1197
|
try {
|
|
1192
|
-
if (await S.init(),
|
|
1198
|
+
if (await S.init(), c) {
|
|
1193
1199
|
const L = e.draft.closingAdjustmentId;
|
|
1194
1200
|
if (!L) {
|
|
1195
1201
|
t.open({
|
|
@@ -1201,8 +1207,8 @@ const wa = xt(
|
|
|
1201
1207
|
});
|
|
1202
1208
|
return;
|
|
1203
1209
|
}
|
|
1204
|
-
const N = await W.readAdjustmentById(L),
|
|
1205
|
-
for (const ue of
|
|
1210
|
+
const N = await W.readAdjustmentById(L), ie = (N == null ? void 0 : N.skus) ?? [];
|
|
1211
|
+
for (const ue of ie) {
|
|
1206
1212
|
const De = {
|
|
1207
1213
|
id: ue.sku._id,
|
|
1208
1214
|
balance: ue.fromBalance,
|
|
@@ -1220,12 +1226,12 @@ const wa = xt(
|
|
|
1220
1226
|
if ((o = e.draft) != null && o.adjustmentSnapshot)
|
|
1221
1227
|
for (const L of e.draft.adjustmentSnapshot)
|
|
1222
1228
|
L.adjustmentsByType && Object.keys(L.adjustmentsByType).forEach((N) => u.add(N));
|
|
1223
|
-
const l = ["receive", "sales", "wastage"],
|
|
1229
|
+
const l = ["receive", "sales", "wastage"], $ = [];
|
|
1224
1230
|
l.forEach((L) => {
|
|
1225
|
-
u.has(L) && (
|
|
1231
|
+
u.has(L) && ($.push(L), u.delete(L));
|
|
1226
1232
|
});
|
|
1227
1233
|
const A = Array.from(u).sort();
|
|
1228
|
-
I.value = [
|
|
1234
|
+
I.value = [...$, ...A];
|
|
1229
1235
|
} catch (u) {
|
|
1230
1236
|
t.open({
|
|
1231
1237
|
title: "Something went wrong",
|
|
@@ -1233,12 +1239,12 @@ const wa = xt(
|
|
|
1233
1239
|
type: "error"
|
|
1234
1240
|
}), console.error("error on fetch stock balances", u);
|
|
1235
1241
|
} finally {
|
|
1236
|
-
|
|
1242
|
+
j.value = !1;
|
|
1237
1243
|
}
|
|
1238
1244
|
}
|
|
1239
|
-
async function
|
|
1245
|
+
async function se() {
|
|
1240
1246
|
var a, v;
|
|
1241
|
-
if (!(((a = e.draft) == null ? void 0 : a.effectiveAt) ?? (e.draft ?
|
|
1247
|
+
if (!(((a = e.draft) == null ? void 0 : a.effectiveAt) ?? (e.draft ? He((v = e.draft) == null ? void 0 : v._id) : null))) {
|
|
1242
1248
|
t.open({
|
|
1243
1249
|
title: "Cannot refresh",
|
|
1244
1250
|
message: "Effective date is not available for this draft.",
|
|
@@ -1251,9 +1257,9 @@ const wa = xt(
|
|
|
1251
1257
|
() => {
|
|
1252
1258
|
},
|
|
1253
1259
|
async (n) => {
|
|
1254
|
-
var
|
|
1255
|
-
|
|
1256
|
-
const o = (
|
|
1260
|
+
var $;
|
|
1261
|
+
V.value = !0;
|
|
1262
|
+
const o = ($ = e.draft) == null ? void 0 : $._rev, u = 30, l = 2e3;
|
|
1257
1263
|
try {
|
|
1258
1264
|
await W.recalculation.scheduleCalculateStockSnapshotAtDate(n, e.draft._id);
|
|
1259
1265
|
let A = null;
|
|
@@ -1279,14 +1285,14 @@ const wa = xt(
|
|
|
1279
1285
|
type: "error"
|
|
1280
1286
|
}), console.error("error refreshing stock balances", A);
|
|
1281
1287
|
} finally {
|
|
1282
|
-
|
|
1288
|
+
V.value = !1;
|
|
1283
1289
|
}
|
|
1284
1290
|
}
|
|
1285
1291
|
);
|
|
1286
1292
|
}
|
|
1287
|
-
async function
|
|
1293
|
+
async function le() {
|
|
1288
1294
|
var a, v;
|
|
1289
|
-
if (!(((a = e.draft) == null ? void 0 : a.effectiveAt) ?? (e.draft ?
|
|
1295
|
+
if (!(((a = e.draft) == null ? void 0 : a.effectiveAt) ?? (e.draft ? He((v = e.draft) == null ? void 0 : v._id) : null))) {
|
|
1290
1296
|
t.open({
|
|
1291
1297
|
title: "Cannot refresh",
|
|
1292
1298
|
message: "Effective date is not available for this draft.",
|
|
@@ -1298,34 +1304,34 @@ const wa = xt(
|
|
|
1298
1304
|
}
|
|
1299
1305
|
const me = M(
|
|
1300
1306
|
() => x.value.groupBy(
|
|
1301
|
-
(
|
|
1302
|
-
(
|
|
1307
|
+
(c) => c.id,
|
|
1308
|
+
(c) => c.balance
|
|
1303
1309
|
)
|
|
1304
|
-
), he = M(() => H.value.groupBy((
|
|
1305
|
-
var
|
|
1306
|
-
return (
|
|
1307
|
-
}),
|
|
1308
|
-
var
|
|
1309
|
-
return (
|
|
1310
|
+
), he = M(() => H.value.groupBy((c) => c.sku._id)), ke = M(() => {
|
|
1311
|
+
var c;
|
|
1312
|
+
return (c = e.draft) != null && c.adjustmentSnapshot ? new Map(e.draft.adjustmentSnapshot.map((a) => [a.skuId, a.adjustmentsByType])) : /* @__PURE__ */ new Map();
|
|
1313
|
+
}), Ve = M(() => {
|
|
1314
|
+
var c;
|
|
1315
|
+
return (c = e.draft) != null && c.opening ? new Map(e.draft.opening.map((a) => [a.skuId, a.balance])) : /* @__PURE__ */ new Map();
|
|
1310
1316
|
});
|
|
1311
|
-
function te(
|
|
1312
|
-
return
|
|
1317
|
+
function te(c, a) {
|
|
1318
|
+
return B(
|
|
1313
1319
|
ge.FmTooltip,
|
|
1314
1320
|
{ zIndex: 51, placement: "left", class: "w-full flex justify-end" },
|
|
1315
1321
|
{
|
|
1316
1322
|
default() {
|
|
1317
|
-
return
|
|
1323
|
+
return c;
|
|
1318
1324
|
},
|
|
1319
1325
|
content() {
|
|
1320
|
-
return a ||
|
|
1326
|
+
return a || c;
|
|
1321
1327
|
}
|
|
1322
1328
|
}
|
|
1323
1329
|
);
|
|
1324
1330
|
}
|
|
1325
1331
|
const Te = M(() => {
|
|
1326
|
-
const
|
|
1332
|
+
const c = q.value.reduce((v, n) => {
|
|
1327
1333
|
var o, u;
|
|
1328
|
-
return Math.max(v, ((u = (o =
|
|
1334
|
+
return Math.max(v, ((u = (o = C.value) == null ? void 0 : o.get(n._id)) == null ? void 0 : u[0].length) ?? 0);
|
|
1329
1335
|
}, 0);
|
|
1330
1336
|
return [
|
|
1331
1337
|
{
|
|
@@ -1334,8 +1340,8 @@ const wa = xt(
|
|
|
1334
1340
|
header: () => "Name",
|
|
1335
1341
|
size: 350,
|
|
1336
1342
|
cell(v) {
|
|
1337
|
-
const n = v.row.original, o = n.adjustedDiffPercentage, u = typeof o == "number" && Math.abs(o) > 10, l =
|
|
1338
|
-
|
|
1343
|
+
const n = v.row.original, o = n.adjustedDiffPercentage, u = typeof o == "number" && Math.abs(o) > 10, l = B("div", { class: "flex flex-col gap-4" }, [
|
|
1344
|
+
B(
|
|
1339
1345
|
"div",
|
|
1340
1346
|
{
|
|
1341
1347
|
class: [
|
|
@@ -1345,7 +1351,7 @@ const wa = xt(
|
|
|
1345
1351
|
},
|
|
1346
1352
|
n.name
|
|
1347
1353
|
),
|
|
1348
|
-
|
|
1354
|
+
B(
|
|
1349
1355
|
"div",
|
|
1350
1356
|
{
|
|
1351
1357
|
class: [
|
|
@@ -1356,7 +1362,7 @@ const wa = xt(
|
|
|
1356
1362
|
n.code
|
|
1357
1363
|
)
|
|
1358
1364
|
]);
|
|
1359
|
-
return
|
|
1365
|
+
return B(
|
|
1360
1366
|
ge.FmTooltip,
|
|
1361
1367
|
{
|
|
1362
1368
|
zIndex: 51
|
|
@@ -1366,7 +1372,7 @@ const wa = xt(
|
|
|
1366
1372
|
return u ? "Adjustment difference is more than 10%." : `${n.code} - ${n.name}`;
|
|
1367
1373
|
},
|
|
1368
1374
|
default() {
|
|
1369
|
-
return
|
|
1375
|
+
return B("div", { class: "flex items-center gap-4 justify-start w-full" }, [
|
|
1370
1376
|
l
|
|
1371
1377
|
]);
|
|
1372
1378
|
}
|
|
@@ -1381,7 +1387,7 @@ const wa = xt(
|
|
|
1381
1387
|
size: 160,
|
|
1382
1388
|
cell(v) {
|
|
1383
1389
|
const n = v.row.original.costPerUnit;
|
|
1384
|
-
return
|
|
1390
|
+
return B("div", { class: "text-right" }, n.toFixed(2));
|
|
1385
1391
|
},
|
|
1386
1392
|
meta: {
|
|
1387
1393
|
textAlign: "right"
|
|
@@ -1392,23 +1398,23 @@ const wa = xt(
|
|
|
1392
1398
|
header: () => "UOM",
|
|
1393
1399
|
size: 120,
|
|
1394
1400
|
cell(v) {
|
|
1395
|
-
var
|
|
1401
|
+
var $;
|
|
1396
1402
|
const n = v.row.original, o = n.costUnit, u = n.baseUnit, l = o ?? u;
|
|
1397
1403
|
if (o && o !== u) {
|
|
1398
|
-
const A = q.value.find((N) => N._id === n.id), L = (
|
|
1404
|
+
const A = q.value.find((N) => N._id === n.id), L = ($ = A == null ? void 0 : A.defaultCost) == null ? void 0 : $.measurement;
|
|
1399
1405
|
if (L) {
|
|
1400
1406
|
const N = L.conversion.amount / Math.pow(10, L.conversion.precision);
|
|
1401
|
-
return
|
|
1402
|
-
|
|
1407
|
+
return B("div", { class: "flex flex-col" }, [
|
|
1408
|
+
B(
|
|
1403
1409
|
"span",
|
|
1404
1410
|
{ class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
|
|
1405
1411
|
l
|
|
1406
1412
|
),
|
|
1407
|
-
|
|
1413
|
+
B("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, [
|
|
1408
1414
|
"1 ",
|
|
1409
|
-
|
|
1415
|
+
B("span", { class: "fm-typo-en-body-sm-600" }, o),
|
|
1410
1416
|
` = ${N} `,
|
|
1411
|
-
|
|
1417
|
+
B("span", { class: "fm-typo-en-body-sm-600" }, u)
|
|
1412
1418
|
])
|
|
1413
1419
|
]);
|
|
1414
1420
|
}
|
|
@@ -1423,7 +1429,7 @@ const wa = xt(
|
|
|
1423
1429
|
size: 150,
|
|
1424
1430
|
cell(v) {
|
|
1425
1431
|
const n = v.row.original.opening;
|
|
1426
|
-
return
|
|
1432
|
+
return B("div", { class: "text-right" }, n.toFixed(2));
|
|
1427
1433
|
},
|
|
1428
1434
|
meta: {
|
|
1429
1435
|
textAlign: "right"
|
|
@@ -1434,11 +1440,11 @@ const wa = xt(
|
|
|
1434
1440
|
(v) => ({
|
|
1435
1441
|
id: `adjustment_${v}`,
|
|
1436
1442
|
accessorFn: (n) => n.adjustmentAmounts[v] ?? { amount: 0, precision: 0 },
|
|
1437
|
-
header: () => te(
|
|
1443
|
+
header: () => te(Oe(v)),
|
|
1438
1444
|
size: 150,
|
|
1439
1445
|
cell(n) {
|
|
1440
1446
|
const o = n.row.original.adjustmentAmounts[v] ?? { amount: 0, precision: 0 };
|
|
1441
|
-
return
|
|
1447
|
+
return B("div", { class: "text-right" }, Xe(o));
|
|
1442
1448
|
},
|
|
1443
1449
|
meta: {
|
|
1444
1450
|
textAlign: "right"
|
|
@@ -1466,17 +1472,17 @@ const wa = xt(
|
|
|
1466
1472
|
var A;
|
|
1467
1473
|
const n = v.row.original, o = E.fromNumber(n.physicalBalance);
|
|
1468
1474
|
let u = !0, l = n.physicalBalance;
|
|
1469
|
-
const
|
|
1470
|
-
return
|
|
1475
|
+
const $ = (A = D.value.find((L) => L.id === n.id)) == null ? void 0 : A.balance;
|
|
1476
|
+
return $ && (E.equals({
|
|
1471
1477
|
a: o,
|
|
1472
|
-
b:
|
|
1473
|
-
}) || (u = !1, l = Number(E.toFormatString({ value:
|
|
1474
|
-
|
|
1478
|
+
b: $
|
|
1479
|
+
}) || (u = !1, l = Number(E.toFormatString({ value: $ })))), B("div", { class: "flex flex-col" }, [
|
|
1480
|
+
B(
|
|
1475
1481
|
"span",
|
|
1476
1482
|
{ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
|
|
1477
1483
|
l
|
|
1478
1484
|
),
|
|
1479
|
-
u ? null :
|
|
1485
|
+
u ? null : B(
|
|
1480
1486
|
"span",
|
|
1481
1487
|
{ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
|
|
1482
1488
|
`Draft: ${n.physicalBalance.toString()}`
|
|
@@ -1504,7 +1510,7 @@ const wa = xt(
|
|
|
1504
1510
|
size: 150,
|
|
1505
1511
|
cell(v) {
|
|
1506
1512
|
const n = v.row.original.varianceInCost;
|
|
1507
|
-
return
|
|
1513
|
+
return B(
|
|
1508
1514
|
"div",
|
|
1509
1515
|
{ class: "text-right" },
|
|
1510
1516
|
n.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })
|
|
@@ -1527,10 +1533,10 @@ const wa = xt(
|
|
|
1527
1533
|
if (!n) return xn;
|
|
1528
1534
|
const o = n.toFixed(2);
|
|
1529
1535
|
if (o === "0.00")
|
|
1530
|
-
return
|
|
1536
|
+
return B("div", { class: "flex items-center gap-4 justify-end" }, ["0.00"]);
|
|
1531
1537
|
const u = n > 0;
|
|
1532
|
-
return
|
|
1533
|
-
|
|
1538
|
+
return B("div", { class: "flex items-center gap-4 justify-end" }, [
|
|
1539
|
+
B(ge.FmIcon, {
|
|
1534
1540
|
name: u ? "arrow_drop_up" : "arrow_drop_down",
|
|
1535
1541
|
color: u ? "system-success-300" : "system-error-300",
|
|
1536
1542
|
size: "md"
|
|
@@ -1549,18 +1555,18 @@ const wa = xt(
|
|
|
1549
1555
|
size: 180,
|
|
1550
1556
|
cell(v) {
|
|
1551
1557
|
var L;
|
|
1552
|
-
const n = v.row.original, o = n.stockTakeValue, u = q.value.find((N) => N._id === n.id), l = (L = u == null ? void 0 : u.defaultCost) == null ? void 0 : L.measurement,
|
|
1558
|
+
const n = v.row.original, o = n.stockTakeValue, u = q.value.find((N) => N._id === n.id), l = (L = u == null ? void 0 : u.defaultCost) == null ? void 0 : L.measurement, $ = n.physicalBalance, A = n.costPerUnit;
|
|
1553
1559
|
if (l) {
|
|
1554
|
-
const N = E.toFormatString({ value: l.conversion }),
|
|
1555
|
-
return
|
|
1560
|
+
const N = E.toFormatString({ value: l.conversion }), ie = `${$.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${n.baseUnit} ÷ ${N} × ${A} ${d.value}`;
|
|
1561
|
+
return B(
|
|
1556
1562
|
ge.FmTooltip,
|
|
1557
1563
|
{ zIndex: 51 },
|
|
1558
1564
|
{
|
|
1559
1565
|
content() {
|
|
1560
|
-
return
|
|
1566
|
+
return ie;
|
|
1561
1567
|
},
|
|
1562
1568
|
default() {
|
|
1563
|
-
return
|
|
1569
|
+
return B(
|
|
1564
1570
|
"div",
|
|
1565
1571
|
{ class: "text-right" },
|
|
1566
1572
|
o.toLocaleString("en-US", {
|
|
@@ -1572,8 +1578,8 @@ const wa = xt(
|
|
|
1572
1578
|
}
|
|
1573
1579
|
);
|
|
1574
1580
|
} else {
|
|
1575
|
-
const N = `${
|
|
1576
|
-
return
|
|
1581
|
+
const N = `${$.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${n.baseUnit} × ${A} ${d.value}`;
|
|
1582
|
+
return B(
|
|
1577
1583
|
ge.FmTooltip,
|
|
1578
1584
|
{ zIndex: 51 },
|
|
1579
1585
|
{
|
|
@@ -1581,7 +1587,7 @@ const wa = xt(
|
|
|
1581
1587
|
return N;
|
|
1582
1588
|
},
|
|
1583
1589
|
default() {
|
|
1584
|
-
return
|
|
1590
|
+
return B(
|
|
1585
1591
|
"div",
|
|
1586
1592
|
{ class: "text-right" },
|
|
1587
1593
|
o.toLocaleString("en-US", {
|
|
@@ -1605,18 +1611,18 @@ const wa = xt(
|
|
|
1605
1611
|
size: 180,
|
|
1606
1612
|
cell(v) {
|
|
1607
1613
|
var L;
|
|
1608
|
-
const n = v.row.original, o = n.systemValue, u = q.value.find((N) => N._id === n.id), l = (L = u == null ? void 0 : u.defaultCost) == null ? void 0 : L.measurement,
|
|
1614
|
+
const n = v.row.original, o = n.systemValue, u = q.value.find((N) => N._id === n.id), l = (L = u == null ? void 0 : u.defaultCost) == null ? void 0 : L.measurement, $ = n.systemBalance, A = n.costPerUnit;
|
|
1609
1615
|
if (l) {
|
|
1610
|
-
const N = E.toFormatString({ value: l.conversion }),
|
|
1611
|
-
return
|
|
1616
|
+
const N = E.toFormatString({ value: l.conversion }), ie = `${$.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${n.baseUnit} ÷ ${N} × ${A} ${d.value}`;
|
|
1617
|
+
return B(
|
|
1612
1618
|
ge.FmTooltip,
|
|
1613
1619
|
{ zIndex: 51 },
|
|
1614
1620
|
{
|
|
1615
1621
|
content() {
|
|
1616
|
-
return
|
|
1622
|
+
return ie;
|
|
1617
1623
|
},
|
|
1618
1624
|
default() {
|
|
1619
|
-
return
|
|
1625
|
+
return B(
|
|
1620
1626
|
"div",
|
|
1621
1627
|
{ class: "text-right" },
|
|
1622
1628
|
o.toLocaleString("en-US", {
|
|
@@ -1628,8 +1634,8 @@ const wa = xt(
|
|
|
1628
1634
|
}
|
|
1629
1635
|
);
|
|
1630
1636
|
} else {
|
|
1631
|
-
const N = `${
|
|
1632
|
-
return
|
|
1637
|
+
const N = `${$.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${n.baseUnit} × ${A} ${d.value}`;
|
|
1638
|
+
return B(
|
|
1633
1639
|
ge.FmTooltip,
|
|
1634
1640
|
{ zIndex: 51 },
|
|
1635
1641
|
{
|
|
@@ -1637,7 +1643,7 @@ const wa = xt(
|
|
|
1637
1643
|
return N;
|
|
1638
1644
|
},
|
|
1639
1645
|
default() {
|
|
1640
|
-
return
|
|
1646
|
+
return B(
|
|
1641
1647
|
"div",
|
|
1642
1648
|
{ class: "text-right" },
|
|
1643
1649
|
o.toLocaleString("en-US", {
|
|
@@ -1659,41 +1665,41 @@ const wa = xt(
|
|
|
1659
1665
|
header: () => "Amounts",
|
|
1660
1666
|
enableSorting: !1,
|
|
1661
1667
|
cell(v) {
|
|
1662
|
-
const n = v.row.original, o = (l,
|
|
1668
|
+
const n = v.row.original, o = (l, $) => B(
|
|
1663
1669
|
ge.FmTooltip,
|
|
1664
1670
|
{ zIndex: 50 },
|
|
1665
1671
|
{
|
|
1666
1672
|
default() {
|
|
1667
|
-
return
|
|
1673
|
+
return B(
|
|
1668
1674
|
"div",
|
|
1669
1675
|
{
|
|
1670
1676
|
class: "fm-typo-en-body-md-400 py-4 px-8 border-1 border-fm-color-typo-secondary fm-corner-radius-md line-clamp-1"
|
|
1671
1677
|
},
|
|
1672
1678
|
[
|
|
1673
|
-
|
|
1674
|
-
|
|
1679
|
+
B("span", { class: "text-fm-color-typo-primary" }, `${l} `),
|
|
1680
|
+
B(
|
|
1675
1681
|
"span",
|
|
1676
1682
|
{
|
|
1677
1683
|
class: "text-fm-color-typo-secondary",
|
|
1678
1684
|
style: { maxWidth: "80px" }
|
|
1679
1685
|
},
|
|
1680
|
-
|
|
1686
|
+
$
|
|
1681
1687
|
)
|
|
1682
1688
|
]
|
|
1683
1689
|
);
|
|
1684
1690
|
},
|
|
1685
1691
|
content() {
|
|
1686
|
-
return `${l} ${
|
|
1692
|
+
return `${l} ${$}`;
|
|
1687
1693
|
}
|
|
1688
1694
|
}
|
|
1689
1695
|
);
|
|
1690
|
-
let u = Array.from({ length:
|
|
1691
|
-
if (!n[`measurementAmount${
|
|
1696
|
+
let u = Array.from({ length: c }).map((l, $) => {
|
|
1697
|
+
if (!n[`measurementAmount${$}`])
|
|
1692
1698
|
return null;
|
|
1693
|
-
const A = n[`measurementAmount${
|
|
1699
|
+
const A = n[`measurementAmount${$}`], L = n[`measurementAbbrev${$}`];
|
|
1694
1700
|
return o(A, L);
|
|
1695
1701
|
}).filter((l) => l);
|
|
1696
|
-
return (n.baseUnitAmount || !u.length) && (u = [o(n.baseUnitAmount, n.baseUnit), ...u]),
|
|
1702
|
+
return (n.baseUnitAmount || !u.length) && (u = [o(n.baseUnitAmount, n.baseUnit), ...u]), B(
|
|
1697
1703
|
"div",
|
|
1698
1704
|
{
|
|
1699
1705
|
class: "flex gap-8 flex-nowrap",
|
|
@@ -1706,25 +1712,25 @@ const wa = xt(
|
|
|
1706
1712
|
}
|
|
1707
1713
|
}
|
|
1708
1714
|
];
|
|
1709
|
-
}),
|
|
1715
|
+
}), Pe = M(() => Te.value.map((c) => c.size ?? 0).reduce((c, a) => c + a)), xe = Y(""), je = M(() => {
|
|
1710
1716
|
var v, n;
|
|
1711
|
-
const
|
|
1717
|
+
const c = ((n = (v = e.draft) == null ? void 0 : v.negativeStockItems) == null ? void 0 : n.reduce(
|
|
1712
1718
|
(o, u) => (o[u.sku._id] = u, o),
|
|
1713
1719
|
{}
|
|
1714
1720
|
)) ?? {};
|
|
1715
1721
|
return q.value.map((o) => {
|
|
1716
1722
|
var rt, lt, it, ct, ut, dt, mt, ft, pt, vt, gt;
|
|
1717
|
-
const u = (rt = he.value.get(o._id)) == null ? void 0 : rt[0], l = ((lt = me.value.get(o._id)) == null ? void 0 : lt[0]) ?? b,
|
|
1723
|
+
const u = (rt = he.value.get(o._id)) == null ? void 0 : rt[0], l = ((lt = me.value.get(o._id)) == null ? void 0 : lt[0]) ?? b, $ = ((it = o.defaultCost) == null ? void 0 : it.costPerUnit) ?? b, A = Number(E.toFormatString({ value: $ })), L = ((ut = (ct = o.defaultCost) == null ? void 0 : ct.measurement) == null ? void 0 : ut.conversion) ?? {
|
|
1718
1724
|
amount: 1,
|
|
1719
1725
|
precision: 0
|
|
1720
1726
|
}, N = Number(
|
|
1721
1727
|
E.toFormatString({ value: L })
|
|
1722
|
-
),
|
|
1728
|
+
), ie = Ve.value.get(o._id), ue = ie ? Number(E.toFormatString({ value: ie })) : 0, De = ke.value.get(o._id), pe = {};
|
|
1723
1729
|
if (I.value.forEach((ee) => {
|
|
1724
1730
|
const de = pe[ee] ?? { amount: 0, precision: 0 }, fe = De == null ? void 0 : De[ee];
|
|
1725
1731
|
fe && (pe[ee] = Xt(de, fe));
|
|
1726
1732
|
}), !u) {
|
|
1727
|
-
const ee = Number(E.toFormatString({ value: l })), de = ee - 0, fe = de * A / N,
|
|
1733
|
+
const ee = Number(E.toFormatString({ value: l })), de = ee - 0, fe = de * A / N, Ne = 0, Pt = ee * A / N;
|
|
1728
1734
|
return {
|
|
1729
1735
|
id: o._id,
|
|
1730
1736
|
code: o.code,
|
|
@@ -1736,25 +1742,25 @@ const wa = xt(
|
|
|
1736
1742
|
physicalBalance: 0,
|
|
1737
1743
|
adjustedAmount: -ee,
|
|
1738
1744
|
adjustedDiffPercentage: -100,
|
|
1739
|
-
isTemplateItem: !
|
|
1745
|
+
isTemplateItem: !c[o._id],
|
|
1740
1746
|
costPerUnit: A,
|
|
1741
1747
|
opening: ue,
|
|
1742
1748
|
varianceQty: de,
|
|
1743
1749
|
varianceInCost: fe,
|
|
1744
|
-
stockTakeValue:
|
|
1745
|
-
systemValue:
|
|
1750
|
+
stockTakeValue: Ne,
|
|
1751
|
+
systemValue: Pt,
|
|
1746
1752
|
adjustmentAmounts: pe
|
|
1747
1753
|
};
|
|
1748
1754
|
}
|
|
1749
1755
|
const U = $t(u), X = (pt = (ft = D.value) == null ? void 0 : ft.find(
|
|
1750
1756
|
(ee) => ee.id === o._id
|
|
1751
|
-
)) == null ? void 0 : pt.balance, ae =
|
|
1757
|
+
)) == null ? void 0 : pt.balance, ae = St(
|
|
1752
1758
|
X ?? U,
|
|
1753
1759
|
l
|
|
1754
|
-
), ve = l.amount === 0 ? null :
|
|
1760
|
+
), ve = l.amount === 0 ? null : wt(ae, {
|
|
1755
1761
|
...l,
|
|
1756
1762
|
amount: Math.abs(l.amount)
|
|
1757
|
-
}),
|
|
1763
|
+
}), Fe = ve ? at(ve, G) : null, Ie = Number(E.toFormatString({ value: l })), We = Number(E.toFormatString({ value: U })), st = Ie - We, Ut = st * A / N, Rt = We * A / N, Vt = Ie * A / N;
|
|
1758
1764
|
return {
|
|
1759
1765
|
id: o._id,
|
|
1760
1766
|
code: o.code,
|
|
@@ -1763,37 +1769,37 @@ const wa = xt(
|
|
|
1763
1769
|
baseUnit: o.unit.abbrev,
|
|
1764
1770
|
baseUnitAmount: Number(E.toFormatString({ value: u.baseAmount })),
|
|
1765
1771
|
...u.measurementsAmounts.filter((ee) => {
|
|
1766
|
-
var de, fe,
|
|
1767
|
-
return (
|
|
1772
|
+
var de, fe, Ne;
|
|
1773
|
+
return (Ne = (fe = (de = C.value) == null ? void 0 : de.get(o._id)) == null ? void 0 : fe[0]) == null ? void 0 : Ne.includes(ee.measurement.id);
|
|
1768
1774
|
}).reduce((ee, de, fe) => (ee[`measurementAbbrev${fe}`] = `(${de.measurement.abbrev}) × ${E.toFormatString({ value: de.measurement.conversion })}`, ee[`measurementAmount${fe}`] = Number(E.toFormatString({ value: de.amount })), ee), {}),
|
|
1769
1775
|
systemBalance: Ie,
|
|
1770
1776
|
physicalBalance: We,
|
|
1771
1777
|
adjustedAmount: Number(E.toFormatString({ value: ae })),
|
|
1772
|
-
adjustedDiffPercentage:
|
|
1778
|
+
adjustedDiffPercentage: Fe ? Number(
|
|
1773
1779
|
E.toFormatString({
|
|
1774
|
-
value:
|
|
1780
|
+
value: Ft(Fe, 2)
|
|
1775
1781
|
})
|
|
1776
1782
|
) : null,
|
|
1777
|
-
isTemplateItem: !
|
|
1783
|
+
isTemplateItem: !c[o._id],
|
|
1778
1784
|
costPerUnit: A,
|
|
1779
1785
|
opening: ue,
|
|
1780
1786
|
varianceQty: st,
|
|
1781
1787
|
varianceInCost: Ut,
|
|
1782
1788
|
stockTakeValue: Rt,
|
|
1783
|
-
systemValue:
|
|
1789
|
+
systemValue: Vt,
|
|
1784
1790
|
adjustmentAmounts: pe
|
|
1785
1791
|
};
|
|
1786
|
-
}).filter((o) => !!(o.isTemplateItem &&
|
|
1792
|
+
}).filter((o) => !!(o.isTemplateItem && w.value.templateItem || !o.isTemplateItem && w.value.nonTemplateItem));
|
|
1787
1793
|
}), Ae = M(() => {
|
|
1788
1794
|
var a, v, n, o, u;
|
|
1789
1795
|
if (!e.draft) return [];
|
|
1790
|
-
const
|
|
1791
|
-
action: `Approve at ${
|
|
1796
|
+
const c = e.draft.approvedAt ? {
|
|
1797
|
+
action: `Approve at ${ye(e.draft.approvedAt)}`,
|
|
1792
1798
|
// actionAt: props.draft.approvedAt,
|
|
1793
1799
|
actionBy: e.draft.approvedBy,
|
|
1794
1800
|
remark: e.draft.approveRemark
|
|
1795
1801
|
} : (a = e.draft.rejectionHistory) == null ? void 0 : a.computeFirst((l) => ({
|
|
1796
|
-
action: `Reject at ${
|
|
1802
|
+
action: `Reject at ${ye(l.rejectedAt)}`,
|
|
1797
1803
|
// actionAt: e.rejectedAt,
|
|
1798
1804
|
actionBy: l.rejectedBy,
|
|
1799
1805
|
remark: l.rejectRemark
|
|
@@ -1801,11 +1807,11 @@ const wa = xt(
|
|
|
1801
1807
|
return [
|
|
1802
1808
|
{
|
|
1803
1809
|
label: "Location",
|
|
1804
|
-
value: ((v =
|
|
1810
|
+
value: ((v = R._currentLocation) == null ? void 0 : v.name) ?? "N/A"
|
|
1805
1811
|
},
|
|
1806
1812
|
{
|
|
1807
1813
|
label: "Created at",
|
|
1808
|
-
value:
|
|
1814
|
+
value: ye(e.draft.createdAt)
|
|
1809
1815
|
},
|
|
1810
1816
|
{
|
|
1811
1817
|
label: "Created by",
|
|
@@ -1813,7 +1819,7 @@ const wa = xt(
|
|
|
1813
1819
|
},
|
|
1814
1820
|
{
|
|
1815
1821
|
label: "Updated at",
|
|
1816
|
-
value:
|
|
1822
|
+
value: ye(e.draft.updatedAt)
|
|
1817
1823
|
},
|
|
1818
1824
|
{
|
|
1819
1825
|
label: "Updated by",
|
|
@@ -1821,7 +1827,7 @@ const wa = xt(
|
|
|
1821
1827
|
},
|
|
1822
1828
|
{
|
|
1823
1829
|
label: "Effective at",
|
|
1824
|
-
value:
|
|
1830
|
+
value: ye(e.draft.effectiveAt ?? He((n = e.draft) == null ? void 0 : n._id))
|
|
1825
1831
|
},
|
|
1826
1832
|
{
|
|
1827
1833
|
label: "Using template",
|
|
@@ -1831,20 +1837,20 @@ const wa = xt(
|
|
|
1831
1837
|
label: "Remark",
|
|
1832
1838
|
value: e.draft.remark
|
|
1833
1839
|
} : null,
|
|
1834
|
-
|
|
1840
|
+
c ? {
|
|
1835
1841
|
label: "Last action",
|
|
1836
|
-
value:
|
|
1842
|
+
value: c.action
|
|
1837
1843
|
} : null,
|
|
1838
|
-
|
|
1844
|
+
c && c.actionBy ? {
|
|
1839
1845
|
label: "Last action by",
|
|
1840
|
-
value: (u =
|
|
1846
|
+
value: (u = c.actionBy) == null ? void 0 : u.name
|
|
1841
1847
|
} : null,
|
|
1842
|
-
|
|
1848
|
+
c && c.remark ? {
|
|
1843
1849
|
label: "Action remark",
|
|
1844
|
-
value:
|
|
1850
|
+
value: c.remark
|
|
1845
1851
|
} : null
|
|
1846
1852
|
].filter((l) => l).map((l) => l);
|
|
1847
|
-
}),
|
|
1853
|
+
}), Se = [
|
|
1848
1854
|
{
|
|
1849
1855
|
label: "Overview",
|
|
1850
1856
|
value: "overview"
|
|
@@ -1853,32 +1859,32 @@ const wa = xt(
|
|
|
1853
1859
|
label: "Action history",
|
|
1854
1860
|
value: "history"
|
|
1855
1861
|
}
|
|
1856
|
-
], _e = Y(
|
|
1862
|
+
], _e = Y(Se[0]), we = M(() => {
|
|
1857
1863
|
var n, o, u;
|
|
1858
|
-
const
|
|
1864
|
+
const c = ((n = e.draft) == null ? void 0 : n.activityLogs) ?? [], a = ((o = e.draft) == null ? void 0 : o.rejectionHistory) ?? [];
|
|
1859
1865
|
for (const l of a)
|
|
1860
|
-
|
|
1866
|
+
c.find(
|
|
1861
1867
|
(A) => `${A.action}_${A.performedAt}` == `${Q.enum.rejectDraft}_${l.rejectedAt}`
|
|
1862
|
-
) ||
|
|
1868
|
+
) || c.push({
|
|
1863
1869
|
action: Q.enum.rejectDraft,
|
|
1864
1870
|
performedAt: l.rejectedAt,
|
|
1865
1871
|
performedBy: l.rejectedBy,
|
|
1866
1872
|
remark: l.rejectRemark
|
|
1867
1873
|
});
|
|
1868
|
-
return (u = e.draft) != null && u.approvedAt && (
|
|
1869
|
-
(
|
|
1874
|
+
return (u = e.draft) != null && u.approvedAt && (c.find(
|
|
1875
|
+
($) => {
|
|
1870
1876
|
var A;
|
|
1871
|
-
return `${
|
|
1877
|
+
return `${$.action}_${$.performedAt}` == `${Q.enum.approveDraft}_${(A = e.draft) == null ? void 0 : A.approvedAt}`;
|
|
1872
1878
|
}
|
|
1873
|
-
) ||
|
|
1879
|
+
) || c.push({
|
|
1874
1880
|
action: Q.enum.approveDraft,
|
|
1875
1881
|
performedAt: e.draft.approvedAt,
|
|
1876
1882
|
performedBy: e.draft.approvedBy ?? { name: "Unknown", id: "unknown" },
|
|
1877
1883
|
remark: e.draft.approveRemark
|
|
1878
|
-
})),
|
|
1884
|
+
})), c.sort((l, $) => new Date($.performedAt).getTime() - new Date(l.performedAt).getTime()).map(
|
|
1879
1885
|
(l) => ({
|
|
1880
|
-
header:
|
|
1881
|
-
date:
|
|
1886
|
+
header: Oe(l.action),
|
|
1887
|
+
date: ye(l.performedAt),
|
|
1882
1888
|
info: [
|
|
1883
1889
|
{
|
|
1884
1890
|
label: "Performed by",
|
|
@@ -1891,32 +1897,38 @@ const wa = xt(
|
|
|
1891
1897
|
]
|
|
1892
1898
|
})
|
|
1893
1899
|
);
|
|
1894
|
-
}), Me = Y(!1),
|
|
1900
|
+
}), Me = Y(!1), Le = Y(!1), jt = M(() => {
|
|
1895
1901
|
var o, u;
|
|
1896
|
-
const
|
|
1902
|
+
const c = je.value.filter((l) => l.physicalBalance < 0).map((l) => ({
|
|
1897
1903
|
code: l.code,
|
|
1898
1904
|
name: l.name
|
|
1899
1905
|
})), a = ((u = (o = _.stockBalance.skus) == null ? void 0 : o.filter((l) => l.balance.amount < 0)) == null ? void 0 : u.map((l) => l.id)) ?? [], v = new Set(q.value.map((l) => l._id)), n = a.filter((l) => !v.has(l)).map((l) => {
|
|
1900
|
-
var
|
|
1906
|
+
var $, A;
|
|
1901
1907
|
return {
|
|
1902
|
-
code: ((
|
|
1908
|
+
code: (($ = S.skuById[l]) == null ? void 0 : $.code) ?? "N/A",
|
|
1903
1909
|
name: ((A = S.skuById[l]) == null ? void 0 : A.name) ?? "N/A"
|
|
1904
1910
|
};
|
|
1905
1911
|
});
|
|
1906
|
-
return [...
|
|
1912
|
+
return [...c, ...n];
|
|
1907
1913
|
}), ot = M(() => {
|
|
1908
|
-
var
|
|
1909
|
-
return ((
|
|
1914
|
+
var c;
|
|
1915
|
+
return ((c = e.draft) == null ? void 0 : c.status) !== be.enum.DRAFT ? "Status is not draft." : null;
|
|
1910
1916
|
});
|
|
1911
1917
|
function It() {
|
|
1912
|
-
e.draft && (
|
|
1913
|
-
|
|
1914
|
-
|
|
1918
|
+
e.draft && (Le.value = !0, y.approveDraft(
|
|
1919
|
+
e.draft,
|
|
1920
|
+
() => {
|
|
1921
|
+
Le.value = !1, Me.value = !1, p("submitted");
|
|
1922
|
+
},
|
|
1923
|
+
() => {
|
|
1924
|
+
Le.value = !1;
|
|
1925
|
+
}
|
|
1926
|
+
));
|
|
1915
1927
|
}
|
|
1916
|
-
return (
|
|
1928
|
+
return (c, a) => {
|
|
1917
1929
|
var pe;
|
|
1918
|
-
const v = K("FmButtonGroup"), n = K("FmMenuDivider"), o = K("FmCard"), u = K("FmButton"), l = K("FmCircularProgress"),
|
|
1919
|
-
return
|
|
1930
|
+
const v = K("FmButtonGroup"), n = K("FmMenuDivider"), o = K("FmCard"), u = K("FmButton"), l = K("FmCircularProgress"), $ = K("FmChip"), A = K("FmTextField"), L = K("FmIcon"), N = K("FmTable"), ie = K("FmSpacer"), ue = K("FmTooltip"), De = K("FmSideSheet");
|
|
1931
|
+
return F(), P(oe, null, [
|
|
1920
1932
|
k(De, {
|
|
1921
1933
|
"dismiss-away": "",
|
|
1922
1934
|
"max-width": 9999,
|
|
@@ -1928,14 +1940,14 @@ const wa = xt(
|
|
|
1928
1940
|
var U, X, ae, ve;
|
|
1929
1941
|
return [
|
|
1930
1942
|
s("div", Dn, [
|
|
1931
|
-
((U = e.draft) == null ? void 0 : U.status) === g(
|
|
1932
|
-
ot.value ? (
|
|
1943
|
+
((U = e.draft) == null ? void 0 : U.status) === g(be).enum.DRAFT ? (F(), P(oe, { key: 0 }, [
|
|
1944
|
+
ot.value ? (F(), ce(ue, {
|
|
1933
1945
|
key: 0,
|
|
1934
1946
|
"z-index": 51,
|
|
1935
1947
|
placement: "right"
|
|
1936
1948
|
}, {
|
|
1937
1949
|
content: O(() => [
|
|
1938
|
-
|
|
1950
|
+
re(Z(ot.value), 1)
|
|
1939
1951
|
]),
|
|
1940
1952
|
default: O(() => [
|
|
1941
1953
|
k(u, {
|
|
@@ -1945,26 +1957,26 @@ const wa = xt(
|
|
|
1945
1957
|
})
|
|
1946
1958
|
]),
|
|
1947
1959
|
_: 1
|
|
1948
|
-
})) : (
|
|
1960
|
+
})) : (F(), ce(u, {
|
|
1949
1961
|
key: "approve key",
|
|
1950
1962
|
label: "Approve",
|
|
1951
|
-
onClick: a[5] || (a[5] = (
|
|
1963
|
+
onClick: a[5] || (a[5] = (Fe) => Me.value = !0)
|
|
1952
1964
|
}))
|
|
1953
1965
|
], 64)) : J("", !0),
|
|
1954
|
-
((X = e.draft) == null ? void 0 : X.status) === g(
|
|
1966
|
+
((X = e.draft) == null ? void 0 : X.status) === g(be).enum.DRAFT ? (F(), ce(u, {
|
|
1955
1967
|
key: 1,
|
|
1956
1968
|
label: "Reject",
|
|
1957
1969
|
variant: "destructive",
|
|
1958
1970
|
onClick: a[6] || (a[6] = () => e.draft && g(y).rejectDraft(e.draft, () => p("submitted")))
|
|
1959
1971
|
})) : J("", !0),
|
|
1960
|
-
(ae = e.draft) != null && ae.approvedAt && ((ve = e.draft) == null ? void 0 : ve.status) !== g(
|
|
1972
|
+
(ae = e.draft) != null && ae.approvedAt && ((ve = e.draft) == null ? void 0 : ve.status) !== g(be).enum.COMPLETED ? (F(), ce(Je, { key: 2 }, {
|
|
1961
1973
|
default: O(() => [
|
|
1962
1974
|
k(u, {
|
|
1963
1975
|
label: "Sync",
|
|
1964
|
-
loading:
|
|
1976
|
+
loading: T.value,
|
|
1965
1977
|
onClick: a[7] || (a[7] = () => {
|
|
1966
|
-
e.draft && (
|
|
1967
|
-
|
|
1978
|
+
e.draft && (T.value = !0, g(y).syncDraft(e.draft, () => {
|
|
1979
|
+
T.value = !1, p("submitted");
|
|
1968
1980
|
}));
|
|
1969
1981
|
})
|
|
1970
1982
|
}, null, 8, ["loading"])
|
|
@@ -1974,7 +1986,7 @@ const wa = xt(
|
|
|
1974
1986
|
k(u, {
|
|
1975
1987
|
label: "Close",
|
|
1976
1988
|
variant: "tertiary",
|
|
1977
|
-
onClick: a[8] || (a[8] = (
|
|
1989
|
+
onClick: a[8] || (a[8] = (Fe) => f.value = !1)
|
|
1978
1990
|
})
|
|
1979
1991
|
])
|
|
1980
1992
|
];
|
|
@@ -1983,12 +1995,12 @@ const wa = xt(
|
|
|
1983
1995
|
s("div", Ea, [
|
|
1984
1996
|
s("div", null, [
|
|
1985
1997
|
k(v, {
|
|
1986
|
-
items:
|
|
1998
|
+
items: Se,
|
|
1987
1999
|
modelValue: _e.value,
|
|
1988
2000
|
"onUpdate:modelValue": a[0] || (a[0] = (U) => _e.value = U)
|
|
1989
2001
|
}, null, 8, ["modelValue"])
|
|
1990
2002
|
]),
|
|
1991
|
-
_e.value.value === "overview" ? (
|
|
2003
|
+
_e.value.value === "overview" ? (F(), P(oe, { key: 0 }, [
|
|
1992
2004
|
k(o, {
|
|
1993
2005
|
variant: "outlined",
|
|
1994
2006
|
class: "flex flex-col gap-8 px-12 py-16"
|
|
@@ -2000,13 +2012,13 @@ const wa = xt(
|
|
|
2000
2012
|
a[11] || (a[11] = s("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
|
|
2001
2013
|
s("div", Ha, [
|
|
2002
2014
|
s("div", {
|
|
2003
|
-
class: Be(["fm-status-badge", g(
|
|
2004
|
-
}, Z(g(
|
|
2015
|
+
class: Be(["fm-status-badge", g(Ke)(((U = c.draft) == null ? void 0 : U.status) ?? "DRAFT")])
|
|
2016
|
+
}, Z(g(Oe)(((X = c.draft) == null ? void 0 : X.status) ?? "")), 3)
|
|
2005
2017
|
])
|
|
2006
2018
|
]),
|
|
2007
2019
|
k(n),
|
|
2008
2020
|
s("div", Oa, [
|
|
2009
|
-
(
|
|
2021
|
+
(F(!0), P(oe, null, $e(Ae.value, (ae, ve) => (F(), P("div", {
|
|
2010
2022
|
class: "flex flex-col gap-4",
|
|
2011
2023
|
key: ve
|
|
2012
2024
|
}, [
|
|
@@ -2023,18 +2035,7 @@ const wa = xt(
|
|
|
2023
2035
|
s("div", qa, [
|
|
2024
2036
|
s("div", Ga, [
|
|
2025
2037
|
a[12] || (a[12] = s("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
|
|
2026
|
-
|
|
2027
|
-
i.draft && i.draft.status !== g(ye).enum.COMPLETED ? (w(), re(u, {
|
|
2028
|
-
key: 0,
|
|
2029
|
-
label: "Refresh balance",
|
|
2030
|
-
"prepend-icon": "refresh",
|
|
2031
|
-
variant: "secondary",
|
|
2032
|
-
"text-color": "primary",
|
|
2033
|
-
"bg-color": "transparent",
|
|
2034
|
-
"border-color": "primary",
|
|
2035
|
-
loading: R.value,
|
|
2036
|
-
onClick: oe
|
|
2037
|
-
}, null, 8, ["loading"])) : J("", !0),
|
|
2038
|
+
j.value ? J("", !0) : (F(), P("div", Wa, [
|
|
2038
2039
|
k(Je, null, {
|
|
2039
2040
|
default: O(() => [
|
|
2040
2041
|
k(u, {
|
|
@@ -2044,8 +2045,8 @@ const wa = xt(
|
|
|
2044
2045
|
"text-color": "primary",
|
|
2045
2046
|
"bg-color": "transparent",
|
|
2046
2047
|
"border-color": "primary",
|
|
2047
|
-
loading:
|
|
2048
|
-
onClick:
|
|
2048
|
+
loading: V.value,
|
|
2049
|
+
onClick: le
|
|
2049
2050
|
}, null, 8, ["loading"])
|
|
2050
2051
|
]),
|
|
2051
2052
|
_: 1
|
|
@@ -2057,15 +2058,15 @@ const wa = xt(
|
|
|
2057
2058
|
"text-color": "primary",
|
|
2058
2059
|
"bg-color": "transparent",
|
|
2059
2060
|
"border-color": "primary",
|
|
2060
|
-
onClick: a[1] || (a[1] = (U) =>
|
|
2061
|
-
|
|
2061
|
+
onClick: a[1] || (a[1] = (U) => c.draft ? g(y).exportDraft(
|
|
2062
|
+
c.draft,
|
|
2062
2063
|
x.value,
|
|
2063
2064
|
D.value
|
|
2064
2065
|
) : null)
|
|
2065
2066
|
})
|
|
2066
2067
|
]))
|
|
2067
2068
|
]),
|
|
2068
|
-
|
|
2069
|
+
j.value ? (F(), P("div", Za, [
|
|
2069
2070
|
a[14] || (a[14] = s("div", { class: "h-80" }, null, -1)),
|
|
2070
2071
|
s("div", Ja, [
|
|
2071
2072
|
s("div", null, [
|
|
@@ -2074,18 +2075,18 @@ const wa = xt(
|
|
|
2074
2075
|
a[13] || (a[13] = s("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
|
|
2075
2076
|
]),
|
|
2076
2077
|
a[15] || (a[15] = s("div", { class: "h-80" }, null, -1))
|
|
2077
|
-
])) : (
|
|
2078
|
+
])) : (F(), P(oe, { key: 1 }, [
|
|
2078
2079
|
s("div", Xa, [
|
|
2079
2080
|
s("div", en, [
|
|
2080
|
-
k(
|
|
2081
|
+
k($, {
|
|
2081
2082
|
label: "Template Item(s)",
|
|
2082
|
-
selected:
|
|
2083
|
-
onClick: a[2] || (a[2] = (U) =>
|
|
2083
|
+
selected: w.value.templateItem,
|
|
2084
|
+
onClick: a[2] || (a[2] = (U) => w.value.templateItem = !w.value.templateItem)
|
|
2084
2085
|
}, null, 8, ["selected"]),
|
|
2085
|
-
k(
|
|
2086
|
+
k($, {
|
|
2086
2087
|
label: "Non-template Item(s)",
|
|
2087
|
-
selected:
|
|
2088
|
-
onClick: a[3] || (a[3] = (U) =>
|
|
2088
|
+
selected: w.value.nonTemplateItem,
|
|
2089
|
+
onClick: a[3] || (a[3] = (U) => w.value.nonTemplateItem = !w.value.nonTemplateItem)
|
|
2089
2090
|
}, null, 8, ["selected"])
|
|
2090
2091
|
]),
|
|
2091
2092
|
k(A, {
|
|
@@ -2094,8 +2095,8 @@ const wa = xt(
|
|
|
2094
2095
|
placeholder: "Filter items"
|
|
2095
2096
|
}, null, 8, ["modelValue"])
|
|
2096
2097
|
]),
|
|
2097
|
-
g(S).skuTags.size ? (
|
|
2098
|
-
(
|
|
2098
|
+
g(S).skuTags.size ? (F(), P("div", tn, [
|
|
2099
|
+
(F(!0), P(oe, null, $e(g(S).skuTags.keys(), (U) => (F(), ce($, {
|
|
2099
2100
|
key: `${U}`,
|
|
2100
2101
|
label: `${U}`,
|
|
2101
2102
|
selectable: "",
|
|
@@ -2103,7 +2104,7 @@ const wa = xt(
|
|
|
2103
2104
|
onClick: (X) => z[`${U}`] = !z[`${U}`]
|
|
2104
2105
|
}, {
|
|
2105
2106
|
default: O(() => [
|
|
2106
|
-
z[`${U}`] ? (
|
|
2107
|
+
z[`${U}`] ? (F(), ce(L, {
|
|
2107
2108
|
key: 0,
|
|
2108
2109
|
name: "check",
|
|
2109
2110
|
class: "text-white",
|
|
@@ -2124,7 +2125,7 @@ const wa = xt(
|
|
|
2124
2125
|
])) : J("", !0),
|
|
2125
2126
|
s("div", an, [
|
|
2126
2127
|
s("div", {
|
|
2127
|
-
style: ht({ height: "600px", minWidth: `${
|
|
2128
|
+
style: ht({ height: "600px", minWidth: `${Pe.value}px` })
|
|
2128
2129
|
}, [
|
|
2129
2130
|
k(N, {
|
|
2130
2131
|
"column-defs": Te.value,
|
|
@@ -2136,9 +2137,9 @@ const wa = xt(
|
|
|
2136
2137
|
], 64))
|
|
2137
2138
|
])
|
|
2138
2139
|
], 64)) : J("", !0),
|
|
2139
|
-
_e.value.value === "history" ? (
|
|
2140
|
-
|
|
2141
|
-
(
|
|
2140
|
+
_e.value.value === "history" ? (F(), P("div", nn, [
|
|
2141
|
+
we.value.length ? (F(), P("div", rn, [
|
|
2142
|
+
(F(!0), P(oe, null, $e(we.value, (U, X) => (F(), P(oe, { key: X }, [
|
|
2142
2143
|
s("div", ln, [
|
|
2143
2144
|
s("div", cn, [
|
|
2144
2145
|
s("div", un, [
|
|
@@ -2157,8 +2158,8 @@ const wa = xt(
|
|
|
2157
2158
|
s("div", {
|
|
2158
2159
|
class: Be([
|
|
2159
2160
|
{
|
|
2160
|
-
"bg-fm-color-primary": X <
|
|
2161
|
-
"bg-white": X >=
|
|
2161
|
+
"bg-fm-color-primary": X < we.value.length - 1,
|
|
2162
|
+
"bg-white": X >= we.value.length - 1
|
|
2162
2163
|
},
|
|
2163
2164
|
"w-[2px] h-full"
|
|
2164
2165
|
])
|
|
@@ -2176,8 +2177,8 @@ const wa = xt(
|
|
|
2176
2177
|
s("div", {
|
|
2177
2178
|
class: Be([
|
|
2178
2179
|
{
|
|
2179
|
-
"bg-fm-color-primary": X <
|
|
2180
|
-
"bg-white": X >=
|
|
2180
|
+
"bg-fm-color-primary": X < we.value.length - 1,
|
|
2181
|
+
"bg-white": X >= we.value.length - 1
|
|
2181
2182
|
},
|
|
2182
2183
|
"w-[2px] h-full"
|
|
2183
2184
|
])
|
|
@@ -2191,16 +2192,16 @@ const wa = xt(
|
|
|
2191
2192
|
}, {
|
|
2192
2193
|
default: O(() => [
|
|
2193
2194
|
s("div", hn, [
|
|
2194
|
-
(
|
|
2195
|
+
(F(!0), P(oe, null, $e(U.info, (ae, ve) => (F(), P("div", {
|
|
2195
2196
|
key: ve,
|
|
2196
2197
|
class: "flex flex-col gap-4"
|
|
2197
2198
|
}, [
|
|
2198
2199
|
s("div", kn, Z(ae == null ? void 0 : ae.label), 1),
|
|
2199
2200
|
s("div", _n, [
|
|
2200
|
-
(
|
|
2201
|
+
(F(!0), P(oe, null, $e(ae == null ? void 0 : ae.values, (Fe, Ie) => (F(), P("div", {
|
|
2201
2202
|
key: Ie,
|
|
2202
2203
|
class: "fm-typo-en-body-lg-600"
|
|
2203
|
-
}, Z(
|
|
2204
|
+
}, Z(Fe), 1))), 128))
|
|
2204
2205
|
])
|
|
2205
2206
|
]))), 128))
|
|
2206
2207
|
])
|
|
@@ -2210,8 +2211,8 @@ const wa = xt(
|
|
|
2210
2211
|
])
|
|
2211
2212
|
])
|
|
2212
2213
|
], 64))), 128))
|
|
2213
|
-
])) : (
|
|
2214
|
-
k(
|
|
2214
|
+
])) : (F(), P("div", on, [
|
|
2215
|
+
k(ie),
|
|
2215
2216
|
s("div", null, [
|
|
2216
2217
|
s("img", {
|
|
2217
2218
|
src: g(ra),
|
|
@@ -2220,34 +2221,34 @@ const wa = xt(
|
|
|
2220
2221
|
]),
|
|
2221
2222
|
a[16] || (a[16] = s("div", { class: "fm-typo-en-body-lg-600" }, Z("No records found"), -1)),
|
|
2222
2223
|
a[17] || (a[17] = s("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, Z("You can track approval and rejection history here"), -1)),
|
|
2223
|
-
k(
|
|
2224
|
-
k(
|
|
2224
|
+
k(ie),
|
|
2225
|
+
k(ie)
|
|
2225
2226
|
]))
|
|
2226
2227
|
])) : J("", !0)
|
|
2227
2228
|
])
|
|
2228
2229
|
]),
|
|
2229
2230
|
_: 1
|
|
2230
2231
|
}, 8, ["model-value"]),
|
|
2231
|
-
g(f) ? (
|
|
2232
|
+
g(f) ? (F(), ce(Na, {
|
|
2232
2233
|
key: 0,
|
|
2233
2234
|
show: Me.value,
|
|
2234
2235
|
"onUpdate:show": a[10] || (a[10] = (U) => Me.value = U),
|
|
2235
2236
|
"negative-items": jt.value,
|
|
2236
|
-
refreshing:
|
|
2237
|
-
approving:
|
|
2237
|
+
refreshing: V.value,
|
|
2238
|
+
approving: Le.value,
|
|
2238
2239
|
"has-stock-snapshot": !!((pe = e.draft) != null && pe.stockSnapshot),
|
|
2239
|
-
onRefresh:
|
|
2240
|
+
onRefresh: se,
|
|
2240
2241
|
onApprove: It
|
|
2241
2242
|
}, null, 8, ["show", "negative-items", "refreshing", "approving", "has-stock-snapshot"])) : J("", !0)
|
|
2242
2243
|
], 64);
|
|
2243
2244
|
};
|
|
2244
2245
|
}
|
|
2245
|
-
}),
|
|
2246
|
+
}), Sn = { class: "flex-1 flex flex-col gap-8" }, wn = { class: "flex flex-col" }, Fn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Cn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, $n = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, Bn = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, Wn = /* @__PURE__ */ Re({
|
|
2246
2247
|
__name: "ClosingDraftView",
|
|
2247
|
-
setup(
|
|
2248
|
-
const { t: r } = _t(), { viewDraft: e } =
|
|
2248
|
+
setup(i) {
|
|
2249
|
+
const { t: r } = _t(), { viewDraft: e } = Qe(), { viewClosingDraftProps: d, viewClosingDraftShow: _ } = Gt(Qe()), y = qe(), f = Sa(), j = Et(), { breakpoints: V } = Kt();
|
|
2249
2250
|
y.watchLocation(f.fetchDrafts);
|
|
2250
|
-
const
|
|
2251
|
+
const T = M(() => f.loading), x = Y(""), D = M(() => V.value.xs || V.value.sm), I = M(() => D.value ? 10 : 20);
|
|
2251
2252
|
function W(S) {
|
|
2252
2253
|
switch (S) {
|
|
2253
2254
|
case "refresh":
|
|
@@ -2270,9 +2271,9 @@ const wa = xt(
|
|
|
2270
2271
|
isPrimary: !1
|
|
2271
2272
|
}
|
|
2272
2273
|
]);
|
|
2273
|
-
return (S,
|
|
2274
|
+
return (S, R) => {
|
|
2274
2275
|
const z = K("FmTable");
|
|
2275
|
-
return
|
|
2276
|
+
return F(), P(oe, null, [
|
|
2276
2277
|
k(zt, {
|
|
2277
2278
|
title: g(r)("inventory.closing.draft.title"),
|
|
2278
2279
|
actions: t.value,
|
|
@@ -2292,15 +2293,15 @@ const wa = xt(
|
|
|
2292
2293
|
"change-location": "",
|
|
2293
2294
|
searchable: "",
|
|
2294
2295
|
search: x.value,
|
|
2295
|
-
"onUpdate:search":
|
|
2296
|
+
"onUpdate:search": R[0] || (R[0] = (h) => x.value = h)
|
|
2296
2297
|
}, null, 8, ["search"]),
|
|
2297
2298
|
k(z, {
|
|
2298
|
-
style: ht(g(
|
|
2299
|
+
style: ht(g(j).tableHeight),
|
|
2299
2300
|
"column-defs": g(f).columnDefs,
|
|
2300
2301
|
"row-data": g(f).drafts,
|
|
2301
2302
|
"search-value": x.value,
|
|
2302
|
-
loading:
|
|
2303
|
-
onRowClick:
|
|
2303
|
+
loading: T.value,
|
|
2304
|
+
onRowClick: R[1] || (R[1] = (h) => g(e)(h.original)),
|
|
2304
2305
|
"page-size": I.value
|
|
2305
2306
|
}, {
|
|
2306
2307
|
"list-row": O((h) => [
|
|
@@ -2309,20 +2310,20 @@ const wa = xt(
|
|
|
2309
2310
|
onRowClick: (p) => g(e)(p)
|
|
2310
2311
|
}, {
|
|
2311
2312
|
default: O((p) => {
|
|
2312
|
-
var
|
|
2313
|
+
var w, H, q, C, b, G, ne, se, le, me, he, ke, Ve, te, Te, Pe, xe, je, Ae, Se;
|
|
2313
2314
|
return [
|
|
2314
|
-
s("div",
|
|
2315
|
-
s("div",
|
|
2316
|
-
s("div",
|
|
2317
|
-
k(g(
|
|
2318
|
-
render: (q = (H = (
|
|
2319
|
-
props: (b = (
|
|
2315
|
+
s("div", Sn, [
|
|
2316
|
+
s("div", wn, [
|
|
2317
|
+
s("div", Fn, [
|
|
2318
|
+
k(g(Ee), {
|
|
2319
|
+
render: (q = (H = (w = p._id) == null ? void 0 : w.column) == null ? void 0 : H.columnDef) == null ? void 0 : q.cell,
|
|
2320
|
+
props: (b = (C = p._id) == null ? void 0 : C.getContext) == null ? void 0 : b.call(C)
|
|
2320
2321
|
}, null, 8, ["render", "props"])
|
|
2321
2322
|
]),
|
|
2322
|
-
s("div",
|
|
2323
|
-
k(g(
|
|
2324
|
-
render: (
|
|
2325
|
-
props: (me = (
|
|
2323
|
+
s("div", Cn, [
|
|
2324
|
+
k(g(Ee), {
|
|
2325
|
+
render: (se = (ne = (G = p.name) == null ? void 0 : G.column) == null ? void 0 : ne.columnDef) == null ? void 0 : se.cell,
|
|
2326
|
+
props: (me = (le = p.name) == null ? void 0 : le.getContext) == null ? void 0 : me.call(le)
|
|
2326
2327
|
}, null, 8, ["render", "props"])
|
|
2327
2328
|
]),
|
|
2328
2329
|
s("div", $n, Z([
|
|
@@ -2330,16 +2331,16 @@ const wa = xt(
|
|
|
2330
2331
|
...h.original.items.length >= 3 ? [`and ${h.original.items.length - 3} more items`] : []
|
|
2331
2332
|
].join(", ")), 1),
|
|
2332
2333
|
s("div", Bn, [
|
|
2333
|
-
k(g(
|
|
2334
|
-
render: (
|
|
2334
|
+
k(g(Ee), {
|
|
2335
|
+
render: (Ve = (ke = (he = p.ref) == null ? void 0 : he.column) == null ? void 0 : ke.columnDef) == null ? void 0 : Ve.cell,
|
|
2335
2336
|
props: (Te = (te = p.ref) == null ? void 0 : te.getContext) == null ? void 0 : Te.call(te)
|
|
2336
2337
|
}, null, 8, ["render", "props"])
|
|
2337
2338
|
])
|
|
2338
2339
|
]),
|
|
2339
2340
|
s("div", null, [
|
|
2340
|
-
k(g(
|
|
2341
|
-
render: (je = (xe = (
|
|
2342
|
-
props: (
|
|
2341
|
+
k(g(Ee), {
|
|
2342
|
+
render: (je = (xe = (Pe = p.status) == null ? void 0 : Pe.column) == null ? void 0 : xe.columnDef) == null ? void 0 : je.cell,
|
|
2343
|
+
props: (Se = (Ae = p.status) == null ? void 0 : Ae.getContext) == null ? void 0 : Se.call(Ae)
|
|
2343
2344
|
}, null, 8, ["render", "props"])
|
|
2344
2345
|
])
|
|
2345
2346
|
])
|
|
@@ -2354,12 +2355,12 @@ const wa = xt(
|
|
|
2354
2355
|
]),
|
|
2355
2356
|
_: 1
|
|
2356
2357
|
}, 8, ["title", "actions"]),
|
|
2357
|
-
(
|
|
2358
|
+
(F(), ce(Lt, { to: "body" }, [
|
|
2358
2359
|
k(An, Nt(g(d), {
|
|
2359
2360
|
show: g(_),
|
|
2360
|
-
"onUpdate:show":
|
|
2361
|
-
onSubmitted:
|
|
2362
|
-
onRefresh:
|
|
2361
|
+
"onUpdate:show": R[2] || (R[2] = (h) => bt(_) ? _.value = h : null),
|
|
2362
|
+
onSubmitted: R[3] || (R[3] = () => (_.value = !1, g(f).fetchDrafts())),
|
|
2363
|
+
onRefresh: R[4] || (R[4] = (h) => g(f).updateDraftRef(h))
|
|
2363
2364
|
}), null, 16, ["show"])
|
|
2364
2365
|
]))
|
|
2365
2366
|
], 64);
|