@feedmepos/mf-inventory-portal 1.5.9-dev.2 → 1.5.9
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-B7rirksC.js → App-D_elK-3W.js} +4 -4
- package/dist/{ApprovalView-BomKMill.js → ApprovalView-WdSQEpGQ.js} +7 -7
- package/dist/{BindingsDialog-CI8qKlCl.js → BindingsDialog-CkqhKrrD.js} +2 -2
- package/dist/{BindingsPicker-BhED4TMH.js → BindingsPicker-HPjbSTJd.js} +2 -2
- package/dist/{BindingsTable-CgD27m69.js → BindingsTable-BF4WTUsf.js} +3 -3
- package/dist/{ClosingDraftView-BKjxsKag.js → ClosingDraftView-CTEaBuhS.js} +634 -634
- package/dist/{ClosingHistoryView-C8xdmA9v.js → ClosingHistoryView-DL9g4naX.js} +5 -5
- package/dist/{ClosingTemplateView-C3IMkNtu.js → ClosingTemplateView-DMtIj04r.js} +14 -14
- package/dist/{DefaultView-M1s5DkYs.js → DefaultView-v-32G42G.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-DNvsv0bs.js → DeliveryOrderPrintPreview-DHD9kykc.js} +2 -2
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DPiYsxMt.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-FRe1RX5T.js} +2 -2
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-W4K3RNpN.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-KTtYD7qS.js} +2 -2
- package/dist/{FmMultiselectDialog-DpiLiqOe.js → FmMultiselectDialog-BTNJvhnt.js} +2 -2
- package/dist/{FmMultiselectDialog-D5vlbq9s.js → FmMultiselectDialog-LmjSdrn3.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-tiIC1uvr.js → FmUnitInput.vue_vue_type_script_setup_true_lang-CvUDKcli.js} +5 -5
- package/dist/{ImportView-uPX4OhrY.js → ImportView-DoHL35I-.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-iTmbGMAv.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-D8JocFRD.js} +1 -1
- package/dist/{IngredientGroupView-Dhhm6SwF.js → IngredientGroupView-CVhShbuq.js} +5 -5
- package/dist/{IngredientsView-BeuJFNel.js → IngredientsView-XOTuP5ZI.js} +15 -15
- package/dist/{IntegrationExplorerView-DvIVyrTk.js → IntegrationExplorerView-BsY4Ca2E.js} +352 -352
- package/dist/{IntegrationView-BlCqI1aF.js → IntegrationView-C_Y3_I_8.js} +13 -13
- package/dist/{InventoryBindingForm-BbaQJX-2.js → InventoryBindingForm-CHsrJSnp.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-8kDSVOQT.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DMGMZ556.js} +5 -5
- package/dist/{InventoryBindingSummary-ISEBBsyC.js → InventoryBindingSummary-C9UE6Zh2.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C2XS7S9B.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DFj3HtnZ.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DMQCjdfY.js → PremiumBadge.vue_vue_type_script_setup_true_lang-oNk0zO9K.js} +1 -1
- package/dist/{PublishView-B7ngdwbS.js → PublishView-DVk0ZUlG.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-CdKQ2vC9.js → PurchaseOrderPrintPreview-poHk4RMP.js} +2 -2
- package/dist/{ReceiveRequestView-i7V6aTo7.js → ReceiveRequestView-CaPoxKBs.js} +25 -25
- package/dist/{RecipeView-DQeKXITE.js → RecipeView-bbhd-mNL.js} +17 -17
- package/dist/{SettingsView-5jm5pZxN.js → SettingsView-DxiMiFpz.js} +4 -4
- package/dist/{StockView-BeNHn4jp.js → StockView-Dc4ICHq3.js} +19 -19
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CKfaF6XM.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Cn3NL6mQ.js} +1 -1
- package/dist/{SupplierView-DzX3leQE.js → SupplierView-6fETAO2h.js} +12 -12
- package/dist/{SurchargeView-q8Rl6XQg.js → SurchargeView-7ucdobpg.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-CfYRww5Y.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-C4EeNPwc.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Bywpva5c.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-D-PqQ3Mi.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-Ceg3e163.js → TransferDetails.vue_vue_type_script_setup_true_lang-D-nG9kcq.js} +20 -20
- package/dist/{TransferTemplateView-ClEeuE0A.js → TransferTemplateView-CDD_5s5s.js} +18 -18
- package/dist/{UnitCostHistoryView-CkvS4aGj.js → UnitCostHistoryView-BrYXJWz0.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-C7VKd1XK.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-Cj15fCG9.js} +4 -4
- package/dist/{UnitView-COKzqhf7.js → UnitView-CMXUZZvZ.js} +7 -7
- package/dist/{WarehouseView-CWsl1Awb.js → WarehouseView-CUgJ4YGF.js} +5 -5
- package/dist/{WastageTemplateView-BAEbIzfQ.js → WastageTemplateView-Di6ffpTU.js} +14 -14
- package/dist/{app-DTz4LGCJ.js → app-D3gm3Lsw.js} +11 -11
- package/dist/app.js +1 -1
- package/dist/{closing-template-DmMvmiD8.js → closing-template-BiSW9398.js} +1 -1
- package/dist/{date2-BJJQIIV9.js → date2-DJotzNeB.js} +1 -1
- package/dist/{dayjs.min-YbnVt6Kp.js → dayjs.min-DxOA6M7_.js} +1 -1
- package/dist/{decimal-DstnZVub.js → decimal-BPZo97WQ.js} +2 -2
- package/dist/{defineDeepModel-CxxsD8UG.js → defineDeepModel-BMU9Poed.js} +1 -1
- package/dist/{duplicate-template-DFAfrk_o.js → duplicate-template-4bkTBQu0.js} +1 -1
- package/dist/{export-C0aosI78.js → export-BS0TrI3Q.js} +2 -2
- package/dist/{feature-dHHbIKf7.js → feature-WVA_2Jx-.js} +2 -2
- package/dist/{format-time-from-id-BtGI10RN.js → format-time-from-id-gcRrHjjv.js} +1 -1
- package/dist/{format-unit-display-C4V_dB6d.js → format-unit-display-BXkR_Hu0.js} +11 -11
- package/dist/{import-export.helper-BblDa7MU.js → import-export.helper-5AEiNKim.js} +6 -6
- package/dist/{index-j4PQ4n55.js → index-DU4iyU3D.js} +1 -1
- package/dist/{index-Y7yMwT_5.js → index-DkCy3EG9.js} +1 -1
- package/dist/{index-B8bFII4h.js → index-YVMa0U0j.js} +3 -3
- package/dist/{inventory-core-dart.default-JrRChx_V.js → inventory-core-dart.default-B7xHV5Y6.js} +1 -1
- package/dist/{lz-string-C856gsAG.js → lz-string-BtgOc0yQ.js} +1 -1
- package/dist/{netsuite-B6QeJ2cS.js → netsuite-DmXOUJo-.js} +2 -2
- package/dist/{number-CKzPOWR2.js → number-BfNWSAkN.js} +3 -3
- package/dist/{predefined-templates-bmWnR8Cx.js → predefined-templates-BKxLIZg6.js} +1 -1
- package/dist/{purchase-order-template-DQwbAN8F.js → purchase-order-template-7iNDStWd.js} +1 -1
- package/dist/{recalculationUtils-CTLTLQ9V.js → recalculationUtils-BVuC0H2j.js} +1 -1
- package/dist/{rules-EEgDDXMF.js → rules-BK8yTx5p.js} +2 -2
- package/dist/{stock-GVmcy_Vk.js → stock-BSA86fOX.js} +1 -1
- package/dist/{supplier-D2tc_iCh.js → supplier-DA3y7WoU.js} +2 -2
- package/dist/{surcharge-xQ1WGUtz.js → surcharge-BiYvWPv-.js} +1 -1
- package/dist/{uom-rules-BOqMU5Ob.js → uom-rules-BxHGqiP7.js} +1 -1
- package/dist/{use-ingredient-select-dialog-BQmyEVZx.js → use-ingredient-select-dialog-CPiX95uf.js} +2 -2
- package/dist/{use-inventory-binding-dialog-BzFcGuKM.js → use-inventory-binding-dialog-CxKLW2Xh.js} +2 -2
- package/dist/{use-template-enabled-locations-CkW-7UVo.js → use-template-enabled-locations-CrwOCxDu.js} +2 -2
- package/dist/{use-transfer-locations-CjrxfaGK.js → use-transfer-locations-CNY1m-5P.js} +2 -2
- package/dist/{useHrmPermission-DcAcggus.js → useHrmPermission-YEdf2QFW.js} +1 -1
- package/dist/{useNavigationMenu-D2tNJzZl.js → useNavigationMenu-Bz5AabkY.js} +2 -2
- package/dist/{useSseClient-D9Xmiz-D.js → useSseClient-BWrz2czP.js} +3 -3
- package/dist/{vue-i18n-BQm9JO9o.js → vue-i18n-DyHvEzel.js} +358 -358
- package/dist/{xlsx-DZYL-v8V.js → xlsx-DQfBpM_Q.js} +1 -1
- package/dist/{xlsx.util-FEXJ9YRM.js → xlsx.util-XLH11fha.js} +3 -3
- package/package.json +3 -3
|
@@ -1,80 +1,80 @@
|
|
|
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
|
|
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 rt, e as
|
|
8
|
-
import { R as
|
|
9
|
-
import { e as lt, a as ht, t as
|
|
10
|
-
import { b as
|
|
11
|
-
import { i as
|
|
12
|
-
import { u as
|
|
13
|
-
import { u as ct } from "./stock-
|
|
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 X, createElementVNode as o, toDisplayString as H, unref as u, createVNode as $, createCommentVNode as K, h as k, watch as ze, renderList as he, onUnmounted as hn, reactive as Et, isRef as _t, normalizeClass as Se, normalizeStyle as Ht, createSlots as kn, Teleport as _n, mergeProps as wn } from "vue";
|
|
2
|
+
import { u as xn, _ as Dn } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DGlWE5I8.js";
|
|
3
|
+
import { useCoreStore as Yt, useI18n as Ye } from "@feedmepos/mf-common";
|
|
4
|
+
import { useSnackbar as Ke, useDialog as An, components as pe, useProxiedModel as Kt, useBreakpoints as Cn } from "@feedmepos/ui-library";
|
|
5
|
+
import { m as Sn, u as We, L as oe, w as te, q as Wt, s as Be, M as _e, B as Te, c as $n, a as wt, j as In } from "./app-D3gm3Lsw.js";
|
|
6
|
+
import { defineStore as qt, storeToRefs as Fn } from "pinia";
|
|
7
|
+
import { b as rt, e as Gt, f as Bn, a as Ce } from "./date2-DJotzNeB.js";
|
|
8
|
+
import { R as Tn } from "./rules-BK8yTx5p.js";
|
|
9
|
+
import { e as lt, a as ht, t as Qt, c as He, l as Zt, m as Jt, j as Xt, k as en, o as ne } from "./number-BfNWSAkN.js";
|
|
10
|
+
import { b as jn, d as Mn } from "./xlsx.util-XLH11fha.js";
|
|
11
|
+
import { i as tn, u as nn } from "./uom-rules-BxHGqiP7.js";
|
|
12
|
+
import { u as Un, a as Rn } from "./useSseClient-BWrz2czP.js";
|
|
13
|
+
import { u as ct } from "./stock-BSA86fOX.js";
|
|
14
|
+
import { D as Lt, R as Ne } from "./row-action.enum-DQ9bJ_uv.js";
|
|
15
|
+
import { c as Pn } from "./component-kqxARxvM.js";
|
|
16
|
+
import { f as Vn } from "./format-time-from-id-gcRrHjjv.js";
|
|
17
|
+
import { f as Nn } from "./recalculationUtils-BVuC0H2j.js";
|
|
18
|
+
import { _ as zn } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-KTtYD7qS.js";
|
|
19
|
+
import { _ as En } 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 Ln } from "./vue-i18n-DyHvEzel.js";
|
|
22
|
+
import { F as On } from "./decimal-BPZo97WQ.js";
|
|
23
|
+
import { r as Hn, u as ot, w as Yn } from "./xlsx-DQfBpM_Q.js";
|
|
24
|
+
import { d as Kn } from "./dayjs.min-DxOA6M7_.js";
|
|
25
|
+
import { F as Wn } from "./FmDroppableField-J0xUsOTV.js";
|
|
26
|
+
import { _ as qn } from "./FmConfirmationButton.vue_vue_type_script_setup_true_lang-DLrMEGFR.js";
|
|
27
|
+
import { _ as Gn, F as at } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
|
|
28
|
+
const qe = Sn((n, l) => {
|
|
29
29
|
function t() {
|
|
30
30
|
return We().currentLocation.dbName;
|
|
31
31
|
}
|
|
32
32
|
return {
|
|
33
33
|
getDbName: t,
|
|
34
|
-
async getDraft(
|
|
35
|
-
const g = t(), i = `${n.inventoryBackendUrl}/${g}/closing-draft/${
|
|
34
|
+
async getDraft(s) {
|
|
35
|
+
const g = t(), i = `${n.inventoryBackendUrl}/${g}/closing-draft/${s}`;
|
|
36
36
|
return l.get(i);
|
|
37
37
|
},
|
|
38
38
|
async readDrafts() {
|
|
39
|
-
const
|
|
39
|
+
const s = t(), g = `${n.inventoryBackendUrl}/${s}/closing-draft`;
|
|
40
40
|
return l.get(g);
|
|
41
41
|
},
|
|
42
|
-
async runOperation(
|
|
42
|
+
async runOperation(s) {
|
|
43
43
|
const g = t(), i = `${n.inventoryBackendUrl}/${g}/closing-draft/run-operation`;
|
|
44
|
-
return l.post(i,
|
|
44
|
+
return l.post(i, s);
|
|
45
45
|
},
|
|
46
|
-
async runOperationV1(
|
|
46
|
+
async runOperationV1(s) {
|
|
47
47
|
const g = t(), i = `${n.inventoryBackendUrl}/${g}/closing-draft/v1/run-operation`;
|
|
48
|
-
return l.post(i,
|
|
48
|
+
return l.post(i, s);
|
|
49
49
|
},
|
|
50
|
-
async sync(
|
|
50
|
+
async sync(s) {
|
|
51
51
|
const g = t(), i = `${n.inventoryBackendUrl}/${g}/closing-draft/sync`;
|
|
52
|
-
return l.post(i,
|
|
52
|
+
return l.post(i, s);
|
|
53
53
|
},
|
|
54
|
-
async cloneDraft(
|
|
55
|
-
const g = t(), i = `${n.inventoryBackendUrl}/${g}/closing-draft/${
|
|
54
|
+
async cloneDraft(s) {
|
|
55
|
+
const g = t(), i = `${n.inventoryBackendUrl}/${g}/closing-draft/${s}/clone`;
|
|
56
56
|
return l.post(i, {});
|
|
57
57
|
},
|
|
58
|
-
async createQuickModeDraftWithItems(
|
|
58
|
+
async createQuickModeDraftWithItems(s) {
|
|
59
59
|
const g = t(), i = `${n.inventoryBackendUrl}/${g}/closing-draft/quick-mode/new-with-items`;
|
|
60
|
-
return l.post(i,
|
|
60
|
+
return l.post(i, s);
|
|
61
61
|
},
|
|
62
|
-
initializeStockSnapshot(
|
|
63
|
-
const i = t(),
|
|
64
|
-
return l.post(
|
|
62
|
+
initializeStockSnapshot(s, g) {
|
|
63
|
+
const i = t(), r = `${n.inventoryBackendUrl}/${i}/closing-draft/${encodeURIComponent(s)}/initialize-stock-snapshot`;
|
|
64
|
+
return l.post(r, { effectiveAt: g });
|
|
65
65
|
},
|
|
66
|
-
async getRefreshBalanceStatus(
|
|
67
|
-
const i = t(),
|
|
68
|
-
return l.get(
|
|
66
|
+
async getRefreshBalanceStatus(s, g) {
|
|
67
|
+
const i = t(), r = `${n.inventoryBackendUrl}/${i}/closing-draft/${s}/refresh-balance/status?closingDraftRevision=${encodeURIComponent(g)}`;
|
|
68
|
+
return l.get(r);
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
|
-
}),
|
|
71
|
+
}), Qn = { class: "fm-typo-en-body-lg-400" }, Zn = { class: "fm-typo-en-body-lg-600" }, Jn = {
|
|
72
72
|
key: 0,
|
|
73
73
|
class: "flex flex-col"
|
|
74
|
-
},
|
|
74
|
+
}, Xn = {
|
|
75
75
|
key: 0,
|
|
76
76
|
class: "fm-typo-en-body-sm-400 text-fm-color-typo-error mt-4"
|
|
77
|
-
},
|
|
77
|
+
}, ea = { class: "flex gap-12 py-8 justify-end w-full" }, bt = /* @__PURE__ */ je({
|
|
78
78
|
__name: "ClosingDraftAction",
|
|
79
79
|
props: {
|
|
80
80
|
draft: {},
|
|
@@ -83,7 +83,7 @@ const qe = $n((n, l) => {
|
|
|
83
83
|
onFinished: { type: Function }
|
|
84
84
|
},
|
|
85
85
|
setup(n) {
|
|
86
|
-
const l = n, t = W(),
|
|
86
|
+
const l = n, t = W(), s = qe(), g = Ke(), i = W(!1), r = W(null), c = W(!1), x = M(() => {
|
|
87
87
|
switch (l.action) {
|
|
88
88
|
case oe.enum.approveDraft:
|
|
89
89
|
return "Approve";
|
|
@@ -106,53 +106,53 @@ const qe = $n((n, l) => {
|
|
|
106
106
|
});
|
|
107
107
|
kt(() => {
|
|
108
108
|
if (l.draft.effectiveAt)
|
|
109
|
-
|
|
109
|
+
r.value = new Date(l.draft.effectiveAt);
|
|
110
110
|
else {
|
|
111
|
-
const
|
|
112
|
-
|
|
111
|
+
const F = new Date(l.draft.createdAt);
|
|
112
|
+
F.setHours(23, 59, 59, 999), r.value = F;
|
|
113
113
|
}
|
|
114
114
|
c.value = !0;
|
|
115
115
|
});
|
|
116
116
|
const f = M({
|
|
117
117
|
get() {
|
|
118
|
-
return
|
|
118
|
+
return r.value === null ? "" : rt(r.value);
|
|
119
119
|
},
|
|
120
|
-
set(
|
|
121
|
-
if (
|
|
122
|
-
const _ = /* @__PURE__ */ new Date(`${
|
|
123
|
-
_.setSeconds(59, 999),
|
|
120
|
+
set(F) {
|
|
121
|
+
if (F) {
|
|
122
|
+
const _ = /* @__PURE__ */ new Date(`${F} ${B.value}`);
|
|
123
|
+
_.setSeconds(59, 999), r.value = _;
|
|
124
124
|
} else
|
|
125
|
-
|
|
125
|
+
r.value = null;
|
|
126
126
|
}
|
|
127
127
|
}), B = M({
|
|
128
128
|
get() {
|
|
129
|
-
return
|
|
129
|
+
return r.value === null ? "" : Gt(r.value);
|
|
130
130
|
},
|
|
131
|
-
set(
|
|
132
|
-
if (
|
|
133
|
-
const _ = /* @__PURE__ */ new Date(`${f.value} ${
|
|
134
|
-
_.setSeconds(59, 999),
|
|
131
|
+
set(F) {
|
|
132
|
+
if (F) {
|
|
133
|
+
const _ = /* @__PURE__ */ new Date(`${f.value} ${F}`);
|
|
134
|
+
_.setSeconds(59, 999), r.value = _;
|
|
135
135
|
} else
|
|
136
|
-
|
|
136
|
+
r.value = null;
|
|
137
137
|
}
|
|
138
|
-
}), N = M(() =>
|
|
139
|
-
async function E(
|
|
138
|
+
}), N = M(() => r.value ? r.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
|
|
139
|
+
async function E(F) {
|
|
140
140
|
i.value = !0;
|
|
141
141
|
try {
|
|
142
|
-
|
|
142
|
+
F ? await s.runOperationV1({
|
|
143
143
|
_id: l.draft._id,
|
|
144
144
|
_rev: l.draft._rev ?? "",
|
|
145
145
|
action: l.action,
|
|
146
146
|
data: {
|
|
147
|
-
effectiveAt:
|
|
147
|
+
effectiveAt: r.value ? r.value.toISOString() : null,
|
|
148
148
|
remark: t.value
|
|
149
149
|
}
|
|
150
|
-
}).delayed(500) : await
|
|
150
|
+
}).delayed(500) : await s.runOperation({
|
|
151
151
|
_id: l.draft._id,
|
|
152
152
|
_rev: l.draft._rev ?? "",
|
|
153
153
|
action: l.action,
|
|
154
154
|
data: {
|
|
155
|
-
effectiveAt:
|
|
155
|
+
effectiveAt: r.value ? r.value.toISOString() : null,
|
|
156
156
|
remark: t.value
|
|
157
157
|
}
|
|
158
158
|
}).delayed(500), g.open({
|
|
@@ -170,7 +170,7 @@ const qe = $n((n, l) => {
|
|
|
170
170
|
i.value = !1;
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
return (
|
|
173
|
+
return (F, _) => {
|
|
174
174
|
const R = Z("FmLabel"), p = Z("FmDatePicker"), v = Z("FmTimePicker"), m = Z("FmTextField"), b = Z("FmButton"), y = Z("FmForm");
|
|
175
175
|
return c.value ? (h(), ae(y, {
|
|
176
176
|
key: 1,
|
|
@@ -178,15 +178,15 @@ const qe = $n((n, l) => {
|
|
|
178
178
|
class: "flex flex-col gap-32",
|
|
179
179
|
disabled: i.value
|
|
180
180
|
}, {
|
|
181
|
-
default:
|
|
182
|
-
|
|
181
|
+
default: X(() => [
|
|
182
|
+
o("div", Qn, [
|
|
183
183
|
_[4] || (_[4] = de(" You are about to ")),
|
|
184
|
-
|
|
184
|
+
o("span", Zn, H(x.value), 1),
|
|
185
185
|
_[5] || (_[5] = de(" this draft. Please provide a remark to justify this action. "))
|
|
186
186
|
]),
|
|
187
|
-
|
|
187
|
+
F.action === u(oe).enum.approveDraft ? (h(), T("div", Jn, [
|
|
188
188
|
$(R, { class: "fm-typo-en-body-lg-600" }, {
|
|
189
|
-
default:
|
|
189
|
+
default: X(() => _[6] || (_[6] = [
|
|
190
190
|
de("Closing Date")
|
|
191
191
|
])),
|
|
192
192
|
_: 1
|
|
@@ -197,7 +197,7 @@ const qe = $n((n, l) => {
|
|
|
197
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:
|
|
200
|
+
default: X(() => _[7] || (_[7] = [
|
|
201
201
|
de("Closing Time")
|
|
202
202
|
])),
|
|
203
203
|
_: 1
|
|
@@ -206,20 +206,20 @@ const qe = $n((n, l) => {
|
|
|
206
206
|
modelValue: B.value,
|
|
207
207
|
"onUpdate:modelValue": _[1] || (_[1] = (w) => B.value = w)
|
|
208
208
|
}, null, 8, ["modelValue"]),
|
|
209
|
-
N.value ? (h(), T("div",
|
|
209
|
+
N.value ? (h(), T("div", Xn, " Cannot select future date ")) : K("", !0)
|
|
210
210
|
])) : K("", !0),
|
|
211
211
|
$(m, {
|
|
212
212
|
modelValue: t.value,
|
|
213
213
|
"onUpdate:modelValue": _[2] || (_[2] = (w) => t.value = w),
|
|
214
214
|
label: "Remark",
|
|
215
215
|
"label-mark": "required",
|
|
216
|
-
rules: [u(
|
|
216
|
+
rules: [u(Tn)()]
|
|
217
217
|
}, null, 8, ["modelValue", "rules"]),
|
|
218
|
-
|
|
218
|
+
o("div", ea, [
|
|
219
219
|
$(b, {
|
|
220
220
|
label: "Cancel",
|
|
221
221
|
variant: "tertiary",
|
|
222
|
-
onClick: _[3] || (_[3] = (w) =>
|
|
222
|
+
onClick: _[3] || (_[3] = (w) => F.onCancel())
|
|
223
223
|
}),
|
|
224
224
|
$(b, {
|
|
225
225
|
label: x.value,
|
|
@@ -235,31 +235,31 @@ const qe = $n((n, l) => {
|
|
|
235
235
|
], 64));
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
|
-
}),
|
|
239
|
-
function
|
|
240
|
-
const l = n.measurementsAmounts.groupBy((
|
|
238
|
+
}), ta = He(0);
|
|
239
|
+
function an(n) {
|
|
240
|
+
const l = n.measurementsAmounts.groupBy((s) => s.measurement.id), t = n.sku.unit.measurements.reduce((s, g) => {
|
|
241
241
|
var c, x;
|
|
242
|
-
const i = ((x = (c = l.get(g.id)) == null ? void 0 : c[0]) == null ? void 0 : x.amount) ??
|
|
243
|
-
return
|
|
242
|
+
const i = ((x = (c = l.get(g.id)) == null ? void 0 : c[0]) == null ? void 0 : x.amount) ?? ta, r = lt(g.conversion, i);
|
|
243
|
+
return s + +ht(r);
|
|
244
244
|
}, +ht(n.baseAmount));
|
|
245
|
-
return
|
|
245
|
+
return Qt(t, n.baseAmount.precision);
|
|
246
246
|
}
|
|
247
|
-
const
|
|
248
|
-
function
|
|
247
|
+
const na = He(0), aa = He(100);
|
|
248
|
+
function oa(n, l, t, s, g, i, r, c) {
|
|
249
249
|
var z, le, P, S, ie;
|
|
250
|
-
const x =
|
|
250
|
+
const x = an(n), A = s ?? x, f = Zt(A, l), B = l.amount === 0 ? null : Jt(f, {
|
|
251
251
|
...l,
|
|
252
252
|
amount: Math.abs(l.amount)
|
|
253
|
-
}), N = B ? lt(B,
|
|
253
|
+
}), N = B ? lt(B, aa) : null, E = ((z = n.sku.defaultCost) == null ? void 0 : z.costPerUnit) ?? { amount: 0, precision: 0 }, F = 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
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 *
|
|
259
|
-
return
|
|
260
|
-
const
|
|
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 * F / R, w = m * F / R, Y = v * F / R, q = {};
|
|
259
|
+
return r && i && r.forEach((L) => {
|
|
260
|
+
const I = { amount: 0, precision: 0 }, Q = i[L];
|
|
261
261
|
if (Q) {
|
|
262
|
-
const se =
|
|
262
|
+
const se = Xt(I, Q);
|
|
263
263
|
q[`adjustment_${L}`] = ht(se);
|
|
264
264
|
} else
|
|
265
265
|
q[`adjustment_${L}`] = "0";
|
|
@@ -270,9 +270,9 @@ function sa(n, l, t, o, g, i, s, c) {
|
|
|
270
270
|
costUnit: ((ie = (S = n.sku.defaultCost) == null ? void 0 : S.measurement) == null ? void 0 : ie.abbrev) ?? null,
|
|
271
271
|
baseUnitAmount: Number(te.toFormatString({ value: n.baseAmount })),
|
|
272
272
|
...t.reduce(
|
|
273
|
-
(L,
|
|
274
|
-
const se = te.toFormatString({ value:
|
|
275
|
-
return L[`measurementAbbrev${Q}`] = `(${
|
|
273
|
+
(L, I, Q) => {
|
|
274
|
+
const se = te.toFormatString({ value: I.conversion }), we = I.orphan ? " [invalid UOM]" : I.inactive ? " [NetSuite-inactive]" : "";
|
|
275
|
+
return L[`measurementAbbrev${Q}`] = `(${I.abbrev}) × ${se}${we}`, L[`measurementAmount${Q}`] = Number(te.toFormatString({ value: I.amount })), L;
|
|
276
276
|
},
|
|
277
277
|
{}
|
|
278
278
|
),
|
|
@@ -281,10 +281,10 @@ function sa(n, l, 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: en(N, 2)
|
|
285
285
|
})
|
|
286
286
|
) : null,
|
|
287
|
-
costPerUnit:
|
|
287
|
+
costPerUnit: F,
|
|
288
288
|
opening: p,
|
|
289
289
|
...q,
|
|
290
290
|
varianceQty: b,
|
|
@@ -293,41 +293,41 @@ function sa(n, l, t, o, g, i, s, c) {
|
|
|
293
293
|
systemValue: Y,
|
|
294
294
|
// Include custom attribute values
|
|
295
295
|
...(c ?? []).reduce(
|
|
296
|
-
(L,
|
|
296
|
+
(L, I) => {
|
|
297
297
|
var se;
|
|
298
|
-
const Q = (se = n.sku.customAttributes) == null ? void 0 : se[
|
|
299
|
-
return L[`customAttr_${
|
|
298
|
+
const Q = (se = n.sku.customAttributes) == null ? void 0 : se[I];
|
|
299
|
+
return L[`customAttr_${I}`] = Q != null ? String(Q) : null, L;
|
|
300
300
|
},
|
|
301
301
|
{}
|
|
302
302
|
)
|
|
303
303
|
};
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function sa(n) {
|
|
306
306
|
let l = 0;
|
|
307
307
|
for (const t of n.values())
|
|
308
308
|
t.length > l && (l = t.length);
|
|
309
309
|
return l;
|
|
310
310
|
}
|
|
311
|
-
function
|
|
311
|
+
function ra(n, l) {
|
|
312
312
|
const t = /* @__PURE__ */ new Map();
|
|
313
|
-
for (const
|
|
314
|
-
if (t.has(
|
|
315
|
-
const g = new Map(
|
|
316
|
-
|
|
317
|
-
),
|
|
318
|
-
for (const c of
|
|
313
|
+
for (const s of n) {
|
|
314
|
+
if (t.has(s.sku._id)) continue;
|
|
315
|
+
const g = new Map(s.sku.unit.measurements.map((c) => [c.id, c])), i = new Map(
|
|
316
|
+
s.measurementsAmounts.map((c) => [c.measurement.id, c.amount])
|
|
317
|
+
), r = [];
|
|
318
|
+
for (const c of s.sku.unit.measurements) {
|
|
319
319
|
const x = i.get(c.id);
|
|
320
|
-
x &&
|
|
320
|
+
x && r.push({
|
|
321
321
|
id: c.id,
|
|
322
322
|
abbrev: c.abbrev,
|
|
323
323
|
conversion: c.conversion,
|
|
324
324
|
amount: x,
|
|
325
|
-
inactive:
|
|
325
|
+
inactive: tn(c, l),
|
|
326
326
|
orphan: !1
|
|
327
327
|
});
|
|
328
328
|
}
|
|
329
|
-
for (const c of
|
|
330
|
-
g.has(c.measurement.id) ||
|
|
329
|
+
for (const c of s.measurementsAmounts)
|
|
330
|
+
g.has(c.measurement.id) || r.push({
|
|
331
331
|
id: c.measurement.id,
|
|
332
332
|
abbrev: c.measurement.abbrev,
|
|
333
333
|
conversion: c.measurement.conversion,
|
|
@@ -335,12 +335,12 @@ function la(n, l) {
|
|
|
335
335
|
inactive: !1,
|
|
336
336
|
orphan: !0
|
|
337
337
|
});
|
|
338
|
-
t.set(
|
|
338
|
+
t.set(s.sku._id, r);
|
|
339
339
|
}
|
|
340
340
|
return t;
|
|
341
341
|
}
|
|
342
|
-
function
|
|
343
|
-
const
|
|
342
|
+
function la(n, l = [], t = []) {
|
|
343
|
+
const s = Wt(), g = s === "MYR" ? "RM" : s;
|
|
344
344
|
return [
|
|
345
345
|
{
|
|
346
346
|
id: "code",
|
|
@@ -367,9 +367,9 @@ function ia(n, l = [], t = []) {
|
|
|
367
367
|
name: "Opening (B/F)"
|
|
368
368
|
},
|
|
369
369
|
// Dynamic adjustment type columns
|
|
370
|
-
...l.map((
|
|
371
|
-
id: `adjustment_${
|
|
372
|
-
name: Be(
|
|
370
|
+
...l.map((r) => ({
|
|
371
|
+
id: `adjustment_${r}`,
|
|
372
|
+
name: Be(r)
|
|
373
373
|
})),
|
|
374
374
|
{
|
|
375
375
|
id: "systemBalance",
|
|
@@ -403,7 +403,7 @@ function ia(n, l = [], t = []) {
|
|
|
403
403
|
id: "baseUnitAmount",
|
|
404
404
|
name: "Base unit amount"
|
|
405
405
|
},
|
|
406
|
-
...Array.from({ length: n }).flatMap((
|
|
406
|
+
...Array.from({ length: n }).flatMap((r, c) => [
|
|
407
407
|
{
|
|
408
408
|
id: `measurementAmount${c}`,
|
|
409
409
|
name: `UOM amount ${c + 1}`
|
|
@@ -414,46 +414,46 @@ function ia(n, l = [], t = []) {
|
|
|
414
414
|
}
|
|
415
415
|
]),
|
|
416
416
|
// Dynamic custom attribute columns
|
|
417
|
-
...t.map((
|
|
418
|
-
id: `customAttr_${
|
|
419
|
-
name: Be(
|
|
417
|
+
...t.map((r) => ({
|
|
418
|
+
id: `customAttr_${r}`,
|
|
419
|
+
name: Be(r)
|
|
420
420
|
}))
|
|
421
421
|
];
|
|
422
422
|
}
|
|
423
|
-
function
|
|
423
|
+
function ia(n, l, t, s = [], g) {
|
|
424
424
|
var re, z, le, P, S, ie, L;
|
|
425
425
|
const i = l.groupBy(
|
|
426
|
-
(
|
|
427
|
-
(
|
|
428
|
-
),
|
|
429
|
-
(
|
|
430
|
-
(
|
|
426
|
+
(I) => I.id,
|
|
427
|
+
(I) => I.balance
|
|
428
|
+
), r = t.groupBy(
|
|
429
|
+
(I) => I.id,
|
|
430
|
+
(I) => I.balance
|
|
431
431
|
), c = /* @__PURE__ */ new Map();
|
|
432
432
|
if (n.opening)
|
|
433
|
-
for (const
|
|
434
|
-
c.set(
|
|
433
|
+
for (const I of n.opening)
|
|
434
|
+
c.set(I.skuId, I.balance);
|
|
435
435
|
const x = /* @__PURE__ */ new Set(), A = /* @__PURE__ */ new Map();
|
|
436
436
|
if (n.adjustmentSnapshot)
|
|
437
|
-
for (const
|
|
438
|
-
|
|
437
|
+
for (const I of n.adjustmentSnapshot)
|
|
438
|
+
I.adjustmentsByType && (Object.keys(I.adjustmentsByType).forEach((Q) => x.add(Q)), A.set(I.skuId, I.adjustmentsByType));
|
|
439
439
|
const f = ["receive", "sales", "wastage"], B = [];
|
|
440
|
-
f.forEach((
|
|
441
|
-
x.has(
|
|
440
|
+
f.forEach((I) => {
|
|
441
|
+
x.has(I) && (B.push(I), x.delete(I));
|
|
442
442
|
});
|
|
443
|
-
const N = Array.from(x).sort(), E = [...B, ...N],
|
|
443
|
+
const N = Array.from(x).sort(), E = [...B, ...N], F = [...n.items, ...n.negativeStockItems ?? []], R = Yt().currentBusiness.value, p = ra(F, g), v = F.map((I) => {
|
|
444
444
|
var De, $e;
|
|
445
|
-
const Q = ((De = i.get(
|
|
446
|
-
return
|
|
447
|
-
|
|
445
|
+
const Q = ((De = i.get(I.sku._id)) == null ? void 0 : De[0]) ?? na, se = p.get(I.sku._id) ?? [], we = c.get(I.sku._id), xe = A.get(I.sku._id);
|
|
446
|
+
return oa(
|
|
447
|
+
I,
|
|
448
448
|
Q,
|
|
449
449
|
se,
|
|
450
|
-
($e =
|
|
450
|
+
($e = r.get(I.sku._id)) == null ? void 0 : $e[0],
|
|
451
451
|
we,
|
|
452
452
|
xe,
|
|
453
453
|
E,
|
|
454
|
-
|
|
454
|
+
s
|
|
455
455
|
);
|
|
456
|
-
}), m =
|
|
456
|
+
}), m = sa(p), b = la(m, E, s), 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],
|
|
@@ -475,15 +475,15 @@ function ca(n, l, t, o = [], g) {
|
|
|
475
475
|
n.approvedAt ? n.approveRemark : n.rejectionHistory ? new Date((L = n.rejectionHistory[0]) == null ? void 0 : L.rejectRemark) : ""
|
|
476
476
|
],
|
|
477
477
|
[],
|
|
478
|
-
b.map((
|
|
479
|
-
...v.map((
|
|
480
|
-
], w = b.map((
|
|
481
|
-
return
|
|
478
|
+
b.map((I) => I.name),
|
|
479
|
+
...v.map((I) => b.map((Q) => I[Q.id]))
|
|
480
|
+
], w = b.map((I) => `system:${I.id}`), Y = jn(y, w), q = `[${R == null ? void 0 : R.name}] closing draft (${Bn(new Date(n.updatedAt))}).xlsx`;
|
|
481
|
+
return Mn(Y, q), q;
|
|
482
482
|
}
|
|
483
|
-
const
|
|
483
|
+
const ca = { class: "flex flex-col" }, ua = {
|
|
484
484
|
key: 0,
|
|
485
485
|
class: "fm-typo-en-body-sm-400 text-fm-color-typo-error mt-4"
|
|
486
|
-
},
|
|
486
|
+
}, da = { class: "flex gap-12 py-8 justify-end w-full" }, ma = /* @__PURE__ */ je({
|
|
487
487
|
__name: "RefreshBalanceAction",
|
|
488
488
|
props: {
|
|
489
489
|
draft: {},
|
|
@@ -493,66 +493,66 @@ const ua = { class: "flex flex-col" }, da = {
|
|
|
493
493
|
setup(n) {
|
|
494
494
|
const l = n;
|
|
495
495
|
ct();
|
|
496
|
-
const t = W(!1),
|
|
496
|
+
const t = W(!1), s = W(null), g = W(!1);
|
|
497
497
|
kt(() => {
|
|
498
498
|
if (l.draft.effectiveAt)
|
|
499
|
-
|
|
499
|
+
s.value = new Date(l.draft.effectiveAt);
|
|
500
500
|
else {
|
|
501
501
|
const A = new Date(l.draft.createdAt);
|
|
502
|
-
A.setHours(23, 59, 59, 999),
|
|
502
|
+
A.setHours(23, 59, 59, 999), s.value = A;
|
|
503
503
|
}
|
|
504
504
|
g.value = !0;
|
|
505
505
|
});
|
|
506
506
|
const i = M({
|
|
507
507
|
get() {
|
|
508
|
-
return
|
|
508
|
+
return s.value === null ? "" : rt(s.value);
|
|
509
509
|
},
|
|
510
510
|
set(A) {
|
|
511
511
|
if (A) {
|
|
512
|
-
const f = /* @__PURE__ */ new Date(`${A} ${
|
|
513
|
-
f.setSeconds(59, 999),
|
|
512
|
+
const f = /* @__PURE__ */ new Date(`${A} ${r.value}`);
|
|
513
|
+
f.setSeconds(59, 999), s.value = f;
|
|
514
514
|
} else
|
|
515
|
-
|
|
515
|
+
s.value = null;
|
|
516
516
|
}
|
|
517
|
-
}),
|
|
517
|
+
}), r = M({
|
|
518
518
|
get() {
|
|
519
|
-
return
|
|
519
|
+
return s.value === null ? "" : Gt(s.value);
|
|
520
520
|
},
|
|
521
521
|
set(A) {
|
|
522
522
|
if (A) {
|
|
523
523
|
const f = /* @__PURE__ */ new Date(`${i.value} ${A}`);
|
|
524
|
-
f.setSeconds(59, 999),
|
|
524
|
+
f.setSeconds(59, 999), s.value = f;
|
|
525
525
|
} else
|
|
526
|
-
|
|
526
|
+
s.value = null;
|
|
527
527
|
}
|
|
528
|
-
}), c = M(() =>
|
|
528
|
+
}), c = M(() => s.value ? s.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
|
|
529
529
|
async function x() {
|
|
530
|
-
t.value = !0, l.onFinished(
|
|
530
|
+
t.value = !0, l.onFinished(s.value.toISOString());
|
|
531
531
|
}
|
|
532
532
|
return (A, f) => {
|
|
533
|
-
const B = Z("FmLabel"), N = Z("FmDatePicker"), E = Z("FmTimePicker"),
|
|
533
|
+
const B = Z("FmLabel"), N = Z("FmDatePicker"), E = Z("FmTimePicker"), F = Z("FmButton"), _ = Z("FmForm");
|
|
534
534
|
return g.value ? (h(), ae(_, {
|
|
535
535
|
key: 1,
|
|
536
536
|
onValidationSuccess: x,
|
|
537
537
|
class: "flex flex-col gap-32",
|
|
538
538
|
disabled: t.value
|
|
539
539
|
}, {
|
|
540
|
-
default:
|
|
541
|
-
f[5] || (f[5] =
|
|
542
|
-
|
|
540
|
+
default: X(() => [
|
|
541
|
+
f[5] || (f[5] = o("div", { class: "fm-typo-en-body-lg-400" }, [
|
|
542
|
+
o("p", null, [
|
|
543
543
|
de(" Performing "),
|
|
544
|
-
|
|
544
|
+
o("span", { class: "fm-typo-en-body-lg-600" }, '"Refresh Balance"'),
|
|
545
545
|
de(" until closing effective date and time. ")
|
|
546
546
|
]),
|
|
547
|
-
|
|
547
|
+
o("p", { class: "mt-2" }, [
|
|
548
548
|
de(" Please note that this action will "),
|
|
549
|
-
|
|
549
|
+
o("b", null, "update"),
|
|
550
550
|
de(" the effective date and time. ")
|
|
551
551
|
])
|
|
552
552
|
], -1)),
|
|
553
|
-
|
|
553
|
+
o("div", ca, [
|
|
554
554
|
$(B, { class: "fm-typo-en-body-lg-600" }, {
|
|
555
|
-
default:
|
|
555
|
+
default: X(() => f[3] || (f[3] = [
|
|
556
556
|
de("Closing Date")
|
|
557
557
|
])),
|
|
558
558
|
_: 1
|
|
@@ -563,24 +563,24 @@ const ua = { class: "flex flex-col" }, da = {
|
|
|
563
563
|
max: u(rt)(/* @__PURE__ */ new Date())
|
|
564
564
|
}, null, 8, ["modelValue", "max"]),
|
|
565
565
|
$(B, { class: "fm-typo-en-body-lg-600" }, {
|
|
566
|
-
default:
|
|
566
|
+
default: X(() => f[4] || (f[4] = [
|
|
567
567
|
de("Closing Time")
|
|
568
568
|
])),
|
|
569
569
|
_: 1
|
|
570
570
|
}),
|
|
571
571
|
$(E, {
|
|
572
|
-
modelValue:
|
|
573
|
-
"onUpdate:modelValue": f[1] || (f[1] = (R) =>
|
|
572
|
+
modelValue: r.value,
|
|
573
|
+
"onUpdate:modelValue": f[1] || (f[1] = (R) => r.value = R)
|
|
574
574
|
}, null, 8, ["modelValue"]),
|
|
575
|
-
c.value ? (h(), T("div",
|
|
575
|
+
c.value ? (h(), T("div", ua, " Cannot select future date ")) : K("", !0)
|
|
576
576
|
]),
|
|
577
|
-
|
|
578
|
-
$(
|
|
577
|
+
o("div", da, [
|
|
578
|
+
$(F, {
|
|
579
579
|
label: "Cancel",
|
|
580
580
|
variant: "tertiary",
|
|
581
581
|
onClick: f[2] || (f[2] = (R) => A.onCancel())
|
|
582
582
|
}),
|
|
583
|
-
$(
|
|
583
|
+
$(F, {
|
|
584
584
|
label: "Refresh balance",
|
|
585
585
|
type: "submit",
|
|
586
586
|
variant: "primary",
|
|
@@ -595,10 +595,10 @@ const ua = { class: "flex flex-col" }, da = {
|
|
|
595
595
|
], 64));
|
|
596
596
|
};
|
|
597
597
|
}
|
|
598
|
-
}), it =
|
|
598
|
+
}), it = qt(
|
|
599
599
|
"closingDraftActions",
|
|
600
600
|
function() {
|
|
601
|
-
const l =
|
|
601
|
+
const l = An(), t = Ke(), s = ct(), g = qe(), i = Un(), r = nn(), c = W(!1), x = W();
|
|
602
602
|
function A(b) {
|
|
603
603
|
const y = {
|
|
604
604
|
draft: b
|
|
@@ -617,7 +617,7 @@ const ua = { class: "flex flex-col" }, da = {
|
|
|
617
617
|
}), console.error("Closing draft is completed but closing document cannot be found.", {
|
|
618
618
|
draftId: b._id
|
|
619
619
|
}), [];
|
|
620
|
-
const q = await
|
|
620
|
+
const q = await s.readAdjustmentById(Y);
|
|
621
621
|
return ((q == null ? void 0 : q.skus) ?? []).map((z) => ({
|
|
622
622
|
id: z.sku._id,
|
|
623
623
|
balance: z.fromBalance,
|
|
@@ -630,12 +630,12 @@ const ua = { class: "flex flex-col" }, da = {
|
|
|
630
630
|
y || (t.open({
|
|
631
631
|
title: "Exporting",
|
|
632
632
|
message: "Fetching data..."
|
|
633
|
-
}), y = await f(b)),
|
|
633
|
+
}), y = await f(b)), ia(
|
|
634
634
|
b,
|
|
635
635
|
y,
|
|
636
636
|
w ?? [],
|
|
637
637
|
Y ?? [],
|
|
638
|
-
|
|
638
|
+
r.value
|
|
639
639
|
);
|
|
640
640
|
}
|
|
641
641
|
function N(b, y, w) {
|
|
@@ -670,7 +670,7 @@ const ua = { class: "flex flex-col" }, da = {
|
|
|
670
670
|
}
|
|
671
671
|
});
|
|
672
672
|
}
|
|
673
|
-
function
|
|
673
|
+
function F(b, y) {
|
|
674
674
|
l.open({
|
|
675
675
|
title: "Mark draft as failed",
|
|
676
676
|
contentComponent: bt,
|
|
@@ -704,7 +704,7 @@ const ua = { class: "flex flex-col" }, da = {
|
|
|
704
704
|
async function p(b, y, w) {
|
|
705
705
|
await l.open({
|
|
706
706
|
title: "Refresh balance",
|
|
707
|
-
contentComponent:
|
|
707
|
+
contentComponent: ma,
|
|
708
708
|
contentComponentProps: {
|
|
709
709
|
draft: b,
|
|
710
710
|
onFinished: (Y) => {
|
|
@@ -723,7 +723,7 @@ const ua = { class: "flex flex-col" }, da = {
|
|
|
723
723
|
primaryActions: { text: "Proceed", close: !0 },
|
|
724
724
|
secondaryActions: { text: "Cancel", close: !0 }
|
|
725
725
|
}).onPrimary(async () => {
|
|
726
|
-
await
|
|
726
|
+
await s.recalculation.scheduleInvalidateClosingDraftCache([b._id]), t.open({
|
|
727
727
|
title: "Success",
|
|
728
728
|
message: "Invalidate cache requested",
|
|
729
729
|
type: "success"
|
|
@@ -753,7 +753,7 @@ const ua = { class: "flex flex-col" }, da = {
|
|
|
753
753
|
closeDraftDialog: R,
|
|
754
754
|
approveDraft: N,
|
|
755
755
|
rejectDraft: E,
|
|
756
|
-
markAsFailed:
|
|
756
|
+
markAsFailed: F,
|
|
757
757
|
syncDraft: _,
|
|
758
758
|
exportDraft: B,
|
|
759
759
|
refreshBalance: p,
|
|
@@ -776,26 +776,26 @@ function st(n) {
|
|
|
776
776
|
return "fm-status-badge-complete";
|
|
777
777
|
}
|
|
778
778
|
}
|
|
779
|
-
const
|
|
779
|
+
const on = qt(
|
|
780
780
|
"closingDraftTable",
|
|
781
781
|
function() {
|
|
782
|
-
const { t: l } = Ye(), t =
|
|
782
|
+
const { t: l } = Ye(), t = Yt(), s = it(), g = W(new Array()), i = W(0), r = W(!1), c = We(), x = qe();
|
|
783
783
|
async function A() {
|
|
784
784
|
if (g.value = [], !!c._currentLocation) {
|
|
785
|
-
|
|
785
|
+
r.value = !0;
|
|
786
786
|
try {
|
|
787
787
|
const [p] = await Promise.all([x.readDrafts()]).delayed(1e3);
|
|
788
788
|
g.value = B(p.reverse());
|
|
789
789
|
} catch (p) {
|
|
790
790
|
console.log("Something went wrong when fetching drafts:", p);
|
|
791
791
|
} finally {
|
|
792
|
-
|
|
792
|
+
r.value = !1;
|
|
793
793
|
}
|
|
794
794
|
}
|
|
795
795
|
}
|
|
796
796
|
async function f(p) {
|
|
797
797
|
if (!g.value.find((v) => v._id) && c._currentLocation) {
|
|
798
|
-
|
|
798
|
+
r.value = !0;
|
|
799
799
|
try {
|
|
800
800
|
const [v] = await Promise.all([
|
|
801
801
|
x.getDraft(p),
|
|
@@ -805,12 +805,12 @@ const rn = Qt(
|
|
|
805
805
|
} catch (v) {
|
|
806
806
|
console.log("Something went wrong when fetching drafts:", v);
|
|
807
807
|
} finally {
|
|
808
|
-
|
|
808
|
+
r.value = !1;
|
|
809
809
|
}
|
|
810
810
|
}
|
|
811
811
|
}
|
|
812
812
|
function B(p) {
|
|
813
|
-
const v =
|
|
813
|
+
const v = Nn(
|
|
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) => ({
|
|
@@ -830,23 +830,23 @@ const rn = Qt(
|
|
|
830
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
|
-
function
|
|
834
|
-
|
|
833
|
+
function F() {
|
|
834
|
+
s.closeDraftDialog(), A();
|
|
835
835
|
}
|
|
836
836
|
function _(p, v) {
|
|
837
|
-
switch (v =
|
|
837
|
+
switch (v = $n(v), p) {
|
|
838
838
|
case Ne.Details:
|
|
839
|
-
return
|
|
839
|
+
return s.viewDraft(v);
|
|
840
840
|
case Ne.Export:
|
|
841
|
-
return
|
|
841
|
+
return s.exportDraft(v);
|
|
842
842
|
case oe.enum.approveDraft:
|
|
843
|
-
return
|
|
843
|
+
return s.approveDraft(v, F);
|
|
844
844
|
case oe.enum.rejectDraft:
|
|
845
|
-
return
|
|
845
|
+
return s.rejectDraft(v, F);
|
|
846
846
|
case oe.enum.markAsFailed:
|
|
847
|
-
return
|
|
847
|
+
return s.markAsFailed(v, F);
|
|
848
848
|
case Ne.Duplicate:
|
|
849
|
-
return
|
|
849
|
+
return s.cloneDraft(v, F);
|
|
850
850
|
}
|
|
851
851
|
}
|
|
852
852
|
return {
|
|
@@ -856,7 +856,7 @@ const rn = Qt(
|
|
|
856
856
|
accessorKey: "_id",
|
|
857
857
|
header: () => l("inventory.closing.table.createdAt"),
|
|
858
858
|
cell(p) {
|
|
859
|
-
return
|
|
859
|
+
return Vn(`${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
|
|
@@ -988,8 +988,8 @@ const rn = 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
|
+
Lt[Ne.Details],
|
|
992
|
+
Lt[Ne.Export]
|
|
993
993
|
], y = [
|
|
994
994
|
{
|
|
995
995
|
translationKey: "inventory.closing.draft.approveDraft",
|
|
@@ -1013,7 +1013,7 @@ const rn = Qt(
|
|
|
1013
1013
|
value: Ne.Duplicate
|
|
1014
1014
|
}
|
|
1015
1015
|
] : [];
|
|
1016
|
-
return
|
|
1016
|
+
return Pn(
|
|
1017
1017
|
[
|
|
1018
1018
|
...b,
|
|
1019
1019
|
...v.status === _e.enum.DRAFT ? y : []
|
|
@@ -1031,23 +1031,23 @@ const rn = Qt(
|
|
|
1031
1031
|
}
|
|
1032
1032
|
],
|
|
1033
1033
|
drafts: g,
|
|
1034
|
-
loading:
|
|
1034
|
+
loading: r,
|
|
1035
1035
|
tableKey: i,
|
|
1036
1036
|
fetchDrafts: A,
|
|
1037
1037
|
loadDraft: f,
|
|
1038
1038
|
updateDraftRef: N
|
|
1039
1039
|
};
|
|
1040
1040
|
}
|
|
1041
|
-
),
|
|
1041
|
+
), fa = { class: "fm-typo-en-heading-lg-600" }, pa = { class: "py-4" }, va = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, ya = { key: 0 }, ga = { class: "mt-4 flex gap-4" }, ba = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, ha = { key: 0 }, ka = {
|
|
1042
1042
|
key: 0,
|
|
1043
1043
|
class: "mb-4"
|
|
1044
|
-
},
|
|
1044
|
+
}, _a = { class: "flex flex-col gap-1 max-h-200 overflow-auto w-full" }, wa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, xa = {
|
|
1045
1045
|
key: 0,
|
|
1046
1046
|
class: "text-fm-color-system-success-300 mr-1"
|
|
1047
|
-
},
|
|
1047
|
+
}, Da = {
|
|
1048
1048
|
key: 1,
|
|
1049
1049
|
class: "text-fm-color-system-error-300 mr-1"
|
|
1050
|
-
},
|
|
1050
|
+
}, Aa = { class: "fm-typo-en-body-md-400" }, Ca = { class: "mt-4 flex gap-4" }, Sa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, $a = {
|
|
1051
1051
|
key: 0,
|
|
1052
1052
|
class: "flex gap-4"
|
|
1053
1053
|
}, Ia = /* @__PURE__ */ je({
|
|
@@ -1060,18 +1060,18 @@ const rn = Qt(
|
|
|
1060
1060
|
},
|
|
1061
1061
|
emits: ["update:show", "refresh", "approve"],
|
|
1062
1062
|
setup(n, { emit: l }) {
|
|
1063
|
-
const { FmStepper: t, FmStep:
|
|
1063
|
+
const { FmStepper: t, FmStep: s, FmDialog: g, FmButton: i } = pe, { t: r } = Ln(), 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;
|
|
1067
1067
|
}
|
|
1068
1068
|
), B = M(() => {
|
|
1069
|
-
var ie, L,
|
|
1069
|
+
var ie, L, I;
|
|
1070
1070
|
const P = ((ie = x.draft) == null ? void 0 : ie.items.map((Q) => ({
|
|
1071
1071
|
id: Q.sku._id,
|
|
1072
1072
|
code: Q.sku.code,
|
|
1073
1073
|
name: Q.sku.name
|
|
1074
|
-
}))) ?? [], S = ((
|
|
1074
|
+
}))) ?? [], S = ((I = (L = x.draft) == null ? void 0 : L.negativeStockItems) == null ? void 0 : I.map((Q) => ({
|
|
1075
1075
|
id: Q.sku._id,
|
|
1076
1076
|
code: Q.sku.code,
|
|
1077
1077
|
name: Q.sku.name
|
|
@@ -1084,18 +1084,18 @@ const rn = Qt(
|
|
|
1084
1084
|
() => {
|
|
1085
1085
|
var P, S, ie;
|
|
1086
1086
|
return (((ie = (S = (P = x.draft) == null ? void 0 : P.stockSnapshot) == null ? void 0 : S.filter((L) => L.balance.amount < 0)) == null ? void 0 : ie.map((L) => {
|
|
1087
|
-
const
|
|
1088
|
-
return
|
|
1089
|
-
id:
|
|
1090
|
-
code:
|
|
1091
|
-
name:
|
|
1087
|
+
const I = c.skuById[L.id];
|
|
1088
|
+
return I ? {
|
|
1089
|
+
id: I._id,
|
|
1090
|
+
code: I.code,
|
|
1091
|
+
name: I.name
|
|
1092
1092
|
} : null;
|
|
1093
1093
|
})) ?? []).filter((L) => L !== null);
|
|
1094
1094
|
}
|
|
1095
1095
|
), E = M(() => {
|
|
1096
1096
|
var P;
|
|
1097
1097
|
return f.value ? ((P = N.value) == null ? void 0 : P.filter((S) => !B.value[S.id]).map((S) => S.id)) ?? [] : [];
|
|
1098
|
-
}),
|
|
1098
|
+
}), F = 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;
|
|
@@ -1147,40 +1147,40 @@ const rn = Qt(
|
|
|
1147
1147
|
return (P, S) => {
|
|
1148
1148
|
const ie = Z("FmIcon");
|
|
1149
1149
|
return h(), ae(u(g), {
|
|
1150
|
-
modelValue:
|
|
1151
|
-
"onUpdate:modelValue": S[1] || (S[1] = (L) =>
|
|
1150
|
+
modelValue: F.value,
|
|
1151
|
+
"onUpdate:modelValue": S[1] || (S[1] = (L) => F.value = L),
|
|
1152
1152
|
"max-width": 600
|
|
1153
1153
|
}, {
|
|
1154
|
-
"dialog-header":
|
|
1155
|
-
|
|
1154
|
+
"dialog-header": X(() => [
|
|
1155
|
+
o("div", fa, H(u(r)("inventory.closing.approval.title")), 1)
|
|
1156
1156
|
]),
|
|
1157
|
-
default:
|
|
1158
|
-
|
|
1157
|
+
default: X(() => [
|
|
1158
|
+
o("div", pa, [
|
|
1159
1159
|
$(u(t), {
|
|
1160
1160
|
modelValue: _.value,
|
|
1161
1161
|
"onUpdate:modelValue": S[0] || (S[0] = (L) => _.value = L),
|
|
1162
1162
|
orientation: "vertical"
|
|
1163
1163
|
}, {
|
|
1164
|
-
default:
|
|
1165
|
-
$(u(
|
|
1164
|
+
default: X(() => [
|
|
1165
|
+
$(u(s), {
|
|
1166
1166
|
value: 1,
|
|
1167
|
-
title: u(
|
|
1167
|
+
title: u(r)("inventory.closing.approval.step.generateReport.title"),
|
|
1168
1168
|
complete: R
|
|
1169
1169
|
}, {
|
|
1170
|
-
default:
|
|
1171
|
-
|
|
1172
|
-
_.value === 1 ? (h(), T("div",
|
|
1170
|
+
default: X(() => [
|
|
1171
|
+
o("div", va, H(u(r)("inventory.closing.approval.step.generateReport.description")), 1),
|
|
1172
|
+
_.value === 1 ? (h(), T("div", ya, [
|
|
1173
1173
|
$(u(i), {
|
|
1174
|
-
label: u(
|
|
1174
|
+
label: u(r)("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
1179
|
onClick: q
|
|
1180
1180
|
}, null, 8, ["label", "loading", "disabled"]),
|
|
1181
|
-
|
|
1181
|
+
o("div", ga, [
|
|
1182
1182
|
$(u(i), {
|
|
1183
|
-
label: u(
|
|
1183
|
+
label: u(r)("inventory.common.continue"),
|
|
1184
1184
|
disabled: !f.value,
|
|
1185
1185
|
onClick: re
|
|
1186
1186
|
}, null, 8, ["label", "disabled"])
|
|
@@ -1189,29 +1189,29 @@ const rn = Qt(
|
|
|
1189
1189
|
]),
|
|
1190
1190
|
_: 1
|
|
1191
1191
|
}, 8, ["title"]),
|
|
1192
|
-
$(u(
|
|
1192
|
+
$(u(s), {
|
|
1193
1193
|
value: 2,
|
|
1194
|
-
title: u(
|
|
1194
|
+
title: u(r)("inventory.closing.approval.step.negativeItems.title"),
|
|
1195
1195
|
disabled: () => !f.value,
|
|
1196
1196
|
complete: p
|
|
1197
1197
|
}, {
|
|
1198
|
-
default:
|
|
1199
|
-
|
|
1200
|
-
_.value === 2 ? (h(), T("div",
|
|
1201
|
-
N.value.length > 0 ? (h(), T("div",
|
|
1202
|
-
S[2] || (S[2] =
|
|
1203
|
-
|
|
1198
|
+
default: X(() => [
|
|
1199
|
+
o("div", ba, H(N.value.length > 0 ? `${u(r)("inventory.closing.approval.step.negativeItems.resolveMessage")} [${u(r)("inventory.closing.approval.step.negativeItems.itemsHeader")} (${E.value.length})]` : u(r)("inventory.closing.approval.step.negativeItems.noItemsMessage")), 1),
|
|
1200
|
+
_.value === 2 ? (h(), T("div", ha, [
|
|
1201
|
+
N.value.length > 0 ? (h(), T("div", ka, [
|
|
1202
|
+
S[2] || (S[2] = o("div", { class: "fm-typo-en-body-md-600 mb-2" }, null, -1)),
|
|
1203
|
+
o("div", _a, [
|
|
1204
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
|
-
|
|
1209
|
-
B.value[L.id] ? (h(), T("span",
|
|
1208
|
+
o("div", wa, [
|
|
1209
|
+
B.value[L.id] ? (h(), T("span", xa, [
|
|
1210
1210
|
$(ie, {
|
|
1211
1211
|
name: "check_circle",
|
|
1212
1212
|
size: "sm"
|
|
1213
1213
|
})
|
|
1214
|
-
])) : (h(), T("span",
|
|
1214
|
+
])) : (h(), T("span", Da, [
|
|
1215
1215
|
$(ie, {
|
|
1216
1216
|
name: "error",
|
|
1217
1217
|
size: "sm"
|
|
@@ -1219,18 +1219,18 @@ const rn = Qt(
|
|
|
1219
1219
|
])),
|
|
1220
1220
|
de(" " + H(L.code), 1)
|
|
1221
1221
|
]),
|
|
1222
|
-
|
|
1222
|
+
o("div", Aa, H(L.name), 1)
|
|
1223
1223
|
]))), 128))
|
|
1224
1224
|
])
|
|
1225
1225
|
])) : K("", !0),
|
|
1226
|
-
|
|
1226
|
+
o("div", Ca, [
|
|
1227
1227
|
$(u(i), {
|
|
1228
|
-
label: u(
|
|
1228
|
+
label: u(r)("inventory.common.back"),
|
|
1229
1229
|
variant: "secondary",
|
|
1230
1230
|
onClick: z
|
|
1231
1231
|
}, null, 8, ["label"]),
|
|
1232
1232
|
$(u(i), {
|
|
1233
|
-
label: u(
|
|
1233
|
+
label: u(r)("inventory.common.continue"),
|
|
1234
1234
|
disabled: b.value,
|
|
1235
1235
|
onClick: re
|
|
1236
1236
|
}, null, 8, ["label", "disabled"])
|
|
@@ -1239,22 +1239,22 @@ const rn = Qt(
|
|
|
1239
1239
|
]),
|
|
1240
1240
|
_: 1
|
|
1241
1241
|
}, 8, ["title", "disabled"]),
|
|
1242
|
-
$(u(
|
|
1242
|
+
$(u(s), {
|
|
1243
1243
|
value: 3,
|
|
1244
|
-
title: u(
|
|
1244
|
+
title: u(r)("inventory.closing.approval.step.approval.title"),
|
|
1245
1245
|
disabled: () => b.value,
|
|
1246
1246
|
complete: v
|
|
1247
1247
|
}, {
|
|
1248
|
-
default:
|
|
1249
|
-
|
|
1250
|
-
_.value === 3 ? (h(), T("div",
|
|
1248
|
+
default: X(() => [
|
|
1249
|
+
o("div", Sa, H(u(r)("inventory.closing.approval.step.approval.warning")), 1),
|
|
1250
|
+
_.value === 3 ? (h(), T("div", $a, [
|
|
1251
1251
|
$(u(i), {
|
|
1252
|
-
label: u(
|
|
1252
|
+
label: u(r)("inventory.common.back"),
|
|
1253
1253
|
variant: "secondary",
|
|
1254
1254
|
onClick: z
|
|
1255
1255
|
}, null, 8, ["label"]),
|
|
1256
1256
|
$(u(i), {
|
|
1257
|
-
label: u(
|
|
1257
|
+
label: u(r)("inventory.common.approve"),
|
|
1258
1258
|
variant: "destructive",
|
|
1259
1259
|
disabled: b.value,
|
|
1260
1260
|
loading: P.approving,
|
|
@@ -1274,8 +1274,8 @@ const rn = Qt(
|
|
|
1274
1274
|
};
|
|
1275
1275
|
}
|
|
1276
1276
|
});
|
|
1277
|
-
function
|
|
1278
|
-
const l = qe(), t =
|
|
1277
|
+
function Fa(n) {
|
|
1278
|
+
const l = qe(), t = Rn(), s = Ke(), { t: g } = Ye(), i = W(!1), r = W(null);
|
|
1279
1279
|
let c = !1, x = null, A = !1, f = !1;
|
|
1280
1280
|
function B() {
|
|
1281
1281
|
R();
|
|
@@ -1303,11 +1303,11 @@ function Ba(n) {
|
|
|
1303
1303
|
async function E(m) {
|
|
1304
1304
|
var b;
|
|
1305
1305
|
if (c || !m) {
|
|
1306
|
-
|
|
1306
|
+
r.value = m, i.value = !1;
|
|
1307
1307
|
return;
|
|
1308
1308
|
}
|
|
1309
1309
|
if (!(m.closingDraftId && m.closingDraftId !== n.closingDraftId.value)) {
|
|
1310
|
-
if (
|
|
1310
|
+
if (r.value = m, m.message === "processing" || !m.completedAt && !m.message) {
|
|
1311
1311
|
A = !0, i.value = !0;
|
|
1312
1312
|
return;
|
|
1313
1313
|
}
|
|
@@ -1316,17 +1316,17 @@ function Ba(n) {
|
|
|
1316
1316
|
i.value = !1;
|
|
1317
1317
|
return;
|
|
1318
1318
|
}
|
|
1319
|
-
A = !1, await
|
|
1319
|
+
A = !1, await F();
|
|
1320
1320
|
return;
|
|
1321
1321
|
}
|
|
1322
|
-
A = !1, i.value = !1,
|
|
1322
|
+
A = !1, i.value = !1, s.open({
|
|
1323
1323
|
title: g("inventory.common.refreshFailed"),
|
|
1324
1324
|
message: g("inventory.stock.stock_balance.refreshBalanceError"),
|
|
1325
1325
|
type: "error"
|
|
1326
1326
|
}), (b = n.onError) == null || b.call(n, m.message ?? "Unknown error");
|
|
1327
1327
|
}
|
|
1328
1328
|
}
|
|
1329
|
-
async function
|
|
1329
|
+
async function F() {
|
|
1330
1330
|
const m = n.closingDraftId.value;
|
|
1331
1331
|
if (!m) {
|
|
1332
1332
|
i.value = !1;
|
|
@@ -1334,13 +1334,13 @@ function Ba(n) {
|
|
|
1334
1334
|
}
|
|
1335
1335
|
try {
|
|
1336
1336
|
const b = await l.getDraft(m);
|
|
1337
|
-
i.value = !1, n.onCompleted(b),
|
|
1337
|
+
i.value = !1, n.onCompleted(b), s.open({
|
|
1338
1338
|
title: "Balance refreshed",
|
|
1339
1339
|
message: "Stock balance has been recalculated.",
|
|
1340
1340
|
type: "success"
|
|
1341
1341
|
});
|
|
1342
1342
|
} catch {
|
|
1343
|
-
i.value = !1,
|
|
1343
|
+
i.value = !1, s.open({
|
|
1344
1344
|
title: "Refresh completed",
|
|
1345
1345
|
message: "Balance was refreshed but failed to load updated data. Please reload.",
|
|
1346
1346
|
type: "warning"
|
|
@@ -1349,7 +1349,7 @@ function Ba(n) {
|
|
|
1349
1349
|
}
|
|
1350
1350
|
async function _(m) {
|
|
1351
1351
|
if (!(!n.closingDraftId.value || i.value || A)) {
|
|
1352
|
-
i.value = !0, A = !0,
|
|
1352
|
+
i.value = !0, A = !0, r.value = {
|
|
1353
1353
|
requestId: "",
|
|
1354
1354
|
closingDraftId: n.closingDraftId.value,
|
|
1355
1355
|
closingDraftRevision: n.currentRev.value ?? "",
|
|
@@ -1359,7 +1359,7 @@ function Ba(n) {
|
|
|
1359
1359
|
try {
|
|
1360
1360
|
await l.initializeStockSnapshot(n.closingDraftId.value, m);
|
|
1361
1361
|
} catch (b) {
|
|
1362
|
-
A = !1, i.value = !1,
|
|
1362
|
+
A = !1, i.value = !1, s.open({
|
|
1363
1363
|
title: g("inventory.common.refreshFailed"),
|
|
1364
1364
|
message: g("inventory.stock.stock_balance.refreshBalanceError"),
|
|
1365
1365
|
type: "error"
|
|
@@ -1371,7 +1371,7 @@ function Ba(n) {
|
|
|
1371
1371
|
c = !1, x && (x(), x = null);
|
|
1372
1372
|
}
|
|
1373
1373
|
function p() {
|
|
1374
|
-
R(), c = !0, i.value = !1, A = !1,
|
|
1374
|
+
R(), c = !0, i.value = !1, A = !1, r.value = null;
|
|
1375
1375
|
}
|
|
1376
1376
|
function v() {
|
|
1377
1377
|
f = !1, p();
|
|
@@ -1381,56 +1381,56 @@ function Ba(n) {
|
|
|
1381
1381
|
([m, b], [y, w]) => {
|
|
1382
1382
|
f && (m === y && b === w || B());
|
|
1383
1383
|
}
|
|
1384
|
-
),
|
|
1384
|
+
), hn(() => {
|
|
1385
1385
|
v();
|
|
1386
1386
|
}), {
|
|
1387
1387
|
refreshing: i,
|
|
1388
|
-
refreshStatus:
|
|
1388
|
+
refreshStatus: r,
|
|
1389
1389
|
startListening: N,
|
|
1390
1390
|
startRefresh: _,
|
|
1391
1391
|
cleanup: v
|
|
1392
1392
|
};
|
|
1393
1393
|
}
|
|
1394
|
-
const
|
|
1394
|
+
const Ba = { class: "w-full flex flex-col gap-32" }, Ta = { class: "flex flex-col gap-4" }, ja = { class: "flex justify-between" }, Ma = { class: "flex" }, Ua = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, Ra = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Pa = { class: "flex gap-1" }, Va = {
|
|
1395
1395
|
class: "fm-typo-en-body-lg-600",
|
|
1396
1396
|
style: { "white-space": "pre-wrap", "word-break": "break-word" }
|
|
1397
|
-
},
|
|
1397
|
+
}, Na = {
|
|
1398
1398
|
key: 0,
|
|
1399
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
|
-
},
|
|
1400
|
+
}, za = { class: "flex flex-col gap-2" }, Ea = { class: "fm-typo-en-body-sm-400 list-disc pl-16" }, La = { key: 0 }, Oa = { key: 1 }, Ha = { class: "flex flex-col gap-16" }, Ya = { class: "flex items-center" }, Ka = {
|
|
1401
1401
|
key: 0,
|
|
1402
1402
|
class: "flex gap-8"
|
|
1403
|
-
},
|
|
1403
|
+
}, Wa = {
|
|
1404
1404
|
key: 0,
|
|
1405
1405
|
class: "w-full flex flex-col items-center"
|
|
1406
|
-
},
|
|
1406
|
+
}, qa = { class: "flex items-center gap-8" }, Ga = { class: "flex flex-col gap-8" }, Qa = { class: "flex gap-8" }, Za = {
|
|
1407
1407
|
key: 0,
|
|
1408
1408
|
class: "flex gap-8"
|
|
1409
|
-
},
|
|
1409
|
+
}, Ja = {
|
|
1410
1410
|
key: 1,
|
|
1411
1411
|
class: "flex gap-8 flex-wrap"
|
|
1412
|
-
},
|
|
1412
|
+
}, Xa = { class: "overflow-x-auto" }, eo = {
|
|
1413
1413
|
key: 1,
|
|
1414
1414
|
class: "flex-1 xs:w-screen xs:max-w-full"
|
|
1415
|
-
},
|
|
1415
|
+
}, to = {
|
|
1416
1416
|
key: 0,
|
|
1417
1417
|
class: "flex flex-col items-center gap-8 h-full"
|
|
1418
|
-
},
|
|
1418
|
+
}, no = ["src"], ao = {
|
|
1419
1419
|
key: 1,
|
|
1420
1420
|
class: "px-4 flex flex-col"
|
|
1421
|
-
},
|
|
1421
|
+
}, oo = { class: "flex gap-12 content-stretch" }, so = {
|
|
1422
1422
|
class: "flex flex-col w-24",
|
|
1423
1423
|
name: "circles"
|
|
1424
|
-
},
|
|
1424
|
+
}, ro = { class: "flex-1 flex flex-col items-center" }, lo = { class: "flex-1 flex flex-col items-center" }, io = {
|
|
1425
1425
|
class: "py-12 flex flex-col gap-4",
|
|
1426
1426
|
name: "received-at header"
|
|
1427
|
-
},
|
|
1427
|
+
}, co = { class: "fm-typo-en-body-lg-400" }, uo = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, mo = { class: "flex gap-12 content-stretch" }, fo = {
|
|
1428
1428
|
class: "flex flex-col w-24",
|
|
1429
1429
|
name: "circles"
|
|
1430
|
-
},
|
|
1430
|
+
}, po = { class: "flex-1 flex flex-col items-center" }, vo = {
|
|
1431
1431
|
class: "py-12 flex flex-col gap-4 flex-1",
|
|
1432
1432
|
name: "delivery details"
|
|
1433
|
-
},
|
|
1433
|
+
}, yo = { class: "flex flex-col gap-8" }, go = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, bo = { class: "flex flex-col gap-4" }, ho = { class: "flex items-center justify-between gap-8 w-full" }, ko = { class: "flex items-center gap-8" }, _o = { class: "flex flex-col items-end" }, wo = { class: "text-2xl font-semibold" }, Ot = "N/A", xo = /* @__PURE__ */ je({
|
|
1434
1434
|
__name: "ClosingDraftDialog",
|
|
1435
1435
|
props: {
|
|
1436
1436
|
show: { type: Boolean },
|
|
@@ -1438,49 +1438,49 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
1438
1438
|
},
|
|
1439
1439
|
emits: ["submitted", "refresh"],
|
|
1440
1440
|
setup(n, { emit: l }) {
|
|
1441
|
-
const t = n,
|
|
1442
|
-
const
|
|
1443
|
-
return
|
|
1444
|
-
}), g =
|
|
1445
|
-
var
|
|
1446
|
-
return (
|
|
1447
|
-
}),
|
|
1448
|
-
_.skus.filter((
|
|
1441
|
+
const t = n, s = M(() => {
|
|
1442
|
+
const a = Wt();
|
|
1443
|
+
return a === "MYR" ? "RM" : a;
|
|
1444
|
+
}), g = on(), i = M(() => {
|
|
1445
|
+
var a, e;
|
|
1446
|
+
return (a = t.draft) != null && a.closingId ? ((e = g.drafts.find((d) => d._id === t.draft._id)) == null ? void 0 : e.closingIdDisplay) ?? null : null;
|
|
1447
|
+
}), r = it(), c = Kt(t, "show"), x = W(!1), A = W(!1), f = W(new Array()), B = W(new Array()), N = W([]), E = ct(), F = Ke(), _ = wt(), R = We(), p = Et({}), v = M(() => new Set(
|
|
1448
|
+
_.skus.filter((a) => {
|
|
1449
1449
|
var e;
|
|
1450
|
-
return p[(e =
|
|
1451
|
-
}).map((
|
|
1450
|
+
return p[(e = a.customAttributes) == null ? void 0 : e.tag];
|
|
1451
|
+
}).map((a) => a._id)
|
|
1452
1452
|
)), m = l, b = M(() => {
|
|
1453
|
-
var
|
|
1454
|
-
return (
|
|
1453
|
+
var a;
|
|
1454
|
+
return (a = t.draft) == null ? void 0 : a._id;
|
|
1455
1455
|
}), y = M(() => {
|
|
1456
|
-
var
|
|
1457
|
-
return (
|
|
1456
|
+
var a;
|
|
1457
|
+
return (a = t.draft) == null ? void 0 : a._rev;
|
|
1458
1458
|
}), {
|
|
1459
1459
|
refreshing: w,
|
|
1460
1460
|
startListening: Y,
|
|
1461
1461
|
startRefresh: q,
|
|
1462
1462
|
cleanup: re
|
|
1463
|
-
} =
|
|
1463
|
+
} = Fa({
|
|
1464
1464
|
closingDraftId: b,
|
|
1465
1465
|
currentRev: y,
|
|
1466
|
-
onCompleted: (
|
|
1467
|
-
m("refresh",
|
|
1466
|
+
onCompleted: (a) => {
|
|
1467
|
+
m("refresh", a), f.value = a.stockSnapshot ?? [], c.value = !1;
|
|
1468
1468
|
}
|
|
1469
1469
|
}), z = W({
|
|
1470
1470
|
templateItem: !0,
|
|
1471
1471
|
nonTemplateItem: !0
|
|
1472
1472
|
}), le = W(null);
|
|
1473
|
-
function P(
|
|
1474
|
-
le.value = e ?
|
|
1473
|
+
function P(a, e) {
|
|
1474
|
+
le.value = e ? a : le.value === a ? null : le.value;
|
|
1475
1475
|
}
|
|
1476
|
-
const S = (
|
|
1477
|
-
function ie(
|
|
1478
|
-
return e ? "text-fm-color-system-error-300" :
|
|
1476
|
+
const S = (a) => ne(a, { minPrecision: 0, maxPrecision: 3 });
|
|
1477
|
+
function ie(a, e) {
|
|
1478
|
+
return e ? "text-fm-color-system-error-300" : a ? "text-purple-500" : "";
|
|
1479
1479
|
}
|
|
1480
|
-
function L(
|
|
1481
|
-
return e ? k(pe.FmIcon, { name: "warning", size: "sm", color: "system-error-300" }) :
|
|
1480
|
+
function L(a, e) {
|
|
1481
|
+
return e ? k(pe.FmIcon, { name: "warning", size: "sm", color: "system-error-300" }) : a ? k(pe.FmIcon, { name: "rule", size: "sm" }) : null;
|
|
1482
1482
|
}
|
|
1483
|
-
function
|
|
1483
|
+
function I(a) {
|
|
1484
1484
|
return k(
|
|
1485
1485
|
"div",
|
|
1486
1486
|
{
|
|
@@ -1488,7 +1488,7 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
1488
1488
|
},
|
|
1489
1489
|
[
|
|
1490
1490
|
k("div", { class: "fm-typo-en-body-sm-600 text-fm-color-typo-secondary mb-4" }, "Breakdown"),
|
|
1491
|
-
...
|
|
1491
|
+
...a.breakdown.map(
|
|
1492
1492
|
(e) => k("div", { class: "flex justify-between gap-12" }, [
|
|
1493
1493
|
k(
|
|
1494
1494
|
"div",
|
|
@@ -1498,30 +1498,30 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
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)} ${a.baseUnit}` : `${S(e.subtotal)} ${a.baseUnit} (ignored)`
|
|
1502
1502
|
)
|
|
1503
1503
|
])
|
|
1504
1504
|
),
|
|
1505
1505
|
k("hr", { class: "border-fm-color-typo-secondary my-4" }),
|
|
1506
1506
|
k("div", { class: "flex justify-between fm-typo-en-body-lg-600" }, [
|
|
1507
1507
|
k("span", "Total"),
|
|
1508
|
-
k("span", `${S(
|
|
1508
|
+
k("span", `${S(a.physicalBalance)} ${a.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 a = [...((e = t.draft) == null ? void 0 : e.items) ?? [], ...((d = t.draft) == null ? void 0 : d.negativeStockItems) ?? []];
|
|
1516
|
+
return v.value.size ? a.filter((j) => v.value.has(j.sku._id)) : a;
|
|
1517
1517
|
}), se = M(() => {
|
|
1518
|
-
const
|
|
1519
|
-
return
|
|
1520
|
-
}), we =
|
|
1518
|
+
const a = Q.value.map((e) => e.sku);
|
|
1519
|
+
return a.sort((e, d) => e.code.localeCompare(d.code)), a;
|
|
1520
|
+
}), we = nn();
|
|
1521
1521
|
kt(Ee), ze(
|
|
1522
1522
|
() => t.show,
|
|
1523
|
-
async (
|
|
1524
|
-
if (!
|
|
1523
|
+
async (a) => {
|
|
1524
|
+
if (!a) {
|
|
1525
1525
|
re();
|
|
1526
1526
|
return;
|
|
1527
1527
|
}
|
|
@@ -1532,18 +1532,18 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
1532
1532
|
},
|
|
1533
1533
|
{ immediate: !0 }
|
|
1534
1534
|
);
|
|
1535
|
-
const xe = M(() => Qe.value.reduce((
|
|
1535
|
+
const xe = M(() => Qe.value.reduce((a, e) => a + Number(e.stockTakeValue), 0)), De = He(0), $e = He(100);
|
|
1536
1536
|
async function Ee() {
|
|
1537
1537
|
var e, d, j, D;
|
|
1538
1538
|
if (!R._currentLocation) return;
|
|
1539
1539
|
x.value = !0;
|
|
1540
|
-
const
|
|
1540
|
+
const a = ((e = t.draft) == null ? void 0 : e.status) === _e.enum.COMPLETED;
|
|
1541
1541
|
B.value = [];
|
|
1542
1542
|
try {
|
|
1543
|
-
if (await _.init(),
|
|
1543
|
+
if (await _.init(), a) {
|
|
1544
1544
|
const G = t.draft.closingAdjustmentId;
|
|
1545
1545
|
if (!G) {
|
|
1546
|
-
|
|
1546
|
+
F.open({
|
|
1547
1547
|
title: "Something went wrong",
|
|
1548
1548
|
message: "Closing draft is completed but closing document cannot be found.",
|
|
1549
1549
|
type: "error"
|
|
@@ -1554,7 +1554,7 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
1554
1554
|
}
|
|
1555
1555
|
const me = await E.readAdjustmentById(G), Ae = (me == null ? void 0 : me.skus) ?? [];
|
|
1556
1556
|
for (const ge of Ae) {
|
|
1557
|
-
const
|
|
1557
|
+
const Ie = {
|
|
1558
1558
|
id: ge.sku._id,
|
|
1559
1559
|
balance: ge.fromBalance,
|
|
1560
1560
|
costs: ge.fromCostBalances
|
|
@@ -1563,7 +1563,7 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
1563
1563
|
balance: ge.toBalance,
|
|
1564
1564
|
costs: ge.toCostBalances
|
|
1565
1565
|
};
|
|
1566
|
-
f.value.push(
|
|
1566
|
+
f.value.push(Ie), B.value.push(U);
|
|
1567
1567
|
}
|
|
1568
1568
|
} else
|
|
1569
1569
|
f.value = ((j = t.draft) == null ? void 0 : j.stockSnapshot) ?? [];
|
|
@@ -1580,7 +1580,7 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
1580
1580
|
const O = Array.from(V).sort();
|
|
1581
1581
|
N.value = [...J, ...O];
|
|
1582
1582
|
} catch (V) {
|
|
1583
|
-
|
|
1583
|
+
F.open({
|
|
1584
1584
|
title: "Something went wrong",
|
|
1585
1585
|
message: "Something went wrong when fetching info. Please try again.",
|
|
1586
1586
|
type: "error"
|
|
@@ -1594,14 +1594,14 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
1594
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
|
+
F.open({
|
|
1598
1598
|
title: "Cannot refresh",
|
|
1599
1599
|
message: "Effective date is not available for this draft.",
|
|
1600
1600
|
type: "error"
|
|
1601
1601
|
});
|
|
1602
1602
|
return;
|
|
1603
1603
|
}
|
|
1604
|
-
await
|
|
1604
|
+
await r.refreshBalance(
|
|
1605
1605
|
t.draft,
|
|
1606
1606
|
() => {
|
|
1607
1607
|
},
|
|
@@ -1613,37 +1613,37 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
1613
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
|
+
F.open({
|
|
1617
1617
|
title: "Cannot refresh",
|
|
1618
1618
|
message: "Effective date is not available for this draft.",
|
|
1619
1619
|
type: "error"
|
|
1620
1620
|
});
|
|
1621
1621
|
return;
|
|
1622
1622
|
}
|
|
1623
|
-
await
|
|
1623
|
+
await r.invalidateDraftCache(t.draft);
|
|
1624
1624
|
}
|
|
1625
1625
|
const Ge = M(
|
|
1626
1626
|
() => f.value.groupBy(
|
|
1627
|
-
(
|
|
1628
|
-
(
|
|
1627
|
+
(a) => a.id,
|
|
1628
|
+
(a) => a.balance
|
|
1629
1629
|
)
|
|
1630
|
-
), ut = M(() => Q.value.groupBy((
|
|
1631
|
-
var
|
|
1632
|
-
return (
|
|
1633
|
-
}),
|
|
1634
|
-
var
|
|
1635
|
-
return (
|
|
1630
|
+
), ut = M(() => Q.value.groupBy((a) => a.sku._id)), sn = M(() => {
|
|
1631
|
+
var a;
|
|
1632
|
+
return (a = t.draft) != null && a.adjustmentSnapshot ? new Map(t.draft.adjustmentSnapshot.map((e) => [e.skuId, e.adjustmentsByType])) : /* @__PURE__ */ new Map();
|
|
1633
|
+
}), rn = M(() => {
|
|
1634
|
+
var a;
|
|
1635
|
+
return (a = t.draft) != null && a.opening ? new Map(t.draft.opening.map((e) => [e.skuId, e.balance])) : /* @__PURE__ */ new Map();
|
|
1636
1636
|
});
|
|
1637
|
-
function ye(
|
|
1637
|
+
function ye(a, e) {
|
|
1638
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 a;
|
|
1644
1644
|
},
|
|
1645
1645
|
content() {
|
|
1646
|
-
return e ||
|
|
1646
|
+
return e || a;
|
|
1647
1647
|
}
|
|
1648
1648
|
}
|
|
1649
1649
|
);
|
|
@@ -1800,7 +1800,7 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
1800
1800
|
accessorFn: (e) => {
|
|
1801
1801
|
var j;
|
|
1802
1802
|
const d = (j = B.value.find((D) => D.id === e.id)) == null ? void 0 : j.balance;
|
|
1803
|
-
return d ?
|
|
1803
|
+
return d ? On.toDouble(d) : e.physicalBalance;
|
|
1804
1804
|
},
|
|
1805
1805
|
header: () => ye("Stock Take balance", "The physical balance recorded during stock take."),
|
|
1806
1806
|
cell(e) {
|
|
@@ -1842,7 +1842,7 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
1842
1842
|
k(pe.FmIcon, { name: "info", size: "sm", outline: !0 })
|
|
1843
1843
|
]
|
|
1844
1844
|
),
|
|
1845
|
-
default: () =>
|
|
1845
|
+
default: () => I(d)
|
|
1846
1846
|
}
|
|
1847
1847
|
) : J;
|
|
1848
1848
|
},
|
|
@@ -1867,7 +1867,7 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
1867
1867
|
{
|
|
1868
1868
|
id: "varianceInCost",
|
|
1869
1869
|
accessorKey: "varianceInCost",
|
|
1870
|
-
header: () => ye(`Variance (${
|
|
1870
|
+
header: () => ye(`Variance (${s.value})`),
|
|
1871
1871
|
size: 150,
|
|
1872
1872
|
cell(e) {
|
|
1873
1873
|
const d = e.row.original.varianceInCost;
|
|
@@ -1891,7 +1891,7 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
1891
1891
|
return k(
|
|
1892
1892
|
"div",
|
|
1893
1893
|
{ class: "flex items-center gap-4 justify-end fm-typo-en-body-lg-400" },
|
|
1894
|
-
|
|
1894
|
+
Ot
|
|
1895
1895
|
);
|
|
1896
1896
|
const j = ne(d);
|
|
1897
1897
|
if (d === 0)
|
|
@@ -1915,13 +1915,13 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
1915
1915
|
{
|
|
1916
1916
|
id: "stockTakeValue",
|
|
1917
1917
|
accessorKey: "stockTakeValue",
|
|
1918
|
-
header: () => ye(`Stock take value (${
|
|
1918
|
+
header: () => ye(`Stock take value (${s.value})`),
|
|
1919
1919
|
size: 180,
|
|
1920
1920
|
cell(e) {
|
|
1921
1921
|
var O;
|
|
1922
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 G = te.toFormatString({ value: V.conversion }), me = `${ne(C, { minPrecision: 2, maxPrecision: 4 })} ${d.baseUnit} ÷ ${G} × ${J} ${
|
|
1924
|
+
const G = te.toFormatString({ value: V.conversion }), me = `${ne(C, { minPrecision: 2, maxPrecision: 4 })} ${d.baseUnit} ÷ ${G} × ${J} ${s.value}`;
|
|
1925
1925
|
return k(
|
|
1926
1926
|
pe.FmTooltip,
|
|
1927
1927
|
{ zIndex: 51 },
|
|
@@ -1939,7 +1939,7 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
1939
1939
|
}
|
|
1940
1940
|
);
|
|
1941
1941
|
} else {
|
|
1942
|
-
const G = `${ne(C, { minPrecision: 2, maxPrecision: 4 })} ${d.baseUnit} × ${J} ${
|
|
1942
|
+
const G = `${ne(C, { minPrecision: 2, maxPrecision: 4 })} ${d.baseUnit} × ${J} ${s.value}`;
|
|
1943
1943
|
return k(
|
|
1944
1944
|
pe.FmTooltip,
|
|
1945
1945
|
{ zIndex: 51 },
|
|
@@ -1965,13 +1965,13 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
1965
1965
|
{
|
|
1966
1966
|
id: "systemValue",
|
|
1967
1967
|
accessorKey: "systemValue",
|
|
1968
|
-
header: () => ye(`System value (${
|
|
1968
|
+
header: () => ye(`System value (${s.value})`),
|
|
1969
1969
|
size: 180,
|
|
1970
1970
|
cell(e) {
|
|
1971
1971
|
var O;
|
|
1972
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 G = te.toFormatString({ value: V.conversion }), me = `${ne(C, { minPrecision: 2, maxPrecision: 4 })} ${d.baseUnit} ÷ ${G} × ${J} ${
|
|
1974
|
+
const G = te.toFormatString({ value: V.conversion }), me = `${ne(C, { minPrecision: 2, maxPrecision: 4 })} ${d.baseUnit} ÷ ${G} × ${J} ${s.value}`;
|
|
1975
1975
|
return k(
|
|
1976
1976
|
pe.FmTooltip,
|
|
1977
1977
|
{ zIndex: 51 },
|
|
@@ -1989,7 +1989,7 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
1989
1989
|
}
|
|
1990
1990
|
);
|
|
1991
1991
|
} else {
|
|
1992
|
-
const G = `${ne(C, { minPrecision: 2, maxPrecision: 4 })} ${d.baseUnit} × ${J} ${
|
|
1992
|
+
const G = `${ne(C, { minPrecision: 2, maxPrecision: 4 })} ${d.baseUnit} × ${J} ${s.value}`;
|
|
1993
1993
|
return k(
|
|
1994
1994
|
pe.FmTooltip,
|
|
1995
1995
|
{ zIndex: 51 },
|
|
@@ -2058,25 +2058,27 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2058
2058
|
);
|
|
2059
2059
|
}
|
|
2060
2060
|
}
|
|
2061
|
-
]),
|
|
2061
|
+
]), ln = M(() => xt.value.map((a) => a.size ?? 0).reduce((a, e) => a + e)), dt = W(""), cn = M(() => {
|
|
2062
2062
|
var d, j;
|
|
2063
|
-
const
|
|
2063
|
+
const a = ((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
|
+
)) ?? {}, e = new Map(
|
|
2067
|
+
B.value.map((D) => [D.id, D.balance])
|
|
2068
|
+
);
|
|
2067
2069
|
return se.value.map((D) => {
|
|
2068
|
-
var Bt, Tt, jt, Mt, Ut, Rt, Pt, Vt, Nt
|
|
2070
|
+
var Bt, Tt, jt, Mt, Ut, Rt, Pt, Vt, Nt;
|
|
2069
2071
|
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
2072
|
amount: 1,
|
|
2071
2073
|
precision: 0
|
|
2072
2074
|
}, me = Number(
|
|
2073
2075
|
te.toFormatString({ value: G })
|
|
2074
|
-
), Ae =
|
|
2075
|
-
if (N.value.forEach((
|
|
2076
|
-
const be = U[
|
|
2077
|
-
|
|
2076
|
+
), Ae = rn.value.get(D._id), ge = Ae ? Number(te.toFormatString({ value: Ae })) : 0, Ie = sn.value.get(D._id), U = {};
|
|
2077
|
+
if (N.value.forEach((ee) => {
|
|
2078
|
+
const be = U[ee] ?? { amount: 0, precision: 0 }, Fe = Ie == null ? void 0 : Ie[ee];
|
|
2079
|
+
Fe && (U[ee] = Xt(be, Fe));
|
|
2078
2080
|
}), !V) {
|
|
2079
|
-
const
|
|
2081
|
+
const ee = Number(te.toFormatString({ value: C })), be = 0 - ee, Fe = be * O / me, nt = 0, Pe = ee * O / me;
|
|
2080
2082
|
return {
|
|
2081
2083
|
id: D._id,
|
|
2082
2084
|
code: D.code,
|
|
@@ -2084,15 +2086,15 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2084
2086
|
costUnit: ((Pt = (Rt = D.defaultCost) == null ? void 0 : Rt.measurement) == null ? void 0 : Pt.abbrev) ?? null,
|
|
2085
2087
|
baseUnit: D.unit.abbrev,
|
|
2086
2088
|
baseUnitAmount: 0,
|
|
2087
|
-
systemBalance:
|
|
2089
|
+
systemBalance: ee,
|
|
2088
2090
|
physicalBalance: 0,
|
|
2089
|
-
adjustedAmount: -
|
|
2091
|
+
adjustedAmount: -ee,
|
|
2090
2092
|
adjustedDiffPercentage: -100,
|
|
2091
|
-
isTemplateItem: !
|
|
2093
|
+
isTemplateItem: !a[D._id],
|
|
2092
2094
|
costPerUnit: O,
|
|
2093
2095
|
opening: ge,
|
|
2094
2096
|
varianceQty: be,
|
|
2095
|
-
varianceInCost:
|
|
2097
|
+
varianceInCost: Fe,
|
|
2096
2098
|
stockTakeValue: nt,
|
|
2097
2099
|
systemValue: Pe,
|
|
2098
2100
|
adjustmentAmounts: U,
|
|
@@ -2101,15 +2103,13 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2101
2103
|
breakdown: []
|
|
2102
2104
|
};
|
|
2103
2105
|
}
|
|
2104
|
-
const ue =
|
|
2105
|
-
(X) => X.id === D._id
|
|
2106
|
-
)) == null ? void 0 : Nt.balance, ke = Xt(
|
|
2106
|
+
const ue = an(V), fe = e.get(D._id), ke = Zt(
|
|
2107
2107
|
fe ?? ue,
|
|
2108
2108
|
C
|
|
2109
|
-
), Re = C.amount === 0 ? null :
|
|
2109
|
+
), Re = C.amount === 0 ? null : Jt(ke, {
|
|
2110
2110
|
...C,
|
|
2111
2111
|
amount: Math.abs(C.amount)
|
|
2112
|
-
}), et = Re ? lt(Re, $e) : null, pt = Number(te.toFormatString({ value: C })), vt = Number(te.toFormatString({ value: ue })), $t = vt - pt,
|
|
2112
|
+
}), et = Re ? lt(Re, $e) : null, pt = Number(te.toFormatString({ value: C })), vt = Number(te.toFormatString({ value: ue })), $t = vt - pt, fn = $t * O / me, pn = vt * O / me, vn = pt * O / me, tt = Number(te.toFormatString({ value: V.baseAmount })), It = [], yt = [];
|
|
2113
2113
|
tt && yt.push({
|
|
2114
2114
|
label: "Base",
|
|
2115
2115
|
amount: tt,
|
|
@@ -2119,81 +2119,81 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2119
2119
|
orphan: !1,
|
|
2120
2120
|
counted: !0
|
|
2121
2121
|
});
|
|
2122
|
-
const
|
|
2123
|
-
V.measurementsAmounts.map((
|
|
2124
|
-
),
|
|
2125
|
-
const Ve = Number(te.toFormatString({ value:
|
|
2126
|
-
if (
|
|
2127
|
-
abbrev: `(${
|
|
2122
|
+
const yn = new Map(
|
|
2123
|
+
V.measurementsAmounts.map((ee) => [ee.measurement.id, ee.amount])
|
|
2124
|
+
), gn = new Set(D.unit.measurements.map((ee) => ee.id)), Ft = (ee, be, Fe, nt, Pe) => {
|
|
2125
|
+
const Ve = Number(te.toFormatString({ value: Fe })), zt = te.toFormatString({ value: be });
|
|
2126
|
+
if (It.push({
|
|
2127
|
+
abbrev: `(${ee}) × ${zt}`,
|
|
2128
2128
|
amount: Ve,
|
|
2129
2129
|
variant: Pe ? "orphan" : nt ? "inactive" : "normal"
|
|
2130
2130
|
}), !Ve) return;
|
|
2131
|
-
const
|
|
2132
|
-
te.toFormatString({ value: lt(
|
|
2131
|
+
const bn = Number(
|
|
2132
|
+
te.toFormatString({ value: lt(Fe, be) })
|
|
2133
2133
|
);
|
|
2134
2134
|
yt.push({
|
|
2135
|
-
label: Pe ? `${Ve} ${
|
|
2135
|
+
label: Pe ? `${Ve} ${ee}` : `${Ve} ${ee} × ${zt} ${D.unit.abbrev}`,
|
|
2136
2136
|
amount: Ve,
|
|
2137
|
-
abbrev:
|
|
2138
|
-
subtotal:
|
|
2137
|
+
abbrev: ee,
|
|
2138
|
+
subtotal: bn,
|
|
2139
2139
|
inactive: nt,
|
|
2140
2140
|
orphan: Pe,
|
|
2141
2141
|
counted: !Pe
|
|
2142
2142
|
});
|
|
2143
2143
|
};
|
|
2144
|
-
for (const
|
|
2145
|
-
const be =
|
|
2146
|
-
be &&
|
|
2144
|
+
for (const ee of D.unit.measurements) {
|
|
2145
|
+
const be = yn.get(ee.id);
|
|
2146
|
+
be && Ft(ee.abbrev, ee.conversion, be, tn(ee, we.value), !1);
|
|
2147
2147
|
}
|
|
2148
|
-
for (const
|
|
2149
|
-
|
|
2148
|
+
for (const ee of V.measurementsAmounts)
|
|
2149
|
+
gn.has(ee.measurement.id) || Ft(ee.measurement.abbrev, ee.measurement.conversion, ee.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: ((Nt = (Vt = D.defaultCost) == null ? void 0 : Vt.measurement) == null ? void 0 : Nt.abbrev) ?? null,
|
|
2155
2155
|
baseUnit: D.unit.abbrev,
|
|
2156
2156
|
baseUnitAmount: tt,
|
|
2157
|
-
measurements:
|
|
2157
|
+
measurements: It,
|
|
2158
2158
|
breakdown: yt,
|
|
2159
2159
|
systemBalance: pt,
|
|
2160
2160
|
physicalBalance: vt,
|
|
2161
2161
|
adjustedAmount: Number(te.toFormatString({ value: ke })),
|
|
2162
2162
|
adjustedDiffPercentage: et ? Number(
|
|
2163
2163
|
te.toFormatString({
|
|
2164
|
-
value:
|
|
2164
|
+
value: en(et, 2)
|
|
2165
2165
|
})
|
|
2166
2166
|
) : null,
|
|
2167
|
-
isTemplateItem: !
|
|
2167
|
+
isTemplateItem: !a[D._id],
|
|
2168
2168
|
costPerUnit: O,
|
|
2169
2169
|
opening: ge,
|
|
2170
2170
|
varianceQty: $t,
|
|
2171
|
-
varianceInCost:
|
|
2172
|
-
stockTakeValue:
|
|
2173
|
-
systemValue:
|
|
2171
|
+
varianceInCost: fn,
|
|
2172
|
+
stockTakeValue: pn,
|
|
2173
|
+
systemValue: vn,
|
|
2174
2174
|
adjustmentAmounts: U,
|
|
2175
2175
|
customAttributeValues: D.customAttributes ?? {}
|
|
2176
2176
|
};
|
|
2177
|
-
})
|
|
2178
|
-
}), Dt = M(
|
|
2179
|
-
() => Qe.value.some((
|
|
2177
|
+
});
|
|
2178
|
+
}), Qe = M(() => cn.value.filter((a) => !!(a.isTemplateItem && z.value.templateItem || !a.isTemplateItem && z.value.nonTemplateItem))), Dt = M(
|
|
2179
|
+
() => Qe.value.some((a) => a.measurements.some((e) => e.variant === "inactive"))
|
|
2180
2180
|
), At = M(
|
|
2181
|
-
() => Qe.value.some((
|
|
2182
|
-
),
|
|
2181
|
+
() => Qe.value.some((a) => a.measurements.some((e) => e.variant === "orphan"))
|
|
2182
|
+
), un = M(
|
|
2183
2183
|
() => Dt.value || At.value
|
|
2184
2184
|
), mt = M(() => {
|
|
2185
|
-
const
|
|
2185
|
+
const a = /* @__PURE__ */ new Set();
|
|
2186
2186
|
for (const e of se.value)
|
|
2187
2187
|
if (e.customAttributes)
|
|
2188
2188
|
for (const d of Object.keys(e.customAttributes))
|
|
2189
|
-
d !== "tag" &&
|
|
2190
|
-
return Array.from(
|
|
2191
|
-
}), Ze =
|
|
2192
|
-
() => mt.value.filter((
|
|
2193
|
-
),
|
|
2189
|
+
d !== "tag" && a.add(d);
|
|
2190
|
+
return Array.from(a).sort();
|
|
2191
|
+
}), Ze = Et({}), Ct = M(
|
|
2192
|
+
() => mt.value.filter((a) => Ze[a])
|
|
2193
|
+
), dn = M(() => {
|
|
2194
2194
|
var e, d, j, D, V;
|
|
2195
2195
|
if (!t.draft) return [];
|
|
2196
|
-
const
|
|
2196
|
+
const a = t.draft.approvedAt ? {
|
|
2197
2197
|
action: `Approve at ${Ce(t.draft.approvedAt)}`,
|
|
2198
2198
|
// actionAt: props.draft.approvedAt,
|
|
2199
2199
|
actionBy: t.draft.approvedBy,
|
|
@@ -2211,7 +2211,7 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2211
2211
|
} : null,
|
|
2212
2212
|
{
|
|
2213
2213
|
label: "Location",
|
|
2214
|
-
value: ((d = R._currentLocation) == null ? void 0 : d.name) ??
|
|
2214
|
+
value: ((d = R._currentLocation) == null ? void 0 : d.name) ?? Ot
|
|
2215
2215
|
},
|
|
2216
2216
|
{
|
|
2217
2217
|
label: "Created at",
|
|
@@ -2241,17 +2241,17 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2241
2241
|
label: "Remark",
|
|
2242
2242
|
value: t.draft.remark
|
|
2243
2243
|
} : null,
|
|
2244
|
-
|
|
2244
|
+
a ? {
|
|
2245
2245
|
label: "Last action",
|
|
2246
|
-
value:
|
|
2246
|
+
value: a.action
|
|
2247
2247
|
} : null,
|
|
2248
|
-
|
|
2248
|
+
a && a.actionBy ? {
|
|
2249
2249
|
label: "Last action by",
|
|
2250
|
-
value: (V =
|
|
2250
|
+
value: (V = a.actionBy) == null ? void 0 : V.name
|
|
2251
2251
|
} : null,
|
|
2252
|
-
|
|
2252
|
+
a && a.remark ? {
|
|
2253
2253
|
label: "Action remark",
|
|
2254
|
-
value:
|
|
2254
|
+
value: a.remark
|
|
2255
2255
|
} : null
|
|
2256
2256
|
].filter((C) => C).map((C) => C);
|
|
2257
2257
|
}), ft = [
|
|
@@ -2265,27 +2265,27 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2265
2265
|
}
|
|
2266
2266
|
], Oe = W(ft[0]), Ue = M(() => {
|
|
2267
2267
|
var j, D, V;
|
|
2268
|
-
const
|
|
2268
|
+
const a = ((j = t.draft) == null ? void 0 : j.activityLogs) ?? [], e = ((D = t.draft) == null ? void 0 : D.rejectionHistory) ?? [];
|
|
2269
2269
|
for (const C of e)
|
|
2270
|
-
|
|
2270
|
+
a.find(
|
|
2271
2271
|
(O) => `${O.action}_${O.performedAt}` == `${oe.enum.rejectDraft}_${C.rejectedAt}`
|
|
2272
|
-
) ||
|
|
2272
|
+
) || a.push({
|
|
2273
2273
|
action: oe.enum.rejectDraft,
|
|
2274
2274
|
performedAt: C.rejectedAt,
|
|
2275
2275
|
performedBy: C.rejectedBy,
|
|
2276
2276
|
remark: C.rejectRemark
|
|
2277
2277
|
});
|
|
2278
|
-
return (V = t.draft) != null && V.approvedAt && (
|
|
2278
|
+
return (V = t.draft) != null && V.approvedAt && (a.find(
|
|
2279
2279
|
(J) => {
|
|
2280
2280
|
var O;
|
|
2281
2281
|
return `${J.action}_${J.performedAt}` == `${oe.enum.approveDraft}_${(O = t.draft) == null ? void 0 : O.approvedAt}`;
|
|
2282
2282
|
}
|
|
2283
|
-
) ||
|
|
2283
|
+
) || a.push({
|
|
2284
2284
|
action: oe.enum.approveDraft,
|
|
2285
2285
|
performedAt: t.draft.approvedAt,
|
|
2286
2286
|
performedBy: t.draft.approvedBy ?? { name: "Unknown", id: "unknown" },
|
|
2287
2287
|
remark: t.draft.approveRemark
|
|
2288
|
-
})),
|
|
2288
|
+
})), a.sort((C, J) => new Date(J.performedAt).getTime() - new Date(C.performedAt).getTime()).map(
|
|
2289
2289
|
(C) => ({
|
|
2290
2290
|
header: Be(C.action),
|
|
2291
2291
|
date: Ce(C.performedAt),
|
|
@@ -2302,11 +2302,11 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2302
2302
|
})
|
|
2303
2303
|
);
|
|
2304
2304
|
}), Je = W(!1), Xe = W(!1), St = M(() => {
|
|
2305
|
-
var
|
|
2306
|
-
return ((
|
|
2305
|
+
var a;
|
|
2306
|
+
return ((a = t.draft) == null ? void 0 : a.status) !== _e.enum.DRAFT ? "Status is not draft." : null;
|
|
2307
2307
|
});
|
|
2308
|
-
function
|
|
2309
|
-
t.draft && (Xe.value = !0,
|
|
2308
|
+
function mn() {
|
|
2309
|
+
t.draft && (Xe.value = !0, r.approveDraft(
|
|
2310
2310
|
t.draft,
|
|
2311
2311
|
() => {
|
|
2312
2312
|
Xe.value = !1, Je.value = !1, m("submitted");
|
|
@@ -2316,31 +2316,31 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2316
2316
|
}
|
|
2317
2317
|
));
|
|
2318
2318
|
}
|
|
2319
|
-
return (
|
|
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"),
|
|
2319
|
+
return (a, 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"), Ie = Z("FmSideSheet");
|
|
2321
2321
|
return h(), T(ce, null, [
|
|
2322
|
-
$(
|
|
2322
|
+
$(Ie, {
|
|
2323
2323
|
"dismiss-away": "",
|
|
2324
2324
|
"max-width": 9999,
|
|
2325
2325
|
"model-value": u(c),
|
|
2326
2326
|
"onUpdate:modelValue": e[9] || (e[9] = (U) => _t(c) ? c.value = U : null),
|
|
2327
2327
|
header: "Closing details"
|
|
2328
2328
|
}, {
|
|
2329
|
-
"side-sheet-footer":
|
|
2329
|
+
"side-sheet-footer": X(() => {
|
|
2330
2330
|
var U, ue, fe, ke;
|
|
2331
2331
|
return [
|
|
2332
|
-
|
|
2333
|
-
|
|
2332
|
+
o("div", ho, [
|
|
2333
|
+
o("div", ko, [
|
|
2334
2334
|
((U = t.draft) == null ? void 0 : U.status) === u(_e).enum.DRAFT ? (h(), T(ce, { key: 0 }, [
|
|
2335
2335
|
St.value ? (h(), ae(ge, {
|
|
2336
2336
|
key: 0,
|
|
2337
2337
|
"z-index": 51,
|
|
2338
2338
|
placement: "right"
|
|
2339
2339
|
}, {
|
|
2340
|
-
content:
|
|
2340
|
+
content: X(() => [
|
|
2341
2341
|
de(H(St.value), 1)
|
|
2342
2342
|
]),
|
|
2343
|
-
default:
|
|
2343
|
+
default: X(() => [
|
|
2344
2344
|
$(C, {
|
|
2345
2345
|
disabled: "",
|
|
2346
2346
|
key: "approve key",
|
|
@@ -2358,7 +2358,7 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2358
2358
|
key: 1,
|
|
2359
2359
|
label: "Reject",
|
|
2360
2360
|
variant: "destructive",
|
|
2361
|
-
onClick: e[6] || (e[6] = () => t.draft && u(
|
|
2361
|
+
onClick: e[6] || (e[6] = () => t.draft && u(r).rejectDraft(t.draft, () => m("submitted")))
|
|
2362
2362
|
})) : K("", !0),
|
|
2363
2363
|
$(C, {
|
|
2364
2364
|
label: "Close",
|
|
@@ -2366,12 +2366,12 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2366
2366
|
onClick: e[7] || (e[7] = (Re) => c.value = !1)
|
|
2367
2367
|
}),
|
|
2368
2368
|
(fe = t.draft) != null && fe.approvedAt && ((ke = t.draft) == null ? void 0 : ke.status) !== u(_e).enum.COMPLETED ? (h(), ae(gt, { key: 2 }, {
|
|
2369
|
-
default:
|
|
2369
|
+
default: X(() => [
|
|
2370
2370
|
$(C, {
|
|
2371
2371
|
label: "Sync",
|
|
2372
2372
|
loading: A.value,
|
|
2373
2373
|
onClick: e[8] || (e[8] = () => {
|
|
2374
|
-
t.draft && (A.value = !0, u(
|
|
2374
|
+
t.draft && (A.value = !0, u(r).syncDraft(t.draft, () => {
|
|
2375
2375
|
A.value = !1, m("submitted");
|
|
2376
2376
|
}));
|
|
2377
2377
|
})
|
|
@@ -2380,16 +2380,16 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2380
2380
|
_: 1
|
|
2381
2381
|
})) : K("", !0)
|
|
2382
2382
|
]),
|
|
2383
|
-
|
|
2384
|
-
e[23] || (e[23] =
|
|
2385
|
-
|
|
2383
|
+
o("div", _o, [
|
|
2384
|
+
e[23] || (e[23] = o("div", { class: "text-xs text-gray-500 uppercase tracking-wide" }, "Total stock take value", -1)),
|
|
2385
|
+
o("div", wo, H(s.value) + " " + H(xe.value.toFixed(2)), 1)
|
|
2386
2386
|
])
|
|
2387
2387
|
])
|
|
2388
2388
|
];
|
|
2389
2389
|
}),
|
|
2390
|
-
default:
|
|
2391
|
-
|
|
2392
|
-
|
|
2390
|
+
default: X(() => [
|
|
2391
|
+
o("div", Ba, [
|
|
2392
|
+
o("div", null, [
|
|
2393
2393
|
$(d, {
|
|
2394
2394
|
items: ft,
|
|
2395
2395
|
modelValue: Oe.value,
|
|
@@ -2398,14 +2398,14 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2398
2398
|
]),
|
|
2399
2399
|
Oe.value.value === "overview" ? (h(), T(ce, { key: 0 }, [
|
|
2400
2400
|
$(gt, { selectable: "" }, {
|
|
2401
|
-
default:
|
|
2401
|
+
default: X(() => {
|
|
2402
2402
|
var U;
|
|
2403
2403
|
return [
|
|
2404
|
-
|
|
2405
|
-
e[11] || (e[11] =
|
|
2406
|
-
|
|
2404
|
+
o("div", Ta, [
|
|
2405
|
+
e[11] || (e[11] = o("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, [
|
|
2406
|
+
o("div", { class: "flex gap-1" }, "Draft ID")
|
|
2407
2407
|
], -1)),
|
|
2408
|
-
de(" " + H((U =
|
|
2408
|
+
de(" " + H((U = a.draft) == null ? void 0 : U._id), 1)
|
|
2409
2409
|
])
|
|
2410
2410
|
];
|
|
2411
2411
|
}),
|
|
@@ -2415,55 +2415,55 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2415
2415
|
variant: "outlined",
|
|
2416
2416
|
class: "flex flex-col gap-8 px-12 py-16"
|
|
2417
2417
|
}, {
|
|
2418
|
-
default:
|
|
2418
|
+
default: X(() => {
|
|
2419
2419
|
var U, ue;
|
|
2420
2420
|
return [
|
|
2421
|
-
|
|
2422
|
-
e[12] || (e[12] =
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
class: Se(["fm-status-badge", u(st)(((U =
|
|
2426
|
-
}, H(u(Be)(((ue =
|
|
2421
|
+
o("div", ja, [
|
|
2422
|
+
e[12] || (e[12] = o("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
|
|
2423
|
+
o("div", Ma, [
|
|
2424
|
+
o("div", {
|
|
2425
|
+
class: Se(["fm-status-badge", u(st)(((U = a.draft) == null ? void 0 : U.status) ?? "DRAFT")])
|
|
2426
|
+
}, H(u(Be)(((ue = a.draft) == null ? void 0 : ue.status) ?? "")), 3)
|
|
2427
2427
|
])
|
|
2428
2428
|
]),
|
|
2429
2429
|
$(j),
|
|
2430
|
-
|
|
2431
|
-
(h(!0), T(ce, null, he(
|
|
2430
|
+
o("div", Ua, [
|
|
2431
|
+
(h(!0), T(ce, null, he(dn.value, (fe, ke) => (h(), T("div", {
|
|
2432
2432
|
class: "flex flex-col gap-4",
|
|
2433
2433
|
key: ke
|
|
2434
2434
|
}, [
|
|
2435
|
-
|
|
2436
|
-
|
|
2435
|
+
o("div", Ra, [
|
|
2436
|
+
o("div", Pa, H(fe.label), 1)
|
|
2437
2437
|
]),
|
|
2438
|
-
|
|
2438
|
+
o("div", Va, H(fe.value), 1)
|
|
2439
2439
|
]))), 128))
|
|
2440
2440
|
])
|
|
2441
2441
|
];
|
|
2442
2442
|
}),
|
|
2443
2443
|
_: 1
|
|
2444
2444
|
}),
|
|
2445
|
-
|
|
2445
|
+
un.value ? (h(), T("div", Na, [
|
|
2446
2446
|
$(V, {
|
|
2447
2447
|
name: "rule",
|
|
2448
2448
|
size: "sm"
|
|
2449
2449
|
}),
|
|
2450
|
-
|
|
2451
|
-
e[14] || (e[14] =
|
|
2452
|
-
|
|
2453
|
-
Dt.value ? (h(), T("li",
|
|
2450
|
+
o("div", za, [
|
|
2451
|
+
e[14] || (e[14] = o("div", { class: "fm-typo-en-body-md-600" }, "UOM notes", -1)),
|
|
2452
|
+
o("ul", Ea, [
|
|
2453
|
+
Dt.value ? (h(), T("li", La, e[13] || (e[13] = [
|
|
2454
2454
|
de(" Measurements highlighted in "),
|
|
2455
|
-
|
|
2455
|
+
o("span", { class: "font-bold" }, "purple", -1),
|
|
2456
2456
|
de(" are NetSuite-inactive UOMs (surfaced for audit; their amounts are part of the base total). ")
|
|
2457
2457
|
]))) : K("", !0),
|
|
2458
|
-
At.value ? (h(), T("li",
|
|
2458
|
+
At.value ? (h(), T("li", Oa, " Red highlights are UOMs not on the SKU (ignored). ")) : K("", !0)
|
|
2459
2459
|
])
|
|
2460
2460
|
])
|
|
2461
2461
|
])) : K("", !0),
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
e[15] || (e[15] =
|
|
2465
|
-
x.value ? K("", !0) : (h(), T("div",
|
|
2466
|
-
|
|
2462
|
+
o("div", Ha, [
|
|
2463
|
+
o("div", Ya, [
|
|
2464
|
+
e[15] || (e[15] = o("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", Ka, [
|
|
2466
|
+
a.draft && a.draft.status !== u(_e).enum.COMPLETED ? (h(), ae(C, {
|
|
2467
2467
|
key: 0,
|
|
2468
2468
|
label: "Refresh balance",
|
|
2469
2469
|
"prepend-icon": "refresh",
|
|
@@ -2476,7 +2476,7 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2476
2476
|
onClick: Le
|
|
2477
2477
|
}, null, 8, ["loading", "disabled"])) : K("", !0),
|
|
2478
2478
|
$(gt, null, {
|
|
2479
|
-
default:
|
|
2479
|
+
default: X(() => [
|
|
2480
2480
|
$(C, {
|
|
2481
2481
|
label: "Invalidate Draft Cache",
|
|
2482
2482
|
"prepend-icon": "refresh",
|
|
@@ -2497,8 +2497,8 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2497
2497
|
"text-color": "primary",
|
|
2498
2498
|
"bg-color": "transparent",
|
|
2499
2499
|
"border-color": "primary",
|
|
2500
|
-
onClick: e[1] || (e[1] = (U) =>
|
|
2501
|
-
|
|
2500
|
+
onClick: e[1] || (e[1] = (U) => a.draft ? u(r).exportDraft(
|
|
2501
|
+
a.draft,
|
|
2502
2502
|
f.value,
|
|
2503
2503
|
B.value,
|
|
2504
2504
|
Ct.value
|
|
@@ -2506,18 +2506,18 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2506
2506
|
})
|
|
2507
2507
|
]))
|
|
2508
2508
|
]),
|
|
2509
|
-
x.value ? (h(), T("div",
|
|
2510
|
-
e[17] || (e[17] =
|
|
2511
|
-
|
|
2512
|
-
|
|
2509
|
+
x.value ? (h(), T("div", Wa, [
|
|
2510
|
+
e[17] || (e[17] = o("div", { class: "h-80" }, null, -1)),
|
|
2511
|
+
o("div", qa, [
|
|
2512
|
+
o("div", null, [
|
|
2513
2513
|
$(J, { size: "md" })
|
|
2514
2514
|
]),
|
|
2515
|
-
e[16] || (e[16] =
|
|
2515
|
+
e[16] || (e[16] = o("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
|
|
2516
2516
|
]),
|
|
2517
|
-
e[18] || (e[18] =
|
|
2517
|
+
e[18] || (e[18] = o("div", { class: "h-80" }, null, -1))
|
|
2518
2518
|
])) : (h(), T(ce, { key: 1 }, [
|
|
2519
|
-
|
|
2520
|
-
|
|
2519
|
+
o("div", Ga, [
|
|
2520
|
+
o("div", Qa, [
|
|
2521
2521
|
$(O, {
|
|
2522
2522
|
label: "Template Item(s)",
|
|
2523
2523
|
selected: z.value.templateItem,
|
|
@@ -2535,7 +2535,7 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2535
2535
|
placeholder: "Filter items"
|
|
2536
2536
|
}, null, 8, ["modelValue"])
|
|
2537
2537
|
]),
|
|
2538
|
-
u(_).skuTags.size ? (h(), T("div",
|
|
2538
|
+
u(_).skuTags.size ? (h(), T("div", Za, [
|
|
2539
2539
|
(h(!0), T(ce, null, he(u(_).skuTags.keys(), (U) => (h(), ae(O, {
|
|
2540
2540
|
key: `${U}`,
|
|
2541
2541
|
label: `${U}`,
|
|
@@ -2543,14 +2543,14 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2543
2543
|
selected: p[`${U}`],
|
|
2544
2544
|
onClick: (ue) => p[`${U}`] = !p[`${U}`]
|
|
2545
2545
|
}, {
|
|
2546
|
-
default:
|
|
2546
|
+
default: X(() => [
|
|
2547
2547
|
p[`${U}`] ? (h(), ae(V, {
|
|
2548
2548
|
key: 0,
|
|
2549
2549
|
name: "check",
|
|
2550
2550
|
class: "text-white",
|
|
2551
2551
|
size: "sm"
|
|
2552
2552
|
})) : K("", !0),
|
|
2553
|
-
|
|
2553
|
+
o("span", {
|
|
2554
2554
|
class: Se([
|
|
2555
2555
|
"",
|
|
2556
2556
|
{
|
|
@@ -2563,8 +2563,8 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2563
2563
|
_: 2
|
|
2564
2564
|
}, 1032, ["label", "selected", "onClick"]))), 128))
|
|
2565
2565
|
])) : K("", !0),
|
|
2566
|
-
mt.value.length ? (h(), T("div",
|
|
2567
|
-
e[19] || (e[19] =
|
|
2566
|
+
mt.value.length ? (h(), T("div", Ja, [
|
|
2567
|
+
e[19] || (e[19] = o("span", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary self-center" }, "Extra columns:", -1)),
|
|
2568
2568
|
(h(!0), T(ce, null, he(mt.value, (U) => (h(), ae(O, {
|
|
2569
2569
|
key: U,
|
|
2570
2570
|
label: U,
|
|
@@ -2573,9 +2573,9 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2573
2573
|
onClick: (ue) => Ze[U] = !Ze[U]
|
|
2574
2574
|
}, null, 8, ["label", "selected", "onClick"]))), 128))
|
|
2575
2575
|
])) : K("", !0),
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
style:
|
|
2576
|
+
o("div", Xa, [
|
|
2577
|
+
o("div", {
|
|
2578
|
+
style: Ht({ height: "600px", minWidth: `${ln.value}px` })
|
|
2579
2579
|
}, [
|
|
2580
2580
|
$(me, {
|
|
2581
2581
|
"column-defs": xt.value,
|
|
@@ -2587,13 +2587,13 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2587
2587
|
], 64))
|
|
2588
2588
|
])
|
|
2589
2589
|
], 64)) : K("", !0),
|
|
2590
|
-
Oe.value.value === "history" ? (h(), T("div",
|
|
2591
|
-
Ue.value.length ? (h(), T("div",
|
|
2590
|
+
Oe.value.value === "history" ? (h(), T("div", eo, [
|
|
2591
|
+
Ue.value.length ? (h(), T("div", ao, [
|
|
2592
2592
|
(h(!0), T(ce, null, he(Ue.value, (U, ue) => (h(), T(ce, { key: ue }, [
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2593
|
+
o("div", oo, [
|
|
2594
|
+
o("div", so, [
|
|
2595
|
+
o("div", ro, [
|
|
2596
|
+
o("div", {
|
|
2597
2597
|
class: Se([
|
|
2598
2598
|
{
|
|
2599
2599
|
"bg-fm-color-primary": ue !== 0,
|
|
@@ -2603,9 +2603,9 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2603
2603
|
])
|
|
2604
2604
|
}, null, 2)
|
|
2605
2605
|
]),
|
|
2606
|
-
e[22] || (e[22] =
|
|
2607
|
-
|
|
2608
|
-
|
|
2606
|
+
e[22] || (e[22] = o("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
|
|
2607
|
+
o("div", lo, [
|
|
2608
|
+
o("div", {
|
|
2609
2609
|
class: Se([
|
|
2610
2610
|
{
|
|
2611
2611
|
"bg-fm-color-primary": ue < Ue.value.length - 1,
|
|
@@ -2616,15 +2616,15 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2616
2616
|
}, null, 2)
|
|
2617
2617
|
])
|
|
2618
2618
|
]),
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2619
|
+
o("div", io, [
|
|
2620
|
+
o("div", co, H(U.header), 1),
|
|
2621
|
+
o("div", uo, H(U.date), 1)
|
|
2622
2622
|
])
|
|
2623
2623
|
]),
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2624
|
+
o("div", mo, [
|
|
2625
|
+
o("div", fo, [
|
|
2626
|
+
o("div", po, [
|
|
2627
|
+
o("div", {
|
|
2628
2628
|
class: Se([
|
|
2629
2629
|
{
|
|
2630
2630
|
"bg-fm-color-primary": ue < Ue.value.length - 1,
|
|
@@ -2635,19 +2635,19 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2635
2635
|
}, null, 2)
|
|
2636
2636
|
])
|
|
2637
2637
|
]),
|
|
2638
|
-
|
|
2638
|
+
o("div", vo, [
|
|
2639
2639
|
$(D, {
|
|
2640
2640
|
variant: "outlined",
|
|
2641
2641
|
class: "py-12 px-16"
|
|
2642
2642
|
}, {
|
|
2643
|
-
default:
|
|
2644
|
-
|
|
2643
|
+
default: X(() => [
|
|
2644
|
+
o("div", yo, [
|
|
2645
2645
|
(h(!0), T(ce, null, he(U.info, (fe, ke) => (h(), T("div", {
|
|
2646
2646
|
key: ke,
|
|
2647
2647
|
class: "flex flex-col gap-4"
|
|
2648
2648
|
}, [
|
|
2649
|
-
|
|
2650
|
-
|
|
2649
|
+
o("div", go, H(fe == null ? void 0 : fe.label), 1),
|
|
2650
|
+
o("div", bo, [
|
|
2651
2651
|
(h(!0), T(ce, null, he(fe == null ? void 0 : fe.values, (Re, et) => (h(), T("div", {
|
|
2652
2652
|
key: et,
|
|
2653
2653
|
class: "fm-typo-en-body-lg-600"
|
|
@@ -2661,16 +2661,16 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2661
2661
|
])
|
|
2662
2662
|
])
|
|
2663
2663
|
], 64))), 128))
|
|
2664
|
-
])) : (h(), T("div",
|
|
2664
|
+
])) : (h(), T("div", to, [
|
|
2665
2665
|
$(Ae),
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
src: u(
|
|
2666
|
+
o("div", null, [
|
|
2667
|
+
o("img", {
|
|
2668
|
+
src: u(En),
|
|
2669
2669
|
alt: "List is empty"
|
|
2670
|
-
}, null, 8,
|
|
2670
|
+
}, null, 8, no)
|
|
2671
2671
|
]),
|
|
2672
|
-
e[20] || (e[20] =
|
|
2673
|
-
e[21] || (e[21] =
|
|
2672
|
+
e[20] || (e[20] = o("div", { class: "fm-typo-en-body-lg-600" }, H("No records found"), -1)),
|
|
2673
|
+
e[21] || (e[21] = o("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)),
|
|
2674
2674
|
$(Ae),
|
|
2675
2675
|
$(Ae)
|
|
2676
2676
|
]))
|
|
@@ -2687,20 +2687,20 @@ const Ta = { class: "w-full flex flex-col gap-32" }, ja = { class: "flex flex-co
|
|
|
2687
2687
|
approving: Xe.value,
|
|
2688
2688
|
draft: t.draft,
|
|
2689
2689
|
onRefresh: Le,
|
|
2690
|
-
onApprove:
|
|
2690
|
+
onApprove: mn
|
|
2691
2691
|
}, null, 8, ["show", "refreshing", "approving", "draft"])) : K("", !0)
|
|
2692
2692
|
], 64);
|
|
2693
2693
|
};
|
|
2694
2694
|
}
|
|
2695
2695
|
});
|
|
2696
2696
|
var ve = /* @__PURE__ */ ((n) => (n.ready = "ready", n.negative = "negative", n.systemNegative = "systemNegative", n))(ve || {});
|
|
2697
|
-
async function
|
|
2697
|
+
async function Do(n) {
|
|
2698
2698
|
return new Promise((l, t) => {
|
|
2699
|
-
const
|
|
2700
|
-
|
|
2699
|
+
const s = new FileReader();
|
|
2700
|
+
s.onload = (g) => {
|
|
2701
2701
|
var i;
|
|
2702
2702
|
try {
|
|
2703
|
-
const
|
|
2703
|
+
const r = (i = g.target) == null ? void 0 : i.result, c = Hn(r, { type: "array" }), x = c.SheetNames[0], A = c.Sheets[x], f = ot.sheet_to_json(A, {
|
|
2704
2704
|
header: 1,
|
|
2705
2705
|
defval: ""
|
|
2706
2706
|
}), B = (v) => String(v).trim().toLowerCase().replace(/^\uFEFF/, ""), N = f.findIndex(
|
|
@@ -2710,44 +2710,44 @@ async function Ao(n) {
|
|
|
2710
2710
|
l([]);
|
|
2711
2711
|
return;
|
|
2712
2712
|
}
|
|
2713
|
-
const E = f[N],
|
|
2714
|
-
if (
|
|
2713
|
+
const E = f[N], F = E.findIndex((v) => B(v) === "code"), _ = E.findIndex((v) => B(v) === "balance");
|
|
2714
|
+
if (F === -1 || _ === -1) {
|
|
2715
2715
|
t(
|
|
2716
2716
|
new Error(
|
|
2717
|
-
`Missing required columns: ${
|
|
2717
|
+
`Missing required columns: ${F === -1 ? '"Code" ' : ""}${_ === -1 ? '"Balance"' : ""}.`.trim()
|
|
2718
2718
|
)
|
|
2719
2719
|
);
|
|
2720
2720
|
return;
|
|
2721
2721
|
}
|
|
2722
|
-
const p = f.slice(N + 1).filter((v) => String(v[
|
|
2723
|
-
itemCode: String(v[
|
|
2722
|
+
const p = f.slice(N + 1).filter((v) => String(v[F]).trim()).map((v) => ({
|
|
2723
|
+
itemCode: String(v[F]).trim(),
|
|
2724
2724
|
quantity: Number(v[_]) || 0
|
|
2725
2725
|
}));
|
|
2726
2726
|
l(p);
|
|
2727
|
-
} catch (
|
|
2728
|
-
t(
|
|
2727
|
+
} catch (r) {
|
|
2728
|
+
t(r);
|
|
2729
2729
|
}
|
|
2730
|
-
},
|
|
2730
|
+
}, s.onerror = t, s.readAsArrayBuffer(n);
|
|
2731
2731
|
});
|
|
2732
2732
|
}
|
|
2733
|
-
function
|
|
2733
|
+
function Ao(n) {
|
|
2734
2734
|
const l = /* @__PURE__ */ new Map();
|
|
2735
2735
|
return n.forEach((t) => {
|
|
2736
|
-
const
|
|
2737
|
-
l.set(t.itemCode,
|
|
2736
|
+
const s = l.get(t.itemCode) || 0;
|
|
2737
|
+
l.set(t.itemCode, s + t.quantity);
|
|
2738
2738
|
}), l;
|
|
2739
2739
|
}
|
|
2740
|
-
function
|
|
2741
|
-
const t = [],
|
|
2740
|
+
function Co(n, l) {
|
|
2741
|
+
const t = [], s = [];
|
|
2742
2742
|
for (const [g, i] of l.entries()) {
|
|
2743
|
-
const
|
|
2744
|
-
if (!
|
|
2745
|
-
|
|
2743
|
+
const r = n[g];
|
|
2744
|
+
if (!r) {
|
|
2745
|
+
s.push(g);
|
|
2746
2746
|
continue;
|
|
2747
2747
|
}
|
|
2748
2748
|
const c = i < 0 ? "negative" : "ready";
|
|
2749
2749
|
t.push({
|
|
2750
|
-
sku:
|
|
2750
|
+
sku: r,
|
|
2751
2751
|
physicalCount: i,
|
|
2752
2752
|
// Note: filled by composable after readStockBalance()
|
|
2753
2753
|
systemBalance: { amount: 0, precision: 0 },
|
|
@@ -2755,23 +2755,23 @@ function So(n, l) {
|
|
|
2755
2755
|
status: c
|
|
2756
2756
|
});
|
|
2757
2757
|
}
|
|
2758
|
-
return { mergedItems: t, unrecognisedItemCodes:
|
|
2758
|
+
return { mergedItems: t, unrecognisedItemCodes: s };
|
|
2759
2759
|
}
|
|
2760
|
-
function
|
|
2761
|
-
const t = n.filter((x) => !x.isInactive),
|
|
2760
|
+
function So(n, l) {
|
|
2761
|
+
const t = n.filter((x) => !x.isInactive), s = Kn().format("YYYY-MM-DD"), g = `${l} - ${s}.csv`, i = [
|
|
2762
2762
|
["Code", "Name", "Balance"],
|
|
2763
2763
|
...t.map((x) => [x.code, x.name, ""])
|
|
2764
|
-
],
|
|
2765
|
-
ot.book_append_sheet(c,
|
|
2764
|
+
], r = ot.aoa_to_sheet(i), c = ot.book_new();
|
|
2765
|
+
ot.book_append_sheet(c, r, "Template"), Yn(c, g, { bookType: "csv" });
|
|
2766
2766
|
}
|
|
2767
|
-
function
|
|
2768
|
-
const n = W([]), l = W([]), t = W(!1),
|
|
2767
|
+
function $o() {
|
|
2768
|
+
const n = W([]), l = W([]), t = W(!1), s = wt(), g = We(), i = ct(), r = M(
|
|
2769
2769
|
() => n.value.some((f) => f.status === ve.negative)
|
|
2770
2770
|
);
|
|
2771
2771
|
async function c(f) {
|
|
2772
2772
|
n.value = [], l.value = [], t.value = !0;
|
|
2773
2773
|
try {
|
|
2774
|
-
const B = await
|
|
2774
|
+
const B = await Do(f), N = Ao(B), E = s.skuByCode, { mergedItems: F, unrecognisedItemCodes: _ } = Co(
|
|
2775
2775
|
E,
|
|
2776
2776
|
N
|
|
2777
2777
|
), R = await i.readStockBalance(), p = R.skus ?? [];
|
|
@@ -2783,12 +2783,12 @@ function Fo() {
|
|
|
2783
2783
|
);
|
|
2784
2784
|
const v = new Map(
|
|
2785
2785
|
p.map((b) => [b.id, b.balance])
|
|
2786
|
-
), m = new Set(
|
|
2787
|
-
n.value =
|
|
2786
|
+
), m = new Set(F.map((b) => b.sku._id));
|
|
2787
|
+
n.value = F.map((b) => {
|
|
2788
2788
|
const y = v.get(b.sku._id) ?? { amount: 0, precision: 0 }, w = y.amount / Math.pow(10, y.precision);
|
|
2789
2789
|
return { ...b, systemBalance: y, variance: b.physicalCount - w };
|
|
2790
2790
|
});
|
|
2791
|
-
for (const b of Object.values(
|
|
2791
|
+
for (const b of Object.values(s.skuByCode)) {
|
|
2792
2792
|
if (m.has(b._id)) continue;
|
|
2793
2793
|
const y = v.get(b._id);
|
|
2794
2794
|
if (!y) continue;
|
|
@@ -2818,11 +2818,11 @@ function Fo() {
|
|
|
2818
2818
|
name: p.sku.name,
|
|
2819
2819
|
unit: p.sku.unit
|
|
2820
2820
|
},
|
|
2821
|
-
baseAmount:
|
|
2821
|
+
baseAmount: Qt(p.physicalCount, p.sku.unit.precision),
|
|
2822
2822
|
measurementsAmounts: []
|
|
2823
|
-
}),
|
|
2823
|
+
}), F = B.map(E), _ = N.map(E), R = {
|
|
2824
2824
|
effectiveAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2825
|
-
items:
|
|
2825
|
+
items: F,
|
|
2826
2826
|
negativeStockItems: _
|
|
2827
2827
|
};
|
|
2828
2828
|
return await f.createQuickModeDraftWithItems(R);
|
|
@@ -2830,21 +2830,21 @@ function Fo() {
|
|
|
2830
2830
|
function A() {
|
|
2831
2831
|
var B;
|
|
2832
2832
|
const f = ((B = g.currentLocation) == null ? void 0 : B.name) ?? "template";
|
|
2833
|
-
|
|
2833
|
+
So(s.skus, f);
|
|
2834
2834
|
}
|
|
2835
|
-
return { mergedItems: n, unrecognisedItemCodes: l, hasBlockingErrors:
|
|
2835
|
+
return { mergedItems: n, unrecognisedItemCodes: l, hasBlockingErrors: r, isLoading: t, onFileUpload: c, submit: x, downloadTemplate: A };
|
|
2836
2836
|
}
|
|
2837
|
-
const Io = { class: "flex flex-col gap-16" },
|
|
2837
|
+
const Io = { class: "flex flex-col gap-16" }, Fo = {
|
|
2838
2838
|
key: 0,
|
|
2839
2839
|
class: "px-16 py-12 rounded-8 bg-fm-color-danger-weak text-fm-color-danger-default"
|
|
2840
|
-
},
|
|
2840
|
+
}, Bo = { key: 1 }, To = { class: "fm-typo-en-label-md-400 cursor-pointer" }, jo = { class: "mt-8 flex flex-col gap-4" }, Mo = { key: 2 }, Uo = { class: "fm-typo-en-label-md-400 cursor-pointer" }, Ro = { class: "mt-8 flex flex-col gap-4" }, Po = /* @__PURE__ */ je({
|
|
2841
2841
|
__name: "ClosingDraftCreatePreviewTable",
|
|
2842
2842
|
props: {
|
|
2843
2843
|
items: {},
|
|
2844
2844
|
unrecognisedItemCodes: {}
|
|
2845
2845
|
},
|
|
2846
2846
|
setup(n) {
|
|
2847
|
-
const l = n, { t } = Ye(),
|
|
2847
|
+
const l = n, { t } = Ye(), s = M(
|
|
2848
2848
|
() => l.items.filter((c) => c.status === ve.negative)
|
|
2849
2849
|
), g = M(
|
|
2850
2850
|
() => l.items.filter((c) => c.status === ve.systemNegative)
|
|
@@ -2861,7 +2861,7 @@ const Io = { class: "flex flex-col gap-16" }, Bo = {
|
|
|
2861
2861
|
icon: "⚠️",
|
|
2862
2862
|
label: t("inventory.closing.draft.createDraft.previewTable.status.systemNegative")
|
|
2863
2863
|
}
|
|
2864
|
-
})),
|
|
2864
|
+
})), r = [
|
|
2865
2865
|
{
|
|
2866
2866
|
id: "name",
|
|
2867
2867
|
header: () => t("inventory.ingredient.name"),
|
|
@@ -2949,22 +2949,22 @@ const Io = { class: "flex flex-col gap-16" }, Bo = {
|
|
|
2949
2949
|
return (c, x) => {
|
|
2950
2950
|
const A = Z("FmTable");
|
|
2951
2951
|
return h(), T("div", Io, [
|
|
2952
|
-
|
|
2952
|
+
s.value.length > 0 ? (h(), T("div", Fo, [
|
|
2953
2953
|
de(H(u(t)("inventory.closing.draft.createDraft.previewTable.cannotSubmitNegative")) + " ", 1),
|
|
2954
|
-
|
|
2954
|
+
o("strong", null, H(s.value.map((f) => f.sku.code).join(", ")), 1)
|
|
2955
2955
|
])) : K("", !0),
|
|
2956
|
-
g.value.length > 0 ? (h(), T("details",
|
|
2957
|
-
|
|
2958
|
-
|
|
2956
|
+
g.value.length > 0 ? (h(), T("details", Bo, [
|
|
2957
|
+
o("summary", To, H(u(t)("inventory.closing.draft.createDraft.previewTable.systemNegativeNote", [g.value.length])), 1),
|
|
2958
|
+
o("ul", jo, [
|
|
2959
2959
|
(h(!0), T(ce, null, he(g.value, (f) => (h(), T("li", {
|
|
2960
2960
|
key: f.sku._id,
|
|
2961
2961
|
class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
2962
2962
|
}, H(f.sku.code), 1))), 128))
|
|
2963
2963
|
])
|
|
2964
2964
|
])) : K("", !0),
|
|
2965
|
-
c.unrecognisedItemCodes.length > 0 ? (h(), T("details",
|
|
2966
|
-
|
|
2967
|
-
|
|
2965
|
+
c.unrecognisedItemCodes.length > 0 ? (h(), T("details", Mo, [
|
|
2966
|
+
o("summary", Uo, H(u(t)("inventory.closing.draft.createDraft.previewTable.unrecognisedNote", [c.unrecognisedItemCodes.length])), 1),
|
|
2967
|
+
o("ul", Ro, [
|
|
2968
2968
|
(h(!0), T(ce, null, he(c.unrecognisedItemCodes, (f) => (h(), T("li", {
|
|
2969
2969
|
key: f,
|
|
2970
2970
|
class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
@@ -2973,26 +2973,26 @@ const Io = { class: "flex flex-col gap-16" }, Bo = {
|
|
|
2973
2973
|
])) : K("", !0),
|
|
2974
2974
|
$(A, {
|
|
2975
2975
|
"row-data": l.items,
|
|
2976
|
-
"column-defs":
|
|
2976
|
+
"column-defs": r,
|
|
2977
2977
|
pagination: { pageSize: 20 }
|
|
2978
2978
|
}, null, 8, ["row-data"])
|
|
2979
2979
|
]);
|
|
2980
2980
|
};
|
|
2981
2981
|
}
|
|
2982
|
-
}),
|
|
2982
|
+
}), Vo = { class: "flex flex-col gap-16" }, No = { class: "flex flex-col gap-8" }, zo = { class: "fm-typo-en-body-lg-600" }, Eo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Lo = { class: "fm-corner-radius-md p-16 flex items-center gap-16 border border-fm-color-border-default" }, Oo = { class: "flex flex-col flex-1 gap-4" }, Ho = { class: "fm-typo-en-body-md-600" }, Yo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ko = {
|
|
2983
2983
|
key: 0,
|
|
2984
2984
|
class: "flex flex-col gap-8"
|
|
2985
|
-
},
|
|
2985
|
+
}, Wo = { class: "fm-typo-en-body-lg-600" }, qo = {
|
|
2986
2986
|
key: 0,
|
|
2987
2987
|
class: "fm-typo-en-body-sm-400 text-fm-color-system-error-300 flex items-center gap-8"
|
|
2988
|
-
},
|
|
2988
|
+
}, Go = { class: "grid grid-cols-[repeat(3,1fr)] gap-12" }, Qo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary flex items-center gap-4" }, Zo = { class: "flex items-center gap-8 w-full" }, Jo = /* @__PURE__ */ je({
|
|
2989
2989
|
__name: "ClosingDraftCreateSideSheet",
|
|
2990
2990
|
props: {
|
|
2991
2991
|
show: { type: Boolean }
|
|
2992
2992
|
},
|
|
2993
2993
|
emits: ["update:show", "submitted"],
|
|
2994
2994
|
setup(n, { emit: l }) {
|
|
2995
|
-
const t = n,
|
|
2995
|
+
const t = n, s = l, g = Kt(t, "show"), { t: i } = Ye(), r = Ke(), c = W("upload"), x = W(null), A = W(!1), { mergedItems: f, unrecognisedItemCodes: B, hasBlockingErrors: N, isLoading: E, onFileUpload: F, submit: _, downloadTemplate: R } = $o(), p = M(
|
|
2996
2996
|
() => x.value && !E.value && f.value.length > 0
|
|
2997
2997
|
), v = M(() => {
|
|
2998
2998
|
const w = f.value.filter(
|
|
@@ -3020,18 +3020,18 @@ const Io = { class: "flex flex-col gap-16" }, Bo = {
|
|
|
3020
3020
|
];
|
|
3021
3021
|
});
|
|
3022
3022
|
async function m(w) {
|
|
3023
|
-
x.value = w, await
|
|
3023
|
+
x.value = w, await F(w);
|
|
3024
3024
|
}
|
|
3025
3025
|
async function b() {
|
|
3026
3026
|
A.value = !0;
|
|
3027
3027
|
try {
|
|
3028
|
-
await _(), y(),
|
|
3028
|
+
await _(), y(), s("submitted"), r.open({
|
|
3029
3029
|
title: "Success",
|
|
3030
3030
|
message: "Closing draft created successfully",
|
|
3031
3031
|
type: "success"
|
|
3032
3032
|
});
|
|
3033
3033
|
} catch (w) {
|
|
3034
|
-
console.error("Failed to create closing draft", { error: w }),
|
|
3034
|
+
console.error("Failed to create closing draft", { error: w }), r.open({
|
|
3035
3035
|
title: "Something went wrong",
|
|
3036
3036
|
message: "Failed to create closing draft. Please try again",
|
|
3037
3037
|
type: "error"
|
|
@@ -3055,22 +3055,22 @@ const Io = { class: "flex flex-col gap-16" }, Bo = {
|
|
|
3055
3055
|
"onUpdate:modelValue": Y[2] || (Y[2] = (S) => _t(g) ? g.value = S : null),
|
|
3056
3056
|
header: u(i)("inventory.closing.draft.createDraft.title")
|
|
3057
3057
|
}, {
|
|
3058
|
-
default:
|
|
3059
|
-
|
|
3058
|
+
default: X(() => [
|
|
3059
|
+
o("div", Vo, [
|
|
3060
3060
|
c.value === "upload" ? (h(), T(ce, { key: 0 }, [
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
$(
|
|
3061
|
+
o("div", No, [
|
|
3062
|
+
o("div", zo, H(u(i)("inventory.closing.draft.createDraft.importCsv")), 1),
|
|
3063
|
+
o("div", Eo, H(u(i)("inventory.closing.draft.createDraft.uploadDescription")), 1),
|
|
3064
|
+
$(Wn, {
|
|
3065
3065
|
class: Se({ "h-[200px]": !x.value }),
|
|
3066
3066
|
accept: ".csv",
|
|
3067
3067
|
disabled: u(E),
|
|
3068
3068
|
onFileUpload: m
|
|
3069
|
-
},
|
|
3069
|
+
}, kn({ _: 2 }, [
|
|
3070
3070
|
x.value ? {
|
|
3071
3071
|
name: "default",
|
|
3072
|
-
fn:
|
|
3073
|
-
|
|
3072
|
+
fn: X(({ openFileDialog: S }) => [
|
|
3073
|
+
o("div", Lo, [
|
|
3074
3074
|
u(E) ? (h(), ae(q, {
|
|
3075
3075
|
key: 0,
|
|
3076
3076
|
size: "md",
|
|
@@ -3081,9 +3081,9 @@ const Io = { class: "flex flex-col gap-16" }, Bo = {
|
|
|
3081
3081
|
color: "system-success-400",
|
|
3082
3082
|
size: "lg"
|
|
3083
3083
|
})),
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3084
|
+
o("div", Oo, [
|
|
3085
|
+
o("div", Ho, H(x.value.name), 1),
|
|
3086
|
+
o("div", Yo, H(u(E) ? u(i)("inventory.closing.draft.createDraft.processing") : u(i)("inventory.closing.draft.createDraft.itemsLoaded", [u(f).length])), 1)
|
|
3087
3087
|
]),
|
|
3088
3088
|
u(E) ? K("", !0) : (h(), ae(z, {
|
|
3089
3089
|
key: 2,
|
|
@@ -3098,27 +3098,27 @@ const Io = { class: "flex flex-col gap-16" }, Bo = {
|
|
|
3098
3098
|
} : void 0
|
|
3099
3099
|
]), 1032, ["class", "disabled"])
|
|
3100
3100
|
]),
|
|
3101
|
-
p.value ? (h(), T("div",
|
|
3102
|
-
|
|
3103
|
-
u(N) ? (h(), T("div",
|
|
3101
|
+
p.value ? (h(), T("div", Ko, [
|
|
3102
|
+
o("div", Wo, H(u(i)("inventory.closing.draft.createDraft.importSummary")), 1),
|
|
3103
|
+
u(N) ? (h(), T("div", qo, [
|
|
3104
3104
|
$(re, {
|
|
3105
3105
|
name: "error",
|
|
3106
3106
|
size: "sm",
|
|
3107
3107
|
color: "system-error-300"
|
|
3108
3108
|
}),
|
|
3109
|
-
|
|
3109
|
+
o("span", null, H(u(i)("inventory.closing.draft.createDraft.reviewIssues")), 1)
|
|
3110
3110
|
])) : K("", !0),
|
|
3111
3111
|
$(le, {
|
|
3112
3112
|
variant: "outlined",
|
|
3113
3113
|
class: "flex flex-col gap-12 px-16 py-12"
|
|
3114
3114
|
}, {
|
|
3115
|
-
default:
|
|
3116
|
-
|
|
3115
|
+
default: X(() => [
|
|
3116
|
+
o("div", Go, [
|
|
3117
3117
|
(h(!0), T(ce, null, he(v.value, (S) => (h(), T("div", {
|
|
3118
3118
|
key: S.label,
|
|
3119
3119
|
class: "flex flex-col gap-4"
|
|
3120
3120
|
}, [
|
|
3121
|
-
|
|
3121
|
+
o("div", Qo, [
|
|
3122
3122
|
S.isError ? (h(), ae(re, {
|
|
3123
3123
|
key: 0,
|
|
3124
3124
|
name: "error",
|
|
@@ -3131,9 +3131,9 @@ const Io = { class: "flex flex-col gap-16" }, Bo = {
|
|
|
3131
3131
|
size: "sm",
|
|
3132
3132
|
color: "system-warning-300"
|
|
3133
3133
|
})) : K("", !0),
|
|
3134
|
-
|
|
3134
|
+
o("span", null, H(S.label), 1)
|
|
3135
3135
|
]),
|
|
3136
|
-
|
|
3136
|
+
o("div", {
|
|
3137
3137
|
class: Se([
|
|
3138
3138
|
"fm-typo-en-body-lg-600",
|
|
3139
3139
|
{
|
|
@@ -3149,15 +3149,15 @@ const Io = { class: "flex flex-col gap-16" }, Bo = {
|
|
|
3149
3149
|
})
|
|
3150
3150
|
])) : K("", !0)
|
|
3151
3151
|
], 64)) : K("", !0),
|
|
3152
|
-
c.value === "preview" ? (h(), ae(
|
|
3152
|
+
c.value === "preview" ? (h(), ae(Po, {
|
|
3153
3153
|
key: 1,
|
|
3154
3154
|
items: u(f),
|
|
3155
3155
|
"unrecognised-item-codes": u(B)
|
|
3156
3156
|
}, null, 8, ["items", "unrecognised-item-codes"])) : K("", !0)
|
|
3157
3157
|
])
|
|
3158
3158
|
]),
|
|
3159
|
-
"side-sheet-footer":
|
|
3160
|
-
|
|
3159
|
+
"side-sheet-footer": X(() => [
|
|
3160
|
+
o("div", Zo, [
|
|
3161
3161
|
c.value === "preview" ? (h(), ae(z, {
|
|
3162
3162
|
key: 0,
|
|
3163
3163
|
variant: "secondary",
|
|
@@ -3172,7 +3172,7 @@ const Io = { class: "flex flex-col gap-16" }, Bo = {
|
|
|
3172
3172
|
disabled: !x.value || u(E),
|
|
3173
3173
|
onClick: Y[1] || (Y[1] = (S) => c.value = "preview")
|
|
3174
3174
|
}, null, 8, ["label", "disabled"])) : K("", !0),
|
|
3175
|
-
c.value === "preview" ? (h(), ae(
|
|
3175
|
+
c.value === "preview" ? (h(), ae(qn, {
|
|
3176
3176
|
key: 2,
|
|
3177
3177
|
label: u(i)("inventory.closing.draft.createDraft.submit"),
|
|
3178
3178
|
disabled: u(N) || u(f).length === 0 || A.value,
|
|
@@ -3200,12 +3200,12 @@ const Io = { class: "flex flex-col gap-16" }, Bo = {
|
|
|
3200
3200
|
}, 8, ["model-value", "header"]);
|
|
3201
3201
|
};
|
|
3202
3202
|
}
|
|
3203
|
-
}),
|
|
3203
|
+
}), Xo = { class: "flex-1 flex flex-col gap-8" }, es = { class: "flex flex-col" }, ts = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ns = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, as = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, os = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, js = /* @__PURE__ */ je({
|
|
3204
3204
|
__name: "ClosingDraftView",
|
|
3205
3205
|
setup(n) {
|
|
3206
|
-
const { t: l } = Ye(), { viewDraft: t } = it(), { viewClosingDraftProps:
|
|
3207
|
-
i.watchLocation(
|
|
3208
|
-
const A = M(() =>
|
|
3206
|
+
const { t: l } = Ye(), { viewDraft: t } = it(), { viewClosingDraftProps: s, viewClosingDraftShow: g } = Fn(it()), i = We(), r = on(), c = xn(), { breakpoints: x } = Cn();
|
|
3207
|
+
i.watchLocation(r.fetchDrafts);
|
|
3208
|
+
const A = M(() => r.loading), f = W(""), B = W(!1), N = M(() => x.value.xs || x.value.sm), E = M(() => N.value ? 10 : 20), F = M(
|
|
3209
3209
|
() => {
|
|
3210
3210
|
var v;
|
|
3211
3211
|
return ((v = i.currentLocation) == null ? void 0 : v.type) === In.enum.warehouse;
|
|
@@ -3216,7 +3216,7 @@ const Io = { class: "flex flex-col gap-16" }, Bo = {
|
|
|
3216
3216
|
case "add":
|
|
3217
3217
|
return B.value = !0;
|
|
3218
3218
|
case "refresh":
|
|
3219
|
-
return
|
|
3219
|
+
return r.fetchDrafts();
|
|
3220
3220
|
}
|
|
3221
3221
|
}
|
|
3222
3222
|
function R(v) {
|
|
@@ -3233,18 +3233,18 @@ const Io = { class: "flex flex-col gap-16" }, Bo = {
|
|
|
3233
3233
|
value: "refresh",
|
|
3234
3234
|
isPrimary: !1
|
|
3235
3235
|
};
|
|
3236
|
-
return [...
|
|
3236
|
+
return [...F.value ? [v] : [], m];
|
|
3237
3237
|
});
|
|
3238
3238
|
return (v, m) => {
|
|
3239
3239
|
const b = Z("FmTable");
|
|
3240
3240
|
return h(), T(ce, null, [
|
|
3241
|
-
$(
|
|
3241
|
+
$(Dn, {
|
|
3242
3242
|
title: u(l)("inventory.closing.draft.title"),
|
|
3243
3243
|
actions: p.value,
|
|
3244
3244
|
"onClick:action": _
|
|
3245
3245
|
}, {
|
|
3246
|
-
default:
|
|
3247
|
-
|
|
3246
|
+
default: X(() => [
|
|
3247
|
+
o("div", {
|
|
3248
3248
|
class: Se([
|
|
3249
3249
|
"flex flex-col gap-8 max-h-full",
|
|
3250
3250
|
{
|
|
@@ -3253,56 +3253,56 @@ const Io = { class: "flex flex-col gap-16" }, Bo = {
|
|
|
3253
3253
|
}
|
|
3254
3254
|
])
|
|
3255
3255
|
}, [
|
|
3256
|
-
$(
|
|
3256
|
+
$(zn, {
|
|
3257
3257
|
"change-location": "",
|
|
3258
3258
|
searchable: "",
|
|
3259
3259
|
search: f.value,
|
|
3260
3260
|
"onUpdate:search": m[0] || (m[0] = (y) => f.value = y)
|
|
3261
3261
|
}, null, 8, ["search"]),
|
|
3262
3262
|
(h(), ae(b, {
|
|
3263
|
-
key: u(
|
|
3264
|
-
style:
|
|
3265
|
-
"column-defs": u(
|
|
3266
|
-
"row-data": u(
|
|
3263
|
+
key: u(r).tableKey,
|
|
3264
|
+
style: Ht(u(c).tableHeight),
|
|
3265
|
+
"column-defs": u(r).columnDefs,
|
|
3266
|
+
"row-data": u(r).drafts,
|
|
3267
3267
|
"search-value": f.value,
|
|
3268
3268
|
loading: A.value,
|
|
3269
3269
|
onRowClick: m[1] || (m[1] = (y) => u(t)(y.original)),
|
|
3270
3270
|
"page-size": E.value
|
|
3271
3271
|
}, {
|
|
3272
|
-
"list-row":
|
|
3273
|
-
$(
|
|
3272
|
+
"list-row": X((y) => [
|
|
3273
|
+
$(Gn, {
|
|
3274
3274
|
row: y,
|
|
3275
3275
|
onRowClick: (w) => u(t)(w)
|
|
3276
3276
|
}, {
|
|
3277
|
-
default:
|
|
3278
|
-
var Y, q, re, z, le, P, S, ie, L,
|
|
3277
|
+
default: X((w) => {
|
|
3278
|
+
var Y, q, re, z, le, P, S, ie, L, I, Q, se, we, xe, De, $e, Ee, Le, Me, Ge;
|
|
3279
3279
|
return [
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3280
|
+
o("div", Xo, [
|
|
3281
|
+
o("div", es, [
|
|
3282
|
+
o("div", ts, [
|
|
3283
3283
|
$(u(at), {
|
|
3284
3284
|
render: (re = (q = (Y = w._id) == null ? void 0 : Y.column) == null ? void 0 : q.columnDef) == null ? void 0 : re.cell,
|
|
3285
3285
|
props: (le = (z = w._id) == null ? void 0 : z.getContext) == null ? void 0 : le.call(z)
|
|
3286
3286
|
}, null, 8, ["render", "props"])
|
|
3287
3287
|
]),
|
|
3288
|
-
|
|
3288
|
+
o("div", ns, [
|
|
3289
3289
|
$(u(at), {
|
|
3290
3290
|
render: (ie = (S = (P = w.name) == null ? void 0 : P.column) == null ? void 0 : S.columnDef) == null ? void 0 : ie.cell,
|
|
3291
|
-
props: (
|
|
3291
|
+
props: (I = (L = w.name) == null ? void 0 : L.getContext) == null ? void 0 : I.call(L)
|
|
3292
3292
|
}, null, 8, ["render", "props"])
|
|
3293
3293
|
]),
|
|
3294
|
-
|
|
3294
|
+
o("div", as, H([
|
|
3295
3295
|
...y.original.items.slice(0, 3).map((ut) => ut.sku.name),
|
|
3296
3296
|
...y.original.items.length >= 3 ? [`and ${y.original.items.length - 3} more items`] : []
|
|
3297
3297
|
].join(", ")), 1),
|
|
3298
|
-
|
|
3298
|
+
o("div", os, [
|
|
3299
3299
|
$(u(at), {
|
|
3300
3300
|
render: (we = (se = (Q = w.ref) == null ? void 0 : Q.column) == null ? void 0 : se.columnDef) == null ? void 0 : we.cell,
|
|
3301
3301
|
props: (De = (xe = w.ref) == null ? void 0 : xe.getContext) == null ? void 0 : De.call(xe)
|
|
3302
3302
|
}, null, 8, ["render", "props"])
|
|
3303
3303
|
])
|
|
3304
3304
|
]),
|
|
3305
|
-
|
|
3305
|
+
o("div", null, [
|
|
3306
3306
|
$(u(at), {
|
|
3307
3307
|
render: (Le = (Ee = ($e = w.status) == null ? void 0 : $e.column) == null ? void 0 : Ee.columnDef) == null ? void 0 : Le.cell,
|
|
3308
3308
|
props: (Ge = (Me = w.status) == null ? void 0 : Me.getContext) == null ? void 0 : Ge.call(Me)
|
|
@@ -3320,17 +3320,17 @@ const Io = { class: "flex flex-col gap-16" }, Bo = {
|
|
|
3320
3320
|
]),
|
|
3321
3321
|
_: 1
|
|
3322
3322
|
}, 8, ["title", "actions"]),
|
|
3323
|
-
$(
|
|
3323
|
+
$(Jo, {
|
|
3324
3324
|
show: B.value,
|
|
3325
3325
|
"onUpdate:show": m[2] || (m[2] = (y) => B.value = y),
|
|
3326
|
-
onSubmitted: u(
|
|
3326
|
+
onSubmitted: u(r).fetchDrafts
|
|
3327
3327
|
}, null, 8, ["show", "onSubmitted"]),
|
|
3328
|
-
(h(), ae(
|
|
3329
|
-
$(
|
|
3328
|
+
(h(), ae(_n, { to: "body" }, [
|
|
3329
|
+
$(xo, wn(u(s), {
|
|
3330
3330
|
show: u(g),
|
|
3331
3331
|
"onUpdate:show": m[3] || (m[3] = (y) => _t(g) ? g.value = y : null),
|
|
3332
|
-
onSubmitted: m[4] || (m[4] = () => (g.value = !1, u(
|
|
3333
|
-
onRefresh: m[5] || (m[5] = (y) => u(
|
|
3332
|
+
onSubmitted: m[4] || (m[4] = () => (g.value = !1, u(r).fetchDrafts())),
|
|
3333
|
+
onRefresh: m[5] || (m[5] = (y) => u(r).updateDraftRef(y))
|
|
3334
3334
|
}), null, 16, ["show"])
|
|
3335
3335
|
]))
|
|
3336
3336
|
], 64);
|
|
@@ -3338,5 +3338,5 @@ const Io = { class: "flex flex-col gap-16" }, Bo = {
|
|
|
3338
3338
|
}
|
|
3339
3339
|
});
|
|
3340
3340
|
export {
|
|
3341
|
-
|
|
3341
|
+
js as default
|
|
3342
3342
|
};
|