@feedmepos/mf-inventory-portal 0.0.25-dev.11 → 0.0.25-dev.12
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-CO-6e1yq.js → App-PehI6qSK.js} +2 -2
- package/dist/ApprovalView-a6tbFyO2.js +140 -0
- package/dist/{BindingsDialog-oWRH8tAd.js → BindingsDialog-BNco1Vhd.js} +2 -2
- package/dist/{BindingsPicker-CpM2ldne.js → BindingsPicker-Dns2kFS-.js} +1 -1
- package/dist/{BindingsTable-BA3ATsO3.js → BindingsTable-DTrXzYzr.js} +1 -1
- package/dist/{ClosingDraftView-CS2v3zbm.js → ClosingDraftView-BXBkI6WL.js} +2 -2
- package/dist/{ClosingTemplateView-BS8RaUgX.js → ClosingTemplateView-BiAGOmVg.js} +2 -2
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-7qLOtuzy.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-IlN0Uj04.js} +3 -3
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-Dn5wTNsE.js → FmUnitInput.vue_vue_type_script_setup_true_lang-JDL6LVAb.js} +1 -1
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-Wv_HtVUG.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DR5ewA1c.js} +1 -1
- package/dist/{IngredientGroupView-DLDfRzPQ.js → IngredientGroupView-Bci0qysG.js} +1 -1
- package/dist/{IngredientsView-IpEhZhFt.js → IngredientsView-Dpc_GncE.js} +4 -4
- package/dist/{IntegrationView-D8DFRPr1.js → IntegrationView-DCWg-DR4.js} +1 -1
- package/dist/{InventoryBindingForm-9255LnDG.js → InventoryBindingForm-BwwF-2NM.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BqlOlgnY.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-1BVSUfuT.js} +3 -3
- package/dist/{InventoryBindingSummary-BPEwj0Gs.js → InventoryBindingSummary-DgoHed7T.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-E53iSENL.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Bu4Dw_6P.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CByTbk0u.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CW7-Eu69.js} +1 -1
- package/dist/{PublishView-SUyD0hW-.js → PublishView-DVYBAYBI.js} +2 -2
- package/dist/{PurchaseOrderPrintPreview-CSi_l2J8.js → PurchaseOrderPrintPreview-Dp2v_J3o.js} +1 -1
- package/dist/{ReceiveRequestView-DA7CofZ1.js → ReceiveRequestView-DVq8tkzd.js} +388 -380
- package/dist/{RecipeView-DYGIII7T.js → RecipeView-Cv5EH2Ah.js} +3 -3
- package/dist/{StockView-DjQlAXbi.js → StockView-B7x9Pywp.js} +7 -7
- package/dist/{SupplierView-CB8pq2dk.js → SupplierView-BgyqCgOQ.js} +4 -4
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-ByAN3s-h.js +1494 -0
- package/dist/{TransferTemplateView-CjVir2Ql.js → TransferTemplateView-C30bwI6y.js} +7 -7
- package/dist/{UnitView-DD8sGjaR.js → UnitView-IUEnJvH0.js} +3 -3
- package/dist/{WarehouseView-BE131osn.js → WarehouseView-Bcwta2ui.js} +1 -1
- package/dist/api/purchase-order.d.ts +1 -0
- package/dist/{app-CbAke6dP.js → app-BKrf9Qul.js} +10 -10
- package/dist/app.js +1 -1
- package/dist/{decimal-ITAjlTW6.js → decimal-pm1D555G.js} +1 -1
- package/dist/{feature-Dq5knPmf.js → feature-IIGwFZ6m.js} +1 -1
- package/dist/{format-unit-display-D-Ho5ga9.js → format-unit-display-DAzCcqoK.js} +2 -2
- package/dist/{index-DpN0zX69.js → index-phCfzXTb.js} +2 -2
- package/dist/{stock-CjI4mNO9.js → stock-B9Im7AGF.js} +1 -1
- package/dist/{supplier-DnImzKTa.js → supplier-D5z7EqEg.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-AgNLUJRC.js → use-ingredient-select-dialog-QJXtuwbP.js} +1 -1
- package/dist/{use-inventory-binding-dialog-sJsbhbQI.js → use-inventory-binding-dialog-DbK__hMV.js} +1 -1
- package/dist/views/receive-request/components/netsuite/NetSuiteProps.d.ts +2 -0
- package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +2 -0
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +6 -2
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +2 -2
- package/dist/{vue-i18n-DYyu2tND.js → vue-i18n-sbiTSWWp.js} +221 -221
- package/package.json +3 -3
- package/dist/ApprovalView-CibKgQlF.js +0 -138
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-IxGRO3vL.js +0 -1461
|
@@ -0,0 +1,1494 @@
|
|
|
1
|
+
import { W as He, u as be, aL as D, a5 as ze, a7 as Qe, a8 as Ye, am as We, d as Ce, e as Ue, av as $, T as Be, aM as Je, Y as Re, K as he, i as fe, aN as Le, ac as ge, f as $e, D as z, h as L, b as Me, a6 as Ze, as as Ie, a0 as _e, ai as Fe } from "./app-BKrf9Qul.js";
|
|
2
|
+
import { ref as K, computed as W, h as x, defineComponent as Oe, onMounted as Xe, unref as l, openBlock as y, createElementBlock as w, createElementVNode as e, toDisplayString as g, createCommentVNode as N, resolveComponent as te, createVNode as V, createBlock as X, isRef as et, withCtx as de, Fragment as le, normalizeClass as ye, createTextVNode as Se, renderList as pe, resolveDynamicComponent as tt } from "vue";
|
|
3
|
+
import { F as st } from "./decimal-pm1D555G.js";
|
|
4
|
+
import { b as rt, u as at, f as je, P as ue } from "./format-unit-display-DAzCcqoK.js";
|
|
5
|
+
import { useI18n as Ve } from "@feedmepos/mf-common";
|
|
6
|
+
import { E as nt } from "./empty-placeholder-wf6-BWE8.js";
|
|
7
|
+
import { useDialog as xe, useSnackbar as De, useProxiedModel as ot } from "@feedmepos/ui-library";
|
|
8
|
+
import { u as Ke } from "./feature-IIGwFZ6m.js";
|
|
9
|
+
const ke = He((m, f) => {
|
|
10
|
+
const b = be();
|
|
11
|
+
return {
|
|
12
|
+
async readRequests(s) {
|
|
13
|
+
const _ = s ?? b.currentLocationDBName, R = `${m.inventoryBackendUrl}/${_}/purchase-request`;
|
|
14
|
+
return await f.get(R);
|
|
15
|
+
},
|
|
16
|
+
async getPurchaseOrders({
|
|
17
|
+
start: s,
|
|
18
|
+
end: _
|
|
19
|
+
}) {
|
|
20
|
+
const R = b.currentLocationDBName, E = `${m.inventoryBackendUrl}/${R}/purchase-order`;
|
|
21
|
+
return await f.get(`${E}?start=${s}&end=${_}`);
|
|
22
|
+
},
|
|
23
|
+
async getLatestPurchaseOrderRequest(s) {
|
|
24
|
+
const _ = b.currentLocationDBName, R = `${m.inventoryBackendUrl}/${_}/purchase-request/find-by-purchase-order-id`;
|
|
25
|
+
return await f.get(`${R}/${s}`);
|
|
26
|
+
},
|
|
27
|
+
async getPurchaseOrderById(s) {
|
|
28
|
+
const _ = b.currentLocationDBName, R = `${m.inventoryBackendUrl}/${_}/purchase-order`;
|
|
29
|
+
return await f.get(`${R}/${s}`);
|
|
30
|
+
},
|
|
31
|
+
async processPurchaseOrder(s, _) {
|
|
32
|
+
const R = b.currentLocationDBName, E = _ || R, v = `${m.inventoryBackendUrl}/${E}/purchase-order/run-operation`;
|
|
33
|
+
return await f.put(v, s);
|
|
34
|
+
},
|
|
35
|
+
async createPurchaseOrder(s) {
|
|
36
|
+
const _ = b.currentLocationDBName, R = `${m.inventoryBackendUrl}/${_}/purchase-order`;
|
|
37
|
+
return await f.post(R, s);
|
|
38
|
+
},
|
|
39
|
+
async updatePurchaseOrder(s) {
|
|
40
|
+
const _ = b.currentLocationDBName, R = `${m.inventoryBackendUrl}/${_}/purchase-order`;
|
|
41
|
+
return await f.put(R, s);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}), Ge = {
|
|
45
|
+
[D.enum.confirmDraft]: {
|
|
46
|
+
primaryActions: {
|
|
47
|
+
text: "Confirm draft",
|
|
48
|
+
close: !0
|
|
49
|
+
},
|
|
50
|
+
title: "Confirm draft?",
|
|
51
|
+
message: "Purchase order cannot be changed after confirm draft.",
|
|
52
|
+
successMessage: "Purchase order draft has been confirmed"
|
|
53
|
+
},
|
|
54
|
+
[D.enum.cancelDraft]: {
|
|
55
|
+
primaryActions: {
|
|
56
|
+
text: "Cancel draft",
|
|
57
|
+
close: !0,
|
|
58
|
+
variant: "destructive"
|
|
59
|
+
},
|
|
60
|
+
title: "Cancel draft?",
|
|
61
|
+
message: "Purchase order cannot be changed after cancelled draft.",
|
|
62
|
+
successMessage: "Purchase order draft has been cancelled"
|
|
63
|
+
},
|
|
64
|
+
[D.enum.submitRequest]: {
|
|
65
|
+
primaryActions: {
|
|
66
|
+
text: "Submit request",
|
|
67
|
+
close: !0
|
|
68
|
+
},
|
|
69
|
+
title: "Confirm draft?",
|
|
70
|
+
message: "Purchase order cannot be changed after confirm draft.",
|
|
71
|
+
successMessage: "Purchase order draft has been submitted"
|
|
72
|
+
},
|
|
73
|
+
[D.enum.completeReceive]: {
|
|
74
|
+
primaryActions: {
|
|
75
|
+
text: "Mark received",
|
|
76
|
+
close: !0
|
|
77
|
+
},
|
|
78
|
+
title: "Mark as received",
|
|
79
|
+
message: "Purchase order cannot be changed after it has complete receiving.",
|
|
80
|
+
successMessage: "Purchase order has been marked as received"
|
|
81
|
+
},
|
|
82
|
+
[D.enum.approveRequest]: {
|
|
83
|
+
primaryActions: {
|
|
84
|
+
text: "Approve request",
|
|
85
|
+
close: !0
|
|
86
|
+
},
|
|
87
|
+
title: "Approve request?",
|
|
88
|
+
message: "Purchase order will be approved.",
|
|
89
|
+
successMessage: "Purchase order has been approved"
|
|
90
|
+
},
|
|
91
|
+
[D.enum.rejectRequest]: {
|
|
92
|
+
primaryActions: {
|
|
93
|
+
text: "Reject request",
|
|
94
|
+
close: !0,
|
|
95
|
+
variant: "destructive"
|
|
96
|
+
},
|
|
97
|
+
title: "Reject request?",
|
|
98
|
+
message: "Purchase order will be rejected.",
|
|
99
|
+
successMessage: "Purchase order has been rejected"
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
var we = /* @__PURE__ */ ((m) => (m.RECEIVE_REQUEST = "receive/request", m.APPROVAL = "approval", m))(we || {});
|
|
103
|
+
const ve = K();
|
|
104
|
+
function Ks(m, f) {
|
|
105
|
+
const b = xe(), s = be(), _ = Ke(), R = rt(), E = at(), v = K(!1), n = De(), a = ke(), r = K(new Array()), c = K(
|
|
106
|
+
f != null && f.startDate && (f != null && f.endDate) ? f : ze()
|
|
107
|
+
), u = W(() => {
|
|
108
|
+
const h = new Date(c.value.startDate), p = new Date(c.value.endDate);
|
|
109
|
+
return {
|
|
110
|
+
start: Qe(h).toISOString(),
|
|
111
|
+
end: Ye(p).toISOString()
|
|
112
|
+
};
|
|
113
|
+
}), d = K(new Array()), P = We(), I = K(null);
|
|
114
|
+
async function J(h) {
|
|
115
|
+
function p(i) {
|
|
116
|
+
const S = {
|
|
117
|
+
mode: Ce.CREATE,
|
|
118
|
+
modelValue: h || void 0,
|
|
119
|
+
show: !0,
|
|
120
|
+
"onUpdate:show"(O) {
|
|
121
|
+
ve.value.show = O;
|
|
122
|
+
},
|
|
123
|
+
templateId: i,
|
|
124
|
+
lastClosingDate: I.value
|
|
125
|
+
};
|
|
126
|
+
ve.value = S;
|
|
127
|
+
}
|
|
128
|
+
let k;
|
|
129
|
+
_.mustUsePoTemplate && !(h != null && h.template) ? b.open({
|
|
130
|
+
title: "Create transfer",
|
|
131
|
+
message: "",
|
|
132
|
+
primaryActions: {
|
|
133
|
+
text: "Select a template",
|
|
134
|
+
close: !0
|
|
135
|
+
},
|
|
136
|
+
secondaryActions: {
|
|
137
|
+
text: "Outlet to Outlet",
|
|
138
|
+
variant: "secondary",
|
|
139
|
+
close: !0
|
|
140
|
+
}
|
|
141
|
+
}).onPrimary(async () => {
|
|
142
|
+
k = await R.getTemplateId(), k && p(k);
|
|
143
|
+
}).onSecondary(() => {
|
|
144
|
+
p(void 0);
|
|
145
|
+
}) : p(k);
|
|
146
|
+
}
|
|
147
|
+
function se(h) {
|
|
148
|
+
const p = {
|
|
149
|
+
mode: Ce.UPDATE,
|
|
150
|
+
modelValue: Ue(h),
|
|
151
|
+
show: !0,
|
|
152
|
+
"onUpdate:show"(k) {
|
|
153
|
+
ve.value.show = k;
|
|
154
|
+
},
|
|
155
|
+
lastClosingDate: I.value
|
|
156
|
+
};
|
|
157
|
+
ve.value = p;
|
|
158
|
+
}
|
|
159
|
+
async function M() {
|
|
160
|
+
r.value = [], v.value = !0;
|
|
161
|
+
try {
|
|
162
|
+
r.value = await a.getPurchaseOrders(u.value).then((k) => k.sort((i, S) => S._id.localeCompare(i._id)));
|
|
163
|
+
const h = await P.readLastClosing(!0), p = h == null ? void 0 : h._id;
|
|
164
|
+
p && (I.value = Je(p)), _.mustUsePoTemplate && await E.fetchTemplates();
|
|
165
|
+
} catch {
|
|
166
|
+
n.open({
|
|
167
|
+
title: "Something went wrong",
|
|
168
|
+
message: "Error at fetching purchase orders",
|
|
169
|
+
type: "error"
|
|
170
|
+
});
|
|
171
|
+
} finally {
|
|
172
|
+
v.value = !1;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
async function re() {
|
|
176
|
+
d.value = [], v.value = !0;
|
|
177
|
+
try {
|
|
178
|
+
d.value = await a.readRequests().then((h) => h.reverse());
|
|
179
|
+
} catch {
|
|
180
|
+
n.open({
|
|
181
|
+
title: "Something went wrong",
|
|
182
|
+
message: "Error at fetching purchase requests",
|
|
183
|
+
type: "error"
|
|
184
|
+
});
|
|
185
|
+
} finally {
|
|
186
|
+
v.value = !1;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function ae() {
|
|
190
|
+
switch (m) {
|
|
191
|
+
case "receive/request":
|
|
192
|
+
return M();
|
|
193
|
+
case "approval":
|
|
194
|
+
return re();
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function Z(h, p) {
|
|
198
|
+
c.value = {
|
|
199
|
+
startDate: h,
|
|
200
|
+
endDate: p
|
|
201
|
+
}, ae();
|
|
202
|
+
}
|
|
203
|
+
s.watchLocation(async (h) => {
|
|
204
|
+
if (!h) {
|
|
205
|
+
r.value = [];
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
await ae();
|
|
209
|
+
});
|
|
210
|
+
const Q = K(), t = K(Math.random().toString());
|
|
211
|
+
async function o(h, p) {
|
|
212
|
+
var O, F;
|
|
213
|
+
const k = Math.random().toString();
|
|
214
|
+
t.value = k;
|
|
215
|
+
const i = m === "receive/request" ? s.currentLocation : p == null ? void 0 : p.to, S = {
|
|
216
|
+
poRequest: p,
|
|
217
|
+
purchaseOrder: h,
|
|
218
|
+
transferTo: i == null ? void 0 : i.name,
|
|
219
|
+
transferToDbName: i == null ? void 0 : i.dbName,
|
|
220
|
+
show: !0,
|
|
221
|
+
canResubmit: !1,
|
|
222
|
+
canApprove: m === "approval",
|
|
223
|
+
"onUpdate:show"(T) {
|
|
224
|
+
Q.value.show = T;
|
|
225
|
+
},
|
|
226
|
+
scope: m
|
|
227
|
+
};
|
|
228
|
+
if (Q.value = S, !(p || h.status !== $.enum.REQUESTING)) {
|
|
229
|
+
try {
|
|
230
|
+
p = (await a.readRequests(
|
|
231
|
+
`${h.supplier.internal}_${h.supplier._id}`
|
|
232
|
+
)).find((G) => G.purchaseOrderId === h._id);
|
|
233
|
+
} catch {
|
|
234
|
+
console.error("Error at fetching po request to check");
|
|
235
|
+
}
|
|
236
|
+
k === t.value && (Q.value.canResubmit = !p, Q.value.transferTo = (O = p == null ? void 0 : p.to) == null ? void 0 : O.name, Q.value.transferToDbName = (F = p == null ? void 0 : p.to) == null ? void 0 : F.dbName);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
async function C(h, p, k, i) {
|
|
240
|
+
v.value = !0;
|
|
241
|
+
try {
|
|
242
|
+
await a.processPurchaseOrder(
|
|
243
|
+
{
|
|
244
|
+
operation: p,
|
|
245
|
+
doc: h,
|
|
246
|
+
options: (
|
|
247
|
+
// auto receive for supplier to warehouse
|
|
248
|
+
(p === D.enum.confirmDraft || // auto receive for warehouse to warehouse
|
|
249
|
+
p === D.enum.completeReceive) && _.autoReceiveWarehouse ? {
|
|
250
|
+
autoReceive: !0
|
|
251
|
+
} : void 0
|
|
252
|
+
)
|
|
253
|
+
},
|
|
254
|
+
i
|
|
255
|
+
), await new Promise((F) => setTimeout(F, 1e3));
|
|
256
|
+
const O = be().currentLocationDBName.startsWith("restaurant_");
|
|
257
|
+
p === D.enum.confirmDraft && h.effectiveAt && O ? n.open({
|
|
258
|
+
title: "Success",
|
|
259
|
+
message: `${k}. The backdate will be reflected once your POS has received this change.`,
|
|
260
|
+
type: "success"
|
|
261
|
+
}) : n.open({
|
|
262
|
+
title: "Success",
|
|
263
|
+
message: k,
|
|
264
|
+
type: "success"
|
|
265
|
+
});
|
|
266
|
+
} catch (S) {
|
|
267
|
+
n.open({
|
|
268
|
+
title: "Something went wrong",
|
|
269
|
+
message: "Please try again.",
|
|
270
|
+
type: "error"
|
|
271
|
+
}), console.error("Error when submitting PO operation", p, h, S);
|
|
272
|
+
} finally {
|
|
273
|
+
v.value = !1, ae();
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
async function q(h, p, k) {
|
|
277
|
+
const i = Ge[p];
|
|
278
|
+
if (!i) {
|
|
279
|
+
n.open({
|
|
280
|
+
title: "Something went wrong",
|
|
281
|
+
message: `Cannot process order: ${Be(p)}`,
|
|
282
|
+
type: "error"
|
|
283
|
+
});
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
const { successMessage: S, ...O } = i;
|
|
287
|
+
b.open({
|
|
288
|
+
title: O.title,
|
|
289
|
+
message: O.message,
|
|
290
|
+
primaryActions: O.primaryActions
|
|
291
|
+
}).onPrimary(() => {
|
|
292
|
+
C(h, p, S, k);
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
return {
|
|
296
|
+
purchaseOrders: r,
|
|
297
|
+
purchaseRequests: d,
|
|
298
|
+
updateDateRange: Z,
|
|
299
|
+
fetchData: ae,
|
|
300
|
+
loading: v,
|
|
301
|
+
transferDialogProps: ve,
|
|
302
|
+
promptCreateTransferDialog: J,
|
|
303
|
+
promptUpdateTransferDialog: se,
|
|
304
|
+
transferDetailsProps: Q,
|
|
305
|
+
promptShowTransferDetails: o,
|
|
306
|
+
submitAction: q
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
function lt(m, f) {
|
|
310
|
+
return f.reduce(
|
|
311
|
+
(s, _) => {
|
|
312
|
+
const R = _.received.find((E) => E.sku._id === m._id);
|
|
313
|
+
return R && (s = Re(s, R.amount)), s;
|
|
314
|
+
},
|
|
315
|
+
st.toPrecision(he(0), m.unit.precision)
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
function ct(m, f) {
|
|
319
|
+
const { name: b, address: s, regNo: _ } = f.doc.profile, R = {
|
|
320
|
+
name: b,
|
|
321
|
+
registrationNumber: _,
|
|
322
|
+
line1: s == null ? void 0 : s.line1,
|
|
323
|
+
line2: s == null ? void 0 : s.line2,
|
|
324
|
+
postcode: s == null ? void 0 : s.postcode,
|
|
325
|
+
city: s == null ? void 0 : s.city,
|
|
326
|
+
state: s == null ? void 0 : s.state,
|
|
327
|
+
country: s == null ? void 0 : s.country
|
|
328
|
+
}, E = {
|
|
329
|
+
name: m.supplier.name,
|
|
330
|
+
registrationNumber: m.supplier.registrationNumber,
|
|
331
|
+
line1: m.supplier.address.line1,
|
|
332
|
+
line2: m.supplier.address.line2,
|
|
333
|
+
postcode: m.supplier.address.postcode,
|
|
334
|
+
city: m.supplier.address.city,
|
|
335
|
+
state: m.supplier.address.state,
|
|
336
|
+
country: m.supplier.address.country
|
|
337
|
+
}, v = m.items.map((c) => {
|
|
338
|
+
const { sku: u, measurement: d } = c, P = fe(
|
|
339
|
+
lt(c.sku, m.deliveryOrder || []),
|
|
340
|
+
!1
|
|
341
|
+
);
|
|
342
|
+
return {
|
|
343
|
+
code: u.code,
|
|
344
|
+
description: u.name,
|
|
345
|
+
quantity: je(c.quantity, u.unit, c.measurement),
|
|
346
|
+
unit: (d == null ? void 0 : d.abbrev) || u.unit.abbrev,
|
|
347
|
+
received: P
|
|
348
|
+
};
|
|
349
|
+
}), n = m.deliveryOrder.map((c) => ({
|
|
350
|
+
createdAt: Le(new Date(c.createdAt)),
|
|
351
|
+
ref: c.deliveryOrderNumber,
|
|
352
|
+
remark: c.remark || "",
|
|
353
|
+
items: c.received.map((u) => {
|
|
354
|
+
var d;
|
|
355
|
+
return {
|
|
356
|
+
code: u.sku.code,
|
|
357
|
+
description: u.sku.name,
|
|
358
|
+
quantity: fe(u.amount),
|
|
359
|
+
unit: ((d = u.measurement) == null ? void 0 : d.abbrev) || u.sku.unit.abbrev
|
|
360
|
+
};
|
|
361
|
+
})
|
|
362
|
+
})), a = {
|
|
363
|
+
orderNumber: m.seqNumber.toString(),
|
|
364
|
+
createdAt: ge(m._id),
|
|
365
|
+
ref: m.ref || "",
|
|
366
|
+
remark: m.remark || "",
|
|
367
|
+
buyer: R,
|
|
368
|
+
supplier: E,
|
|
369
|
+
items: v,
|
|
370
|
+
status: m.status,
|
|
371
|
+
deliveryOrders: n
|
|
372
|
+
}, r = new URL(window.location.href);
|
|
373
|
+
r.pathname = r.hostname.includes("inventory.feedme") ? "/receive-request/print-preview" : "/inventory/receive-request/print-preview", r.searchParams.append("data", JSON.stringify(a)), window.open(r.href, "_blank", "noreferrer");
|
|
374
|
+
}
|
|
375
|
+
const me = {
|
|
376
|
+
submitRequest: {
|
|
377
|
+
translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
|
|
378
|
+
color: "text-fm-color-typo-primary",
|
|
379
|
+
value: D.enum.submitRequest
|
|
380
|
+
},
|
|
381
|
+
confirmDraft: {
|
|
382
|
+
translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
|
|
383
|
+
color: "text-fm-color-typo-primary",
|
|
384
|
+
value: D.enum.confirmDraft
|
|
385
|
+
},
|
|
386
|
+
cancelDraft: {
|
|
387
|
+
translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
|
|
388
|
+
color: "text-fm-color-typo-error",
|
|
389
|
+
value: D.enum.cancelDraft
|
|
390
|
+
},
|
|
391
|
+
approveRequest: {
|
|
392
|
+
translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
|
|
393
|
+
color: "text-fm-color-typo-primary",
|
|
394
|
+
value: D.enum.approveRequest
|
|
395
|
+
},
|
|
396
|
+
rejectRequest: {
|
|
397
|
+
translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
|
|
398
|
+
color: "text-fm-color-typo-error",
|
|
399
|
+
value: D.enum.rejectRequest
|
|
400
|
+
},
|
|
401
|
+
processRequest: {
|
|
402
|
+
translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
|
|
403
|
+
color: "text-fm-color-typo-primary",
|
|
404
|
+
value: D.enum.processRequest
|
|
405
|
+
},
|
|
406
|
+
receiveStock: {
|
|
407
|
+
translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
|
|
408
|
+
color: "text-fm-color-typo-primary",
|
|
409
|
+
value: D.enum.receiveStock
|
|
410
|
+
},
|
|
411
|
+
completeReceive: {
|
|
412
|
+
translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
|
|
413
|
+
color: "text-fm-color-typo-primary",
|
|
414
|
+
value: D.enum.completeReceive
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
function Gs(m, f) {
|
|
418
|
+
const b = be(), { t: s } = Ve();
|
|
419
|
+
function _(r) {
|
|
420
|
+
switch (r.status) {
|
|
421
|
+
case "DRAFT":
|
|
422
|
+
return [
|
|
423
|
+
z[L.Update],
|
|
424
|
+
z[L.Details],
|
|
425
|
+
r.supplier.internal === "restaurant" || r.supplier.internal === "warehouse" ? me[D.enum.submitRequest] : me[D.enum.confirmDraft],
|
|
426
|
+
me[D.enum.cancelDraft],
|
|
427
|
+
z[L.Print]
|
|
428
|
+
];
|
|
429
|
+
case "RECEIVING":
|
|
430
|
+
return [
|
|
431
|
+
me[D.enum.completeReceive],
|
|
432
|
+
z[L.Details],
|
|
433
|
+
z[L.Print]
|
|
434
|
+
];
|
|
435
|
+
case "REQUESTING":
|
|
436
|
+
return m === "receive/request" ? [z[L.Details], z[L.Print]] : [
|
|
437
|
+
me[D.enum.approveRequest],
|
|
438
|
+
me[D.enum.rejectRequest],
|
|
439
|
+
z[L.Details],
|
|
440
|
+
z[L.Print]
|
|
441
|
+
];
|
|
442
|
+
case "PROCESSING":
|
|
443
|
+
return [z[L.Details], z[L.Print]];
|
|
444
|
+
case "COMPLETE":
|
|
445
|
+
case "CANCEL":
|
|
446
|
+
default:
|
|
447
|
+
return [z[L.Details], z[L.Print]];
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
function R(r) {
|
|
451
|
+
return Object.values(D.enum).includes(r);
|
|
452
|
+
}
|
|
453
|
+
async function E(r, c, u) {
|
|
454
|
+
var P, I;
|
|
455
|
+
const d = Ue(c);
|
|
456
|
+
if (r === L.Print) {
|
|
457
|
+
ct(d, b.currentLocation);
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
if (r === L.Details) {
|
|
461
|
+
f.promptShowTransferDetails(d, u);
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
if (r === L.Update) {
|
|
465
|
+
(P = f.promptUpdateTransferDialog) == null || P.call(f, d);
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
if (R(r)) {
|
|
469
|
+
f.submitAction(c, r, (I = u == null ? void 0 : u.to) == null ? void 0 : I.dbName);
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
function v() {
|
|
474
|
+
return [
|
|
475
|
+
{
|
|
476
|
+
accessorKey: "seqNumber",
|
|
477
|
+
header: () => s("inventory.transfer.table.seqNo"),
|
|
478
|
+
enableSorting: !0,
|
|
479
|
+
size: 80,
|
|
480
|
+
sortUndefined: "last"
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
accessorKey: "_id",
|
|
484
|
+
header: () => s("inventory.transfer.table.createdAt"),
|
|
485
|
+
cell(r) {
|
|
486
|
+
return ge(`${r.getValue()}`);
|
|
487
|
+
},
|
|
488
|
+
enableSorting: !0
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
accessorKey: "supplier.name",
|
|
492
|
+
header: () => s("inventory.transfer.table.transferFrom"),
|
|
493
|
+
enableSorting: !0,
|
|
494
|
+
size: 200
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
accessorKey: "items.length",
|
|
498
|
+
header: () => s("inventory.transfer.table.noOfItems"),
|
|
499
|
+
enableSorting: !1,
|
|
500
|
+
meta: {
|
|
501
|
+
width: "10rem"
|
|
502
|
+
}
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
accessorKey: "ref",
|
|
506
|
+
header: () => s("inventory.transfer.table.reference"),
|
|
507
|
+
enableSorting: !1,
|
|
508
|
+
size: "auto"
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
accessorKey: "status",
|
|
512
|
+
header: () => s("inventory.transfer.table.status"),
|
|
513
|
+
cell(r) {
|
|
514
|
+
const c = s(`inventory.transfer.status.${r.getValue() ?? ""}`), u = `${r.getValue() ?? ""}`.toLocaleLowerCase("en-us");
|
|
515
|
+
return x(
|
|
516
|
+
"div",
|
|
517
|
+
{
|
|
518
|
+
class: "flex"
|
|
519
|
+
},
|
|
520
|
+
x(
|
|
521
|
+
"div",
|
|
522
|
+
{
|
|
523
|
+
class: `fm-status-badge fm-status-badge-${u}`
|
|
524
|
+
},
|
|
525
|
+
c
|
|
526
|
+
)
|
|
527
|
+
);
|
|
528
|
+
},
|
|
529
|
+
enableSorting: !0,
|
|
530
|
+
size: 200
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
id: "action",
|
|
534
|
+
cell(r) {
|
|
535
|
+
const c = r.row.original, u = _(c);
|
|
536
|
+
return $e(u, (d) => E(d, c));
|
|
537
|
+
},
|
|
538
|
+
enableSorting: !1,
|
|
539
|
+
size: 40,
|
|
540
|
+
meta: {
|
|
541
|
+
cellClass: "",
|
|
542
|
+
headerClass: ""
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
];
|
|
546
|
+
}
|
|
547
|
+
function n() {
|
|
548
|
+
return [
|
|
549
|
+
{
|
|
550
|
+
accessorKey: "purchaseOrder.seqNumber",
|
|
551
|
+
header: () => s("inventory.transfer.table.seqNo"),
|
|
552
|
+
enableSorting: !0,
|
|
553
|
+
size: 80,
|
|
554
|
+
sortUndefined: "last"
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
accessorKey: "purchaseOrder._id",
|
|
558
|
+
header: () => s("inventory.transfer.table.createdAt"),
|
|
559
|
+
cell(r) {
|
|
560
|
+
return ge(`${r.getValue()}`);
|
|
561
|
+
},
|
|
562
|
+
enableSorting: !0
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
accessorKey: "to.name",
|
|
566
|
+
header: () => s("inventory.transfer.table.transferTo"),
|
|
567
|
+
enableSorting: !1,
|
|
568
|
+
size: 200
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
accessorKey: "purchaseOrder.items.length",
|
|
572
|
+
header: () => s("inventory.transfer.table.noOfItems"),
|
|
573
|
+
enableSorting: !1
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
accessorKey: "purchaseOrder.ref",
|
|
577
|
+
header: () => s("inventory.transfer.table.reference"),
|
|
578
|
+
enableSorting: !1,
|
|
579
|
+
size: "auto"
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
accessorKey: "purchaseOrder.status",
|
|
583
|
+
header: () => s("inventory.transfer.table.status"),
|
|
584
|
+
cell(r) {
|
|
585
|
+
const c = s(`inventory.transfer.status.${r.getValue() ?? ""}`), u = `${r.getValue() ?? ""}`.toLocaleLowerCase("en-us");
|
|
586
|
+
return x(
|
|
587
|
+
"div",
|
|
588
|
+
{
|
|
589
|
+
class: "flex"
|
|
590
|
+
},
|
|
591
|
+
x(
|
|
592
|
+
"div",
|
|
593
|
+
{
|
|
594
|
+
class: `fm-status-badge fm-status-badge-${u}`
|
|
595
|
+
},
|
|
596
|
+
c
|
|
597
|
+
)
|
|
598
|
+
);
|
|
599
|
+
},
|
|
600
|
+
enableSorting: !0
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
id: "action",
|
|
604
|
+
cell(r) {
|
|
605
|
+
const c = r.row.original, u = c.purchaseOrder ? _(c.purchaseOrder) : [];
|
|
606
|
+
return $e(
|
|
607
|
+
u,
|
|
608
|
+
(d) => c.purchaseOrder ? E(d, c.purchaseOrder, c) : void 0
|
|
609
|
+
);
|
|
610
|
+
},
|
|
611
|
+
enableSorting: !1,
|
|
612
|
+
size: 40,
|
|
613
|
+
meta: {
|
|
614
|
+
cellClass: "",
|
|
615
|
+
headerClass: ""
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
];
|
|
619
|
+
}
|
|
620
|
+
const a = W(() => m === "receive/request" ? v() : n());
|
|
621
|
+
return {
|
|
622
|
+
get columnDefs() {
|
|
623
|
+
return a.value;
|
|
624
|
+
}
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
const it = {
|
|
628
|
+
key: 0,
|
|
629
|
+
class: "flex flex-col gap-8"
|
|
630
|
+
}, ut = { class: "flex flex-col gap-4" }, dt = { class: "fm-typo-en-body-lg-600" }, mt = {
|
|
631
|
+
key: 0,
|
|
632
|
+
class: "flex flex-col gap-4"
|
|
633
|
+
}, ft = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, pt = { class: "fm-typo-en-body-lg-600" }, vt = { key: 0 }, yt = { key: 1 }, ht = {
|
|
634
|
+
key: 1,
|
|
635
|
+
class: "flex flex-col gap-4"
|
|
636
|
+
}, bt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, gt = { class: "fm-typo-en-body-lg-600" }, _t = { key: 0 }, St = { key: 1 }, Rt = {
|
|
637
|
+
key: 2,
|
|
638
|
+
class: "flex flex-col gap-4"
|
|
639
|
+
}, wt = { class: "fm-typo-en-body-lg-600" }, Ot = {
|
|
640
|
+
key: 3,
|
|
641
|
+
class: "flex flex-col gap-4"
|
|
642
|
+
}, xt = { class: "fm-typo-en-body-lg-600" }, Dt = /* @__PURE__ */ Oe({
|
|
643
|
+
__name: "NetSuiteInfo",
|
|
644
|
+
props: {
|
|
645
|
+
transferType: {},
|
|
646
|
+
transferToDbName: {},
|
|
647
|
+
poRequest: {},
|
|
648
|
+
purchaseOrder: {},
|
|
649
|
+
isTransferBetweenOutlets: { type: Boolean },
|
|
650
|
+
scope: {}
|
|
651
|
+
},
|
|
652
|
+
setup(m) {
|
|
653
|
+
const f = m, b = Me(), s = ke(), _ = K(f.poRequest);
|
|
654
|
+
Xe(async () => {
|
|
655
|
+
var n;
|
|
656
|
+
if (!f.poRequest && ((n = f.purchaseOrder) != null && n._id)) {
|
|
657
|
+
const a = await s.getLatestPurchaseOrderRequest(f.purchaseOrder._id);
|
|
658
|
+
_.value = a;
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
const R = W(
|
|
662
|
+
() => {
|
|
663
|
+
var n, a, r, c, u, d;
|
|
664
|
+
return b.getSubsidiaryFullName(
|
|
665
|
+
((r = (a = (n = f.purchaseOrder) == null ? void 0 : n.netSuite) == null ? void 0 : a.subsidiary) == null ? void 0 : r.id) || ((d = (u = (c = f.poRequest) == null ? void 0 : c.netSuite) == null ? void 0 : u.subsidiary) == null ? void 0 : d.id)
|
|
666
|
+
).fullName;
|
|
667
|
+
}
|
|
668
|
+
), E = W(() => {
|
|
669
|
+
var n, a, r, c, u, d, P, I, J, se, M, re;
|
|
670
|
+
return (r = (a = (n = f.purchaseOrder) == null ? void 0 : n.netSuite) == null ? void 0 : a.additionalInfo) != null && r.transactionnumber ? (d = (u = (c = f.purchaseOrder) == null ? void 0 : c.netSuite) == null ? void 0 : u.additionalInfo) == null ? void 0 : d.transactionnumber : (J = (I = (P = _.value) == null ? void 0 : P.netSuite) == null ? void 0 : I.additionalInfo) != null && J.transactionnumber ? (re = (M = (se = _.value) == null ? void 0 : se.netSuite) == null ? void 0 : M.additionalInfo) == null ? void 0 : re.transactionnumber : null;
|
|
671
|
+
}), v = W(() => {
|
|
672
|
+
var n, a, r, c, u, d;
|
|
673
|
+
return (a = (n = f.purchaseOrder) == null ? void 0 : n.deliveryFullfillment) != null && a.length && ((c = (r = f.purchaseOrder) == null ? void 0 : r.deliveryFullfillment) == null ? void 0 : c.length) > 0 ? (d = (u = f.purchaseOrder) == null ? void 0 : u.deliveryFullfillment) == null ? void 0 : d.map((P) => {
|
|
674
|
+
var I;
|
|
675
|
+
return (I = P.netSuite) == null ? void 0 : I.refNo;
|
|
676
|
+
}).join(", ") : "N/A";
|
|
677
|
+
});
|
|
678
|
+
return (n, a) => {
|
|
679
|
+
var r, c, u, d, P, I, J, se, M, re, ae, Z, Q, t;
|
|
680
|
+
return l(b).isEnabled ? (y(), w("div", it, [
|
|
681
|
+
e("div", ut, [
|
|
682
|
+
a[0] || (a[0] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "NetSuite subsidiary", -1)),
|
|
683
|
+
e("div", dt, g(R.value || "N/A"), 1)
|
|
684
|
+
]),
|
|
685
|
+
!n.isTransferBetweenOutlets && ((r = n.purchaseOrder) == null ? void 0 : r.status) !== l($).Enum.REQUESTING && n.scope === l(we).RECEIVE_REQUEST ? (y(), w("div", mt, [
|
|
686
|
+
e("div", ft, " NetSuite " + g(n.transferType === l(ue).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
|
|
687
|
+
e("div", pt, [
|
|
688
|
+
(u = (c = n.purchaseOrder) == null ? void 0 : c.netSuite) != null && u.id ? (y(), w("span", vt, g((P = (d = n.purchaseOrder) == null ? void 0 : d.netSuite) == null ? void 0 : P.refNo) + " (" + g((J = (I = n.purchaseOrder) == null ? void 0 : I.netSuite) == null ? void 0 : J.id) + ") ", 1)) : (y(), w("span", yt, "N/ssA"))
|
|
689
|
+
])
|
|
690
|
+
])) : N("", !0),
|
|
691
|
+
!n.isTransferBetweenOutlets && _.value && ((se = n.purchaseOrder) == null ? void 0 : se.status) === l($).Enum.REQUESTING || n.scope === l(we).APPROVAL ? (y(), w("div", ht, [
|
|
692
|
+
e("div", bt, " (Request) NetSuite " + g(n.transferType === l(ue).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
|
|
693
|
+
e("div", gt, [
|
|
694
|
+
(re = (M = _.value) == null ? void 0 : M.netSuite) != null && re.id ? (y(), w("span", _t, g((Z = (ae = _.value) == null ? void 0 : ae.netSuite) == null ? void 0 : Z.refNo) + " (" + g((t = (Q = _.value) == null ? void 0 : Q.netSuite) == null ? void 0 : t.id) + ") ", 1)) : (y(), w("span", St, "N/A"))
|
|
695
|
+
])
|
|
696
|
+
])) : N("", !0),
|
|
697
|
+
E.value ? (y(), w("div", Rt, [
|
|
698
|
+
a[1] || (a[1] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transaction Number ", -1)),
|
|
699
|
+
e("div", wt, g(E.value), 1)
|
|
700
|
+
])) : N("", !0),
|
|
701
|
+
l(b).isEnabled && n.transferType === l(ue).TRANSFER && !n.isTransferBetweenOutlets ? (y(), w("div", Ot, [
|
|
702
|
+
a[2] || (a[2] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite fulfillment IDs ", -1)),
|
|
703
|
+
e("div", xt, g(v.value), 1)
|
|
704
|
+
])) : N("", !0)
|
|
705
|
+
])) : N("", !0);
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
}), kt = {
|
|
709
|
+
key: 0,
|
|
710
|
+
class: "flex flex-row-reverse"
|
|
711
|
+
}, At = /* @__PURE__ */ Oe({
|
|
712
|
+
__name: "NetSuiteSync",
|
|
713
|
+
props: {
|
|
714
|
+
poRequest: {},
|
|
715
|
+
purchaseOrder: {},
|
|
716
|
+
isTransferBetweenOutlets: { type: Boolean }
|
|
717
|
+
},
|
|
718
|
+
setup(m) {
|
|
719
|
+
const f = m, b = Me(), s = De(), _ = xe(), R = K(!1), E = W(() => {
|
|
720
|
+
var c, u, d, P;
|
|
721
|
+
let n = !0;
|
|
722
|
+
b.isEnabled || (n = !1);
|
|
723
|
+
const a = f.purchaseOrder, r = f.poRequest;
|
|
724
|
+
return a && ((c = a == null ? void 0 : a.supplier) != null && c.internal ? (!r && a.status == $.enum.DRAFT && (n = !1), r && !((u = r == null ? void 0 : r.netSuite) != null && u.id) && (n = !1), f.isTransferBetweenOutlets && (n = !1)) : ((a == null ? void 0 : a.status) !== $.enum.REQUESTING && a.supplier.internal && (n = !1), !r && !((d = a == null ? void 0 : a.netSuite) != null && d.id) && (n = !1), !r && ((P = a == null ? void 0 : a.netSuite) != null && P.id) && (a == null ? void 0 : a.status) == $.enum.REQUESTING && (n = !1))), n;
|
|
725
|
+
});
|
|
726
|
+
async function v() {
|
|
727
|
+
R.value || _.open({
|
|
728
|
+
title: "Sync with NetSuite",
|
|
729
|
+
contentComponent: x("div", [
|
|
730
|
+
x("p", "Are you sure you want to sync now?"),
|
|
731
|
+
x("br"),
|
|
732
|
+
x(
|
|
733
|
+
"p",
|
|
734
|
+
{ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
|
|
735
|
+
"Please wait a moment before syncing manually to avoid unnecessary actions."
|
|
736
|
+
)
|
|
737
|
+
]),
|
|
738
|
+
primaryActions: {
|
|
739
|
+
text: "Sync",
|
|
740
|
+
close: !0,
|
|
741
|
+
variant: "destructive"
|
|
742
|
+
},
|
|
743
|
+
secondaryActions: { text: "Not now", close: !0 }
|
|
744
|
+
}).onPrimary(async () => {
|
|
745
|
+
var n;
|
|
746
|
+
try {
|
|
747
|
+
R.value = !0;
|
|
748
|
+
const a = f.purchaseOrder, r = f.poRequest;
|
|
749
|
+
let c = "purchaseOrder";
|
|
750
|
+
if ((n = a == null ? void 0 : a.supplier) != null && n.internal && (c = "purchaseOrderRequest"), !(a != null && a._id)) {
|
|
751
|
+
s.open({
|
|
752
|
+
title: "Error",
|
|
753
|
+
message: "Invalid sync ID",
|
|
754
|
+
type: "error"
|
|
755
|
+
});
|
|
756
|
+
return;
|
|
757
|
+
}
|
|
758
|
+
await b.syncTransferOrder(c, a == null ? void 0 : a._id, r == null ? void 0 : r._id), s.open({
|
|
759
|
+
title: "Sync with NetSuite",
|
|
760
|
+
message: "Requested to sync with NetSuite. Please wait a moment.",
|
|
761
|
+
type: "success"
|
|
762
|
+
});
|
|
763
|
+
} catch {
|
|
764
|
+
s.open({
|
|
765
|
+
title: "Error",
|
|
766
|
+
message: "Failed to sync with NetSuite",
|
|
767
|
+
type: "error"
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
setTimeout(() => {
|
|
771
|
+
R.value = !1;
|
|
772
|
+
}, 5e3);
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
return (n, a) => {
|
|
776
|
+
const r = te("FmButton");
|
|
777
|
+
return E.value ? (y(), w("div", kt, [
|
|
778
|
+
V(r, {
|
|
779
|
+
"prepend-icon": "sync",
|
|
780
|
+
variant: "primary",
|
|
781
|
+
label: "NetSuite",
|
|
782
|
+
loading: R.value,
|
|
783
|
+
onClick: v
|
|
784
|
+
}, null, 8, ["loading"])
|
|
785
|
+
])) : N("", !0);
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
}), Nt = { class: "flex flex-col gap-16 w-full h-full" }, qt = { class: "flex justify-between" }, Tt = { class: "fm-typo-en-body-lg-600" }, Pt = { class: "flex flex-col gap-8" }, Et = { class: "flex flex-col gap-4" }, Ct = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, $t = { class: "flex gap-1" }, It = { class: "fm-typo-en-body-lg-600" }, Ft = {
|
|
789
|
+
key: 0,
|
|
790
|
+
class: "flex flex-col gap-4"
|
|
791
|
+
}, Ut = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Bt = { class: "fm-typo-en-body-lg-600" }, Lt = { class: "flex flex-col gap-4" }, Mt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, jt = { class: "fm-typo-en-body-lg-600" }, Vt = {
|
|
792
|
+
key: 1,
|
|
793
|
+
class: "flex flex-col gap-4"
|
|
794
|
+
}, Kt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Gt = { class: "fm-typo-en-body-lg-600" }, Ht = {
|
|
795
|
+
key: 2,
|
|
796
|
+
class: "flex flex-col gap-4"
|
|
797
|
+
}, zt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Qt = { class: "fm-typo-en-body-lg-600" }, Yt = {
|
|
798
|
+
key: 3,
|
|
799
|
+
class: "flex flex-col gap-4"
|
|
800
|
+
}, Wt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Jt = { class: "fm-typo-en-body-lg-600" }, Zt = {
|
|
801
|
+
key: 4,
|
|
802
|
+
class: "flex flex-col gap-4"
|
|
803
|
+
}, Xt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, es = { class: "fm-typo-en-body-lg-600" }, ts = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, ss = { class: "flex flex-col gap-8" }, rs = { class: "fm-typo-en-body-lg-600" }, as = { class: "flex gap-8" }, ns = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-4" }, os = { class: "flex w-full gap-4" }, ls = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2" }, cs = { class: "fm-typo-en-body-lg-600 line-clamp-2" }, is = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, us = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, ds = {
|
|
804
|
+
key: 0,
|
|
805
|
+
class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
|
|
806
|
+
}, ms = { class: "py-8" }, fs = { class: "flex justify-end gap-4 items-center" }, ps = { class: "fm-typo-en-body-lg-600" }, vs = {
|
|
807
|
+
key: 1,
|
|
808
|
+
class: "flex-1 xs:w-screen xs:max-w-full"
|
|
809
|
+
}, ys = {
|
|
810
|
+
key: 0,
|
|
811
|
+
class: "flex flex-col items-center gap-8 h-full"
|
|
812
|
+
}, hs = ["src"], bs = { class: "fm-typo-en-body-lg-600" }, gs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, _s = {
|
|
813
|
+
key: 1,
|
|
814
|
+
class: "px-4 flex flex-col"
|
|
815
|
+
}, Ss = { class: "flex gap-12 content-stretch" }, Rs = {
|
|
816
|
+
class: "flex flex-col w-24",
|
|
817
|
+
name: "circles"
|
|
818
|
+
}, ws = { class: "flex-1 flex flex-col items-center" }, Os = { class: "flex-1 flex flex-col items-center" }, xs = {
|
|
819
|
+
class: "py-12 flex flex-col gap-4",
|
|
820
|
+
name: "received-at header"
|
|
821
|
+
}, Ds = { class: "fm-typo-en-body-lg-400" }, ks = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, As = { class: "flex gap-12 content-stretch" }, Ns = {
|
|
822
|
+
class: "flex flex-col w-24",
|
|
823
|
+
name: "circles"
|
|
824
|
+
}, qs = { class: "flex-1 flex flex-col items-center" }, Ts = {
|
|
825
|
+
class: "py-12 flex flex-col gap-4 flex-1",
|
|
826
|
+
name: "delivery details"
|
|
827
|
+
}, Ps = { class: "flex flex-col gap-8" }, Es = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Cs = { class: "flex flex-col gap-4" }, $s = { class: "flex gap-8 xs:flex-col" }, Hs = /* @__PURE__ */ Oe({
|
|
828
|
+
__name: "TransferDetails",
|
|
829
|
+
props: {
|
|
830
|
+
poRequest: {},
|
|
831
|
+
purchaseOrder: {},
|
|
832
|
+
transferTo: {},
|
|
833
|
+
transferToDbName: {},
|
|
834
|
+
show: { type: Boolean },
|
|
835
|
+
canResubmit: { type: Boolean },
|
|
836
|
+
canApprove: { type: Boolean },
|
|
837
|
+
scope: {}
|
|
838
|
+
},
|
|
839
|
+
emits: ["update:show", "submitted"],
|
|
840
|
+
setup(m, { emit: f }) {
|
|
841
|
+
const b = m, s = f, _ = xe(), R = De(), E = Ke(), { t: v } = Ve(), n = W(
|
|
842
|
+
() => {
|
|
843
|
+
var t, o, C, q;
|
|
844
|
+
return ((o = (t = b.purchaseOrder) == null ? void 0 : t.supplier) == null ? void 0 : o.internal) === "restaurant" || ((q = (C = b.purchaseOrder) == null ? void 0 : C.supplier) == null ? void 0 : q.internal) === "warehouse" ? ue.TRANSFER : ue.PURCHASE;
|
|
845
|
+
}
|
|
846
|
+
), a = W(() => {
|
|
847
|
+
var t, o, C;
|
|
848
|
+
return n.value === ue.TRANSFER && ((t = b.transferToDbName) == null ? void 0 : t.startsWith("restaurant")) && ((C = (o = b.purchaseOrder) == null ? void 0 : o.supplier) == null ? void 0 : C.internal) === "restaurant";
|
|
849
|
+
}), r = [
|
|
850
|
+
{
|
|
851
|
+
label: v("inventory.transfer.receiveRequest.details.overview"),
|
|
852
|
+
value: "overview"
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
label: v("inventory.transfer.receiveRequest.details.deliveryHistory"),
|
|
856
|
+
value: "deliveryHistory"
|
|
857
|
+
}
|
|
858
|
+
], c = K(r[0]), u = K(!1), d = K(""), P = K(!0), I = ke(), J = ot(b, "show");
|
|
859
|
+
async function se(t, o, C) {
|
|
860
|
+
d.value = o, u.value = !0, P.value = !1;
|
|
861
|
+
try {
|
|
862
|
+
await I.processPurchaseOrder(
|
|
863
|
+
{
|
|
864
|
+
operation: o,
|
|
865
|
+
doc: t,
|
|
866
|
+
options: (
|
|
867
|
+
// auto receive for supplier to warehouse
|
|
868
|
+
(o === D.enum.confirmDraft || // auto receive for warehouse to warehouse
|
|
869
|
+
o === D.enum.completeReceive) && E.autoReceiveWarehouse ? {
|
|
870
|
+
autoReceive: !0
|
|
871
|
+
} : void 0
|
|
872
|
+
)
|
|
873
|
+
},
|
|
874
|
+
b.transferToDbName
|
|
875
|
+
), await new Promise((q) => setTimeout(q, 1e3)), R.open({
|
|
876
|
+
title: "Success",
|
|
877
|
+
message: C,
|
|
878
|
+
type: "success"
|
|
879
|
+
}), s("update:show", !1), s("submitted");
|
|
880
|
+
} catch (q) {
|
|
881
|
+
R.open({
|
|
882
|
+
title: "Something went wrong",
|
|
883
|
+
message: "Please try again.",
|
|
884
|
+
type: "error"
|
|
885
|
+
}), console.error("Error when submitting PO operation", o, t, q);
|
|
886
|
+
} finally {
|
|
887
|
+
d.value = "", u.value = !1, P.value = !0;
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
async function M(t) {
|
|
891
|
+
const o = Ge[t];
|
|
892
|
+
if (!o) {
|
|
893
|
+
R.open({
|
|
894
|
+
title: "Something went wrong",
|
|
895
|
+
message: `Cannot process order: ${Be(t)}`,
|
|
896
|
+
type: "error"
|
|
897
|
+
});
|
|
898
|
+
return;
|
|
899
|
+
}
|
|
900
|
+
const { successMessage: C, ...q } = o;
|
|
901
|
+
_.open({
|
|
902
|
+
title: q.title,
|
|
903
|
+
message: q.message,
|
|
904
|
+
primaryActions: q.primaryActions
|
|
905
|
+
}).onPrimary(() => {
|
|
906
|
+
b.purchaseOrder && se(b.purchaseOrder, t, C);
|
|
907
|
+
});
|
|
908
|
+
}
|
|
909
|
+
const re = W(() => {
|
|
910
|
+
var t, o;
|
|
911
|
+
return ((t = b.purchaseOrder) == null ? void 0 : t.status) === $.enum.RECEIVING || ((o = b.purchaseOrder) == null ? void 0 : o.status) === $.enum.COMPLETE;
|
|
912
|
+
}), ae = W(() => {
|
|
913
|
+
var p, k, i;
|
|
914
|
+
const C = (((p = b.purchaseOrder) == null ? void 0 : p.deliveryOrder) ?? []).flatMap((S) => S.received ?? []).reduce(
|
|
915
|
+
(S, O) => {
|
|
916
|
+
const F = S[O.sku._id] ?? [];
|
|
917
|
+
return S[O.sku._id] = [...F, O], S;
|
|
918
|
+
},
|
|
919
|
+
{}
|
|
920
|
+
), q = Object.entries(C).reduce(
|
|
921
|
+
(S, [O, F]) => {
|
|
922
|
+
const T = F.reduce((G, H) => {
|
|
923
|
+
const ee = Ze(
|
|
924
|
+
G,
|
|
925
|
+
Math.max(G.precision, H.amount.precision)
|
|
926
|
+
);
|
|
927
|
+
return Re(ee, H.amount);
|
|
928
|
+
}, he(0));
|
|
929
|
+
return S[O] = T, S;
|
|
930
|
+
},
|
|
931
|
+
{}
|
|
932
|
+
), h = ((k = b.purchaseOrder) == null ? void 0 : k.items) ?? [];
|
|
933
|
+
for (const S of h)
|
|
934
|
+
q[i = S.sku._id] ?? (q[i] = he(0));
|
|
935
|
+
return q;
|
|
936
|
+
}), Z = W(() => {
|
|
937
|
+
var p, k;
|
|
938
|
+
const t = ((p = b.purchaseOrder) == null ? void 0 : p.deliveryOrder) ?? [], o = ((k = b.purchaseOrder) == null ? void 0 : k.deliveryFullfillment) ?? [], C = [
|
|
939
|
+
...t.map((i) => ({
|
|
940
|
+
createdAt: i.createdAt,
|
|
941
|
+
type: "grn",
|
|
942
|
+
doc: i
|
|
943
|
+
})),
|
|
944
|
+
...o.map((i) => ({
|
|
945
|
+
createdAt: i.createdAt,
|
|
946
|
+
type: "fulfillment",
|
|
947
|
+
doc: i
|
|
948
|
+
}))
|
|
949
|
+
];
|
|
950
|
+
C.reverse().sort((i, S) => i.createdAt.localeCompare(S.createdAt));
|
|
951
|
+
function q(i) {
|
|
952
|
+
var O, F, T, G, H, ee, ce;
|
|
953
|
+
const S = o.findIndex((j) => j.id === i.fullfillmentId);
|
|
954
|
+
return {
|
|
955
|
+
header: "Received",
|
|
956
|
+
date: Fe(new Date(i.createdAt)),
|
|
957
|
+
info: [
|
|
958
|
+
{
|
|
959
|
+
label: "Received by",
|
|
960
|
+
values: [(O = i.createdBy) == null ? void 0 : O.name]
|
|
961
|
+
},
|
|
962
|
+
{
|
|
963
|
+
label: "Received items",
|
|
964
|
+
values: i.received.map((j) => {
|
|
965
|
+
var ie;
|
|
966
|
+
return x("div", [
|
|
967
|
+
x(
|
|
968
|
+
"div",
|
|
969
|
+
{
|
|
970
|
+
class: "flex gap-4"
|
|
971
|
+
},
|
|
972
|
+
[
|
|
973
|
+
x(
|
|
974
|
+
"div",
|
|
975
|
+
{
|
|
976
|
+
class: "flex flex-col"
|
|
977
|
+
},
|
|
978
|
+
[
|
|
979
|
+
x(
|
|
980
|
+
"span",
|
|
981
|
+
{
|
|
982
|
+
class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
|
|
983
|
+
},
|
|
984
|
+
`${j.sku.name}`
|
|
985
|
+
),
|
|
986
|
+
x(
|
|
987
|
+
"span",
|
|
988
|
+
{
|
|
989
|
+
class: "fm-typo-en-body-md-400"
|
|
990
|
+
},
|
|
991
|
+
`${j.sku.code} `
|
|
992
|
+
)
|
|
993
|
+
]
|
|
994
|
+
),
|
|
995
|
+
x(
|
|
996
|
+
"div",
|
|
997
|
+
{
|
|
998
|
+
class: "ml-auto flex flex-col"
|
|
999
|
+
},
|
|
1000
|
+
[
|
|
1001
|
+
x(
|
|
1002
|
+
"div",
|
|
1003
|
+
{
|
|
1004
|
+
class: "ml-auto flex gap-1"
|
|
1005
|
+
},
|
|
1006
|
+
[
|
|
1007
|
+
x(
|
|
1008
|
+
"span",
|
|
1009
|
+
{
|
|
1010
|
+
class: "fm-typo-en-body-lg-600 self-end"
|
|
1011
|
+
},
|
|
1012
|
+
fe(j.amount, !1)
|
|
1013
|
+
),
|
|
1014
|
+
x(
|
|
1015
|
+
"span",
|
|
1016
|
+
{
|
|
1017
|
+
class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
|
|
1018
|
+
},
|
|
1019
|
+
((ie = j.measurement) == null ? void 0 : ie.abbrev) ?? j.sku.unit.abbrev
|
|
1020
|
+
)
|
|
1021
|
+
]
|
|
1022
|
+
)
|
|
1023
|
+
]
|
|
1024
|
+
)
|
|
1025
|
+
]
|
|
1026
|
+
)
|
|
1027
|
+
]);
|
|
1028
|
+
})
|
|
1029
|
+
},
|
|
1030
|
+
i.deliveryOrderNumber ? {
|
|
1031
|
+
label: "Delivery order no.",
|
|
1032
|
+
values: [i.deliveryOrderNumber]
|
|
1033
|
+
} : null,
|
|
1034
|
+
i.remark ? {
|
|
1035
|
+
label: "Remark",
|
|
1036
|
+
values: [i.remark]
|
|
1037
|
+
} : null,
|
|
1038
|
+
S > -1 ? {
|
|
1039
|
+
label: "Fulfilment's sequence",
|
|
1040
|
+
values: [`${S + 1}`]
|
|
1041
|
+
} : null,
|
|
1042
|
+
(T = (F = o[S]) == null ? void 0 : F.netSuite) != null && T.refNo ? {
|
|
1043
|
+
label: "Fulfillment's ref no. (Netsuite)",
|
|
1044
|
+
values: [(H = (G = o[S]) == null ? void 0 : G.netSuite) == null ? void 0 : H.refNo]
|
|
1045
|
+
} : null,
|
|
1046
|
+
(ee = i == null ? void 0 : i.netSuite) != null && ee.refNo ? {
|
|
1047
|
+
label: "Item receipt (Netsuite)",
|
|
1048
|
+
values: [(ce = i == null ? void 0 : i.netSuite) == null ? void 0 : ce.refNo]
|
|
1049
|
+
} : null
|
|
1050
|
+
].filter((j) => j)
|
|
1051
|
+
};
|
|
1052
|
+
}
|
|
1053
|
+
function h(i) {
|
|
1054
|
+
var O, F;
|
|
1055
|
+
const S = o.findIndex((T) => T.id === i.id);
|
|
1056
|
+
return {
|
|
1057
|
+
header: "Fulfillment",
|
|
1058
|
+
date: Fe(new Date(i.createdAt)),
|
|
1059
|
+
info: [
|
|
1060
|
+
{
|
|
1061
|
+
label: "Sequence",
|
|
1062
|
+
values: [String(S + 1)]
|
|
1063
|
+
},
|
|
1064
|
+
{
|
|
1065
|
+
label: "Receiveable items",
|
|
1066
|
+
values: i.items.map((T) => {
|
|
1067
|
+
var G;
|
|
1068
|
+
return x("div", [
|
|
1069
|
+
x(
|
|
1070
|
+
"div",
|
|
1071
|
+
{
|
|
1072
|
+
class: "flex gap-4"
|
|
1073
|
+
},
|
|
1074
|
+
[
|
|
1075
|
+
x(
|
|
1076
|
+
"div",
|
|
1077
|
+
{
|
|
1078
|
+
class: "flex flex-col"
|
|
1079
|
+
},
|
|
1080
|
+
[
|
|
1081
|
+
x(
|
|
1082
|
+
"span",
|
|
1083
|
+
{
|
|
1084
|
+
class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
|
|
1085
|
+
},
|
|
1086
|
+
`${T.sku.name}`
|
|
1087
|
+
),
|
|
1088
|
+
x(
|
|
1089
|
+
"span",
|
|
1090
|
+
{
|
|
1091
|
+
class: "fm-typo-en-body-md-400"
|
|
1092
|
+
},
|
|
1093
|
+
`${T.sku.code} `
|
|
1094
|
+
)
|
|
1095
|
+
]
|
|
1096
|
+
),
|
|
1097
|
+
x(
|
|
1098
|
+
"div",
|
|
1099
|
+
{
|
|
1100
|
+
class: "ml-auto flex flex-col"
|
|
1101
|
+
},
|
|
1102
|
+
[
|
|
1103
|
+
x(
|
|
1104
|
+
"div",
|
|
1105
|
+
{
|
|
1106
|
+
class: "ml-auto flex gap-1"
|
|
1107
|
+
},
|
|
1108
|
+
[
|
|
1109
|
+
x(
|
|
1110
|
+
"span",
|
|
1111
|
+
{
|
|
1112
|
+
class: "fm-typo-en-body-lg-600 self-end"
|
|
1113
|
+
},
|
|
1114
|
+
fe(T.amount, !1)
|
|
1115
|
+
),
|
|
1116
|
+
x(
|
|
1117
|
+
"span",
|
|
1118
|
+
{
|
|
1119
|
+
class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
|
|
1120
|
+
},
|
|
1121
|
+
((G = T.measurement) == null ? void 0 : G.abbrev) ?? T.sku.unit.abbrev
|
|
1122
|
+
)
|
|
1123
|
+
]
|
|
1124
|
+
),
|
|
1125
|
+
x(
|
|
1126
|
+
"div",
|
|
1127
|
+
{
|
|
1128
|
+
class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
1129
|
+
},
|
|
1130
|
+
`${T.cost ? `(${_e(T.cost)})` : ""}`
|
|
1131
|
+
)
|
|
1132
|
+
]
|
|
1133
|
+
)
|
|
1134
|
+
]
|
|
1135
|
+
)
|
|
1136
|
+
]);
|
|
1137
|
+
})
|
|
1138
|
+
},
|
|
1139
|
+
(O = i.netSuite) != null && O.refNo ? {
|
|
1140
|
+
label: "Ref no. (Netsuite)",
|
|
1141
|
+
values: [(F = i.netSuite) == null ? void 0 : F.refNo]
|
|
1142
|
+
} : null
|
|
1143
|
+
].filter((T) => T)
|
|
1144
|
+
};
|
|
1145
|
+
}
|
|
1146
|
+
return C.map((i) => {
|
|
1147
|
+
switch (i.type) {
|
|
1148
|
+
case "grn":
|
|
1149
|
+
return q(i.doc);
|
|
1150
|
+
case "fulfillment":
|
|
1151
|
+
return h(i.doc);
|
|
1152
|
+
}
|
|
1153
|
+
});
|
|
1154
|
+
}), Q = W(() => {
|
|
1155
|
+
var o;
|
|
1156
|
+
const t = {
|
|
1157
|
+
...he(0),
|
|
1158
|
+
currency: Ie()
|
|
1159
|
+
};
|
|
1160
|
+
return ((o = b.purchaseOrder) == null ? void 0 : o.items.reduce((C, q) => ({
|
|
1161
|
+
...Re(C, q.totalCost ?? t),
|
|
1162
|
+
currency: Ie()
|
|
1163
|
+
}), t)) ?? t;
|
|
1164
|
+
});
|
|
1165
|
+
return (t, o) => {
|
|
1166
|
+
var T, G;
|
|
1167
|
+
const C = te("FmButtonGroup"), q = te("FmChip"), h = te("FmMenuDivider"), p = te("FmCard"), k = te("FmIcon"), i = te("FmTooltip"), S = te("FmSpacer"), O = te("FmButton"), F = te("FmSideSheet");
|
|
1168
|
+
return y(), X(F, {
|
|
1169
|
+
header: l(v)("inventory.transfer.receiveRequest.details.title") + ((T = t.purchaseOrder) != null && T.seqNumber ? ` #${(G = t.purchaseOrder) == null ? void 0 : G.seqNumber}` : ""),
|
|
1170
|
+
modelValue: l(J),
|
|
1171
|
+
"onUpdate:modelValue": o[9] || (o[9] = (H) => et(J) ? J.value = H : null),
|
|
1172
|
+
"dismiss-away": P.value,
|
|
1173
|
+
"close-button": "",
|
|
1174
|
+
"max-width": 600
|
|
1175
|
+
}, {
|
|
1176
|
+
default: de(() => {
|
|
1177
|
+
var H, ee, ce, j, ie;
|
|
1178
|
+
return [
|
|
1179
|
+
e("div", Nt, [
|
|
1180
|
+
V(At, {
|
|
1181
|
+
"po-request": t.poRequest,
|
|
1182
|
+
"purchase-order": t.purchaseOrder,
|
|
1183
|
+
"is-transfer-between-outlets": a.value
|
|
1184
|
+
}, null, 8, ["po-request", "purchase-order", "is-transfer-between-outlets"]),
|
|
1185
|
+
e("div", null, [
|
|
1186
|
+
V(C, {
|
|
1187
|
+
items: r,
|
|
1188
|
+
modelValue: c.value,
|
|
1189
|
+
"onUpdate:modelValue": o[0] || (o[0] = (A) => c.value = A)
|
|
1190
|
+
}, null, 8, ["modelValue"])
|
|
1191
|
+
]),
|
|
1192
|
+
c.value.value === "overview" ? (y(), w(le, { key: 0 }, [
|
|
1193
|
+
e("div", null, [
|
|
1194
|
+
V(p, {
|
|
1195
|
+
variant: "outlined",
|
|
1196
|
+
class: "flex flex-col gap-8 px-12 py-16"
|
|
1197
|
+
}, {
|
|
1198
|
+
default: de(() => {
|
|
1199
|
+
var A, U, B, ne, oe, Y, Ae, Ne, qe, Te, Pe, Ee;
|
|
1200
|
+
return [
|
|
1201
|
+
e("div", qt, [
|
|
1202
|
+
e("div", Tt, g(l(v)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
|
|
1203
|
+
e("div", null, [
|
|
1204
|
+
V(q, {
|
|
1205
|
+
label: l(v)(`inventory.transfer.status.${(A = t.purchaseOrder) == null ? void 0 : A.status}`),
|
|
1206
|
+
class: ye(`fm-status-badge fm-status-badge-${(B = (U = t.purchaseOrder) == null ? void 0 : U.status) == null ? void 0 : B.toLocaleLowerCase("en-us")}`),
|
|
1207
|
+
compact: ""
|
|
1208
|
+
}, null, 8, ["label", "class"])
|
|
1209
|
+
])
|
|
1210
|
+
]),
|
|
1211
|
+
V(h),
|
|
1212
|
+
e("div", Pt, [
|
|
1213
|
+
e("div", Et, [
|
|
1214
|
+
e("div", Ct, [
|
|
1215
|
+
e("div", $t, g(l(v)("inventory.transfer.receiveRequest.details.createdAt")), 1)
|
|
1216
|
+
]),
|
|
1217
|
+
e("div", It, g(l(ge)(((ne = t.purchaseOrder) == null ? void 0 : ne._id) ?? "")), 1)
|
|
1218
|
+
]),
|
|
1219
|
+
(oe = t.purchaseOrder) != null && oe.effectiveAt ? (y(), w("div", Ft, [
|
|
1220
|
+
e("div", Ut, g(l(v)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
|
|
1221
|
+
e("div", Bt, g(l(Le)(new Date((Y = t.purchaseOrder) == null ? void 0 : Y.effectiveAt))), 1)
|
|
1222
|
+
])) : N("", !0),
|
|
1223
|
+
e("div", Lt, [
|
|
1224
|
+
e("div", Mt, g(l(v)("inventory.transfer.receiveRequest.details.type.title")), 1),
|
|
1225
|
+
e("div", jt, g(l(v)(
|
|
1226
|
+
`inventory.transfer.receiveRequest.details.type.${n.value.toLocaleLowerCase("en-US")}`
|
|
1227
|
+
)), 1)
|
|
1228
|
+
]),
|
|
1229
|
+
(Ne = (Ae = t.purchaseOrder) == null ? void 0 : Ae.supplier) != null && Ne.name ? (y(), w("div", Vt, [
|
|
1230
|
+
e("div", Kt, g(l(v)("inventory.transfer.receiveRequest.details.from")), 1),
|
|
1231
|
+
e("div", Gt, g((Te = (qe = t.purchaseOrder) == null ? void 0 : qe.supplier) == null ? void 0 : Te.name), 1)
|
|
1232
|
+
])) : N("", !0),
|
|
1233
|
+
t.transferTo ? (y(), w("div", Ht, [
|
|
1234
|
+
e("div", zt, g(l(v)("inventory.transfer.receiveRequest.details.to")), 1),
|
|
1235
|
+
e("div", Qt, g(t.transferTo), 1)
|
|
1236
|
+
])) : N("", !0),
|
|
1237
|
+
V(Dt, {
|
|
1238
|
+
"po-request": t.poRequest,
|
|
1239
|
+
"purchase-order": t.purchaseOrder,
|
|
1240
|
+
"transfer-type": n.value,
|
|
1241
|
+
"transfer-to-db-name": t.transferToDbName,
|
|
1242
|
+
"is-transfer-between-outlets": a.value,
|
|
1243
|
+
scope: t.scope
|
|
1244
|
+
}, null, 8, ["po-request", "purchase-order", "transfer-type", "transfer-to-db-name", "is-transfer-between-outlets", "scope"]),
|
|
1245
|
+
(Pe = t.purchaseOrder) != null && Pe.ref ? (y(), w("div", Yt, [
|
|
1246
|
+
e("div", Wt, g(l(v)("inventory.transfer.receiveRequest.details.reference")), 1),
|
|
1247
|
+
e("div", Jt, g(t.purchaseOrder.ref), 1)
|
|
1248
|
+
])) : N("", !0),
|
|
1249
|
+
(Ee = t.purchaseOrder) != null && Ee.remark ? (y(), w("div", Zt, [
|
|
1250
|
+
e("div", Xt, g(l(v)("inventory.transfer.receiveRequest.details.remark")), 1),
|
|
1251
|
+
e("div", es, g(t.purchaseOrder.remark), 1)
|
|
1252
|
+
])) : N("", !0)
|
|
1253
|
+
])
|
|
1254
|
+
];
|
|
1255
|
+
}),
|
|
1256
|
+
_: 1
|
|
1257
|
+
})
|
|
1258
|
+
]),
|
|
1259
|
+
e("div", ts, [
|
|
1260
|
+
e("div", ss, [
|
|
1261
|
+
e("div", rs, [
|
|
1262
|
+
e("div", as, [
|
|
1263
|
+
Se(g(re.value ? l(v)("inventory.transfer.receiveRequest.details.receivedItems") : l(v)("inventory.transfer.receiveRequest.details.requestedItems")) + " ", 1),
|
|
1264
|
+
(ee = (H = t.purchaseOrder) == null ? void 0 : H.netSuite) != null && ee.missingItems && ((j = (ce = t.purchaseOrder) == null ? void 0 : ce.netSuite) == null ? void 0 : j.missingItems.length) > 0 ? (y(), X(i, {
|
|
1265
|
+
key: 0,
|
|
1266
|
+
variant: "rich",
|
|
1267
|
+
placement: "top",
|
|
1268
|
+
"z-index": 51
|
|
1269
|
+
}, {
|
|
1270
|
+
content: de(() => {
|
|
1271
|
+
var A, U;
|
|
1272
|
+
return [
|
|
1273
|
+
e("div", ns, [
|
|
1274
|
+
(y(!0), w(le, null, pe((U = (A = t.purchaseOrder) == null ? void 0 : A.netSuite) == null ? void 0 : U.missingItems, (B, ne) => (y(), w("div", {
|
|
1275
|
+
class: "flex justify-center align-middle",
|
|
1276
|
+
key: ne
|
|
1277
|
+
}, [
|
|
1278
|
+
V(k, {
|
|
1279
|
+
name: "arrow_right",
|
|
1280
|
+
size: "sm"
|
|
1281
|
+
}),
|
|
1282
|
+
Se(" " + g(`(${B.netSuiteId}) ${B.name}: ${B.reason}`), 1)
|
|
1283
|
+
]))), 128))
|
|
1284
|
+
])
|
|
1285
|
+
];
|
|
1286
|
+
}),
|
|
1287
|
+
default: de(() => [
|
|
1288
|
+
V(k, {
|
|
1289
|
+
name: "error",
|
|
1290
|
+
color: "#ff2c2c",
|
|
1291
|
+
size: "sm"
|
|
1292
|
+
})
|
|
1293
|
+
]),
|
|
1294
|
+
_: 1
|
|
1295
|
+
})) : N("", !0)
|
|
1296
|
+
])
|
|
1297
|
+
]),
|
|
1298
|
+
(y(!0), w(le, null, pe(((ie = t.purchaseOrder) == null ? void 0 : ie.items) ?? [], (A) => (y(), w("div", {
|
|
1299
|
+
key: A.code,
|
|
1300
|
+
class: "flex flex-col"
|
|
1301
|
+
}, [
|
|
1302
|
+
e("div", os, [
|
|
1303
|
+
e("div", ls, g(A.name), 1),
|
|
1304
|
+
e("div", cs, g(l(fe)(ae.value[A.sku._id], !1)) + "/" + g(l(je)(A.quantity, A.sku.unit, A.measurement)), 1)
|
|
1305
|
+
]),
|
|
1306
|
+
e("div", is, [
|
|
1307
|
+
e("div", us, g(A.code), 1),
|
|
1308
|
+
A.totalCost && l(E).enableTotalCost ? (y(), w("div", ds, " (" + g(l(_e)(A.totalCost)) + ") ", 1)) : N("", !0)
|
|
1309
|
+
])
|
|
1310
|
+
]))), 128)),
|
|
1311
|
+
+l(fe)(Q.value) ? (y(), w(le, { key: 0 }, [
|
|
1312
|
+
e("div", ms, [
|
|
1313
|
+
V(h)
|
|
1314
|
+
]),
|
|
1315
|
+
e("div", fs, [
|
|
1316
|
+
o[10] || (o[10] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Total:", -1)),
|
|
1317
|
+
e("div", ps, g(l(_e)(Q.value)), 1)
|
|
1318
|
+
])
|
|
1319
|
+
], 64)) : N("", !0)
|
|
1320
|
+
])
|
|
1321
|
+
])
|
|
1322
|
+
], 64)) : N("", !0),
|
|
1323
|
+
c.value.value === "deliveryHistory" ? (y(), w("div", vs, [
|
|
1324
|
+
Z.value.length ? (y(), w("div", _s, [
|
|
1325
|
+
(y(!0), w(le, null, pe(Z.value, (A, U) => (y(), w(le, { key: U }, [
|
|
1326
|
+
e("div", Ss, [
|
|
1327
|
+
e("div", Rs, [
|
|
1328
|
+
e("div", ws, [
|
|
1329
|
+
e("div", {
|
|
1330
|
+
class: ye([
|
|
1331
|
+
{
|
|
1332
|
+
"bg-fm-color-primary": U !== 0,
|
|
1333
|
+
"bg-white": U === 0
|
|
1334
|
+
},
|
|
1335
|
+
"w-[2px] h-full"
|
|
1336
|
+
])
|
|
1337
|
+
}, null, 2)
|
|
1338
|
+
]),
|
|
1339
|
+
o[11] || (o[11] = e("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
|
|
1340
|
+
e("div", Os, [
|
|
1341
|
+
e("div", {
|
|
1342
|
+
class: ye([
|
|
1343
|
+
{
|
|
1344
|
+
"bg-fm-color-primary": U < Z.value.length - 1,
|
|
1345
|
+
"bg-white": U >= Z.value.length - 1
|
|
1346
|
+
},
|
|
1347
|
+
"w-[2px] h-full"
|
|
1348
|
+
])
|
|
1349
|
+
}, null, 2)
|
|
1350
|
+
])
|
|
1351
|
+
]),
|
|
1352
|
+
e("div", xs, [
|
|
1353
|
+
e("div", Ds, g(A.header), 1),
|
|
1354
|
+
e("div", ks, g(A.date), 1)
|
|
1355
|
+
])
|
|
1356
|
+
]),
|
|
1357
|
+
e("div", As, [
|
|
1358
|
+
e("div", Ns, [
|
|
1359
|
+
e("div", qs, [
|
|
1360
|
+
e("div", {
|
|
1361
|
+
class: ye([
|
|
1362
|
+
{
|
|
1363
|
+
"bg-fm-color-primary": U < Z.value.length - 1,
|
|
1364
|
+
"bg-white": U >= Z.value.length - 1
|
|
1365
|
+
},
|
|
1366
|
+
"w-[2px] h-full"
|
|
1367
|
+
])
|
|
1368
|
+
}, null, 2)
|
|
1369
|
+
])
|
|
1370
|
+
]),
|
|
1371
|
+
e("div", Ts, [
|
|
1372
|
+
V(p, {
|
|
1373
|
+
variant: "outlined",
|
|
1374
|
+
class: "py-12 px-16"
|
|
1375
|
+
}, {
|
|
1376
|
+
default: de(() => [
|
|
1377
|
+
e("div", Ps, [
|
|
1378
|
+
(y(!0), w(le, null, pe(A.info, (B, ne) => (y(), w("div", {
|
|
1379
|
+
key: ne,
|
|
1380
|
+
class: "flex flex-col gap-4"
|
|
1381
|
+
}, [
|
|
1382
|
+
e("div", Es, g(B == null ? void 0 : B.label), 1),
|
|
1383
|
+
e("div", Cs, [
|
|
1384
|
+
(y(!0), w(le, null, pe(B == null ? void 0 : B.values, (oe, Y) => (y(), w("div", {
|
|
1385
|
+
key: Y,
|
|
1386
|
+
class: "fm-typo-en-body-lg-600"
|
|
1387
|
+
}, [
|
|
1388
|
+
typeof oe == "string" ? (y(), w(le, { key: 0 }, [
|
|
1389
|
+
Se(g(oe), 1)
|
|
1390
|
+
], 64)) : (y(), X(tt(oe), { key: 1 }))
|
|
1391
|
+
]))), 128))
|
|
1392
|
+
])
|
|
1393
|
+
]))), 128))
|
|
1394
|
+
])
|
|
1395
|
+
]),
|
|
1396
|
+
_: 2
|
|
1397
|
+
}, 1024)
|
|
1398
|
+
])
|
|
1399
|
+
])
|
|
1400
|
+
], 64))), 128))
|
|
1401
|
+
])) : (y(), w("div", ys, [
|
|
1402
|
+
V(S),
|
|
1403
|
+
e("div", null, [
|
|
1404
|
+
e("img", {
|
|
1405
|
+
src: l(nt),
|
|
1406
|
+
alt: "List is empty"
|
|
1407
|
+
}, null, 8, hs)
|
|
1408
|
+
]),
|
|
1409
|
+
e("div", bs, g(l(v)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
|
|
1410
|
+
e("div", gs, g(l(v)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
|
|
1411
|
+
V(S),
|
|
1412
|
+
V(S)
|
|
1413
|
+
]))
|
|
1414
|
+
])) : N("", !0)
|
|
1415
|
+
])
|
|
1416
|
+
];
|
|
1417
|
+
}),
|
|
1418
|
+
"side-sheet-footer": de(() => {
|
|
1419
|
+
var H, ee, ce, j, ie, A, U, B, ne, oe;
|
|
1420
|
+
return [
|
|
1421
|
+
e("div", $s, [
|
|
1422
|
+
((H = t.purchaseOrder) == null ? void 0 : H.status) === l($).enum.DRAFT && n.value === l(ue).PURCHASE ? (y(), X(O, {
|
|
1423
|
+
key: 0,
|
|
1424
|
+
label: l(v)("inventory.transfer.receiveRequest.actions.confirmDraft"),
|
|
1425
|
+
onClick: o[1] || (o[1] = (Y) => M("confirmDraft")),
|
|
1426
|
+
loading: d.value === "confirmDraft",
|
|
1427
|
+
disabled: d.value !== "confirmDraft" && u.value
|
|
1428
|
+
}, null, 8, ["label", "loading", "disabled"])) : N("", !0),
|
|
1429
|
+
((ee = t.purchaseOrder) == null ? void 0 : ee.status) === l($).enum.DRAFT && n.value === l(ue).TRANSFER ? (y(), X(O, {
|
|
1430
|
+
key: 1,
|
|
1431
|
+
label: l(v)("inventory.transfer.receiveRequest.actions.submitRequest"),
|
|
1432
|
+
onClick: o[2] || (o[2] = (Y) => M("submitRequest")),
|
|
1433
|
+
loading: d.value === "submitRequest",
|
|
1434
|
+
disabled: d.value !== "submitRequest" && u.value
|
|
1435
|
+
}, null, 8, ["label", "loading", "disabled"])) : N("", !0),
|
|
1436
|
+
((ce = t.purchaseOrder) == null ? void 0 : ce.status) === l($).enum.DRAFT ? (y(), X(O, {
|
|
1437
|
+
key: 2,
|
|
1438
|
+
label: l(v)("inventory.transfer.receiveRequest.actions.cancelDraft"),
|
|
1439
|
+
onClick: o[3] || (o[3] = (Y) => M("cancelDraft")),
|
|
1440
|
+
loading: d.value === "cancelDraft",
|
|
1441
|
+
disabled: d.value !== "cancelDraft" && u.value,
|
|
1442
|
+
variant: "destructive"
|
|
1443
|
+
}, null, 8, ["label", "loading", "disabled"])) : N("", !0),
|
|
1444
|
+
((j = t.purchaseOrder) == null ? void 0 : j.status) === l($).enum.RECEIVING ? (y(), X(O, {
|
|
1445
|
+
key: 3,
|
|
1446
|
+
label: l(v)("inventory.transfer.receiveRequest.actions.completeReceive"),
|
|
1447
|
+
onClick: o[4] || (o[4] = (Y) => M("completeReceive")),
|
|
1448
|
+
loading: d.value === "completeReceive",
|
|
1449
|
+
disabled: d.value !== "completeReceive" && u.value
|
|
1450
|
+
}, null, 8, ["label", "loading", "disabled"])) : N("", !0),
|
|
1451
|
+
t.canResubmit ? (y(), X(O, {
|
|
1452
|
+
key: 4,
|
|
1453
|
+
label: l(v)("inventory.transfer.receiveRequest.actions.resubmitRequest"),
|
|
1454
|
+
onClick: o[5] || (o[5] = (Y) => M("submitRequest")),
|
|
1455
|
+
loading: d.value === "submitRequest",
|
|
1456
|
+
disabled: d.value !== "submitRequest" && u.value
|
|
1457
|
+
}, null, 8, ["label", "loading", "disabled"])) : N("", !0),
|
|
1458
|
+
(((ie = t.purchaseOrder) == null ? void 0 : ie.status) === l($).enum.REQUESTING || ((A = t.purchaseOrder) == null ? void 0 : A.status) === l($).enum.PROCESSING) && t.canApprove ? (y(), X(O, {
|
|
1459
|
+
key: 5,
|
|
1460
|
+
label: l(v)("inventory.transfer.approval.actions.approveRequest"),
|
|
1461
|
+
onClick: o[6] || (o[6] = (Y) => M("approveRequest")),
|
|
1462
|
+
loading: d.value === "approveRequest",
|
|
1463
|
+
disabled: d.value !== "approveRequest" && u.value
|
|
1464
|
+
}, null, 8, ["label", "loading", "disabled"])) : N("", !0),
|
|
1465
|
+
((U = t.purchaseOrder) == null ? void 0 : U.status) === l($).enum.REQUESTING && t.canApprove ? (y(), X(O, {
|
|
1466
|
+
key: 6,
|
|
1467
|
+
label: l(v)("inventory.transfer.approval.actions.rejectRequest"),
|
|
1468
|
+
onClick: o[7] || (o[7] = (Y) => M("rejectRequest")),
|
|
1469
|
+
loading: d.value === "rejectRequest",
|
|
1470
|
+
disabled: d.value !== "rejectRequest" && u.value,
|
|
1471
|
+
variant: "destructive"
|
|
1472
|
+
}, null, 8, ["label", "loading", "disabled"])) : N("", !0),
|
|
1473
|
+
((B = t.purchaseOrder) == null ? void 0 : B.status) !== l($).enum.COMPLETE && ((ne = t.purchaseOrder) == null ? void 0 : ne.status) !== l($).enum.CANCEL && (((oe = t.purchaseOrder) == null ? void 0 : oe.status) !== l($).enum.REQUESTING || t.canApprove) ? (y(), X(O, {
|
|
1474
|
+
key: 7,
|
|
1475
|
+
label: l(v)("common.close"),
|
|
1476
|
+
variant: "tertiary",
|
|
1477
|
+
onClick: o[8] || (o[8] = (Y) => s("update:show", !1))
|
|
1478
|
+
}, null, 8, ["label"])) : N("", !0)
|
|
1479
|
+
])
|
|
1480
|
+
];
|
|
1481
|
+
}),
|
|
1482
|
+
_: 1
|
|
1483
|
+
}, 8, ["header", "modelValue", "dismiss-away"]);
|
|
1484
|
+
};
|
|
1485
|
+
}
|
|
1486
|
+
});
|
|
1487
|
+
export {
|
|
1488
|
+
we as P,
|
|
1489
|
+
Hs as _,
|
|
1490
|
+
Ks as a,
|
|
1491
|
+
Gs as b,
|
|
1492
|
+
lt as g,
|
|
1493
|
+
ke as u
|
|
1494
|
+
};
|