@feedmepos/mf-inventory-portal 1.2.43 → 1.2.44-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-DVsAv4k3.js → App-BO6IVlu7.js} +3 -3
- package/dist/{ApprovalView-EHDiLsmL.js → ApprovalView-CVX6nsha.js} +5 -5
- package/dist/{BindingsDialog-DL2Dgzpf.js → BindingsDialog-CvoCVSNi.js} +8 -8
- package/dist/{BindingsPicker-BpdNqjSm.js → BindingsPicker-BgJRr_DM.js} +3 -3
- package/dist/{BindingsTable-C6KWR_kl.js → BindingsTable-CoXmqfkS.js} +3 -3
- package/dist/{ClosingDraftView-Byx8Zp15.js → ClosingDraftView-DJOHSc45.js} +615 -573
- package/dist/ClosingHistoryView-D_-BFRz0.js +447 -0
- package/dist/{ClosingTemplateView-DqfxzSBi.js → ClosingTemplateView-Bk3D5Snj.js} +14 -14
- package/dist/{DeliveryOrderPrintPreview-DvaTq4XO.js → DeliveryOrderPrintPreview-Cb64kpGv.js} +9 -9
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Dadg0d7W.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DFANhaaJ.js} +59 -60
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-yp0tPBLr.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DF_WpezC.js} +2 -2
- package/dist/{FmMultiselectDialog-M-tcECkK.js → FmMultiselectDialog-Cfc5qRdH.js} +2 -2
- package/dist/{FmMultiselectDialog-iXXJJ181.js → FmMultiselectDialog-DeHxbT6C.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-CzYmgtjx.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BrCLK3_O.js} +3 -3
- package/dist/{ImportView-BGbe571V.js → ImportView-CwTD-Oy5.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-SkZJQR4H.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DLq0PwYt.js} +1 -1
- package/dist/{IngredientGroupView-B5AhZqGE.js → IngredientGroupView-C9IrJkA2.js} +5 -5
- package/dist/{IngredientsView-BkORfSgQ.js → IngredientsView-cx05yMa1.js} +14 -14
- package/dist/{IntegrationView-DC1u6d1K.js → IntegrationView-DyhKmpP1.js} +12 -12
- package/dist/{InventoryBindingForm-D4ht1PMO.js → InventoryBindingForm-BiPyN399.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CFWTE_sj.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-B4hiEtLq.js} +14 -14
- package/dist/{InventoryBindingSummary-DKYKoLOt.js → InventoryBindingSummary-CLipXxCy.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-D1hfyifk.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-dpwW1B9T.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BfsTUKPQ.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CFi82_2z.js} +2 -2
- package/dist/{PublishView-CMTQJ7Nv.js → PublishView-xqkAIXWI.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-CzYlYowQ.js → PurchaseOrderPrintPreview-DQgycOZX.js} +9 -9
- package/dist/ReceiveRequestView-Bteeg8L4.js +2894 -0
- package/dist/{RecipeView-CIwSZuEd.js → RecipeView-Wr4d3B_9.js} +8 -8
- package/dist/{StockView-DBY2sHlj.js → StockView-CkKpgWUl.js} +344 -341
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-VY2KygFc.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DSGGTbPw.js} +1 -1
- package/dist/{SupplierView-CGsqiXR4.js → SupplierView-BK-t2Qtu.js} +11 -11
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-BUs4-nO6.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-D7L13xxB.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-plLh-5S3.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DWMif1dO.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-C8DluFT4.js → TransferDetails.vue_vue_type_script_setup_true_lang-0tyNbKG0.js} +306 -306
- package/dist/{TransferTemplateView-BEXsC7mp.js → TransferTemplateView-qIlYcciH.js} +354 -354
- package/dist/{UnitView-BGRkT8Hr.js → UnitView-B5boUZuR.js} +6 -6
- package/dist/{WarehouseView-D7og7WBg.js → WarehouseView-C3PXZgeW.js} +5 -5
- package/dist/WastageTemplateView-BfJZ5Heq.js +2327 -0
- package/dist/api/stock.d.ts +2 -0
- package/dist/{app-CioeggUO.js → app-IXE7AiJd.js} +2344 -2296
- package/dist/app.js +7 -7
- package/dist/{closing-template-DrBlhTbC.js → closing-template-Bdb3yRUm.js} +1 -1
- package/dist/{date2-mucf0HV-.js → date2-FhBpgAsI.js} +1 -1
- package/dist/{dayjs.min-C5lVIjQ1.js → dayjs.min-DzvYG-ky.js} +21 -21
- package/dist/{decimal-EYAs7CPT.js → decimal-Io-Hwy_Y.js} +2 -2
- package/dist/{defineDeepModel-BQ_3cF8o.js → defineDeepModel-D8sQDXuo.js} +1 -1
- package/dist/{duplicate-template-K_oezMr4.js → duplicate-template-DnygqbZo.js} +1 -1
- package/dist/feature-C4FdNiJm.js +25697 -0
- package/dist/{format-time-from-id-qnJY4xQY.js → format-time-from-id-oJMEPmai.js} +1 -1
- package/dist/{format-unit-display-6I_PHQ9C.js → format-unit-display-CyyP1TnC.js} +245 -246
- package/dist/helper/form.d.ts +1 -0
- package/dist/helper/object.d.ts +21 -0
- package/dist/helper/reactivity.d.ts +11 -0
- package/dist/helper/reactivity.spec.d.ts +1 -0
- package/dist/{import-export.helper-vmA8rXwv.js → import-export.helper-C33N1h7C.js} +5 -5
- package/dist/{index-DXJ9MIiE.js → index-DYfJ9nqH.js} +9 -9
- package/dist/{index-5yza2WJR.js → index-DdtrR7II.js} +1 -1
- package/dist/{index-DqMYKP87.js → index-qDt3kqgv.js} +3 -3
- package/dist/{lodash-D6iOSfR7.js → lodash-DRz5U0Za.js} +1 -1
- package/dist/{netsuite-DKE_ORM0.js → netsuite-CIv-Yh60.js} +70 -70
- package/dist/{purchase-order-template-Brpbfw8K.js → purchase-order-template-CX62LUzz.js} +1 -1
- package/dist/{rules-fd3m4inF.js → rules-DmJTahUJ.js} +3 -3
- package/dist/{stock-CLX4SKxt.js → stock-BAtpqZgN.js} +3 -3
- package/dist/{stock-8-vRigjE.js → stock-dMNUMGOC.js} +35 -27
- package/dist/{supplier-Dlv1Clk5.js → supplier-B2g3AW72.js} +2 -2
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-2j3Nbou_.js → use-ingredient-select-dialog-ZyFtPCb9.js} +2 -2
- package/dist/{use-inventory-binding-dialog-_S2XGoVU.js → use-inventory-binding-dialog-CRgPd2qi.js} +2 -2
- package/dist/{use-template-enabled-locations-2-CWlQQnyD.js → use-template-enabled-locations-2-S598U0zh.js} +2 -2
- package/dist/views/adjustment-template/wastage-template/form/useAdjustmentTemplateItems.d.ts +7 -0
- package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +4 -1
- package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupForm.vue.d.ts +1 -0
- package/dist/views/receive-request/components/netsuite/NetSuitePanel.vue.d.ts +3 -2
- package/dist/views/receive-request/components/netsuite/NetSuiteProps.d.ts +3 -2
- package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +6 -0
- package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +628 -0
- package/dist/views/receive-request/components/transfer-form/composables/use-purchase-order-form-controller.d.ts +22 -0
- package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +3 -2
- package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +1 -1
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +6 -6
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +7 -7
- package/dist/views/receive-request/constants/purchase-order-transaction-type.d.ts +2 -2
- package/dist/views/receive-request/helper/get-transfer-type.d.ts +1 -2
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +3 -2
- package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItemProps.d.ts +3 -2
- package/dist/views/transfer-template/helpers/import-export.helper.d.ts +4 -3
- package/dist/{vue-i18n-CCrvzsiW.js → vue-i18n-CoLcy8bm.js} +286 -286
- package/dist/{xlsx-oL4emcgf.js → xlsx-CtFn9Ikt.js} +398 -398
- package/dist/{xlsx.util-JOeDOZ3P.js → xlsx.util-C5Ug4P4c.js} +1 -1
- package/package.json +3 -3
- package/dist/ClosingHistoryView-BpFFNCqD.js +0 -391
- package/dist/ReceiveRequestView-CMHZZ9ul.js +0 -2841
- package/dist/WastageTemplateView-CwEUAwCw.js +0 -2287
- package/dist/feature-BkR98vGd.js +0 -20161
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +0 -3159
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { F as
|
|
3
|
-
import { useCoreStore as
|
|
4
|
-
import { useSnackbar as
|
|
5
|
-
import { o as
|
|
6
|
-
import { defineStore as kt, storeToRefs as
|
|
7
|
-
import { d as
|
|
8
|
-
import { R as
|
|
9
|
-
import { b as
|
|
10
|
-
import { u as
|
|
11
|
-
import { u as
|
|
12
|
-
import { D as
|
|
13
|
-
import { c as
|
|
14
|
-
import { f as
|
|
15
|
-
import { _ as
|
|
16
|
-
import { E as
|
|
17
|
-
const
|
|
1
|
+
import { defineComponent as He, ref as Y, computed as L, onMounted as Ze, resolveComponent as z, openBlock as F, createElementBlock as E, Fragment as le, createTextVNode as oe, createBlock as ie, withCtx as Q, createElementVNode as c, toDisplayString as ae, unref as $, createVNode as D, createCommentVNode as ne, h as A, reactive as It, watch as Ut, isRef as vt, normalizeClass as Fe, renderList as Te, normalizeStyle as gt, Teleport as Pt, mergeProps as Rt } from "vue";
|
|
2
|
+
import { F as Ge, u as Mt, _ as Vt } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
|
|
3
|
+
import { useCoreStore as yt, useI18n as bt } from "@feedmepos/mf-common";
|
|
4
|
+
import { useSnackbar as Je, useDialog as Lt, useProxiedModel as Nt, components as ge, useBreakpoints as Et } from "@feedmepos/ui-library";
|
|
5
|
+
import { o as zt, u as Oe, H as O, s as V, I as ht, J as ve, A as Ve, v as Le, c as Ht, a as Ot } from "./app-IXE7AiJd.js";
|
|
6
|
+
import { defineStore as kt, storeToRefs as Yt } from "pinia";
|
|
7
|
+
import { d as Ee, e as Dt, f as Kt, a as ye } from "./date2-FhBpgAsI.js";
|
|
8
|
+
import { R as Qt, f as Xe, a as We, t as qt, d as je, o as xt, p as At, m as _t, l as Gt } from "./rules-DmJTahUJ.js";
|
|
9
|
+
import { b as Wt, d as Zt } from "./xlsx.util-C5Ug4P4c.js";
|
|
10
|
+
import { u as wt } from "./stock-BAtpqZgN.js";
|
|
11
|
+
import { u as et } from "./stock-dMNUMGOC.js";
|
|
12
|
+
import { D as pt, R as Se } from "./row-action.enum-BcW_L_nE.js";
|
|
13
|
+
import { c as Jt, _ as Xt, F as Me } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-cfFHDIwQ.js";
|
|
14
|
+
import { f as ea } from "./format-time-from-id-oJMEPmai.js";
|
|
15
|
+
import { _ as ta } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DF_WpezC.js";
|
|
16
|
+
import { E as aa } from "./empty-placeholder-wf6-BWE8.js";
|
|
17
|
+
const Ye = zt((r, s) => {
|
|
18
18
|
function e() {
|
|
19
|
-
return
|
|
19
|
+
return Oe().currentLocation.dbName;
|
|
20
20
|
}
|
|
21
21
|
return {
|
|
22
|
-
async getDraft(
|
|
23
|
-
const
|
|
24
|
-
return s.get(
|
|
22
|
+
async getDraft(d) {
|
|
23
|
+
const h = e(), y = `${r.inventoryBackendUrl}/${h}/closing-draft/${d}`;
|
|
24
|
+
return s.get(y);
|
|
25
25
|
},
|
|
26
26
|
async readDrafts() {
|
|
27
|
-
const
|
|
28
|
-
return s.get(
|
|
27
|
+
const d = e(), h = `${r.inventoryBackendUrl}/${d}/closing-draft`;
|
|
28
|
+
return s.get(h);
|
|
29
29
|
},
|
|
30
|
-
async runOperation(
|
|
31
|
-
const
|
|
32
|
-
return s.post(
|
|
30
|
+
async runOperation(d) {
|
|
31
|
+
const h = e(), y = `${r.inventoryBackendUrl}/${h}/closing-draft/run-operation`;
|
|
32
|
+
return s.post(y, d);
|
|
33
33
|
},
|
|
34
|
-
async runOperationV1(
|
|
35
|
-
const
|
|
36
|
-
return s.post(
|
|
34
|
+
async runOperationV1(d) {
|
|
35
|
+
const h = e(), y = `${r.inventoryBackendUrl}/${h}/closing-draft/v1/run-operation`;
|
|
36
|
+
return s.post(y, d);
|
|
37
37
|
},
|
|
38
|
-
async sync(
|
|
39
|
-
const
|
|
40
|
-
return s.post(
|
|
38
|
+
async sync(d) {
|
|
39
|
+
const h = e(), y = `${r.inventoryBackendUrl}/${h}/closing-draft/sync`;
|
|
40
|
+
return s.post(y, d);
|
|
41
41
|
},
|
|
42
|
-
async cloneDraft(
|
|
43
|
-
const
|
|
44
|
-
return s.post(
|
|
42
|
+
async cloneDraft(d) {
|
|
43
|
+
const h = e(), y = `${r.inventoryBackendUrl}/${h}/closing-draft/${d}/clone`;
|
|
44
|
+
return s.post(y, {});
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
|
-
}),
|
|
47
|
+
}), na = { class: "fm-typo-en-body-lg-400" }, oa = { class: "fm-typo-en-body-lg-600" }, sa = {
|
|
48
48
|
key: 0,
|
|
49
49
|
class: "flex flex-col"
|
|
50
|
-
},
|
|
50
|
+
}, ra = {
|
|
51
51
|
key: 0,
|
|
52
52
|
class: "fm-typo-en-body-sm-400 text-fm-color-typo-error mt-4"
|
|
53
|
-
},
|
|
53
|
+
}, la = { class: "flex gap-12 py-8 justify-end w-full" }, qe = /* @__PURE__ */ He({
|
|
54
54
|
__name: "ClosingDraftAction",
|
|
55
55
|
props: {
|
|
56
56
|
draft: {},
|
|
@@ -59,7 +59,7 @@ const He = Et((r, s) => {
|
|
|
59
59
|
onFinished: { type: Function }
|
|
60
60
|
},
|
|
61
61
|
setup(r) {
|
|
62
|
-
const s = r, e = Y(),
|
|
62
|
+
const s = r, e = Y(), d = Ye(), h = Je(), y = Y(!1), b = Y(null), I = Y(!1), M = L(() => {
|
|
63
63
|
switch (s.action) {
|
|
64
64
|
case O.enum.approveDraft:
|
|
65
65
|
return "Approve";
|
|
@@ -80,141 +80,141 @@ const He = Et((r, s) => {
|
|
|
80
80
|
}
|
|
81
81
|
throw new Error(`Unknown action: ${s.action}`);
|
|
82
82
|
});
|
|
83
|
-
|
|
83
|
+
Ze(() => {
|
|
84
84
|
if (s.draft.effectiveAt)
|
|
85
|
-
|
|
85
|
+
b.value = new Date(s.draft.effectiveAt);
|
|
86
86
|
else {
|
|
87
87
|
const u = new Date(s.draft.createdAt);
|
|
88
|
-
u.setHours(23, 59, 59, 999),
|
|
88
|
+
u.setHours(23, 59, 59, 999), b.value = u;
|
|
89
89
|
}
|
|
90
90
|
I.value = !0;
|
|
91
91
|
});
|
|
92
|
-
const
|
|
92
|
+
const k = L({
|
|
93
93
|
get() {
|
|
94
|
-
return
|
|
94
|
+
return b.value === null ? "" : Ee(b.value);
|
|
95
95
|
},
|
|
96
96
|
set(u) {
|
|
97
97
|
if (u) {
|
|
98
98
|
const t = /* @__PURE__ */ new Date(`${u} ${P.value}`);
|
|
99
|
-
t.setSeconds(59, 999),
|
|
99
|
+
t.setSeconds(59, 999), b.value = t;
|
|
100
100
|
} else
|
|
101
|
-
|
|
101
|
+
b.value = null;
|
|
102
102
|
}
|
|
103
103
|
}), P = L({
|
|
104
104
|
get() {
|
|
105
|
-
return
|
|
105
|
+
return b.value === null ? "" : Dt(b.value);
|
|
106
106
|
},
|
|
107
107
|
set(u) {
|
|
108
108
|
if (u) {
|
|
109
|
-
const t = /* @__PURE__ */ new Date(`${
|
|
110
|
-
t.setSeconds(59, 999),
|
|
109
|
+
const t = /* @__PURE__ */ new Date(`${k.value} ${u}`);
|
|
110
|
+
t.setSeconds(59, 999), b.value = t;
|
|
111
111
|
} else
|
|
112
|
-
|
|
112
|
+
b.value = null;
|
|
113
113
|
}
|
|
114
|
-
}), B = L(() =>
|
|
115
|
-
async function
|
|
116
|
-
|
|
114
|
+
}), B = L(() => b.value ? b.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
|
|
115
|
+
async function q(u) {
|
|
116
|
+
y.value = !0;
|
|
117
117
|
try {
|
|
118
|
-
u ? await
|
|
118
|
+
u ? await d.runOperationV1({
|
|
119
119
|
_id: s.draft._id,
|
|
120
120
|
_rev: s.draft._rev ?? "",
|
|
121
121
|
action: s.action,
|
|
122
122
|
data: {
|
|
123
|
-
effectiveAt:
|
|
123
|
+
effectiveAt: b.value ? b.value.toISOString() : null,
|
|
124
124
|
remark: e.value
|
|
125
125
|
}
|
|
126
|
-
}).delayed(500) : await
|
|
126
|
+
}).delayed(500) : await d.runOperation({
|
|
127
127
|
_id: s.draft._id,
|
|
128
128
|
_rev: s.draft._rev ?? "",
|
|
129
129
|
action: s.action,
|
|
130
130
|
data: {
|
|
131
|
-
effectiveAt:
|
|
131
|
+
effectiveAt: b.value ? b.value.toISOString() : null,
|
|
132
132
|
remark: e.value
|
|
133
133
|
}
|
|
134
|
-
}).delayed(500),
|
|
134
|
+
}).delayed(500), h.open({
|
|
135
135
|
title: "Success",
|
|
136
136
|
message: "Action submitted",
|
|
137
137
|
type: "success"
|
|
138
138
|
}), s.onFinished();
|
|
139
139
|
} catch (t) {
|
|
140
|
-
|
|
140
|
+
h.open({
|
|
141
141
|
title: "Something went wrong",
|
|
142
142
|
message: (t == null ? void 0 : t.message) ?? "Unable to submit action. Please try again",
|
|
143
143
|
type: "error"
|
|
144
144
|
}), console.error("error on submit closing draft action", t);
|
|
145
145
|
} finally {
|
|
146
|
-
|
|
146
|
+
y.value = !1;
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
return (u, t) => {
|
|
150
|
-
const _ = z("FmLabel"), R = z("FmDatePicker"),
|
|
151
|
-
return I.value ? (F(), ie(
|
|
150
|
+
const _ = z("FmLabel"), R = z("FmDatePicker"), N = z("FmTimePicker"), g = z("FmTextField"), m = z("FmButton"), S = z("FmForm");
|
|
151
|
+
return I.value ? (F(), ie(S, {
|
|
152
152
|
key: 1,
|
|
153
|
-
onValidationSuccess:
|
|
153
|
+
onValidationSuccess: q,
|
|
154
154
|
class: "flex flex-col gap-32",
|
|
155
|
-
disabled:
|
|
155
|
+
disabled: y.value
|
|
156
156
|
}, {
|
|
157
157
|
default: Q(() => [
|
|
158
|
-
c("div",
|
|
158
|
+
c("div", na, [
|
|
159
159
|
t[5] || (t[5] = oe(" You are about to ")),
|
|
160
|
-
c("span",
|
|
160
|
+
c("span", oa, ae(M.value), 1),
|
|
161
161
|
t[6] || (t[6] = oe(" this draft. Please provide a remark to justify this action. "))
|
|
162
162
|
]),
|
|
163
|
-
u.action === $(O).enum.approveDraft ? (F(), E("div",
|
|
164
|
-
|
|
163
|
+
u.action === $(O).enum.approveDraft ? (F(), E("div", sa, [
|
|
164
|
+
D(_, { class: "fm-typo-en-body-lg-600" }, {
|
|
165
165
|
default: Q(() => t[7] || (t[7] = [
|
|
166
166
|
oe("Closing Date")
|
|
167
167
|
])),
|
|
168
168
|
_: 1
|
|
169
169
|
}),
|
|
170
|
-
|
|
171
|
-
modelValue:
|
|
172
|
-
"onUpdate:modelValue": t[0] || (t[0] = (H) =>
|
|
173
|
-
max: $(
|
|
170
|
+
D(R, {
|
|
171
|
+
modelValue: k.value,
|
|
172
|
+
"onUpdate:modelValue": t[0] || (t[0] = (H) => k.value = H),
|
|
173
|
+
max: $(Ee)(/* @__PURE__ */ new Date())
|
|
174
174
|
}, null, 8, ["modelValue", "max"]),
|
|
175
|
-
|
|
175
|
+
D(_, { class: "fm-typo-en-body-lg-600" }, {
|
|
176
176
|
default: Q(() => t[8] || (t[8] = [
|
|
177
177
|
oe("Closing Time")
|
|
178
178
|
])),
|
|
179
179
|
_: 1
|
|
180
180
|
}),
|
|
181
|
-
|
|
181
|
+
D(N, {
|
|
182
182
|
modelValue: P.value,
|
|
183
183
|
"onUpdate:modelValue": t[1] || (t[1] = (H) => P.value = H)
|
|
184
184
|
}, null, 8, ["modelValue"]),
|
|
185
|
-
B.value ? (F(), E("div",
|
|
185
|
+
B.value ? (F(), E("div", ra, " Cannot select future date ")) : ne("", !0)
|
|
186
186
|
])) : ne("", !0),
|
|
187
|
-
|
|
187
|
+
D(g, {
|
|
188
188
|
modelValue: e.value,
|
|
189
189
|
"onUpdate:modelValue": t[2] || (t[2] = (H) => e.value = H),
|
|
190
190
|
label: "Remark",
|
|
191
191
|
"label-mark": "required",
|
|
192
|
-
rules: [$(
|
|
192
|
+
rules: [$(Qt)()]
|
|
193
193
|
}, null, 8, ["modelValue", "rules"]),
|
|
194
|
-
c("div",
|
|
195
|
-
|
|
194
|
+
c("div", la, [
|
|
195
|
+
D(m, {
|
|
196
196
|
label: "Cancel",
|
|
197
197
|
variant: "tertiary",
|
|
198
198
|
onClick: t[3] || (t[3] = (H) => u.onCancel())
|
|
199
199
|
}),
|
|
200
|
-
u.action === $(O).enum.approveDraft ? (F(), ie(
|
|
200
|
+
u.action === $(O).enum.approveDraft ? (F(), ie(Ge, { key: 0 }, {
|
|
201
201
|
default: Q(() => [
|
|
202
|
-
|
|
202
|
+
D(m, {
|
|
203
203
|
label: "Approve (Legacy)",
|
|
204
204
|
type: "button",
|
|
205
|
-
onClick: t[4] || (t[4] = (H) =>
|
|
205
|
+
onClick: t[4] || (t[4] = (H) => q(!0)),
|
|
206
206
|
variant: U.value,
|
|
207
|
-
loading:
|
|
207
|
+
loading: y.value,
|
|
208
208
|
disabled: B.value
|
|
209
209
|
}, null, 8, ["variant", "loading", "disabled"])
|
|
210
210
|
]),
|
|
211
211
|
_: 1
|
|
212
212
|
})) : ne("", !0),
|
|
213
|
-
|
|
214
|
-
label:
|
|
213
|
+
D(m, {
|
|
214
|
+
label: M.value,
|
|
215
215
|
type: "submit",
|
|
216
216
|
variant: U.value,
|
|
217
|
-
loading:
|
|
217
|
+
loading: y.value
|
|
218
218
|
}, null, 8, ["label", "variant", "loading"])
|
|
219
219
|
])
|
|
220
220
|
]),
|
|
@@ -224,27 +224,27 @@ const He = Et((r, s) => {
|
|
|
224
224
|
], 64));
|
|
225
225
|
};
|
|
226
226
|
}
|
|
227
|
-
}),
|
|
228
|
-
function
|
|
229
|
-
const s = r.measurementsAmounts.groupBy((
|
|
230
|
-
var I,
|
|
231
|
-
const
|
|
232
|
-
return
|
|
233
|
-
}, +
|
|
234
|
-
return
|
|
227
|
+
}), ia = je(0);
|
|
228
|
+
function St(r) {
|
|
229
|
+
const s = r.measurementsAmounts.groupBy((d) => d.measurement.id), e = r.sku.unit.measurements.reduce((d, h) => {
|
|
230
|
+
var I, M;
|
|
231
|
+
const y = ((M = (I = s.get(h.id)) == null ? void 0 : I[0]) == null ? void 0 : M.amount) ?? ia, b = Xe(h.conversion, y);
|
|
232
|
+
return d + +We(b);
|
|
233
|
+
}, +We(r.baseAmount));
|
|
234
|
+
return qt(e, r.baseAmount.precision);
|
|
235
235
|
}
|
|
236
|
-
const
|
|
237
|
-
function
|
|
238
|
-
var
|
|
239
|
-
const
|
|
236
|
+
const ca = je(0), ua = je(100), Ft = "N/A";
|
|
237
|
+
function ma(r, s, e, d, h, y) {
|
|
238
|
+
var K, J, w, X, me;
|
|
239
|
+
const b = St(r), I = d ?? b, M = xt(I, s), U = s.amount === 0 ? null : At(M, {
|
|
240
240
|
...s,
|
|
241
241
|
amount: Math.abs(s.amount)
|
|
242
|
-
}),
|
|
242
|
+
}), k = U ? Xe(U, ua) : null, P = ((K = r.sku.defaultCost) == null ? void 0 : K.costPerUnit) ?? { amount: 0, precision: 0 }, B = Number(V.toFormatString({ value: P })), q = ((w = (J = r.sku.defaultCost) == null ? void 0 : J.measurement) == null ? void 0 : w.conversion) ?? {
|
|
243
243
|
amount: 1,
|
|
244
244
|
precision: 0
|
|
245
245
|
}, u = Number(
|
|
246
|
-
V.toFormatString({ value:
|
|
247
|
-
), t =
|
|
246
|
+
V.toFormatString({ value: q })
|
|
247
|
+
), t = h ? Number(V.toFormatString({ value: h })) : 0, _ = Number(V.toFormatString({ value: s })), R = Number(V.toFormatString({ value: I })), N = _ - R, g = N * B / u, m = R * B / u, S = _ * B / u;
|
|
248
248
|
return {
|
|
249
249
|
code: r.sku.code,
|
|
250
250
|
name: r.sku.name,
|
|
@@ -252,49 +252,49 @@ function ua(r, s, e, m, b, g) {
|
|
|
252
252
|
costUnit: ((me = (X = r.sku.defaultCost) == null ? void 0 : X.measurement) == null ? void 0 : me.abbrev) ?? null,
|
|
253
253
|
baseUnitAmount: Number(V.toFormatString({ value: r.baseAmount })),
|
|
254
254
|
...r.measurementsAmounts.filter(
|
|
255
|
-
(
|
|
255
|
+
(te) => da(te.measurement) && e.includes(te.measurement.id)
|
|
256
256
|
).reduce(
|
|
257
|
-
(
|
|
257
|
+
(te, se, de) => (te[`measurementAbbrev${de}`] = `(${se.measurement.abbrev}) × ${V.toFormatString({ value: se.measurement.conversion })}`, te[`measurementAmount${de}`] = Number(V.toFormatString({ value: se.amount })), te),
|
|
258
258
|
{}
|
|
259
259
|
),
|
|
260
260
|
systemBalance: _,
|
|
261
261
|
physicalBalance: R,
|
|
262
|
-
adjustedAmount: Number(V.toFormatString({ value:
|
|
263
|
-
adjustedDiffPercentage:
|
|
262
|
+
adjustedAmount: Number(V.toFormatString({ value: M })),
|
|
263
|
+
adjustedDiffPercentage: k ? Number(
|
|
264
264
|
V.toFormatString({
|
|
265
|
-
value:
|
|
265
|
+
value: _t(k, 2)
|
|
266
266
|
})
|
|
267
267
|
) : null,
|
|
268
268
|
costPerUnit: B,
|
|
269
269
|
opening: t,
|
|
270
|
-
adjustmentTypes:
|
|
271
|
-
varianceQty:
|
|
272
|
-
varianceInCost:
|
|
273
|
-
stockTakeValue:
|
|
274
|
-
systemValue:
|
|
270
|
+
adjustmentTypes: y ?? Ft,
|
|
271
|
+
varianceQty: N,
|
|
272
|
+
varianceInCost: g,
|
|
273
|
+
stockTakeValue: m,
|
|
274
|
+
systemValue: S
|
|
275
275
|
};
|
|
276
276
|
}
|
|
277
|
-
function
|
|
277
|
+
function da(r) {
|
|
278
278
|
return !r.abbrev.toLocaleLowerCase().includes("inactive");
|
|
279
279
|
}
|
|
280
|
-
function
|
|
281
|
-
const s =
|
|
280
|
+
function fa(r) {
|
|
281
|
+
const s = Ct(r);
|
|
282
282
|
return r.reduce(
|
|
283
|
-
(e,
|
|
284
|
-
var
|
|
285
|
-
return Math.max(e, ((
|
|
283
|
+
(e, d) => {
|
|
284
|
+
var h;
|
|
285
|
+
return Math.max(e, ((h = s == null ? void 0 : s.get(d.sku._id)) == null ? void 0 : h[0].length) ?? 0);
|
|
286
286
|
},
|
|
287
287
|
0
|
|
288
288
|
);
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function Ct(r) {
|
|
291
291
|
return r.groupBy(
|
|
292
292
|
(s) => s.sku._id,
|
|
293
293
|
(s) => s.measurementsAmounts.filter((e) => !e.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((e) => e.measurement.id)
|
|
294
294
|
);
|
|
295
295
|
}
|
|
296
|
-
function
|
|
297
|
-
const s =
|
|
296
|
+
function pa(r) {
|
|
297
|
+
const s = ht(), e = s === "MYR" ? "RM" : s;
|
|
298
298
|
return [
|
|
299
299
|
{
|
|
300
300
|
id: "code",
|
|
@@ -360,78 +360,78 @@ function fa(r) {
|
|
|
360
360
|
id: "baseUnitAmount",
|
|
361
361
|
name: "Base unit amount"
|
|
362
362
|
},
|
|
363
|
-
...Array.from({ length: r }).flatMap((
|
|
363
|
+
...Array.from({ length: r }).flatMap((h, y) => [
|
|
364
364
|
{
|
|
365
|
-
id: `measurementAmount${
|
|
366
|
-
name: `UOM amount ${
|
|
365
|
+
id: `measurementAmount${y}`,
|
|
366
|
+
name: `UOM amount ${y + 1}`
|
|
367
367
|
},
|
|
368
368
|
{
|
|
369
|
-
id: `measurementAbbrev${
|
|
370
|
-
name: `UOM ${
|
|
369
|
+
id: `measurementAbbrev${y}`,
|
|
370
|
+
name: `UOM ${y + 1}`
|
|
371
371
|
}
|
|
372
372
|
])
|
|
373
373
|
];
|
|
374
374
|
}
|
|
375
|
-
function
|
|
376
|
-
var
|
|
377
|
-
const
|
|
378
|
-
(
|
|
379
|
-
(
|
|
380
|
-
),
|
|
381
|
-
(
|
|
382
|
-
(
|
|
383
|
-
),
|
|
375
|
+
function va(r, s, e) {
|
|
376
|
+
var N, g, m, S, H, K, J;
|
|
377
|
+
const d = s.groupBy(
|
|
378
|
+
(w) => w.id,
|
|
379
|
+
(w) => w.balance
|
|
380
|
+
), h = e.groupBy(
|
|
381
|
+
(w) => w.id,
|
|
382
|
+
(w) => w.balance
|
|
383
|
+
), y = /* @__PURE__ */ new Map();
|
|
384
384
|
if (r.opening)
|
|
385
|
-
for (const
|
|
386
|
-
|
|
387
|
-
const
|
|
385
|
+
for (const w of r.opening)
|
|
386
|
+
y.set(w.skuId, w.balance);
|
|
387
|
+
const b = /* @__PURE__ */ new Map();
|
|
388
388
|
if (r.adjustmentSnapshot)
|
|
389
|
-
for (const
|
|
390
|
-
const X = Object.keys(
|
|
391
|
-
|
|
389
|
+
for (const w of r.adjustmentSnapshot) {
|
|
390
|
+
const X = Object.keys(w.adjustmentsByType).join(", ");
|
|
391
|
+
b.set(w.skuId, X || Ft);
|
|
392
392
|
}
|
|
393
|
-
const I = [...r.items, ...r.negativeStockItems ?? []],
|
|
394
|
-
var de,
|
|
395
|
-
const X = ((de =
|
|
396
|
-
return
|
|
397
|
-
|
|
393
|
+
const I = [...r.items, ...r.negativeStockItems ?? []], M = Ct(I), U = I.map((w) => {
|
|
394
|
+
var de, be, he;
|
|
395
|
+
const X = ((de = d.get(w.sku._id)) == null ? void 0 : de[0]) ?? ca, me = ((be = M == null ? void 0 : M.get(w.sku._id)) == null ? void 0 : be[0]) ?? [], te = y.get(w.sku._id), se = b.get(w.sku._id);
|
|
396
|
+
return ma(
|
|
397
|
+
w,
|
|
398
398
|
X,
|
|
399
399
|
me,
|
|
400
|
-
(
|
|
401
|
-
|
|
400
|
+
(he = h.get(w.sku._id)) == null ? void 0 : he[0],
|
|
401
|
+
te,
|
|
402
402
|
se
|
|
403
403
|
);
|
|
404
|
-
}),
|
|
404
|
+
}), k = fa(I), B = yt().currentBusiness.value, q = pa(k), u = [
|
|
405
405
|
["Business name:", B == null ? void 0 : B.name],
|
|
406
406
|
["Business ID:", B == null ? void 0 : B._id],
|
|
407
407
|
["Menu version", B == null ? void 0 : B.menuVersion],
|
|
408
408
|
["Created at", new Date(r.createdAt)],
|
|
409
|
-
["Created by", (
|
|
409
|
+
["Created by", (N = r.createdBy) == null ? void 0 : N.name],
|
|
410
410
|
["Updated at", new Date(r.updatedAt)],
|
|
411
|
-
["Updated by", (
|
|
411
|
+
["Updated by", (g = r.updatedBy) == null ? void 0 : g.name],
|
|
412
412
|
["Recent action", r.approvedAt ? "Approve" : r.rejectionHistory ? "Reject" : ""],
|
|
413
413
|
[
|
|
414
414
|
"Action by",
|
|
415
|
-
r.approvedAt ? (
|
|
415
|
+
r.approvedAt ? (m = r.approvedBy) == null ? void 0 : m.name : r.rejectionHistory ? (H = (S = r.rejectionHistory[0]) == null ? void 0 : S.rejectedBy) == null ? void 0 : H.name : ""
|
|
416
416
|
],
|
|
417
417
|
[
|
|
418
418
|
"Action at",
|
|
419
|
-
r.approvedAt ? new Date(r.approvedAt) : r.rejectionHistory ? new Date((
|
|
419
|
+
r.approvedAt ? new Date(r.approvedAt) : r.rejectionHistory ? new Date((K = r.rejectionHistory[0]) == null ? void 0 : K.rejectedAt) : ""
|
|
420
420
|
],
|
|
421
421
|
[
|
|
422
422
|
"Action remark",
|
|
423
|
-
r.approvedAt ? r.approveRemark : r.rejectionHistory ? new Date((
|
|
423
|
+
r.approvedAt ? r.approveRemark : r.rejectionHistory ? new Date((J = r.rejectionHistory[0]) == null ? void 0 : J.rejectRemark) : ""
|
|
424
424
|
],
|
|
425
425
|
[],
|
|
426
|
-
|
|
427
|
-
...U.map((
|
|
428
|
-
], t =
|
|
429
|
-
return
|
|
426
|
+
q.map((w) => w.name),
|
|
427
|
+
...U.map((w) => q.map((X) => w[X.id]))
|
|
428
|
+
], t = q.map((w) => `system:${w.id}`), _ = Wt(u, t), R = `[${B == null ? void 0 : B.name}] closing draft (${Kt(new Date(r.updatedAt))}).xlsx`;
|
|
429
|
+
return Zt(_, R), R;
|
|
430
430
|
}
|
|
431
|
-
const
|
|
431
|
+
const ga = { class: "flex flex-col" }, ya = {
|
|
432
432
|
key: 0,
|
|
433
433
|
class: "fm-typo-en-body-sm-400 text-fm-color-typo-error mt-4"
|
|
434
|
-
},
|
|
434
|
+
}, ba = { class: "flex gap-12 py-8 justify-end w-full" }, ha = /* @__PURE__ */ He({
|
|
435
435
|
__name: "RefreshBalanceAction",
|
|
436
436
|
props: {
|
|
437
437
|
draft: {},
|
|
@@ -440,53 +440,53 @@ const va = { class: "flex flex-col" }, ga = {
|
|
|
440
440
|
},
|
|
441
441
|
setup(r) {
|
|
442
442
|
const s = r;
|
|
443
|
-
|
|
444
|
-
const e = Y(!1),
|
|
445
|
-
|
|
443
|
+
et();
|
|
444
|
+
const e = Y(!1), d = Y(null), h = Y(!1);
|
|
445
|
+
Ze(() => {
|
|
446
446
|
if (s.draft.effectiveAt)
|
|
447
|
-
|
|
447
|
+
d.value = new Date(s.draft.effectiveAt);
|
|
448
448
|
else {
|
|
449
449
|
const U = new Date(s.draft.createdAt);
|
|
450
|
-
U.setHours(23, 59, 59, 999),
|
|
450
|
+
U.setHours(23, 59, 59, 999), d.value = U;
|
|
451
451
|
}
|
|
452
|
-
|
|
452
|
+
h.value = !0;
|
|
453
453
|
});
|
|
454
|
-
const
|
|
454
|
+
const y = L({
|
|
455
455
|
get() {
|
|
456
|
-
return
|
|
456
|
+
return d.value === null ? "" : Ee(d.value);
|
|
457
457
|
},
|
|
458
458
|
set(U) {
|
|
459
459
|
if (U) {
|
|
460
|
-
const
|
|
461
|
-
|
|
460
|
+
const k = /* @__PURE__ */ new Date(`${U} ${b.value}`);
|
|
461
|
+
k.setSeconds(59, 999), d.value = k;
|
|
462
462
|
} else
|
|
463
|
-
|
|
463
|
+
d.value = null;
|
|
464
464
|
}
|
|
465
|
-
}),
|
|
465
|
+
}), b = L({
|
|
466
466
|
get() {
|
|
467
|
-
return
|
|
467
|
+
return d.value === null ? "" : Dt(d.value);
|
|
468
468
|
},
|
|
469
469
|
set(U) {
|
|
470
470
|
if (U) {
|
|
471
|
-
const
|
|
472
|
-
|
|
471
|
+
const k = /* @__PURE__ */ new Date(`${y.value} ${U}`);
|
|
472
|
+
k.setSeconds(59, 999), d.value = k;
|
|
473
473
|
} else
|
|
474
|
-
|
|
474
|
+
d.value = null;
|
|
475
475
|
}
|
|
476
|
-
}), I = L(() =>
|
|
477
|
-
async function
|
|
478
|
-
e.value = !0, s.onFinished(
|
|
476
|
+
}), I = L(() => d.value ? d.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
|
|
477
|
+
async function M() {
|
|
478
|
+
e.value = !0, s.onFinished(d.value.toISOString());
|
|
479
479
|
}
|
|
480
|
-
return (U,
|
|
481
|
-
const P = z("FmLabel"), B = z("FmDatePicker"),
|
|
482
|
-
return
|
|
480
|
+
return (U, k) => {
|
|
481
|
+
const P = z("FmLabel"), B = z("FmDatePicker"), q = z("FmTimePicker"), u = z("FmButton"), t = z("FmForm");
|
|
482
|
+
return h.value ? (F(), ie(t, {
|
|
483
483
|
key: 1,
|
|
484
|
-
onValidationSuccess:
|
|
484
|
+
onValidationSuccess: M,
|
|
485
485
|
class: "flex flex-col gap-32",
|
|
486
486
|
disabled: e.value
|
|
487
487
|
}, {
|
|
488
488
|
default: Q(() => [
|
|
489
|
-
|
|
489
|
+
k[5] || (k[5] = c("div", { class: "fm-typo-en-body-lg-400" }, [
|
|
490
490
|
c("p", null, [
|
|
491
491
|
oe(" Performing "),
|
|
492
492
|
c("span", { class: "fm-typo-en-body-lg-600" }, '"Refresh Balance"'),
|
|
@@ -498,37 +498,37 @@ const va = { class: "flex flex-col" }, ga = {
|
|
|
498
498
|
oe(" the effective date and time. ")
|
|
499
499
|
])
|
|
500
500
|
], -1)),
|
|
501
|
-
c("div",
|
|
502
|
-
|
|
503
|
-
default: Q(() =>
|
|
501
|
+
c("div", ga, [
|
|
502
|
+
D(P, { class: "fm-typo-en-body-lg-600" }, {
|
|
503
|
+
default: Q(() => k[3] || (k[3] = [
|
|
504
504
|
oe("Closing Date")
|
|
505
505
|
])),
|
|
506
506
|
_: 1
|
|
507
507
|
}),
|
|
508
|
-
|
|
509
|
-
modelValue:
|
|
510
|
-
"onUpdate:modelValue":
|
|
511
|
-
max: $(
|
|
508
|
+
D(B, {
|
|
509
|
+
modelValue: y.value,
|
|
510
|
+
"onUpdate:modelValue": k[0] || (k[0] = (_) => y.value = _),
|
|
511
|
+
max: $(Ee)(/* @__PURE__ */ new Date())
|
|
512
512
|
}, null, 8, ["modelValue", "max"]),
|
|
513
|
-
|
|
514
|
-
default: Q(() =>
|
|
513
|
+
D(P, { class: "fm-typo-en-body-lg-600" }, {
|
|
514
|
+
default: Q(() => k[4] || (k[4] = [
|
|
515
515
|
oe("Closing Time")
|
|
516
516
|
])),
|
|
517
517
|
_: 1
|
|
518
518
|
}),
|
|
519
|
-
|
|
520
|
-
modelValue:
|
|
521
|
-
"onUpdate:modelValue":
|
|
519
|
+
D(q, {
|
|
520
|
+
modelValue: b.value,
|
|
521
|
+
"onUpdate:modelValue": k[1] || (k[1] = (_) => b.value = _)
|
|
522
522
|
}, null, 8, ["modelValue"]),
|
|
523
|
-
I.value ? (F(), E("div",
|
|
523
|
+
I.value ? (F(), E("div", ya, " Cannot select future date ")) : ne("", !0)
|
|
524
524
|
]),
|
|
525
|
-
c("div",
|
|
526
|
-
|
|
525
|
+
c("div", ba, [
|
|
526
|
+
D(u, {
|
|
527
527
|
label: "Cancel",
|
|
528
528
|
variant: "tertiary",
|
|
529
|
-
onClick:
|
|
529
|
+
onClick: k[2] || (k[2] = (_) => U.onCancel())
|
|
530
530
|
}),
|
|
531
|
-
|
|
531
|
+
D(u, {
|
|
532
532
|
label: "Refresh balance",
|
|
533
533
|
type: "submit",
|
|
534
534
|
variant: "primary",
|
|
@@ -543,151 +543,166 @@ const va = { class: "flex flex-col" }, ga = {
|
|
|
543
543
|
], 64));
|
|
544
544
|
};
|
|
545
545
|
}
|
|
546
|
-
}),
|
|
546
|
+
}), ze = kt(
|
|
547
547
|
"closingDraftActions",
|
|
548
548
|
function() {
|
|
549
|
-
const s =
|
|
550
|
-
function
|
|
551
|
-
const
|
|
552
|
-
draft:
|
|
549
|
+
const s = Lt(), e = Je(), d = et(), h = Ye(), y = wt(), b = Y(!1), I = Y();
|
|
550
|
+
function M(g) {
|
|
551
|
+
const m = {
|
|
552
|
+
draft: g
|
|
553
553
|
};
|
|
554
|
-
I.value =
|
|
554
|
+
I.value = m, b.value = !0;
|
|
555
555
|
}
|
|
556
|
-
async function U(
|
|
557
|
-
var
|
|
558
|
-
if (
|
|
559
|
-
const
|
|
560
|
-
if (!
|
|
556
|
+
async function U(g) {
|
|
557
|
+
var S;
|
|
558
|
+
if (g.status === ve.enum.COMPLETED) {
|
|
559
|
+
const H = g.closingAdjustmentId;
|
|
560
|
+
if (!H)
|
|
561
561
|
return e.open({
|
|
562
562
|
title: "Something went wrong",
|
|
563
563
|
message: "Closing draft is completed but closing document cannot be found.",
|
|
564
564
|
type: "error"
|
|
565
565
|
}), console.error("Closing draft is completed but closing document cannot be found.", {
|
|
566
|
-
draftId:
|
|
566
|
+
draftId: g._id
|
|
567
567
|
}), [];
|
|
568
|
-
const
|
|
569
|
-
return ((
|
|
570
|
-
id:
|
|
571
|
-
balance:
|
|
572
|
-
costs:
|
|
568
|
+
const K = await d.readAdjustmentById(H);
|
|
569
|
+
return ((K == null ? void 0 : K.skus) ?? []).map((w) => ({
|
|
570
|
+
id: w.sku._id,
|
|
571
|
+
balance: w.fromBalance,
|
|
572
|
+
costs: w.fromCostBalances
|
|
573
573
|
}));
|
|
574
574
|
} else
|
|
575
|
-
return await
|
|
575
|
+
return await y.readStockBalance(), ((S = y.stockBalance) == null ? void 0 : S.skus) ?? [];
|
|
576
576
|
}
|
|
577
|
-
async function
|
|
578
|
-
|
|
577
|
+
async function k(g, m, S) {
|
|
578
|
+
m || (e.open({
|
|
579
579
|
title: "Exporting",
|
|
580
580
|
message: "Fetching data..."
|
|
581
|
-
}),
|
|
581
|
+
}), m = await U(g)), va(g, m, S ?? []);
|
|
582
582
|
}
|
|
583
|
-
function P(
|
|
583
|
+
function P(g, m) {
|
|
584
584
|
s.open({
|
|
585
585
|
title: "Approve draft",
|
|
586
|
-
contentComponent:
|
|
586
|
+
contentComponent: qe,
|
|
587
587
|
contentComponentProps: {
|
|
588
|
-
draft:
|
|
588
|
+
draft: g,
|
|
589
589
|
action: O.enum.approveDraft,
|
|
590
590
|
onFinished: () => {
|
|
591
|
-
s.close(),
|
|
591
|
+
s.close(), m == null || m();
|
|
592
592
|
},
|
|
593
593
|
onCancel: () => s.close()
|
|
594
594
|
}
|
|
595
595
|
});
|
|
596
596
|
}
|
|
597
|
-
function B(
|
|
597
|
+
function B(g, m) {
|
|
598
598
|
s.open({
|
|
599
599
|
title: "Reject draft",
|
|
600
|
-
contentComponent:
|
|
600
|
+
contentComponent: qe,
|
|
601
601
|
contentComponentProps: {
|
|
602
|
-
draft:
|
|
602
|
+
draft: g,
|
|
603
603
|
action: O.enum.rejectDraft,
|
|
604
604
|
onFinished: () => {
|
|
605
|
-
s.close(),
|
|
605
|
+
s.close(), m == null || m();
|
|
606
606
|
},
|
|
607
607
|
onCancel: () => s.close()
|
|
608
608
|
}
|
|
609
609
|
});
|
|
610
610
|
}
|
|
611
|
-
function
|
|
611
|
+
function q(g, m) {
|
|
612
612
|
s.open({
|
|
613
613
|
title: "Mark draft as failed",
|
|
614
|
-
contentComponent:
|
|
614
|
+
contentComponent: qe,
|
|
615
615
|
contentComponentProps: {
|
|
616
|
-
draft:
|
|
616
|
+
draft: g,
|
|
617
617
|
action: O.enum.markAsFailed,
|
|
618
618
|
onFinished: () => {
|
|
619
|
-
s.close(),
|
|
619
|
+
s.close(), m == null || m();
|
|
620
620
|
},
|
|
621
621
|
onCancel: () => s.close()
|
|
622
622
|
}
|
|
623
623
|
});
|
|
624
624
|
}
|
|
625
|
-
async function u(
|
|
626
|
-
await
|
|
627
|
-
_id:
|
|
628
|
-
_rev:
|
|
625
|
+
async function u(g, m) {
|
|
626
|
+
await h.sync({
|
|
627
|
+
_id: g._id,
|
|
628
|
+
_rev: g._rev ?? "",
|
|
629
629
|
action: O.enum.approveDraft,
|
|
630
630
|
data: {
|
|
631
|
-
remark:
|
|
631
|
+
remark: g.remark ?? ""
|
|
632
632
|
}
|
|
633
633
|
}).delayed(500), e.open({
|
|
634
634
|
title: "Success",
|
|
635
635
|
message: "Sync requested",
|
|
636
636
|
type: "success"
|
|
637
|
-
}),
|
|
637
|
+
}), m == null || m();
|
|
638
638
|
}
|
|
639
639
|
function t() {
|
|
640
|
-
|
|
640
|
+
b.value = !1;
|
|
641
641
|
}
|
|
642
|
-
async function _(
|
|
642
|
+
async function _(g, m, S) {
|
|
643
643
|
await s.open({
|
|
644
644
|
title: "Refresh balance",
|
|
645
|
-
contentComponent:
|
|
645
|
+
contentComponent: ha,
|
|
646
646
|
contentComponentProps: {
|
|
647
|
-
draft:
|
|
648
|
-
onFinished: (
|
|
649
|
-
s.close(),
|
|
647
|
+
draft: g,
|
|
648
|
+
onFinished: (H) => {
|
|
649
|
+
s.close(), S == null || S(H);
|
|
650
650
|
},
|
|
651
651
|
onCancel: async () => {
|
|
652
|
-
s.close(),
|
|
652
|
+
s.close(), m == null || m();
|
|
653
653
|
}
|
|
654
654
|
}
|
|
655
655
|
});
|
|
656
656
|
}
|
|
657
|
-
async function R(
|
|
657
|
+
async function R(g) {
|
|
658
|
+
await s.open({
|
|
659
|
+
title: "Invalidate closing draft cache",
|
|
660
|
+
message: "It will invalidate opening and stock movement cache for this draft.",
|
|
661
|
+
primaryActions: { text: "Proceed", close: !0 },
|
|
662
|
+
secondaryActions: { text: "Cancel", close: !0 }
|
|
663
|
+
}).onPrimary(async () => {
|
|
664
|
+
await d.recalculation.scheduleInvalidateClosingDraftCache([g._id]), e.open({
|
|
665
|
+
title: "Success",
|
|
666
|
+
message: "Invalidate cache requested",
|
|
667
|
+
type: "success"
|
|
668
|
+
});
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
async function N(g, m) {
|
|
658
672
|
try {
|
|
659
673
|
e.open({
|
|
660
674
|
title: "Cloning",
|
|
661
675
|
message: "Creating a copy of the draft..."
|
|
662
|
-
}), await
|
|
676
|
+
}), await h.cloneDraft(g._id), e.open({
|
|
663
677
|
title: "Success",
|
|
664
678
|
message: "Draft cloned successfully",
|
|
665
679
|
type: "success"
|
|
666
|
-
}),
|
|
667
|
-
} catch (
|
|
680
|
+
}), m == null || m();
|
|
681
|
+
} catch (S) {
|
|
668
682
|
e.open({
|
|
669
683
|
title: "Error",
|
|
670
|
-
message: (
|
|
684
|
+
message: (S == null ? void 0 : S.message) || "Failed to clone draft",
|
|
671
685
|
type: "error"
|
|
672
686
|
});
|
|
673
687
|
}
|
|
674
688
|
}
|
|
675
689
|
return {
|
|
676
|
-
viewDraft:
|
|
690
|
+
viewDraft: M,
|
|
677
691
|
closeDraftDialog: t,
|
|
678
692
|
approveDraft: P,
|
|
679
693
|
rejectDraft: B,
|
|
680
|
-
markAsFailed:
|
|
694
|
+
markAsFailed: q,
|
|
681
695
|
syncDraft: u,
|
|
682
|
-
exportDraft:
|
|
696
|
+
exportDraft: k,
|
|
683
697
|
refreshBalance: _,
|
|
684
|
-
cloneDraft:
|
|
685
|
-
viewClosingDraftShow:
|
|
686
|
-
viewClosingDraftProps: I
|
|
698
|
+
cloneDraft: N,
|
|
699
|
+
viewClosingDraftShow: b,
|
|
700
|
+
viewClosingDraftProps: I,
|
|
701
|
+
invalidateDraftCache: R
|
|
687
702
|
};
|
|
688
703
|
}
|
|
689
704
|
);
|
|
690
|
-
function
|
|
705
|
+
function Ne(r) {
|
|
691
706
|
switch (r) {
|
|
692
707
|
case "DRAFT":
|
|
693
708
|
return "fm-status-badge-draft";
|
|
@@ -702,59 +717,59 @@ function Ve(r) {
|
|
|
702
717
|
const ka = kt(
|
|
703
718
|
"closingDraftTable",
|
|
704
719
|
function() {
|
|
705
|
-
const { t: s } =
|
|
706
|
-
async function
|
|
707
|
-
if (
|
|
708
|
-
|
|
720
|
+
const { t: s } = bt(), e = yt(), d = ze(), h = Y(new Array()), y = Y(!1), b = Oe(), I = Ye();
|
|
721
|
+
async function M() {
|
|
722
|
+
if (h.value = [], !!b._currentLocation) {
|
|
723
|
+
y.value = !0;
|
|
709
724
|
try {
|
|
710
725
|
const [u] = await Promise.all([I.readDrafts()]).delayed(1e3);
|
|
711
|
-
|
|
726
|
+
h.value = u.reverse();
|
|
712
727
|
} catch (u) {
|
|
713
728
|
console.log("Something went wrong when fetching drafts:", u);
|
|
714
729
|
} finally {
|
|
715
|
-
|
|
730
|
+
y.value = !1;
|
|
716
731
|
}
|
|
717
732
|
}
|
|
718
733
|
}
|
|
719
734
|
async function U(u) {
|
|
720
|
-
if (!
|
|
721
|
-
|
|
735
|
+
if (!h.value.find((t) => t._id) && b._currentLocation) {
|
|
736
|
+
y.value = !0;
|
|
722
737
|
try {
|
|
723
738
|
const [t] = await Promise.all([
|
|
724
739
|
I.getDraft(u),
|
|
725
740
|
new Promise((_) => setTimeout(_, 1e3))
|
|
726
741
|
]);
|
|
727
|
-
|
|
742
|
+
h.value = [t];
|
|
728
743
|
} catch (t) {
|
|
729
744
|
console.log("Something went wrong when fetching drafts:", t);
|
|
730
745
|
} finally {
|
|
731
|
-
|
|
746
|
+
y.value = !1;
|
|
732
747
|
}
|
|
733
748
|
}
|
|
734
749
|
}
|
|
735
|
-
function
|
|
736
|
-
|
|
750
|
+
function k(u) {
|
|
751
|
+
h.value = h.value.map((t) => t._id === u._id ? {
|
|
737
752
|
...u,
|
|
738
753
|
_rev: t._rev
|
|
739
754
|
} : t);
|
|
740
755
|
}
|
|
741
756
|
function P() {
|
|
742
|
-
|
|
757
|
+
d.closeDraftDialog(), M();
|
|
743
758
|
}
|
|
744
759
|
function B(u, t) {
|
|
745
|
-
switch (t =
|
|
760
|
+
switch (t = Ht(t), u) {
|
|
746
761
|
case Se.Details:
|
|
747
|
-
return
|
|
762
|
+
return d.viewDraft(t);
|
|
748
763
|
case Se.Export:
|
|
749
|
-
return
|
|
764
|
+
return d.exportDraft(t);
|
|
750
765
|
case O.enum.approveDraft:
|
|
751
|
-
return
|
|
766
|
+
return d.approveDraft(t, P);
|
|
752
767
|
case O.enum.rejectDraft:
|
|
753
|
-
return
|
|
768
|
+
return d.rejectDraft(t, P);
|
|
754
769
|
case O.enum.markAsFailed:
|
|
755
|
-
return
|
|
770
|
+
return d.markAsFailed(t, P);
|
|
756
771
|
case Se.Duplicate:
|
|
757
|
-
return
|
|
772
|
+
return d.cloneDraft(t, P);
|
|
758
773
|
}
|
|
759
774
|
}
|
|
760
775
|
return {
|
|
@@ -764,7 +779,7 @@ const ka = kt(
|
|
|
764
779
|
accessorKey: "_id",
|
|
765
780
|
header: () => s("inventory.closing.table.createdAt"),
|
|
766
781
|
cell(u) {
|
|
767
|
-
return
|
|
782
|
+
return ea(`${u.getValue()}`);
|
|
768
783
|
},
|
|
769
784
|
enableSorting: !0
|
|
770
785
|
},
|
|
@@ -774,14 +789,14 @@ const ka = kt(
|
|
|
774
789
|
cell(u) {
|
|
775
790
|
const t = u.row.original;
|
|
776
791
|
let _ = u.getValue();
|
|
777
|
-
return _ || (_ =
|
|
792
|
+
return _ || (_ = Ve(t._id)), ye(_);
|
|
778
793
|
},
|
|
779
794
|
enableSorting: !0,
|
|
780
795
|
size: 200
|
|
781
796
|
},
|
|
782
797
|
{
|
|
783
798
|
id: "updatedAt",
|
|
784
|
-
accessorFn: (u) =>
|
|
799
|
+
accessorFn: (u) => ye(u.updatedAt),
|
|
785
800
|
header: () => "Updated at",
|
|
786
801
|
enableSorting: !0,
|
|
787
802
|
size: 200
|
|
@@ -820,9 +835,9 @@ const ka = kt(
|
|
|
820
835
|
header: () => s("inventory.closing.table.status"),
|
|
821
836
|
enableSorting: !1,
|
|
822
837
|
cell(u) {
|
|
823
|
-
var
|
|
824
|
-
const t = u.row.original, _ = t.status, R = new Date(t.updatedAt),
|
|
825
|
-
return _ === "DRAFT" &&
|
|
838
|
+
var m;
|
|
839
|
+
const t = u.row.original, _ = t.status, R = new Date(t.updatedAt), N = (m = t == null ? void 0 : t.rejectionHistory) == null ? void 0 : m.computeFirst((S) => S.rejectedAt), g = N ? new Date(N) : null;
|
|
840
|
+
return _ === "DRAFT" && g ? g.getTime() > R.getTime() ? A(
|
|
826
841
|
"div",
|
|
827
842
|
{
|
|
828
843
|
class: "flex"
|
|
@@ -830,7 +845,7 @@ const ka = kt(
|
|
|
830
845
|
A(
|
|
831
846
|
"div",
|
|
832
847
|
{
|
|
833
|
-
class: ["fm-status-badge",
|
|
848
|
+
class: ["fm-status-badge", Ne("FAILED")]
|
|
834
849
|
},
|
|
835
850
|
"Rejected"
|
|
836
851
|
)
|
|
@@ -842,7 +857,7 @@ const ka = kt(
|
|
|
842
857
|
A(
|
|
843
858
|
"div",
|
|
844
859
|
{
|
|
845
|
-
class: ["fm-status-badge",
|
|
860
|
+
class: ["fm-status-badge", Ne("PROCESSING")]
|
|
846
861
|
},
|
|
847
862
|
"Updated"
|
|
848
863
|
)
|
|
@@ -854,9 +869,9 @@ const ka = kt(
|
|
|
854
869
|
A(
|
|
855
870
|
"div",
|
|
856
871
|
{
|
|
857
|
-
class: ["fm-status-badge",
|
|
872
|
+
class: ["fm-status-badge", Ne(_)]
|
|
858
873
|
},
|
|
859
|
-
|
|
874
|
+
Le(_)
|
|
860
875
|
)
|
|
861
876
|
);
|
|
862
877
|
}
|
|
@@ -864,11 +879,11 @@ const ka = kt(
|
|
|
864
879
|
{
|
|
865
880
|
id: "action",
|
|
866
881
|
cell(u) {
|
|
867
|
-
var
|
|
868
|
-
const t = u.row.original, _ = ((
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
],
|
|
882
|
+
var m;
|
|
883
|
+
const t = u.row.original, _ = ((m = e.sessionUser.value) == null ? void 0 : m.role.isAdmin) ?? !1, R = [
|
|
884
|
+
pt[Se.Details],
|
|
885
|
+
pt[Se.Export]
|
|
886
|
+
], N = [
|
|
872
887
|
{
|
|
873
888
|
translationKey: "inventory.closing.draft.approveDraft",
|
|
874
889
|
color: "text-fm-color-typo-primary",
|
|
@@ -884,20 +899,20 @@ const ka = kt(
|
|
|
884
899
|
color: "text-fm-color-typo-error",
|
|
885
900
|
value: O.enum.markAsFailed
|
|
886
901
|
}
|
|
887
|
-
],
|
|
902
|
+
], g = _ && t.status !== ve.enum.DRAFT ? [
|
|
888
903
|
{
|
|
889
904
|
translationKey: "inventory.closing.draft.cloneDraft",
|
|
890
905
|
color: "text-fm-color-typo-primary",
|
|
891
906
|
value: Se.Duplicate
|
|
892
907
|
}
|
|
893
908
|
] : [];
|
|
894
|
-
return
|
|
909
|
+
return Jt(
|
|
895
910
|
[
|
|
896
911
|
...R,
|
|
897
|
-
...t.status === ve.enum.DRAFT ?
|
|
912
|
+
...t.status === ve.enum.DRAFT ? N : []
|
|
898
913
|
],
|
|
899
|
-
(
|
|
900
|
-
|
|
914
|
+
(S) => B(S, t),
|
|
915
|
+
g
|
|
901
916
|
);
|
|
902
917
|
},
|
|
903
918
|
enableSorting: !1,
|
|
@@ -908,44 +923,44 @@ const ka = kt(
|
|
|
908
923
|
}
|
|
909
924
|
}
|
|
910
925
|
],
|
|
911
|
-
drafts:
|
|
912
|
-
loading:
|
|
913
|
-
fetchDrafts:
|
|
926
|
+
drafts: h,
|
|
927
|
+
loading: y,
|
|
928
|
+
fetchDrafts: M,
|
|
914
929
|
loadDraft: U,
|
|
915
|
-
updateDraftRef:
|
|
930
|
+
updateDraftRef: k
|
|
916
931
|
};
|
|
917
932
|
}
|
|
918
|
-
),
|
|
933
|
+
), Da = { class: "w-full flex flex-col gap-32" }, xa = { class: "flex justify-between" }, Aa = { class: "flex" }, _a = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, wa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Sa = { class: "flex gap-1" }, Fa = { class: "fm-typo-en-body-lg-600" }, Ca = { class: "flex flex-col gap-16" }, $a = { class: "flex items-center" }, Ba = {
|
|
919
934
|
key: 0,
|
|
920
935
|
class: "flex gap-8"
|
|
921
|
-
},
|
|
936
|
+
}, Ta = {
|
|
922
937
|
key: 0,
|
|
923
938
|
class: "w-full flex flex-col items-center"
|
|
924
|
-
},
|
|
939
|
+
}, ja = { class: "flex items-center gap-8" }, Ia = { class: "flex flex-col gap-8" }, Ua = { class: "flex gap-8" }, Pa = {
|
|
925
940
|
key: 0,
|
|
926
941
|
class: "flex gap-8"
|
|
927
|
-
},
|
|
942
|
+
}, Ra = { class: "overflow-x-auto" }, Ma = {
|
|
928
943
|
key: 1,
|
|
929
944
|
class: "flex-1 xs:w-screen xs:max-w-full"
|
|
930
|
-
},
|
|
945
|
+
}, Va = {
|
|
931
946
|
key: 0,
|
|
932
947
|
class: "flex flex-col items-center gap-8 h-full"
|
|
933
|
-
},
|
|
948
|
+
}, La = ["src"], Na = {
|
|
934
949
|
key: 1,
|
|
935
950
|
class: "px-4 flex flex-col"
|
|
936
|
-
},
|
|
951
|
+
}, Ea = { class: "flex gap-12 content-stretch" }, za = {
|
|
937
952
|
class: "flex flex-col w-24",
|
|
938
953
|
name: "circles"
|
|
939
|
-
},
|
|
954
|
+
}, Ha = { class: "flex-1 flex flex-col items-center" }, Oa = { class: "flex-1 flex flex-col items-center" }, Ya = {
|
|
940
955
|
class: "py-12 flex flex-col gap-4",
|
|
941
956
|
name: "received-at header"
|
|
942
|
-
},
|
|
957
|
+
}, Ka = { class: "fm-typo-en-body-lg-400" }, Qa = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, qa = { class: "flex gap-12 content-stretch" }, Ga = {
|
|
943
958
|
class: "flex flex-col w-24",
|
|
944
959
|
name: "circles"
|
|
945
|
-
},
|
|
960
|
+
}, Wa = { class: "flex-1 flex flex-col items-center" }, Za = {
|
|
946
961
|
class: "py-12 flex flex-col gap-4 flex-1",
|
|
947
962
|
name: "delivery details"
|
|
948
|
-
},
|
|
963
|
+
}, Ja = { class: "flex flex-col gap-8" }, Xa = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, en = { class: "flex flex-col gap-4" }, tn = { class: "flex gap-8" }, an = "N/A", nn = /* @__PURE__ */ He({
|
|
949
964
|
__name: "ClosingDraftDialog",
|
|
950
965
|
props: {
|
|
951
966
|
show: { type: Boolean },
|
|
@@ -953,38 +968,38 @@ const ka = kt(
|
|
|
953
968
|
},
|
|
954
969
|
emits: ["submitted", "refresh"],
|
|
955
970
|
setup(r, { emit: s }) {
|
|
956
|
-
const e = r,
|
|
957
|
-
const l =
|
|
971
|
+
const e = r, d = L(() => {
|
|
972
|
+
const l = ht();
|
|
958
973
|
return l === "MYR" ? "RM" : l;
|
|
959
|
-
}),
|
|
974
|
+
}), h = wt(), y = ze(), b = Nt(e, "show"), I = Y(!1), M = Y(!1), U = Y(!1), k = Y(new Array()), P = Y(new Array()), B = Y([]), q = et(), u = Ye(), t = Je(), _ = Ot(), R = Oe(), N = It({}), g = L(() => new Set(
|
|
960
975
|
_.skus.filter((l) => {
|
|
961
976
|
var a;
|
|
962
|
-
return
|
|
977
|
+
return N[(a = l.customAttributes) == null ? void 0 : a.tag];
|
|
963
978
|
}).map((l) => l._id)
|
|
964
|
-
)),
|
|
979
|
+
)), m = s, S = Y({
|
|
965
980
|
templateItem: !0,
|
|
966
981
|
nonTemplateItem: !0
|
|
967
982
|
}), H = L(() => {
|
|
968
983
|
var a, f;
|
|
969
984
|
const l = [...((a = e.draft) == null ? void 0 : a.items) ?? [], ...((f = e.draft) == null ? void 0 : f.negativeStockItems) ?? []];
|
|
970
|
-
return
|
|
971
|
-
}),
|
|
985
|
+
return g.value.size ? l.filter((n) => g.value.has(n.sku._id)) : l;
|
|
986
|
+
}), K = L(() => {
|
|
972
987
|
const l = H.value.map((a) => a.sku);
|
|
973
988
|
return l.sort((a, f) => a.code.localeCompare(f.code)), l;
|
|
974
|
-
}),
|
|
989
|
+
}), J = L(() => H.value.groupBy(
|
|
975
990
|
(a) => a.sku._id,
|
|
976
991
|
(a) => a.measurementsAmounts.filter((f) => !f.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((f) => f.measurement.id)
|
|
977
992
|
));
|
|
978
|
-
|
|
993
|
+
Ze(me), Ut(
|
|
979
994
|
() => e.show,
|
|
980
995
|
(l) => {
|
|
981
|
-
l && (
|
|
996
|
+
l && (ke.value = _e[0], me(), S.value = {
|
|
982
997
|
templateItem: !0,
|
|
983
998
|
nonTemplateItem: !0
|
|
984
999
|
});
|
|
985
1000
|
}
|
|
986
1001
|
);
|
|
987
|
-
const
|
|
1002
|
+
const w = je(0), X = je(100);
|
|
988
1003
|
async function me() {
|
|
989
1004
|
var a, f, n, o;
|
|
990
1005
|
if (!R._currentLocation) return;
|
|
@@ -1004,9 +1019,9 @@ const ka = kt(
|
|
|
1004
1019
|
});
|
|
1005
1020
|
return;
|
|
1006
1021
|
}
|
|
1007
|
-
const j = await
|
|
1022
|
+
const j = await q.readAdjustmentById(T), re = (j == null ? void 0 : j.skus) ?? [];
|
|
1008
1023
|
for (const ce of re) {
|
|
1009
|
-
const
|
|
1024
|
+
const De = {
|
|
1010
1025
|
id: ce.sku._id,
|
|
1011
1026
|
balance: ce.fromBalance,
|
|
1012
1027
|
costs: ce.fromCostBalances
|
|
@@ -1015,10 +1030,10 @@ const ka = kt(
|
|
|
1015
1030
|
balance: ce.toBalance,
|
|
1016
1031
|
costs: ce.toCostBalances
|
|
1017
1032
|
};
|
|
1018
|
-
|
|
1033
|
+
k.value.push(De), P.value.push(C);
|
|
1019
1034
|
}
|
|
1020
1035
|
} else
|
|
1021
|
-
|
|
1036
|
+
k.value = ((n = e.draft) == null ? void 0 : n.stockSnapshot) ?? [];
|
|
1022
1037
|
const i = /* @__PURE__ */ new Set();
|
|
1023
1038
|
if ((o = e.draft) != null && o.adjustmentSnapshot)
|
|
1024
1039
|
for (const T of e.draft.adjustmentSnapshot)
|
|
@@ -1039,9 +1054,9 @@ const ka = kt(
|
|
|
1039
1054
|
I.value = !1;
|
|
1040
1055
|
}
|
|
1041
1056
|
}
|
|
1042
|
-
async function
|
|
1057
|
+
async function te() {
|
|
1043
1058
|
var a, f;
|
|
1044
|
-
if (!(((a = e.draft) == null ? void 0 : a.effectiveAt) ?? (e.draft ?
|
|
1059
|
+
if (!(((a = e.draft) == null ? void 0 : a.effectiveAt) ?? (e.draft ? Ve((f = e.draft) == null ? void 0 : f._id) : null))) {
|
|
1045
1060
|
t.open({
|
|
1046
1061
|
title: "Cannot refresh",
|
|
1047
1062
|
message: "Effective date is not available for this draft.",
|
|
@@ -1049,16 +1064,16 @@ const ka = kt(
|
|
|
1049
1064
|
});
|
|
1050
1065
|
return;
|
|
1051
1066
|
}
|
|
1052
|
-
await
|
|
1067
|
+
await y.refreshBalance(
|
|
1053
1068
|
e.draft,
|
|
1054
1069
|
() => {
|
|
1055
1070
|
},
|
|
1056
1071
|
async (n) => {
|
|
1057
1072
|
var x;
|
|
1058
|
-
|
|
1073
|
+
M.value = !0;
|
|
1059
1074
|
const o = (x = e.draft) == null ? void 0 : x._rev, i = 30, p = 2e3;
|
|
1060
1075
|
try {
|
|
1061
|
-
await
|
|
1076
|
+
await q.recalculation.scheduleCalculateStockSnapshotAtDate(n, e.draft._id);
|
|
1062
1077
|
let v = null;
|
|
1063
1078
|
for (let T = 0; T < i && (v = await u.getDraft(e.draft._id).delayed(p), v._rev === o); T++)
|
|
1064
1079
|
;
|
|
@@ -1070,11 +1085,11 @@ const ka = kt(
|
|
|
1070
1085
|
}), console.error("error refreshing stock balances: there is no change in _rev");
|
|
1071
1086
|
return;
|
|
1072
1087
|
}
|
|
1073
|
-
|
|
1088
|
+
m("refresh", v), k.value = v.stockSnapshot ?? [], t.open({
|
|
1074
1089
|
title: "Balance refreshed",
|
|
1075
1090
|
message: "Stock balance has been recalculated.",
|
|
1076
1091
|
type: "success"
|
|
1077
|
-
}),
|
|
1092
|
+
}), b.value = !1;
|
|
1078
1093
|
} catch (v) {
|
|
1079
1094
|
t.open({
|
|
1080
1095
|
title: "Refresh failed",
|
|
@@ -1082,26 +1097,38 @@ const ka = kt(
|
|
|
1082
1097
|
type: "error"
|
|
1083
1098
|
}), console.error("error refreshing stock balances", v);
|
|
1084
1099
|
} finally {
|
|
1085
|
-
|
|
1100
|
+
M.value = !1;
|
|
1086
1101
|
}
|
|
1087
1102
|
}
|
|
1088
1103
|
);
|
|
1089
1104
|
}
|
|
1090
|
-
|
|
1091
|
-
|
|
1105
|
+
async function se() {
|
|
1106
|
+
var a, f;
|
|
1107
|
+
if (!(((a = e.draft) == null ? void 0 : a.effectiveAt) ?? (e.draft ? Ve((f = e.draft) == null ? void 0 : f._id) : null))) {
|
|
1108
|
+
t.open({
|
|
1109
|
+
title: "Cannot refresh",
|
|
1110
|
+
message: "Effective date is not available for this draft.",
|
|
1111
|
+
type: "error"
|
|
1112
|
+
});
|
|
1113
|
+
return;
|
|
1114
|
+
}
|
|
1115
|
+
await y.invalidateDraftCache(e.draft);
|
|
1116
|
+
}
|
|
1117
|
+
const de = L(
|
|
1118
|
+
() => k.value.groupBy(
|
|
1092
1119
|
(l) => l.id,
|
|
1093
1120
|
(l) => l.balance
|
|
1094
1121
|
)
|
|
1095
|
-
),
|
|
1122
|
+
), be = L(() => H.value.groupBy((l) => l.sku._id)), he = L(() => {
|
|
1096
1123
|
var l;
|
|
1097
1124
|
return (l = e.draft) != null && l.adjustmentSnapshot ? new Map(e.draft.adjustmentSnapshot.map((a) => [a.skuId, a.adjustmentsByType])) : /* @__PURE__ */ new Map();
|
|
1098
|
-
}),
|
|
1125
|
+
}), Ie = L(() => {
|
|
1099
1126
|
var l;
|
|
1100
1127
|
return (l = e.draft) != null && l.opening ? new Map(e.draft.opening.map((a) => [a.skuId, a.balance])) : /* @__PURE__ */ new Map();
|
|
1101
1128
|
});
|
|
1102
|
-
function
|
|
1129
|
+
function Z(l, a) {
|
|
1103
1130
|
return A(
|
|
1104
|
-
|
|
1131
|
+
ge.FmTooltip,
|
|
1105
1132
|
{ zIndex: 51, placement: "left", class: "w-full flex justify-end" },
|
|
1106
1133
|
{
|
|
1107
1134
|
default() {
|
|
@@ -1113,10 +1140,10 @@ const ka = kt(
|
|
|
1113
1140
|
}
|
|
1114
1141
|
);
|
|
1115
1142
|
}
|
|
1116
|
-
const
|
|
1117
|
-
const l =
|
|
1143
|
+
const Ce = L(() => {
|
|
1144
|
+
const l = K.value.reduce((f, n) => {
|
|
1118
1145
|
var o, i;
|
|
1119
|
-
return Math.max(f, ((i = (o =
|
|
1146
|
+
return Math.max(f, ((i = (o = J.value) == null ? void 0 : o.get(n._id)) == null ? void 0 : i[0].length) ?? 0);
|
|
1120
1147
|
}, 0);
|
|
1121
1148
|
return [
|
|
1122
1149
|
{
|
|
@@ -1148,7 +1175,7 @@ const ka = kt(
|
|
|
1148
1175
|
)
|
|
1149
1176
|
]);
|
|
1150
1177
|
return A(
|
|
1151
|
-
|
|
1178
|
+
ge.FmTooltip,
|
|
1152
1179
|
{
|
|
1153
1180
|
zIndex: 51
|
|
1154
1181
|
},
|
|
@@ -1168,7 +1195,7 @@ const ka = kt(
|
|
|
1168
1195
|
{
|
|
1169
1196
|
id: "costPerUnit",
|
|
1170
1197
|
accessorKey: "costPerUnit",
|
|
1171
|
-
header: () =>
|
|
1198
|
+
header: () => Z("Cost per unit"),
|
|
1172
1199
|
size: 160,
|
|
1173
1200
|
cell(f) {
|
|
1174
1201
|
const n = f.row.original.costPerUnit;
|
|
@@ -1186,7 +1213,7 @@ const ka = kt(
|
|
|
1186
1213
|
var x;
|
|
1187
1214
|
const n = f.row.original, o = n.costUnit, i = n.baseUnit, p = o ?? i;
|
|
1188
1215
|
if (o && o !== i) {
|
|
1189
|
-
const v =
|
|
1216
|
+
const v = K.value.find((j) => j._id === n.id), T = (x = v == null ? void 0 : v.defaultCost) == null ? void 0 : x.measurement;
|
|
1190
1217
|
if (T) {
|
|
1191
1218
|
const j = T.conversion.amount / Math.pow(10, T.conversion.precision);
|
|
1192
1219
|
return A("div", { class: "flex flex-col" }, [
|
|
@@ -1210,7 +1237,7 @@ const ka = kt(
|
|
|
1210
1237
|
{
|
|
1211
1238
|
id: "opening",
|
|
1212
1239
|
accessorKey: "opening",
|
|
1213
|
-
header: () =>
|
|
1240
|
+
header: () => Z("Opening (B/F)", "The opening balance brought forward from previous period."),
|
|
1214
1241
|
size: 150,
|
|
1215
1242
|
cell(f) {
|
|
1216
1243
|
const n = f.row.original.opening;
|
|
@@ -1225,11 +1252,11 @@ const ka = kt(
|
|
|
1225
1252
|
(f) => ({
|
|
1226
1253
|
id: `adjustment_${f}`,
|
|
1227
1254
|
accessorFn: (n) => n.adjustmentAmounts[f] ?? { amount: 0, precision: 0 },
|
|
1228
|
-
header: () =>
|
|
1255
|
+
header: () => Z(Le(f)),
|
|
1229
1256
|
size: 150,
|
|
1230
1257
|
cell(n) {
|
|
1231
1258
|
const o = n.row.original.adjustmentAmounts[f] ?? { amount: 0, precision: 0 };
|
|
1232
|
-
return A("div", { class: "text-right" },
|
|
1259
|
+
return A("div", { class: "text-right" }, We(o));
|
|
1233
1260
|
},
|
|
1234
1261
|
meta: {
|
|
1235
1262
|
textAlign: "right"
|
|
@@ -1239,7 +1266,7 @@ const ka = kt(
|
|
|
1239
1266
|
{
|
|
1240
1267
|
id: "systemBalance",
|
|
1241
1268
|
accessorKey: "systemBalance",
|
|
1242
|
-
header: () =>
|
|
1269
|
+
header: () => Z("System Balance", "The system calculated balance before stock take."),
|
|
1243
1270
|
size: 200,
|
|
1244
1271
|
meta: {
|
|
1245
1272
|
textAlign: "right"
|
|
@@ -1252,7 +1279,7 @@ const ka = kt(
|
|
|
1252
1279
|
const n = (o = P.value.find((i) => i.id === f.id)) == null ? void 0 : o.balance;
|
|
1253
1280
|
return n ? V.toFormatString({ value: n }) : f.physicalBalance;
|
|
1254
1281
|
},
|
|
1255
|
-
header: () =>
|
|
1282
|
+
header: () => Z("Stock Take balance", "The physical balance recorded during stock take."),
|
|
1256
1283
|
cell(f) {
|
|
1257
1284
|
var v;
|
|
1258
1285
|
const n = f.row.original, o = V.fromNumber(n.physicalBalance);
|
|
@@ -1282,7 +1309,7 @@ const ka = kt(
|
|
|
1282
1309
|
{
|
|
1283
1310
|
id: "adjustedAmount",
|
|
1284
1311
|
accessorKey: "adjustedAmount",
|
|
1285
|
-
header: () =>
|
|
1312
|
+
header: () => Z("Variance", "The difference between Stock Take balance and System Balance."),
|
|
1286
1313
|
size: 200,
|
|
1287
1314
|
meta: {
|
|
1288
1315
|
textAlign: "right"
|
|
@@ -1291,7 +1318,7 @@ const ka = kt(
|
|
|
1291
1318
|
{
|
|
1292
1319
|
id: "varianceInCost",
|
|
1293
1320
|
accessorKey: "varianceInCost",
|
|
1294
|
-
header: () =>
|
|
1321
|
+
header: () => Z(`Variance (${d.value})`),
|
|
1295
1322
|
size: 150,
|
|
1296
1323
|
cell(f) {
|
|
1297
1324
|
const n = f.row.original.varianceInCost;
|
|
@@ -1308,20 +1335,20 @@ const ka = kt(
|
|
|
1308
1335
|
{
|
|
1309
1336
|
id: "adjustedDiffPercentage",
|
|
1310
1337
|
accessorKey: "adjustedDiffPercentage",
|
|
1311
|
-
header: () =>
|
|
1338
|
+
header: () => Z(
|
|
1312
1339
|
"Variance (%)",
|
|
1313
1340
|
"Difference between Stock Take balance and System Balance in percentage."
|
|
1314
1341
|
),
|
|
1315
1342
|
size: 200,
|
|
1316
1343
|
cell(f) {
|
|
1317
1344
|
const n = f.row.original.adjustedDiffPercentage;
|
|
1318
|
-
if (!n) return
|
|
1345
|
+
if (!n) return an;
|
|
1319
1346
|
const o = n.toFixed(2);
|
|
1320
1347
|
if (o === "0.00")
|
|
1321
1348
|
return A("div", { class: "flex items-center gap-4 justify-end" }, ["0.00"]);
|
|
1322
1349
|
const i = n > 0;
|
|
1323
1350
|
return A("div", { class: "flex items-center gap-4 justify-end" }, [
|
|
1324
|
-
A(
|
|
1351
|
+
A(ge.FmIcon, {
|
|
1325
1352
|
name: i ? "arrow_drop_up" : "arrow_drop_down",
|
|
1326
1353
|
color: i ? "system-success-300" : "system-error-300",
|
|
1327
1354
|
size: "md"
|
|
@@ -1336,15 +1363,15 @@ const ka = kt(
|
|
|
1336
1363
|
{
|
|
1337
1364
|
id: "stockTakeValue",
|
|
1338
1365
|
accessorKey: "stockTakeValue",
|
|
1339
|
-
header: () =>
|
|
1366
|
+
header: () => Z(`Stock take value (${d.value})`),
|
|
1340
1367
|
size: 180,
|
|
1341
1368
|
cell(f) {
|
|
1342
1369
|
var T;
|
|
1343
|
-
const n = f.row.original, o = n.stockTakeValue, i =
|
|
1370
|
+
const n = f.row.original, o = n.stockTakeValue, i = K.value.find((j) => j._id === n.id), p = (T = i == null ? void 0 : i.defaultCost) == null ? void 0 : T.measurement, x = n.physicalBalance, v = n.costPerUnit;
|
|
1344
1371
|
if (p) {
|
|
1345
|
-
const j = V.toFormatString({ value: p.conversion }), re = `${x.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${n.baseUnit} ÷ ${j} × ${v} ${
|
|
1372
|
+
const j = V.toFormatString({ value: p.conversion }), re = `${x.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${n.baseUnit} ÷ ${j} × ${v} ${d.value}`;
|
|
1346
1373
|
return A(
|
|
1347
|
-
|
|
1374
|
+
ge.FmTooltip,
|
|
1348
1375
|
{ zIndex: 51 },
|
|
1349
1376
|
{
|
|
1350
1377
|
content() {
|
|
@@ -1363,9 +1390,9 @@ const ka = kt(
|
|
|
1363
1390
|
}
|
|
1364
1391
|
);
|
|
1365
1392
|
} else {
|
|
1366
|
-
const j = `${x.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${n.baseUnit} × ${v} ${
|
|
1393
|
+
const j = `${x.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${n.baseUnit} × ${v} ${d.value}`;
|
|
1367
1394
|
return A(
|
|
1368
|
-
|
|
1395
|
+
ge.FmTooltip,
|
|
1369
1396
|
{ zIndex: 51 },
|
|
1370
1397
|
{
|
|
1371
1398
|
content() {
|
|
@@ -1392,15 +1419,15 @@ const ka = kt(
|
|
|
1392
1419
|
{
|
|
1393
1420
|
id: "systemValue",
|
|
1394
1421
|
accessorKey: "systemValue",
|
|
1395
|
-
header: () =>
|
|
1422
|
+
header: () => Z(`System value (${d.value})`),
|
|
1396
1423
|
size: 180,
|
|
1397
1424
|
cell(f) {
|
|
1398
1425
|
var T;
|
|
1399
|
-
const n = f.row.original, o = n.systemValue, i =
|
|
1426
|
+
const n = f.row.original, o = n.systemValue, i = K.value.find((j) => j._id === n.id), p = (T = i == null ? void 0 : i.defaultCost) == null ? void 0 : T.measurement, x = n.systemBalance, v = n.costPerUnit;
|
|
1400
1427
|
if (p) {
|
|
1401
|
-
const j = V.toFormatString({ value: p.conversion }), re = `${x.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${n.baseUnit} ÷ ${j} × ${v} ${
|
|
1428
|
+
const j = V.toFormatString({ value: p.conversion }), re = `${x.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${n.baseUnit} ÷ ${j} × ${v} ${d.value}`;
|
|
1402
1429
|
return A(
|
|
1403
|
-
|
|
1430
|
+
ge.FmTooltip,
|
|
1404
1431
|
{ zIndex: 51 },
|
|
1405
1432
|
{
|
|
1406
1433
|
content() {
|
|
@@ -1419,9 +1446,9 @@ const ka = kt(
|
|
|
1419
1446
|
}
|
|
1420
1447
|
);
|
|
1421
1448
|
} else {
|
|
1422
|
-
const j = `${x.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${n.baseUnit} × ${v} ${
|
|
1449
|
+
const j = `${x.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${n.baseUnit} × ${v} ${d.value}`;
|
|
1423
1450
|
return A(
|
|
1424
|
-
|
|
1451
|
+
ge.FmTooltip,
|
|
1425
1452
|
{ zIndex: 51 },
|
|
1426
1453
|
{
|
|
1427
1454
|
content() {
|
|
@@ -1451,7 +1478,7 @@ const ka = kt(
|
|
|
1451
1478
|
enableSorting: !1,
|
|
1452
1479
|
cell(f) {
|
|
1453
1480
|
const n = f.row.original, o = (p, x) => A(
|
|
1454
|
-
|
|
1481
|
+
ge.FmTooltip,
|
|
1455
1482
|
{ zIndex: 50 },
|
|
1456
1483
|
{
|
|
1457
1484
|
default() {
|
|
@@ -1497,94 +1524,94 @@ const ka = kt(
|
|
|
1497
1524
|
}
|
|
1498
1525
|
}
|
|
1499
1526
|
];
|
|
1500
|
-
}),
|
|
1527
|
+
}), Ue = L(() => Ce.value.map((l) => l.size ?? 0).reduce((l, a) => l + a)), xe = Y(""), $e = L(() => {
|
|
1501
1528
|
var f, n;
|
|
1502
1529
|
const l = ((n = (f = e.draft) == null ? void 0 : f.negativeStockItems) == null ? void 0 : n.reduce(
|
|
1503
1530
|
(o, i) => (o[i.sku._id] = i, o),
|
|
1504
1531
|
{}
|
|
1505
1532
|
)) ?? {};
|
|
1506
|
-
return
|
|
1507
|
-
var
|
|
1508
|
-
const i = (
|
|
1533
|
+
return K.value.map((o) => {
|
|
1534
|
+
var nt, ot, st, rt, lt, it, ct, ut, mt, dt, ft;
|
|
1535
|
+
const i = (nt = be.value.get(o._id)) == null ? void 0 : nt[0], p = ((ot = de.value.get(o._id)) == null ? void 0 : ot[0]) ?? w, x = ((st = o.defaultCost) == null ? void 0 : st.costPerUnit) ?? w, v = Number(V.toFormatString({ value: x })), T = ((lt = (rt = o.defaultCost) == null ? void 0 : rt.measurement) == null ? void 0 : lt.conversion) ?? {
|
|
1509
1536
|
amount: 1,
|
|
1510
1537
|
precision: 0
|
|
1511
1538
|
}, j = Number(
|
|
1512
1539
|
V.toFormatString({ value: T })
|
|
1513
|
-
), re =
|
|
1514
|
-
if (B.value.forEach((
|
|
1515
|
-
const ue = C[
|
|
1516
|
-
fe && (C[
|
|
1540
|
+
), re = Ie.value.get(o._id), ce = re ? Number(V.toFormatString({ value: re })) : 0, De = he.value.get(o._id), C = {};
|
|
1541
|
+
if (B.value.forEach((W) => {
|
|
1542
|
+
const ue = C[W] ?? { amount: 0, precision: 0 }, fe = De == null ? void 0 : De[W];
|
|
1543
|
+
fe && (C[W] = Gt(ue, fe));
|
|
1517
1544
|
}), !i) {
|
|
1518
|
-
const
|
|
1545
|
+
const W = Number(V.toFormatString({ value: p })), ue = W - 0, fe = ue * v / j, Re = 0, jt = W * v / j;
|
|
1519
1546
|
return {
|
|
1520
1547
|
id: o._id,
|
|
1521
1548
|
code: o.code,
|
|
1522
1549
|
name: o.name,
|
|
1523
|
-
costUnit: ((
|
|
1550
|
+
costUnit: ((ct = (it = o.defaultCost) == null ? void 0 : it.measurement) == null ? void 0 : ct.abbrev) ?? null,
|
|
1524
1551
|
baseUnit: o.unit.abbrev,
|
|
1525
1552
|
baseUnitAmount: 0,
|
|
1526
|
-
systemBalance:
|
|
1553
|
+
systemBalance: W,
|
|
1527
1554
|
physicalBalance: 0,
|
|
1528
|
-
adjustedAmount: -
|
|
1555
|
+
adjustedAmount: -W,
|
|
1529
1556
|
adjustedDiffPercentage: -100,
|
|
1530
1557
|
isTemplateItem: !l[o._id],
|
|
1531
1558
|
costPerUnit: v,
|
|
1532
1559
|
opening: ce,
|
|
1533
1560
|
varianceQty: ue,
|
|
1534
1561
|
varianceInCost: fe,
|
|
1535
|
-
stockTakeValue:
|
|
1536
|
-
systemValue:
|
|
1562
|
+
stockTakeValue: Re,
|
|
1563
|
+
systemValue: jt,
|
|
1537
1564
|
adjustmentAmounts: C
|
|
1538
1565
|
};
|
|
1539
1566
|
}
|
|
1540
|
-
const
|
|
1541
|
-
(
|
|
1542
|
-
)) == null ? void 0 :
|
|
1543
|
-
|
|
1567
|
+
const G = St(i), ee = (mt = (ut = P.value) == null ? void 0 : ut.find(
|
|
1568
|
+
(W) => W.id === o._id
|
|
1569
|
+
)) == null ? void 0 : mt.balance, pe = xt(
|
|
1570
|
+
ee ?? G,
|
|
1544
1571
|
p
|
|
1545
|
-
),
|
|
1572
|
+
), Be = p.amount === 0 ? null : At(pe, {
|
|
1546
1573
|
...p,
|
|
1547
1574
|
amount: Math.abs(p.amount)
|
|
1548
|
-
}),
|
|
1575
|
+
}), Pe = Be ? Xe(Be, X) : null, Ke = Number(V.toFormatString({ value: p })), Qe = Number(V.toFormatString({ value: G })), at = Ke - Qe, $t = at * v / j, Bt = Qe * v / j, Tt = Ke * v / j;
|
|
1549
1576
|
return {
|
|
1550
1577
|
id: o._id,
|
|
1551
1578
|
code: o.code,
|
|
1552
1579
|
name: o.name,
|
|
1553
|
-
costUnit: ((
|
|
1580
|
+
costUnit: ((ft = (dt = o.defaultCost) == null ? void 0 : dt.measurement) == null ? void 0 : ft.abbrev) ?? null,
|
|
1554
1581
|
baseUnit: o.unit.abbrev,
|
|
1555
1582
|
baseUnitAmount: Number(V.toFormatString({ value: i.baseAmount })),
|
|
1556
|
-
...i.measurementsAmounts.filter((
|
|
1557
|
-
var ue, fe,
|
|
1558
|
-
return (
|
|
1559
|
-
}).reduce((
|
|
1560
|
-
systemBalance:
|
|
1561
|
-
physicalBalance:
|
|
1583
|
+
...i.measurementsAmounts.filter((W) => {
|
|
1584
|
+
var ue, fe, Re;
|
|
1585
|
+
return (Re = (fe = (ue = J.value) == null ? void 0 : ue.get(o._id)) == null ? void 0 : fe[0]) == null ? void 0 : Re.includes(W.measurement.id);
|
|
1586
|
+
}).reduce((W, ue, fe) => (W[`measurementAbbrev${fe}`] = `(${ue.measurement.abbrev}) × ${V.toFormatString({ value: ue.measurement.conversion })}`, W[`measurementAmount${fe}`] = Number(V.toFormatString({ value: ue.amount })), W), {}),
|
|
1587
|
+
systemBalance: Ke,
|
|
1588
|
+
physicalBalance: Qe,
|
|
1562
1589
|
adjustedAmount: Number(V.toFormatString({ value: pe })),
|
|
1563
|
-
adjustedDiffPercentage:
|
|
1590
|
+
adjustedDiffPercentage: Pe ? Number(
|
|
1564
1591
|
V.toFormatString({
|
|
1565
|
-
value:
|
|
1592
|
+
value: _t(Pe, 2)
|
|
1566
1593
|
})
|
|
1567
1594
|
) : null,
|
|
1568
1595
|
isTemplateItem: !l[o._id],
|
|
1569
1596
|
costPerUnit: v,
|
|
1570
1597
|
opening: ce,
|
|
1571
|
-
varianceQty:
|
|
1572
|
-
varianceInCost:
|
|
1573
|
-
stockTakeValue:
|
|
1574
|
-
systemValue:
|
|
1598
|
+
varianceQty: at,
|
|
1599
|
+
varianceInCost: $t,
|
|
1600
|
+
stockTakeValue: Bt,
|
|
1601
|
+
systemValue: Tt,
|
|
1575
1602
|
adjustmentAmounts: C
|
|
1576
1603
|
};
|
|
1577
|
-
}).filter((o) => !!(o.isTemplateItem &&
|
|
1578
|
-
}),
|
|
1604
|
+
}).filter((o) => !!(o.isTemplateItem && S.value.templateItem || !o.isTemplateItem && S.value.nonTemplateItem));
|
|
1605
|
+
}), Ae = L(() => {
|
|
1579
1606
|
var a, f, n, o, i;
|
|
1580
1607
|
if (!e.draft) return [];
|
|
1581
1608
|
const l = e.draft.approvedAt ? {
|
|
1582
|
-
action: `Approve at ${
|
|
1609
|
+
action: `Approve at ${ye(e.draft.approvedAt)}`,
|
|
1583
1610
|
// actionAt: props.draft.approvedAt,
|
|
1584
1611
|
actionBy: e.draft.approvedBy,
|
|
1585
1612
|
remark: e.draft.approveRemark
|
|
1586
1613
|
} : (a = e.draft.rejectionHistory) == null ? void 0 : a.computeFirst((p) => ({
|
|
1587
|
-
action: `Reject at ${
|
|
1614
|
+
action: `Reject at ${ye(p.rejectedAt)}`,
|
|
1588
1615
|
// actionAt: e.rejectedAt,
|
|
1589
1616
|
actionBy: p.rejectedBy,
|
|
1590
1617
|
remark: p.rejectRemark
|
|
@@ -1596,7 +1623,7 @@ const ka = kt(
|
|
|
1596
1623
|
},
|
|
1597
1624
|
{
|
|
1598
1625
|
label: "Created at",
|
|
1599
|
-
value:
|
|
1626
|
+
value: ye(e.draft.createdAt)
|
|
1600
1627
|
},
|
|
1601
1628
|
{
|
|
1602
1629
|
label: "Created by",
|
|
@@ -1604,7 +1631,7 @@ const ka = kt(
|
|
|
1604
1631
|
},
|
|
1605
1632
|
{
|
|
1606
1633
|
label: "Updated at",
|
|
1607
|
-
value:
|
|
1634
|
+
value: ye(e.draft.updatedAt)
|
|
1608
1635
|
},
|
|
1609
1636
|
{
|
|
1610
1637
|
label: "Updated by",
|
|
@@ -1612,7 +1639,7 @@ const ka = kt(
|
|
|
1612
1639
|
},
|
|
1613
1640
|
{
|
|
1614
1641
|
label: "Effective at",
|
|
1615
|
-
value:
|
|
1642
|
+
value: ye(e.draft.effectiveAt ?? Ve((n = e.draft) == null ? void 0 : n._id))
|
|
1616
1643
|
},
|
|
1617
1644
|
{
|
|
1618
1645
|
label: "Using template",
|
|
@@ -1635,7 +1662,7 @@ const ka = kt(
|
|
|
1635
1662
|
value: l.remark
|
|
1636
1663
|
} : null
|
|
1637
1664
|
].filter((p) => p).map((p) => p);
|
|
1638
|
-
}),
|
|
1665
|
+
}), _e = [
|
|
1639
1666
|
{
|
|
1640
1667
|
label: "Overview",
|
|
1641
1668
|
value: "overview"
|
|
@@ -1644,7 +1671,7 @@ const ka = kt(
|
|
|
1644
1671
|
label: "Action history",
|
|
1645
1672
|
value: "history"
|
|
1646
1673
|
}
|
|
1647
|
-
],
|
|
1674
|
+
], ke = Y(_e[0]), we = L(() => {
|
|
1648
1675
|
var n, o, i;
|
|
1649
1676
|
const l = ((n = e.draft) == null ? void 0 : n.activityLogs) ?? [], a = ((o = e.draft) == null ? void 0 : o.rejectionHistory) ?? [];
|
|
1650
1677
|
for (const p of a)
|
|
@@ -1668,8 +1695,8 @@ const ka = kt(
|
|
|
1668
1695
|
remark: e.draft.approveRemark
|
|
1669
1696
|
})), l.sort((p, x) => new Date(x.performedAt).getTime() - new Date(p.performedAt).getTime()).map(
|
|
1670
1697
|
(p) => ({
|
|
1671
|
-
header:
|
|
1672
|
-
date:
|
|
1698
|
+
header: Le(p.action),
|
|
1699
|
+
date: ye(p.performedAt),
|
|
1673
1700
|
info: [
|
|
1674
1701
|
{
|
|
1675
1702
|
label: "Performed by",
|
|
@@ -1682,126 +1709,126 @@ const ka = kt(
|
|
|
1682
1709
|
]
|
|
1683
1710
|
})
|
|
1684
1711
|
);
|
|
1685
|
-
}),
|
|
1712
|
+
}), tt = L(() => {
|
|
1686
1713
|
var o, i, p, x;
|
|
1687
1714
|
if (!((o = e.draft) != null && o.stockSnapshot)) return "Stock snapshot is not available.";
|
|
1688
1715
|
if (((i = e.draft) == null ? void 0 : i.status) !== ve.enum.DRAFT) return "Status is not draft.";
|
|
1689
|
-
const l =
|
|
1716
|
+
const l = $e.value.some((v) => v.physicalBalance < 0), a = ((x = (p = h.stockBalance.skus) == null ? void 0 : p.filter((v) => v.balance.amount < 0)) == null ? void 0 : x.map((v) => v.id)) ?? [], f = new Set(K.value.map((v) => v._id)), n = a.filter((v) => !f.has(v)).length;
|
|
1690
1717
|
return [
|
|
1691
1718
|
l ? "Negative total exist." : null,
|
|
1692
1719
|
n ? "Negative stock is not included in this draft. Please commit the draft to include these stocks." : null
|
|
1693
1720
|
].filter((v) => v).join(" ");
|
|
1694
1721
|
});
|
|
1695
1722
|
return (l, a) => {
|
|
1696
|
-
const f = z("FmButtonGroup"), n = z("FmMenuDivider"), o = z("FmCard"), i = z("FmButton"), p = z("FmCircularProgress"), x = z("FmChip"), v = z("FmTextField"), T = z("FmIcon"), j = z("FmTable"), re = z("FmSpacer"), ce = z("FmTooltip"),
|
|
1697
|
-
return F(), ie(
|
|
1723
|
+
const f = z("FmButtonGroup"), n = z("FmMenuDivider"), o = z("FmCard"), i = z("FmButton"), p = z("FmCircularProgress"), x = z("FmChip"), v = z("FmTextField"), T = z("FmIcon"), j = z("FmTable"), re = z("FmSpacer"), ce = z("FmTooltip"), De = z("FmSideSheet");
|
|
1724
|
+
return F(), ie(De, {
|
|
1698
1725
|
"dismiss-away": "",
|
|
1699
1726
|
"max-width": 9999,
|
|
1700
|
-
"model-value": $(
|
|
1701
|
-
"onUpdate:modelValue": a[10] || (a[10] = (C) =>
|
|
1727
|
+
"model-value": $(b),
|
|
1728
|
+
"onUpdate:modelValue": a[10] || (a[10] = (C) => vt(b) ? b.value = C : null),
|
|
1702
1729
|
header: "Closing details"
|
|
1703
1730
|
}, {
|
|
1704
1731
|
"side-sheet-footer": Q(() => {
|
|
1705
|
-
var C,
|
|
1732
|
+
var C, G, ee, pe;
|
|
1706
1733
|
return [
|
|
1707
|
-
c("div",
|
|
1734
|
+
c("div", tn, [
|
|
1708
1735
|
((C = e.draft) == null ? void 0 : C.status) === $(ve).enum.DRAFT ? (F(), E(le, { key: 0 }, [
|
|
1709
|
-
|
|
1736
|
+
tt.value ? (F(), ie(ce, {
|
|
1710
1737
|
key: 0,
|
|
1711
1738
|
"z-index": 51,
|
|
1712
1739
|
placement: "right"
|
|
1713
1740
|
}, {
|
|
1714
1741
|
content: Q(() => [
|
|
1715
|
-
oe(ae(
|
|
1742
|
+
oe(ae(tt.value), 1)
|
|
1716
1743
|
]),
|
|
1717
1744
|
default: Q(() => [
|
|
1718
|
-
|
|
1745
|
+
D(i, {
|
|
1719
1746
|
disabled: "",
|
|
1720
1747
|
key: "approve key",
|
|
1721
1748
|
label: "Approve",
|
|
1722
|
-
onClick: a[5] || (a[5] = () => e.draft && $(
|
|
1749
|
+
onClick: a[5] || (a[5] = () => e.draft && $(y).approveDraft(e.draft, () => m("submitted")))
|
|
1723
1750
|
})
|
|
1724
1751
|
]),
|
|
1725
1752
|
_: 1
|
|
1726
1753
|
})) : (F(), ie(i, {
|
|
1727
1754
|
key: "approve key",
|
|
1728
1755
|
label: "Approve",
|
|
1729
|
-
onClick: a[6] || (a[6] = () => e.draft && $(
|
|
1756
|
+
onClick: a[6] || (a[6] = () => e.draft && $(y).approveDraft(e.draft, () => m("submitted")))
|
|
1730
1757
|
}))
|
|
1731
1758
|
], 64)) : ne("", !0),
|
|
1732
|
-
((
|
|
1759
|
+
((G = e.draft) == null ? void 0 : G.status) === $(ve).enum.DRAFT ? (F(), ie(i, {
|
|
1733
1760
|
key: 1,
|
|
1734
1761
|
label: "Reject",
|
|
1735
1762
|
variant: "destructive",
|
|
1736
|
-
onClick: a[7] || (a[7] = () => e.draft && $(
|
|
1763
|
+
onClick: a[7] || (a[7] = () => e.draft && $(y).rejectDraft(e.draft, () => m("submitted")))
|
|
1737
1764
|
})) : ne("", !0),
|
|
1738
|
-
(
|
|
1765
|
+
(ee = e.draft) != null && ee.approvedAt && ((pe = e.draft) == null ? void 0 : pe.status) !== $(ve).enum.COMPLETED ? (F(), ie(Ge, { key: 2 }, {
|
|
1739
1766
|
default: Q(() => [
|
|
1740
|
-
|
|
1767
|
+
D(i, {
|
|
1741
1768
|
label: "Sync",
|
|
1742
1769
|
loading: U.value,
|
|
1743
1770
|
onClick: a[8] || (a[8] = () => {
|
|
1744
|
-
e.draft && (U.value = !0, $(
|
|
1745
|
-
U.value = !1,
|
|
1771
|
+
e.draft && (U.value = !0, $(y).syncDraft(e.draft, () => {
|
|
1772
|
+
U.value = !1, m("submitted");
|
|
1746
1773
|
}));
|
|
1747
1774
|
})
|
|
1748
1775
|
}, null, 8, ["loading"])
|
|
1749
1776
|
]),
|
|
1750
1777
|
_: 1
|
|
1751
1778
|
})) : ne("", !0),
|
|
1752
|
-
|
|
1779
|
+
D(i, {
|
|
1753
1780
|
label: "Close",
|
|
1754
1781
|
variant: "tertiary",
|
|
1755
|
-
onClick: a[9] || (a[9] = (
|
|
1782
|
+
onClick: a[9] || (a[9] = (Be) => b.value = !1)
|
|
1756
1783
|
})
|
|
1757
1784
|
])
|
|
1758
1785
|
];
|
|
1759
1786
|
}),
|
|
1760
1787
|
default: Q(() => [
|
|
1761
|
-
c("div",
|
|
1788
|
+
c("div", Da, [
|
|
1762
1789
|
c("div", null, [
|
|
1763
|
-
|
|
1764
|
-
items:
|
|
1765
|
-
modelValue:
|
|
1766
|
-
"onUpdate:modelValue": a[0] || (a[0] = (C) =>
|
|
1790
|
+
D(f, {
|
|
1791
|
+
items: _e,
|
|
1792
|
+
modelValue: ke.value,
|
|
1793
|
+
"onUpdate:modelValue": a[0] || (a[0] = (C) => ke.value = C)
|
|
1767
1794
|
}, null, 8, ["modelValue"])
|
|
1768
1795
|
]),
|
|
1769
|
-
|
|
1770
|
-
|
|
1796
|
+
ke.value.value === "overview" ? (F(), E(le, { key: 0 }, [
|
|
1797
|
+
D(o, {
|
|
1771
1798
|
variant: "outlined",
|
|
1772
1799
|
class: "flex flex-col gap-8 px-12 py-16"
|
|
1773
1800
|
}, {
|
|
1774
1801
|
default: Q(() => {
|
|
1775
|
-
var C,
|
|
1802
|
+
var C, G;
|
|
1776
1803
|
return [
|
|
1777
|
-
c("div",
|
|
1804
|
+
c("div", xa, [
|
|
1778
1805
|
a[11] || (a[11] = c("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
|
|
1779
|
-
c("div",
|
|
1806
|
+
c("div", Aa, [
|
|
1780
1807
|
c("div", {
|
|
1781
|
-
class: Fe(["fm-status-badge", $(
|
|
1782
|
-
}, ae($(
|
|
1808
|
+
class: Fe(["fm-status-badge", $(Ne)(((C = l.draft) == null ? void 0 : C.status) ?? "DRAFT")])
|
|
1809
|
+
}, ae($(Le)(((G = l.draft) == null ? void 0 : G.status) ?? "")), 3)
|
|
1783
1810
|
])
|
|
1784
1811
|
]),
|
|
1785
|
-
|
|
1786
|
-
c("div",
|
|
1787
|
-
(F(!0), E(le, null,
|
|
1812
|
+
D(n),
|
|
1813
|
+
c("div", _a, [
|
|
1814
|
+
(F(!0), E(le, null, Te(Ae.value, (ee, pe) => (F(), E("div", {
|
|
1788
1815
|
class: "flex flex-col gap-4",
|
|
1789
1816
|
key: pe
|
|
1790
1817
|
}, [
|
|
1791
|
-
c("div",
|
|
1792
|
-
c("div",
|
|
1818
|
+
c("div", wa, [
|
|
1819
|
+
c("div", Sa, ae(ee.label), 1)
|
|
1793
1820
|
]),
|
|
1794
|
-
c("div",
|
|
1821
|
+
c("div", Fa, ae(ee.value), 1)
|
|
1795
1822
|
]))), 128))
|
|
1796
1823
|
])
|
|
1797
1824
|
];
|
|
1798
1825
|
}),
|
|
1799
1826
|
_: 1
|
|
1800
1827
|
}),
|
|
1801
|
-
c("div",
|
|
1802
|
-
c("div",
|
|
1828
|
+
c("div", Ca, [
|
|
1829
|
+
c("div", $a, [
|
|
1803
1830
|
a[12] || (a[12] = c("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
|
|
1804
|
-
I.value ? ne("", !0) : (F(), E("div",
|
|
1831
|
+
I.value ? ne("", !0) : (F(), E("div", Ba, [
|
|
1805
1832
|
l.draft && l.draft.status !== $(ve).enum.COMPLETED ? (F(), ie(i, {
|
|
1806
1833
|
key: 0,
|
|
1807
1834
|
label: "Refresh balance",
|
|
@@ -1810,63 +1837,78 @@ const ka = kt(
|
|
|
1810
1837
|
"text-color": "primary",
|
|
1811
1838
|
"bg-color": "transparent",
|
|
1812
1839
|
"border-color": "primary",
|
|
1813
|
-
loading:
|
|
1814
|
-
onClick:
|
|
1840
|
+
loading: M.value,
|
|
1841
|
+
onClick: te
|
|
1815
1842
|
}, null, 8, ["loading"])) : ne("", !0),
|
|
1816
|
-
|
|
1843
|
+
D(Ge, null, {
|
|
1844
|
+
default: Q(() => [
|
|
1845
|
+
D(i, {
|
|
1846
|
+
label: "Invalidate Draft Cache",
|
|
1847
|
+
"prepend-icon": "refresh",
|
|
1848
|
+
variant: "secondary",
|
|
1849
|
+
"text-color": "primary",
|
|
1850
|
+
"bg-color": "transparent",
|
|
1851
|
+
"border-color": "primary",
|
|
1852
|
+
loading: M.value,
|
|
1853
|
+
onClick: se
|
|
1854
|
+
}, null, 8, ["loading"])
|
|
1855
|
+
]),
|
|
1856
|
+
_: 1
|
|
1857
|
+
}),
|
|
1858
|
+
D(i, {
|
|
1817
1859
|
label: "Export data",
|
|
1818
1860
|
"prepend-icon": "download",
|
|
1819
1861
|
variant: "secondary",
|
|
1820
1862
|
"text-color": "primary",
|
|
1821
1863
|
"bg-color": "transparent",
|
|
1822
1864
|
"border-color": "primary",
|
|
1823
|
-
onClick: a[1] || (a[1] = (C) => l.draft ? $(
|
|
1865
|
+
onClick: a[1] || (a[1] = (C) => l.draft ? $(y).exportDraft(
|
|
1824
1866
|
l.draft,
|
|
1825
|
-
|
|
1867
|
+
k.value,
|
|
1826
1868
|
P.value
|
|
1827
1869
|
) : null)
|
|
1828
1870
|
})
|
|
1829
1871
|
]))
|
|
1830
1872
|
]),
|
|
1831
|
-
I.value ? (F(), E("div",
|
|
1873
|
+
I.value ? (F(), E("div", Ta, [
|
|
1832
1874
|
a[14] || (a[14] = c("div", { class: "h-80" }, null, -1)),
|
|
1833
|
-
c("div",
|
|
1875
|
+
c("div", ja, [
|
|
1834
1876
|
c("div", null, [
|
|
1835
|
-
|
|
1877
|
+
D(p, { size: "md" })
|
|
1836
1878
|
]),
|
|
1837
1879
|
a[13] || (a[13] = c("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
|
|
1838
1880
|
]),
|
|
1839
1881
|
a[15] || (a[15] = c("div", { class: "h-80" }, null, -1))
|
|
1840
1882
|
])) : (F(), E(le, { key: 1 }, [
|
|
1841
|
-
c("div",
|
|
1842
|
-
c("div",
|
|
1843
|
-
|
|
1883
|
+
c("div", Ia, [
|
|
1884
|
+
c("div", Ua, [
|
|
1885
|
+
D(x, {
|
|
1844
1886
|
label: "Template Item(s)",
|
|
1845
|
-
selected:
|
|
1846
|
-
onClick: a[2] || (a[2] = (C) =>
|
|
1887
|
+
selected: S.value.templateItem,
|
|
1888
|
+
onClick: a[2] || (a[2] = (C) => S.value.templateItem = !S.value.templateItem)
|
|
1847
1889
|
}, null, 8, ["selected"]),
|
|
1848
|
-
|
|
1890
|
+
D(x, {
|
|
1849
1891
|
label: "Non-template Item(s)",
|
|
1850
|
-
selected:
|
|
1851
|
-
onClick: a[3] || (a[3] = (C) =>
|
|
1892
|
+
selected: S.value.nonTemplateItem,
|
|
1893
|
+
onClick: a[3] || (a[3] = (C) => S.value.nonTemplateItem = !S.value.nonTemplateItem)
|
|
1852
1894
|
}, null, 8, ["selected"])
|
|
1853
1895
|
]),
|
|
1854
|
-
|
|
1855
|
-
modelValue:
|
|
1856
|
-
"onUpdate:modelValue": a[4] || (a[4] = (C) =>
|
|
1896
|
+
D(v, {
|
|
1897
|
+
modelValue: xe.value,
|
|
1898
|
+
"onUpdate:modelValue": a[4] || (a[4] = (C) => xe.value = C),
|
|
1857
1899
|
placeholder: "Filter items"
|
|
1858
1900
|
}, null, 8, ["modelValue"])
|
|
1859
1901
|
]),
|
|
1860
|
-
$(_).skuTags.size ? (F(), E("div",
|
|
1861
|
-
(F(!0), E(le, null,
|
|
1902
|
+
$(_).skuTags.size ? (F(), E("div", Pa, [
|
|
1903
|
+
(F(!0), E(le, null, Te($(_).skuTags.keys(), (C) => (F(), ie(x, {
|
|
1862
1904
|
key: `${C}`,
|
|
1863
1905
|
label: `${C}`,
|
|
1864
1906
|
selectable: "",
|
|
1865
|
-
selected:
|
|
1866
|
-
onClick: (
|
|
1907
|
+
selected: N[`${C}`],
|
|
1908
|
+
onClick: (G) => N[`${C}`] = !N[`${C}`]
|
|
1867
1909
|
}, {
|
|
1868
1910
|
default: Q(() => [
|
|
1869
|
-
|
|
1911
|
+
N[`${C}`] ? (F(), ie(T, {
|
|
1870
1912
|
key: 0,
|
|
1871
1913
|
name: "check",
|
|
1872
1914
|
class: "text-white",
|
|
@@ -1876,8 +1918,8 @@ const ka = kt(
|
|
|
1876
1918
|
class: Fe([
|
|
1877
1919
|
"",
|
|
1878
1920
|
{
|
|
1879
|
-
"text-white fm-typo-en-body-md-600":
|
|
1880
|
-
"text-fm-color-typo-primary fm-typo-en-body-md-400": !
|
|
1921
|
+
"text-white fm-typo-en-body-md-600": N[`${C}`],
|
|
1922
|
+
"text-fm-color-typo-primary fm-typo-en-body-md-400": !N[`${C}`]
|
|
1881
1923
|
}
|
|
1882
1924
|
])
|
|
1883
1925
|
}, ae(C), 3)
|
|
@@ -1885,85 +1927,85 @@ const ka = kt(
|
|
|
1885
1927
|
_: 2
|
|
1886
1928
|
}, 1032, ["label", "selected", "onClick"]))), 128))
|
|
1887
1929
|
])) : ne("", !0),
|
|
1888
|
-
c("div",
|
|
1930
|
+
c("div", Ra, [
|
|
1889
1931
|
c("div", {
|
|
1890
|
-
style:
|
|
1932
|
+
style: gt({ height: "600px", minWidth: `${Ue.value}px` })
|
|
1891
1933
|
}, [
|
|
1892
|
-
|
|
1893
|
-
"column-defs":
|
|
1894
|
-
"row-data":
|
|
1895
|
-
"search-value":
|
|
1934
|
+
D(j, {
|
|
1935
|
+
"column-defs": Ce.value,
|
|
1936
|
+
"row-data": $e.value,
|
|
1937
|
+
"search-value": xe.value
|
|
1896
1938
|
}, null, 8, ["column-defs", "row-data", "search-value"])
|
|
1897
1939
|
], 4)
|
|
1898
1940
|
])
|
|
1899
1941
|
], 64))
|
|
1900
1942
|
])
|
|
1901
1943
|
], 64)) : ne("", !0),
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
(F(!0), E(le, null,
|
|
1905
|
-
c("div",
|
|
1906
|
-
c("div",
|
|
1907
|
-
c("div",
|
|
1944
|
+
ke.value.value === "history" ? (F(), E("div", Ma, [
|
|
1945
|
+
we.value.length ? (F(), E("div", Na, [
|
|
1946
|
+
(F(!0), E(le, null, Te(we.value, (C, G) => (F(), E(le, { key: G }, [
|
|
1947
|
+
c("div", Ea, [
|
|
1948
|
+
c("div", za, [
|
|
1949
|
+
c("div", Ha, [
|
|
1908
1950
|
c("div", {
|
|
1909
1951
|
class: Fe([
|
|
1910
1952
|
{
|
|
1911
|
-
"bg-fm-color-primary":
|
|
1912
|
-
"bg-white":
|
|
1953
|
+
"bg-fm-color-primary": G !== 0,
|
|
1954
|
+
"bg-white": G === 0
|
|
1913
1955
|
},
|
|
1914
1956
|
"w-[2px] h-full"
|
|
1915
1957
|
])
|
|
1916
1958
|
}, null, 2)
|
|
1917
1959
|
]),
|
|
1918
1960
|
a[18] || (a[18] = c("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
|
|
1919
|
-
c("div",
|
|
1961
|
+
c("div", Oa, [
|
|
1920
1962
|
c("div", {
|
|
1921
1963
|
class: Fe([
|
|
1922
1964
|
{
|
|
1923
|
-
"bg-fm-color-primary":
|
|
1924
|
-
"bg-white":
|
|
1965
|
+
"bg-fm-color-primary": G < we.value.length - 1,
|
|
1966
|
+
"bg-white": G >= we.value.length - 1
|
|
1925
1967
|
},
|
|
1926
1968
|
"w-[2px] h-full"
|
|
1927
1969
|
])
|
|
1928
1970
|
}, null, 2)
|
|
1929
1971
|
])
|
|
1930
1972
|
]),
|
|
1931
|
-
c("div",
|
|
1932
|
-
c("div",
|
|
1933
|
-
c("div",
|
|
1973
|
+
c("div", Ya, [
|
|
1974
|
+
c("div", Ka, ae(C.header), 1),
|
|
1975
|
+
c("div", Qa, ae(C.date), 1)
|
|
1934
1976
|
])
|
|
1935
1977
|
]),
|
|
1936
|
-
c("div",
|
|
1978
|
+
c("div", qa, [
|
|
1937
1979
|
c("div", Ga, [
|
|
1938
|
-
c("div",
|
|
1980
|
+
c("div", Wa, [
|
|
1939
1981
|
c("div", {
|
|
1940
1982
|
class: Fe([
|
|
1941
1983
|
{
|
|
1942
|
-
"bg-fm-color-primary":
|
|
1943
|
-
"bg-white":
|
|
1984
|
+
"bg-fm-color-primary": G < we.value.length - 1,
|
|
1985
|
+
"bg-white": G >= we.value.length - 1
|
|
1944
1986
|
},
|
|
1945
1987
|
"w-[2px] h-full"
|
|
1946
1988
|
])
|
|
1947
1989
|
}, null, 2)
|
|
1948
1990
|
])
|
|
1949
1991
|
]),
|
|
1950
|
-
c("div",
|
|
1951
|
-
|
|
1992
|
+
c("div", Za, [
|
|
1993
|
+
D(o, {
|
|
1952
1994
|
variant: "outlined",
|
|
1953
1995
|
class: "py-12 px-16"
|
|
1954
1996
|
}, {
|
|
1955
1997
|
default: Q(() => [
|
|
1956
|
-
c("div",
|
|
1957
|
-
(F(!0), E(le, null,
|
|
1998
|
+
c("div", Ja, [
|
|
1999
|
+
(F(!0), E(le, null, Te(C.info, (ee, pe) => (F(), E("div", {
|
|
1958
2000
|
key: pe,
|
|
1959
2001
|
class: "flex flex-col gap-4"
|
|
1960
2002
|
}, [
|
|
1961
|
-
c("div",
|
|
1962
|
-
c("div",
|
|
1963
|
-
(F(!0), E(le, null,
|
|
1964
|
-
key:
|
|
2003
|
+
c("div", Xa, ae(ee == null ? void 0 : ee.label), 1),
|
|
2004
|
+
c("div", en, [
|
|
2005
|
+
(F(!0), E(le, null, Te(ee == null ? void 0 : ee.values, (Be, Pe) => (F(), E("div", {
|
|
2006
|
+
key: Pe,
|
|
1965
2007
|
class: "fm-typo-en-body-lg-600"
|
|
1966
|
-
}, ae(
|
|
2008
|
+
}, ae(Be), 1))), 128))
|
|
1967
2009
|
])
|
|
1968
2010
|
]))), 128))
|
|
1969
2011
|
])
|
|
@@ -1973,18 +2015,18 @@ const ka = kt(
|
|
|
1973
2015
|
])
|
|
1974
2016
|
])
|
|
1975
2017
|
], 64))), 128))
|
|
1976
|
-
])) : (F(), E("div",
|
|
1977
|
-
|
|
2018
|
+
])) : (F(), E("div", Va, [
|
|
2019
|
+
D(re),
|
|
1978
2020
|
c("div", null, [
|
|
1979
2021
|
c("img", {
|
|
1980
|
-
src: $(
|
|
2022
|
+
src: $(aa),
|
|
1981
2023
|
alt: "List is empty"
|
|
1982
|
-
}, null, 8,
|
|
2024
|
+
}, null, 8, La)
|
|
1983
2025
|
]),
|
|
1984
2026
|
a[16] || (a[16] = c("div", { class: "fm-typo-en-body-lg-600" }, ae("No records found"), -1)),
|
|
1985
2027
|
a[17] || (a[17] = c("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, ae("You can track approval and rejection history here"), -1)),
|
|
1986
|
-
|
|
1987
|
-
|
|
2028
|
+
D(re),
|
|
2029
|
+
D(re)
|
|
1988
2030
|
]))
|
|
1989
2031
|
])) : ne("", !0)
|
|
1990
2032
|
])
|
|
@@ -1993,16 +2035,16 @@ const ka = kt(
|
|
|
1993
2035
|
}, 8, ["model-value"]);
|
|
1994
2036
|
};
|
|
1995
2037
|
}
|
|
1996
|
-
}),
|
|
2038
|
+
}), on = { class: "flex-1 flex flex-col gap-8" }, sn = { class: "flex flex-col" }, rn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ln = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, cn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, un = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, $n = /* @__PURE__ */ He({
|
|
1997
2039
|
__name: "ClosingDraftView",
|
|
1998
2040
|
setup(r) {
|
|
1999
|
-
const { t: s } =
|
|
2000
|
-
|
|
2001
|
-
const U = L(() =>
|
|
2002
|
-
function
|
|
2041
|
+
const { t: s } = bt(), { viewDraft: e } = ze(), { viewClosingDraftProps: d, viewClosingDraftShow: h } = Yt(ze()), y = Oe(), b = ka(), I = Mt(), { breakpoints: M } = Et();
|
|
2042
|
+
y.watchLocation(b.fetchDrafts);
|
|
2043
|
+
const U = L(() => b.loading), k = Y(""), P = L(() => M.value.xs || M.value.sm), B = L(() => P.value ? 10 : 20);
|
|
2044
|
+
function q(_) {
|
|
2003
2045
|
switch (_) {
|
|
2004
2046
|
case "refresh":
|
|
2005
|
-
return
|
|
2047
|
+
return b.fetchDrafts();
|
|
2006
2048
|
}
|
|
2007
2049
|
}
|
|
2008
2050
|
function u(_) {
|
|
@@ -2022,12 +2064,12 @@ const ka = kt(
|
|
|
2022
2064
|
}
|
|
2023
2065
|
]);
|
|
2024
2066
|
return (_, R) => {
|
|
2025
|
-
const
|
|
2067
|
+
const N = z("FmTable");
|
|
2026
2068
|
return F(), E(le, null, [
|
|
2027
|
-
|
|
2069
|
+
D(Vt, {
|
|
2028
2070
|
title: $(s)("inventory.closing.draft.title"),
|
|
2029
2071
|
actions: t.value,
|
|
2030
|
-
"onClick:action":
|
|
2072
|
+
"onClick:action": q
|
|
2031
2073
|
}, {
|
|
2032
2074
|
default: Q(() => [
|
|
2033
2075
|
c("div", {
|
|
@@ -2039,58 +2081,58 @@ const ka = kt(
|
|
|
2039
2081
|
}
|
|
2040
2082
|
])
|
|
2041
2083
|
}, [
|
|
2042
|
-
|
|
2084
|
+
D(ta, {
|
|
2043
2085
|
"change-location": "",
|
|
2044
2086
|
searchable: "",
|
|
2045
|
-
search:
|
|
2046
|
-
"onUpdate:search": R[0] || (R[0] = (
|
|
2087
|
+
search: k.value,
|
|
2088
|
+
"onUpdate:search": R[0] || (R[0] = (g) => k.value = g)
|
|
2047
2089
|
}, null, 8, ["search"]),
|
|
2048
|
-
|
|
2049
|
-
style:
|
|
2050
|
-
"column-defs": $(
|
|
2051
|
-
"row-data": $(
|
|
2052
|
-
"search-value":
|
|
2090
|
+
D(N, {
|
|
2091
|
+
style: gt($(I).tableHeight),
|
|
2092
|
+
"column-defs": $(b).columnDefs,
|
|
2093
|
+
"row-data": $(b).drafts,
|
|
2094
|
+
"search-value": k.value,
|
|
2053
2095
|
loading: U.value,
|
|
2054
|
-
onRowClick: R[1] || (R[1] = (
|
|
2096
|
+
onRowClick: R[1] || (R[1] = (g) => $(e)(g.original)),
|
|
2055
2097
|
"page-size": B.value
|
|
2056
2098
|
}, {
|
|
2057
|
-
"list-row": Q((
|
|
2058
|
-
|
|
2059
|
-
row:
|
|
2060
|
-
onRowClick: (
|
|
2099
|
+
"list-row": Q((g) => [
|
|
2100
|
+
D(Xt, {
|
|
2101
|
+
row: g,
|
|
2102
|
+
onRowClick: (m) => $(e)(m)
|
|
2061
2103
|
}, {
|
|
2062
|
-
default: Q((
|
|
2063
|
-
var
|
|
2104
|
+
default: Q((m) => {
|
|
2105
|
+
var S, H, K, J, w, X, me, te, se, de, be, he, Ie, Z, Ce, Ue, xe, $e, Ae, _e;
|
|
2064
2106
|
return [
|
|
2065
|
-
c("div",
|
|
2066
|
-
c("div",
|
|
2067
|
-
c("div",
|
|
2068
|
-
|
|
2069
|
-
render: (
|
|
2070
|
-
props: (
|
|
2107
|
+
c("div", on, [
|
|
2108
|
+
c("div", sn, [
|
|
2109
|
+
c("div", rn, [
|
|
2110
|
+
D($(Me), {
|
|
2111
|
+
render: (K = (H = (S = m._id) == null ? void 0 : S.column) == null ? void 0 : H.columnDef) == null ? void 0 : K.cell,
|
|
2112
|
+
props: (w = (J = m._id) == null ? void 0 : J.getContext) == null ? void 0 : w.call(J)
|
|
2071
2113
|
}, null, 8, ["render", "props"])
|
|
2072
2114
|
]),
|
|
2073
|
-
c("div",
|
|
2074
|
-
|
|
2075
|
-
render: (
|
|
2076
|
-
props: (de = (se =
|
|
2115
|
+
c("div", ln, [
|
|
2116
|
+
D($(Me), {
|
|
2117
|
+
render: (te = (me = (X = m.name) == null ? void 0 : X.column) == null ? void 0 : me.columnDef) == null ? void 0 : te.cell,
|
|
2118
|
+
props: (de = (se = m.name) == null ? void 0 : se.getContext) == null ? void 0 : de.call(se)
|
|
2077
2119
|
}, null, 8, ["render", "props"])
|
|
2078
2120
|
]),
|
|
2079
|
-
c("div",
|
|
2080
|
-
...
|
|
2081
|
-
...
|
|
2121
|
+
c("div", cn, ae([
|
|
2122
|
+
...g.original.items.slice(0, 3).map((ke) => ke.sku.name),
|
|
2123
|
+
...g.original.items.length >= 3 ? [`and ${g.original.items.length - 3} more items`] : []
|
|
2082
2124
|
].join(", ")), 1),
|
|
2083
|
-
c("div",
|
|
2084
|
-
|
|
2085
|
-
render: (
|
|
2086
|
-
props: (
|
|
2125
|
+
c("div", un, [
|
|
2126
|
+
D($(Me), {
|
|
2127
|
+
render: (Ie = (he = (be = m.ref) == null ? void 0 : be.column) == null ? void 0 : he.columnDef) == null ? void 0 : Ie.cell,
|
|
2128
|
+
props: (Ce = (Z = m.ref) == null ? void 0 : Z.getContext) == null ? void 0 : Ce.call(Z)
|
|
2087
2129
|
}, null, 8, ["render", "props"])
|
|
2088
2130
|
])
|
|
2089
2131
|
]),
|
|
2090
2132
|
c("div", null, [
|
|
2091
|
-
|
|
2092
|
-
render: (
|
|
2093
|
-
props: (
|
|
2133
|
+
D($(Me), {
|
|
2134
|
+
render: ($e = (xe = (Ue = m.status) == null ? void 0 : Ue.column) == null ? void 0 : xe.columnDef) == null ? void 0 : $e.cell,
|
|
2135
|
+
props: (_e = (Ae = m.status) == null ? void 0 : Ae.getContext) == null ? void 0 : _e.call(Ae)
|
|
2094
2136
|
}, null, 8, ["render", "props"])
|
|
2095
2137
|
])
|
|
2096
2138
|
])
|
|
@@ -2105,12 +2147,12 @@ const ka = kt(
|
|
|
2105
2147
|
]),
|
|
2106
2148
|
_: 1
|
|
2107
2149
|
}, 8, ["title", "actions"]),
|
|
2108
|
-
(F(), ie(
|
|
2109
|
-
|
|
2110
|
-
show: $(
|
|
2111
|
-
"onUpdate:show": R[2] || (R[2] = (
|
|
2112
|
-
onSubmitted: R[3] || (R[3] = () => (
|
|
2113
|
-
onRefresh: R[4] || (R[4] = (
|
|
2150
|
+
(F(), ie(Pt, { to: "body" }, [
|
|
2151
|
+
D(nn, Rt($(d), {
|
|
2152
|
+
show: $(h),
|
|
2153
|
+
"onUpdate:show": R[2] || (R[2] = (g) => vt(h) ? h.value = g : null),
|
|
2154
|
+
onSubmitted: R[3] || (R[3] = () => (h.value = !1, $(b).fetchDrafts())),
|
|
2155
|
+
onRefresh: R[4] || (R[4] = (g) => $(b).updateDraftRef(g))
|
|
2114
2156
|
}), null, 16, ["show"])
|
|
2115
2157
|
]))
|
|
2116
2158
|
], 64);
|
|
@@ -2118,5 +2160,5 @@ const ka = kt(
|
|
|
2118
2160
|
}
|
|
2119
2161
|
});
|
|
2120
2162
|
export {
|
|
2121
|
-
|
|
2163
|
+
$n as default
|
|
2122
2164
|
};
|