@feedmepos/mf-inventory-portal 1.1.9 → 1.2.0-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-D1UJ8NY1.js → App-CvnYXQ_H.js} +1 -1
- package/dist/{ApprovalView-Cf6tfPo1.js → ApprovalView-Brt_cfLI.js} +22 -22
- package/dist/{BindingsDialog-C4XnyllW.js → BindingsDialog-BBCRbm60.js} +2 -2
- package/dist/{BindingsPicker-BW4-JT2R.js → BindingsPicker-D3cfis0-.js} +1 -1
- package/dist/{BindingsTable-DtDFatll.js → BindingsTable-BuHEtiqI.js} +1 -1
- package/dist/{ClosingDraftView-TtsNry0r.js → ClosingDraftView-fLxuV9T9.js} +2 -2
- package/dist/{ClosingTemplateView-NbwT6bOk.js → ClosingTemplateView-BJRZQ_9d.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-ujSpOCKj.js → DeliveryOrderPrintPreview-CKLGVFoJ.js} +8 -8
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-AGOtUG41.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-6h2ZF1IM.js} +12 -12
- package/dist/{FmMultiselectDialog-c2e1Pisp.js → FmMultiselectDialog-uEoXq-hv.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BNxA-pQp.js → FmUnitInput.vue_vue_type_script_setup_true_lang-CSNDv3kk.js} +25 -25
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-HkmovqY5.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CeZBz1eT.js} +1 -1
- package/dist/{IngredientGroupView-CnSZ_jFk.js → IngredientGroupView-BhsEp63p.js} +2 -2
- package/dist/{IngredientsView-DjWSaEi8.js → IngredientsView-D3aehOrb.js} +4 -4
- package/dist/{IntegrationView-CJJKfJDQ.js → IntegrationView-Ds4_pk0y.js} +83 -83
- package/dist/{InventoryBindingForm-DhnOLZJo.js → InventoryBindingForm-CVaSaP-L.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CgLA6KH7.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DsJObBbP.js} +3 -3
- package/dist/{InventoryBindingSummary-_DhLtjfm.js → InventoryBindingSummary-4dCMV0Je.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BzlWBYz0.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BWTfN1Nc.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DRlFOUlD.js → PremiumBadge.vue_vue_type_script_setup_true_lang-lKPfAldc.js} +7 -7
- package/dist/{PublishView-DjA8RTiy.js → PublishView-BW1IjgqP.js} +4 -4
- package/dist/{PurchaseOrderPrintPreview-Bzdm9Vd-.js → PurchaseOrderPrintPreview-DupzzHHn.js} +7 -7
- package/dist/{ReceiveRequestView-CJ7oiJBQ.js → ReceiveRequestView-CZMDH6oI.js} +60 -60
- package/dist/{RecipeView--lcBWmZ3.js → RecipeView-BJ1JyMWl.js} +3 -3
- package/dist/StockView-C0h2udKi.js +2080 -0
- package/dist/{SupplierView-BN1P0pgR.js → SupplierView-nRrJO3aS.js} +3 -3
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CWXS6_zv.js +2310 -0
- package/dist/{TransferTemplateView-P25c3cZ-.js → TransferTemplateView-BmGAvcDy.js} +64 -64
- package/dist/{UnitView-Umy1Vy0Y.js → UnitView-CFayjoeC.js} +3 -3
- package/dist/{WarehouseView-DNDIdR4i.js → WarehouseView-Dw74JEJ4.js} +1 -1
- package/dist/api/stock.d.ts +2 -0
- package/dist/{app-CgzMLhAo.js → app-Cjc33Hak.js} +18639 -17803
- package/dist/app.d.ts +726 -6
- package/dist/app.js +1 -1
- package/dist/{decimal-D_3mwNtr.js → decimal-DkctM_2I.js} +1 -1
- package/dist/{format-unit-display-Bu29MSxm.js → format-unit-display-BWs5lTJP.js} +17 -17
- package/dist/{index-D-fVJxc8.js → index-C64jubVC.js} +1 -1
- package/dist/{index-BE8jrI3O.js → index-IbY1gBGq.js} +1 -1
- package/dist/{stock-JVbFNtIv.js → stock-BhsZeZQ6.js} +35 -27
- package/dist/style.css +1 -1
- package/dist/{supplier-nx8WElIW.js → supplier-D-CggzHd.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-CX9_4vk_.js → use-ingredient-select-dialog-C03zsmuo.js} +1 -1
- package/dist/{use-inventory-binding-dialog-BfVLQDzr.js → use-inventory-binding-dialog-D3Chc97P.js} +1 -1
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +18 -0
- package/dist/views/stock/components/StockRecordCard.vue.d.ts +6 -2
- package/dist/views/stock/components/dialog/AmendAdjustmentForm.vue.d.ts +94 -0
- package/dist/views/stock/components/dialog/AmendAdjustmentFormProps.d.ts +3 -0
- package/package.json +4 -4
- package/dist/StockView-BGNukBaV.js +0 -1856
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CiK1nGyN.js +0 -2272
|
@@ -0,0 +1,2310 @@
|
|
|
1
|
+
import { a3 as pt, u as me, aS as x, aT as qe, aA as M, c as Te, b as Pe, ab as vt, ad as yt, ae as ht, aU as bt, e as et, f as nt, a0 as He, aV as gt, a8 as at, T as ot, j as fe, a6 as _t, aW as it, ai as $e, h as tt, i as te, D as ae, aX as lt, aY as ct, aZ as Le, ay as rt, aa as ke, a4 as Be, a5 as St, a_ as Ae, Q as wt } from "./app-Cjc33Hak.js";
|
|
2
|
+
import { ref as G, computed as ee, h as $, defineComponent as he, reactive as Rt, onMounted as ut, resolveComponent as W, openBlock as g, createBlock as ie, withCtx as oe, createElementVNode as o, createVNode as F, unref as R, createElementBlock as N, toDisplayString as k, createCommentVNode as U, Fragment as ne, renderList as ve, watch as Ot, isRef as Nt, normalizeClass as Ce, createTextVNode as Ve, resolveDynamicComponent as xt } from "vue";
|
|
3
|
+
import { F as kt } from "./decimal-DkctM_2I.js";
|
|
4
|
+
import { useCoreStore as Ie, useI18n as dt } from "@feedmepos/mf-common";
|
|
5
|
+
import { useDialog as We, useSnackbar as Fe, components as Ke, FmButtonVariant as se, useProxiedModel as At } from "@feedmepos/ui-library";
|
|
6
|
+
import { b as Ct, u as $t, P as ye, f as Dt } from "./format-unit-display-BWs5lTJP.js";
|
|
7
|
+
import { E as qt } from "./empty-placeholder-wf6-BWE8.js";
|
|
8
|
+
import { _ as Tt, F as Pt, a as It } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-CSNDv3kk.js";
|
|
9
|
+
import { u as Ft, R as st } from "./usePromise-CbVUCxhj.js";
|
|
10
|
+
import { u as Et } from "./index-C64jubVC.js";
|
|
11
|
+
const Ee = pt((p, t) => {
|
|
12
|
+
const a = me(), _ = Ie();
|
|
13
|
+
return {
|
|
14
|
+
async readRequests(c, e, u) {
|
|
15
|
+
const i = c ?? a.currentLocationDBName, n = `${p.inventoryBackendUrl}/${i}/purchase-request`;
|
|
16
|
+
return e && u ? await t.get(`${n}?startDate=${e}&endDate=${u}`) : await t.get(n);
|
|
17
|
+
},
|
|
18
|
+
async readRequestById(c, e) {
|
|
19
|
+
const u = e ?? a.currentLocationDBName, i = `${p.inventoryBackendUrl}/${u}/purchase-request/${c}`;
|
|
20
|
+
return await t.get(i);
|
|
21
|
+
},
|
|
22
|
+
async readRequestByIds(c, e) {
|
|
23
|
+
const u = e ?? a.currentLocationDBName, i = `${p.inventoryBackendUrl}/${u}/purchase-request/find`;
|
|
24
|
+
return await t.post(i, { requestIds: c });
|
|
25
|
+
},
|
|
26
|
+
async getPurchaseOrders({
|
|
27
|
+
start: c,
|
|
28
|
+
end: e
|
|
29
|
+
}) {
|
|
30
|
+
const u = a.currentLocationDBName, i = `${p.inventoryBackendUrl}/${u}/purchase-order`;
|
|
31
|
+
return await t.get(`${i}?start=${c}&end=${e}`);
|
|
32
|
+
},
|
|
33
|
+
async getLatestPurchaseOrderRequest(c) {
|
|
34
|
+
const e = a.currentLocationDBName, u = `${p.inventoryBackendUrl}/${e}/purchase-request/find-by-purchase-order-id`;
|
|
35
|
+
return await t.get(`${u}/${c}`);
|
|
36
|
+
},
|
|
37
|
+
async getPurchaseOrderById(c) {
|
|
38
|
+
const e = a.currentLocationDBName, u = `${p.inventoryBackendUrl}/${e}/purchase-order`;
|
|
39
|
+
return await t.get(`${u}/${c}`);
|
|
40
|
+
},
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Use `processPurchaseOrderV2` instead.
|
|
43
|
+
*/
|
|
44
|
+
async processPurchaseOrder(c, e) {
|
|
45
|
+
const u = a.currentLocationDBName, i = e || u, n = `${p.inventoryBackendUrl}/${i}/purchase-order/run-operation`;
|
|
46
|
+
return await t.put(n, c);
|
|
47
|
+
},
|
|
48
|
+
async createPurchaseOrder(c) {
|
|
49
|
+
const e = a.currentLocationDBName, u = `${p.inventoryBackendUrl}/${e}/purchase-order`;
|
|
50
|
+
return await t.post(u, c);
|
|
51
|
+
},
|
|
52
|
+
async updatePurchaseOrder(c) {
|
|
53
|
+
const e = a.currentLocationDBName, u = `${p.inventoryBackendUrl}/${e}/purchase-order`;
|
|
54
|
+
return await t.put(u, c);
|
|
55
|
+
},
|
|
56
|
+
async importFromXilnex(c) {
|
|
57
|
+
const e = a.currentLocationDBName, u = `${p.inventoryBackendUrl}/${e}/purchase-order/import-from-xilnex`;
|
|
58
|
+
return await t.post(u, c);
|
|
59
|
+
},
|
|
60
|
+
async processPurchaseOrderV2(c, e) {
|
|
61
|
+
const u = a.currentLocationDBName, i = e || u, n = `${p.inventoryBackendUrl}/${i}/v2/purchase-order/run-operation`;
|
|
62
|
+
return await t.put(n, c);
|
|
63
|
+
},
|
|
64
|
+
async getWorkflowConfig() {
|
|
65
|
+
var i;
|
|
66
|
+
const e = `business_${(i = _.currentBusiness.value) == null ? void 0 : i._id}`, u = `${p.inventoryBackendUrl}/${e}/v2/purchase-order/workflow-config`;
|
|
67
|
+
return await t.get(u);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}), ft = {
|
|
71
|
+
[x.enum.confirmDraft]: {
|
|
72
|
+
primaryActions: {
|
|
73
|
+
text: "Confirm draft",
|
|
74
|
+
close: !0
|
|
75
|
+
},
|
|
76
|
+
title: "Confirm draft?",
|
|
77
|
+
message: "Purchase order cannot be changed after confirm draft.",
|
|
78
|
+
successMessage: "Purchase order draft has been confirmed"
|
|
79
|
+
},
|
|
80
|
+
[x.enum.cancelDraft]: {
|
|
81
|
+
primaryActions: {
|
|
82
|
+
text: "Cancel draft",
|
|
83
|
+
close: !0,
|
|
84
|
+
variant: "destructive"
|
|
85
|
+
},
|
|
86
|
+
title: "Cancel draft?",
|
|
87
|
+
message: "Purchase order cannot be changed after cancelled draft.",
|
|
88
|
+
successMessage: "Purchase order draft has been cancelled"
|
|
89
|
+
},
|
|
90
|
+
[x.enum.submitRequest]: {
|
|
91
|
+
primaryActions: {
|
|
92
|
+
text: "Submit request",
|
|
93
|
+
close: !0
|
|
94
|
+
},
|
|
95
|
+
title: "Confirm draft?",
|
|
96
|
+
message: "Purchase order cannot be changed after confirm draft.",
|
|
97
|
+
successMessage: "Purchase order draft has been submitted"
|
|
98
|
+
},
|
|
99
|
+
[x.enum.completeReceive]: {
|
|
100
|
+
primaryActions: {
|
|
101
|
+
text: "Mark received",
|
|
102
|
+
close: !0
|
|
103
|
+
},
|
|
104
|
+
title: "Mark as received",
|
|
105
|
+
message: "Purchase order cannot be changed after it has complete receiving.",
|
|
106
|
+
successMessage: "Purchase order has been marked as received"
|
|
107
|
+
},
|
|
108
|
+
[x.enum.approveRequest]: {
|
|
109
|
+
primaryActions: {
|
|
110
|
+
text: "Accept request",
|
|
111
|
+
close: !0
|
|
112
|
+
},
|
|
113
|
+
title: "Accept request?",
|
|
114
|
+
message: "Transfer out request will be accepted.",
|
|
115
|
+
successMessage: "Transfer out request has been approved"
|
|
116
|
+
},
|
|
117
|
+
[x.enum.rejectRequest]: {
|
|
118
|
+
primaryActions: {
|
|
119
|
+
text: "Reject request",
|
|
120
|
+
close: !0,
|
|
121
|
+
variant: "destructive"
|
|
122
|
+
},
|
|
123
|
+
title: "Reject request?",
|
|
124
|
+
message: "Purchase order will be rejected.",
|
|
125
|
+
successMessage: "Purchase order has been rejected"
|
|
126
|
+
},
|
|
127
|
+
[x.enum.processRequest]: {
|
|
128
|
+
primaryActions: {
|
|
129
|
+
text: "Process request",
|
|
130
|
+
close: !0,
|
|
131
|
+
variant: "destructive"
|
|
132
|
+
},
|
|
133
|
+
title: "Process request?",
|
|
134
|
+
message: "Purchase order will be processed.",
|
|
135
|
+
successMessage: "Purchase order has been processed"
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
function De(p) {
|
|
139
|
+
return qe.generatedPOReceivedMap({
|
|
140
|
+
purchaseOrder: p
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function Lt(p) {
|
|
144
|
+
return qe.validatePOItemReceivedStatus({
|
|
145
|
+
dto: p
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function je(p) {
|
|
149
|
+
return qe.validatePOReceivedStatus({
|
|
150
|
+
receivedMap: p
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function ze(p, t, a) {
|
|
154
|
+
if (!M.safeParse(p).success)
|
|
155
|
+
throw new Error(`Invalid purchase order status: ${p}`);
|
|
156
|
+
const _ = M.parse(p);
|
|
157
|
+
return qe.orderStatusCombination({
|
|
158
|
+
status: _,
|
|
159
|
+
isPOPartialReceive: t,
|
|
160
|
+
isPOOverReceive: a
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
function mt() {
|
|
164
|
+
const p = me(), t = Ee(), a = Te();
|
|
165
|
+
async function _(e, u) {
|
|
166
|
+
const i = p.currentLocationDBName;
|
|
167
|
+
return e.doc.supplier.internal && e.operation === x.enum.confirmDraft && (e.operation = x.enum.submitRequest), await t.processPurchaseOrder(e, u || i);
|
|
168
|
+
}
|
|
169
|
+
async function c(e, u) {
|
|
170
|
+
const i = p.currentLocationDBName;
|
|
171
|
+
return await t.processPurchaseOrderV2(e, u || i);
|
|
172
|
+
}
|
|
173
|
+
return (e) => a.useOperatePurchaseOrderV2 ? c(e.operateV2, e.transferTo) : _(e.operate, e.transferTo);
|
|
174
|
+
}
|
|
175
|
+
var Ge = /* @__PURE__ */ ((p) => (p.RECEIVE_REQUEST = "receive/request", p.APPROVAL = "approval", p))(Ge || {});
|
|
176
|
+
const Oe = G(), Ue = G();
|
|
177
|
+
function Hs(p, t) {
|
|
178
|
+
const a = We(), _ = me(), c = Te();
|
|
179
|
+
Pe();
|
|
180
|
+
const e = Ct(), u = $t(), i = G(!1), n = Fe(), h = Ee(), S = G(new Array()), v = G(
|
|
181
|
+
t != null && t.startDate && (t != null && t.endDate) ? t : vt()
|
|
182
|
+
), m = ee(() => {
|
|
183
|
+
const A = new Date(v.value.startDate), T = new Date(v.value.endDate);
|
|
184
|
+
return {
|
|
185
|
+
start: yt(A).toISOString(),
|
|
186
|
+
end: ht(T).toISOString()
|
|
187
|
+
};
|
|
188
|
+
}), d = G(new Array()), s = bt(), l = G(null);
|
|
189
|
+
async function b(A) {
|
|
190
|
+
function T(r) {
|
|
191
|
+
const f = {
|
|
192
|
+
mode: et.CREATE,
|
|
193
|
+
modelValue: A || void 0,
|
|
194
|
+
show: !0,
|
|
195
|
+
"onUpdate:show"(O) {
|
|
196
|
+
Oe.value.show = O;
|
|
197
|
+
},
|
|
198
|
+
templateId: r,
|
|
199
|
+
lastClosingDate: l.value
|
|
200
|
+
};
|
|
201
|
+
Oe.value = f;
|
|
202
|
+
}
|
|
203
|
+
let Y;
|
|
204
|
+
c.mustUsePoTemplate && !(A != null && A.template) ? a.open({
|
|
205
|
+
title: "Create transfer",
|
|
206
|
+
message: "",
|
|
207
|
+
primaryActions: {
|
|
208
|
+
text: "Select a template",
|
|
209
|
+
close: !0
|
|
210
|
+
},
|
|
211
|
+
secondaryActions: {
|
|
212
|
+
text: "Outlet to Outlet",
|
|
213
|
+
variant: "secondary",
|
|
214
|
+
close: !0
|
|
215
|
+
}
|
|
216
|
+
}).onPrimary(async () => {
|
|
217
|
+
Y = await e.getTemplateId(), Y && T(Y);
|
|
218
|
+
}).onSecondary(() => {
|
|
219
|
+
T(void 0);
|
|
220
|
+
}) : T(Y);
|
|
221
|
+
}
|
|
222
|
+
function w(A) {
|
|
223
|
+
const T = {
|
|
224
|
+
mode: et.UPDATE,
|
|
225
|
+
modelValue: nt(A),
|
|
226
|
+
show: !0,
|
|
227
|
+
"onUpdate:show"(Y) {
|
|
228
|
+
Oe.value.show = Y;
|
|
229
|
+
},
|
|
230
|
+
lastClosingDate: l.value
|
|
231
|
+
};
|
|
232
|
+
Oe.value = T;
|
|
233
|
+
}
|
|
234
|
+
async function D() {
|
|
235
|
+
S.value = [], i.value = !0;
|
|
236
|
+
try {
|
|
237
|
+
S.value = await h.getPurchaseOrders(m.value).then((r) => r.sort((f, O) => O._id.localeCompare(f._id)));
|
|
238
|
+
const A = await s.readCurrentLocationLastClosing(!0), T = A == null ? void 0 : A._id;
|
|
239
|
+
T && (l.value = gt(T)), await c.awaitFeatureLoaded(() => c.mustUsePoTemplate) && await u.fetchTemplates();
|
|
240
|
+
const Y = S.value.map((r) => {
|
|
241
|
+
var f;
|
|
242
|
+
return ((f = r.request) == null ? void 0 : f.id) ?? "";
|
|
243
|
+
}).filter((r) => r);
|
|
244
|
+
d.value = await h.readRequestByIds(Y);
|
|
245
|
+
} catch {
|
|
246
|
+
n.open({
|
|
247
|
+
title: "Something went wrong",
|
|
248
|
+
message: "Error at fetching purchase orders",
|
|
249
|
+
type: "error"
|
|
250
|
+
});
|
|
251
|
+
} finally {
|
|
252
|
+
i.value = !1;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
async function q() {
|
|
256
|
+
d.value = [], i.value = !0;
|
|
257
|
+
try {
|
|
258
|
+
d.value = await h.readRequests(
|
|
259
|
+
void 0,
|
|
260
|
+
m.value.start,
|
|
261
|
+
m.value.end
|
|
262
|
+
).then((A) => A.reverse());
|
|
263
|
+
} catch {
|
|
264
|
+
n.open({
|
|
265
|
+
title: "Something went wrong",
|
|
266
|
+
message: "Error at fetching purchase requests",
|
|
267
|
+
type: "error"
|
|
268
|
+
});
|
|
269
|
+
} finally {
|
|
270
|
+
i.value = !1;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
function P() {
|
|
274
|
+
switch (p) {
|
|
275
|
+
case "receive/request":
|
|
276
|
+
return D();
|
|
277
|
+
case "approval":
|
|
278
|
+
return q();
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
function E(A, T) {
|
|
282
|
+
v.value = {
|
|
283
|
+
startDate: A,
|
|
284
|
+
endDate: T
|
|
285
|
+
}, P();
|
|
286
|
+
}
|
|
287
|
+
_.watchLocation(async (A) => {
|
|
288
|
+
if (!A) {
|
|
289
|
+
S.value = [];
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
await P();
|
|
293
|
+
});
|
|
294
|
+
const z = G(), ce = G(Math.random().toString());
|
|
295
|
+
async function le(A, T) {
|
|
296
|
+
const Y = Math.random().toString();
|
|
297
|
+
ce.value = Y, T ?? (T = d.value.computeFirst(
|
|
298
|
+
(O) => O.purchaseOrderId === A._id ? O : null
|
|
299
|
+
) ?? void 0);
|
|
300
|
+
const r = p === "receive/request" ? _.currentLocation : T == null ? void 0 : T.to, f = {
|
|
301
|
+
poRequest: T,
|
|
302
|
+
purchaseOrder: A,
|
|
303
|
+
transferTo: r == null ? void 0 : r.name,
|
|
304
|
+
transferToDbName: r == null ? void 0 : r.dbName,
|
|
305
|
+
show: !0,
|
|
306
|
+
canResubmit: !1,
|
|
307
|
+
canApprove: p === "approval",
|
|
308
|
+
"onUpdate:show"(O) {
|
|
309
|
+
z.value.show = O;
|
|
310
|
+
},
|
|
311
|
+
scope: p,
|
|
312
|
+
receivedMap: De(A) ?? {}
|
|
313
|
+
};
|
|
314
|
+
z.value = f;
|
|
315
|
+
}
|
|
316
|
+
async function be(A, T, Y, r) {
|
|
317
|
+
const f = mt();
|
|
318
|
+
i.value = !0;
|
|
319
|
+
try {
|
|
320
|
+
await f({
|
|
321
|
+
operate: {
|
|
322
|
+
operation: T,
|
|
323
|
+
doc: A,
|
|
324
|
+
options: (
|
|
325
|
+
// auto receive for supplier to warehouse
|
|
326
|
+
(T === x.enum.confirmDraft || // auto receive for warehouse to warehouse
|
|
327
|
+
T === x.enum.completeReceive) && c.autoReceiveWarehouse ? {
|
|
328
|
+
autoReceive: !0
|
|
329
|
+
} : void 0
|
|
330
|
+
)
|
|
331
|
+
},
|
|
332
|
+
operateV2: {
|
|
333
|
+
_id: A._id,
|
|
334
|
+
_rev: A._rev ?? "",
|
|
335
|
+
action: T,
|
|
336
|
+
payloads: []
|
|
337
|
+
},
|
|
338
|
+
transferTo: r
|
|
339
|
+
}), await new Promise((B) => setTimeout(B, 1e3));
|
|
340
|
+
const C = me().currentLocationDBName.startsWith("restaurant_");
|
|
341
|
+
T === x.enum.confirmDraft && A.effectiveAt && C ? n.open({
|
|
342
|
+
title: "Success",
|
|
343
|
+
message: `${Y}. The backdate will be reflected once your POS has received this change.`,
|
|
344
|
+
type: "success"
|
|
345
|
+
}) : n.open({
|
|
346
|
+
title: "Success",
|
|
347
|
+
message: Y,
|
|
348
|
+
type: "success"
|
|
349
|
+
});
|
|
350
|
+
} catch (O) {
|
|
351
|
+
n.open({
|
|
352
|
+
title: "Something went wrong",
|
|
353
|
+
message: "Please try again.",
|
|
354
|
+
type: "error"
|
|
355
|
+
}), console.error("Error when submitting PO operation", T, A, O);
|
|
356
|
+
} finally {
|
|
357
|
+
i.value = !1, P();
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
async function Ne(A, T, Y) {
|
|
361
|
+
const r = ft[T];
|
|
362
|
+
if (!r) {
|
|
363
|
+
n.open({
|
|
364
|
+
title: "Something went wrong",
|
|
365
|
+
message: `Cannot process order: ${He(T)}`,
|
|
366
|
+
type: "error"
|
|
367
|
+
});
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
const { successMessage: f, ...O } = r;
|
|
371
|
+
a.open({
|
|
372
|
+
title: O.title,
|
|
373
|
+
message: O.message,
|
|
374
|
+
primaryActions: O.primaryActions
|
|
375
|
+
}).onPrimary(() => {
|
|
376
|
+
be(A, T, f, Y);
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
async function ue() {
|
|
380
|
+
a.open({
|
|
381
|
+
title: "Upload Transfer",
|
|
382
|
+
primaryActions: {
|
|
383
|
+
text: "Xilnex transfer note",
|
|
384
|
+
close: !0
|
|
385
|
+
},
|
|
386
|
+
secondaryActions: {
|
|
387
|
+
text: "Cancel",
|
|
388
|
+
close: !0
|
|
389
|
+
}
|
|
390
|
+
}).onPrimary(() => {
|
|
391
|
+
const A = {
|
|
392
|
+
show: !0,
|
|
393
|
+
"onUpdate:show"(T) {
|
|
394
|
+
Ue.value.show = T;
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
Ue.value = A;
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
return {
|
|
401
|
+
purchaseOrders: S,
|
|
402
|
+
purchaseRequests: d,
|
|
403
|
+
updateDateRange: E,
|
|
404
|
+
fetchData: P,
|
|
405
|
+
loading: i,
|
|
406
|
+
transferDialogProps: Oe,
|
|
407
|
+
promptCreateTransferDialog: b,
|
|
408
|
+
promptUpdateTransferDialog: w,
|
|
409
|
+
transferDetailsProps: z,
|
|
410
|
+
promptShowTransferDetails: le,
|
|
411
|
+
submitAction: Ne,
|
|
412
|
+
xilnexImportDialogProps: Ue,
|
|
413
|
+
promptUploadTransferDialog: ue
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
function Bt(p, t) {
|
|
417
|
+
return t.reduce(
|
|
418
|
+
(_, c) => {
|
|
419
|
+
const e = c.received.find((u) => u.sku._id === p._id);
|
|
420
|
+
return e && (_ = at(_, e.amount)), _;
|
|
421
|
+
},
|
|
422
|
+
kt.toPrecision(ot(0), p.unit.precision)
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
function Vt(p) {
|
|
426
|
+
const { po: t, currentLocation: a, business: _, fulfilling: c, por: e } = p, { name: u, address: i, regNo: n } = a.doc.profile, h = {
|
|
427
|
+
name: u,
|
|
428
|
+
registrationNumber: n,
|
|
429
|
+
line1: i == null ? void 0 : i.line1,
|
|
430
|
+
line2: i == null ? void 0 : i.line2,
|
|
431
|
+
postcode: i == null ? void 0 : i.postcode,
|
|
432
|
+
city: i == null ? void 0 : i.city,
|
|
433
|
+
state: i == null ? void 0 : i.state,
|
|
434
|
+
country: i == null ? void 0 : i.country
|
|
435
|
+
}, S = {
|
|
436
|
+
name: t.supplier.name,
|
|
437
|
+
phoneNumber: t.supplier.phoneNumber,
|
|
438
|
+
registrationNumber: t.supplier.registrationNumber,
|
|
439
|
+
line1: t.supplier.address.line1,
|
|
440
|
+
line2: t.supplier.address.line2,
|
|
441
|
+
postcode: t.supplier.address.postcode,
|
|
442
|
+
city: t.supplier.address.city,
|
|
443
|
+
state: t.supplier.address.state,
|
|
444
|
+
country: t.supplier.address.country
|
|
445
|
+
}, v = t.items.map((q) => {
|
|
446
|
+
const { sku: P, measurement: E } = q, z = fe(
|
|
447
|
+
Bt(q.sku, t.deliveryOrder || []),
|
|
448
|
+
!1
|
|
449
|
+
);
|
|
450
|
+
return {
|
|
451
|
+
code: P.code,
|
|
452
|
+
description: P.name,
|
|
453
|
+
quantity: fe(q.quantity, !1),
|
|
454
|
+
unit: (E == null ? void 0 : E.abbrev) || P.unit.abbrev,
|
|
455
|
+
received: z,
|
|
456
|
+
cost: q.totalCost ? `${q.totalCost.currency} ${_t.toFormatString({
|
|
457
|
+
value: q.totalCost
|
|
458
|
+
})}` : void 0
|
|
459
|
+
};
|
|
460
|
+
}), m = t.deliveryOrder.map((q) => ({
|
|
461
|
+
createdAt: it(new Date(q.createdAt)),
|
|
462
|
+
ref: q.deliveryOrderNumber,
|
|
463
|
+
remark: q.remark || "",
|
|
464
|
+
items: q.received.map((P) => {
|
|
465
|
+
var E;
|
|
466
|
+
return {
|
|
467
|
+
code: P.sku.code,
|
|
468
|
+
description: P.sku.name,
|
|
469
|
+
quantity: fe(P.amount),
|
|
470
|
+
unit: ((E = P.measurement) == null ? void 0 : E.abbrev) || P.sku.unit.abbrev
|
|
471
|
+
};
|
|
472
|
+
})
|
|
473
|
+
})), d = [
|
|
474
|
+
// Production
|
|
475
|
+
"67ca5d2c80bd0e001c5bf5bc",
|
|
476
|
+
// Dev
|
|
477
|
+
"6880b36a3054c5001db19218"
|
|
478
|
+
];
|
|
479
|
+
let s = "Inventory Receive Note";
|
|
480
|
+
if (t.supplier.internal ? (s = "Inventory Transfer Note", d.includes((_ == null ? void 0 : _._id) || "") && (s = "Stock Request")) : s = "Purchase Order", e) {
|
|
481
|
+
const q = e.from.dbName;
|
|
482
|
+
a.dbName === q || (s = "Inventory Receive Note");
|
|
483
|
+
}
|
|
484
|
+
const b = {
|
|
485
|
+
title: s,
|
|
486
|
+
businessName: _ == null ? void 0 : _.name,
|
|
487
|
+
logo: _ == null ? void 0 : _.thumbnail,
|
|
488
|
+
orderNumber: t.seqNumber.toString(),
|
|
489
|
+
createdAt: $e(t._id),
|
|
490
|
+
ref: t.ref || "",
|
|
491
|
+
remark: t.remark || "",
|
|
492
|
+
buyer: h,
|
|
493
|
+
supplier: S,
|
|
494
|
+
items: v,
|
|
495
|
+
status: t.status,
|
|
496
|
+
deliveryOrders: m
|
|
497
|
+
}, w = new URL(window.location.href), D = c && (t.deliveryFullfillment || []).length > 0 ? "receive-request/delivery-print-preview" : "receive-request/print-preview";
|
|
498
|
+
w.pathname = w.hostname.includes("portal.feedme") ? `/inventory/${D}` : `/${D}`, w.searchParams.append("data", JSON.stringify(b)), window.open(w.href, "_blank", "noreferrer");
|
|
499
|
+
}
|
|
500
|
+
const Se = {
|
|
501
|
+
submitRequest: {
|
|
502
|
+
translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
|
|
503
|
+
color: "text-fm-color-typo-primary",
|
|
504
|
+
value: x.enum.submitRequest
|
|
505
|
+
},
|
|
506
|
+
confirmDraft: {
|
|
507
|
+
translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
|
|
508
|
+
color: "text-fm-color-typo-primary",
|
|
509
|
+
value: x.enum.confirmDraft
|
|
510
|
+
},
|
|
511
|
+
cancelDraft: {
|
|
512
|
+
translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
|
|
513
|
+
color: "text-fm-color-typo-error",
|
|
514
|
+
value: x.enum.cancelDraft
|
|
515
|
+
},
|
|
516
|
+
approveRequest: {
|
|
517
|
+
translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
|
|
518
|
+
color: "text-fm-color-typo-primary",
|
|
519
|
+
value: x.enum.approveRequest
|
|
520
|
+
},
|
|
521
|
+
rejectRequest: {
|
|
522
|
+
translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
|
|
523
|
+
color: "text-fm-color-typo-error",
|
|
524
|
+
value: x.enum.rejectRequest
|
|
525
|
+
},
|
|
526
|
+
processRequest: {
|
|
527
|
+
translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
|
|
528
|
+
color: "text-fm-color-typo-primary",
|
|
529
|
+
value: x.enum.processRequest
|
|
530
|
+
},
|
|
531
|
+
receiveStock: {
|
|
532
|
+
translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
|
|
533
|
+
color: "text-fm-color-typo-primary",
|
|
534
|
+
value: x.enum.receiveStock
|
|
535
|
+
},
|
|
536
|
+
completeReceive: {
|
|
537
|
+
translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
|
|
538
|
+
color: "text-fm-color-typo-primary",
|
|
539
|
+
value: x.enum.completeReceive
|
|
540
|
+
},
|
|
541
|
+
closeRequest: {
|
|
542
|
+
translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
|
|
543
|
+
color: "system-error-300",
|
|
544
|
+
value: x.enum.closeRequest
|
|
545
|
+
},
|
|
546
|
+
approveDraft: {
|
|
547
|
+
translationKey: "",
|
|
548
|
+
color: "",
|
|
549
|
+
value: void 0
|
|
550
|
+
},
|
|
551
|
+
rejectDraft: {
|
|
552
|
+
translationKey: "",
|
|
553
|
+
color: "",
|
|
554
|
+
value: void 0
|
|
555
|
+
},
|
|
556
|
+
returnStock: {
|
|
557
|
+
translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
|
|
558
|
+
color: "text-fm-color-typo-primary",
|
|
559
|
+
value: x.enum.returnStock
|
|
560
|
+
}
|
|
561
|
+
};
|
|
562
|
+
function Ws(p, t) {
|
|
563
|
+
const a = me(), _ = Pe(), c = Ie(), { t: e } = dt();
|
|
564
|
+
function u(m) {
|
|
565
|
+
switch (m.status) {
|
|
566
|
+
case "DRAFT":
|
|
567
|
+
return [
|
|
568
|
+
ae[te.Update],
|
|
569
|
+
ae[te.Details],
|
|
570
|
+
m.supplier.internal === "restaurant" || m.supplier.internal === "warehouse" ? Se[x.enum.submitRequest] : Se[x.enum.confirmDraft],
|
|
571
|
+
Se[x.enum.cancelDraft]
|
|
572
|
+
];
|
|
573
|
+
case "RECEIVING":
|
|
574
|
+
return [
|
|
575
|
+
Se[x.enum.completeReceive],
|
|
576
|
+
ae[te.Details],
|
|
577
|
+
ae[te.Print]
|
|
578
|
+
];
|
|
579
|
+
case "REQUESTING":
|
|
580
|
+
return p === "receive/request" ? [ae[te.Details], ae[te.Print]] : [
|
|
581
|
+
Se[x.enum.approveRequest],
|
|
582
|
+
Se[x.enum.rejectRequest],
|
|
583
|
+
ae[te.Details]
|
|
584
|
+
// DefaultRowActions[RowActionEnum.Print]
|
|
585
|
+
];
|
|
586
|
+
case "PROCESSING":
|
|
587
|
+
return [ae[te.Details], ae[te.Print]];
|
|
588
|
+
case "COMPLETE":
|
|
589
|
+
case "CANCEL":
|
|
590
|
+
default:
|
|
591
|
+
return [ae[te.Details], ae[te.Print]];
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
function i(m) {
|
|
595
|
+
return Object.values(x.enum).includes(m);
|
|
596
|
+
}
|
|
597
|
+
async function n(m, d, s) {
|
|
598
|
+
var b, w, D, q, P, E;
|
|
599
|
+
const l = nt(d);
|
|
600
|
+
if (m === te.Print) {
|
|
601
|
+
const z = (s == null ? void 0 : s.toInventoryLocation) ?? a.currentLocation;
|
|
602
|
+
((b = s == null ? void 0 : s.netSuite) != null && b.refNo || (w = l.netSuite) != null && w.refNo) && (l.ref = [((D = s == null ? void 0 : s.netSuite) == null ? void 0 : D.refNo) || ((q = l.netSuite) == null ? void 0 : q.refNo)].filter((ce) => ce).join(" ")), Vt({
|
|
603
|
+
po: l,
|
|
604
|
+
currentLocation: z,
|
|
605
|
+
business: c.currentBusiness.value,
|
|
606
|
+
fulfilling: p === "approval",
|
|
607
|
+
por: s
|
|
608
|
+
});
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
611
|
+
if (m === te.Details) {
|
|
612
|
+
t.promptShowTransferDetails(l, s);
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
if (m === te.Update) {
|
|
616
|
+
(P = t.promptUpdateTransferDialog) == null || P.call(t, l);
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
if (i(m)) {
|
|
620
|
+
t.submitAction(d, m, (E = s == null ? void 0 : s.to) == null ? void 0 : E.dbName);
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
function h() {
|
|
625
|
+
var d;
|
|
626
|
+
const m = [
|
|
627
|
+
{
|
|
628
|
+
accessorKey: "seqNumber",
|
|
629
|
+
header: () => e("inventory.transfer.table.seqNo"),
|
|
630
|
+
enableSorting: !0,
|
|
631
|
+
size: 80,
|
|
632
|
+
sortUndefined: "last"
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
accessorKey: "_id",
|
|
636
|
+
header: () => e("inventory.transfer.table.createdAt"),
|
|
637
|
+
cell(s) {
|
|
638
|
+
return $e(`${s.getValue()}`);
|
|
639
|
+
},
|
|
640
|
+
enableSorting: !0
|
|
641
|
+
},
|
|
642
|
+
{
|
|
643
|
+
accessorKey: "supplier.name",
|
|
644
|
+
header: () => e("inventory.transfer.table.transferFrom"),
|
|
645
|
+
enableSorting: !0,
|
|
646
|
+
size: 200
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
accessorKey: "items.length",
|
|
650
|
+
header: () => e("inventory.transfer.table.noOfItems"),
|
|
651
|
+
cell: (s) => {
|
|
652
|
+
var w;
|
|
653
|
+
const l = s.row.original.version || "1", b = s.getValue();
|
|
654
|
+
return $("div", { class: "flex items-center gap-2" }, [
|
|
655
|
+
b,
|
|
656
|
+
l !== "1" && ((w = c.sessionUser.value) != null && w.role.isAdmin) ? $(
|
|
657
|
+
"div",
|
|
658
|
+
{
|
|
659
|
+
class: ["fm-status-badge", "fm-status-badge-draft"].join(" ")
|
|
660
|
+
},
|
|
661
|
+
`v${l}`
|
|
662
|
+
) : null
|
|
663
|
+
]);
|
|
664
|
+
},
|
|
665
|
+
enableSorting: !1,
|
|
666
|
+
meta: {
|
|
667
|
+
width: "10rem"
|
|
668
|
+
}
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
accessorKey: "ref",
|
|
672
|
+
header: () => e("inventory.transfer.table.reference"),
|
|
673
|
+
enableSorting: !1,
|
|
674
|
+
size: "auto"
|
|
675
|
+
},
|
|
676
|
+
...(d = c.sessionUser.value) != null && d.role.isAdmin ? [
|
|
677
|
+
{
|
|
678
|
+
id: "statusForAdmin",
|
|
679
|
+
header: () => `${e("inventory.transfer.table.status")} (Admin)`,
|
|
680
|
+
cell(s) {
|
|
681
|
+
return s.row.original.status;
|
|
682
|
+
},
|
|
683
|
+
enableSorting: !0,
|
|
684
|
+
size: 200
|
|
685
|
+
}
|
|
686
|
+
] : [],
|
|
687
|
+
{
|
|
688
|
+
accessorKey: "status",
|
|
689
|
+
header: () => e("inventory.transfer.table.status"),
|
|
690
|
+
cell(s) {
|
|
691
|
+
const l = s.getValue(), b = De(s.row.original), { partial: w, over: D } = je(b), q = ze(l ?? "", w, D);
|
|
692
|
+
let P = e(`inventory.transfer.status.${q}`), E = `${l ?? ""}`.toLocaleLowerCase("en-us");
|
|
693
|
+
return q === M.enum.CLOSE && (P = `${e(`inventory.transfer.status.${M.enum.COMPLETE}`)}`), q === "PARTIAL_RECEIVED" && E === M.enum.PROCESSING.toLocaleLowerCase("en-us") && (E = M.enum.RECEIVING.toLocaleLowerCase("en-us")), $(
|
|
694
|
+
"div",
|
|
695
|
+
{
|
|
696
|
+
class: "flex"
|
|
697
|
+
},
|
|
698
|
+
$(
|
|
699
|
+
"div",
|
|
700
|
+
{
|
|
701
|
+
class: [
|
|
702
|
+
"fm-status-badge",
|
|
703
|
+
`fm-status-badge-${E}`,
|
|
704
|
+
D && "fm-status-badge-error"
|
|
705
|
+
].filter(Boolean).join(" ")
|
|
706
|
+
},
|
|
707
|
+
`${P}`
|
|
708
|
+
)
|
|
709
|
+
);
|
|
710
|
+
},
|
|
711
|
+
enableSorting: !0,
|
|
712
|
+
size: 200
|
|
713
|
+
},
|
|
714
|
+
{
|
|
715
|
+
id: "action",
|
|
716
|
+
cell(s) {
|
|
717
|
+
const l = s.row.original, b = u(l);
|
|
718
|
+
return tt(b, (w) => n(w, l));
|
|
719
|
+
},
|
|
720
|
+
enableSorting: !1,
|
|
721
|
+
size: 40,
|
|
722
|
+
meta: {
|
|
723
|
+
cellClass: "",
|
|
724
|
+
headerClass: ""
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
];
|
|
728
|
+
if (_.isEnabled) {
|
|
729
|
+
const s = [
|
|
730
|
+
{
|
|
731
|
+
id: "netsuiteTransferOrder",
|
|
732
|
+
accessorFn: (l) => {
|
|
733
|
+
var b;
|
|
734
|
+
return (b = l.netSuite) != null && b.id ? `${l.netSuite.refNo} (${l.netSuite.id})` : "N/A";
|
|
735
|
+
},
|
|
736
|
+
header: () => "NetSuite Order (ID)",
|
|
737
|
+
cell(l) {
|
|
738
|
+
var w;
|
|
739
|
+
const b = l.row.original;
|
|
740
|
+
return (w = b.netSuite) != null && w.id ? `${b.netSuite.refNo} (${b.netSuite.id})` : "N/A";
|
|
741
|
+
},
|
|
742
|
+
enableSorting: !1,
|
|
743
|
+
size: 200,
|
|
744
|
+
meta: {
|
|
745
|
+
cellClass: "",
|
|
746
|
+
headerClass: ""
|
|
747
|
+
}
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
id: "netsuiteTransactionNumber",
|
|
751
|
+
accessorFn: (l) => {
|
|
752
|
+
var b, w;
|
|
753
|
+
return ((w = (b = l.netSuite) == null ? void 0 : b.additionalInfo) == null ? void 0 : w.transactionnumber) ?? "N/A";
|
|
754
|
+
},
|
|
755
|
+
header: () => "NetSuite Transaction No.",
|
|
756
|
+
cell(l) {
|
|
757
|
+
var w, D;
|
|
758
|
+
return ((D = (w = l.row.original.netSuite) == null ? void 0 : w.additionalInfo) == null ? void 0 : D.transactionnumber) ?? "N/A";
|
|
759
|
+
},
|
|
760
|
+
enableSorting: !1,
|
|
761
|
+
size: 200,
|
|
762
|
+
meta: {
|
|
763
|
+
cellClass: "",
|
|
764
|
+
headerClass: ""
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
];
|
|
768
|
+
m.splice(m.length - 1, 0, ...s);
|
|
769
|
+
}
|
|
770
|
+
return m;
|
|
771
|
+
}
|
|
772
|
+
function S() {
|
|
773
|
+
var d;
|
|
774
|
+
const m = [
|
|
775
|
+
{
|
|
776
|
+
accessorKey: "purchaseOrder.seqNumber",
|
|
777
|
+
header: () => e("inventory.transfer.table.seqNo"),
|
|
778
|
+
enableSorting: !0,
|
|
779
|
+
size: 80,
|
|
780
|
+
sortUndefined: "last"
|
|
781
|
+
},
|
|
782
|
+
{
|
|
783
|
+
accessorKey: "purchaseOrder._id",
|
|
784
|
+
header: () => e("inventory.transfer.table.createdAt"),
|
|
785
|
+
cell(s) {
|
|
786
|
+
return $e(`${s.getValue()}`);
|
|
787
|
+
},
|
|
788
|
+
enableSorting: !0
|
|
789
|
+
},
|
|
790
|
+
{
|
|
791
|
+
accessorKey: "to.name",
|
|
792
|
+
header: () => e("inventory.transfer.table.transferTo"),
|
|
793
|
+
enableSorting: !1,
|
|
794
|
+
size: 200
|
|
795
|
+
},
|
|
796
|
+
{
|
|
797
|
+
accessorKey: "purchaseOrder.items.length",
|
|
798
|
+
header: () => e("inventory.transfer.table.noOfItems"),
|
|
799
|
+
enableSorting: !1
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
accessorKey: "purchaseOrder.ref",
|
|
803
|
+
header: () => e("inventory.transfer.table.reference"),
|
|
804
|
+
enableSorting: !1,
|
|
805
|
+
size: "auto"
|
|
806
|
+
},
|
|
807
|
+
...(d = c.sessionUser.value) != null && d.role.isAdmin ? [
|
|
808
|
+
{
|
|
809
|
+
id: "statusForAdmin",
|
|
810
|
+
header: () => `${e("inventory.transfer.table.status")} (Admin)`,
|
|
811
|
+
cell(s) {
|
|
812
|
+
return s.row.original.status;
|
|
813
|
+
},
|
|
814
|
+
enableSorting: !0,
|
|
815
|
+
size: 200
|
|
816
|
+
}
|
|
817
|
+
] : [],
|
|
818
|
+
{
|
|
819
|
+
accessorKey: "purchaseOrder.status",
|
|
820
|
+
header: () => e("inventory.transfer.table.status"),
|
|
821
|
+
cell(s) {
|
|
822
|
+
const l = s.row.original, b = s.getValue();
|
|
823
|
+
if (!l.purchaseOrder)
|
|
824
|
+
return $(Ke.FmChip, {
|
|
825
|
+
label: "N/A",
|
|
826
|
+
compact: !0
|
|
827
|
+
});
|
|
828
|
+
const w = De(l.purchaseOrder), { partial: D, over: q } = je(w), P = ze(b ?? "", D, q);
|
|
829
|
+
let E = e(`inventory.transfer.status.${P}`), z = `${b ?? ""}`.toLocaleLowerCase("en-us");
|
|
830
|
+
return P === M.enum.CLOSE && (E = `${e(`inventory.transfer.status.${M.enum.COMPLETE}`)}`), P === "PARTIAL_RECEIVED" && z === M.enum.PROCESSING.toLocaleLowerCase("en-us") && (z = M.enum.RECEIVING.toLocaleLowerCase("en-us")), $(
|
|
831
|
+
"div",
|
|
832
|
+
{
|
|
833
|
+
class: "flex"
|
|
834
|
+
},
|
|
835
|
+
$(
|
|
836
|
+
"div",
|
|
837
|
+
{
|
|
838
|
+
class: [
|
|
839
|
+
"fm-status-badge",
|
|
840
|
+
`fm-status-badge-${z}`,
|
|
841
|
+
q && "fm-status-badge-error"
|
|
842
|
+
].filter(Boolean).join(" ")
|
|
843
|
+
},
|
|
844
|
+
`${E}`
|
|
845
|
+
)
|
|
846
|
+
);
|
|
847
|
+
},
|
|
848
|
+
enableSorting: !0
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
id: "action",
|
|
852
|
+
cell(s) {
|
|
853
|
+
const l = s.row.original, w = (l.purchaseOrder ? u(l.purchaseOrder) : []).map((D) => D.value === te.Print ? {
|
|
854
|
+
...D,
|
|
855
|
+
translationKey: "inventory.transfer.receiveRequest.details.printDeliveryOrder"
|
|
856
|
+
} : D);
|
|
857
|
+
return tt(
|
|
858
|
+
w,
|
|
859
|
+
(D) => l.purchaseOrder ? n(D, l.purchaseOrder, l) : void 0
|
|
860
|
+
);
|
|
861
|
+
},
|
|
862
|
+
enableSorting: !1,
|
|
863
|
+
size: 40,
|
|
864
|
+
meta: {
|
|
865
|
+
cellClass: "",
|
|
866
|
+
headerClass: ""
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
];
|
|
870
|
+
if (_.isEnabled) {
|
|
871
|
+
const s = [
|
|
872
|
+
{
|
|
873
|
+
id: "netsuiteTransferOrder",
|
|
874
|
+
accessorFn: (l) => {
|
|
875
|
+
var b;
|
|
876
|
+
return (b = l.netSuite) != null && b.id ? `${l.netSuite.refNo} (${l.netSuite.id})` : "N/A";
|
|
877
|
+
},
|
|
878
|
+
header: () => "NetSuite Order (ID)",
|
|
879
|
+
cell(l) {
|
|
880
|
+
var w;
|
|
881
|
+
const b = l.row.original;
|
|
882
|
+
return (w = b.netSuite) != null && w.id ? `${b.netSuite.refNo} (${b.netSuite.id})` : "N/A";
|
|
883
|
+
},
|
|
884
|
+
enableSorting: !1,
|
|
885
|
+
size: 200,
|
|
886
|
+
meta: {
|
|
887
|
+
cellClass: "",
|
|
888
|
+
headerClass: ""
|
|
889
|
+
}
|
|
890
|
+
},
|
|
891
|
+
{
|
|
892
|
+
id: "netsuiteTransactionNumber",
|
|
893
|
+
accessorFn: (l) => {
|
|
894
|
+
var b, w;
|
|
895
|
+
return ((w = (b = l.netSuite) == null ? void 0 : b.additionalInfo) == null ? void 0 : w.transactionnumber) ?? "N/A";
|
|
896
|
+
},
|
|
897
|
+
header: () => "NetSuite Transaction No.",
|
|
898
|
+
cell(l) {
|
|
899
|
+
var w, D;
|
|
900
|
+
return ((D = (w = l.row.original.netSuite) == null ? void 0 : w.additionalInfo) == null ? void 0 : D.transactionnumber) ?? "N/A";
|
|
901
|
+
},
|
|
902
|
+
enableSorting: !1,
|
|
903
|
+
size: 200,
|
|
904
|
+
meta: {
|
|
905
|
+
cellClass: "",
|
|
906
|
+
headerClass: ""
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
];
|
|
910
|
+
m.splice(m.length - 2, 0, ...s);
|
|
911
|
+
}
|
|
912
|
+
return m;
|
|
913
|
+
}
|
|
914
|
+
return {
|
|
915
|
+
columnDefs: ee(() => p === "receive/request" ? h() : S())
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
const Ut = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Mt = { class: "flex flex-col gap-8" }, Kt = { class: "flex w-full justify-end gap-16" }, jt = /* @__PURE__ */ he({
|
|
919
|
+
__name: "FulfillmentForm",
|
|
920
|
+
props: {
|
|
921
|
+
purchaseOrder: {},
|
|
922
|
+
confirm: { type: Function }
|
|
923
|
+
},
|
|
924
|
+
emits: ["update:show"],
|
|
925
|
+
setup(p, { emit: t }) {
|
|
926
|
+
const a = p, _ = Rt({
|
|
927
|
+
id: "",
|
|
928
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
929
|
+
items: []
|
|
930
|
+
}), c = G(), e = t;
|
|
931
|
+
ut(() => {
|
|
932
|
+
a.purchaseOrder && (_.items = a.purchaseOrder.items.map((i) => ({
|
|
933
|
+
id: i.id,
|
|
934
|
+
sku: i.sku,
|
|
935
|
+
measurement: i.measurement,
|
|
936
|
+
amount: i.quantity ?? { amount: 1, precision: 0 }
|
|
937
|
+
})));
|
|
938
|
+
});
|
|
939
|
+
const u = ee(() => _.items.length <= 10);
|
|
940
|
+
return (i, n) => {
|
|
941
|
+
const h = W("FmTable"), S = W("FmButton"), v = W("FmForm");
|
|
942
|
+
return g(), ie(v, {
|
|
943
|
+
ref_key: "formRef",
|
|
944
|
+
ref: c,
|
|
945
|
+
class: "bg-white flex flex-col gap-32 rounded-3xl p-24 w-[800px]",
|
|
946
|
+
onValidationFailed: console.log,
|
|
947
|
+
onValidationSuccess: n[1] || (n[1] = () => a.confirm(_))
|
|
948
|
+
}, {
|
|
949
|
+
default: oe(() => [
|
|
950
|
+
n[2] || (n[2] = o("div", { class: "fm-typo-en-title-sm-600" }, "Confirm the transfer amount", -1)),
|
|
951
|
+
o("div", Ut, [
|
|
952
|
+
o("div", Mt, [
|
|
953
|
+
F(h, {
|
|
954
|
+
"column-defs": [
|
|
955
|
+
{
|
|
956
|
+
header: "Code",
|
|
957
|
+
cell: (m) => {
|
|
958
|
+
const d = a.purchaseOrder.items.find((s) => s.id === m.row.original.id || s.sku._id === m.row.original.sku._id);
|
|
959
|
+
return $(
|
|
960
|
+
R(Ke).FmTooltip,
|
|
961
|
+
{
|
|
962
|
+
content: d.code,
|
|
963
|
+
placement: "top",
|
|
964
|
+
variant: "plain",
|
|
965
|
+
zIndex: 50
|
|
966
|
+
},
|
|
967
|
+
$(
|
|
968
|
+
"span",
|
|
969
|
+
{
|
|
970
|
+
class: "flex-auto line-clamp-2 text-ellipsis break-all"
|
|
971
|
+
},
|
|
972
|
+
d.code
|
|
973
|
+
)
|
|
974
|
+
);
|
|
975
|
+
}
|
|
976
|
+
},
|
|
977
|
+
{
|
|
978
|
+
header: "Name",
|
|
979
|
+
cell: (m) => {
|
|
980
|
+
const d = a.purchaseOrder.items.find((s) => s.id === m.row.original.id || s.sku._id === m.row.original.sku._id);
|
|
981
|
+
return $(
|
|
982
|
+
R(Ke).FmTooltip,
|
|
983
|
+
{
|
|
984
|
+
content: d.name,
|
|
985
|
+
placement: "top",
|
|
986
|
+
variant: "plain",
|
|
987
|
+
zIndex: 50
|
|
988
|
+
},
|
|
989
|
+
$(
|
|
990
|
+
"span",
|
|
991
|
+
{
|
|
992
|
+
class: "flex-auto line-clamp-2 text-ellipsis break-all"
|
|
993
|
+
},
|
|
994
|
+
d.name
|
|
995
|
+
)
|
|
996
|
+
);
|
|
997
|
+
}
|
|
998
|
+
},
|
|
999
|
+
{
|
|
1000
|
+
header: "Amount",
|
|
1001
|
+
cell: (m) => {
|
|
1002
|
+
const d = m.row.original, s = a.purchaseOrder.items.find((b) => b.id === d.id || b.sku._id === d.sku._id), l = d.amount ?? {
|
|
1003
|
+
amount: 1,
|
|
1004
|
+
precision: 0
|
|
1005
|
+
};
|
|
1006
|
+
return $(Tt, {
|
|
1007
|
+
style: {
|
|
1008
|
+
flex: "1 1 0%"
|
|
1009
|
+
},
|
|
1010
|
+
modelValue: {
|
|
1011
|
+
amount: l,
|
|
1012
|
+
measurement: d.measurement ?? null
|
|
1013
|
+
},
|
|
1014
|
+
key: d.id ?? d.sku._id,
|
|
1015
|
+
unit: d.sku.unit,
|
|
1016
|
+
"onUpdate:modelValue": (b) => {
|
|
1017
|
+
if (!b) return;
|
|
1018
|
+
const w = _.items.find((D) => D.id === d.id || D.sku._id === d.sku._id);
|
|
1019
|
+
w && (w.amount = b.amount);
|
|
1020
|
+
},
|
|
1021
|
+
disableUnit: !0,
|
|
1022
|
+
rules: [
|
|
1023
|
+
R(Pt)(
|
|
1024
|
+
+R(fe)({ amount: 0, precision: 0 })
|
|
1025
|
+
),
|
|
1026
|
+
R(It)(+R(fe)(s.quantity))
|
|
1027
|
+
],
|
|
1028
|
+
applyDefaultRules: !0
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
],
|
|
1033
|
+
"row-data": _.items,
|
|
1034
|
+
"hide-footer": u.value
|
|
1035
|
+
}, null, 8, ["column-defs", "row-data", "hide-footer"])
|
|
1036
|
+
])
|
|
1037
|
+
]),
|
|
1038
|
+
o("div", Kt, [
|
|
1039
|
+
F(S, {
|
|
1040
|
+
class: "px-16",
|
|
1041
|
+
label: "Confirm",
|
|
1042
|
+
size: "md",
|
|
1043
|
+
variant: "primary",
|
|
1044
|
+
type: "submit"
|
|
1045
|
+
}),
|
|
1046
|
+
F(S, {
|
|
1047
|
+
class: "px-16",
|
|
1048
|
+
label: "Cancel",
|
|
1049
|
+
size: "md",
|
|
1050
|
+
variant: "secondary",
|
|
1051
|
+
onClick: n[0] || (n[0] = () => e("update:show", !1))
|
|
1052
|
+
})
|
|
1053
|
+
])
|
|
1054
|
+
]),
|
|
1055
|
+
_: 1
|
|
1056
|
+
}, 8, ["onValidationFailed"]);
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1059
|
+
}), Me = {
|
|
1060
|
+
submitRequest: {
|
|
1061
|
+
translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
|
|
1062
|
+
color: "primary",
|
|
1063
|
+
buttonVariant: se.Primary
|
|
1064
|
+
},
|
|
1065
|
+
confirmDraft: {
|
|
1066
|
+
translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
|
|
1067
|
+
color: "primary",
|
|
1068
|
+
buttonVariant: se.Primary
|
|
1069
|
+
},
|
|
1070
|
+
cancelDraft: {
|
|
1071
|
+
translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
|
|
1072
|
+
color: "system-error-300",
|
|
1073
|
+
buttonVariant: se.Destructive
|
|
1074
|
+
},
|
|
1075
|
+
approveDraft: {
|
|
1076
|
+
translationKey: "inventory.transfer.receiveRequest.actions.approveDraft",
|
|
1077
|
+
color: "primary",
|
|
1078
|
+
buttonVariant: se.Primary
|
|
1079
|
+
},
|
|
1080
|
+
rejectDraft: {
|
|
1081
|
+
translationKey: "inventory.transfer.receiveRequest.actions.rejectDraft",
|
|
1082
|
+
color: "system-error-300",
|
|
1083
|
+
buttonVariant: se.Destructive
|
|
1084
|
+
},
|
|
1085
|
+
approveRequest: {
|
|
1086
|
+
translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
|
|
1087
|
+
color: "primary",
|
|
1088
|
+
buttonVariant: se.Primary
|
|
1089
|
+
},
|
|
1090
|
+
processRequest: {
|
|
1091
|
+
translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
|
|
1092
|
+
color: "primary",
|
|
1093
|
+
buttonVariant: se.Primary
|
|
1094
|
+
},
|
|
1095
|
+
receiveStock: {
|
|
1096
|
+
translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
|
|
1097
|
+
color: "primary",
|
|
1098
|
+
buttonVariant: se.Primary,
|
|
1099
|
+
available: !1
|
|
1100
|
+
},
|
|
1101
|
+
completeReceive: {
|
|
1102
|
+
translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
|
|
1103
|
+
color: "primary",
|
|
1104
|
+
buttonVariant: se.Plain
|
|
1105
|
+
},
|
|
1106
|
+
rejectRequest: {
|
|
1107
|
+
translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
|
|
1108
|
+
color: "system-error-300",
|
|
1109
|
+
buttonVariant: se.Destructive
|
|
1110
|
+
},
|
|
1111
|
+
closeRequest: {
|
|
1112
|
+
translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
|
|
1113
|
+
color: "system-error-300",
|
|
1114
|
+
buttonVariant: se.Destructive,
|
|
1115
|
+
available: !1
|
|
1116
|
+
},
|
|
1117
|
+
returnStock: {
|
|
1118
|
+
translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
|
|
1119
|
+
color: "primary",
|
|
1120
|
+
buttonVariant: se.Primary,
|
|
1121
|
+
available: !1
|
|
1122
|
+
}
|
|
1123
|
+
};
|
|
1124
|
+
function zt() {
|
|
1125
|
+
const p = Te();
|
|
1126
|
+
return {
|
|
1127
|
+
ableToMarkReceived(t) {
|
|
1128
|
+
if (!t || t.status !== M.enum.RECEIVING)
|
|
1129
|
+
return !1;
|
|
1130
|
+
const _ = me().currentLocationDBName;
|
|
1131
|
+
return `${t.supplier.internal}_${t.supplier._id}` !== _;
|
|
1132
|
+
},
|
|
1133
|
+
ableToMarkApproved(t) {
|
|
1134
|
+
return !(!t || (t == null ? void 0 : t.status) !== M.enum.REQUESTING);
|
|
1135
|
+
},
|
|
1136
|
+
ableToCreateFulfillment(t, a) {
|
|
1137
|
+
var e, u;
|
|
1138
|
+
if (!p.acceptRequireFulfillment || !t || !a || t.status !== M.enum.PROCESSING || !a.processedAt)
|
|
1139
|
+
return !1;
|
|
1140
|
+
const _ = (e = a == null ? void 0 : a.from) == null ? void 0 : e.dbName, c = (u = a == null ? void 0 : a.to) == null ? void 0 : u.dbName;
|
|
1141
|
+
return !(_.startsWith("restaurant_") && c.startsWith("restaurant_"));
|
|
1142
|
+
}
|
|
1143
|
+
};
|
|
1144
|
+
}
|
|
1145
|
+
const Gt = { class: "flex flex-row-reverse" }, Ht = /* @__PURE__ */ he({
|
|
1146
|
+
__name: "NetSuiteSync",
|
|
1147
|
+
props: {
|
|
1148
|
+
poRequest: {},
|
|
1149
|
+
purchaseOrder: {},
|
|
1150
|
+
isTransferBetweenOutlets: { type: Boolean },
|
|
1151
|
+
scope: {}
|
|
1152
|
+
},
|
|
1153
|
+
setup(p) {
|
|
1154
|
+
const t = p, a = Pe(), _ = Fe(), c = We(), e = G(!1);
|
|
1155
|
+
ee(() => {
|
|
1156
|
+
var S, v, m, d;
|
|
1157
|
+
let i = !0;
|
|
1158
|
+
a.isEnabled || (i = !1);
|
|
1159
|
+
const n = t.purchaseOrder, h = t.poRequest;
|
|
1160
|
+
return n && ((S = n == null ? void 0 : n.supplier) != null && S.internal ? (!h && n.status == M.enum.DRAFT && (i = !1), h && !((v = h == null ? void 0 : h.netSuite) != null && v.id) && (i = !1), t.isTransferBetweenOutlets && (i = !1)) : ((n == null ? void 0 : n.status) !== M.enum.REQUESTING && n.supplier.internal && (i = !1), !h && !((m = n == null ? void 0 : n.netSuite) != null && m.id) && (i = !1), !h && ((d = n == null ? void 0 : n.netSuite) != null && d.id) && (n == null ? void 0 : n.status) == M.enum.REQUESTING && (i = !1))), i;
|
|
1161
|
+
});
|
|
1162
|
+
async function u() {
|
|
1163
|
+
e.value || c.open({
|
|
1164
|
+
title: "Sync with NetSuite",
|
|
1165
|
+
contentComponent: $("div", [
|
|
1166
|
+
$("p", "Are you sure you want to sync now?"),
|
|
1167
|
+
$("br"),
|
|
1168
|
+
$(
|
|
1169
|
+
"p",
|
|
1170
|
+
{ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
|
|
1171
|
+
"Please wait a moment before syncing manually to avoid unnecessary actions."
|
|
1172
|
+
)
|
|
1173
|
+
]),
|
|
1174
|
+
primaryActions: {
|
|
1175
|
+
text: "Sync",
|
|
1176
|
+
close: !0,
|
|
1177
|
+
variant: "destructive"
|
|
1178
|
+
},
|
|
1179
|
+
secondaryActions: { text: "Not now", close: !0 }
|
|
1180
|
+
}).onPrimary(async () => {
|
|
1181
|
+
var i, n, h;
|
|
1182
|
+
try {
|
|
1183
|
+
e.value = !0;
|
|
1184
|
+
const S = ((i = t.purchaseOrder) == null ? void 0 : i._id) || ((n = t.poRequest) == null ? void 0 : n.purchaseOrderId) || "", v = (h = t.poRequest) == null ? void 0 : h.to.dbName;
|
|
1185
|
+
await a.syncPurchaseOrder(
|
|
1186
|
+
S,
|
|
1187
|
+
t.scope === "approval" ? v : void 0
|
|
1188
|
+
), _.open({
|
|
1189
|
+
title: "Sync with NetSuite",
|
|
1190
|
+
message: "Requested to sync with NetSuite. Please wait a moment.",
|
|
1191
|
+
type: "success"
|
|
1192
|
+
}), await new Promise((m) => setTimeout(m, 5e3)), e.value = !1;
|
|
1193
|
+
} catch {
|
|
1194
|
+
_.open({
|
|
1195
|
+
title: "Error",
|
|
1196
|
+
message: "Failed to sync with NetSuite",
|
|
1197
|
+
type: "error"
|
|
1198
|
+
}), e.value = !1;
|
|
1199
|
+
}
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1202
|
+
return (i, n) => {
|
|
1203
|
+
const h = W("FmButton");
|
|
1204
|
+
return g(), N("div", Gt, [
|
|
1205
|
+
F(h, {
|
|
1206
|
+
"prepend-icon": "sync",
|
|
1207
|
+
variant: "secondary",
|
|
1208
|
+
label: "Sync",
|
|
1209
|
+
loading: e.value,
|
|
1210
|
+
onClick: u,
|
|
1211
|
+
"text-color": "primary",
|
|
1212
|
+
"bg-color": "transparent",
|
|
1213
|
+
"border-color": "primary"
|
|
1214
|
+
}, null, 8, ["loading"])
|
|
1215
|
+
]);
|
|
1216
|
+
};
|
|
1217
|
+
}
|
|
1218
|
+
}), Wt = {
|
|
1219
|
+
key: 0,
|
|
1220
|
+
class: "flex flex-col gap-8"
|
|
1221
|
+
}, Yt = { class: "flex flex-col gap-4" }, Qt = { class: "fm-typo-en-body-lg-600" }, Xt = {
|
|
1222
|
+
key: 0,
|
|
1223
|
+
class: "flex flex-col gap-4"
|
|
1224
|
+
}, Zt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Jt = { class: "fm-typo-en-body-lg-600" }, er = { key: 0 }, tr = { key: 1 }, rr = {
|
|
1225
|
+
key: 1,
|
|
1226
|
+
class: "flex flex-col gap-4"
|
|
1227
|
+
}, sr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, nr = { class: "fm-typo-en-body-lg-600" }, ar = { key: 0 }, or = { key: 1 }, ir = {
|
|
1228
|
+
key: 2,
|
|
1229
|
+
class: "flex flex-col gap-4"
|
|
1230
|
+
}, lr = { class: "fm-typo-en-body-lg-600" }, cr = {
|
|
1231
|
+
key: 3,
|
|
1232
|
+
class: "flex flex-col gap-4"
|
|
1233
|
+
}, ur = { class: "fm-typo-en-body-lg-600" }, dr = /* @__PURE__ */ he({
|
|
1234
|
+
__name: "NetSuiteInfo",
|
|
1235
|
+
props: {
|
|
1236
|
+
transferType: {},
|
|
1237
|
+
transferToDbName: {},
|
|
1238
|
+
poRequest: {},
|
|
1239
|
+
purchaseOrder: {},
|
|
1240
|
+
isTransferBetweenOutlets: { type: Boolean },
|
|
1241
|
+
scope: {}
|
|
1242
|
+
},
|
|
1243
|
+
setup(p) {
|
|
1244
|
+
const t = p, a = Pe(), _ = Ee(), c = G(t.poRequest);
|
|
1245
|
+
ut(async () => {
|
|
1246
|
+
var n;
|
|
1247
|
+
if (!t.poRequest && ((n = t.purchaseOrder) != null && n._id)) {
|
|
1248
|
+
const h = await _.getLatestPurchaseOrderRequest(t.purchaseOrder._id);
|
|
1249
|
+
c.value = h;
|
|
1250
|
+
}
|
|
1251
|
+
});
|
|
1252
|
+
const e = ee(
|
|
1253
|
+
() => {
|
|
1254
|
+
var n, h, S, v, m, d;
|
|
1255
|
+
return a.getSubsidiaryFullName(
|
|
1256
|
+
((S = (h = (n = t.purchaseOrder) == null ? void 0 : n.netSuite) == null ? void 0 : h.subsidiary) == null ? void 0 : S.id) || ((d = (m = (v = t.poRequest) == null ? void 0 : v.netSuite) == null ? void 0 : m.subsidiary) == null ? void 0 : d.id)
|
|
1257
|
+
).fullName;
|
|
1258
|
+
}
|
|
1259
|
+
), u = ee(() => {
|
|
1260
|
+
var n, h, S, v, m, d, s, l, b, w, D, q;
|
|
1261
|
+
return (S = (h = (n = t.purchaseOrder) == null ? void 0 : n.netSuite) == null ? void 0 : h.additionalInfo) != null && S.transactionnumber ? (d = (m = (v = t.purchaseOrder) == null ? void 0 : v.netSuite) == null ? void 0 : m.additionalInfo) == null ? void 0 : d.transactionnumber : (b = (l = (s = c.value) == null ? void 0 : s.netSuite) == null ? void 0 : l.additionalInfo) != null && b.transactionnumber ? (q = (D = (w = c.value) == null ? void 0 : w.netSuite) == null ? void 0 : D.additionalInfo) == null ? void 0 : q.transactionnumber : null;
|
|
1262
|
+
}), i = ee(() => {
|
|
1263
|
+
var n, h, S, v, m, d;
|
|
1264
|
+
return (h = (n = t.purchaseOrder) == null ? void 0 : n.deliveryFullfillment) != null && h.length && ((v = (S = t.purchaseOrder) == null ? void 0 : S.deliveryFullfillment) == null ? void 0 : v.length) > 0 ? (d = (m = t.purchaseOrder) == null ? void 0 : m.deliveryFullfillment) == null ? void 0 : d.map((s) => {
|
|
1265
|
+
var l;
|
|
1266
|
+
return (l = s.netSuite) == null ? void 0 : l.refNo;
|
|
1267
|
+
}).join(", ") : "N/A";
|
|
1268
|
+
});
|
|
1269
|
+
return (n, h) => {
|
|
1270
|
+
var S, v, m, d, s, l, b, w, D, q, P, E, z, ce, le, be;
|
|
1271
|
+
return R(a).isEnabled ? (g(), N("div", Wt, [
|
|
1272
|
+
o("div", Yt, [
|
|
1273
|
+
h[0] || (h[0] = o("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "NetSuite subsidiary", -1)),
|
|
1274
|
+
o("div", Qt, k(e.value || "N/A"), 1)
|
|
1275
|
+
]),
|
|
1276
|
+
!n.isTransferBetweenOutlets && n.scope === R(Ge).RECEIVE_REQUEST ? (g(), N("div", Xt, [
|
|
1277
|
+
o("div", Zt, " NetSuite " + k((v = (S = n.purchaseOrder) == null ? void 0 : S.netSuite) != null && v.recordType ? R(lt)((d = (m = n.purchaseOrder) == null ? void 0 : m.netSuite) == null ? void 0 : d.recordType) : n.transferType === R(ye).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
|
|
1278
|
+
o("div", Jt, [
|
|
1279
|
+
(l = (s = n.purchaseOrder) == null ? void 0 : s.netSuite) != null && l.id ? (g(), N("span", er, k((w = (b = n.purchaseOrder) == null ? void 0 : b.netSuite) == null ? void 0 : w.refNo) + " (" + k((q = (D = n.purchaseOrder) == null ? void 0 : D.netSuite) == null ? void 0 : q.id) + ") ", 1)) : (g(), N("span", tr, "N/A"))
|
|
1280
|
+
])
|
|
1281
|
+
])) : U("", !0),
|
|
1282
|
+
!n.isTransferBetweenOutlets && c.value || n.scope === R(Ge).APPROVAL ? (g(), N("div", rr, [
|
|
1283
|
+
o("div", sr, " (Request) NetSuite " + k(n.transferType === R(ye).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
|
|
1284
|
+
o("div", nr, [
|
|
1285
|
+
(E = (P = c.value) == null ? void 0 : P.netSuite) != null && E.id ? (g(), N("span", ar, k((ce = (z = c.value) == null ? void 0 : z.netSuite) == null ? void 0 : ce.refNo) + " (" + k((be = (le = c.value) == null ? void 0 : le.netSuite) == null ? void 0 : be.id) + ") ", 1)) : (g(), N("span", or, "N/A"))
|
|
1286
|
+
])
|
|
1287
|
+
])) : U("", !0),
|
|
1288
|
+
u.value ? (g(), N("div", ir, [
|
|
1289
|
+
h[1] || (h[1] = o("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transaction Number ", -1)),
|
|
1290
|
+
o("div", lr, k(u.value), 1)
|
|
1291
|
+
])) : U("", !0),
|
|
1292
|
+
R(a).isEnabled && n.transferType === R(ye).TRANSFER && !n.isTransferBetweenOutlets ? (g(), N("div", cr, [
|
|
1293
|
+
h[2] || (h[2] = o("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite fulfillment IDs ", -1)),
|
|
1294
|
+
o("div", ur, k(i.value), 1)
|
|
1295
|
+
])) : U("", !0)
|
|
1296
|
+
])) : U("", !0);
|
|
1297
|
+
};
|
|
1298
|
+
}
|
|
1299
|
+
}), fr = { class: "flex flex-row-reverse" }, mr = /* @__PURE__ */ he({
|
|
1300
|
+
__name: "NetSuiteLog",
|
|
1301
|
+
props: {
|
|
1302
|
+
netsuiteId: {},
|
|
1303
|
+
purchaseOrderId: {}
|
|
1304
|
+
},
|
|
1305
|
+
setup(p) {
|
|
1306
|
+
const t = Fe(), a = ct();
|
|
1307
|
+
async function _(c, e) {
|
|
1308
|
+
const u = [];
|
|
1309
|
+
if (c && u.push(`body.message:*${c}*`), e) {
|
|
1310
|
+
const S = e.replace(/:/g, "\\:");
|
|
1311
|
+
u.push(`${S}`);
|
|
1312
|
+
}
|
|
1313
|
+
if (u.length === 0) {
|
|
1314
|
+
t.open({
|
|
1315
|
+
message: "Cannot open logs without valid filters.",
|
|
1316
|
+
type: "error"
|
|
1317
|
+
});
|
|
1318
|
+
return;
|
|
1319
|
+
}
|
|
1320
|
+
const n = `attributes.pod:netsuite* AND (${u.join(" OR ")})`, { url: h } = await a.getLogs(n);
|
|
1321
|
+
t.open(
|
|
1322
|
+
{
|
|
1323
|
+
message: "Opening NetSuite logs...",
|
|
1324
|
+
type: "info"
|
|
1325
|
+
},
|
|
1326
|
+
800
|
|
1327
|
+
), await new Promise((S) => setTimeout(S, 800)), window.open(h, "_blank");
|
|
1328
|
+
}
|
|
1329
|
+
return (c, e) => {
|
|
1330
|
+
const u = W("FmButton");
|
|
1331
|
+
return g(), N("div", fr, [
|
|
1332
|
+
F(u, {
|
|
1333
|
+
"prepend-icon": "history",
|
|
1334
|
+
variant: "secondary",
|
|
1335
|
+
label: "Logs",
|
|
1336
|
+
onClick: e[0] || (e[0] = (i) => _(c.netsuiteId, c.purchaseOrderId)),
|
|
1337
|
+
"text-color": "primary",
|
|
1338
|
+
"bg-color": "transparent",
|
|
1339
|
+
"border-color": "primary"
|
|
1340
|
+
})
|
|
1341
|
+
]);
|
|
1342
|
+
};
|
|
1343
|
+
}
|
|
1344
|
+
}), pr = { class: "flex flex-row-reverse" }, vr = { key: 0 }, yr = {
|
|
1345
|
+
key: 1,
|
|
1346
|
+
class: "w-[480px]"
|
|
1347
|
+
}, hr = { class: "fm-typo-en-body-md-400" }, br = { key: 0 }, gr = { key: 1 }, _r = { key: 1 }, Sr = /* @__PURE__ */ he({
|
|
1348
|
+
__name: "NetSuiteLatestInfo",
|
|
1349
|
+
props: {
|
|
1350
|
+
netsuiteId: {},
|
|
1351
|
+
purchaseOrderId: {}
|
|
1352
|
+
},
|
|
1353
|
+
setup(p) {
|
|
1354
|
+
const t = p, a = ct(), _ = G(!1), c = me(), e = G(!0), u = G(!1), i = G(null);
|
|
1355
|
+
async function n() {
|
|
1356
|
+
if (!i.value) {
|
|
1357
|
+
_.value = !0;
|
|
1358
|
+
try {
|
|
1359
|
+
e.value = !0;
|
|
1360
|
+
const h = await a.getMoreInfo(
|
|
1361
|
+
c.currentLocation.dbName,
|
|
1362
|
+
t.purchaseOrderId
|
|
1363
|
+
);
|
|
1364
|
+
i.value = h, u.value = !1;
|
|
1365
|
+
} catch {
|
|
1366
|
+
u.value = !0;
|
|
1367
|
+
} finally {
|
|
1368
|
+
e.value = !1;
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
return (h, S) => {
|
|
1373
|
+
const v = W("FmButton"), m = W("FmLabel"), d = W("FmDialog");
|
|
1374
|
+
return g(), N("div", pr, [
|
|
1375
|
+
F(d, {
|
|
1376
|
+
modelValue: _.value,
|
|
1377
|
+
"onUpdate:modelValue": S[2] || (S[2] = (s) => _.value = s),
|
|
1378
|
+
overlay: !0
|
|
1379
|
+
}, {
|
|
1380
|
+
"dialog-button": oe(() => [
|
|
1381
|
+
F(v, {
|
|
1382
|
+
"prepend-icon": "info",
|
|
1383
|
+
variant: "secondary",
|
|
1384
|
+
label: "Latest Info",
|
|
1385
|
+
onClick: S[0] || (S[0] = (s) => n()),
|
|
1386
|
+
"text-color": "primary",
|
|
1387
|
+
"bg-color": "transparent",
|
|
1388
|
+
"border-color": "primary"
|
|
1389
|
+
})
|
|
1390
|
+
]),
|
|
1391
|
+
"dialog-header": oe(() => S[3] || (S[3] = [
|
|
1392
|
+
o("div", null, "NetSuite latest info", -1)
|
|
1393
|
+
])),
|
|
1394
|
+
"dialog-footer": oe(() => [
|
|
1395
|
+
F(v, {
|
|
1396
|
+
class: "ml-auto sm:w-full xs:w-full",
|
|
1397
|
+
label: "Close",
|
|
1398
|
+
size: "md",
|
|
1399
|
+
variant: "primary",
|
|
1400
|
+
onClick: S[1] || (S[1] = (s) => _.value = !1)
|
|
1401
|
+
})
|
|
1402
|
+
]),
|
|
1403
|
+
default: oe(() => [
|
|
1404
|
+
e.value ? (g(), N("div", vr, "Loading...")) : (g(), N("div", yr, [
|
|
1405
|
+
u.value ? (g(), N("p", _r, "Something went wrong.")) : (g(!0), N(ne, { key: 0 }, ve(i.value, (s, l) => (g(), N("div", {
|
|
1406
|
+
key: l,
|
|
1407
|
+
class: "mb-2"
|
|
1408
|
+
}, [
|
|
1409
|
+
o("div", null, [
|
|
1410
|
+
F(m, {
|
|
1411
|
+
label: R(He)(l)
|
|
1412
|
+
}, null, 8, ["label"]),
|
|
1413
|
+
o("div", hr, [
|
|
1414
|
+
Array.isArray(s) ? (g(), N("span", br, k(s.length > 0 ? s.join(", ") : "N/A"), 1)) : (g(), N("span", gr, k(s), 1))
|
|
1415
|
+
])
|
|
1416
|
+
])
|
|
1417
|
+
]))), 128))
|
|
1418
|
+
]))
|
|
1419
|
+
]),
|
|
1420
|
+
_: 1
|
|
1421
|
+
}, 8, ["modelValue"])
|
|
1422
|
+
]);
|
|
1423
|
+
};
|
|
1424
|
+
}
|
|
1425
|
+
}), wr = {
|
|
1426
|
+
key: 0,
|
|
1427
|
+
class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16 flex flex-col gap-8"
|
|
1428
|
+
}, Rr = { class: "flex gap-8 items-center" }, Or = { class: "ml-auto" }, Nr = { class: "flex gap-4" }, xr = /* @__PURE__ */ he({
|
|
1429
|
+
__name: "NetSuitePanel",
|
|
1430
|
+
props: {
|
|
1431
|
+
poRequest: {},
|
|
1432
|
+
purchaseOrder: {},
|
|
1433
|
+
transferType: {},
|
|
1434
|
+
transferToDbName: {},
|
|
1435
|
+
scope: {}
|
|
1436
|
+
},
|
|
1437
|
+
setup(p) {
|
|
1438
|
+
const t = p, a = Et(), _ = Ie(), c = ee(() => {
|
|
1439
|
+
var n, h, S, v, m, d, s;
|
|
1440
|
+
const e = ((n = t.transferToDbName) == null ? void 0 : n.startsWith("restaurant")) && ((S = (h = t.purchaseOrder) == null ? void 0 : h.supplier) == null ? void 0 : S.internal) === "restaurant", u = t.transferType === ye.PURCHASE, i = t.transferType === ye.TRANSFER;
|
|
1441
|
+
return u || i && !e || ((m = (v = t.purchaseOrder) == null ? void 0 : v.netSuite) == null ? void 0 : m.id) || ((s = (d = t.poRequest) == null ? void 0 : d.netSuite) == null ? void 0 : s.id);
|
|
1442
|
+
});
|
|
1443
|
+
return (e, u) => {
|
|
1444
|
+
var n, h, S, v, m, d, s, l, b, w;
|
|
1445
|
+
const i = W("FmMenuDivider");
|
|
1446
|
+
return R(a).isNetSuiteEnabled && c.value ? (g(), N("div", wr, [
|
|
1447
|
+
o("div", Rr, [
|
|
1448
|
+
u[0] || (u[0] = o("span", { class: "flex-1 fm-typo-en-body-lg-600" }, "NetSuite Info", -1)),
|
|
1449
|
+
o("div", Or, [
|
|
1450
|
+
o("div", Nr, [
|
|
1451
|
+
(n = R(_).sessionUser.value) != null && n.role.isAdmin && ((S = (h = t.purchaseOrder) == null ? void 0 : h.netSuite) != null && S.id) ? (g(), ie(Sr, {
|
|
1452
|
+
key: 0,
|
|
1453
|
+
"netsuite-id": (m = (v = e.purchaseOrder) == null ? void 0 : v.netSuite) == null ? void 0 : m.id,
|
|
1454
|
+
"purchase-order-id": (d = e.purchaseOrder) == null ? void 0 : d._id
|
|
1455
|
+
}, null, 8, ["netsuite-id", "purchase-order-id"])) : U("", !0),
|
|
1456
|
+
(s = R(_).sessionUser.value) != null && s.role.isAdmin ? (g(), ie(mr, {
|
|
1457
|
+
key: 1,
|
|
1458
|
+
"netsuite-id": (b = (l = e.purchaseOrder) == null ? void 0 : l.netSuite) == null ? void 0 : b.id,
|
|
1459
|
+
"purchase-order-id": (w = e.purchaseOrder) == null ? void 0 : w._id
|
|
1460
|
+
}, null, 8, ["netsuite-id", "purchase-order-id"])) : U("", !0),
|
|
1461
|
+
F(Ht, {
|
|
1462
|
+
"po-request": e.poRequest,
|
|
1463
|
+
"purchase-order": e.purchaseOrder,
|
|
1464
|
+
"is-transfer-between-outlets": !c.value,
|
|
1465
|
+
scope: e.scope
|
|
1466
|
+
}, null, 8, ["po-request", "purchase-order", "is-transfer-between-outlets", "scope"])
|
|
1467
|
+
])
|
|
1468
|
+
])
|
|
1469
|
+
]),
|
|
1470
|
+
F(i),
|
|
1471
|
+
F(dr, {
|
|
1472
|
+
"po-request": e.poRequest,
|
|
1473
|
+
"purchase-order": e.purchaseOrder,
|
|
1474
|
+
"transfer-type": e.transferType,
|
|
1475
|
+
"transfer-to-db-name": e.transferToDbName,
|
|
1476
|
+
"is-transfer-between-outlets": !c.value,
|
|
1477
|
+
scope: e.scope
|
|
1478
|
+
}, null, 8, ["po-request", "purchase-order", "transfer-type", "transfer-to-db-name", "is-transfer-between-outlets", "scope"])
|
|
1479
|
+
])) : U("", !0);
|
|
1480
|
+
};
|
|
1481
|
+
}
|
|
1482
|
+
}), kr = { class: "flex flex-col gap-16 w-full h-full" }, Ar = { class: "flex justify-between" }, Cr = { class: "fm-typo-en-body-lg-600" }, $r = { class: "flex gap-2" }, Dr = { key: 0 }, qr = { class: "flex flex-col gap-8" }, Tr = { class: "flex flex-col gap-4" }, Pr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ir = { class: "flex gap-1" }, Fr = { class: "fm-typo-en-body-lg-600" }, Er = {
|
|
1483
|
+
key: 0,
|
|
1484
|
+
class: "flex flex-col gap-4"
|
|
1485
|
+
}, Lr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Br = { class: "fm-typo-en-body-lg-600" }, Vr = { class: "flex flex-col gap-4" }, Ur = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Mr = { class: "fm-typo-en-body-lg-600" }, Kr = {
|
|
1486
|
+
key: 1,
|
|
1487
|
+
class: "flex flex-col gap-4"
|
|
1488
|
+
}, jr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, zr = { class: "fm-typo-en-body-lg-600" }, Gr = {
|
|
1489
|
+
key: 2,
|
|
1490
|
+
class: "flex flex-col gap-4"
|
|
1491
|
+
}, Hr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Wr = { class: "fm-typo-en-body-lg-600" }, Yr = {
|
|
1492
|
+
key: 3,
|
|
1493
|
+
class: "flex flex-col gap-4"
|
|
1494
|
+
}, Qr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Xr = { class: "fm-typo-en-body-lg-600" }, Zr = {
|
|
1495
|
+
key: 4,
|
|
1496
|
+
class: "flex flex-col gap-4"
|
|
1497
|
+
}, Jr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, es = { class: "fm-typo-en-body-lg-600" }, ts = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, rs = { class: "flex flex-col gap-8" }, ss = { class: "flex gap-8 items-center" }, ns = { class: "flex-1 fm-typo-en-body-lg-600" }, as = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-4" }, os = { class: "flex w-full gap-4" }, is = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2 flex items-center gap-2" }, ls = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, cs = ["innerHTML"], us = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, ds = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, fs = {
|
|
1498
|
+
key: 0,
|
|
1499
|
+
class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
|
|
1500
|
+
}, ms = { class: "py-8" }, ps = { class: "flex justify-end gap-4 items-center" }, vs = { class: "fm-typo-en-body-lg-600" }, ys = {
|
|
1501
|
+
key: 1,
|
|
1502
|
+
class: "flex-1 xs:w-screen xs:max-w-full"
|
|
1503
|
+
}, hs = {
|
|
1504
|
+
key: 0,
|
|
1505
|
+
class: "flex flex-col items-center gap-8 h-full"
|
|
1506
|
+
}, bs = ["src"], gs = { class: "fm-typo-en-body-lg-600" }, _s = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, Ss = {
|
|
1507
|
+
key: 1,
|
|
1508
|
+
class: "px-4 flex flex-col"
|
|
1509
|
+
}, ws = { class: "flex gap-12 content-stretch" }, Rs = {
|
|
1510
|
+
class: "flex flex-col w-24",
|
|
1511
|
+
name: "circles"
|
|
1512
|
+
}, Os = { class: "flex-1 flex flex-col items-center" }, Ns = { class: "flex-1 flex flex-col items-center" }, xs = {
|
|
1513
|
+
class: "py-12 flex flex-col gap-4",
|
|
1514
|
+
name: "received-at header"
|
|
1515
|
+
}, ks = { class: "fm-typo-en-body-lg-400" }, As = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Cs = { class: "flex gap-12 content-stretch" }, $s = {
|
|
1516
|
+
class: "flex flex-col w-24",
|
|
1517
|
+
name: "circles"
|
|
1518
|
+
}, Ds = { class: "flex-1 flex flex-col items-center" }, qs = {
|
|
1519
|
+
class: "py-12 flex flex-col gap-4 flex-1",
|
|
1520
|
+
name: "delivery details"
|
|
1521
|
+
}, Ts = { class: "flex flex-col gap-8" }, Ps = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Is = { class: "flex flex-col gap-4" }, Fs = { class: "flex gap-8 xs:flex-col" }, Ys = /* @__PURE__ */ he({
|
|
1522
|
+
__name: "TransferDetails",
|
|
1523
|
+
props: {
|
|
1524
|
+
poRequest: {},
|
|
1525
|
+
purchaseOrder: {},
|
|
1526
|
+
transferTo: {},
|
|
1527
|
+
transferToDbName: {},
|
|
1528
|
+
show: { type: Boolean },
|
|
1529
|
+
canResubmit: { type: Boolean },
|
|
1530
|
+
canApprove: { type: Boolean },
|
|
1531
|
+
scope: {},
|
|
1532
|
+
receivedMap: {}
|
|
1533
|
+
},
|
|
1534
|
+
emits: ["update:show", "submitted"],
|
|
1535
|
+
setup(p, { emit: t }) {
|
|
1536
|
+
const a = p, _ = t, c = We(), e = Fe(), u = Te(), i = me(), n = Ie(), h = ee(
|
|
1537
|
+
() => {
|
|
1538
|
+
var r, f;
|
|
1539
|
+
return {
|
|
1540
|
+
id: ((r = n.sessionUser.value) == null ? void 0 : r.id) ?? "",
|
|
1541
|
+
name: ((f = n.sessionUser.value) == null ? void 0 : f.displayName) ?? ""
|
|
1542
|
+
};
|
|
1543
|
+
}
|
|
1544
|
+
), S = zt(), { t: v } = dt(), m = ee(
|
|
1545
|
+
() => {
|
|
1546
|
+
var r, f, O, C;
|
|
1547
|
+
return ((f = (r = a.purchaseOrder) == null ? void 0 : r.supplier) == null ? void 0 : f.internal) === "restaurant" || ((C = (O = a.purchaseOrder) == null ? void 0 : O.supplier) == null ? void 0 : C.internal) === "warehouse" ? ye.TRANSFER : ye.PURCHASE;
|
|
1548
|
+
}
|
|
1549
|
+
), d = G(!1), s = G(""), l = G(!0), b = Ee(), w = Ft(b.getWorkflowConfig), D = mt(), q = ee(() => {
|
|
1550
|
+
if (!a.purchaseOrder)
|
|
1551
|
+
return [];
|
|
1552
|
+
const r = w.result.value;
|
|
1553
|
+
if (r.state === st.loading)
|
|
1554
|
+
return [];
|
|
1555
|
+
const f = {
|
|
1556
|
+
user: h.value,
|
|
1557
|
+
executedAt: i.locations.computeFirst(
|
|
1558
|
+
(C) => {
|
|
1559
|
+
var B;
|
|
1560
|
+
return C.dbName === ((B = i._currentLocation) == null ? void 0 : B.dbName) ? C : null;
|
|
1561
|
+
}
|
|
1562
|
+
),
|
|
1563
|
+
purchaseOrderRequest: a.poRequest,
|
|
1564
|
+
purchaseOrder: a.purchaseOrder
|
|
1565
|
+
};
|
|
1566
|
+
let O = [];
|
|
1567
|
+
try {
|
|
1568
|
+
r.state === st.error ? (console.error("Error fetching workflow config:", r.error), O = Le.getAvailableActions({
|
|
1569
|
+
...f,
|
|
1570
|
+
orderConfig: Le.getDefaultConfig()
|
|
1571
|
+
}).actions.filter(
|
|
1572
|
+
(C) => (
|
|
1573
|
+
// TODO: create receiveStock & processRequest dialog
|
|
1574
|
+
// to create their payload
|
|
1575
|
+
C !== x.enum.receiveStock && C !== x.enum.processRequest && C !== x.enum.closeRequest
|
|
1576
|
+
)
|
|
1577
|
+
)) : O = Le.getAvailableActions({
|
|
1578
|
+
...f,
|
|
1579
|
+
orderConfig: r.data
|
|
1580
|
+
}).actions.filter(
|
|
1581
|
+
(C) => C !== x.enum.receiveStock && C !== x.enum.processRequest && C !== x.enum.closeRequest
|
|
1582
|
+
);
|
|
1583
|
+
} catch (C) {
|
|
1584
|
+
console.error("Error getting available actions:", C);
|
|
1585
|
+
}
|
|
1586
|
+
return a.scope === "approval" && (O = O.filter((C) => C !== x.enum.completeReceive)), O;
|
|
1587
|
+
}), P = At(a, "show"), E = ee(() => [
|
|
1588
|
+
{
|
|
1589
|
+
label: v("inventory.transfer.receiveRequest.details.overview"),
|
|
1590
|
+
value: "overview"
|
|
1591
|
+
},
|
|
1592
|
+
{
|
|
1593
|
+
label: v("inventory.transfer.receiveRequest.details.deliveryHistory"),
|
|
1594
|
+
value: "deliveryHistory"
|
|
1595
|
+
}
|
|
1596
|
+
]), z = G(E.value[0]);
|
|
1597
|
+
Ot(
|
|
1598
|
+
() => a.show,
|
|
1599
|
+
(r) => {
|
|
1600
|
+
r && (z.value = E.value[0]);
|
|
1601
|
+
}
|
|
1602
|
+
);
|
|
1603
|
+
async function ce(r, f, O, C, B) {
|
|
1604
|
+
return new Promise((H, Q) => {
|
|
1605
|
+
c.open({
|
|
1606
|
+
closeButton: !1,
|
|
1607
|
+
title: C.title,
|
|
1608
|
+
message: C.message,
|
|
1609
|
+
primaryActions: C.primaryActions,
|
|
1610
|
+
secondaryActions: { text: "No", close: !1 }
|
|
1611
|
+
}).onPrimary(async () => {
|
|
1612
|
+
var V, X, Z, L;
|
|
1613
|
+
const y = [];
|
|
1614
|
+
O === x.enum.approveRequest ? (y.push({
|
|
1615
|
+
action: "approveRequest",
|
|
1616
|
+
payload: null
|
|
1617
|
+
}), f.fulfillment && y.push({
|
|
1618
|
+
action: "processRequest",
|
|
1619
|
+
payload: {
|
|
1620
|
+
fulfillmentId: "",
|
|
1621
|
+
deliveryOrderNumber: "",
|
|
1622
|
+
deliveryRemark: null,
|
|
1623
|
+
items: f.fulfillment.items,
|
|
1624
|
+
createdBy: h.value
|
|
1625
|
+
}
|
|
1626
|
+
})) : O === x.enum.processRequest ? f.fulfillment && y.push({
|
|
1627
|
+
action: "processRequest",
|
|
1628
|
+
payload: {
|
|
1629
|
+
fulfillmentId: "",
|
|
1630
|
+
deliveryOrderNumber: "",
|
|
1631
|
+
deliveryRemark: null,
|
|
1632
|
+
items: f.fulfillment.items,
|
|
1633
|
+
createdBy: h.value
|
|
1634
|
+
}
|
|
1635
|
+
}) : O === x.enum.rejectRequest ? y.push({
|
|
1636
|
+
action: "rejectRequest",
|
|
1637
|
+
payload: null
|
|
1638
|
+
}) : O === x.enum.closeRequest && y.push({
|
|
1639
|
+
action: "closeRequest",
|
|
1640
|
+
payload: null
|
|
1641
|
+
});
|
|
1642
|
+
try {
|
|
1643
|
+
await D({
|
|
1644
|
+
operate: {
|
|
1645
|
+
operation: O,
|
|
1646
|
+
doc: r,
|
|
1647
|
+
options: f
|
|
1648
|
+
},
|
|
1649
|
+
operateV2: {
|
|
1650
|
+
_id: ((V = a.purchaseOrder) == null ? void 0 : V._id) ?? "",
|
|
1651
|
+
_rev: ((X = a.purchaseOrder) == null ? void 0 : X._rev) ?? "",
|
|
1652
|
+
action: O,
|
|
1653
|
+
payloads: y
|
|
1654
|
+
// add payload if action is receiveStock or processRequest
|
|
1655
|
+
},
|
|
1656
|
+
transferTo: (L = (Z = a.poRequest) == null ? void 0 : Z.to) == null ? void 0 : L.dbName
|
|
1657
|
+
}).delayed(1e3), H("submitted");
|
|
1658
|
+
} catch (re) {
|
|
1659
|
+
Q(re);
|
|
1660
|
+
}
|
|
1661
|
+
}).onSecondary(() => {
|
|
1662
|
+
H("cancelled");
|
|
1663
|
+
for (let y = 0; y < B + 2; y++)
|
|
1664
|
+
c.close();
|
|
1665
|
+
}).onClose(() => {
|
|
1666
|
+
});
|
|
1667
|
+
});
|
|
1668
|
+
}
|
|
1669
|
+
async function le(r) {
|
|
1670
|
+
var B, H, Q, y;
|
|
1671
|
+
if (r === x.enum.receiveStock)
|
|
1672
|
+
return;
|
|
1673
|
+
const f = ft[r];
|
|
1674
|
+
if (!f) {
|
|
1675
|
+
e.open({
|
|
1676
|
+
title: "Something went wrong",
|
|
1677
|
+
message: `Cannot process order: ${He(r)}`,
|
|
1678
|
+
type: "error"
|
|
1679
|
+
});
|
|
1680
|
+
return;
|
|
1681
|
+
}
|
|
1682
|
+
const { successMessage: O, ...C } = f;
|
|
1683
|
+
if (a.purchaseOrder) {
|
|
1684
|
+
s.value = `${r}`, d.value = !0, l.value = !1;
|
|
1685
|
+
const V = {};
|
|
1686
|
+
let X = 0;
|
|
1687
|
+
if ((r === x.enum.confirmDraft || // auto receive for warehouse to warehouse
|
|
1688
|
+
r === x.enum.completeReceive) && u.autoReceiveWarehouse)
|
|
1689
|
+
V.autoReceive = !0;
|
|
1690
|
+
else if ((r === x.enum.approveRequest || r === x.enum.processRequest) && u.acceptRequireFulfillment) {
|
|
1691
|
+
const Z = (H = (B = a.poRequest) == null ? void 0 : B.from) == null ? void 0 : H.dbName, L = (y = (Q = a.poRequest) == null ? void 0 : Q.to) == null ? void 0 : y.dbName;
|
|
1692
|
+
if (Z && L && (Z.startsWith("warehouse_") || L.startsWith("warehouse_"))) {
|
|
1693
|
+
const re = await new Promise((K, de) => {
|
|
1694
|
+
c.open({
|
|
1695
|
+
closeButton: !1,
|
|
1696
|
+
title: "Confirm transfer amount",
|
|
1697
|
+
dialogComponent: jt,
|
|
1698
|
+
dialogComponentProps: {
|
|
1699
|
+
purchaseOrder: a.purchaseOrder,
|
|
1700
|
+
confirm: K,
|
|
1701
|
+
"onUpdate:show": (pe) => {
|
|
1702
|
+
pe || (s.value = "", d.value = !1, l.value = !0, X++, c.close()), de("cancelled");
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
});
|
|
1706
|
+
});
|
|
1707
|
+
V.fulfillment = re;
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
try {
|
|
1711
|
+
await ce(
|
|
1712
|
+
a.purchaseOrder,
|
|
1713
|
+
V,
|
|
1714
|
+
r,
|
|
1715
|
+
f,
|
|
1716
|
+
X
|
|
1717
|
+
) === "submitted" && (e.open({
|
|
1718
|
+
title: "Success",
|
|
1719
|
+
message: O,
|
|
1720
|
+
type: "success"
|
|
1721
|
+
}), _("update:show", !1), _("submitted"));
|
|
1722
|
+
} catch (Z) {
|
|
1723
|
+
e.open({
|
|
1724
|
+
title: "Something went wrong",
|
|
1725
|
+
message: "Please try again.",
|
|
1726
|
+
type: "error"
|
|
1727
|
+
}), console.error("Error when submitting PO operation", r, a.purchaseOrder, Z);
|
|
1728
|
+
} finally {
|
|
1729
|
+
s.value = "", d.value = !1, l.value = !0;
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
const be = ee(() => {
|
|
1734
|
+
var r, f;
|
|
1735
|
+
return ((r = a.purchaseOrder) == null ? void 0 : r.status) === M.enum.RECEIVING || ((f = a.purchaseOrder) == null ? void 0 : f.status) === M.enum.COMPLETE;
|
|
1736
|
+
}), Ne = ee(() => {
|
|
1737
|
+
const r = a.purchaseOrder;
|
|
1738
|
+
if (!r) return { status: "", statusClass: "" };
|
|
1739
|
+
const f = De(r), { partial: O, over: C } = je(f), B = ze(r.status, O, C);
|
|
1740
|
+
let H = v(`inventory.transfer.status.${B}`), Q = `${r.status}`.toLocaleLowerCase("en-us");
|
|
1741
|
+
return B === M.enum.CLOSE && (H = `${v(`inventory.transfer.status.${M.enum.COMPLETE}`)}`), B === "PARTIAL_RECEIVED" && Q === M.enum.PROCESSING.toLocaleLowerCase("en-us") && (Q = M.enum.RECEIVING.toLocaleLowerCase("en-us")), {
|
|
1742
|
+
status: H,
|
|
1743
|
+
statusClass: `fm-status-badge fm-status-badge-${Q}`
|
|
1744
|
+
};
|
|
1745
|
+
}), ue = ee(() => {
|
|
1746
|
+
var H, Q;
|
|
1747
|
+
const r = ((H = a.purchaseOrder) == null ? void 0 : H.deliveryOrder) ?? [], f = ((Q = a.purchaseOrder) == null ? void 0 : Q.deliveryFullfillment) ?? [], O = [
|
|
1748
|
+
...r.map((y) => ({
|
|
1749
|
+
createdAt: y.createdAt,
|
|
1750
|
+
type: "grn",
|
|
1751
|
+
doc: y
|
|
1752
|
+
})),
|
|
1753
|
+
...f.map((y) => ({
|
|
1754
|
+
createdAt: y.createdAt,
|
|
1755
|
+
type: "fulfillment",
|
|
1756
|
+
doc: y
|
|
1757
|
+
}))
|
|
1758
|
+
];
|
|
1759
|
+
O.reverse().sort((y, V) => y.createdAt.localeCompare(V.createdAt));
|
|
1760
|
+
function C(y) {
|
|
1761
|
+
var Z, L, re, K, de, pe, we, Re, j;
|
|
1762
|
+
const V = f.findIndex((I) => I.id === y.fullfillmentId), X = [
|
|
1763
|
+
(L = (Z = f[V]) == null ? void 0 : Z.netSuite) != null && L.refNo ? {
|
|
1764
|
+
label: "Fulfillment's ref no. (Netsuite)",
|
|
1765
|
+
values: [(K = (re = f[V]) == null ? void 0 : re.netSuite) == null ? void 0 : K.refNo]
|
|
1766
|
+
} : null,
|
|
1767
|
+
(de = y == null ? void 0 : y.netSuite) != null && de.refNo ? {
|
|
1768
|
+
label: "Netsuite ref no.",
|
|
1769
|
+
values: [(pe = y == null ? void 0 : y.netSuite) == null ? void 0 : pe.refNo]
|
|
1770
|
+
} : null,
|
|
1771
|
+
(we = y == null ? void 0 : y.netSuite) != null && we.recordType ? {
|
|
1772
|
+
label: "Netsuite Type",
|
|
1773
|
+
values: [lt((Re = y == null ? void 0 : y.netSuite) == null ? void 0 : Re.recordType)]
|
|
1774
|
+
} : null
|
|
1775
|
+
];
|
|
1776
|
+
return {
|
|
1777
|
+
header: "Received",
|
|
1778
|
+
date: Be(new Date(y.createdAt)),
|
|
1779
|
+
info: [
|
|
1780
|
+
{
|
|
1781
|
+
label: "Adjustment date",
|
|
1782
|
+
values: [
|
|
1783
|
+
y.adjustment ? Be(new Date(St(y.adjustment))) : "-"
|
|
1784
|
+
]
|
|
1785
|
+
},
|
|
1786
|
+
{
|
|
1787
|
+
label: "Received by",
|
|
1788
|
+
values: [(j = y.createdBy) == null ? void 0 : j.name]
|
|
1789
|
+
},
|
|
1790
|
+
{
|
|
1791
|
+
label: "Received items",
|
|
1792
|
+
values: y.received.map((I) => {
|
|
1793
|
+
var J;
|
|
1794
|
+
return $("div", [
|
|
1795
|
+
$(
|
|
1796
|
+
"div",
|
|
1797
|
+
{
|
|
1798
|
+
class: "flex gap-4"
|
|
1799
|
+
},
|
|
1800
|
+
[
|
|
1801
|
+
$(
|
|
1802
|
+
"div",
|
|
1803
|
+
{
|
|
1804
|
+
class: "flex flex-col"
|
|
1805
|
+
},
|
|
1806
|
+
[
|
|
1807
|
+
$(
|
|
1808
|
+
"span",
|
|
1809
|
+
{
|
|
1810
|
+
class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
|
|
1811
|
+
},
|
|
1812
|
+
`${I.sku.name}`
|
|
1813
|
+
),
|
|
1814
|
+
$(
|
|
1815
|
+
"span",
|
|
1816
|
+
{
|
|
1817
|
+
class: "fm-typo-en-body-md-400"
|
|
1818
|
+
},
|
|
1819
|
+
`${I.sku.code} `
|
|
1820
|
+
)
|
|
1821
|
+
]
|
|
1822
|
+
),
|
|
1823
|
+
$(
|
|
1824
|
+
"div",
|
|
1825
|
+
{
|
|
1826
|
+
class: "ml-auto flex flex-col"
|
|
1827
|
+
},
|
|
1828
|
+
[
|
|
1829
|
+
$(
|
|
1830
|
+
"div",
|
|
1831
|
+
{
|
|
1832
|
+
class: "ml-auto flex gap-1"
|
|
1833
|
+
},
|
|
1834
|
+
[
|
|
1835
|
+
$(
|
|
1836
|
+
"span",
|
|
1837
|
+
{
|
|
1838
|
+
class: "fm-typo-en-body-lg-600 self-end"
|
|
1839
|
+
},
|
|
1840
|
+
fe(I.amount, !1)
|
|
1841
|
+
),
|
|
1842
|
+
$(
|
|
1843
|
+
"span",
|
|
1844
|
+
{
|
|
1845
|
+
class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
|
|
1846
|
+
},
|
|
1847
|
+
((J = I.measurement) == null ? void 0 : J.abbrev) ?? I.sku.unit.abbrev
|
|
1848
|
+
)
|
|
1849
|
+
]
|
|
1850
|
+
),
|
|
1851
|
+
$(
|
|
1852
|
+
"div",
|
|
1853
|
+
{
|
|
1854
|
+
class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
1855
|
+
},
|
|
1856
|
+
`${I.cost ? `(${ke(I.cost)})` : ""}`
|
|
1857
|
+
)
|
|
1858
|
+
]
|
|
1859
|
+
)
|
|
1860
|
+
]
|
|
1861
|
+
)
|
|
1862
|
+
]);
|
|
1863
|
+
})
|
|
1864
|
+
},
|
|
1865
|
+
y.deliveryOrderNumber ? {
|
|
1866
|
+
label: "Delivery order no.",
|
|
1867
|
+
values: [y.deliveryOrderNumber]
|
|
1868
|
+
} : null,
|
|
1869
|
+
y.remark ? {
|
|
1870
|
+
label: "Remark",
|
|
1871
|
+
values: [y.remark]
|
|
1872
|
+
} : null,
|
|
1873
|
+
V > -1 ? {
|
|
1874
|
+
label: "Fulfilment's sequence",
|
|
1875
|
+
values: [`${V + 1}`]
|
|
1876
|
+
} : null,
|
|
1877
|
+
...X
|
|
1878
|
+
].filter((I) => I)
|
|
1879
|
+
};
|
|
1880
|
+
}
|
|
1881
|
+
function B(y) {
|
|
1882
|
+
var X, Z;
|
|
1883
|
+
const V = f.findIndex((L) => L.id === y.id);
|
|
1884
|
+
return {
|
|
1885
|
+
header: "Fulfillment",
|
|
1886
|
+
date: Be(new Date(y.createdAt)),
|
|
1887
|
+
info: [
|
|
1888
|
+
{
|
|
1889
|
+
label: "Sequence",
|
|
1890
|
+
values: [String(V + 1)]
|
|
1891
|
+
},
|
|
1892
|
+
{
|
|
1893
|
+
label: "Receiveable items",
|
|
1894
|
+
values: y.items.map((L) => {
|
|
1895
|
+
var re;
|
|
1896
|
+
return $("div", [
|
|
1897
|
+
$(
|
|
1898
|
+
"div",
|
|
1899
|
+
{
|
|
1900
|
+
class: "flex gap-4"
|
|
1901
|
+
},
|
|
1902
|
+
[
|
|
1903
|
+
$(
|
|
1904
|
+
"div",
|
|
1905
|
+
{
|
|
1906
|
+
class: "flex flex-col"
|
|
1907
|
+
},
|
|
1908
|
+
[
|
|
1909
|
+
$(
|
|
1910
|
+
"span",
|
|
1911
|
+
{
|
|
1912
|
+
class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
|
|
1913
|
+
},
|
|
1914
|
+
`${L.sku.name}`
|
|
1915
|
+
),
|
|
1916
|
+
$(
|
|
1917
|
+
"span",
|
|
1918
|
+
{
|
|
1919
|
+
class: "fm-typo-en-body-md-400"
|
|
1920
|
+
},
|
|
1921
|
+
`${L.sku.code} `
|
|
1922
|
+
)
|
|
1923
|
+
]
|
|
1924
|
+
),
|
|
1925
|
+
$(
|
|
1926
|
+
"div",
|
|
1927
|
+
{
|
|
1928
|
+
class: "ml-auto flex flex-col"
|
|
1929
|
+
},
|
|
1930
|
+
[
|
|
1931
|
+
$(
|
|
1932
|
+
"div",
|
|
1933
|
+
{
|
|
1934
|
+
class: "ml-auto flex gap-1"
|
|
1935
|
+
},
|
|
1936
|
+
[
|
|
1937
|
+
$(
|
|
1938
|
+
"span",
|
|
1939
|
+
{
|
|
1940
|
+
class: "fm-typo-en-body-lg-600 self-end"
|
|
1941
|
+
},
|
|
1942
|
+
fe(L.amount, !1)
|
|
1943
|
+
),
|
|
1944
|
+
$(
|
|
1945
|
+
"span",
|
|
1946
|
+
{
|
|
1947
|
+
class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
|
|
1948
|
+
},
|
|
1949
|
+
((re = L.measurement) == null ? void 0 : re.abbrev) ?? L.sku.unit.abbrev
|
|
1950
|
+
)
|
|
1951
|
+
]
|
|
1952
|
+
),
|
|
1953
|
+
$(
|
|
1954
|
+
"div",
|
|
1955
|
+
{
|
|
1956
|
+
class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
1957
|
+
},
|
|
1958
|
+
`${L.cost ? `(${ke(L.cost)})` : ""}`
|
|
1959
|
+
)
|
|
1960
|
+
]
|
|
1961
|
+
)
|
|
1962
|
+
]
|
|
1963
|
+
)
|
|
1964
|
+
]);
|
|
1965
|
+
})
|
|
1966
|
+
},
|
|
1967
|
+
(X = y.netSuite) != null && X.refNo ? {
|
|
1968
|
+
label: "Ref no. (Netsuite)",
|
|
1969
|
+
values: [(Z = y.netSuite) == null ? void 0 : Z.refNo]
|
|
1970
|
+
} : null
|
|
1971
|
+
].filter((L) => L)
|
|
1972
|
+
};
|
|
1973
|
+
}
|
|
1974
|
+
return O.map((y) => {
|
|
1975
|
+
switch (y.type) {
|
|
1976
|
+
case "grn":
|
|
1977
|
+
return C(y.doc);
|
|
1978
|
+
case "fulfillment":
|
|
1979
|
+
return B(y.doc);
|
|
1980
|
+
}
|
|
1981
|
+
});
|
|
1982
|
+
}), A = ee(() => {
|
|
1983
|
+
var f;
|
|
1984
|
+
const r = {
|
|
1985
|
+
...ot(0),
|
|
1986
|
+
currency: rt()
|
|
1987
|
+
};
|
|
1988
|
+
return ((f = a.purchaseOrder) == null ? void 0 : f.items.reduce((O, C) => ({
|
|
1989
|
+
...at(O, C.totalCost ?? r),
|
|
1990
|
+
currency: rt()
|
|
1991
|
+
}), r)) ?? r;
|
|
1992
|
+
});
|
|
1993
|
+
function T(r) {
|
|
1994
|
+
var H;
|
|
1995
|
+
const O = (((H = a.purchaseOrder) == null ? void 0 : H.version) ?? Ae.enum[1]) === Ae.enum[2] ? r.id : r.sku._id, C = a.receivedMap[O];
|
|
1996
|
+
return `<span class="${Y(r)} fm-typo-en-body-lg-600">${wt.toFormatString({ value: C.received })}</span>/${Dt(r.quantity, r.sku.unit, r.measurement)}`;
|
|
1997
|
+
}
|
|
1998
|
+
function Y(r) {
|
|
1999
|
+
var V;
|
|
2000
|
+
const O = (((V = a.purchaseOrder) == null ? void 0 : V.version) ?? Ae.enum[1]) === Ae.enum[2] ? r.id : r.sku._id, C = a.receivedMap[O], { isPartialReceive: B, isNoReceive: H, isOverReceive: Q, isFullReceive: y } = Lt(C);
|
|
2001
|
+
return H ? "text-fm-color-typo-tertiary" : B ? "text-fm-color-system-warning-300" : Q ? "text-fm-color-system-error-300" : y ? "text-fm-color-system-success-300" : "";
|
|
2002
|
+
}
|
|
2003
|
+
return (r, f) => {
|
|
2004
|
+
var L, re;
|
|
2005
|
+
const O = W("FmButtonGroup"), C = W("FmChip"), B = W("FmMenuDivider"), H = W("FmCard"), Q = W("FmIcon"), y = W("FmTooltip"), V = W("FmSpacer"), X = W("FmButton"), Z = W("FmSideSheet");
|
|
2006
|
+
return g(), ie(Z, {
|
|
2007
|
+
header: R(v)("inventory.transfer.receiveRequest.details.title") + ((L = r.purchaseOrder) != null && L.seqNumber ? ` #${(re = r.purchaseOrder) == null ? void 0 : re.seqNumber}` : ""),
|
|
2008
|
+
modelValue: R(P),
|
|
2009
|
+
"onUpdate:modelValue": f[5] || (f[5] = (K) => Nt(P) ? P.value = K : null),
|
|
2010
|
+
"dismiss-away": l.value,
|
|
2011
|
+
"close-button": "",
|
|
2012
|
+
"max-width": 600
|
|
2013
|
+
}, {
|
|
2014
|
+
default: oe(() => {
|
|
2015
|
+
var K, de, pe, we, Re;
|
|
2016
|
+
return [
|
|
2017
|
+
o("div", kr, [
|
|
2018
|
+
o("div", null, [
|
|
2019
|
+
F(O, {
|
|
2020
|
+
items: E.value,
|
|
2021
|
+
modelValue: z.value,
|
|
2022
|
+
"onUpdate:modelValue": f[0] || (f[0] = (j) => z.value = j)
|
|
2023
|
+
}, null, 8, ["items", "modelValue"])
|
|
2024
|
+
]),
|
|
2025
|
+
z.value.value === "overview" ? (g(), N(ne, { key: 0 }, [
|
|
2026
|
+
o("div", null, [
|
|
2027
|
+
F(H, {
|
|
2028
|
+
variant: "outlined",
|
|
2029
|
+
class: "flex flex-col gap-8 px-12 py-16"
|
|
2030
|
+
}, {
|
|
2031
|
+
default: oe(() => {
|
|
2032
|
+
var j, I, J, ge, _e, xe, Ye, Qe, Xe, Ze, Je;
|
|
2033
|
+
return [
|
|
2034
|
+
o("div", Ar, [
|
|
2035
|
+
o("div", Cr, k(R(v)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
|
|
2036
|
+
o("div", $r, [
|
|
2037
|
+
(j = R(n).sessionUser.value) != null && j.role.isAdmin ? (g(), N("div", Dr, k((I = a.purchaseOrder) == null ? void 0 : I.status) + " (Admin) ", 1)) : U("", !0),
|
|
2038
|
+
F(C, {
|
|
2039
|
+
label: Ne.value.status,
|
|
2040
|
+
class: Ce(Ne.value.statusClass),
|
|
2041
|
+
compact: ""
|
|
2042
|
+
}, null, 8, ["label", "class"])
|
|
2043
|
+
])
|
|
2044
|
+
]),
|
|
2045
|
+
F(B),
|
|
2046
|
+
o("div", qr, [
|
|
2047
|
+
o("div", Tr, [
|
|
2048
|
+
o("div", Pr, [
|
|
2049
|
+
o("div", Ir, k(R(v)("inventory.transfer.receiveRequest.details.createdAt")), 1)
|
|
2050
|
+
]),
|
|
2051
|
+
o("div", Fr, k(R($e)(((J = r.purchaseOrder) == null ? void 0 : J._id) ?? "")), 1)
|
|
2052
|
+
]),
|
|
2053
|
+
(ge = r.purchaseOrder) != null && ge.effectiveAt ? (g(), N("div", Er, [
|
|
2054
|
+
o("div", Lr, k(R(v)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
|
|
2055
|
+
o("div", Br, k(R(it)(new Date((_e = r.purchaseOrder) == null ? void 0 : _e.effectiveAt))), 1)
|
|
2056
|
+
])) : U("", !0),
|
|
2057
|
+
o("div", Vr, [
|
|
2058
|
+
o("div", Ur, k(R(v)("inventory.transfer.receiveRequest.details.type.title")), 1),
|
|
2059
|
+
o("div", Mr, k(R(v)(
|
|
2060
|
+
`inventory.transfer.receiveRequest.details.type.${m.value.toLocaleLowerCase("en-US")}`
|
|
2061
|
+
)), 1)
|
|
2062
|
+
]),
|
|
2063
|
+
(Ye = (xe = r.purchaseOrder) == null ? void 0 : xe.supplier) != null && Ye.name ? (g(), N("div", Kr, [
|
|
2064
|
+
o("div", jr, k(R(v)("inventory.transfer.receiveRequest.details.from")), 1),
|
|
2065
|
+
o("div", zr, k((Xe = (Qe = r.purchaseOrder) == null ? void 0 : Qe.supplier) == null ? void 0 : Xe.name), 1)
|
|
2066
|
+
])) : U("", !0),
|
|
2067
|
+
r.transferTo ? (g(), N("div", Gr, [
|
|
2068
|
+
o("div", Hr, k(R(v)("inventory.transfer.receiveRequest.details.to")), 1),
|
|
2069
|
+
o("div", Wr, k(r.transferTo), 1)
|
|
2070
|
+
])) : U("", !0),
|
|
2071
|
+
(Ze = r.purchaseOrder) != null && Ze.ref ? (g(), N("div", Yr, [
|
|
2072
|
+
o("div", Qr, k(R(v)("inventory.transfer.receiveRequest.details.reference")), 1),
|
|
2073
|
+
o("div", Xr, k(r.purchaseOrder.ref), 1)
|
|
2074
|
+
])) : U("", !0),
|
|
2075
|
+
(Je = r.purchaseOrder) != null && Je.remark ? (g(), N("div", Zr, [
|
|
2076
|
+
o("div", Jr, k(R(v)("inventory.transfer.receiveRequest.details.remark")), 1),
|
|
2077
|
+
o("div", es, k(r.purchaseOrder.remark), 1)
|
|
2078
|
+
])) : U("", !0)
|
|
2079
|
+
])
|
|
2080
|
+
];
|
|
2081
|
+
}),
|
|
2082
|
+
_: 1
|
|
2083
|
+
})
|
|
2084
|
+
]),
|
|
2085
|
+
F(xr, {
|
|
2086
|
+
"po-request": r.poRequest,
|
|
2087
|
+
purchaseOrder: r.purchaseOrder,
|
|
2088
|
+
transferType: m.value,
|
|
2089
|
+
transferToDbName: r.transferToDbName,
|
|
2090
|
+
scope: r.scope
|
|
2091
|
+
}, null, 8, ["po-request", "purchaseOrder", "transferType", "transferToDbName", "scope"]),
|
|
2092
|
+
o("div", ts, [
|
|
2093
|
+
o("div", rs, [
|
|
2094
|
+
o("div", ss, [
|
|
2095
|
+
o("span", ns, [
|
|
2096
|
+
Ve(k(be.value ? R(v)("inventory.transfer.receiveRequest.details.receivedItems") : R(v)("inventory.transfer.receiveRequest.details.requestedItems")) + " ", 1),
|
|
2097
|
+
(de = (K = r.purchaseOrder) == null ? void 0 : K.netSuite) != null && de.missingItems && ((we = (pe = r.purchaseOrder) == null ? void 0 : pe.netSuite) == null ? void 0 : we.missingItems.length) > 0 ? (g(), ie(y, {
|
|
2098
|
+
key: 0,
|
|
2099
|
+
variant: "rich",
|
|
2100
|
+
placement: "top",
|
|
2101
|
+
"z-index": 51
|
|
2102
|
+
}, {
|
|
2103
|
+
content: oe(() => {
|
|
2104
|
+
var j, I;
|
|
2105
|
+
return [
|
|
2106
|
+
o("div", as, [
|
|
2107
|
+
(g(!0), N(ne, null, ve((I = (j = r.purchaseOrder) == null ? void 0 : j.netSuite) == null ? void 0 : I.missingItems, (J, ge) => (g(), N("div", {
|
|
2108
|
+
class: "flex justify-center align-middle",
|
|
2109
|
+
key: ge
|
|
2110
|
+
}, [
|
|
2111
|
+
F(Q, {
|
|
2112
|
+
name: "arrow_right",
|
|
2113
|
+
size: "sm"
|
|
2114
|
+
}),
|
|
2115
|
+
Ve(" " + k(`(${J.netSuiteId}) ${J.name}: ${J.reason}`), 1)
|
|
2116
|
+
]))), 128))
|
|
2117
|
+
])
|
|
2118
|
+
];
|
|
2119
|
+
}),
|
|
2120
|
+
default: oe(() => [
|
|
2121
|
+
F(Q, {
|
|
2122
|
+
name: "error",
|
|
2123
|
+
color: "#ff2c2c",
|
|
2124
|
+
size: "sm"
|
|
2125
|
+
})
|
|
2126
|
+
]),
|
|
2127
|
+
_: 1
|
|
2128
|
+
})) : U("", !0)
|
|
2129
|
+
])
|
|
2130
|
+
]),
|
|
2131
|
+
F(B),
|
|
2132
|
+
(g(!0), N(ne, null, ve(((Re = r.purchaseOrder) == null ? void 0 : Re.items) ?? [], (j) => {
|
|
2133
|
+
var I;
|
|
2134
|
+
return g(), N("div", {
|
|
2135
|
+
key: j.code,
|
|
2136
|
+
class: "flex flex-col"
|
|
2137
|
+
}, [
|
|
2138
|
+
o("div", os, [
|
|
2139
|
+
o("div", is, k(j.name), 1),
|
|
2140
|
+
o("div", ls, [
|
|
2141
|
+
o("span", {
|
|
2142
|
+
innerHTML: T(j)
|
|
2143
|
+
}, null, 8, cs)
|
|
2144
|
+
])
|
|
2145
|
+
]),
|
|
2146
|
+
o("div", us, [
|
|
2147
|
+
o("div", ds, k(j.code), 1),
|
|
2148
|
+
(I = j.totalCost) != null && I.amount && R(u).enableTotalCost ? (g(), N("div", fs, " (" + k(R(ke)(j.totalCost)) + ") ", 1)) : U("", !0)
|
|
2149
|
+
])
|
|
2150
|
+
]);
|
|
2151
|
+
}), 128)),
|
|
2152
|
+
+R(fe)(A.value) ? (g(), N(ne, { key: 0 }, [
|
|
2153
|
+
o("div", ms, [
|
|
2154
|
+
F(B)
|
|
2155
|
+
]),
|
|
2156
|
+
o("div", ps, [
|
|
2157
|
+
f[6] || (f[6] = o("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Total:", -1)),
|
|
2158
|
+
o("div", vs, k(R(ke)(A.value)), 1)
|
|
2159
|
+
])
|
|
2160
|
+
], 64)) : U("", !0)
|
|
2161
|
+
])
|
|
2162
|
+
])
|
|
2163
|
+
], 64)) : z.value.value === "deliveryHistory" ? (g(), N("div", ys, [
|
|
2164
|
+
ue.value.length ? (g(), N("div", Ss, [
|
|
2165
|
+
(g(!0), N(ne, null, ve(ue.value, (j, I) => (g(), N(ne, { key: I }, [
|
|
2166
|
+
o("div", ws, [
|
|
2167
|
+
o("div", Rs, [
|
|
2168
|
+
o("div", Os, [
|
|
2169
|
+
o("div", {
|
|
2170
|
+
class: Ce([
|
|
2171
|
+
{
|
|
2172
|
+
"bg-fm-color-primary": I !== 0,
|
|
2173
|
+
"bg-white": I === 0
|
|
2174
|
+
},
|
|
2175
|
+
"w-[2px] h-full"
|
|
2176
|
+
])
|
|
2177
|
+
}, null, 2)
|
|
2178
|
+
]),
|
|
2179
|
+
f[7] || (f[7] = o("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
|
|
2180
|
+
o("div", Ns, [
|
|
2181
|
+
o("div", {
|
|
2182
|
+
class: Ce([
|
|
2183
|
+
{
|
|
2184
|
+
"bg-fm-color-primary": I < ue.value.length - 1,
|
|
2185
|
+
"bg-white": I >= ue.value.length - 1
|
|
2186
|
+
},
|
|
2187
|
+
"w-[2px] h-full"
|
|
2188
|
+
])
|
|
2189
|
+
}, null, 2)
|
|
2190
|
+
])
|
|
2191
|
+
]),
|
|
2192
|
+
o("div", xs, [
|
|
2193
|
+
o("div", ks, k(j.header), 1),
|
|
2194
|
+
o("div", As, k(j.date), 1)
|
|
2195
|
+
])
|
|
2196
|
+
]),
|
|
2197
|
+
o("div", Cs, [
|
|
2198
|
+
o("div", $s, [
|
|
2199
|
+
o("div", Ds, [
|
|
2200
|
+
o("div", {
|
|
2201
|
+
class: Ce([
|
|
2202
|
+
{
|
|
2203
|
+
"bg-fm-color-primary": I < ue.value.length - 1,
|
|
2204
|
+
"bg-white": I >= ue.value.length - 1
|
|
2205
|
+
},
|
|
2206
|
+
"w-[2px] h-full"
|
|
2207
|
+
])
|
|
2208
|
+
}, null, 2)
|
|
2209
|
+
])
|
|
2210
|
+
]),
|
|
2211
|
+
o("div", qs, [
|
|
2212
|
+
F(H, {
|
|
2213
|
+
variant: "outlined",
|
|
2214
|
+
class: "py-12 px-16"
|
|
2215
|
+
}, {
|
|
2216
|
+
default: oe(() => [
|
|
2217
|
+
o("div", Ts, [
|
|
2218
|
+
(g(!0), N(ne, null, ve(j.info, (J, ge) => (g(), N("div", {
|
|
2219
|
+
key: ge,
|
|
2220
|
+
class: "flex flex-col gap-4"
|
|
2221
|
+
}, [
|
|
2222
|
+
o("div", Ps, k(J == null ? void 0 : J.label), 1),
|
|
2223
|
+
o("div", Is, [
|
|
2224
|
+
(g(!0), N(ne, null, ve(J == null ? void 0 : J.values, (_e, xe) => (g(), N("div", {
|
|
2225
|
+
key: xe,
|
|
2226
|
+
class: "fm-typo-en-body-lg-600"
|
|
2227
|
+
}, [
|
|
2228
|
+
typeof _e == "string" ? (g(), N(ne, { key: 0 }, [
|
|
2229
|
+
Ve(k(_e), 1)
|
|
2230
|
+
], 64)) : (g(), ie(xt(_e), { key: 1 }))
|
|
2231
|
+
]))), 128))
|
|
2232
|
+
])
|
|
2233
|
+
]))), 128))
|
|
2234
|
+
])
|
|
2235
|
+
]),
|
|
2236
|
+
_: 2
|
|
2237
|
+
}, 1024)
|
|
2238
|
+
])
|
|
2239
|
+
])
|
|
2240
|
+
], 64))), 128))
|
|
2241
|
+
])) : (g(), N("div", hs, [
|
|
2242
|
+
F(V),
|
|
2243
|
+
o("div", null, [
|
|
2244
|
+
o("img", {
|
|
2245
|
+
src: R(qt),
|
|
2246
|
+
alt: "List is empty"
|
|
2247
|
+
}, null, 8, bs)
|
|
2248
|
+
]),
|
|
2249
|
+
o("div", gs, k(R(v)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
|
|
2250
|
+
o("div", _s, k(R(v)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
|
|
2251
|
+
F(V),
|
|
2252
|
+
F(V)
|
|
2253
|
+
]))
|
|
2254
|
+
])) : U("", !0)
|
|
2255
|
+
])
|
|
2256
|
+
];
|
|
2257
|
+
}),
|
|
2258
|
+
"side-sheet-footer": oe(() => [
|
|
2259
|
+
o("div", Fs, [
|
|
2260
|
+
(g(!0), N(ne, null, ve(q.value, (K) => (g(), N(ne, null, [
|
|
2261
|
+
R(Me)[K].available != !1 ? (g(), ie(X, {
|
|
2262
|
+
key: K,
|
|
2263
|
+
label: R(v)(R(Me)[K].translationKey),
|
|
2264
|
+
onClick: (de) => le(K),
|
|
2265
|
+
loading: s.value === K,
|
|
2266
|
+
disabled: s.value !== K && d.value,
|
|
2267
|
+
variant: R(Me)[K].buttonVariant
|
|
2268
|
+
}, null, 8, ["label", "onClick", "loading", "disabled", "variant"])) : U("", !0)
|
|
2269
|
+
], 64))), 256)),
|
|
2270
|
+
R(S).ableToMarkReceived(r.purchaseOrder) && !q.value.includes("completeReceive") ? (g(), ie(X, {
|
|
2271
|
+
key: 0,
|
|
2272
|
+
label: R(v)("inventory.transfer.receiveRequest.actions.completeReceive"),
|
|
2273
|
+
onClick: f[1] || (f[1] = (K) => le("completeReceive")),
|
|
2274
|
+
loading: s.value === "completeReceive",
|
|
2275
|
+
disabled: s.value !== "completeReceive" && d.value
|
|
2276
|
+
}, null, 8, ["label", "loading", "disabled"])) : U("", !0),
|
|
2277
|
+
R(S).ableToMarkApproved(r.purchaseOrder) && r.canApprove && !q.value.includes("approveRequest") ? (g(), ie(X, {
|
|
2278
|
+
key: 1,
|
|
2279
|
+
label: R(v)("inventory.transfer.approval.actions.approveRequest"),
|
|
2280
|
+
onClick: f[2] || (f[2] = (K) => le("approveRequest")),
|
|
2281
|
+
loading: s.value === "approveRequest",
|
|
2282
|
+
disabled: s.value !== "approveRequest" && d.value
|
|
2283
|
+
}, null, 8, ["label", "loading", "disabled"])) : U("", !0),
|
|
2284
|
+
R(S).ableToCreateFulfillment(r.purchaseOrder, r.poRequest) && a.scope === "approval" ? (g(), ie(X, {
|
|
2285
|
+
key: 2,
|
|
2286
|
+
label: R(v)("inventory.transfer.receiveRequest.actions.processRequest"),
|
|
2287
|
+
onClick: f[3] || (f[3] = (K) => le("processRequest")),
|
|
2288
|
+
loading: s.value === "processRequest",
|
|
2289
|
+
disabled: s.value !== "processRequest" && d.value
|
|
2290
|
+
}, null, 8, ["label", "loading", "disabled"])) : U("", !0),
|
|
2291
|
+
F(X, {
|
|
2292
|
+
label: R(v)("common.close"),
|
|
2293
|
+
variant: "tertiary",
|
|
2294
|
+
onClick: f[4] || (f[4] = (K) => _("update:show", !1))
|
|
2295
|
+
}, null, 8, ["label"])
|
|
2296
|
+
])
|
|
2297
|
+
]),
|
|
2298
|
+
_: 1
|
|
2299
|
+
}, 8, ["header", "modelValue", "dismiss-away"]);
|
|
2300
|
+
};
|
|
2301
|
+
}
|
|
2302
|
+
});
|
|
2303
|
+
export {
|
|
2304
|
+
Ge as P,
|
|
2305
|
+
Ys as _,
|
|
2306
|
+
Hs as a,
|
|
2307
|
+
Ws as b,
|
|
2308
|
+
Bt as g,
|
|
2309
|
+
Ee as u
|
|
2310
|
+
};
|