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