@feedmepos/mf-inventory-portal 1.2.12-dev.1 → 1.2.12-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-DAWBJNxz.js → App-D5hXQpVn.js} +1 -1
- package/dist/{ApprovalView-B2WUwSN4.js → ApprovalView-B__WDklZ.js} +2 -2
- package/dist/{BindingsDialog-C3OOcB8g.js → BindingsDialog-DXdwRSnn.js} +2 -2
- package/dist/{BindingsPicker-R3Zz0fWB.js → BindingsPicker-CqAD3aHc.js} +1 -1
- package/dist/{BindingsTable-B46C8p7M.js → BindingsTable-DVNjpusl.js} +1 -1
- package/dist/{ClosingDraftView-a_QhmaM4.js → ClosingDraftView-DL678GBB.js} +2 -2
- package/dist/{ClosingTemplateView-CEVmIsVw.js → ClosingTemplateView-DThiXLtp.js} +3 -3
- package/dist/{DeliveryOrderPrintPreview-BeQFF6sn.js → DeliveryOrderPrintPreview-B2MB9S6a.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DIG9NwPj.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BNxs6Bcr.js} +3 -3
- package/dist/{FmMultiselectDialog-BunyF2O-.js → FmMultiselectDialog-B45ZLjVp.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-Bx0dzfHO.js → FmUnitInput.vue_vue_type_script_setup_true_lang-D8ks6AEM.js} +1 -1
- package/dist/ImportView-EXm_g_jD.js +1303 -0
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-CfwprwJN.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-C5zIvG2h.js} +1 -1
- package/dist/{IngredientGroupView-CIPTj0hf.js → IngredientGroupView-D95dFXIZ.js} +2 -2
- package/dist/{IngredientsView-BwBaeLtw.js → IngredientsView-MF1USuZI.js} +8 -8
- package/dist/{IntegrationView-CvRD-5O6.js → IntegrationView-9m3N_9lW.js} +3 -3
- package/dist/{InventoryBindingForm-DLQTH1di.js → InventoryBindingForm-kLoQskao.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-XvIklIYw.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-BytErBcK.js} +3 -3
- package/dist/{InventoryBindingSummary-BGFSPQIw.js → InventoryBindingSummary-Dg0FH7ad.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-B3J0i5IU.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BKrUNLuG.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CyMRTB5L.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BL1f817e.js} +1 -1
- package/dist/{PublishView-7g0bx6KO.js → PublishView-BcOHSAj3.js} +1 -1
- package/dist/{PurchaseOrderPrintPreview-LEfLcjkd.js → PurchaseOrderPrintPreview-UfF8RVkv.js} +1 -1
- package/dist/{ReceiveRequestView-DUNfHRGf.js → ReceiveRequestView-D_y_xNUb.js} +8 -8
- package/dist/{RecipeView-XzqGQg_a.js → RecipeView-DOaU9GIF.js} +3 -3
- package/dist/{StockView-vZr9etBj.js → StockView-ciU6aAV7.js} +7 -7
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-3_csD6uU.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-XwDTGpR-.js} +1 -1
- package/dist/{SupplierView-CUORFWJW.js → SupplierView-DFwtALPg.js} +4 -4
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CdA5_lEz.js +3221 -0
- package/dist/{TransferTemplateView-DeliKkYY.js → TransferTemplateView-BXr_GqTi.js} +7 -7
- package/dist/{UnitView-B4NCl6jJ.js → UnitView-CAXHvh3n.js} +3 -3
- package/dist/{WarehouseView-jLGGlnwV.js → WarehouseView-BYd0bPhi.js} +1 -1
- package/dist/api/purchase-order.d.ts +1 -0
- package/dist/{app-DJcCTZjT.js → app-Bb0-8bRg.js} +7962 -7669
- package/dist/app.d.ts +252 -0
- package/dist/app.js +1 -1
- package/dist/{closing-template-hM43IpP-.js → closing-template-DPVNEyI7.js} +1 -1
- package/dist/{decimal-BVu2HlCS.js → decimal-BdBZYISm.js} +1 -1
- package/dist/{format-unit-display-C-M_AirC.js → format-unit-display-DlmCwWo_.js} +3 -3
- package/dist/{import-export.helper-C05Vl6i-.js → import-export.helper-B04wszRI.js} +1 -1
- package/dist/{index-v6hU4gAy.js → index-CKFmV1Pk.js} +1 -1
- package/dist/{index-CNQtmSfJ.js → index-CqBKFj1B.js} +1 -1
- package/dist/{purchase-order-template-BBCEFnbo.js → purchase-order-template-CLtEYr5E.js} +1 -1
- package/dist/{stock-CK3LBQmj.js → stock-nHQhfe2W.js} +1 -1
- package/dist/stores/feature.d.ts +2 -0
- package/dist/{supplier-CoCAyG12.js → supplier-DuOjLpOa.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-DYfpyC4u.js → use-ingredient-select-dialog-B-11Eqlm.js} +1 -1
- package/dist/{use-inventory-binding-dialog-CDwm6TPx.js → use-inventory-binding-dialog-DhLSdRtp.js} +1 -1
- package/dist/views/receive-request/components/delivery-order-form/SystemTrailDialog.vue.d.ts +17 -0
- package/package.json +3 -3
- package/dist/ImportView-CwBeBbXz.js +0 -1220
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DhXoNkss.js +0 -3057
|
@@ -1,3057 +0,0 @@
|
|
|
1
|
-
import { a6 as mt, u as _e, aW as F, aX as Ge, aG as Z, c as Fe, b as We, ae as xt, ag as wt, ah as $t, aY as Rt, e as it, f as pt, a4 as rt, aZ as kt, ab as ft, Z as yt, l as ye, a9 as Dt, a_ as vt, al as je, h as qe, i as ct, j as me, D as ve, a$ as ht, b0 as bt, b1 as Ee, O as gt, a7 as Ue, a8 as ze, ad as Ve, Y as De, t as ut, aE as Te, b2 as Qe, b3 as ke } from "./app-DJcCTZjT.js";
|
|
2
|
-
import { ref as Y, computed as H, h as P, defineComponent as Se, reactive as Nt, onMounted as _t, resolveComponent as G, openBlock as f, createBlock as le, withCtx as X, createElementVNode as e, createVNode as I, unref as h, createElementBlock as x, toDisplayString as _, createCommentVNode as M, Fragment as ue, renderList as be, createTextVNode as Ne, normalizeClass as Be, watch as Ct, isRef as At, resolveDynamicComponent as Tt } from "vue";
|
|
3
|
-
import { F as qt } from "./decimal-BVu2HlCS.js";
|
|
4
|
-
import { useCoreStore as Me, useI18n as st } from "@feedmepos/mf-common";
|
|
5
|
-
import { useDialog as Ye, useSnackbar as Pe, components as Ke, FmButtonVariant as fe, useProxiedModel as Ft } from "@feedmepos/ui-library";
|
|
6
|
-
import { a as Pt, u as It, P as Ce, f as Et } from "./format-unit-display-C-M_AirC.js";
|
|
7
|
-
import { E as Lt } from "./empty-placeholder-wf6-BWE8.js";
|
|
8
|
-
import { _ as Vt, F as Bt, a as Ut } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-Bx0dzfHO.js";
|
|
9
|
-
import { u as Mt, R as dt } from "./usePromise-CbVUCxhj.js";
|
|
10
|
-
import { u as jt } from "./index-v6hU4gAy.js";
|
|
11
|
-
const Ie = mt((g, r) => {
|
|
12
|
-
const o = _e(), p = Me();
|
|
13
|
-
return {
|
|
14
|
-
async readRequests(a, n, l) {
|
|
15
|
-
const s = a ?? o.currentLocationDBName, i = `${g.inventoryBackendUrl}/${s}/purchase-request`;
|
|
16
|
-
return n && l ? await r.get(`${i}?startDate=${n}&endDate=${l}`) : await r.get(i);
|
|
17
|
-
},
|
|
18
|
-
async readRequestById(a, n) {
|
|
19
|
-
const l = n ?? o.currentLocationDBName, s = `${g.inventoryBackendUrl}/${l}/purchase-request/${a}`;
|
|
20
|
-
return await r.get(s);
|
|
21
|
-
},
|
|
22
|
-
async readRequestByIds(a, n) {
|
|
23
|
-
const l = n ?? o.currentLocationDBName, s = `${g.inventoryBackendUrl}/${l}/purchase-request/find`;
|
|
24
|
-
return await r.post(s, { requestIds: a });
|
|
25
|
-
},
|
|
26
|
-
async getPurchaseOrders({
|
|
27
|
-
start: a,
|
|
28
|
-
end: n
|
|
29
|
-
}) {
|
|
30
|
-
const l = o.currentLocationDBName, s = `${g.inventoryBackendUrl}/${l}/purchase-order`;
|
|
31
|
-
return await r.get(`${s}?start=${a}&end=${n}`);
|
|
32
|
-
},
|
|
33
|
-
async getLatestPurchaseOrderRequest(a) {
|
|
34
|
-
const n = o.currentLocationDBName, l = `${g.inventoryBackendUrl}/${n}/purchase-request/find-by-purchase-order-id`;
|
|
35
|
-
return await r.get(`${l}/${a}`);
|
|
36
|
-
},
|
|
37
|
-
async getPurchaseOrderById(a) {
|
|
38
|
-
const n = o.currentLocationDBName, l = `${g.inventoryBackendUrl}/${n}/purchase-order`;
|
|
39
|
-
return await r.get(`${l}/${a}`);
|
|
40
|
-
},
|
|
41
|
-
/**
|
|
42
|
-
* @deprecated Use `processPurchaseOrderV2` instead.
|
|
43
|
-
*/
|
|
44
|
-
async processPurchaseOrder(a, n) {
|
|
45
|
-
const l = o.currentLocationDBName, s = n || l, i = `${g.inventoryBackendUrl}/${s}/purchase-order/run-operation`;
|
|
46
|
-
return await r.put(i, a);
|
|
47
|
-
},
|
|
48
|
-
async createPurchaseOrder(a) {
|
|
49
|
-
const n = o.currentLocationDBName, l = `${g.inventoryBackendUrl}/${n}/purchase-order`;
|
|
50
|
-
return await r.post(l, a);
|
|
51
|
-
},
|
|
52
|
-
async updatePurchaseOrder(a) {
|
|
53
|
-
const n = o.currentLocationDBName, l = `${g.inventoryBackendUrl}/${n}/purchase-order`;
|
|
54
|
-
return await r.put(l, a);
|
|
55
|
-
},
|
|
56
|
-
async importFromXilnex(a) {
|
|
57
|
-
const n = o.currentLocationDBName, l = `${g.inventoryBackendUrl}/${n}/purchase-order/import-from-xilnex`;
|
|
58
|
-
return await r.post(l, a);
|
|
59
|
-
},
|
|
60
|
-
async processPurchaseOrderV2(a, n) {
|
|
61
|
-
const l = o.currentLocationDBName, s = n || l, i = `${g.inventoryBackendUrl}/${s}/v2/purchase-order/run-operation`;
|
|
62
|
-
return await r.put(i, a);
|
|
63
|
-
},
|
|
64
|
-
async getWorkflowConfig() {
|
|
65
|
-
var s;
|
|
66
|
-
const n = `business_${(s = p.currentBusiness.value) == null ? void 0 : s._id}`, l = `${g.inventoryBackendUrl}/${n}/v2/purchase-order/workflow-config`;
|
|
67
|
-
return await r.get(l);
|
|
68
|
-
},
|
|
69
|
-
async updateDeliveryOrder(a) {
|
|
70
|
-
const n = o.currentLocationDBName, l = `${g.inventoryBackendUrl}/${n}/delivery-order`;
|
|
71
|
-
return await r.put(l, a);
|
|
72
|
-
},
|
|
73
|
-
async createDeliveryOrder(a) {
|
|
74
|
-
const n = o.currentLocationDBName, l = `${g.inventoryBackendUrl}/${n}/delivery-order`;
|
|
75
|
-
return await r.post(l, a);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
}), zt = mt((g, r) => {
|
|
79
|
-
const o = _e();
|
|
80
|
-
return {
|
|
81
|
-
async getShipments({
|
|
82
|
-
start: p,
|
|
83
|
-
end: a
|
|
84
|
-
}) {
|
|
85
|
-
const n = o.currentLocationDBName, l = `${g.inventoryBackendUrl}/${n}/shipments`;
|
|
86
|
-
return await r.get(`${l}?start=${p}&end=${a}`);
|
|
87
|
-
},
|
|
88
|
-
async getShipmentsByIds(p) {
|
|
89
|
-
if (p.length === 0)
|
|
90
|
-
return [];
|
|
91
|
-
const a = o.currentLocationDBName, n = `${g.inventoryBackendUrl}/${a}/shipments/get`;
|
|
92
|
-
return await r.post(n, { shipmentIds: p });
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
}), St = {
|
|
96
|
-
[F.enum.confirmDraft]: {
|
|
97
|
-
primaryActions: {
|
|
98
|
-
text: "Confirm draft",
|
|
99
|
-
close: !0
|
|
100
|
-
},
|
|
101
|
-
title: "Confirm draft?",
|
|
102
|
-
message: "Purchase order cannot be changed after confirm draft.",
|
|
103
|
-
successMessage: "Purchase order draft has been confirmed"
|
|
104
|
-
},
|
|
105
|
-
[F.enum.cancelDraft]: {
|
|
106
|
-
primaryActions: {
|
|
107
|
-
text: "Cancel draft",
|
|
108
|
-
close: !0,
|
|
109
|
-
variant: "destructive"
|
|
110
|
-
},
|
|
111
|
-
title: "Cancel draft?",
|
|
112
|
-
message: "Purchase order cannot be changed after cancelled draft.",
|
|
113
|
-
successMessage: "Purchase order draft has been cancelled"
|
|
114
|
-
},
|
|
115
|
-
[F.enum.submitRequest]: {
|
|
116
|
-
primaryActions: {
|
|
117
|
-
text: "Submit request",
|
|
118
|
-
close: !0
|
|
119
|
-
},
|
|
120
|
-
title: "Confirm draft?",
|
|
121
|
-
message: "Purchase order cannot be changed after confirm draft.",
|
|
122
|
-
successMessage: "Purchase order draft has been submitted"
|
|
123
|
-
},
|
|
124
|
-
[F.enum.completeReceive]: {
|
|
125
|
-
primaryActions: {
|
|
126
|
-
text: "Mark received",
|
|
127
|
-
close: !0
|
|
128
|
-
},
|
|
129
|
-
title: "Mark as received",
|
|
130
|
-
message: "Purchase order cannot be changed after it has complete receiving.",
|
|
131
|
-
successMessage: "Purchase order has been marked as received"
|
|
132
|
-
},
|
|
133
|
-
[F.enum.approveRequest]: {
|
|
134
|
-
primaryActions: {
|
|
135
|
-
text: "Accept request",
|
|
136
|
-
close: !0
|
|
137
|
-
},
|
|
138
|
-
title: "Accept request?",
|
|
139
|
-
message: "Transfer out request will be accepted.",
|
|
140
|
-
successMessage: "Transfer out request has been approved"
|
|
141
|
-
},
|
|
142
|
-
[F.enum.rejectRequest]: {
|
|
143
|
-
primaryActions: {
|
|
144
|
-
text: "Reject request",
|
|
145
|
-
close: !0,
|
|
146
|
-
variant: "destructive"
|
|
147
|
-
},
|
|
148
|
-
title: "Reject request?",
|
|
149
|
-
message: "Purchase order will be rejected.",
|
|
150
|
-
successMessage: "Purchase order has been rejected"
|
|
151
|
-
},
|
|
152
|
-
[F.enum.processRequest]: {
|
|
153
|
-
primaryActions: {
|
|
154
|
-
text: "Process request",
|
|
155
|
-
close: !0,
|
|
156
|
-
variant: "destructive"
|
|
157
|
-
},
|
|
158
|
-
title: "Process request?",
|
|
159
|
-
message: "Purchase order will be processed.",
|
|
160
|
-
successMessage: "Purchase order has been processed"
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
function He(g) {
|
|
164
|
-
return Ge.generatedPOReceivedMap({
|
|
165
|
-
purchaseOrder: g
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
function Kt(g) {
|
|
169
|
-
return Ge.validatePOItemReceivedStatus({
|
|
170
|
-
dto: g
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
function Je(g) {
|
|
174
|
-
return Ge.validatePOReceivedStatus({
|
|
175
|
-
receivedMap: g
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
function et(g, r, o) {
|
|
179
|
-
if (!Z.safeParse(g).success)
|
|
180
|
-
throw new Error(`Invalid purchase order status: ${g}`);
|
|
181
|
-
const p = Z.parse(g);
|
|
182
|
-
return Ge.orderStatusCombination({
|
|
183
|
-
status: p,
|
|
184
|
-
isPOPartialReceive: r,
|
|
185
|
-
isPOOverReceive: o
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
function Ot() {
|
|
189
|
-
const g = _e(), r = Ie(), o = Fe();
|
|
190
|
-
async function p(n, l) {
|
|
191
|
-
const s = g.currentLocationDBName;
|
|
192
|
-
return n.doc.supplier.internal && n.operation === F.enum.confirmDraft && (n.operation = F.enum.submitRequest), await r.processPurchaseOrder(n, l || s);
|
|
193
|
-
}
|
|
194
|
-
async function a(n, l) {
|
|
195
|
-
const s = g.currentLocationDBName;
|
|
196
|
-
return await r.processPurchaseOrderV2(n, l || s);
|
|
197
|
-
}
|
|
198
|
-
return (n) => o.useOperatePurchaseOrderV2 ? a(n.operateV2, n.transferTo) : p(n.operate, n.transferTo);
|
|
199
|
-
}
|
|
200
|
-
var tt = /* @__PURE__ */ ((g) => (g.RECEIVE_REQUEST = "receive/request", g.APPROVAL = "approval", g))(tt || {});
|
|
201
|
-
const Le = Y(), Xe = Y();
|
|
202
|
-
function bn(g, r) {
|
|
203
|
-
const o = Ye(), p = _e(), a = Fe();
|
|
204
|
-
We();
|
|
205
|
-
const n = Pt(), l = It(), s = Y(!1), i = Pe(), O = Ie(), $ = zt(), b = Y(new Array()), q = Y(new Array()), u = Y(
|
|
206
|
-
r != null && r.startDate && (r != null && r.endDate) ? r : xt()
|
|
207
|
-
), C = H(() => {
|
|
208
|
-
const V = new Date(u.value.startDate), B = new Date(u.value.endDate);
|
|
209
|
-
return {
|
|
210
|
-
start: wt(V).toISOString(),
|
|
211
|
-
end: $t(B).toISOString()
|
|
212
|
-
};
|
|
213
|
-
}), d = Y(new Array()), c = Rt(), y = Y(null);
|
|
214
|
-
async function R(V) {
|
|
215
|
-
function B(D) {
|
|
216
|
-
const S = {
|
|
217
|
-
mode: it.CREATE,
|
|
218
|
-
modelValue: V || void 0,
|
|
219
|
-
show: !0,
|
|
220
|
-
"onUpdate:show"(N) {
|
|
221
|
-
Le.value.show = N;
|
|
222
|
-
},
|
|
223
|
-
templateId: D,
|
|
224
|
-
lastClosingDate: y.value
|
|
225
|
-
};
|
|
226
|
-
Le.value = S;
|
|
227
|
-
}
|
|
228
|
-
let se;
|
|
229
|
-
a.mustUsePoTemplate && !(V != null && V.template) ? o.open({
|
|
230
|
-
title: "Create transfer",
|
|
231
|
-
message: "",
|
|
232
|
-
primaryActions: {
|
|
233
|
-
text: "Select a template",
|
|
234
|
-
close: !0
|
|
235
|
-
},
|
|
236
|
-
secondaryActions: {
|
|
237
|
-
text: "Outlet to Outlet",
|
|
238
|
-
variant: "secondary",
|
|
239
|
-
close: !0
|
|
240
|
-
}
|
|
241
|
-
}).onPrimary(async () => {
|
|
242
|
-
se = await n.getTemplateId(), se && B(se);
|
|
243
|
-
}).onSecondary(() => {
|
|
244
|
-
B(void 0);
|
|
245
|
-
}) : B(se);
|
|
246
|
-
}
|
|
247
|
-
function k(V) {
|
|
248
|
-
const B = {
|
|
249
|
-
mode: it.UPDATE,
|
|
250
|
-
modelValue: pt(V),
|
|
251
|
-
show: !0,
|
|
252
|
-
"onUpdate:show"(se) {
|
|
253
|
-
Le.value.show = se;
|
|
254
|
-
},
|
|
255
|
-
lastClosingDate: y.value
|
|
256
|
-
};
|
|
257
|
-
Le.value = B;
|
|
258
|
-
}
|
|
259
|
-
async function z() {
|
|
260
|
-
b.value = [], q.value = [], s.value = !0;
|
|
261
|
-
try {
|
|
262
|
-
const V = await O.getPurchaseOrders(C.value);
|
|
263
|
-
b.value = V.sort((t, m) => m._id.localeCompare(t._id));
|
|
264
|
-
const B = V.flatMap((t) => t.shipmentIds || []).filter(Boolean), se = B.length > 0 ? await $.getShipmentsByIds(B) : [];
|
|
265
|
-
q.value = se;
|
|
266
|
-
const D = await c.readCurrentLocationLastClosing(!0), S = D == null ? void 0 : D._id;
|
|
267
|
-
S && (y.value = kt(S)), await a.awaitFeatureLoaded(() => a.mustUsePoTemplate) && await l.fetchTemplates();
|
|
268
|
-
const N = b.value.map((t) => {
|
|
269
|
-
var m;
|
|
270
|
-
return ((m = t.request) == null ? void 0 : m.id) ?? "";
|
|
271
|
-
}).filter((t) => t);
|
|
272
|
-
d.value = await O.readRequestByIds(N);
|
|
273
|
-
} catch {
|
|
274
|
-
i.open({
|
|
275
|
-
title: "Something went wrong",
|
|
276
|
-
message: "Error at fetching purchase orders",
|
|
277
|
-
type: "error"
|
|
278
|
-
});
|
|
279
|
-
} finally {
|
|
280
|
-
s.value = !1;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
async function T() {
|
|
284
|
-
d.value = [], s.value = !0;
|
|
285
|
-
try {
|
|
286
|
-
d.value = await O.readRequests(
|
|
287
|
-
void 0,
|
|
288
|
-
C.value.start,
|
|
289
|
-
C.value.end
|
|
290
|
-
).then((V) => V.reverse());
|
|
291
|
-
} catch {
|
|
292
|
-
i.open({
|
|
293
|
-
title: "Something went wrong",
|
|
294
|
-
message: "Error at fetching purchase requests",
|
|
295
|
-
type: "error"
|
|
296
|
-
});
|
|
297
|
-
} finally {
|
|
298
|
-
s.value = !1;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
function K() {
|
|
302
|
-
switch (g) {
|
|
303
|
-
case "receive/request":
|
|
304
|
-
return z();
|
|
305
|
-
case "approval":
|
|
306
|
-
return T();
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
function J(V, B) {
|
|
310
|
-
u.value = {
|
|
311
|
-
startDate: V,
|
|
312
|
-
endDate: B
|
|
313
|
-
}, K();
|
|
314
|
-
}
|
|
315
|
-
p.watchLocation(async (V) => {
|
|
316
|
-
if (!V) {
|
|
317
|
-
b.value = [];
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
await K();
|
|
321
|
-
});
|
|
322
|
-
const oe = Y(), ce = Y(Math.random().toString());
|
|
323
|
-
async function Oe(V, B) {
|
|
324
|
-
const se = Math.random().toString();
|
|
325
|
-
ce.value = se, B ?? (B = d.value.computeFirst(
|
|
326
|
-
(N) => N.purchaseOrderId === V._id ? N : null
|
|
327
|
-
) ?? void 0);
|
|
328
|
-
const D = g === "receive/request" ? p.currentLocation : B == null ? void 0 : B.to, S = {
|
|
329
|
-
poRequest: B,
|
|
330
|
-
purchaseOrder: V,
|
|
331
|
-
transferTo: D == null ? void 0 : D.name,
|
|
332
|
-
transferToDbName: D == null ? void 0 : D.dbName,
|
|
333
|
-
show: !0,
|
|
334
|
-
canResubmit: !1,
|
|
335
|
-
canApprove: g === "approval",
|
|
336
|
-
"onUpdate:show"(N) {
|
|
337
|
-
oe.value.show = N;
|
|
338
|
-
},
|
|
339
|
-
scope: g,
|
|
340
|
-
receivedMap: He(V) ?? {},
|
|
341
|
-
shipments: q.value
|
|
342
|
-
};
|
|
343
|
-
oe.value = S;
|
|
344
|
-
}
|
|
345
|
-
async function ge(V, B, se, D) {
|
|
346
|
-
const S = Ot();
|
|
347
|
-
s.value = !0;
|
|
348
|
-
try {
|
|
349
|
-
await S({
|
|
350
|
-
operate: {
|
|
351
|
-
operation: B,
|
|
352
|
-
doc: V,
|
|
353
|
-
options: (
|
|
354
|
-
// auto receive for supplier to warehouse
|
|
355
|
-
(B === F.enum.confirmDraft || // auto receive for warehouse to warehouse
|
|
356
|
-
B === F.enum.completeReceive) && a.autoReceiveWarehouse ? {
|
|
357
|
-
autoReceive: !0
|
|
358
|
-
} : void 0
|
|
359
|
-
)
|
|
360
|
-
},
|
|
361
|
-
operateV2: {
|
|
362
|
-
_id: V._id,
|
|
363
|
-
_rev: V._rev ?? "",
|
|
364
|
-
action: B,
|
|
365
|
-
payloads: []
|
|
366
|
-
},
|
|
367
|
-
transferTo: D
|
|
368
|
-
}), await new Promise((m) => setTimeout(m, 1e3));
|
|
369
|
-
const t = _e().currentLocationDBName.startsWith("restaurant_");
|
|
370
|
-
B === F.enum.confirmDraft && V.effectiveAt && t ? i.open({
|
|
371
|
-
title: "Success",
|
|
372
|
-
message: `${se}. The backdate will be reflected once your POS has received this change.`,
|
|
373
|
-
type: "success"
|
|
374
|
-
}) : i.open({
|
|
375
|
-
title: "Success",
|
|
376
|
-
message: se,
|
|
377
|
-
type: "success"
|
|
378
|
-
});
|
|
379
|
-
} catch (N) {
|
|
380
|
-
i.open({
|
|
381
|
-
title: "Something went wrong",
|
|
382
|
-
message: "Please try again.",
|
|
383
|
-
type: "error"
|
|
384
|
-
}), console.error("Error when submitting PO operation", B, V, N);
|
|
385
|
-
} finally {
|
|
386
|
-
s.value = !1, K();
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
async function xe(V, B, se) {
|
|
390
|
-
const D = St[B];
|
|
391
|
-
if (!D) {
|
|
392
|
-
i.open({
|
|
393
|
-
title: "Something went wrong",
|
|
394
|
-
message: `Cannot process order: ${rt(B)}`,
|
|
395
|
-
type: "error"
|
|
396
|
-
});
|
|
397
|
-
return;
|
|
398
|
-
}
|
|
399
|
-
const { successMessage: S, ...N } = D;
|
|
400
|
-
o.open({
|
|
401
|
-
title: N.title,
|
|
402
|
-
message: N.message,
|
|
403
|
-
primaryActions: N.primaryActions
|
|
404
|
-
}).onPrimary(() => {
|
|
405
|
-
ge(V, B, S, se);
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
async function he() {
|
|
409
|
-
o.open({
|
|
410
|
-
title: "Upload Transfer",
|
|
411
|
-
primaryActions: {
|
|
412
|
-
text: "Xilnex transfer note",
|
|
413
|
-
close: !0
|
|
414
|
-
},
|
|
415
|
-
secondaryActions: {
|
|
416
|
-
text: "Cancel",
|
|
417
|
-
close: !0
|
|
418
|
-
}
|
|
419
|
-
}).onPrimary(() => {
|
|
420
|
-
const V = {
|
|
421
|
-
show: !0,
|
|
422
|
-
"onUpdate:show"(B) {
|
|
423
|
-
Xe.value.show = B;
|
|
424
|
-
}
|
|
425
|
-
};
|
|
426
|
-
Xe.value = V;
|
|
427
|
-
});
|
|
428
|
-
}
|
|
429
|
-
return {
|
|
430
|
-
purchaseOrders: b,
|
|
431
|
-
shipments: q,
|
|
432
|
-
purchaseRequests: d,
|
|
433
|
-
updateDateRange: J,
|
|
434
|
-
fetchData: K,
|
|
435
|
-
loading: s,
|
|
436
|
-
transferDialogProps: Le,
|
|
437
|
-
promptCreateTransferDialog: R,
|
|
438
|
-
promptUpdateTransferDialog: k,
|
|
439
|
-
transferDetailsProps: oe,
|
|
440
|
-
promptShowTransferDetails: Oe,
|
|
441
|
-
submitAction: xe,
|
|
442
|
-
xilnexImportDialogProps: Xe,
|
|
443
|
-
promptUploadTransferDialog: he
|
|
444
|
-
};
|
|
445
|
-
}
|
|
446
|
-
function Ht(g, r) {
|
|
447
|
-
return r.reduce(
|
|
448
|
-
(p, a) => {
|
|
449
|
-
const n = a.received.find((l) => l.sku._id === g._id);
|
|
450
|
-
return n && (p = ft(p, n.amount)), p;
|
|
451
|
-
},
|
|
452
|
-
qt.toPrecision(yt(0), g.unit.precision)
|
|
453
|
-
);
|
|
454
|
-
}
|
|
455
|
-
function Gt(g) {
|
|
456
|
-
const { po: r, currentLocation: o, business: p, fulfilling: a, por: n } = g, { name: l, address: s, regNo: i } = o.doc.profile, O = {
|
|
457
|
-
name: l,
|
|
458
|
-
registrationNumber: i,
|
|
459
|
-
line1: s == null ? void 0 : s.line1,
|
|
460
|
-
line2: s == null ? void 0 : s.line2,
|
|
461
|
-
postcode: s == null ? void 0 : s.postcode,
|
|
462
|
-
city: s == null ? void 0 : s.city,
|
|
463
|
-
state: s == null ? void 0 : s.state,
|
|
464
|
-
country: s == null ? void 0 : s.country
|
|
465
|
-
}, $ = {
|
|
466
|
-
name: r.supplier.name,
|
|
467
|
-
phoneNumber: r.supplier.phoneNumber,
|
|
468
|
-
registrationNumber: r.supplier.registrationNumber,
|
|
469
|
-
line1: r.supplier.address.line1,
|
|
470
|
-
line2: r.supplier.address.line2,
|
|
471
|
-
postcode: r.supplier.address.postcode,
|
|
472
|
-
city: r.supplier.address.city,
|
|
473
|
-
state: r.supplier.address.state,
|
|
474
|
-
country: r.supplier.address.country
|
|
475
|
-
}, b = r.items.map((k) => {
|
|
476
|
-
const { sku: z, measurement: T } = k, K = ye(
|
|
477
|
-
Ht(k.sku, r.deliveryOrder || []),
|
|
478
|
-
!1
|
|
479
|
-
);
|
|
480
|
-
return {
|
|
481
|
-
code: z.code,
|
|
482
|
-
description: z.name,
|
|
483
|
-
quantity: ye(k.quantity, !1),
|
|
484
|
-
unit: (T == null ? void 0 : T.abbrev) || z.unit.abbrev,
|
|
485
|
-
received: K,
|
|
486
|
-
cost: k.totalCost ? `${k.totalCost.currency} ${Dt.toFormatString({
|
|
487
|
-
value: k.totalCost
|
|
488
|
-
})}` : void 0
|
|
489
|
-
};
|
|
490
|
-
}), q = r.deliveryOrder.map((k) => ({
|
|
491
|
-
createdAt: vt(new Date(k.createdAt)),
|
|
492
|
-
ref: k.deliveryOrderNumber,
|
|
493
|
-
remark: k.remark || "",
|
|
494
|
-
items: k.received.map((z) => {
|
|
495
|
-
var T;
|
|
496
|
-
return {
|
|
497
|
-
code: z.sku.code,
|
|
498
|
-
description: z.sku.name,
|
|
499
|
-
quantity: ye(z.amount),
|
|
500
|
-
unit: ((T = z.measurement) == null ? void 0 : T.abbrev) || z.sku.unit.abbrev
|
|
501
|
-
};
|
|
502
|
-
})
|
|
503
|
-
})), u = [
|
|
504
|
-
// Production
|
|
505
|
-
"67ca5d2c80bd0e001c5bf5bc",
|
|
506
|
-
// Dev
|
|
507
|
-
"6880b36a3054c5001db19218"
|
|
508
|
-
];
|
|
509
|
-
let C = "Inventory Receive Note";
|
|
510
|
-
if (r.supplier.internal ? (C = "Inventory Transfer Note", u.includes((p == null ? void 0 : p._id) || "") && (C = "Stock Request")) : C = "Purchase Order", n) {
|
|
511
|
-
const k = n.from.dbName;
|
|
512
|
-
o.dbName === k || (C = "Inventory Receive Note");
|
|
513
|
-
}
|
|
514
|
-
const c = {
|
|
515
|
-
title: C,
|
|
516
|
-
businessName: p == null ? void 0 : p.name,
|
|
517
|
-
logo: p == null ? void 0 : p.thumbnail,
|
|
518
|
-
orderNumber: r.seqNumber.toString(),
|
|
519
|
-
createdAt: je(r._id),
|
|
520
|
-
ref: r.ref || "",
|
|
521
|
-
remark: r.remark || "",
|
|
522
|
-
buyer: O,
|
|
523
|
-
supplier: $,
|
|
524
|
-
items: b,
|
|
525
|
-
status: r.status,
|
|
526
|
-
deliveryOrders: q
|
|
527
|
-
}, y = new URL(window.location.href), R = a && (r.deliveryFullfillment || []).length > 0 ? "receive-request/delivery-print-preview" : "receive-request/print-preview";
|
|
528
|
-
y.pathname = y.hostname.includes("portal.feedme") ? `/inventory/${R}` : `/${R}`, y.searchParams.append("data", JSON.stringify(c)), window.open(y.href, "_blank", "noreferrer");
|
|
529
|
-
}
|
|
530
|
-
const Ae = {
|
|
531
|
-
submitRequest: {
|
|
532
|
-
translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
|
|
533
|
-
color: "text-fm-color-typo-primary",
|
|
534
|
-
value: F.enum.submitRequest
|
|
535
|
-
},
|
|
536
|
-
confirmDraft: {
|
|
537
|
-
translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
|
|
538
|
-
color: "text-fm-color-typo-primary",
|
|
539
|
-
value: F.enum.confirmDraft
|
|
540
|
-
},
|
|
541
|
-
cancelDraft: {
|
|
542
|
-
translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
|
|
543
|
-
color: "text-fm-color-typo-error",
|
|
544
|
-
value: F.enum.cancelDraft
|
|
545
|
-
},
|
|
546
|
-
approveRequest: {
|
|
547
|
-
translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
|
|
548
|
-
color: "text-fm-color-typo-primary",
|
|
549
|
-
value: F.enum.approveRequest
|
|
550
|
-
},
|
|
551
|
-
rejectRequest: {
|
|
552
|
-
translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
|
|
553
|
-
color: "text-fm-color-typo-error",
|
|
554
|
-
value: F.enum.rejectRequest
|
|
555
|
-
},
|
|
556
|
-
processRequest: {
|
|
557
|
-
translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
|
|
558
|
-
color: "text-fm-color-typo-primary",
|
|
559
|
-
value: F.enum.processRequest
|
|
560
|
-
},
|
|
561
|
-
receiveStock: {
|
|
562
|
-
translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
|
|
563
|
-
color: "text-fm-color-typo-primary",
|
|
564
|
-
value: F.enum.receiveStock
|
|
565
|
-
},
|
|
566
|
-
completeReceive: {
|
|
567
|
-
translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
|
|
568
|
-
color: "text-fm-color-typo-primary",
|
|
569
|
-
value: F.enum.completeReceive
|
|
570
|
-
},
|
|
571
|
-
closeRequest: {
|
|
572
|
-
translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
|
|
573
|
-
color: "system-error-300",
|
|
574
|
-
value: F.enum.closeRequest
|
|
575
|
-
},
|
|
576
|
-
approveDraft: {
|
|
577
|
-
translationKey: "",
|
|
578
|
-
color: "",
|
|
579
|
-
value: void 0
|
|
580
|
-
},
|
|
581
|
-
rejectDraft: {
|
|
582
|
-
translationKey: "",
|
|
583
|
-
color: "",
|
|
584
|
-
value: void 0
|
|
585
|
-
},
|
|
586
|
-
returnStock: {
|
|
587
|
-
translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
|
|
588
|
-
color: "text-fm-color-typo-primary",
|
|
589
|
-
value: F.enum.returnStock
|
|
590
|
-
}
|
|
591
|
-
};
|
|
592
|
-
function gn(g, r, o) {
|
|
593
|
-
const p = _e(), a = We(), n = Me(), { t: l } = st();
|
|
594
|
-
function s(u) {
|
|
595
|
-
switch (u.status) {
|
|
596
|
-
case "DRAFT":
|
|
597
|
-
return [
|
|
598
|
-
ve[me.Update],
|
|
599
|
-
ve[me.Details],
|
|
600
|
-
u.supplier.internal === "restaurant" || u.supplier.internal === "warehouse" ? Ae[F.enum.submitRequest] : Ae[F.enum.confirmDraft],
|
|
601
|
-
Ae[F.enum.cancelDraft]
|
|
602
|
-
];
|
|
603
|
-
case "RECEIVING":
|
|
604
|
-
return [
|
|
605
|
-
Ae[F.enum.completeReceive],
|
|
606
|
-
ve[me.Details],
|
|
607
|
-
ve[me.Print]
|
|
608
|
-
];
|
|
609
|
-
case "REQUESTING":
|
|
610
|
-
return g === "receive/request" ? [ve[me.Details], ve[me.Print]] : [
|
|
611
|
-
Ae[F.enum.approveRequest],
|
|
612
|
-
Ae[F.enum.rejectRequest],
|
|
613
|
-
ve[me.Details]
|
|
614
|
-
// DefaultRowActions[RowActionEnum.Print]
|
|
615
|
-
];
|
|
616
|
-
case "PROCESSING":
|
|
617
|
-
return [ve[me.Details], ve[me.Print]];
|
|
618
|
-
case "COMPLETE":
|
|
619
|
-
case "CANCEL":
|
|
620
|
-
default:
|
|
621
|
-
return [ve[me.Details], ve[me.Print]];
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
function i(u) {
|
|
625
|
-
return Object.values(F.enum).includes(u);
|
|
626
|
-
}
|
|
627
|
-
async function O(u, C, d) {
|
|
628
|
-
var y, R, k, z, T, K;
|
|
629
|
-
const c = pt(C);
|
|
630
|
-
if (u === me.Print) {
|
|
631
|
-
const J = (d == null ? void 0 : d.toInventoryLocation) ?? p.currentLocation;
|
|
632
|
-
((y = d == null ? void 0 : d.netSuite) != null && y.refNo || (R = c.netSuite) != null && R.refNo) && (c.ref = [((k = d == null ? void 0 : d.netSuite) == null ? void 0 : k.refNo) || ((z = c.netSuite) == null ? void 0 : z.refNo)].filter((oe) => oe).join(" ")), Gt({
|
|
633
|
-
po: c,
|
|
634
|
-
currentLocation: J,
|
|
635
|
-
business: n.currentBusiness.value,
|
|
636
|
-
fulfilling: g === "approval",
|
|
637
|
-
por: d
|
|
638
|
-
});
|
|
639
|
-
return;
|
|
640
|
-
}
|
|
641
|
-
if (u === me.Details) {
|
|
642
|
-
r.promptShowTransferDetails(c, d);
|
|
643
|
-
return;
|
|
644
|
-
}
|
|
645
|
-
if (u === me.Update) {
|
|
646
|
-
(T = r.promptUpdateTransferDialog) == null || T.call(r, c);
|
|
647
|
-
return;
|
|
648
|
-
}
|
|
649
|
-
if (i(u)) {
|
|
650
|
-
r.submitAction(C, u, (K = d == null ? void 0 : d.to) == null ? void 0 : K.dbName);
|
|
651
|
-
return;
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
function $() {
|
|
655
|
-
var C;
|
|
656
|
-
const u = [
|
|
657
|
-
{
|
|
658
|
-
accessorKey: "seqNumber",
|
|
659
|
-
header: () => l("inventory.transfer.table.seqNo"),
|
|
660
|
-
enableSorting: !0,
|
|
661
|
-
size: 80,
|
|
662
|
-
sortUndefined: "last"
|
|
663
|
-
},
|
|
664
|
-
{
|
|
665
|
-
accessorKey: "_id",
|
|
666
|
-
header: () => l("inventory.transfer.table.createdAt"),
|
|
667
|
-
cell(d) {
|
|
668
|
-
return je(`${d.getValue()}`);
|
|
669
|
-
},
|
|
670
|
-
enableSorting: !0
|
|
671
|
-
},
|
|
672
|
-
{
|
|
673
|
-
accessorKey: "supplier.name",
|
|
674
|
-
header: () => l("inventory.transfer.table.transferFrom"),
|
|
675
|
-
enableSorting: !0,
|
|
676
|
-
size: 200
|
|
677
|
-
},
|
|
678
|
-
{
|
|
679
|
-
accessorKey: "items.length",
|
|
680
|
-
header: () => l("inventory.transfer.table.noOfItems"),
|
|
681
|
-
cell: (d) => {
|
|
682
|
-
const c = d.row.original.version || "1", y = d.getValue();
|
|
683
|
-
return P("div", { class: "flex items-center gap-2" }, [
|
|
684
|
-
y,
|
|
685
|
-
c !== "1" ? P(
|
|
686
|
-
"div",
|
|
687
|
-
{ class: "py-3" },
|
|
688
|
-
P(
|
|
689
|
-
qe,
|
|
690
|
-
P(
|
|
691
|
-
"div",
|
|
692
|
-
{
|
|
693
|
-
class: ["fm-status-badge", "fm-status-badge-draft"].join(" ")
|
|
694
|
-
},
|
|
695
|
-
`v${c}`
|
|
696
|
-
)
|
|
697
|
-
)
|
|
698
|
-
) : null
|
|
699
|
-
]);
|
|
700
|
-
},
|
|
701
|
-
enableSorting: !1,
|
|
702
|
-
meta: {
|
|
703
|
-
width: "10rem"
|
|
704
|
-
}
|
|
705
|
-
},
|
|
706
|
-
{
|
|
707
|
-
accessorKey: "ref",
|
|
708
|
-
header: () => l("inventory.transfer.table.reference"),
|
|
709
|
-
enableSorting: !1,
|
|
710
|
-
size: "auto"
|
|
711
|
-
},
|
|
712
|
-
...(C = n.sessionUser.value) != null && C.role.isAdmin ? [
|
|
713
|
-
{
|
|
714
|
-
id: "statusForAdmin",
|
|
715
|
-
header: () => P(qe, {}, () => `${l("inventory.transfer.table.status")}`),
|
|
716
|
-
cell(d) {
|
|
717
|
-
return d.row.original.status;
|
|
718
|
-
},
|
|
719
|
-
enableSorting: !0,
|
|
720
|
-
size: 200
|
|
721
|
-
}
|
|
722
|
-
] : [],
|
|
723
|
-
{
|
|
724
|
-
accessorKey: "status",
|
|
725
|
-
header: () => l("inventory.transfer.table.status"),
|
|
726
|
-
cell(d) {
|
|
727
|
-
const c = d.getValue(), y = He(d.row.original), { partial: R, over: k } = Je(y), z = et(c ?? "", R, k);
|
|
728
|
-
let T = l(`inventory.transfer.status.${z}`), K = `${c ?? ""}`.toLocaleLowerCase("en-us");
|
|
729
|
-
z === Z.enum.CLOSE && (T = `${l(`inventory.transfer.status.${Z.enum.COMPLETE}`)}`), z === "PARTIAL_RECEIVED" && K === Z.enum.PROCESSING.toLocaleLowerCase("en-us") && (K = Z.enum.RECEIVING.toLocaleLowerCase("en-us"));
|
|
730
|
-
let J = null;
|
|
731
|
-
const oe = o.value.find((ce) => ce.ref === d.row.original._id);
|
|
732
|
-
if (oe != null && oe.milestones && oe.milestones.length > 0) {
|
|
733
|
-
const ce = oe.milestones[oe.milestones.length - 1];
|
|
734
|
-
if (ce.estimatedTime) {
|
|
735
|
-
const Oe = new Date(ce.estimatedTime), ge = Oe.getDate().toString().padStart(2, "0");
|
|
736
|
-
J = `${Oe.toLocaleString("en-US", { month: "short" })} ${ge}`;
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
return P(
|
|
740
|
-
"div",
|
|
741
|
-
{
|
|
742
|
-
class: "flex"
|
|
743
|
-
},
|
|
744
|
-
[
|
|
745
|
-
P(
|
|
746
|
-
"div",
|
|
747
|
-
{ class: "flex items-center" },
|
|
748
|
-
P(
|
|
749
|
-
"div",
|
|
750
|
-
{
|
|
751
|
-
class: [
|
|
752
|
-
"fm-status-badge",
|
|
753
|
-
`fm-status-badge-${K}`,
|
|
754
|
-
k && "fm-status-badge-error"
|
|
755
|
-
].filter(Boolean).join(" ")
|
|
756
|
-
},
|
|
757
|
-
`${T}`
|
|
758
|
-
)
|
|
759
|
-
),
|
|
760
|
-
...J ? [
|
|
761
|
-
P(
|
|
762
|
-
"div",
|
|
763
|
-
{
|
|
764
|
-
class: "flex items-center gap-1 ml-2"
|
|
765
|
-
},
|
|
766
|
-
[
|
|
767
|
-
P(Ke.FmIcon, {
|
|
768
|
-
name: "local_shipping",
|
|
769
|
-
size: "md",
|
|
770
|
-
color: "neutral-gray-400"
|
|
771
|
-
}),
|
|
772
|
-
P(
|
|
773
|
-
"span",
|
|
774
|
-
{ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
|
|
775
|
-
J
|
|
776
|
-
)
|
|
777
|
-
]
|
|
778
|
-
)
|
|
779
|
-
] : []
|
|
780
|
-
]
|
|
781
|
-
);
|
|
782
|
-
},
|
|
783
|
-
enableSorting: !0,
|
|
784
|
-
size: 150
|
|
785
|
-
},
|
|
786
|
-
{
|
|
787
|
-
id: "action",
|
|
788
|
-
cell(d) {
|
|
789
|
-
const c = d.row.original, y = s(c);
|
|
790
|
-
return ct(y, (R) => O(R, c));
|
|
791
|
-
},
|
|
792
|
-
enableSorting: !1,
|
|
793
|
-
size: 40,
|
|
794
|
-
meta: {
|
|
795
|
-
cellClass: "",
|
|
796
|
-
headerClass: ""
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
];
|
|
800
|
-
if (a.isEnabled) {
|
|
801
|
-
const d = [
|
|
802
|
-
{
|
|
803
|
-
id: "netsuiteTransferOrder",
|
|
804
|
-
accessorFn: (c) => {
|
|
805
|
-
var y;
|
|
806
|
-
return (y = c.netSuite) != null && y.id ? `${c.netSuite.refNo} (${c.netSuite.id})` : "N/A";
|
|
807
|
-
},
|
|
808
|
-
header: () => "NetSuite Order (ID)",
|
|
809
|
-
cell(c) {
|
|
810
|
-
var R;
|
|
811
|
-
const y = c.row.original;
|
|
812
|
-
return (R = y.netSuite) != null && R.id ? `${y.netSuite.refNo} (${y.netSuite.id})` : "N/A";
|
|
813
|
-
},
|
|
814
|
-
enableSorting: !1,
|
|
815
|
-
size: 200,
|
|
816
|
-
meta: {
|
|
817
|
-
cellClass: "",
|
|
818
|
-
headerClass: ""
|
|
819
|
-
}
|
|
820
|
-
},
|
|
821
|
-
{
|
|
822
|
-
id: "netsuiteTransactionNumber",
|
|
823
|
-
accessorFn: (c) => {
|
|
824
|
-
var y, R;
|
|
825
|
-
return ((R = (y = c.netSuite) == null ? void 0 : y.additionalInfo) == null ? void 0 : R.transactionnumber) ?? "N/A";
|
|
826
|
-
},
|
|
827
|
-
header: () => "NetSuite Transaction No.",
|
|
828
|
-
cell(c) {
|
|
829
|
-
var R, k;
|
|
830
|
-
return ((k = (R = c.row.original.netSuite) == null ? void 0 : R.additionalInfo) == null ? void 0 : k.transactionnumber) ?? "N/A";
|
|
831
|
-
},
|
|
832
|
-
enableSorting: !1,
|
|
833
|
-
size: 200,
|
|
834
|
-
meta: {
|
|
835
|
-
cellClass: "",
|
|
836
|
-
headerClass: ""
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
];
|
|
840
|
-
u.splice(u.length - 1, 0, ...d);
|
|
841
|
-
}
|
|
842
|
-
return u;
|
|
843
|
-
}
|
|
844
|
-
function b() {
|
|
845
|
-
var C;
|
|
846
|
-
const u = [
|
|
847
|
-
{
|
|
848
|
-
accessorKey: "purchaseOrder.seqNumber",
|
|
849
|
-
header: () => l("inventory.transfer.table.seqNo"),
|
|
850
|
-
enableSorting: !0,
|
|
851
|
-
size: 80,
|
|
852
|
-
sortUndefined: "last"
|
|
853
|
-
},
|
|
854
|
-
{
|
|
855
|
-
accessorKey: "purchaseOrder._id",
|
|
856
|
-
header: () => l("inventory.transfer.table.createdAt"),
|
|
857
|
-
cell(d) {
|
|
858
|
-
return je(`${d.getValue()}`);
|
|
859
|
-
},
|
|
860
|
-
enableSorting: !0
|
|
861
|
-
},
|
|
862
|
-
{
|
|
863
|
-
accessorKey: "to.name",
|
|
864
|
-
header: () => l("inventory.transfer.table.transferTo"),
|
|
865
|
-
enableSorting: !1,
|
|
866
|
-
size: 200
|
|
867
|
-
},
|
|
868
|
-
{
|
|
869
|
-
accessorKey: "purchaseOrder.items.length",
|
|
870
|
-
header: () => l("inventory.transfer.table.noOfItems"),
|
|
871
|
-
enableSorting: !1
|
|
872
|
-
},
|
|
873
|
-
{
|
|
874
|
-
accessorKey: "purchaseOrder.ref",
|
|
875
|
-
header: () => l("inventory.transfer.table.reference"),
|
|
876
|
-
enableSorting: !1,
|
|
877
|
-
size: "auto"
|
|
878
|
-
},
|
|
879
|
-
...(C = n.sessionUser.value) != null && C.role.isAdmin ? [
|
|
880
|
-
{
|
|
881
|
-
id: "statusForAdmin",
|
|
882
|
-
header: () => P(qe, {}, () => `${l("inventory.transfer.table.status")}`),
|
|
883
|
-
cell(d) {
|
|
884
|
-
return d.row.original.status;
|
|
885
|
-
},
|
|
886
|
-
enableSorting: !0,
|
|
887
|
-
size: 200
|
|
888
|
-
}
|
|
889
|
-
] : [],
|
|
890
|
-
{
|
|
891
|
-
accessorKey: "purchaseOrder.status",
|
|
892
|
-
header: () => l("inventory.transfer.table.status"),
|
|
893
|
-
cell(d) {
|
|
894
|
-
const c = d.row.original, y = d.getValue();
|
|
895
|
-
if (!c.purchaseOrder)
|
|
896
|
-
return P(Ke.FmChip, {
|
|
897
|
-
label: "N/A",
|
|
898
|
-
compact: !0
|
|
899
|
-
});
|
|
900
|
-
const R = He(c.purchaseOrder), { partial: k, over: z } = Je(R), T = et(y ?? "", k, z);
|
|
901
|
-
let K = l(`inventory.transfer.status.${T}`), J = `${y ?? ""}`.toLocaleLowerCase("en-us");
|
|
902
|
-
return T === Z.enum.CLOSE && (K = `${l(`inventory.transfer.status.${Z.enum.COMPLETE}`)}`), T === "PARTIAL_RECEIVED" && J === Z.enum.PROCESSING.toLocaleLowerCase("en-us") && (J = Z.enum.RECEIVING.toLocaleLowerCase("en-us")), P(
|
|
903
|
-
"div",
|
|
904
|
-
{
|
|
905
|
-
class: "flex"
|
|
906
|
-
},
|
|
907
|
-
P(
|
|
908
|
-
"div",
|
|
909
|
-
{
|
|
910
|
-
class: [
|
|
911
|
-
"fm-status-badge",
|
|
912
|
-
`fm-status-badge-${J}`,
|
|
913
|
-
z && "fm-status-badge-error"
|
|
914
|
-
].filter(Boolean).join(" ")
|
|
915
|
-
},
|
|
916
|
-
`${K}`
|
|
917
|
-
)
|
|
918
|
-
);
|
|
919
|
-
},
|
|
920
|
-
enableSorting: !0
|
|
921
|
-
},
|
|
922
|
-
{
|
|
923
|
-
id: "action",
|
|
924
|
-
cell(d) {
|
|
925
|
-
const c = d.row.original, R = (c.purchaseOrder ? s(c.purchaseOrder) : []).map((k) => k.value === me.Print ? {
|
|
926
|
-
...k,
|
|
927
|
-
translationKey: "inventory.transfer.receiveRequest.details.printDeliveryOrder"
|
|
928
|
-
} : k);
|
|
929
|
-
return ct(
|
|
930
|
-
R,
|
|
931
|
-
(k) => c.purchaseOrder ? O(k, c.purchaseOrder, c) : void 0
|
|
932
|
-
);
|
|
933
|
-
},
|
|
934
|
-
enableSorting: !1,
|
|
935
|
-
size: 40,
|
|
936
|
-
meta: {
|
|
937
|
-
cellClass: "",
|
|
938
|
-
headerClass: ""
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
];
|
|
942
|
-
if (a.isEnabled) {
|
|
943
|
-
const d = [
|
|
944
|
-
{
|
|
945
|
-
id: "netsuiteTransferOrder",
|
|
946
|
-
accessorFn: (c) => {
|
|
947
|
-
var y;
|
|
948
|
-
return (y = c.netSuite) != null && y.id ? `${c.netSuite.refNo} (${c.netSuite.id})` : "N/A";
|
|
949
|
-
},
|
|
950
|
-
header: () => "NetSuite Order (ID)",
|
|
951
|
-
cell(c) {
|
|
952
|
-
var R;
|
|
953
|
-
const y = c.row.original;
|
|
954
|
-
return (R = y.netSuite) != null && R.id ? `${y.netSuite.refNo} (${y.netSuite.id})` : "N/A";
|
|
955
|
-
},
|
|
956
|
-
enableSorting: !1,
|
|
957
|
-
size: 200,
|
|
958
|
-
meta: {
|
|
959
|
-
cellClass: "",
|
|
960
|
-
headerClass: ""
|
|
961
|
-
}
|
|
962
|
-
},
|
|
963
|
-
{
|
|
964
|
-
id: "netsuiteTransactionNumber",
|
|
965
|
-
accessorFn: (c) => {
|
|
966
|
-
var y, R;
|
|
967
|
-
return ((R = (y = c.netSuite) == null ? void 0 : y.additionalInfo) == null ? void 0 : R.transactionnumber) ?? "N/A";
|
|
968
|
-
},
|
|
969
|
-
header: () => "NetSuite Transaction No.",
|
|
970
|
-
cell(c) {
|
|
971
|
-
var R, k;
|
|
972
|
-
return ((k = (R = c.row.original.netSuite) == null ? void 0 : R.additionalInfo) == null ? void 0 : k.transactionnumber) ?? "N/A";
|
|
973
|
-
},
|
|
974
|
-
enableSorting: !1,
|
|
975
|
-
size: 200,
|
|
976
|
-
meta: {
|
|
977
|
-
cellClass: "",
|
|
978
|
-
headerClass: ""
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
];
|
|
982
|
-
u.splice(u.length - 2, 0, ...d);
|
|
983
|
-
}
|
|
984
|
-
return u;
|
|
985
|
-
}
|
|
986
|
-
return {
|
|
987
|
-
columnDefs: H(() => g === "receive/request" ? $() : b())
|
|
988
|
-
};
|
|
989
|
-
}
|
|
990
|
-
const Wt = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Yt = { class: "flex flex-col gap-8" }, Qt = { class: "flex w-full justify-end gap-16" }, Xt = /* @__PURE__ */ Se({
|
|
991
|
-
__name: "FulfillmentForm",
|
|
992
|
-
props: {
|
|
993
|
-
purchaseOrder: {},
|
|
994
|
-
confirm: { type: Function }
|
|
995
|
-
},
|
|
996
|
-
emits: ["update:show"],
|
|
997
|
-
setup(g, { emit: r }) {
|
|
998
|
-
const o = g, p = Nt({
|
|
999
|
-
id: "",
|
|
1000
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1001
|
-
items: []
|
|
1002
|
-
}), a = Y(), n = r;
|
|
1003
|
-
_t(() => {
|
|
1004
|
-
o.purchaseOrder && (p.items = o.purchaseOrder.items.map((s) => ({
|
|
1005
|
-
id: s.id,
|
|
1006
|
-
sku: s.sku,
|
|
1007
|
-
measurement: s.measurement,
|
|
1008
|
-
amount: s.quantity ?? { amount: 1, precision: 0 }
|
|
1009
|
-
})));
|
|
1010
|
-
});
|
|
1011
|
-
const l = H(() => p.items.length <= 10);
|
|
1012
|
-
return (s, i) => {
|
|
1013
|
-
const O = G("FmTable"), $ = G("FmButton"), b = G("FmForm");
|
|
1014
|
-
return f(), le(b, {
|
|
1015
|
-
ref_key: "formRef",
|
|
1016
|
-
ref: a,
|
|
1017
|
-
class: "bg-white flex flex-col gap-32 rounded-3xl p-24 w-[800px]",
|
|
1018
|
-
onValidationFailed: console.log,
|
|
1019
|
-
onValidationSuccess: i[1] || (i[1] = () => o.confirm(p))
|
|
1020
|
-
}, {
|
|
1021
|
-
default: X(() => [
|
|
1022
|
-
i[2] || (i[2] = e("div", { class: "fm-typo-en-title-sm-600" }, "Confirm the transfer amount", -1)),
|
|
1023
|
-
e("div", Wt, [
|
|
1024
|
-
e("div", Yt, [
|
|
1025
|
-
I(O, {
|
|
1026
|
-
"column-defs": [
|
|
1027
|
-
{
|
|
1028
|
-
header: "Code",
|
|
1029
|
-
cell: (q) => {
|
|
1030
|
-
const u = o.purchaseOrder.items.find((C) => C.id === q.row.original.id || C.sku._id === q.row.original.sku._id);
|
|
1031
|
-
return P(
|
|
1032
|
-
h(Ke).FmTooltip,
|
|
1033
|
-
{
|
|
1034
|
-
content: u.code,
|
|
1035
|
-
placement: "top",
|
|
1036
|
-
variant: "plain",
|
|
1037
|
-
zIndex: 50
|
|
1038
|
-
},
|
|
1039
|
-
P(
|
|
1040
|
-
"span",
|
|
1041
|
-
{
|
|
1042
|
-
class: "flex-auto line-clamp-2 text-ellipsis break-all"
|
|
1043
|
-
},
|
|
1044
|
-
u.code
|
|
1045
|
-
)
|
|
1046
|
-
);
|
|
1047
|
-
}
|
|
1048
|
-
},
|
|
1049
|
-
{
|
|
1050
|
-
header: "Name",
|
|
1051
|
-
cell: (q) => {
|
|
1052
|
-
const u = o.purchaseOrder.items.find((C) => C.id === q.row.original.id || C.sku._id === q.row.original.sku._id);
|
|
1053
|
-
return P(
|
|
1054
|
-
h(Ke).FmTooltip,
|
|
1055
|
-
{
|
|
1056
|
-
content: u.name,
|
|
1057
|
-
placement: "top",
|
|
1058
|
-
variant: "plain",
|
|
1059
|
-
zIndex: 50
|
|
1060
|
-
},
|
|
1061
|
-
P(
|
|
1062
|
-
"span",
|
|
1063
|
-
{
|
|
1064
|
-
class: "flex-auto line-clamp-2 text-ellipsis break-all"
|
|
1065
|
-
},
|
|
1066
|
-
u.name
|
|
1067
|
-
)
|
|
1068
|
-
);
|
|
1069
|
-
}
|
|
1070
|
-
},
|
|
1071
|
-
{
|
|
1072
|
-
header: "Amount",
|
|
1073
|
-
cell: (q) => {
|
|
1074
|
-
const u = q.row.original, C = o.purchaseOrder.items.find((c) => c.id === u.id || c.sku._id === u.sku._id), d = u.amount ?? {
|
|
1075
|
-
amount: 1,
|
|
1076
|
-
precision: 0
|
|
1077
|
-
};
|
|
1078
|
-
return P(Vt, {
|
|
1079
|
-
style: {
|
|
1080
|
-
flex: "1 1 0%"
|
|
1081
|
-
},
|
|
1082
|
-
modelValue: {
|
|
1083
|
-
amount: d,
|
|
1084
|
-
measurement: u.measurement ?? null
|
|
1085
|
-
},
|
|
1086
|
-
key: u.id ?? u.sku._id,
|
|
1087
|
-
unit: u.sku.unit,
|
|
1088
|
-
"onUpdate:modelValue": (c) => {
|
|
1089
|
-
if (!c) return;
|
|
1090
|
-
const y = p.items.find((R) => R.id === u.id || R.sku._id === u.sku._id);
|
|
1091
|
-
y && (y.amount = c.amount);
|
|
1092
|
-
},
|
|
1093
|
-
disableUnit: !0,
|
|
1094
|
-
rules: [
|
|
1095
|
-
h(Bt)(
|
|
1096
|
-
+h(ye)({ amount: 0, precision: 0 })
|
|
1097
|
-
),
|
|
1098
|
-
h(Ut)(+h(ye)(C.quantity))
|
|
1099
|
-
],
|
|
1100
|
-
applyDefaultRules: !0
|
|
1101
|
-
});
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
],
|
|
1105
|
-
"row-data": p.items,
|
|
1106
|
-
"hide-footer": l.value
|
|
1107
|
-
}, null, 8, ["column-defs", "row-data", "hide-footer"])
|
|
1108
|
-
])
|
|
1109
|
-
]),
|
|
1110
|
-
e("div", Qt, [
|
|
1111
|
-
I($, {
|
|
1112
|
-
class: "px-16",
|
|
1113
|
-
label: "Confirm",
|
|
1114
|
-
size: "md",
|
|
1115
|
-
variant: "primary",
|
|
1116
|
-
type: "submit"
|
|
1117
|
-
}),
|
|
1118
|
-
I($, {
|
|
1119
|
-
class: "px-16",
|
|
1120
|
-
label: "Cancel",
|
|
1121
|
-
size: "md",
|
|
1122
|
-
variant: "secondary",
|
|
1123
|
-
onClick: i[0] || (i[0] = () => n("update:show", !1))
|
|
1124
|
-
})
|
|
1125
|
-
])
|
|
1126
|
-
]),
|
|
1127
|
-
_: 1
|
|
1128
|
-
}, 8, ["onValidationFailed"]);
|
|
1129
|
-
};
|
|
1130
|
-
}
|
|
1131
|
-
}), Ze = {
|
|
1132
|
-
submitRequest: {
|
|
1133
|
-
translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
|
|
1134
|
-
color: "primary",
|
|
1135
|
-
buttonVariant: fe.Primary
|
|
1136
|
-
},
|
|
1137
|
-
confirmDraft: {
|
|
1138
|
-
translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
|
|
1139
|
-
color: "primary",
|
|
1140
|
-
buttonVariant: fe.Primary
|
|
1141
|
-
},
|
|
1142
|
-
cancelDraft: {
|
|
1143
|
-
translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
|
|
1144
|
-
color: "system-error-300",
|
|
1145
|
-
buttonVariant: fe.Destructive
|
|
1146
|
-
},
|
|
1147
|
-
approveDraft: {
|
|
1148
|
-
translationKey: "inventory.transfer.receiveRequest.actions.approveDraft",
|
|
1149
|
-
color: "primary",
|
|
1150
|
-
buttonVariant: fe.Primary
|
|
1151
|
-
},
|
|
1152
|
-
rejectDraft: {
|
|
1153
|
-
translationKey: "inventory.transfer.receiveRequest.actions.rejectDraft",
|
|
1154
|
-
color: "system-error-300",
|
|
1155
|
-
buttonVariant: fe.Destructive
|
|
1156
|
-
},
|
|
1157
|
-
approveRequest: {
|
|
1158
|
-
translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
|
|
1159
|
-
color: "primary",
|
|
1160
|
-
buttonVariant: fe.Primary
|
|
1161
|
-
},
|
|
1162
|
-
processRequest: {
|
|
1163
|
-
translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
|
|
1164
|
-
color: "primary",
|
|
1165
|
-
buttonVariant: fe.Primary
|
|
1166
|
-
},
|
|
1167
|
-
receiveStock: {
|
|
1168
|
-
translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
|
|
1169
|
-
color: "primary",
|
|
1170
|
-
buttonVariant: fe.Primary,
|
|
1171
|
-
available: !1
|
|
1172
|
-
},
|
|
1173
|
-
completeReceive: {
|
|
1174
|
-
translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
|
|
1175
|
-
color: "primary",
|
|
1176
|
-
buttonVariant: fe.Plain
|
|
1177
|
-
},
|
|
1178
|
-
rejectRequest: {
|
|
1179
|
-
translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
|
|
1180
|
-
color: "system-error-300",
|
|
1181
|
-
buttonVariant: fe.Destructive
|
|
1182
|
-
},
|
|
1183
|
-
closeRequest: {
|
|
1184
|
-
translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
|
|
1185
|
-
color: "system-error-300",
|
|
1186
|
-
buttonVariant: fe.Destructive,
|
|
1187
|
-
available: !1
|
|
1188
|
-
},
|
|
1189
|
-
returnStock: {
|
|
1190
|
-
translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
|
|
1191
|
-
color: "primary",
|
|
1192
|
-
buttonVariant: fe.Primary,
|
|
1193
|
-
available: !1
|
|
1194
|
-
}
|
|
1195
|
-
};
|
|
1196
|
-
function Zt() {
|
|
1197
|
-
const g = Fe();
|
|
1198
|
-
return {
|
|
1199
|
-
ableToMarkReceived(r) {
|
|
1200
|
-
if (!r || r.status !== Z.enum.RECEIVING)
|
|
1201
|
-
return !1;
|
|
1202
|
-
const p = _e().currentLocationDBName;
|
|
1203
|
-
return `${r.supplier.internal}_${r.supplier._id}` !== p;
|
|
1204
|
-
},
|
|
1205
|
-
ableToMarkApproved(r) {
|
|
1206
|
-
return !(!r || (r == null ? void 0 : r.status) !== Z.enum.REQUESTING);
|
|
1207
|
-
},
|
|
1208
|
-
ableToCreateFulfillment(r, o) {
|
|
1209
|
-
var n, l;
|
|
1210
|
-
if (!g.acceptRequireFulfillment || !r || !o || r.status !== Z.enum.PROCESSING || !o.processedAt)
|
|
1211
|
-
return !1;
|
|
1212
|
-
const p = (n = o == null ? void 0 : o.from) == null ? void 0 : n.dbName, a = (l = o == null ? void 0 : o.to) == null ? void 0 : l.dbName;
|
|
1213
|
-
return !(p.startsWith("restaurant_") && a.startsWith("restaurant_"));
|
|
1214
|
-
}
|
|
1215
|
-
};
|
|
1216
|
-
}
|
|
1217
|
-
const Jt = { class: "flex flex-row-reverse" }, er = /* @__PURE__ */ Se({
|
|
1218
|
-
__name: "NetSuiteSync",
|
|
1219
|
-
props: {
|
|
1220
|
-
poRequest: {},
|
|
1221
|
-
purchaseOrder: {},
|
|
1222
|
-
isTransferBetweenOutlets: { type: Boolean },
|
|
1223
|
-
scope: {}
|
|
1224
|
-
},
|
|
1225
|
-
setup(g) {
|
|
1226
|
-
const r = g, o = We(), p = Pe(), a = Ye(), n = Y(!1);
|
|
1227
|
-
H(() => {
|
|
1228
|
-
var $, b, q, u;
|
|
1229
|
-
let s = !0;
|
|
1230
|
-
o.isEnabled || (s = !1);
|
|
1231
|
-
const i = r.purchaseOrder, O = r.poRequest;
|
|
1232
|
-
return i && (($ = i == null ? void 0 : i.supplier) != null && $.internal ? (!O && i.status == Z.enum.DRAFT && (s = !1), O && !((b = O == null ? void 0 : O.netSuite) != null && b.id) && (s = !1), r.isTransferBetweenOutlets && (s = !1)) : ((i == null ? void 0 : i.status) !== Z.enum.REQUESTING && i.supplier.internal && (s = !1), !O && !((q = i == null ? void 0 : i.netSuite) != null && q.id) && (s = !1), !O && ((u = i == null ? void 0 : i.netSuite) != null && u.id) && (i == null ? void 0 : i.status) == Z.enum.REQUESTING && (s = !1))), s;
|
|
1233
|
-
});
|
|
1234
|
-
async function l() {
|
|
1235
|
-
n.value || a.open({
|
|
1236
|
-
title: "Sync with NetSuite",
|
|
1237
|
-
contentComponent: P("div", [
|
|
1238
|
-
P("p", "Are you sure you want to sync now?"),
|
|
1239
|
-
P("br"),
|
|
1240
|
-
P(
|
|
1241
|
-
"p",
|
|
1242
|
-
{ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
|
|
1243
|
-
"Please wait a moment before syncing manually to avoid unnecessary actions."
|
|
1244
|
-
)
|
|
1245
|
-
]),
|
|
1246
|
-
primaryActions: {
|
|
1247
|
-
text: "Sync",
|
|
1248
|
-
close: !0,
|
|
1249
|
-
variant: "destructive"
|
|
1250
|
-
},
|
|
1251
|
-
secondaryActions: { text: "Not now", close: !0 }
|
|
1252
|
-
}).onPrimary(async () => {
|
|
1253
|
-
var s, i, O;
|
|
1254
|
-
try {
|
|
1255
|
-
n.value = !0;
|
|
1256
|
-
const $ = ((s = r.purchaseOrder) == null ? void 0 : s._id) || ((i = r.poRequest) == null ? void 0 : i.purchaseOrderId) || "", b = (O = r.poRequest) == null ? void 0 : O.to.dbName;
|
|
1257
|
-
await o.syncPurchaseOrder(
|
|
1258
|
-
$,
|
|
1259
|
-
r.scope === "approval" ? b : void 0
|
|
1260
|
-
), p.open({
|
|
1261
|
-
title: "Sync with NetSuite",
|
|
1262
|
-
message: "Requested to sync with NetSuite. Please wait a moment.",
|
|
1263
|
-
type: "success"
|
|
1264
|
-
}), await new Promise((q) => setTimeout(q, 5e3)), n.value = !1;
|
|
1265
|
-
} catch {
|
|
1266
|
-
p.open({
|
|
1267
|
-
title: "Error",
|
|
1268
|
-
message: "Failed to sync with NetSuite",
|
|
1269
|
-
type: "error"
|
|
1270
|
-
}), n.value = !1;
|
|
1271
|
-
}
|
|
1272
|
-
});
|
|
1273
|
-
}
|
|
1274
|
-
return (s, i) => {
|
|
1275
|
-
const O = G("FmButton");
|
|
1276
|
-
return f(), x("div", Jt, [
|
|
1277
|
-
I(O, {
|
|
1278
|
-
"prepend-icon": "sync",
|
|
1279
|
-
variant: "secondary",
|
|
1280
|
-
label: "Sync",
|
|
1281
|
-
loading: n.value,
|
|
1282
|
-
onClick: l,
|
|
1283
|
-
"text-color": "primary",
|
|
1284
|
-
"bg-color": "transparent",
|
|
1285
|
-
"border-color": "primary"
|
|
1286
|
-
}, null, 8, ["loading"])
|
|
1287
|
-
]);
|
|
1288
|
-
};
|
|
1289
|
-
}
|
|
1290
|
-
}), tr = {
|
|
1291
|
-
key: 0,
|
|
1292
|
-
class: "flex flex-col gap-8"
|
|
1293
|
-
}, rr = { class: "flex flex-col gap-4" }, sr = { class: "fm-typo-en-body-lg-600" }, or = {
|
|
1294
|
-
key: 0,
|
|
1295
|
-
class: "flex flex-col gap-4"
|
|
1296
|
-
}, nr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ar = { class: "fm-typo-en-body-lg-600" }, lr = { key: 0 }, ir = { key: 1 }, cr = {
|
|
1297
|
-
key: 1,
|
|
1298
|
-
class: "flex flex-col gap-4"
|
|
1299
|
-
}, ur = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, dr = { class: "fm-typo-en-body-lg-600" }, mr = { key: 0 }, pr = { key: 1 }, fr = {
|
|
1300
|
-
key: 2,
|
|
1301
|
-
class: "flex flex-col gap-4"
|
|
1302
|
-
}, yr = { class: "fm-typo-en-body-lg-600" }, vr = {
|
|
1303
|
-
key: 3,
|
|
1304
|
-
class: "flex flex-col gap-4"
|
|
1305
|
-
}, hr = { class: "fm-typo-en-body-lg-600" }, br = /* @__PURE__ */ Se({
|
|
1306
|
-
__name: "NetSuiteInfo",
|
|
1307
|
-
props: {
|
|
1308
|
-
transferType: {},
|
|
1309
|
-
transferToDbName: {},
|
|
1310
|
-
poRequest: {},
|
|
1311
|
-
purchaseOrder: {},
|
|
1312
|
-
isTransferBetweenOutlets: { type: Boolean },
|
|
1313
|
-
scope: {}
|
|
1314
|
-
},
|
|
1315
|
-
setup(g) {
|
|
1316
|
-
const r = g, o = We(), p = Ie(), a = Y(r.poRequest);
|
|
1317
|
-
_t(async () => {
|
|
1318
|
-
var i;
|
|
1319
|
-
if (!r.poRequest && ((i = r.purchaseOrder) != null && i._id)) {
|
|
1320
|
-
const O = await p.getLatestPurchaseOrderRequest(r.purchaseOrder._id);
|
|
1321
|
-
a.value = O;
|
|
1322
|
-
}
|
|
1323
|
-
});
|
|
1324
|
-
const n = H(
|
|
1325
|
-
() => {
|
|
1326
|
-
var i, O, $, b, q, u;
|
|
1327
|
-
return o.getSubsidiaryFullName(
|
|
1328
|
-
(($ = (O = (i = r.purchaseOrder) == null ? void 0 : i.netSuite) == null ? void 0 : O.subsidiary) == null ? void 0 : $.id) || ((u = (q = (b = r.poRequest) == null ? void 0 : b.netSuite) == null ? void 0 : q.subsidiary) == null ? void 0 : u.id)
|
|
1329
|
-
).fullName;
|
|
1330
|
-
}
|
|
1331
|
-
), l = H(() => {
|
|
1332
|
-
var i, O, $, b, q, u, C, d, c, y, R, k;
|
|
1333
|
-
return ($ = (O = (i = r.purchaseOrder) == null ? void 0 : i.netSuite) == null ? void 0 : O.additionalInfo) != null && $.transactionnumber ? (u = (q = (b = r.purchaseOrder) == null ? void 0 : b.netSuite) == null ? void 0 : q.additionalInfo) == null ? void 0 : u.transactionnumber : (c = (d = (C = a.value) == null ? void 0 : C.netSuite) == null ? void 0 : d.additionalInfo) != null && c.transactionnumber ? (k = (R = (y = a.value) == null ? void 0 : y.netSuite) == null ? void 0 : R.additionalInfo) == null ? void 0 : k.transactionnumber : null;
|
|
1334
|
-
}), s = H(() => {
|
|
1335
|
-
var i, O, $, b, q, u;
|
|
1336
|
-
return (O = (i = r.purchaseOrder) == null ? void 0 : i.deliveryFullfillment) != null && O.length && ((b = ($ = r.purchaseOrder) == null ? void 0 : $.deliveryFullfillment) == null ? void 0 : b.length) > 0 ? (u = (q = r.purchaseOrder) == null ? void 0 : q.deliveryFullfillment) == null ? void 0 : u.map((C) => {
|
|
1337
|
-
var d;
|
|
1338
|
-
return (d = C.netSuite) == null ? void 0 : d.refNo;
|
|
1339
|
-
}).join(", ") : "N/A";
|
|
1340
|
-
});
|
|
1341
|
-
return (i, O) => {
|
|
1342
|
-
var $, b, q, u, C, d, c, y, R, k, z, T, K, J, oe, ce;
|
|
1343
|
-
return h(o).isEnabled ? (f(), x("div", tr, [
|
|
1344
|
-
e("div", rr, [
|
|
1345
|
-
O[0] || (O[0] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "NetSuite subsidiary", -1)),
|
|
1346
|
-
e("div", sr, _(n.value || "N/A"), 1)
|
|
1347
|
-
]),
|
|
1348
|
-
!i.isTransferBetweenOutlets && i.scope === h(tt).RECEIVE_REQUEST ? (f(), x("div", or, [
|
|
1349
|
-
e("div", nr, " NetSuite " + _((b = ($ = i.purchaseOrder) == null ? void 0 : $.netSuite) != null && b.recordType ? h(ht)((u = (q = i.purchaseOrder) == null ? void 0 : q.netSuite) == null ? void 0 : u.recordType) : i.transferType === h(Ce).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
|
|
1350
|
-
e("div", ar, [
|
|
1351
|
-
(d = (C = i.purchaseOrder) == null ? void 0 : C.netSuite) != null && d.id ? (f(), x("span", lr, _((y = (c = i.purchaseOrder) == null ? void 0 : c.netSuite) == null ? void 0 : y.refNo) + " (" + _((k = (R = i.purchaseOrder) == null ? void 0 : R.netSuite) == null ? void 0 : k.id) + ") ", 1)) : (f(), x("span", ir, "N/A"))
|
|
1352
|
-
])
|
|
1353
|
-
])) : M("", !0),
|
|
1354
|
-
!i.isTransferBetweenOutlets && a.value || i.scope === h(tt).APPROVAL ? (f(), x("div", cr, [
|
|
1355
|
-
e("div", ur, " (Request) NetSuite " + _(i.transferType === h(Ce).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
|
|
1356
|
-
e("div", dr, [
|
|
1357
|
-
(T = (z = a.value) == null ? void 0 : z.netSuite) != null && T.id ? (f(), x("span", mr, _((J = (K = a.value) == null ? void 0 : K.netSuite) == null ? void 0 : J.refNo) + " (" + _((ce = (oe = a.value) == null ? void 0 : oe.netSuite) == null ? void 0 : ce.id) + ") ", 1)) : (f(), x("span", pr, "N/A"))
|
|
1358
|
-
])
|
|
1359
|
-
])) : M("", !0),
|
|
1360
|
-
l.value ? (f(), x("div", fr, [
|
|
1361
|
-
O[1] || (O[1] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transaction Number ", -1)),
|
|
1362
|
-
e("div", yr, _(l.value), 1)
|
|
1363
|
-
])) : M("", !0),
|
|
1364
|
-
h(o).isEnabled && i.transferType === h(Ce).TRANSFER && !i.isTransferBetweenOutlets ? (f(), x("div", vr, [
|
|
1365
|
-
O[2] || (O[2] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite fulfillment IDs ", -1)),
|
|
1366
|
-
e("div", hr, _(s.value), 1)
|
|
1367
|
-
])) : M("", !0)
|
|
1368
|
-
])) : M("", !0);
|
|
1369
|
-
};
|
|
1370
|
-
}
|
|
1371
|
-
}), gr = { class: "flex flex-row-reverse" }, _r = /* @__PURE__ */ Se({
|
|
1372
|
-
__name: "NetSuiteLog",
|
|
1373
|
-
props: {
|
|
1374
|
-
netsuiteId: {},
|
|
1375
|
-
purchaseOrderId: {}
|
|
1376
|
-
},
|
|
1377
|
-
setup(g) {
|
|
1378
|
-
const r = Pe(), o = bt();
|
|
1379
|
-
async function p(a, n) {
|
|
1380
|
-
const l = [];
|
|
1381
|
-
if (a && l.push(`body.message:*${a}*`), n) {
|
|
1382
|
-
const $ = n.replace(/:/g, "\\:");
|
|
1383
|
-
l.push(`${$}`);
|
|
1384
|
-
}
|
|
1385
|
-
if (l.length === 0) {
|
|
1386
|
-
r.open({
|
|
1387
|
-
message: "Cannot open logs without valid filters.",
|
|
1388
|
-
type: "error"
|
|
1389
|
-
});
|
|
1390
|
-
return;
|
|
1391
|
-
}
|
|
1392
|
-
const i = `attributes.pod:netsuite* AND (${l.join(" OR ")})`, { url: O } = await o.getSyncLogs(i);
|
|
1393
|
-
r.open(
|
|
1394
|
-
{
|
|
1395
|
-
message: "Opening NetSuite logs...",
|
|
1396
|
-
type: "info"
|
|
1397
|
-
},
|
|
1398
|
-
800
|
|
1399
|
-
), await new Promise(($) => setTimeout($, 800)), window.open(O, "_blank");
|
|
1400
|
-
}
|
|
1401
|
-
return (a, n) => {
|
|
1402
|
-
const l = G("FmButton");
|
|
1403
|
-
return f(), x("div", gr, [
|
|
1404
|
-
I(l, {
|
|
1405
|
-
"prepend-icon": "history",
|
|
1406
|
-
variant: "secondary",
|
|
1407
|
-
label: "Logs",
|
|
1408
|
-
onClick: n[0] || (n[0] = (s) => p(a.netsuiteId, a.purchaseOrderId)),
|
|
1409
|
-
"text-color": "primary",
|
|
1410
|
-
"bg-color": "transparent",
|
|
1411
|
-
"border-color": "primary"
|
|
1412
|
-
})
|
|
1413
|
-
]);
|
|
1414
|
-
};
|
|
1415
|
-
}
|
|
1416
|
-
}), Sr = { class: "flex flex-row-reverse" }, Or = { key: 0 }, xr = { key: 1 }, wr = { class: "mb-6" }, $r = { class: "fm-typo-en-body-md-400" }, Rr = { key: 0 }, kr = { key: 1 }, Dr = { key: 0 }, Nr = {
|
|
1417
|
-
key: 1,
|
|
1418
|
-
class: "border-t pt-6"
|
|
1419
|
-
}, Cr = { class: "fm-typo-en-body-lg-600 mb-4 flex items-center gap-2" }, Ar = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg overflow-y-auto" }, Tr = { class: "w-full" }, qr = {
|
|
1420
|
-
class: "p-3 fm-typo-en-body-sm-600",
|
|
1421
|
-
style: { "min-width": "130px" }
|
|
1422
|
-
}, Fr = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Pr = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ir = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Er = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Lr = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Vr = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Br = { class: "p-3 fm-typo-en-body-sm-600" }, Ur = { key: 2 }, Mr = { key: 1 }, jr = /* @__PURE__ */ Se({
|
|
1423
|
-
__name: "NetSuiteLatestInfo",
|
|
1424
|
-
props: {
|
|
1425
|
-
netsuiteId: {},
|
|
1426
|
-
purchaseOrderId: {}
|
|
1427
|
-
},
|
|
1428
|
-
setup(g) {
|
|
1429
|
-
const r = g, o = bt(), p = Y(!1), a = _e(), n = Y(!0), l = Y(!1), s = Y(!1), i = Y(!1), O = Y(null), $ = Y([]);
|
|
1430
|
-
async function b() {
|
|
1431
|
-
if (!O.value) {
|
|
1432
|
-
p.value = !0;
|
|
1433
|
-
try {
|
|
1434
|
-
n.value = !0;
|
|
1435
|
-
const d = await o.getMoreInfo(
|
|
1436
|
-
a.currentLocation.dbName,
|
|
1437
|
-
r.purchaseOrderId
|
|
1438
|
-
);
|
|
1439
|
-
O.value = d, l.value = !1;
|
|
1440
|
-
} catch {
|
|
1441
|
-
l.value = !0;
|
|
1442
|
-
} finally {
|
|
1443
|
-
n.value = !1;
|
|
1444
|
-
}
|
|
1445
|
-
await q();
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
async function q() {
|
|
1449
|
-
if (!($.value.length > 0))
|
|
1450
|
-
try {
|
|
1451
|
-
s.value = !0;
|
|
1452
|
-
const d = await o.getChangeLogs(r.netsuiteId);
|
|
1453
|
-
$.value = d, i.value = !1;
|
|
1454
|
-
} catch {
|
|
1455
|
-
i.value = !0;
|
|
1456
|
-
} finally {
|
|
1457
|
-
s.value = !1;
|
|
1458
|
-
}
|
|
1459
|
-
}
|
|
1460
|
-
function u(d) {
|
|
1461
|
-
switch (d) {
|
|
1462
|
-
case Ee.Create:
|
|
1463
|
-
return "text-green-600 bg-green-100";
|
|
1464
|
-
case Ee.Set:
|
|
1465
|
-
return "text-blue-600 bg-blue-100";
|
|
1466
|
-
case Ee.Change:
|
|
1467
|
-
return "text-yellow-600 bg-yellow-100";
|
|
1468
|
-
case Ee.Unset:
|
|
1469
|
-
return "text-red-600 bg-red-100";
|
|
1470
|
-
default:
|
|
1471
|
-
return "text-gray-600 bg-gray-100";
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
function C(d) {
|
|
1475
|
-
return new Date(d).toLocaleDateString("en-US", {
|
|
1476
|
-
year: "numeric",
|
|
1477
|
-
month: "short",
|
|
1478
|
-
day: "numeric",
|
|
1479
|
-
hour: "2-digit",
|
|
1480
|
-
minute: "2-digit"
|
|
1481
|
-
});
|
|
1482
|
-
}
|
|
1483
|
-
return (d, c) => {
|
|
1484
|
-
const y = G("FmButton"), R = G("FmLabel"), k = G("FmIcon"), z = G("FmDialog");
|
|
1485
|
-
return f(), x("div", Sr, [
|
|
1486
|
-
I(z, {
|
|
1487
|
-
modelValue: p.value,
|
|
1488
|
-
"onUpdate:modelValue": c[2] || (c[2] = (T) => p.value = T),
|
|
1489
|
-
overlay: !0,
|
|
1490
|
-
"max-width": 800
|
|
1491
|
-
}, {
|
|
1492
|
-
"dialog-button": X(() => [
|
|
1493
|
-
I(y, {
|
|
1494
|
-
"prepend-icon": "info",
|
|
1495
|
-
variant: "secondary",
|
|
1496
|
-
label: "Latest Info",
|
|
1497
|
-
onClick: c[0] || (c[0] = (T) => b()),
|
|
1498
|
-
"text-color": "primary",
|
|
1499
|
-
"bg-color": "transparent",
|
|
1500
|
-
"border-color": "primary"
|
|
1501
|
-
})
|
|
1502
|
-
]),
|
|
1503
|
-
"dialog-header": X(() => c[3] || (c[3] = [
|
|
1504
|
-
e("div", null, "NetSuite latest info", -1)
|
|
1505
|
-
])),
|
|
1506
|
-
default: X(() => [
|
|
1507
|
-
n.value ? (f(), x("div", Or, "Loading...")) : (f(), x("div", xr, [
|
|
1508
|
-
l.value ? (f(), x("p", Mr, "Something went wrong.")) : (f(), x(ue, { key: 0 }, [
|
|
1509
|
-
e("div", wr, [
|
|
1510
|
-
c[4] || (c[4] = e("h3", { class: "fm-typo-en-body-lg-600 mb-4" }, "NetSuite Order Details", -1)),
|
|
1511
|
-
(f(!0), x(ue, null, be(O.value, (T, K) => (f(), x("div", {
|
|
1512
|
-
key: K,
|
|
1513
|
-
class: "mb-2"
|
|
1514
|
-
}, [
|
|
1515
|
-
e("div", null, [
|
|
1516
|
-
I(R, {
|
|
1517
|
-
label: h(rt)(K)
|
|
1518
|
-
}, null, 8, ["label"]),
|
|
1519
|
-
e("div", $r, [
|
|
1520
|
-
Array.isArray(T) ? (f(), x("span", Rr, _(T.length > 0 ? T.join(", ") : "N/A"), 1)) : (f(), x("span", kr, _(T), 1))
|
|
1521
|
-
])
|
|
1522
|
-
])
|
|
1523
|
-
]))), 128))
|
|
1524
|
-
]),
|
|
1525
|
-
s.value ? (f(), x("div", Dr, "Change Log Loading...")) : M("", !0),
|
|
1526
|
-
!s.value && $.value.length > 0 ? (f(), x("div", Nr, [
|
|
1527
|
-
e("h3", Cr, [
|
|
1528
|
-
I(k, {
|
|
1529
|
-
name: "error",
|
|
1530
|
-
color: "#ff9500",
|
|
1531
|
-
size: "sm"
|
|
1532
|
-
}),
|
|
1533
|
-
c[5] || (c[5] = Ne(" Change Logs "))
|
|
1534
|
-
]),
|
|
1535
|
-
e("div", Ar, [
|
|
1536
|
-
e("table", Tr, [
|
|
1537
|
-
c[6] || (c[6] = e("thead", { class: "bg-fm-color-neutral-gray-50" }, [
|
|
1538
|
-
e("tr", { class: "border-b border-fm-color-neutral-gray-200" }, [
|
|
1539
|
-
e("th", {
|
|
1540
|
-
class: "text-left p-3 fm-typo-en-body-md-600",
|
|
1541
|
-
style: { "min-width": "130px" }
|
|
1542
|
-
}, " Date "),
|
|
1543
|
-
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Role"),
|
|
1544
|
-
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Name"),
|
|
1545
|
-
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Context"),
|
|
1546
|
-
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Type"),
|
|
1547
|
-
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Line ID"),
|
|
1548
|
-
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Field"),
|
|
1549
|
-
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Old Value"),
|
|
1550
|
-
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "New Value")
|
|
1551
|
-
])
|
|
1552
|
-
], -1)),
|
|
1553
|
-
e("tbody", null, [
|
|
1554
|
-
(f(!0), x(ue, null, be($.value, (T, K) => (f(), x("tr", {
|
|
1555
|
-
key: K,
|
|
1556
|
-
class: "border-b border-fm-color-neutral-gray-200 last:border-b-0"
|
|
1557
|
-
}, [
|
|
1558
|
-
e("td", qr, _(C(T._dateiso8601)), 1),
|
|
1559
|
-
e("td", Fr, _(T._rolename), 1),
|
|
1560
|
-
e("td", Pr, _(T._employeename), 1),
|
|
1561
|
-
e("td", Ir, _(T._contextname), 1),
|
|
1562
|
-
e("td", {
|
|
1563
|
-
class: Be(`p-3 fm-typo-en-body-sm-600 ${u(Number(T.type) - 1)}`)
|
|
1564
|
-
}, _(h(Ee)[Number(T.type) - 1]), 3),
|
|
1565
|
-
e("td", Er, _(T.lineid || ""), 1),
|
|
1566
|
-
e("td", Lr, _(T._fieldname), 1),
|
|
1567
|
-
e("td", Vr, _(T.oldvalue || ""), 1),
|
|
1568
|
-
e("td", Br, _(T.newvalue || ""), 1)
|
|
1569
|
-
]))), 128))
|
|
1570
|
-
])
|
|
1571
|
-
])
|
|
1572
|
-
])
|
|
1573
|
-
])) : (f(), x("div", Ur, c[7] || (c[7] = [
|
|
1574
|
-
e("p", null, "No change logs available.", -1)
|
|
1575
|
-
])))
|
|
1576
|
-
], 64))
|
|
1577
|
-
]))
|
|
1578
|
-
]),
|
|
1579
|
-
"dialog-footer": X(() => [
|
|
1580
|
-
I(y, {
|
|
1581
|
-
class: "ml-auto sm:w-full xs:w-full",
|
|
1582
|
-
label: "Close",
|
|
1583
|
-
size: "md",
|
|
1584
|
-
variant: "primary",
|
|
1585
|
-
onClick: c[1] || (c[1] = (T) => p.value = !1)
|
|
1586
|
-
})
|
|
1587
|
-
]),
|
|
1588
|
-
_: 1
|
|
1589
|
-
}, 8, ["modelValue"])
|
|
1590
|
-
]);
|
|
1591
|
-
};
|
|
1592
|
-
}
|
|
1593
|
-
}), zr = {
|
|
1594
|
-
key: 0,
|
|
1595
|
-
class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16 flex flex-col gap-8"
|
|
1596
|
-
}, Kr = { class: "flex gap-8 items-center" }, Hr = { class: "ml-auto" }, Gr = { class: "flex gap-3" }, Wr = /* @__PURE__ */ Se({
|
|
1597
|
-
__name: "NetSuitePanel",
|
|
1598
|
-
props: {
|
|
1599
|
-
poRequest: {},
|
|
1600
|
-
purchaseOrder: {},
|
|
1601
|
-
transferType: {},
|
|
1602
|
-
transferToDbName: {},
|
|
1603
|
-
scope: {}
|
|
1604
|
-
},
|
|
1605
|
-
setup(g) {
|
|
1606
|
-
const r = g, o = jt();
|
|
1607
|
-
Me();
|
|
1608
|
-
const p = H(() => {
|
|
1609
|
-
var s, i, O, $, b, q, u;
|
|
1610
|
-
const a = ((s = r.transferToDbName) == null ? void 0 : s.startsWith("restaurant")) && ((O = (i = r.purchaseOrder) == null ? void 0 : i.supplier) == null ? void 0 : O.internal) === "restaurant", n = r.transferType === Ce.PURCHASE, l = r.transferType === Ce.TRANSFER;
|
|
1611
|
-
return n || l && !a || ((b = ($ = r.purchaseOrder) == null ? void 0 : $.netSuite) == null ? void 0 : b.id) || ((u = (q = r.poRequest) == null ? void 0 : q.netSuite) == null ? void 0 : u.id);
|
|
1612
|
-
});
|
|
1613
|
-
return (a, n) => {
|
|
1614
|
-
var s, i;
|
|
1615
|
-
const l = G("FmMenuDivider");
|
|
1616
|
-
return h(o).isNetSuiteEnabled && p.value ? (f(), x("div", zr, [
|
|
1617
|
-
e("div", Kr, [
|
|
1618
|
-
n[0] || (n[0] = e("span", { class: "flex-1 fm-typo-en-body-lg-600" }, "NetSuite Info", -1)),
|
|
1619
|
-
e("div", Hr, [
|
|
1620
|
-
e("div", Gr, [
|
|
1621
|
-
(i = (s = r.purchaseOrder) == null ? void 0 : s.netSuite) != null && i.id ? (f(), le(qe, { key: 0 }, {
|
|
1622
|
-
default: X(() => {
|
|
1623
|
-
var O, $, b;
|
|
1624
|
-
return [
|
|
1625
|
-
I(jr, {
|
|
1626
|
-
"netsuite-id": ($ = (O = a.purchaseOrder) == null ? void 0 : O.netSuite) == null ? void 0 : $.id,
|
|
1627
|
-
"purchase-order-id": (b = a.purchaseOrder) == null ? void 0 : b._id
|
|
1628
|
-
}, null, 8, ["netsuite-id", "purchase-order-id"])
|
|
1629
|
-
];
|
|
1630
|
-
}),
|
|
1631
|
-
_: 1
|
|
1632
|
-
})) : M("", !0),
|
|
1633
|
-
I(qe, null, {
|
|
1634
|
-
default: X(() => {
|
|
1635
|
-
var O, $, b;
|
|
1636
|
-
return [
|
|
1637
|
-
I(_r, {
|
|
1638
|
-
"netsuite-id": ($ = (O = a.purchaseOrder) == null ? void 0 : O.netSuite) == null ? void 0 : $.id,
|
|
1639
|
-
"purchase-order-id": (b = a.purchaseOrder) == null ? void 0 : b._id
|
|
1640
|
-
}, null, 8, ["netsuite-id", "purchase-order-id"])
|
|
1641
|
-
];
|
|
1642
|
-
}),
|
|
1643
|
-
_: 1
|
|
1644
|
-
}),
|
|
1645
|
-
I(er, {
|
|
1646
|
-
"po-request": a.poRequest,
|
|
1647
|
-
"purchase-order": a.purchaseOrder,
|
|
1648
|
-
"is-transfer-between-outlets": !p.value,
|
|
1649
|
-
scope: a.scope
|
|
1650
|
-
}, null, 8, ["po-request", "purchase-order", "is-transfer-between-outlets", "scope"])
|
|
1651
|
-
])
|
|
1652
|
-
])
|
|
1653
|
-
]),
|
|
1654
|
-
I(l),
|
|
1655
|
-
I(br, {
|
|
1656
|
-
"po-request": a.poRequest,
|
|
1657
|
-
"purchase-order": a.purchaseOrder,
|
|
1658
|
-
"transfer-type": a.transferType,
|
|
1659
|
-
"transfer-to-db-name": a.transferToDbName,
|
|
1660
|
-
"is-transfer-between-outlets": !p.value,
|
|
1661
|
-
scope: a.scope
|
|
1662
|
-
}, null, 8, ["po-request", "purchase-order", "transfer-type", "transfer-to-db-name", "is-transfer-between-outlets", "scope"])
|
|
1663
|
-
])) : M("", !0);
|
|
1664
|
-
};
|
|
1665
|
-
}
|
|
1666
|
-
}), Yr = { class: "flex flex-col gap-3" }, Qr = { class: "flex flex-col gap-4" }, Xr = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, Zr = { class: "flex flex-col gap-4" }, Jr = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, es = { class: "flex flex-col gap-4" }, ts = { class: "flex gap-4" }, rs = { class: "flex flex-col" }, ss = { class: "fm-typo-en-body-lg-600 basis-1/2 shrink-0 grow" }, os = { class: "fm-typo-en-body-md-400" }, ns = { class: "ml-auto flex flex-col" }, as = { class: "ml-auto flex gap-1" }, ls = { class: "fm-typo-en-body-lg-600 self-end" }, is = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, cs = { class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, us = { class: "flex flex-col gap-4" }, ds = { class: "flex flex-col gap-4" }, ms = { class: "flex flex-col gap-4" }, ps = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, fs = {
|
|
1667
|
-
key: 0,
|
|
1668
|
-
class: "flex flex-col gap-4"
|
|
1669
|
-
}, ys = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, vs = /* @__PURE__ */ Se({
|
|
1670
|
-
__name: "EditForm",
|
|
1671
|
-
props: {
|
|
1672
|
-
purchaseOrder: {},
|
|
1673
|
-
deliveryOrder: {}
|
|
1674
|
-
},
|
|
1675
|
-
emits: ["submitted"],
|
|
1676
|
-
setup(g, { emit: r }) {
|
|
1677
|
-
const o = Y(!1), p = g, a = r, n = gt("deliveryOrder"), l = Ie(), s = H(
|
|
1678
|
-
() => {
|
|
1679
|
-
var q;
|
|
1680
|
-
return ((q = p.purchaseOrder.deliveryFullfillment) == null ? void 0 : q.findIndex(
|
|
1681
|
-
(u) => p.deliveryOrder.fullfillmentId && u.id === p.deliveryOrder.fullfillmentId
|
|
1682
|
-
)) ?? -1;
|
|
1683
|
-
}
|
|
1684
|
-
), O = Fe().enablePortalDeliveryOrderWrite, $ = Pe();
|
|
1685
|
-
function b() {
|
|
1686
|
-
l.updateDeliveryOrder({
|
|
1687
|
-
deliveryOrder: {
|
|
1688
|
-
...p.deliveryOrder,
|
|
1689
|
-
deliveryOrderNumber: n.deliveryOrderNumber || ""
|
|
1690
|
-
},
|
|
1691
|
-
purchaseOrderId: p.purchaseOrder._id,
|
|
1692
|
-
purchaseOrderRev: p.purchaseOrder._rev
|
|
1693
|
-
}).then(() => {
|
|
1694
|
-
$.open(
|
|
1695
|
-
{
|
|
1696
|
-
title: "Success",
|
|
1697
|
-
message: `PO# ${p.purchaseOrder.seqNumber} Changes have been saved`,
|
|
1698
|
-
type: "success"
|
|
1699
|
-
},
|
|
1700
|
-
1e4
|
|
1701
|
-
), o.value = !1, a("submitted");
|
|
1702
|
-
});
|
|
1703
|
-
}
|
|
1704
|
-
return (q, u) => {
|
|
1705
|
-
const C = G("FmButton"), d = G("FmTextField"), c = G("FmDialog");
|
|
1706
|
-
return f(), le(c, {
|
|
1707
|
-
modelValue: o.value,
|
|
1708
|
-
"onUpdate:modelValue": u[1] || (u[1] = (y) => o.value = y),
|
|
1709
|
-
overlay: !0
|
|
1710
|
-
}, {
|
|
1711
|
-
"dialog-button": X(() => [
|
|
1712
|
-
h(O) ? (f(), le(C, {
|
|
1713
|
-
key: 0,
|
|
1714
|
-
variant: "plain",
|
|
1715
|
-
label: "Edit",
|
|
1716
|
-
size: "md",
|
|
1717
|
-
"prepend-icon": "edit"
|
|
1718
|
-
})) : M("", !0)
|
|
1719
|
-
]),
|
|
1720
|
-
"dialog-header": X(() => [
|
|
1721
|
-
e("div", null, "Received on " + _(h(Ue)(p.deliveryOrder.createdAt)), 1)
|
|
1722
|
-
]),
|
|
1723
|
-
"dialog-footer": X(() => [
|
|
1724
|
-
I(C, {
|
|
1725
|
-
class: "ml-auto",
|
|
1726
|
-
label: "Apply changes",
|
|
1727
|
-
size: "md",
|
|
1728
|
-
variant: "destructive",
|
|
1729
|
-
onClick: b
|
|
1730
|
-
})
|
|
1731
|
-
]),
|
|
1732
|
-
default: X(() => [
|
|
1733
|
-
e("div", null, [
|
|
1734
|
-
e("div", Yr, [
|
|
1735
|
-
e("div", Qr, [
|
|
1736
|
-
u[2] || (u[2] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Adjustment date", -1)),
|
|
1737
|
-
e("div", Xr, _(p.deliveryOrder.adjustment ? h(Ue)(new Date(h(ze)(p.deliveryOrder.adjustment))) : "-"), 1)
|
|
1738
|
-
]),
|
|
1739
|
-
e("div", Zr, [
|
|
1740
|
-
u[3] || (u[3] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Received by", -1)),
|
|
1741
|
-
e("div", Jr, _(p.deliveryOrder.createdBy.name), 1)
|
|
1742
|
-
]),
|
|
1743
|
-
e("div", es, [
|
|
1744
|
-
u[4] || (u[4] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Received items", -1)),
|
|
1745
|
-
(f(!0), x(ue, null, be(p.deliveryOrder.received, (y, R) => {
|
|
1746
|
-
var k;
|
|
1747
|
-
return f(), x("div", { key: R }, [
|
|
1748
|
-
e("div", ts, [
|
|
1749
|
-
e("div", rs, [
|
|
1750
|
-
e("span", ss, _(y.sku.name), 1),
|
|
1751
|
-
e("span", os, _(y.sku.code), 1)
|
|
1752
|
-
]),
|
|
1753
|
-
e("div", ns, [
|
|
1754
|
-
e("div", as, [
|
|
1755
|
-
e("span", ls, _(h(ye)(y.amount, !1)), 1),
|
|
1756
|
-
e("span", is, _(((k = y.measurement) == null ? void 0 : k.abbrev) ?? y.sku.unit.abbrev), 1)
|
|
1757
|
-
]),
|
|
1758
|
-
e("div", cs, _(`${y.cost ? `(${h(Ve)(y.cost)})` : ""}`), 1)
|
|
1759
|
-
])
|
|
1760
|
-
])
|
|
1761
|
-
]);
|
|
1762
|
-
}), 128))
|
|
1763
|
-
]),
|
|
1764
|
-
e("div", us, [
|
|
1765
|
-
u[5] || (u[5] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Delivery order no.", -1)),
|
|
1766
|
-
e("div", ds, [
|
|
1767
|
-
I(d, {
|
|
1768
|
-
modelValue: h(n).deliveryOrderNumber,
|
|
1769
|
-
"onUpdate:modelValue": u[0] || (u[0] = (y) => h(n).deliveryOrderNumber = y),
|
|
1770
|
-
size: "md",
|
|
1771
|
-
placeholder: p.deliveryOrder.deliveryOrderNumber
|
|
1772
|
-
}, null, 8, ["modelValue", "placeholder"])
|
|
1773
|
-
])
|
|
1774
|
-
]),
|
|
1775
|
-
e("div", ms, [
|
|
1776
|
-
u[6] || (u[6] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Remark", -1)),
|
|
1777
|
-
e("div", ps, _(p.deliveryOrder.remark || "N/A"), 1)
|
|
1778
|
-
]),
|
|
1779
|
-
s.value >= 0 ? (f(), x("div", fs, [
|
|
1780
|
-
u[7] || (u[7] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fulfilment's sequence ", -1)),
|
|
1781
|
-
e("div", ys, _(s.value + 1), 1)
|
|
1782
|
-
])) : M("", !0)
|
|
1783
|
-
])
|
|
1784
|
-
])
|
|
1785
|
-
]),
|
|
1786
|
-
_: 1
|
|
1787
|
-
}, 8, ["modelValue"]);
|
|
1788
|
-
};
|
|
1789
|
-
}
|
|
1790
|
-
}), hs = { class: "flex flex-col gap-3" }, bs = { class: "flex flex-col gap-4" }, gs = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, _s = {
|
|
1791
|
-
key: 0,
|
|
1792
|
-
class: "flex flex-col gap-4"
|
|
1793
|
-
}, Ss = { class: "flex items-center justify-between" }, Os = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, xs = {
|
|
1794
|
-
key: 0,
|
|
1795
|
-
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
1796
|
-
}, ws = { class: "flex gap-4" }, $s = { class: "flex-1" }, Rs = { class: "flex-1" }, ks = {
|
|
1797
|
-
key: 0,
|
|
1798
|
-
class: "flex items-center text-fm-color-system-error-300"
|
|
1799
|
-
}, Ds = { class: "fm-typo-en-body-md-400" }, Ns = { class: "flex flex-col gap-4" }, Cs = { class: "flex justify-between items-center py-1 gap-4" }, As = { class: "flex flex-col" }, Ts = { class: "fm-typo-en-body-lg-600" }, qs = { class: "fm-typo-en-body-md-400" }, Fs = { class: "flex flex-col gap-2 items-end" }, Ps = {
|
|
1800
|
-
key: 0,
|
|
1801
|
-
class: "flex items-center gap-2"
|
|
1802
|
-
}, Is = {
|
|
1803
|
-
key: 0,
|
|
1804
|
-
class: "border-b border-fm-color-stroke-secondary"
|
|
1805
|
-
}, Es = { class: "flex flex-col gap-4" }, Ls = { class: "flex flex-col gap-4" }, Vs = { class: "flex flex-col gap-4" }, Bs = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, Us = /* @__PURE__ */ Se({
|
|
1806
|
-
__name: "CreateForm",
|
|
1807
|
-
props: {
|
|
1808
|
-
purchaseOrder: {},
|
|
1809
|
-
receivedInfoMap: {}
|
|
1810
|
-
},
|
|
1811
|
-
emits: ["submitted"],
|
|
1812
|
-
setup(g, { emit: r }) {
|
|
1813
|
-
var V, B, se;
|
|
1814
|
-
const { t: o } = st(), p = Y(!1), a = Me(), n = g, l = r, s = gt("", {
|
|
1815
|
-
default: {
|
|
1816
|
-
deliveryOrderNumber: "",
|
|
1817
|
-
remark: "",
|
|
1818
|
-
received: n.purchaseOrder.items.map((D) => ({
|
|
1819
|
-
sku: D.sku,
|
|
1820
|
-
amount: De.fromNumber(0),
|
|
1821
|
-
measurement: D.measurement
|
|
1822
|
-
})),
|
|
1823
|
-
createdBy: {
|
|
1824
|
-
id: ((V = a.sessionUser.value) == null ? void 0 : V.id) || "",
|
|
1825
|
-
name: ((B = a.sessionUser.value) == null ? void 0 : B.displayName) || ""
|
|
1826
|
-
},
|
|
1827
|
-
createdAt: ""
|
|
1828
|
-
}
|
|
1829
|
-
}), i = Ie(), O = Ye(), $ = Fe(), b = ((se = n.purchaseOrder) == null ? void 0 : se.supplier.internal) != null, q = b && $.enablePOSTransferRequireFulfillment, u = $.enablePortalDeliveryOrderWrite && (n.purchaseOrder.status === Z.Enum.RECEIVING || n.purchaseOrder.status === Z.Enum.COMPLETE) && (b ? !q : !0), C = $.enablePurchaseOrderReceiveWithCustomCost, d = $.enableBackdateReceive, c = Y({}), y = Pe(), R = H({
|
|
1830
|
-
get() {
|
|
1831
|
-
if (!s.createdAt) return "";
|
|
1832
|
-
const D = new Date(s.createdAt), S = D.getFullYear(), N = String(D.getMonth() + 1).padStart(2, "0"), t = String(D.getDate()).padStart(2, "0");
|
|
1833
|
-
return `${S}-${N}-${t}`;
|
|
1834
|
-
},
|
|
1835
|
-
set(D) {
|
|
1836
|
-
if (D) {
|
|
1837
|
-
const S = s.createdAt ? new Date(s.createdAt) : /* @__PURE__ */ new Date(), [N, t, m] = D.split("-");
|
|
1838
|
-
S.setFullYear(parseInt(N)), S.setMonth(parseInt(t) - 1), S.setDate(parseInt(m)), s.createdAt = S.toISOString();
|
|
1839
|
-
}
|
|
1840
|
-
}
|
|
1841
|
-
}), k = H({
|
|
1842
|
-
get() {
|
|
1843
|
-
if (!s.createdAt) return "";
|
|
1844
|
-
const D = new Date(s.createdAt), S = String(D.getHours()).padStart(2, "0"), N = String(D.getMinutes()).padStart(2, "0");
|
|
1845
|
-
return `${S}:${N}`;
|
|
1846
|
-
},
|
|
1847
|
-
set(D) {
|
|
1848
|
-
if (D) {
|
|
1849
|
-
const S = s.createdAt ? new Date(s.createdAt) : /* @__PURE__ */ new Date(), [N, t] = D.split(":");
|
|
1850
|
-
S.setHours(parseInt(N)), S.setMinutes(parseInt(t)), s.createdAt = S.toISOString();
|
|
1851
|
-
}
|
|
1852
|
-
}
|
|
1853
|
-
}), z = H(() => {
|
|
1854
|
-
const D = ze(n.purchaseOrder._id);
|
|
1855
|
-
if (!D) return "";
|
|
1856
|
-
const S = new Date(D), N = S.getFullYear(), t = String(S.getMonth() + 1).padStart(2, "0"), m = String(S.getDate()).padStart(2, "0");
|
|
1857
|
-
return `${N}-${t}-${m}`;
|
|
1858
|
-
}), T = H(() => {
|
|
1859
|
-
const D = ze(n.purchaseOrder._id);
|
|
1860
|
-
return D ? new Date(D) : null;
|
|
1861
|
-
}), K = H(() => {
|
|
1862
|
-
if (!R.value || !k.value || !T.value) return null;
|
|
1863
|
-
if (/* @__PURE__ */ new Date(`${R.value}T${k.value}:00`) < T.value) {
|
|
1864
|
-
const S = z.value, N = T.value.getHours(), t = T.value.getMinutes(), m = N >= 12 ? "PM" : "AM", A = N % 12 || 12, w = `${String(A).padStart(2, "0")}:${String(t).padStart(2, "0")} ${m}`;
|
|
1865
|
-
return `Delivery date & time cannot be earlier than order creation (${S} ${w})`;
|
|
1866
|
-
}
|
|
1867
|
-
return null;
|
|
1868
|
-
}), J = H(() => K.value ? !1 : s.received.some((S) => {
|
|
1869
|
-
const N = S.amount;
|
|
1870
|
-
return N ? +ye(N) > 0 : !1;
|
|
1871
|
-
}));
|
|
1872
|
-
function oe() {
|
|
1873
|
-
s.createdAt = "";
|
|
1874
|
-
}
|
|
1875
|
-
const ce = H(() => n.purchaseOrder.items.map((D, S) => H({
|
|
1876
|
-
get: () => {
|
|
1877
|
-
var t;
|
|
1878
|
-
const N = (t = s.received[S]) == null ? void 0 : t.amount;
|
|
1879
|
-
return N ? +ye(N) : 0;
|
|
1880
|
-
},
|
|
1881
|
-
set: (N) => {
|
|
1882
|
-
s.received[S].amount = ut(N, 2);
|
|
1883
|
-
}
|
|
1884
|
-
})));
|
|
1885
|
-
function Oe(D) {
|
|
1886
|
-
const S = !c.value[D];
|
|
1887
|
-
if (c.value[D] = S, S) {
|
|
1888
|
-
const N = n.purchaseOrder.items[D];
|
|
1889
|
-
N.totalCost ? s.received[D].cost = {
|
|
1890
|
-
currency: N.totalCost.currency,
|
|
1891
|
-
amount: N.totalCost.amount,
|
|
1892
|
-
precision: 4
|
|
1893
|
-
// Standardize to 4 decimals
|
|
1894
|
-
} : s.received[D].cost = {
|
|
1895
|
-
currency: Te(),
|
|
1896
|
-
amount: 0,
|
|
1897
|
-
precision: 4
|
|
1898
|
-
};
|
|
1899
|
-
} else
|
|
1900
|
-
delete s.received[D].cost;
|
|
1901
|
-
}
|
|
1902
|
-
const ge = H(() => n.purchaseOrder.items.map((D, S) => H({
|
|
1903
|
-
get: () => {
|
|
1904
|
-
var t;
|
|
1905
|
-
const N = (t = s.received[S]) == null ? void 0 : t.cost;
|
|
1906
|
-
return N ? +ye(N) : 0;
|
|
1907
|
-
},
|
|
1908
|
-
set: (N) => {
|
|
1909
|
-
s.received[S].cost = {
|
|
1910
|
-
currency: Te(),
|
|
1911
|
-
...ut(N, 4)
|
|
1912
|
-
};
|
|
1913
|
-
}
|
|
1914
|
-
})));
|
|
1915
|
-
function xe() {
|
|
1916
|
-
O.open({
|
|
1917
|
-
title: "Confirm Create Delivery Order",
|
|
1918
|
-
message: `Are you sure you want to create delivery order for PO# ${n.purchaseOrder.seqNumber}?`,
|
|
1919
|
-
primaryActions: {
|
|
1920
|
-
text: "Create",
|
|
1921
|
-
close: !0,
|
|
1922
|
-
variant: "primary"
|
|
1923
|
-
},
|
|
1924
|
-
secondaryActions: {
|
|
1925
|
-
text: "Cancel",
|
|
1926
|
-
close: !0
|
|
1927
|
-
}
|
|
1928
|
-
}).onPrimary(() => he());
|
|
1929
|
-
}
|
|
1930
|
-
function he() {
|
|
1931
|
-
i.createDeliveryOrder({
|
|
1932
|
-
deliveryOrder: s,
|
|
1933
|
-
purchaseOrderId: n.purchaseOrder._id,
|
|
1934
|
-
purchaseOrderRev: n.purchaseOrder._rev,
|
|
1935
|
-
currency: Te()
|
|
1936
|
-
}).then(() => {
|
|
1937
|
-
y.open(
|
|
1938
|
-
{
|
|
1939
|
-
title: "Success",
|
|
1940
|
-
message: `New delivery order created for PO# ${n.purchaseOrder.seqNumber}`,
|
|
1941
|
-
type: "success"
|
|
1942
|
-
},
|
|
1943
|
-
1e4
|
|
1944
|
-
), p.value = !1, l("submitted");
|
|
1945
|
-
});
|
|
1946
|
-
}
|
|
1947
|
-
return (D, S) => {
|
|
1948
|
-
const N = G("FmButton"), t = G("FmDatePicker"), m = G("FmTimePicker"), A = G("FmIcon"), w = G("FmStepperField"), j = G("FmSwitch"), U = G("FmTextField"), ee = G("FmDialog");
|
|
1949
|
-
return f(), le(ee, {
|
|
1950
|
-
modelValue: p.value,
|
|
1951
|
-
"onUpdate:modelValue": S[4] || (S[4] = (v) => p.value = v),
|
|
1952
|
-
overlay: !0,
|
|
1953
|
-
"min-width": 800
|
|
1954
|
-
}, {
|
|
1955
|
-
"dialog-button": X(() => [
|
|
1956
|
-
h(u) ? (f(), le(N, {
|
|
1957
|
-
key: 0,
|
|
1958
|
-
variant: "primary",
|
|
1959
|
-
label: "Create",
|
|
1960
|
-
size: "md",
|
|
1961
|
-
"prepend-icon": "add",
|
|
1962
|
-
class: "w-full"
|
|
1963
|
-
})) : M("", !0)
|
|
1964
|
-
]),
|
|
1965
|
-
"dialog-header": X(() => [
|
|
1966
|
-
e("div", null, "Order #" + _(n.purchaseOrder.seqNumber) + " (New Delivery Order)", 1)
|
|
1967
|
-
]),
|
|
1968
|
-
"dialog-footer": X(() => [
|
|
1969
|
-
I(N, {
|
|
1970
|
-
class: "ml-auto",
|
|
1971
|
-
label: "Create",
|
|
1972
|
-
size: "md",
|
|
1973
|
-
variant: "destructive",
|
|
1974
|
-
disabled: !J.value,
|
|
1975
|
-
onClick: xe
|
|
1976
|
-
}, null, 8, ["disabled"])
|
|
1977
|
-
]),
|
|
1978
|
-
default: X(() => {
|
|
1979
|
-
var v;
|
|
1980
|
-
return [
|
|
1981
|
-
e("div", hs, [
|
|
1982
|
-
e("div", bs, [
|
|
1983
|
-
S[5] || (S[5] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Received by", -1)),
|
|
1984
|
-
e("div", gs, _((v = h(a).sessionUser.value) == null ? void 0 : v.displayName), 1)
|
|
1985
|
-
]),
|
|
1986
|
-
h(d) ? (f(), x("div", _s, [
|
|
1987
|
-
e("div", Ss, [
|
|
1988
|
-
e("div", Os, [
|
|
1989
|
-
S[6] || (S[6] = Ne(" Delivery Date & Time ")),
|
|
1990
|
-
!R.value && !k.value ? (f(), x("div", xs, " Leave blank to use current date & time ")) : M("", !0)
|
|
1991
|
-
]),
|
|
1992
|
-
R.value || k.value ? (f(), le(N, {
|
|
1993
|
-
key: 0,
|
|
1994
|
-
variant: "tertiary",
|
|
1995
|
-
label: "Clear",
|
|
1996
|
-
"prepend-icon": "close",
|
|
1997
|
-
onClick: oe
|
|
1998
|
-
})) : M("", !0)
|
|
1999
|
-
]),
|
|
2000
|
-
e("div", ws, [
|
|
2001
|
-
e("div", $s, [
|
|
2002
|
-
I(t, {
|
|
2003
|
-
modelValue: R.value,
|
|
2004
|
-
"onUpdate:modelValue": S[0] || (S[0] = (L) => R.value = L)
|
|
2005
|
-
}, null, 8, ["modelValue"])
|
|
2006
|
-
]),
|
|
2007
|
-
e("div", Rs, [
|
|
2008
|
-
I(m, {
|
|
2009
|
-
modelValue: k.value,
|
|
2010
|
-
"onUpdate:modelValue": S[1] || (S[1] = (L) => k.value = L)
|
|
2011
|
-
}, null, 8, ["modelValue"])
|
|
2012
|
-
])
|
|
2013
|
-
]),
|
|
2014
|
-
K.value ? (f(), x("div", ks, [
|
|
2015
|
-
I(A, {
|
|
2016
|
-
name: "error",
|
|
2017
|
-
class: "inline-block mr-1",
|
|
2018
|
-
size: "sm"
|
|
2019
|
-
}),
|
|
2020
|
-
e("div", Ds, _(K.value), 1)
|
|
2021
|
-
])) : M("", !0)
|
|
2022
|
-
])) : M("", !0),
|
|
2023
|
-
e("div", Ns, [
|
|
2024
|
-
S[8] || (S[8] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Items going to receive ", -1)),
|
|
2025
|
-
(f(!0), x(ue, null, be(n.purchaseOrder.items, (L, W) => {
|
|
2026
|
-
var te, E, ne;
|
|
2027
|
-
return f(), x("div", { key: W }, [
|
|
2028
|
-
e("div", Cs, [
|
|
2029
|
-
e("div", As, [
|
|
2030
|
-
e("span", Ts, _(L.sku.name), 1),
|
|
2031
|
-
e("span", qs, _(L.sku.code), 1)
|
|
2032
|
-
]),
|
|
2033
|
-
e("div", Fs, [
|
|
2034
|
-
I(w, {
|
|
2035
|
-
label: "Receive Quantity",
|
|
2036
|
-
modelValue: ce.value[W].value,
|
|
2037
|
-
"onUpdate:modelValue": (de) => ce.value[W].value = de,
|
|
2038
|
-
"helper-text": `${h(o)("inventory.transfer.receiveRequest.details.received")} ${h(De).toFormatString(
|
|
2039
|
-
{
|
|
2040
|
-
value: (te = D.receivedInfoMap[L.sku._id]) == null ? void 0 : te.received
|
|
2041
|
-
}
|
|
2042
|
-
)} ${((E = L.measurement) == null ? void 0 : E.abbrev) ?? L.sku.unit.abbrev}`,
|
|
2043
|
-
min: 0,
|
|
2044
|
-
"append-text": ((ne = L.measurement) == null ? void 0 : ne.abbrev) ?? L.sku.unit.abbrev
|
|
2045
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "helper-text", "append-text"]),
|
|
2046
|
-
h(C) ? (f(), x("div", Ps, [
|
|
2047
|
-
I(j, {
|
|
2048
|
-
"model-value": c.value[W],
|
|
2049
|
-
"onUpdate:modelValue": (de) => Oe(W),
|
|
2050
|
-
size: "sm"
|
|
2051
|
-
}, null, 8, ["model-value", "onUpdate:modelValue"]),
|
|
2052
|
-
S[7] || (S[7] = e("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Override cost ", -1))
|
|
2053
|
-
])) : M("", !0),
|
|
2054
|
-
h(C) && c.value[W] ? (f(), le(w, {
|
|
2055
|
-
key: 1,
|
|
2056
|
-
modelValue: ge.value[W].value,
|
|
2057
|
-
"onUpdate:modelValue": (de) => ge.value[W].value = de,
|
|
2058
|
-
label: "Total Cost",
|
|
2059
|
-
step: 1e-4,
|
|
2060
|
-
min: 0,
|
|
2061
|
-
placeholder: "0.0000",
|
|
2062
|
-
size: "sm",
|
|
2063
|
-
"append-text": h(Te)()
|
|
2064
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "append-text"])) : M("", !0)
|
|
2065
|
-
])
|
|
2066
|
-
]),
|
|
2067
|
-
W < n.purchaseOrder.items.length - 1 ? (f(), x("div", Is)) : M("", !0)
|
|
2068
|
-
]);
|
|
2069
|
-
}), 128))
|
|
2070
|
-
]),
|
|
2071
|
-
e("div", Es, [
|
|
2072
|
-
S[9] || (S[9] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Delivery order no.", -1)),
|
|
2073
|
-
e("div", Ls, [
|
|
2074
|
-
I(U, {
|
|
2075
|
-
modelValue: h(s).deliveryOrderNumber,
|
|
2076
|
-
"onUpdate:modelValue": S[2] || (S[2] = (L) => h(s).deliveryOrderNumber = L),
|
|
2077
|
-
size: "md"
|
|
2078
|
-
}, null, 8, ["modelValue"])
|
|
2079
|
-
])
|
|
2080
|
-
]),
|
|
2081
|
-
e("div", Vs, [
|
|
2082
|
-
S[10] || (S[10] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Remark", -1)),
|
|
2083
|
-
e("div", Bs, [
|
|
2084
|
-
I(U, {
|
|
2085
|
-
modelValue: h(s).remark,
|
|
2086
|
-
"onUpdate:modelValue": S[3] || (S[3] = (L) => h(s).remark = L),
|
|
2087
|
-
size: "md"
|
|
2088
|
-
}, null, 8, ["modelValue"])
|
|
2089
|
-
])
|
|
2090
|
-
])
|
|
2091
|
-
])
|
|
2092
|
-
];
|
|
2093
|
-
}),
|
|
2094
|
-
_: 1
|
|
2095
|
-
}, 8, ["modelValue"]);
|
|
2096
|
-
};
|
|
2097
|
-
}
|
|
2098
|
-
}), Ms = { class: "flex flex-col w-full gap-3" }, js = { class: "flex" }, zs = { class: "fm-typo-en-title-md-600 text-fm-color-typo-primary" }, Ks = { class: "flex flex-col gap-16 w-full h-full" }, Hs = { class: "flex justify-between" }, Gs = { class: "fm-typo-en-body-lg-600" }, Ws = { class: "flex gap-2" }, Ys = {
|
|
2099
|
-
key: 0,
|
|
2100
|
-
class: "flex items-center gap-1"
|
|
2101
|
-
}, Qs = { class: "fm-typo-en-body-md-400" }, Xs = { class: "flex flex-col gap-8" }, Zs = { class: "flex flex-col gap-4" }, Js = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, eo = { class: "flex gap-1" }, to = { class: "fm-typo-en-body-lg-600" }, ro = {
|
|
2102
|
-
key: 0,
|
|
2103
|
-
class: "flex flex-col gap-4"
|
|
2104
|
-
}, so = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, oo = { class: "fm-typo-en-body-lg-600" }, no = { class: "flex flex-col gap-4" }, ao = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, lo = { class: "fm-typo-en-body-lg-600" }, io = {
|
|
2105
|
-
key: 1,
|
|
2106
|
-
class: "flex flex-col gap-4"
|
|
2107
|
-
}, co = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, uo = { class: "fm-typo-en-body-lg-600" }, mo = {
|
|
2108
|
-
key: 2,
|
|
2109
|
-
class: "flex flex-col gap-4"
|
|
2110
|
-
}, po = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, fo = { class: "fm-typo-en-body-lg-600" }, yo = {
|
|
2111
|
-
key: 3,
|
|
2112
|
-
class: "flex flex-col gap-4"
|
|
2113
|
-
}, vo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ho = { class: "fm-typo-en-body-lg-600" }, bo = {
|
|
2114
|
-
key: 4,
|
|
2115
|
-
class: "flex flex-col gap-4"
|
|
2116
|
-
}, go = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _o = { class: "fm-typo-en-body-lg-600" }, So = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Oo = { class: "flex flex-col gap-8" }, xo = { class: "flex gap-8 items-center" }, wo = { class: "flex-1 fm-typo-en-body-lg-600" }, $o = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-4" }, Ro = { class: "flex w-full gap-4" }, ko = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2 flex items-center gap-2" }, Do = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-2" }, No = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, Co = ["innerHTML"], Ao = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, To = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, qo = {
|
|
2117
|
-
key: 0,
|
|
2118
|
-
class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
|
|
2119
|
-
}, Fo = { class: "py-8" }, Po = { class: "flex justify-end gap-4 items-center" }, Io = { class: "fm-typo-en-body-lg-600" }, Eo = {
|
|
2120
|
-
key: 1,
|
|
2121
|
-
class: "flex-1 xs:w-screen xs:max-w-full"
|
|
2122
|
-
}, Lo = {
|
|
2123
|
-
key: 0,
|
|
2124
|
-
class: "flex flex-col items-center gap-8 h-full"
|
|
2125
|
-
}, Vo = ["src"], Bo = { class: "fm-typo-en-body-lg-600" }, Uo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, Mo = {
|
|
2126
|
-
key: 1,
|
|
2127
|
-
class: "px-4 flex flex-col"
|
|
2128
|
-
}, jo = { class: "flex gap-12 content-stretch" }, zo = {
|
|
2129
|
-
class: "flex flex-col w-40",
|
|
2130
|
-
name: "circles"
|
|
2131
|
-
}, Ko = { class: "flex-1 flex flex-col items-center" }, Ho = { class: "h-40 w-40 bg-fm-color-primary rounded-full flex items-center justify-center" }, Go = { class: "flex-1 flex flex-col items-center" }, Wo = { class: "flex w-full items-center gap-4" }, Yo = {
|
|
2132
|
-
class: "py-12 flex flex-col gap-4",
|
|
2133
|
-
name: "received-at header"
|
|
2134
|
-
}, Qo = { class: "fm-typo-en-body-lg-400" }, Xo = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Zo = { class: "ml-auto" }, Jo = { class: "flex gap-12 content-stretch" }, en = {
|
|
2135
|
-
class: "flex flex-col w-40",
|
|
2136
|
-
name: "circles"
|
|
2137
|
-
}, tn = { class: "flex-1 flex flex-col items-center" }, rn = {
|
|
2138
|
-
class: "py-12 flex flex-col gap-4 flex-1",
|
|
2139
|
-
name: "delivery details"
|
|
2140
|
-
}, sn = { class: "flex flex-col gap-8" }, on = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, nn = { class: "flex flex-col gap-4" }, an = { class: "flex gap-8 xs:flex-col" }, _n = /* @__PURE__ */ Se({
|
|
2141
|
-
__name: "TransferDetails",
|
|
2142
|
-
props: {
|
|
2143
|
-
poRequest: {},
|
|
2144
|
-
purchaseOrder: {},
|
|
2145
|
-
transferTo: {},
|
|
2146
|
-
transferToDbName: {},
|
|
2147
|
-
show: { type: Boolean },
|
|
2148
|
-
canResubmit: { type: Boolean },
|
|
2149
|
-
canApprove: { type: Boolean },
|
|
2150
|
-
scope: {},
|
|
2151
|
-
receivedMap: {},
|
|
2152
|
-
shipments: {}
|
|
2153
|
-
},
|
|
2154
|
-
emits: ["update:show", "submitted"],
|
|
2155
|
-
setup(g, { emit: r }) {
|
|
2156
|
-
const o = g, p = r, a = Ye(), n = Pe(), l = Fe(), s = _e(), i = Me(), O = H(
|
|
2157
|
-
() => {
|
|
2158
|
-
var t, m;
|
|
2159
|
-
return {
|
|
2160
|
-
id: ((t = i.sessionUser.value) == null ? void 0 : t.id) ?? "",
|
|
2161
|
-
name: ((m = i.sessionUser.value) == null ? void 0 : m.displayName) ?? ""
|
|
2162
|
-
};
|
|
2163
|
-
}
|
|
2164
|
-
), $ = Zt(), { t: b } = st(), q = H(
|
|
2165
|
-
() => {
|
|
2166
|
-
var t, m, A, w;
|
|
2167
|
-
return ((m = (t = o.purchaseOrder) == null ? void 0 : t.supplier) == null ? void 0 : m.internal) === "restaurant" || ((w = (A = o.purchaseOrder) == null ? void 0 : A.supplier) == null ? void 0 : w.internal) === "warehouse" ? Ce.TRANSFER : Ce.PURCHASE;
|
|
2168
|
-
}
|
|
2169
|
-
), u = H(() => {
|
|
2170
|
-
var A;
|
|
2171
|
-
const t = (A = o.shipments) == null ? void 0 : A.find((w) => {
|
|
2172
|
-
var j;
|
|
2173
|
-
return w.ref === ((j = o.purchaseOrder) == null ? void 0 : j._id);
|
|
2174
|
-
});
|
|
2175
|
-
let m = null;
|
|
2176
|
-
if (t != null && t.milestones && t.milestones.length > 0) {
|
|
2177
|
-
const w = t.milestones[t.milestones.length - 1];
|
|
2178
|
-
if (w.estimatedTime) {
|
|
2179
|
-
const j = new Date(w.estimatedTime), U = j.getDate().toString().padStart(2, "0");
|
|
2180
|
-
m = `${j.toLocaleString("en-US", { month: "short" })} ${U}`;
|
|
2181
|
-
}
|
|
2182
|
-
}
|
|
2183
|
-
return m;
|
|
2184
|
-
}), C = Y(!1), d = Y(""), c = Y(!0), y = Ie(), R = Mt(y.getWorkflowConfig), k = Ot(), z = H(() => {
|
|
2185
|
-
if (!o.purchaseOrder)
|
|
2186
|
-
return [];
|
|
2187
|
-
const t = R.result.value;
|
|
2188
|
-
if (t.state === dt.loading)
|
|
2189
|
-
return [];
|
|
2190
|
-
const m = {
|
|
2191
|
-
user: O.value,
|
|
2192
|
-
executedAt: s.locations.computeFirst(
|
|
2193
|
-
(w) => {
|
|
2194
|
-
var j;
|
|
2195
|
-
return w.dbName === ((j = s._currentLocation) == null ? void 0 : j.dbName) ? w : null;
|
|
2196
|
-
}
|
|
2197
|
-
),
|
|
2198
|
-
purchaseOrderRequest: o.poRequest,
|
|
2199
|
-
purchaseOrder: o.purchaseOrder
|
|
2200
|
-
};
|
|
2201
|
-
let A = [];
|
|
2202
|
-
try {
|
|
2203
|
-
t.state === dt.error ? (console.error("Error fetching workflow config:", t.error), A = Qe.getAvailableActions({
|
|
2204
|
-
...m,
|
|
2205
|
-
orderConfig: Qe.getDefaultConfig()
|
|
2206
|
-
}).actions.filter(
|
|
2207
|
-
(w) => (
|
|
2208
|
-
// TODO: create receiveStock & processRequest dialog
|
|
2209
|
-
// to create their payload
|
|
2210
|
-
w !== F.enum.receiveStock && w !== F.enum.processRequest && w !== F.enum.closeRequest
|
|
2211
|
-
)
|
|
2212
|
-
)) : A = Qe.getAvailableActions({
|
|
2213
|
-
...m,
|
|
2214
|
-
orderConfig: t.data
|
|
2215
|
-
}).actions.filter(
|
|
2216
|
-
(w) => w !== F.enum.receiveStock && w !== F.enum.processRequest && w !== F.enum.closeRequest
|
|
2217
|
-
);
|
|
2218
|
-
} catch (w) {
|
|
2219
|
-
console.error("Error getting available actions:", w);
|
|
2220
|
-
}
|
|
2221
|
-
return o.scope === "approval" && (A = A.filter((w) => w !== F.enum.completeReceive)), A;
|
|
2222
|
-
}), T = Ft(o, "show"), K = H(() => [
|
|
2223
|
-
{
|
|
2224
|
-
label: b("inventory.transfer.receiveRequest.details.overview"),
|
|
2225
|
-
value: "overview"
|
|
2226
|
-
},
|
|
2227
|
-
{
|
|
2228
|
-
label: b("inventory.transfer.receiveRequest.details.deliveryHistory"),
|
|
2229
|
-
value: "deliveryHistory"
|
|
2230
|
-
}
|
|
2231
|
-
]), J = Y(K.value[0]);
|
|
2232
|
-
Ct(
|
|
2233
|
-
() => o.show,
|
|
2234
|
-
(t) => {
|
|
2235
|
-
t && (J.value = K.value[0]);
|
|
2236
|
-
}
|
|
2237
|
-
);
|
|
2238
|
-
async function oe(t, m, A, w, j) {
|
|
2239
|
-
return new Promise((U, ee) => {
|
|
2240
|
-
a.open({
|
|
2241
|
-
closeButton: !1,
|
|
2242
|
-
title: w.title,
|
|
2243
|
-
message: w.message,
|
|
2244
|
-
primaryActions: w.primaryActions,
|
|
2245
|
-
secondaryActions: { text: "No", close: !1 }
|
|
2246
|
-
}).onPrimary(async () => {
|
|
2247
|
-
var L, W, te, E;
|
|
2248
|
-
const v = [];
|
|
2249
|
-
A === F.enum.approveRequest ? (v.push({
|
|
2250
|
-
action: "approveRequest",
|
|
2251
|
-
payload: null
|
|
2252
|
-
}), m.fulfillment && v.push({
|
|
2253
|
-
action: "processRequest",
|
|
2254
|
-
payload: {
|
|
2255
|
-
fulfillmentId: "",
|
|
2256
|
-
deliveryOrderNumber: "",
|
|
2257
|
-
deliveryRemark: null,
|
|
2258
|
-
items: m.fulfillment.items,
|
|
2259
|
-
createdBy: O.value
|
|
2260
|
-
}
|
|
2261
|
-
})) : A === F.enum.processRequest ? m.fulfillment && v.push({
|
|
2262
|
-
action: "processRequest",
|
|
2263
|
-
payload: {
|
|
2264
|
-
fulfillmentId: "",
|
|
2265
|
-
deliveryOrderNumber: "",
|
|
2266
|
-
deliveryRemark: null,
|
|
2267
|
-
items: m.fulfillment.items,
|
|
2268
|
-
createdBy: O.value
|
|
2269
|
-
}
|
|
2270
|
-
}) : A === F.enum.rejectRequest ? v.push({
|
|
2271
|
-
action: "rejectRequest",
|
|
2272
|
-
payload: null
|
|
2273
|
-
}) : A === F.enum.closeRequest && v.push({
|
|
2274
|
-
action: "closeRequest",
|
|
2275
|
-
payload: null
|
|
2276
|
-
});
|
|
2277
|
-
try {
|
|
2278
|
-
await k({
|
|
2279
|
-
operate: {
|
|
2280
|
-
operation: A,
|
|
2281
|
-
doc: t,
|
|
2282
|
-
options: m
|
|
2283
|
-
},
|
|
2284
|
-
operateV2: {
|
|
2285
|
-
_id: ((L = o.purchaseOrder) == null ? void 0 : L._id) ?? "",
|
|
2286
|
-
_rev: ((W = o.purchaseOrder) == null ? void 0 : W._rev) ?? "",
|
|
2287
|
-
action: A,
|
|
2288
|
-
payloads: v
|
|
2289
|
-
// add payload if action is receiveStock or processRequest
|
|
2290
|
-
},
|
|
2291
|
-
transferTo: (E = (te = o.poRequest) == null ? void 0 : te.to) == null ? void 0 : E.dbName
|
|
2292
|
-
}).delayed(1e3), U("submitted");
|
|
2293
|
-
} catch (ne) {
|
|
2294
|
-
ee(ne);
|
|
2295
|
-
}
|
|
2296
|
-
}).onSecondary(() => {
|
|
2297
|
-
U("cancelled");
|
|
2298
|
-
for (let v = 0; v < j + 2; v++)
|
|
2299
|
-
a.close();
|
|
2300
|
-
}).onClose(() => {
|
|
2301
|
-
});
|
|
2302
|
-
});
|
|
2303
|
-
}
|
|
2304
|
-
async function ce(t) {
|
|
2305
|
-
var j, U, ee, v;
|
|
2306
|
-
if (t === F.enum.receiveStock)
|
|
2307
|
-
return;
|
|
2308
|
-
const m = St[t];
|
|
2309
|
-
if (!m) {
|
|
2310
|
-
n.open({
|
|
2311
|
-
title: "Something went wrong",
|
|
2312
|
-
message: `Cannot process order: ${rt(t)}`,
|
|
2313
|
-
type: "error"
|
|
2314
|
-
});
|
|
2315
|
-
return;
|
|
2316
|
-
}
|
|
2317
|
-
const { successMessage: A, ...w } = m;
|
|
2318
|
-
if (o.purchaseOrder) {
|
|
2319
|
-
d.value = `${t}`, C.value = !0, c.value = !1;
|
|
2320
|
-
const L = {};
|
|
2321
|
-
let W = 0;
|
|
2322
|
-
if ((t === F.enum.confirmDraft || // auto receive for warehouse to warehouse
|
|
2323
|
-
t === F.enum.completeReceive) && l.autoReceiveWarehouse)
|
|
2324
|
-
L.autoReceive = !0;
|
|
2325
|
-
else if ((t === F.enum.approveRequest || t === F.enum.processRequest) && l.acceptRequireFulfillment) {
|
|
2326
|
-
const te = (U = (j = o.poRequest) == null ? void 0 : j.from) == null ? void 0 : U.dbName, E = (v = (ee = o.poRequest) == null ? void 0 : ee.to) == null ? void 0 : v.dbName;
|
|
2327
|
-
if (te && E && (te.startsWith("warehouse_") || E.startsWith("warehouse_"))) {
|
|
2328
|
-
const ne = await new Promise((de, we) => {
|
|
2329
|
-
a.open({
|
|
2330
|
-
closeButton: !1,
|
|
2331
|
-
title: "Confirm transfer amount",
|
|
2332
|
-
dialogComponent: Xt,
|
|
2333
|
-
dialogComponentProps: {
|
|
2334
|
-
purchaseOrder: o.purchaseOrder,
|
|
2335
|
-
confirm: de,
|
|
2336
|
-
"onUpdate:show": ($e) => {
|
|
2337
|
-
$e || (d.value = "", C.value = !1, c.value = !0, W++, a.close()), we("cancelled");
|
|
2338
|
-
}
|
|
2339
|
-
}
|
|
2340
|
-
});
|
|
2341
|
-
});
|
|
2342
|
-
L.fulfillment = ne;
|
|
2343
|
-
}
|
|
2344
|
-
}
|
|
2345
|
-
try {
|
|
2346
|
-
await oe(
|
|
2347
|
-
o.purchaseOrder,
|
|
2348
|
-
L,
|
|
2349
|
-
t,
|
|
2350
|
-
m,
|
|
2351
|
-
W
|
|
2352
|
-
) === "submitted" && (n.open({
|
|
2353
|
-
title: "Success",
|
|
2354
|
-
message: A,
|
|
2355
|
-
type: "success"
|
|
2356
|
-
}), p("update:show", !1), p("submitted"));
|
|
2357
|
-
} catch (te) {
|
|
2358
|
-
n.open({
|
|
2359
|
-
title: "Something went wrong",
|
|
2360
|
-
message: "Please try again.",
|
|
2361
|
-
type: "error"
|
|
2362
|
-
}), console.error("Error when submitting PO operation", t, o.purchaseOrder, te);
|
|
2363
|
-
} finally {
|
|
2364
|
-
d.value = "", C.value = !1, c.value = !0;
|
|
2365
|
-
}
|
|
2366
|
-
}
|
|
2367
|
-
}
|
|
2368
|
-
const Oe = H(() => {
|
|
2369
|
-
var t, m;
|
|
2370
|
-
return ((t = o.purchaseOrder) == null ? void 0 : t.status) === Z.enum.RECEIVING || ((m = o.purchaseOrder) == null ? void 0 : m.status) === Z.enum.COMPLETE;
|
|
2371
|
-
}), ge = H(() => o.purchaseOrder ? He(o.purchaseOrder) : {}), xe = H(() => {
|
|
2372
|
-
const t = o.purchaseOrder;
|
|
2373
|
-
if (!t) return { status: "", statusClass: "" };
|
|
2374
|
-
const { partial: m, over: A } = Je(ge.value), w = et(t.status, m, A);
|
|
2375
|
-
let j = b(`inventory.transfer.status.${w}`), U = `${t.status}`.toLocaleLowerCase("en-us");
|
|
2376
|
-
return w === Z.enum.CLOSE && (j = `${b(`inventory.transfer.status.${Z.enum.COMPLETE}`)}`), w === "PARTIAL_RECEIVED" && U === Z.enum.PROCESSING.toLocaleLowerCase("en-us") && (U = Z.enum.RECEIVING.toLocaleLowerCase("en-us")), {
|
|
2377
|
-
status: j,
|
|
2378
|
-
statusClass: `fm-status-badge fm-status-badge-${U}`
|
|
2379
|
-
};
|
|
2380
|
-
}), he = H(() => {
|
|
2381
|
-
var U, ee;
|
|
2382
|
-
const t = ((U = o.purchaseOrder) == null ? void 0 : U.deliveryOrder) ?? [], m = ((ee = o.purchaseOrder) == null ? void 0 : ee.deliveryFullfillment) ?? [], A = [
|
|
2383
|
-
...t.map((v) => ({
|
|
2384
|
-
createdAt: v.createdAt,
|
|
2385
|
-
type: "grn",
|
|
2386
|
-
doc: v
|
|
2387
|
-
})),
|
|
2388
|
-
...m.map((v) => ({
|
|
2389
|
-
createdAt: v.createdAt,
|
|
2390
|
-
type: "fulfillment",
|
|
2391
|
-
doc: v
|
|
2392
|
-
}))
|
|
2393
|
-
];
|
|
2394
|
-
A.reverse().sort((v, L) => v.createdAt.localeCompare(L.createdAt));
|
|
2395
|
-
function w(v) {
|
|
2396
|
-
var te, E, ne, de, we, $e, Q, ie, ae, pe;
|
|
2397
|
-
const L = m.findIndex((re) => re.id === v.fullfillmentId), W = [
|
|
2398
|
-
(E = (te = m[L]) == null ? void 0 : te.netSuite) != null && E.refNo ? {
|
|
2399
|
-
label: "Fulfillment's ref no. (Netsuite)",
|
|
2400
|
-
values: [(de = (ne = m[L]) == null ? void 0 : ne.netSuite) == null ? void 0 : de.refNo]
|
|
2401
|
-
} : null,
|
|
2402
|
-
(we = v == null ? void 0 : v.netSuite) != null && we.refNo ? {
|
|
2403
|
-
label: "Netsuite ref no.",
|
|
2404
|
-
values: [`${($e = v == null ? void 0 : v.netSuite) == null ? void 0 : $e.refNo} (${((Q = v == null ? void 0 : v.netSuite) == null ? void 0 : Q.id) ?? "-"})`]
|
|
2405
|
-
} : null,
|
|
2406
|
-
(ie = v == null ? void 0 : v.netSuite) != null && ie.recordType ? {
|
|
2407
|
-
label: "Netsuite Type",
|
|
2408
|
-
values: [ht((ae = v == null ? void 0 : v.netSuite) == null ? void 0 : ae.recordType)]
|
|
2409
|
-
} : null
|
|
2410
|
-
];
|
|
2411
|
-
return {
|
|
2412
|
-
header: "Received",
|
|
2413
|
-
deliveryOrder: v,
|
|
2414
|
-
date: Ue(new Date(v.createdAt)),
|
|
2415
|
-
info: [
|
|
2416
|
-
{
|
|
2417
|
-
label: "Adjustment date",
|
|
2418
|
-
values: [
|
|
2419
|
-
v.adjustment ? Ue(new Date(ze(v.adjustment))) : "-"
|
|
2420
|
-
]
|
|
2421
|
-
},
|
|
2422
|
-
{
|
|
2423
|
-
label: "Received by",
|
|
2424
|
-
values: [(pe = v.createdBy) == null ? void 0 : pe.name]
|
|
2425
|
-
},
|
|
2426
|
-
{
|
|
2427
|
-
label: "Received items",
|
|
2428
|
-
values: v.received.map((re) => {
|
|
2429
|
-
var Re;
|
|
2430
|
-
return P("div", [
|
|
2431
|
-
P(
|
|
2432
|
-
"div",
|
|
2433
|
-
{
|
|
2434
|
-
class: "flex gap-4"
|
|
2435
|
-
},
|
|
2436
|
-
[
|
|
2437
|
-
P(
|
|
2438
|
-
"div",
|
|
2439
|
-
{
|
|
2440
|
-
class: "flex flex-col"
|
|
2441
|
-
},
|
|
2442
|
-
[
|
|
2443
|
-
P(
|
|
2444
|
-
"span",
|
|
2445
|
-
{
|
|
2446
|
-
class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
|
|
2447
|
-
},
|
|
2448
|
-
`${re.sku.name}`
|
|
2449
|
-
),
|
|
2450
|
-
P(
|
|
2451
|
-
"span",
|
|
2452
|
-
{
|
|
2453
|
-
class: "fm-typo-en-body-md-400"
|
|
2454
|
-
},
|
|
2455
|
-
`${re.sku.code} `
|
|
2456
|
-
)
|
|
2457
|
-
]
|
|
2458
|
-
),
|
|
2459
|
-
P(
|
|
2460
|
-
"div",
|
|
2461
|
-
{
|
|
2462
|
-
class: "ml-auto flex flex-col"
|
|
2463
|
-
},
|
|
2464
|
-
[
|
|
2465
|
-
P(
|
|
2466
|
-
"div",
|
|
2467
|
-
{
|
|
2468
|
-
class: "ml-auto flex gap-1"
|
|
2469
|
-
},
|
|
2470
|
-
[
|
|
2471
|
-
P(
|
|
2472
|
-
"span",
|
|
2473
|
-
{
|
|
2474
|
-
class: "fm-typo-en-body-lg-600 self-end"
|
|
2475
|
-
},
|
|
2476
|
-
ye(re.amount, !1)
|
|
2477
|
-
),
|
|
2478
|
-
P(
|
|
2479
|
-
"span",
|
|
2480
|
-
{
|
|
2481
|
-
class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
|
|
2482
|
-
},
|
|
2483
|
-
((Re = re.measurement) == null ? void 0 : Re.abbrev) ?? re.sku.unit.abbrev
|
|
2484
|
-
)
|
|
2485
|
-
]
|
|
2486
|
-
),
|
|
2487
|
-
P(
|
|
2488
|
-
"div",
|
|
2489
|
-
{
|
|
2490
|
-
class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
2491
|
-
},
|
|
2492
|
-
`${re.cost ? `(${Ve(re.cost)})` : ""}`
|
|
2493
|
-
)
|
|
2494
|
-
]
|
|
2495
|
-
)
|
|
2496
|
-
]
|
|
2497
|
-
)
|
|
2498
|
-
]);
|
|
2499
|
-
})
|
|
2500
|
-
},
|
|
2501
|
-
{
|
|
2502
|
-
label: "Delivery order no.",
|
|
2503
|
-
values: [v.deliveryOrderNumber || "N/A"]
|
|
2504
|
-
},
|
|
2505
|
-
{
|
|
2506
|
-
label: "Remark",
|
|
2507
|
-
values: [v.remark || "N/A"]
|
|
2508
|
-
},
|
|
2509
|
-
L > -1 ? {
|
|
2510
|
-
label: "Fulfilment's sequence",
|
|
2511
|
-
values: [`${L + 1}`]
|
|
2512
|
-
} : null,
|
|
2513
|
-
...W
|
|
2514
|
-
].filter((re) => !!re)
|
|
2515
|
-
};
|
|
2516
|
-
}
|
|
2517
|
-
function j(v) {
|
|
2518
|
-
var W, te;
|
|
2519
|
-
const L = m.findIndex((E) => E.id === v.id);
|
|
2520
|
-
return {
|
|
2521
|
-
header: "Fulfillment",
|
|
2522
|
-
date: Ue(new Date(v.createdAt)),
|
|
2523
|
-
info: [
|
|
2524
|
-
{
|
|
2525
|
-
label: "Sequence",
|
|
2526
|
-
values: [String(L + 1)]
|
|
2527
|
-
},
|
|
2528
|
-
{
|
|
2529
|
-
label: "Receiveable items",
|
|
2530
|
-
values: v.items.map((E) => {
|
|
2531
|
-
var ne;
|
|
2532
|
-
return P("div", [
|
|
2533
|
-
P(
|
|
2534
|
-
"div",
|
|
2535
|
-
{
|
|
2536
|
-
class: "flex gap-4"
|
|
2537
|
-
},
|
|
2538
|
-
[
|
|
2539
|
-
P(
|
|
2540
|
-
"div",
|
|
2541
|
-
{
|
|
2542
|
-
class: "flex flex-col"
|
|
2543
|
-
},
|
|
2544
|
-
[
|
|
2545
|
-
P(
|
|
2546
|
-
"span",
|
|
2547
|
-
{
|
|
2548
|
-
class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
|
|
2549
|
-
},
|
|
2550
|
-
`${E.sku.name}`
|
|
2551
|
-
),
|
|
2552
|
-
P(
|
|
2553
|
-
"span",
|
|
2554
|
-
{
|
|
2555
|
-
class: "fm-typo-en-body-md-400"
|
|
2556
|
-
},
|
|
2557
|
-
`${E.sku.code} `
|
|
2558
|
-
)
|
|
2559
|
-
]
|
|
2560
|
-
),
|
|
2561
|
-
P(
|
|
2562
|
-
"div",
|
|
2563
|
-
{
|
|
2564
|
-
class: "ml-auto flex flex-col"
|
|
2565
|
-
},
|
|
2566
|
-
[
|
|
2567
|
-
P(
|
|
2568
|
-
"div",
|
|
2569
|
-
{
|
|
2570
|
-
class: "ml-auto flex gap-1"
|
|
2571
|
-
},
|
|
2572
|
-
[
|
|
2573
|
-
P(
|
|
2574
|
-
"span",
|
|
2575
|
-
{
|
|
2576
|
-
class: "fm-typo-en-body-lg-600 self-end"
|
|
2577
|
-
},
|
|
2578
|
-
ye(E.amount, !1)
|
|
2579
|
-
),
|
|
2580
|
-
P(
|
|
2581
|
-
"span",
|
|
2582
|
-
{
|
|
2583
|
-
class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
|
|
2584
|
-
},
|
|
2585
|
-
((ne = E.measurement) == null ? void 0 : ne.abbrev) ?? E.sku.unit.abbrev
|
|
2586
|
-
)
|
|
2587
|
-
]
|
|
2588
|
-
),
|
|
2589
|
-
P(
|
|
2590
|
-
"div",
|
|
2591
|
-
{
|
|
2592
|
-
class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
2593
|
-
},
|
|
2594
|
-
`${E.cost ? `(${Ve(E.cost)})` : ""}`
|
|
2595
|
-
)
|
|
2596
|
-
]
|
|
2597
|
-
)
|
|
2598
|
-
]
|
|
2599
|
-
)
|
|
2600
|
-
]);
|
|
2601
|
-
})
|
|
2602
|
-
},
|
|
2603
|
-
(W = v.netSuite) != null && W.refNo ? {
|
|
2604
|
-
label: "Ref no. (Netsuite)",
|
|
2605
|
-
values: [(te = v.netSuite) == null ? void 0 : te.refNo]
|
|
2606
|
-
} : null
|
|
2607
|
-
].filter((E) => !!E)
|
|
2608
|
-
};
|
|
2609
|
-
}
|
|
2610
|
-
return A.map((v) => {
|
|
2611
|
-
switch (v.type) {
|
|
2612
|
-
case "grn":
|
|
2613
|
-
return w(v.doc);
|
|
2614
|
-
case "fulfillment":
|
|
2615
|
-
return j(v.doc);
|
|
2616
|
-
}
|
|
2617
|
-
});
|
|
2618
|
-
}), V = H(() => {
|
|
2619
|
-
var m;
|
|
2620
|
-
const t = {
|
|
2621
|
-
...yt(0),
|
|
2622
|
-
currency: Te()
|
|
2623
|
-
};
|
|
2624
|
-
return ((m = o.purchaseOrder) == null ? void 0 : m.items.reduce((A, w) => ({
|
|
2625
|
-
...ft(A, w.totalCost ?? t),
|
|
2626
|
-
currency: Te()
|
|
2627
|
-
}), t)) ?? t;
|
|
2628
|
-
});
|
|
2629
|
-
function B(t) {
|
|
2630
|
-
var U;
|
|
2631
|
-
const A = (((U = o.purchaseOrder) == null ? void 0 : U.version) ?? ke.enum[1]) === ke.enum[2] ? t.id : t.sku._id, w = o.receivedMap[A];
|
|
2632
|
-
return `<span class="${se(t)} fm-typo-en-body-lg-600">${De.toFormatString({ value: w.received })}</span>/${Et(t.quantity, t.sku.unit, t.measurement)}`;
|
|
2633
|
-
}
|
|
2634
|
-
function se(t) {
|
|
2635
|
-
var L;
|
|
2636
|
-
const A = (((L = o.purchaseOrder) == null ? void 0 : L.version) ?? ke.enum[1]) === ke.enum[2] ? t.id : t.sku._id, w = o.receivedMap[A], { isPartialReceive: j, isNoReceive: U, isOverReceive: ee, isFullReceive: v } = Kt(w);
|
|
2637
|
-
return U ? "text-fm-color-typo-tertiary" : j ? "text-fm-color-system-warning-300" : ee ? "text-fm-color-system-error-300" : v ? "text-fm-color-system-success-300" : "";
|
|
2638
|
-
}
|
|
2639
|
-
const D = H(() => {
|
|
2640
|
-
var t, m, A;
|
|
2641
|
-
return (t = o.purchaseOrder) != null && t.itemsAtSubmission ? ((m = o.purchaseOrder) == null ? void 0 : m.version) === ke.enum[2] ? o.purchaseOrder.items.reduce((w, j) => {
|
|
2642
|
-
var ee, v;
|
|
2643
|
-
const U = (v = (ee = o.purchaseOrder) == null ? void 0 : ee.itemsAtSubmission) == null ? void 0 : v.find(
|
|
2644
|
-
(L) => L.id === j.id
|
|
2645
|
-
);
|
|
2646
|
-
return U && U.quantity !== j.quantity && w.set(j.sku.code, {
|
|
2647
|
-
originalAmount: Number(De.toFormatString({ value: U.quantity })),
|
|
2648
|
-
newAmount: Number(De.toFormatString({ value: j.quantity }))
|
|
2649
|
-
}), w;
|
|
2650
|
-
}, /* @__PURE__ */ new Map()) : (A = o.purchaseOrder) == null ? void 0 : A.items.reduce((w, j) => {
|
|
2651
|
-
var L, W;
|
|
2652
|
-
const U = (W = (L = o.purchaseOrder) == null ? void 0 : L.itemsAtSubmission) == null ? void 0 : W.find(
|
|
2653
|
-
(te) => te.sku._id === j.sku._id
|
|
2654
|
-
), ee = U ? Number(De.toFormatString({ value: U.quantity })) : 0, v = Number(De.toFormatString({ value: j.quantity }));
|
|
2655
|
-
return U && ee !== v && w.set(j.sku.code, {
|
|
2656
|
-
originalAmount: ee,
|
|
2657
|
-
newAmount: v
|
|
2658
|
-
}), w;
|
|
2659
|
-
}, /* @__PURE__ */ new Map()) : /* @__PURE__ */ new Map();
|
|
2660
|
-
}), S = (t) => {
|
|
2661
|
-
var A, w;
|
|
2662
|
-
const m = D.value;
|
|
2663
|
-
return ((A = o.purchaseOrder) == null ? void 0 : A.version) === ke.enum[2] ? m.has(t.id) : m.has((w = t.sku) == null ? void 0 : w.code);
|
|
2664
|
-
}, N = (t) => {
|
|
2665
|
-
var A, w;
|
|
2666
|
-
const m = D.value;
|
|
2667
|
-
return ((A = o.purchaseOrder) == null ? void 0 : A.version) === ke.enum[2] ? m.get(t.id) : m.get((w = t.sku) == null ? void 0 : w.code);
|
|
2668
|
-
};
|
|
2669
|
-
return (t, m) => {
|
|
2670
|
-
const A = G("FmButton"), w = G("FmButtonGroup"), j = G("FmChip"), U = G("FmIcon"), ee = G("FmMenuDivider"), v = G("FmCard"), L = G("FmTooltip"), W = G("FmSpacer"), te = G("FmSideSheet");
|
|
2671
|
-
return f(), le(te, {
|
|
2672
|
-
modelValue: h(T),
|
|
2673
|
-
"onUpdate:modelValue": m[8] || (m[8] = (E) => At(T) ? T.value = E : null),
|
|
2674
|
-
"dismiss-away": c.value,
|
|
2675
|
-
"max-width": 600,
|
|
2676
|
-
"close-button": !1
|
|
2677
|
-
}, {
|
|
2678
|
-
"side-sheet-header": X(() => {
|
|
2679
|
-
var E, ne;
|
|
2680
|
-
return [
|
|
2681
|
-
e("div", Ms, [
|
|
2682
|
-
e("div", js, [
|
|
2683
|
-
e("div", zs, _(h(b)("inventory.transfer.receiveRequest.details.title") + ((E = t.purchaseOrder) != null && E.seqNumber ? ` #${(ne = t.purchaseOrder) == null ? void 0 : ne.seqNumber}` : "")), 1),
|
|
2684
|
-
I(A, {
|
|
2685
|
-
class: "ml-auto -m-2",
|
|
2686
|
-
variant: "tertiary",
|
|
2687
|
-
"prepend-icon": "close",
|
|
2688
|
-
onClick: m[0] || (m[0] = (de) => p("update:show", !1))
|
|
2689
|
-
})
|
|
2690
|
-
]),
|
|
2691
|
-
I(w, {
|
|
2692
|
-
items: K.value,
|
|
2693
|
-
modelValue: J.value,
|
|
2694
|
-
"onUpdate:modelValue": m[1] || (m[1] = (de) => J.value = de)
|
|
2695
|
-
}, null, 8, ["items", "modelValue"]),
|
|
2696
|
-
t.purchaseOrder && J.value.value === "deliveryHistory" ? (f(), le(Us, {
|
|
2697
|
-
key: 0,
|
|
2698
|
-
"purchase-order": t.purchaseOrder,
|
|
2699
|
-
"received-info-map": ge.value,
|
|
2700
|
-
onSubmitted: m[2] || (m[2] = () => {
|
|
2701
|
-
p("update:show", !1), p("submitted");
|
|
2702
|
-
})
|
|
2703
|
-
}, null, 8, ["purchase-order", "received-info-map"])) : M("", !0)
|
|
2704
|
-
])
|
|
2705
|
-
];
|
|
2706
|
-
}),
|
|
2707
|
-
default: X(() => {
|
|
2708
|
-
var E, ne, de, we, $e;
|
|
2709
|
-
return [
|
|
2710
|
-
e("div", Ks, [
|
|
2711
|
-
J.value.value === "overview" ? (f(), x(ue, { key: 0 }, [
|
|
2712
|
-
e("div", null, [
|
|
2713
|
-
I(v, {
|
|
2714
|
-
variant: "outlined",
|
|
2715
|
-
class: "flex flex-col gap-8 px-12 py-16"
|
|
2716
|
-
}, {
|
|
2717
|
-
default: X(() => {
|
|
2718
|
-
var Q, ie, ae, pe, re, Re, ot, nt, at;
|
|
2719
|
-
return [
|
|
2720
|
-
e("div", Hs, [
|
|
2721
|
-
e("div", Gs, _(h(b)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
|
|
2722
|
-
e("div", Ws, [
|
|
2723
|
-
I(qe, null, {
|
|
2724
|
-
default: X(() => {
|
|
2725
|
-
var lt;
|
|
2726
|
-
return [
|
|
2727
|
-
Ne(_((lt = o.purchaseOrder) == null ? void 0 : lt.status), 1)
|
|
2728
|
-
];
|
|
2729
|
-
}),
|
|
2730
|
-
_: 1
|
|
2731
|
-
}),
|
|
2732
|
-
I(j, {
|
|
2733
|
-
label: xe.value.status,
|
|
2734
|
-
class: Be(xe.value.statusClass),
|
|
2735
|
-
compact: ""
|
|
2736
|
-
}, null, 8, ["label", "class"]),
|
|
2737
|
-
u.value ? (f(), x("div", Ys, [
|
|
2738
|
-
I(U, {
|
|
2739
|
-
name: "local_shipping",
|
|
2740
|
-
color: "#666666"
|
|
2741
|
-
}),
|
|
2742
|
-
e("span", Qs, _(u.value), 1)
|
|
2743
|
-
])) : M("", !0)
|
|
2744
|
-
])
|
|
2745
|
-
]),
|
|
2746
|
-
I(ee),
|
|
2747
|
-
e("div", Xs, [
|
|
2748
|
-
e("div", Zs, [
|
|
2749
|
-
e("div", Js, [
|
|
2750
|
-
e("div", eo, _(h(b)("inventory.transfer.receiveRequest.details.createdAt")), 1)
|
|
2751
|
-
]),
|
|
2752
|
-
e("div", to, _(h(je)(((Q = t.purchaseOrder) == null ? void 0 : Q._id) ?? "")), 1)
|
|
2753
|
-
]),
|
|
2754
|
-
(ie = t.purchaseOrder) != null && ie.effectiveAt ? (f(), x("div", ro, [
|
|
2755
|
-
e("div", so, _(h(b)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
|
|
2756
|
-
e("div", oo, _(h(vt)(new Date((ae = t.purchaseOrder) == null ? void 0 : ae.effectiveAt))), 1)
|
|
2757
|
-
])) : M("", !0),
|
|
2758
|
-
e("div", no, [
|
|
2759
|
-
e("div", ao, _(h(b)("inventory.transfer.receiveRequest.details.type.title")), 1),
|
|
2760
|
-
e("div", lo, _(h(b)(
|
|
2761
|
-
`inventory.transfer.receiveRequest.details.type.${q.value.toLocaleLowerCase("en-US")}`
|
|
2762
|
-
)), 1)
|
|
2763
|
-
]),
|
|
2764
|
-
(re = (pe = t.purchaseOrder) == null ? void 0 : pe.supplier) != null && re.name ? (f(), x("div", io, [
|
|
2765
|
-
e("div", co, _(h(b)("inventory.transfer.receiveRequest.details.from")), 1),
|
|
2766
|
-
e("div", uo, _((ot = (Re = t.purchaseOrder) == null ? void 0 : Re.supplier) == null ? void 0 : ot.name), 1)
|
|
2767
|
-
])) : M("", !0),
|
|
2768
|
-
t.transferTo ? (f(), x("div", mo, [
|
|
2769
|
-
e("div", po, _(h(b)("inventory.transfer.receiveRequest.details.to")), 1),
|
|
2770
|
-
e("div", fo, _(t.transferTo), 1)
|
|
2771
|
-
])) : M("", !0),
|
|
2772
|
-
(nt = t.purchaseOrder) != null && nt.ref ? (f(), x("div", yo, [
|
|
2773
|
-
e("div", vo, _(h(b)("inventory.transfer.receiveRequest.details.reference")), 1),
|
|
2774
|
-
e("div", ho, _(t.purchaseOrder.ref), 1)
|
|
2775
|
-
])) : M("", !0),
|
|
2776
|
-
(at = t.purchaseOrder) != null && at.remark ? (f(), x("div", bo, [
|
|
2777
|
-
e("div", go, _(h(b)("inventory.transfer.receiveRequest.details.remark")), 1),
|
|
2778
|
-
e("div", _o, _(t.purchaseOrder.remark), 1)
|
|
2779
|
-
])) : M("", !0)
|
|
2780
|
-
])
|
|
2781
|
-
];
|
|
2782
|
-
}),
|
|
2783
|
-
_: 1
|
|
2784
|
-
})
|
|
2785
|
-
]),
|
|
2786
|
-
I(Wr, {
|
|
2787
|
-
"po-request": t.poRequest,
|
|
2788
|
-
purchaseOrder: t.purchaseOrder,
|
|
2789
|
-
transferType: q.value,
|
|
2790
|
-
transferToDbName: t.transferToDbName,
|
|
2791
|
-
scope: t.scope
|
|
2792
|
-
}, null, 8, ["po-request", "purchaseOrder", "transferType", "transferToDbName", "scope"]),
|
|
2793
|
-
e("div", So, [
|
|
2794
|
-
e("div", Oo, [
|
|
2795
|
-
e("div", xo, [
|
|
2796
|
-
e("span", wo, [
|
|
2797
|
-
Ne(_(Oe.value ? h(b)("inventory.transfer.receiveRequest.details.receivedItems") : h(b)("inventory.transfer.receiveRequest.details.requestedItems")) + " ", 1),
|
|
2798
|
-
(ne = (E = t.purchaseOrder) == null ? void 0 : E.netSuite) != null && ne.missingItems && ((we = (de = t.purchaseOrder) == null ? void 0 : de.netSuite) == null ? void 0 : we.missingItems.length) > 0 ? (f(), le(L, {
|
|
2799
|
-
key: 0,
|
|
2800
|
-
variant: "rich",
|
|
2801
|
-
placement: "top",
|
|
2802
|
-
"z-index": 51
|
|
2803
|
-
}, {
|
|
2804
|
-
content: X(() => {
|
|
2805
|
-
var Q, ie;
|
|
2806
|
-
return [
|
|
2807
|
-
e("div", $o, [
|
|
2808
|
-
(f(!0), x(ue, null, be((ie = (Q = t.purchaseOrder) == null ? void 0 : Q.netSuite) == null ? void 0 : ie.missingItems, (ae, pe) => (f(), x("div", {
|
|
2809
|
-
class: "flex justify-center align-middle",
|
|
2810
|
-
key: pe
|
|
2811
|
-
}, [
|
|
2812
|
-
I(U, {
|
|
2813
|
-
name: "arrow_right",
|
|
2814
|
-
size: "sm"
|
|
2815
|
-
}),
|
|
2816
|
-
Ne(" " + _(`(${ae.netSuiteId}) ${ae.name}: ${ae.reason}`), 1)
|
|
2817
|
-
]))), 128))
|
|
2818
|
-
])
|
|
2819
|
-
];
|
|
2820
|
-
}),
|
|
2821
|
-
default: X(() => [
|
|
2822
|
-
I(U, {
|
|
2823
|
-
name: "error",
|
|
2824
|
-
color: "#ff2c2c",
|
|
2825
|
-
size: "sm"
|
|
2826
|
-
})
|
|
2827
|
-
]),
|
|
2828
|
-
_: 1
|
|
2829
|
-
})) : M("", !0)
|
|
2830
|
-
])
|
|
2831
|
-
]),
|
|
2832
|
-
I(ee),
|
|
2833
|
-
(f(!0), x(ue, null, be((($e = t.purchaseOrder) == null ? void 0 : $e.items) ?? [], (Q, ie) => {
|
|
2834
|
-
var ae;
|
|
2835
|
-
return f(), x("div", {
|
|
2836
|
-
key: ie,
|
|
2837
|
-
class: "flex flex-col"
|
|
2838
|
-
}, [
|
|
2839
|
-
e("div", Ro, [
|
|
2840
|
-
e("div", ko, [
|
|
2841
|
-
Ne(_(Q.name) + " ", 1),
|
|
2842
|
-
S(Q) ? (f(), le(L, {
|
|
2843
|
-
key: 0,
|
|
2844
|
-
variant: "rich",
|
|
2845
|
-
placement: "top",
|
|
2846
|
-
"z-index": 51
|
|
2847
|
-
}, {
|
|
2848
|
-
content: X(() => {
|
|
2849
|
-
var pe, re;
|
|
2850
|
-
return [
|
|
2851
|
-
e("div", Do, [
|
|
2852
|
-
m[9] || (m[9] = e("div", { class: "font-semibold" }, "Submission changes", -1)),
|
|
2853
|
-
e("div", null, "Original Amount: " + _((pe = N(Q)) == null ? void 0 : pe.originalAmount), 1),
|
|
2854
|
-
e("div", null, " New Amount: " + _((re = N(Q)) == null ? void 0 : re.newAmount), 1)
|
|
2855
|
-
])
|
|
2856
|
-
];
|
|
2857
|
-
}),
|
|
2858
|
-
default: X(() => [
|
|
2859
|
-
I(U, {
|
|
2860
|
-
name: "error",
|
|
2861
|
-
color: "#ff9500",
|
|
2862
|
-
size: "sm"
|
|
2863
|
-
})
|
|
2864
|
-
]),
|
|
2865
|
-
_: 2
|
|
2866
|
-
}, 1024)) : M("", !0)
|
|
2867
|
-
]),
|
|
2868
|
-
e("div", No, [
|
|
2869
|
-
e("span", {
|
|
2870
|
-
innerHTML: B(Q)
|
|
2871
|
-
}, null, 8, Co)
|
|
2872
|
-
])
|
|
2873
|
-
]),
|
|
2874
|
-
e("div", Ao, [
|
|
2875
|
-
e("div", To, _(Q.code), 1),
|
|
2876
|
-
(ae = Q.totalCost) != null && ae.amount && h(l).enableTotalCost ? (f(), x("div", qo, " (" + _(h(Ve)(Q.totalCost)) + ") ", 1)) : M("", !0)
|
|
2877
|
-
])
|
|
2878
|
-
]);
|
|
2879
|
-
}), 128)),
|
|
2880
|
-
+h(ye)(V.value) ? (f(), x(ue, { key: 0 }, [
|
|
2881
|
-
e("div", Fo, [
|
|
2882
|
-
I(ee)
|
|
2883
|
-
]),
|
|
2884
|
-
e("div", Po, [
|
|
2885
|
-
m[10] || (m[10] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Total:", -1)),
|
|
2886
|
-
e("div", Io, _(h(Ve)(V.value)), 1)
|
|
2887
|
-
])
|
|
2888
|
-
], 64)) : M("", !0)
|
|
2889
|
-
])
|
|
2890
|
-
])
|
|
2891
|
-
], 64)) : J.value.value === "deliveryHistory" ? (f(), x("div", Eo, [
|
|
2892
|
-
he.value.length ? (f(), x("div", Mo, [
|
|
2893
|
-
(f(!0), x(ue, null, be(he.value, (Q, ie) => (f(), x(ue, { key: ie }, [
|
|
2894
|
-
e("div", jo, [
|
|
2895
|
-
e("div", zo, [
|
|
2896
|
-
e("div", Ko, [
|
|
2897
|
-
e("div", {
|
|
2898
|
-
class: Be([
|
|
2899
|
-
{
|
|
2900
|
-
"bg-fm-color-primary": ie !== 0,
|
|
2901
|
-
"bg-white": ie === 0
|
|
2902
|
-
},
|
|
2903
|
-
"w-[2px] h-full"
|
|
2904
|
-
])
|
|
2905
|
-
}, null, 2)
|
|
2906
|
-
]),
|
|
2907
|
-
e("div", Ho, [
|
|
2908
|
-
Q.header === "Received" ? (f(), le(U, {
|
|
2909
|
-
key: 0,
|
|
2910
|
-
name: "local_shipping",
|
|
2911
|
-
outline: "",
|
|
2912
|
-
color: "#ffffff"
|
|
2913
|
-
})) : M("", !0)
|
|
2914
|
-
]),
|
|
2915
|
-
e("div", Go, [
|
|
2916
|
-
e("div", {
|
|
2917
|
-
class: Be([
|
|
2918
|
-
{
|
|
2919
|
-
"bg-fm-color-primary": ie < he.value.length - 1,
|
|
2920
|
-
"bg-white": ie >= he.value.length - 1
|
|
2921
|
-
},
|
|
2922
|
-
"w-[2px] h-full"
|
|
2923
|
-
])
|
|
2924
|
-
}, null, 2)
|
|
2925
|
-
])
|
|
2926
|
-
]),
|
|
2927
|
-
e("div", Wo, [
|
|
2928
|
-
e("div", Yo, [
|
|
2929
|
-
e("div", Qo, _(Q.header), 1),
|
|
2930
|
-
e("div", Xo, _(Q.date), 1)
|
|
2931
|
-
]),
|
|
2932
|
-
e("div", Zo, [
|
|
2933
|
-
Q.header === "Received" && Q.deliveryOrder && t.purchaseOrder ? (f(), le(vs, {
|
|
2934
|
-
key: 0,
|
|
2935
|
-
deliveryOrder: Q.deliveryOrder,
|
|
2936
|
-
purchaseOrder: t.purchaseOrder,
|
|
2937
|
-
onSubmitted: m[3] || (m[3] = () => {
|
|
2938
|
-
p("update:show", !1), p("submitted");
|
|
2939
|
-
})
|
|
2940
|
-
}, null, 8, ["deliveryOrder", "purchaseOrder"])) : M("", !0)
|
|
2941
|
-
])
|
|
2942
|
-
])
|
|
2943
|
-
]),
|
|
2944
|
-
e("div", Jo, [
|
|
2945
|
-
e("div", en, [
|
|
2946
|
-
e("div", tn, [
|
|
2947
|
-
e("div", {
|
|
2948
|
-
class: Be([
|
|
2949
|
-
{
|
|
2950
|
-
"bg-fm-color-primary": ie < he.value.length - 1,
|
|
2951
|
-
"bg-white": ie >= he.value.length - 1
|
|
2952
|
-
},
|
|
2953
|
-
"w-[2px] h-full"
|
|
2954
|
-
])
|
|
2955
|
-
}, null, 2)
|
|
2956
|
-
])
|
|
2957
|
-
]),
|
|
2958
|
-
e("div", rn, [
|
|
2959
|
-
I(v, {
|
|
2960
|
-
variant: "outlined",
|
|
2961
|
-
class: "py-12 px-16"
|
|
2962
|
-
}, {
|
|
2963
|
-
default: X(() => [
|
|
2964
|
-
e("div", sn, [
|
|
2965
|
-
(f(!0), x(ue, null, be(Q.info, (ae, pe) => (f(), x("div", {
|
|
2966
|
-
key: pe,
|
|
2967
|
-
class: "flex flex-col gap-4"
|
|
2968
|
-
}, [
|
|
2969
|
-
e("div", on, _(ae == null ? void 0 : ae.label), 1),
|
|
2970
|
-
e("div", nn, [
|
|
2971
|
-
(f(!0), x(ue, null, be(ae == null ? void 0 : ae.values, (re, Re) => (f(), x("div", {
|
|
2972
|
-
key: Re,
|
|
2973
|
-
class: "fm-typo-en-body-lg-600"
|
|
2974
|
-
}, [
|
|
2975
|
-
typeof re == "string" ? (f(), x(ue, { key: 0 }, [
|
|
2976
|
-
Ne(_(re), 1)
|
|
2977
|
-
], 64)) : (f(), le(Tt(re), { key: 1 }))
|
|
2978
|
-
]))), 128))
|
|
2979
|
-
])
|
|
2980
|
-
]))), 128))
|
|
2981
|
-
])
|
|
2982
|
-
]),
|
|
2983
|
-
_: 2
|
|
2984
|
-
}, 1024)
|
|
2985
|
-
])
|
|
2986
|
-
])
|
|
2987
|
-
], 64))), 128))
|
|
2988
|
-
])) : (f(), x("div", Lo, [
|
|
2989
|
-
I(W),
|
|
2990
|
-
e("div", null, [
|
|
2991
|
-
e("img", {
|
|
2992
|
-
src: h(Lt),
|
|
2993
|
-
alt: "List is empty"
|
|
2994
|
-
}, null, 8, Vo)
|
|
2995
|
-
]),
|
|
2996
|
-
e("div", Bo, _(h(b)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
|
|
2997
|
-
e("div", Uo, _(h(b)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
|
|
2998
|
-
I(W),
|
|
2999
|
-
I(W)
|
|
3000
|
-
]))
|
|
3001
|
-
])) : M("", !0)
|
|
3002
|
-
])
|
|
3003
|
-
];
|
|
3004
|
-
}),
|
|
3005
|
-
"side-sheet-footer": X(() => [
|
|
3006
|
-
e("div", an, [
|
|
3007
|
-
(f(!0), x(ue, null, be(z.value, (E) => (f(), x(ue, null, [
|
|
3008
|
-
h(Ze)[E].available != !1 ? (f(), le(A, {
|
|
3009
|
-
key: E,
|
|
3010
|
-
label: h(b)(h(Ze)[E].translationKey),
|
|
3011
|
-
onClick: (ne) => ce(E),
|
|
3012
|
-
loading: d.value === E,
|
|
3013
|
-
disabled: d.value !== E && C.value,
|
|
3014
|
-
variant: h(Ze)[E].buttonVariant
|
|
3015
|
-
}, null, 8, ["label", "onClick", "loading", "disabled", "variant"])) : M("", !0)
|
|
3016
|
-
], 64))), 256)),
|
|
3017
|
-
h($).ableToMarkReceived(t.purchaseOrder) && !z.value.includes("completeReceive") ? (f(), le(A, {
|
|
3018
|
-
key: 0,
|
|
3019
|
-
label: h(b)("inventory.transfer.receiveRequest.actions.completeReceive"),
|
|
3020
|
-
onClick: m[4] || (m[4] = (E) => ce("completeReceive")),
|
|
3021
|
-
loading: d.value === "completeReceive",
|
|
3022
|
-
disabled: d.value !== "completeReceive" && C.value
|
|
3023
|
-
}, null, 8, ["label", "loading", "disabled"])) : M("", !0),
|
|
3024
|
-
h($).ableToMarkApproved(t.purchaseOrder) && t.canApprove && !z.value.includes("approveRequest") ? (f(), le(A, {
|
|
3025
|
-
key: 1,
|
|
3026
|
-
label: h(b)("inventory.transfer.approval.actions.approveRequest"),
|
|
3027
|
-
onClick: m[5] || (m[5] = (E) => ce("approveRequest")),
|
|
3028
|
-
loading: d.value === "approveRequest",
|
|
3029
|
-
disabled: d.value !== "approveRequest" && C.value
|
|
3030
|
-
}, null, 8, ["label", "loading", "disabled"])) : M("", !0),
|
|
3031
|
-
h($).ableToCreateFulfillment(t.purchaseOrder, t.poRequest) && o.scope === "approval" ? (f(), le(A, {
|
|
3032
|
-
key: 2,
|
|
3033
|
-
label: h(b)("inventory.transfer.receiveRequest.actions.processRequest"),
|
|
3034
|
-
onClick: m[6] || (m[6] = (E) => ce("processRequest")),
|
|
3035
|
-
loading: d.value === "processRequest",
|
|
3036
|
-
disabled: d.value !== "processRequest" && C.value
|
|
3037
|
-
}, null, 8, ["label", "loading", "disabled"])) : M("", !0),
|
|
3038
|
-
I(A, {
|
|
3039
|
-
label: h(b)("common.close"),
|
|
3040
|
-
variant: "tertiary",
|
|
3041
|
-
onClick: m[7] || (m[7] = (E) => p("update:show", !1))
|
|
3042
|
-
}, null, 8, ["label"])
|
|
3043
|
-
])
|
|
3044
|
-
]),
|
|
3045
|
-
_: 1
|
|
3046
|
-
}, 8, ["modelValue", "dismiss-away"]);
|
|
3047
|
-
};
|
|
3048
|
-
}
|
|
3049
|
-
});
|
|
3050
|
-
export {
|
|
3051
|
-
tt as P,
|
|
3052
|
-
_n as _,
|
|
3053
|
-
bn as a,
|
|
3054
|
-
gn as b,
|
|
3055
|
-
Ht as g,
|
|
3056
|
-
Ie as u
|
|
3057
|
-
};
|