@feedmepos/mf-inventory-portal 0.0.18-dev.3 → 0.0.19-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/{ApprovalView-G-u9nPxH.js → ApprovalView-DU7oB2Zk.js} +42 -39
- package/dist/{BindingsDialog-CVeD1mOn.js → BindingsDialog-BgfV0G46.js} +2 -2
- package/dist/{BindingsPicker-K04aOoGr.js → BindingsPicker-tUI5WYBk.js} +2 -2
- package/dist/{BindingsTable-65aYkpX7.js → BindingsTable-8G-Nc4pC.js} +18 -17
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DaHXKF1s.js +273 -0
- package/dist/{FmMultiselectDialog.vue_vue_type_script_setup_true_lang-C5WBLEy3.js → FmMultiselectDialog.vue_vue_type_script_setup_true_lang-CxOk5ule.js} +2 -2
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-QKFZeZKM.js → FmUnitInput.vue_vue_type_script_setup_true_lang-D-vJDMKb.js} +3 -3
- package/dist/IngredientsView-CAh7D4tL.js +1760 -0
- package/dist/{IntegrationView-ZMPPIopU.js → IntegrationView-Bf7yHuS8.js} +3 -3
- package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-BdVrpR9J.js +277 -0
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-kidodonU.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BKlWhMnB.js} +1 -1
- package/dist/{PurchaseOrderPrintPreview-B4uzudnC.js → PurchaseOrderPrintPreview-YFcOtdfJ.js} +1 -1
- package/dist/ReceiveRequestView-bIXyVVX9.js +1401 -0
- package/dist/RecipeView-BD0mvxCg.js +575 -0
- package/dist/StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js +59 -0
- package/dist/StockView-BCq37bGl.js +1865 -0
- package/dist/SupplierView-BiSqTXnz.js +804 -0
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CvbKNb0C.js +1033 -0
- package/dist/UnitView-DSdn__9m.js +643 -0
- package/dist/WarehouseView-B8UxxAL6.js +1051 -0
- package/dist/api/bill.d.ts +2 -2
- package/dist/app-RVyC2D4O.js +43892 -0
- package/dist/app.d.ts +1002 -0
- package/dist/app.js +4 -3
- package/dist/components/FmDroppableField.vue.d.ts +1 -1
- package/dist/{date2-6Vt_hnAG.js → date2-C2PfOqbB.js} +1 -1
- package/dist/{dayjs.min-Co7-8-Mb.js → dayjs.min-0pzT_dbr.js} +1 -1
- package/dist/{decimal-ziY3648r.js → decimal-BtIn4K57.js} +1 -1
- package/dist/{fuzzy-gvHXFsh0.js → fuzzy-yzIM5KUK.js} +1 -1
- package/dist/{index-Do1KDD1S.js → index-l87_vggM.js} +1 -1
- package/dist/{layout-BxDEsp4a.js → layout-ITqYtCVu.js} +1 -1
- package/dist/{number-Dvvpk3SV.js → number-B5d98l0m.js} +1 -1
- package/dist/router/name.d.ts +2 -1
- package/dist/{rules-CQu9yXsg.js → rules-CCwuHe8Y.js} +2 -2
- package/dist/{stock-estimate-Wysv30cx.js → stock-estimate-C4PL0Fcz.js} +2 -2
- package/dist/style.css +1 -1
- package/dist/{supplier-BFdAYn3E.js → supplier-CA0OR3DU.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-inventory-binding-dialog-CuyOzZ5r.js → use-inventory-binding-dialog-CTriImiV.js} +2 -2
- package/dist/views/receive-request/components/transfer-form/SparkIcon.vue.d.ts +1 -1
- package/dist/views/stock/components/StockRecordCard.vue.d.ts +1 -1
- package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +2 -2
- package/dist/views/stock/helper/compute-summary-total.d.ts +2 -2
- package/dist/{xlsx-BG4CsaGF.js → xlsx-DAVatAlv.js} +660 -660
- package/dist/xlsx.util-BsZI2tNE.js +109 -0
- package/package.json +6 -5
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DgHp7KgJ.js +0 -268
- package/dist/IngredientsView-6Q2UWsu-.js +0 -1776
- package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-C8YTZoBw.js +0 -276
- package/dist/ReceiveRequestView-DuHtLwZN.js +0 -1394
- package/dist/RecipeView-CRj0pC9N.js +0 -573
- package/dist/StockForecast.vue_vue_type_style_index_0_lang-B5EK101t.js +0 -58
- package/dist/StockView-CQbeZ5pU.js +0 -1862
- package/dist/SupplierView-CrfQATQf.js +0 -796
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CLUo-Tve.js +0 -1028
- package/dist/UnitView-D1acjiRV.js +0 -635
- package/dist/WarehouseView-DID1G1qK.js +0 -1043
- package/dist/app-D1teOEQX.js +0 -66113
- package/dist/xlsx.util-BkVYceD0.js +0 -107
|
@@ -1,1028 +0,0 @@
|
|
|
1
|
-
import { ref as F, computed as re, h as Se, defineComponent as Ue, resolveComponent as H, openBlock as f, createBlock as I, unref as y, isRef as Me, withCtx as se, createElementVNode as e, createVNode as G, createElementBlock as x, Fragment as ee, normalizeClass as ae, toDisplayString as O, createCommentVNode as S, renderList as me } from "vue";
|
|
2
|
-
import { i as Fe } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DgHp7KgJ.js";
|
|
3
|
-
import { h as Le, f as oe, v, w as je, c as Ce, q as M, s as Y, a as xe } from "./app-D1teOEQX.js";
|
|
4
|
-
import { e as ne, t as Be, b as Ie, a as Ve } from "./date2-6Vt_hnAG.js";
|
|
5
|
-
import { F as ke, D as N, R as k } from "./row-action.enum-BwQbURNh.js";
|
|
6
|
-
import { useDialog as Pe, useSnackbar as Ne, components as Ae, useProxiedModel as Ge } from "@feedmepos/ui-library";
|
|
7
|
-
import { c as Re } from "./layout-BxDEsp4a.js";
|
|
8
|
-
import { h as Ee, c as pe, a as ce, j as Ke, i as ze } from "./number-Dvvpk3SV.js";
|
|
9
|
-
import { F as He } from "./decimal-ziY3648r.js";
|
|
10
|
-
import { E as Qe } from "./empty-placeholder-wf6-BWE8.js";
|
|
11
|
-
const Te = Le((a, i) => {
|
|
12
|
-
const d = oe();
|
|
13
|
-
return {
|
|
14
|
-
async readRequests(r) {
|
|
15
|
-
const g = r ?? d.currentLocationDBName, m = `${a.inventoryBackendUrl}/${g}/purchase-request`;
|
|
16
|
-
return await i.get(m);
|
|
17
|
-
},
|
|
18
|
-
async getPurchaseOrders({
|
|
19
|
-
start: r,
|
|
20
|
-
end: g
|
|
21
|
-
}) {
|
|
22
|
-
const m = d.currentLocationDBName, D = `${a.inventoryBackendUrl}/${m}/purchase-order`;
|
|
23
|
-
return await i.get(`${D}?start=${r}&end=${g}`);
|
|
24
|
-
},
|
|
25
|
-
async getPurchaseOrderById(r) {
|
|
26
|
-
const g = d.currentLocationDBName, m = `${a.inventoryBackendUrl}/${g}/purchase-order`;
|
|
27
|
-
return await i.get(`${m}/${r}`);
|
|
28
|
-
},
|
|
29
|
-
async processPurchaseOrder(r, g) {
|
|
30
|
-
const m = d.currentLocationDBName, D = g || m, T = `${a.inventoryBackendUrl}/${D}/purchase-order/run-operation`;
|
|
31
|
-
return await i.put(T, r);
|
|
32
|
-
},
|
|
33
|
-
async createPurchaseOrder(r) {
|
|
34
|
-
const g = d.currentLocationDBName, m = `${a.inventoryBackendUrl}/${g}/purchase-order`;
|
|
35
|
-
return await i.post(m, r);
|
|
36
|
-
},
|
|
37
|
-
async updatePurchaseOrder(r) {
|
|
38
|
-
const g = d.currentLocationDBName, m = `${a.inventoryBackendUrl}/${g}/purchase-order`;
|
|
39
|
-
return await i.put(m, r);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
}), $e = {
|
|
43
|
-
[v.enum.confirmDraft]: {
|
|
44
|
-
primaryActions: {
|
|
45
|
-
text: "Confirm draft",
|
|
46
|
-
close: !0
|
|
47
|
-
},
|
|
48
|
-
title: "Confirm draft?",
|
|
49
|
-
message: "Purchase order cannot be changed after confirm draft.",
|
|
50
|
-
successMessage: "Purchase order draft has been confirmed"
|
|
51
|
-
},
|
|
52
|
-
[v.enum.cancelDraft]: {
|
|
53
|
-
primaryActions: {
|
|
54
|
-
text: "Cancel draft",
|
|
55
|
-
close: !0,
|
|
56
|
-
variant: "destructive"
|
|
57
|
-
},
|
|
58
|
-
title: "Cancel draft?",
|
|
59
|
-
message: "Purchase order cannot be changed after cancelled draft.",
|
|
60
|
-
successMessage: "Purchase order draft has been cancelled"
|
|
61
|
-
},
|
|
62
|
-
[v.enum.submitRequest]: {
|
|
63
|
-
primaryActions: {
|
|
64
|
-
text: "Submit request",
|
|
65
|
-
close: !0
|
|
66
|
-
},
|
|
67
|
-
title: "Confirm draft?",
|
|
68
|
-
message: "Purchase order cannot be changed after confirm draft.",
|
|
69
|
-
successMessage: "Purchase order draft has been submitted"
|
|
70
|
-
},
|
|
71
|
-
[v.enum.completeReceive]: {
|
|
72
|
-
primaryActions: {
|
|
73
|
-
text: "Mark received",
|
|
74
|
-
close: !0
|
|
75
|
-
},
|
|
76
|
-
title: "Mark as received",
|
|
77
|
-
message: "Purchase order cannot be changed after it has complete receiving.",
|
|
78
|
-
successMessage: "Purchase order has been marked as received"
|
|
79
|
-
},
|
|
80
|
-
[v.enum.approveRequest]: {
|
|
81
|
-
primaryActions: {
|
|
82
|
-
text: "Approve request",
|
|
83
|
-
close: !0
|
|
84
|
-
},
|
|
85
|
-
title: "Approve request?",
|
|
86
|
-
message: "Purchase order will be approved.",
|
|
87
|
-
successMessage: "Purchase order has been approved"
|
|
88
|
-
},
|
|
89
|
-
[v.enum.rejectRequest]: {
|
|
90
|
-
primaryActions: {
|
|
91
|
-
text: "Reject request",
|
|
92
|
-
close: !0,
|
|
93
|
-
variant: "destructive"
|
|
94
|
-
},
|
|
95
|
-
title: "Reject request?",
|
|
96
|
-
message: "Purchase order will be rejected.",
|
|
97
|
-
successMessage: "Purchase order has been rejected"
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
function le(a) {
|
|
101
|
-
const i = qe(a);
|
|
102
|
-
return i === null ? "" : ne(i);
|
|
103
|
-
}
|
|
104
|
-
function qe(a) {
|
|
105
|
-
const i = a.match(/\w+_(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z).*/);
|
|
106
|
-
if (!i) return null;
|
|
107
|
-
const d = /* @__PURE__ */ new Date(`${i[1]}`);
|
|
108
|
-
return isNaN(d.getTime()) ? null : d;
|
|
109
|
-
}
|
|
110
|
-
function _r(a, i) {
|
|
111
|
-
const d = Pe(), r = oe(), g = xe(), m = F(!1), D = Ne(), T = Te(), L = F(new Array()), u = F(
|
|
112
|
-
i != null && i.startDate && (i != null && i.endDate) ? i : Fe()
|
|
113
|
-
), l = re(() => {
|
|
114
|
-
const n = new Date(u.value.startDate), s = new Date(u.value.endDate);
|
|
115
|
-
return {
|
|
116
|
-
start: Be(n).toISOString(),
|
|
117
|
-
end: Ie(s).toISOString()
|
|
118
|
-
};
|
|
119
|
-
}), o = F(new Array()), h = je(), E = F(null), $ = F();
|
|
120
|
-
function ie() {
|
|
121
|
-
const n = {
|
|
122
|
-
mode: ke.CREATE,
|
|
123
|
-
modelValue: {},
|
|
124
|
-
show: !0,
|
|
125
|
-
"onUpdate:show"(s) {
|
|
126
|
-
$.value.show = s;
|
|
127
|
-
},
|
|
128
|
-
lastClosingDate: E.value
|
|
129
|
-
};
|
|
130
|
-
$.value = n;
|
|
131
|
-
}
|
|
132
|
-
function B(n) {
|
|
133
|
-
const s = {
|
|
134
|
-
mode: ke.UPDATE,
|
|
135
|
-
modelValue: Ce(n),
|
|
136
|
-
show: !0,
|
|
137
|
-
"onUpdate:show"(_) {
|
|
138
|
-
$.value.show = _;
|
|
139
|
-
},
|
|
140
|
-
lastClosingDate: E.value
|
|
141
|
-
};
|
|
142
|
-
$.value = s;
|
|
143
|
-
}
|
|
144
|
-
async function ue() {
|
|
145
|
-
L.value = [], m.value = !0;
|
|
146
|
-
try {
|
|
147
|
-
L.value = await T.getPurchaseOrders(l.value).then((_) => _.sort((w, A) => A._id.localeCompare(w._id)));
|
|
148
|
-
const n = await h.readLastClosing(!0), s = n == null ? void 0 : n._id;
|
|
149
|
-
s && (E.value = qe(s));
|
|
150
|
-
} catch {
|
|
151
|
-
D.open({
|
|
152
|
-
title: "Something went wrong",
|
|
153
|
-
message: "Error at fetching purchase orders",
|
|
154
|
-
type: "error"
|
|
155
|
-
});
|
|
156
|
-
} finally {
|
|
157
|
-
m.value = !1;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
async function de() {
|
|
161
|
-
o.value = [], m.value = !0;
|
|
162
|
-
try {
|
|
163
|
-
o.value = await T.readRequests();
|
|
164
|
-
} catch {
|
|
165
|
-
D.open({
|
|
166
|
-
title: "Something went wrong",
|
|
167
|
-
message: "Error at fetching purchase requests",
|
|
168
|
-
type: "error"
|
|
169
|
-
});
|
|
170
|
-
} finally {
|
|
171
|
-
m.value = !1;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
function t() {
|
|
175
|
-
switch (a) {
|
|
176
|
-
case "receive/request":
|
|
177
|
-
return ue();
|
|
178
|
-
case "approval":
|
|
179
|
-
return de();
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
function c(n, s) {
|
|
183
|
-
u.value = {
|
|
184
|
-
startDate: n,
|
|
185
|
-
endDate: s
|
|
186
|
-
}, t();
|
|
187
|
-
}
|
|
188
|
-
r.watchLocation(async (n) => {
|
|
189
|
-
if (!n) {
|
|
190
|
-
L.value = [];
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
await t();
|
|
194
|
-
});
|
|
195
|
-
const R = F(), b = F(Math.random().toString());
|
|
196
|
-
async function W(n, s) {
|
|
197
|
-
var C, q;
|
|
198
|
-
const _ = Math.random().toString();
|
|
199
|
-
b.value = _;
|
|
200
|
-
const w = a === "receive/request" ? r.currentLocation : s == null ? void 0 : s.to, A = {
|
|
201
|
-
purchaseOrder: n,
|
|
202
|
-
transferTo: w == null ? void 0 : w.name,
|
|
203
|
-
transferToDbName: w == null ? void 0 : w.dbName,
|
|
204
|
-
show: !0,
|
|
205
|
-
canResubmit: !1,
|
|
206
|
-
canApprove: a === "approval",
|
|
207
|
-
"onUpdate:show"(j) {
|
|
208
|
-
R.value.show = j;
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
if (R.value = A, !(s || n.status !== M.enum.REQUESTING)) {
|
|
212
|
-
try {
|
|
213
|
-
s = (await T.readRequests(
|
|
214
|
-
`${n.supplier.internal}_${n.supplier._id}`
|
|
215
|
-
)).find((z) => z.purchaseOrderId === n._id);
|
|
216
|
-
} catch {
|
|
217
|
-
console.error("Error at fetching po request to check");
|
|
218
|
-
}
|
|
219
|
-
_ === b.value && (R.value.canResubmit = !s, R.value.transferTo = (C = s == null ? void 0 : s.to) == null ? void 0 : C.name, R.value.transferToDbName = (q = s == null ? void 0 : s.to) == null ? void 0 : q.dbName);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
async function K(n, s, _, w) {
|
|
223
|
-
m.value = !0;
|
|
224
|
-
try {
|
|
225
|
-
await T.processPurchaseOrder(
|
|
226
|
-
{
|
|
227
|
-
operation: s,
|
|
228
|
-
doc: n,
|
|
229
|
-
options: (
|
|
230
|
-
// auto receive for supplier to warehouse
|
|
231
|
-
(s === v.enum.confirmDraft || // auto receive for warehouse to warehouse
|
|
232
|
-
s === v.enum.completeReceive) && g.autoReceiveWarehouse ? {
|
|
233
|
-
autoReceive: !0
|
|
234
|
-
} : void 0
|
|
235
|
-
)
|
|
236
|
-
},
|
|
237
|
-
w
|
|
238
|
-
), await new Promise((q) => setTimeout(q, 1e3));
|
|
239
|
-
const C = oe().currentLocationDBName.startsWith("restaurant_");
|
|
240
|
-
s === v.enum.confirmDraft && n.effectiveAt && C ? D.open({
|
|
241
|
-
title: "Success",
|
|
242
|
-
message: `${_}. The backdate will be reflected once your POS has received this change.`,
|
|
243
|
-
type: "success"
|
|
244
|
-
}) : D.open({
|
|
245
|
-
title: "Success",
|
|
246
|
-
message: _,
|
|
247
|
-
type: "success"
|
|
248
|
-
});
|
|
249
|
-
} catch (A) {
|
|
250
|
-
D.open({
|
|
251
|
-
title: "Something went wrong",
|
|
252
|
-
message: "Please try again.",
|
|
253
|
-
type: "error"
|
|
254
|
-
}), console.error("Error when submitting PO operation", s, n, A);
|
|
255
|
-
} finally {
|
|
256
|
-
m.value = !1, t();
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
async function V(n, s, _) {
|
|
260
|
-
const w = $e[s];
|
|
261
|
-
if (!w) {
|
|
262
|
-
D.open({
|
|
263
|
-
title: "Something went wrong",
|
|
264
|
-
message: `Cannot process order: ${Y(s)}`,
|
|
265
|
-
type: "error"
|
|
266
|
-
});
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
const { successMessage: A, ...C } = w;
|
|
270
|
-
d.open({
|
|
271
|
-
title: C.title,
|
|
272
|
-
message: C.message,
|
|
273
|
-
primaryActions: C.primaryActions
|
|
274
|
-
}).onPrimary(() => {
|
|
275
|
-
K(n, s, A, _);
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
return {
|
|
279
|
-
purchaseOrders: L,
|
|
280
|
-
purchaseRequests: o,
|
|
281
|
-
updateDateRange: c,
|
|
282
|
-
fetchData: t,
|
|
283
|
-
loading: m,
|
|
284
|
-
transferDialogProps: $,
|
|
285
|
-
promptCreateTransferDialog: ie,
|
|
286
|
-
promptUpdateTransferDialog: B,
|
|
287
|
-
transferDetailsProps: R,
|
|
288
|
-
promptShowTransferDetails: W,
|
|
289
|
-
submitAction: V
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
function Ye(a, i) {
|
|
293
|
-
return i.reduce(
|
|
294
|
-
(r, g) => {
|
|
295
|
-
const m = g.received.find((D) => D.sku._id === a._id);
|
|
296
|
-
return m && (r = Ee(r, m.amount)), r;
|
|
297
|
-
},
|
|
298
|
-
He.toPrecision(pe(0), a.unit.precision)
|
|
299
|
-
);
|
|
300
|
-
}
|
|
301
|
-
function fe(a, i, d) {
|
|
302
|
-
const r = (d == null ? void 0 : d.abbrev) ?? i.abbrev;
|
|
303
|
-
return `${ce(a, !1)} ${r}`;
|
|
304
|
-
}
|
|
305
|
-
function We(a, i) {
|
|
306
|
-
const { name: d, address: r, regNo: g } = i.doc.profile, m = {
|
|
307
|
-
name: d,
|
|
308
|
-
registrationNumber: g,
|
|
309
|
-
line1: r == null ? void 0 : r.line1,
|
|
310
|
-
line2: r == null ? void 0 : r.line2,
|
|
311
|
-
postcode: r == null ? void 0 : r.postcode,
|
|
312
|
-
city: r == null ? void 0 : r.city,
|
|
313
|
-
state: r == null ? void 0 : r.state,
|
|
314
|
-
country: r == null ? void 0 : r.country
|
|
315
|
-
}, D = {
|
|
316
|
-
name: a.supplier.name,
|
|
317
|
-
registrationNumber: a.supplier.registrationNumber,
|
|
318
|
-
line1: a.supplier.address.line1,
|
|
319
|
-
line2: a.supplier.address.line2,
|
|
320
|
-
postcode: a.supplier.address.postcode,
|
|
321
|
-
city: a.supplier.address.city,
|
|
322
|
-
state: a.supplier.address.state,
|
|
323
|
-
country: a.supplier.address.country
|
|
324
|
-
}, T = a.items.map((o) => {
|
|
325
|
-
const { sku: h, measurement: E } = o, $ = ce(
|
|
326
|
-
Ye(o.sku, a.deliveryOrder || []),
|
|
327
|
-
!1
|
|
328
|
-
);
|
|
329
|
-
return {
|
|
330
|
-
code: h.code,
|
|
331
|
-
description: h.name,
|
|
332
|
-
quantity: fe(o.quantity, h.unit, o.measurement),
|
|
333
|
-
unit: (E == null ? void 0 : E.abbrev) || h.unit.abbrev,
|
|
334
|
-
received: $
|
|
335
|
-
};
|
|
336
|
-
}), L = a.deliveryOrder.map((o) => ({
|
|
337
|
-
createdAt: ne(new Date(o.createdAt)),
|
|
338
|
-
ref: o.deliveryOrderNumber,
|
|
339
|
-
remark: o.remark || "",
|
|
340
|
-
items: o.received.map((h) => {
|
|
341
|
-
var E;
|
|
342
|
-
return {
|
|
343
|
-
code: h.sku.code,
|
|
344
|
-
description: h.sku.name,
|
|
345
|
-
quantity: ce(h.amount),
|
|
346
|
-
unit: ((E = h.measurement) == null ? void 0 : E.abbrev) || h.sku.unit.abbrev
|
|
347
|
-
};
|
|
348
|
-
})
|
|
349
|
-
})), u = {
|
|
350
|
-
orderNumber: a.seqNumber.toString(),
|
|
351
|
-
createdAt: le(a._id),
|
|
352
|
-
ref: a.ref || "",
|
|
353
|
-
remark: a.remark || "",
|
|
354
|
-
buyer: m,
|
|
355
|
-
supplier: D,
|
|
356
|
-
items: T,
|
|
357
|
-
status: a.status,
|
|
358
|
-
deliveryOrders: L
|
|
359
|
-
}, l = new URL(window.location.href);
|
|
360
|
-
l.pathname = "/receive-request/print-preview", l.searchParams.append("data", JSON.stringify(u)), window.open(l.href, "_blank", "noreferrer");
|
|
361
|
-
}
|
|
362
|
-
const Q = {
|
|
363
|
-
submitRequest: {
|
|
364
|
-
label: "Submit request",
|
|
365
|
-
color: "text-fm-color-typo-primary",
|
|
366
|
-
value: v.enum.submitRequest
|
|
367
|
-
},
|
|
368
|
-
confirmDraft: {
|
|
369
|
-
label: "Confirm draft",
|
|
370
|
-
color: "text-fm-color-typo-primary",
|
|
371
|
-
value: v.enum.confirmDraft
|
|
372
|
-
},
|
|
373
|
-
cancelDraft: {
|
|
374
|
-
label: "Cancel draft",
|
|
375
|
-
color: "text-fm-color-typo-error",
|
|
376
|
-
value: v.enum.cancelDraft
|
|
377
|
-
},
|
|
378
|
-
approveRequest: {
|
|
379
|
-
label: "Approve",
|
|
380
|
-
color: "text-fm-color-typo-primary",
|
|
381
|
-
value: v.enum.approveRequest
|
|
382
|
-
},
|
|
383
|
-
rejectRequest: {
|
|
384
|
-
label: "Reject",
|
|
385
|
-
color: "text-fm-color-typo-error",
|
|
386
|
-
value: v.enum.rejectRequest
|
|
387
|
-
},
|
|
388
|
-
processRequest: {
|
|
389
|
-
label: "Process",
|
|
390
|
-
color: "text-fm-color-typo-primary",
|
|
391
|
-
value: v.enum.processRequest
|
|
392
|
-
},
|
|
393
|
-
receiveStock: {
|
|
394
|
-
label: "Receive Stock",
|
|
395
|
-
color: "text-fm-color-typo-primary",
|
|
396
|
-
value: v.enum.receiveStock
|
|
397
|
-
},
|
|
398
|
-
completeReceive: {
|
|
399
|
-
label: "Mark completed",
|
|
400
|
-
color: "text-fm-color-typo-primary",
|
|
401
|
-
value: v.enum.completeReceive
|
|
402
|
-
}
|
|
403
|
-
};
|
|
404
|
-
function wr(a, i) {
|
|
405
|
-
const d = oe();
|
|
406
|
-
function r(u) {
|
|
407
|
-
switch (u.status) {
|
|
408
|
-
case "DRAFT":
|
|
409
|
-
return [
|
|
410
|
-
u.supplier.internal === "restaurant" || u.supplier.internal === "warehouse" ? Q[v.enum.submitRequest] : Q[v.enum.confirmDraft],
|
|
411
|
-
Q[v.enum.cancelDraft],
|
|
412
|
-
N[k.Update],
|
|
413
|
-
N[k.Details],
|
|
414
|
-
N[k.Print]
|
|
415
|
-
];
|
|
416
|
-
case "RECEIVING":
|
|
417
|
-
return [
|
|
418
|
-
Q[v.enum.completeReceive],
|
|
419
|
-
N[k.Update],
|
|
420
|
-
N[k.Details],
|
|
421
|
-
N[k.Print]
|
|
422
|
-
];
|
|
423
|
-
case "REQUESTING":
|
|
424
|
-
return a === "receive/request" ? [
|
|
425
|
-
N[k.Update],
|
|
426
|
-
N[k.Details],
|
|
427
|
-
N[k.Print]
|
|
428
|
-
] : [
|
|
429
|
-
Q[v.enum.approveRequest],
|
|
430
|
-
Q[v.enum.rejectRequest],
|
|
431
|
-
N[k.Details],
|
|
432
|
-
N[k.Print]
|
|
433
|
-
];
|
|
434
|
-
case "PROCESSING":
|
|
435
|
-
return [N[k.Details], N[k.Print]];
|
|
436
|
-
case "COMPLETE":
|
|
437
|
-
case "CANCEL":
|
|
438
|
-
default:
|
|
439
|
-
return [
|
|
440
|
-
N[k.Update],
|
|
441
|
-
N[k.Details],
|
|
442
|
-
N[k.Print]
|
|
443
|
-
];
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
function g(u) {
|
|
447
|
-
return Object.values(v.enum).includes(u);
|
|
448
|
-
}
|
|
449
|
-
async function m(u, l, o) {
|
|
450
|
-
var E, $;
|
|
451
|
-
const h = Ce(l);
|
|
452
|
-
if (u === k.Print) {
|
|
453
|
-
We(h, d.currentLocation);
|
|
454
|
-
return;
|
|
455
|
-
}
|
|
456
|
-
if (u === k.Details) {
|
|
457
|
-
i.promptShowTransferDetails(h, o);
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
460
|
-
if (u === k.Update) {
|
|
461
|
-
(E = i.promptUpdateTransferDialog) == null || E.call(i, h);
|
|
462
|
-
return;
|
|
463
|
-
}
|
|
464
|
-
if (g(u)) {
|
|
465
|
-
i.submitAction(l, u, ($ = o == null ? void 0 : o.to) == null ? void 0 : $.dbName);
|
|
466
|
-
return;
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
function D() {
|
|
470
|
-
return [
|
|
471
|
-
{
|
|
472
|
-
accessorKey: "seqNumber",
|
|
473
|
-
header: "#",
|
|
474
|
-
enableSorting: !0,
|
|
475
|
-
size: 80,
|
|
476
|
-
sortUndefined: "last"
|
|
477
|
-
},
|
|
478
|
-
{
|
|
479
|
-
accessorKey: "_id",
|
|
480
|
-
header: "Created At",
|
|
481
|
-
cell(u) {
|
|
482
|
-
return le(`${u.getValue()}`);
|
|
483
|
-
},
|
|
484
|
-
enableSorting: !0
|
|
485
|
-
},
|
|
486
|
-
{
|
|
487
|
-
accessorKey: "supplier.name",
|
|
488
|
-
header: "Transfer From",
|
|
489
|
-
enableSorting: !0,
|
|
490
|
-
size: 200
|
|
491
|
-
},
|
|
492
|
-
{
|
|
493
|
-
accessorKey: "items.length",
|
|
494
|
-
header: "No. of Items",
|
|
495
|
-
enableSorting: !1,
|
|
496
|
-
meta: {
|
|
497
|
-
width: "10rem"
|
|
498
|
-
}
|
|
499
|
-
},
|
|
500
|
-
{
|
|
501
|
-
accessorKey: "ref",
|
|
502
|
-
header: "Reference",
|
|
503
|
-
enableSorting: !1,
|
|
504
|
-
size: "auto"
|
|
505
|
-
},
|
|
506
|
-
{
|
|
507
|
-
accessorKey: "status",
|
|
508
|
-
header: "Status",
|
|
509
|
-
cell(u) {
|
|
510
|
-
const l = `${u.getValue() ?? ""}`.toLocaleLowerCase("en-us");
|
|
511
|
-
return Se(Ae.FmChip, {
|
|
512
|
-
label: l === "cancel" ? "Cancelled" : Y(l),
|
|
513
|
-
class: `fm-status-badge fm-status-badge-${l}`,
|
|
514
|
-
compact: !0
|
|
515
|
-
});
|
|
516
|
-
},
|
|
517
|
-
enableSorting: !0,
|
|
518
|
-
size: 200
|
|
519
|
-
},
|
|
520
|
-
{
|
|
521
|
-
id: "action",
|
|
522
|
-
cell(u) {
|
|
523
|
-
const l = u.row.original, o = r(l);
|
|
524
|
-
return Re(o, (h) => m(h, l));
|
|
525
|
-
},
|
|
526
|
-
enableSorting: !1,
|
|
527
|
-
size: 40,
|
|
528
|
-
meta: {
|
|
529
|
-
cellClass: "",
|
|
530
|
-
headerClass: ""
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
];
|
|
534
|
-
}
|
|
535
|
-
function T() {
|
|
536
|
-
return [
|
|
537
|
-
{
|
|
538
|
-
accessorKey: "purchaseOrder.seqNumber",
|
|
539
|
-
header: "#",
|
|
540
|
-
enableSorting: !0,
|
|
541
|
-
size: 80,
|
|
542
|
-
sortUndefined: "last"
|
|
543
|
-
},
|
|
544
|
-
{
|
|
545
|
-
accessorKey: "purchaseOrder._id",
|
|
546
|
-
header: "Created At",
|
|
547
|
-
cell(u) {
|
|
548
|
-
return le(`${u.getValue()}`);
|
|
549
|
-
},
|
|
550
|
-
enableSorting: !0
|
|
551
|
-
},
|
|
552
|
-
{
|
|
553
|
-
accessorKey: "to.name",
|
|
554
|
-
header: "Transfer To",
|
|
555
|
-
enableSorting: !1,
|
|
556
|
-
size: 200
|
|
557
|
-
},
|
|
558
|
-
{
|
|
559
|
-
accessorKey: "purchaseOrder.items.length",
|
|
560
|
-
header: "No. of Items",
|
|
561
|
-
enableSorting: !1
|
|
562
|
-
},
|
|
563
|
-
{
|
|
564
|
-
accessorKey: "purchaseOrder.ref",
|
|
565
|
-
header: "Reference",
|
|
566
|
-
enableSorting: !1,
|
|
567
|
-
size: "auto"
|
|
568
|
-
},
|
|
569
|
-
{
|
|
570
|
-
accessorKey: "purchaseOrder.status",
|
|
571
|
-
header: "Status",
|
|
572
|
-
cell(u) {
|
|
573
|
-
const l = `${u.getValue() ?? ""}`.toLocaleLowerCase("en-us");
|
|
574
|
-
return Se(Ae.FmChip, {
|
|
575
|
-
label: Y(l),
|
|
576
|
-
class: `fm-status-badge fm-status-badge-${l}`,
|
|
577
|
-
compact: !0
|
|
578
|
-
});
|
|
579
|
-
},
|
|
580
|
-
enableSorting: !0
|
|
581
|
-
},
|
|
582
|
-
{
|
|
583
|
-
id: "action",
|
|
584
|
-
cell(u) {
|
|
585
|
-
const l = u.row.original, o = l.purchaseOrder ? r(l.purchaseOrder) : [];
|
|
586
|
-
return Re(
|
|
587
|
-
o,
|
|
588
|
-
(h) => l.purchaseOrder ? m(h, l.purchaseOrder, l) : void 0
|
|
589
|
-
);
|
|
590
|
-
},
|
|
591
|
-
enableSorting: !1,
|
|
592
|
-
size: 40,
|
|
593
|
-
meta: {
|
|
594
|
-
cellClass: "",
|
|
595
|
-
headerClass: ""
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
];
|
|
599
|
-
}
|
|
600
|
-
const L = re(() => a === "receive/request" ? D() : T());
|
|
601
|
-
return {
|
|
602
|
-
get columnDefs() {
|
|
603
|
-
return L.value;
|
|
604
|
-
}
|
|
605
|
-
};
|
|
606
|
-
}
|
|
607
|
-
var te = /* @__PURE__ */ ((a) => (a.PURCHASE = "PURCHASE", a.TRANSFER = "TRANSFER", a))(te || {});
|
|
608
|
-
const Je = { class: "flex flex-col gap-16 w-full h-full" }, Ze = { class: "xs:w-screen max-w-full" }, Xe = { class: "flex justify-between" }, et = /* @__PURE__ */ e("div", { class: "fm-typo-en-body-lg-600" }, "Request summary", -1), tt = { class: "flex flex-col gap-8" }, rt = { class: "flex flex-col gap-4" }, st = /* @__PURE__ */ e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, [
|
|
609
|
-
/* @__PURE__ */ e("div", { class: "flex gap-1" }, "Created at")
|
|
610
|
-
], -1), at = { class: "fm-typo-en-body-lg-600" }, ot = {
|
|
611
|
-
key: 0,
|
|
612
|
-
class: "flex flex-col gap-4"
|
|
613
|
-
}, nt = /* @__PURE__ */ e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Backdated to ", -1), ct = { class: "fm-typo-en-body-lg-600" }, lt = { class: "flex flex-col gap-4" }, it = /* @__PURE__ */ e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "Type", -1), ut = { class: "fm-typo-en-body-lg-600" }, dt = {
|
|
614
|
-
key: 1,
|
|
615
|
-
class: "flex flex-col gap-4"
|
|
616
|
-
}, mt = /* @__PURE__ */ e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "From", -1), pt = { class: "fm-typo-en-body-lg-600" }, ft = {
|
|
617
|
-
key: 2,
|
|
618
|
-
class: "flex flex-col gap-4"
|
|
619
|
-
}, vt = /* @__PURE__ */ e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "To", -1), yt = { class: "fm-typo-en-body-lg-600" }, ht = {
|
|
620
|
-
key: 3,
|
|
621
|
-
class: "flex flex-col gap-4"
|
|
622
|
-
}, gt = /* @__PURE__ */ e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "Reference", -1), bt = { class: "fm-typo-en-body-lg-600" }, _t = {
|
|
623
|
-
key: 4,
|
|
624
|
-
class: "flex flex-col gap-4"
|
|
625
|
-
}, wt = /* @__PURE__ */ e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "Remark", -1), Ot = { class: "fm-typo-en-body-lg-600" }, Dt = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, St = { class: "flex flex-col gap-8" }, kt = { class: "fm-typo-en-body-lg-600" }, At = { class: "flex w-full gap-4" }, Rt = { class: "grow fm-typo-en-body-lg-400 line-clamp-2" }, Ct = /* @__PURE__ */ e("div", { class: "flex-1 min-w-32" }, null, -1), xt = { class: "fm-typo-en-body-lg-600 shrink-0" }, Pt = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, Nt = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, Et = {
|
|
626
|
-
key: 0,
|
|
627
|
-
class: "shrink-0 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
|
|
628
|
-
}, Tt = {
|
|
629
|
-
key: 1,
|
|
630
|
-
class: "flex-1 xs:w-screen xs:max-w-full"
|
|
631
|
-
}, $t = {
|
|
632
|
-
key: 0,
|
|
633
|
-
class: "flex flex-col items-center gap-8 h-full"
|
|
634
|
-
}, qt = ["src"], Ut = /* @__PURE__ */ e("div", { class: "fm-typo-en-body-lg-600" }, "No records found", -1), Mt = /* @__PURE__ */ e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, " Track and manage your delivery history here. ", -1), Ft = {
|
|
635
|
-
key: 1,
|
|
636
|
-
class: "px-4 flex flex-col"
|
|
637
|
-
}, Lt = { class: "flex gap-12 content-stretch" }, jt = {
|
|
638
|
-
class: "flex flex-col w-24",
|
|
639
|
-
name: "circles"
|
|
640
|
-
}, Bt = { class: "flex-1 flex flex-col items-center" }, It = /* @__PURE__ */ e("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1), Vt = { class: "flex-1 flex flex-col items-center" }, Gt = {
|
|
641
|
-
class: "py-12 flex flex-col gap-4",
|
|
642
|
-
name: "received-at header"
|
|
643
|
-
}, Kt = /* @__PURE__ */ e("div", { class: "fm-typo-en-body-lg-400" }, "Received", -1), zt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Ht = { class: "flex gap-12 content-stretch" }, Qt = {
|
|
644
|
-
class: "flex flex-col w-24",
|
|
645
|
-
name: "circles"
|
|
646
|
-
}, Yt = { class: "flex-1 flex flex-col items-center" }, Wt = {
|
|
647
|
-
class: "py-12 flex flex-col gap-4 flex-1",
|
|
648
|
-
name: "delivery details"
|
|
649
|
-
}, Jt = { class: "flex flex-col gap-8" }, Zt = { class: "flex flex-col gap-4" }, Xt = /* @__PURE__ */ e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Received by ", -1), er = { class: "fm-typo-en-body-lg-600" }, tr = { class: "flex flex-col gap-4" }, rr = /* @__PURE__ */ e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Received items ", -1), sr = { class: "flex flex-col gap-4" }, ar = /* @__PURE__ */ e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Delivery order no. ", -1), or = { class: "fm-typo-en-body-lg-600" }, nr = { class: "flex flex-col gap-4" }, cr = {
|
|
650
|
-
key: 0,
|
|
651
|
-
class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
|
|
652
|
-
}, lr = { class: "fm-typo-en-body-lg-600" }, ir = { class: "flex gap-8 xs:flex-col" }, Or = /* @__PURE__ */ Ue({
|
|
653
|
-
__name: "TransferDetails",
|
|
654
|
-
props: {
|
|
655
|
-
purchaseOrder: {},
|
|
656
|
-
transferTo: {},
|
|
657
|
-
transferToDbName: {},
|
|
658
|
-
show: { type: Boolean },
|
|
659
|
-
canResubmit: { type: Boolean },
|
|
660
|
-
canApprove: { type: Boolean }
|
|
661
|
-
},
|
|
662
|
-
emits: ["update:show", "submitted"],
|
|
663
|
-
setup(a, { emit: i }) {
|
|
664
|
-
const d = a, r = i, g = Pe(), m = Ne(), D = xe(), T = re(
|
|
665
|
-
() => {
|
|
666
|
-
var t, c, R, b;
|
|
667
|
-
return ((c = (t = d.purchaseOrder) == null ? void 0 : t.supplier) == null ? void 0 : c.internal) === "restaurant" || ((b = (R = d.purchaseOrder) == null ? void 0 : R.supplier) == null ? void 0 : b.internal) === "warehouse" ? te.TRANSFER : te.PURCHASE;
|
|
668
|
-
}
|
|
669
|
-
), L = [
|
|
670
|
-
{
|
|
671
|
-
label: "Overview"
|
|
672
|
-
},
|
|
673
|
-
{
|
|
674
|
-
label: "Delivery history"
|
|
675
|
-
}
|
|
676
|
-
], u = F(L[0]), l = F(!1), o = F(""), h = F(!0), E = Te(), $ = Ge(d, "show");
|
|
677
|
-
async function ie(t, c, R) {
|
|
678
|
-
o.value = c, l.value = !0, h.value = !1;
|
|
679
|
-
try {
|
|
680
|
-
await E.processPurchaseOrder(
|
|
681
|
-
{
|
|
682
|
-
operation: c,
|
|
683
|
-
doc: t,
|
|
684
|
-
options: (
|
|
685
|
-
// auto receive for supplier to warehouse
|
|
686
|
-
(c === v.enum.confirmDraft || // auto receive for warehouse to warehouse
|
|
687
|
-
c === v.enum.completeReceive) && D.autoReceiveWarehouse ? {
|
|
688
|
-
autoReceive: !0
|
|
689
|
-
} : void 0
|
|
690
|
-
)
|
|
691
|
-
},
|
|
692
|
-
d.transferToDbName
|
|
693
|
-
), await new Promise((b) => setTimeout(b, 1e3)), m.open({
|
|
694
|
-
title: "Success",
|
|
695
|
-
message: R,
|
|
696
|
-
type: "success"
|
|
697
|
-
}), r("update:show", !1), r("submitted");
|
|
698
|
-
} catch (b) {
|
|
699
|
-
m.open({
|
|
700
|
-
title: "Something went wrong",
|
|
701
|
-
message: "Please try again.",
|
|
702
|
-
type: "error"
|
|
703
|
-
}), console.error("Error when submitting PO operation", c, t, b);
|
|
704
|
-
} finally {
|
|
705
|
-
o.value = "", l.value = !1, h.value = !0;
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
async function B(t) {
|
|
709
|
-
const c = $e[t];
|
|
710
|
-
if (!c) {
|
|
711
|
-
m.open({
|
|
712
|
-
title: "Something went wrong",
|
|
713
|
-
message: `Cannot process order: ${Y(t)}`,
|
|
714
|
-
type: "error"
|
|
715
|
-
});
|
|
716
|
-
return;
|
|
717
|
-
}
|
|
718
|
-
const { successMessage: R, ...b } = c;
|
|
719
|
-
g.open({
|
|
720
|
-
title: b.title,
|
|
721
|
-
message: b.message,
|
|
722
|
-
primaryActions: b.primaryActions
|
|
723
|
-
}).onPrimary(() => {
|
|
724
|
-
d.purchaseOrder && ie(d.purchaseOrder, t, R);
|
|
725
|
-
});
|
|
726
|
-
}
|
|
727
|
-
const ue = re(() => {
|
|
728
|
-
var t, c;
|
|
729
|
-
return ((t = d.purchaseOrder) == null ? void 0 : t.status) === M.enum.RECEIVING || ((c = d.purchaseOrder) == null ? void 0 : c.status) === M.enum.COMPLETE;
|
|
730
|
-
}), de = re(() => {
|
|
731
|
-
var K, V, n;
|
|
732
|
-
const R = (((K = d.purchaseOrder) == null ? void 0 : K.deliveryOrder) ?? []).flatMap((s) => s.received ?? []).reduce(
|
|
733
|
-
(s, _) => {
|
|
734
|
-
const w = s[_.sku._id] ?? [];
|
|
735
|
-
return s[_.sku._id] = [...w, _], s;
|
|
736
|
-
},
|
|
737
|
-
{}
|
|
738
|
-
), b = Object.entries(R).reduce(
|
|
739
|
-
(s, [_, w]) => {
|
|
740
|
-
const A = w.reduce((C, q) => {
|
|
741
|
-
const j = Ke(
|
|
742
|
-
C,
|
|
743
|
-
Math.max(C.precision, q.amount.precision)
|
|
744
|
-
);
|
|
745
|
-
return Ee(j, q.amount);
|
|
746
|
-
}, pe(0));
|
|
747
|
-
return s[_] = A, s;
|
|
748
|
-
},
|
|
749
|
-
{}
|
|
750
|
-
), W = ((V = d.purchaseOrder) == null ? void 0 : V.items) ?? [];
|
|
751
|
-
for (const s of W)
|
|
752
|
-
b[n = s.sku._id] ?? (b[n] = pe(0));
|
|
753
|
-
return b;
|
|
754
|
-
});
|
|
755
|
-
return (t, c) => {
|
|
756
|
-
var _, w;
|
|
757
|
-
const R = H("FmButtonGroup"), b = H("FmChip"), W = H("FmMenuDivider"), K = H("FmCard"), V = H("FmSpacer"), n = H("FmButton"), s = H("FmSideSheet");
|
|
758
|
-
return f(), I(s, {
|
|
759
|
-
header: `Transfer details ${(_ = t.purchaseOrder) != null && _.seqNumber ? `#${(w = t.purchaseOrder) == null ? void 0 : w.seqNumber}` : ""}`,
|
|
760
|
-
modelValue: y($),
|
|
761
|
-
"onUpdate:modelValue": c[9] || (c[9] = (A) => Me($) ? $.value = A : null),
|
|
762
|
-
"dismiss-away": h.value,
|
|
763
|
-
"close-button": "",
|
|
764
|
-
"max-width": 500
|
|
765
|
-
}, {
|
|
766
|
-
default: se(() => {
|
|
767
|
-
var A, C, q, j, z, J, Z, X;
|
|
768
|
-
return [
|
|
769
|
-
e("div", Je, [
|
|
770
|
-
e("div", null, [
|
|
771
|
-
G(R, {
|
|
772
|
-
items: L,
|
|
773
|
-
modelValue: u.value,
|
|
774
|
-
"onUpdate:modelValue": c[0] || (c[0] = (p) => u.value = p)
|
|
775
|
-
}, null, 8, ["modelValue"])
|
|
776
|
-
]),
|
|
777
|
-
((A = u.value) == null ? void 0 : A.label) === "Overview" ? (f(), x(ee, { key: 0 }, [
|
|
778
|
-
e("div", Ze, [
|
|
779
|
-
G(K, {
|
|
780
|
-
variant: "outlined",
|
|
781
|
-
class: "flex flex-col gap-8 px-12 py-16"
|
|
782
|
-
}, {
|
|
783
|
-
default: se(() => {
|
|
784
|
-
var p, U, P, ve, ye, he, ge, be, _e, we, Oe, De;
|
|
785
|
-
return [
|
|
786
|
-
e("div", Xe, [
|
|
787
|
-
et,
|
|
788
|
-
e("div", null, [
|
|
789
|
-
G(b, {
|
|
790
|
-
label: ((p = t.purchaseOrder) == null ? void 0 : p.status) === "CANCEL" ? "Cancelled" : y(Y)(((U = t.purchaseOrder) == null ? void 0 : U.status) ?? ""),
|
|
791
|
-
class: ae(`fm-status-badge fm-status-badge-${(P = t.purchaseOrder) == null ? void 0 : P.status.toLocaleLowerCase("en-us")}`),
|
|
792
|
-
compact: ""
|
|
793
|
-
}, null, 8, ["label", "class"])
|
|
794
|
-
])
|
|
795
|
-
]),
|
|
796
|
-
G(W),
|
|
797
|
-
e("div", tt, [
|
|
798
|
-
e("div", rt, [
|
|
799
|
-
st,
|
|
800
|
-
e("div", at, O(y(le)(((ve = t.purchaseOrder) == null ? void 0 : ve._id) ?? "")), 1)
|
|
801
|
-
]),
|
|
802
|
-
(ye = t.purchaseOrder) != null && ye.effectiveAt ? (f(), x("div", ot, [
|
|
803
|
-
nt,
|
|
804
|
-
e("div", ct, O(y(ne)(new Date((he = t.purchaseOrder) == null ? void 0 : he.effectiveAt))), 1)
|
|
805
|
-
])) : S("", !0),
|
|
806
|
-
e("div", lt, [
|
|
807
|
-
it,
|
|
808
|
-
e("div", ut, O(y(Y)(T.value)), 1)
|
|
809
|
-
]),
|
|
810
|
-
(be = (ge = t.purchaseOrder) == null ? void 0 : ge.supplier) != null && be.name ? (f(), x("div", dt, [
|
|
811
|
-
mt,
|
|
812
|
-
e("div", pt, O((we = (_e = t.purchaseOrder) == null ? void 0 : _e.supplier) == null ? void 0 : we.name), 1)
|
|
813
|
-
])) : S("", !0),
|
|
814
|
-
t.transferTo ? (f(), x("div", ft, [
|
|
815
|
-
vt,
|
|
816
|
-
e("div", yt, O(t.transferTo), 1)
|
|
817
|
-
])) : S("", !0),
|
|
818
|
-
(Oe = t.purchaseOrder) != null && Oe.ref ? (f(), x("div", ht, [
|
|
819
|
-
gt,
|
|
820
|
-
e("div", bt, O(t.purchaseOrder.ref), 1)
|
|
821
|
-
])) : S("", !0),
|
|
822
|
-
(De = t.purchaseOrder) != null && De.remark ? (f(), x("div", _t, [
|
|
823
|
-
wt,
|
|
824
|
-
e("div", Ot, O(t.purchaseOrder.remark), 1)
|
|
825
|
-
])) : S("", !0)
|
|
826
|
-
])
|
|
827
|
-
];
|
|
828
|
-
}),
|
|
829
|
-
_: 1
|
|
830
|
-
})
|
|
831
|
-
]),
|
|
832
|
-
e("div", Dt, [
|
|
833
|
-
e("div", St, [
|
|
834
|
-
e("div", kt, O(ue.value ? "Received items" : "Requested items"), 1),
|
|
835
|
-
(f(!0), x(ee, null, me(((C = t.purchaseOrder) == null ? void 0 : C.items) ?? [], (p) => (f(), x("div", {
|
|
836
|
-
key: p.code,
|
|
837
|
-
class: "flex flex-col"
|
|
838
|
-
}, [
|
|
839
|
-
e("div", At, [
|
|
840
|
-
e("div", Rt, O(p.name), 1),
|
|
841
|
-
Ct,
|
|
842
|
-
e("div", xt, O(y(ce)(de.value[p.sku._id], !1)) + "/" + O(y(fe)(p.quantity, p.sku.unit, p.measurement)), 1)
|
|
843
|
-
]),
|
|
844
|
-
e("div", Pt, [
|
|
845
|
-
e("div", Nt, O(p.code), 1),
|
|
846
|
-
p.totalCost && y(D).enableTotalCost ? (f(), x("div", Et, " (" + O(y(ze)(p.totalCost)) + ") ", 1)) : S("", !0)
|
|
847
|
-
])
|
|
848
|
-
]))), 128))
|
|
849
|
-
])
|
|
850
|
-
])
|
|
851
|
-
], 64)) : S("", !0),
|
|
852
|
-
((q = u.value) == null ? void 0 : q.label) === "Delivery history" ? (f(), x("div", Tt, [
|
|
853
|
-
((z = (j = t.purchaseOrder) == null ? void 0 : j.deliveryOrder) == null ? void 0 : z.length) === 0 ? (f(), x("div", $t, [
|
|
854
|
-
G(V),
|
|
855
|
-
e("div", null, [
|
|
856
|
-
e("img", {
|
|
857
|
-
src: y(Qe),
|
|
858
|
-
alt: "List is empty"
|
|
859
|
-
}, null, 8, qt)
|
|
860
|
-
]),
|
|
861
|
-
Ut,
|
|
862
|
-
Mt,
|
|
863
|
-
G(V),
|
|
864
|
-
G(V)
|
|
865
|
-
])) : S("", !0),
|
|
866
|
-
(J = t.purchaseOrder) != null && J.deliveryOrder && ((Z = t.purchaseOrder) == null ? void 0 : Z.deliveryOrder.length) > 0 ? (f(), x("div", Ft, [
|
|
867
|
-
(f(!0), x(ee, null, me((X = t.purchaseOrder) == null ? void 0 : X.deliveryOrder, (p, U) => (f(), x(ee, { key: U }, [
|
|
868
|
-
e("div", Lt, [
|
|
869
|
-
e("div", jt, [
|
|
870
|
-
e("div", Bt, [
|
|
871
|
-
e("div", {
|
|
872
|
-
class: ae([
|
|
873
|
-
{
|
|
874
|
-
"bg-fm-color-primary": U !== 0,
|
|
875
|
-
"bg-white": U === 0
|
|
876
|
-
},
|
|
877
|
-
"w-[2px] h-full"
|
|
878
|
-
])
|
|
879
|
-
}, null, 2)
|
|
880
|
-
]),
|
|
881
|
-
It,
|
|
882
|
-
e("div", Vt, [
|
|
883
|
-
e("div", {
|
|
884
|
-
class: ae([
|
|
885
|
-
{
|
|
886
|
-
"bg-fm-color-primary": U < t.purchaseOrder.deliveryOrder.length - 1,
|
|
887
|
-
"bg-white": U >= t.purchaseOrder.deliveryOrder.length - 1
|
|
888
|
-
},
|
|
889
|
-
"w-[2px] h-full"
|
|
890
|
-
])
|
|
891
|
-
}, null, 2)
|
|
892
|
-
])
|
|
893
|
-
]),
|
|
894
|
-
e("div", Gt, [
|
|
895
|
-
Kt,
|
|
896
|
-
e("div", zt, O(y(ne)(new Date(p.createdAt))) + ", " + O(y(Ve)(new Date(p.createdAt))), 1)
|
|
897
|
-
])
|
|
898
|
-
]),
|
|
899
|
-
e("div", Ht, [
|
|
900
|
-
e("div", Qt, [
|
|
901
|
-
e("div", Yt, [
|
|
902
|
-
e("div", {
|
|
903
|
-
class: ae([
|
|
904
|
-
{
|
|
905
|
-
"bg-fm-color-primary": U < t.purchaseOrder.deliveryOrder.length - 1,
|
|
906
|
-
"bg-white": U >= t.purchaseOrder.deliveryOrder.length - 1
|
|
907
|
-
},
|
|
908
|
-
"w-[2px] h-full"
|
|
909
|
-
])
|
|
910
|
-
}, null, 2)
|
|
911
|
-
])
|
|
912
|
-
]),
|
|
913
|
-
e("div", Wt, [
|
|
914
|
-
G(K, {
|
|
915
|
-
variant: "outlined",
|
|
916
|
-
class: "py-12 px-16"
|
|
917
|
-
}, {
|
|
918
|
-
default: se(() => [
|
|
919
|
-
e("div", Jt, [
|
|
920
|
-
e("div", Zt, [
|
|
921
|
-
Xt,
|
|
922
|
-
e("div", er, O(p.createdBy.name), 1)
|
|
923
|
-
]),
|
|
924
|
-
e("div", tr, [
|
|
925
|
-
rr,
|
|
926
|
-
(f(!0), x(ee, null, me(p.received, (P) => (f(), x("div", {
|
|
927
|
-
class: "fm-typo-en-body-lg-600",
|
|
928
|
-
key: P.sku._id
|
|
929
|
-
}, O(P.sku.name) + " " + O(y(fe)(P.amount, P.sku.unit, P.measurement)), 1))), 128))
|
|
930
|
-
]),
|
|
931
|
-
e("div", sr, [
|
|
932
|
-
ar,
|
|
933
|
-
e("div", or, O(p.deliveryOrderNumber.trim().length ? p.deliveryOrderNumber : "-"), 1)
|
|
934
|
-
]),
|
|
935
|
-
e("div", nr, [
|
|
936
|
-
p.remark ? (f(), x("div", cr, " Delivery remark ")) : S("", !0),
|
|
937
|
-
e("div", lr, O(p.remark), 1)
|
|
938
|
-
])
|
|
939
|
-
])
|
|
940
|
-
]),
|
|
941
|
-
_: 2
|
|
942
|
-
}, 1024)
|
|
943
|
-
])
|
|
944
|
-
])
|
|
945
|
-
], 64))), 128))
|
|
946
|
-
])) : S("", !0)
|
|
947
|
-
])) : S("", !0)
|
|
948
|
-
])
|
|
949
|
-
];
|
|
950
|
-
}),
|
|
951
|
-
"side-sheet-footer": se(() => {
|
|
952
|
-
var A, C, q, j, z, J, Z, X, p, U;
|
|
953
|
-
return [
|
|
954
|
-
e("div", ir, [
|
|
955
|
-
((A = t.purchaseOrder) == null ? void 0 : A.status) === y(M).enum.DRAFT && T.value === y(te).PURCHASE ? (f(), I(n, {
|
|
956
|
-
key: 0,
|
|
957
|
-
label: "Confirm draft",
|
|
958
|
-
onClick: c[1] || (c[1] = (P) => B("confirmDraft")),
|
|
959
|
-
loading: o.value === "confirmDraft",
|
|
960
|
-
disabled: o.value !== "confirmDraft" && l.value
|
|
961
|
-
}, null, 8, ["loading", "disabled"])) : S("", !0),
|
|
962
|
-
((C = t.purchaseOrder) == null ? void 0 : C.status) === y(M).enum.DRAFT && T.value === y(te).TRANSFER ? (f(), I(n, {
|
|
963
|
-
key: 1,
|
|
964
|
-
label: "Submit request",
|
|
965
|
-
onClick: c[2] || (c[2] = (P) => B("submitRequest")),
|
|
966
|
-
loading: o.value === "submitRequest",
|
|
967
|
-
disabled: o.value !== "submitRequest" && l.value
|
|
968
|
-
}, null, 8, ["loading", "disabled"])) : S("", !0),
|
|
969
|
-
((q = t.purchaseOrder) == null ? void 0 : q.status) === y(M).enum.DRAFT ? (f(), I(n, {
|
|
970
|
-
key: 2,
|
|
971
|
-
label: "Cancel draft",
|
|
972
|
-
onClick: c[3] || (c[3] = (P) => B("cancelDraft")),
|
|
973
|
-
loading: o.value === "cancelDraft",
|
|
974
|
-
disabled: o.value !== "cancelDraft" && l.value,
|
|
975
|
-
variant: "destructive"
|
|
976
|
-
}, null, 8, ["loading", "disabled"])) : S("", !0),
|
|
977
|
-
((j = t.purchaseOrder) == null ? void 0 : j.status) === y(M).enum.RECEIVING ? (f(), I(n, {
|
|
978
|
-
key: 3,
|
|
979
|
-
label: "Mark completed",
|
|
980
|
-
onClick: c[4] || (c[4] = (P) => B("completeReceive")),
|
|
981
|
-
loading: o.value === "completeReceive",
|
|
982
|
-
disabled: o.value !== "completeReceive" && l.value
|
|
983
|
-
}, null, 8, ["loading", "disabled"])) : S("", !0),
|
|
984
|
-
t.canResubmit ? (f(), I(n, {
|
|
985
|
-
key: 4,
|
|
986
|
-
label: "Resubmit request",
|
|
987
|
-
onClick: c[5] || (c[5] = (P) => B("submitRequest")),
|
|
988
|
-
loading: o.value === "submitRequest",
|
|
989
|
-
disabled: o.value !== "submitRequest" && l.value
|
|
990
|
-
}, null, 8, ["loading", "disabled"])) : S("", !0),
|
|
991
|
-
(((z = t.purchaseOrder) == null ? void 0 : z.status) === y(M).enum.REQUESTING || ((J = t.purchaseOrder) == null ? void 0 : J.status) === y(M).enum.PROCESSING) && t.canApprove ? (f(), I(n, {
|
|
992
|
-
key: 5,
|
|
993
|
-
label: "Approve",
|
|
994
|
-
onClick: c[6] || (c[6] = (P) => B("approveRequest")),
|
|
995
|
-
loading: o.value === "approveRequest",
|
|
996
|
-
disabled: o.value !== "approveRequest" && l.value
|
|
997
|
-
}, null, 8, ["loading", "disabled"])) : S("", !0),
|
|
998
|
-
((Z = t.purchaseOrder) == null ? void 0 : Z.status) === y(M).enum.REQUESTING && t.canApprove ? (f(), I(n, {
|
|
999
|
-
key: 6,
|
|
1000
|
-
label: "Reject",
|
|
1001
|
-
onClick: c[7] || (c[7] = (P) => B("rejectRequest")),
|
|
1002
|
-
loading: o.value === "rejectRequest",
|
|
1003
|
-
disabled: o.value !== "rejectRequest" && l.value,
|
|
1004
|
-
variant: "destructive"
|
|
1005
|
-
}, null, 8, ["loading", "disabled"])) : S("", !0),
|
|
1006
|
-
((X = t.purchaseOrder) == null ? void 0 : X.status) !== y(M).enum.COMPLETE && ((p = t.purchaseOrder) == null ? void 0 : p.status) !== y(M).enum.CANCEL && (((U = t.purchaseOrder) == null ? void 0 : U.status) !== y(M).enum.REQUESTING || t.canApprove) ? (f(), I(n, {
|
|
1007
|
-
key: 7,
|
|
1008
|
-
label: "Close",
|
|
1009
|
-
variant: "tertiary",
|
|
1010
|
-
onClick: c[8] || (c[8] = (P) => r("update:show", !1))
|
|
1011
|
-
})) : S("", !0)
|
|
1012
|
-
])
|
|
1013
|
-
];
|
|
1014
|
-
}),
|
|
1015
|
-
_: 1
|
|
1016
|
-
}, 8, ["header", "modelValue", "dismiss-away"]);
|
|
1017
|
-
};
|
|
1018
|
-
}
|
|
1019
|
-
});
|
|
1020
|
-
export {
|
|
1021
|
-
te as P,
|
|
1022
|
-
Or as _,
|
|
1023
|
-
_r as a,
|
|
1024
|
-
wr as b,
|
|
1025
|
-
Ye as g,
|
|
1026
|
-
qe as p,
|
|
1027
|
-
Te as u
|
|
1028
|
-
};
|