@feedmepos/mf-inventory-portal 1.0.8 → 1.0.9-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-DeBNx7kq.js → App-DfxhucPn.js} +50 -49
- package/dist/{ApprovalView-CYgDG4X-.js → ApprovalView-BUYgTb8S.js} +24 -24
- package/dist/{BindingsDialog-Bojdsd9h.js → BindingsDialog-Cbs9aVch.js} +2 -2
- package/dist/{BindingsPicker-TkiARkrC.js → BindingsPicker-BH9bil6g.js} +3 -3
- package/dist/{BindingsTable-BWYaPoFt.js → BindingsTable-DBsS_9yb.js} +1 -1
- package/dist/ClosingDraftView-CcQssDLY.js +1415 -0
- package/dist/{ClosingTemplateView-CUjkAFjw.js → ClosingTemplateView-BHPqi-bL.js} +10 -10
- package/dist/{DeliveryOrderPrintPreview-BOEKl7zP.js → DeliveryOrderPrintPreview-DlTLtZ1f.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Bve5cng3.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CtJSPDCo.js} +32 -32
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-1-G4gmCj.js → FmUnitInput.vue_vue_type_script_setup_true_lang-B-erI7fq.js} +51 -51
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-Bl526zYj.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DT4nyE8i.js} +1 -1
- package/dist/{IngredientGroupView-stli1Xiv.js → IngredientGroupView-DE15kdqH.js} +11 -11
- package/dist/{IngredientsView-jmDSRSkr.js → IngredientsView-BCEznLxB.js} +15 -14
- package/dist/{IntegrationView-BQZtDqlR.js → IntegrationView-COSJuqnB.js} +146 -145
- package/dist/{InventoryBindingForm-hHgB20dI.js → InventoryBindingForm-B3C8gktf.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BK36mlQE.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-Bn2X1jxB.js} +20 -20
- package/dist/{InventoryBindingSummary-JsAhd0Jm.js → InventoryBindingSummary-BF1OtGum.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C4A6bDPB.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BMTXHa4I.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-C6bND0mn.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CZR7wF6-.js} +10 -10
- package/dist/{PublishView-BK7WwXeV.js → PublishView-Cp5tpVb0.js} +12 -12
- package/dist/{PurchaseOrderPrintPreview-CMnaZkzc.js → PurchaseOrderPrintPreview-DWOcxCH8.js} +4 -4
- package/dist/{ReceiveRequestView-Bb6RQyJ8.js → ReceiveRequestView-CRuhm8r1.js} +53 -52
- package/dist/{RecipeView-CZnElbJ8.js → RecipeView-BTS1LBKZ.js} +29 -29
- package/dist/{StockView-CDAHrTyi.js → StockView-CuK8s5rt.js} +73 -72
- package/dist/{SupplierView-WTgrwbJ_.js → SupplierView-Bwpe9RoM.js} +12 -11
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DDAZMTzq.js +1897 -0
- package/dist/{TransferTemplateView-26w6orAY.js → TransferTemplateView-BlluEiV-.js} +291 -290
- package/dist/{UnitView-DAl0OS01.js → UnitView-BWGQHOWP.js} +23 -23
- package/dist/{WarehouseView-Db2wXza_.js → WarehouseView-dOCu22dg.js} +26 -26
- package/dist/api/bill.d.ts +2 -2
- package/dist/api/food-market-hub.d.ts +1 -1
- package/dist/api/inventory.d.ts +44 -44
- package/dist/api/netsuite.d.ts +3 -3
- package/dist/api/purchase-order.d.ts +5 -1
- package/dist/api/stock.d.ts +1 -0
- package/dist/{app-Ch3IXeOL.js → app-BkIAyhP-.js} +16504 -16961
- package/dist/app.d.ts +7 -7
- package/dist/app.js +1 -1
- package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +8 -8
- package/dist/components/shell/inventory/binding-dialog.vue.d.ts +2 -2
- package/dist/components/shell/inventory/binding-ui.vue.d.ts +5 -5
- package/dist/composable/usePromise.d.ts +41 -0
- package/dist/{decimal-BFWsfQmw.js → decimal-BiC7uGww.js} +1 -1
- package/dist/feature-CCDDWpq8.js +17319 -0
- package/dist/{format-unit-display-CyBzA_Ye.js → format-unit-display-CLa0op_h.js} +60 -60
- package/dist/{index-CKB7R0y2.js → index-BbFvsU1Z.js} +7 -6
- package/dist/{index-CSjhH3PC.js → index-UgbyiGok.js} +1 -1
- package/dist/{stock-BjY9UvKO.js → stock-SxO4bxTm.js} +29 -25
- package/dist/stores/feature.d.ts +5 -20
- package/dist/stores/integration/foodmarkethub.d.ts +1 -1
- package/dist/stores/integration/netsuite.d.ts +7 -7
- package/dist/stores/inventory.d.ts +44 -44
- package/dist/stores/location.d.ts +137 -137
- package/dist/{supplier-8x-ZFcOk.js → supplier-BVdCk7nI.js} +4 -4
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-CxZAaSGc.js → use-ingredient-select-dialog-CDeGXhur.js} +1 -1
- package/dist/{use-inventory-binding-dialog-Kmg24YiM.js → use-inventory-binding-dialog-CeRKqMy7.js} +1 -1
- package/dist/views/adjustment-template/wastage-template/actions.d.ts +228 -228
- package/dist/views/adjustment-template/wastage-template/form/WastageTemplateItemTable.vue.d.ts +2 -2
- package/dist/views/adjustment-template/wastage-template/form/useAdjustmentTemplateItems.d.ts +1 -1
- package/dist/views/adjustment-template/wastage-template/table.d.ts +234 -234
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +780 -74
- package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +424 -409
- package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +4 -4
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +252 -252
- package/dist/views/closing-template/composables/use-closing-template-table.d.ts +252 -252
- package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +12 -12
- package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +2 -2
- package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +8 -8
- package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +3 -3
- package/dist/views/ingredients/composables/use-ingredient-table.d.ts +4 -4
- package/dist/views/integration/components/ApplyProduct.vue.d.ts +2 -2
- package/dist/views/integration/components/ApplyProductDialog.vue.d.ts +2 -2
- package/dist/views/integration/components/ApplyProductDialogV4.vue.d.ts +2 -2
- package/dist/views/integration/components/netsuite/AddLocationDialog.vue.d.ts +204 -204
- package/dist/views/integration/components/netsuite/LocationConfigurationDialog.vue.d.ts +2 -2
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +665 -637
- package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +22 -22
- package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +44 -44
- package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +11 -11
- package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +614 -0
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +1190 -1142
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +1192 -1144
- package/dist/views/receive-request/constants/po-action-to-ui-style.d.ts +6 -0
- package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +2 -2
- package/dist/views/stock/components/StockRecordCard.vue.d.ts +1 -1
- package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +14 -14
- package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +22 -22
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +17 -17
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +11 -11
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +805 -805
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +805 -805
- package/dist/views/transfer-template/composables/useTransferTemplateHelper.d.ts +33 -33
- package/dist/{vue-i18n-CXd9SF_G.js → vue-i18n-3Mh8tKq8.js} +341 -341
- package/package.json +3 -1
- package/dist/ClosingDraftView-C0ECZ9zi.js +0 -1394
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-mHNmxBuV.js +0 -1746
|
@@ -0,0 +1,1415 @@
|
|
|
1
|
+
import { defineComponent as Fe, ref as O, resolveComponent as U, openBlock as h, createBlock as W, withCtx as Y, createElementVNode as o, createTextVNode as Be, toDisplayString as N, unref as g, createVNode as w, h as S, reactive as We, computed as E, onMounted as Ze, watch as Je, isRef as Ie, createElementBlock as P, Fragment as q, createCommentVNode as ee, normalizeClass as pe, renderList as be, normalizeStyle as Ue, Teleport as Xe, mergeProps as Qe } from "vue";
|
|
2
|
+
import { X as et, u as Se, af as Z, l as tt, J as $e, i as M, t as at, K as he, q as nt, r as ot, s as st, ag as Ee, ah as He, a3 as Le, ai as ne, a9 as rt, ae, V as ze, D as Pe, h as _e, f as lt, e as ct, a as it, z as ut, _ as dt, B as mt, C as ft, E as ke } from "./app-BkIAyhP-.js";
|
|
3
|
+
import { useCoreStore as pt, useI18n as Ne } from "@feedmepos/mf-common";
|
|
4
|
+
import { useSnackbar as Re, useDialog as vt, useProxiedModel as yt, components as fe, useBreakpoints as gt } from "@feedmepos/ui-library";
|
|
5
|
+
import { defineStore as Oe, storeToRefs as bt } from "pinia";
|
|
6
|
+
import { a as Ve, u as Ye } from "./stock-SxO4bxTm.js";
|
|
7
|
+
import { E as ht } from "./empty-placeholder-wf6-BWE8.js";
|
|
8
|
+
const je = et((n, r) => {
|
|
9
|
+
function e() {
|
|
10
|
+
return Se().currentLocation.dbName;
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
async getDraft(i) {
|
|
14
|
+
const u = e(), b = `${n.inventoryBackendUrl}/${u}/closing-draft/${i}`;
|
|
15
|
+
return r.get(b);
|
|
16
|
+
},
|
|
17
|
+
async readDrafts() {
|
|
18
|
+
const i = e(), u = `${n.inventoryBackendUrl}/${i}/closing-draft`;
|
|
19
|
+
return r.get(u);
|
|
20
|
+
},
|
|
21
|
+
async runOperation(i) {
|
|
22
|
+
const u = e(), b = `${n.inventoryBackendUrl}/${u}/closing-draft/run-operation`;
|
|
23
|
+
return r.post(b, i);
|
|
24
|
+
},
|
|
25
|
+
async sync(i) {
|
|
26
|
+
const u = e(), b = `${n.inventoryBackendUrl}/${u}/closing-draft/sync`;
|
|
27
|
+
return r.post(b, i);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}), xt = { class: "fm-typo-en-body-lg-400" }, At = { class: "fm-typo-en-body-lg-600" }, Dt = { class: "flex gap-12 py-8 justify-end w-full" }, Me = /* @__PURE__ */ Fe({
|
|
31
|
+
__name: "ClosingDraftAction",
|
|
32
|
+
props: {
|
|
33
|
+
draft: {},
|
|
34
|
+
action: {},
|
|
35
|
+
onCancel: { type: Function },
|
|
36
|
+
onFinished: { type: Function }
|
|
37
|
+
},
|
|
38
|
+
setup(n) {
|
|
39
|
+
const r = n, e = O(), i = je(), u = Re(), b = O(!1);
|
|
40
|
+
async function x() {
|
|
41
|
+
b.value = !0;
|
|
42
|
+
try {
|
|
43
|
+
await i.runOperation({
|
|
44
|
+
_id: r.draft._id,
|
|
45
|
+
_rev: r.draft._rev ?? "",
|
|
46
|
+
action: r.action,
|
|
47
|
+
data: {
|
|
48
|
+
remark: e.value
|
|
49
|
+
}
|
|
50
|
+
}).delayed(500), u.open({
|
|
51
|
+
title: "Success",
|
|
52
|
+
message: "Action submitted",
|
|
53
|
+
type: "success"
|
|
54
|
+
}), r.onFinished();
|
|
55
|
+
} catch (C) {
|
|
56
|
+
u.open({
|
|
57
|
+
title: "Something went wrong",
|
|
58
|
+
message: "Unable to submit actino. Please try again",
|
|
59
|
+
type: "error"
|
|
60
|
+
}), console.error("error on submit closing draft aciont", C);
|
|
61
|
+
} finally {
|
|
62
|
+
b.value = !1;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return (C, d) => {
|
|
66
|
+
const F = U("FmTextField"), R = U("FmButton"), H = U("FmForm");
|
|
67
|
+
return h(), W(H, {
|
|
68
|
+
onValidationSuccess: x,
|
|
69
|
+
class: "flex flex-col gap-32",
|
|
70
|
+
disabled: b.value
|
|
71
|
+
}, {
|
|
72
|
+
default: Y(() => [
|
|
73
|
+
o("div", xt, [
|
|
74
|
+
d[2] || (d[2] = Be(" You are about to ")),
|
|
75
|
+
o("span", At, N(C.action == g(Z).enum.approveDraft ? "approve" : "reject"), 1),
|
|
76
|
+
d[3] || (d[3] = Be(" this draft. Please provider a remark to justify this action. "))
|
|
77
|
+
]),
|
|
78
|
+
w(F, {
|
|
79
|
+
modelValue: e.value,
|
|
80
|
+
"onUpdate:modelValue": d[0] || (d[0] = (I) => e.value = I),
|
|
81
|
+
label: "Remark",
|
|
82
|
+
"label-mark": "required",
|
|
83
|
+
rules: [g(tt)()]
|
|
84
|
+
}, null, 8, ["modelValue", "rules"]),
|
|
85
|
+
o("div", Dt, [
|
|
86
|
+
w(R, {
|
|
87
|
+
label: "Cancel",
|
|
88
|
+
variant: "tertiary",
|
|
89
|
+
onClick: d[1] || (d[1] = (I) => C.onCancel())
|
|
90
|
+
}),
|
|
91
|
+
w(R, {
|
|
92
|
+
label: C.action == g(Z).enum.approveDraft ? "Approve" : "Reject",
|
|
93
|
+
type: "submit",
|
|
94
|
+
variant: C.action == g(Z).enum.approveDraft ? "primary" : "destructive",
|
|
95
|
+
loading: b.value
|
|
96
|
+
}, null, 8, ["label", "variant", "loading"])
|
|
97
|
+
])
|
|
98
|
+
]),
|
|
99
|
+
_: 1
|
|
100
|
+
}, 8, ["disabled"]);
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}), _t = he(0);
|
|
104
|
+
function Ke(n) {
|
|
105
|
+
const r = n.measurementsAmounts.groupBy((i) => i.measurement.id), e = n.sku.unit.measurements.reduce((i, u) => {
|
|
106
|
+
var C, d;
|
|
107
|
+
const b = ((d = (C = r.get(u.id)) == null ? void 0 : C[0]) == null ? void 0 : d.amount) ?? _t, x = $e(u.conversion, b);
|
|
108
|
+
return i + +M(x);
|
|
109
|
+
}, +M(n.baseAmount));
|
|
110
|
+
return at(e, n.baseAmount.precision);
|
|
111
|
+
}
|
|
112
|
+
const kt = he(0), wt = he(100);
|
|
113
|
+
function Ct(n, r, e) {
|
|
114
|
+
const i = Ke(n), u = Ee(i, r), b = r.amount === 0 ? null : He(u, {
|
|
115
|
+
...r,
|
|
116
|
+
amount: Math.abs(r.amount)
|
|
117
|
+
}), x = b ? $e(b, wt) : null;
|
|
118
|
+
return {
|
|
119
|
+
code: n.sku.code,
|
|
120
|
+
name: n.sku.name,
|
|
121
|
+
baseUnit: n.sku.unit.abbrev,
|
|
122
|
+
baseUnitAmount: +M(n.baseAmount),
|
|
123
|
+
...n.measurementsAmounts.filter(
|
|
124
|
+
(d) => St(d.measurement) && e.includes(d.measurement.id)
|
|
125
|
+
).reduce(
|
|
126
|
+
(d, F, R) => (d[`measurementAbbrev${R}`] = `(${F.measurement.abbrev}) × ${M(F.measurement.conversion)}`, d[`measurementAmount${R}`] = +M(F.amount), d),
|
|
127
|
+
{}
|
|
128
|
+
),
|
|
129
|
+
systemBalance: +M(r),
|
|
130
|
+
physicalBalance: +M(i),
|
|
131
|
+
adjustedAmount: +M(u),
|
|
132
|
+
adjustedDiffPercentage: x ? +M(Le(x, 2)) : null
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function St(n) {
|
|
136
|
+
return !n.abbrev.toLocaleLowerCase().includes("inactive");
|
|
137
|
+
}
|
|
138
|
+
function jt(n) {
|
|
139
|
+
const r = Ge(n);
|
|
140
|
+
return n.reduce(
|
|
141
|
+
(e, i) => {
|
|
142
|
+
var u;
|
|
143
|
+
return Math.max(e, ((u = r == null ? void 0 : r.get(i.sku._id)) == null ? void 0 : u[0].length) ?? 0);
|
|
144
|
+
},
|
|
145
|
+
0
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
function Ge(n) {
|
|
149
|
+
return n.groupBy(
|
|
150
|
+
(r) => r.sku._id,
|
|
151
|
+
(r) => r.measurementsAmounts.filter((e) => !e.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((e) => e.measurement.id)
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
function Bt(n) {
|
|
155
|
+
return [
|
|
156
|
+
{
|
|
157
|
+
id: "code",
|
|
158
|
+
name: "Code"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
id: "name",
|
|
162
|
+
name: "Name"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
id: "systemBalance",
|
|
166
|
+
name: "Balance"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: "physicalBalance",
|
|
170
|
+
name: "Actual balance"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
id: "adjustedAmount",
|
|
174
|
+
name: "Adjusted balance"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
id: "adjustedDiffPercentage",
|
|
178
|
+
name: "Diff (%)"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
id: "baseUnitAmount",
|
|
182
|
+
name: "Base unit amount"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
id: "baseUnit",
|
|
186
|
+
name: "Base unit"
|
|
187
|
+
},
|
|
188
|
+
...Array.from({ length: n }).flatMap((e, i) => [
|
|
189
|
+
{
|
|
190
|
+
id: `measurementAmount${i}`,
|
|
191
|
+
name: `UOM amount ${i + 1}`
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
id: `measurementAbbrev${i}`,
|
|
195
|
+
name: `UOM ${i + 1}`
|
|
196
|
+
}
|
|
197
|
+
])
|
|
198
|
+
];
|
|
199
|
+
}
|
|
200
|
+
function Ft(n, r) {
|
|
201
|
+
var p, v, y, A, L, D, T;
|
|
202
|
+
const e = r.groupBy(
|
|
203
|
+
(j) => j.id,
|
|
204
|
+
(j) => j.balance
|
|
205
|
+
), i = [...n.items, ...n.negativeStockItems ?? []], u = Ge(i), b = i.map((j) => {
|
|
206
|
+
var X, se;
|
|
207
|
+
const J = ((X = e.get(j.sku._id)) == null ? void 0 : X[0]) ?? kt, oe = ((se = u == null ? void 0 : u.get(j.sku._id)) == null ? void 0 : se[0]) ?? [];
|
|
208
|
+
return Ct(j, J, oe);
|
|
209
|
+
}), x = jt(i), d = pt().currentBusiness.value, F = Bt(x), R = [
|
|
210
|
+
["Business name:", d == null ? void 0 : d.name],
|
|
211
|
+
["Business ID:", d == null ? void 0 : d._id],
|
|
212
|
+
["Menu version", d == null ? void 0 : d.menuVersion],
|
|
213
|
+
["Created at", new Date(n.createdAt)],
|
|
214
|
+
["Created by", (p = n.createdBy) == null ? void 0 : p.name],
|
|
215
|
+
["Updated at", new Date(n.updatedAt)],
|
|
216
|
+
["Updated by", (v = n.updatedBy) == null ? void 0 : v.name],
|
|
217
|
+
["Recent action", n.approvedAt ? "Approve" : n.rejectionHistory ? "Reject" : ""],
|
|
218
|
+
[
|
|
219
|
+
"Action by",
|
|
220
|
+
n.approvedAt ? (y = n.approvedBy) == null ? void 0 : y.name : n.rejectionHistory ? (L = (A = n.rejectionHistory[0]) == null ? void 0 : A.rejectedBy) == null ? void 0 : L.name : ""
|
|
221
|
+
],
|
|
222
|
+
[
|
|
223
|
+
"Action at",
|
|
224
|
+
n.approvedAt ? new Date(n.approvedAt) : n.rejectionHistory ? new Date((D = n.rejectionHistory[0]) == null ? void 0 : D.rejectedAt) : ""
|
|
225
|
+
],
|
|
226
|
+
[
|
|
227
|
+
"Action remark",
|
|
228
|
+
n.approvedAt ? n.approveRemark : n.rejectionHistory ? new Date((T = n.rejectionHistory[0]) == null ? void 0 : T.rejectRemark) : ""
|
|
229
|
+
],
|
|
230
|
+
[],
|
|
231
|
+
F.map((j) => j.name),
|
|
232
|
+
...b.map((j) => F.map((J) => j[J.id]))
|
|
233
|
+
], H = F.map((j) => `system:${j.id}`), I = nt(R, H), l = `[${d == null ? void 0 : d.name}] closing draft (${ot(new Date(n.updatedAt))}).xlsx`;
|
|
234
|
+
return st(I, l), l;
|
|
235
|
+
}
|
|
236
|
+
const Ce = Oe(
|
|
237
|
+
"closingDraftActions",
|
|
238
|
+
function() {
|
|
239
|
+
const r = vt(), e = Re(), i = Ve(), u = je(), b = Ye(), x = O(!1), C = O();
|
|
240
|
+
function d(v) {
|
|
241
|
+
const y = {
|
|
242
|
+
draft: v
|
|
243
|
+
};
|
|
244
|
+
C.value = y, x.value = !0;
|
|
245
|
+
}
|
|
246
|
+
async function F(v) {
|
|
247
|
+
var A;
|
|
248
|
+
if (v.status === ne.enum.COMPLETED) {
|
|
249
|
+
const L = v.closingAdjustmentId;
|
|
250
|
+
if (!L)
|
|
251
|
+
return e.open({
|
|
252
|
+
title: "Something went wrong",
|
|
253
|
+
message: "Closing draft is completed but closing document cannot be found.",
|
|
254
|
+
type: "error"
|
|
255
|
+
}), console.error("Closing draft is completed but closing document cannot be found.", {
|
|
256
|
+
draftId: v._id
|
|
257
|
+
}), [];
|
|
258
|
+
const D = await i.readAdjustmentById(L);
|
|
259
|
+
return ((D == null ? void 0 : D.skus) ?? []).map((j) => ({
|
|
260
|
+
id: j.sku._id,
|
|
261
|
+
balance: j.fromBalance,
|
|
262
|
+
costs: j.fromCostBalances
|
|
263
|
+
}));
|
|
264
|
+
} else
|
|
265
|
+
return await b.readStockBalance(), ((A = b.stockBalance) == null ? void 0 : A.skus) ?? [];
|
|
266
|
+
}
|
|
267
|
+
async function R(v, y) {
|
|
268
|
+
y || (e.open({
|
|
269
|
+
title: "Exporting",
|
|
270
|
+
message: "Fetching data..."
|
|
271
|
+
}), y = await F(v)), Ft(v, y);
|
|
272
|
+
}
|
|
273
|
+
function H(v, y) {
|
|
274
|
+
r.open({
|
|
275
|
+
title: "Approve draft",
|
|
276
|
+
contentComponent: Me,
|
|
277
|
+
contentComponentProps: {
|
|
278
|
+
draft: v,
|
|
279
|
+
action: Z.enum.approveDraft,
|
|
280
|
+
onFinished: () => {
|
|
281
|
+
r.close(), y == null || y();
|
|
282
|
+
},
|
|
283
|
+
onCancel: () => r.close()
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
function I(v, y) {
|
|
288
|
+
r.open({
|
|
289
|
+
title: "Reject draft",
|
|
290
|
+
contentComponent: Me,
|
|
291
|
+
contentComponentProps: {
|
|
292
|
+
draft: v,
|
|
293
|
+
action: Z.enum.rejectDraft,
|
|
294
|
+
onFinished: () => {
|
|
295
|
+
r.close(), y == null || y();
|
|
296
|
+
},
|
|
297
|
+
onCancel: () => r.close()
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
async function l(v, y) {
|
|
302
|
+
await u.sync({
|
|
303
|
+
_id: v._id,
|
|
304
|
+
_rev: v._rev ?? "",
|
|
305
|
+
action: Z.enum.approveDraft,
|
|
306
|
+
data: {
|
|
307
|
+
remark: v.remark ?? ""
|
|
308
|
+
}
|
|
309
|
+
}).delayed(500), e.open({
|
|
310
|
+
title: "Success",
|
|
311
|
+
message: "Sync requested",
|
|
312
|
+
type: "success"
|
|
313
|
+
}), y == null || y();
|
|
314
|
+
}
|
|
315
|
+
function p() {
|
|
316
|
+
x.value = !1;
|
|
317
|
+
}
|
|
318
|
+
return {
|
|
319
|
+
viewDraft: d,
|
|
320
|
+
closeDraftDialog: p,
|
|
321
|
+
approveDraft: H,
|
|
322
|
+
rejectDraft: I,
|
|
323
|
+
syncDraft: l,
|
|
324
|
+
exportDraft: R,
|
|
325
|
+
viewClosingDraftShow: x,
|
|
326
|
+
viewClosingDraftProps: C
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
);
|
|
330
|
+
function we(n) {
|
|
331
|
+
switch (n) {
|
|
332
|
+
case "DRAFT":
|
|
333
|
+
return "fm-status-badge-draft";
|
|
334
|
+
case "PROCESSING":
|
|
335
|
+
return "fm-status-badge-processing";
|
|
336
|
+
case "FAILED":
|
|
337
|
+
return "fm-status-badge-cancel";
|
|
338
|
+
case "COMPLETED":
|
|
339
|
+
return "fm-status-badge-complete";
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
const $t = Oe(
|
|
343
|
+
"closingDraftTable",
|
|
344
|
+
function() {
|
|
345
|
+
const { t: r } = Ne(), e = Ce(), i = O(new Array()), u = O(!1), b = Se(), x = je();
|
|
346
|
+
async function C() {
|
|
347
|
+
if (i.value = [], !!b._currentLocation) {
|
|
348
|
+
u.value = !0;
|
|
349
|
+
try {
|
|
350
|
+
const [l] = await Promise.all([x.readDrafts()]).delayed(1e3);
|
|
351
|
+
i.value = l.reverse();
|
|
352
|
+
} catch (l) {
|
|
353
|
+
console.log("Something went wrong when fetching drafts:", l);
|
|
354
|
+
} finally {
|
|
355
|
+
u.value = !1;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
async function d(l) {
|
|
360
|
+
if (!i.value.find((p) => p._id) && b._currentLocation) {
|
|
361
|
+
u.value = !0;
|
|
362
|
+
try {
|
|
363
|
+
const [p] = await Promise.all([
|
|
364
|
+
x.getDraft(l),
|
|
365
|
+
new Promise((v) => setTimeout(v, 1e3))
|
|
366
|
+
]);
|
|
367
|
+
i.value = [p];
|
|
368
|
+
} catch (p) {
|
|
369
|
+
console.log("Something went wrong when fetching drafts:", p);
|
|
370
|
+
} finally {
|
|
371
|
+
u.value = !1;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
function F(l) {
|
|
376
|
+
i.value = i.value.map((p) => p._id === l._id ? {
|
|
377
|
+
...l,
|
|
378
|
+
_rev: p._rev
|
|
379
|
+
} : p);
|
|
380
|
+
}
|
|
381
|
+
function R() {
|
|
382
|
+
e.closeDraftDialog(), C();
|
|
383
|
+
}
|
|
384
|
+
function H(l, p) {
|
|
385
|
+
switch (p = ct(p), l) {
|
|
386
|
+
case _e.Details:
|
|
387
|
+
return e.viewDraft(p);
|
|
388
|
+
case _e.Export:
|
|
389
|
+
return e.exportDraft(p);
|
|
390
|
+
case Z.enum.approveDraft:
|
|
391
|
+
return e.approveDraft(p, R);
|
|
392
|
+
case Z.enum.rejectDraft:
|
|
393
|
+
return e.rejectDraft(p, R);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
return {
|
|
397
|
+
columnDefs: [
|
|
398
|
+
{
|
|
399
|
+
id: "_id",
|
|
400
|
+
accessorKey: "_id",
|
|
401
|
+
header: () => r("inventory.closing.table.createdAt"),
|
|
402
|
+
cell(l) {
|
|
403
|
+
return rt(`${l.getValue()}`);
|
|
404
|
+
},
|
|
405
|
+
enableSorting: !0
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
id: "updatedAt",
|
|
409
|
+
accessorFn: (l) => ae(l.updatedAt),
|
|
410
|
+
header: () => "Updated at",
|
|
411
|
+
enableSorting: !0,
|
|
412
|
+
size: 200
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
id: "updatedBy",
|
|
416
|
+
accessorKey: "updatedBy.name",
|
|
417
|
+
header: () => "Last update by",
|
|
418
|
+
enableSorting: !0,
|
|
419
|
+
size: 200
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
id: "noOfItems",
|
|
423
|
+
accessorFn: (l) => {
|
|
424
|
+
var p;
|
|
425
|
+
return l.items.length + (((p = l.negativeStockItems) == null ? void 0 : p.length) ?? 0);
|
|
426
|
+
},
|
|
427
|
+
header: () => r("inventory.closing.table.noOfItems"),
|
|
428
|
+
enableSorting: !1,
|
|
429
|
+
meta: {
|
|
430
|
+
width: "10rem",
|
|
431
|
+
textAlign: "right"
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
id: "recentRemark",
|
|
436
|
+
accessorFn: (l) => {
|
|
437
|
+
var p;
|
|
438
|
+
return (l == null ? void 0 : l.approveRemark) ?? ((p = l == null ? void 0 : l.rejectionHistory) == null ? void 0 : p.computeFirst((v) => v.rejectRemark)) ?? l.remark;
|
|
439
|
+
},
|
|
440
|
+
header: () => "Recent remark"
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
id: "status",
|
|
444
|
+
accessorFn: (l) => l.status,
|
|
445
|
+
header: () => r("inventory.closing.table.status"),
|
|
446
|
+
enableSorting: !1,
|
|
447
|
+
cell(l) {
|
|
448
|
+
var D;
|
|
449
|
+
const p = l.row.original, v = p.status, y = new Date(p.updatedAt), A = (D = p == null ? void 0 : p.rejectionHistory) == null ? void 0 : D.computeFirst((T) => T.rejectedAt), L = A ? new Date(A) : null;
|
|
450
|
+
return v === "DRAFT" && L ? L.getTime() > y.getTime() ? S(
|
|
451
|
+
"div",
|
|
452
|
+
{
|
|
453
|
+
class: "flex"
|
|
454
|
+
},
|
|
455
|
+
S(
|
|
456
|
+
"div",
|
|
457
|
+
{
|
|
458
|
+
class: ["fm-status-badge", we("FAILED")]
|
|
459
|
+
},
|
|
460
|
+
"Rejected"
|
|
461
|
+
)
|
|
462
|
+
) : S(
|
|
463
|
+
"div",
|
|
464
|
+
{
|
|
465
|
+
class: "flex"
|
|
466
|
+
},
|
|
467
|
+
S(
|
|
468
|
+
"div",
|
|
469
|
+
{
|
|
470
|
+
class: ["fm-status-badge", we("PROCESSING")]
|
|
471
|
+
},
|
|
472
|
+
"Updated"
|
|
473
|
+
)
|
|
474
|
+
) : S(
|
|
475
|
+
"div",
|
|
476
|
+
{
|
|
477
|
+
class: "flex"
|
|
478
|
+
},
|
|
479
|
+
S(
|
|
480
|
+
"div",
|
|
481
|
+
{
|
|
482
|
+
class: ["fm-status-badge", we(v)]
|
|
483
|
+
},
|
|
484
|
+
ze(v)
|
|
485
|
+
)
|
|
486
|
+
);
|
|
487
|
+
}
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
id: "action",
|
|
491
|
+
cell(l) {
|
|
492
|
+
const p = l.row.original, v = [
|
|
493
|
+
Pe[_e.Details],
|
|
494
|
+
Pe[_e.Export]
|
|
495
|
+
], y = [
|
|
496
|
+
{
|
|
497
|
+
translationKey: "inventory.closing.draft.approveDraft",
|
|
498
|
+
color: "text-fm-color-typo-primary",
|
|
499
|
+
value: Z.enum.approveDraft
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
translationKey: "inventory.closing.draft.rejectDraft",
|
|
503
|
+
color: "text-fm-color-typo-error",
|
|
504
|
+
value: Z.enum.rejectDraft
|
|
505
|
+
}
|
|
506
|
+
];
|
|
507
|
+
return lt(
|
|
508
|
+
[
|
|
509
|
+
...v,
|
|
510
|
+
...p.status === ne.enum.DRAFT ? y : []
|
|
511
|
+
],
|
|
512
|
+
(A) => H(A, p)
|
|
513
|
+
);
|
|
514
|
+
},
|
|
515
|
+
enableSorting: !1,
|
|
516
|
+
size: 40,
|
|
517
|
+
meta: {
|
|
518
|
+
cellClass: "",
|
|
519
|
+
headerClass: ""
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
],
|
|
523
|
+
drafts: i,
|
|
524
|
+
loading: u,
|
|
525
|
+
fetchDrafts: C,
|
|
526
|
+
loadDraft: d,
|
|
527
|
+
updateDraftRef: F
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
), Rt = { class: "w-full flex flex-col gap-32" }, Tt = { class: "flex justify-between" }, Pt = { class: "flex" }, Mt = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, It = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ut = { class: "flex gap-1" }, Et = { class: "fm-typo-en-body-lg-600" }, Ht = { class: "flex flex-col gap-16" }, Lt = { class: "flex items-center" }, zt = {
|
|
531
|
+
key: 0,
|
|
532
|
+
class: "flex gap-8"
|
|
533
|
+
}, Nt = {
|
|
534
|
+
key: 0,
|
|
535
|
+
class: "w-full flex flex-col items-center"
|
|
536
|
+
}, Ot = { class: "flex items-center gap-8" }, Vt = {
|
|
537
|
+
key: 0,
|
|
538
|
+
class: "flex gap-8"
|
|
539
|
+
}, Yt = { class: "overflow-x-auto" }, Kt = {
|
|
540
|
+
key: 1,
|
|
541
|
+
class: "flex-1 xs:w-screen xs:max-w-full"
|
|
542
|
+
}, Gt = {
|
|
543
|
+
key: 0,
|
|
544
|
+
class: "flex flex-col items-center gap-8 h-full"
|
|
545
|
+
}, qt = ["src"], Wt = {
|
|
546
|
+
key: 1,
|
|
547
|
+
class: "px-4 flex flex-col"
|
|
548
|
+
}, Zt = { class: "flex gap-12 content-stretch" }, Jt = {
|
|
549
|
+
class: "flex flex-col w-24",
|
|
550
|
+
name: "circles"
|
|
551
|
+
}, Xt = { class: "flex-1 flex flex-col items-center" }, Qt = { class: "flex-1 flex flex-col items-center" }, ea = {
|
|
552
|
+
class: "py-12 flex flex-col gap-4",
|
|
553
|
+
name: "received-at header"
|
|
554
|
+
}, ta = { class: "fm-typo-en-body-lg-400" }, aa = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, na = { class: "flex gap-12 content-stretch" }, oa = {
|
|
555
|
+
class: "flex flex-col w-24",
|
|
556
|
+
name: "circles"
|
|
557
|
+
}, sa = { class: "flex-1 flex flex-col items-center" }, ra = {
|
|
558
|
+
class: "py-12 flex flex-col gap-4 flex-1",
|
|
559
|
+
name: "delivery details"
|
|
560
|
+
}, la = { class: "flex flex-col gap-8" }, ca = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, ia = { class: "flex flex-col gap-4" }, ua = { class: "flex gap-8" }, da = /* @__PURE__ */ Fe({
|
|
561
|
+
__name: "ClosingDraftDialog",
|
|
562
|
+
props: {
|
|
563
|
+
show: { type: Boolean },
|
|
564
|
+
draft: {}
|
|
565
|
+
},
|
|
566
|
+
emits: ["submitted", "refresh"],
|
|
567
|
+
setup(n, { emit: r }) {
|
|
568
|
+
const e = n, i = Ye(), u = Ce(), b = yt(e, "show"), x = O(!1), C = O(!1), d = O(!1), F = O(new Array()), R = Ve(), H = je(), I = Re(), l = it(), p = Se(), v = We({}), y = E(() => new Set(
|
|
569
|
+
l.skus.filter((a) => {
|
|
570
|
+
var t;
|
|
571
|
+
return v[(t = a.customAttributes) == null ? void 0 : t.tag];
|
|
572
|
+
}).map((a) => a._id)
|
|
573
|
+
)), A = r, L = E(() => {
|
|
574
|
+
var t, s;
|
|
575
|
+
const a = [...((t = e.draft) == null ? void 0 : t.items) ?? [], ...((s = e.draft) == null ? void 0 : s.negativeStockItems) ?? []];
|
|
576
|
+
return y.value.size ? a.filter((m) => y.value.has(m.sku._id)) : a;
|
|
577
|
+
}), D = E(() => {
|
|
578
|
+
const a = L.value.map((t) => t.sku);
|
|
579
|
+
return a.sort((t, s) => t.code.localeCompare(s.code)), a;
|
|
580
|
+
}), T = E(() => L.value.groupBy(
|
|
581
|
+
(t) => t.sku._id,
|
|
582
|
+
(t) => t.measurementsAmounts.filter((s) => !s.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((s) => s.measurement.id)
|
|
583
|
+
));
|
|
584
|
+
Ze(oe), Je(
|
|
585
|
+
() => e.show,
|
|
586
|
+
(a) => {
|
|
587
|
+
a && (K.value = ue[0], oe());
|
|
588
|
+
}
|
|
589
|
+
);
|
|
590
|
+
const j = he(0), J = he(100);
|
|
591
|
+
async function oe() {
|
|
592
|
+
var t, s, m;
|
|
593
|
+
if (!p._currentLocation) return;
|
|
594
|
+
x.value = !0;
|
|
595
|
+
const a = ((t = e.draft) == null ? void 0 : t.status) === ne.enum.COMPLETED;
|
|
596
|
+
try {
|
|
597
|
+
if (await l.init(), a) {
|
|
598
|
+
const c = e.draft.closingAdjustmentId;
|
|
599
|
+
if (!c) {
|
|
600
|
+
I.open({
|
|
601
|
+
title: "Something went wrong",
|
|
602
|
+
message: "Closing draft is completed but closing document cannot be found.",
|
|
603
|
+
type: "error"
|
|
604
|
+
}), console.error("Closing draft is completed but closing document cannot be found.", {
|
|
605
|
+
draftId: (s = e.draft) == null ? void 0 : s._id
|
|
606
|
+
});
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
const f = await R.readAdjustmentById(c), $ = (f == null ? void 0 : f.skus) ?? [];
|
|
610
|
+
F.value = $.map((k) => ({
|
|
611
|
+
id: k.sku._id,
|
|
612
|
+
balance: k.fromBalance,
|
|
613
|
+
costs: k.fromCostBalances
|
|
614
|
+
}));
|
|
615
|
+
} else
|
|
616
|
+
F.value = ((m = e.draft) == null ? void 0 : m.stockSnapshot) ?? [];
|
|
617
|
+
} catch (c) {
|
|
618
|
+
I.open({
|
|
619
|
+
title: "Something went wrong",
|
|
620
|
+
message: "Something went wrong when fetching info. Please try again.",
|
|
621
|
+
type: "error"
|
|
622
|
+
}), console.error("error on fetch stock balances", c);
|
|
623
|
+
} finally {
|
|
624
|
+
x.value = !1;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
async function X() {
|
|
628
|
+
var c, f, $;
|
|
629
|
+
const a = ((c = e.draft) == null ? void 0 : c.effectiveAt) ?? ((f = e.draft) == null ? void 0 : f.updatedAt);
|
|
630
|
+
if (!a) {
|
|
631
|
+
I.open({
|
|
632
|
+
title: "Cannot refresh",
|
|
633
|
+
message: "Effective date is not available for this draft.",
|
|
634
|
+
type: "error"
|
|
635
|
+
});
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
C.value = !0;
|
|
639
|
+
const t = ($ = e.draft) == null ? void 0 : $.stockSnapshotAt, s = 30, m = 2e3;
|
|
640
|
+
try {
|
|
641
|
+
await R.recalculation.scheduleCalculateStockSnapshotAtDate(
|
|
642
|
+
a,
|
|
643
|
+
e.draft._id
|
|
644
|
+
);
|
|
645
|
+
let k = null;
|
|
646
|
+
for (let B = 0; B < s && (k = await H.getDraft(e.draft._id).delayed(m), k.stockSnapshotAt === t); B++)
|
|
647
|
+
;
|
|
648
|
+
if (!k || k.stockSnapshotAt === t) {
|
|
649
|
+
I.open({
|
|
650
|
+
title: "Refresh failed",
|
|
651
|
+
message: "Failed to refresh stock balance. Please try again.",
|
|
652
|
+
type: "error"
|
|
653
|
+
}), console.error("error refreshing stock balances: there is no change in stockSnapshotAt");
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
A("refresh", k), F.value = k.stockSnapshot ?? [], I.open({
|
|
657
|
+
title: "Balance refreshed",
|
|
658
|
+
message: "Stock balance has been recalculated.",
|
|
659
|
+
type: "success"
|
|
660
|
+
});
|
|
661
|
+
} catch (k) {
|
|
662
|
+
I.open({
|
|
663
|
+
title: "Refresh failed",
|
|
664
|
+
message: "Failed to refresh stock balance. Please try again.",
|
|
665
|
+
type: "error"
|
|
666
|
+
}), console.error("error refreshing stock balances", k);
|
|
667
|
+
} finally {
|
|
668
|
+
C.value = !1;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
const se = E(
|
|
672
|
+
() => F.value.groupBy(
|
|
673
|
+
(a) => a.id,
|
|
674
|
+
(a) => a.balance
|
|
675
|
+
)
|
|
676
|
+
), xe = E(() => L.value.groupBy((a) => a.sku._id));
|
|
677
|
+
function le(a) {
|
|
678
|
+
return S(
|
|
679
|
+
fe.FmTooltip,
|
|
680
|
+
{ zIndex: 51, placement: "left", class: "w-full flex justify-end" },
|
|
681
|
+
{
|
|
682
|
+
default() {
|
|
683
|
+
return a;
|
|
684
|
+
},
|
|
685
|
+
content() {
|
|
686
|
+
return "Differences are calculated using this formula: (Adjusted / System) × 100%";
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
);
|
|
690
|
+
}
|
|
691
|
+
const ve = E(() => {
|
|
692
|
+
const a = D.value.reduce((s, m) => {
|
|
693
|
+
var c, f;
|
|
694
|
+
return Math.max(s, ((f = (c = T.value) == null ? void 0 : c.get(m._id)) == null ? void 0 : f[0].length) ?? 0);
|
|
695
|
+
}, 0);
|
|
696
|
+
return [
|
|
697
|
+
{
|
|
698
|
+
id: "sku",
|
|
699
|
+
accessorFn: (s) => `${s.code} ${s.name}`,
|
|
700
|
+
header: () => "Name",
|
|
701
|
+
size: 350,
|
|
702
|
+
cell(s) {
|
|
703
|
+
const m = s.row.original, c = m.adjustedDiffPercentage, f = typeof c == "number" && Math.abs(c) > 10, $ = S("div", { class: "flex flex-col gap-4" }, [
|
|
704
|
+
S(
|
|
705
|
+
"div",
|
|
706
|
+
{
|
|
707
|
+
class: [
|
|
708
|
+
"line-clamp-1 fm-typo-en-body-lg-400",
|
|
709
|
+
f ? " text-fm-color-system-error-300" : "text-fm-color-typo-primary"
|
|
710
|
+
]
|
|
711
|
+
},
|
|
712
|
+
m.name
|
|
713
|
+
),
|
|
714
|
+
S(
|
|
715
|
+
"div",
|
|
716
|
+
{
|
|
717
|
+
class: [
|
|
718
|
+
"line-clamp-1 fm-typo-en-body-md-400",
|
|
719
|
+
f ? " text-fm-color-system-error-300" : "text-fm-color-typo-secondary"
|
|
720
|
+
]
|
|
721
|
+
},
|
|
722
|
+
m.code
|
|
723
|
+
)
|
|
724
|
+
]);
|
|
725
|
+
return S(
|
|
726
|
+
fe.FmTooltip,
|
|
727
|
+
{
|
|
728
|
+
zIndex: 51
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
content() {
|
|
732
|
+
return f ? "Adjustment difference is more than 10%." : `${m.code} - ${m.name}`;
|
|
733
|
+
},
|
|
734
|
+
default() {
|
|
735
|
+
return S("div", { class: "flex items-center gap-4 justify-start w-full" }, [
|
|
736
|
+
$
|
|
737
|
+
]);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
);
|
|
741
|
+
}
|
|
742
|
+
},
|
|
743
|
+
{
|
|
744
|
+
id: "baseUnit",
|
|
745
|
+
header: () => "Base unit",
|
|
746
|
+
accessorKey: "baseUnit"
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
id: "physicalBalance",
|
|
750
|
+
accessorKey: "physicalBalance",
|
|
751
|
+
header: () => le("Actual balance"),
|
|
752
|
+
size: 200,
|
|
753
|
+
meta: {
|
|
754
|
+
textAlign: "right"
|
|
755
|
+
}
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
id: "systemBalance",
|
|
759
|
+
accessorKey: "systemBalance",
|
|
760
|
+
header: () => le("Balance"),
|
|
761
|
+
size: 200,
|
|
762
|
+
meta: {
|
|
763
|
+
textAlign: "right"
|
|
764
|
+
}
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
id: "adjustedAmount",
|
|
768
|
+
accessorKey: "adjustedAmount",
|
|
769
|
+
header: () => le("Adjusted balance"),
|
|
770
|
+
size: 200,
|
|
771
|
+
meta: {
|
|
772
|
+
textAlign: "right"
|
|
773
|
+
}
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
id: "adjustedDiffPercentage",
|
|
777
|
+
accessorKey: "adjustedDiffPercentage",
|
|
778
|
+
header: () => S(
|
|
779
|
+
fe.FmTooltip,
|
|
780
|
+
{ zIndex: 51, placement: "left", class: "w-full flex justify-end" },
|
|
781
|
+
{
|
|
782
|
+
default() {
|
|
783
|
+
return S("div", { class: "flex items-center gap-4" }, [
|
|
784
|
+
"Diff (%)",
|
|
785
|
+
S(fe.FmIcon, { name: "info", color: "neutral-gray-400", size: "sm" })
|
|
786
|
+
]);
|
|
787
|
+
},
|
|
788
|
+
content() {
|
|
789
|
+
return "Differences are calculated using this formula: (Adjusted / System) × 100%";
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
),
|
|
793
|
+
size: 200,
|
|
794
|
+
cell(s) {
|
|
795
|
+
const m = s.row.original.adjustedDiffPercentage;
|
|
796
|
+
if (!m) return "N/A";
|
|
797
|
+
const c = m.toFixed(2);
|
|
798
|
+
if (c === "0.00")
|
|
799
|
+
return S("div", { class: "flex items-center gap-4 justify-end" }, ["0.00"]);
|
|
800
|
+
const f = m > 0;
|
|
801
|
+
return S("div", { class: "flex items-center gap-4 justify-end" }, [
|
|
802
|
+
S(fe.FmIcon, {
|
|
803
|
+
name: f ? "arrow_drop_up" : "arrow_drop_down",
|
|
804
|
+
color: f ? "system-success-300" : "system-error-300",
|
|
805
|
+
size: "md"
|
|
806
|
+
}),
|
|
807
|
+
c
|
|
808
|
+
]);
|
|
809
|
+
},
|
|
810
|
+
meta: {
|
|
811
|
+
textAlign: "right"
|
|
812
|
+
}
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
id: "physicalBalances",
|
|
816
|
+
header: () => "Amounts",
|
|
817
|
+
enableSorting: !1,
|
|
818
|
+
cell(s) {
|
|
819
|
+
const m = s.row.original, c = ($, k) => S(
|
|
820
|
+
fe.FmTooltip,
|
|
821
|
+
{ zIndex: 50 },
|
|
822
|
+
{
|
|
823
|
+
default() {
|
|
824
|
+
return S(
|
|
825
|
+
"div",
|
|
826
|
+
{
|
|
827
|
+
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"
|
|
828
|
+
},
|
|
829
|
+
[
|
|
830
|
+
S("span", { class: "text-fm-color-typo-primary" }, `${$} `),
|
|
831
|
+
S(
|
|
832
|
+
"span",
|
|
833
|
+
{
|
|
834
|
+
class: "text-fm-color-typo-secondary",
|
|
835
|
+
style: { maxWidth: "80px" }
|
|
836
|
+
},
|
|
837
|
+
k
|
|
838
|
+
)
|
|
839
|
+
]
|
|
840
|
+
);
|
|
841
|
+
},
|
|
842
|
+
content() {
|
|
843
|
+
return `${$} ${k}`;
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
);
|
|
847
|
+
let f = Array.from({ length: a }).map(($, k) => {
|
|
848
|
+
if (!m[`measurementAmount${k}`])
|
|
849
|
+
return null;
|
|
850
|
+
const B = m[`measurementAmount${k}`], de = m[`measurementAbbrev${k}`];
|
|
851
|
+
return c(B, de);
|
|
852
|
+
}).filter(($) => $);
|
|
853
|
+
return (m.baseUnitAmount || !f.length) && (f = [c(m.baseUnitAmount, m.baseUnit), ...f]), S(
|
|
854
|
+
"div",
|
|
855
|
+
{
|
|
856
|
+
class: "flex gap-8 flex-nowrap",
|
|
857
|
+
style: {
|
|
858
|
+
minWidth: `${120 * f.length}px`
|
|
859
|
+
}
|
|
860
|
+
},
|
|
861
|
+
f
|
|
862
|
+
);
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
];
|
|
866
|
+
}), ce = E(() => ve.value.map((a) => a.size ?? 0).reduce((a, t) => a + t)), ie = O(""), ye = E(() => D.value.map((a) => {
|
|
867
|
+
var B, de;
|
|
868
|
+
const t = (B = xe.value.get(a._id)) == null ? void 0 : B[0], s = ((de = se.value.get(a._id)) == null ? void 0 : de[0]) ?? j;
|
|
869
|
+
if (!t)
|
|
870
|
+
return {
|
|
871
|
+
code: a.code,
|
|
872
|
+
name: a.name,
|
|
873
|
+
baseUnit: a.unit.abbrev,
|
|
874
|
+
baseUnitAmount: 0,
|
|
875
|
+
systemBalance: +M(s),
|
|
876
|
+
physicalBalance: 0,
|
|
877
|
+
adjustedAmount: -+M(s),
|
|
878
|
+
adjustedDiffPercentage: -100
|
|
879
|
+
};
|
|
880
|
+
const m = Ke(t), c = Ee(m, s), f = s.amount === 0 ? null : He(c, {
|
|
881
|
+
...s,
|
|
882
|
+
amount: Math.abs(s.amount)
|
|
883
|
+
}), $ = f ? $e(f, J) : null;
|
|
884
|
+
return {
|
|
885
|
+
code: a.code,
|
|
886
|
+
name: a.name,
|
|
887
|
+
baseUnit: a.unit.abbrev,
|
|
888
|
+
baseUnitAmount: +M(t.baseAmount),
|
|
889
|
+
...t.measurementsAmounts.filter((te) => {
|
|
890
|
+
var G, re, De;
|
|
891
|
+
return (De = (re = (G = T.value) == null ? void 0 : G.get(a._id)) == null ? void 0 : re[0]) == null ? void 0 : De.includes(te.measurement.id);
|
|
892
|
+
}).reduce((te, G, re) => (te[`measurementAbbrev${re}`] = `(${G.measurement.abbrev}) × ${M(G.measurement.conversion)}`, te[`measurementAmount${re}`] = +M(G.amount), te), {}),
|
|
893
|
+
systemBalance: +M(s),
|
|
894
|
+
physicalBalance: +M(m),
|
|
895
|
+
adjustedAmount: +M(c),
|
|
896
|
+
adjustedDiffPercentage: $ ? +M(Le($, 2)) : null
|
|
897
|
+
};
|
|
898
|
+
})), Ae = E(() => {
|
|
899
|
+
var t, s, m;
|
|
900
|
+
if (!e.draft) return [];
|
|
901
|
+
const a = e.draft.approvedAt ? {
|
|
902
|
+
action: `Approve at ${ae(e.draft.approvedAt)}`,
|
|
903
|
+
// actionAt: props.draft.approvedAt,
|
|
904
|
+
actionBy: e.draft.approvedBy,
|
|
905
|
+
remark: e.draft.approveRemark
|
|
906
|
+
} : (t = e.draft.rejectionHistory) == null ? void 0 : t.computeFirst((c) => ({
|
|
907
|
+
action: `Reject at ${ae(c.rejectedAt)}`,
|
|
908
|
+
// actionAt: e.rejectedAt,
|
|
909
|
+
actionBy: c.rejectedBy,
|
|
910
|
+
remark: c.rejectRemark
|
|
911
|
+
}));
|
|
912
|
+
return [
|
|
913
|
+
{
|
|
914
|
+
label: "Created at",
|
|
915
|
+
value: ae(e.draft.createdAt)
|
|
916
|
+
},
|
|
917
|
+
{
|
|
918
|
+
label: "Created by",
|
|
919
|
+
value: e.draft.createdBy.name
|
|
920
|
+
},
|
|
921
|
+
{
|
|
922
|
+
label: "Updated at",
|
|
923
|
+
value: ae(e.draft.updatedAt)
|
|
924
|
+
},
|
|
925
|
+
{
|
|
926
|
+
label: "Updated by",
|
|
927
|
+
value: e.draft.updatedBy.name
|
|
928
|
+
},
|
|
929
|
+
{
|
|
930
|
+
label: "Effective at",
|
|
931
|
+
value: ae(e.draft.effectiveAt ?? e.draft.updatedAt)
|
|
932
|
+
},
|
|
933
|
+
{
|
|
934
|
+
label: "Using template",
|
|
935
|
+
value: ((s = e.draft.usingTemplates.find((c) => c)) == null ? void 0 : s.name) ?? "None"
|
|
936
|
+
},
|
|
937
|
+
e.draft.remark ? {
|
|
938
|
+
label: "Remark",
|
|
939
|
+
value: e.draft.remark
|
|
940
|
+
} : null,
|
|
941
|
+
a ? {
|
|
942
|
+
label: "Last action",
|
|
943
|
+
value: a.action
|
|
944
|
+
} : null,
|
|
945
|
+
a && a.actionBy ? {
|
|
946
|
+
label: "Last action by",
|
|
947
|
+
value: (m = a.actionBy) == null ? void 0 : m.name
|
|
948
|
+
} : null,
|
|
949
|
+
a && a.remark ? {
|
|
950
|
+
label: "Action remark",
|
|
951
|
+
value: a.remark
|
|
952
|
+
} : null
|
|
953
|
+
].filter((c) => c).map((c) => c);
|
|
954
|
+
}), ue = [
|
|
955
|
+
{
|
|
956
|
+
label: "Overview",
|
|
957
|
+
value: "overview"
|
|
958
|
+
},
|
|
959
|
+
{
|
|
960
|
+
label: "Action history",
|
|
961
|
+
value: "history"
|
|
962
|
+
}
|
|
963
|
+
], K = O(ue[0]), Q = E(() => {
|
|
964
|
+
var t, s, m, c;
|
|
965
|
+
return [
|
|
966
|
+
...(((t = e.draft) == null ? void 0 : t.rejectionHistory) ?? []).map(
|
|
967
|
+
(f) => ({
|
|
968
|
+
header: "Reject",
|
|
969
|
+
date: ae(f.rejectedAt),
|
|
970
|
+
info: [
|
|
971
|
+
{
|
|
972
|
+
label: "Rejected by",
|
|
973
|
+
values: [f.rejectedBy.name]
|
|
974
|
+
},
|
|
975
|
+
{
|
|
976
|
+
label: "Rejection remark",
|
|
977
|
+
values: [f.rejectRemark]
|
|
978
|
+
}
|
|
979
|
+
]
|
|
980
|
+
})
|
|
981
|
+
),
|
|
982
|
+
...(s = e.draft) != null && s.approvedBy ? [
|
|
983
|
+
{
|
|
984
|
+
header: "Approve",
|
|
985
|
+
date: e.draft.approvedAt ? ae(e.draft.approvedAt) : "",
|
|
986
|
+
info: [
|
|
987
|
+
{
|
|
988
|
+
label: "Approved by",
|
|
989
|
+
values: [(m = e.draft) == null ? void 0 : m.approvedBy.name]
|
|
990
|
+
},
|
|
991
|
+
{
|
|
992
|
+
label: "Approval remark",
|
|
993
|
+
values: [((c = e.draft) == null ? void 0 : c.approveRemark) ?? ""]
|
|
994
|
+
}
|
|
995
|
+
]
|
|
996
|
+
}
|
|
997
|
+
] : []
|
|
998
|
+
];
|
|
999
|
+
}), ge = E(() => {
|
|
1000
|
+
var c, f, $, k;
|
|
1001
|
+
if ((c = e == null ? void 0 : e.draft) != null && c.approvedAt) return "Draft is already approved.";
|
|
1002
|
+
if (((f = e.draft) == null ? void 0 : f.status) !== ne.enum.DRAFT) return "Status is not draft.";
|
|
1003
|
+
const a = ye.value.some((B) => B.physicalBalance < 0), t = ((k = ($ = i.stockBalance.skus) == null ? void 0 : $.filter((B) => B.balance.amount < 0)) == null ? void 0 : k.map((B) => B.id)) ?? [], s = new Set(D.value.map((B) => B._id)), m = t.filter((B) => !s.has(B)).length;
|
|
1004
|
+
return [
|
|
1005
|
+
a ? "Negative total exist." : null,
|
|
1006
|
+
m ? "Negative stock is not included in this draft. Reopen draft in POS and apply changes." : null
|
|
1007
|
+
].filter((B) => B).join(" ");
|
|
1008
|
+
});
|
|
1009
|
+
return (a, t) => {
|
|
1010
|
+
const s = U("FmButtonGroup"), m = U("FmMenuDivider"), c = U("FmCard"), f = U("FmButton"), $ = U("FmCircularProgress"), k = U("FmTextField"), B = U("FmIcon"), de = U("FmChip"), te = U("FmTable"), G = U("FmSpacer"), re = U("FmTooltip"), De = U("FmSideSheet");
|
|
1011
|
+
return h(), W(De, {
|
|
1012
|
+
"dismiss-away": "",
|
|
1013
|
+
"max-width": 9999,
|
|
1014
|
+
"model-value": g(b),
|
|
1015
|
+
"onUpdate:modelValue": t[8] || (t[8] = (_) => Ie(b) ? b.value = _ : null),
|
|
1016
|
+
header: "Closing details"
|
|
1017
|
+
}, {
|
|
1018
|
+
"side-sheet-footer": Y(() => {
|
|
1019
|
+
var _, z, V, me;
|
|
1020
|
+
return [
|
|
1021
|
+
o("div", ua, [
|
|
1022
|
+
((_ = e.draft) == null ? void 0 : _.status) === g(ne).enum.DRAFT ? (h(), P(q, { key: 0 }, [
|
|
1023
|
+
ge.value ? (h(), W(re, {
|
|
1024
|
+
key: 0,
|
|
1025
|
+
"z-index": 51
|
|
1026
|
+
}, {
|
|
1027
|
+
content: Y(() => [
|
|
1028
|
+
Be(N(ge.value), 1)
|
|
1029
|
+
]),
|
|
1030
|
+
default: Y(() => [
|
|
1031
|
+
w(f, {
|
|
1032
|
+
disabled: "",
|
|
1033
|
+
key: "approve key",
|
|
1034
|
+
label: "Approve",
|
|
1035
|
+
onClick: t[3] || (t[3] = () => e.draft && g(u).approveDraft(e.draft, () => A("submitted")))
|
|
1036
|
+
})
|
|
1037
|
+
]),
|
|
1038
|
+
_: 1
|
|
1039
|
+
})) : (h(), W(f, {
|
|
1040
|
+
key: "approve key",
|
|
1041
|
+
label: "Approve",
|
|
1042
|
+
onClick: t[4] || (t[4] = () => e.draft && g(u).approveDraft(e.draft, () => A("submitted")))
|
|
1043
|
+
}))
|
|
1044
|
+
], 64)) : ee("", !0),
|
|
1045
|
+
((z = e.draft) == null ? void 0 : z.status) === g(ne).enum.DRAFT ? (h(), W(f, {
|
|
1046
|
+
key: 1,
|
|
1047
|
+
label: "Reject",
|
|
1048
|
+
variant: "destructive",
|
|
1049
|
+
onClick: t[5] || (t[5] = () => e.draft && g(u).rejectDraft(e.draft, () => A("submitted")))
|
|
1050
|
+
})) : ee("", !0),
|
|
1051
|
+
(V = e.draft) != null && V.approvedAt && ((me = e.draft) == null ? void 0 : me.status) !== g(ne).enum.COMPLETED ? (h(), W(f, {
|
|
1052
|
+
key: 2,
|
|
1053
|
+
label: "Sync",
|
|
1054
|
+
loading: d.value,
|
|
1055
|
+
onClick: t[6] || (t[6] = () => {
|
|
1056
|
+
e.draft && (d.value = !0, g(u).syncDraft(e.draft, () => {
|
|
1057
|
+
d.value = !1, A("submitted");
|
|
1058
|
+
}));
|
|
1059
|
+
})
|
|
1060
|
+
}, null, 8, ["loading"])) : ee("", !0),
|
|
1061
|
+
w(f, {
|
|
1062
|
+
label: "Close",
|
|
1063
|
+
variant: "tertiary",
|
|
1064
|
+
onClick: t[7] || (t[7] = (Te) => b.value = !1)
|
|
1065
|
+
})
|
|
1066
|
+
])
|
|
1067
|
+
];
|
|
1068
|
+
}),
|
|
1069
|
+
default: Y(() => [
|
|
1070
|
+
o("div", Rt, [
|
|
1071
|
+
o("div", null, [
|
|
1072
|
+
w(s, {
|
|
1073
|
+
items: ue,
|
|
1074
|
+
modelValue: K.value,
|
|
1075
|
+
"onUpdate:modelValue": t[0] || (t[0] = (_) => K.value = _)
|
|
1076
|
+
}, null, 8, ["modelValue"])
|
|
1077
|
+
]),
|
|
1078
|
+
K.value.value === "overview" ? (h(), P(q, { key: 0 }, [
|
|
1079
|
+
w(c, {
|
|
1080
|
+
variant: "outlined",
|
|
1081
|
+
class: "flex flex-col gap-8 px-12 py-16"
|
|
1082
|
+
}, {
|
|
1083
|
+
default: Y(() => {
|
|
1084
|
+
var _, z;
|
|
1085
|
+
return [
|
|
1086
|
+
o("div", Tt, [
|
|
1087
|
+
t[9] || (t[9] = o("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
|
|
1088
|
+
o("div", Pt, [
|
|
1089
|
+
o("div", {
|
|
1090
|
+
class: pe(["fm-status-badge", g(we)(((_ = a.draft) == null ? void 0 : _.status) ?? "DRAFT")])
|
|
1091
|
+
}, N(g(ze)(((z = a.draft) == null ? void 0 : z.status) ?? "")), 3)
|
|
1092
|
+
])
|
|
1093
|
+
]),
|
|
1094
|
+
w(m),
|
|
1095
|
+
o("div", Mt, [
|
|
1096
|
+
(h(!0), P(q, null, be(Ae.value, (V, me) => (h(), P("div", {
|
|
1097
|
+
class: "flex flex-col gap-4",
|
|
1098
|
+
key: me
|
|
1099
|
+
}, [
|
|
1100
|
+
o("div", It, [
|
|
1101
|
+
o("div", Ut, N(V.label), 1)
|
|
1102
|
+
]),
|
|
1103
|
+
o("div", Et, N(V.value), 1)
|
|
1104
|
+
]))), 128))
|
|
1105
|
+
])
|
|
1106
|
+
];
|
|
1107
|
+
}),
|
|
1108
|
+
_: 1
|
|
1109
|
+
}),
|
|
1110
|
+
o("div", Ht, [
|
|
1111
|
+
o("div", Lt, [
|
|
1112
|
+
t[10] || (t[10] = o("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
|
|
1113
|
+
x.value ? ee("", !0) : (h(), P("div", zt, [
|
|
1114
|
+
a.draft && a.draft.status !== g(ne).enum.COMPLETED ? (h(), W(f, {
|
|
1115
|
+
key: 0,
|
|
1116
|
+
label: "Refresh balance",
|
|
1117
|
+
"prepend-icon": "refresh",
|
|
1118
|
+
variant: "secondary",
|
|
1119
|
+
"text-color": "primary",
|
|
1120
|
+
"bg-color": "transparent",
|
|
1121
|
+
"border-color": "primary",
|
|
1122
|
+
loading: C.value,
|
|
1123
|
+
onClick: X
|
|
1124
|
+
}, null, 8, ["loading"])) : ee("", !0),
|
|
1125
|
+
w(f, {
|
|
1126
|
+
label: "Export data",
|
|
1127
|
+
"prepend-icon": "download",
|
|
1128
|
+
variant: "secondary",
|
|
1129
|
+
"text-color": "primary",
|
|
1130
|
+
"bg-color": "transparent",
|
|
1131
|
+
"border-color": "primary",
|
|
1132
|
+
onClick: t[1] || (t[1] = (_) => a.draft ? g(u).exportDraft(a.draft, F.value) : null)
|
|
1133
|
+
})
|
|
1134
|
+
]))
|
|
1135
|
+
]),
|
|
1136
|
+
x.value ? (h(), P("div", Nt, [
|
|
1137
|
+
t[12] || (t[12] = o("div", { class: "h-80" }, null, -1)),
|
|
1138
|
+
o("div", Ot, [
|
|
1139
|
+
o("div", null, [
|
|
1140
|
+
w($, { size: "md" })
|
|
1141
|
+
]),
|
|
1142
|
+
t[11] || (t[11] = o("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
|
|
1143
|
+
]),
|
|
1144
|
+
t[13] || (t[13] = o("div", { class: "h-80" }, null, -1))
|
|
1145
|
+
])) : (h(), P(q, { key: 1 }, [
|
|
1146
|
+
o("div", null, [
|
|
1147
|
+
w(k, {
|
|
1148
|
+
modelValue: ie.value,
|
|
1149
|
+
"onUpdate:modelValue": t[2] || (t[2] = (_) => ie.value = _),
|
|
1150
|
+
placeholder: "Filter items"
|
|
1151
|
+
}, null, 8, ["modelValue"])
|
|
1152
|
+
]),
|
|
1153
|
+
g(l).skuTags.size ? (h(), P("div", Vt, [
|
|
1154
|
+
(h(!0), P(q, null, be(g(l).skuTags.keys(), (_) => (h(), W(de, {
|
|
1155
|
+
key: `${_}`,
|
|
1156
|
+
label: `${_}`,
|
|
1157
|
+
selectable: "",
|
|
1158
|
+
selected: v[`${_}`],
|
|
1159
|
+
onClick: (z) => v[`${_}`] = !v[`${_}`]
|
|
1160
|
+
}, {
|
|
1161
|
+
default: Y(() => [
|
|
1162
|
+
v[`${_}`] ? (h(), W(B, {
|
|
1163
|
+
key: 0,
|
|
1164
|
+
name: "check",
|
|
1165
|
+
class: "text-white",
|
|
1166
|
+
size: "sm"
|
|
1167
|
+
})) : ee("", !0),
|
|
1168
|
+
o("span", {
|
|
1169
|
+
class: pe([
|
|
1170
|
+
"",
|
|
1171
|
+
{
|
|
1172
|
+
"text-white fm-typo-en-body-md-600": v[`${_}`],
|
|
1173
|
+
"text-fm-color-typo-primary fm-typo-en-body-md-400": !v[`${_}`]
|
|
1174
|
+
}
|
|
1175
|
+
])
|
|
1176
|
+
}, N(_), 3)
|
|
1177
|
+
]),
|
|
1178
|
+
_: 2
|
|
1179
|
+
}, 1032, ["label", "selected", "onClick"]))), 128))
|
|
1180
|
+
])) : ee("", !0),
|
|
1181
|
+
o("div", Yt, [
|
|
1182
|
+
o("div", {
|
|
1183
|
+
style: Ue({ minWidth: `${ce.value}px` })
|
|
1184
|
+
}, [
|
|
1185
|
+
w(te, {
|
|
1186
|
+
"column-defs": ve.value,
|
|
1187
|
+
"row-data": ye.value,
|
|
1188
|
+
"search-value": ie.value
|
|
1189
|
+
}, null, 8, ["column-defs", "row-data", "search-value"])
|
|
1190
|
+
], 4)
|
|
1191
|
+
])
|
|
1192
|
+
], 64))
|
|
1193
|
+
])
|
|
1194
|
+
], 64)) : ee("", !0),
|
|
1195
|
+
K.value.value === "history" ? (h(), P("div", Kt, [
|
|
1196
|
+
Q.value.length ? (h(), P("div", Wt, [
|
|
1197
|
+
(h(!0), P(q, null, be(Q.value, (_, z) => (h(), P(q, { key: z }, [
|
|
1198
|
+
o("div", Zt, [
|
|
1199
|
+
o("div", Jt, [
|
|
1200
|
+
o("div", Xt, [
|
|
1201
|
+
o("div", {
|
|
1202
|
+
class: pe([
|
|
1203
|
+
{
|
|
1204
|
+
"bg-fm-color-primary": z !== 0,
|
|
1205
|
+
"bg-white": z === 0
|
|
1206
|
+
},
|
|
1207
|
+
"w-[2px] h-full"
|
|
1208
|
+
])
|
|
1209
|
+
}, null, 2)
|
|
1210
|
+
]),
|
|
1211
|
+
t[16] || (t[16] = o("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
|
|
1212
|
+
o("div", Qt, [
|
|
1213
|
+
o("div", {
|
|
1214
|
+
class: pe([
|
|
1215
|
+
{
|
|
1216
|
+
"bg-fm-color-primary": z < Q.value.length - 1,
|
|
1217
|
+
"bg-white": z >= Q.value.length - 1
|
|
1218
|
+
},
|
|
1219
|
+
"w-[2px] h-full"
|
|
1220
|
+
])
|
|
1221
|
+
}, null, 2)
|
|
1222
|
+
])
|
|
1223
|
+
]),
|
|
1224
|
+
o("div", ea, [
|
|
1225
|
+
o("div", ta, N(_.header), 1),
|
|
1226
|
+
o("div", aa, N(_.date), 1)
|
|
1227
|
+
])
|
|
1228
|
+
]),
|
|
1229
|
+
o("div", na, [
|
|
1230
|
+
o("div", oa, [
|
|
1231
|
+
o("div", sa, [
|
|
1232
|
+
o("div", {
|
|
1233
|
+
class: pe([
|
|
1234
|
+
{
|
|
1235
|
+
"bg-fm-color-primary": z < Q.value.length - 1,
|
|
1236
|
+
"bg-white": z >= Q.value.length - 1
|
|
1237
|
+
},
|
|
1238
|
+
"w-[2px] h-full"
|
|
1239
|
+
])
|
|
1240
|
+
}, null, 2)
|
|
1241
|
+
])
|
|
1242
|
+
]),
|
|
1243
|
+
o("div", ra, [
|
|
1244
|
+
w(c, {
|
|
1245
|
+
variant: "outlined",
|
|
1246
|
+
class: "py-12 px-16"
|
|
1247
|
+
}, {
|
|
1248
|
+
default: Y(() => [
|
|
1249
|
+
o("div", la, [
|
|
1250
|
+
(h(!0), P(q, null, be(_.info, (V, me) => (h(), P("div", {
|
|
1251
|
+
key: me,
|
|
1252
|
+
class: "flex flex-col gap-4"
|
|
1253
|
+
}, [
|
|
1254
|
+
o("div", ca, N(V == null ? void 0 : V.label), 1),
|
|
1255
|
+
o("div", ia, [
|
|
1256
|
+
(h(!0), P(q, null, be(V == null ? void 0 : V.values, (Te, qe) => (h(), P("div", {
|
|
1257
|
+
key: qe,
|
|
1258
|
+
class: "fm-typo-en-body-lg-600"
|
|
1259
|
+
}, N(Te), 1))), 128))
|
|
1260
|
+
])
|
|
1261
|
+
]))), 128))
|
|
1262
|
+
])
|
|
1263
|
+
]),
|
|
1264
|
+
_: 2
|
|
1265
|
+
}, 1024)
|
|
1266
|
+
])
|
|
1267
|
+
])
|
|
1268
|
+
], 64))), 128))
|
|
1269
|
+
])) : (h(), P("div", Gt, [
|
|
1270
|
+
w(G),
|
|
1271
|
+
o("div", null, [
|
|
1272
|
+
o("img", {
|
|
1273
|
+
src: g(ht),
|
|
1274
|
+
alt: "List is empty"
|
|
1275
|
+
}, null, 8, qt)
|
|
1276
|
+
]),
|
|
1277
|
+
t[14] || (t[14] = o("div", { class: "fm-typo-en-body-lg-600" }, N("No records found"), -1)),
|
|
1278
|
+
t[15] || (t[15] = o("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, N("You can track approval and rejection history here"), -1)),
|
|
1279
|
+
w(G),
|
|
1280
|
+
w(G)
|
|
1281
|
+
]))
|
|
1282
|
+
])) : ee("", !0)
|
|
1283
|
+
])
|
|
1284
|
+
]),
|
|
1285
|
+
_: 1
|
|
1286
|
+
}, 8, ["model-value"]);
|
|
1287
|
+
};
|
|
1288
|
+
}
|
|
1289
|
+
}), ma = { class: "flex-1 flex flex-col gap-8" }, fa = { class: "flex flex-col" }, pa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, va = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, ya = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, ga = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, wa = /* @__PURE__ */ Fe({
|
|
1290
|
+
__name: "ClosingDraftView",
|
|
1291
|
+
setup(n) {
|
|
1292
|
+
const { t: r } = Ne(), { viewDraft: e } = Ce(), { viewClosingDraftProps: i, viewClosingDraftShow: u } = bt(Ce()), b = Se(), x = $t(), C = ut(), { breakpoints: d } = gt();
|
|
1293
|
+
b.watchLocation(x.fetchDrafts);
|
|
1294
|
+
const F = E(() => x.loading), R = O(""), H = E(() => d.value.xs || d.value.sm), I = E(() => H.value ? 10 : 20);
|
|
1295
|
+
function l(y) {
|
|
1296
|
+
switch (y) {
|
|
1297
|
+
case "refresh":
|
|
1298
|
+
return x.fetchDrafts();
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
function p(y) {
|
|
1302
|
+
return y;
|
|
1303
|
+
}
|
|
1304
|
+
const v = E(() => H.value ? [
|
|
1305
|
+
{
|
|
1306
|
+
label: r("inventory.common.refresh"),
|
|
1307
|
+
value: "refresh",
|
|
1308
|
+
isPrimary: !1
|
|
1309
|
+
}
|
|
1310
|
+
] : [
|
|
1311
|
+
{
|
|
1312
|
+
label: r("inventory.common.refresh"),
|
|
1313
|
+
value: "refresh",
|
|
1314
|
+
isPrimary: !1
|
|
1315
|
+
}
|
|
1316
|
+
]);
|
|
1317
|
+
return (y, A) => {
|
|
1318
|
+
const L = U("FmTable");
|
|
1319
|
+
return h(), P(q, null, [
|
|
1320
|
+
w(dt, {
|
|
1321
|
+
title: g(r)("inventory.closing.draft.title"),
|
|
1322
|
+
actions: v.value,
|
|
1323
|
+
"onClick:action": l
|
|
1324
|
+
}, {
|
|
1325
|
+
default: Y(() => [
|
|
1326
|
+
o("div", {
|
|
1327
|
+
class: pe([
|
|
1328
|
+
"flex flex-col gap-8 max-h-full",
|
|
1329
|
+
{
|
|
1330
|
+
"p-0": H.value,
|
|
1331
|
+
"px-24 ": !H.value
|
|
1332
|
+
}
|
|
1333
|
+
])
|
|
1334
|
+
}, [
|
|
1335
|
+
w(mt, {
|
|
1336
|
+
"change-location": "",
|
|
1337
|
+
searchable: "",
|
|
1338
|
+
search: R.value,
|
|
1339
|
+
"onUpdate:search": A[0] || (A[0] = (D) => R.value = D)
|
|
1340
|
+
}, null, 8, ["search"]),
|
|
1341
|
+
w(L, {
|
|
1342
|
+
style: Ue(g(C).tableHeight),
|
|
1343
|
+
"column-defs": g(x).columnDefs,
|
|
1344
|
+
"row-data": g(x).drafts,
|
|
1345
|
+
"search-value": R.value,
|
|
1346
|
+
loading: F.value,
|
|
1347
|
+
onRowClick: A[1] || (A[1] = (D) => g(e)(D.original)),
|
|
1348
|
+
"page-size": I.value
|
|
1349
|
+
}, {
|
|
1350
|
+
"list-row": Y((D) => [
|
|
1351
|
+
w(ft, {
|
|
1352
|
+
row: D,
|
|
1353
|
+
onRowClick: (T) => g(e)(T)
|
|
1354
|
+
}, {
|
|
1355
|
+
default: Y((T) => {
|
|
1356
|
+
var j, J, oe, X, se, xe, le, ve, ce, ie, ye, Ae, ue, K, Q, ge, a, t, s, m;
|
|
1357
|
+
return [
|
|
1358
|
+
o("div", ma, [
|
|
1359
|
+
o("div", fa, [
|
|
1360
|
+
o("div", pa, [
|
|
1361
|
+
w(g(ke), {
|
|
1362
|
+
render: (oe = (J = (j = T._id) == null ? void 0 : j.column) == null ? void 0 : J.columnDef) == null ? void 0 : oe.cell,
|
|
1363
|
+
props: (se = (X = T._id) == null ? void 0 : X.getContext) == null ? void 0 : se.call(X)
|
|
1364
|
+
}, null, 8, ["render", "props"])
|
|
1365
|
+
]),
|
|
1366
|
+
o("div", va, [
|
|
1367
|
+
w(g(ke), {
|
|
1368
|
+
render: (ve = (le = (xe = T.name) == null ? void 0 : xe.column) == null ? void 0 : le.columnDef) == null ? void 0 : ve.cell,
|
|
1369
|
+
props: (ie = (ce = T.name) == null ? void 0 : ce.getContext) == null ? void 0 : ie.call(ce)
|
|
1370
|
+
}, null, 8, ["render", "props"])
|
|
1371
|
+
]),
|
|
1372
|
+
o("div", ya, N([
|
|
1373
|
+
...D.original.items.slice(0, 3).map((c) => c.sku.name),
|
|
1374
|
+
...D.original.items.length >= 3 ? [`and ${D.original.items.length - 3} more items`] : []
|
|
1375
|
+
].join(", ")), 1),
|
|
1376
|
+
o("div", ga, [
|
|
1377
|
+
w(g(ke), {
|
|
1378
|
+
render: (ue = (Ae = (ye = T.ref) == null ? void 0 : ye.column) == null ? void 0 : Ae.columnDef) == null ? void 0 : ue.cell,
|
|
1379
|
+
props: (Q = (K = T.ref) == null ? void 0 : K.getContext) == null ? void 0 : Q.call(K)
|
|
1380
|
+
}, null, 8, ["render", "props"])
|
|
1381
|
+
])
|
|
1382
|
+
]),
|
|
1383
|
+
o("div", null, [
|
|
1384
|
+
w(g(ke), {
|
|
1385
|
+
render: (t = (a = (ge = T.status) == null ? void 0 : ge.column) == null ? void 0 : a.columnDef) == null ? void 0 : t.cell,
|
|
1386
|
+
props: (m = (s = T.status) == null ? void 0 : s.getContext) == null ? void 0 : m.call(s)
|
|
1387
|
+
}, null, 8, ["render", "props"])
|
|
1388
|
+
])
|
|
1389
|
+
])
|
|
1390
|
+
];
|
|
1391
|
+
}),
|
|
1392
|
+
_: 2
|
|
1393
|
+
}, 1032, ["row", "onRowClick"])
|
|
1394
|
+
]),
|
|
1395
|
+
_: 1
|
|
1396
|
+
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
|
|
1397
|
+
], 2)
|
|
1398
|
+
]),
|
|
1399
|
+
_: 1
|
|
1400
|
+
}, 8, ["title", "actions"]),
|
|
1401
|
+
(h(), W(Xe, { to: "body" }, [
|
|
1402
|
+
w(da, Qe(g(i), {
|
|
1403
|
+
show: g(u),
|
|
1404
|
+
"onUpdate:show": A[2] || (A[2] = (D) => Ie(u) ? u.value = D : null),
|
|
1405
|
+
onSubmitted: A[3] || (A[3] = () => (u.value = !1, g(x).fetchDrafts())),
|
|
1406
|
+
onRefresh: A[4] || (A[4] = (D) => g(x).updateDraftRef(D))
|
|
1407
|
+
}), null, 16, ["show"])
|
|
1408
|
+
]))
|
|
1409
|
+
], 64);
|
|
1410
|
+
};
|
|
1411
|
+
}
|
|
1412
|
+
});
|
|
1413
|
+
export {
|
|
1414
|
+
wa as default
|
|
1415
|
+
};
|