@feedmepos/mf-inventory-portal 1.5.9-dev.1 → 1.5.9-dev.2
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-CRKhmCwm.js → App-B7rirksC.js} +4 -4
- package/dist/{ApprovalView-BdvNZ3Mi.js → ApprovalView-BomKMill.js} +7 -7
- package/dist/{BindingsDialog-UieCgCDS.js → BindingsDialog-CI8qKlCl.js} +2 -2
- package/dist/{BindingsPicker-Bo7xvsut.js → BindingsPicker-BhED4TMH.js} +2 -2
- package/dist/{BindingsTable-CUaQzSBn.js → BindingsTable-CgD27m69.js} +3 -3
- package/dist/{ClosingDraftView-QgRaat2h.js → ClosingDraftView-BKjxsKag.js} +788 -781
- package/dist/{ClosingHistoryView-C_qw6v7h.js → ClosingHistoryView-C8xdmA9v.js} +5 -5
- package/dist/{ClosingTemplateView-BAsHjB3H.js → ClosingTemplateView-C3IMkNtu.js} +14 -14
- package/dist/{DefaultView-CaWfkTXn.js → DefaultView-M1s5DkYs.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-Dv2fXveZ.js → DeliveryOrderPrintPreview-DNvsv0bs.js} +2 -2
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BFzPTyKA.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DPiYsxMt.js} +2 -2
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Y_AhN6qb.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-W4K3RNpN.js} +2 -2
- package/dist/{FmMultiselectDialog-DT28lMdK.js → FmMultiselectDialog-D5vlbq9s.js} +1 -1
- package/dist/{FmMultiselectDialog-e4dbq-bB.js → FmMultiselectDialog-DpiLiqOe.js} +2 -2
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-CO2Uom0f.js → FmUnitInput.vue_vue_type_script_setup_true_lang-tiIC1uvr.js} +5 -5
- package/dist/{ImportView-Brvxm1EN.js → ImportView-uPX4OhrY.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DSqbdU3A.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-iTmbGMAv.js} +1 -1
- package/dist/{IngredientGroupView-CqqD1_5X.js → IngredientGroupView-Dhhm6SwF.js} +5 -5
- package/dist/{IngredientsView-BmOSo8oo.js → IngredientsView-BeuJFNel.js} +15 -15
- package/dist/{IntegrationExplorerView-CZH3568k.js → IntegrationExplorerView-DvIVyrTk.js} +352 -352
- package/dist/{IntegrationView-CJv9Ps4v.js → IntegrationView-BlCqI1aF.js} +13 -13
- package/dist/{InventoryBindingForm-BZVAC4x1.js → InventoryBindingForm-BbaQJX-2.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BPl9weMj.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-8kDSVOQT.js} +5 -5
- package/dist/{InventoryBindingSummary-C7Xl5Fd7.js → InventoryBindingSummary-ISEBBsyC.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CyjRq3A-.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C2XS7S9B.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DIoYx-x4.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DMQCjdfY.js} +1 -1
- package/dist/{PublishView-DHK3MPsP.js → PublishView-B7ngdwbS.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-DLg01buw.js → PurchaseOrderPrintPreview-CdKQ2vC9.js} +2 -2
- package/dist/{ReceiveRequestView-B1n42VJ5.js → ReceiveRequestView-i7V6aTo7.js} +25 -25
- package/dist/{RecipeView-BOEfiTuN.js → RecipeView-DQeKXITE.js} +17 -17
- package/dist/{SettingsView-Bqx3woVD.js → SettingsView-5jm5pZxN.js} +4 -4
- package/dist/{StockView-UjWpz_eL.js → StockView-BeNHn4jp.js} +19 -19
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BxyFAK_X.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CKfaF6XM.js} +1 -1
- package/dist/{SupplierView-_zK2xohX.js → SupplierView-DzX3leQE.js} +12 -12
- package/dist/{SurchargeView-BtUebfil.js → SurchargeView-q8Rl6XQg.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-DF3seGmT.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-CfYRww5Y.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Bpo1u5g2.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Bywpva5c.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-B_kdNBCT.js → TransferDetails.vue_vue_type_script_setup_true_lang-Ceg3e163.js} +20 -20
- package/dist/{TransferTemplateView-OlHTVdCG.js → TransferTemplateView-ClEeuE0A.js} +18 -18
- package/dist/{UnitCostHistoryView-BIvYaMio.js → UnitCostHistoryView-CkvS4aGj.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-DqTis1lE.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-C7VKd1XK.js} +4 -4
- package/dist/{UnitView-DAtDiu3f.js → UnitView-COKzqhf7.js} +7 -7
- package/dist/{WarehouseView-B3mXQpoO.js → WarehouseView-CWsl1Awb.js} +5 -5
- package/dist/{WastageTemplateView-BOoybeCb.js → WastageTemplateView-BAEbIzfQ.js} +14 -14
- package/dist/{app-cwueji6m.js → app-DTz4LGCJ.js} +11 -11
- package/dist/app.js +1 -1
- package/dist/{closing-template-CobmAqhD.js → closing-template-DmMvmiD8.js} +1 -1
- package/dist/{date2-D_-j6u1x.js → date2-BJJQIIV9.js} +1 -1
- package/dist/{dayjs.min-iDeAwg0n.js → dayjs.min-YbnVt6Kp.js} +1 -1
- package/dist/{decimal-DcHr_uvI.js → decimal-DstnZVub.js} +2 -2
- package/dist/{defineDeepModel-BhC1n6G-.js → defineDeepModel-CxxsD8UG.js} +1 -1
- package/dist/{duplicate-template-Y9iggS9l.js → duplicate-template-DFAfrk_o.js} +1 -1
- package/dist/{export-CAHG4EbP.js → export-C0aosI78.js} +2 -2
- package/dist/{feature-BhK4XmmS.js → feature-dHHbIKf7.js} +2 -2
- package/dist/{format-time-from-id-2IFiQNTX.js → format-time-from-id-BtGI10RN.js} +1 -1
- package/dist/{format-unit-display-CTYZvXcZ.js → format-unit-display-C4V_dB6d.js} +11 -11
- package/dist/{import-export.helper-DtWH9atw.js → import-export.helper-BblDa7MU.js} +6 -6
- package/dist/{index-dfAAA8HA.js → index-B8bFII4h.js} +3 -3
- package/dist/{index-iGt85nBk.js → index-Y7yMwT_5.js} +1 -1
- package/dist/{index-Ckhb0CMq.js → index-j4PQ4n55.js} +1 -1
- package/dist/{inventory-core-dart.default-R1tOn2RS.js → inventory-core-dart.default-JrRChx_V.js} +1 -1
- package/dist/{lz-string-DUT6tVSg.js → lz-string-C856gsAG.js} +1 -1
- package/dist/{netsuite-BiF6Fo7G.js → netsuite-B6QeJ2cS.js} +2 -2
- package/dist/{number-Cqsx9s88.js → number-CKzPOWR2.js} +3 -3
- package/dist/{predefined-templates-CHExzSjx.js → predefined-templates-bmWnR8Cx.js} +1 -1
- package/dist/{purchase-order-template-_FfLY2u1.js → purchase-order-template-DQwbAN8F.js} +1 -1
- package/dist/{recalculationUtils-KdVSBljW.js → recalculationUtils-CTLTLQ9V.js} +1 -1
- package/dist/{rules-DB26S6qs.js → rules-EEgDDXMF.js} +2 -2
- package/dist/{stock-n6h8HkNk.js → stock-GVmcy_Vk.js} +1 -1
- package/dist/{supplier-6K9Cbfcf.js → supplier-D2tc_iCh.js} +2 -2
- package/dist/{surcharge-BV03ItuR.js → surcharge-xQ1WGUtz.js} +1 -1
- package/dist/{uom-rules-CzTxRiqL.js → uom-rules-BOqMU5Ob.js} +1 -1
- package/dist/{use-ingredient-select-dialog-Bs_4jjVy.js → use-ingredient-select-dialog-BQmyEVZx.js} +2 -2
- package/dist/{use-inventory-binding-dialog-CgtoqJ2D.js → use-inventory-binding-dialog-BzFcGuKM.js} +2 -2
- package/dist/{use-template-enabled-locations-C6fQtFF0.js → use-template-enabled-locations-CkW-7UVo.js} +2 -2
- package/dist/{use-transfer-locations-DI48leYd.js → use-transfer-locations-CjrxfaGK.js} +2 -2
- package/dist/{useHrmPermission-Co1Jgyvq.js → useHrmPermission-DcAcggus.js} +1 -1
- package/dist/{useNavigationMenu-JenXwvSv.js → useNavigationMenu-D2tNJzZl.js} +2 -2
- package/dist/{useSseClient-gIA58rTS.js → useSseClient-D9Xmiz-D.js} +3 -3
- package/dist/{vue-i18n-C3I0upD3.js → vue-i18n-BQm9JO9o.js} +378 -378
- package/dist/{xlsx-4BYDayT5.js → xlsx-DZYL-v8V.js} +1 -1
- package/dist/{xlsx.util-CD_xD6ZX.js → xlsx.util-FEXJ9YRM.js} +3 -3
- package/package.json +3 -3
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { defineComponent as je, ref as
|
|
2
|
-
import { u as
|
|
3
|
-
import { useCoreStore as
|
|
4
|
-
import { useSnackbar as Ke, useDialog as
|
|
5
|
-
import { m as
|
|
6
|
-
import { defineStore as
|
|
7
|
-
import { b as
|
|
8
|
-
import { R as
|
|
9
|
-
import { e as
|
|
10
|
-
import { b as
|
|
11
|
-
import { i as
|
|
12
|
-
import { u as
|
|
13
|
-
import { u as
|
|
14
|
-
import { D as
|
|
15
|
-
import { c as
|
|
16
|
-
import { f as
|
|
17
|
-
import { f as
|
|
18
|
-
import { _ as
|
|
19
|
-
import { _ as
|
|
1
|
+
import { defineComponent as je, ref as W, computed as M, onMounted as kt, resolveComponent as Z, openBlock as h, createElementBlock as T, Fragment as ce, createTextVNode as de, createBlock as ae, withCtx as ee, createElementVNode as a, toDisplayString as H, unref as u, createVNode as $, createCommentVNode as K, h as k, watch as ze, renderList as he, onUnmounted as kn, reactive as Ot, isRef as _t, normalizeClass as Se, normalizeStyle as Kt, createSlots as _n, Teleport as wn, mergeProps as xn } from "vue";
|
|
2
|
+
import { u as Dn, _ as An } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DGlWE5I8.js";
|
|
3
|
+
import { useCoreStore as Wt, useI18n as Ye } from "@feedmepos/mf-common";
|
|
4
|
+
import { useSnackbar as Ke, useDialog as Cn, components as pe, useProxiedModel as qt, useBreakpoints as Sn } from "@feedmepos/ui-library";
|
|
5
|
+
import { m as $n, u as We, L as oe, w as te, q as Gt, s as Be, M as _e, B as Te, c as Fn, a as wt, j as In } from "./app-DTz4LGCJ.js";
|
|
6
|
+
import { defineStore as Qt, storeToRefs as Bn } from "pinia";
|
|
7
|
+
import { b as rt, e as Zt, f as Tn, a as Ce } from "./date2-BJJQIIV9.js";
|
|
8
|
+
import { R as jn } from "./rules-EEgDDXMF.js";
|
|
9
|
+
import { e as lt, a as ht, t as Jt, c as He, l as Xt, m as en, j as tn, k as nn, o as ne } from "./number-CKzPOWR2.js";
|
|
10
|
+
import { b as Mn, d as Un } from "./xlsx.util-FEXJ9YRM.js";
|
|
11
|
+
import { i as an, u as on } from "./uom-rules-BOqMU5Ob.js";
|
|
12
|
+
import { u as Rn, a as Pn } from "./useSseClient-D9Xmiz-D.js";
|
|
13
|
+
import { u as ct } from "./stock-GVmcy_Vk.js";
|
|
14
|
+
import { D as Ht, R as Ne } from "./row-action.enum-DQ9bJ_uv.js";
|
|
15
|
+
import { c as Vn } from "./component-kqxARxvM.js";
|
|
16
|
+
import { f as Nn } from "./format-time-from-id-BtGI10RN.js";
|
|
17
|
+
import { f as zn } from "./recalculationUtils-CTLTLQ9V.js";
|
|
18
|
+
import { _ as En } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-W4K3RNpN.js";
|
|
19
|
+
import { _ as Ln } from "./empty-placeholder-B0QU467o.js";
|
|
20
20
|
import { F as gt } from "./FmAdminBadge-DjnBAgyv.js";
|
|
21
|
-
import { u as
|
|
22
|
-
import { F as
|
|
23
|
-
import { r as
|
|
24
|
-
import { d as
|
|
25
|
-
import { F as
|
|
26
|
-
import { _ as
|
|
27
|
-
import { _ as
|
|
28
|
-
const qe =
|
|
21
|
+
import { u as On } from "./vue-i18n-BQm9JO9o.js";
|
|
22
|
+
import { F as Hn } from "./decimal-DstnZVub.js";
|
|
23
|
+
import { r as Yn, u as ot, w as Kn } from "./xlsx-DZYL-v8V.js";
|
|
24
|
+
import { d as Wn } from "./dayjs.min-YbnVt6Kp.js";
|
|
25
|
+
import { F as qn } from "./FmDroppableField-J0xUsOTV.js";
|
|
26
|
+
import { _ as Gn } from "./FmConfirmationButton.vue_vue_type_script_setup_true_lang-DLrMEGFR.js";
|
|
27
|
+
import { _ as Qn, F as at } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
|
|
28
|
+
const qe = $n((n, l) => {
|
|
29
29
|
function t() {
|
|
30
30
|
return We().currentLocation.dbName;
|
|
31
31
|
}
|
|
@@ -33,48 +33,48 @@ const qe = Cn((n, r) => {
|
|
|
33
33
|
getDbName: t,
|
|
34
34
|
async getDraft(o) {
|
|
35
35
|
const g = t(), i = `${n.inventoryBackendUrl}/${g}/closing-draft/${o}`;
|
|
36
|
-
return
|
|
36
|
+
return l.get(i);
|
|
37
37
|
},
|
|
38
38
|
async readDrafts() {
|
|
39
39
|
const o = t(), g = `${n.inventoryBackendUrl}/${o}/closing-draft`;
|
|
40
|
-
return
|
|
40
|
+
return l.get(g);
|
|
41
41
|
},
|
|
42
42
|
async runOperation(o) {
|
|
43
43
|
const g = t(), i = `${n.inventoryBackendUrl}/${g}/closing-draft/run-operation`;
|
|
44
|
-
return
|
|
44
|
+
return l.post(i, o);
|
|
45
45
|
},
|
|
46
46
|
async runOperationV1(o) {
|
|
47
47
|
const g = t(), i = `${n.inventoryBackendUrl}/${g}/closing-draft/v1/run-operation`;
|
|
48
|
-
return
|
|
48
|
+
return l.post(i, o);
|
|
49
49
|
},
|
|
50
50
|
async sync(o) {
|
|
51
51
|
const g = t(), i = `${n.inventoryBackendUrl}/${g}/closing-draft/sync`;
|
|
52
|
-
return
|
|
52
|
+
return l.post(i, o);
|
|
53
53
|
},
|
|
54
54
|
async cloneDraft(o) {
|
|
55
55
|
const g = t(), i = `${n.inventoryBackendUrl}/${g}/closing-draft/${o}/clone`;
|
|
56
|
-
return
|
|
56
|
+
return l.post(i, {});
|
|
57
57
|
},
|
|
58
58
|
async createQuickModeDraftWithItems(o) {
|
|
59
59
|
const g = t(), i = `${n.inventoryBackendUrl}/${g}/closing-draft/quick-mode/new-with-items`;
|
|
60
|
-
return
|
|
60
|
+
return l.post(i, o);
|
|
61
61
|
},
|
|
62
62
|
initializeStockSnapshot(o, g) {
|
|
63
63
|
const i = t(), s = `${n.inventoryBackendUrl}/${i}/closing-draft/${encodeURIComponent(o)}/initialize-stock-snapshot`;
|
|
64
|
-
return
|
|
64
|
+
return l.post(s, { effectiveAt: g });
|
|
65
65
|
},
|
|
66
66
|
async getRefreshBalanceStatus(o, g) {
|
|
67
67
|
const i = t(), s = `${n.inventoryBackendUrl}/${i}/closing-draft/${o}/refresh-balance/status?closingDraftRevision=${encodeURIComponent(g)}`;
|
|
68
|
-
return
|
|
68
|
+
return l.get(s);
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
|
-
}),
|
|
71
|
+
}), Zn = { class: "fm-typo-en-body-lg-400" }, Jn = { class: "fm-typo-en-body-lg-600" }, Xn = {
|
|
72
72
|
key: 0,
|
|
73
73
|
class: "flex flex-col"
|
|
74
|
-
},
|
|
74
|
+
}, ea = {
|
|
75
75
|
key: 0,
|
|
76
76
|
class: "fm-typo-en-body-sm-400 text-fm-color-typo-error mt-4"
|
|
77
|
-
},
|
|
77
|
+
}, ta = { class: "flex gap-12 py-8 justify-end w-full" }, bt = /* @__PURE__ */ je({
|
|
78
78
|
__name: "ClosingDraftAction",
|
|
79
79
|
props: {
|
|
80
80
|
draft: {},
|
|
@@ -83,8 +83,8 @@ const qe = Cn((n, r) => {
|
|
|
83
83
|
onFinished: { type: Function }
|
|
84
84
|
},
|
|
85
85
|
setup(n) {
|
|
86
|
-
const
|
|
87
|
-
switch (
|
|
86
|
+
const l = n, t = W(), o = qe(), g = Ke(), i = W(!1), s = W(null), c = W(!1), x = M(() => {
|
|
87
|
+
switch (l.action) {
|
|
88
88
|
case oe.enum.approveDraft:
|
|
89
89
|
return "Approve";
|
|
90
90
|
case oe.enum.rejectDraft:
|
|
@@ -92,9 +92,9 @@ const qe = Cn((n, r) => {
|
|
|
92
92
|
case oe.enum.markAsFailed:
|
|
93
93
|
return "Mark as Failed";
|
|
94
94
|
}
|
|
95
|
-
throw new Error(`Unknown action: ${
|
|
95
|
+
throw new Error(`Unknown action: ${l.action}`);
|
|
96
96
|
}), A = M(() => {
|
|
97
|
-
switch (
|
|
97
|
+
switch (l.action) {
|
|
98
98
|
case oe.enum.approveDraft:
|
|
99
99
|
return "primary";
|
|
100
100
|
case oe.enum.rejectDraft:
|
|
@@ -102,36 +102,36 @@ const qe = Cn((n, r) => {
|
|
|
102
102
|
case oe.enum.markAsFailed:
|
|
103
103
|
return "destructive";
|
|
104
104
|
}
|
|
105
|
-
throw new Error(`Unknown action: ${
|
|
105
|
+
throw new Error(`Unknown action: ${l.action}`);
|
|
106
106
|
});
|
|
107
107
|
kt(() => {
|
|
108
|
-
if (
|
|
109
|
-
s.value = new Date(
|
|
108
|
+
if (l.draft.effectiveAt)
|
|
109
|
+
s.value = new Date(l.draft.effectiveAt);
|
|
110
110
|
else {
|
|
111
|
-
const I = new Date(
|
|
111
|
+
const I = new Date(l.draft.createdAt);
|
|
112
112
|
I.setHours(23, 59, 59, 999), s.value = I;
|
|
113
113
|
}
|
|
114
114
|
c.value = !0;
|
|
115
115
|
});
|
|
116
116
|
const f = M({
|
|
117
117
|
get() {
|
|
118
|
-
return s.value === null ? "" :
|
|
118
|
+
return s.value === null ? "" : rt(s.value);
|
|
119
119
|
},
|
|
120
120
|
set(I) {
|
|
121
121
|
if (I) {
|
|
122
|
-
const
|
|
123
|
-
|
|
122
|
+
const _ = /* @__PURE__ */ new Date(`${I} ${B.value}`);
|
|
123
|
+
_.setSeconds(59, 999), s.value = _;
|
|
124
124
|
} else
|
|
125
125
|
s.value = null;
|
|
126
126
|
}
|
|
127
127
|
}), B = M({
|
|
128
128
|
get() {
|
|
129
|
-
return s.value === null ? "" :
|
|
129
|
+
return s.value === null ? "" : Zt(s.value);
|
|
130
130
|
},
|
|
131
131
|
set(I) {
|
|
132
132
|
if (I) {
|
|
133
|
-
const
|
|
134
|
-
|
|
133
|
+
const _ = /* @__PURE__ */ new Date(`${f.value} ${I}`);
|
|
134
|
+
_.setSeconds(59, 999), s.value = _;
|
|
135
135
|
} else
|
|
136
136
|
s.value = null;
|
|
137
137
|
}
|
|
@@ -140,17 +140,17 @@ const qe = Cn((n, r) => {
|
|
|
140
140
|
i.value = !0;
|
|
141
141
|
try {
|
|
142
142
|
I ? await o.runOperationV1({
|
|
143
|
-
_id:
|
|
144
|
-
_rev:
|
|
145
|
-
action:
|
|
143
|
+
_id: l.draft._id,
|
|
144
|
+
_rev: l.draft._rev ?? "",
|
|
145
|
+
action: l.action,
|
|
146
146
|
data: {
|
|
147
147
|
effectiveAt: s.value ? s.value.toISOString() : null,
|
|
148
148
|
remark: t.value
|
|
149
149
|
}
|
|
150
150
|
}).delayed(500) : await o.runOperation({
|
|
151
|
-
_id:
|
|
152
|
-
_rev:
|
|
153
|
-
action:
|
|
151
|
+
_id: l.draft._id,
|
|
152
|
+
_rev: l.draft._rev ?? "",
|
|
153
|
+
action: l.action,
|
|
154
154
|
data: {
|
|
155
155
|
effectiveAt: s.value ? s.value.toISOString() : null,
|
|
156
156
|
remark: t.value
|
|
@@ -159,67 +159,67 @@ const qe = Cn((n, r) => {
|
|
|
159
159
|
title: "Success",
|
|
160
160
|
message: "Action submitted",
|
|
161
161
|
type: "success"
|
|
162
|
-
}),
|
|
163
|
-
} catch (
|
|
162
|
+
}), l.onFinished();
|
|
163
|
+
} catch (_) {
|
|
164
164
|
g.open({
|
|
165
165
|
title: "Something went wrong",
|
|
166
|
-
message: (
|
|
166
|
+
message: (_ == null ? void 0 : _.message) ?? "Unable to submit action. Please try again",
|
|
167
167
|
type: "error"
|
|
168
|
-
}), console.error("error on submit closing draft action",
|
|
168
|
+
}), console.error("error on submit closing draft action", _);
|
|
169
169
|
} finally {
|
|
170
170
|
i.value = !1;
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
return (I,
|
|
173
|
+
return (I, _) => {
|
|
174
174
|
const R = Z("FmLabel"), p = Z("FmDatePicker"), v = Z("FmTimePicker"), m = Z("FmTextField"), b = Z("FmButton"), y = Z("FmForm");
|
|
175
|
-
return c.value ? (
|
|
175
|
+
return c.value ? (h(), ae(y, {
|
|
176
176
|
key: 1,
|
|
177
177
|
onValidationSuccess: E,
|
|
178
178
|
class: "flex flex-col gap-32",
|
|
179
179
|
disabled: i.value
|
|
180
180
|
}, {
|
|
181
181
|
default: ee(() => [
|
|
182
|
-
a("div",
|
|
183
|
-
|
|
184
|
-
a("span",
|
|
185
|
-
|
|
182
|
+
a("div", Zn, [
|
|
183
|
+
_[4] || (_[4] = de(" You are about to ")),
|
|
184
|
+
a("span", Jn, H(x.value), 1),
|
|
185
|
+
_[5] || (_[5] = de(" this draft. Please provide a remark to justify this action. "))
|
|
186
186
|
]),
|
|
187
|
-
I.action === u(oe).enum.approveDraft ? (
|
|
187
|
+
I.action === u(oe).enum.approveDraft ? (h(), T("div", Xn, [
|
|
188
188
|
$(R, { class: "fm-typo-en-body-lg-600" }, {
|
|
189
|
-
default: ee(() =>
|
|
189
|
+
default: ee(() => _[6] || (_[6] = [
|
|
190
190
|
de("Closing Date")
|
|
191
191
|
])),
|
|
192
192
|
_: 1
|
|
193
193
|
}),
|
|
194
194
|
$(p, {
|
|
195
195
|
modelValue: f.value,
|
|
196
|
-
"onUpdate:modelValue":
|
|
197
|
-
max: u(
|
|
196
|
+
"onUpdate:modelValue": _[0] || (_[0] = (w) => f.value = w),
|
|
197
|
+
max: u(rt)(/* @__PURE__ */ new Date())
|
|
198
198
|
}, null, 8, ["modelValue", "max"]),
|
|
199
199
|
$(R, { class: "fm-typo-en-body-lg-600" }, {
|
|
200
|
-
default: ee(() =>
|
|
200
|
+
default: ee(() => _[7] || (_[7] = [
|
|
201
201
|
de("Closing Time")
|
|
202
202
|
])),
|
|
203
203
|
_: 1
|
|
204
204
|
}),
|
|
205
205
|
$(v, {
|
|
206
206
|
modelValue: B.value,
|
|
207
|
-
"onUpdate:modelValue":
|
|
207
|
+
"onUpdate:modelValue": _[1] || (_[1] = (w) => B.value = w)
|
|
208
208
|
}, null, 8, ["modelValue"]),
|
|
209
|
-
N.value ? (
|
|
210
|
-
])) :
|
|
209
|
+
N.value ? (h(), T("div", ea, " Cannot select future date ")) : K("", !0)
|
|
210
|
+
])) : K("", !0),
|
|
211
211
|
$(m, {
|
|
212
212
|
modelValue: t.value,
|
|
213
|
-
"onUpdate:modelValue":
|
|
213
|
+
"onUpdate:modelValue": _[2] || (_[2] = (w) => t.value = w),
|
|
214
214
|
label: "Remark",
|
|
215
215
|
"label-mark": "required",
|
|
216
|
-
rules: [u(
|
|
216
|
+
rules: [u(jn)()]
|
|
217
217
|
}, null, 8, ["modelValue", "rules"]),
|
|
218
|
-
a("div",
|
|
218
|
+
a("div", ta, [
|
|
219
219
|
$(b, {
|
|
220
220
|
label: "Cancel",
|
|
221
221
|
variant: "tertiary",
|
|
222
|
-
onClick:
|
|
222
|
+
onClick: _[3] || (_[3] = (w) => I.onCancel())
|
|
223
223
|
}),
|
|
224
224
|
$(b, {
|
|
225
225
|
label: x.value,
|
|
@@ -230,39 +230,39 @@ const qe = Cn((n, r) => {
|
|
|
230
230
|
])
|
|
231
231
|
]),
|
|
232
232
|
_: 1
|
|
233
|
-
}, 8, ["disabled"])) : (
|
|
233
|
+
}, 8, ["disabled"])) : (h(), T(ce, { key: 0 }, [
|
|
234
234
|
de("Loading")
|
|
235
235
|
], 64));
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
|
-
}),
|
|
239
|
-
function
|
|
240
|
-
const
|
|
238
|
+
}), na = He(0);
|
|
239
|
+
function sn(n) {
|
|
240
|
+
const l = n.measurementsAmounts.groupBy((o) => o.measurement.id), t = n.sku.unit.measurements.reduce((o, g) => {
|
|
241
241
|
var c, x;
|
|
242
|
-
const i = ((x = (c =
|
|
242
|
+
const i = ((x = (c = l.get(g.id)) == null ? void 0 : c[0]) == null ? void 0 : x.amount) ?? na, s = lt(g.conversion, i);
|
|
243
243
|
return o + +ht(s);
|
|
244
244
|
}, +ht(n.baseAmount));
|
|
245
|
-
return
|
|
245
|
+
return Jt(t, n.baseAmount.precision);
|
|
246
246
|
}
|
|
247
|
-
const
|
|
248
|
-
function
|
|
247
|
+
const aa = He(0), oa = He(100);
|
|
248
|
+
function sa(n, l, t, o, g, i, s, c) {
|
|
249
249
|
var z, le, P, S, ie;
|
|
250
|
-
const x =
|
|
251
|
-
...
|
|
252
|
-
amount: Math.abs(
|
|
253
|
-
}), N = B ?
|
|
250
|
+
const x = sn(n), A = o ?? x, f = Xt(A, l), B = l.amount === 0 ? null : en(f, {
|
|
251
|
+
...l,
|
|
252
|
+
amount: Math.abs(l.amount)
|
|
253
|
+
}), N = B ? lt(B, oa) : null, E = ((z = n.sku.defaultCost) == null ? void 0 : z.costPerUnit) ?? { amount: 0, precision: 0 }, I = Number(te.toFormatString({ value: E })), _ = ((P = (le = n.sku.defaultCost) == null ? void 0 : le.measurement) == null ? void 0 : P.conversion) ?? {
|
|
254
254
|
amount: 1,
|
|
255
255
|
precision: 0
|
|
256
256
|
}, R = Number(
|
|
257
|
-
te.toFormatString({ value:
|
|
258
|
-
), p = g ? Number(te.toFormatString({ value: g })) : 0, v = Number(te.toFormatString({ value:
|
|
257
|
+
te.toFormatString({ value: _ })
|
|
258
|
+
), p = g ? Number(te.toFormatString({ value: g })) : 0, v = Number(te.toFormatString({ value: l })), m = Number(te.toFormatString({ value: A })), b = m - v, y = b * I / R, w = m * I / R, Y = v * I / R, q = {};
|
|
259
259
|
return s && i && s.forEach((L) => {
|
|
260
260
|
const F = { amount: 0, precision: 0 }, Q = i[L];
|
|
261
261
|
if (Q) {
|
|
262
|
-
const se =
|
|
263
|
-
|
|
262
|
+
const se = tn(F, Q);
|
|
263
|
+
q[`adjustment_${L}`] = ht(se);
|
|
264
264
|
} else
|
|
265
|
-
|
|
265
|
+
q[`adjustment_${L}`] = "0";
|
|
266
266
|
}), {
|
|
267
267
|
code: n.sku.code,
|
|
268
268
|
name: n.sku.name,
|
|
@@ -281,15 +281,15 @@ function aa(n, r, t, o, g, i, s, c) {
|
|
|
281
281
|
adjustedAmount: Number(te.toFormatString({ value: f })),
|
|
282
282
|
adjustedDiffPercentage: N ? Number(
|
|
283
283
|
te.toFormatString({
|
|
284
|
-
value:
|
|
284
|
+
value: nn(N, 2)
|
|
285
285
|
})
|
|
286
286
|
) : null,
|
|
287
287
|
costPerUnit: I,
|
|
288
288
|
opening: p,
|
|
289
|
-
...
|
|
289
|
+
...q,
|
|
290
290
|
varianceQty: b,
|
|
291
291
|
varianceInCost: y,
|
|
292
|
-
stockTakeValue:
|
|
292
|
+
stockTakeValue: w,
|
|
293
293
|
systemValue: Y,
|
|
294
294
|
// Include custom attribute values
|
|
295
295
|
...(c ?? []).reduce(
|
|
@@ -302,13 +302,13 @@ function aa(n, r, t, o, g, i, s, c) {
|
|
|
302
302
|
)
|
|
303
303
|
};
|
|
304
304
|
}
|
|
305
|
-
function
|
|
306
|
-
let
|
|
305
|
+
function ra(n) {
|
|
306
|
+
let l = 0;
|
|
307
307
|
for (const t of n.values())
|
|
308
|
-
t.length >
|
|
309
|
-
return
|
|
308
|
+
t.length > l && (l = t.length);
|
|
309
|
+
return l;
|
|
310
310
|
}
|
|
311
|
-
function
|
|
311
|
+
function la(n, l) {
|
|
312
312
|
const t = /* @__PURE__ */ new Map();
|
|
313
313
|
for (const o of n) {
|
|
314
314
|
if (t.has(o.sku._id)) continue;
|
|
@@ -322,7 +322,7 @@ function sa(n, r) {
|
|
|
322
322
|
abbrev: c.abbrev,
|
|
323
323
|
conversion: c.conversion,
|
|
324
324
|
amount: x,
|
|
325
|
-
inactive:
|
|
325
|
+
inactive: an(c, l),
|
|
326
326
|
orphan: !1
|
|
327
327
|
});
|
|
328
328
|
}
|
|
@@ -339,8 +339,8 @@ function sa(n, r) {
|
|
|
339
339
|
}
|
|
340
340
|
return t;
|
|
341
341
|
}
|
|
342
|
-
function
|
|
343
|
-
const o =
|
|
342
|
+
function ia(n, l = [], t = []) {
|
|
343
|
+
const o = Gt(), g = o === "MYR" ? "RM" : o;
|
|
344
344
|
return [
|
|
345
345
|
{
|
|
346
346
|
id: "code",
|
|
@@ -367,7 +367,7 @@ function ra(n, r = [], t = []) {
|
|
|
367
367
|
name: "Opening (B/F)"
|
|
368
368
|
},
|
|
369
369
|
// Dynamic adjustment type columns
|
|
370
|
-
...
|
|
370
|
+
...l.map((s) => ({
|
|
371
371
|
id: `adjustment_${s}`,
|
|
372
372
|
name: Be(s)
|
|
373
373
|
})),
|
|
@@ -420,9 +420,9 @@ function ra(n, r = [], t = []) {
|
|
|
420
420
|
}))
|
|
421
421
|
];
|
|
422
422
|
}
|
|
423
|
-
function
|
|
423
|
+
function ca(n, l, t, o = [], g) {
|
|
424
424
|
var re, z, le, P, S, ie, L;
|
|
425
|
-
const i =
|
|
425
|
+
const i = l.groupBy(
|
|
426
426
|
(F) => F.id,
|
|
427
427
|
(F) => F.balance
|
|
428
428
|
), s = t.groupBy(
|
|
@@ -440,10 +440,10 @@ function la(n, r, t, o = [], g) {
|
|
|
440
440
|
f.forEach((F) => {
|
|
441
441
|
x.has(F) && (B.push(F), x.delete(F));
|
|
442
442
|
});
|
|
443
|
-
const N = Array.from(x).sort(), E = [...B, ...N], I = [...n.items, ...n.negativeStockItems ?? []], R =
|
|
443
|
+
const N = Array.from(x).sort(), E = [...B, ...N], I = [...n.items, ...n.negativeStockItems ?? []], R = Wt().currentBusiness.value, p = la(I, g), v = I.map((F) => {
|
|
444
444
|
var De, $e;
|
|
445
|
-
const Q = ((De = i.get(F.sku._id)) == null ? void 0 : De[0]) ??
|
|
446
|
-
return
|
|
445
|
+
const Q = ((De = i.get(F.sku._id)) == null ? void 0 : De[0]) ?? aa, se = p.get(F.sku._id) ?? [], we = c.get(F.sku._id), xe = A.get(F.sku._id);
|
|
446
|
+
return sa(
|
|
447
447
|
F,
|
|
448
448
|
Q,
|
|
449
449
|
se,
|
|
@@ -453,7 +453,7 @@ function la(n, r, t, o = [], g) {
|
|
|
453
453
|
E,
|
|
454
454
|
o
|
|
455
455
|
);
|
|
456
|
-
}), m =
|
|
456
|
+
}), m = ra(p), b = ia(m, E, o), y = [
|
|
457
457
|
["Business name:", R == null ? void 0 : R.name],
|
|
458
458
|
["Business ID:", R == null ? void 0 : R._id],
|
|
459
459
|
["Menu version", R == null ? void 0 : R.menuVersion],
|
|
@@ -477,13 +477,13 @@ function la(n, r, t, o = [], g) {
|
|
|
477
477
|
[],
|
|
478
478
|
b.map((F) => F.name),
|
|
479
479
|
...v.map((F) => b.map((Q) => F[Q.id]))
|
|
480
|
-
],
|
|
481
|
-
return
|
|
480
|
+
], w = b.map((F) => `system:${F.id}`), Y = Mn(y, w), q = `[${R == null ? void 0 : R.name}] closing draft (${Tn(new Date(n.updatedAt))}).xlsx`;
|
|
481
|
+
return Un(Y, q), q;
|
|
482
482
|
}
|
|
483
|
-
const
|
|
483
|
+
const ua = { class: "flex flex-col" }, da = {
|
|
484
484
|
key: 0,
|
|
485
485
|
class: "fm-typo-en-body-sm-400 text-fm-color-typo-error mt-4"
|
|
486
|
-
},
|
|
486
|
+
}, ma = { class: "flex gap-12 py-8 justify-end w-full" }, fa = /* @__PURE__ */ je({
|
|
487
487
|
__name: "RefreshBalanceAction",
|
|
488
488
|
props: {
|
|
489
489
|
draft: {},
|
|
@@ -491,21 +491,21 @@ const ia = { class: "flex flex-col" }, ca = {
|
|
|
491
491
|
onFinished: { type: Function }
|
|
492
492
|
},
|
|
493
493
|
setup(n) {
|
|
494
|
-
const
|
|
495
|
-
|
|
496
|
-
const t =
|
|
494
|
+
const l = n;
|
|
495
|
+
ct();
|
|
496
|
+
const t = W(!1), o = W(null), g = W(!1);
|
|
497
497
|
kt(() => {
|
|
498
|
-
if (
|
|
499
|
-
o.value = new Date(
|
|
498
|
+
if (l.draft.effectiveAt)
|
|
499
|
+
o.value = new Date(l.draft.effectiveAt);
|
|
500
500
|
else {
|
|
501
|
-
const A = new Date(
|
|
501
|
+
const A = new Date(l.draft.createdAt);
|
|
502
502
|
A.setHours(23, 59, 59, 999), o.value = A;
|
|
503
503
|
}
|
|
504
504
|
g.value = !0;
|
|
505
505
|
});
|
|
506
506
|
const i = M({
|
|
507
507
|
get() {
|
|
508
|
-
return o.value === null ? "" :
|
|
508
|
+
return o.value === null ? "" : rt(o.value);
|
|
509
509
|
},
|
|
510
510
|
set(A) {
|
|
511
511
|
if (A) {
|
|
@@ -516,7 +516,7 @@ const ia = { class: "flex flex-col" }, ca = {
|
|
|
516
516
|
}
|
|
517
517
|
}), s = M({
|
|
518
518
|
get() {
|
|
519
|
-
return o.value === null ? "" :
|
|
519
|
+
return o.value === null ? "" : Zt(o.value);
|
|
520
520
|
},
|
|
521
521
|
set(A) {
|
|
522
522
|
if (A) {
|
|
@@ -527,11 +527,11 @@ const ia = { class: "flex flex-col" }, ca = {
|
|
|
527
527
|
}
|
|
528
528
|
}), c = M(() => o.value ? o.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
|
|
529
529
|
async function x() {
|
|
530
|
-
t.value = !0,
|
|
530
|
+
t.value = !0, l.onFinished(o.value.toISOString());
|
|
531
531
|
}
|
|
532
532
|
return (A, f) => {
|
|
533
|
-
const B = Z("FmLabel"), N = Z("FmDatePicker"), E = Z("FmTimePicker"), I = Z("FmButton"),
|
|
534
|
-
return g.value ? (
|
|
533
|
+
const B = Z("FmLabel"), N = Z("FmDatePicker"), E = Z("FmTimePicker"), I = Z("FmButton"), _ = Z("FmForm");
|
|
534
|
+
return g.value ? (h(), ae(_, {
|
|
535
535
|
key: 1,
|
|
536
536
|
onValidationSuccess: x,
|
|
537
537
|
class: "flex flex-col gap-32",
|
|
@@ -550,7 +550,7 @@ const ia = { class: "flex flex-col" }, ca = {
|
|
|
550
550
|
de(" the effective date and time. ")
|
|
551
551
|
])
|
|
552
552
|
], -1)),
|
|
553
|
-
a("div",
|
|
553
|
+
a("div", ua, [
|
|
554
554
|
$(B, { class: "fm-typo-en-body-lg-600" }, {
|
|
555
555
|
default: ee(() => f[3] || (f[3] = [
|
|
556
556
|
de("Closing Date")
|
|
@@ -560,7 +560,7 @@ const ia = { class: "flex flex-col" }, ca = {
|
|
|
560
560
|
$(N, {
|
|
561
561
|
modelValue: i.value,
|
|
562
562
|
"onUpdate:modelValue": f[0] || (f[0] = (R) => i.value = R),
|
|
563
|
-
max: u(
|
|
563
|
+
max: u(rt)(/* @__PURE__ */ new Date())
|
|
564
564
|
}, null, 8, ["modelValue", "max"]),
|
|
565
565
|
$(B, { class: "fm-typo-en-body-lg-600" }, {
|
|
566
566
|
default: ee(() => f[4] || (f[4] = [
|
|
@@ -572,9 +572,9 @@ const ia = { class: "flex flex-col" }, ca = {
|
|
|
572
572
|
modelValue: s.value,
|
|
573
573
|
"onUpdate:modelValue": f[1] || (f[1] = (R) => s.value = R)
|
|
574
574
|
}, null, 8, ["modelValue"]),
|
|
575
|
-
c.value ? (
|
|
575
|
+
c.value ? (h(), T("div", da, " Cannot select future date ")) : K("", !0)
|
|
576
576
|
]),
|
|
577
|
-
a("div",
|
|
577
|
+
a("div", ma, [
|
|
578
578
|
$(I, {
|
|
579
579
|
label: "Cancel",
|
|
580
580
|
variant: "tertiary",
|
|
@@ -590,15 +590,15 @@ const ia = { class: "flex flex-col" }, ca = {
|
|
|
590
590
|
])
|
|
591
591
|
]),
|
|
592
592
|
_: 1
|
|
593
|
-
}, 8, ["disabled"])) : (
|
|
593
|
+
}, 8, ["disabled"])) : (h(), T(ce, { key: 0 }, [
|
|
594
594
|
de("Loading")
|
|
595
595
|
], 64));
|
|
596
596
|
};
|
|
597
597
|
}
|
|
598
|
-
}),
|
|
598
|
+
}), it = Qt(
|
|
599
599
|
"closingDraftActions",
|
|
600
600
|
function() {
|
|
601
|
-
const
|
|
601
|
+
const l = Cn(), t = Ke(), o = ct(), g = qe(), i = Rn(), s = on(), c = W(!1), x = W();
|
|
602
602
|
function A(b) {
|
|
603
603
|
const y = {
|
|
604
604
|
draft: b
|
|
@@ -606,7 +606,7 @@ const ia = { class: "flex flex-col" }, ca = {
|
|
|
606
606
|
x.value = y, c.value = !0;
|
|
607
607
|
}
|
|
608
608
|
async function f(b) {
|
|
609
|
-
var
|
|
609
|
+
var w;
|
|
610
610
|
if (b.status === _e.enum.COMPLETED) {
|
|
611
611
|
const Y = b.closingAdjustmentId;
|
|
612
612
|
if (!Y)
|
|
@@ -617,74 +617,74 @@ const ia = { class: "flex flex-col" }, ca = {
|
|
|
617
617
|
}), console.error("Closing draft is completed but closing document cannot be found.", {
|
|
618
618
|
draftId: b._id
|
|
619
619
|
}), [];
|
|
620
|
-
const
|
|
621
|
-
return ((
|
|
620
|
+
const q = await o.readAdjustmentById(Y);
|
|
621
|
+
return ((q == null ? void 0 : q.skus) ?? []).map((z) => ({
|
|
622
622
|
id: z.sku._id,
|
|
623
623
|
balance: z.fromBalance,
|
|
624
624
|
costs: z.fromCostBalances
|
|
625
625
|
}));
|
|
626
626
|
} else
|
|
627
|
-
return await i.readStockBalance(), ((
|
|
627
|
+
return await i.readStockBalance(), ((w = i.stockBalance) == null ? void 0 : w.skus) ?? [];
|
|
628
628
|
}
|
|
629
|
-
async function B(b, y,
|
|
629
|
+
async function B(b, y, w, Y) {
|
|
630
630
|
y || (t.open({
|
|
631
631
|
title: "Exporting",
|
|
632
632
|
message: "Fetching data..."
|
|
633
|
-
}), y = await f(b)),
|
|
633
|
+
}), y = await f(b)), ca(
|
|
634
634
|
b,
|
|
635
635
|
y,
|
|
636
|
-
|
|
636
|
+
w ?? [],
|
|
637
637
|
Y ?? [],
|
|
638
638
|
s.value
|
|
639
639
|
);
|
|
640
640
|
}
|
|
641
|
-
function N(b, y,
|
|
642
|
-
|
|
641
|
+
function N(b, y, w) {
|
|
642
|
+
l.open({
|
|
643
643
|
title: "Approve draft",
|
|
644
644
|
contentComponent: bt,
|
|
645
645
|
contentComponentProps: {
|
|
646
646
|
draft: b,
|
|
647
647
|
action: oe.enum.approveDraft,
|
|
648
648
|
onFinished: () => {
|
|
649
|
-
|
|
649
|
+
l.close(), y == null || y();
|
|
650
650
|
},
|
|
651
651
|
onCancel: () => {
|
|
652
|
-
|
|
652
|
+
l.close();
|
|
653
653
|
}
|
|
654
654
|
}
|
|
655
655
|
}).onClose(() => {
|
|
656
|
-
|
|
656
|
+
w == null || w();
|
|
657
657
|
});
|
|
658
658
|
}
|
|
659
659
|
function E(b, y) {
|
|
660
|
-
|
|
660
|
+
l.open({
|
|
661
661
|
title: "Reject draft",
|
|
662
662
|
contentComponent: bt,
|
|
663
663
|
contentComponentProps: {
|
|
664
664
|
draft: b,
|
|
665
665
|
action: oe.enum.rejectDraft,
|
|
666
666
|
onFinished: () => {
|
|
667
|
-
|
|
667
|
+
l.close(), y == null || y();
|
|
668
668
|
},
|
|
669
|
-
onCancel: () =>
|
|
669
|
+
onCancel: () => l.close()
|
|
670
670
|
}
|
|
671
671
|
});
|
|
672
672
|
}
|
|
673
673
|
function I(b, y) {
|
|
674
|
-
|
|
674
|
+
l.open({
|
|
675
675
|
title: "Mark draft as failed",
|
|
676
676
|
contentComponent: bt,
|
|
677
677
|
contentComponentProps: {
|
|
678
678
|
draft: b,
|
|
679
679
|
action: oe.enum.markAsFailed,
|
|
680
680
|
onFinished: () => {
|
|
681
|
-
|
|
681
|
+
l.close(), y == null || y();
|
|
682
682
|
},
|
|
683
|
-
onCancel: () =>
|
|
683
|
+
onCancel: () => l.close()
|
|
684
684
|
}
|
|
685
685
|
});
|
|
686
686
|
}
|
|
687
|
-
async function
|
|
687
|
+
async function _(b, y) {
|
|
688
688
|
await g.sync({
|
|
689
689
|
_id: b._id,
|
|
690
690
|
_rev: b._rev ?? "",
|
|
@@ -701,23 +701,23 @@ const ia = { class: "flex flex-col" }, ca = {
|
|
|
701
701
|
function R() {
|
|
702
702
|
c.value = !1;
|
|
703
703
|
}
|
|
704
|
-
async function p(b, y,
|
|
705
|
-
await
|
|
704
|
+
async function p(b, y, w) {
|
|
705
|
+
await l.open({
|
|
706
706
|
title: "Refresh balance",
|
|
707
|
-
contentComponent:
|
|
707
|
+
contentComponent: fa,
|
|
708
708
|
contentComponentProps: {
|
|
709
709
|
draft: b,
|
|
710
710
|
onFinished: (Y) => {
|
|
711
|
-
|
|
711
|
+
l.close(), w == null || w(Y);
|
|
712
712
|
},
|
|
713
713
|
onCancel: async () => {
|
|
714
|
-
|
|
714
|
+
l.close(), y == null || y();
|
|
715
715
|
}
|
|
716
716
|
}
|
|
717
717
|
});
|
|
718
718
|
}
|
|
719
719
|
async function v(b) {
|
|
720
|
-
await
|
|
720
|
+
await l.open({
|
|
721
721
|
title: "Invalidate closing draft cache",
|
|
722
722
|
message: "It will invalidate opening and stock movement cache for this draft.",
|
|
723
723
|
primaryActions: { text: "Proceed", close: !0 },
|
|
@@ -740,10 +740,10 @@ const ia = { class: "flex flex-col" }, ca = {
|
|
|
740
740
|
message: "Draft cloned successfully",
|
|
741
741
|
type: "success"
|
|
742
742
|
}), y == null || y();
|
|
743
|
-
} catch (
|
|
743
|
+
} catch (w) {
|
|
744
744
|
t.open({
|
|
745
745
|
title: "Error",
|
|
746
|
-
message: (
|
|
746
|
+
message: (w == null ? void 0 : w.message) || "Failed to clone draft",
|
|
747
747
|
type: "error"
|
|
748
748
|
});
|
|
749
749
|
}
|
|
@@ -754,7 +754,7 @@ const ia = { class: "flex flex-col" }, ca = {
|
|
|
754
754
|
approveDraft: N,
|
|
755
755
|
rejectDraft: E,
|
|
756
756
|
markAsFailed: I,
|
|
757
|
-
syncDraft:
|
|
757
|
+
syncDraft: _,
|
|
758
758
|
exportDraft: B,
|
|
759
759
|
refreshBalance: p,
|
|
760
760
|
cloneDraft: m,
|
|
@@ -764,7 +764,7 @@ const ia = { class: "flex flex-col" }, ca = {
|
|
|
764
764
|
};
|
|
765
765
|
}
|
|
766
766
|
);
|
|
767
|
-
function
|
|
767
|
+
function st(n) {
|
|
768
768
|
switch (n) {
|
|
769
769
|
case "DRAFT":
|
|
770
770
|
return "fm-status-badge-draft";
|
|
@@ -776,10 +776,10 @@ function ot(n) {
|
|
|
776
776
|
return "fm-status-badge-complete";
|
|
777
777
|
}
|
|
778
778
|
}
|
|
779
|
-
const
|
|
779
|
+
const rn = Qt(
|
|
780
780
|
"closingDraftTable",
|
|
781
781
|
function() {
|
|
782
|
-
const { t:
|
|
782
|
+
const { t: l } = Ye(), t = Wt(), o = it(), g = W(new Array()), i = W(0), s = W(!1), c = We(), x = qe();
|
|
783
783
|
async function A() {
|
|
784
784
|
if (g.value = [], !!c._currentLocation) {
|
|
785
785
|
s.value = !0;
|
|
@@ -810,7 +810,7 @@ const on = qt(
|
|
|
810
810
|
}
|
|
811
811
|
}
|
|
812
812
|
function B(p) {
|
|
813
|
-
const v =
|
|
813
|
+
const v = zn(
|
|
814
814
|
p.filter((m) => !!m.closingId).map((m) => ({ closingId: m.closingId, draftCreatedAt: new Date(Te(m._id)) }))
|
|
815
815
|
);
|
|
816
816
|
return p.map((m) => ({
|
|
@@ -827,14 +827,14 @@ const on = qt(
|
|
|
827
827
|
}
|
|
828
828
|
function E(p) {
|
|
829
829
|
var b, y;
|
|
830
|
-
const v = p.items.length + (((b = p.negativeStockItems) == null ? void 0 : b.length) ?? 0), m = (p == null ? void 0 : p.approveRemark) ?? ((y = p == null ? void 0 : p.rejectionHistory) == null ? void 0 : y.computeFirst((
|
|
830
|
+
const v = p.items.length + (((b = p.negativeStockItems) == null ? void 0 : b.length) ?? 0), m = (p == null ? void 0 : p.approveRemark) ?? ((y = p == null ? void 0 : p.rejectionHistory) == null ? void 0 : y.computeFirst((w) => w.rejectRemark)) ?? p.remark ?? "";
|
|
831
831
|
return { count: v, remark: m };
|
|
832
832
|
}
|
|
833
833
|
function I() {
|
|
834
834
|
o.closeDraftDialog(), A();
|
|
835
835
|
}
|
|
836
|
-
function
|
|
837
|
-
switch (v =
|
|
836
|
+
function _(p, v) {
|
|
837
|
+
switch (v = Fn(v), p) {
|
|
838
838
|
case Ne.Details:
|
|
839
839
|
return o.viewDraft(v);
|
|
840
840
|
case Ne.Export:
|
|
@@ -854,9 +854,9 @@ const on = qt(
|
|
|
854
854
|
{
|
|
855
855
|
id: "_id",
|
|
856
856
|
accessorKey: "_id",
|
|
857
|
-
header: () =>
|
|
857
|
+
header: () => l("inventory.closing.table.createdAt"),
|
|
858
858
|
cell(p) {
|
|
859
|
-
return
|
|
859
|
+
return Nn(`${p.getValue()}`);
|
|
860
860
|
},
|
|
861
861
|
sortingFn: (p, v) => new Date(Te(p.original._id)).getTime() - new Date(Te(v.original._id)).getTime(),
|
|
862
862
|
enableSorting: !0
|
|
@@ -865,7 +865,7 @@ const on = qt(
|
|
|
865
865
|
id: "closingId",
|
|
866
866
|
accessorFn: (p) => p.closingIdDisplay,
|
|
867
867
|
size: 160,
|
|
868
|
-
header: () =>
|
|
868
|
+
header: () => l("inventory.closing.draft.table.id"),
|
|
869
869
|
cell(p) {
|
|
870
870
|
return p.getValue();
|
|
871
871
|
},
|
|
@@ -873,7 +873,7 @@ const on = qt(
|
|
|
873
873
|
},
|
|
874
874
|
{
|
|
875
875
|
accessorKey: "effectiveAt",
|
|
876
|
-
header: () =>
|
|
876
|
+
header: () => l("inventory.closing.draft.table.effectiveAt"),
|
|
877
877
|
cell(p) {
|
|
878
878
|
const v = p.row.original;
|
|
879
879
|
let m = p.getValue();
|
|
@@ -888,72 +888,72 @@ const on = qt(
|
|
|
888
888
|
const { count: v, remark: m } = E(p);
|
|
889
889
|
return `${v} ${m}`;
|
|
890
890
|
},
|
|
891
|
-
header: () =>
|
|
891
|
+
header: () => l("inventory.closing.draft.table.description"),
|
|
892
892
|
enableSorting: !0,
|
|
893
893
|
size: 350,
|
|
894
894
|
cell(p) {
|
|
895
|
-
const { count: v, remark: m } = E(p.row.original), b = (y,
|
|
896
|
-
|
|
895
|
+
const { count: v, remark: m } = E(p.row.original), b = (y, w) => k("div", { class: "flex gap-4" }, [
|
|
896
|
+
k(
|
|
897
897
|
"span",
|
|
898
898
|
{ class: "fm-typo-en-body-sm-600 text-fm-color-typo-primary" },
|
|
899
899
|
`${y}:`
|
|
900
900
|
),
|
|
901
|
-
|
|
901
|
+
k(
|
|
902
902
|
"span",
|
|
903
903
|
{
|
|
904
904
|
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary",
|
|
905
905
|
style: "white-space: pre-wrap; word-break: break-word;"
|
|
906
906
|
},
|
|
907
|
-
`${
|
|
907
|
+
`${w}`
|
|
908
908
|
)
|
|
909
909
|
]);
|
|
910
|
-
return
|
|
911
|
-
b(
|
|
912
|
-
m ? b(
|
|
910
|
+
return k("div", { class: "flex flex-col gap-2", style: "width: 300px;" }, [
|
|
911
|
+
b(l("inventory.closing.draft.table.items"), v),
|
|
912
|
+
m ? b(l("inventory.closing.draft.table.remark"), m) : null
|
|
913
913
|
]);
|
|
914
914
|
}
|
|
915
915
|
},
|
|
916
916
|
{
|
|
917
917
|
id: "status",
|
|
918
918
|
accessorFn: (p) => p.status,
|
|
919
|
-
header: () =>
|
|
919
|
+
header: () => l("inventory.closing.table.status"),
|
|
920
920
|
enableSorting: !1,
|
|
921
921
|
cell(p) {
|
|
922
922
|
var Y;
|
|
923
|
-
const v = p.row.original, m = v.status, b = new Date(v.updatedAt), y = (Y = v == null ? void 0 : v.rejectionHistory) == null ? void 0 : Y.computeFirst((
|
|
924
|
-
return m === "DRAFT" &&
|
|
923
|
+
const v = p.row.original, m = v.status, b = new Date(v.updatedAt), y = (Y = v == null ? void 0 : v.rejectionHistory) == null ? void 0 : Y.computeFirst((q) => q.rejectedAt), w = y ? new Date(y) : null;
|
|
924
|
+
return m === "DRAFT" && w ? w.getTime() > b.getTime() ? k(
|
|
925
925
|
"div",
|
|
926
926
|
{
|
|
927
927
|
class: "flex"
|
|
928
928
|
},
|
|
929
|
-
|
|
929
|
+
k(
|
|
930
930
|
"div",
|
|
931
931
|
{
|
|
932
|
-
class: ["fm-status-badge",
|
|
932
|
+
class: ["fm-status-badge", st("FAILED")]
|
|
933
933
|
},
|
|
934
934
|
"Rejected"
|
|
935
935
|
)
|
|
936
|
-
) :
|
|
936
|
+
) : k(
|
|
937
937
|
"div",
|
|
938
938
|
{
|
|
939
939
|
class: "flex"
|
|
940
940
|
},
|
|
941
|
-
|
|
941
|
+
k(
|
|
942
942
|
"div",
|
|
943
943
|
{
|
|
944
|
-
class: ["fm-status-badge",
|
|
944
|
+
class: ["fm-status-badge", st("PROCESSING")]
|
|
945
945
|
},
|
|
946
946
|
"Updated"
|
|
947
947
|
)
|
|
948
|
-
) :
|
|
948
|
+
) : k(
|
|
949
949
|
"div",
|
|
950
950
|
{
|
|
951
951
|
class: "flex"
|
|
952
952
|
},
|
|
953
|
-
|
|
953
|
+
k(
|
|
954
954
|
"div",
|
|
955
955
|
{
|
|
956
|
-
class: ["fm-status-badge",
|
|
956
|
+
class: ["fm-status-badge", st(m)]
|
|
957
957
|
},
|
|
958
958
|
Be(m)
|
|
959
959
|
)
|
|
@@ -963,19 +963,19 @@ const on = qt(
|
|
|
963
963
|
{
|
|
964
964
|
id: "updatedAt",
|
|
965
965
|
accessorFn: (p) => p.updatedAt,
|
|
966
|
-
header: () =>
|
|
966
|
+
header: () => l("inventory.closing.draft.table.lastUpdate"),
|
|
967
967
|
enableSorting: !0,
|
|
968
968
|
size: 200,
|
|
969
969
|
cell(p) {
|
|
970
970
|
var m;
|
|
971
971
|
const v = p.row.original;
|
|
972
|
-
return
|
|
973
|
-
|
|
972
|
+
return k("div", { class: "flex flex-col" }, [
|
|
973
|
+
k(
|
|
974
974
|
"div",
|
|
975
975
|
{ class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" },
|
|
976
976
|
((m = v.updatedBy) == null ? void 0 : m.name) ?? ""
|
|
977
977
|
),
|
|
978
|
-
|
|
978
|
+
k(
|
|
979
979
|
"div",
|
|
980
980
|
{ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
|
|
981
981
|
Ce(v.updatedAt)
|
|
@@ -988,8 +988,8 @@ const on = qt(
|
|
|
988
988
|
cell(p) {
|
|
989
989
|
var Y;
|
|
990
990
|
const v = p.row.original, m = ((Y = t.sessionUser.value) == null ? void 0 : Y.role.isAdmin) ?? !1, b = [
|
|
991
|
-
|
|
992
|
-
|
|
991
|
+
Ht[Ne.Details],
|
|
992
|
+
Ht[Ne.Export]
|
|
993
993
|
], y = [
|
|
994
994
|
{
|
|
995
995
|
translationKey: "inventory.closing.draft.approveDraft",
|
|
@@ -1006,20 +1006,20 @@ const on = qt(
|
|
|
1006
1006
|
color: "text-fm-color-typo-error",
|
|
1007
1007
|
value: oe.enum.markAsFailed
|
|
1008
1008
|
}
|
|
1009
|
-
],
|
|
1009
|
+
], w = m && v.status !== _e.enum.DRAFT ? [
|
|
1010
1010
|
{
|
|
1011
1011
|
translationKey: "inventory.closing.draft.cloneDraft",
|
|
1012
1012
|
color: "text-fm-color-typo-primary",
|
|
1013
1013
|
value: Ne.Duplicate
|
|
1014
1014
|
}
|
|
1015
1015
|
] : [];
|
|
1016
|
-
return
|
|
1016
|
+
return Vn(
|
|
1017
1017
|
[
|
|
1018
1018
|
...b,
|
|
1019
1019
|
...v.status === _e.enum.DRAFT ? y : []
|
|
1020
1020
|
],
|
|
1021
|
-
(
|
|
1022
|
-
|
|
1021
|
+
(q) => _(q, v),
|
|
1022
|
+
w
|
|
1023
1023
|
);
|
|
1024
1024
|
},
|
|
1025
1025
|
enableSorting: !1,
|
|
@@ -1038,19 +1038,19 @@ const on = qt(
|
|
|
1038
1038
|
updateDraftRef: N
|
|
1039
1039
|
};
|
|
1040
1040
|
}
|
|
1041
|
-
),
|
|
1041
|
+
), pa = { class: "fm-typo-en-heading-lg-600" }, va = { class: "py-4" }, ya = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, ga = { key: 0 }, ba = { class: "mt-4 flex gap-4" }, ha = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, ka = { key: 0 }, _a = {
|
|
1042
1042
|
key: 0,
|
|
1043
1043
|
class: "mb-4"
|
|
1044
|
-
},
|
|
1044
|
+
}, wa = { class: "flex flex-col gap-1 max-h-200 overflow-auto w-full" }, xa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Da = {
|
|
1045
1045
|
key: 0,
|
|
1046
1046
|
class: "text-fm-color-system-success-300 mr-1"
|
|
1047
|
-
},
|
|
1047
|
+
}, Aa = {
|
|
1048
1048
|
key: 1,
|
|
1049
1049
|
class: "text-fm-color-system-error-300 mr-1"
|
|
1050
|
-
},
|
|
1050
|
+
}, Ca = { class: "fm-typo-en-body-md-400" }, Sa = { class: "mt-4 flex gap-4" }, $a = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, Fa = {
|
|
1051
1051
|
key: 0,
|
|
1052
1052
|
class: "flex gap-4"
|
|
1053
|
-
},
|
|
1053
|
+
}, Ia = /* @__PURE__ */ je({
|
|
1054
1054
|
__name: "ClosingDraftApprovalDialog",
|
|
1055
1055
|
props: {
|
|
1056
1056
|
show: { type: Boolean },
|
|
@@ -1059,8 +1059,8 @@ const on = qt(
|
|
|
1059
1059
|
draft: {}
|
|
1060
1060
|
},
|
|
1061
1061
|
emits: ["update:show", "refresh", "approve"],
|
|
1062
|
-
setup(n, { emit:
|
|
1063
|
-
const { FmStepper: t, FmStep: o, FmDialog: g, FmButton: i } = pe, { t: s } =
|
|
1062
|
+
setup(n, { emit: l }) {
|
|
1063
|
+
const { FmStepper: t, FmStep: o, FmDialog: g, FmButton: i } = pe, { t: s } = On(), c = wt(), x = n, A = l, f = M(
|
|
1064
1064
|
() => {
|
|
1065
1065
|
var P, S;
|
|
1066
1066
|
return ((P = x.draft) == null ? void 0 : P.stockSnapshot) && ((S = x.draft) == null ? void 0 : S.stockSnapshot) !== void 0;
|
|
@@ -1098,7 +1098,7 @@ const on = qt(
|
|
|
1098
1098
|
}), I = M({
|
|
1099
1099
|
get: () => x.show,
|
|
1100
1100
|
set: (P) => A("update:show", P)
|
|
1101
|
-
}),
|
|
1101
|
+
}), _ = W(1), R = () => _.value > 1, p = () => _.value > 2, v = () => !1;
|
|
1102
1102
|
function m(P) {
|
|
1103
1103
|
return P === 1 ? f.value : P === 2 ? E.value.length == 0 : !1;
|
|
1104
1104
|
}
|
|
@@ -1108,7 +1108,7 @@ const on = qt(
|
|
|
1108
1108
|
for (; S <= 3 && m(S); ) S++;
|
|
1109
1109
|
return S > 3 ? 3 : S;
|
|
1110
1110
|
}
|
|
1111
|
-
function
|
|
1111
|
+
function w(P) {
|
|
1112
1112
|
let S = P - 1;
|
|
1113
1113
|
for (; S >= 1 && m(S); ) S--;
|
|
1114
1114
|
return S < 1 ? 1 : S;
|
|
@@ -1119,46 +1119,46 @@ const on = qt(
|
|
|
1119
1119
|
ze(
|
|
1120
1120
|
() => x.show,
|
|
1121
1121
|
(P) => {
|
|
1122
|
-
P && (
|
|
1122
|
+
P && (_.value = Y());
|
|
1123
1123
|
}
|
|
1124
1124
|
), ze(
|
|
1125
1125
|
() => f.value,
|
|
1126
1126
|
(P) => {
|
|
1127
|
-
P &&
|
|
1127
|
+
P && _.value === 1 && (_.value = y(1));
|
|
1128
1128
|
}
|
|
1129
1129
|
), ze(
|
|
1130
1130
|
() => E.value.length,
|
|
1131
1131
|
(P) => {
|
|
1132
|
-
P === 0 &&
|
|
1132
|
+
P === 0 && _.value === 2 && (_.value = y(2));
|
|
1133
1133
|
}
|
|
1134
1134
|
);
|
|
1135
|
-
function
|
|
1135
|
+
function q() {
|
|
1136
1136
|
A("refresh");
|
|
1137
1137
|
}
|
|
1138
1138
|
function re() {
|
|
1139
|
-
|
|
1139
|
+
_.value < 3 && (_.value = y(_.value));
|
|
1140
1140
|
}
|
|
1141
1141
|
function z() {
|
|
1142
|
-
|
|
1142
|
+
_.value > 1 && (_.value = w(_.value));
|
|
1143
1143
|
}
|
|
1144
1144
|
function le() {
|
|
1145
1145
|
A("approve");
|
|
1146
1146
|
}
|
|
1147
1147
|
return (P, S) => {
|
|
1148
1148
|
const ie = Z("FmIcon");
|
|
1149
|
-
return
|
|
1149
|
+
return h(), ae(u(g), {
|
|
1150
1150
|
modelValue: I.value,
|
|
1151
1151
|
"onUpdate:modelValue": S[1] || (S[1] = (L) => I.value = L),
|
|
1152
1152
|
"max-width": 600
|
|
1153
1153
|
}, {
|
|
1154
1154
|
"dialog-header": ee(() => [
|
|
1155
|
-
a("div",
|
|
1155
|
+
a("div", pa, H(u(s)("inventory.closing.approval.title")), 1)
|
|
1156
1156
|
]),
|
|
1157
1157
|
default: ee(() => [
|
|
1158
|
-
a("div",
|
|
1158
|
+
a("div", va, [
|
|
1159
1159
|
$(u(t), {
|
|
1160
|
-
modelValue:
|
|
1161
|
-
"onUpdate:modelValue": S[0] || (S[0] = (L) =>
|
|
1160
|
+
modelValue: _.value,
|
|
1161
|
+
"onUpdate:modelValue": S[0] || (S[0] = (L) => _.value = L),
|
|
1162
1162
|
orientation: "vertical"
|
|
1163
1163
|
}, {
|
|
1164
1164
|
default: ee(() => [
|
|
@@ -1168,24 +1168,24 @@ const on = qt(
|
|
|
1168
1168
|
complete: R
|
|
1169
1169
|
}, {
|
|
1170
1170
|
default: ee(() => [
|
|
1171
|
-
a("div",
|
|
1172
|
-
|
|
1171
|
+
a("div", ya, H(u(s)("inventory.closing.approval.step.generateReport.description")), 1),
|
|
1172
|
+
_.value === 1 ? (h(), T("div", ga, [
|
|
1173
1173
|
$(u(i), {
|
|
1174
1174
|
label: u(s)("inventory.stock.stock_balance.refreshBalance"),
|
|
1175
1175
|
"prepend-icon": "refresh",
|
|
1176
1176
|
variant: "secondary",
|
|
1177
1177
|
loading: P.refreshing,
|
|
1178
1178
|
disabled: P.refreshing,
|
|
1179
|
-
onClick:
|
|
1179
|
+
onClick: q
|
|
1180
1180
|
}, null, 8, ["label", "loading", "disabled"]),
|
|
1181
|
-
a("div",
|
|
1181
|
+
a("div", ba, [
|
|
1182
1182
|
$(u(i), {
|
|
1183
1183
|
label: u(s)("inventory.common.continue"),
|
|
1184
1184
|
disabled: !f.value,
|
|
1185
1185
|
onClick: re
|
|
1186
1186
|
}, null, 8, ["label", "disabled"])
|
|
1187
1187
|
])
|
|
1188
|
-
])) :
|
|
1188
|
+
])) : K("", !0)
|
|
1189
1189
|
]),
|
|
1190
1190
|
_: 1
|
|
1191
1191
|
}, 8, ["title"]),
|
|
@@ -1196,22 +1196,22 @@ const on = qt(
|
|
|
1196
1196
|
complete: p
|
|
1197
1197
|
}, {
|
|
1198
1198
|
default: ee(() => [
|
|
1199
|
-
a("div",
|
|
1200
|
-
|
|
1201
|
-
N.value.length > 0 ? (
|
|
1199
|
+
a("div", ha, H(N.value.length > 0 ? `${u(s)("inventory.closing.approval.step.negativeItems.resolveMessage")} [${u(s)("inventory.closing.approval.step.negativeItems.itemsHeader")} (${E.value.length})]` : u(s)("inventory.closing.approval.step.negativeItems.noItemsMessage")), 1),
|
|
1200
|
+
_.value === 2 ? (h(), T("div", ka, [
|
|
1201
|
+
N.value.length > 0 ? (h(), T("div", _a, [
|
|
1202
1202
|
S[2] || (S[2] = a("div", { class: "fm-typo-en-body-md-600 mb-2" }, null, -1)),
|
|
1203
|
-
a("div",
|
|
1204
|
-
(
|
|
1203
|
+
a("div", wa, [
|
|
1204
|
+
(h(!0), T(ce, null, he(N.value, (L) => (h(), T("div", {
|
|
1205
1205
|
key: L.id,
|
|
1206
1206
|
class: "flex gap-8"
|
|
1207
1207
|
}, [
|
|
1208
|
-
a("div",
|
|
1209
|
-
B.value[L.id] ? (
|
|
1208
|
+
a("div", xa, [
|
|
1209
|
+
B.value[L.id] ? (h(), T("span", Da, [
|
|
1210
1210
|
$(ie, {
|
|
1211
1211
|
name: "check_circle",
|
|
1212
1212
|
size: "sm"
|
|
1213
1213
|
})
|
|
1214
|
-
])) : (
|
|
1214
|
+
])) : (h(), T("span", Aa, [
|
|
1215
1215
|
$(ie, {
|
|
1216
1216
|
name: "error",
|
|
1217
1217
|
size: "sm"
|
|
@@ -1219,11 +1219,11 @@ const on = qt(
|
|
|
1219
1219
|
])),
|
|
1220
1220
|
de(" " + H(L.code), 1)
|
|
1221
1221
|
]),
|
|
1222
|
-
a("div",
|
|
1222
|
+
a("div", Ca, H(L.name), 1)
|
|
1223
1223
|
]))), 128))
|
|
1224
1224
|
])
|
|
1225
|
-
])) :
|
|
1226
|
-
a("div",
|
|
1225
|
+
])) : K("", !0),
|
|
1226
|
+
a("div", Sa, [
|
|
1227
1227
|
$(u(i), {
|
|
1228
1228
|
label: u(s)("inventory.common.back"),
|
|
1229
1229
|
variant: "secondary",
|
|
@@ -1235,7 +1235,7 @@ const on = qt(
|
|
|
1235
1235
|
onClick: re
|
|
1236
1236
|
}, null, 8, ["label", "disabled"])
|
|
1237
1237
|
])
|
|
1238
|
-
])) :
|
|
1238
|
+
])) : K("", !0)
|
|
1239
1239
|
]),
|
|
1240
1240
|
_: 1
|
|
1241
1241
|
}, 8, ["title", "disabled"]),
|
|
@@ -1246,8 +1246,8 @@ const on = qt(
|
|
|
1246
1246
|
complete: v
|
|
1247
1247
|
}, {
|
|
1248
1248
|
default: ee(() => [
|
|
1249
|
-
a("div",
|
|
1250
|
-
|
|
1249
|
+
a("div", $a, H(u(s)("inventory.closing.approval.step.approval.warning")), 1),
|
|
1250
|
+
_.value === 3 ? (h(), T("div", Fa, [
|
|
1251
1251
|
$(u(i), {
|
|
1252
1252
|
label: u(s)("inventory.common.back"),
|
|
1253
1253
|
variant: "secondary",
|
|
@@ -1260,7 +1260,7 @@ const on = qt(
|
|
|
1260
1260
|
loading: P.approving,
|
|
1261
1261
|
onClick: le
|
|
1262
1262
|
}, null, 8, ["label", "disabled", "loading"])
|
|
1263
|
-
])) :
|
|
1263
|
+
])) : K("", !0)
|
|
1264
1264
|
]),
|
|
1265
1265
|
_: 1
|
|
1266
1266
|
}, 8, ["title", "disabled"])
|
|
@@ -1274,8 +1274,8 @@ const on = qt(
|
|
|
1274
1274
|
};
|
|
1275
1275
|
}
|
|
1276
1276
|
});
|
|
1277
|
-
function
|
|
1278
|
-
const
|
|
1277
|
+
function Ba(n) {
|
|
1278
|
+
const l = qe(), t = Pn(), o = Ke(), { t: g } = Ye(), i = W(!1), s = W(null);
|
|
1279
1279
|
let c = !1, x = null, A = !1, f = !1;
|
|
1280
1280
|
function B() {
|
|
1281
1281
|
R();
|
|
@@ -1287,14 +1287,14 @@ function Fa(n) {
|
|
|
1287
1287
|
type: "closing-draft",
|
|
1288
1288
|
params: {
|
|
1289
1289
|
draftId: m,
|
|
1290
|
-
locationId:
|
|
1290
|
+
locationId: l.getDbName(),
|
|
1291
1291
|
closingDraftRevision: b
|
|
1292
1292
|
}
|
|
1293
|
-
}, { unsubscribe:
|
|
1294
|
-
x =
|
|
1295
|
-
|
|
1296
|
-
}).catch((
|
|
1297
|
-
console.error("Failed to fetch initial state",
|
|
1293
|
+
}, { unsubscribe: w, initialState: Y } = t.subscribe(y, E);
|
|
1294
|
+
x = w, Y.then((q) => {
|
|
1295
|
+
q != null && q.initialState && E(q.initialState);
|
|
1296
|
+
}).catch((q) => {
|
|
1297
|
+
console.error("Failed to fetch initial state", q);
|
|
1298
1298
|
});
|
|
1299
1299
|
}
|
|
1300
1300
|
function N() {
|
|
@@ -1333,7 +1333,7 @@ function Fa(n) {
|
|
|
1333
1333
|
return;
|
|
1334
1334
|
}
|
|
1335
1335
|
try {
|
|
1336
|
-
const b = await
|
|
1336
|
+
const b = await l.getDraft(m);
|
|
1337
1337
|
i.value = !1, n.onCompleted(b), o.open({
|
|
1338
1338
|
title: "Balance refreshed",
|
|
1339
1339
|
message: "Stock balance has been recalculated.",
|
|
@@ -1347,7 +1347,7 @@ function Fa(n) {
|
|
|
1347
1347
|
});
|
|
1348
1348
|
}
|
|
1349
1349
|
}
|
|
1350
|
-
async function
|
|
1350
|
+
async function _(m) {
|
|
1351
1351
|
if (!(!n.closingDraftId.value || i.value || A)) {
|
|
1352
1352
|
i.value = !0, A = !0, s.value = {
|
|
1353
1353
|
requestId: "",
|
|
@@ -1357,7 +1357,7 @@ function Fa(n) {
|
|
|
1357
1357
|
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1358
1358
|
};
|
|
1359
1359
|
try {
|
|
1360
|
-
await
|
|
1360
|
+
await l.initializeStockSnapshot(n.closingDraftId.value, m);
|
|
1361
1361
|
} catch (b) {
|
|
1362
1362
|
A = !1, i.value = !1, o.open({
|
|
1363
1363
|
title: g("inventory.common.refreshFailed"),
|
|
@@ -1378,150 +1378,150 @@ function Fa(n) {
|
|
|
1378
1378
|
}
|
|
1379
1379
|
return ze(
|
|
1380
1380
|
[n.closingDraftId, n.currentRev],
|
|
1381
|
-
([m, b], [y,
|
|
1382
|
-
f && (m === y && b ===
|
|
1381
|
+
([m, b], [y, w]) => {
|
|
1382
|
+
f && (m === y && b === w || B());
|
|
1383
1383
|
}
|
|
1384
|
-
),
|
|
1384
|
+
), kn(() => {
|
|
1385
1385
|
v();
|
|
1386
1386
|
}), {
|
|
1387
1387
|
refreshing: i,
|
|
1388
1388
|
refreshStatus: s,
|
|
1389
1389
|
startListening: N,
|
|
1390
|
-
startRefresh:
|
|
1390
|
+
startRefresh: _,
|
|
1391
1391
|
cleanup: v
|
|
1392
1392
|
};
|
|
1393
1393
|
}
|
|
1394
|
-
const
|
|
1394
|
+
const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-col gap-4" }, Ma = { class: "flex justify-between" }, Ua = { class: "flex" }, Ra = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, Pa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Va = { class: "flex gap-1" }, Na = {
|
|
1395
1395
|
class: "fm-typo-en-body-lg-600",
|
|
1396
1396
|
style: { "white-space": "pre-wrap", "word-break": "break-word" }
|
|
1397
|
-
},
|
|
1397
|
+
}, za = {
|
|
1398
1398
|
key: 0,
|
|
1399
|
-
class: "flex items-start gap-8 p-12 fm-corner-radius-md border-1 border-
|
|
1400
|
-
},
|
|
1399
|
+
class: "flex items-start gap-8 p-12 fm-corner-radius-md border-1 border-yellow-500 bg-yellow-50 text-yellow-700"
|
|
1400
|
+
}, Ea = { class: "flex flex-col gap-2" }, La = { class: "fm-typo-en-body-sm-400 list-disc pl-16" }, Oa = { key: 0 }, Ha = { key: 1 }, Ya = { class: "flex flex-col gap-16" }, Ka = { class: "flex items-center" }, Wa = {
|
|
1401
1401
|
key: 0,
|
|
1402
1402
|
class: "flex gap-8"
|
|
1403
|
-
},
|
|
1403
|
+
}, qa = {
|
|
1404
1404
|
key: 0,
|
|
1405
1405
|
class: "w-full flex flex-col items-center"
|
|
1406
|
-
},
|
|
1406
|
+
}, Ga = { class: "flex items-center gap-8" }, Qa = { class: "flex flex-col gap-8" }, Za = { class: "flex gap-8" }, Ja = {
|
|
1407
1407
|
key: 0,
|
|
1408
1408
|
class: "flex gap-8"
|
|
1409
|
-
},
|
|
1409
|
+
}, Xa = {
|
|
1410
1410
|
key: 1,
|
|
1411
1411
|
class: "flex gap-8 flex-wrap"
|
|
1412
|
-
},
|
|
1412
|
+
}, eo = { class: "overflow-x-auto" }, to = {
|
|
1413
1413
|
key: 1,
|
|
1414
1414
|
class: "flex-1 xs:w-screen xs:max-w-full"
|
|
1415
|
-
},
|
|
1415
|
+
}, no = {
|
|
1416
1416
|
key: 0,
|
|
1417
1417
|
class: "flex flex-col items-center gap-8 h-full"
|
|
1418
|
-
},
|
|
1418
|
+
}, ao = ["src"], oo = {
|
|
1419
1419
|
key: 1,
|
|
1420
1420
|
class: "px-4 flex flex-col"
|
|
1421
|
-
},
|
|
1421
|
+
}, so = { class: "flex gap-12 content-stretch" }, ro = {
|
|
1422
1422
|
class: "flex flex-col w-24",
|
|
1423
1423
|
name: "circles"
|
|
1424
|
-
},
|
|
1424
|
+
}, lo = { class: "flex-1 flex flex-col items-center" }, io = { class: "flex-1 flex flex-col items-center" }, co = {
|
|
1425
1425
|
class: "py-12 flex flex-col gap-4",
|
|
1426
1426
|
name: "received-at header"
|
|
1427
|
-
},
|
|
1427
|
+
}, uo = { class: "fm-typo-en-body-lg-400" }, mo = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, fo = { class: "flex gap-12 content-stretch" }, po = {
|
|
1428
1428
|
class: "flex flex-col w-24",
|
|
1429
1429
|
name: "circles"
|
|
1430
|
-
},
|
|
1430
|
+
}, vo = { class: "flex-1 flex flex-col items-center" }, yo = {
|
|
1431
1431
|
class: "py-12 flex flex-col gap-4 flex-1",
|
|
1432
1432
|
name: "delivery details"
|
|
1433
|
-
},
|
|
1433
|
+
}, go = { class: "flex flex-col gap-8" }, bo = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, ho = { class: "flex flex-col gap-4" }, ko = { class: "flex items-center justify-between gap-8 w-full" }, _o = { class: "flex items-center gap-8" }, wo = { class: "flex flex-col items-end" }, xo = { class: "text-2xl font-semibold" }, Yt = "N/A", Do = /* @__PURE__ */ je({
|
|
1434
1434
|
__name: "ClosingDraftDialog",
|
|
1435
1435
|
props: {
|
|
1436
1436
|
show: { type: Boolean },
|
|
1437
1437
|
draft: {}
|
|
1438
1438
|
},
|
|
1439
1439
|
emits: ["submitted", "refresh"],
|
|
1440
|
-
setup(n, { emit:
|
|
1440
|
+
setup(n, { emit: l }) {
|
|
1441
1441
|
const t = n, o = M(() => {
|
|
1442
|
-
const
|
|
1443
|
-
return
|
|
1444
|
-
}), g =
|
|
1445
|
-
var
|
|
1446
|
-
return (
|
|
1447
|
-
}), s =
|
|
1448
|
-
|
|
1442
|
+
const r = Gt();
|
|
1443
|
+
return r === "MYR" ? "RM" : r;
|
|
1444
|
+
}), g = rn(), i = M(() => {
|
|
1445
|
+
var r, e;
|
|
1446
|
+
return (r = t.draft) != null && r.closingId ? ((e = g.drafts.find((d) => d._id === t.draft._id)) == null ? void 0 : e.closingIdDisplay) ?? null : null;
|
|
1447
|
+
}), s = it(), c = qt(t, "show"), x = W(!1), A = W(!1), f = W(new Array()), B = W(new Array()), N = W([]), E = ct(), I = Ke(), _ = wt(), R = We(), p = Ot({}), v = M(() => new Set(
|
|
1448
|
+
_.skus.filter((r) => {
|
|
1449
1449
|
var e;
|
|
1450
|
-
return p[(e =
|
|
1451
|
-
}).map((
|
|
1452
|
-
)), m =
|
|
1453
|
-
var
|
|
1454
|
-
return (
|
|
1450
|
+
return p[(e = r.customAttributes) == null ? void 0 : e.tag];
|
|
1451
|
+
}).map((r) => r._id)
|
|
1452
|
+
)), m = l, b = M(() => {
|
|
1453
|
+
var r;
|
|
1454
|
+
return (r = t.draft) == null ? void 0 : r._id;
|
|
1455
1455
|
}), y = M(() => {
|
|
1456
|
-
var
|
|
1457
|
-
return (
|
|
1456
|
+
var r;
|
|
1457
|
+
return (r = t.draft) == null ? void 0 : r._rev;
|
|
1458
1458
|
}), {
|
|
1459
|
-
refreshing:
|
|
1459
|
+
refreshing: w,
|
|
1460
1460
|
startListening: Y,
|
|
1461
|
-
startRefresh:
|
|
1461
|
+
startRefresh: q,
|
|
1462
1462
|
cleanup: re
|
|
1463
|
-
} =
|
|
1463
|
+
} = Ba({
|
|
1464
1464
|
closingDraftId: b,
|
|
1465
1465
|
currentRev: y,
|
|
1466
|
-
onCompleted: (
|
|
1467
|
-
m("refresh",
|
|
1466
|
+
onCompleted: (r) => {
|
|
1467
|
+
m("refresh", r), f.value = r.stockSnapshot ?? [], c.value = !1;
|
|
1468
1468
|
}
|
|
1469
|
-
}), z =
|
|
1469
|
+
}), z = W({
|
|
1470
1470
|
templateItem: !0,
|
|
1471
1471
|
nonTemplateItem: !0
|
|
1472
|
-
}), le =
|
|
1473
|
-
function P(
|
|
1474
|
-
le.value = e ?
|
|
1472
|
+
}), le = W(null);
|
|
1473
|
+
function P(r, e) {
|
|
1474
|
+
le.value = e ? r : le.value === r ? null : le.value;
|
|
1475
1475
|
}
|
|
1476
|
-
const S = (
|
|
1477
|
-
function ie(
|
|
1478
|
-
return e ? "text-fm-color-system-error-300" :
|
|
1476
|
+
const S = (r) => ne(r, { minPrecision: 0, maxPrecision: 3 });
|
|
1477
|
+
function ie(r, e) {
|
|
1478
|
+
return e ? "text-fm-color-system-error-300" : r ? "text-purple-500" : "";
|
|
1479
1479
|
}
|
|
1480
|
-
function L(
|
|
1481
|
-
return e ?
|
|
1480
|
+
function L(r, e) {
|
|
1481
|
+
return e ? k(pe.FmIcon, { name: "warning", size: "sm", color: "system-error-300" }) : r ? k(pe.FmIcon, { name: "rule", size: "sm" }) : null;
|
|
1482
1482
|
}
|
|
1483
|
-
function F(
|
|
1484
|
-
return
|
|
1483
|
+
function F(r) {
|
|
1484
|
+
return k(
|
|
1485
1485
|
"div",
|
|
1486
1486
|
{
|
|
1487
1487
|
class: "p-12 flex flex-col gap-4 fm-typo-en-body-md-400 min-w-[280px] max-w-[420px]"
|
|
1488
1488
|
},
|
|
1489
1489
|
[
|
|
1490
|
-
|
|
1491
|
-
...
|
|
1492
|
-
(e) =>
|
|
1493
|
-
|
|
1490
|
+
k("div", { class: "fm-typo-en-body-sm-600 text-fm-color-typo-secondary mb-4" }, "Breakdown"),
|
|
1491
|
+
...r.breakdown.map(
|
|
1492
|
+
(e) => k("div", { class: "flex justify-between gap-12" }, [
|
|
1493
|
+
k(
|
|
1494
1494
|
"div",
|
|
1495
1495
|
{ class: ["flex items-center gap-4", ie(e.inactive, e.orphan)] },
|
|
1496
|
-
[L(e.inactive, e.orphan),
|
|
1496
|
+
[L(e.inactive, e.orphan), k("span", e.label)]
|
|
1497
1497
|
),
|
|
1498
|
-
|
|
1498
|
+
k(
|
|
1499
1499
|
"div",
|
|
1500
1500
|
{ class: e.counted ? "" : "line-through text-fm-color-typo-tertiary" },
|
|
1501
|
-
e.orphan ? `${S(e.amount)} ${e.abbrev} (no valid conversion)` : e.counted ? `${S(e.subtotal)} ${
|
|
1501
|
+
e.orphan ? `${S(e.amount)} ${e.abbrev} (no valid conversion)` : e.counted ? `${S(e.subtotal)} ${r.baseUnit}` : `${S(e.subtotal)} ${r.baseUnit} (ignored)`
|
|
1502
1502
|
)
|
|
1503
1503
|
])
|
|
1504
1504
|
),
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1505
|
+
k("hr", { class: "border-fm-color-typo-secondary my-4" }),
|
|
1506
|
+
k("div", { class: "flex justify-between fm-typo-en-body-lg-600" }, [
|
|
1507
|
+
k("span", "Total"),
|
|
1508
|
+
k("span", `${S(r.physicalBalance)} ${r.baseUnit}`)
|
|
1509
1509
|
])
|
|
1510
1510
|
]
|
|
1511
1511
|
);
|
|
1512
1512
|
}
|
|
1513
1513
|
const Q = M(() => {
|
|
1514
1514
|
var e, d;
|
|
1515
|
-
const
|
|
1516
|
-
return v.value.size ?
|
|
1515
|
+
const r = [...((e = t.draft) == null ? void 0 : e.items) ?? [], ...((d = t.draft) == null ? void 0 : d.negativeStockItems) ?? []];
|
|
1516
|
+
return v.value.size ? r.filter((j) => v.value.has(j.sku._id)) : r;
|
|
1517
1517
|
}), se = M(() => {
|
|
1518
|
-
const
|
|
1519
|
-
return
|
|
1520
|
-
}), we =
|
|
1518
|
+
const r = Q.value.map((e) => e.sku);
|
|
1519
|
+
return r.sort((e, d) => e.code.localeCompare(d.code)), r;
|
|
1520
|
+
}), we = on();
|
|
1521
1521
|
kt(Ee), ze(
|
|
1522
1522
|
() => t.show,
|
|
1523
|
-
async (
|
|
1524
|
-
if (!
|
|
1523
|
+
async (r) => {
|
|
1524
|
+
if (!r) {
|
|
1525
1525
|
re();
|
|
1526
1526
|
return;
|
|
1527
1527
|
}
|
|
@@ -1532,17 +1532,17 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1532
1532
|
},
|
|
1533
1533
|
{ immediate: !0 }
|
|
1534
1534
|
);
|
|
1535
|
-
const xe = M(() =>
|
|
1535
|
+
const xe = M(() => Qe.value.reduce((r, e) => r + Number(e.stockTakeValue), 0)), De = He(0), $e = He(100);
|
|
1536
1536
|
async function Ee() {
|
|
1537
|
-
var e, d,
|
|
1537
|
+
var e, d, j, D;
|
|
1538
1538
|
if (!R._currentLocation) return;
|
|
1539
1539
|
x.value = !0;
|
|
1540
|
-
const
|
|
1540
|
+
const r = ((e = t.draft) == null ? void 0 : e.status) === _e.enum.COMPLETED;
|
|
1541
1541
|
B.value = [];
|
|
1542
1542
|
try {
|
|
1543
|
-
if (await
|
|
1544
|
-
const
|
|
1545
|
-
if (!
|
|
1543
|
+
if (await _.init(), r) {
|
|
1544
|
+
const G = t.draft.closingAdjustmentId;
|
|
1545
|
+
if (!G) {
|
|
1546
1546
|
I.open({
|
|
1547
1547
|
title: "Something went wrong",
|
|
1548
1548
|
message: "Closing draft is completed but closing document cannot be found.",
|
|
@@ -1552,7 +1552,7 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1552
1552
|
});
|
|
1553
1553
|
return;
|
|
1554
1554
|
}
|
|
1555
|
-
const me = await E.readAdjustmentById(
|
|
1555
|
+
const me = await E.readAdjustmentById(G), Ae = (me == null ? void 0 : me.skus) ?? [];
|
|
1556
1556
|
for (const ge of Ae) {
|
|
1557
1557
|
const Fe = {
|
|
1558
1558
|
id: ge.sku._id,
|
|
@@ -1566,16 +1566,16 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1566
1566
|
f.value.push(Fe), B.value.push(U);
|
|
1567
1567
|
}
|
|
1568
1568
|
} else
|
|
1569
|
-
f.value = ((
|
|
1569
|
+
f.value = ((j = t.draft) == null ? void 0 : j.stockSnapshot) ?? [];
|
|
1570
1570
|
const V = /* @__PURE__ */ new Set();
|
|
1571
1571
|
if ((D = t.draft) != null && D.adjustmentSnapshot)
|
|
1572
|
-
for (const
|
|
1573
|
-
|
|
1572
|
+
for (const G of t.draft.adjustmentSnapshot)
|
|
1573
|
+
G.adjustmentsByType && Object.keys(G.adjustmentsByType).forEach((me) => {
|
|
1574
1574
|
V.add(me);
|
|
1575
1575
|
});
|
|
1576
1576
|
const C = ["receive", "sales", "wastage"], J = [];
|
|
1577
|
-
C.forEach((
|
|
1578
|
-
V.has(
|
|
1577
|
+
C.forEach((G) => {
|
|
1578
|
+
V.has(G) && (J.push(G), V.delete(G));
|
|
1579
1579
|
});
|
|
1580
1580
|
const O = Array.from(V).sort();
|
|
1581
1581
|
N.value = [...J, ...O];
|
|
@@ -1591,7 +1591,7 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1591
1591
|
}
|
|
1592
1592
|
async function Le() {
|
|
1593
1593
|
var e, d;
|
|
1594
|
-
if (
|
|
1594
|
+
if (w.value)
|
|
1595
1595
|
return;
|
|
1596
1596
|
if (!(((e = t.draft) == null ? void 0 : e.effectiveAt) ?? (t.draft ? Te((d = t.draft) == null ? void 0 : d._id) : null))) {
|
|
1597
1597
|
I.open({
|
|
@@ -1605,12 +1605,12 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1605
1605
|
t.draft,
|
|
1606
1606
|
() => {
|
|
1607
1607
|
},
|
|
1608
|
-
async (
|
|
1609
|
-
await
|
|
1608
|
+
async (j) => {
|
|
1609
|
+
await q(j);
|
|
1610
1610
|
}
|
|
1611
1611
|
);
|
|
1612
1612
|
}
|
|
1613
|
-
async function
|
|
1613
|
+
async function Me() {
|
|
1614
1614
|
var e, d;
|
|
1615
1615
|
if (!(((e = t.draft) == null ? void 0 : e.effectiveAt) ?? (t.draft ? Te((d = t.draft) == null ? void 0 : d._id) : null))) {
|
|
1616
1616
|
I.open({
|
|
@@ -1624,26 +1624,26 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1624
1624
|
}
|
|
1625
1625
|
const Ge = M(
|
|
1626
1626
|
() => f.value.groupBy(
|
|
1627
|
-
(
|
|
1628
|
-
(
|
|
1627
|
+
(r) => r.id,
|
|
1628
|
+
(r) => r.balance
|
|
1629
1629
|
)
|
|
1630
|
-
),
|
|
1631
|
-
var
|
|
1632
|
-
return (
|
|
1633
|
-
}),
|
|
1634
|
-
var
|
|
1635
|
-
return (
|
|
1630
|
+
), ut = M(() => Q.value.groupBy((r) => r.sku._id)), ln = M(() => {
|
|
1631
|
+
var r;
|
|
1632
|
+
return (r = t.draft) != null && r.adjustmentSnapshot ? new Map(t.draft.adjustmentSnapshot.map((e) => [e.skuId, e.adjustmentsByType])) : /* @__PURE__ */ new Map();
|
|
1633
|
+
}), cn = M(() => {
|
|
1634
|
+
var r;
|
|
1635
|
+
return (r = t.draft) != null && r.opening ? new Map(t.draft.opening.map((e) => [e.skuId, e.balance])) : /* @__PURE__ */ new Map();
|
|
1636
1636
|
});
|
|
1637
|
-
function ye(
|
|
1638
|
-
return
|
|
1637
|
+
function ye(r, e) {
|
|
1638
|
+
return k(
|
|
1639
1639
|
pe.FmTooltip,
|
|
1640
1640
|
{ zIndex: 51, placement: "left", class: "w-full flex justify-end" },
|
|
1641
1641
|
{
|
|
1642
1642
|
default() {
|
|
1643
|
-
return
|
|
1643
|
+
return r;
|
|
1644
1644
|
},
|
|
1645
1645
|
content() {
|
|
1646
|
-
return e ||
|
|
1646
|
+
return e || r;
|
|
1647
1647
|
}
|
|
1648
1648
|
}
|
|
1649
1649
|
);
|
|
@@ -1655,8 +1655,8 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1655
1655
|
header: () => "Name",
|
|
1656
1656
|
size: 350,
|
|
1657
1657
|
cell(e) {
|
|
1658
|
-
const d = e.row.original,
|
|
1659
|
-
|
|
1658
|
+
const d = e.row.original, j = d.adjustedDiffPercentage, D = typeof j == "number" && Math.abs(j) > 10, V = k("div", { class: "flex flex-col gap-4" }, [
|
|
1659
|
+
k(
|
|
1660
1660
|
"div",
|
|
1661
1661
|
{
|
|
1662
1662
|
class: [
|
|
@@ -1666,7 +1666,7 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1666
1666
|
},
|
|
1667
1667
|
d.name
|
|
1668
1668
|
),
|
|
1669
|
-
|
|
1669
|
+
k(
|
|
1670
1670
|
"div",
|
|
1671
1671
|
{
|
|
1672
1672
|
class: [
|
|
@@ -1677,7 +1677,7 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1677
1677
|
d.code
|
|
1678
1678
|
)
|
|
1679
1679
|
]);
|
|
1680
|
-
return
|
|
1680
|
+
return k(
|
|
1681
1681
|
pe.FmTooltip,
|
|
1682
1682
|
{
|
|
1683
1683
|
zIndex: 51
|
|
@@ -1687,7 +1687,7 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1687
1687
|
return D ? "Adjustment difference is more than 10%." : `${d.code} - ${d.name}`;
|
|
1688
1688
|
},
|
|
1689
1689
|
default() {
|
|
1690
|
-
return
|
|
1690
|
+
return k("div", { class: "flex items-center gap-4 justify-start w-full" }, [
|
|
1691
1691
|
V
|
|
1692
1692
|
]);
|
|
1693
1693
|
}
|
|
@@ -1696,15 +1696,15 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1696
1696
|
}
|
|
1697
1697
|
},
|
|
1698
1698
|
// Dynamic custom attribute columns (toggled by user)
|
|
1699
|
-
...
|
|
1699
|
+
...Ct.value.map(
|
|
1700
1700
|
(e) => ({
|
|
1701
1701
|
id: `customAttr_${e}`,
|
|
1702
1702
|
accessorFn: (d) => d.customAttributeValues[e],
|
|
1703
1703
|
header: () => ye(Be(e)),
|
|
1704
1704
|
size: 160,
|
|
1705
1705
|
cell(d) {
|
|
1706
|
-
const
|
|
1707
|
-
return
|
|
1706
|
+
const j = d.row.original.customAttributeValues[e];
|
|
1707
|
+
return j == null ? "N/A" : typeof j == "number" ? k("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(j)) : k("div", { class: "text-right fm-typo-en-body-lg-400" }, String(j));
|
|
1708
1708
|
},
|
|
1709
1709
|
meta: {
|
|
1710
1710
|
textAlign: "right"
|
|
@@ -1718,7 +1718,7 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1718
1718
|
size: 160,
|
|
1719
1719
|
cell(e) {
|
|
1720
1720
|
const d = e.row.original.costPerUnit;
|
|
1721
|
-
return
|
|
1721
|
+
return k("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(d));
|
|
1722
1722
|
},
|
|
1723
1723
|
meta: {
|
|
1724
1724
|
textAlign: "right"
|
|
@@ -1730,22 +1730,22 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1730
1730
|
size: 120,
|
|
1731
1731
|
cell(e) {
|
|
1732
1732
|
var C;
|
|
1733
|
-
const d = e.row.original,
|
|
1734
|
-
if (
|
|
1735
|
-
const J = se.value.find((
|
|
1733
|
+
const d = e.row.original, j = d.costUnit, D = d.baseUnit, V = j ?? D;
|
|
1734
|
+
if (j && j !== D) {
|
|
1735
|
+
const J = se.value.find((G) => G._id === d.id), O = (C = J == null ? void 0 : J.defaultCost) == null ? void 0 : C.measurement;
|
|
1736
1736
|
if (O) {
|
|
1737
|
-
const
|
|
1738
|
-
return
|
|
1739
|
-
|
|
1737
|
+
const G = O.conversion.amount / Math.pow(10, O.conversion.precision);
|
|
1738
|
+
return k("div", { class: "flex flex-col" }, [
|
|
1739
|
+
k(
|
|
1740
1740
|
"span",
|
|
1741
1741
|
{ class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
|
|
1742
1742
|
V
|
|
1743
1743
|
),
|
|
1744
|
-
|
|
1744
|
+
k("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, [
|
|
1745
1745
|
"1 ",
|
|
1746
|
-
|
|
1747
|
-
` = ${
|
|
1748
|
-
|
|
1746
|
+
k("span", { class: "fm-typo-en-body-sm-600" }, j),
|
|
1747
|
+
` = ${G} `,
|
|
1748
|
+
k("span", { class: "fm-typo-en-body-sm-600" }, D)
|
|
1749
1749
|
])
|
|
1750
1750
|
]);
|
|
1751
1751
|
}
|
|
@@ -1760,7 +1760,7 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1760
1760
|
size: 150,
|
|
1761
1761
|
cell(e) {
|
|
1762
1762
|
const d = e.row.original.opening;
|
|
1763
|
-
return
|
|
1763
|
+
return k("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(d));
|
|
1764
1764
|
},
|
|
1765
1765
|
meta: {
|
|
1766
1766
|
textAlign: "right"
|
|
@@ -1774,8 +1774,8 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1774
1774
|
header: () => ye(Be(e)),
|
|
1775
1775
|
size: 150,
|
|
1776
1776
|
cell(d) {
|
|
1777
|
-
const
|
|
1778
|
-
return
|
|
1777
|
+
const j = d.row.original.adjustmentAmounts[e] ?? { amount: 0, precision: 0 };
|
|
1778
|
+
return k("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(j));
|
|
1779
1779
|
},
|
|
1780
1780
|
meta: {
|
|
1781
1781
|
textAlign: "right"
|
|
@@ -1789,7 +1789,7 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1789
1789
|
size: 200,
|
|
1790
1790
|
cell(e) {
|
|
1791
1791
|
const d = e.row.original.systemBalance;
|
|
1792
|
-
return
|
|
1792
|
+
return k("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(d));
|
|
1793
1793
|
},
|
|
1794
1794
|
meta: {
|
|
1795
1795
|
textAlign: "right"
|
|
@@ -1798,40 +1798,40 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1798
1798
|
{
|
|
1799
1799
|
id: "physicalBalance",
|
|
1800
1800
|
accessorFn: (e) => {
|
|
1801
|
-
var
|
|
1802
|
-
const d = (
|
|
1803
|
-
return d ?
|
|
1801
|
+
var j;
|
|
1802
|
+
const d = (j = B.value.find((D) => D.id === e.id)) == null ? void 0 : j.balance;
|
|
1803
|
+
return d ? Hn.toDouble(d) : e.physicalBalance;
|
|
1804
1804
|
},
|
|
1805
1805
|
header: () => ye("Stock Take balance", "The physical balance recorded during stock take."),
|
|
1806
1806
|
cell(e) {
|
|
1807
1807
|
var O;
|
|
1808
|
-
const d = e.row.original,
|
|
1808
|
+
const d = e.row.original, j = te.fromNumber(d.physicalBalance);
|
|
1809
1809
|
let D = !0;
|
|
1810
|
-
const V = (O = B.value.find((
|
|
1810
|
+
const V = (O = B.value.find((G) => G.id === d.id)) == null ? void 0 : O.balance;
|
|
1811
1811
|
let C;
|
|
1812
|
-
V && !te.equals({ a:
|
|
1813
|
-
const J =
|
|
1814
|
-
|
|
1812
|
+
V && !te.equals({ a: j, b: V }) ? (D = !1, C = ne(V)) : C = ne(d.physicalBalance);
|
|
1813
|
+
const J = k("div", { class: "flex flex-col items-end" }, [
|
|
1814
|
+
k(
|
|
1815
1815
|
"span",
|
|
1816
1816
|
{ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
|
|
1817
1817
|
C
|
|
1818
1818
|
),
|
|
1819
|
-
D ? null :
|
|
1819
|
+
D ? null : k(
|
|
1820
1820
|
"span",
|
|
1821
1821
|
{ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
|
|
1822
1822
|
`Draft: ${ne(d.physicalBalance)}`
|
|
1823
1823
|
)
|
|
1824
1824
|
]);
|
|
1825
|
-
return d.breakdown.length ?
|
|
1825
|
+
return d.breakdown.length ? k(
|
|
1826
1826
|
pe.FmPopover,
|
|
1827
1827
|
{
|
|
1828
1828
|
showPopover: le.value === d.id,
|
|
1829
1829
|
placement: "bottom-end",
|
|
1830
1830
|
zIndex: 9999,
|
|
1831
|
-
"onPopover-changed": (
|
|
1831
|
+
"onPopover-changed": (G) => P(d.id, G)
|
|
1832
1832
|
},
|
|
1833
1833
|
{
|
|
1834
|
-
"popover-button": () =>
|
|
1834
|
+
"popover-button": () => k(
|
|
1835
1835
|
"button",
|
|
1836
1836
|
{
|
|
1837
1837
|
type: "button",
|
|
@@ -1839,7 +1839,7 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1839
1839
|
},
|
|
1840
1840
|
[
|
|
1841
1841
|
J,
|
|
1842
|
-
|
|
1842
|
+
k(pe.FmIcon, { name: "info", size: "sm", outline: !0 })
|
|
1843
1843
|
]
|
|
1844
1844
|
),
|
|
1845
1845
|
default: () => F(d)
|
|
@@ -1858,7 +1858,7 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1858
1858
|
size: 200,
|
|
1859
1859
|
cell(e) {
|
|
1860
1860
|
const d = e.row.original.adjustedAmount;
|
|
1861
|
-
return
|
|
1861
|
+
return k("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(d));
|
|
1862
1862
|
},
|
|
1863
1863
|
meta: {
|
|
1864
1864
|
textAlign: "right"
|
|
@@ -1871,7 +1871,7 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1871
1871
|
size: 150,
|
|
1872
1872
|
cell(e) {
|
|
1873
1873
|
const d = e.row.original.varianceInCost;
|
|
1874
|
-
return
|
|
1874
|
+
return k("div", { class: "text-right fm-typo-en-body-lg-400" }, ne(d));
|
|
1875
1875
|
},
|
|
1876
1876
|
meta: {
|
|
1877
1877
|
textAlign: "right"
|
|
@@ -1888,24 +1888,24 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1888
1888
|
cell(e) {
|
|
1889
1889
|
const d = e.row.original.adjustedDiffPercentage;
|
|
1890
1890
|
if (d == null)
|
|
1891
|
-
return
|
|
1891
|
+
return k(
|
|
1892
1892
|
"div",
|
|
1893
1893
|
{ class: "flex items-center gap-4 justify-end fm-typo-en-body-lg-400" },
|
|
1894
|
-
|
|
1894
|
+
Yt
|
|
1895
1895
|
);
|
|
1896
|
-
const
|
|
1896
|
+
const j = ne(d);
|
|
1897
1897
|
if (d === 0)
|
|
1898
|
-
return
|
|
1898
|
+
return k("div", { class: "flex items-center gap-4 justify-end fm-typo-en-body-lg-400" }, [
|
|
1899
1899
|
ne(0)
|
|
1900
1900
|
]);
|
|
1901
1901
|
const D = d > 0;
|
|
1902
|
-
return
|
|
1903
|
-
|
|
1902
|
+
return k("div", { class: "flex items-center gap-4 justify-end fm-typo-en-body-lg-400" }, [
|
|
1903
|
+
k(pe.FmIcon, {
|
|
1904
1904
|
name: D ? "arrow_drop_up" : "arrow_drop_down",
|
|
1905
1905
|
color: D ? "system-success-300" : "system-error-300",
|
|
1906
1906
|
size: "md"
|
|
1907
1907
|
}),
|
|
1908
|
-
|
|
1908
|
+
j
|
|
1909
1909
|
]);
|
|
1910
1910
|
},
|
|
1911
1911
|
meta: {
|
|
@@ -1919,10 +1919,10 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1919
1919
|
size: 180,
|
|
1920
1920
|
cell(e) {
|
|
1921
1921
|
var O;
|
|
1922
|
-
const d = e.row.original,
|
|
1922
|
+
const d = e.row.original, j = d.stockTakeValue, D = se.value.find((G) => G._id === d.id), V = (O = D == null ? void 0 : D.defaultCost) == null ? void 0 : O.measurement, C = d.physicalBalance, J = d.costPerUnit;
|
|
1923
1923
|
if (V) {
|
|
1924
|
-
const
|
|
1925
|
-
return
|
|
1924
|
+
const G = te.toFormatString({ value: V.conversion }), me = `${ne(C, { minPrecision: 2, maxPrecision: 4 })} ${d.baseUnit} ÷ ${G} × ${J} ${o.value}`;
|
|
1925
|
+
return k(
|
|
1926
1926
|
pe.FmTooltip,
|
|
1927
1927
|
{ zIndex: 51 },
|
|
1928
1928
|
{
|
|
@@ -1930,28 +1930,28 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1930
1930
|
return me;
|
|
1931
1931
|
},
|
|
1932
1932
|
default() {
|
|
1933
|
-
return
|
|
1933
|
+
return k(
|
|
1934
1934
|
"div",
|
|
1935
1935
|
{ class: "text-right w-full fm-typo-en-body-lg-400" },
|
|
1936
|
-
ne(
|
|
1936
|
+
ne(j)
|
|
1937
1937
|
);
|
|
1938
1938
|
}
|
|
1939
1939
|
}
|
|
1940
1940
|
);
|
|
1941
1941
|
} else {
|
|
1942
|
-
const
|
|
1943
|
-
return
|
|
1942
|
+
const G = `${ne(C, { minPrecision: 2, maxPrecision: 4 })} ${d.baseUnit} × ${J} ${o.value}`;
|
|
1943
|
+
return k(
|
|
1944
1944
|
pe.FmTooltip,
|
|
1945
1945
|
{ zIndex: 51 },
|
|
1946
1946
|
{
|
|
1947
1947
|
content() {
|
|
1948
|
-
return
|
|
1948
|
+
return G;
|
|
1949
1949
|
},
|
|
1950
1950
|
default() {
|
|
1951
|
-
return
|
|
1951
|
+
return k(
|
|
1952
1952
|
"div",
|
|
1953
1953
|
{ class: "text-right w-full fm-typo-en-body-lg-400" },
|
|
1954
|
-
ne(
|
|
1954
|
+
ne(j)
|
|
1955
1955
|
);
|
|
1956
1956
|
}
|
|
1957
1957
|
}
|
|
@@ -1969,10 +1969,10 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1969
1969
|
size: 180,
|
|
1970
1970
|
cell(e) {
|
|
1971
1971
|
var O;
|
|
1972
|
-
const d = e.row.original,
|
|
1972
|
+
const d = e.row.original, j = d.systemValue, D = se.value.find((G) => G._id === d.id), V = (O = D == null ? void 0 : D.defaultCost) == null ? void 0 : O.measurement, C = d.systemBalance, J = d.costPerUnit;
|
|
1973
1973
|
if (V) {
|
|
1974
|
-
const
|
|
1975
|
-
return
|
|
1974
|
+
const G = te.toFormatString({ value: V.conversion }), me = `${ne(C, { minPrecision: 2, maxPrecision: 4 })} ${d.baseUnit} ÷ ${G} × ${J} ${o.value}`;
|
|
1975
|
+
return k(
|
|
1976
1976
|
pe.FmTooltip,
|
|
1977
1977
|
{ zIndex: 51 },
|
|
1978
1978
|
{
|
|
@@ -1980,28 +1980,28 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
1980
1980
|
return me;
|
|
1981
1981
|
},
|
|
1982
1982
|
default() {
|
|
1983
|
-
return
|
|
1983
|
+
return k(
|
|
1984
1984
|
"div",
|
|
1985
1985
|
{ class: "text-right fm-typo-en-body-lg-400" },
|
|
1986
|
-
ne(
|
|
1986
|
+
ne(j)
|
|
1987
1987
|
);
|
|
1988
1988
|
}
|
|
1989
1989
|
}
|
|
1990
1990
|
);
|
|
1991
1991
|
} else {
|
|
1992
|
-
const
|
|
1993
|
-
return
|
|
1992
|
+
const G = `${ne(C, { minPrecision: 2, maxPrecision: 4 })} ${d.baseUnit} × ${J} ${o.value}`;
|
|
1993
|
+
return k(
|
|
1994
1994
|
pe.FmTooltip,
|
|
1995
1995
|
{ zIndex: 51 },
|
|
1996
1996
|
{
|
|
1997
1997
|
content() {
|
|
1998
|
-
return
|
|
1998
|
+
return G;
|
|
1999
1999
|
},
|
|
2000
2000
|
default() {
|
|
2001
|
-
return
|
|
2001
|
+
return k(
|
|
2002
2002
|
"div",
|
|
2003
2003
|
{ class: "text-right fm-typo-en-body-lg-400" },
|
|
2004
|
-
ne(
|
|
2004
|
+
ne(j)
|
|
2005
2005
|
);
|
|
2006
2006
|
}
|
|
2007
2007
|
}
|
|
@@ -2017,12 +2017,12 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
2017
2017
|
header: () => "Amounts",
|
|
2018
2018
|
enableSorting: !1,
|
|
2019
2019
|
cell(e) {
|
|
2020
|
-
const d = e.row.original,
|
|
2020
|
+
const d = e.row.original, j = (C, J, O = "normal") => k(
|
|
2021
2021
|
pe.FmTooltip,
|
|
2022
2022
|
{ zIndex: 50 },
|
|
2023
2023
|
{
|
|
2024
2024
|
default() {
|
|
2025
|
-
return
|
|
2025
|
+
return k(
|
|
2026
2026
|
"div",
|
|
2027
2027
|
{
|
|
2028
2028
|
class: [
|
|
@@ -2031,8 +2031,8 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
2031
2031
|
]
|
|
2032
2032
|
},
|
|
2033
2033
|
[
|
|
2034
|
-
|
|
2035
|
-
|
|
2034
|
+
k("span", { class: "text-fm-color-typo-primary" }, `${C} `),
|
|
2035
|
+
k(
|
|
2036
2036
|
"span",
|
|
2037
2037
|
{
|
|
2038
2038
|
class: "text-fm-color-typo-secondary",
|
|
@@ -2047,8 +2047,8 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
2047
2047
|
return O === "orphan" ? `${C} ${J} (invalid UOM — not on SKU)` : O === "inactive" ? `${C} ${J} (NetSuite-inactive UOM)` : `${C} ${J}`;
|
|
2048
2048
|
}
|
|
2049
2049
|
}
|
|
2050
|
-
), D = d.measurements.filter((C) => !!C.amount).map((C) =>
|
|
2051
|
-
return
|
|
2050
|
+
), D = d.measurements.filter((C) => !!C.amount).map((C) => j(C.amount, C.abbrev, C.variant)), V = d.baseUnitAmount || !D.length ? [j(d.baseUnitAmount, d.baseUnit), ...D] : D;
|
|
2051
|
+
return k(
|
|
2052
2052
|
"div",
|
|
2053
2053
|
{
|
|
2054
2054
|
class: "flex gap-8 flex-nowrap",
|
|
@@ -2058,42 +2058,42 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
2058
2058
|
);
|
|
2059
2059
|
}
|
|
2060
2060
|
}
|
|
2061
|
-
]),
|
|
2062
|
-
var d,
|
|
2063
|
-
const
|
|
2061
|
+
]), un = M(() => xt.value.map((r) => r.size ?? 0).reduce((r, e) => r + e)), dt = W(""), Qe = M(() => {
|
|
2062
|
+
var d, j;
|
|
2063
|
+
const r = ((j = (d = t.draft) == null ? void 0 : d.negativeStockItems) == null ? void 0 : j.reduce(
|
|
2064
2064
|
(D, V) => (D[V.sku._id] = V, D),
|
|
2065
2065
|
{}
|
|
2066
2066
|
)) ?? {};
|
|
2067
2067
|
return se.value.map((D) => {
|
|
2068
|
-
var
|
|
2069
|
-
const V = (
|
|
2068
|
+
var Bt, Tt, jt, Mt, Ut, Rt, Pt, Vt, Nt, zt, Et;
|
|
2069
|
+
const V = (Bt = ut.value.get(D._id)) == null ? void 0 : Bt[0], C = ((Tt = Ge.value.get(D._id)) == null ? void 0 : Tt[0]) ?? De, J = ((jt = D.defaultCost) == null ? void 0 : jt.costPerUnit) ?? De, O = Number(te.toFormatString({ value: J })), G = ((Ut = (Mt = D.defaultCost) == null ? void 0 : Mt.measurement) == null ? void 0 : Ut.conversion) ?? {
|
|
2070
2070
|
amount: 1,
|
|
2071
2071
|
precision: 0
|
|
2072
2072
|
}, me = Number(
|
|
2073
|
-
te.toFormatString({ value:
|
|
2074
|
-
), Ae =
|
|
2073
|
+
te.toFormatString({ value: G })
|
|
2074
|
+
), Ae = cn.value.get(D._id), ge = Ae ? Number(te.toFormatString({ value: Ae })) : 0, Fe = ln.value.get(D._id), U = {};
|
|
2075
2075
|
if (N.value.forEach((X) => {
|
|
2076
2076
|
const be = U[X] ?? { amount: 0, precision: 0 }, Ie = Fe == null ? void 0 : Fe[X];
|
|
2077
|
-
Ie && (U[X] =
|
|
2077
|
+
Ie && (U[X] = tn(be, Ie));
|
|
2078
2078
|
}), !V) {
|
|
2079
|
-
const X = Number(te.toFormatString({ value: C })), be = 0 - X, Ie = be * O / me,
|
|
2079
|
+
const X = Number(te.toFormatString({ value: C })), be = 0 - X, Ie = be * O / me, nt = 0, Pe = X * O / me;
|
|
2080
2080
|
return {
|
|
2081
2081
|
id: D._id,
|
|
2082
2082
|
code: D.code,
|
|
2083
2083
|
name: D.name,
|
|
2084
|
-
costUnit: ((
|
|
2084
|
+
costUnit: ((Pt = (Rt = D.defaultCost) == null ? void 0 : Rt.measurement) == null ? void 0 : Pt.abbrev) ?? null,
|
|
2085
2085
|
baseUnit: D.unit.abbrev,
|
|
2086
2086
|
baseUnitAmount: 0,
|
|
2087
2087
|
systemBalance: X,
|
|
2088
2088
|
physicalBalance: 0,
|
|
2089
2089
|
adjustedAmount: -X,
|
|
2090
2090
|
adjustedDiffPercentage: -100,
|
|
2091
|
-
isTemplateItem: !
|
|
2091
|
+
isTemplateItem: !r[D._id],
|
|
2092
2092
|
costPerUnit: O,
|
|
2093
2093
|
opening: ge,
|
|
2094
2094
|
varianceQty: be,
|
|
2095
2095
|
varianceInCost: Ie,
|
|
2096
|
-
stockTakeValue:
|
|
2096
|
+
stockTakeValue: nt,
|
|
2097
2097
|
systemValue: Pe,
|
|
2098
2098
|
adjustmentAmounts: U,
|
|
2099
2099
|
customAttributeValues: D.customAttributes ?? {},
|
|
@@ -2101,95 +2101,99 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
2101
2101
|
breakdown: []
|
|
2102
2102
|
};
|
|
2103
2103
|
}
|
|
2104
|
-
const ue =
|
|
2104
|
+
const ue = sn(V), fe = (Nt = (Vt = B.value) == null ? void 0 : Vt.find(
|
|
2105
2105
|
(X) => X.id === D._id
|
|
2106
|
-
)) == null ? void 0 :
|
|
2106
|
+
)) == null ? void 0 : Nt.balance, ke = Xt(
|
|
2107
2107
|
fe ?? ue,
|
|
2108
2108
|
C
|
|
2109
|
-
), Re = C.amount === 0 ? null :
|
|
2109
|
+
), Re = C.amount === 0 ? null : en(ke, {
|
|
2110
2110
|
...C,
|
|
2111
2111
|
amount: Math.abs(C.amount)
|
|
2112
|
-
}),
|
|
2113
|
-
|
|
2112
|
+
}), et = Re ? lt(Re, $e) : null, pt = Number(te.toFormatString({ value: C })), vt = Number(te.toFormatString({ value: ue })), $t = vt - pt, pn = $t * O / me, vn = vt * O / me, yn = pt * O / me, tt = Number(te.toFormatString({ value: V.baseAmount })), Ft = [], yt = [];
|
|
2113
|
+
tt && yt.push({
|
|
2114
2114
|
label: "Base",
|
|
2115
|
-
amount:
|
|
2115
|
+
amount: tt,
|
|
2116
2116
|
abbrev: D.unit.abbrev,
|
|
2117
|
-
subtotal:
|
|
2117
|
+
subtotal: tt,
|
|
2118
2118
|
inactive: !1,
|
|
2119
2119
|
orphan: !1,
|
|
2120
2120
|
counted: !0
|
|
2121
2121
|
});
|
|
2122
|
-
const
|
|
2122
|
+
const gn = new Map(
|
|
2123
2123
|
V.measurementsAmounts.map((X) => [X.measurement.id, X.amount])
|
|
2124
|
-
),
|
|
2125
|
-
const Ve = Number(te.toFormatString({ value: Ie })),
|
|
2126
|
-
if (
|
|
2127
|
-
abbrev: `(${X}) × ${
|
|
2124
|
+
), bn = new Set(D.unit.measurements.map((X) => X.id)), It = (X, be, Ie, nt, Pe) => {
|
|
2125
|
+
const Ve = Number(te.toFormatString({ value: Ie })), Lt = te.toFormatString({ value: be });
|
|
2126
|
+
if (Ft.push({
|
|
2127
|
+
abbrev: `(${X}) × ${Lt}`,
|
|
2128
2128
|
amount: Ve,
|
|
2129
|
-
variant: Pe ? "orphan" :
|
|
2129
|
+
variant: Pe ? "orphan" : nt ? "inactive" : "normal"
|
|
2130
2130
|
}), !Ve) return;
|
|
2131
|
-
const
|
|
2132
|
-
te.toFormatString({ value:
|
|
2131
|
+
const hn = Number(
|
|
2132
|
+
te.toFormatString({ value: lt(Ie, be) })
|
|
2133
2133
|
);
|
|
2134
2134
|
yt.push({
|
|
2135
|
-
label: Pe ? `${Ve} ${X}` : `${Ve} ${X} × ${
|
|
2135
|
+
label: Pe ? `${Ve} ${X}` : `${Ve} ${X} × ${Lt} ${D.unit.abbrev}`,
|
|
2136
2136
|
amount: Ve,
|
|
2137
2137
|
abbrev: X,
|
|
2138
|
-
subtotal:
|
|
2139
|
-
inactive:
|
|
2138
|
+
subtotal: hn,
|
|
2139
|
+
inactive: nt,
|
|
2140
2140
|
orphan: Pe,
|
|
2141
2141
|
counted: !Pe
|
|
2142
2142
|
});
|
|
2143
2143
|
};
|
|
2144
2144
|
for (const X of D.unit.measurements) {
|
|
2145
|
-
const be =
|
|
2146
|
-
be &&
|
|
2145
|
+
const be = gn.get(X.id);
|
|
2146
|
+
be && It(X.abbrev, X.conversion, be, an(X, we.value), !1);
|
|
2147
2147
|
}
|
|
2148
2148
|
for (const X of V.measurementsAmounts)
|
|
2149
|
-
|
|
2149
|
+
bn.has(X.measurement.id) || It(X.measurement.abbrev, X.measurement.conversion, X.amount, !1, !0);
|
|
2150
2150
|
return {
|
|
2151
2151
|
id: D._id,
|
|
2152
2152
|
code: D.code,
|
|
2153
2153
|
name: D.name,
|
|
2154
|
-
costUnit: ((
|
|
2154
|
+
costUnit: ((Et = (zt = D.defaultCost) == null ? void 0 : zt.measurement) == null ? void 0 : Et.abbrev) ?? null,
|
|
2155
2155
|
baseUnit: D.unit.abbrev,
|
|
2156
|
-
baseUnitAmount:
|
|
2157
|
-
measurements:
|
|
2156
|
+
baseUnitAmount: tt,
|
|
2157
|
+
measurements: Ft,
|
|
2158
2158
|
breakdown: yt,
|
|
2159
2159
|
systemBalance: pt,
|
|
2160
2160
|
physicalBalance: vt,
|
|
2161
2161
|
adjustedAmount: Number(te.toFormatString({ value: ke })),
|
|
2162
|
-
adjustedDiffPercentage:
|
|
2162
|
+
adjustedDiffPercentage: et ? Number(
|
|
2163
2163
|
te.toFormatString({
|
|
2164
|
-
value:
|
|
2164
|
+
value: nn(et, 2)
|
|
2165
2165
|
})
|
|
2166
2166
|
) : null,
|
|
2167
|
-
isTemplateItem: !
|
|
2167
|
+
isTemplateItem: !r[D._id],
|
|
2168
2168
|
costPerUnit: O,
|
|
2169
2169
|
opening: ge,
|
|
2170
|
-
varianceQty:
|
|
2171
|
-
varianceInCost:
|
|
2172
|
-
stockTakeValue:
|
|
2173
|
-
systemValue:
|
|
2170
|
+
varianceQty: $t,
|
|
2171
|
+
varianceInCost: pn,
|
|
2172
|
+
stockTakeValue: vn,
|
|
2173
|
+
systemValue: yn,
|
|
2174
2174
|
adjustmentAmounts: U,
|
|
2175
2175
|
customAttributeValues: D.customAttributes ?? {}
|
|
2176
2176
|
};
|
|
2177
2177
|
}).filter((D) => !!(D.isTemplateItem && z.value.templateItem || !D.isTemplateItem && z.value.nonTemplateItem));
|
|
2178
|
-
}),
|
|
2179
|
-
() =>
|
|
2178
|
+
}), Dt = M(
|
|
2179
|
+
() => Qe.value.some((r) => r.measurements.some((e) => e.variant === "inactive"))
|
|
2180
|
+
), At = M(
|
|
2181
|
+
() => Qe.value.some((r) => r.measurements.some((e) => e.variant === "orphan"))
|
|
2182
|
+
), dn = M(
|
|
2183
|
+
() => Dt.value || At.value
|
|
2180
2184
|
), mt = M(() => {
|
|
2181
|
-
const
|
|
2185
|
+
const r = /* @__PURE__ */ new Set();
|
|
2182
2186
|
for (const e of se.value)
|
|
2183
2187
|
if (e.customAttributes)
|
|
2184
2188
|
for (const d of Object.keys(e.customAttributes))
|
|
2185
|
-
d !== "tag" &&
|
|
2186
|
-
return Array.from(
|
|
2187
|
-
}),
|
|
2188
|
-
() => mt.value.filter((
|
|
2189
|
-
),
|
|
2190
|
-
var e, d,
|
|
2189
|
+
d !== "tag" && r.add(d);
|
|
2190
|
+
return Array.from(r).sort();
|
|
2191
|
+
}), Ze = Ot({}), Ct = M(
|
|
2192
|
+
() => mt.value.filter((r) => Ze[r])
|
|
2193
|
+
), mn = M(() => {
|
|
2194
|
+
var e, d, j, D, V;
|
|
2191
2195
|
if (!t.draft) return [];
|
|
2192
|
-
const
|
|
2196
|
+
const r = t.draft.approvedAt ? {
|
|
2193
2197
|
action: `Approve at ${Ce(t.draft.approvedAt)}`,
|
|
2194
2198
|
// actionAt: props.draft.approvedAt,
|
|
2195
2199
|
actionBy: t.draft.approvedBy,
|
|
@@ -2207,7 +2211,7 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
2207
2211
|
} : null,
|
|
2208
2212
|
{
|
|
2209
2213
|
label: "Location",
|
|
2210
|
-
value: ((d = R._currentLocation) == null ? void 0 : d.name) ??
|
|
2214
|
+
value: ((d = R._currentLocation) == null ? void 0 : d.name) ?? Yt
|
|
2211
2215
|
},
|
|
2212
2216
|
{
|
|
2213
2217
|
label: "Created at",
|
|
@@ -2227,7 +2231,7 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
2227
2231
|
},
|
|
2228
2232
|
{
|
|
2229
2233
|
label: "Effective at",
|
|
2230
|
-
value: Ce(t.draft.effectiveAt ?? Te((
|
|
2234
|
+
value: Ce(t.draft.effectiveAt ?? Te((j = t.draft) == null ? void 0 : j._id))
|
|
2231
2235
|
},
|
|
2232
2236
|
{
|
|
2233
2237
|
label: "Using template",
|
|
@@ -2237,17 +2241,17 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
2237
2241
|
label: "Remark",
|
|
2238
2242
|
value: t.draft.remark
|
|
2239
2243
|
} : null,
|
|
2240
|
-
|
|
2244
|
+
r ? {
|
|
2241
2245
|
label: "Last action",
|
|
2242
|
-
value:
|
|
2246
|
+
value: r.action
|
|
2243
2247
|
} : null,
|
|
2244
|
-
|
|
2248
|
+
r && r.actionBy ? {
|
|
2245
2249
|
label: "Last action by",
|
|
2246
|
-
value: (V =
|
|
2250
|
+
value: (V = r.actionBy) == null ? void 0 : V.name
|
|
2247
2251
|
} : null,
|
|
2248
|
-
|
|
2252
|
+
r && r.remark ? {
|
|
2249
2253
|
label: "Action remark",
|
|
2250
|
-
value:
|
|
2254
|
+
value: r.remark
|
|
2251
2255
|
} : null
|
|
2252
2256
|
].filter((C) => C).map((C) => C);
|
|
2253
2257
|
}), ft = [
|
|
@@ -2259,29 +2263,29 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
2259
2263
|
label: "Action history",
|
|
2260
2264
|
value: "history"
|
|
2261
2265
|
}
|
|
2262
|
-
], Oe =
|
|
2263
|
-
var
|
|
2264
|
-
const
|
|
2266
|
+
], Oe = W(ft[0]), Ue = M(() => {
|
|
2267
|
+
var j, D, V;
|
|
2268
|
+
const r = ((j = t.draft) == null ? void 0 : j.activityLogs) ?? [], e = ((D = t.draft) == null ? void 0 : D.rejectionHistory) ?? [];
|
|
2265
2269
|
for (const C of e)
|
|
2266
|
-
|
|
2270
|
+
r.find(
|
|
2267
2271
|
(O) => `${O.action}_${O.performedAt}` == `${oe.enum.rejectDraft}_${C.rejectedAt}`
|
|
2268
|
-
) ||
|
|
2272
|
+
) || r.push({
|
|
2269
2273
|
action: oe.enum.rejectDraft,
|
|
2270
2274
|
performedAt: C.rejectedAt,
|
|
2271
2275
|
performedBy: C.rejectedBy,
|
|
2272
2276
|
remark: C.rejectRemark
|
|
2273
2277
|
});
|
|
2274
|
-
return (V = t.draft) != null && V.approvedAt && (
|
|
2278
|
+
return (V = t.draft) != null && V.approvedAt && (r.find(
|
|
2275
2279
|
(J) => {
|
|
2276
2280
|
var O;
|
|
2277
2281
|
return `${J.action}_${J.performedAt}` == `${oe.enum.approveDraft}_${(O = t.draft) == null ? void 0 : O.approvedAt}`;
|
|
2278
2282
|
}
|
|
2279
|
-
) ||
|
|
2283
|
+
) || r.push({
|
|
2280
2284
|
action: oe.enum.approveDraft,
|
|
2281
2285
|
performedAt: t.draft.approvedAt,
|
|
2282
2286
|
performedBy: t.draft.approvedBy ?? { name: "Unknown", id: "unknown" },
|
|
2283
2287
|
remark: t.draft.approveRemark
|
|
2284
|
-
})),
|
|
2288
|
+
})), r.sort((C, J) => new Date(J.performedAt).getTime() - new Date(C.performedAt).getTime()).map(
|
|
2285
2289
|
(C) => ({
|
|
2286
2290
|
header: Be(C.action),
|
|
2287
2291
|
date: Ce(C.performedAt),
|
|
@@ -2297,24 +2301,24 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
2297
2301
|
]
|
|
2298
2302
|
})
|
|
2299
2303
|
);
|
|
2300
|
-
}),
|
|
2301
|
-
var
|
|
2302
|
-
return ((
|
|
2304
|
+
}), Je = W(!1), Xe = W(!1), St = M(() => {
|
|
2305
|
+
var r;
|
|
2306
|
+
return ((r = t.draft) == null ? void 0 : r.status) !== _e.enum.DRAFT ? "Status is not draft." : null;
|
|
2303
2307
|
});
|
|
2304
|
-
function
|
|
2305
|
-
t.draft && (
|
|
2308
|
+
function fn() {
|
|
2309
|
+
t.draft && (Xe.value = !0, s.approveDraft(
|
|
2306
2310
|
t.draft,
|
|
2307
2311
|
() => {
|
|
2308
|
-
|
|
2312
|
+
Xe.value = !1, Je.value = !1, m("submitted");
|
|
2309
2313
|
},
|
|
2310
2314
|
() => {
|
|
2311
|
-
|
|
2315
|
+
Xe.value = !1;
|
|
2312
2316
|
}
|
|
2313
2317
|
));
|
|
2314
2318
|
}
|
|
2315
|
-
return (
|
|
2316
|
-
const d = Z("FmButtonGroup"),
|
|
2317
|
-
return
|
|
2319
|
+
return (r, e) => {
|
|
2320
|
+
const d = Z("FmButtonGroup"), j = Z("FmMenuDivider"), D = Z("FmCard"), V = Z("FmIcon"), C = Z("FmButton"), J = Z("FmCircularProgress"), O = Z("FmChip"), G = Z("FmTextField"), me = Z("FmTable"), Ae = Z("FmSpacer"), ge = Z("FmTooltip"), Fe = Z("FmSideSheet");
|
|
2321
|
+
return h(), T(ce, null, [
|
|
2318
2322
|
$(Fe, {
|
|
2319
2323
|
"dismiss-away": "",
|
|
2320
2324
|
"max-width": 9999,
|
|
@@ -2325,16 +2329,16 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
2325
2329
|
"side-sheet-footer": ee(() => {
|
|
2326
2330
|
var U, ue, fe, ke;
|
|
2327
2331
|
return [
|
|
2328
|
-
a("div",
|
|
2329
|
-
a("div",
|
|
2330
|
-
((U = t.draft) == null ? void 0 : U.status) === u(_e).enum.DRAFT ? (
|
|
2331
|
-
|
|
2332
|
+
a("div", ko, [
|
|
2333
|
+
a("div", _o, [
|
|
2334
|
+
((U = t.draft) == null ? void 0 : U.status) === u(_e).enum.DRAFT ? (h(), T(ce, { key: 0 }, [
|
|
2335
|
+
St.value ? (h(), ae(ge, {
|
|
2332
2336
|
key: 0,
|
|
2333
2337
|
"z-index": 51,
|
|
2334
2338
|
placement: "right"
|
|
2335
2339
|
}, {
|
|
2336
2340
|
content: ee(() => [
|
|
2337
|
-
de(H(
|
|
2341
|
+
de(H(St.value), 1)
|
|
2338
2342
|
]),
|
|
2339
2343
|
default: ee(() => [
|
|
2340
2344
|
$(C, {
|
|
@@ -2344,24 +2348,24 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
2344
2348
|
})
|
|
2345
2349
|
]),
|
|
2346
2350
|
_: 1
|
|
2347
|
-
})) : (
|
|
2351
|
+
})) : (h(), ae(C, {
|
|
2348
2352
|
key: "approve key",
|
|
2349
2353
|
label: "Approve",
|
|
2350
|
-
onClick: e[5] || (e[5] = (Re) =>
|
|
2354
|
+
onClick: e[5] || (e[5] = (Re) => Je.value = !0)
|
|
2351
2355
|
}))
|
|
2352
|
-
], 64)) :
|
|
2353
|
-
((ue = t.draft) == null ? void 0 : ue.status) === u(_e).enum.DRAFT ? (
|
|
2356
|
+
], 64)) : K("", !0),
|
|
2357
|
+
((ue = t.draft) == null ? void 0 : ue.status) === u(_e).enum.DRAFT ? (h(), ae(C, {
|
|
2354
2358
|
key: 1,
|
|
2355
2359
|
label: "Reject",
|
|
2356
2360
|
variant: "destructive",
|
|
2357
2361
|
onClick: e[6] || (e[6] = () => t.draft && u(s).rejectDraft(t.draft, () => m("submitted")))
|
|
2358
|
-
})) :
|
|
2362
|
+
})) : K("", !0),
|
|
2359
2363
|
$(C, {
|
|
2360
2364
|
label: "Close",
|
|
2361
2365
|
variant: "tertiary",
|
|
2362
2366
|
onClick: e[7] || (e[7] = (Re) => c.value = !1)
|
|
2363
2367
|
}),
|
|
2364
|
-
(fe = t.draft) != null && fe.approvedAt && ((ke = t.draft) == null ? void 0 : ke.status) !== u(_e).enum.COMPLETED ? (
|
|
2368
|
+
(fe = t.draft) != null && fe.approvedAt && ((ke = t.draft) == null ? void 0 : ke.status) !== u(_e).enum.COMPLETED ? (h(), ae(gt, { key: 2 }, {
|
|
2365
2369
|
default: ee(() => [
|
|
2366
2370
|
$(C, {
|
|
2367
2371
|
label: "Sync",
|
|
@@ -2374,17 +2378,17 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
2374
2378
|
}, null, 8, ["loading"])
|
|
2375
2379
|
]),
|
|
2376
2380
|
_: 1
|
|
2377
|
-
})) :
|
|
2381
|
+
})) : K("", !0)
|
|
2378
2382
|
]),
|
|
2379
|
-
a("div",
|
|
2380
|
-
e[
|
|
2381
|
-
a("div",
|
|
2383
|
+
a("div", wo, [
|
|
2384
|
+
e[23] || (e[23] = a("div", { class: "text-xs text-gray-500 uppercase tracking-wide" }, "Total stock take value", -1)),
|
|
2385
|
+
a("div", xo, H(o.value) + " " + H(xe.value.toFixed(2)), 1)
|
|
2382
2386
|
])
|
|
2383
2387
|
])
|
|
2384
2388
|
];
|
|
2385
2389
|
}),
|
|
2386
2390
|
default: ee(() => [
|
|
2387
|
-
a("div",
|
|
2391
|
+
a("div", Ta, [
|
|
2388
2392
|
a("div", null, [
|
|
2389
2393
|
$(d, {
|
|
2390
2394
|
items: ft,
|
|
@@ -2392,16 +2396,16 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
2392
2396
|
"onUpdate:modelValue": e[0] || (e[0] = (U) => Oe.value = U)
|
|
2393
2397
|
}, null, 8, ["modelValue"])
|
|
2394
2398
|
]),
|
|
2395
|
-
Oe.value.value === "overview" ? (
|
|
2399
|
+
Oe.value.value === "overview" ? (h(), T(ce, { key: 0 }, [
|
|
2396
2400
|
$(gt, { selectable: "" }, {
|
|
2397
2401
|
default: ee(() => {
|
|
2398
2402
|
var U;
|
|
2399
2403
|
return [
|
|
2400
|
-
a("div",
|
|
2404
|
+
a("div", ja, [
|
|
2401
2405
|
e[11] || (e[11] = a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, [
|
|
2402
2406
|
a("div", { class: "flex gap-1" }, "Draft ID")
|
|
2403
2407
|
], -1)),
|
|
2404
|
-
de(" " + H((U =
|
|
2408
|
+
de(" " + H((U = r.draft) == null ? void 0 : U._id), 1)
|
|
2405
2409
|
])
|
|
2406
2410
|
];
|
|
2407
2411
|
}),
|
|
@@ -2414,49 +2418,52 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
2414
2418
|
default: ee(() => {
|
|
2415
2419
|
var U, ue;
|
|
2416
2420
|
return [
|
|
2417
|
-
a("div",
|
|
2421
|
+
a("div", Ma, [
|
|
2418
2422
|
e[12] || (e[12] = a("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
|
|
2419
|
-
a("div",
|
|
2423
|
+
a("div", Ua, [
|
|
2420
2424
|
a("div", {
|
|
2421
|
-
class: Se(["fm-status-badge", u(
|
|
2422
|
-
}, H(u(Be)(((ue =
|
|
2425
|
+
class: Se(["fm-status-badge", u(st)(((U = r.draft) == null ? void 0 : U.status) ?? "DRAFT")])
|
|
2426
|
+
}, H(u(Be)(((ue = r.draft) == null ? void 0 : ue.status) ?? "")), 3)
|
|
2423
2427
|
])
|
|
2424
2428
|
]),
|
|
2425
|
-
$(
|
|
2426
|
-
a("div",
|
|
2427
|
-
(
|
|
2429
|
+
$(j),
|
|
2430
|
+
a("div", Ra, [
|
|
2431
|
+
(h(!0), T(ce, null, he(mn.value, (fe, ke) => (h(), T("div", {
|
|
2428
2432
|
class: "flex flex-col gap-4",
|
|
2429
2433
|
key: ke
|
|
2430
2434
|
}, [
|
|
2431
|
-
a("div",
|
|
2432
|
-
a("div",
|
|
2435
|
+
a("div", Pa, [
|
|
2436
|
+
a("div", Va, H(fe.label), 1)
|
|
2433
2437
|
]),
|
|
2434
|
-
a("div",
|
|
2438
|
+
a("div", Na, H(fe.value), 1)
|
|
2435
2439
|
]))), 128))
|
|
2436
2440
|
])
|
|
2437
2441
|
];
|
|
2438
2442
|
}),
|
|
2439
2443
|
_: 1
|
|
2440
2444
|
}),
|
|
2441
|
-
|
|
2445
|
+
dn.value ? (h(), T("div", za, [
|
|
2442
2446
|
$(V, {
|
|
2443
2447
|
name: "rule",
|
|
2444
2448
|
size: "sm"
|
|
2445
2449
|
}),
|
|
2446
|
-
|
|
2447
|
-
a("div", { class: "fm-typo-en-body-md-600" }, "UOM notes"),
|
|
2448
|
-
a("
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2450
|
+
a("div", Ea, [
|
|
2451
|
+
e[14] || (e[14] = a("div", { class: "fm-typo-en-body-md-600" }, "UOM notes", -1)),
|
|
2452
|
+
a("ul", La, [
|
|
2453
|
+
Dt.value ? (h(), T("li", Oa, e[13] || (e[13] = [
|
|
2454
|
+
de(" Measurements highlighted in "),
|
|
2455
|
+
a("span", { class: "font-bold" }, "purple", -1),
|
|
2456
|
+
de(" are NetSuite-inactive UOMs (surfaced for audit; their amounts are part of the base total). ")
|
|
2457
|
+
]))) : K("", !0),
|
|
2458
|
+
At.value ? (h(), T("li", Ha, " Red highlights are UOMs not on the SKU (ignored). ")) : K("", !0)
|
|
2452
2459
|
])
|
|
2453
|
-
]
|
|
2454
|
-
])) :
|
|
2455
|
-
a("div",
|
|
2456
|
-
a("div",
|
|
2457
|
-
e[
|
|
2458
|
-
x.value ?
|
|
2459
|
-
|
|
2460
|
+
])
|
|
2461
|
+
])) : K("", !0),
|
|
2462
|
+
a("div", Ya, [
|
|
2463
|
+
a("div", Ka, [
|
|
2464
|
+
e[15] || (e[15] = a("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
|
|
2465
|
+
x.value ? K("", !0) : (h(), T("div", Wa, [
|
|
2466
|
+
r.draft && r.draft.status !== u(_e).enum.COMPLETED ? (h(), ae(C, {
|
|
2460
2467
|
key: 0,
|
|
2461
2468
|
label: "Refresh balance",
|
|
2462
2469
|
"prepend-icon": "refresh",
|
|
@@ -2464,10 +2471,10 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
2464
2471
|
"text-color": "primary",
|
|
2465
2472
|
"bg-color": "transparent",
|
|
2466
2473
|
"border-color": "primary",
|
|
2467
|
-
loading: u(
|
|
2468
|
-
disabled: u(
|
|
2474
|
+
loading: u(w),
|
|
2475
|
+
disabled: u(w),
|
|
2469
2476
|
onClick: Le
|
|
2470
|
-
}, null, 8, ["loading", "disabled"])) :
|
|
2477
|
+
}, null, 8, ["loading", "disabled"])) : K("", !0),
|
|
2471
2478
|
$(gt, null, {
|
|
2472
2479
|
default: ee(() => [
|
|
2473
2480
|
$(C, {
|
|
@@ -2477,8 +2484,8 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
2477
2484
|
"text-color": "primary",
|
|
2478
2485
|
"bg-color": "transparent",
|
|
2479
2486
|
"border-color": "primary",
|
|
2480
|
-
loading: u(
|
|
2481
|
-
onClick:
|
|
2487
|
+
loading: u(w),
|
|
2488
|
+
onClick: Me
|
|
2482
2489
|
}, null, 8, ["loading"])
|
|
2483
2490
|
]),
|
|
2484
2491
|
_: 1
|
|
@@ -2490,27 +2497,27 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
2490
2497
|
"text-color": "primary",
|
|
2491
2498
|
"bg-color": "transparent",
|
|
2492
2499
|
"border-color": "primary",
|
|
2493
|
-
onClick: e[1] || (e[1] = (U) =>
|
|
2494
|
-
|
|
2500
|
+
onClick: e[1] || (e[1] = (U) => r.draft ? u(s).exportDraft(
|
|
2501
|
+
r.draft,
|
|
2495
2502
|
f.value,
|
|
2496
2503
|
B.value,
|
|
2497
|
-
|
|
2504
|
+
Ct.value
|
|
2498
2505
|
) : null)
|
|
2499
2506
|
})
|
|
2500
2507
|
]))
|
|
2501
2508
|
]),
|
|
2502
|
-
x.value ? (
|
|
2503
|
-
e[
|
|
2504
|
-
a("div",
|
|
2509
|
+
x.value ? (h(), T("div", qa, [
|
|
2510
|
+
e[17] || (e[17] = a("div", { class: "h-80" }, null, -1)),
|
|
2511
|
+
a("div", Ga, [
|
|
2505
2512
|
a("div", null, [
|
|
2506
2513
|
$(J, { size: "md" })
|
|
2507
2514
|
]),
|
|
2508
|
-
e[
|
|
2515
|
+
e[16] || (e[16] = a("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
|
|
2509
2516
|
]),
|
|
2510
|
-
e[
|
|
2511
|
-
])) : (
|
|
2512
|
-
a("div",
|
|
2513
|
-
a("div",
|
|
2517
|
+
e[18] || (e[18] = a("div", { class: "h-80" }, null, -1))
|
|
2518
|
+
])) : (h(), T(ce, { key: 1 }, [
|
|
2519
|
+
a("div", Qa, [
|
|
2520
|
+
a("div", Za, [
|
|
2514
2521
|
$(O, {
|
|
2515
2522
|
label: "Template Item(s)",
|
|
2516
2523
|
selected: z.value.templateItem,
|
|
@@ -2522,14 +2529,14 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
2522
2529
|
onClick: e[3] || (e[3] = (U) => z.value.nonTemplateItem = !z.value.nonTemplateItem)
|
|
2523
2530
|
}, null, 8, ["selected"])
|
|
2524
2531
|
]),
|
|
2525
|
-
$(
|
|
2526
|
-
modelValue:
|
|
2527
|
-
"onUpdate:modelValue": e[4] || (e[4] = (U) =>
|
|
2532
|
+
$(G, {
|
|
2533
|
+
modelValue: dt.value,
|
|
2534
|
+
"onUpdate:modelValue": e[4] || (e[4] = (U) => dt.value = U),
|
|
2528
2535
|
placeholder: "Filter items"
|
|
2529
2536
|
}, null, 8, ["modelValue"])
|
|
2530
2537
|
]),
|
|
2531
|
-
u(
|
|
2532
|
-
(
|
|
2538
|
+
u(_).skuTags.size ? (h(), T("div", Ja, [
|
|
2539
|
+
(h(!0), T(ce, null, he(u(_).skuTags.keys(), (U) => (h(), ae(O, {
|
|
2533
2540
|
key: `${U}`,
|
|
2534
2541
|
label: `${U}`,
|
|
2535
2542
|
selectable: "",
|
|
@@ -2537,12 +2544,12 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
2537
2544
|
onClick: (ue) => p[`${U}`] = !p[`${U}`]
|
|
2538
2545
|
}, {
|
|
2539
2546
|
default: ee(() => [
|
|
2540
|
-
p[`${U}`] ? (
|
|
2547
|
+
p[`${U}`] ? (h(), ae(V, {
|
|
2541
2548
|
key: 0,
|
|
2542
2549
|
name: "check",
|
|
2543
2550
|
class: "text-white",
|
|
2544
2551
|
size: "sm"
|
|
2545
|
-
})) :
|
|
2552
|
+
})) : K("", !0),
|
|
2546
2553
|
a("span", {
|
|
2547
2554
|
class: Se([
|
|
2548
2555
|
"",
|
|
@@ -2555,37 +2562,37 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
2555
2562
|
]),
|
|
2556
2563
|
_: 2
|
|
2557
2564
|
}, 1032, ["label", "selected", "onClick"]))), 128))
|
|
2558
|
-
])) :
|
|
2559
|
-
mt.value.length ? (
|
|
2560
|
-
e[
|
|
2561
|
-
(
|
|
2565
|
+
])) : K("", !0),
|
|
2566
|
+
mt.value.length ? (h(), T("div", Xa, [
|
|
2567
|
+
e[19] || (e[19] = a("span", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary self-center" }, "Extra columns:", -1)),
|
|
2568
|
+
(h(!0), T(ce, null, he(mt.value, (U) => (h(), ae(O, {
|
|
2562
2569
|
key: U,
|
|
2563
2570
|
label: U,
|
|
2564
2571
|
selectable: "",
|
|
2565
|
-
selected:
|
|
2566
|
-
onClick: (ue) =>
|
|
2572
|
+
selected: Ze[U],
|
|
2573
|
+
onClick: (ue) => Ze[U] = !Ze[U]
|
|
2567
2574
|
}, null, 8, ["label", "selected", "onClick"]))), 128))
|
|
2568
|
-
])) :
|
|
2569
|
-
a("div",
|
|
2575
|
+
])) : K("", !0),
|
|
2576
|
+
a("div", eo, [
|
|
2570
2577
|
a("div", {
|
|
2571
|
-
style:
|
|
2578
|
+
style: Kt({ height: "600px", minWidth: `${un.value}px` })
|
|
2572
2579
|
}, [
|
|
2573
2580
|
$(me, {
|
|
2574
2581
|
"column-defs": xt.value,
|
|
2575
|
-
"row-data":
|
|
2576
|
-
"search-value":
|
|
2582
|
+
"row-data": Qe.value,
|
|
2583
|
+
"search-value": dt.value
|
|
2577
2584
|
}, null, 8, ["column-defs", "row-data", "search-value"])
|
|
2578
2585
|
], 4)
|
|
2579
2586
|
])
|
|
2580
2587
|
], 64))
|
|
2581
2588
|
])
|
|
2582
|
-
], 64)) :
|
|
2583
|
-
Oe.value.value === "history" ? (
|
|
2584
|
-
|
|
2585
|
-
(
|
|
2586
|
-
a("div",
|
|
2587
|
-
a("div",
|
|
2588
|
-
a("div",
|
|
2589
|
+
], 64)) : K("", !0),
|
|
2590
|
+
Oe.value.value === "history" ? (h(), T("div", to, [
|
|
2591
|
+
Ue.value.length ? (h(), T("div", oo, [
|
|
2592
|
+
(h(!0), T(ce, null, he(Ue.value, (U, ue) => (h(), T(ce, { key: ue }, [
|
|
2593
|
+
a("div", so, [
|
|
2594
|
+
a("div", ro, [
|
|
2595
|
+
a("div", lo, [
|
|
2589
2596
|
a("div", {
|
|
2590
2597
|
class: Se([
|
|
2591
2598
|
{
|
|
@@ -2596,53 +2603,53 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
2596
2603
|
])
|
|
2597
2604
|
}, null, 2)
|
|
2598
2605
|
]),
|
|
2599
|
-
e[
|
|
2600
|
-
a("div",
|
|
2606
|
+
e[22] || (e[22] = a("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
|
|
2607
|
+
a("div", io, [
|
|
2601
2608
|
a("div", {
|
|
2602
2609
|
class: Se([
|
|
2603
2610
|
{
|
|
2604
|
-
"bg-fm-color-primary": ue <
|
|
2605
|
-
"bg-white": ue >=
|
|
2611
|
+
"bg-fm-color-primary": ue < Ue.value.length - 1,
|
|
2612
|
+
"bg-white": ue >= Ue.value.length - 1
|
|
2606
2613
|
},
|
|
2607
2614
|
"w-[2px] h-full"
|
|
2608
2615
|
])
|
|
2609
2616
|
}, null, 2)
|
|
2610
2617
|
])
|
|
2611
2618
|
]),
|
|
2612
|
-
a("div",
|
|
2613
|
-
a("div",
|
|
2614
|
-
a("div",
|
|
2619
|
+
a("div", co, [
|
|
2620
|
+
a("div", uo, H(U.header), 1),
|
|
2621
|
+
a("div", mo, H(U.date), 1)
|
|
2615
2622
|
])
|
|
2616
2623
|
]),
|
|
2617
|
-
a("div",
|
|
2618
|
-
a("div",
|
|
2619
|
-
a("div",
|
|
2624
|
+
a("div", fo, [
|
|
2625
|
+
a("div", po, [
|
|
2626
|
+
a("div", vo, [
|
|
2620
2627
|
a("div", {
|
|
2621
2628
|
class: Se([
|
|
2622
2629
|
{
|
|
2623
|
-
"bg-fm-color-primary": ue <
|
|
2624
|
-
"bg-white": ue >=
|
|
2630
|
+
"bg-fm-color-primary": ue < Ue.value.length - 1,
|
|
2631
|
+
"bg-white": ue >= Ue.value.length - 1
|
|
2625
2632
|
},
|
|
2626
2633
|
"w-[2px] h-full"
|
|
2627
2634
|
])
|
|
2628
2635
|
}, null, 2)
|
|
2629
2636
|
])
|
|
2630
2637
|
]),
|
|
2631
|
-
a("div",
|
|
2638
|
+
a("div", yo, [
|
|
2632
2639
|
$(D, {
|
|
2633
2640
|
variant: "outlined",
|
|
2634
2641
|
class: "py-12 px-16"
|
|
2635
2642
|
}, {
|
|
2636
2643
|
default: ee(() => [
|
|
2637
|
-
a("div",
|
|
2638
|
-
(
|
|
2644
|
+
a("div", go, [
|
|
2645
|
+
(h(!0), T(ce, null, he(U.info, (fe, ke) => (h(), T("div", {
|
|
2639
2646
|
key: ke,
|
|
2640
2647
|
class: "flex flex-col gap-4"
|
|
2641
2648
|
}, [
|
|
2642
|
-
a("div",
|
|
2643
|
-
a("div",
|
|
2644
|
-
(
|
|
2645
|
-
key:
|
|
2649
|
+
a("div", bo, H(fe == null ? void 0 : fe.label), 1),
|
|
2650
|
+
a("div", ho, [
|
|
2651
|
+
(h(!0), T(ce, null, he(fe == null ? void 0 : fe.values, (Re, et) => (h(), T("div", {
|
|
2652
|
+
key: et,
|
|
2646
2653
|
class: "fm-typo-en-body-lg-600"
|
|
2647
2654
|
}, H(Re), 1))), 128))
|
|
2648
2655
|
])
|
|
@@ -2654,85 +2661,85 @@ const Ia = { class: "w-full flex flex-col gap-32" }, Ba = { class: "flex flex-co
|
|
|
2654
2661
|
])
|
|
2655
2662
|
])
|
|
2656
2663
|
], 64))), 128))
|
|
2657
|
-
])) : (
|
|
2664
|
+
])) : (h(), T("div", no, [
|
|
2658
2665
|
$(Ae),
|
|
2659
2666
|
a("div", null, [
|
|
2660
2667
|
a("img", {
|
|
2661
|
-
src: u(
|
|
2668
|
+
src: u(Ln),
|
|
2662
2669
|
alt: "List is empty"
|
|
2663
|
-
}, null, 8,
|
|
2670
|
+
}, null, 8, ao)
|
|
2664
2671
|
]),
|
|
2665
|
-
e[
|
|
2666
|
-
e[
|
|
2672
|
+
e[20] || (e[20] = a("div", { class: "fm-typo-en-body-lg-600" }, H("No records found"), -1)),
|
|
2673
|
+
e[21] || (e[21] = a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, H("You can track approval and rejection history here"), -1)),
|
|
2667
2674
|
$(Ae),
|
|
2668
2675
|
$(Ae)
|
|
2669
2676
|
]))
|
|
2670
|
-
])) :
|
|
2677
|
+
])) : K("", !0)
|
|
2671
2678
|
])
|
|
2672
2679
|
]),
|
|
2673
2680
|
_: 1
|
|
2674
2681
|
}, 8, ["model-value"]),
|
|
2675
|
-
u(c) && t.draft ? (
|
|
2682
|
+
u(c) && t.draft ? (h(), ae(Ia, {
|
|
2676
2683
|
key: 0,
|
|
2677
|
-
show:
|
|
2678
|
-
"onUpdate:show": e[10] || (e[10] = (U) =>
|
|
2679
|
-
refreshing: u(
|
|
2680
|
-
approving:
|
|
2684
|
+
show: Je.value,
|
|
2685
|
+
"onUpdate:show": e[10] || (e[10] = (U) => Je.value = U),
|
|
2686
|
+
refreshing: u(w),
|
|
2687
|
+
approving: Xe.value,
|
|
2681
2688
|
draft: t.draft,
|
|
2682
2689
|
onRefresh: Le,
|
|
2683
|
-
onApprove:
|
|
2684
|
-
}, null, 8, ["show", "refreshing", "approving", "draft"])) :
|
|
2690
|
+
onApprove: fn
|
|
2691
|
+
}, null, 8, ["show", "refreshing", "approving", "draft"])) : K("", !0)
|
|
2685
2692
|
], 64);
|
|
2686
2693
|
};
|
|
2687
2694
|
}
|
|
2688
2695
|
});
|
|
2689
2696
|
var ve = /* @__PURE__ */ ((n) => (n.ready = "ready", n.negative = "negative", n.systemNegative = "systemNegative", n))(ve || {});
|
|
2690
|
-
async function
|
|
2691
|
-
return new Promise((
|
|
2697
|
+
async function Ao(n) {
|
|
2698
|
+
return new Promise((l, t) => {
|
|
2692
2699
|
const o = new FileReader();
|
|
2693
2700
|
o.onload = (g) => {
|
|
2694
2701
|
var i;
|
|
2695
2702
|
try {
|
|
2696
|
-
const s = (i = g.target) == null ? void 0 : i.result, c =
|
|
2703
|
+
const s = (i = g.target) == null ? void 0 : i.result, c = Yn(s, { type: "array" }), x = c.SheetNames[0], A = c.Sheets[x], f = ot.sheet_to_json(A, {
|
|
2697
2704
|
header: 1,
|
|
2698
2705
|
defval: ""
|
|
2699
2706
|
}), B = (v) => String(v).trim().toLowerCase().replace(/^\uFEFF/, ""), N = f.findIndex(
|
|
2700
2707
|
(v) => v.some((m) => B(m) === "code")
|
|
2701
2708
|
);
|
|
2702
2709
|
if (N === -1) {
|
|
2703
|
-
|
|
2710
|
+
l([]);
|
|
2704
2711
|
return;
|
|
2705
2712
|
}
|
|
2706
|
-
const E = f[N], I = E.findIndex((v) => B(v) === "code"),
|
|
2707
|
-
if (I === -1 ||
|
|
2713
|
+
const E = f[N], I = E.findIndex((v) => B(v) === "code"), _ = E.findIndex((v) => B(v) === "balance");
|
|
2714
|
+
if (I === -1 || _ === -1) {
|
|
2708
2715
|
t(
|
|
2709
2716
|
new Error(
|
|
2710
|
-
`Missing required columns: ${I === -1 ? '"Code" ' : ""}${
|
|
2717
|
+
`Missing required columns: ${I === -1 ? '"Code" ' : ""}${_ === -1 ? '"Balance"' : ""}.`.trim()
|
|
2711
2718
|
)
|
|
2712
2719
|
);
|
|
2713
2720
|
return;
|
|
2714
2721
|
}
|
|
2715
2722
|
const p = f.slice(N + 1).filter((v) => String(v[I]).trim()).map((v) => ({
|
|
2716
2723
|
itemCode: String(v[I]).trim(),
|
|
2717
|
-
quantity: Number(v[
|
|
2724
|
+
quantity: Number(v[_]) || 0
|
|
2718
2725
|
}));
|
|
2719
|
-
|
|
2726
|
+
l(p);
|
|
2720
2727
|
} catch (s) {
|
|
2721
2728
|
t(s);
|
|
2722
2729
|
}
|
|
2723
2730
|
}, o.onerror = t, o.readAsArrayBuffer(n);
|
|
2724
2731
|
});
|
|
2725
2732
|
}
|
|
2726
|
-
function
|
|
2727
|
-
const
|
|
2733
|
+
function Co(n) {
|
|
2734
|
+
const l = /* @__PURE__ */ new Map();
|
|
2728
2735
|
return n.forEach((t) => {
|
|
2729
|
-
const o =
|
|
2730
|
-
|
|
2731
|
-
}),
|
|
2736
|
+
const o = l.get(t.itemCode) || 0;
|
|
2737
|
+
l.set(t.itemCode, o + t.quantity);
|
|
2738
|
+
}), l;
|
|
2732
2739
|
}
|
|
2733
|
-
function
|
|
2740
|
+
function So(n, l) {
|
|
2734
2741
|
const t = [], o = [];
|
|
2735
|
-
for (const [g, i] of
|
|
2742
|
+
for (const [g, i] of l.entries()) {
|
|
2736
2743
|
const s = n[g];
|
|
2737
2744
|
if (!s) {
|
|
2738
2745
|
o.push(g);
|
|
@@ -2750,21 +2757,21 @@ function _o(n, r) {
|
|
|
2750
2757
|
}
|
|
2751
2758
|
return { mergedItems: t, unrecognisedItemCodes: o };
|
|
2752
2759
|
}
|
|
2753
|
-
function
|
|
2754
|
-
const t = n.filter((x) => !x.isInactive), o =
|
|
2760
|
+
function $o(n, l) {
|
|
2761
|
+
const t = n.filter((x) => !x.isInactive), o = Wn().format("YYYY-MM-DD"), g = `${l} - ${o}.csv`, i = [
|
|
2755
2762
|
["Code", "Name", "Balance"],
|
|
2756
2763
|
...t.map((x) => [x.code, x.name, ""])
|
|
2757
|
-
], s =
|
|
2758
|
-
|
|
2764
|
+
], s = ot.aoa_to_sheet(i), c = ot.book_new();
|
|
2765
|
+
ot.book_append_sheet(c, s, "Template"), Kn(c, g, { bookType: "csv" });
|
|
2759
2766
|
}
|
|
2760
|
-
function
|
|
2761
|
-
const n =
|
|
2767
|
+
function Fo() {
|
|
2768
|
+
const n = W([]), l = W([]), t = W(!1), o = wt(), g = We(), i = ct(), s = M(
|
|
2762
2769
|
() => n.value.some((f) => f.status === ve.negative)
|
|
2763
2770
|
);
|
|
2764
2771
|
async function c(f) {
|
|
2765
|
-
n.value = [],
|
|
2772
|
+
n.value = [], l.value = [], t.value = !0;
|
|
2766
2773
|
try {
|
|
2767
|
-
const B = await
|
|
2774
|
+
const B = await Ao(f), N = Co(B), E = o.skuByCode, { mergedItems: I, unrecognisedItemCodes: _ } = So(
|
|
2768
2775
|
E,
|
|
2769
2776
|
N
|
|
2770
2777
|
), R = await i.readStockBalance(), p = R.skus ?? [];
|
|
@@ -2778,25 +2785,25 @@ function xo() {
|
|
|
2778
2785
|
p.map((b) => [b.id, b.balance])
|
|
2779
2786
|
), m = new Set(I.map((b) => b.sku._id));
|
|
2780
2787
|
n.value = I.map((b) => {
|
|
2781
|
-
const y = v.get(b.sku._id) ?? { amount: 0, precision: 0 },
|
|
2782
|
-
return { ...b, systemBalance: y, variance: b.physicalCount -
|
|
2788
|
+
const y = v.get(b.sku._id) ?? { amount: 0, precision: 0 }, w = y.amount / Math.pow(10, y.precision);
|
|
2789
|
+
return { ...b, systemBalance: y, variance: b.physicalCount - w };
|
|
2783
2790
|
});
|
|
2784
2791
|
for (const b of Object.values(o.skuByCode)) {
|
|
2785
2792
|
if (m.has(b._id)) continue;
|
|
2786
2793
|
const y = v.get(b._id);
|
|
2787
2794
|
if (!y) continue;
|
|
2788
|
-
const
|
|
2789
|
-
|
|
2795
|
+
const w = y.amount / Math.pow(10, y.precision);
|
|
2796
|
+
w >= 0 || n.value.push({
|
|
2790
2797
|
sku: b,
|
|
2791
2798
|
physicalCount: 0,
|
|
2792
2799
|
systemBalance: y,
|
|
2793
|
-
variance: 0 -
|
|
2800
|
+
variance: 0 - w,
|
|
2794
2801
|
status: ve.systemNegative
|
|
2795
2802
|
});
|
|
2796
2803
|
}
|
|
2797
|
-
|
|
2804
|
+
l.value = _;
|
|
2798
2805
|
} catch (B) {
|
|
2799
|
-
n.value = [],
|
|
2806
|
+
n.value = [], l.value = [], console.error("Error processing uploaded file", { error: B });
|
|
2800
2807
|
} finally {
|
|
2801
2808
|
t.value = !1;
|
|
2802
2809
|
}
|
|
@@ -2811,36 +2818,36 @@ function xo() {
|
|
|
2811
2818
|
name: p.sku.name,
|
|
2812
2819
|
unit: p.sku.unit
|
|
2813
2820
|
},
|
|
2814
|
-
baseAmount:
|
|
2821
|
+
baseAmount: Jt(p.physicalCount, p.sku.unit.precision),
|
|
2815
2822
|
measurementsAmounts: []
|
|
2816
|
-
}), I = B.map(E),
|
|
2823
|
+
}), I = B.map(E), _ = N.map(E), R = {
|
|
2817
2824
|
effectiveAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2818
2825
|
items: I,
|
|
2819
|
-
negativeStockItems:
|
|
2826
|
+
negativeStockItems: _
|
|
2820
2827
|
};
|
|
2821
2828
|
return await f.createQuickModeDraftWithItems(R);
|
|
2822
2829
|
}
|
|
2823
2830
|
function A() {
|
|
2824
2831
|
var B;
|
|
2825
2832
|
const f = ((B = g.currentLocation) == null ? void 0 : B.name) ?? "template";
|
|
2826
|
-
|
|
2833
|
+
$o(o.skus, f);
|
|
2827
2834
|
}
|
|
2828
|
-
return { mergedItems: n, unrecognisedItemCodes:
|
|
2835
|
+
return { mergedItems: n, unrecognisedItemCodes: l, hasBlockingErrors: s, isLoading: t, onFileUpload: c, submit: x, downloadTemplate: A };
|
|
2829
2836
|
}
|
|
2830
|
-
const
|
|
2837
|
+
const Io = { class: "flex flex-col gap-16" }, Bo = {
|
|
2831
2838
|
key: 0,
|
|
2832
2839
|
class: "px-16 py-12 rounded-8 bg-fm-color-danger-weak text-fm-color-danger-default"
|
|
2833
|
-
},
|
|
2840
|
+
}, To = { key: 1 }, jo = { class: "fm-typo-en-label-md-400 cursor-pointer" }, Mo = { class: "mt-8 flex flex-col gap-4" }, Uo = { key: 2 }, Ro = { class: "fm-typo-en-label-md-400 cursor-pointer" }, Po = { class: "mt-8 flex flex-col gap-4" }, Vo = /* @__PURE__ */ je({
|
|
2834
2841
|
__name: "ClosingDraftCreatePreviewTable",
|
|
2835
2842
|
props: {
|
|
2836
2843
|
items: {},
|
|
2837
2844
|
unrecognisedItemCodes: {}
|
|
2838
2845
|
},
|
|
2839
2846
|
setup(n) {
|
|
2840
|
-
const
|
|
2841
|
-
() =>
|
|
2847
|
+
const l = n, { t } = Ye(), o = M(
|
|
2848
|
+
() => l.items.filter((c) => c.status === ve.negative)
|
|
2842
2849
|
), g = M(
|
|
2843
|
-
() =>
|
|
2850
|
+
() => l.items.filter((c) => c.status === ve.systemNegative)
|
|
2844
2851
|
), i = M(() => ({
|
|
2845
2852
|
[ve.negative]: {
|
|
2846
2853
|
bgColor: "bg-fm-color-danger-weak",
|
|
@@ -2872,7 +2879,7 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
|
|
|
2872
2879
|
size: 180,
|
|
2873
2880
|
cell: (c) => {
|
|
2874
2881
|
const x = c.row.original;
|
|
2875
|
-
return
|
|
2882
|
+
return k("div", ne(x.systemBalance));
|
|
2876
2883
|
}
|
|
2877
2884
|
},
|
|
2878
2885
|
{
|
|
@@ -2880,7 +2887,7 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
|
|
|
2880
2887
|
header: () => t("inventory.closing.draft.createDraft.previewTable.stockTakeBalance"),
|
|
2881
2888
|
cell: (c) => {
|
|
2882
2889
|
const x = c.row.original;
|
|
2883
|
-
return
|
|
2890
|
+
return k("div", ne(x.physicalCount));
|
|
2884
2891
|
}
|
|
2885
2892
|
},
|
|
2886
2893
|
{
|
|
@@ -2888,7 +2895,7 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
|
|
|
2888
2895
|
header: () => t("inventory.closing.draft.createDraft.previewTable.variance"),
|
|
2889
2896
|
cell: (c) => {
|
|
2890
2897
|
const A = c.row.original.variance, f = A < 0 ? "text-fm-color-danger-default" : A > 0 ? "text-fm-color-success-default" : "";
|
|
2891
|
-
return
|
|
2898
|
+
return k("span", { class: f }, ne(A));
|
|
2892
2899
|
}
|
|
2893
2900
|
},
|
|
2894
2901
|
{
|
|
@@ -2901,21 +2908,21 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
|
|
|
2901
2908
|
Math.min(100, Math.round(x.variance / Math.abs(A) * 1e4) / 100)
|
|
2902
2909
|
);
|
|
2903
2910
|
if (f === null)
|
|
2904
|
-
return
|
|
2911
|
+
return k(
|
|
2905
2912
|
"div",
|
|
2906
2913
|
{ class: "flex items-center gap-4 justify-end fm-typo-en-body-md-400" },
|
|
2907
2914
|
t("inventory.closing.draft.createDraft.previewTable.notApplicable")
|
|
2908
2915
|
);
|
|
2909
2916
|
const B = `${ne(f)}`;
|
|
2910
2917
|
if (f === 0)
|
|
2911
|
-
return
|
|
2918
|
+
return k(
|
|
2912
2919
|
"div",
|
|
2913
2920
|
{ class: "flex items-center gap-4 justify-end fm-typo-en-body-md-400" },
|
|
2914
2921
|
B
|
|
2915
2922
|
);
|
|
2916
2923
|
const N = f > 0;
|
|
2917
|
-
return
|
|
2918
|
-
|
|
2924
|
+
return k("div", { class: "flex items-center gap-4 justify-end fm-typo-en-body-md-400" }, [
|
|
2925
|
+
k(pe.FmIcon, {
|
|
2919
2926
|
name: N ? "arrow_drop_up" : "arrow_drop_down",
|
|
2920
2927
|
color: N ? "system-success-300" : "system-error-300",
|
|
2921
2928
|
size: "md"
|
|
@@ -2929,7 +2936,7 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
|
|
|
2929
2936
|
header: () => t("inventory.common.status"),
|
|
2930
2937
|
cell: (c) => {
|
|
2931
2938
|
const x = c.row.original.status, A = i.value[x];
|
|
2932
|
-
return A ?
|
|
2939
|
+
return A ? k(
|
|
2933
2940
|
"span",
|
|
2934
2941
|
{
|
|
2935
2942
|
class: `px-8 py-2 rounded-4 ${A.bgColor} ${A.textColor} fm-typo-en-label-sm-400`
|
|
@@ -2941,63 +2948,63 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
|
|
|
2941
2948
|
];
|
|
2942
2949
|
return (c, x) => {
|
|
2943
2950
|
const A = Z("FmTable");
|
|
2944
|
-
return
|
|
2945
|
-
o.value.length > 0 ? (
|
|
2951
|
+
return h(), T("div", Io, [
|
|
2952
|
+
o.value.length > 0 ? (h(), T("div", Bo, [
|
|
2946
2953
|
de(H(u(t)("inventory.closing.draft.createDraft.previewTable.cannotSubmitNegative")) + " ", 1),
|
|
2947
2954
|
a("strong", null, H(o.value.map((f) => f.sku.code).join(", ")), 1)
|
|
2948
|
-
])) :
|
|
2949
|
-
g.value.length > 0 ? (
|
|
2950
|
-
a("summary",
|
|
2951
|
-
a("ul",
|
|
2952
|
-
(
|
|
2955
|
+
])) : K("", !0),
|
|
2956
|
+
g.value.length > 0 ? (h(), T("details", To, [
|
|
2957
|
+
a("summary", jo, H(u(t)("inventory.closing.draft.createDraft.previewTable.systemNegativeNote", [g.value.length])), 1),
|
|
2958
|
+
a("ul", Mo, [
|
|
2959
|
+
(h(!0), T(ce, null, he(g.value, (f) => (h(), T("li", {
|
|
2953
2960
|
key: f.sku._id,
|
|
2954
2961
|
class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
2955
2962
|
}, H(f.sku.code), 1))), 128))
|
|
2956
2963
|
])
|
|
2957
|
-
])) :
|
|
2958
|
-
c.unrecognisedItemCodes.length > 0 ? (
|
|
2959
|
-
a("summary",
|
|
2960
|
-
a("ul",
|
|
2961
|
-
(
|
|
2964
|
+
])) : K("", !0),
|
|
2965
|
+
c.unrecognisedItemCodes.length > 0 ? (h(), T("details", Uo, [
|
|
2966
|
+
a("summary", Ro, H(u(t)("inventory.closing.draft.createDraft.previewTable.unrecognisedNote", [c.unrecognisedItemCodes.length])), 1),
|
|
2967
|
+
a("ul", Po, [
|
|
2968
|
+
(h(!0), T(ce, null, he(c.unrecognisedItemCodes, (f) => (h(), T("li", {
|
|
2962
2969
|
key: f,
|
|
2963
2970
|
class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
2964
2971
|
}, H(f), 1))), 128))
|
|
2965
2972
|
])
|
|
2966
|
-
])) :
|
|
2973
|
+
])) : K("", !0),
|
|
2967
2974
|
$(A, {
|
|
2968
|
-
"row-data":
|
|
2975
|
+
"row-data": l.items,
|
|
2969
2976
|
"column-defs": s,
|
|
2970
2977
|
pagination: { pageSize: 20 }
|
|
2971
2978
|
}, null, 8, ["row-data"])
|
|
2972
2979
|
]);
|
|
2973
2980
|
};
|
|
2974
2981
|
}
|
|
2975
|
-
}),
|
|
2982
|
+
}), No = { class: "flex flex-col gap-16" }, zo = { class: "flex flex-col gap-8" }, Eo = { class: "fm-typo-en-body-lg-600" }, Lo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Oo = { class: "fm-corner-radius-md p-16 flex items-center gap-16 border border-fm-color-border-default" }, Ho = { class: "flex flex-col flex-1 gap-4" }, Yo = { class: "fm-typo-en-body-md-600" }, Ko = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Wo = {
|
|
2976
2983
|
key: 0,
|
|
2977
2984
|
class: "flex flex-col gap-8"
|
|
2978
|
-
},
|
|
2985
|
+
}, qo = { class: "fm-typo-en-body-lg-600" }, Go = {
|
|
2979
2986
|
key: 0,
|
|
2980
2987
|
class: "fm-typo-en-body-sm-400 text-fm-color-system-error-300 flex items-center gap-8"
|
|
2981
|
-
},
|
|
2988
|
+
}, Qo = { class: "grid grid-cols-[repeat(3,1fr)] gap-12" }, Zo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary flex items-center gap-4" }, Jo = { class: "flex items-center gap-8 w-full" }, Xo = /* @__PURE__ */ je({
|
|
2982
2989
|
__name: "ClosingDraftCreateSideSheet",
|
|
2983
2990
|
props: {
|
|
2984
2991
|
show: { type: Boolean }
|
|
2985
2992
|
},
|
|
2986
2993
|
emits: ["update:show", "submitted"],
|
|
2987
|
-
setup(n, { emit:
|
|
2988
|
-
const t = n, o =
|
|
2994
|
+
setup(n, { emit: l }) {
|
|
2995
|
+
const t = n, o = l, g = qt(t, "show"), { t: i } = Ye(), s = Ke(), c = W("upload"), x = W(null), A = W(!1), { mergedItems: f, unrecognisedItemCodes: B, hasBlockingErrors: N, isLoading: E, onFileUpload: I, submit: _, downloadTemplate: R } = Fo(), p = M(
|
|
2989
2996
|
() => x.value && !E.value && f.value.length > 0
|
|
2990
2997
|
), v = M(() => {
|
|
2991
|
-
const
|
|
2998
|
+
const w = f.value.filter(
|
|
2992
2999
|
(z) => z.status === ve.ready
|
|
2993
3000
|
).length, Y = f.value.filter(
|
|
2994
3001
|
(z) => z.status === ve.negative
|
|
2995
|
-
).length,
|
|
3002
|
+
).length, q = f.value.filter(
|
|
2996
3003
|
(z) => z.status === ve.systemNegative
|
|
2997
3004
|
).length, re = f.value.filter((z) => z.variance !== 0).length;
|
|
2998
3005
|
return [
|
|
2999
3006
|
{ label: i("inventory.closing.draft.createDraft.summary.totalItems"), value: f.value.length },
|
|
3000
|
-
{ label: i("inventory.closing.draft.createDraft.summary.itemsWithCount"), value:
|
|
3007
|
+
{ label: i("inventory.closing.draft.createDraft.summary.itemsWithCount"), value: w },
|
|
3001
3008
|
{
|
|
3002
3009
|
label: i("inventory.closing.draft.createDraft.summary.unrecognisedItems"),
|
|
3003
3010
|
value: B.value.length,
|
|
@@ -3007,24 +3014,24 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
|
|
|
3007
3014
|
{ label: i("inventory.closing.draft.createDraft.summary.negativeCounts"), value: Y, isError: Y > 0 },
|
|
3008
3015
|
{
|
|
3009
3016
|
label: i("inventory.closing.draft.createDraft.summary.systemNegative"),
|
|
3010
|
-
value:
|
|
3011
|
-
isWarning:
|
|
3017
|
+
value: q,
|
|
3018
|
+
isWarning: q > 0
|
|
3012
3019
|
}
|
|
3013
3020
|
];
|
|
3014
3021
|
});
|
|
3015
|
-
async function m(
|
|
3016
|
-
x.value =
|
|
3022
|
+
async function m(w) {
|
|
3023
|
+
x.value = w, await I(w);
|
|
3017
3024
|
}
|
|
3018
3025
|
async function b() {
|
|
3019
3026
|
A.value = !0;
|
|
3020
3027
|
try {
|
|
3021
|
-
await
|
|
3028
|
+
await _(), y(), o("submitted"), s.open({
|
|
3022
3029
|
title: "Success",
|
|
3023
3030
|
message: "Closing draft created successfully",
|
|
3024
3031
|
type: "success"
|
|
3025
3032
|
});
|
|
3026
|
-
} catch (
|
|
3027
|
-
console.error("Failed to create closing draft", { error:
|
|
3033
|
+
} catch (w) {
|
|
3034
|
+
console.error("Failed to create closing draft", { error: w }), s.open({
|
|
3028
3035
|
title: "Something went wrong",
|
|
3029
3036
|
message: "Failed to create closing draft. Please try again",
|
|
3030
3037
|
type: "error"
|
|
@@ -3033,15 +3040,15 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
|
|
|
3033
3040
|
A.value = !1;
|
|
3034
3041
|
}
|
|
3035
3042
|
}
|
|
3036
|
-
ze(g, (
|
|
3037
|
-
|
|
3043
|
+
ze(g, (w) => {
|
|
3044
|
+
w || (c.value = "upload", x.value = null);
|
|
3038
3045
|
});
|
|
3039
3046
|
function y() {
|
|
3040
3047
|
g.value = !1;
|
|
3041
3048
|
}
|
|
3042
|
-
return (
|
|
3043
|
-
const
|
|
3044
|
-
return
|
|
3049
|
+
return (w, Y) => {
|
|
3050
|
+
const q = Z("FmCircularProgress"), re = Z("FmIcon"), z = Z("FmButton"), le = Z("FmCard"), P = Z("FmSideSheet");
|
|
3051
|
+
return h(), ae(P, {
|
|
3045
3052
|
"dismiss-away": "",
|
|
3046
3053
|
"max-width": 9999,
|
|
3047
3054
|
"model-value": u(g),
|
|
@@ -3049,36 +3056,36 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
|
|
|
3049
3056
|
header: u(i)("inventory.closing.draft.createDraft.title")
|
|
3050
3057
|
}, {
|
|
3051
3058
|
default: ee(() => [
|
|
3052
|
-
a("div",
|
|
3053
|
-
c.value === "upload" ? (
|
|
3054
|
-
a("div",
|
|
3055
|
-
a("div",
|
|
3056
|
-
a("div",
|
|
3057
|
-
$(
|
|
3059
|
+
a("div", No, [
|
|
3060
|
+
c.value === "upload" ? (h(), T(ce, { key: 0 }, [
|
|
3061
|
+
a("div", zo, [
|
|
3062
|
+
a("div", Eo, H(u(i)("inventory.closing.draft.createDraft.importCsv")), 1),
|
|
3063
|
+
a("div", Lo, H(u(i)("inventory.closing.draft.createDraft.uploadDescription")), 1),
|
|
3064
|
+
$(qn, {
|
|
3058
3065
|
class: Se({ "h-[200px]": !x.value }),
|
|
3059
3066
|
accept: ".csv",
|
|
3060
3067
|
disabled: u(E),
|
|
3061
3068
|
onFileUpload: m
|
|
3062
|
-
},
|
|
3069
|
+
}, _n({ _: 2 }, [
|
|
3063
3070
|
x.value ? {
|
|
3064
3071
|
name: "default",
|
|
3065
3072
|
fn: ee(({ openFileDialog: S }) => [
|
|
3066
|
-
a("div",
|
|
3067
|
-
u(E) ? (
|
|
3073
|
+
a("div", Oo, [
|
|
3074
|
+
u(E) ? (h(), ae(q, {
|
|
3068
3075
|
key: 0,
|
|
3069
3076
|
size: "md",
|
|
3070
3077
|
color: "neutral-gray-200"
|
|
3071
|
-
})) : (
|
|
3078
|
+
})) : (h(), ae(re, {
|
|
3072
3079
|
key: 1,
|
|
3073
3080
|
name: "check_circle",
|
|
3074
3081
|
color: "system-success-400",
|
|
3075
3082
|
size: "lg"
|
|
3076
3083
|
})),
|
|
3077
|
-
a("div",
|
|
3078
|
-
a("div",
|
|
3079
|
-
a("div",
|
|
3084
|
+
a("div", Ho, [
|
|
3085
|
+
a("div", Yo, H(x.value.name), 1),
|
|
3086
|
+
a("div", Ko, H(u(E) ? u(i)("inventory.closing.draft.createDraft.processing") : u(i)("inventory.closing.draft.createDraft.itemsLoaded", [u(f).length])), 1)
|
|
3080
3087
|
]),
|
|
3081
|
-
u(E) ?
|
|
3088
|
+
u(E) ? K("", !0) : (h(), ae(z, {
|
|
3082
3089
|
key: 2,
|
|
3083
3090
|
label: u(i)("inventory.closing.draft.createDraft.replaceFile"),
|
|
3084
3091
|
variant: "secondary",
|
|
@@ -3091,39 +3098,39 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
|
|
|
3091
3098
|
} : void 0
|
|
3092
3099
|
]), 1032, ["class", "disabled"])
|
|
3093
3100
|
]),
|
|
3094
|
-
p.value ? (
|
|
3095
|
-
a("div",
|
|
3096
|
-
u(N) ? (
|
|
3101
|
+
p.value ? (h(), T("div", Wo, [
|
|
3102
|
+
a("div", qo, H(u(i)("inventory.closing.draft.createDraft.importSummary")), 1),
|
|
3103
|
+
u(N) ? (h(), T("div", Go, [
|
|
3097
3104
|
$(re, {
|
|
3098
3105
|
name: "error",
|
|
3099
3106
|
size: "sm",
|
|
3100
3107
|
color: "system-error-300"
|
|
3101
3108
|
}),
|
|
3102
3109
|
a("span", null, H(u(i)("inventory.closing.draft.createDraft.reviewIssues")), 1)
|
|
3103
|
-
])) :
|
|
3110
|
+
])) : K("", !0),
|
|
3104
3111
|
$(le, {
|
|
3105
3112
|
variant: "outlined",
|
|
3106
3113
|
class: "flex flex-col gap-12 px-16 py-12"
|
|
3107
3114
|
}, {
|
|
3108
3115
|
default: ee(() => [
|
|
3109
|
-
a("div",
|
|
3110
|
-
(
|
|
3116
|
+
a("div", Qo, [
|
|
3117
|
+
(h(!0), T(ce, null, he(v.value, (S) => (h(), T("div", {
|
|
3111
3118
|
key: S.label,
|
|
3112
3119
|
class: "flex flex-col gap-4"
|
|
3113
3120
|
}, [
|
|
3114
|
-
a("div",
|
|
3115
|
-
S.isError ? (
|
|
3121
|
+
a("div", Zo, [
|
|
3122
|
+
S.isError ? (h(), ae(re, {
|
|
3116
3123
|
key: 0,
|
|
3117
3124
|
name: "error",
|
|
3118
3125
|
size: "sm",
|
|
3119
3126
|
color: "system-error-300"
|
|
3120
|
-
})) :
|
|
3121
|
-
S.isWarning && !S.isError ? (
|
|
3127
|
+
})) : K("", !0),
|
|
3128
|
+
S.isWarning && !S.isError ? (h(), ae(re, {
|
|
3122
3129
|
key: 1,
|
|
3123
3130
|
name: "warning",
|
|
3124
3131
|
size: "sm",
|
|
3125
3132
|
color: "system-warning-300"
|
|
3126
|
-
})) :
|
|
3133
|
+
})) : K("", !0),
|
|
3127
3134
|
a("span", null, H(S.label), 1)
|
|
3128
3135
|
]),
|
|
3129
3136
|
a("div", {
|
|
@@ -3140,32 +3147,32 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
|
|
|
3140
3147
|
]),
|
|
3141
3148
|
_: 1
|
|
3142
3149
|
})
|
|
3143
|
-
])) :
|
|
3144
|
-
], 64)) :
|
|
3145
|
-
c.value === "preview" ? (
|
|
3150
|
+
])) : K("", !0)
|
|
3151
|
+
], 64)) : K("", !0),
|
|
3152
|
+
c.value === "preview" ? (h(), ae(Vo, {
|
|
3146
3153
|
key: 1,
|
|
3147
3154
|
items: u(f),
|
|
3148
3155
|
"unrecognised-item-codes": u(B)
|
|
3149
|
-
}, null, 8, ["items", "unrecognised-item-codes"])) :
|
|
3156
|
+
}, null, 8, ["items", "unrecognised-item-codes"])) : K("", !0)
|
|
3150
3157
|
])
|
|
3151
3158
|
]),
|
|
3152
3159
|
"side-sheet-footer": ee(() => [
|
|
3153
|
-
a("div",
|
|
3154
|
-
c.value === "preview" ? (
|
|
3160
|
+
a("div", Jo, [
|
|
3161
|
+
c.value === "preview" ? (h(), ae(z, {
|
|
3155
3162
|
key: 0,
|
|
3156
3163
|
variant: "secondary",
|
|
3157
3164
|
label: u(i)("inventory.common.back"),
|
|
3158
3165
|
"prepend-icon": "arrow_back",
|
|
3159
3166
|
onClick: Y[0] || (Y[0] = (S) => c.value = "upload")
|
|
3160
|
-
}, null, 8, ["label"])) :
|
|
3161
|
-
c.value === "upload" ? (
|
|
3167
|
+
}, null, 8, ["label"])) : K("", !0),
|
|
3168
|
+
c.value === "upload" ? (h(), ae(z, {
|
|
3162
3169
|
key: 1,
|
|
3163
3170
|
variant: "primary",
|
|
3164
3171
|
label: u(i)("inventory.common.next"),
|
|
3165
3172
|
disabled: !x.value || u(E),
|
|
3166
3173
|
onClick: Y[1] || (Y[1] = (S) => c.value = "preview")
|
|
3167
|
-
}, null, 8, ["label", "disabled"])) :
|
|
3168
|
-
c.value === "preview" ? (
|
|
3174
|
+
}, null, 8, ["label", "disabled"])) : K("", !0),
|
|
3175
|
+
c.value === "preview" ? (h(), ae(Gn, {
|
|
3169
3176
|
key: 2,
|
|
3170
3177
|
label: u(i)("inventory.closing.draft.createDraft.submit"),
|
|
3171
3178
|
disabled: u(N) || u(f).length === 0 || A.value,
|
|
@@ -3173,38 +3180,38 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
|
|
|
3173
3180
|
"confirm-title": u(i)("inventory.closing.draft.createDraft.confirmTitle"),
|
|
3174
3181
|
"confirm-message": u(i)("inventory.closing.draft.createDraft.confirmMessage"),
|
|
3175
3182
|
onConfirm: b
|
|
3176
|
-
}, null, 8, ["label", "disabled", "loading", "confirm-title", "confirm-message"])) :
|
|
3183
|
+
}, null, 8, ["label", "disabled", "loading", "confirm-title", "confirm-message"])) : K("", !0),
|
|
3177
3184
|
$(z, {
|
|
3178
3185
|
variant: "tertiary",
|
|
3179
3186
|
label: u(i)("inventory.common.close"),
|
|
3180
3187
|
onClick: y
|
|
3181
3188
|
}, null, 8, ["label"]),
|
|
3182
|
-
c.value === "upload" ? (
|
|
3189
|
+
c.value === "upload" ? (h(), ae(z, {
|
|
3183
3190
|
key: 3,
|
|
3184
3191
|
class: "ml-auto",
|
|
3185
3192
|
variant: "secondary",
|
|
3186
3193
|
label: u(i)("inventory.closing.draft.createDraft.downloadTemplate"),
|
|
3187
3194
|
"prepend-icon": "download",
|
|
3188
3195
|
onClick: u(R)
|
|
3189
|
-
}, null, 8, ["label", "onClick"])) :
|
|
3196
|
+
}, null, 8, ["label", "onClick"])) : K("", !0)
|
|
3190
3197
|
])
|
|
3191
3198
|
]),
|
|
3192
3199
|
_: 1
|
|
3193
3200
|
}, 8, ["model-value", "header"]);
|
|
3194
3201
|
};
|
|
3195
3202
|
}
|
|
3196
|
-
}),
|
|
3203
|
+
}), es = { class: "flex-1 flex flex-col gap-8" }, ts = { class: "flex flex-col" }, ns = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, as = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, os = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, ss = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, Ms = /* @__PURE__ */ je({
|
|
3197
3204
|
__name: "ClosingDraftView",
|
|
3198
3205
|
setup(n) {
|
|
3199
|
-
const { t:
|
|
3206
|
+
const { t: l } = Ye(), { viewDraft: t } = it(), { viewClosingDraftProps: o, viewClosingDraftShow: g } = Bn(it()), i = We(), s = rn(), c = Dn(), { breakpoints: x } = Sn();
|
|
3200
3207
|
i.watchLocation(s.fetchDrafts);
|
|
3201
|
-
const A = M(() => s.loading), f =
|
|
3208
|
+
const A = M(() => s.loading), f = W(""), B = W(!1), N = M(() => x.value.xs || x.value.sm), E = M(() => N.value ? 10 : 20), I = M(
|
|
3202
3209
|
() => {
|
|
3203
3210
|
var v;
|
|
3204
|
-
return ((v = i.currentLocation) == null ? void 0 : v.type) ===
|
|
3211
|
+
return ((v = i.currentLocation) == null ? void 0 : v.type) === In.enum.warehouse;
|
|
3205
3212
|
}
|
|
3206
3213
|
);
|
|
3207
|
-
function
|
|
3214
|
+
function _(v) {
|
|
3208
3215
|
switch (v) {
|
|
3209
3216
|
case "add":
|
|
3210
3217
|
return B.value = !0;
|
|
@@ -3217,12 +3224,12 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
|
|
|
3217
3224
|
}
|
|
3218
3225
|
const p = M(() => {
|
|
3219
3226
|
const v = {
|
|
3220
|
-
label:
|
|
3227
|
+
label: l("inventory.closing.draft.createDraft.title"),
|
|
3221
3228
|
value: "add",
|
|
3222
3229
|
isPrimary: !0,
|
|
3223
3230
|
prependIcon: "add"
|
|
3224
3231
|
}, m = {
|
|
3225
|
-
label:
|
|
3232
|
+
label: l("inventory.common.refresh"),
|
|
3226
3233
|
value: "refresh",
|
|
3227
3234
|
isPrimary: !1
|
|
3228
3235
|
};
|
|
@@ -3230,11 +3237,11 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
|
|
|
3230
3237
|
});
|
|
3231
3238
|
return (v, m) => {
|
|
3232
3239
|
const b = Z("FmTable");
|
|
3233
|
-
return
|
|
3234
|
-
$(
|
|
3235
|
-
title: u(
|
|
3240
|
+
return h(), T(ce, null, [
|
|
3241
|
+
$(An, {
|
|
3242
|
+
title: u(l)("inventory.closing.draft.title"),
|
|
3236
3243
|
actions: p.value,
|
|
3237
|
-
"onClick:action":
|
|
3244
|
+
"onClick:action": _
|
|
3238
3245
|
}, {
|
|
3239
3246
|
default: ee(() => [
|
|
3240
3247
|
a("div", {
|
|
@@ -3246,15 +3253,15 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
|
|
|
3246
3253
|
}
|
|
3247
3254
|
])
|
|
3248
3255
|
}, [
|
|
3249
|
-
$(
|
|
3256
|
+
$(En, {
|
|
3250
3257
|
"change-location": "",
|
|
3251
3258
|
searchable: "",
|
|
3252
3259
|
search: f.value,
|
|
3253
3260
|
"onUpdate:search": m[0] || (m[0] = (y) => f.value = y)
|
|
3254
3261
|
}, null, 8, ["search"]),
|
|
3255
|
-
(
|
|
3262
|
+
(h(), ae(b, {
|
|
3256
3263
|
key: u(s).tableKey,
|
|
3257
|
-
style:
|
|
3264
|
+
style: Kt(u(c).tableHeight),
|
|
3258
3265
|
"column-defs": u(s).columnDefs,
|
|
3259
3266
|
"row-data": u(s).drafts,
|
|
3260
3267
|
"search-value": f.value,
|
|
@@ -3263,42 +3270,42 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
|
|
|
3263
3270
|
"page-size": E.value
|
|
3264
3271
|
}, {
|
|
3265
3272
|
"list-row": ee((y) => [
|
|
3266
|
-
$(
|
|
3273
|
+
$(Qn, {
|
|
3267
3274
|
row: y,
|
|
3268
|
-
onRowClick: (
|
|
3275
|
+
onRowClick: (w) => u(t)(w)
|
|
3269
3276
|
}, {
|
|
3270
|
-
default: ee((
|
|
3271
|
-
var Y,
|
|
3277
|
+
default: ee((w) => {
|
|
3278
|
+
var Y, q, re, z, le, P, S, ie, L, F, Q, se, we, xe, De, $e, Ee, Le, Me, Ge;
|
|
3272
3279
|
return [
|
|
3273
|
-
a("div",
|
|
3274
|
-
a("div",
|
|
3275
|
-
a("div",
|
|
3276
|
-
$(u(
|
|
3277
|
-
render: (re = (
|
|
3278
|
-
props: (le = (z =
|
|
3280
|
+
a("div", es, [
|
|
3281
|
+
a("div", ts, [
|
|
3282
|
+
a("div", ns, [
|
|
3283
|
+
$(u(at), {
|
|
3284
|
+
render: (re = (q = (Y = w._id) == null ? void 0 : Y.column) == null ? void 0 : q.columnDef) == null ? void 0 : re.cell,
|
|
3285
|
+
props: (le = (z = w._id) == null ? void 0 : z.getContext) == null ? void 0 : le.call(z)
|
|
3279
3286
|
}, null, 8, ["render", "props"])
|
|
3280
3287
|
]),
|
|
3281
|
-
a("div",
|
|
3282
|
-
$(u(
|
|
3283
|
-
render: (ie = (S = (P =
|
|
3284
|
-
props: (F = (L =
|
|
3288
|
+
a("div", as, [
|
|
3289
|
+
$(u(at), {
|
|
3290
|
+
render: (ie = (S = (P = w.name) == null ? void 0 : P.column) == null ? void 0 : S.columnDef) == null ? void 0 : ie.cell,
|
|
3291
|
+
props: (F = (L = w.name) == null ? void 0 : L.getContext) == null ? void 0 : F.call(L)
|
|
3285
3292
|
}, null, 8, ["render", "props"])
|
|
3286
3293
|
]),
|
|
3287
|
-
a("div",
|
|
3288
|
-
...y.original.items.slice(0, 3).map((
|
|
3294
|
+
a("div", os, H([
|
|
3295
|
+
...y.original.items.slice(0, 3).map((ut) => ut.sku.name),
|
|
3289
3296
|
...y.original.items.length >= 3 ? [`and ${y.original.items.length - 3} more items`] : []
|
|
3290
3297
|
].join(", ")), 1),
|
|
3291
|
-
a("div",
|
|
3292
|
-
$(u(
|
|
3293
|
-
render: (we = (se = (Q =
|
|
3294
|
-
props: (De = (xe =
|
|
3298
|
+
a("div", ss, [
|
|
3299
|
+
$(u(at), {
|
|
3300
|
+
render: (we = (se = (Q = w.ref) == null ? void 0 : Q.column) == null ? void 0 : se.columnDef) == null ? void 0 : we.cell,
|
|
3301
|
+
props: (De = (xe = w.ref) == null ? void 0 : xe.getContext) == null ? void 0 : De.call(xe)
|
|
3295
3302
|
}, null, 8, ["render", "props"])
|
|
3296
3303
|
])
|
|
3297
3304
|
]),
|
|
3298
3305
|
a("div", null, [
|
|
3299
|
-
$(u(
|
|
3300
|
-
render: (Le = (Ee = ($e =
|
|
3301
|
-
props: (Ge = (
|
|
3306
|
+
$(u(at), {
|
|
3307
|
+
render: (Le = (Ee = ($e = w.status) == null ? void 0 : $e.column) == null ? void 0 : Ee.columnDef) == null ? void 0 : Le.cell,
|
|
3308
|
+
props: (Ge = (Me = w.status) == null ? void 0 : Me.getContext) == null ? void 0 : Ge.call(Me)
|
|
3302
3309
|
}, null, 8, ["render", "props"])
|
|
3303
3310
|
])
|
|
3304
3311
|
])
|
|
@@ -3313,13 +3320,13 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
|
|
|
3313
3320
|
]),
|
|
3314
3321
|
_: 1
|
|
3315
3322
|
}, 8, ["title", "actions"]),
|
|
3316
|
-
$(
|
|
3323
|
+
$(Xo, {
|
|
3317
3324
|
show: B.value,
|
|
3318
3325
|
"onUpdate:show": m[2] || (m[2] = (y) => B.value = y),
|
|
3319
3326
|
onSubmitted: u(s).fetchDrafts
|
|
3320
3327
|
}, null, 8, ["show", "onSubmitted"]),
|
|
3321
|
-
(
|
|
3322
|
-
$(
|
|
3328
|
+
(h(), ae(wn, { to: "body" }, [
|
|
3329
|
+
$(Do, xn(u(o), {
|
|
3323
3330
|
show: u(g),
|
|
3324
3331
|
"onUpdate:show": m[3] || (m[3] = (y) => _t(g) ? g.value = y : null),
|
|
3325
3332
|
onSubmitted: m[4] || (m[4] = () => (g.value = !1, u(s).fetchDrafts())),
|
|
@@ -3331,5 +3338,5 @@ const Do = { class: "flex flex-col gap-16" }, Ao = {
|
|
|
3331
3338
|
}
|
|
3332
3339
|
});
|
|
3333
3340
|
export {
|
|
3334
|
-
|
|
3341
|
+
Ms as default
|
|
3335
3342
|
};
|