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