@feedmepos/mf-inventory-portal 1.2.46 → 1.2.47
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-DBd4DVaZ.js → App-JsgP9iMu.js} +3 -3
- package/dist/{ApprovalView-C-XcEiMZ.js → ApprovalView-Co6sACH5.js} +5 -5
- package/dist/{BindingsDialog-CXKDYmmR.js → BindingsDialog-B73QXq1j.js} +2 -2
- package/dist/{BindingsPicker-Cq1yHJhJ.js → BindingsPicker-DuMTRelf.js} +3 -3
- package/dist/{BindingsTable-BL8DhipQ.js → BindingsTable-CcYQN1_L.js} +3 -3
- package/dist/ClosingDraftView-D3INnwT_.js +2410 -0
- package/dist/{ClosingHistoryView-BC8ZP51z.js → ClosingHistoryView-CSjxazA8.js} +3 -3
- package/dist/{ClosingTemplateView-B4jnOrpc.js → ClosingTemplateView-Ct0GFJ7D.js} +14 -14
- package/dist/{DeliveryOrderPrintPreview-Bxy5xIrP.js → DeliveryOrderPrintPreview-BS50CpKI.js} +4 -4
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-D5DApGXT.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Bi9iqGTu.js} +12 -12
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DHS5LMuy.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CRUsPKK3.js} +2 -2
- package/dist/{FmMultiselectDialog-C6OzbsWu.js → FmMultiselectDialog-B_aNaPp3.js} +2 -2
- package/dist/{FmMultiselectDialog-C7DVf8cL.js → FmMultiselectDialog-CaUUBqDA.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BtN3UL40.js → FmUnitInput.vue_vue_type_script_setup_true_lang-CQqGUFIx.js} +3 -3
- package/dist/{ImportView-BhmfI7Am.js → ImportView-KjHa3RPH.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BXSO5UKK.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BBaVY_DM.js} +1 -1
- package/dist/{IngredientGroupView-DfAt-7Fz.js → IngredientGroupView-DPM9zcrM.js} +5 -5
- package/dist/{IngredientsView-4MNLuMhd.js → IngredientsView-DJGeVNXg.js} +916 -910
- package/dist/{IntegrationView-CvgAJIaG.js → IntegrationView-C1-xqYQI.js} +12 -12
- package/dist/{InventoryBindingForm-CQB1X3d5.js → InventoryBindingForm-B57y7_jC.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-Sebvr-gm.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CHTnMNKl.js} +4 -4
- package/dist/{InventoryBindingSummary-_-dkvb4N.js → InventoryBindingSummary-Df70IKSg.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BGsjKOls.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DWe54YRe.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-D9goSrss.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BgCCrM-_.js} +2 -2
- package/dist/{PublishView-BFdsGmRf.js → PublishView-C5YHhPwg.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-DpaV5GjO.js → PurchaseOrderPrintPreview-BjopVTxs.js} +10 -10
- package/dist/{ReceiveRequestView-DNimgIgR.js → ReceiveRequestView-huk0yTuo.js} +896 -889
- package/dist/{RecipeView-D8CH2rJC.js → RecipeView-B2jYchFP.js} +8 -8
- package/dist/StockView-BhttACCV.js +2497 -0
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Bb-yJBxo.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DvviBt_n.js} +1 -1
- package/dist/{SupplierView-Bl0JNI44.js → SupplierView-6Vxxq9GN.js} +11 -11
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-C-VmXiM3.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-C_nItuSz.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DqmlOtC4.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Den4pUf9.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-D-4LyU74.js → TransferDetails.vue_vue_type_script_setup_true_lang-CmI0k0v2.js} +99 -99
- package/dist/{TransferTemplateView-COJEXmF0.js → TransferTemplateView-_WTnebCR.js} +412 -412
- package/dist/{UnitView-ecUANF8x.js → UnitView-BeP9MpmK.js} +6 -6
- package/dist/{WarehouseView-DZ9OCali.js → WarehouseView-pdM7HFYr.js} +5 -5
- package/dist/{WastageTemplateView-DXu5bayJ.js → WastageTemplateView-a4twoJLB.js} +14 -14
- package/dist/api/inventory.d.ts +10 -10
- package/dist/api/stock.d.ts +1 -0
- package/dist/{app-aLZoWUfQ.js → app-D-WXtKYn.js} +4623 -5097
- package/dist/app.d.ts +176 -834
- package/dist/app.js +1 -1
- package/dist/{closing-template-D-cf9Vnu.js → closing-template-O7lUhol7.js} +1 -1
- package/dist/{date2-DluMG3-3.js → date2-DkEAKP8N.js} +1 -1
- package/dist/{dayjs.min-UuQWuDkU.js → dayjs.min-DF1VUh0Q.js} +13 -13
- package/dist/{decimal-B2f58cUQ.js → decimal-CL_qgPqL.js} +2 -2
- package/dist/{defineDeepModel-DUvW0g9M.js → defineDeepModel-xcAkDmDA.js} +1 -1
- package/dist/{duplicate-template-BiGYHuPK.js → duplicate-template-TY54cIdK.js} +1 -1
- package/dist/{feature-B-rekKRC.js → feature-Dw3PJCX9.js} +2 -2
- package/dist/{format-time-from-id-CMm14GBq.js → format-time-from-id-Ceptcl3U.js} +1 -1
- package/dist/{format-unit-display-DeHfXVX_.js → format-unit-display-GRZQIgFD.js} +10 -10
- package/dist/{import-export.helper-rXmKqRlR.js → import-export.helper-Bl-r_RxV.js} +5 -5
- package/dist/{index-DGs4MBmv.js → index-CEbidibW.js} +3 -3
- package/dist/{index-CYdIQDVa.js → index-D-_4dS91.js} +1 -1
- package/dist/{index-CEK6OlSE.js → index-Dgk8_4hY.js} +1 -1
- package/dist/{lodash-DO8ShgBV.js → lodash-efdnV3n2.js} +1 -1
- package/dist/{netsuite-NShFW2SJ.js → netsuite-D4yOOSrW.js} +3 -3
- package/dist/{purchase-order-template-COeJz9vK.js → purchase-order-template-Dvs3YVVH.js} +1 -1
- package/dist/{rules-C_U2Ahtv.js → rules-BsrasJ6a.js} +3 -3
- package/dist/{stock-B9KGLNAt.js → stock-BITU59fq.js} +3 -3
- package/dist/{stock-DdZuie8e.js → stock-D0WV9zWp.js} +7 -1
- package/dist/stores/inventory.d.ts +13 -13
- package/dist/stores/stock.d.ts +5 -5
- package/dist/stores/supplier.d.ts +24 -24
- package/dist/{supplier-BCfa74hz.js → supplier-DSUvpEyd.js} +2 -2
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-CoAP08vZ.js → use-ingredient-select-dialog-CNpU0tfI.js} +2 -2
- package/dist/{use-inventory-binding-dialog-BPXhlhVD.js → use-inventory-binding-dialog-D7s2C-xQ.js} +2 -2
- package/dist/{use-template-enabled-locations-2-CYfkmGP5.js → use-template-enabled-locations-2-bflR8fp7.js} +2 -2
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftApprovalDialog.vue.d.ts +29 -0
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +20 -20
- package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +3 -3
- package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +60 -60
- package/dist/views/ingredient-group/components/ingredient-group-rule-field/IngredientGroupRuleField.vue.d.ts +2 -2
- package/dist/views/ingredient-group/composables/use-ingredient-group-rule-item.d.ts +1 -1
- package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +6 -6
- package/dist/views/integration/components/netsuite/business/AddVendorDialog.vue.d.ts +12 -12
- package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +2 -2
- package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +2 -2
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +12 -12
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +14 -14
- package/dist/views/stock/components/StockRecordCard.vue.d.ts +29 -6
- package/dist/views/supplier/components/SupplierForm.vue.d.ts +2 -2
- package/dist/views/supplier/components/SupplierSupplyItemField.vue.d.ts +2 -2
- package/dist/views/supplier/composables/use-supplier-table.d.ts +1 -1
- package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +2 -2
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +4 -4
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +12 -12
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +12 -12
- package/dist/{vue-i18n-Cn8L1Fah.js → vue-i18n-j0rHGXSn.js} +301 -301
- package/dist/{xlsx-jqtV3ziP.js → xlsx-CgB84NXq.js} +398 -398
- package/dist/{xlsx.util-BBey-FqO.js → xlsx.util-DeZhqfVV.js} +1 -1
- package/package.json +1 -1
- package/dist/ClosingDraftView-nwQQl4U1.js +0 -2164
- package/dist/StockView-cXMeYZEU.js +0 -2407
|
@@ -1,2164 +0,0 @@
|
|
|
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-aLZoWUfQ.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-DluMG3-3.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-C_U2Ahtv.js";
|
|
9
|
-
import { b as Wt, d as Zt } from "./xlsx.util-BBey-FqO.js";
|
|
10
|
-
import { u as wt } from "./stock-B9KGLNAt.js";
|
|
11
|
-
import { u as et } from "./stock-DdZuie8e.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-CMm14GBq.js";
|
|
15
|
-
import { _ as ta } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DHS5LMuy.js";
|
|
16
|
-
import { E as aa } from "./empty-placeholder-wf6-BWE8.js";
|
|
17
|
-
const Ye = zt((r, s) => {
|
|
18
|
-
function e() {
|
|
19
|
-
return Oe().currentLocation.dbName;
|
|
20
|
-
}
|
|
21
|
-
return {
|
|
22
|
-
async getDraft(d) {
|
|
23
|
-
const h = e(), y = `${r.inventoryBackendUrl}/${h}/closing-draft/${d}`;
|
|
24
|
-
return s.get(y);
|
|
25
|
-
},
|
|
26
|
-
async readDrafts() {
|
|
27
|
-
const d = e(), h = `${r.inventoryBackendUrl}/${d}/closing-draft`;
|
|
28
|
-
return s.get(h);
|
|
29
|
-
},
|
|
30
|
-
async runOperation(d) {
|
|
31
|
-
const h = e(), y = `${r.inventoryBackendUrl}/${h}/closing-draft/run-operation`;
|
|
32
|
-
return s.post(y, d);
|
|
33
|
-
},
|
|
34
|
-
async runOperationV1(d) {
|
|
35
|
-
const h = e(), y = `${r.inventoryBackendUrl}/${h}/closing-draft/v1/run-operation`;
|
|
36
|
-
return s.post(y, d);
|
|
37
|
-
},
|
|
38
|
-
async sync(d) {
|
|
39
|
-
const h = e(), y = `${r.inventoryBackendUrl}/${h}/closing-draft/sync`;
|
|
40
|
-
return s.post(y, d);
|
|
41
|
-
},
|
|
42
|
-
async cloneDraft(d) {
|
|
43
|
-
const h = e(), y = `${r.inventoryBackendUrl}/${h}/closing-draft/${d}/clone`;
|
|
44
|
-
return s.post(y, {});
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
}), na = { class: "fm-typo-en-body-lg-400" }, oa = { class: "fm-typo-en-body-lg-600" }, sa = {
|
|
48
|
-
key: 0,
|
|
49
|
-
class: "flex flex-col"
|
|
50
|
-
}, ra = {
|
|
51
|
-
key: 0,
|
|
52
|
-
class: "fm-typo-en-body-sm-400 text-fm-color-typo-error mt-4"
|
|
53
|
-
}, la = { class: "flex gap-12 py-8 justify-end w-full" }, qe = /* @__PURE__ */ He({
|
|
54
|
-
__name: "ClosingDraftAction",
|
|
55
|
-
props: {
|
|
56
|
-
draft: {},
|
|
57
|
-
action: {},
|
|
58
|
-
onCancel: { type: Function },
|
|
59
|
-
onFinished: { type: Function }
|
|
60
|
-
},
|
|
61
|
-
setup(r) {
|
|
62
|
-
const s = r, e = Y(), d = Ye(), h = Je(), y = Y(!1), b = Y(null), I = Y(!1), M = L(() => {
|
|
63
|
-
switch (s.action) {
|
|
64
|
-
case O.enum.approveDraft:
|
|
65
|
-
return "Approve";
|
|
66
|
-
case O.enum.rejectDraft:
|
|
67
|
-
return "Reject";
|
|
68
|
-
case O.enum.markAsFailed:
|
|
69
|
-
return "Mark as Failed";
|
|
70
|
-
}
|
|
71
|
-
throw new Error(`Unknown action: ${s.action}`);
|
|
72
|
-
}), U = L(() => {
|
|
73
|
-
switch (s.action) {
|
|
74
|
-
case O.enum.approveDraft:
|
|
75
|
-
return "primary";
|
|
76
|
-
case O.enum.rejectDraft:
|
|
77
|
-
return "destructive";
|
|
78
|
-
case O.enum.markAsFailed:
|
|
79
|
-
return "destructive";
|
|
80
|
-
}
|
|
81
|
-
throw new Error(`Unknown action: ${s.action}`);
|
|
82
|
-
});
|
|
83
|
-
Ze(() => {
|
|
84
|
-
if (s.draft.effectiveAt)
|
|
85
|
-
b.value = new Date(s.draft.effectiveAt);
|
|
86
|
-
else {
|
|
87
|
-
const u = new Date(s.draft.createdAt);
|
|
88
|
-
u.setHours(23, 59, 59, 999), b.value = u;
|
|
89
|
-
}
|
|
90
|
-
I.value = !0;
|
|
91
|
-
});
|
|
92
|
-
const k = L({
|
|
93
|
-
get() {
|
|
94
|
-
return b.value === null ? "" : Ee(b.value);
|
|
95
|
-
},
|
|
96
|
-
set(u) {
|
|
97
|
-
if (u) {
|
|
98
|
-
const t = /* @__PURE__ */ new Date(`${u} ${P.value}`);
|
|
99
|
-
t.setSeconds(59, 999), b.value = t;
|
|
100
|
-
} else
|
|
101
|
-
b.value = null;
|
|
102
|
-
}
|
|
103
|
-
}), P = L({
|
|
104
|
-
get() {
|
|
105
|
-
return b.value === null ? "" : Dt(b.value);
|
|
106
|
-
},
|
|
107
|
-
set(u) {
|
|
108
|
-
if (u) {
|
|
109
|
-
const t = /* @__PURE__ */ new Date(`${k.value} ${u}`);
|
|
110
|
-
t.setSeconds(59, 999), b.value = t;
|
|
111
|
-
} else
|
|
112
|
-
b.value = null;
|
|
113
|
-
}
|
|
114
|
-
}), B = L(() => b.value ? b.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
|
|
115
|
-
async function q(u) {
|
|
116
|
-
y.value = !0;
|
|
117
|
-
try {
|
|
118
|
-
u ? await d.runOperationV1({
|
|
119
|
-
_id: s.draft._id,
|
|
120
|
-
_rev: s.draft._rev ?? "",
|
|
121
|
-
action: s.action,
|
|
122
|
-
data: {
|
|
123
|
-
effectiveAt: b.value ? b.value.toISOString() : null,
|
|
124
|
-
remark: e.value
|
|
125
|
-
}
|
|
126
|
-
}).delayed(500) : await d.runOperation({
|
|
127
|
-
_id: s.draft._id,
|
|
128
|
-
_rev: s.draft._rev ?? "",
|
|
129
|
-
action: s.action,
|
|
130
|
-
data: {
|
|
131
|
-
effectiveAt: b.value ? b.value.toISOString() : null,
|
|
132
|
-
remark: e.value
|
|
133
|
-
}
|
|
134
|
-
}).delayed(500), h.open({
|
|
135
|
-
title: "Success",
|
|
136
|
-
message: "Action submitted",
|
|
137
|
-
type: "success"
|
|
138
|
-
}), s.onFinished();
|
|
139
|
-
} catch (t) {
|
|
140
|
-
h.open({
|
|
141
|
-
title: "Something went wrong",
|
|
142
|
-
message: (t == null ? void 0 : t.message) ?? "Unable to submit action. Please try again",
|
|
143
|
-
type: "error"
|
|
144
|
-
}), console.error("error on submit closing draft action", t);
|
|
145
|
-
} finally {
|
|
146
|
-
y.value = !1;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return (u, t) => {
|
|
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
|
-
key: 1,
|
|
153
|
-
onValidationSuccess: q,
|
|
154
|
-
class: "flex flex-col gap-32",
|
|
155
|
-
disabled: y.value
|
|
156
|
-
}, {
|
|
157
|
-
default: Q(() => [
|
|
158
|
-
c("div", na, [
|
|
159
|
-
t[5] || (t[5] = oe(" You are about to ")),
|
|
160
|
-
c("span", oa, ae(M.value), 1),
|
|
161
|
-
t[6] || (t[6] = oe(" this draft. Please provide a remark to justify this action. "))
|
|
162
|
-
]),
|
|
163
|
-
u.action === $(O).enum.approveDraft ? (F(), E("div", sa, [
|
|
164
|
-
D(_, { class: "fm-typo-en-body-lg-600" }, {
|
|
165
|
-
default: Q(() => t[7] || (t[7] = [
|
|
166
|
-
oe("Closing Date")
|
|
167
|
-
])),
|
|
168
|
-
_: 1
|
|
169
|
-
}),
|
|
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
|
-
}, null, 8, ["modelValue", "max"]),
|
|
175
|
-
D(_, { class: "fm-typo-en-body-lg-600" }, {
|
|
176
|
-
default: Q(() => t[8] || (t[8] = [
|
|
177
|
-
oe("Closing Time")
|
|
178
|
-
])),
|
|
179
|
-
_: 1
|
|
180
|
-
}),
|
|
181
|
-
D(N, {
|
|
182
|
-
modelValue: P.value,
|
|
183
|
-
"onUpdate:modelValue": t[1] || (t[1] = (H) => P.value = H)
|
|
184
|
-
}, null, 8, ["modelValue"]),
|
|
185
|
-
B.value ? (F(), E("div", ra, " Cannot select future date ")) : ne("", !0)
|
|
186
|
-
])) : ne("", !0),
|
|
187
|
-
D(g, {
|
|
188
|
-
modelValue: e.value,
|
|
189
|
-
"onUpdate:modelValue": t[2] || (t[2] = (H) => e.value = H),
|
|
190
|
-
label: "Remark",
|
|
191
|
-
"label-mark": "required",
|
|
192
|
-
rules: [$(Qt)()]
|
|
193
|
-
}, null, 8, ["modelValue", "rules"]),
|
|
194
|
-
c("div", la, [
|
|
195
|
-
D(m, {
|
|
196
|
-
label: "Cancel",
|
|
197
|
-
variant: "tertiary",
|
|
198
|
-
onClick: t[3] || (t[3] = (H) => u.onCancel())
|
|
199
|
-
}),
|
|
200
|
-
u.action === $(O).enum.approveDraft ? (F(), ie(Ge, { key: 0 }, {
|
|
201
|
-
default: Q(() => [
|
|
202
|
-
D(m, {
|
|
203
|
-
label: "Approve (Legacy)",
|
|
204
|
-
type: "button",
|
|
205
|
-
onClick: t[4] || (t[4] = (H) => q(!0)),
|
|
206
|
-
variant: U.value,
|
|
207
|
-
loading: y.value,
|
|
208
|
-
disabled: B.value
|
|
209
|
-
}, null, 8, ["variant", "loading", "disabled"])
|
|
210
|
-
]),
|
|
211
|
-
_: 1
|
|
212
|
-
})) : ne("", !0),
|
|
213
|
-
D(m, {
|
|
214
|
-
label: M.value,
|
|
215
|
-
type: "submit",
|
|
216
|
-
variant: U.value,
|
|
217
|
-
loading: y.value
|
|
218
|
-
}, null, 8, ["label", "variant", "loading"])
|
|
219
|
-
])
|
|
220
|
-
]),
|
|
221
|
-
_: 1
|
|
222
|
-
}, 8, ["disabled"])) : (F(), E(le, { key: 0 }, [
|
|
223
|
-
oe("Loading")
|
|
224
|
-
], 64));
|
|
225
|
-
};
|
|
226
|
-
}
|
|
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
|
-
}
|
|
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
|
-
...s,
|
|
241
|
-
amount: Math.abs(s.amount)
|
|
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
|
-
amount: 1,
|
|
244
|
-
precision: 0
|
|
245
|
-
}, u = Number(
|
|
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
|
-
return {
|
|
249
|
-
code: r.sku.code,
|
|
250
|
-
name: r.sku.name,
|
|
251
|
-
baseUnit: r.sku.unit.abbrev,
|
|
252
|
-
costUnit: ((me = (X = r.sku.defaultCost) == null ? void 0 : X.measurement) == null ? void 0 : me.abbrev) ?? null,
|
|
253
|
-
baseUnitAmount: Number(V.toFormatString({ value: r.baseAmount })),
|
|
254
|
-
...r.measurementsAmounts.filter(
|
|
255
|
-
(te) => da(te.measurement) && e.includes(te.measurement.id)
|
|
256
|
-
).reduce(
|
|
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
|
-
{}
|
|
259
|
-
),
|
|
260
|
-
systemBalance: _,
|
|
261
|
-
physicalBalance: R,
|
|
262
|
-
adjustedAmount: Number(V.toFormatString({ value: M })),
|
|
263
|
-
adjustedDiffPercentage: k ? Number(
|
|
264
|
-
V.toFormatString({
|
|
265
|
-
value: _t(k, 2)
|
|
266
|
-
})
|
|
267
|
-
) : null,
|
|
268
|
-
costPerUnit: B,
|
|
269
|
-
opening: t,
|
|
270
|
-
adjustmentTypes: y ?? Ft,
|
|
271
|
-
varianceQty: N,
|
|
272
|
-
varianceInCost: g,
|
|
273
|
-
stockTakeValue: m,
|
|
274
|
-
systemValue: S
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
function da(r) {
|
|
278
|
-
return !r.abbrev.toLocaleLowerCase().includes("inactive");
|
|
279
|
-
}
|
|
280
|
-
function fa(r) {
|
|
281
|
-
const s = Ct(r);
|
|
282
|
-
return r.reduce(
|
|
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
|
-
},
|
|
287
|
-
0
|
|
288
|
-
);
|
|
289
|
-
}
|
|
290
|
-
function Ct(r) {
|
|
291
|
-
return r.groupBy(
|
|
292
|
-
(s) => s.sku._id,
|
|
293
|
-
(s) => s.measurementsAmounts.filter((e) => !e.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((e) => e.measurement.id)
|
|
294
|
-
);
|
|
295
|
-
}
|
|
296
|
-
function pa(r) {
|
|
297
|
-
const s = ht(), e = s === "MYR" ? "RM" : s;
|
|
298
|
-
return [
|
|
299
|
-
{
|
|
300
|
-
id: "code",
|
|
301
|
-
name: "Code"
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
id: "name",
|
|
305
|
-
name: "Name"
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
id: "baseUnit",
|
|
309
|
-
name: "Base unit"
|
|
310
|
-
},
|
|
311
|
-
{
|
|
312
|
-
id: "costPerUnit",
|
|
313
|
-
name: "Cost per unit"
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
id: "costUnit",
|
|
317
|
-
name: "UOM"
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
id: "opening",
|
|
321
|
-
name: "Opening (B/F)"
|
|
322
|
-
},
|
|
323
|
-
{
|
|
324
|
-
id: "adjustmentTypes",
|
|
325
|
-
name: "Type"
|
|
326
|
-
},
|
|
327
|
-
{
|
|
328
|
-
id: "varianceQty",
|
|
329
|
-
name: "Variance (Qty)"
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
id: "varianceInCost",
|
|
333
|
-
name: `Variance (${e})`
|
|
334
|
-
},
|
|
335
|
-
{
|
|
336
|
-
id: "physicalBalance",
|
|
337
|
-
name: "Stock take (Qty)"
|
|
338
|
-
},
|
|
339
|
-
{
|
|
340
|
-
id: "systemBalance",
|
|
341
|
-
name: "System balance (Qty)"
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
id: "stockTakeValue",
|
|
345
|
-
name: `Stock take value (${e})`
|
|
346
|
-
},
|
|
347
|
-
{
|
|
348
|
-
id: "systemValue",
|
|
349
|
-
name: `System value (${e})`
|
|
350
|
-
},
|
|
351
|
-
{
|
|
352
|
-
id: "adjustedAmount",
|
|
353
|
-
name: "Adjusted balance"
|
|
354
|
-
},
|
|
355
|
-
{
|
|
356
|
-
id: "adjustedDiffPercentage",
|
|
357
|
-
name: "Diff (%)"
|
|
358
|
-
},
|
|
359
|
-
{
|
|
360
|
-
id: "baseUnitAmount",
|
|
361
|
-
name: "Base unit amount"
|
|
362
|
-
},
|
|
363
|
-
...Array.from({ length: r }).flatMap((h, y) => [
|
|
364
|
-
{
|
|
365
|
-
id: `measurementAmount${y}`,
|
|
366
|
-
name: `UOM amount ${y + 1}`
|
|
367
|
-
},
|
|
368
|
-
{
|
|
369
|
-
id: `measurementAbbrev${y}`,
|
|
370
|
-
name: `UOM ${y + 1}`
|
|
371
|
-
}
|
|
372
|
-
])
|
|
373
|
-
];
|
|
374
|
-
}
|
|
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
|
-
if (r.opening)
|
|
385
|
-
for (const w of r.opening)
|
|
386
|
-
y.set(w.skuId, w.balance);
|
|
387
|
-
const b = /* @__PURE__ */ new Map();
|
|
388
|
-
if (r.adjustmentSnapshot)
|
|
389
|
-
for (const w of r.adjustmentSnapshot) {
|
|
390
|
-
const X = Object.keys(w.adjustmentsByType).join(", ");
|
|
391
|
-
b.set(w.skuId, X || Ft);
|
|
392
|
-
}
|
|
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
|
-
X,
|
|
399
|
-
me,
|
|
400
|
-
(he = h.get(w.sku._id)) == null ? void 0 : he[0],
|
|
401
|
-
te,
|
|
402
|
-
se
|
|
403
|
-
);
|
|
404
|
-
}), k = fa(I), B = yt().currentBusiness.value, q = pa(k), u = [
|
|
405
|
-
["Business name:", B == null ? void 0 : B.name],
|
|
406
|
-
["Business ID:", B == null ? void 0 : B._id],
|
|
407
|
-
["Menu version", B == null ? void 0 : B.menuVersion],
|
|
408
|
-
["Created at", new Date(r.createdAt)],
|
|
409
|
-
["Created by", (N = r.createdBy) == null ? void 0 : N.name],
|
|
410
|
-
["Updated at", new Date(r.updatedAt)],
|
|
411
|
-
["Updated by", (g = r.updatedBy) == null ? void 0 : g.name],
|
|
412
|
-
["Recent action", r.approvedAt ? "Approve" : r.rejectionHistory ? "Reject" : ""],
|
|
413
|
-
[
|
|
414
|
-
"Action by",
|
|
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
|
-
],
|
|
417
|
-
[
|
|
418
|
-
"Action at",
|
|
419
|
-
r.approvedAt ? new Date(r.approvedAt) : r.rejectionHistory ? new Date((K = r.rejectionHistory[0]) == null ? void 0 : K.rejectedAt) : ""
|
|
420
|
-
],
|
|
421
|
-
[
|
|
422
|
-
"Action remark",
|
|
423
|
-
r.approvedAt ? r.approveRemark : r.rejectionHistory ? new Date((J = r.rejectionHistory[0]) == null ? void 0 : J.rejectRemark) : ""
|
|
424
|
-
],
|
|
425
|
-
[],
|
|
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
|
-
}
|
|
431
|
-
const ga = { class: "flex flex-col" }, ya = {
|
|
432
|
-
key: 0,
|
|
433
|
-
class: "fm-typo-en-body-sm-400 text-fm-color-typo-error mt-4"
|
|
434
|
-
}, ba = { class: "flex gap-12 py-8 justify-end w-full" }, ha = /* @__PURE__ */ He({
|
|
435
|
-
__name: "RefreshBalanceAction",
|
|
436
|
-
props: {
|
|
437
|
-
draft: {},
|
|
438
|
-
onCancel: { type: Function },
|
|
439
|
-
onFinished: { type: Function }
|
|
440
|
-
},
|
|
441
|
-
setup(r) {
|
|
442
|
-
const s = r;
|
|
443
|
-
et();
|
|
444
|
-
const e = Y(!1), d = Y(null), h = Y(!1);
|
|
445
|
-
Ze(() => {
|
|
446
|
-
if (s.draft.effectiveAt)
|
|
447
|
-
d.value = new Date(s.draft.effectiveAt);
|
|
448
|
-
else {
|
|
449
|
-
const U = new Date(s.draft.createdAt);
|
|
450
|
-
U.setHours(23, 59, 59, 999), d.value = U;
|
|
451
|
-
}
|
|
452
|
-
h.value = !0;
|
|
453
|
-
});
|
|
454
|
-
const y = L({
|
|
455
|
-
get() {
|
|
456
|
-
return d.value === null ? "" : Ee(d.value);
|
|
457
|
-
},
|
|
458
|
-
set(U) {
|
|
459
|
-
if (U) {
|
|
460
|
-
const k = /* @__PURE__ */ new Date(`${U} ${b.value}`);
|
|
461
|
-
k.setSeconds(59, 999), d.value = k;
|
|
462
|
-
} else
|
|
463
|
-
d.value = null;
|
|
464
|
-
}
|
|
465
|
-
}), b = L({
|
|
466
|
-
get() {
|
|
467
|
-
return d.value === null ? "" : Dt(d.value);
|
|
468
|
-
},
|
|
469
|
-
set(U) {
|
|
470
|
-
if (U) {
|
|
471
|
-
const k = /* @__PURE__ */ new Date(`${y.value} ${U}`);
|
|
472
|
-
k.setSeconds(59, 999), d.value = k;
|
|
473
|
-
} else
|
|
474
|
-
d.value = null;
|
|
475
|
-
}
|
|
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
|
-
}
|
|
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
|
-
key: 1,
|
|
484
|
-
onValidationSuccess: M,
|
|
485
|
-
class: "flex flex-col gap-32",
|
|
486
|
-
disabled: e.value
|
|
487
|
-
}, {
|
|
488
|
-
default: Q(() => [
|
|
489
|
-
k[5] || (k[5] = c("div", { class: "fm-typo-en-body-lg-400" }, [
|
|
490
|
-
c("p", null, [
|
|
491
|
-
oe(" Performing "),
|
|
492
|
-
c("span", { class: "fm-typo-en-body-lg-600" }, '"Refresh Balance"'),
|
|
493
|
-
oe(" until closing effective date and time. ")
|
|
494
|
-
]),
|
|
495
|
-
c("p", { class: "mt-2" }, [
|
|
496
|
-
oe(" Please note that this action will "),
|
|
497
|
-
c("b", null, "update"),
|
|
498
|
-
oe(" the effective date and time. ")
|
|
499
|
-
])
|
|
500
|
-
], -1)),
|
|
501
|
-
c("div", ga, [
|
|
502
|
-
D(P, { class: "fm-typo-en-body-lg-600" }, {
|
|
503
|
-
default: Q(() => k[3] || (k[3] = [
|
|
504
|
-
oe("Closing Date")
|
|
505
|
-
])),
|
|
506
|
-
_: 1
|
|
507
|
-
}),
|
|
508
|
-
D(B, {
|
|
509
|
-
modelValue: y.value,
|
|
510
|
-
"onUpdate:modelValue": k[0] || (k[0] = (_) => y.value = _),
|
|
511
|
-
max: $(Ee)(/* @__PURE__ */ new Date())
|
|
512
|
-
}, null, 8, ["modelValue", "max"]),
|
|
513
|
-
D(P, { class: "fm-typo-en-body-lg-600" }, {
|
|
514
|
-
default: Q(() => k[4] || (k[4] = [
|
|
515
|
-
oe("Closing Time")
|
|
516
|
-
])),
|
|
517
|
-
_: 1
|
|
518
|
-
}),
|
|
519
|
-
D(q, {
|
|
520
|
-
modelValue: b.value,
|
|
521
|
-
"onUpdate:modelValue": k[1] || (k[1] = (_) => b.value = _)
|
|
522
|
-
}, null, 8, ["modelValue"]),
|
|
523
|
-
I.value ? (F(), E("div", ya, " Cannot select future date ")) : ne("", !0)
|
|
524
|
-
]),
|
|
525
|
-
c("div", ba, [
|
|
526
|
-
D(u, {
|
|
527
|
-
label: "Cancel",
|
|
528
|
-
variant: "tertiary",
|
|
529
|
-
onClick: k[2] || (k[2] = (_) => U.onCancel())
|
|
530
|
-
}),
|
|
531
|
-
D(u, {
|
|
532
|
-
label: "Refresh balance",
|
|
533
|
-
type: "submit",
|
|
534
|
-
variant: "primary",
|
|
535
|
-
loading: e.value,
|
|
536
|
-
disabled: I.value
|
|
537
|
-
}, null, 8, ["loading", "disabled"])
|
|
538
|
-
])
|
|
539
|
-
]),
|
|
540
|
-
_: 1
|
|
541
|
-
}, 8, ["disabled"])) : (F(), E(le, { key: 0 }, [
|
|
542
|
-
oe("Loading")
|
|
543
|
-
], 64));
|
|
544
|
-
};
|
|
545
|
-
}
|
|
546
|
-
}), ze = kt(
|
|
547
|
-
"closingDraftActions",
|
|
548
|
-
function() {
|
|
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
|
-
};
|
|
554
|
-
I.value = m, b.value = !0;
|
|
555
|
-
}
|
|
556
|
-
async function U(g) {
|
|
557
|
-
var S;
|
|
558
|
-
if (g.status === ve.enum.COMPLETED) {
|
|
559
|
-
const H = g.closingAdjustmentId;
|
|
560
|
-
if (!H)
|
|
561
|
-
return e.open({
|
|
562
|
-
title: "Something went wrong",
|
|
563
|
-
message: "Closing draft is completed but closing document cannot be found.",
|
|
564
|
-
type: "error"
|
|
565
|
-
}), console.error("Closing draft is completed but closing document cannot be found.", {
|
|
566
|
-
draftId: g._id
|
|
567
|
-
}), [];
|
|
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
|
-
}));
|
|
574
|
-
} else
|
|
575
|
-
return await y.readStockBalance(), ((S = y.stockBalance) == null ? void 0 : S.skus) ?? [];
|
|
576
|
-
}
|
|
577
|
-
async function k(g, m, S) {
|
|
578
|
-
m || (e.open({
|
|
579
|
-
title: "Exporting",
|
|
580
|
-
message: "Fetching data..."
|
|
581
|
-
}), m = await U(g)), va(g, m, S ?? []);
|
|
582
|
-
}
|
|
583
|
-
function P(g, m) {
|
|
584
|
-
s.open({
|
|
585
|
-
title: "Approve draft",
|
|
586
|
-
contentComponent: qe,
|
|
587
|
-
contentComponentProps: {
|
|
588
|
-
draft: g,
|
|
589
|
-
action: O.enum.approveDraft,
|
|
590
|
-
onFinished: () => {
|
|
591
|
-
s.close(), m == null || m();
|
|
592
|
-
},
|
|
593
|
-
onCancel: () => s.close()
|
|
594
|
-
}
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
function B(g, m) {
|
|
598
|
-
s.open({
|
|
599
|
-
title: "Reject draft",
|
|
600
|
-
contentComponent: qe,
|
|
601
|
-
contentComponentProps: {
|
|
602
|
-
draft: g,
|
|
603
|
-
action: O.enum.rejectDraft,
|
|
604
|
-
onFinished: () => {
|
|
605
|
-
s.close(), m == null || m();
|
|
606
|
-
},
|
|
607
|
-
onCancel: () => s.close()
|
|
608
|
-
}
|
|
609
|
-
});
|
|
610
|
-
}
|
|
611
|
-
function q(g, m) {
|
|
612
|
-
s.open({
|
|
613
|
-
title: "Mark draft as failed",
|
|
614
|
-
contentComponent: qe,
|
|
615
|
-
contentComponentProps: {
|
|
616
|
-
draft: g,
|
|
617
|
-
action: O.enum.markAsFailed,
|
|
618
|
-
onFinished: () => {
|
|
619
|
-
s.close(), m == null || m();
|
|
620
|
-
},
|
|
621
|
-
onCancel: () => s.close()
|
|
622
|
-
}
|
|
623
|
-
});
|
|
624
|
-
}
|
|
625
|
-
async function u(g, m) {
|
|
626
|
-
await h.sync({
|
|
627
|
-
_id: g._id,
|
|
628
|
-
_rev: g._rev ?? "",
|
|
629
|
-
action: O.enum.approveDraft,
|
|
630
|
-
data: {
|
|
631
|
-
remark: g.remark ?? ""
|
|
632
|
-
}
|
|
633
|
-
}).delayed(500), e.open({
|
|
634
|
-
title: "Success",
|
|
635
|
-
message: "Sync requested",
|
|
636
|
-
type: "success"
|
|
637
|
-
}), m == null || m();
|
|
638
|
-
}
|
|
639
|
-
function t() {
|
|
640
|
-
b.value = !1;
|
|
641
|
-
}
|
|
642
|
-
async function _(g, m, S) {
|
|
643
|
-
await s.open({
|
|
644
|
-
title: "Refresh balance",
|
|
645
|
-
contentComponent: ha,
|
|
646
|
-
contentComponentProps: {
|
|
647
|
-
draft: g,
|
|
648
|
-
onFinished: (H) => {
|
|
649
|
-
s.close(), S == null || S(H);
|
|
650
|
-
},
|
|
651
|
-
onCancel: async () => {
|
|
652
|
-
s.close(), m == null || m();
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
});
|
|
656
|
-
}
|
|
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) {
|
|
672
|
-
try {
|
|
673
|
-
e.open({
|
|
674
|
-
title: "Cloning",
|
|
675
|
-
message: "Creating a copy of the draft..."
|
|
676
|
-
}), await h.cloneDraft(g._id), e.open({
|
|
677
|
-
title: "Success",
|
|
678
|
-
message: "Draft cloned successfully",
|
|
679
|
-
type: "success"
|
|
680
|
-
}), m == null || m();
|
|
681
|
-
} catch (S) {
|
|
682
|
-
e.open({
|
|
683
|
-
title: "Error",
|
|
684
|
-
message: (S == null ? void 0 : S.message) || "Failed to clone draft",
|
|
685
|
-
type: "error"
|
|
686
|
-
});
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
return {
|
|
690
|
-
viewDraft: M,
|
|
691
|
-
closeDraftDialog: t,
|
|
692
|
-
approveDraft: P,
|
|
693
|
-
rejectDraft: B,
|
|
694
|
-
markAsFailed: q,
|
|
695
|
-
syncDraft: u,
|
|
696
|
-
exportDraft: k,
|
|
697
|
-
refreshBalance: _,
|
|
698
|
-
cloneDraft: N,
|
|
699
|
-
viewClosingDraftShow: b,
|
|
700
|
-
viewClosingDraftProps: I,
|
|
701
|
-
invalidateDraftCache: R
|
|
702
|
-
};
|
|
703
|
-
}
|
|
704
|
-
);
|
|
705
|
-
function Ne(r) {
|
|
706
|
-
switch (r) {
|
|
707
|
-
case "DRAFT":
|
|
708
|
-
return "fm-status-badge-draft";
|
|
709
|
-
case "PROCESSING":
|
|
710
|
-
return "fm-status-badge-processing";
|
|
711
|
-
case "FAILED":
|
|
712
|
-
return "fm-status-badge-cancel";
|
|
713
|
-
case "COMPLETED":
|
|
714
|
-
return "fm-status-badge-complete";
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
const ka = kt(
|
|
718
|
-
"closingDraftTable",
|
|
719
|
-
function() {
|
|
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;
|
|
724
|
-
try {
|
|
725
|
-
const [u] = await Promise.all([I.readDrafts()]).delayed(1e3);
|
|
726
|
-
h.value = u.reverse();
|
|
727
|
-
} catch (u) {
|
|
728
|
-
console.log("Something went wrong when fetching drafts:", u);
|
|
729
|
-
} finally {
|
|
730
|
-
y.value = !1;
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
async function U(u) {
|
|
735
|
-
if (!h.value.find((t) => t._id) && b._currentLocation) {
|
|
736
|
-
y.value = !0;
|
|
737
|
-
try {
|
|
738
|
-
const [t] = await Promise.all([
|
|
739
|
-
I.getDraft(u),
|
|
740
|
-
new Promise((_) => setTimeout(_, 1e3))
|
|
741
|
-
]);
|
|
742
|
-
h.value = [t];
|
|
743
|
-
} catch (t) {
|
|
744
|
-
console.log("Something went wrong when fetching drafts:", t);
|
|
745
|
-
} finally {
|
|
746
|
-
y.value = !1;
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
function k(u) {
|
|
751
|
-
h.value = h.value.map((t) => t._id === u._id ? {
|
|
752
|
-
...u,
|
|
753
|
-
_rev: t._rev
|
|
754
|
-
} : t);
|
|
755
|
-
}
|
|
756
|
-
function P() {
|
|
757
|
-
d.closeDraftDialog(), M();
|
|
758
|
-
}
|
|
759
|
-
function B(u, t) {
|
|
760
|
-
switch (t = Ht(t), u) {
|
|
761
|
-
case Se.Details:
|
|
762
|
-
return d.viewDraft(t);
|
|
763
|
-
case Se.Export:
|
|
764
|
-
return d.exportDraft(t);
|
|
765
|
-
case O.enum.approveDraft:
|
|
766
|
-
return d.approveDraft(t, P);
|
|
767
|
-
case O.enum.rejectDraft:
|
|
768
|
-
return d.rejectDraft(t, P);
|
|
769
|
-
case O.enum.markAsFailed:
|
|
770
|
-
return d.markAsFailed(t, P);
|
|
771
|
-
case Se.Duplicate:
|
|
772
|
-
return d.cloneDraft(t, P);
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
return {
|
|
776
|
-
columnDefs: [
|
|
777
|
-
{
|
|
778
|
-
id: "_id",
|
|
779
|
-
accessorKey: "_id",
|
|
780
|
-
header: () => s("inventory.closing.table.createdAt"),
|
|
781
|
-
cell(u) {
|
|
782
|
-
return ea(`${u.getValue()}`);
|
|
783
|
-
},
|
|
784
|
-
enableSorting: !0
|
|
785
|
-
},
|
|
786
|
-
{
|
|
787
|
-
accessorKey: "effectiveAt",
|
|
788
|
-
header: () => "Effective at",
|
|
789
|
-
cell(u) {
|
|
790
|
-
const t = u.row.original;
|
|
791
|
-
let _ = u.getValue();
|
|
792
|
-
return _ || (_ = Ve(t._id)), ye(_);
|
|
793
|
-
},
|
|
794
|
-
enableSorting: !0,
|
|
795
|
-
size: 200
|
|
796
|
-
},
|
|
797
|
-
{
|
|
798
|
-
id: "updatedAt",
|
|
799
|
-
accessorFn: (u) => ye(u.updatedAt),
|
|
800
|
-
header: () => "Updated at",
|
|
801
|
-
enableSorting: !0,
|
|
802
|
-
size: 200
|
|
803
|
-
},
|
|
804
|
-
{
|
|
805
|
-
id: "updatedBy",
|
|
806
|
-
accessorKey: "updatedBy.name",
|
|
807
|
-
header: () => "Last update by",
|
|
808
|
-
enableSorting: !0,
|
|
809
|
-
size: 200
|
|
810
|
-
},
|
|
811
|
-
{
|
|
812
|
-
id: "noOfItems",
|
|
813
|
-
accessorFn: (u) => {
|
|
814
|
-
var t;
|
|
815
|
-
return u.items.length + (((t = u.negativeStockItems) == null ? void 0 : t.length) ?? 0);
|
|
816
|
-
},
|
|
817
|
-
header: () => s("inventory.closing.table.noOfItems"),
|
|
818
|
-
enableSorting: !1,
|
|
819
|
-
meta: {
|
|
820
|
-
width: "10rem",
|
|
821
|
-
textAlign: "right"
|
|
822
|
-
}
|
|
823
|
-
},
|
|
824
|
-
{
|
|
825
|
-
id: "recentRemark",
|
|
826
|
-
accessorFn: (u) => {
|
|
827
|
-
var t;
|
|
828
|
-
return (u == null ? void 0 : u.approveRemark) ?? ((t = u == null ? void 0 : u.rejectionHistory) == null ? void 0 : t.computeFirst((_) => _.rejectRemark)) ?? u.remark;
|
|
829
|
-
},
|
|
830
|
-
header: () => "Recent remark"
|
|
831
|
-
},
|
|
832
|
-
{
|
|
833
|
-
id: "status",
|
|
834
|
-
accessorFn: (u) => u.status,
|
|
835
|
-
header: () => s("inventory.closing.table.status"),
|
|
836
|
-
enableSorting: !1,
|
|
837
|
-
cell(u) {
|
|
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(
|
|
841
|
-
"div",
|
|
842
|
-
{
|
|
843
|
-
class: "flex"
|
|
844
|
-
},
|
|
845
|
-
A(
|
|
846
|
-
"div",
|
|
847
|
-
{
|
|
848
|
-
class: ["fm-status-badge", Ne("FAILED")]
|
|
849
|
-
},
|
|
850
|
-
"Rejected"
|
|
851
|
-
)
|
|
852
|
-
) : A(
|
|
853
|
-
"div",
|
|
854
|
-
{
|
|
855
|
-
class: "flex"
|
|
856
|
-
},
|
|
857
|
-
A(
|
|
858
|
-
"div",
|
|
859
|
-
{
|
|
860
|
-
class: ["fm-status-badge", Ne("PROCESSING")]
|
|
861
|
-
},
|
|
862
|
-
"Updated"
|
|
863
|
-
)
|
|
864
|
-
) : A(
|
|
865
|
-
"div",
|
|
866
|
-
{
|
|
867
|
-
class: "flex"
|
|
868
|
-
},
|
|
869
|
-
A(
|
|
870
|
-
"div",
|
|
871
|
-
{
|
|
872
|
-
class: ["fm-status-badge", Ne(_)]
|
|
873
|
-
},
|
|
874
|
-
Le(_)
|
|
875
|
-
)
|
|
876
|
-
);
|
|
877
|
-
}
|
|
878
|
-
},
|
|
879
|
-
{
|
|
880
|
-
id: "action",
|
|
881
|
-
cell(u) {
|
|
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 = [
|
|
887
|
-
{
|
|
888
|
-
translationKey: "inventory.closing.draft.approveDraft",
|
|
889
|
-
color: "text-fm-color-typo-primary",
|
|
890
|
-
value: O.enum.approveDraft
|
|
891
|
-
},
|
|
892
|
-
{
|
|
893
|
-
translationKey: "inventory.closing.draft.rejectDraft",
|
|
894
|
-
color: "text-fm-color-typo-error",
|
|
895
|
-
value: O.enum.rejectDraft
|
|
896
|
-
},
|
|
897
|
-
{
|
|
898
|
-
translationKey: "inventory.closing.draft.markAsFailed",
|
|
899
|
-
color: "text-fm-color-typo-error",
|
|
900
|
-
value: O.enum.markAsFailed
|
|
901
|
-
}
|
|
902
|
-
], g = _ && t.status !== ve.enum.DRAFT ? [
|
|
903
|
-
{
|
|
904
|
-
translationKey: "inventory.closing.draft.cloneDraft",
|
|
905
|
-
color: "text-fm-color-typo-primary",
|
|
906
|
-
value: Se.Duplicate
|
|
907
|
-
}
|
|
908
|
-
] : [];
|
|
909
|
-
return Jt(
|
|
910
|
-
[
|
|
911
|
-
...R,
|
|
912
|
-
...t.status === ve.enum.DRAFT ? N : []
|
|
913
|
-
],
|
|
914
|
-
(S) => B(S, t),
|
|
915
|
-
g
|
|
916
|
-
);
|
|
917
|
-
},
|
|
918
|
-
enableSorting: !1,
|
|
919
|
-
size: 40,
|
|
920
|
-
meta: {
|
|
921
|
-
cellClass: "",
|
|
922
|
-
headerClass: ""
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
],
|
|
926
|
-
drafts: h,
|
|
927
|
-
loading: y,
|
|
928
|
-
fetchDrafts: M,
|
|
929
|
-
loadDraft: U,
|
|
930
|
-
updateDraftRef: k
|
|
931
|
-
};
|
|
932
|
-
}
|
|
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 = {
|
|
934
|
-
key: 0,
|
|
935
|
-
class: "flex gap-8"
|
|
936
|
-
}, Ta = {
|
|
937
|
-
key: 0,
|
|
938
|
-
class: "w-full flex flex-col items-center"
|
|
939
|
-
}, ja = { class: "flex items-center gap-8" }, Ia = { class: "flex flex-col gap-8" }, Ua = { class: "flex gap-8" }, Pa = {
|
|
940
|
-
key: 0,
|
|
941
|
-
class: "flex gap-8"
|
|
942
|
-
}, Ra = { class: "overflow-x-auto" }, Ma = {
|
|
943
|
-
key: 1,
|
|
944
|
-
class: "flex-1 xs:w-screen xs:max-w-full"
|
|
945
|
-
}, Va = {
|
|
946
|
-
key: 0,
|
|
947
|
-
class: "flex flex-col items-center gap-8 h-full"
|
|
948
|
-
}, La = ["src"], Na = {
|
|
949
|
-
key: 1,
|
|
950
|
-
class: "px-4 flex flex-col"
|
|
951
|
-
}, Ea = { class: "flex gap-12 content-stretch" }, za = {
|
|
952
|
-
class: "flex flex-col w-24",
|
|
953
|
-
name: "circles"
|
|
954
|
-
}, Ha = { class: "flex-1 flex flex-col items-center" }, Oa = { class: "flex-1 flex flex-col items-center" }, Ya = {
|
|
955
|
-
class: "py-12 flex flex-col gap-4",
|
|
956
|
-
name: "received-at header"
|
|
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 = {
|
|
958
|
-
class: "flex flex-col w-24",
|
|
959
|
-
name: "circles"
|
|
960
|
-
}, Wa = { class: "flex-1 flex flex-col items-center" }, Za = {
|
|
961
|
-
class: "py-12 flex flex-col gap-4 flex-1",
|
|
962
|
-
name: "delivery details"
|
|
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({
|
|
964
|
-
__name: "ClosingDraftDialog",
|
|
965
|
-
props: {
|
|
966
|
-
show: { type: Boolean },
|
|
967
|
-
draft: {}
|
|
968
|
-
},
|
|
969
|
-
emits: ["submitted", "refresh"],
|
|
970
|
-
setup(r, { emit: s }) {
|
|
971
|
-
const e = r, d = L(() => {
|
|
972
|
-
const l = ht();
|
|
973
|
-
return l === "MYR" ? "RM" : l;
|
|
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(
|
|
975
|
-
_.skus.filter((l) => {
|
|
976
|
-
var a;
|
|
977
|
-
return N[(a = l.customAttributes) == null ? void 0 : a.tag];
|
|
978
|
-
}).map((l) => l._id)
|
|
979
|
-
)), m = s, S = Y({
|
|
980
|
-
templateItem: !0,
|
|
981
|
-
nonTemplateItem: !0
|
|
982
|
-
}), H = L(() => {
|
|
983
|
-
var a, f;
|
|
984
|
-
const l = [...((a = e.draft) == null ? void 0 : a.items) ?? [], ...((f = e.draft) == null ? void 0 : f.negativeStockItems) ?? []];
|
|
985
|
-
return g.value.size ? l.filter((n) => g.value.has(n.sku._id)) : l;
|
|
986
|
-
}), K = L(() => {
|
|
987
|
-
const l = H.value.map((a) => a.sku);
|
|
988
|
-
return l.sort((a, f) => a.code.localeCompare(f.code)), l;
|
|
989
|
-
}), J = L(() => H.value.groupBy(
|
|
990
|
-
(a) => a.sku._id,
|
|
991
|
-
(a) => a.measurementsAmounts.filter((f) => !f.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((f) => f.measurement.id)
|
|
992
|
-
));
|
|
993
|
-
Ze(me), Ut(
|
|
994
|
-
() => e.show,
|
|
995
|
-
(l) => {
|
|
996
|
-
l && (ke.value = _e[0], me(), S.value = {
|
|
997
|
-
templateItem: !0,
|
|
998
|
-
nonTemplateItem: !0
|
|
999
|
-
});
|
|
1000
|
-
}
|
|
1001
|
-
);
|
|
1002
|
-
const w = je(0), X = je(100);
|
|
1003
|
-
async function me() {
|
|
1004
|
-
var a, f, n, o;
|
|
1005
|
-
if (!R._currentLocation) return;
|
|
1006
|
-
I.value = !0;
|
|
1007
|
-
const l = ((a = e.draft) == null ? void 0 : a.status) === ve.enum.COMPLETED;
|
|
1008
|
-
P.value = [];
|
|
1009
|
-
try {
|
|
1010
|
-
if (await _.init(), l) {
|
|
1011
|
-
const T = e.draft.closingAdjustmentId;
|
|
1012
|
-
if (!T) {
|
|
1013
|
-
t.open({
|
|
1014
|
-
title: "Something went wrong",
|
|
1015
|
-
message: "Closing draft is completed but closing document cannot be found.",
|
|
1016
|
-
type: "error"
|
|
1017
|
-
}), console.error("Closing draft is completed but closing document cannot be found.", {
|
|
1018
|
-
draftId: (f = e.draft) == null ? void 0 : f._id
|
|
1019
|
-
});
|
|
1020
|
-
return;
|
|
1021
|
-
}
|
|
1022
|
-
const j = await q.readAdjustmentById(T), re = (j == null ? void 0 : j.skus) ?? [];
|
|
1023
|
-
for (const ce of re) {
|
|
1024
|
-
const De = {
|
|
1025
|
-
id: ce.sku._id,
|
|
1026
|
-
balance: ce.fromBalance,
|
|
1027
|
-
costs: ce.fromCostBalances
|
|
1028
|
-
}, C = {
|
|
1029
|
-
id: ce.sku._id,
|
|
1030
|
-
balance: ce.toBalance,
|
|
1031
|
-
costs: ce.toCostBalances
|
|
1032
|
-
};
|
|
1033
|
-
k.value.push(De), P.value.push(C);
|
|
1034
|
-
}
|
|
1035
|
-
} else
|
|
1036
|
-
k.value = ((n = e.draft) == null ? void 0 : n.stockSnapshot) ?? [];
|
|
1037
|
-
const i = /* @__PURE__ */ new Set();
|
|
1038
|
-
if ((o = e.draft) != null && o.adjustmentSnapshot)
|
|
1039
|
-
for (const T of e.draft.adjustmentSnapshot)
|
|
1040
|
-
T.adjustmentsByType && Object.keys(T.adjustmentsByType).forEach((j) => i.add(j));
|
|
1041
|
-
const p = ["receive", "sales", "wastage"], x = [];
|
|
1042
|
-
p.forEach((T) => {
|
|
1043
|
-
i.has(T) && (x.push(T), i.delete(T));
|
|
1044
|
-
});
|
|
1045
|
-
const v = Array.from(i).sort();
|
|
1046
|
-
B.value = [...x, ...v];
|
|
1047
|
-
} catch (i) {
|
|
1048
|
-
t.open({
|
|
1049
|
-
title: "Something went wrong",
|
|
1050
|
-
message: "Something went wrong when fetching info. Please try again.",
|
|
1051
|
-
type: "error"
|
|
1052
|
-
}), console.error("error on fetch stock balances", i);
|
|
1053
|
-
} finally {
|
|
1054
|
-
I.value = !1;
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
async function te() {
|
|
1058
|
-
var a, f;
|
|
1059
|
-
if (!(((a = e.draft) == null ? void 0 : a.effectiveAt) ?? (e.draft ? Ve((f = e.draft) == null ? void 0 : f._id) : null))) {
|
|
1060
|
-
t.open({
|
|
1061
|
-
title: "Cannot refresh",
|
|
1062
|
-
message: "Effective date is not available for this draft.",
|
|
1063
|
-
type: "error"
|
|
1064
|
-
});
|
|
1065
|
-
return;
|
|
1066
|
-
}
|
|
1067
|
-
await y.refreshBalance(
|
|
1068
|
-
e.draft,
|
|
1069
|
-
() => {
|
|
1070
|
-
},
|
|
1071
|
-
async (n) => {
|
|
1072
|
-
var x;
|
|
1073
|
-
M.value = !0;
|
|
1074
|
-
const o = (x = e.draft) == null ? void 0 : x._rev, i = 30, p = 2e3;
|
|
1075
|
-
try {
|
|
1076
|
-
await q.recalculation.scheduleCalculateStockSnapshotAtDate(n, e.draft._id);
|
|
1077
|
-
let v = null;
|
|
1078
|
-
for (let T = 0; T < i && (v = await u.getDraft(e.draft._id).delayed(p), v._rev === o); T++)
|
|
1079
|
-
;
|
|
1080
|
-
if (!v || v._rev === o) {
|
|
1081
|
-
t.open({
|
|
1082
|
-
title: "Refresh failed",
|
|
1083
|
-
message: "Failed to refresh stock balance. Please try again.",
|
|
1084
|
-
type: "error"
|
|
1085
|
-
}), console.error("error refreshing stock balances: there is no change in _rev");
|
|
1086
|
-
return;
|
|
1087
|
-
}
|
|
1088
|
-
m("refresh", v), k.value = v.stockSnapshot ?? [], t.open({
|
|
1089
|
-
title: "Balance refreshed",
|
|
1090
|
-
message: "Stock balance has been recalculated.",
|
|
1091
|
-
type: "success"
|
|
1092
|
-
}), b.value = !1;
|
|
1093
|
-
} catch (v) {
|
|
1094
|
-
t.open({
|
|
1095
|
-
title: "Refresh failed",
|
|
1096
|
-
message: "Failed to refresh stock balance. Please try again.",
|
|
1097
|
-
type: "error"
|
|
1098
|
-
}), console.error("error refreshing stock balances", v);
|
|
1099
|
-
} finally {
|
|
1100
|
-
M.value = !1;
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
);
|
|
1104
|
-
}
|
|
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(
|
|
1119
|
-
(l) => l.id,
|
|
1120
|
-
(l) => l.balance
|
|
1121
|
-
)
|
|
1122
|
-
), be = L(() => H.value.groupBy((l) => l.sku._id)), he = L(() => {
|
|
1123
|
-
var l;
|
|
1124
|
-
return (l = e.draft) != null && l.adjustmentSnapshot ? new Map(e.draft.adjustmentSnapshot.map((a) => [a.skuId, a.adjustmentsByType])) : /* @__PURE__ */ new Map();
|
|
1125
|
-
}), Ie = L(() => {
|
|
1126
|
-
var l;
|
|
1127
|
-
return (l = e.draft) != null && l.opening ? new Map(e.draft.opening.map((a) => [a.skuId, a.balance])) : /* @__PURE__ */ new Map();
|
|
1128
|
-
});
|
|
1129
|
-
function Z(l, a) {
|
|
1130
|
-
return A(
|
|
1131
|
-
ge.FmTooltip,
|
|
1132
|
-
{ zIndex: 51, placement: "left", class: "w-full flex justify-end" },
|
|
1133
|
-
{
|
|
1134
|
-
default() {
|
|
1135
|
-
return l;
|
|
1136
|
-
},
|
|
1137
|
-
content() {
|
|
1138
|
-
return a || l;
|
|
1139
|
-
}
|
|
1140
|
-
}
|
|
1141
|
-
);
|
|
1142
|
-
}
|
|
1143
|
-
const Ce = L(() => {
|
|
1144
|
-
const l = K.value.reduce((f, n) => {
|
|
1145
|
-
var o, i;
|
|
1146
|
-
return Math.max(f, ((i = (o = J.value) == null ? void 0 : o.get(n._id)) == null ? void 0 : i[0].length) ?? 0);
|
|
1147
|
-
}, 0);
|
|
1148
|
-
return [
|
|
1149
|
-
{
|
|
1150
|
-
id: "sku",
|
|
1151
|
-
accessorFn: (f) => `${f.code} ${f.name}`,
|
|
1152
|
-
header: () => "Name",
|
|
1153
|
-
size: 350,
|
|
1154
|
-
cell(f) {
|
|
1155
|
-
const n = f.row.original, o = n.adjustedDiffPercentage, i = typeof o == "number" && Math.abs(o) > 10, p = A("div", { class: "flex flex-col gap-4" }, [
|
|
1156
|
-
A(
|
|
1157
|
-
"div",
|
|
1158
|
-
{
|
|
1159
|
-
class: [
|
|
1160
|
-
"line-clamp-1 fm-typo-en-body-lg-400",
|
|
1161
|
-
i ? " text-fm-color-system-error-300" : "text-fm-color-typo-primary"
|
|
1162
|
-
]
|
|
1163
|
-
},
|
|
1164
|
-
n.name
|
|
1165
|
-
),
|
|
1166
|
-
A(
|
|
1167
|
-
"div",
|
|
1168
|
-
{
|
|
1169
|
-
class: [
|
|
1170
|
-
"line-clamp-1 fm-typo-en-body-md-400",
|
|
1171
|
-
i ? " text-fm-color-system-error-300" : "text-fm-color-typo-secondary"
|
|
1172
|
-
]
|
|
1173
|
-
},
|
|
1174
|
-
n.code
|
|
1175
|
-
)
|
|
1176
|
-
]);
|
|
1177
|
-
return A(
|
|
1178
|
-
ge.FmTooltip,
|
|
1179
|
-
{
|
|
1180
|
-
zIndex: 51
|
|
1181
|
-
},
|
|
1182
|
-
{
|
|
1183
|
-
content() {
|
|
1184
|
-
return i ? "Adjustment difference is more than 10%." : `${n.code} - ${n.name}`;
|
|
1185
|
-
},
|
|
1186
|
-
default() {
|
|
1187
|
-
return A("div", { class: "flex items-center gap-4 justify-start w-full" }, [
|
|
1188
|
-
p
|
|
1189
|
-
]);
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
);
|
|
1193
|
-
}
|
|
1194
|
-
},
|
|
1195
|
-
{
|
|
1196
|
-
id: "costPerUnit",
|
|
1197
|
-
accessorKey: "costPerUnit",
|
|
1198
|
-
header: () => Z("Cost per unit"),
|
|
1199
|
-
size: 160,
|
|
1200
|
-
cell(f) {
|
|
1201
|
-
const n = f.row.original.costPerUnit;
|
|
1202
|
-
return A("div", { class: "text-right" }, n.toFixed(2));
|
|
1203
|
-
},
|
|
1204
|
-
meta: {
|
|
1205
|
-
textAlign: "right"
|
|
1206
|
-
}
|
|
1207
|
-
},
|
|
1208
|
-
{
|
|
1209
|
-
id: "costUnit",
|
|
1210
|
-
header: () => "UOM",
|
|
1211
|
-
size: 120,
|
|
1212
|
-
cell(f) {
|
|
1213
|
-
var x;
|
|
1214
|
-
const n = f.row.original, o = n.costUnit, i = n.baseUnit, p = o ?? i;
|
|
1215
|
-
if (o && o !== i) {
|
|
1216
|
-
const v = K.value.find((j) => j._id === n.id), T = (x = v == null ? void 0 : v.defaultCost) == null ? void 0 : x.measurement;
|
|
1217
|
-
if (T) {
|
|
1218
|
-
const j = T.conversion.amount / Math.pow(10, T.conversion.precision);
|
|
1219
|
-
return A("div", { class: "flex flex-col" }, [
|
|
1220
|
-
A(
|
|
1221
|
-
"span",
|
|
1222
|
-
{ class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
|
|
1223
|
-
p
|
|
1224
|
-
),
|
|
1225
|
-
A("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, [
|
|
1226
|
-
"1 ",
|
|
1227
|
-
A("span", { class: "fm-typo-en-body-sm-600" }, o),
|
|
1228
|
-
` = ${j} `,
|
|
1229
|
-
A("span", { class: "fm-typo-en-body-sm-600" }, i)
|
|
1230
|
-
])
|
|
1231
|
-
]);
|
|
1232
|
-
}
|
|
1233
|
-
}
|
|
1234
|
-
return p;
|
|
1235
|
-
}
|
|
1236
|
-
},
|
|
1237
|
-
{
|
|
1238
|
-
id: "opening",
|
|
1239
|
-
accessorKey: "opening",
|
|
1240
|
-
header: () => Z("Opening (B/F)", "The opening balance brought forward from previous period."),
|
|
1241
|
-
size: 150,
|
|
1242
|
-
cell(f) {
|
|
1243
|
-
const n = f.row.original.opening;
|
|
1244
|
-
return A("div", { class: "text-right" }, n.toFixed(2));
|
|
1245
|
-
},
|
|
1246
|
-
meta: {
|
|
1247
|
-
textAlign: "right"
|
|
1248
|
-
}
|
|
1249
|
-
},
|
|
1250
|
-
// Dynamic adjustment type columns
|
|
1251
|
-
...B.value.map(
|
|
1252
|
-
(f) => ({
|
|
1253
|
-
id: `adjustment_${f}`,
|
|
1254
|
-
accessorFn: (n) => n.adjustmentAmounts[f] ?? { amount: 0, precision: 0 },
|
|
1255
|
-
header: () => Z(Le(f)),
|
|
1256
|
-
size: 150,
|
|
1257
|
-
cell(n) {
|
|
1258
|
-
const o = n.row.original.adjustmentAmounts[f] ?? { amount: 0, precision: 0 };
|
|
1259
|
-
return A("div", { class: "text-right" }, We(o));
|
|
1260
|
-
},
|
|
1261
|
-
meta: {
|
|
1262
|
-
textAlign: "right"
|
|
1263
|
-
}
|
|
1264
|
-
})
|
|
1265
|
-
),
|
|
1266
|
-
{
|
|
1267
|
-
id: "systemBalance",
|
|
1268
|
-
accessorKey: "systemBalance",
|
|
1269
|
-
header: () => Z("System Balance", "The system calculated balance before stock take."),
|
|
1270
|
-
size: 200,
|
|
1271
|
-
meta: {
|
|
1272
|
-
textAlign: "right"
|
|
1273
|
-
}
|
|
1274
|
-
},
|
|
1275
|
-
{
|
|
1276
|
-
id: "physicalBalance",
|
|
1277
|
-
accessorFn: (f) => {
|
|
1278
|
-
var o;
|
|
1279
|
-
const n = (o = P.value.find((i) => i.id === f.id)) == null ? void 0 : o.balance;
|
|
1280
|
-
return n ? V.toFormatString({ value: n }) : f.physicalBalance;
|
|
1281
|
-
},
|
|
1282
|
-
header: () => Z("Stock Take balance", "The physical balance recorded during stock take."),
|
|
1283
|
-
cell(f) {
|
|
1284
|
-
var v;
|
|
1285
|
-
const n = f.row.original, o = V.fromNumber(n.physicalBalance);
|
|
1286
|
-
let i = !0, p = n.physicalBalance;
|
|
1287
|
-
const x = (v = P.value.find((T) => T.id === n.id)) == null ? void 0 : v.balance;
|
|
1288
|
-
return x && (V.equals({
|
|
1289
|
-
a: o,
|
|
1290
|
-
b: x
|
|
1291
|
-
}) || (i = !1, p = Number(V.toFormatString({ value: x })))), A("div", { class: "flex flex-col" }, [
|
|
1292
|
-
A(
|
|
1293
|
-
"span",
|
|
1294
|
-
{ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
|
|
1295
|
-
p
|
|
1296
|
-
),
|
|
1297
|
-
i ? null : A(
|
|
1298
|
-
"span",
|
|
1299
|
-
{ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
|
|
1300
|
-
`Draft: ${n.physicalBalance.toString()}`
|
|
1301
|
-
)
|
|
1302
|
-
]);
|
|
1303
|
-
},
|
|
1304
|
-
size: 200,
|
|
1305
|
-
meta: {
|
|
1306
|
-
textAlign: "right"
|
|
1307
|
-
}
|
|
1308
|
-
},
|
|
1309
|
-
{
|
|
1310
|
-
id: "adjustedAmount",
|
|
1311
|
-
accessorKey: "adjustedAmount",
|
|
1312
|
-
header: () => Z("Variance", "The difference between Stock Take balance and System Balance."),
|
|
1313
|
-
size: 200,
|
|
1314
|
-
meta: {
|
|
1315
|
-
textAlign: "right"
|
|
1316
|
-
}
|
|
1317
|
-
},
|
|
1318
|
-
{
|
|
1319
|
-
id: "varianceInCost",
|
|
1320
|
-
accessorKey: "varianceInCost",
|
|
1321
|
-
header: () => Z(`Variance (${d.value})`),
|
|
1322
|
-
size: 150,
|
|
1323
|
-
cell(f) {
|
|
1324
|
-
const n = f.row.original.varianceInCost;
|
|
1325
|
-
return A(
|
|
1326
|
-
"div",
|
|
1327
|
-
{ class: "text-right" },
|
|
1328
|
-
n.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })
|
|
1329
|
-
);
|
|
1330
|
-
},
|
|
1331
|
-
meta: {
|
|
1332
|
-
textAlign: "right"
|
|
1333
|
-
}
|
|
1334
|
-
},
|
|
1335
|
-
{
|
|
1336
|
-
id: "adjustedDiffPercentage",
|
|
1337
|
-
accessorKey: "adjustedDiffPercentage",
|
|
1338
|
-
header: () => Z(
|
|
1339
|
-
"Variance (%)",
|
|
1340
|
-
"Difference between Stock Take balance and System Balance in percentage."
|
|
1341
|
-
),
|
|
1342
|
-
size: 200,
|
|
1343
|
-
cell(f) {
|
|
1344
|
-
const n = f.row.original.adjustedDiffPercentage;
|
|
1345
|
-
if (!n) return an;
|
|
1346
|
-
const o = n.toFixed(2);
|
|
1347
|
-
if (o === "0.00")
|
|
1348
|
-
return A("div", { class: "flex items-center gap-4 justify-end" }, ["0.00"]);
|
|
1349
|
-
const i = n > 0;
|
|
1350
|
-
return A("div", { class: "flex items-center gap-4 justify-end" }, [
|
|
1351
|
-
A(ge.FmIcon, {
|
|
1352
|
-
name: i ? "arrow_drop_up" : "arrow_drop_down",
|
|
1353
|
-
color: i ? "system-success-300" : "system-error-300",
|
|
1354
|
-
size: "md"
|
|
1355
|
-
}),
|
|
1356
|
-
o
|
|
1357
|
-
]);
|
|
1358
|
-
},
|
|
1359
|
-
meta: {
|
|
1360
|
-
textAlign: "right"
|
|
1361
|
-
}
|
|
1362
|
-
},
|
|
1363
|
-
{
|
|
1364
|
-
id: "stockTakeValue",
|
|
1365
|
-
accessorKey: "stockTakeValue",
|
|
1366
|
-
header: () => Z(`Stock take value (${d.value})`),
|
|
1367
|
-
size: 180,
|
|
1368
|
-
cell(f) {
|
|
1369
|
-
var T;
|
|
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;
|
|
1371
|
-
if (p) {
|
|
1372
|
-
const j = V.toFormatString({ value: p.conversion }), re = `${x.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${n.baseUnit} ÷ ${j} × ${v} ${d.value}`;
|
|
1373
|
-
return A(
|
|
1374
|
-
ge.FmTooltip,
|
|
1375
|
-
{ zIndex: 51 },
|
|
1376
|
-
{
|
|
1377
|
-
content() {
|
|
1378
|
-
return re;
|
|
1379
|
-
},
|
|
1380
|
-
default() {
|
|
1381
|
-
return A(
|
|
1382
|
-
"div",
|
|
1383
|
-
{ class: "text-right" },
|
|
1384
|
-
o.toLocaleString("en-US", {
|
|
1385
|
-
minimumFractionDigits: 2,
|
|
1386
|
-
maximumFractionDigits: 4
|
|
1387
|
-
})
|
|
1388
|
-
);
|
|
1389
|
-
}
|
|
1390
|
-
}
|
|
1391
|
-
);
|
|
1392
|
-
} else {
|
|
1393
|
-
const j = `${x.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${n.baseUnit} × ${v} ${d.value}`;
|
|
1394
|
-
return A(
|
|
1395
|
-
ge.FmTooltip,
|
|
1396
|
-
{ zIndex: 51 },
|
|
1397
|
-
{
|
|
1398
|
-
content() {
|
|
1399
|
-
return j;
|
|
1400
|
-
},
|
|
1401
|
-
default() {
|
|
1402
|
-
return A(
|
|
1403
|
-
"div",
|
|
1404
|
-
{ class: "text-right" },
|
|
1405
|
-
o.toLocaleString("en-US", {
|
|
1406
|
-
minimumFractionDigits: 2,
|
|
1407
|
-
maximumFractionDigits: 4
|
|
1408
|
-
})
|
|
1409
|
-
);
|
|
1410
|
-
}
|
|
1411
|
-
}
|
|
1412
|
-
);
|
|
1413
|
-
}
|
|
1414
|
-
},
|
|
1415
|
-
meta: {
|
|
1416
|
-
textAlign: "right"
|
|
1417
|
-
}
|
|
1418
|
-
},
|
|
1419
|
-
{
|
|
1420
|
-
id: "systemValue",
|
|
1421
|
-
accessorKey: "systemValue",
|
|
1422
|
-
header: () => Z(`System value (${d.value})`),
|
|
1423
|
-
size: 180,
|
|
1424
|
-
cell(f) {
|
|
1425
|
-
var T;
|
|
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;
|
|
1427
|
-
if (p) {
|
|
1428
|
-
const j = V.toFormatString({ value: p.conversion }), re = `${x.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${n.baseUnit} ÷ ${j} × ${v} ${d.value}`;
|
|
1429
|
-
return A(
|
|
1430
|
-
ge.FmTooltip,
|
|
1431
|
-
{ zIndex: 51 },
|
|
1432
|
-
{
|
|
1433
|
-
content() {
|
|
1434
|
-
return re;
|
|
1435
|
-
},
|
|
1436
|
-
default() {
|
|
1437
|
-
return A(
|
|
1438
|
-
"div",
|
|
1439
|
-
{ class: "text-right" },
|
|
1440
|
-
o.toLocaleString("en-US", {
|
|
1441
|
-
minimumFractionDigits: 2,
|
|
1442
|
-
maximumFractionDigits: 4
|
|
1443
|
-
})
|
|
1444
|
-
);
|
|
1445
|
-
}
|
|
1446
|
-
}
|
|
1447
|
-
);
|
|
1448
|
-
} else {
|
|
1449
|
-
const j = `${x.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })} ${n.baseUnit} × ${v} ${d.value}`;
|
|
1450
|
-
return A(
|
|
1451
|
-
ge.FmTooltip,
|
|
1452
|
-
{ zIndex: 51 },
|
|
1453
|
-
{
|
|
1454
|
-
content() {
|
|
1455
|
-
return j;
|
|
1456
|
-
},
|
|
1457
|
-
default() {
|
|
1458
|
-
return A(
|
|
1459
|
-
"div",
|
|
1460
|
-
{ class: "text-right" },
|
|
1461
|
-
o.toLocaleString("en-US", {
|
|
1462
|
-
minimumFractionDigits: 2,
|
|
1463
|
-
maximumFractionDigits: 4
|
|
1464
|
-
})
|
|
1465
|
-
);
|
|
1466
|
-
}
|
|
1467
|
-
}
|
|
1468
|
-
);
|
|
1469
|
-
}
|
|
1470
|
-
},
|
|
1471
|
-
meta: {
|
|
1472
|
-
textAlign: "right"
|
|
1473
|
-
}
|
|
1474
|
-
},
|
|
1475
|
-
{
|
|
1476
|
-
id: "physicalBalances",
|
|
1477
|
-
header: () => "Amounts",
|
|
1478
|
-
enableSorting: !1,
|
|
1479
|
-
cell(f) {
|
|
1480
|
-
const n = f.row.original, o = (p, x) => A(
|
|
1481
|
-
ge.FmTooltip,
|
|
1482
|
-
{ zIndex: 50 },
|
|
1483
|
-
{
|
|
1484
|
-
default() {
|
|
1485
|
-
return A(
|
|
1486
|
-
"div",
|
|
1487
|
-
{
|
|
1488
|
-
class: "fm-typo-en-body-md-400 py-4 px-8 border-1 border-fm-color-typo-secondary fm-corner-radius-md line-clamp-1"
|
|
1489
|
-
},
|
|
1490
|
-
[
|
|
1491
|
-
A("span", { class: "text-fm-color-typo-primary" }, `${p} `),
|
|
1492
|
-
A(
|
|
1493
|
-
"span",
|
|
1494
|
-
{
|
|
1495
|
-
class: "text-fm-color-typo-secondary",
|
|
1496
|
-
style: { maxWidth: "80px" }
|
|
1497
|
-
},
|
|
1498
|
-
x
|
|
1499
|
-
)
|
|
1500
|
-
]
|
|
1501
|
-
);
|
|
1502
|
-
},
|
|
1503
|
-
content() {
|
|
1504
|
-
return `${p} ${x}`;
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1507
|
-
);
|
|
1508
|
-
let i = Array.from({ length: l }).map((p, x) => {
|
|
1509
|
-
if (!n[`measurementAmount${x}`])
|
|
1510
|
-
return null;
|
|
1511
|
-
const v = n[`measurementAmount${x}`], T = n[`measurementAbbrev${x}`];
|
|
1512
|
-
return o(v, T);
|
|
1513
|
-
}).filter((p) => p);
|
|
1514
|
-
return (n.baseUnitAmount || !i.length) && (i = [o(n.baseUnitAmount, n.baseUnit), ...i]), A(
|
|
1515
|
-
"div",
|
|
1516
|
-
{
|
|
1517
|
-
class: "flex gap-8 flex-nowrap",
|
|
1518
|
-
style: {
|
|
1519
|
-
minWidth: `${120 * i.length}px`
|
|
1520
|
-
}
|
|
1521
|
-
},
|
|
1522
|
-
i
|
|
1523
|
-
);
|
|
1524
|
-
}
|
|
1525
|
-
}
|
|
1526
|
-
];
|
|
1527
|
-
}), Ue = L(() => Ce.value.map((l) => l.size ?? 0).reduce((l, a) => l + a)), xe = Y(""), $e = L(() => {
|
|
1528
|
-
var f, n;
|
|
1529
|
-
const l = ((n = (f = e.draft) == null ? void 0 : f.negativeStockItems) == null ? void 0 : n.reduce(
|
|
1530
|
-
(o, i) => (o[i.sku._id] = i, o),
|
|
1531
|
-
{}
|
|
1532
|
-
)) ?? {};
|
|
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) ?? {
|
|
1536
|
-
amount: 1,
|
|
1537
|
-
precision: 0
|
|
1538
|
-
}, j = Number(
|
|
1539
|
-
V.toFormatString({ value: T })
|
|
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));
|
|
1544
|
-
}), !i) {
|
|
1545
|
-
const W = Number(V.toFormatString({ value: p })), ue = W - 0, fe = ue * v / j, Re = 0, jt = W * v / j;
|
|
1546
|
-
return {
|
|
1547
|
-
id: o._id,
|
|
1548
|
-
code: o.code,
|
|
1549
|
-
name: o.name,
|
|
1550
|
-
costUnit: ((ct = (it = o.defaultCost) == null ? void 0 : it.measurement) == null ? void 0 : ct.abbrev) ?? null,
|
|
1551
|
-
baseUnit: o.unit.abbrev,
|
|
1552
|
-
baseUnitAmount: 0,
|
|
1553
|
-
systemBalance: W,
|
|
1554
|
-
physicalBalance: 0,
|
|
1555
|
-
adjustedAmount: -W,
|
|
1556
|
-
adjustedDiffPercentage: -100,
|
|
1557
|
-
isTemplateItem: !l[o._id],
|
|
1558
|
-
costPerUnit: v,
|
|
1559
|
-
opening: ce,
|
|
1560
|
-
varianceQty: ue,
|
|
1561
|
-
varianceInCost: fe,
|
|
1562
|
-
stockTakeValue: Re,
|
|
1563
|
-
systemValue: jt,
|
|
1564
|
-
adjustmentAmounts: C
|
|
1565
|
-
};
|
|
1566
|
-
}
|
|
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,
|
|
1571
|
-
p
|
|
1572
|
-
), Be = p.amount === 0 ? null : At(pe, {
|
|
1573
|
-
...p,
|
|
1574
|
-
amount: Math.abs(p.amount)
|
|
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;
|
|
1576
|
-
return {
|
|
1577
|
-
id: o._id,
|
|
1578
|
-
code: o.code,
|
|
1579
|
-
name: o.name,
|
|
1580
|
-
costUnit: ((ft = (dt = o.defaultCost) == null ? void 0 : dt.measurement) == null ? void 0 : ft.abbrev) ?? null,
|
|
1581
|
-
baseUnit: o.unit.abbrev,
|
|
1582
|
-
baseUnitAmount: Number(V.toFormatString({ value: i.baseAmount })),
|
|
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,
|
|
1589
|
-
adjustedAmount: Number(V.toFormatString({ value: pe })),
|
|
1590
|
-
adjustedDiffPercentage: Pe ? Number(
|
|
1591
|
-
V.toFormatString({
|
|
1592
|
-
value: _t(Pe, 2)
|
|
1593
|
-
})
|
|
1594
|
-
) : null,
|
|
1595
|
-
isTemplateItem: !l[o._id],
|
|
1596
|
-
costPerUnit: v,
|
|
1597
|
-
opening: ce,
|
|
1598
|
-
varianceQty: at,
|
|
1599
|
-
varianceInCost: $t,
|
|
1600
|
-
stockTakeValue: Bt,
|
|
1601
|
-
systemValue: Tt,
|
|
1602
|
-
adjustmentAmounts: C
|
|
1603
|
-
};
|
|
1604
|
-
}).filter((o) => !!(o.isTemplateItem && S.value.templateItem || !o.isTemplateItem && S.value.nonTemplateItem));
|
|
1605
|
-
}), Ae = L(() => {
|
|
1606
|
-
var a, f, n, o, i;
|
|
1607
|
-
if (!e.draft) return [];
|
|
1608
|
-
const l = e.draft.approvedAt ? {
|
|
1609
|
-
action: `Approve at ${ye(e.draft.approvedAt)}`,
|
|
1610
|
-
// actionAt: props.draft.approvedAt,
|
|
1611
|
-
actionBy: e.draft.approvedBy,
|
|
1612
|
-
remark: e.draft.approveRemark
|
|
1613
|
-
} : (a = e.draft.rejectionHistory) == null ? void 0 : a.computeFirst((p) => ({
|
|
1614
|
-
action: `Reject at ${ye(p.rejectedAt)}`,
|
|
1615
|
-
// actionAt: e.rejectedAt,
|
|
1616
|
-
actionBy: p.rejectedBy,
|
|
1617
|
-
remark: p.rejectRemark
|
|
1618
|
-
}));
|
|
1619
|
-
return [
|
|
1620
|
-
{
|
|
1621
|
-
label: "Location",
|
|
1622
|
-
value: ((f = R._currentLocation) == null ? void 0 : f.name) ?? "N/A"
|
|
1623
|
-
},
|
|
1624
|
-
{
|
|
1625
|
-
label: "Created at",
|
|
1626
|
-
value: ye(e.draft.createdAt)
|
|
1627
|
-
},
|
|
1628
|
-
{
|
|
1629
|
-
label: "Created by",
|
|
1630
|
-
value: e.draft.createdBy.name
|
|
1631
|
-
},
|
|
1632
|
-
{
|
|
1633
|
-
label: "Updated at",
|
|
1634
|
-
value: ye(e.draft.updatedAt)
|
|
1635
|
-
},
|
|
1636
|
-
{
|
|
1637
|
-
label: "Updated by",
|
|
1638
|
-
value: e.draft.updatedBy.name
|
|
1639
|
-
},
|
|
1640
|
-
{
|
|
1641
|
-
label: "Effective at",
|
|
1642
|
-
value: ye(e.draft.effectiveAt ?? Ve((n = e.draft) == null ? void 0 : n._id))
|
|
1643
|
-
},
|
|
1644
|
-
{
|
|
1645
|
-
label: "Using template",
|
|
1646
|
-
value: ((o = e.draft.usingTemplates.find((p) => p)) == null ? void 0 : o.name) ?? "None"
|
|
1647
|
-
},
|
|
1648
|
-
e.draft.remark ? {
|
|
1649
|
-
label: "Remark",
|
|
1650
|
-
value: e.draft.remark
|
|
1651
|
-
} : null,
|
|
1652
|
-
l ? {
|
|
1653
|
-
label: "Last action",
|
|
1654
|
-
value: l.action
|
|
1655
|
-
} : null,
|
|
1656
|
-
l && l.actionBy ? {
|
|
1657
|
-
label: "Last action by",
|
|
1658
|
-
value: (i = l.actionBy) == null ? void 0 : i.name
|
|
1659
|
-
} : null,
|
|
1660
|
-
l && l.remark ? {
|
|
1661
|
-
label: "Action remark",
|
|
1662
|
-
value: l.remark
|
|
1663
|
-
} : null
|
|
1664
|
-
].filter((p) => p).map((p) => p);
|
|
1665
|
-
}), _e = [
|
|
1666
|
-
{
|
|
1667
|
-
label: "Overview",
|
|
1668
|
-
value: "overview"
|
|
1669
|
-
},
|
|
1670
|
-
{
|
|
1671
|
-
label: "Action history",
|
|
1672
|
-
value: "history"
|
|
1673
|
-
}
|
|
1674
|
-
], ke = Y(_e[0]), we = L(() => {
|
|
1675
|
-
var n, o, i;
|
|
1676
|
-
const l = ((n = e.draft) == null ? void 0 : n.activityLogs) ?? [], a = ((o = e.draft) == null ? void 0 : o.rejectionHistory) ?? [];
|
|
1677
|
-
for (const p of a)
|
|
1678
|
-
l.find(
|
|
1679
|
-
(v) => `${v.action}_${v.performedAt}` == `${O.enum.rejectDraft}_${p.rejectedAt}`
|
|
1680
|
-
) || l.push({
|
|
1681
|
-
action: O.enum.rejectDraft,
|
|
1682
|
-
performedAt: p.rejectedAt,
|
|
1683
|
-
performedBy: p.rejectedBy,
|
|
1684
|
-
remark: p.rejectRemark
|
|
1685
|
-
});
|
|
1686
|
-
return (i = e.draft) != null && i.approvedAt && (l.find(
|
|
1687
|
-
(x) => {
|
|
1688
|
-
var v;
|
|
1689
|
-
return `${x.action}_${x.performedAt}` == `${O.enum.approveDraft}_${(v = e.draft) == null ? void 0 : v.approvedAt}`;
|
|
1690
|
-
}
|
|
1691
|
-
) || l.push({
|
|
1692
|
-
action: O.enum.approveDraft,
|
|
1693
|
-
performedAt: e.draft.approvedAt,
|
|
1694
|
-
performedBy: e.draft.approvedBy ?? { name: "Unknown", id: "unknown" },
|
|
1695
|
-
remark: e.draft.approveRemark
|
|
1696
|
-
})), l.sort((p, x) => new Date(x.performedAt).getTime() - new Date(p.performedAt).getTime()).map(
|
|
1697
|
-
(p) => ({
|
|
1698
|
-
header: Le(p.action),
|
|
1699
|
-
date: ye(p.performedAt),
|
|
1700
|
-
info: [
|
|
1701
|
-
{
|
|
1702
|
-
label: "Performed by",
|
|
1703
|
-
values: [p.performedBy.name]
|
|
1704
|
-
},
|
|
1705
|
-
{
|
|
1706
|
-
label: "Remark",
|
|
1707
|
-
values: [p.remark ?? ""]
|
|
1708
|
-
}
|
|
1709
|
-
]
|
|
1710
|
-
})
|
|
1711
|
-
);
|
|
1712
|
-
}), tt = L(() => {
|
|
1713
|
-
var o, i, p, x;
|
|
1714
|
-
if (!((o = e.draft) != null && o.stockSnapshot)) return "Stock snapshot is not available.";
|
|
1715
|
-
if (((i = e.draft) == null ? void 0 : i.status) !== ve.enum.DRAFT) return "Status is not draft.";
|
|
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;
|
|
1717
|
-
return [
|
|
1718
|
-
l ? "Negative total exist." : null,
|
|
1719
|
-
n ? "Negative stock is not included in this draft. Please commit the draft to include these stocks." : null
|
|
1720
|
-
].filter((v) => v).join(" ");
|
|
1721
|
-
});
|
|
1722
|
-
return (l, a) => {
|
|
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, {
|
|
1725
|
-
"dismiss-away": "",
|
|
1726
|
-
"max-width": 9999,
|
|
1727
|
-
"model-value": $(b),
|
|
1728
|
-
"onUpdate:modelValue": a[10] || (a[10] = (C) => vt(b) ? b.value = C : null),
|
|
1729
|
-
header: "Closing details"
|
|
1730
|
-
}, {
|
|
1731
|
-
"side-sheet-footer": Q(() => {
|
|
1732
|
-
var C, G, ee, pe;
|
|
1733
|
-
return [
|
|
1734
|
-
c("div", tn, [
|
|
1735
|
-
((C = e.draft) == null ? void 0 : C.status) === $(ve).enum.DRAFT ? (F(), E(le, { key: 0 }, [
|
|
1736
|
-
tt.value ? (F(), ie(ce, {
|
|
1737
|
-
key: 0,
|
|
1738
|
-
"z-index": 51,
|
|
1739
|
-
placement: "right"
|
|
1740
|
-
}, {
|
|
1741
|
-
content: Q(() => [
|
|
1742
|
-
oe(ae(tt.value), 1)
|
|
1743
|
-
]),
|
|
1744
|
-
default: Q(() => [
|
|
1745
|
-
D(i, {
|
|
1746
|
-
disabled: "",
|
|
1747
|
-
key: "approve key",
|
|
1748
|
-
label: "Approve",
|
|
1749
|
-
onClick: a[5] || (a[5] = () => e.draft && $(y).approveDraft(e.draft, () => m("submitted")))
|
|
1750
|
-
})
|
|
1751
|
-
]),
|
|
1752
|
-
_: 1
|
|
1753
|
-
})) : (F(), ie(i, {
|
|
1754
|
-
key: "approve key",
|
|
1755
|
-
label: "Approve",
|
|
1756
|
-
onClick: a[6] || (a[6] = () => e.draft && $(y).approveDraft(e.draft, () => m("submitted")))
|
|
1757
|
-
}))
|
|
1758
|
-
], 64)) : ne("", !0),
|
|
1759
|
-
((G = e.draft) == null ? void 0 : G.status) === $(ve).enum.DRAFT ? (F(), ie(i, {
|
|
1760
|
-
key: 1,
|
|
1761
|
-
label: "Reject",
|
|
1762
|
-
variant: "destructive",
|
|
1763
|
-
onClick: a[7] || (a[7] = () => e.draft && $(y).rejectDraft(e.draft, () => m("submitted")))
|
|
1764
|
-
})) : ne("", !0),
|
|
1765
|
-
(ee = e.draft) != null && ee.approvedAt && ((pe = e.draft) == null ? void 0 : pe.status) !== $(ve).enum.COMPLETED ? (F(), ie(Ge, { key: 2 }, {
|
|
1766
|
-
default: Q(() => [
|
|
1767
|
-
D(i, {
|
|
1768
|
-
label: "Sync",
|
|
1769
|
-
loading: U.value,
|
|
1770
|
-
onClick: a[8] || (a[8] = () => {
|
|
1771
|
-
e.draft && (U.value = !0, $(y).syncDraft(e.draft, () => {
|
|
1772
|
-
U.value = !1, m("submitted");
|
|
1773
|
-
}));
|
|
1774
|
-
})
|
|
1775
|
-
}, null, 8, ["loading"])
|
|
1776
|
-
]),
|
|
1777
|
-
_: 1
|
|
1778
|
-
})) : ne("", !0),
|
|
1779
|
-
D(i, {
|
|
1780
|
-
label: "Close",
|
|
1781
|
-
variant: "tertiary",
|
|
1782
|
-
onClick: a[9] || (a[9] = (Be) => b.value = !1)
|
|
1783
|
-
})
|
|
1784
|
-
])
|
|
1785
|
-
];
|
|
1786
|
-
}),
|
|
1787
|
-
default: Q(() => [
|
|
1788
|
-
c("div", Da, [
|
|
1789
|
-
c("div", null, [
|
|
1790
|
-
D(f, {
|
|
1791
|
-
items: _e,
|
|
1792
|
-
modelValue: ke.value,
|
|
1793
|
-
"onUpdate:modelValue": a[0] || (a[0] = (C) => ke.value = C)
|
|
1794
|
-
}, null, 8, ["modelValue"])
|
|
1795
|
-
]),
|
|
1796
|
-
ke.value.value === "overview" ? (F(), E(le, { key: 0 }, [
|
|
1797
|
-
D(o, {
|
|
1798
|
-
variant: "outlined",
|
|
1799
|
-
class: "flex flex-col gap-8 px-12 py-16"
|
|
1800
|
-
}, {
|
|
1801
|
-
default: Q(() => {
|
|
1802
|
-
var C, G;
|
|
1803
|
-
return [
|
|
1804
|
-
c("div", xa, [
|
|
1805
|
-
a[11] || (a[11] = c("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
|
|
1806
|
-
c("div", Aa, [
|
|
1807
|
-
c("div", {
|
|
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)
|
|
1810
|
-
])
|
|
1811
|
-
]),
|
|
1812
|
-
D(n),
|
|
1813
|
-
c("div", _a, [
|
|
1814
|
-
(F(!0), E(le, null, Te(Ae.value, (ee, pe) => (F(), E("div", {
|
|
1815
|
-
class: "flex flex-col gap-4",
|
|
1816
|
-
key: pe
|
|
1817
|
-
}, [
|
|
1818
|
-
c("div", wa, [
|
|
1819
|
-
c("div", Sa, ae(ee.label), 1)
|
|
1820
|
-
]),
|
|
1821
|
-
c("div", Fa, ae(ee.value), 1)
|
|
1822
|
-
]))), 128))
|
|
1823
|
-
])
|
|
1824
|
-
];
|
|
1825
|
-
}),
|
|
1826
|
-
_: 1
|
|
1827
|
-
}),
|
|
1828
|
-
c("div", Ca, [
|
|
1829
|
-
c("div", $a, [
|
|
1830
|
-
a[12] || (a[12] = c("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
|
|
1831
|
-
I.value ? ne("", !0) : (F(), E("div", Ba, [
|
|
1832
|
-
l.draft && l.draft.status !== $(ve).enum.COMPLETED ? (F(), ie(i, {
|
|
1833
|
-
key: 0,
|
|
1834
|
-
label: "Refresh balance",
|
|
1835
|
-
"prepend-icon": "refresh",
|
|
1836
|
-
variant: "secondary",
|
|
1837
|
-
"text-color": "primary",
|
|
1838
|
-
"bg-color": "transparent",
|
|
1839
|
-
"border-color": "primary",
|
|
1840
|
-
loading: M.value,
|
|
1841
|
-
onClick: te
|
|
1842
|
-
}, null, 8, ["loading"])) : ne("", !0),
|
|
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, {
|
|
1859
|
-
label: "Export data",
|
|
1860
|
-
"prepend-icon": "download",
|
|
1861
|
-
variant: "secondary",
|
|
1862
|
-
"text-color": "primary",
|
|
1863
|
-
"bg-color": "transparent",
|
|
1864
|
-
"border-color": "primary",
|
|
1865
|
-
onClick: a[1] || (a[1] = (C) => l.draft ? $(y).exportDraft(
|
|
1866
|
-
l.draft,
|
|
1867
|
-
k.value,
|
|
1868
|
-
P.value
|
|
1869
|
-
) : null)
|
|
1870
|
-
})
|
|
1871
|
-
]))
|
|
1872
|
-
]),
|
|
1873
|
-
I.value ? (F(), E("div", Ta, [
|
|
1874
|
-
a[14] || (a[14] = c("div", { class: "h-80" }, null, -1)),
|
|
1875
|
-
c("div", ja, [
|
|
1876
|
-
c("div", null, [
|
|
1877
|
-
D(p, { size: "md" })
|
|
1878
|
-
]),
|
|
1879
|
-
a[13] || (a[13] = c("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
|
|
1880
|
-
]),
|
|
1881
|
-
a[15] || (a[15] = c("div", { class: "h-80" }, null, -1))
|
|
1882
|
-
])) : (F(), E(le, { key: 1 }, [
|
|
1883
|
-
c("div", Ia, [
|
|
1884
|
-
c("div", Ua, [
|
|
1885
|
-
D(x, {
|
|
1886
|
-
label: "Template Item(s)",
|
|
1887
|
-
selected: S.value.templateItem,
|
|
1888
|
-
onClick: a[2] || (a[2] = (C) => S.value.templateItem = !S.value.templateItem)
|
|
1889
|
-
}, null, 8, ["selected"]),
|
|
1890
|
-
D(x, {
|
|
1891
|
-
label: "Non-template Item(s)",
|
|
1892
|
-
selected: S.value.nonTemplateItem,
|
|
1893
|
-
onClick: a[3] || (a[3] = (C) => S.value.nonTemplateItem = !S.value.nonTemplateItem)
|
|
1894
|
-
}, null, 8, ["selected"])
|
|
1895
|
-
]),
|
|
1896
|
-
D(v, {
|
|
1897
|
-
modelValue: xe.value,
|
|
1898
|
-
"onUpdate:modelValue": a[4] || (a[4] = (C) => xe.value = C),
|
|
1899
|
-
placeholder: "Filter items"
|
|
1900
|
-
}, null, 8, ["modelValue"])
|
|
1901
|
-
]),
|
|
1902
|
-
$(_).skuTags.size ? (F(), E("div", Pa, [
|
|
1903
|
-
(F(!0), E(le, null, Te($(_).skuTags.keys(), (C) => (F(), ie(x, {
|
|
1904
|
-
key: `${C}`,
|
|
1905
|
-
label: `${C}`,
|
|
1906
|
-
selectable: "",
|
|
1907
|
-
selected: N[`${C}`],
|
|
1908
|
-
onClick: (G) => N[`${C}`] = !N[`${C}`]
|
|
1909
|
-
}, {
|
|
1910
|
-
default: Q(() => [
|
|
1911
|
-
N[`${C}`] ? (F(), ie(T, {
|
|
1912
|
-
key: 0,
|
|
1913
|
-
name: "check",
|
|
1914
|
-
class: "text-white",
|
|
1915
|
-
size: "sm"
|
|
1916
|
-
})) : ne("", !0),
|
|
1917
|
-
c("span", {
|
|
1918
|
-
class: Fe([
|
|
1919
|
-
"",
|
|
1920
|
-
{
|
|
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}`]
|
|
1923
|
-
}
|
|
1924
|
-
])
|
|
1925
|
-
}, ae(C), 3)
|
|
1926
|
-
]),
|
|
1927
|
-
_: 2
|
|
1928
|
-
}, 1032, ["label", "selected", "onClick"]))), 128))
|
|
1929
|
-
])) : ne("", !0),
|
|
1930
|
-
c("div", Ra, [
|
|
1931
|
-
c("div", {
|
|
1932
|
-
style: gt({ height: "600px", minWidth: `${Ue.value}px` })
|
|
1933
|
-
}, [
|
|
1934
|
-
D(j, {
|
|
1935
|
-
"column-defs": Ce.value,
|
|
1936
|
-
"row-data": $e.value,
|
|
1937
|
-
"search-value": xe.value
|
|
1938
|
-
}, null, 8, ["column-defs", "row-data", "search-value"])
|
|
1939
|
-
], 4)
|
|
1940
|
-
])
|
|
1941
|
-
], 64))
|
|
1942
|
-
])
|
|
1943
|
-
], 64)) : ne("", !0),
|
|
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, [
|
|
1950
|
-
c("div", {
|
|
1951
|
-
class: Fe([
|
|
1952
|
-
{
|
|
1953
|
-
"bg-fm-color-primary": G !== 0,
|
|
1954
|
-
"bg-white": G === 0
|
|
1955
|
-
},
|
|
1956
|
-
"w-[2px] h-full"
|
|
1957
|
-
])
|
|
1958
|
-
}, null, 2)
|
|
1959
|
-
]),
|
|
1960
|
-
a[18] || (a[18] = c("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
|
|
1961
|
-
c("div", Oa, [
|
|
1962
|
-
c("div", {
|
|
1963
|
-
class: Fe([
|
|
1964
|
-
{
|
|
1965
|
-
"bg-fm-color-primary": G < we.value.length - 1,
|
|
1966
|
-
"bg-white": G >= we.value.length - 1
|
|
1967
|
-
},
|
|
1968
|
-
"w-[2px] h-full"
|
|
1969
|
-
])
|
|
1970
|
-
}, null, 2)
|
|
1971
|
-
])
|
|
1972
|
-
]),
|
|
1973
|
-
c("div", Ya, [
|
|
1974
|
-
c("div", Ka, ae(C.header), 1),
|
|
1975
|
-
c("div", Qa, ae(C.date), 1)
|
|
1976
|
-
])
|
|
1977
|
-
]),
|
|
1978
|
-
c("div", qa, [
|
|
1979
|
-
c("div", Ga, [
|
|
1980
|
-
c("div", Wa, [
|
|
1981
|
-
c("div", {
|
|
1982
|
-
class: Fe([
|
|
1983
|
-
{
|
|
1984
|
-
"bg-fm-color-primary": G < we.value.length - 1,
|
|
1985
|
-
"bg-white": G >= we.value.length - 1
|
|
1986
|
-
},
|
|
1987
|
-
"w-[2px] h-full"
|
|
1988
|
-
])
|
|
1989
|
-
}, null, 2)
|
|
1990
|
-
])
|
|
1991
|
-
]),
|
|
1992
|
-
c("div", Za, [
|
|
1993
|
-
D(o, {
|
|
1994
|
-
variant: "outlined",
|
|
1995
|
-
class: "py-12 px-16"
|
|
1996
|
-
}, {
|
|
1997
|
-
default: Q(() => [
|
|
1998
|
-
c("div", Ja, [
|
|
1999
|
-
(F(!0), E(le, null, Te(C.info, (ee, pe) => (F(), E("div", {
|
|
2000
|
-
key: pe,
|
|
2001
|
-
class: "flex flex-col gap-4"
|
|
2002
|
-
}, [
|
|
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,
|
|
2007
|
-
class: "fm-typo-en-body-lg-600"
|
|
2008
|
-
}, ae(Be), 1))), 128))
|
|
2009
|
-
])
|
|
2010
|
-
]))), 128))
|
|
2011
|
-
])
|
|
2012
|
-
]),
|
|
2013
|
-
_: 2
|
|
2014
|
-
}, 1024)
|
|
2015
|
-
])
|
|
2016
|
-
])
|
|
2017
|
-
], 64))), 128))
|
|
2018
|
-
])) : (F(), E("div", Va, [
|
|
2019
|
-
D(re),
|
|
2020
|
-
c("div", null, [
|
|
2021
|
-
c("img", {
|
|
2022
|
-
src: $(aa),
|
|
2023
|
-
alt: "List is empty"
|
|
2024
|
-
}, null, 8, La)
|
|
2025
|
-
]),
|
|
2026
|
-
a[16] || (a[16] = c("div", { class: "fm-typo-en-body-lg-600" }, ae("No records found"), -1)),
|
|
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)),
|
|
2028
|
-
D(re),
|
|
2029
|
-
D(re)
|
|
2030
|
-
]))
|
|
2031
|
-
])) : ne("", !0)
|
|
2032
|
-
])
|
|
2033
|
-
]),
|
|
2034
|
-
_: 1
|
|
2035
|
-
}, 8, ["model-value"]);
|
|
2036
|
-
};
|
|
2037
|
-
}
|
|
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({
|
|
2039
|
-
__name: "ClosingDraftView",
|
|
2040
|
-
setup(r) {
|
|
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(_) {
|
|
2045
|
-
switch (_) {
|
|
2046
|
-
case "refresh":
|
|
2047
|
-
return b.fetchDrafts();
|
|
2048
|
-
}
|
|
2049
|
-
}
|
|
2050
|
-
function u(_) {
|
|
2051
|
-
return _;
|
|
2052
|
-
}
|
|
2053
|
-
const t = L(() => P.value ? [
|
|
2054
|
-
{
|
|
2055
|
-
label: s("inventory.common.refresh"),
|
|
2056
|
-
value: "refresh",
|
|
2057
|
-
isPrimary: !1
|
|
2058
|
-
}
|
|
2059
|
-
] : [
|
|
2060
|
-
{
|
|
2061
|
-
label: s("inventory.common.refresh"),
|
|
2062
|
-
value: "refresh",
|
|
2063
|
-
isPrimary: !1
|
|
2064
|
-
}
|
|
2065
|
-
]);
|
|
2066
|
-
return (_, R) => {
|
|
2067
|
-
const N = z("FmTable");
|
|
2068
|
-
return F(), E(le, null, [
|
|
2069
|
-
D(Vt, {
|
|
2070
|
-
title: $(s)("inventory.closing.draft.title"),
|
|
2071
|
-
actions: t.value,
|
|
2072
|
-
"onClick:action": q
|
|
2073
|
-
}, {
|
|
2074
|
-
default: Q(() => [
|
|
2075
|
-
c("div", {
|
|
2076
|
-
class: Fe([
|
|
2077
|
-
"flex flex-col gap-8 max-h-full",
|
|
2078
|
-
{
|
|
2079
|
-
"p-0": P.value,
|
|
2080
|
-
"px-24 ": !P.value
|
|
2081
|
-
}
|
|
2082
|
-
])
|
|
2083
|
-
}, [
|
|
2084
|
-
D(ta, {
|
|
2085
|
-
"change-location": "",
|
|
2086
|
-
searchable: "",
|
|
2087
|
-
search: k.value,
|
|
2088
|
-
"onUpdate:search": R[0] || (R[0] = (g) => k.value = g)
|
|
2089
|
-
}, null, 8, ["search"]),
|
|
2090
|
-
D(N, {
|
|
2091
|
-
style: gt($(I).tableHeight),
|
|
2092
|
-
"column-defs": $(b).columnDefs,
|
|
2093
|
-
"row-data": $(b).drafts,
|
|
2094
|
-
"search-value": k.value,
|
|
2095
|
-
loading: U.value,
|
|
2096
|
-
onRowClick: R[1] || (R[1] = (g) => $(e)(g.original)),
|
|
2097
|
-
"page-size": B.value
|
|
2098
|
-
}, {
|
|
2099
|
-
"list-row": Q((g) => [
|
|
2100
|
-
D(Xt, {
|
|
2101
|
-
row: g,
|
|
2102
|
-
onRowClick: (m) => $(e)(m)
|
|
2103
|
-
}, {
|
|
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;
|
|
2106
|
-
return [
|
|
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)
|
|
2113
|
-
}, null, 8, ["render", "props"])
|
|
2114
|
-
]),
|
|
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)
|
|
2119
|
-
}, null, 8, ["render", "props"])
|
|
2120
|
-
]),
|
|
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`] : []
|
|
2124
|
-
].join(", ")), 1),
|
|
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)
|
|
2129
|
-
}, null, 8, ["render", "props"])
|
|
2130
|
-
])
|
|
2131
|
-
]),
|
|
2132
|
-
c("div", null, [
|
|
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)
|
|
2136
|
-
}, null, 8, ["render", "props"])
|
|
2137
|
-
])
|
|
2138
|
-
])
|
|
2139
|
-
];
|
|
2140
|
-
}),
|
|
2141
|
-
_: 2
|
|
2142
|
-
}, 1032, ["row", "onRowClick"])
|
|
2143
|
-
]),
|
|
2144
|
-
_: 1
|
|
2145
|
-
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
|
|
2146
|
-
], 2)
|
|
2147
|
-
]),
|
|
2148
|
-
_: 1
|
|
2149
|
-
}, 8, ["title", "actions"]),
|
|
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))
|
|
2156
|
-
}), null, 16, ["show"])
|
|
2157
|
-
]))
|
|
2158
|
-
], 64);
|
|
2159
|
-
};
|
|
2160
|
-
}
|
|
2161
|
-
});
|
|
2162
|
-
export {
|
|
2163
|
-
$n as default
|
|
2164
|
-
};
|