@feedmepos/mf-inventory-portal 1.3.11 → 1.3.12-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-CBd6w_qA.js → App-CNtTZWS5.js} +3 -3
- package/dist/{ApprovalView-T5ukxJT2.js → ApprovalView-CEl22JiC.js} +7 -7
- package/dist/{BindingsDialog-wnUUvDbJ.js → BindingsDialog-CfKXCpBU.js} +2 -2
- package/dist/{BindingsPicker-DfxWEsuD.js → BindingsPicker-Cs5tz33G.js} +2 -2
- package/dist/{BindingsTable-C4osZe4g.js → BindingsTable-BfnpZ-KA.js} +3 -3
- package/dist/ClosingDraftView-DkhhKjNZ.js +3005 -0
- package/dist/{ClosingHistoryView-DVkRqMby.js → ClosingHistoryView-BZGgnEMk.js} +5 -5
- package/dist/{ClosingTemplateView-CWVFpLQp.js → ClosingTemplateView-CePW41Zv.js} +14 -14
- package/dist/{DeliveryOrderPrintPreview-CYJ-N_nT.js → DeliveryOrderPrintPreview-CMiT6FFJ.js} +9 -9
- package/dist/FmConfirmationButton.vue_vue_type_script_setup_true_lang-DLrMEGFR.js +62 -0
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DqNegFEz.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Cy37JvjC.js} +17 -17
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CmJ1-ez_.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D1F76xVX.js} +2 -2
- package/dist/{FmMultiselectDialog-DVmf2SUo.js → FmMultiselectDialog-BsvCwcJc.js} +1 -1
- package/dist/{FmMultiselectDialog-BlQ73-mq.js → FmMultiselectDialog-DhMpDoSp.js} +2 -2
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-QjHZgy15.js → FmUnitInput.vue_vue_type_script_setup_true_lang-nHP7zkk1.js} +4 -4
- package/dist/{ImportView-2Lv-F8mA.js → ImportView-i_QNJOjX.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BrBwx7H_.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-9mBpcrHT.js} +1 -1
- package/dist/{IngredientGroupView-6ehuvvaQ.js → IngredientGroupView-BRXP6KA8.js} +5 -5
- package/dist/{IngredientsView-CblSczx0.js → IngredientsView-Ctxhsn56.js} +15 -15
- package/dist/{IntegrationExplorerView-B1_QbRxN.js → IntegrationExplorerView-Bh04rXi3.js} +5 -5
- package/dist/{IntegrationView-O07aQ73D.js → IntegrationView-D21VT578.js} +13 -13
- package/dist/{InventoryBindingForm-D6ZEMcBv.js → InventoryBindingForm-DRN9QJi0.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-D4m2EmK1.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-BLoIOdb3.js} +5 -5
- package/dist/{InventoryBindingSummary-CtpcQqQH.js → InventoryBindingSummary-PAiqx015.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang--DMDGodL.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BIvMfYs0.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DUMRp4XY.js → PremiumBadge.vue_vue_type_script_setup_true_lang--ld9yYXG.js} +1 -1
- package/dist/{PublishView-BDl-gijS.js → PublishView-Dnltnb2q.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-BegfBpk1.js → PurchaseOrderPrintPreview-C117AdbG.js} +9 -9
- package/dist/{ReceiveRequestView-BOwtvG9t.js → ReceiveRequestView-CEGAD0Ng.js} +23 -23
- package/dist/{RecipeView-CH24uIHd.js → RecipeView-BPoXX96N.js} +15 -15
- package/dist/{SettingsView-BS1TIbEG.js → SettingsView-5wcHwBbj.js} +4 -4
- package/dist/StockView-QpWVITjo.js +2431 -0
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DAeIe9L0.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DoBOG20i.js} +1 -1
- package/dist/{SupplierView-BGuEnnrq.js → SupplierView-CXztXTGJ.js} +12 -12
- package/dist/{SurchargeView-CNG75X-N.js → SurchargeView-mA1cNQGF.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-peUaqYJf.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-CbEb8v1Q.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-7_GwFKXj.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-D1hykQLi.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-CFDPN904.js → TransferDetails.vue_vue_type_script_setup_true_lang-zeZt-Xni.js} +91 -91
- package/dist/{TransferTemplateView-BWvtu-wX.js → TransferTemplateView-RD0i6kb6.js} +584 -638
- package/dist/{UnitCostHistoryView-DOJE-1OS.js → UnitCostHistoryView-BWCq8Po_.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-CscoVkhG.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-CZjt9Tph.js} +4 -4
- package/dist/{UnitView-DuAu2apH.js → UnitView-CDqc3Tlc.js} +7 -7
- package/dist/{WarehouseView-or9SYlSw.js → WarehouseView-Dn9Y1pfn.js} +5 -5
- package/dist/{WastageTemplateView-COW_V0fj.js → WastageTemplateView-DqNfxcrF.js} +14 -14
- package/dist/api/closing-draft.d.ts +2 -0
- package/dist/{app-D54yDxFV.js → app-BMCau-r9.js} +22168 -21063
- package/dist/app.d.ts +391 -0
- package/dist/app.js +2 -2
- package/dist/{closing-template-ldiEKhOl.js → closing-template-PafmbL9x.js} +1 -1
- package/dist/components/ui-library/FmConfirmationButton.vue.d.ts +2 -0
- package/dist/{date2-BLeYHVHx.js → date2-NGc-US7r.js} +1 -1
- package/dist/{dayjs.min-DGQ4zttU.js → dayjs.min-D6CbxpmT.js} +1 -1
- package/dist/{decimal-xstA267T.js → decimal-CZC4S20U.js} +2 -2
- package/dist/{defineDeepModel-Cr10VhS5.js → defineDeepModel-BWzoo1Yl.js} +1 -1
- package/dist/{duplicate-template-CyE0xzx2.js → duplicate-template-BxSUC5LI.js} +1 -1
- package/dist/{export-Dg8UUfiF.js → export-Df2CdXk-.js} +1 -1
- package/dist/{feature-DjgoqZRe.js → feature-Byu94DG1.js} +28 -28
- package/dist/{format-time-from-id-BUfvjuAI.js → format-time-from-id-hx4F-i1-.js} +1 -1
- package/dist/{format-unit-display-CjcUbFWk.js → format-unit-display-CDw8VsCc.js} +11 -11
- package/dist/{import-export.helper-CgtFAIYx.js → import-export.helper-DYFRZAI2.js} +6 -6
- package/dist/{index-DhmQ_-Xs.js → index-Bfe8USZ3.js} +1 -1
- package/dist/{index-DjsWOEAk.js → index-CsMpGUvS.js} +1 -1
- package/dist/{index-D1DXcz-1.js → index-DodBVGPe.js} +3 -3
- package/dist/{inventory-core-dart.default-BPi15AEL.js → inventory-core-dart.default-Do9H1oK-.js} +1 -1
- package/dist/{lodash-BKR9tW9Z.js → lodash-jqyiF2Jy.js} +1 -1
- package/dist/{lz-string-CXAZq-_B.js → lz-string-CZH3sbUP.js} +1 -1
- package/dist/{netsuite-BtyQlk6P.js → netsuite-D7C_nhsL.js} +37 -37
- package/dist/{number-DcJHR1ZR.js → number-Dzj3ENjG.js} +3 -3
- package/dist/{predefined-templates-msHan4_0.js → predefined-templates-BZ9EyGnO.js} +1 -1
- package/dist/{purchase-order-template-CYXcyeQV.js → purchase-order-template-DE9pQpEF.js} +1 -1
- package/dist/{recalculationUtils-1IqGhVdW.js → recalculationUtils-BvTzacgL.js} +1 -1
- package/dist/{rules-DXbirS4I.js → rules-Cb9NgTav.js} +2 -2
- package/dist/{stock-CEQ8o0P7.js → stock-BVdxOXPo.js} +1 -1
- package/dist/{stock-Co5liDhH.js → stock-CoJZvuG_.js} +3 -3
- package/dist/{supplier-DAiM8u9g.js → supplier-B7nSOpfH.js} +2 -2
- package/dist/{surcharge-DFgeEcwF.js → surcharge-F1vEGWak.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-RBp06_Ny.js → use-ingredient-select-dialog-BqBdVzw-.js} +2 -2
- package/dist/{use-inventory-binding-dialog-BJUDORac.js → use-inventory-binding-dialog-CsQ8GQND.js} +2 -2
- package/dist/{use-template-enabled-locations-DCgY6X-O.js → use-template-enabled-locations-BzZBqRYv.js} +2 -2
- package/dist/views/closing-draft/components/closing-draft-create/ClosingDraftCreatePreviewTable.vue.d.ts +18 -0
- package/dist/views/closing-draft/components/closing-draft-create/ClosingDraftCreateSideSheet.vue.d.ts +21 -0
- package/dist/views/closing-draft/composables/use-closing-draft-import.d.ts +559 -0
- package/dist/views/closing-draft/helpers/closing-draft-import.helper.d.ts +26 -0
- package/dist/views/stock/composables/use-stock-adjustment-permission.d.ts +3 -0
- package/dist/views/stock/composables/use-stock-adjustment-permission.test.d.ts +1 -0
- package/dist/{vue-i18n-CcG2seRc.js → vue-i18n-Gpl_Em6v.js} +252 -252
- package/dist/{xlsx-DQZhwN-j.js → xlsx-Cq--BOe0.js} +2 -2
- package/dist/{xlsx.util-BVyHdIH5.js → xlsx.util-BD4BK3XO.js} +1 -1
- package/package.json +4 -3
- package/dist/ClosingDraftView-g90vlE4b.js +0 -2476
- package/dist/StockView-D9hMA7Q6.js +0 -2406
|
@@ -1,2476 +0,0 @@
|
|
|
1
|
-
import { defineComponent as Ve, ref as G, computed as P, onMounted as nt, resolveComponent as q, openBlock as S, createElementBlock as M, Fragment as ue, createTextVNode as de, createBlock as pe, withCtx as Q, createElementVNode as a, toDisplayString as Z, unref as b, createVNode as k, createCommentVNode as se, h as x, watch as Oe, renderList as Te, reactive as zt, isRef as xt, normalizeClass as je, normalizeStyle as Dt, Teleport as Ht, mergeProps as Ot } from "vue";
|
|
2
|
-
import { u as Yt, _ as Kt } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-sUxHOj47.js";
|
|
3
|
-
import { useCoreStore as wt, useI18n as At } from "@feedmepos/mf-common";
|
|
4
|
-
import { useSnackbar as at, useDialog as qt, components as ke, useProxiedModel as Gt, useBreakpoints as Qt } from "@feedmepos/ui-library";
|
|
5
|
-
import { o as Wt, u as Ge, M as J, y as K, s as St, v as Ue, O as _e, D as Ce, c as Zt, a as Ct } from "./app-D54yDxFV.js";
|
|
6
|
-
import { defineStore as $t, storeToRefs as Jt } from "pinia";
|
|
7
|
-
import { b as Ke, e as Ft, f as Xt, a as we } from "./date2-BLeYHVHx.js";
|
|
8
|
-
import { R as en } from "./rules-DXbirS4I.js";
|
|
9
|
-
import { e as ot, a as tt, t as tn, c as Re, l as Bt, m as Tt, j as jt, k as It, o as te } from "./number-DcJHR1ZR.js";
|
|
10
|
-
import { b as nn, d as an } from "./xlsx.util-BVyHdIH5.js";
|
|
11
|
-
import { u as on } from "./stock-Co5liDhH.js";
|
|
12
|
-
import { u as st } from "./stock-CEQ8o0P7.js";
|
|
13
|
-
import { D as ht, R as Be } from "./row-action.enum-Co_O4qD9.js";
|
|
14
|
-
import { c as sn } from "./component-kqxARxvM.js";
|
|
15
|
-
import { f as rn } from "./format-time-from-id-BUfvjuAI.js";
|
|
16
|
-
import { f as ln } from "./recalculationUtils-1IqGhVdW.js";
|
|
17
|
-
import { _ as cn } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CmJ1-ez_.js";
|
|
18
|
-
import { E as un } from "./empty-placeholder-wf6-BWE8.js";
|
|
19
|
-
import { F as kt } from "./FmAdminBadge-DjnBAgyv.js";
|
|
20
|
-
import { u as dn } from "./vue-i18n-CcG2seRc.js";
|
|
21
|
-
import { F as mn } from "./decimal-xstA267T.js";
|
|
22
|
-
import { _ as fn, F as He } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
|
|
23
|
-
const Qe = Wt((u, s) => {
|
|
24
|
-
function e() {
|
|
25
|
-
return Ge().currentLocation.dbName;
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
async getDraft(d) {
|
|
29
|
-
const D = e(), _ = `${u.inventoryBackendUrl}/${D}/closing-draft/${d}`;
|
|
30
|
-
return s.get(_);
|
|
31
|
-
},
|
|
32
|
-
async readDrafts() {
|
|
33
|
-
const d = e(), D = `${u.inventoryBackendUrl}/${d}/closing-draft`;
|
|
34
|
-
return s.get(D);
|
|
35
|
-
},
|
|
36
|
-
async runOperation(d) {
|
|
37
|
-
const D = e(), _ = `${u.inventoryBackendUrl}/${D}/closing-draft/run-operation`;
|
|
38
|
-
return s.post(_, d);
|
|
39
|
-
},
|
|
40
|
-
async runOperationV1(d) {
|
|
41
|
-
const D = e(), _ = `${u.inventoryBackendUrl}/${D}/closing-draft/v1/run-operation`;
|
|
42
|
-
return s.post(_, d);
|
|
43
|
-
},
|
|
44
|
-
async sync(d) {
|
|
45
|
-
const D = e(), _ = `${u.inventoryBackendUrl}/${D}/closing-draft/sync`;
|
|
46
|
-
return s.post(_, d);
|
|
47
|
-
},
|
|
48
|
-
async cloneDraft(d) {
|
|
49
|
-
const D = e(), _ = `${u.inventoryBackendUrl}/${D}/closing-draft/${d}/clone`;
|
|
50
|
-
return s.post(_, {});
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
}), pn = { class: "fm-typo-en-body-lg-400" }, vn = { class: "fm-typo-en-body-lg-600" }, yn = {
|
|
54
|
-
key: 0,
|
|
55
|
-
class: "flex flex-col"
|
|
56
|
-
}, gn = {
|
|
57
|
-
key: 0,
|
|
58
|
-
class: "fm-typo-en-body-sm-400 text-fm-color-typo-error mt-4"
|
|
59
|
-
}, bn = { class: "flex gap-12 py-8 justify-end w-full" }, et = /* @__PURE__ */ Ve({
|
|
60
|
-
__name: "ClosingDraftAction",
|
|
61
|
-
props: {
|
|
62
|
-
draft: {},
|
|
63
|
-
action: {},
|
|
64
|
-
onCancel: { type: Function },
|
|
65
|
-
onFinished: { type: Function }
|
|
66
|
-
},
|
|
67
|
-
setup(u) {
|
|
68
|
-
const s = u, e = G(), d = Qe(), D = at(), _ = G(!1), l = G(null), L = G(!1), V = P(() => {
|
|
69
|
-
switch (s.action) {
|
|
70
|
-
case J.enum.approveDraft:
|
|
71
|
-
return "Approve";
|
|
72
|
-
case J.enum.rejectDraft:
|
|
73
|
-
return "Reject";
|
|
74
|
-
case J.enum.markAsFailed:
|
|
75
|
-
return "Mark as Failed";
|
|
76
|
-
}
|
|
77
|
-
throw new Error(`Unknown action: ${s.action}`);
|
|
78
|
-
}), U = P(() => {
|
|
79
|
-
switch (s.action) {
|
|
80
|
-
case J.enum.approveDraft:
|
|
81
|
-
return "primary";
|
|
82
|
-
case J.enum.rejectDraft:
|
|
83
|
-
return "destructive";
|
|
84
|
-
case J.enum.markAsFailed:
|
|
85
|
-
return "destructive";
|
|
86
|
-
}
|
|
87
|
-
throw new Error(`Unknown action: ${s.action}`);
|
|
88
|
-
});
|
|
89
|
-
nt(() => {
|
|
90
|
-
if (s.draft.effectiveAt)
|
|
91
|
-
l.value = new Date(s.draft.effectiveAt);
|
|
92
|
-
else {
|
|
93
|
-
const N = new Date(s.draft.createdAt);
|
|
94
|
-
N.setHours(23, 59, 59, 999), l.value = N;
|
|
95
|
-
}
|
|
96
|
-
L.value = !0;
|
|
97
|
-
});
|
|
98
|
-
const A = P({
|
|
99
|
-
get() {
|
|
100
|
-
return l.value === null ? "" : Ke(l.value);
|
|
101
|
-
},
|
|
102
|
-
set(N) {
|
|
103
|
-
if (N) {
|
|
104
|
-
const y = /* @__PURE__ */ new Date(`${N} ${E.value}`);
|
|
105
|
-
y.setSeconds(59, 999), l.value = y;
|
|
106
|
-
} else
|
|
107
|
-
l.value = null;
|
|
108
|
-
}
|
|
109
|
-
}), E = P({
|
|
110
|
-
get() {
|
|
111
|
-
return l.value === null ? "" : Ft(l.value);
|
|
112
|
-
},
|
|
113
|
-
set(N) {
|
|
114
|
-
if (N) {
|
|
115
|
-
const y = /* @__PURE__ */ new Date(`${A.value} ${N}`);
|
|
116
|
-
y.setSeconds(59, 999), l.value = y;
|
|
117
|
-
} else
|
|
118
|
-
l.value = null;
|
|
119
|
-
}
|
|
120
|
-
}), Y = P(() => l.value ? l.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
|
|
121
|
-
async function z(N) {
|
|
122
|
-
_.value = !0;
|
|
123
|
-
try {
|
|
124
|
-
N ? await d.runOperationV1({
|
|
125
|
-
_id: s.draft._id,
|
|
126
|
-
_rev: s.draft._rev ?? "",
|
|
127
|
-
action: s.action,
|
|
128
|
-
data: {
|
|
129
|
-
effectiveAt: l.value ? l.value.toISOString() : null,
|
|
130
|
-
remark: e.value
|
|
131
|
-
}
|
|
132
|
-
}).delayed(500) : await d.runOperation({
|
|
133
|
-
_id: s.draft._id,
|
|
134
|
-
_rev: s.draft._rev ?? "",
|
|
135
|
-
action: s.action,
|
|
136
|
-
data: {
|
|
137
|
-
effectiveAt: l.value ? l.value.toISOString() : null,
|
|
138
|
-
remark: e.value
|
|
139
|
-
}
|
|
140
|
-
}).delayed(500), D.open({
|
|
141
|
-
title: "Success",
|
|
142
|
-
message: "Action submitted",
|
|
143
|
-
type: "success"
|
|
144
|
-
}), s.onFinished();
|
|
145
|
-
} catch (y) {
|
|
146
|
-
D.open({
|
|
147
|
-
title: "Something went wrong",
|
|
148
|
-
message: (y == null ? void 0 : y.message) ?? "Unable to submit action. Please try again",
|
|
149
|
-
type: "error"
|
|
150
|
-
}), console.error("error on submit closing draft action", y);
|
|
151
|
-
} finally {
|
|
152
|
-
_.value = !1;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
return (N, y) => {
|
|
156
|
-
const r = q("FmLabel"), n = q("FmDatePicker"), w = q("FmTimePicker"), f = q("FmTextField"), m = q("FmButton"), $ = q("FmForm");
|
|
157
|
-
return L.value ? (S(), pe($, {
|
|
158
|
-
key: 1,
|
|
159
|
-
onValidationSuccess: z,
|
|
160
|
-
class: "flex flex-col gap-32",
|
|
161
|
-
disabled: _.value
|
|
162
|
-
}, {
|
|
163
|
-
default: Q(() => [
|
|
164
|
-
a("div", pn, [
|
|
165
|
-
y[4] || (y[4] = de(" You are about to ")),
|
|
166
|
-
a("span", vn, Z(V.value), 1),
|
|
167
|
-
y[5] || (y[5] = de(" this draft. Please provide a remark to justify this action. "))
|
|
168
|
-
]),
|
|
169
|
-
N.action === b(J).enum.approveDraft ? (S(), M("div", yn, [
|
|
170
|
-
k(r, { class: "fm-typo-en-body-lg-600" }, {
|
|
171
|
-
default: Q(() => y[6] || (y[6] = [
|
|
172
|
-
de("Closing Date")
|
|
173
|
-
])),
|
|
174
|
-
_: 1
|
|
175
|
-
}),
|
|
176
|
-
k(n, {
|
|
177
|
-
modelValue: A.value,
|
|
178
|
-
"onUpdate:modelValue": y[0] || (y[0] = (T) => A.value = T),
|
|
179
|
-
max: b(Ke)(/* @__PURE__ */ new Date())
|
|
180
|
-
}, null, 8, ["modelValue", "max"]),
|
|
181
|
-
k(r, { class: "fm-typo-en-body-lg-600" }, {
|
|
182
|
-
default: Q(() => y[7] || (y[7] = [
|
|
183
|
-
de("Closing Time")
|
|
184
|
-
])),
|
|
185
|
-
_: 1
|
|
186
|
-
}),
|
|
187
|
-
k(w, {
|
|
188
|
-
modelValue: E.value,
|
|
189
|
-
"onUpdate:modelValue": y[1] || (y[1] = (T) => E.value = T)
|
|
190
|
-
}, null, 8, ["modelValue"]),
|
|
191
|
-
Y.value ? (S(), M("div", gn, " Cannot select future date ")) : se("", !0)
|
|
192
|
-
])) : se("", !0),
|
|
193
|
-
k(f, {
|
|
194
|
-
modelValue: e.value,
|
|
195
|
-
"onUpdate:modelValue": y[2] || (y[2] = (T) => e.value = T),
|
|
196
|
-
label: "Remark",
|
|
197
|
-
"label-mark": "required",
|
|
198
|
-
rules: [b(en)()]
|
|
199
|
-
}, null, 8, ["modelValue", "rules"]),
|
|
200
|
-
a("div", bn, [
|
|
201
|
-
k(m, {
|
|
202
|
-
label: "Cancel",
|
|
203
|
-
variant: "tertiary",
|
|
204
|
-
onClick: y[3] || (y[3] = (T) => N.onCancel())
|
|
205
|
-
}),
|
|
206
|
-
k(m, {
|
|
207
|
-
label: V.value,
|
|
208
|
-
type: "submit",
|
|
209
|
-
variant: U.value,
|
|
210
|
-
loading: _.value
|
|
211
|
-
}, null, 8, ["label", "variant", "loading"])
|
|
212
|
-
])
|
|
213
|
-
]),
|
|
214
|
-
_: 1
|
|
215
|
-
}, 8, ["disabled"])) : (S(), M(ue, { key: 0 }, [
|
|
216
|
-
de("Loading")
|
|
217
|
-
], 64));
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
}), hn = Re(0);
|
|
221
|
-
function Pt(u) {
|
|
222
|
-
const s = u.measurementsAmounts.groupBy((d) => d.measurement.id), e = u.sku.unit.measurements.reduce((d, D) => {
|
|
223
|
-
var L, V;
|
|
224
|
-
const _ = ((V = (L = s.get(D.id)) == null ? void 0 : L[0]) == null ? void 0 : V.amount) ?? hn, l = ot(D.conversion, _);
|
|
225
|
-
return d + +tt(l);
|
|
226
|
-
}, +tt(u.baseAmount));
|
|
227
|
-
return tn(e, u.baseAmount.precision);
|
|
228
|
-
}
|
|
229
|
-
const kn = Re(0), _n = Re(100);
|
|
230
|
-
function xn(u, s, e, d, D, _, l) {
|
|
231
|
-
var ne, ie, me, B, C;
|
|
232
|
-
const L = Pt(u), V = d ?? L, U = Bt(V, s), A = s.amount === 0 ? null : Tt(U, {
|
|
233
|
-
...s,
|
|
234
|
-
amount: Math.abs(s.amount)
|
|
235
|
-
}), E = A ? ot(A, _n) : null, Y = ((ne = u.sku.defaultCost) == null ? void 0 : ne.costPerUnit) ?? { amount: 0, precision: 0 }, z = Number(K.toFormatString({ value: Y })), N = ((me = (ie = u.sku.defaultCost) == null ? void 0 : ie.measurement) == null ? void 0 : me.conversion) ?? {
|
|
236
|
-
amount: 1,
|
|
237
|
-
precision: 0
|
|
238
|
-
}, y = Number(
|
|
239
|
-
K.toFormatString({ value: N })
|
|
240
|
-
), r = D ? Number(K.toFormatString({ value: D })) : 0, n = Number(K.toFormatString({ value: s })), w = Number(K.toFormatString({ value: V })), f = w - n, m = f * z / y, $ = w * z / y, T = n * z / y, W = {};
|
|
241
|
-
return l && _ && l.forEach((g) => {
|
|
242
|
-
const R = { amount: 0, precision: 0 }, X = _[g];
|
|
243
|
-
if (X) {
|
|
244
|
-
const ee = jt(R, X);
|
|
245
|
-
W[`adjustment_${g}`] = tt(ee);
|
|
246
|
-
} else
|
|
247
|
-
W[`adjustment_${g}`] = "0";
|
|
248
|
-
}), {
|
|
249
|
-
code: u.sku.code,
|
|
250
|
-
name: u.sku.name,
|
|
251
|
-
baseUnit: u.sku.unit.abbrev,
|
|
252
|
-
costUnit: ((C = (B = u.sku.defaultCost) == null ? void 0 : B.measurement) == null ? void 0 : C.abbrev) ?? null,
|
|
253
|
-
baseUnitAmount: Number(K.toFormatString({ value: u.baseAmount })),
|
|
254
|
-
...u.measurementsAmounts.filter(
|
|
255
|
-
(g) => Dn(g.measurement) && e.includes(g.measurement.id)
|
|
256
|
-
).reduce(
|
|
257
|
-
(g, R, X) => (g[`measurementAbbrev${X}`] = `(${R.measurement.abbrev}) × ${K.toFormatString({ value: R.measurement.conversion })}`, g[`measurementAmount${X}`] = Number(K.toFormatString({ value: R.amount })), g),
|
|
258
|
-
{}
|
|
259
|
-
),
|
|
260
|
-
systemBalance: n,
|
|
261
|
-
physicalBalance: w,
|
|
262
|
-
adjustedAmount: Number(K.toFormatString({ value: U })),
|
|
263
|
-
adjustedDiffPercentage: E ? Number(
|
|
264
|
-
K.toFormatString({
|
|
265
|
-
value: It(E, 2)
|
|
266
|
-
})
|
|
267
|
-
) : null,
|
|
268
|
-
costPerUnit: z,
|
|
269
|
-
opening: r,
|
|
270
|
-
...W,
|
|
271
|
-
varianceQty: f,
|
|
272
|
-
varianceInCost: m,
|
|
273
|
-
stockTakeValue: $,
|
|
274
|
-
systemValue: T
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
function Dn(u) {
|
|
278
|
-
return !u.abbrev.toLocaleLowerCase().includes("inactive");
|
|
279
|
-
}
|
|
280
|
-
function wn(u) {
|
|
281
|
-
const s = Ut(u);
|
|
282
|
-
return u.reduce(
|
|
283
|
-
(e, d) => {
|
|
284
|
-
var D;
|
|
285
|
-
return Math.max(e, ((D = s == null ? void 0 : s.get(d.sku._id)) == null ? void 0 : D[0].length) ?? 0);
|
|
286
|
-
},
|
|
287
|
-
0
|
|
288
|
-
);
|
|
289
|
-
}
|
|
290
|
-
function Ut(u) {
|
|
291
|
-
return u.groupBy(
|
|
292
|
-
(s) => s.sku._id,
|
|
293
|
-
(s) => s.measurementsAmounts.filter((e) => !e.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((e) => e.measurement.id)
|
|
294
|
-
);
|
|
295
|
-
}
|
|
296
|
-
function An(u, s = []) {
|
|
297
|
-
const e = St(), d = e === "MYR" ? "RM" : e;
|
|
298
|
-
return [
|
|
299
|
-
{
|
|
300
|
-
id: "code",
|
|
301
|
-
name: "Code"
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
id: "name",
|
|
305
|
-
name: "Name"
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
id: "baseUnit",
|
|
309
|
-
name: "Base unit"
|
|
310
|
-
},
|
|
311
|
-
{
|
|
312
|
-
id: "costPerUnit",
|
|
313
|
-
name: "Cost per unit"
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
id: "costUnit",
|
|
317
|
-
name: "UOM"
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
id: "opening",
|
|
321
|
-
name: "Opening (B/F)"
|
|
322
|
-
},
|
|
323
|
-
// Dynamic adjustment type columns
|
|
324
|
-
...s.map((_) => ({
|
|
325
|
-
id: `adjustment_${_}`,
|
|
326
|
-
name: Ue(_)
|
|
327
|
-
})),
|
|
328
|
-
{
|
|
329
|
-
id: "systemBalance",
|
|
330
|
-
name: "System balance (Qty)"
|
|
331
|
-
},
|
|
332
|
-
{
|
|
333
|
-
id: "physicalBalance",
|
|
334
|
-
name: "Stock take (Qty)"
|
|
335
|
-
},
|
|
336
|
-
{
|
|
337
|
-
id: "adjustedAmount",
|
|
338
|
-
name: "Variance"
|
|
339
|
-
},
|
|
340
|
-
{
|
|
341
|
-
id: "varianceInCost",
|
|
342
|
-
name: `Variance (${d})`
|
|
343
|
-
},
|
|
344
|
-
{
|
|
345
|
-
id: "adjustedDiffPercentage",
|
|
346
|
-
name: "Variance (%)"
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
id: "stockTakeValue",
|
|
350
|
-
name: `Stock take value (${d})`
|
|
351
|
-
},
|
|
352
|
-
{
|
|
353
|
-
id: "systemValue",
|
|
354
|
-
name: `System value (${d})`
|
|
355
|
-
},
|
|
356
|
-
{
|
|
357
|
-
id: "baseUnitAmount",
|
|
358
|
-
name: "Base unit amount"
|
|
359
|
-
},
|
|
360
|
-
...Array.from({ length: u }).flatMap((_, l) => [
|
|
361
|
-
{
|
|
362
|
-
id: `measurementAmount${l}`,
|
|
363
|
-
name: `UOM amount ${l + 1}`
|
|
364
|
-
},
|
|
365
|
-
{
|
|
366
|
-
id: `measurementAbbrev${l}`,
|
|
367
|
-
name: `UOM ${l + 1}`
|
|
368
|
-
}
|
|
369
|
-
])
|
|
370
|
-
];
|
|
371
|
-
}
|
|
372
|
-
function Sn(u, s, e) {
|
|
373
|
-
var W, ae, ne, ie, me, B, C;
|
|
374
|
-
const d = s.groupBy(
|
|
375
|
-
(g) => g.id,
|
|
376
|
-
(g) => g.balance
|
|
377
|
-
), D = e.groupBy(
|
|
378
|
-
(g) => g.id,
|
|
379
|
-
(g) => g.balance
|
|
380
|
-
), _ = /* @__PURE__ */ new Map();
|
|
381
|
-
if (u.opening)
|
|
382
|
-
for (const g of u.opening)
|
|
383
|
-
_.set(g.skuId, g.balance);
|
|
384
|
-
const l = /* @__PURE__ */ new Set(), L = /* @__PURE__ */ new Map();
|
|
385
|
-
if (u.adjustmentSnapshot)
|
|
386
|
-
for (const g of u.adjustmentSnapshot)
|
|
387
|
-
g.adjustmentsByType && (Object.keys(g.adjustmentsByType).forEach((R) => l.add(R)), L.set(g.skuId, g.adjustmentsByType));
|
|
388
|
-
const V = ["receive", "sales", "wastage"], U = [];
|
|
389
|
-
V.forEach((g) => {
|
|
390
|
-
l.has(g) && (U.push(g), l.delete(g));
|
|
391
|
-
});
|
|
392
|
-
const A = Array.from(l).sort(), E = [...U, ...A], Y = [...u.items, ...u.negativeStockItems ?? []], z = Ut(Y), N = Y.map((g) => {
|
|
393
|
-
var Ae, re, xe;
|
|
394
|
-
const R = ((Ae = d.get(g.sku._id)) == null ? void 0 : Ae[0]) ?? kn, X = ((re = z == null ? void 0 : z.get(g.sku._id)) == null ? void 0 : re[0]) ?? [], ee = _.get(g.sku._id), ve = L.get(g.sku._id);
|
|
395
|
-
return xn(
|
|
396
|
-
g,
|
|
397
|
-
R,
|
|
398
|
-
X,
|
|
399
|
-
(xe = D.get(g.sku._id)) == null ? void 0 : xe[0],
|
|
400
|
-
ee,
|
|
401
|
-
ve,
|
|
402
|
-
E
|
|
403
|
-
);
|
|
404
|
-
}), y = wn(Y), n = wt().currentBusiness.value, w = An(y, E), f = [
|
|
405
|
-
["Business name:", n == null ? void 0 : n.name],
|
|
406
|
-
["Business ID:", n == null ? void 0 : n._id],
|
|
407
|
-
["Menu version", n == null ? void 0 : n.menuVersion],
|
|
408
|
-
["Created at", new Date(u.createdAt)],
|
|
409
|
-
["Created by", (W = u.createdBy) == null ? void 0 : W.name],
|
|
410
|
-
["Updated at", new Date(u.updatedAt)],
|
|
411
|
-
["Updated by", (ae = u.updatedBy) == null ? void 0 : ae.name],
|
|
412
|
-
["Recent action", u.approvedAt ? "Approve" : u.rejectionHistory ? "Reject" : ""],
|
|
413
|
-
[
|
|
414
|
-
"Action by",
|
|
415
|
-
u.approvedAt ? (ne = u.approvedBy) == null ? void 0 : ne.name : u.rejectionHistory ? (me = (ie = u.rejectionHistory[0]) == null ? void 0 : ie.rejectedBy) == null ? void 0 : me.name : ""
|
|
416
|
-
],
|
|
417
|
-
[
|
|
418
|
-
"Action at",
|
|
419
|
-
u.approvedAt ? new Date(u.approvedAt) : u.rejectionHistory ? new Date((B = u.rejectionHistory[0]) == null ? void 0 : B.rejectedAt) : ""
|
|
420
|
-
],
|
|
421
|
-
[
|
|
422
|
-
"Action remark",
|
|
423
|
-
u.approvedAt ? u.approveRemark : u.rejectionHistory ? new Date((C = u.rejectionHistory[0]) == null ? void 0 : C.rejectRemark) : ""
|
|
424
|
-
],
|
|
425
|
-
[],
|
|
426
|
-
w.map((g) => g.name),
|
|
427
|
-
...N.map((g) => w.map((R) => g[R.id]))
|
|
428
|
-
], m = w.map((g) => `system:${g.id}`), $ = nn(f, m), T = `[${n == null ? void 0 : n.name}] closing draft (${Xt(new Date(u.updatedAt))}).xlsx`;
|
|
429
|
-
return an($, T), T;
|
|
430
|
-
}
|
|
431
|
-
const Cn = { class: "flex flex-col" }, $n = {
|
|
432
|
-
key: 0,
|
|
433
|
-
class: "fm-typo-en-body-sm-400 text-fm-color-typo-error mt-4"
|
|
434
|
-
}, Fn = { class: "flex gap-12 py-8 justify-end w-full" }, Bn = /* @__PURE__ */ Ve({
|
|
435
|
-
__name: "RefreshBalanceAction",
|
|
436
|
-
props: {
|
|
437
|
-
draft: {},
|
|
438
|
-
onCancel: { type: Function },
|
|
439
|
-
onFinished: { type: Function }
|
|
440
|
-
},
|
|
441
|
-
setup(u) {
|
|
442
|
-
const s = u;
|
|
443
|
-
st();
|
|
444
|
-
const e = G(!1), d = G(null), D = G(!1);
|
|
445
|
-
nt(() => {
|
|
446
|
-
if (s.draft.effectiveAt)
|
|
447
|
-
d.value = new Date(s.draft.effectiveAt);
|
|
448
|
-
else {
|
|
449
|
-
const U = new Date(s.draft.createdAt);
|
|
450
|
-
U.setHours(23, 59, 59, 999), d.value = U;
|
|
451
|
-
}
|
|
452
|
-
D.value = !0;
|
|
453
|
-
});
|
|
454
|
-
const _ = P({
|
|
455
|
-
get() {
|
|
456
|
-
return d.value === null ? "" : Ke(d.value);
|
|
457
|
-
},
|
|
458
|
-
set(U) {
|
|
459
|
-
if (U) {
|
|
460
|
-
const A = /* @__PURE__ */ new Date(`${U} ${l.value}`);
|
|
461
|
-
A.setSeconds(59, 999), d.value = A;
|
|
462
|
-
} else
|
|
463
|
-
d.value = null;
|
|
464
|
-
}
|
|
465
|
-
}), l = P({
|
|
466
|
-
get() {
|
|
467
|
-
return d.value === null ? "" : Ft(d.value);
|
|
468
|
-
},
|
|
469
|
-
set(U) {
|
|
470
|
-
if (U) {
|
|
471
|
-
const A = /* @__PURE__ */ new Date(`${_.value} ${U}`);
|
|
472
|
-
A.setSeconds(59, 999), d.value = A;
|
|
473
|
-
} else
|
|
474
|
-
d.value = null;
|
|
475
|
-
}
|
|
476
|
-
}), L = P(() => d.value ? d.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
|
|
477
|
-
async function V() {
|
|
478
|
-
e.value = !0, s.onFinished(d.value.toISOString());
|
|
479
|
-
}
|
|
480
|
-
return (U, A) => {
|
|
481
|
-
const E = q("FmLabel"), Y = q("FmDatePicker"), z = q("FmTimePicker"), N = q("FmButton"), y = q("FmForm");
|
|
482
|
-
return D.value ? (S(), pe(y, {
|
|
483
|
-
key: 1,
|
|
484
|
-
onValidationSuccess: V,
|
|
485
|
-
class: "flex flex-col gap-32",
|
|
486
|
-
disabled: e.value
|
|
487
|
-
}, {
|
|
488
|
-
default: Q(() => [
|
|
489
|
-
A[5] || (A[5] = a("div", { class: "fm-typo-en-body-lg-400" }, [
|
|
490
|
-
a("p", null, [
|
|
491
|
-
de(" Performing "),
|
|
492
|
-
a("span", { class: "fm-typo-en-body-lg-600" }, '"Refresh Balance"'),
|
|
493
|
-
de(" until closing effective date and time. ")
|
|
494
|
-
]),
|
|
495
|
-
a("p", { class: "mt-2" }, [
|
|
496
|
-
de(" Please note that this action will "),
|
|
497
|
-
a("b", null, "update"),
|
|
498
|
-
de(" the effective date and time. ")
|
|
499
|
-
])
|
|
500
|
-
], -1)),
|
|
501
|
-
a("div", Cn, [
|
|
502
|
-
k(E, { class: "fm-typo-en-body-lg-600" }, {
|
|
503
|
-
default: Q(() => A[3] || (A[3] = [
|
|
504
|
-
de("Closing Date")
|
|
505
|
-
])),
|
|
506
|
-
_: 1
|
|
507
|
-
}),
|
|
508
|
-
k(Y, {
|
|
509
|
-
modelValue: _.value,
|
|
510
|
-
"onUpdate:modelValue": A[0] || (A[0] = (r) => _.value = r),
|
|
511
|
-
max: b(Ke)(/* @__PURE__ */ new Date())
|
|
512
|
-
}, null, 8, ["modelValue", "max"]),
|
|
513
|
-
k(E, { class: "fm-typo-en-body-lg-600" }, {
|
|
514
|
-
default: Q(() => A[4] || (A[4] = [
|
|
515
|
-
de("Closing Time")
|
|
516
|
-
])),
|
|
517
|
-
_: 1
|
|
518
|
-
}),
|
|
519
|
-
k(z, {
|
|
520
|
-
modelValue: l.value,
|
|
521
|
-
"onUpdate:modelValue": A[1] || (A[1] = (r) => l.value = r)
|
|
522
|
-
}, null, 8, ["modelValue"]),
|
|
523
|
-
L.value ? (S(), M("div", $n, " Cannot select future date ")) : se("", !0)
|
|
524
|
-
]),
|
|
525
|
-
a("div", Fn, [
|
|
526
|
-
k(N, {
|
|
527
|
-
label: "Cancel",
|
|
528
|
-
variant: "tertiary",
|
|
529
|
-
onClick: A[2] || (A[2] = (r) => U.onCancel())
|
|
530
|
-
}),
|
|
531
|
-
k(N, {
|
|
532
|
-
label: "Refresh balance",
|
|
533
|
-
type: "submit",
|
|
534
|
-
variant: "primary",
|
|
535
|
-
loading: e.value,
|
|
536
|
-
disabled: L.value
|
|
537
|
-
}, null, 8, ["loading", "disabled"])
|
|
538
|
-
])
|
|
539
|
-
]),
|
|
540
|
-
_: 1
|
|
541
|
-
}, 8, ["disabled"])) : (S(), M(ue, { key: 0 }, [
|
|
542
|
-
de("Loading")
|
|
543
|
-
], 64));
|
|
544
|
-
};
|
|
545
|
-
}
|
|
546
|
-
}), qe = $t(
|
|
547
|
-
"closingDraftActions",
|
|
548
|
-
function() {
|
|
549
|
-
const s = qt(), e = at(), d = st(), D = Qe(), _ = on(), l = G(!1), L = G();
|
|
550
|
-
function V(f) {
|
|
551
|
-
const m = {
|
|
552
|
-
draft: f
|
|
553
|
-
};
|
|
554
|
-
L.value = m, l.value = !0;
|
|
555
|
-
}
|
|
556
|
-
async function U(f) {
|
|
557
|
-
var $;
|
|
558
|
-
if (f.status === _e.enum.COMPLETED) {
|
|
559
|
-
const T = f.closingAdjustmentId;
|
|
560
|
-
if (!T)
|
|
561
|
-
return e.open({
|
|
562
|
-
title: "Something went wrong",
|
|
563
|
-
message: "Closing draft is completed but closing document cannot be found.",
|
|
564
|
-
type: "error"
|
|
565
|
-
}), console.error("Closing draft is completed but closing document cannot be found.", {
|
|
566
|
-
draftId: f._id
|
|
567
|
-
}), [];
|
|
568
|
-
const W = await d.readAdjustmentById(T);
|
|
569
|
-
return ((W == null ? void 0 : W.skus) ?? []).map((ne) => ({
|
|
570
|
-
id: ne.sku._id,
|
|
571
|
-
balance: ne.fromBalance,
|
|
572
|
-
costs: ne.fromCostBalances
|
|
573
|
-
}));
|
|
574
|
-
} else
|
|
575
|
-
return await _.readStockBalance(), (($ = _.stockBalance) == null ? void 0 : $.skus) ?? [];
|
|
576
|
-
}
|
|
577
|
-
async function A(f, m, $) {
|
|
578
|
-
m || (e.open({
|
|
579
|
-
title: "Exporting",
|
|
580
|
-
message: "Fetching data..."
|
|
581
|
-
}), m = await U(f)), Sn(f, m, $ ?? []);
|
|
582
|
-
}
|
|
583
|
-
function E(f, m, $) {
|
|
584
|
-
s.open({
|
|
585
|
-
title: "Approve draft",
|
|
586
|
-
contentComponent: et,
|
|
587
|
-
contentComponentProps: {
|
|
588
|
-
draft: f,
|
|
589
|
-
action: J.enum.approveDraft,
|
|
590
|
-
onFinished: () => {
|
|
591
|
-
s.close(), m == null || m();
|
|
592
|
-
},
|
|
593
|
-
onCancel: () => {
|
|
594
|
-
s.close();
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
}).onClose(() => {
|
|
598
|
-
$ == null || $();
|
|
599
|
-
});
|
|
600
|
-
}
|
|
601
|
-
function Y(f, m) {
|
|
602
|
-
s.open({
|
|
603
|
-
title: "Reject draft",
|
|
604
|
-
contentComponent: et,
|
|
605
|
-
contentComponentProps: {
|
|
606
|
-
draft: f,
|
|
607
|
-
action: J.enum.rejectDraft,
|
|
608
|
-
onFinished: () => {
|
|
609
|
-
s.close(), m == null || m();
|
|
610
|
-
},
|
|
611
|
-
onCancel: () => s.close()
|
|
612
|
-
}
|
|
613
|
-
});
|
|
614
|
-
}
|
|
615
|
-
function z(f, m) {
|
|
616
|
-
s.open({
|
|
617
|
-
title: "Mark draft as failed",
|
|
618
|
-
contentComponent: et,
|
|
619
|
-
contentComponentProps: {
|
|
620
|
-
draft: f,
|
|
621
|
-
action: J.enum.markAsFailed,
|
|
622
|
-
onFinished: () => {
|
|
623
|
-
s.close(), m == null || m();
|
|
624
|
-
},
|
|
625
|
-
onCancel: () => s.close()
|
|
626
|
-
}
|
|
627
|
-
});
|
|
628
|
-
}
|
|
629
|
-
async function N(f, m) {
|
|
630
|
-
await D.sync({
|
|
631
|
-
_id: f._id,
|
|
632
|
-
_rev: f._rev ?? "",
|
|
633
|
-
action: J.enum.approveDraft,
|
|
634
|
-
data: {
|
|
635
|
-
remark: f.remark ?? ""
|
|
636
|
-
}
|
|
637
|
-
}).delayed(500), e.open({
|
|
638
|
-
title: "Success",
|
|
639
|
-
message: "Sync requested",
|
|
640
|
-
type: "success"
|
|
641
|
-
}), m == null || m();
|
|
642
|
-
}
|
|
643
|
-
function y() {
|
|
644
|
-
l.value = !1;
|
|
645
|
-
}
|
|
646
|
-
async function r(f, m, $) {
|
|
647
|
-
await s.open({
|
|
648
|
-
title: "Refresh balance",
|
|
649
|
-
contentComponent: Bn,
|
|
650
|
-
contentComponentProps: {
|
|
651
|
-
draft: f,
|
|
652
|
-
onFinished: (T) => {
|
|
653
|
-
s.close(), $ == null || $(T);
|
|
654
|
-
},
|
|
655
|
-
onCancel: async () => {
|
|
656
|
-
s.close(), m == null || m();
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
});
|
|
660
|
-
}
|
|
661
|
-
async function n(f) {
|
|
662
|
-
await s.open({
|
|
663
|
-
title: "Invalidate closing draft cache",
|
|
664
|
-
message: "It will invalidate opening and stock movement cache for this draft.",
|
|
665
|
-
primaryActions: { text: "Proceed", close: !0 },
|
|
666
|
-
secondaryActions: { text: "Cancel", close: !0 }
|
|
667
|
-
}).onPrimary(async () => {
|
|
668
|
-
await d.recalculation.scheduleInvalidateClosingDraftCache([f._id]), e.open({
|
|
669
|
-
title: "Success",
|
|
670
|
-
message: "Invalidate cache requested",
|
|
671
|
-
type: "success"
|
|
672
|
-
});
|
|
673
|
-
});
|
|
674
|
-
}
|
|
675
|
-
async function w(f, m) {
|
|
676
|
-
try {
|
|
677
|
-
e.open({
|
|
678
|
-
title: "Cloning",
|
|
679
|
-
message: "Creating a copy of the draft..."
|
|
680
|
-
}), await D.cloneDraft(f._id), e.open({
|
|
681
|
-
title: "Success",
|
|
682
|
-
message: "Draft cloned successfully",
|
|
683
|
-
type: "success"
|
|
684
|
-
}), m == null || m();
|
|
685
|
-
} catch ($) {
|
|
686
|
-
e.open({
|
|
687
|
-
title: "Error",
|
|
688
|
-
message: ($ == null ? void 0 : $.message) || "Failed to clone draft",
|
|
689
|
-
type: "error"
|
|
690
|
-
});
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
return {
|
|
694
|
-
viewDraft: V,
|
|
695
|
-
closeDraftDialog: y,
|
|
696
|
-
approveDraft: E,
|
|
697
|
-
rejectDraft: Y,
|
|
698
|
-
markAsFailed: z,
|
|
699
|
-
syncDraft: N,
|
|
700
|
-
exportDraft: A,
|
|
701
|
-
refreshBalance: r,
|
|
702
|
-
cloneDraft: w,
|
|
703
|
-
viewClosingDraftShow: l,
|
|
704
|
-
viewClosingDraftProps: L,
|
|
705
|
-
invalidateDraftCache: n
|
|
706
|
-
};
|
|
707
|
-
}
|
|
708
|
-
);
|
|
709
|
-
function Ye(u) {
|
|
710
|
-
switch (u) {
|
|
711
|
-
case "DRAFT":
|
|
712
|
-
return "fm-status-badge-draft";
|
|
713
|
-
case "PROCESSING":
|
|
714
|
-
return "fm-status-badge-processing";
|
|
715
|
-
case "FAILED":
|
|
716
|
-
return "fm-status-badge-cancel";
|
|
717
|
-
case "COMPLETED":
|
|
718
|
-
return "fm-status-badge-complete";
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
const Rt = $t(
|
|
722
|
-
"closingDraftTable",
|
|
723
|
-
function() {
|
|
724
|
-
const { t: s } = At(), e = wt(), d = qe(), D = G(new Array()), _ = G(!1), l = Ge(), L = Qe();
|
|
725
|
-
async function V() {
|
|
726
|
-
if (D.value = [], !!l._currentLocation) {
|
|
727
|
-
_.value = !0;
|
|
728
|
-
try {
|
|
729
|
-
const [r] = await Promise.all([L.readDrafts()]).delayed(1e3);
|
|
730
|
-
D.value = A(r.reverse());
|
|
731
|
-
} catch (r) {
|
|
732
|
-
console.log("Something went wrong when fetching drafts:", r);
|
|
733
|
-
} finally {
|
|
734
|
-
_.value = !1;
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
async function U(r) {
|
|
739
|
-
if (!D.value.find((n) => n._id) && l._currentLocation) {
|
|
740
|
-
_.value = !0;
|
|
741
|
-
try {
|
|
742
|
-
const [n] = await Promise.all([
|
|
743
|
-
L.getDraft(r),
|
|
744
|
-
new Promise((w) => setTimeout(w, 1e3))
|
|
745
|
-
]);
|
|
746
|
-
D.value = A([n]);
|
|
747
|
-
} catch (n) {
|
|
748
|
-
console.log("Something went wrong when fetching drafts:", n);
|
|
749
|
-
} finally {
|
|
750
|
-
_.value = !1;
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
function A(r) {
|
|
755
|
-
const n = ln(
|
|
756
|
-
r.filter((w) => !!w.closingId).map((w) => ({ closingId: w.closingId, draftCreatedAt: new Date(Ce(w._id)) }))
|
|
757
|
-
);
|
|
758
|
-
return r.map((w) => ({
|
|
759
|
-
...w,
|
|
760
|
-
closingIdDisplay: w.closingId ? n.get(w.closingId) ?? null : null
|
|
761
|
-
}));
|
|
762
|
-
}
|
|
763
|
-
function E(r) {
|
|
764
|
-
D.value = D.value.map((n) => n._id === r._id ? {
|
|
765
|
-
...r,
|
|
766
|
-
_rev: n._rev,
|
|
767
|
-
closingIdDisplay: n.closingIdDisplay
|
|
768
|
-
} : n);
|
|
769
|
-
}
|
|
770
|
-
function Y(r) {
|
|
771
|
-
var f, m;
|
|
772
|
-
const n = r.items.length + (((f = r.negativeStockItems) == null ? void 0 : f.length) ?? 0), w = (r == null ? void 0 : r.approveRemark) ?? ((m = r == null ? void 0 : r.rejectionHistory) == null ? void 0 : m.computeFirst(($) => $.rejectRemark)) ?? r.remark ?? "";
|
|
773
|
-
return { count: n, remark: w };
|
|
774
|
-
}
|
|
775
|
-
function z() {
|
|
776
|
-
d.closeDraftDialog(), V();
|
|
777
|
-
}
|
|
778
|
-
function N(r, n) {
|
|
779
|
-
switch (n = Zt(n), r) {
|
|
780
|
-
case Be.Details:
|
|
781
|
-
return d.viewDraft(n);
|
|
782
|
-
case Be.Export:
|
|
783
|
-
return d.exportDraft(n);
|
|
784
|
-
case J.enum.approveDraft:
|
|
785
|
-
return d.approveDraft(n, z);
|
|
786
|
-
case J.enum.rejectDraft:
|
|
787
|
-
return d.rejectDraft(n, z);
|
|
788
|
-
case J.enum.markAsFailed:
|
|
789
|
-
return d.markAsFailed(n, z);
|
|
790
|
-
case Be.Duplicate:
|
|
791
|
-
return d.cloneDraft(n, z);
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
return {
|
|
795
|
-
columnDefs: [
|
|
796
|
-
{
|
|
797
|
-
id: "_id",
|
|
798
|
-
accessorKey: "_id",
|
|
799
|
-
header: () => s("inventory.closing.table.createdAt"),
|
|
800
|
-
cell(r) {
|
|
801
|
-
return rn(`${r.getValue()}`);
|
|
802
|
-
},
|
|
803
|
-
sortingFn: (r, n) => new Date(Ce(r.original._id)).getTime() - new Date(Ce(n.original._id)).getTime(),
|
|
804
|
-
enableSorting: !0
|
|
805
|
-
},
|
|
806
|
-
{
|
|
807
|
-
id: "closingId",
|
|
808
|
-
accessorFn: (r) => r.closingIdDisplay,
|
|
809
|
-
size: 160,
|
|
810
|
-
header: () => s("inventory.closing.draft.table.id"),
|
|
811
|
-
cell(r) {
|
|
812
|
-
return r.getValue();
|
|
813
|
-
},
|
|
814
|
-
enableSorting: !0
|
|
815
|
-
},
|
|
816
|
-
{
|
|
817
|
-
accessorKey: "effectiveAt",
|
|
818
|
-
header: () => s("inventory.closing.draft.table.effectiveAt"),
|
|
819
|
-
cell(r) {
|
|
820
|
-
const n = r.row.original;
|
|
821
|
-
let w = r.getValue();
|
|
822
|
-
return w || (w = Ce(n._id)), we(w);
|
|
823
|
-
},
|
|
824
|
-
enableSorting: !0,
|
|
825
|
-
size: 230
|
|
826
|
-
},
|
|
827
|
-
{
|
|
828
|
-
id: "description",
|
|
829
|
-
accessorFn: (r) => {
|
|
830
|
-
const { count: n, remark: w } = Y(r);
|
|
831
|
-
return `${n} ${w}`;
|
|
832
|
-
},
|
|
833
|
-
header: () => s("inventory.closing.draft.table.description"),
|
|
834
|
-
enableSorting: !0,
|
|
835
|
-
size: 350,
|
|
836
|
-
cell(r) {
|
|
837
|
-
const { count: n, remark: w } = Y(r.row.original), f = (m, $) => x("div", { class: "flex gap-4" }, [
|
|
838
|
-
x(
|
|
839
|
-
"span",
|
|
840
|
-
{ class: "fm-typo-en-body-sm-600 text-fm-color-typo-primary" },
|
|
841
|
-
`${m}:`
|
|
842
|
-
),
|
|
843
|
-
x(
|
|
844
|
-
"span",
|
|
845
|
-
{
|
|
846
|
-
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary",
|
|
847
|
-
style: "white-space: pre-wrap; word-break: break-word;"
|
|
848
|
-
},
|
|
849
|
-
`${$}`
|
|
850
|
-
)
|
|
851
|
-
]);
|
|
852
|
-
return x("div", { class: "flex flex-col gap-2", style: "width: 300px;" }, [
|
|
853
|
-
f(s("inventory.closing.draft.table.items"), n),
|
|
854
|
-
w ? f(s("inventory.closing.draft.table.remark"), w) : null
|
|
855
|
-
]);
|
|
856
|
-
}
|
|
857
|
-
},
|
|
858
|
-
{
|
|
859
|
-
id: "status",
|
|
860
|
-
accessorFn: (r) => r.status,
|
|
861
|
-
header: () => s("inventory.closing.table.status"),
|
|
862
|
-
enableSorting: !1,
|
|
863
|
-
cell(r) {
|
|
864
|
-
var T;
|
|
865
|
-
const n = r.row.original, w = n.status, f = new Date(n.updatedAt), m = (T = n == null ? void 0 : n.rejectionHistory) == null ? void 0 : T.computeFirst((W) => W.rejectedAt), $ = m ? new Date(m) : null;
|
|
866
|
-
return w === "DRAFT" && $ ? $.getTime() > f.getTime() ? x(
|
|
867
|
-
"div",
|
|
868
|
-
{
|
|
869
|
-
class: "flex"
|
|
870
|
-
},
|
|
871
|
-
x(
|
|
872
|
-
"div",
|
|
873
|
-
{
|
|
874
|
-
class: ["fm-status-badge", Ye("FAILED")]
|
|
875
|
-
},
|
|
876
|
-
"Rejected"
|
|
877
|
-
)
|
|
878
|
-
) : x(
|
|
879
|
-
"div",
|
|
880
|
-
{
|
|
881
|
-
class: "flex"
|
|
882
|
-
},
|
|
883
|
-
x(
|
|
884
|
-
"div",
|
|
885
|
-
{
|
|
886
|
-
class: ["fm-status-badge", Ye("PROCESSING")]
|
|
887
|
-
},
|
|
888
|
-
"Updated"
|
|
889
|
-
)
|
|
890
|
-
) : x(
|
|
891
|
-
"div",
|
|
892
|
-
{
|
|
893
|
-
class: "flex"
|
|
894
|
-
},
|
|
895
|
-
x(
|
|
896
|
-
"div",
|
|
897
|
-
{
|
|
898
|
-
class: ["fm-status-badge", Ye(w)]
|
|
899
|
-
},
|
|
900
|
-
Ue(w)
|
|
901
|
-
)
|
|
902
|
-
);
|
|
903
|
-
}
|
|
904
|
-
},
|
|
905
|
-
{
|
|
906
|
-
id: "updatedAt",
|
|
907
|
-
accessorFn: (r) => r.updatedAt,
|
|
908
|
-
header: () => s("inventory.closing.draft.table.lastUpdate"),
|
|
909
|
-
enableSorting: !0,
|
|
910
|
-
size: 200,
|
|
911
|
-
cell(r) {
|
|
912
|
-
var w;
|
|
913
|
-
const n = r.row.original;
|
|
914
|
-
return x("div", { class: "flex flex-col" }, [
|
|
915
|
-
x(
|
|
916
|
-
"div",
|
|
917
|
-
{ class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" },
|
|
918
|
-
((w = n.updatedBy) == null ? void 0 : w.name) ?? ""
|
|
919
|
-
),
|
|
920
|
-
x(
|
|
921
|
-
"div",
|
|
922
|
-
{ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
|
|
923
|
-
we(n.updatedAt)
|
|
924
|
-
)
|
|
925
|
-
]);
|
|
926
|
-
}
|
|
927
|
-
},
|
|
928
|
-
{
|
|
929
|
-
id: "action",
|
|
930
|
-
cell(r) {
|
|
931
|
-
var T;
|
|
932
|
-
const n = r.row.original, w = ((T = e.sessionUser.value) == null ? void 0 : T.role.isAdmin) ?? !1, f = [
|
|
933
|
-
ht[Be.Details],
|
|
934
|
-
ht[Be.Export]
|
|
935
|
-
], m = [
|
|
936
|
-
{
|
|
937
|
-
translationKey: "inventory.closing.draft.approveDraft",
|
|
938
|
-
color: "text-fm-color-typo-primary",
|
|
939
|
-
value: J.enum.approveDraft
|
|
940
|
-
},
|
|
941
|
-
{
|
|
942
|
-
translationKey: "inventory.closing.draft.rejectDraft",
|
|
943
|
-
color: "text-fm-color-typo-error",
|
|
944
|
-
value: J.enum.rejectDraft
|
|
945
|
-
},
|
|
946
|
-
{
|
|
947
|
-
translationKey: "inventory.closing.draft.markAsFailed",
|
|
948
|
-
color: "text-fm-color-typo-error",
|
|
949
|
-
value: J.enum.markAsFailed
|
|
950
|
-
}
|
|
951
|
-
], $ = w && n.status !== _e.enum.DRAFT ? [
|
|
952
|
-
{
|
|
953
|
-
translationKey: "inventory.closing.draft.cloneDraft",
|
|
954
|
-
color: "text-fm-color-typo-primary",
|
|
955
|
-
value: Be.Duplicate
|
|
956
|
-
}
|
|
957
|
-
] : [];
|
|
958
|
-
return sn(
|
|
959
|
-
[
|
|
960
|
-
...f,
|
|
961
|
-
...n.status === _e.enum.DRAFT ? m : []
|
|
962
|
-
],
|
|
963
|
-
(W) => N(W, n),
|
|
964
|
-
$
|
|
965
|
-
);
|
|
966
|
-
},
|
|
967
|
-
enableSorting: !1,
|
|
968
|
-
size: 40,
|
|
969
|
-
meta: {
|
|
970
|
-
cellClass: "",
|
|
971
|
-
headerClass: ""
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
],
|
|
975
|
-
drafts: D,
|
|
976
|
-
loading: _,
|
|
977
|
-
fetchDrafts: V,
|
|
978
|
-
loadDraft: U,
|
|
979
|
-
updateDraftRef: E
|
|
980
|
-
};
|
|
981
|
-
}
|
|
982
|
-
), Tn = { class: "fm-typo-en-heading-lg-600" }, jn = { class: "py-4" }, In = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, Pn = { key: 0 }, Un = { class: "mt-4 flex gap-4" }, Rn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, Vn = { key: 0 }, Mn = {
|
|
983
|
-
key: 0,
|
|
984
|
-
class: "mb-4"
|
|
985
|
-
}, Nn = { class: "flex flex-col gap-1 max-h-200 overflow-auto w-full" }, Ln = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, En = {
|
|
986
|
-
key: 0,
|
|
987
|
-
class: "text-fm-color-system-success-300 mr-1"
|
|
988
|
-
}, zn = {
|
|
989
|
-
key: 1,
|
|
990
|
-
class: "text-fm-color-system-error-300 mr-1"
|
|
991
|
-
}, Hn = { class: "fm-typo-en-body-md-400" }, On = { class: "mt-4 flex gap-4" }, Yn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, Kn = {
|
|
992
|
-
key: 0,
|
|
993
|
-
class: "flex gap-4"
|
|
994
|
-
}, qn = /* @__PURE__ */ Ve({
|
|
995
|
-
__name: "ClosingDraftApprovalDialog",
|
|
996
|
-
props: {
|
|
997
|
-
show: { type: Boolean },
|
|
998
|
-
refreshing: { type: Boolean },
|
|
999
|
-
approving: { type: Boolean },
|
|
1000
|
-
draft: {}
|
|
1001
|
-
},
|
|
1002
|
-
emits: ["update:show", "refresh", "approve"],
|
|
1003
|
-
setup(u, { emit: s }) {
|
|
1004
|
-
const { FmStepper: e, FmStep: d, FmDialog: D, FmButton: _ } = ke, { t: l } = dn(), L = Ct(), V = u, U = s, A = P(
|
|
1005
|
-
() => {
|
|
1006
|
-
var B, C;
|
|
1007
|
-
return ((B = V.draft) == null ? void 0 : B.stockSnapshot) && ((C = V.draft) == null ? void 0 : C.stockSnapshot) !== void 0;
|
|
1008
|
-
}
|
|
1009
|
-
), E = P(() => {
|
|
1010
|
-
var g, R, X;
|
|
1011
|
-
const B = ((g = V.draft) == null ? void 0 : g.items.map((ee) => ({
|
|
1012
|
-
id: ee.sku._id,
|
|
1013
|
-
code: ee.sku.code,
|
|
1014
|
-
name: ee.sku.name
|
|
1015
|
-
}))) ?? [], C = ((X = (R = V.draft) == null ? void 0 : R.negativeStockItems) == null ? void 0 : X.map((ee) => ({
|
|
1016
|
-
id: ee.sku._id,
|
|
1017
|
-
code: ee.sku.code,
|
|
1018
|
-
name: ee.sku.name
|
|
1019
|
-
}))) ?? [];
|
|
1020
|
-
return [...B, ...C].reduce(
|
|
1021
|
-
(ee, ve) => (ee[ve.id] = ve, ee),
|
|
1022
|
-
{}
|
|
1023
|
-
);
|
|
1024
|
-
}), Y = P(
|
|
1025
|
-
() => {
|
|
1026
|
-
var B, C, g;
|
|
1027
|
-
return (((g = (C = (B = V.draft) == null ? void 0 : B.stockSnapshot) == null ? void 0 : C.filter((R) => R.balance.amount < 0)) == null ? void 0 : g.map((R) => {
|
|
1028
|
-
const X = L.skuById[R.id];
|
|
1029
|
-
return X ? {
|
|
1030
|
-
id: X._id,
|
|
1031
|
-
code: X.code,
|
|
1032
|
-
name: X.name
|
|
1033
|
-
} : null;
|
|
1034
|
-
})) ?? []).filter((R) => R !== null);
|
|
1035
|
-
}
|
|
1036
|
-
), z = P(() => {
|
|
1037
|
-
var B;
|
|
1038
|
-
return A.value ? ((B = Y.value) == null ? void 0 : B.filter((C) => !E.value[C.id]).map((C) => C.id)) ?? [] : [];
|
|
1039
|
-
}), N = P({
|
|
1040
|
-
get: () => V.show,
|
|
1041
|
-
set: (B) => U("update:show", B)
|
|
1042
|
-
}), y = G(1), r = () => y.value > 1, n = () => y.value > 2, w = () => !1;
|
|
1043
|
-
function f(B) {
|
|
1044
|
-
return B === 1 ? A.value : B === 2 ? z.value.length == 0 : !1;
|
|
1045
|
-
}
|
|
1046
|
-
const m = P(() => !A.value || z.value.length > 0);
|
|
1047
|
-
function $(B) {
|
|
1048
|
-
let C = B + 1;
|
|
1049
|
-
for (; C <= 3 && f(C); ) C++;
|
|
1050
|
-
return C > 3 ? 3 : C;
|
|
1051
|
-
}
|
|
1052
|
-
function T(B) {
|
|
1053
|
-
let C = B - 1;
|
|
1054
|
-
for (; C >= 1 && f(C); ) C--;
|
|
1055
|
-
return C < 1 ? 1 : C;
|
|
1056
|
-
}
|
|
1057
|
-
function W() {
|
|
1058
|
-
return A.value ? m.value ? 3 : 2 : 1;
|
|
1059
|
-
}
|
|
1060
|
-
Oe(
|
|
1061
|
-
() => V.show,
|
|
1062
|
-
(B) => {
|
|
1063
|
-
B && (y.value = W());
|
|
1064
|
-
}
|
|
1065
|
-
), Oe(
|
|
1066
|
-
() => A.value,
|
|
1067
|
-
(B) => {
|
|
1068
|
-
B && y.value === 1 && (y.value = $(1));
|
|
1069
|
-
}
|
|
1070
|
-
), Oe(
|
|
1071
|
-
() => z.value.length,
|
|
1072
|
-
(B) => {
|
|
1073
|
-
B === 0 && y.value === 2 && (y.value = $(2));
|
|
1074
|
-
}
|
|
1075
|
-
);
|
|
1076
|
-
function ae() {
|
|
1077
|
-
U("refresh");
|
|
1078
|
-
}
|
|
1079
|
-
function ne() {
|
|
1080
|
-
y.value < 3 && (y.value = $(y.value));
|
|
1081
|
-
}
|
|
1082
|
-
function ie() {
|
|
1083
|
-
y.value > 1 && (y.value = T(y.value));
|
|
1084
|
-
}
|
|
1085
|
-
function me() {
|
|
1086
|
-
U("approve");
|
|
1087
|
-
}
|
|
1088
|
-
return (B, C) => {
|
|
1089
|
-
const g = q("FmIcon");
|
|
1090
|
-
return S(), pe(b(D), {
|
|
1091
|
-
modelValue: N.value,
|
|
1092
|
-
"onUpdate:modelValue": C[1] || (C[1] = (R) => N.value = R),
|
|
1093
|
-
"max-width": 600
|
|
1094
|
-
}, {
|
|
1095
|
-
"dialog-header": Q(() => [
|
|
1096
|
-
a("div", Tn, Z(b(l)("inventory.closing.approval.title")), 1)
|
|
1097
|
-
]),
|
|
1098
|
-
default: Q(() => [
|
|
1099
|
-
a("div", jn, [
|
|
1100
|
-
k(b(e), {
|
|
1101
|
-
modelValue: y.value,
|
|
1102
|
-
"onUpdate:modelValue": C[0] || (C[0] = (R) => y.value = R),
|
|
1103
|
-
orientation: "vertical"
|
|
1104
|
-
}, {
|
|
1105
|
-
default: Q(() => [
|
|
1106
|
-
k(b(d), {
|
|
1107
|
-
value: 1,
|
|
1108
|
-
title: b(l)("inventory.closing.approval.step.generateReport.title"),
|
|
1109
|
-
complete: r
|
|
1110
|
-
}, {
|
|
1111
|
-
default: Q(() => [
|
|
1112
|
-
a("div", In, Z(b(l)("inventory.closing.approval.step.generateReport.description")), 1),
|
|
1113
|
-
y.value === 1 ? (S(), M("div", Pn, [
|
|
1114
|
-
k(b(_), {
|
|
1115
|
-
label: b(l)("inventory.stock.stock_balance.refreshBalance"),
|
|
1116
|
-
"prepend-icon": "refresh",
|
|
1117
|
-
variant: "secondary",
|
|
1118
|
-
loading: B.refreshing,
|
|
1119
|
-
onClick: ae
|
|
1120
|
-
}, null, 8, ["label", "loading"]),
|
|
1121
|
-
a("div", Un, [
|
|
1122
|
-
k(b(_), {
|
|
1123
|
-
label: b(l)("inventory.common.continue"),
|
|
1124
|
-
disabled: !A.value,
|
|
1125
|
-
onClick: ne
|
|
1126
|
-
}, null, 8, ["label", "disabled"])
|
|
1127
|
-
])
|
|
1128
|
-
])) : se("", !0)
|
|
1129
|
-
]),
|
|
1130
|
-
_: 1
|
|
1131
|
-
}, 8, ["title"]),
|
|
1132
|
-
k(b(d), {
|
|
1133
|
-
value: 2,
|
|
1134
|
-
title: b(l)("inventory.closing.approval.step.negativeItems.title"),
|
|
1135
|
-
disabled: () => !A.value,
|
|
1136
|
-
complete: n
|
|
1137
|
-
}, {
|
|
1138
|
-
default: Q(() => [
|
|
1139
|
-
a("div", Rn, Z(Y.value.length > 0 ? `${b(l)("inventory.closing.approval.step.negativeItems.resolveMessage")} [${b(l)("inventory.closing.approval.step.negativeItems.itemsHeader")} (${z.value.length})]` : b(l)("inventory.closing.approval.step.negativeItems.noItemsMessage")), 1),
|
|
1140
|
-
y.value === 2 ? (S(), M("div", Vn, [
|
|
1141
|
-
Y.value.length > 0 ? (S(), M("div", Mn, [
|
|
1142
|
-
C[2] || (C[2] = a("div", { class: "fm-typo-en-body-md-600 mb-2" }, null, -1)),
|
|
1143
|
-
a("div", Nn, [
|
|
1144
|
-
(S(!0), M(ue, null, Te(Y.value, (R) => (S(), M("div", {
|
|
1145
|
-
key: R.id,
|
|
1146
|
-
class: "flex gap-8"
|
|
1147
|
-
}, [
|
|
1148
|
-
a("div", Ln, [
|
|
1149
|
-
E.value[R.id] ? (S(), M("span", En, [
|
|
1150
|
-
k(g, {
|
|
1151
|
-
name: "check_circle",
|
|
1152
|
-
size: "sm"
|
|
1153
|
-
})
|
|
1154
|
-
])) : (S(), M("span", zn, [
|
|
1155
|
-
k(g, {
|
|
1156
|
-
name: "error",
|
|
1157
|
-
size: "sm"
|
|
1158
|
-
})
|
|
1159
|
-
])),
|
|
1160
|
-
de(" " + Z(R.code), 1)
|
|
1161
|
-
]),
|
|
1162
|
-
a("div", Hn, Z(R.name), 1)
|
|
1163
|
-
]))), 128))
|
|
1164
|
-
])
|
|
1165
|
-
])) : se("", !0),
|
|
1166
|
-
a("div", On, [
|
|
1167
|
-
k(b(_), {
|
|
1168
|
-
label: b(l)("inventory.common.back"),
|
|
1169
|
-
variant: "secondary",
|
|
1170
|
-
onClick: ie
|
|
1171
|
-
}, null, 8, ["label"]),
|
|
1172
|
-
k(b(_), {
|
|
1173
|
-
label: b(l)("inventory.common.continue"),
|
|
1174
|
-
disabled: m.value,
|
|
1175
|
-
onClick: ne
|
|
1176
|
-
}, null, 8, ["label", "disabled"])
|
|
1177
|
-
])
|
|
1178
|
-
])) : se("", !0)
|
|
1179
|
-
]),
|
|
1180
|
-
_: 1
|
|
1181
|
-
}, 8, ["title", "disabled"]),
|
|
1182
|
-
k(b(d), {
|
|
1183
|
-
value: 3,
|
|
1184
|
-
title: b(l)("inventory.closing.approval.step.approval.title"),
|
|
1185
|
-
disabled: () => m.value,
|
|
1186
|
-
complete: w
|
|
1187
|
-
}, {
|
|
1188
|
-
default: Q(() => [
|
|
1189
|
-
a("div", Yn, Z(b(l)("inventory.closing.approval.step.approval.warning")), 1),
|
|
1190
|
-
y.value === 3 ? (S(), M("div", Kn, [
|
|
1191
|
-
k(b(_), {
|
|
1192
|
-
label: b(l)("inventory.common.back"),
|
|
1193
|
-
variant: "secondary",
|
|
1194
|
-
onClick: ie
|
|
1195
|
-
}, null, 8, ["label"]),
|
|
1196
|
-
k(b(_), {
|
|
1197
|
-
label: b(l)("inventory.common.approve"),
|
|
1198
|
-
variant: "destructive",
|
|
1199
|
-
disabled: m.value,
|
|
1200
|
-
loading: B.approving,
|
|
1201
|
-
onClick: me
|
|
1202
|
-
}, null, 8, ["label", "disabled", "loading"])
|
|
1203
|
-
])) : se("", !0)
|
|
1204
|
-
]),
|
|
1205
|
-
_: 1
|
|
1206
|
-
}, 8, ["title", "disabled"])
|
|
1207
|
-
]),
|
|
1208
|
-
_: 1
|
|
1209
|
-
}, 8, ["modelValue"])
|
|
1210
|
-
])
|
|
1211
|
-
]),
|
|
1212
|
-
_: 1
|
|
1213
|
-
}, 8, ["modelValue"]);
|
|
1214
|
-
};
|
|
1215
|
-
}
|
|
1216
|
-
}), Gn = { class: "w-full flex flex-col gap-32" }, Qn = { class: "flex justify-between" }, Wn = { class: "flex" }, Zn = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, Jn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Xn = { class: "flex gap-1" }, ea = {
|
|
1217
|
-
class: "fm-typo-en-body-lg-600",
|
|
1218
|
-
style: { "white-space": "pre-wrap", "word-break": "break-word" }
|
|
1219
|
-
}, ta = { class: "flex flex-col gap-16" }, na = { class: "flex items-center" }, aa = {
|
|
1220
|
-
key: 0,
|
|
1221
|
-
class: "flex gap-8"
|
|
1222
|
-
}, oa = {
|
|
1223
|
-
key: 0,
|
|
1224
|
-
class: "w-full flex flex-col items-center"
|
|
1225
|
-
}, sa = { class: "flex items-center gap-8" }, ra = { class: "flex flex-col gap-8" }, la = { class: "flex gap-8" }, ia = {
|
|
1226
|
-
key: 0,
|
|
1227
|
-
class: "flex gap-8"
|
|
1228
|
-
}, ca = { class: "overflow-x-auto" }, ua = {
|
|
1229
|
-
key: 1,
|
|
1230
|
-
class: "flex-1 xs:w-screen xs:max-w-full"
|
|
1231
|
-
}, da = {
|
|
1232
|
-
key: 0,
|
|
1233
|
-
class: "flex flex-col items-center gap-8 h-full"
|
|
1234
|
-
}, ma = ["src"], fa = {
|
|
1235
|
-
key: 1,
|
|
1236
|
-
class: "px-4 flex flex-col"
|
|
1237
|
-
}, pa = { class: "flex gap-12 content-stretch" }, va = {
|
|
1238
|
-
class: "flex flex-col w-24",
|
|
1239
|
-
name: "circles"
|
|
1240
|
-
}, ya = { class: "flex-1 flex flex-col items-center" }, ga = { class: "flex-1 flex flex-col items-center" }, ba = {
|
|
1241
|
-
class: "py-12 flex flex-col gap-4",
|
|
1242
|
-
name: "received-at header"
|
|
1243
|
-
}, ha = { class: "fm-typo-en-body-lg-400" }, ka = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _a = { class: "flex gap-12 content-stretch" }, xa = {
|
|
1244
|
-
class: "flex flex-col w-24",
|
|
1245
|
-
name: "circles"
|
|
1246
|
-
}, Da = { class: "flex-1 flex flex-col items-center" }, wa = {
|
|
1247
|
-
class: "py-12 flex flex-col gap-4 flex-1",
|
|
1248
|
-
name: "delivery details"
|
|
1249
|
-
}, Aa = { class: "flex flex-col gap-8" }, Sa = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Ca = { class: "flex flex-col gap-4" }, $a = { class: "flex items-center justify-between gap-8 w-full" }, Fa = { class: "flex items-center gap-8" }, Ba = { class: "flex flex-col items-end" }, Ta = { class: "text-2xl font-semibold" }, _t = "N/A", ja = /* @__PURE__ */ Ve({
|
|
1250
|
-
__name: "ClosingDraftDialog",
|
|
1251
|
-
props: {
|
|
1252
|
-
show: { type: Boolean },
|
|
1253
|
-
draft: {}
|
|
1254
|
-
},
|
|
1255
|
-
emits: ["submitted", "refresh"],
|
|
1256
|
-
setup(u, { emit: s }) {
|
|
1257
|
-
const e = u, d = P(() => {
|
|
1258
|
-
const i = St();
|
|
1259
|
-
return i === "MYR" ? "RM" : i;
|
|
1260
|
-
}), D = Rt(), _ = P(() => {
|
|
1261
|
-
var i, t;
|
|
1262
|
-
return (i = e.draft) != null && i.closingId ? ((t = D.drafts.find((p) => p._id === e.draft._id)) == null ? void 0 : t.closingIdDisplay) ?? null : null;
|
|
1263
|
-
}), l = qe(), L = Gt(e, "show"), V = G(!1), U = G(!1), A = G(!1), E = G(new Array()), Y = G(new Array()), z = G([]), N = st(), y = Qe(), r = at(), n = Ct(), w = Ge(), f = zt({}), m = P(() => new Set(
|
|
1264
|
-
n.skus.filter((i) => {
|
|
1265
|
-
var t;
|
|
1266
|
-
return f[(t = i.customAttributes) == null ? void 0 : t.tag];
|
|
1267
|
-
}).map((i) => i._id)
|
|
1268
|
-
)), $ = s, T = G({
|
|
1269
|
-
templateItem: !0,
|
|
1270
|
-
nonTemplateItem: !0
|
|
1271
|
-
}), W = P(() => {
|
|
1272
|
-
var t, p;
|
|
1273
|
-
const i = [...((t = e.draft) == null ? void 0 : t.items) ?? [], ...((p = e.draft) == null ? void 0 : p.negativeStockItems) ?? []];
|
|
1274
|
-
return m.value.size ? i.filter((o) => m.value.has(o.sku._id)) : i;
|
|
1275
|
-
}), ae = P(() => {
|
|
1276
|
-
const i = W.value.map((t) => t.sku);
|
|
1277
|
-
return i.sort((t, p) => t.code.localeCompare(p.code)), i;
|
|
1278
|
-
}), ne = P(() => W.value.groupBy(
|
|
1279
|
-
(t) => t.sku._id,
|
|
1280
|
-
(t) => t.measurementsAmounts.filter((p) => !p.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((p) => p.measurement.id)
|
|
1281
|
-
));
|
|
1282
|
-
nt(C), Oe(
|
|
1283
|
-
() => e.show,
|
|
1284
|
-
(i) => {
|
|
1285
|
-
i && (Pe.value = Ze[0], C(), T.value = {
|
|
1286
|
-
templateItem: !0,
|
|
1287
|
-
nonTemplateItem: !0
|
|
1288
|
-
});
|
|
1289
|
-
}
|
|
1290
|
-
);
|
|
1291
|
-
const ie = P(() => Ie.value.reduce((i, t) => i + Number(t.stockTakeValue), 0)), me = Re(0), B = Re(100);
|
|
1292
|
-
async function C() {
|
|
1293
|
-
var t, p, o, c;
|
|
1294
|
-
if (!w._currentLocation) return;
|
|
1295
|
-
V.value = !0;
|
|
1296
|
-
const i = ((t = e.draft) == null ? void 0 : t.status) === _e.enum.COMPLETED;
|
|
1297
|
-
Y.value = [];
|
|
1298
|
-
try {
|
|
1299
|
-
if (await n.init(), i) {
|
|
1300
|
-
const H = e.draft.closingAdjustmentId;
|
|
1301
|
-
if (!H) {
|
|
1302
|
-
r.open({
|
|
1303
|
-
title: "Something went wrong",
|
|
1304
|
-
message: "Closing draft is completed but closing document cannot be found.",
|
|
1305
|
-
type: "error"
|
|
1306
|
-
}), console.error("Closing draft is completed but closing document cannot be found.", {
|
|
1307
|
-
draftId: (p = e.draft) == null ? void 0 : p._id
|
|
1308
|
-
});
|
|
1309
|
-
return;
|
|
1310
|
-
}
|
|
1311
|
-
const O = await N.readAdjustmentById(H), fe = (O == null ? void 0 : O.skus) ?? [];
|
|
1312
|
-
for (const ye of fe) {
|
|
1313
|
-
const Se = {
|
|
1314
|
-
id: ye.sku._id,
|
|
1315
|
-
balance: ye.fromBalance,
|
|
1316
|
-
costs: ye.fromCostBalances
|
|
1317
|
-
}, I = {
|
|
1318
|
-
id: ye.sku._id,
|
|
1319
|
-
balance: ye.toBalance,
|
|
1320
|
-
costs: ye.toCostBalances
|
|
1321
|
-
};
|
|
1322
|
-
E.value.push(Se), Y.value.push(I);
|
|
1323
|
-
}
|
|
1324
|
-
} else
|
|
1325
|
-
E.value = ((o = e.draft) == null ? void 0 : o.stockSnapshot) ?? [];
|
|
1326
|
-
const v = /* @__PURE__ */ new Set();
|
|
1327
|
-
if ((c = e.draft) != null && c.adjustmentSnapshot)
|
|
1328
|
-
for (const H of e.draft.adjustmentSnapshot)
|
|
1329
|
-
H.adjustmentsByType && Object.keys(H.adjustmentsByType).forEach((O) => v.add(O));
|
|
1330
|
-
const h = ["receive", "sales", "wastage"], j = [];
|
|
1331
|
-
h.forEach((H) => {
|
|
1332
|
-
v.has(H) && (j.push(H), v.delete(H));
|
|
1333
|
-
});
|
|
1334
|
-
const F = Array.from(v).sort();
|
|
1335
|
-
z.value = [...j, ...F];
|
|
1336
|
-
} catch (v) {
|
|
1337
|
-
r.open({
|
|
1338
|
-
title: "Something went wrong",
|
|
1339
|
-
message: "Something went wrong when fetching info. Please try again.",
|
|
1340
|
-
type: "error"
|
|
1341
|
-
}), console.error("error on fetch stock balances", v);
|
|
1342
|
-
} finally {
|
|
1343
|
-
V.value = !1;
|
|
1344
|
-
}
|
|
1345
|
-
}
|
|
1346
|
-
async function g() {
|
|
1347
|
-
var t, p;
|
|
1348
|
-
if (!(((t = e.draft) == null ? void 0 : t.effectiveAt) ?? (e.draft ? Ce((p = e.draft) == null ? void 0 : p._id) : null))) {
|
|
1349
|
-
r.open({
|
|
1350
|
-
title: "Cannot refresh",
|
|
1351
|
-
message: "Effective date is not available for this draft.",
|
|
1352
|
-
type: "error"
|
|
1353
|
-
});
|
|
1354
|
-
return;
|
|
1355
|
-
}
|
|
1356
|
-
await l.refreshBalance(
|
|
1357
|
-
e.draft,
|
|
1358
|
-
() => {
|
|
1359
|
-
},
|
|
1360
|
-
async (o) => {
|
|
1361
|
-
var j;
|
|
1362
|
-
U.value = !0;
|
|
1363
|
-
const c = (j = e.draft) == null ? void 0 : j._rev, v = 30, h = 2e3;
|
|
1364
|
-
try {
|
|
1365
|
-
await N.recalculation.scheduleCalculateStockSnapshotAtDate(o, e.draft._id);
|
|
1366
|
-
let F = null;
|
|
1367
|
-
for (let H = 0; H < v && (F = await y.getDraft(e.draft._id).delayed(h), F._rev === c); H++)
|
|
1368
|
-
;
|
|
1369
|
-
if (!F || F._rev === c) {
|
|
1370
|
-
r.open({
|
|
1371
|
-
title: "Refresh failed",
|
|
1372
|
-
message: "Failed to refresh stock balance. Please try again.",
|
|
1373
|
-
type: "error"
|
|
1374
|
-
}), console.error("error refreshing stock balances: there is no change in _rev");
|
|
1375
|
-
return;
|
|
1376
|
-
}
|
|
1377
|
-
$("refresh", F), E.value = F.stockSnapshot ?? [], r.open({
|
|
1378
|
-
title: "Balance refreshed",
|
|
1379
|
-
message: "Stock balance has been recalculated.",
|
|
1380
|
-
type: "success"
|
|
1381
|
-
}), L.value = !1;
|
|
1382
|
-
} catch (F) {
|
|
1383
|
-
r.open({
|
|
1384
|
-
title: "Refresh failed",
|
|
1385
|
-
message: "Failed to refresh stock balance. Please try again.",
|
|
1386
|
-
type: "error"
|
|
1387
|
-
}), console.error("error refreshing stock balances", F);
|
|
1388
|
-
} finally {
|
|
1389
|
-
U.value = !1;
|
|
1390
|
-
}
|
|
1391
|
-
}
|
|
1392
|
-
);
|
|
1393
|
-
}
|
|
1394
|
-
async function R() {
|
|
1395
|
-
var t, p;
|
|
1396
|
-
if (!(((t = e.draft) == null ? void 0 : t.effectiveAt) ?? (e.draft ? Ce((p = e.draft) == null ? void 0 : p._id) : null))) {
|
|
1397
|
-
r.open({
|
|
1398
|
-
title: "Cannot refresh",
|
|
1399
|
-
message: "Effective date is not available for this draft.",
|
|
1400
|
-
type: "error"
|
|
1401
|
-
});
|
|
1402
|
-
return;
|
|
1403
|
-
}
|
|
1404
|
-
await l.invalidateDraftCache(e.draft);
|
|
1405
|
-
}
|
|
1406
|
-
const X = P(
|
|
1407
|
-
() => E.value.groupBy(
|
|
1408
|
-
(i) => i.id,
|
|
1409
|
-
(i) => i.balance
|
|
1410
|
-
)
|
|
1411
|
-
), ee = P(() => W.value.groupBy((i) => i.sku._id)), ve = P(() => {
|
|
1412
|
-
var i;
|
|
1413
|
-
return (i = e.draft) != null && i.adjustmentSnapshot ? new Map(e.draft.adjustmentSnapshot.map((t) => [t.skuId, t.adjustmentsByType])) : /* @__PURE__ */ new Map();
|
|
1414
|
-
}), Ae = P(() => {
|
|
1415
|
-
var i;
|
|
1416
|
-
return (i = e.draft) != null && i.opening ? new Map(e.draft.opening.map((t) => [t.skuId, t.balance])) : /* @__PURE__ */ new Map();
|
|
1417
|
-
});
|
|
1418
|
-
function re(i, t) {
|
|
1419
|
-
return x(
|
|
1420
|
-
ke.FmTooltip,
|
|
1421
|
-
{ zIndex: 51, placement: "left", class: "w-full flex justify-end" },
|
|
1422
|
-
{
|
|
1423
|
-
default() {
|
|
1424
|
-
return i;
|
|
1425
|
-
},
|
|
1426
|
-
content() {
|
|
1427
|
-
return t || i;
|
|
1428
|
-
}
|
|
1429
|
-
}
|
|
1430
|
-
);
|
|
1431
|
-
}
|
|
1432
|
-
const xe = P(() => {
|
|
1433
|
-
const i = ae.value.reduce((p, o) => {
|
|
1434
|
-
var c, v;
|
|
1435
|
-
return Math.max(p, ((v = (c = ne.value) == null ? void 0 : c.get(o._id)) == null ? void 0 : v[0].length) ?? 0);
|
|
1436
|
-
}, 0);
|
|
1437
|
-
return [
|
|
1438
|
-
{
|
|
1439
|
-
id: "sku",
|
|
1440
|
-
accessorFn: (p) => `${p.code} ${p.name}`,
|
|
1441
|
-
header: () => "Name",
|
|
1442
|
-
size: 350,
|
|
1443
|
-
cell(p) {
|
|
1444
|
-
const o = p.row.original, c = o.adjustedDiffPercentage, v = typeof c == "number" && Math.abs(c) > 10, h = x("div", { class: "flex flex-col gap-4" }, [
|
|
1445
|
-
x(
|
|
1446
|
-
"div",
|
|
1447
|
-
{
|
|
1448
|
-
class: [
|
|
1449
|
-
"line-clamp-1 fm-typo-en-body-lg-400",
|
|
1450
|
-
v ? " text-fm-color-system-error-300" : "text-fm-color-typo-primary"
|
|
1451
|
-
]
|
|
1452
|
-
},
|
|
1453
|
-
o.name
|
|
1454
|
-
),
|
|
1455
|
-
x(
|
|
1456
|
-
"div",
|
|
1457
|
-
{
|
|
1458
|
-
class: [
|
|
1459
|
-
"line-clamp-1 fm-typo-en-body-md-400",
|
|
1460
|
-
v ? " text-fm-color-system-error-300" : "text-fm-color-typo-secondary"
|
|
1461
|
-
]
|
|
1462
|
-
},
|
|
1463
|
-
o.code
|
|
1464
|
-
)
|
|
1465
|
-
]);
|
|
1466
|
-
return x(
|
|
1467
|
-
ke.FmTooltip,
|
|
1468
|
-
{
|
|
1469
|
-
zIndex: 51
|
|
1470
|
-
},
|
|
1471
|
-
{
|
|
1472
|
-
content() {
|
|
1473
|
-
return v ? "Adjustment difference is more than 10%." : `${o.code} - ${o.name}`;
|
|
1474
|
-
},
|
|
1475
|
-
default() {
|
|
1476
|
-
return x("div", { class: "flex items-center gap-4 justify-start w-full" }, [
|
|
1477
|
-
h
|
|
1478
|
-
]);
|
|
1479
|
-
}
|
|
1480
|
-
}
|
|
1481
|
-
);
|
|
1482
|
-
}
|
|
1483
|
-
},
|
|
1484
|
-
{
|
|
1485
|
-
id: "costPerUnit",
|
|
1486
|
-
accessorKey: "costPerUnit",
|
|
1487
|
-
header: () => re("Cost per unit"),
|
|
1488
|
-
size: 160,
|
|
1489
|
-
cell(p) {
|
|
1490
|
-
const o = p.row.original.costPerUnit;
|
|
1491
|
-
return x("div", { class: "text-right fm-typo-en-body-lg-400" }, te(o));
|
|
1492
|
-
},
|
|
1493
|
-
meta: {
|
|
1494
|
-
textAlign: "right"
|
|
1495
|
-
}
|
|
1496
|
-
},
|
|
1497
|
-
{
|
|
1498
|
-
id: "costUnit",
|
|
1499
|
-
header: () => "UOM",
|
|
1500
|
-
size: 120,
|
|
1501
|
-
cell(p) {
|
|
1502
|
-
var j;
|
|
1503
|
-
const o = p.row.original, c = o.costUnit, v = o.baseUnit, h = c ?? v;
|
|
1504
|
-
if (c && c !== v) {
|
|
1505
|
-
const F = ae.value.find((O) => O._id === o.id), H = (j = F == null ? void 0 : F.defaultCost) == null ? void 0 : j.measurement;
|
|
1506
|
-
if (H) {
|
|
1507
|
-
const O = H.conversion.amount / Math.pow(10, H.conversion.precision);
|
|
1508
|
-
return x("div", { class: "flex flex-col" }, [
|
|
1509
|
-
x(
|
|
1510
|
-
"span",
|
|
1511
|
-
{ class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
|
|
1512
|
-
h
|
|
1513
|
-
),
|
|
1514
|
-
x("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, [
|
|
1515
|
-
"1 ",
|
|
1516
|
-
x("span", { class: "fm-typo-en-body-sm-600" }, c),
|
|
1517
|
-
` = ${O} `,
|
|
1518
|
-
x("span", { class: "fm-typo-en-body-sm-600" }, v)
|
|
1519
|
-
])
|
|
1520
|
-
]);
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
return h;
|
|
1524
|
-
}
|
|
1525
|
-
},
|
|
1526
|
-
{
|
|
1527
|
-
id: "opening",
|
|
1528
|
-
accessorKey: "opening",
|
|
1529
|
-
header: () => re("Opening (B/F)", "The opening balance brought forward from previous period."),
|
|
1530
|
-
size: 150,
|
|
1531
|
-
cell(p) {
|
|
1532
|
-
const o = p.row.original.opening;
|
|
1533
|
-
return x("div", { class: "text-right fm-typo-en-body-lg-400" }, te(o));
|
|
1534
|
-
},
|
|
1535
|
-
meta: {
|
|
1536
|
-
textAlign: "right"
|
|
1537
|
-
}
|
|
1538
|
-
},
|
|
1539
|
-
// Dynamic adjustment type columns
|
|
1540
|
-
...z.value.map(
|
|
1541
|
-
(p) => ({
|
|
1542
|
-
id: `adjustment_${p}`,
|
|
1543
|
-
accessorFn: (o) => o.adjustmentAmounts[p] ?? { amount: 0, precision: 0 },
|
|
1544
|
-
header: () => re(Ue(p)),
|
|
1545
|
-
size: 150,
|
|
1546
|
-
cell(o) {
|
|
1547
|
-
const c = o.row.original.adjustmentAmounts[p] ?? { amount: 0, precision: 0 };
|
|
1548
|
-
return x("div", { class: "text-right fm-typo-en-body-lg-400" }, te(c));
|
|
1549
|
-
},
|
|
1550
|
-
meta: {
|
|
1551
|
-
textAlign: "right"
|
|
1552
|
-
}
|
|
1553
|
-
})
|
|
1554
|
-
),
|
|
1555
|
-
{
|
|
1556
|
-
id: "systemBalance",
|
|
1557
|
-
accessorKey: "systemBalance",
|
|
1558
|
-
header: () => re("System Balance", "The system calculated balance before stock take."),
|
|
1559
|
-
size: 200,
|
|
1560
|
-
cell(p) {
|
|
1561
|
-
const o = p.row.original.systemBalance;
|
|
1562
|
-
return x("div", { class: "text-right fm-typo-en-body-lg-400" }, te(o));
|
|
1563
|
-
},
|
|
1564
|
-
meta: {
|
|
1565
|
-
textAlign: "right"
|
|
1566
|
-
}
|
|
1567
|
-
},
|
|
1568
|
-
{
|
|
1569
|
-
id: "physicalBalance",
|
|
1570
|
-
accessorFn: (p) => {
|
|
1571
|
-
var c;
|
|
1572
|
-
const o = (c = Y.value.find((v) => v.id === p.id)) == null ? void 0 : c.balance;
|
|
1573
|
-
return o ? mn.toDouble(o) : p.physicalBalance;
|
|
1574
|
-
},
|
|
1575
|
-
header: () => re("Stock Take balance", "The physical balance recorded during stock take."),
|
|
1576
|
-
cell(p) {
|
|
1577
|
-
var F;
|
|
1578
|
-
const o = p.row.original, c = K.fromNumber(o.physicalBalance);
|
|
1579
|
-
let v = !0;
|
|
1580
|
-
const h = (F = Y.value.find((H) => H.id === o.id)) == null ? void 0 : F.balance;
|
|
1581
|
-
let j;
|
|
1582
|
-
return h && !K.equals({ a: c, b: h }) ? (v = !1, j = te(h)) : j = te(o.physicalBalance), x("div", { class: "flex flex-col" }, [
|
|
1583
|
-
x(
|
|
1584
|
-
"span",
|
|
1585
|
-
{ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
|
|
1586
|
-
j
|
|
1587
|
-
),
|
|
1588
|
-
v ? null : x(
|
|
1589
|
-
"span",
|
|
1590
|
-
{ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
|
|
1591
|
-
`Draft: ${te(o.physicalBalance)}`
|
|
1592
|
-
)
|
|
1593
|
-
]);
|
|
1594
|
-
},
|
|
1595
|
-
size: 200,
|
|
1596
|
-
meta: {
|
|
1597
|
-
textAlign: "right"
|
|
1598
|
-
}
|
|
1599
|
-
},
|
|
1600
|
-
{
|
|
1601
|
-
id: "adjustedAmount",
|
|
1602
|
-
accessorKey: "adjustedAmount",
|
|
1603
|
-
header: () => re("Variance", "The difference between Stock Take balance and System Balance."),
|
|
1604
|
-
size: 200,
|
|
1605
|
-
cell(p) {
|
|
1606
|
-
const o = p.row.original.adjustedAmount;
|
|
1607
|
-
return x("div", { class: "text-right fm-typo-en-body-lg-400" }, te(o));
|
|
1608
|
-
},
|
|
1609
|
-
meta: {
|
|
1610
|
-
textAlign: "right"
|
|
1611
|
-
}
|
|
1612
|
-
},
|
|
1613
|
-
{
|
|
1614
|
-
id: "varianceInCost",
|
|
1615
|
-
accessorKey: "varianceInCost",
|
|
1616
|
-
header: () => re(`Variance (${d.value})`),
|
|
1617
|
-
size: 150,
|
|
1618
|
-
cell(p) {
|
|
1619
|
-
const o = p.row.original.varianceInCost;
|
|
1620
|
-
return x("div", { class: "text-right fm-typo-en-body-lg-400" }, te(o));
|
|
1621
|
-
},
|
|
1622
|
-
meta: {
|
|
1623
|
-
textAlign: "right"
|
|
1624
|
-
}
|
|
1625
|
-
},
|
|
1626
|
-
{
|
|
1627
|
-
id: "adjustedDiffPercentage",
|
|
1628
|
-
accessorKey: "adjustedDiffPercentage",
|
|
1629
|
-
header: () => re(
|
|
1630
|
-
"Variance (%)",
|
|
1631
|
-
"Difference between Stock Take balance and System Balance in percentage."
|
|
1632
|
-
),
|
|
1633
|
-
size: 200,
|
|
1634
|
-
cell(p) {
|
|
1635
|
-
const o = p.row.original.adjustedDiffPercentage;
|
|
1636
|
-
if (o == null)
|
|
1637
|
-
return x(
|
|
1638
|
-
"div",
|
|
1639
|
-
{ class: "flex items-center gap-4 justify-end fm-typo-en-body-lg-400" },
|
|
1640
|
-
_t
|
|
1641
|
-
);
|
|
1642
|
-
const c = te(o);
|
|
1643
|
-
if (o === 0)
|
|
1644
|
-
return x("div", { class: "flex items-center gap-4 justify-end fm-typo-en-body-lg-400" }, [
|
|
1645
|
-
te(0)
|
|
1646
|
-
]);
|
|
1647
|
-
const v = o > 0;
|
|
1648
|
-
return x("div", { class: "flex items-center gap-4 justify-end fm-typo-en-body-lg-400" }, [
|
|
1649
|
-
x(ke.FmIcon, {
|
|
1650
|
-
name: v ? "arrow_drop_up" : "arrow_drop_down",
|
|
1651
|
-
color: v ? "system-success-300" : "system-error-300",
|
|
1652
|
-
size: "md"
|
|
1653
|
-
}),
|
|
1654
|
-
c
|
|
1655
|
-
]);
|
|
1656
|
-
},
|
|
1657
|
-
meta: {
|
|
1658
|
-
textAlign: "right"
|
|
1659
|
-
}
|
|
1660
|
-
},
|
|
1661
|
-
{
|
|
1662
|
-
id: "stockTakeValue",
|
|
1663
|
-
accessorKey: "stockTakeValue",
|
|
1664
|
-
header: () => re(`Stock take value (${d.value})`),
|
|
1665
|
-
size: 180,
|
|
1666
|
-
cell(p) {
|
|
1667
|
-
var H;
|
|
1668
|
-
const o = p.row.original, c = o.stockTakeValue, v = ae.value.find((O) => O._id === o.id), h = (H = v == null ? void 0 : v.defaultCost) == null ? void 0 : H.measurement, j = o.physicalBalance, F = o.costPerUnit;
|
|
1669
|
-
if (h) {
|
|
1670
|
-
const O = K.toFormatString({ value: h.conversion }), fe = `${te(j, { minPrecision: 2, maxPrecision: 4 })} ${o.baseUnit} ÷ ${O} × ${F} ${d.value}`;
|
|
1671
|
-
return x(
|
|
1672
|
-
ke.FmTooltip,
|
|
1673
|
-
{ zIndex: 51 },
|
|
1674
|
-
{
|
|
1675
|
-
content() {
|
|
1676
|
-
return fe;
|
|
1677
|
-
},
|
|
1678
|
-
default() {
|
|
1679
|
-
return x(
|
|
1680
|
-
"div",
|
|
1681
|
-
{ class: "text-right w-full fm-typo-en-body-lg-400" },
|
|
1682
|
-
te(c)
|
|
1683
|
-
);
|
|
1684
|
-
}
|
|
1685
|
-
}
|
|
1686
|
-
);
|
|
1687
|
-
} else {
|
|
1688
|
-
const O = `${te(j, { minPrecision: 2, maxPrecision: 4 })} ${o.baseUnit} × ${F} ${d.value}`;
|
|
1689
|
-
return x(
|
|
1690
|
-
ke.FmTooltip,
|
|
1691
|
-
{ zIndex: 51 },
|
|
1692
|
-
{
|
|
1693
|
-
content() {
|
|
1694
|
-
return O;
|
|
1695
|
-
},
|
|
1696
|
-
default() {
|
|
1697
|
-
return x(
|
|
1698
|
-
"div",
|
|
1699
|
-
{ class: "text-right w-full fm-typo-en-body-lg-400" },
|
|
1700
|
-
te(c)
|
|
1701
|
-
);
|
|
1702
|
-
}
|
|
1703
|
-
}
|
|
1704
|
-
);
|
|
1705
|
-
}
|
|
1706
|
-
},
|
|
1707
|
-
meta: {
|
|
1708
|
-
textAlign: "right"
|
|
1709
|
-
}
|
|
1710
|
-
},
|
|
1711
|
-
{
|
|
1712
|
-
id: "systemValue",
|
|
1713
|
-
accessorKey: "systemValue",
|
|
1714
|
-
header: () => re(`System value (${d.value})`),
|
|
1715
|
-
size: 180,
|
|
1716
|
-
cell(p) {
|
|
1717
|
-
var H;
|
|
1718
|
-
const o = p.row.original, c = o.systemValue, v = ae.value.find((O) => O._id === o.id), h = (H = v == null ? void 0 : v.defaultCost) == null ? void 0 : H.measurement, j = o.systemBalance, F = o.costPerUnit;
|
|
1719
|
-
if (h) {
|
|
1720
|
-
const O = K.toFormatString({ value: h.conversion }), fe = `${te(j, { minPrecision: 2, maxPrecision: 4 })} ${o.baseUnit} ÷ ${O} × ${F} ${d.value}`;
|
|
1721
|
-
return x(
|
|
1722
|
-
ke.FmTooltip,
|
|
1723
|
-
{ zIndex: 51 },
|
|
1724
|
-
{
|
|
1725
|
-
content() {
|
|
1726
|
-
return fe;
|
|
1727
|
-
},
|
|
1728
|
-
default() {
|
|
1729
|
-
return x(
|
|
1730
|
-
"div",
|
|
1731
|
-
{ class: "text-right fm-typo-en-body-lg-400" },
|
|
1732
|
-
te(c)
|
|
1733
|
-
);
|
|
1734
|
-
}
|
|
1735
|
-
}
|
|
1736
|
-
);
|
|
1737
|
-
} else {
|
|
1738
|
-
const O = `${te(j, { minPrecision: 2, maxPrecision: 4 })} ${o.baseUnit} × ${F} ${d.value}`;
|
|
1739
|
-
return x(
|
|
1740
|
-
ke.FmTooltip,
|
|
1741
|
-
{ zIndex: 51 },
|
|
1742
|
-
{
|
|
1743
|
-
content() {
|
|
1744
|
-
return O;
|
|
1745
|
-
},
|
|
1746
|
-
default() {
|
|
1747
|
-
return x(
|
|
1748
|
-
"div",
|
|
1749
|
-
{ class: "text-right fm-typo-en-body-lg-400" },
|
|
1750
|
-
te(c)
|
|
1751
|
-
);
|
|
1752
|
-
}
|
|
1753
|
-
}
|
|
1754
|
-
);
|
|
1755
|
-
}
|
|
1756
|
-
},
|
|
1757
|
-
meta: {
|
|
1758
|
-
textAlign: "right"
|
|
1759
|
-
}
|
|
1760
|
-
},
|
|
1761
|
-
{
|
|
1762
|
-
id: "physicalBalances",
|
|
1763
|
-
header: () => "Amounts",
|
|
1764
|
-
enableSorting: !1,
|
|
1765
|
-
cell(p) {
|
|
1766
|
-
const o = p.row.original, c = (h, j) => x(
|
|
1767
|
-
ke.FmTooltip,
|
|
1768
|
-
{ zIndex: 50 },
|
|
1769
|
-
{
|
|
1770
|
-
default() {
|
|
1771
|
-
return x(
|
|
1772
|
-
"div",
|
|
1773
|
-
{
|
|
1774
|
-
class: "fm-typo-en-body-lg-400 py-4 px-8 border-1 border-fm-color-typo-secondary fm-corner-radius-md line-clamp-1"
|
|
1775
|
-
},
|
|
1776
|
-
[
|
|
1777
|
-
x("span", { class: "text-fm-color-typo-primary" }, `${h} `),
|
|
1778
|
-
x(
|
|
1779
|
-
"span",
|
|
1780
|
-
{
|
|
1781
|
-
class: "text-fm-color-typo-secondary",
|
|
1782
|
-
style: { maxWidth: "80px" }
|
|
1783
|
-
},
|
|
1784
|
-
j
|
|
1785
|
-
)
|
|
1786
|
-
]
|
|
1787
|
-
);
|
|
1788
|
-
},
|
|
1789
|
-
content() {
|
|
1790
|
-
return `${h} ${j}`;
|
|
1791
|
-
}
|
|
1792
|
-
}
|
|
1793
|
-
);
|
|
1794
|
-
let v = Array.from({ length: i }).map((h, j) => {
|
|
1795
|
-
if (!o[`measurementAmount${j}`])
|
|
1796
|
-
return null;
|
|
1797
|
-
const F = o[`measurementAmount${j}`], H = o[`measurementAbbrev${j}`];
|
|
1798
|
-
return c(F, H);
|
|
1799
|
-
}).filter((h) => h);
|
|
1800
|
-
return (o.baseUnitAmount || !v.length) && (v = [c(o.baseUnitAmount, o.baseUnit), ...v]), x(
|
|
1801
|
-
"div",
|
|
1802
|
-
{
|
|
1803
|
-
class: "flex gap-8 flex-nowrap",
|
|
1804
|
-
style: {
|
|
1805
|
-
minWidth: `${120 * v.length}px`
|
|
1806
|
-
}
|
|
1807
|
-
},
|
|
1808
|
-
v
|
|
1809
|
-
);
|
|
1810
|
-
}
|
|
1811
|
-
}
|
|
1812
|
-
];
|
|
1813
|
-
}), Me = P(() => xe.value.map((i) => i.size ?? 0).reduce((i, t) => i + t)), De = G(""), Ie = P(() => {
|
|
1814
|
-
var p, o;
|
|
1815
|
-
const i = ((o = (p = e.draft) == null ? void 0 : p.negativeStockItems) == null ? void 0 : o.reduce(
|
|
1816
|
-
(c, v) => (c[v.sku._id] = v, c),
|
|
1817
|
-
{}
|
|
1818
|
-
)) ?? {};
|
|
1819
|
-
return ae.value.map((c) => {
|
|
1820
|
-
var it, ct, ut, dt, mt, ft, pt, vt, yt, gt, bt;
|
|
1821
|
-
const v = (it = ee.value.get(c._id)) == null ? void 0 : it[0], h = ((ct = X.value.get(c._id)) == null ? void 0 : ct[0]) ?? me, j = ((ut = c.defaultCost) == null ? void 0 : ut.costPerUnit) ?? me, F = Number(K.toFormatString({ value: j })), H = ((mt = (dt = c.defaultCost) == null ? void 0 : dt.measurement) == null ? void 0 : mt.conversion) ?? {
|
|
1822
|
-
amount: 1,
|
|
1823
|
-
precision: 0
|
|
1824
|
-
}, O = Number(
|
|
1825
|
-
K.toFormatString({ value: H })
|
|
1826
|
-
), fe = Ae.value.get(c._id), ye = fe ? Number(K.toFormatString({ value: fe })) : 0, Se = ve.value.get(c._id), I = {};
|
|
1827
|
-
if (z.value.forEach((le) => {
|
|
1828
|
-
const ge = I[le] ?? { amount: 0, precision: 0 }, be = Se == null ? void 0 : Se[le];
|
|
1829
|
-
be && (I[le] = jt(ge, be));
|
|
1830
|
-
}), !v) {
|
|
1831
|
-
const le = Number(K.toFormatString({ value: h })), ge = 0 - le, be = ge * F / O, ze = 0, Et = le * F / O;
|
|
1832
|
-
return {
|
|
1833
|
-
id: c._id,
|
|
1834
|
-
code: c.code,
|
|
1835
|
-
name: c.name,
|
|
1836
|
-
costUnit: ((pt = (ft = c.defaultCost) == null ? void 0 : ft.measurement) == null ? void 0 : pt.abbrev) ?? null,
|
|
1837
|
-
baseUnit: c.unit.abbrev,
|
|
1838
|
-
baseUnitAmount: 0,
|
|
1839
|
-
systemBalance: le,
|
|
1840
|
-
physicalBalance: 0,
|
|
1841
|
-
adjustedAmount: -le,
|
|
1842
|
-
adjustedDiffPercentage: -100,
|
|
1843
|
-
isTemplateItem: !i[c._id],
|
|
1844
|
-
costPerUnit: F,
|
|
1845
|
-
opening: ye,
|
|
1846
|
-
varianceQty: ge,
|
|
1847
|
-
varianceInCost: be,
|
|
1848
|
-
stockTakeValue: ze,
|
|
1849
|
-
systemValue: Et,
|
|
1850
|
-
adjustmentAmounts: I
|
|
1851
|
-
};
|
|
1852
|
-
}
|
|
1853
|
-
const oe = Pt(v), ce = (yt = (vt = Y.value) == null ? void 0 : vt.find(
|
|
1854
|
-
(le) => le.id === c._id
|
|
1855
|
-
)) == null ? void 0 : yt.balance, he = Bt(
|
|
1856
|
-
ce ?? oe,
|
|
1857
|
-
h
|
|
1858
|
-
), Fe = h.amount === 0 ? null : Tt(he, {
|
|
1859
|
-
...h,
|
|
1860
|
-
amount: Math.abs(h.amount)
|
|
1861
|
-
}), Ee = Fe ? ot(Fe, B) : null, Je = Number(K.toFormatString({ value: h })), Xe = Number(K.toFormatString({ value: oe })), lt = Xe - Je, Mt = lt * F / O, Nt = Xe * F / O, Lt = Je * F / O;
|
|
1862
|
-
return {
|
|
1863
|
-
id: c._id,
|
|
1864
|
-
code: c.code,
|
|
1865
|
-
name: c.name,
|
|
1866
|
-
costUnit: ((bt = (gt = c.defaultCost) == null ? void 0 : gt.measurement) == null ? void 0 : bt.abbrev) ?? null,
|
|
1867
|
-
baseUnit: c.unit.abbrev,
|
|
1868
|
-
baseUnitAmount: Number(K.toFormatString({ value: v.baseAmount })),
|
|
1869
|
-
...v.measurementsAmounts.filter((le) => {
|
|
1870
|
-
var ge, be, ze;
|
|
1871
|
-
return (ze = (be = (ge = ne.value) == null ? void 0 : ge.get(c._id)) == null ? void 0 : be[0]) == null ? void 0 : ze.includes(le.measurement.id);
|
|
1872
|
-
}).reduce((le, ge, be) => (le[`measurementAbbrev${be}`] = `(${ge.measurement.abbrev}) × ${K.toFormatString({ value: ge.measurement.conversion })}`, le[`measurementAmount${be}`] = Number(K.toFormatString({ value: ge.amount })), le), {}),
|
|
1873
|
-
systemBalance: Je,
|
|
1874
|
-
physicalBalance: Xe,
|
|
1875
|
-
adjustedAmount: Number(K.toFormatString({ value: he })),
|
|
1876
|
-
adjustedDiffPercentage: Ee ? Number(
|
|
1877
|
-
K.toFormatString({
|
|
1878
|
-
value: It(Ee, 2)
|
|
1879
|
-
})
|
|
1880
|
-
) : null,
|
|
1881
|
-
isTemplateItem: !i[c._id],
|
|
1882
|
-
costPerUnit: F,
|
|
1883
|
-
opening: ye,
|
|
1884
|
-
varianceQty: lt,
|
|
1885
|
-
varianceInCost: Mt,
|
|
1886
|
-
stockTakeValue: Nt,
|
|
1887
|
-
systemValue: Lt,
|
|
1888
|
-
adjustmentAmounts: I
|
|
1889
|
-
};
|
|
1890
|
-
}).filter((c) => !!(c.isTemplateItem && T.value.templateItem || !c.isTemplateItem && T.value.nonTemplateItem));
|
|
1891
|
-
}), We = P(() => {
|
|
1892
|
-
var t, p, o, c, v;
|
|
1893
|
-
if (!e.draft) return [];
|
|
1894
|
-
const i = e.draft.approvedAt ? {
|
|
1895
|
-
action: `Approve at ${we(e.draft.approvedAt)}`,
|
|
1896
|
-
// actionAt: props.draft.approvedAt,
|
|
1897
|
-
actionBy: e.draft.approvedBy,
|
|
1898
|
-
remark: e.draft.approveRemark
|
|
1899
|
-
} : (t = e.draft.rejectionHistory) == null ? void 0 : t.computeFirst((h) => ({
|
|
1900
|
-
action: `Reject at ${we(h.rejectedAt)}`,
|
|
1901
|
-
// actionAt: e.rejectedAt,
|
|
1902
|
-
actionBy: h.rejectedBy,
|
|
1903
|
-
remark: h.rejectRemark
|
|
1904
|
-
}));
|
|
1905
|
-
return [
|
|
1906
|
-
_.value ? {
|
|
1907
|
-
label: "ID",
|
|
1908
|
-
value: _.value
|
|
1909
|
-
} : null,
|
|
1910
|
-
{
|
|
1911
|
-
label: "Location",
|
|
1912
|
-
value: ((p = w._currentLocation) == null ? void 0 : p.name) ?? _t
|
|
1913
|
-
},
|
|
1914
|
-
{
|
|
1915
|
-
label: "Created at",
|
|
1916
|
-
value: we(e.draft.createdAt)
|
|
1917
|
-
},
|
|
1918
|
-
{
|
|
1919
|
-
label: "Created by",
|
|
1920
|
-
value: e.draft.createdBy.name
|
|
1921
|
-
},
|
|
1922
|
-
{
|
|
1923
|
-
label: "Updated at",
|
|
1924
|
-
value: we(e.draft.updatedAt)
|
|
1925
|
-
},
|
|
1926
|
-
{
|
|
1927
|
-
label: "Updated by",
|
|
1928
|
-
value: e.draft.updatedBy.name
|
|
1929
|
-
},
|
|
1930
|
-
{
|
|
1931
|
-
label: "Effective at",
|
|
1932
|
-
value: we(e.draft.effectiveAt ?? Ce((o = e.draft) == null ? void 0 : o._id))
|
|
1933
|
-
},
|
|
1934
|
-
{
|
|
1935
|
-
label: "Using template",
|
|
1936
|
-
value: ((c = e.draft.usingTemplates.find((h) => h)) == null ? void 0 : c.name) ?? "None"
|
|
1937
|
-
},
|
|
1938
|
-
e.draft.remark ? {
|
|
1939
|
-
label: "Remark",
|
|
1940
|
-
value: e.draft.remark
|
|
1941
|
-
} : null,
|
|
1942
|
-
i ? {
|
|
1943
|
-
label: "Last action",
|
|
1944
|
-
value: i.action
|
|
1945
|
-
} : null,
|
|
1946
|
-
i && i.actionBy ? {
|
|
1947
|
-
label: "Last action by",
|
|
1948
|
-
value: (v = i.actionBy) == null ? void 0 : v.name
|
|
1949
|
-
} : null,
|
|
1950
|
-
i && i.remark ? {
|
|
1951
|
-
label: "Action remark",
|
|
1952
|
-
value: i.remark
|
|
1953
|
-
} : null
|
|
1954
|
-
].filter((h) => h).map((h) => h);
|
|
1955
|
-
}), Ze = [
|
|
1956
|
-
{
|
|
1957
|
-
label: "Overview",
|
|
1958
|
-
value: "overview"
|
|
1959
|
-
},
|
|
1960
|
-
{
|
|
1961
|
-
label: "Action history",
|
|
1962
|
-
value: "history"
|
|
1963
|
-
}
|
|
1964
|
-
], Pe = G(Ze[0]), $e = P(() => {
|
|
1965
|
-
var o, c, v;
|
|
1966
|
-
const i = ((o = e.draft) == null ? void 0 : o.activityLogs) ?? [], t = ((c = e.draft) == null ? void 0 : c.rejectionHistory) ?? [];
|
|
1967
|
-
for (const h of t)
|
|
1968
|
-
i.find(
|
|
1969
|
-
(F) => `${F.action}_${F.performedAt}` == `${J.enum.rejectDraft}_${h.rejectedAt}`
|
|
1970
|
-
) || i.push({
|
|
1971
|
-
action: J.enum.rejectDraft,
|
|
1972
|
-
performedAt: h.rejectedAt,
|
|
1973
|
-
performedBy: h.rejectedBy,
|
|
1974
|
-
remark: h.rejectRemark
|
|
1975
|
-
});
|
|
1976
|
-
return (v = e.draft) != null && v.approvedAt && (i.find(
|
|
1977
|
-
(j) => {
|
|
1978
|
-
var F;
|
|
1979
|
-
return `${j.action}_${j.performedAt}` == `${J.enum.approveDraft}_${(F = e.draft) == null ? void 0 : F.approvedAt}`;
|
|
1980
|
-
}
|
|
1981
|
-
) || i.push({
|
|
1982
|
-
action: J.enum.approveDraft,
|
|
1983
|
-
performedAt: e.draft.approvedAt,
|
|
1984
|
-
performedBy: e.draft.approvedBy ?? { name: "Unknown", id: "unknown" },
|
|
1985
|
-
remark: e.draft.approveRemark
|
|
1986
|
-
})), i.sort((h, j) => new Date(j.performedAt).getTime() - new Date(h.performedAt).getTime()).map(
|
|
1987
|
-
(h) => ({
|
|
1988
|
-
header: Ue(h.action),
|
|
1989
|
-
date: we(h.performedAt),
|
|
1990
|
-
info: [
|
|
1991
|
-
{
|
|
1992
|
-
label: "Performed by",
|
|
1993
|
-
values: [h.performedBy.name]
|
|
1994
|
-
},
|
|
1995
|
-
{
|
|
1996
|
-
label: "Remark",
|
|
1997
|
-
values: [h.remark ?? ""]
|
|
1998
|
-
}
|
|
1999
|
-
]
|
|
2000
|
-
})
|
|
2001
|
-
);
|
|
2002
|
-
}), Ne = G(!1), Le = G(!1), rt = P(() => {
|
|
2003
|
-
var i;
|
|
2004
|
-
return ((i = e.draft) == null ? void 0 : i.status) !== _e.enum.DRAFT ? "Status is not draft." : null;
|
|
2005
|
-
});
|
|
2006
|
-
function Vt() {
|
|
2007
|
-
e.draft && (Le.value = !0, l.approveDraft(
|
|
2008
|
-
e.draft,
|
|
2009
|
-
() => {
|
|
2010
|
-
Le.value = !1, Ne.value = !1, $("submitted");
|
|
2011
|
-
},
|
|
2012
|
-
() => {
|
|
2013
|
-
Le.value = !1;
|
|
2014
|
-
}
|
|
2015
|
-
));
|
|
2016
|
-
}
|
|
2017
|
-
return (i, t) => {
|
|
2018
|
-
const p = q("FmButtonGroup"), o = q("FmMenuDivider"), c = q("FmCard"), v = q("FmButton"), h = q("FmCircularProgress"), j = q("FmChip"), F = q("FmTextField"), H = q("FmIcon"), O = q("FmTable"), fe = q("FmSpacer"), ye = q("FmTooltip"), Se = q("FmSideSheet");
|
|
2019
|
-
return S(), M(ue, null, [
|
|
2020
|
-
k(Se, {
|
|
2021
|
-
"dismiss-away": "",
|
|
2022
|
-
"max-width": 9999,
|
|
2023
|
-
"model-value": b(L),
|
|
2024
|
-
"onUpdate:modelValue": t[9] || (t[9] = (I) => xt(L) ? L.value = I : null),
|
|
2025
|
-
header: "Closing details"
|
|
2026
|
-
}, {
|
|
2027
|
-
"side-sheet-footer": Q(() => {
|
|
2028
|
-
var I, oe, ce, he;
|
|
2029
|
-
return [
|
|
2030
|
-
a("div", $a, [
|
|
2031
|
-
a("div", Fa, [
|
|
2032
|
-
((I = e.draft) == null ? void 0 : I.status) === b(_e).enum.DRAFT ? (S(), M(ue, { key: 0 }, [
|
|
2033
|
-
rt.value ? (S(), pe(ye, {
|
|
2034
|
-
key: 0,
|
|
2035
|
-
"z-index": 51,
|
|
2036
|
-
placement: "right"
|
|
2037
|
-
}, {
|
|
2038
|
-
content: Q(() => [
|
|
2039
|
-
de(Z(rt.value), 1)
|
|
2040
|
-
]),
|
|
2041
|
-
default: Q(() => [
|
|
2042
|
-
k(v, {
|
|
2043
|
-
disabled: "",
|
|
2044
|
-
key: "approve key",
|
|
2045
|
-
label: "Approve"
|
|
2046
|
-
})
|
|
2047
|
-
]),
|
|
2048
|
-
_: 1
|
|
2049
|
-
})) : (S(), pe(v, {
|
|
2050
|
-
key: "approve key",
|
|
2051
|
-
label: "Approve",
|
|
2052
|
-
onClick: t[5] || (t[5] = (Fe) => Ne.value = !0)
|
|
2053
|
-
}))
|
|
2054
|
-
], 64)) : se("", !0),
|
|
2055
|
-
((oe = e.draft) == null ? void 0 : oe.status) === b(_e).enum.DRAFT ? (S(), pe(v, {
|
|
2056
|
-
key: 1,
|
|
2057
|
-
label: "Reject",
|
|
2058
|
-
variant: "destructive",
|
|
2059
|
-
onClick: t[6] || (t[6] = () => e.draft && b(l).rejectDraft(e.draft, () => $("submitted")))
|
|
2060
|
-
})) : se("", !0),
|
|
2061
|
-
k(v, {
|
|
2062
|
-
label: "Close",
|
|
2063
|
-
variant: "tertiary",
|
|
2064
|
-
onClick: t[7] || (t[7] = (Fe) => L.value = !1)
|
|
2065
|
-
}),
|
|
2066
|
-
(ce = e.draft) != null && ce.approvedAt && ((he = e.draft) == null ? void 0 : he.status) !== b(_e).enum.COMPLETED ? (S(), pe(kt, { key: 2 }, {
|
|
2067
|
-
default: Q(() => [
|
|
2068
|
-
k(v, {
|
|
2069
|
-
label: "Sync",
|
|
2070
|
-
loading: A.value,
|
|
2071
|
-
onClick: t[8] || (t[8] = () => {
|
|
2072
|
-
e.draft && (A.value = !0, b(l).syncDraft(e.draft, () => {
|
|
2073
|
-
A.value = !1, $("submitted");
|
|
2074
|
-
}));
|
|
2075
|
-
})
|
|
2076
|
-
}, null, 8, ["loading"])
|
|
2077
|
-
]),
|
|
2078
|
-
_: 1
|
|
2079
|
-
})) : se("", !0)
|
|
2080
|
-
]),
|
|
2081
|
-
a("div", Ba, [
|
|
2082
|
-
t[19] || (t[19] = a("div", { class: "text-xs text-gray-500 uppercase tracking-wide" }, "Total stock take value", -1)),
|
|
2083
|
-
a("div", Ta, Z(d.value) + " " + Z(ie.value.toFixed(2)), 1)
|
|
2084
|
-
])
|
|
2085
|
-
])
|
|
2086
|
-
];
|
|
2087
|
-
}),
|
|
2088
|
-
default: Q(() => [
|
|
2089
|
-
a("div", Gn, [
|
|
2090
|
-
a("div", null, [
|
|
2091
|
-
k(p, {
|
|
2092
|
-
items: Ze,
|
|
2093
|
-
modelValue: Pe.value,
|
|
2094
|
-
"onUpdate:modelValue": t[0] || (t[0] = (I) => Pe.value = I)
|
|
2095
|
-
}, null, 8, ["modelValue"])
|
|
2096
|
-
]),
|
|
2097
|
-
Pe.value.value === "overview" ? (S(), M(ue, { key: 0 }, [
|
|
2098
|
-
k(c, {
|
|
2099
|
-
variant: "outlined",
|
|
2100
|
-
class: "flex flex-col gap-8 px-12 py-16"
|
|
2101
|
-
}, {
|
|
2102
|
-
default: Q(() => {
|
|
2103
|
-
var I, oe;
|
|
2104
|
-
return [
|
|
2105
|
-
a("div", Qn, [
|
|
2106
|
-
t[11] || (t[11] = a("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
|
|
2107
|
-
a("div", Wn, [
|
|
2108
|
-
a("div", {
|
|
2109
|
-
class: je(["fm-status-badge", b(Ye)(((I = i.draft) == null ? void 0 : I.status) ?? "DRAFT")])
|
|
2110
|
-
}, Z(b(Ue)(((oe = i.draft) == null ? void 0 : oe.status) ?? "")), 3)
|
|
2111
|
-
])
|
|
2112
|
-
]),
|
|
2113
|
-
k(o),
|
|
2114
|
-
a("div", Zn, [
|
|
2115
|
-
(S(!0), M(ue, null, Te(We.value, (ce, he) => (S(), M("div", {
|
|
2116
|
-
class: "flex flex-col gap-4",
|
|
2117
|
-
key: he
|
|
2118
|
-
}, [
|
|
2119
|
-
a("div", Jn, [
|
|
2120
|
-
a("div", Xn, Z(ce.label), 1)
|
|
2121
|
-
]),
|
|
2122
|
-
a("div", ea, Z(ce.value), 1)
|
|
2123
|
-
]))), 128))
|
|
2124
|
-
])
|
|
2125
|
-
];
|
|
2126
|
-
}),
|
|
2127
|
-
_: 1
|
|
2128
|
-
}),
|
|
2129
|
-
a("div", ta, [
|
|
2130
|
-
a("div", na, [
|
|
2131
|
-
t[12] || (t[12] = a("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
|
|
2132
|
-
V.value ? se("", !0) : (S(), M("div", aa, [
|
|
2133
|
-
i.draft && i.draft.status !== b(_e).enum.COMPLETED ? (S(), pe(v, {
|
|
2134
|
-
key: 0,
|
|
2135
|
-
label: "Refresh balance",
|
|
2136
|
-
"prepend-icon": "refresh",
|
|
2137
|
-
variant: "secondary",
|
|
2138
|
-
"text-color": "primary",
|
|
2139
|
-
"bg-color": "transparent",
|
|
2140
|
-
"border-color": "primary",
|
|
2141
|
-
loading: U.value,
|
|
2142
|
-
onClick: g
|
|
2143
|
-
}, null, 8, ["loading"])) : se("", !0),
|
|
2144
|
-
k(kt, null, {
|
|
2145
|
-
default: Q(() => [
|
|
2146
|
-
k(v, {
|
|
2147
|
-
label: "Invalidate Draft Cache",
|
|
2148
|
-
"prepend-icon": "refresh",
|
|
2149
|
-
variant: "secondary",
|
|
2150
|
-
"text-color": "primary",
|
|
2151
|
-
"bg-color": "transparent",
|
|
2152
|
-
"border-color": "primary",
|
|
2153
|
-
loading: U.value,
|
|
2154
|
-
onClick: R
|
|
2155
|
-
}, null, 8, ["loading"])
|
|
2156
|
-
]),
|
|
2157
|
-
_: 1
|
|
2158
|
-
}),
|
|
2159
|
-
k(v, {
|
|
2160
|
-
label: "Export data",
|
|
2161
|
-
"prepend-icon": "download",
|
|
2162
|
-
variant: "secondary",
|
|
2163
|
-
"text-color": "primary",
|
|
2164
|
-
"bg-color": "transparent",
|
|
2165
|
-
"border-color": "primary",
|
|
2166
|
-
onClick: t[1] || (t[1] = (I) => i.draft ? b(l).exportDraft(
|
|
2167
|
-
i.draft,
|
|
2168
|
-
E.value,
|
|
2169
|
-
Y.value
|
|
2170
|
-
) : null)
|
|
2171
|
-
})
|
|
2172
|
-
]))
|
|
2173
|
-
]),
|
|
2174
|
-
V.value ? (S(), M("div", oa, [
|
|
2175
|
-
t[14] || (t[14] = a("div", { class: "h-80" }, null, -1)),
|
|
2176
|
-
a("div", sa, [
|
|
2177
|
-
a("div", null, [
|
|
2178
|
-
k(h, { size: "md" })
|
|
2179
|
-
]),
|
|
2180
|
-
t[13] || (t[13] = a("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
|
|
2181
|
-
]),
|
|
2182
|
-
t[15] || (t[15] = a("div", { class: "h-80" }, null, -1))
|
|
2183
|
-
])) : (S(), M(ue, { key: 1 }, [
|
|
2184
|
-
a("div", ra, [
|
|
2185
|
-
a("div", la, [
|
|
2186
|
-
k(j, {
|
|
2187
|
-
label: "Template Item(s)",
|
|
2188
|
-
selected: T.value.templateItem,
|
|
2189
|
-
onClick: t[2] || (t[2] = (I) => T.value.templateItem = !T.value.templateItem)
|
|
2190
|
-
}, null, 8, ["selected"]),
|
|
2191
|
-
k(j, {
|
|
2192
|
-
label: "Non-template Item(s)",
|
|
2193
|
-
selected: T.value.nonTemplateItem,
|
|
2194
|
-
onClick: t[3] || (t[3] = (I) => T.value.nonTemplateItem = !T.value.nonTemplateItem)
|
|
2195
|
-
}, null, 8, ["selected"])
|
|
2196
|
-
]),
|
|
2197
|
-
k(F, {
|
|
2198
|
-
modelValue: De.value,
|
|
2199
|
-
"onUpdate:modelValue": t[4] || (t[4] = (I) => De.value = I),
|
|
2200
|
-
placeholder: "Filter items"
|
|
2201
|
-
}, null, 8, ["modelValue"])
|
|
2202
|
-
]),
|
|
2203
|
-
b(n).skuTags.size ? (S(), M("div", ia, [
|
|
2204
|
-
(S(!0), M(ue, null, Te(b(n).skuTags.keys(), (I) => (S(), pe(j, {
|
|
2205
|
-
key: `${I}`,
|
|
2206
|
-
label: `${I}`,
|
|
2207
|
-
selectable: "",
|
|
2208
|
-
selected: f[`${I}`],
|
|
2209
|
-
onClick: (oe) => f[`${I}`] = !f[`${I}`]
|
|
2210
|
-
}, {
|
|
2211
|
-
default: Q(() => [
|
|
2212
|
-
f[`${I}`] ? (S(), pe(H, {
|
|
2213
|
-
key: 0,
|
|
2214
|
-
name: "check",
|
|
2215
|
-
class: "text-white",
|
|
2216
|
-
size: "sm"
|
|
2217
|
-
})) : se("", !0),
|
|
2218
|
-
a("span", {
|
|
2219
|
-
class: je([
|
|
2220
|
-
"",
|
|
2221
|
-
{
|
|
2222
|
-
"text-white fm-typo-en-body-md-600": f[`${I}`],
|
|
2223
|
-
"text-fm-color-typo-primary fm-typo-en-body-md-400": !f[`${I}`]
|
|
2224
|
-
}
|
|
2225
|
-
])
|
|
2226
|
-
}, Z(I), 3)
|
|
2227
|
-
]),
|
|
2228
|
-
_: 2
|
|
2229
|
-
}, 1032, ["label", "selected", "onClick"]))), 128))
|
|
2230
|
-
])) : se("", !0),
|
|
2231
|
-
a("div", ca, [
|
|
2232
|
-
a("div", {
|
|
2233
|
-
style: Dt({ height: "600px", minWidth: `${Me.value}px` })
|
|
2234
|
-
}, [
|
|
2235
|
-
k(O, {
|
|
2236
|
-
"column-defs": xe.value,
|
|
2237
|
-
"row-data": Ie.value,
|
|
2238
|
-
"search-value": De.value
|
|
2239
|
-
}, null, 8, ["column-defs", "row-data", "search-value"])
|
|
2240
|
-
], 4)
|
|
2241
|
-
])
|
|
2242
|
-
], 64))
|
|
2243
|
-
])
|
|
2244
|
-
], 64)) : se("", !0),
|
|
2245
|
-
Pe.value.value === "history" ? (S(), M("div", ua, [
|
|
2246
|
-
$e.value.length ? (S(), M("div", fa, [
|
|
2247
|
-
(S(!0), M(ue, null, Te($e.value, (I, oe) => (S(), M(ue, { key: oe }, [
|
|
2248
|
-
a("div", pa, [
|
|
2249
|
-
a("div", va, [
|
|
2250
|
-
a("div", ya, [
|
|
2251
|
-
a("div", {
|
|
2252
|
-
class: je([
|
|
2253
|
-
{
|
|
2254
|
-
"bg-fm-color-primary": oe !== 0,
|
|
2255
|
-
"bg-white": oe === 0
|
|
2256
|
-
},
|
|
2257
|
-
"w-[2px] h-full"
|
|
2258
|
-
])
|
|
2259
|
-
}, null, 2)
|
|
2260
|
-
]),
|
|
2261
|
-
t[18] || (t[18] = a("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
|
|
2262
|
-
a("div", ga, [
|
|
2263
|
-
a("div", {
|
|
2264
|
-
class: je([
|
|
2265
|
-
{
|
|
2266
|
-
"bg-fm-color-primary": oe < $e.value.length - 1,
|
|
2267
|
-
"bg-white": oe >= $e.value.length - 1
|
|
2268
|
-
},
|
|
2269
|
-
"w-[2px] h-full"
|
|
2270
|
-
])
|
|
2271
|
-
}, null, 2)
|
|
2272
|
-
])
|
|
2273
|
-
]),
|
|
2274
|
-
a("div", ba, [
|
|
2275
|
-
a("div", ha, Z(I.header), 1),
|
|
2276
|
-
a("div", ka, Z(I.date), 1)
|
|
2277
|
-
])
|
|
2278
|
-
]),
|
|
2279
|
-
a("div", _a, [
|
|
2280
|
-
a("div", xa, [
|
|
2281
|
-
a("div", Da, [
|
|
2282
|
-
a("div", {
|
|
2283
|
-
class: je([
|
|
2284
|
-
{
|
|
2285
|
-
"bg-fm-color-primary": oe < $e.value.length - 1,
|
|
2286
|
-
"bg-white": oe >= $e.value.length - 1
|
|
2287
|
-
},
|
|
2288
|
-
"w-[2px] h-full"
|
|
2289
|
-
])
|
|
2290
|
-
}, null, 2)
|
|
2291
|
-
])
|
|
2292
|
-
]),
|
|
2293
|
-
a("div", wa, [
|
|
2294
|
-
k(c, {
|
|
2295
|
-
variant: "outlined",
|
|
2296
|
-
class: "py-12 px-16"
|
|
2297
|
-
}, {
|
|
2298
|
-
default: Q(() => [
|
|
2299
|
-
a("div", Aa, [
|
|
2300
|
-
(S(!0), M(ue, null, Te(I.info, (ce, he) => (S(), M("div", {
|
|
2301
|
-
key: he,
|
|
2302
|
-
class: "flex flex-col gap-4"
|
|
2303
|
-
}, [
|
|
2304
|
-
a("div", Sa, Z(ce == null ? void 0 : ce.label), 1),
|
|
2305
|
-
a("div", Ca, [
|
|
2306
|
-
(S(!0), M(ue, null, Te(ce == null ? void 0 : ce.values, (Fe, Ee) => (S(), M("div", {
|
|
2307
|
-
key: Ee,
|
|
2308
|
-
class: "fm-typo-en-body-lg-600"
|
|
2309
|
-
}, Z(Fe), 1))), 128))
|
|
2310
|
-
])
|
|
2311
|
-
]))), 128))
|
|
2312
|
-
])
|
|
2313
|
-
]),
|
|
2314
|
-
_: 2
|
|
2315
|
-
}, 1024)
|
|
2316
|
-
])
|
|
2317
|
-
])
|
|
2318
|
-
], 64))), 128))
|
|
2319
|
-
])) : (S(), M("div", da, [
|
|
2320
|
-
k(fe),
|
|
2321
|
-
a("div", null, [
|
|
2322
|
-
a("img", {
|
|
2323
|
-
src: b(un),
|
|
2324
|
-
alt: "List is empty"
|
|
2325
|
-
}, null, 8, ma)
|
|
2326
|
-
]),
|
|
2327
|
-
t[16] || (t[16] = a("div", { class: "fm-typo-en-body-lg-600" }, Z("No records found"), -1)),
|
|
2328
|
-
t[17] || (t[17] = a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, Z("You can track approval and rejection history here"), -1)),
|
|
2329
|
-
k(fe),
|
|
2330
|
-
k(fe)
|
|
2331
|
-
]))
|
|
2332
|
-
])) : se("", !0)
|
|
2333
|
-
])
|
|
2334
|
-
]),
|
|
2335
|
-
_: 1
|
|
2336
|
-
}, 8, ["model-value"]),
|
|
2337
|
-
b(L) && e.draft ? (S(), pe(qn, {
|
|
2338
|
-
key: 0,
|
|
2339
|
-
show: Ne.value,
|
|
2340
|
-
"onUpdate:show": t[10] || (t[10] = (I) => Ne.value = I),
|
|
2341
|
-
refreshing: U.value,
|
|
2342
|
-
approving: Le.value,
|
|
2343
|
-
draft: e.draft,
|
|
2344
|
-
onRefresh: g,
|
|
2345
|
-
onApprove: Vt
|
|
2346
|
-
}, null, 8, ["show", "refreshing", "approving", "draft"])) : se("", !0)
|
|
2347
|
-
], 64);
|
|
2348
|
-
};
|
|
2349
|
-
}
|
|
2350
|
-
}), Ia = { class: "flex-1 flex flex-col gap-8" }, Pa = { class: "flex flex-col" }, Ua = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ra = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Va = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, Ma = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, co = /* @__PURE__ */ Ve({
|
|
2351
|
-
__name: "ClosingDraftView",
|
|
2352
|
-
setup(u) {
|
|
2353
|
-
const { t: s } = At(), { viewDraft: e } = qe(), { viewClosingDraftProps: d, viewClosingDraftShow: D } = Jt(qe()), _ = Ge(), l = Rt(), L = Yt(), { breakpoints: V } = Qt();
|
|
2354
|
-
_.watchLocation(l.fetchDrafts);
|
|
2355
|
-
const U = P(() => l.loading), A = G(""), E = P(() => V.value.xs || V.value.sm), Y = P(() => E.value ? 10 : 20);
|
|
2356
|
-
function z(r) {
|
|
2357
|
-
switch (r) {
|
|
2358
|
-
case "refresh":
|
|
2359
|
-
return l.fetchDrafts();
|
|
2360
|
-
}
|
|
2361
|
-
}
|
|
2362
|
-
function N(r) {
|
|
2363
|
-
return r;
|
|
2364
|
-
}
|
|
2365
|
-
const y = P(() => E.value ? [
|
|
2366
|
-
{
|
|
2367
|
-
label: s("inventory.common.refresh"),
|
|
2368
|
-
value: "refresh",
|
|
2369
|
-
isPrimary: !1
|
|
2370
|
-
}
|
|
2371
|
-
] : [
|
|
2372
|
-
{
|
|
2373
|
-
label: s("inventory.common.refresh"),
|
|
2374
|
-
value: "refresh",
|
|
2375
|
-
isPrimary: !1
|
|
2376
|
-
}
|
|
2377
|
-
]);
|
|
2378
|
-
return (r, n) => {
|
|
2379
|
-
const w = q("FmTable");
|
|
2380
|
-
return S(), M(ue, null, [
|
|
2381
|
-
k(Kt, {
|
|
2382
|
-
title: b(s)("inventory.closing.draft.title"),
|
|
2383
|
-
actions: y.value,
|
|
2384
|
-
"onClick:action": z
|
|
2385
|
-
}, {
|
|
2386
|
-
default: Q(() => [
|
|
2387
|
-
a("div", {
|
|
2388
|
-
class: je([
|
|
2389
|
-
"flex flex-col gap-8 max-h-full",
|
|
2390
|
-
{
|
|
2391
|
-
"p-0": E.value,
|
|
2392
|
-
"px-24 ": !E.value
|
|
2393
|
-
}
|
|
2394
|
-
])
|
|
2395
|
-
}, [
|
|
2396
|
-
k(cn, {
|
|
2397
|
-
"change-location": "",
|
|
2398
|
-
searchable: "",
|
|
2399
|
-
search: A.value,
|
|
2400
|
-
"onUpdate:search": n[0] || (n[0] = (f) => A.value = f)
|
|
2401
|
-
}, null, 8, ["search"]),
|
|
2402
|
-
k(w, {
|
|
2403
|
-
style: Dt(b(L).tableHeight),
|
|
2404
|
-
"column-defs": b(l).columnDefs,
|
|
2405
|
-
"row-data": b(l).drafts,
|
|
2406
|
-
"search-value": A.value,
|
|
2407
|
-
loading: U.value,
|
|
2408
|
-
onRowClick: n[1] || (n[1] = (f) => b(e)(f.original)),
|
|
2409
|
-
"page-size": Y.value
|
|
2410
|
-
}, {
|
|
2411
|
-
"list-row": Q((f) => [
|
|
2412
|
-
k(fn, {
|
|
2413
|
-
row: f,
|
|
2414
|
-
onRowClick: (m) => b(e)(m)
|
|
2415
|
-
}, {
|
|
2416
|
-
default: Q((m) => {
|
|
2417
|
-
var $, T, W, ae, ne, ie, me, B, C, g, R, X, ee, ve, Ae, re, xe, Me, De, Ie;
|
|
2418
|
-
return [
|
|
2419
|
-
a("div", Ia, [
|
|
2420
|
-
a("div", Pa, [
|
|
2421
|
-
a("div", Ua, [
|
|
2422
|
-
k(b(He), {
|
|
2423
|
-
render: (W = (T = ($ = m._id) == null ? void 0 : $.column) == null ? void 0 : T.columnDef) == null ? void 0 : W.cell,
|
|
2424
|
-
props: (ne = (ae = m._id) == null ? void 0 : ae.getContext) == null ? void 0 : ne.call(ae)
|
|
2425
|
-
}, null, 8, ["render", "props"])
|
|
2426
|
-
]),
|
|
2427
|
-
a("div", Ra, [
|
|
2428
|
-
k(b(He), {
|
|
2429
|
-
render: (B = (me = (ie = m.name) == null ? void 0 : ie.column) == null ? void 0 : me.columnDef) == null ? void 0 : B.cell,
|
|
2430
|
-
props: (g = (C = m.name) == null ? void 0 : C.getContext) == null ? void 0 : g.call(C)
|
|
2431
|
-
}, null, 8, ["render", "props"])
|
|
2432
|
-
]),
|
|
2433
|
-
a("div", Va, Z([
|
|
2434
|
-
...f.original.items.slice(0, 3).map((We) => We.sku.name),
|
|
2435
|
-
...f.original.items.length >= 3 ? [`and ${f.original.items.length - 3} more items`] : []
|
|
2436
|
-
].join(", ")), 1),
|
|
2437
|
-
a("div", Ma, [
|
|
2438
|
-
k(b(He), {
|
|
2439
|
-
render: (ee = (X = (R = m.ref) == null ? void 0 : R.column) == null ? void 0 : X.columnDef) == null ? void 0 : ee.cell,
|
|
2440
|
-
props: (Ae = (ve = m.ref) == null ? void 0 : ve.getContext) == null ? void 0 : Ae.call(ve)
|
|
2441
|
-
}, null, 8, ["render", "props"])
|
|
2442
|
-
])
|
|
2443
|
-
]),
|
|
2444
|
-
a("div", null, [
|
|
2445
|
-
k(b(He), {
|
|
2446
|
-
render: (Me = (xe = (re = m.status) == null ? void 0 : re.column) == null ? void 0 : xe.columnDef) == null ? void 0 : Me.cell,
|
|
2447
|
-
props: (Ie = (De = m.status) == null ? void 0 : De.getContext) == null ? void 0 : Ie.call(De)
|
|
2448
|
-
}, null, 8, ["render", "props"])
|
|
2449
|
-
])
|
|
2450
|
-
])
|
|
2451
|
-
];
|
|
2452
|
-
}),
|
|
2453
|
-
_: 2
|
|
2454
|
-
}, 1032, ["row", "onRowClick"])
|
|
2455
|
-
]),
|
|
2456
|
-
_: 1
|
|
2457
|
-
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
|
|
2458
|
-
], 2)
|
|
2459
|
-
]),
|
|
2460
|
-
_: 1
|
|
2461
|
-
}, 8, ["title", "actions"]),
|
|
2462
|
-
(S(), pe(Ht, { to: "body" }, [
|
|
2463
|
-
k(ja, Ot(b(d), {
|
|
2464
|
-
show: b(D),
|
|
2465
|
-
"onUpdate:show": n[2] || (n[2] = (f) => xt(D) ? D.value = f : null),
|
|
2466
|
-
onSubmitted: n[3] || (n[3] = () => (D.value = !1, b(l).fetchDrafts())),
|
|
2467
|
-
onRefresh: n[4] || (n[4] = (f) => b(l).updateDraftRef(f))
|
|
2468
|
-
}), null, 16, ["show"])
|
|
2469
|
-
]))
|
|
2470
|
-
], 64);
|
|
2471
|
-
};
|
|
2472
|
-
}
|
|
2473
|
-
});
|
|
2474
|
-
export {
|
|
2475
|
-
co as default
|
|
2476
|
-
};
|