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