@feedmepos/mf-inventory-portal 0.0.19-dev.14 → 0.0.19-dev.15
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-BY13XuOu.js → ApprovalView-CRHU3Bv0.js} +5 -5
- package/dist/{BindingsDialog-B3PP-XkE.js → BindingsDialog-ChIRg0d3.js} +1 -1
- package/dist/{BindingsPicker-DL17pRty.js → BindingsPicker-BJAbeiDf.js} +1 -1
- package/dist/{BindingsTable-CjKOv7Yw.js → BindingsTable-5MxWD_qa.js} +1 -1
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DoF7wwNT.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D0j4VOis.js} +1 -1
- package/dist/{IngredientsView-C-rsKAsF.js → IngredientsView-qXrDtzSK.js} +4 -4
- package/dist/{IntegrationView-BkhfPSjM.js → IntegrationView-D6yFqod1.js} +2 -2
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Buc21sEN.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DGurlvYg.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BRijSilS.js → PremiumBadge.vue_vue_type_script_setup_true_lang-2Ady4pB4.js} +1 -1
- package/dist/{PurchaseOrderPrintPreview-CGMMozPA.js → PurchaseOrderPrintPreview-BWwjMRqb.js} +1 -1
- package/dist/{ReceiveRequestView-Bk0pUeEm.js → ReceiveRequestView-C94SWDaj.js} +7 -7
- package/dist/{RecipeView-kzA9kIg8.js → RecipeView-CG9H_ZOo.js} +4 -4
- package/dist/{StockView-DF-ucES_.js → StockView-BdXGfDNl.js} +7 -7
- package/dist/{SupplierView-XlzsU00G.js → SupplierView-ClL2oc8K.js} +4 -4
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-Bp7AJiJ-.js → TransferDetails.vue_vue_type_script_setup_true_lang-DktBkwCx.js} +4 -4
- package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-BE95F9r1.js +1437 -0
- package/dist/{TransferTemplateView-CsA2SzQY.js → TransferTemplateView-BXrNS8pg.js} +26 -26
- package/dist/{UnitView-9VMIlEZ_.js → UnitView-Dx2vWJXi.js} +5 -5
- package/dist/{WarehouseView-JTYLFBsu.js → WarehouseView-UkmUZnqH.js} +3 -3
- package/dist/{app-kYGuBDV8.js → app-BLzTa0Ut.js} +4782 -4760
- package/dist/app.js +1 -1
- package/dist/components/FmMultiselectDialogProps.d.ts +3 -1
- package/dist/{decimal-E3w4eGHF.js → decimal-DLYVb_I_.js} +1 -1
- package/dist/format-unit-display-D_Z4TNZd.js +668 -0
- package/dist/{id-to-date-gyR82hWy.js → id-to-date-CKplrnj_.js} +1 -1
- package/dist/{layout-BTYR4n3X.js → layout-B9sdKjL9.js} +1 -1
- package/dist/stores/feature.d.ts +1 -0
- package/dist/stores/location.d.ts +4 -0
- package/dist/{supplier-Ed-Bva_-.js → supplier-BZ6HZcYB.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/views/receive-request/components/select-template-dialog/SelectTemplateDialog.vue.d.ts +8 -0
- package/dist/views/receive-request/components/transfer-dialog/TransferDialogProps.d.ts +1 -1
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +1 -1
- package/dist/{xlsx-q6Ctgevr.js → xlsx-C3AV6UrJ.js} +1 -1
- package/dist/{xlsx.util-Cvqg56mI.js → xlsx.util-slrhXhsk.js} +2 -2
- package/package.json +1 -1
- package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-D1NAkXMT.js +0 -1690
- package/dist/purchase-order-transaction-type-CUtdDhYo.js +0 -299
|
@@ -1,1690 +0,0 @@
|
|
|
1
|
-
import { reactive as Ke, onMounted as We, computed as P, h as O, getCurrentInstance as Le, watch as Ue, defineComponent as re, openBlock as x, createElementBlock as $, Fragment as ge, renderList as Ae, createElementVNode as f, toDisplayString as A, unref as e, resolveComponent as F, createVNode as k, withCtx as V, createCommentVNode as Y, ref as R, createBlock as q, normalizeClass as Re, normalizeStyle as st, isRef as de } from "vue";
|
|
2
|
-
import { useBreakpoints as ot, components as se, FmButtonVariant as Ve, useSnackbar as Te, useDialog as Ye, useProxiedModel as nt } from "@feedmepos/ui-library";
|
|
3
|
-
import { F as ne, D as Ne, R as ve } from "./row-action.enum-PMKMRrZR.js";
|
|
4
|
-
import { P as D, u as rt, f as at, b as Ze } from "./purchase-order-transaction-type-CUtdDhYo.js";
|
|
5
|
-
import { a as z, t as lt, a5 as Oe, D as it, b as Qe, R as qe, a2 as ut, a3 as ct, r as ze, a4 as dt, G as Ge, l as pt, A as we, M as mt, a6 as Je, c as Se, a9 as ft, O as Ee, P as Be, aa as yt, j as Z, ab as vt, u as Me, n as bt, ac as gt, ad as ht, ae as _t, E as Ct, af as kt, y as wt } from "./app-kYGuBDV8.js";
|
|
6
|
-
import { _ as Xe, u as St } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-BRijSilS.js";
|
|
7
|
-
import { useI18n as ae } from "@feedmepos/mf-common";
|
|
8
|
-
import "vue-router";
|
|
9
|
-
import { u as xe } from "./supplier-Ed-Bva_-.js";
|
|
10
|
-
import { F as pe, c as Tt, _ as xt } from "./layout-BTYR4n3X.js";
|
|
11
|
-
import { _ as Pt } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
|
|
12
|
-
import { defineStore as Ft } from "pinia";
|
|
13
|
-
function oe(t, y, o, l) {
|
|
14
|
-
var i, m, u;
|
|
15
|
-
if (l != null && l.manualTotalCost)
|
|
16
|
-
return l == null ? void 0 : l.manualTotalCost;
|
|
17
|
-
const d = (u = (m = (i = l == null ? void 0 : l.supplier) == null ? void 0 : i.supplyItems) == null ? void 0 : m.find(
|
|
18
|
-
(b) => b.skuId === t._id
|
|
19
|
-
)) == null ? void 0 : u.defaultCost, s = t.defaultCost, n = d ?? s, w = n == null ? void 0 : n.costPerUnit, p = w ? n != null && n.measurement ? +z(w) / +z(n == null ? void 0 : n.measurement.conversion) : +z(w) : void 0, a = p ? o ? p * +z(o.conversion) : p : void 0, c = a ? +z(y) * a : void 0;
|
|
20
|
-
return c ? {
|
|
21
|
-
...lt(c ?? 0, 2),
|
|
22
|
-
currency: Oe()
|
|
23
|
-
} : {
|
|
24
|
-
amount: 0,
|
|
25
|
-
precision: 0,
|
|
26
|
-
currency: Oe()
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
var E = /* @__PURE__ */ ((t) => (t.Code = "Code", t.Name = "Name", t.Amount = "Amount", t.Cost = "Cost", t.Delete = "Delete", t))(E || {});
|
|
30
|
-
const Dt = () => {
|
|
31
|
-
const { t } = ae();
|
|
32
|
-
return O(
|
|
33
|
-
Xe,
|
|
34
|
-
{
|
|
35
|
-
zIndex: 50,
|
|
36
|
-
class: "whitespace-nowrap"
|
|
37
|
-
},
|
|
38
|
-
t("inventory.transfer.form.items.table.Cost", [Je()])
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
function It(t) {
|
|
42
|
-
const { t: y } = ae(), o = Ke({}), { breakpoints: l } = ot(), d = Qe();
|
|
43
|
-
We(() => {
|
|
44
|
-
for (const p of t.items) {
|
|
45
|
-
if (!p.totalCost)
|
|
46
|
-
continue;
|
|
47
|
-
const a = oe(p.sku, p.quantity, p.measurement, {
|
|
48
|
-
supplier: t.supplier
|
|
49
|
-
}), c = p.totalCost ?? it.reset();
|
|
50
|
-
a ? o[p.sku._id] = a.amount !== c.amount || a.precision !== c.precision : o[p.sku._id] = !0;
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
function s(p) {
|
|
54
|
-
var c, r, i, m, u, b, C;
|
|
55
|
-
return !!(((r = (c = p.defaultCost) == null ? void 0 : c.costPerUnit) == null ? void 0 : r.amount) ?? ((C = (b = (u = (m = (i = t.supplier) == null ? void 0 : i.supplyItems) == null ? void 0 : m.find((T) => T.skuId === p._id)) == null ? void 0 : u.defaultCost) == null ? void 0 : b.costPerUnit) == null ? void 0 : C.amount));
|
|
56
|
-
}
|
|
57
|
-
const n = [
|
|
58
|
-
{
|
|
59
|
-
id: "Code",
|
|
60
|
-
header: () => y("inventory.transfer.form.items.table.Code"),
|
|
61
|
-
accessorKey: "code",
|
|
62
|
-
size: 96,
|
|
63
|
-
cell(p) {
|
|
64
|
-
const a = p.row.original;
|
|
65
|
-
return O(se.FmTextField, {
|
|
66
|
-
modelValue: a.code,
|
|
67
|
-
"onUpdate:modelValue": (c) => {
|
|
68
|
-
t.updateItem({
|
|
69
|
-
...a,
|
|
70
|
-
code: c
|
|
71
|
-
});
|
|
72
|
-
},
|
|
73
|
-
key: a.sku._id,
|
|
74
|
-
rules: [qe()],
|
|
75
|
-
labelMark: "required"
|
|
76
|
-
});
|
|
77
|
-
},
|
|
78
|
-
enableSorting: !1
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
id: "Name",
|
|
82
|
-
header: () => y("inventory.transfer.form.items.table.Name"),
|
|
83
|
-
minSize: 300,
|
|
84
|
-
cell(p) {
|
|
85
|
-
const a = p.row.original;
|
|
86
|
-
return O(se.FmTextField, {
|
|
87
|
-
modelValue: a.name,
|
|
88
|
-
"onUpdate:modelValue": (c) => {
|
|
89
|
-
t.updateItem({
|
|
90
|
-
...a,
|
|
91
|
-
name: c
|
|
92
|
-
});
|
|
93
|
-
},
|
|
94
|
-
key: a.sku._id,
|
|
95
|
-
rules: [qe()],
|
|
96
|
-
labelMark: "required"
|
|
97
|
-
});
|
|
98
|
-
},
|
|
99
|
-
enableSorting: !1
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
id: "Amount",
|
|
103
|
-
header: () => y("inventory.transfer.form.items.table.Amount"),
|
|
104
|
-
minSize: 200,
|
|
105
|
-
cell(p) {
|
|
106
|
-
var r, i, m;
|
|
107
|
-
const a = p.row.original, c = (m = (i = (r = t.template) == null ? void 0 : r.purchaseOrder) == null ? void 0 : i.items) == null ? void 0 : m.find(
|
|
108
|
-
(u) => u.sku._id === a.sku._id
|
|
109
|
-
);
|
|
110
|
-
return O(ut, {
|
|
111
|
-
style: {
|
|
112
|
-
flex: "1 1 0%"
|
|
113
|
-
},
|
|
114
|
-
modelValue: {
|
|
115
|
-
amount: a.quantity ?? { amount: 1, precision: 0 },
|
|
116
|
-
measurement: a.measurement ?? null
|
|
117
|
-
},
|
|
118
|
-
key: a.sku._id,
|
|
119
|
-
unit: a.sku.unit,
|
|
120
|
-
"onUpdate:modelValue": (u) => {
|
|
121
|
-
const b = {
|
|
122
|
-
...a,
|
|
123
|
-
quantity: u.amount,
|
|
124
|
-
measurement: u.measurement
|
|
125
|
-
};
|
|
126
|
-
d.enableTotalCost && (b.totalCost = oe(a.sku, a.quantity, a.measurement, {
|
|
127
|
-
supplier: t.supplier,
|
|
128
|
-
// NOTE: set undefined here if `manualTotalCost[row.sku._id] = false`, so that the function
|
|
129
|
-
// will return the auto calculated default cost instead of the manual total cost
|
|
130
|
-
manualTotalCost: o[a.sku._id] ? b.totalCost : void 0
|
|
131
|
-
})), t.updateItem(b);
|
|
132
|
-
},
|
|
133
|
-
stepper: c == null ? void 0 : c.quantityStep,
|
|
134
|
-
disableUnit: !!c,
|
|
135
|
-
disabled: t.disabled,
|
|
136
|
-
rules: [
|
|
137
|
-
ct(
|
|
138
|
-
+z(
|
|
139
|
-
(c == null ? void 0 : c.minimumQuantity) ?? {
|
|
140
|
-
amount: 1,
|
|
141
|
-
precision: ze(a.sku.unit, a.measurement)
|
|
142
|
-
}
|
|
143
|
-
)
|
|
144
|
-
),
|
|
145
|
-
dt(
|
|
146
|
-
+z(
|
|
147
|
-
(c == null ? void 0 : c.maximumQuantity) ?? {
|
|
148
|
-
amount: 1,
|
|
149
|
-
precision: ze(a.sku.unit, a.measurement)
|
|
150
|
-
}
|
|
151
|
-
)
|
|
152
|
-
)
|
|
153
|
-
],
|
|
154
|
-
applyDefaultRules: !0
|
|
155
|
-
});
|
|
156
|
-
},
|
|
157
|
-
enableSorting: !1
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
id: "Cost",
|
|
161
|
-
header: Dt,
|
|
162
|
-
size: 180,
|
|
163
|
-
cell(p) {
|
|
164
|
-
const a = p.row.original, c = s(a.sku), r = l.value.xs || l.value.sm;
|
|
165
|
-
return !o[a.sku._id] && c ? O(
|
|
166
|
-
"div",
|
|
167
|
-
{
|
|
168
|
-
class: [
|
|
169
|
-
"flex gap-4 fm-typo-en-body-md-400 items-center",
|
|
170
|
-
t.disabled ? "text-fm-color-typo-disabled" : ""
|
|
171
|
-
],
|
|
172
|
-
key: a.sku._id
|
|
173
|
-
},
|
|
174
|
-
[
|
|
175
|
-
O(se.FmButton, {
|
|
176
|
-
prependIcon: "edit",
|
|
177
|
-
variant: Ve.Tertiary,
|
|
178
|
-
disabled: t.disabled,
|
|
179
|
-
onClick() {
|
|
180
|
-
t.updateItem({
|
|
181
|
-
...a,
|
|
182
|
-
totalCost: oe(a.sku, a.quantity, a.measurement, {
|
|
183
|
-
supplier: t.supplier
|
|
184
|
-
})
|
|
185
|
-
}), o[a.sku._id] = !0;
|
|
186
|
-
}
|
|
187
|
-
}),
|
|
188
|
-
O(
|
|
189
|
-
"div",
|
|
190
|
-
{
|
|
191
|
-
class: "flex flex-col"
|
|
192
|
-
},
|
|
193
|
-
[
|
|
194
|
-
O(
|
|
195
|
-
"span",
|
|
196
|
-
r ? Ge(
|
|
197
|
-
oe(a.sku, a.quantity, a.measurement, {
|
|
198
|
-
supplier: t.supplier
|
|
199
|
-
})
|
|
200
|
-
) : z(
|
|
201
|
-
oe(a.sku, a.quantity, a.measurement, {
|
|
202
|
-
supplier: t.supplier
|
|
203
|
-
})
|
|
204
|
-
)
|
|
205
|
-
),
|
|
206
|
-
O(
|
|
207
|
-
"span",
|
|
208
|
-
{
|
|
209
|
-
class: [
|
|
210
|
-
"fm-typo-en-body-sm-400",
|
|
211
|
-
t.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-neutral-gray-400"
|
|
212
|
-
]
|
|
213
|
-
},
|
|
214
|
-
y("inventory.transfer.form.items.autoCalculated")
|
|
215
|
-
)
|
|
216
|
-
]
|
|
217
|
-
)
|
|
218
|
-
]
|
|
219
|
-
) : O(
|
|
220
|
-
se.FmTextField,
|
|
221
|
-
{
|
|
222
|
-
modelValue: z(a.totalCost ?? { amount: 0, precision: 0 }),
|
|
223
|
-
key: a.sku._id,
|
|
224
|
-
"onUpdate:modelValue": (i) => {
|
|
225
|
-
t.updateItem({
|
|
226
|
-
...a,
|
|
227
|
-
totalCost: {
|
|
228
|
-
...pt(+i),
|
|
229
|
-
currency: Oe()
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
},
|
|
233
|
-
rules: [we(0), mt(2)]
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
prepend() {
|
|
237
|
-
return r ? O(
|
|
238
|
-
"div",
|
|
239
|
-
{
|
|
240
|
-
class: [
|
|
241
|
-
"text-fm-typo-en-body-lg-400",
|
|
242
|
-
t.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
|
|
243
|
-
]
|
|
244
|
-
},
|
|
245
|
-
Je()
|
|
246
|
-
) : null;
|
|
247
|
-
},
|
|
248
|
-
append() {
|
|
249
|
-
return c ? O(se.FmButton, {
|
|
250
|
-
prependIcon: "close",
|
|
251
|
-
variant: "tertiary",
|
|
252
|
-
disabled: t.disabled,
|
|
253
|
-
onClick() {
|
|
254
|
-
t.updateItem({
|
|
255
|
-
...a,
|
|
256
|
-
// NOTE: different from PO template, if a default cost is reenabled,
|
|
257
|
-
// the total cost will automatically assigned
|
|
258
|
-
totalCost: oe(a.sku, a.quantity, a.measurement, {
|
|
259
|
-
supplier: t.supplier
|
|
260
|
-
})
|
|
261
|
-
}), o[a.sku._id] = !1;
|
|
262
|
-
}
|
|
263
|
-
}) : null;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
);
|
|
267
|
-
},
|
|
268
|
-
enableSorting: !1
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
id: "Delete",
|
|
272
|
-
header: "",
|
|
273
|
-
cell(p) {
|
|
274
|
-
const a = p.row.original;
|
|
275
|
-
return O(se.FmButton, {
|
|
276
|
-
key: a.sku._id,
|
|
277
|
-
class: "delete-button",
|
|
278
|
-
type: "button",
|
|
279
|
-
icon: "delete",
|
|
280
|
-
variant: "tertiary",
|
|
281
|
-
size: "md",
|
|
282
|
-
disabled: t.disabled,
|
|
283
|
-
onClick: () => {
|
|
284
|
-
t.deleteItem(a);
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
},
|
|
288
|
-
enableSorting: !1,
|
|
289
|
-
size: 40,
|
|
290
|
-
meta: {
|
|
291
|
-
cellClass: "",
|
|
292
|
-
headerClass: ""
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
];
|
|
296
|
-
return {
|
|
297
|
-
columnDefs: P(() => d.enableTotalCost && t.transferType === D.PURCHASE ? n : n.filter(
|
|
298
|
-
(p) => p.id !== "Cost"
|
|
299
|
-
/* Cost */
|
|
300
|
-
))
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
function $t(t = "modelValue") {
|
|
304
|
-
var s, n;
|
|
305
|
-
const y = ((s = Le()) == null ? void 0 : s.props) ?? {}, o = ((n = Le()) == null ? void 0 : n.emit) ?? (() => {
|
|
306
|
-
}), l = Ke(Se(y[t] ?? {})), d = `update:${ft(t)}`;
|
|
307
|
-
return Ue(l, (w) => {
|
|
308
|
-
o(d, w);
|
|
309
|
-
}), l;
|
|
310
|
-
}
|
|
311
|
-
const At = { class: "flex flex-col gap-8 px-16 xs:px-4 sm:px-4 py-4 items-center" }, Rt = { class: "fm-typo-en-body-lg-600 xs:fm-typo-en-body-md-600 mr-auto xs:w-full" }, Vt = { class: "w-[450px] xs:w-full flex" }, Ot = { class: "fm-typo-en-body-md-400 whitespace-nowrap" }, Bt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, et = /* @__PURE__ */ re({
|
|
312
|
-
__name: "SupplierPriceHistory",
|
|
313
|
-
props: {
|
|
314
|
-
prices: {}
|
|
315
|
-
},
|
|
316
|
-
setup(t) {
|
|
317
|
-
const y = xe();
|
|
318
|
-
function o(l) {
|
|
319
|
-
return y.suppliers.find((d) => d._id === l);
|
|
320
|
-
}
|
|
321
|
-
return (l, d) => (x(), $("div", At, [
|
|
322
|
-
(x(!0), $(ge, null, Ae(Object.keys(l.prices), (s) => {
|
|
323
|
-
var n;
|
|
324
|
-
return x(), $("div", {
|
|
325
|
-
key: s,
|
|
326
|
-
class: "flex items-center gap-12 xs:gap-4 xs:flex-wrap w-full"
|
|
327
|
-
}, [
|
|
328
|
-
f("div", Rt, A((n = o(s)) == null ? void 0 : n.name), 1),
|
|
329
|
-
f("div", Vt, [
|
|
330
|
-
(x(!0), $(ge, null, Ae(l.prices[s].slice(0, 3), (w) => {
|
|
331
|
-
var p;
|
|
332
|
-
return x(), $("div", {
|
|
333
|
-
key: w.date,
|
|
334
|
-
class: "flex flex-col w-[150px] xs:flex-1 text-ellipsis cursor-pointer"
|
|
335
|
-
}, [
|
|
336
|
-
f("div", Ot, [
|
|
337
|
-
f("span", null, A(w.totalCost ? e(Ge)(w.totalCost) : "No data"), 1),
|
|
338
|
-
d[0] || (d[0] = f("span", { class: "text-fm-color-typo-secondary" }, "/", -1)),
|
|
339
|
-
f("span", null, A(e(z)(w.totalUnit, !1)), 1),
|
|
340
|
-
f("span", null, A(((p = w.measurement) == null ? void 0 : p.abbrev) ?? w.unit.abbrev), 1)
|
|
341
|
-
]),
|
|
342
|
-
f("div", Bt, [
|
|
343
|
-
f("span", null, "(#" + A(w.seqNumber) + ")", 1),
|
|
344
|
-
d[1] || (d[1] = f("span", null, A(" "), -1)),
|
|
345
|
-
f("span", null, A(e(Ee)(new Date(w.date))), 1)
|
|
346
|
-
])
|
|
347
|
-
]);
|
|
348
|
-
}), 128))
|
|
349
|
-
])
|
|
350
|
-
]);
|
|
351
|
-
}), 128))
|
|
352
|
-
]));
|
|
353
|
-
}
|
|
354
|
-
}), Ut = { class: "flex flex-col gap-8 py-16" }, Et = { class: "flex items-center" }, Mt = { class: "flex-1 flex gap-1 items-center" }, Lt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Nt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, qt = { class: "flex gap-8 w-full" }, zt = { class: "flex-1 flex flex-col gap-4" }, Ht = { class: "flex-1 flex flex-col gap-4" }, jt = { class: "flex gap-8 w-full" }, Kt = { class: "flex-1 flex flex-col gap-4" }, Wt = { class: "flex-1 flex flex-col gap-4" }, Yt = /* @__PURE__ */ re({
|
|
355
|
-
__name: "TransferItem",
|
|
356
|
-
props: {
|
|
357
|
-
cellByColId: {},
|
|
358
|
-
comparePriceBySku: {},
|
|
359
|
-
showComparePrice: { type: Boolean },
|
|
360
|
-
row: {}
|
|
361
|
-
},
|
|
362
|
-
setup(t) {
|
|
363
|
-
const { t: y } = ae();
|
|
364
|
-
return (o, l) => {
|
|
365
|
-
var n, w, p, a, c, r, i, m, u, b, C, T, Q, M, X, B, H, G, L, N, J, h, _, U, le, j, Pe;
|
|
366
|
-
const d = F("FmLabel"), s = F("FmSpacer");
|
|
367
|
-
return x(), $("div", Ut, [
|
|
368
|
-
f("div", Et, [
|
|
369
|
-
f("div", Mt, [
|
|
370
|
-
f("span", Lt, " (" + A(o.row.original.sku.code) + ") ", 1),
|
|
371
|
-
f("span", Nt, A(o.row.original.sku.name), 1)
|
|
372
|
-
]),
|
|
373
|
-
f("div", null, [
|
|
374
|
-
k(e(pe), {
|
|
375
|
-
render: (p = (w = (n = o.cellByColId.Delete) == null ? void 0 : n.column) == null ? void 0 : w.columnDef) == null ? void 0 : p.cell,
|
|
376
|
-
props: (c = (a = o.cellByColId.Delete) == null ? void 0 : a.getContext) == null ? void 0 : c.call(a)
|
|
377
|
-
}, null, 8, ["render", "props"])
|
|
378
|
-
])
|
|
379
|
-
]),
|
|
380
|
-
f("div", qt, [
|
|
381
|
-
f("div", zt, [
|
|
382
|
-
k(d, {
|
|
383
|
-
label: e(y)(`inventory.transfer.form.items.table.${e(E).Code}`)
|
|
384
|
-
}, null, 8, ["label"]),
|
|
385
|
-
k(e(pe), {
|
|
386
|
-
render: (m = (i = (r = o.cellByColId[e(E).Code]) == null ? void 0 : r.column) == null ? void 0 : i.columnDef) == null ? void 0 : m.cell,
|
|
387
|
-
props: (b = (u = o.cellByColId[e(E).Code]) == null ? void 0 : u.getContext) == null ? void 0 : b.call(u)
|
|
388
|
-
}, null, 8, ["render", "props"]),
|
|
389
|
-
l[0] || (l[0] = f("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
390
|
-
]),
|
|
391
|
-
f("div", Ht, [
|
|
392
|
-
k(d, {
|
|
393
|
-
label: e(y)(`inventory.transfer.form.items.table.${e(E).Name}`)
|
|
394
|
-
}, null, 8, ["label"]),
|
|
395
|
-
k(e(pe), {
|
|
396
|
-
render: (Q = (T = (C = o.cellByColId[e(E).Name]) == null ? void 0 : C.column) == null ? void 0 : T.columnDef) == null ? void 0 : Q.cell,
|
|
397
|
-
props: (X = (M = o.cellByColId[e(E).Name]) == null ? void 0 : M.getContext) == null ? void 0 : X.call(M)
|
|
398
|
-
}, null, 8, ["render", "props"]),
|
|
399
|
-
l[1] || (l[1] = f("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
400
|
-
])
|
|
401
|
-
]),
|
|
402
|
-
f("div", jt, [
|
|
403
|
-
f("div", Kt, [
|
|
404
|
-
k(d, {
|
|
405
|
-
label: e(y)(`inventory.transfer.form.items.table.${e(E).Amount}`)
|
|
406
|
-
}, null, 8, ["label"]),
|
|
407
|
-
k(e(pe), {
|
|
408
|
-
render: (G = (H = (B = o.cellByColId[e(E).Amount]) == null ? void 0 : B.column) == null ? void 0 : H.columnDef) == null ? void 0 : G.cell,
|
|
409
|
-
props: (N = (L = o.cellByColId[e(E).Amount]) == null ? void 0 : L.getContext) == null ? void 0 : N.call(L)
|
|
410
|
-
}, null, 8, ["render", "props"]),
|
|
411
|
-
l[2] || (l[2] = f("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
412
|
-
]),
|
|
413
|
-
f("div", Wt, [
|
|
414
|
-
k(Xe, { "z-index": 50 }, {
|
|
415
|
-
default: V(() => [
|
|
416
|
-
k(d, {
|
|
417
|
-
label: e(y)(`inventory.transfer.form.items.table.${e(E).Cost}2`)
|
|
418
|
-
}, null, 8, ["label"])
|
|
419
|
-
]),
|
|
420
|
-
_: 1
|
|
421
|
-
}),
|
|
422
|
-
k(e(pe), {
|
|
423
|
-
render: (_ = (h = (J = o.cellByColId[e(E).Cost]) == null ? void 0 : J.column) == null ? void 0 : h.columnDef) == null ? void 0 : _.cell,
|
|
424
|
-
props: (le = (U = o.cellByColId[e(E).Cost]) == null ? void 0 : U.getContext) == null ? void 0 : le.call(U)
|
|
425
|
-
}, null, 8, ["render", "props"]),
|
|
426
|
-
l[3] || (l[3] = f("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
427
|
-
])
|
|
428
|
-
]),
|
|
429
|
-
o.showComparePrice && Object.keys(o.comparePriceBySku[(j = o.row.original.sku) == null ? void 0 : j._id] ?? {}).length > 0 ? (x(), $(ge, { key: 0 }, [
|
|
430
|
-
k(s, { class: "h-8" }),
|
|
431
|
-
k(et, {
|
|
432
|
-
prices: o.comparePriceBySku[(Pe = o.row.original.sku) == null ? void 0 : Pe._id]
|
|
433
|
-
}, null, 8, ["prices"])
|
|
434
|
-
], 64)) : Y("", !0)
|
|
435
|
-
]);
|
|
436
|
-
};
|
|
437
|
-
}
|
|
438
|
-
});
|
|
439
|
-
function be(t) {
|
|
440
|
-
return yt.parse(t);
|
|
441
|
-
}
|
|
442
|
-
function ke(t) {
|
|
443
|
-
return {
|
|
444
|
-
_id: t.doc._id,
|
|
445
|
-
internal: t.type,
|
|
446
|
-
contactName: t.doc.profile.name,
|
|
447
|
-
name: t.doc.profile.name,
|
|
448
|
-
email: t.doc.profile.email,
|
|
449
|
-
phoneNumber: t.doc.profile.phoneNo,
|
|
450
|
-
registrationNumber: t.doc.profile.regNo,
|
|
451
|
-
address: t.doc.profile.address
|
|
452
|
-
};
|
|
453
|
-
}
|
|
454
|
-
function Zt(t, y) {
|
|
455
|
-
const o = xe(), l = Z();
|
|
456
|
-
l.watchLocation(async () => {
|
|
457
|
-
await o.readSuppliers();
|
|
458
|
-
const r = t();
|
|
459
|
-
if (r.supplier._id) return;
|
|
460
|
-
const i = o.suppliers[0], m = l.locations[0];
|
|
461
|
-
y({
|
|
462
|
-
...r,
|
|
463
|
-
supplier: i ? be(i) : m ? ke(m) : r.supplier
|
|
464
|
-
});
|
|
465
|
-
});
|
|
466
|
-
const d = P(
|
|
467
|
-
() => {
|
|
468
|
-
var r, i;
|
|
469
|
-
return typeof ((i = (r = t()) == null ? void 0 : r.supplier) == null ? void 0 : i.internal) == "string" ? D.TRANSFER : D.PURCHASE;
|
|
470
|
-
}
|
|
471
|
-
), s = P({
|
|
472
|
-
get() {
|
|
473
|
-
var r, i;
|
|
474
|
-
return (i = (r = t()) == null ? void 0 : r.supplier) == null ? void 0 : i._id;
|
|
475
|
-
},
|
|
476
|
-
set(r) {
|
|
477
|
-
const i = t() ?? {};
|
|
478
|
-
if (d.value === D.PURCHASE) {
|
|
479
|
-
const b = o.suppliers.find((C) => C._id === r);
|
|
480
|
-
y({
|
|
481
|
-
...i,
|
|
482
|
-
supplier: b ? be(b) : i.supplier
|
|
483
|
-
});
|
|
484
|
-
return;
|
|
485
|
-
}
|
|
486
|
-
const u = l.locations.find((b) => b.doc._id === r);
|
|
487
|
-
y({
|
|
488
|
-
...i,
|
|
489
|
-
supplier: u ? ke(u) : i.supplier
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
}), n = P(() => o.locationSuppliers.map(be)), w = P(() => o.businessSuppliers.map(be)), p = P(() => {
|
|
493
|
-
var i;
|
|
494
|
-
const r = ((i = l._currentLocation) == null ? void 0 : i.type) === Be.warehouse;
|
|
495
|
-
return l.locations.filter((m) => {
|
|
496
|
-
var b;
|
|
497
|
-
return !(m.dbName === ((b = l._currentLocation) == null ? void 0 : b.dbName)) && (!r || m.type === Be.warehouse) && m.acceptRequest;
|
|
498
|
-
}).map(ke);
|
|
499
|
-
}), a = P(() => {
|
|
500
|
-
if (d.value === D.PURCHASE) {
|
|
501
|
-
const i = n.value.map((u) => ({
|
|
502
|
-
label: u.name,
|
|
503
|
-
value: u._id
|
|
504
|
-
})), m = w.value.map((u) => ({
|
|
505
|
-
label: u.name,
|
|
506
|
-
sublabel: "Business supplier",
|
|
507
|
-
value: u._id
|
|
508
|
-
}));
|
|
509
|
-
return [...i, ...m];
|
|
510
|
-
}
|
|
511
|
-
return p.value.map((i) => ({
|
|
512
|
-
label: i.name,
|
|
513
|
-
sublabel: i.internal ? `${i.internal}` : void 0,
|
|
514
|
-
value: i._id
|
|
515
|
-
}));
|
|
516
|
-
}), c = P(() => {
|
|
517
|
-
var u, b;
|
|
518
|
-
const r = (b = (u = t()) == null ? void 0 : u.supplier) == null ? void 0 : b._id;
|
|
519
|
-
if (d.value === D.PURCHASE) {
|
|
520
|
-
const C = o.suppliers.find((T) => T._id === r);
|
|
521
|
-
return C ? be(C) : null;
|
|
522
|
-
}
|
|
523
|
-
const m = l.locations.find((C) => C.doc._id);
|
|
524
|
-
return m ? ke(m) : null;
|
|
525
|
-
});
|
|
526
|
-
return {
|
|
527
|
-
transferLocationModel: s,
|
|
528
|
-
transferLocationOptions: a,
|
|
529
|
-
locationOptionsTypePurchase: n,
|
|
530
|
-
locationOptionsTypeTransfer: p,
|
|
531
|
-
selectedLocation: c
|
|
532
|
-
};
|
|
533
|
-
}
|
|
534
|
-
function Qt(t) {
|
|
535
|
-
const y = P({
|
|
536
|
-
get() {
|
|
537
|
-
const s = t.getEffectiveAt();
|
|
538
|
-
return s ? new Date(s) : null;
|
|
539
|
-
},
|
|
540
|
-
set(s) {
|
|
541
|
-
t.setEffectiveAt((s == null ? void 0 : s.toISOString()) ?? null);
|
|
542
|
-
}
|
|
543
|
-
}), o = P({
|
|
544
|
-
get() {
|
|
545
|
-
return !!y.value;
|
|
546
|
-
},
|
|
547
|
-
set(s) {
|
|
548
|
-
s ? y.value = /* @__PURE__ */ new Date() : y.value = null;
|
|
549
|
-
}
|
|
550
|
-
}), l = P({
|
|
551
|
-
get() {
|
|
552
|
-
return y.value === null ? "" : Ee(y.value);
|
|
553
|
-
},
|
|
554
|
-
set(s) {
|
|
555
|
-
s ? y.value = /* @__PURE__ */ new Date(`${s} ${d.value}`) : y.value = null;
|
|
556
|
-
}
|
|
557
|
-
}), d = P({
|
|
558
|
-
get() {
|
|
559
|
-
return y.value === null ? "" : vt(y.value);
|
|
560
|
-
},
|
|
561
|
-
set(s) {
|
|
562
|
-
s ? y.value = /* @__PURE__ */ new Date(`${l.value} ${s}`) : y.value = null;
|
|
563
|
-
}
|
|
564
|
-
});
|
|
565
|
-
return {
|
|
566
|
-
backdatePo: y,
|
|
567
|
-
backdateSwitch: o,
|
|
568
|
-
backdateModel: l,
|
|
569
|
-
backdateTimeModel: d
|
|
570
|
-
};
|
|
571
|
-
}
|
|
572
|
-
const Gt = {
|
|
573
|
-
width: "24",
|
|
574
|
-
height: "24",
|
|
575
|
-
viewBox: "0 0 24 24",
|
|
576
|
-
fill: "none",
|
|
577
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
578
|
-
}, Jt = ["fill"], Xt = ["fill"], es = ["stroke"], ts = ["stroke"], ss = /* @__PURE__ */ re({
|
|
579
|
-
__name: "SparkIcon",
|
|
580
|
-
props: {
|
|
581
|
-
size: {
|
|
582
|
-
type: Number,
|
|
583
|
-
default: 24
|
|
584
|
-
},
|
|
585
|
-
color: {
|
|
586
|
-
type: String,
|
|
587
|
-
default: "#c7c7cc"
|
|
588
|
-
}
|
|
589
|
-
},
|
|
590
|
-
setup(t) {
|
|
591
|
-
return (y, o) => (x(), $("svg", Gt, [
|
|
592
|
-
f("path", {
|
|
593
|
-
d: "M7.6 7.6C8.17076 6.94229 8.5 5.5 8.5 5.5C8.5 5.5 8.81356 6.87361 9.35714 7.5C9.92948 8.15953 11.5 8.5 11.5 8.5C11.5 8.5 9.92948 8.69761 9.35714 9.35714C8.81356 9.98354 8.5 11.5 8.5 11.5C8.5 11.5 8.32076 10.1888 7.75 9.59091C7.14905 8.96136 5.5 8.5 5.5 8.5C5.5 8.5 6.99905 8.29251 7.6 7.6Z",
|
|
594
|
-
fill: t.color
|
|
595
|
-
}, null, 8, Jt),
|
|
596
|
-
f("path", {
|
|
597
|
-
d: "M12.2 12.2C13.3415 10.8846 14 8 14 8C14 8 14.6271 10.7472 15.7143 12C16.859 13.3191 20 14 20 14C20 14 16.859 14.3952 15.7143 15.7143C14.6271 16.9671 14 20 14 20C14 20 13.6415 17.3777 12.5 16.1818C11.2981 14.9227 8 14 8 14C8 14 10.9981 13.585 12.2 12.2Z",
|
|
598
|
-
fill: t.color
|
|
599
|
-
}, null, 8, Xt),
|
|
600
|
-
f("path", {
|
|
601
|
-
d: "M7.6 7.6C8.17076 6.94229 8.5 5.5 8.5 5.5C8.5 5.5 8.81356 6.87361 9.35714 7.5C9.92948 8.15953 11.5 8.5 11.5 8.5C11.5 8.5 9.92948 8.69761 9.35714 9.35714C8.81356 9.98354 8.5 11.5 8.5 11.5C8.5 11.5 8.32076 10.1888 7.75 9.59091C7.14905 8.96136 5.5 8.5 5.5 8.5C5.5 8.5 6.99905 8.29251 7.6 7.6Z",
|
|
602
|
-
stroke: t.color,
|
|
603
|
-
"stroke-width": "1.5",
|
|
604
|
-
"stroke-linecap": "round",
|
|
605
|
-
"stroke-linejoin": "round"
|
|
606
|
-
}, null, 8, es),
|
|
607
|
-
f("path", {
|
|
608
|
-
d: "M12.2 12.2C13.3415 10.8846 14 8 14 8C14 8 14.6271 10.7472 15.7143 12C16.859 13.3191 20 14 20 14C20 14 16.859 14.3952 15.7143 15.7143C14.6271 16.9671 14 20 14 20C14 20 13.6415 17.3777 12.5 16.1818C11.2981 14.9227 8 14 8 14C8 14 10.9981 13.585 12.2 12.2Z",
|
|
609
|
-
stroke: t.color,
|
|
610
|
-
"stroke-width": "1.5",
|
|
611
|
-
"stroke-linecap": "round",
|
|
612
|
-
"stroke-linejoin": "round"
|
|
613
|
-
}, null, 8, ts)
|
|
614
|
-
]));
|
|
615
|
-
}
|
|
616
|
-
}), os = { class: "flex gap-8 items-center" }, ns = { class: "fm-typo-en-body-lg-600 line-clamp-1" }, rs = { class: "w-[343px] px-24 py-16 rounded-lg shadow-light-300 flex flex-col gap-[20px]" }, as = { class: "flex items-center w-full" }, ls = { class: "flex-1" }, is = { class: "fm-typo-en-title-sm-800" }, us = { class: "flex items-start gap-8" }, cs = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ds = { class: "flex gap-1" }, He = /* @__PURE__ */ re({
|
|
617
|
-
__name: "ForecastStock",
|
|
618
|
-
props: {
|
|
619
|
-
disabled: { type: Boolean }
|
|
620
|
-
},
|
|
621
|
-
emits: ["update:poItems"],
|
|
622
|
-
setup(t, { emit: y }) {
|
|
623
|
-
const o = y, l = R(!1), d = R(7), s = St(), n = Te(), w = Me(), { t: p } = ae();
|
|
624
|
-
async function a() {
|
|
625
|
-
if (d.value < 1)
|
|
626
|
-
return;
|
|
627
|
-
l.value = !1, await s.readPurchaseOrder(d.value);
|
|
628
|
-
const c = [];
|
|
629
|
-
if (s.purchaseOrderForecast.skus.length <= 0) {
|
|
630
|
-
n.open({
|
|
631
|
-
message: p("inventory.transfer.form.items.forecastStock.notAvailable"),
|
|
632
|
-
type: "info"
|
|
633
|
-
});
|
|
634
|
-
return;
|
|
635
|
-
}
|
|
636
|
-
const r = s.purchaseOrderForecast.skus.reduce((i, m) => {
|
|
637
|
-
const u = w.skus.find((T) => T._id === m.id);
|
|
638
|
-
if (i.find((T) => T.sku._id === m.id) || !u)
|
|
639
|
-
return i;
|
|
640
|
-
const C = {
|
|
641
|
-
sku: u,
|
|
642
|
-
code: u.code,
|
|
643
|
-
name: u.name,
|
|
644
|
-
quantity: {
|
|
645
|
-
amount: m.amount,
|
|
646
|
-
precision: 0
|
|
647
|
-
}
|
|
648
|
-
};
|
|
649
|
-
return i.push(C), i;
|
|
650
|
-
}, c);
|
|
651
|
-
o("update:poItems", r);
|
|
652
|
-
}
|
|
653
|
-
return (c, r) => {
|
|
654
|
-
const i = F("FmButton"), m = F("FmIcon"), u = F("FmStepperField"), b = F("FmPopover");
|
|
655
|
-
return x(), q(b, {
|
|
656
|
-
disabled: c.disabled,
|
|
657
|
-
class: "flex",
|
|
658
|
-
"show-popover": l.value,
|
|
659
|
-
onPopoverChanged: r[3] || (r[3] = (C) => l.value = C)
|
|
660
|
-
}, {
|
|
661
|
-
"popover-button": V(() => [
|
|
662
|
-
k(i, {
|
|
663
|
-
label: "unused",
|
|
664
|
-
variant: "secondary",
|
|
665
|
-
"text-color": c.disabled ? "disabled" : "primary",
|
|
666
|
-
"bg-color": "transparent",
|
|
667
|
-
"border-color": c.disabled ? "disabled" : "primary",
|
|
668
|
-
disabled: c.disabled
|
|
669
|
-
}, {
|
|
670
|
-
default: V(() => [
|
|
671
|
-
f("div", os, [
|
|
672
|
-
k(ss, {
|
|
673
|
-
size: 24,
|
|
674
|
-
color: c.disabled ? "#c7c7cc" : "#ff7823"
|
|
675
|
-
}, null, 8, ["color"]),
|
|
676
|
-
f("div", ns, A(e(p)("inventory.transfer.form.items.forecastStock.title")), 1)
|
|
677
|
-
])
|
|
678
|
-
]),
|
|
679
|
-
_: 1
|
|
680
|
-
}, 8, ["text-color", "border-color", "disabled"])
|
|
681
|
-
]),
|
|
682
|
-
default: V(() => [
|
|
683
|
-
f("div", rs, [
|
|
684
|
-
f("div", as, [
|
|
685
|
-
f("div", ls, [
|
|
686
|
-
k(Pt, { "z-index": 99 }, {
|
|
687
|
-
default: V(() => [
|
|
688
|
-
f("p", is, A(e(p)("inventory.transfer.form.items.forecastStock.title")), 1)
|
|
689
|
-
]),
|
|
690
|
-
_: 1
|
|
691
|
-
})
|
|
692
|
-
]),
|
|
693
|
-
k(i, {
|
|
694
|
-
icon: "close",
|
|
695
|
-
size: "md",
|
|
696
|
-
variant: "tertiary",
|
|
697
|
-
onClick: r[0] || (r[0] = (C) => l.value = !1)
|
|
698
|
-
})
|
|
699
|
-
]),
|
|
700
|
-
k(u, {
|
|
701
|
-
modelValue: d.value,
|
|
702
|
-
"onUpdate:modelValue": r[1] || (r[1] = (C) => d.value = C),
|
|
703
|
-
label: e(p)("inventory.transfer.form.items.forecastStock.days"),
|
|
704
|
-
rules: [e(we)(1)]
|
|
705
|
-
}, {
|
|
706
|
-
"helper-text": V(() => [
|
|
707
|
-
f("div", us, [
|
|
708
|
-
k(m, {
|
|
709
|
-
name: "warning",
|
|
710
|
-
size: "sm",
|
|
711
|
-
class: "text-fm-color-system-warning-300"
|
|
712
|
-
}),
|
|
713
|
-
f("div", cs, A(e(p)("inventory.transfer.form.items.forecastStock.replace")), 1)
|
|
714
|
-
])
|
|
715
|
-
]),
|
|
716
|
-
_: 1
|
|
717
|
-
}, 8, ["modelValue", "label", "rules"]),
|
|
718
|
-
f("div", ds, [
|
|
719
|
-
r[4] || (r[4] = f("div", { class: "grow" }, null, -1)),
|
|
720
|
-
k(i, {
|
|
721
|
-
label: e(p)("common.cancel"),
|
|
722
|
-
variant: "tertiary",
|
|
723
|
-
onClick: r[2] || (r[2] = (C) => l.value = !1)
|
|
724
|
-
}, null, 8, ["label"]),
|
|
725
|
-
k(i, {
|
|
726
|
-
label: e(p)("inventory.transfer.form.items.forecastStock.generate"),
|
|
727
|
-
onClick: a
|
|
728
|
-
}, null, 8, ["label"])
|
|
729
|
-
])
|
|
730
|
-
])
|
|
731
|
-
]),
|
|
732
|
-
_: 1
|
|
733
|
-
}, 8, ["disabled", "show-popover"]);
|
|
734
|
-
};
|
|
735
|
-
}
|
|
736
|
-
}), tt = bt((t, y) => ({
|
|
737
|
-
async getTemplate(o) {
|
|
738
|
-
const l = Z(), d = `${t.inventoryBackendUrl}/${l.currentLocationDBName}/purchase-order-template/${o}`;
|
|
739
|
-
return y.get(d);
|
|
740
|
-
},
|
|
741
|
-
async readTemplates() {
|
|
742
|
-
const o = Z(), l = `${t.inventoryBackendUrl}/${o.currentLocationDBName}/purchase-order-template`;
|
|
743
|
-
return y.get(l);
|
|
744
|
-
},
|
|
745
|
-
async createTemplate(o) {
|
|
746
|
-
const l = Z(), d = `${t.inventoryBackendUrl}/${l.currentLocationDBName}/purchase-order-template`;
|
|
747
|
-
return y.post(d, o);
|
|
748
|
-
},
|
|
749
|
-
async updateTemplate(o) {
|
|
750
|
-
const l = Z(), d = `${t.inventoryBackendUrl}/${l.currentLocationDBName}/purchase-order-template`;
|
|
751
|
-
return y.put(d, o);
|
|
752
|
-
},
|
|
753
|
-
async deleteTemplate(o) {
|
|
754
|
-
const l = Z(), d = `${t.inventoryBackendUrl}/${l.currentLocationDBName}/purchase-order-template`;
|
|
755
|
-
return y.delete(d, { _id: o._id, _rev: o._rev });
|
|
756
|
-
}
|
|
757
|
-
})), ps = Ft("transferTemplateActions", () => {
|
|
758
|
-
const t = rt("receive/request"), y = Ye(), o = Te(), l = tt(), d = R({});
|
|
759
|
-
function s() {
|
|
760
|
-
d.value = {
|
|
761
|
-
mode: ne.CREATE,
|
|
762
|
-
show: !0,
|
|
763
|
-
"onUpdate:show"(r) {
|
|
764
|
-
d.value.show = r;
|
|
765
|
-
}
|
|
766
|
-
};
|
|
767
|
-
}
|
|
768
|
-
function n(r) {
|
|
769
|
-
d.value = {
|
|
770
|
-
mode: ne.UPDATE,
|
|
771
|
-
modelValue: r,
|
|
772
|
-
show: !0,
|
|
773
|
-
"onUpdate:show"(i) {
|
|
774
|
-
d.value.show = i;
|
|
775
|
-
}
|
|
776
|
-
};
|
|
777
|
-
}
|
|
778
|
-
function w(r, i, m) {
|
|
779
|
-
y.open({
|
|
780
|
-
title: `Confirm deleting template ${r.name}?`,
|
|
781
|
-
message: "Deleted template can no longer be retrieved",
|
|
782
|
-
primaryActions: {
|
|
783
|
-
text: "Delete",
|
|
784
|
-
variant: Ve.Destructive,
|
|
785
|
-
close: !0
|
|
786
|
-
},
|
|
787
|
-
secondaryActions: {
|
|
788
|
-
text: "Cancel",
|
|
789
|
-
variant: Ve.Plain,
|
|
790
|
-
close: !0
|
|
791
|
-
}
|
|
792
|
-
}).onPrimary(async () => {
|
|
793
|
-
o.open({
|
|
794
|
-
title: `Deleting ${r.name}`,
|
|
795
|
-
type: "info"
|
|
796
|
-
});
|
|
797
|
-
try {
|
|
798
|
-
i.value = !0;
|
|
799
|
-
const [u] = await Promise.allSettled([
|
|
800
|
-
l.deleteTemplate(r),
|
|
801
|
-
new Promise((b) => setTimeout(b, 1e3))
|
|
802
|
-
]);
|
|
803
|
-
if (u.status === "rejected") throw u.reason;
|
|
804
|
-
o.open({
|
|
805
|
-
title: `Deleted ${r.name}`,
|
|
806
|
-
type: "success"
|
|
807
|
-
});
|
|
808
|
-
} catch (u) {
|
|
809
|
-
o.open({
|
|
810
|
-
title: `Unable to delete ${r.name}`,
|
|
811
|
-
message: `See error from server: ${u}`,
|
|
812
|
-
type: "error"
|
|
813
|
-
}), console.error("error on deleting purchase order template", u);
|
|
814
|
-
} finally {
|
|
815
|
-
i.value = !1, m();
|
|
816
|
-
}
|
|
817
|
-
});
|
|
818
|
-
}
|
|
819
|
-
const p = R({});
|
|
820
|
-
function a(r) {
|
|
821
|
-
p.value = {
|
|
822
|
-
template: r,
|
|
823
|
-
show: !0,
|
|
824
|
-
"onUpdate:show"(i) {
|
|
825
|
-
p.value.show = i;
|
|
826
|
-
},
|
|
827
|
-
"onAction:edit"() {
|
|
828
|
-
p.value.show = !1, n(Se(r));
|
|
829
|
-
},
|
|
830
|
-
"onAction:use"() {
|
|
831
|
-
p.value.show = !1, c(Se(r));
|
|
832
|
-
}
|
|
833
|
-
};
|
|
834
|
-
}
|
|
835
|
-
function c(r) {
|
|
836
|
-
t.promptCreateTransferDialog({
|
|
837
|
-
...r.purchaseOrder,
|
|
838
|
-
template: r._id
|
|
839
|
-
});
|
|
840
|
-
}
|
|
841
|
-
return {
|
|
842
|
-
createTemplate: s,
|
|
843
|
-
viewTemplate: a,
|
|
844
|
-
updateTemplate: n,
|
|
845
|
-
deleteTemplate: w,
|
|
846
|
-
useTemplate: c,
|
|
847
|
-
templateDialogProps: d,
|
|
848
|
-
templateDetailsProps: p,
|
|
849
|
-
transferFormDialogProps: t.transferDialogProps
|
|
850
|
-
};
|
|
851
|
-
});
|
|
852
|
-
function $e(t) {
|
|
853
|
-
var o;
|
|
854
|
-
return ((o = t == null ? void 0 : t.supplier) == null ? void 0 : o.internal) ? D.TRANSFER : D.PURCHASE;
|
|
855
|
-
}
|
|
856
|
-
const je = "use";
|
|
857
|
-
function ms() {
|
|
858
|
-
const { t } = ae(), { viewTemplate: y, updateTemplate: o, deleteTemplate: l, useTemplate: d } = ps(), s = R(new Array()), n = R(!1), w = Z(), p = tt();
|
|
859
|
-
async function a() {
|
|
860
|
-
if (s.value = [], !!w._currentLocation) {
|
|
861
|
-
n.value = !0;
|
|
862
|
-
try {
|
|
863
|
-
const [m] = await Promise.all([
|
|
864
|
-
p.readTemplates(),
|
|
865
|
-
new Promise((u) => setTimeout(u, 1e3))
|
|
866
|
-
]);
|
|
867
|
-
s.value = m;
|
|
868
|
-
} catch (m) {
|
|
869
|
-
console.log("Something went wrong when fetching templates:", m);
|
|
870
|
-
} finally {
|
|
871
|
-
n.value = !1;
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
async function c(m) {
|
|
876
|
-
if (!s.value.find((u) => u._id) && w._currentLocation) {
|
|
877
|
-
n.value = !0;
|
|
878
|
-
try {
|
|
879
|
-
const [u] = await Promise.all([
|
|
880
|
-
p.getTemplate(m),
|
|
881
|
-
new Promise((b) => setTimeout(b, 1e3))
|
|
882
|
-
]);
|
|
883
|
-
s.value = [u];
|
|
884
|
-
} catch (u) {
|
|
885
|
-
console.log("Something went wrong when fetching templates:", u);
|
|
886
|
-
} finally {
|
|
887
|
-
n.value = !1;
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
function r(m, u) {
|
|
892
|
-
switch (u = Se(u), m) {
|
|
893
|
-
case je:
|
|
894
|
-
return d(u);
|
|
895
|
-
case ve.Details:
|
|
896
|
-
return y(u);
|
|
897
|
-
case ve.Edit:
|
|
898
|
-
return o(u);
|
|
899
|
-
case ve.Delete:
|
|
900
|
-
return l(u, n, a);
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
return { columnDefs: [
|
|
904
|
-
{
|
|
905
|
-
id: "_id",
|
|
906
|
-
accessorKey: "_id",
|
|
907
|
-
header: () => t("inventory.transfer.table.createdAt"),
|
|
908
|
-
cell(m) {
|
|
909
|
-
return at(`${m.getValue()}`);
|
|
910
|
-
},
|
|
911
|
-
enableSorting: !0
|
|
912
|
-
},
|
|
913
|
-
{
|
|
914
|
-
id: "name",
|
|
915
|
-
accessorKey: "name",
|
|
916
|
-
header: () => t("inventory.transfer.table.name"),
|
|
917
|
-
enableSorting: !0,
|
|
918
|
-
size: 200
|
|
919
|
-
},
|
|
920
|
-
{
|
|
921
|
-
id: "supplier",
|
|
922
|
-
accessorKey: "purchaseOrder.supplier.name",
|
|
923
|
-
header: () => t("inventory.transfer.table.transferFrom"),
|
|
924
|
-
enableSorting: !0,
|
|
925
|
-
size: 200
|
|
926
|
-
},
|
|
927
|
-
{
|
|
928
|
-
id: "type",
|
|
929
|
-
header: () => t("inventory.transfer.receiveRequest.details.type.title"),
|
|
930
|
-
enableSorting: !0,
|
|
931
|
-
sortingFn(m, u) {
|
|
932
|
-
const b = $e(m.original.purchaseOrder), C = $e(u.original.purchaseOrder);
|
|
933
|
-
return b.localeCompare(C);
|
|
934
|
-
},
|
|
935
|
-
size: 200,
|
|
936
|
-
cell(m) {
|
|
937
|
-
const u = $e(m.row.original.purchaseOrder), b = t(
|
|
938
|
-
`inventory.transfer.receiveRequest.details.type.${u.toLocaleLowerCase()}`
|
|
939
|
-
);
|
|
940
|
-
return O(se.FmChip, {
|
|
941
|
-
label: b,
|
|
942
|
-
class: "fm-chip-transfer-info",
|
|
943
|
-
compact: !0
|
|
944
|
-
});
|
|
945
|
-
}
|
|
946
|
-
},
|
|
947
|
-
{
|
|
948
|
-
id: "noOfItems",
|
|
949
|
-
accessorKey: "purchaseOrder.items.length",
|
|
950
|
-
header: () => t("inventory.transfer.table.noOfItems"),
|
|
951
|
-
enableSorting: !1,
|
|
952
|
-
meta: {
|
|
953
|
-
width: "10rem",
|
|
954
|
-
textAlign: "right"
|
|
955
|
-
}
|
|
956
|
-
},
|
|
957
|
-
{
|
|
958
|
-
id: "ref",
|
|
959
|
-
accessorKey: "purchaseOrder.ref",
|
|
960
|
-
header: () => t("inventory.transfer.table.reference"),
|
|
961
|
-
enableSorting: !1,
|
|
962
|
-
size: "auto"
|
|
963
|
-
},
|
|
964
|
-
{
|
|
965
|
-
id: "action",
|
|
966
|
-
cell(m) {
|
|
967
|
-
const u = m.row.original, b = [
|
|
968
|
-
{
|
|
969
|
-
translationKey: "inventory.transfer.template.use",
|
|
970
|
-
value: je,
|
|
971
|
-
color: "text-fm-color-typo-primary"
|
|
972
|
-
},
|
|
973
|
-
Ne[ve.Edit],
|
|
974
|
-
Ne[ve.Delete]
|
|
975
|
-
];
|
|
976
|
-
return Tt(b, (C) => r(C, u));
|
|
977
|
-
},
|
|
978
|
-
enableSorting: !1,
|
|
979
|
-
size: 40,
|
|
980
|
-
meta: {
|
|
981
|
-
cellClass: "",
|
|
982
|
-
headerClass: ""
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
], templates: s, loading: n, fetchTemplates: a, loadTemplate: c };
|
|
986
|
-
}
|
|
987
|
-
function fs() {
|
|
988
|
-
const t = Te(), y = Ze(), o = R(!1);
|
|
989
|
-
Ue(o, (n) => {
|
|
990
|
-
n && (d.value = !0, l().finally(() => {
|
|
991
|
-
d.value = !1;
|
|
992
|
-
}));
|
|
993
|
-
});
|
|
994
|
-
async function l() {
|
|
995
|
-
try {
|
|
996
|
-
const { startDate: n, endDate: w } = gt(6), c = (await y.getPurchaseOrders({ start: n, end: w })).filter(
|
|
997
|
-
(r) => {
|
|
998
|
-
var i, m;
|
|
999
|
-
return r.status === ht.enum.COMPLETE && ((i = r.supplier) == null ? void 0 : i.internal) !== "warehouse" && ((m = r.supplier) == null ? void 0 : m.internal) !== "restaurant";
|
|
1000
|
-
}
|
|
1001
|
-
).reduce((r, i) => {
|
|
1002
|
-
const m = new Date(_t(i._id)), u = i.supplier._id;
|
|
1003
|
-
for (const b of i.items) {
|
|
1004
|
-
if (!b.totalCost) continue;
|
|
1005
|
-
const C = r[b.sku._id] ?? {}, T = C[u] ?? [];
|
|
1006
|
-
T.push({
|
|
1007
|
-
date: m.toISOString(),
|
|
1008
|
-
totalUnit: b.quantity,
|
|
1009
|
-
totalCost: b.totalCost,
|
|
1010
|
-
unit: b.sku.unit,
|
|
1011
|
-
measurement: b.measurement,
|
|
1012
|
-
seqNumber: i.seqNumber
|
|
1013
|
-
}), C[u] = T, r[b.sku._id] = C;
|
|
1014
|
-
}
|
|
1015
|
-
return r;
|
|
1016
|
-
}, {});
|
|
1017
|
-
s.value = c;
|
|
1018
|
-
} catch {
|
|
1019
|
-
t.open({
|
|
1020
|
-
title: "Something went wrong",
|
|
1021
|
-
message: "Cannot retrieve supplier purchase history. Please try again."
|
|
1022
|
-
}), o.value = !1;
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
const d = R(!1), s = R({});
|
|
1026
|
-
return {
|
|
1027
|
-
comparePricesToggle: o,
|
|
1028
|
-
comparePriceFetching: d,
|
|
1029
|
-
comparePriceBySku: s
|
|
1030
|
-
};
|
|
1031
|
-
}
|
|
1032
|
-
const ys = { class: "fm-typo-body-md-400 line-clamp-2 w-full" }, vs = { key: 0 }, bs = ["colspan"], gs = /* @__PURE__ */ re({
|
|
1033
|
-
__name: "TransferItemTable",
|
|
1034
|
-
props: {
|
|
1035
|
-
row: {},
|
|
1036
|
-
comparePriceBySku: {},
|
|
1037
|
-
showComparePrice: { type: Boolean }
|
|
1038
|
-
},
|
|
1039
|
-
setup(t) {
|
|
1040
|
-
function y(o) {
|
|
1041
|
-
return o.column.columnDef.meta;
|
|
1042
|
-
}
|
|
1043
|
-
return (o, l) => {
|
|
1044
|
-
var d, s;
|
|
1045
|
-
return x(), $(ge, null, [
|
|
1046
|
-
f("tr", {
|
|
1047
|
-
class: Re(["border-b border-fm-color-neutral-gray-100 hover:bg-fm-color-opacity-sm", {
|
|
1048
|
-
"bg-fm-color-neutral-gray-100": o.row.getIsSelected()
|
|
1049
|
-
}])
|
|
1050
|
-
}, [
|
|
1051
|
-
(x(!0), $(ge, null, Ae(o.row.getVisibleCells(), (n) => {
|
|
1052
|
-
var w, p, a, c;
|
|
1053
|
-
return x(), $("td", {
|
|
1054
|
-
key: n.id,
|
|
1055
|
-
class: Re([
|
|
1056
|
-
"h-[52px] px-16 text-fm-color-typo-primary",
|
|
1057
|
-
((w = y(n)) == null ? void 0 : w.cellClass) ?? "px-16"
|
|
1058
|
-
]),
|
|
1059
|
-
style: st({
|
|
1060
|
-
width: (p = y(n)) == null ? void 0 : p.width,
|
|
1061
|
-
maxWidth: (a = y(n)) == null ? void 0 : a.maxWidth,
|
|
1062
|
-
textAlign: ((c = y(n)) == null ? void 0 : c.textAlign) ?? "left"
|
|
1063
|
-
})
|
|
1064
|
-
}, [
|
|
1065
|
-
f("span", ys, [
|
|
1066
|
-
k(e(pe), {
|
|
1067
|
-
render: n.column.columnDef.cell,
|
|
1068
|
-
props: n.getContext()
|
|
1069
|
-
}, null, 8, ["render", "props"])
|
|
1070
|
-
])
|
|
1071
|
-
], 6);
|
|
1072
|
-
}), 128))
|
|
1073
|
-
], 2),
|
|
1074
|
-
o.showComparePrice && Object.keys(o.comparePriceBySku[(d = o.row.original.sku) == null ? void 0 : d._id] ?? {}).length > 0 ? (x(), $("tr", vs, [
|
|
1075
|
-
f("td", {
|
|
1076
|
-
colspan: o.row.getVisibleCells().length
|
|
1077
|
-
}, [
|
|
1078
|
-
k(et, {
|
|
1079
|
-
prices: o.comparePriceBySku[(s = o.row.original.sku) == null ? void 0 : s._id]
|
|
1080
|
-
}, null, 8, ["prices"])
|
|
1081
|
-
], 8, bs)
|
|
1082
|
-
])) : Y("", !0)
|
|
1083
|
-
], 64);
|
|
1084
|
-
};
|
|
1085
|
-
}
|
|
1086
|
-
}), hs = { class: "flex flex-col gap-4" }, _s = { class: "flex items-center gap-8 overflow-x-auto pb-12" }, Cs = { class: "flex flex-col gap-16" }, ks = { class: "flex flex-col gap-24" }, ws = {
|
|
1087
|
-
key: 0,
|
|
1088
|
-
class: "p-16 border border-fm-color-neutral-gray-300 fm-corner-radius-md flex flex-col"
|
|
1089
|
-
}, Ss = { class: "flex xs:flex-col sm:flex-col" }, Ts = {
|
|
1090
|
-
key: 0,
|
|
1091
|
-
class: "flex-1 flex gap-8 h-48 xs:flex-col xs:pt-16 sm:flex-col sm:pt-16"
|
|
1092
|
-
}, xs = { class: "flex-1" }, Ps = { class: "flex-1" }, Fs = {
|
|
1093
|
-
key: 1,
|
|
1094
|
-
class: "flex items-center gap-4"
|
|
1095
|
-
}, Ds = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary translate-y-[1px]" }, Is = { class: "flex flex-col gap-16" }, $s = { class: "flex sm:flex-col xs:flex-col gap-16 items-center xs:items-start sm:items-start" }, As = { class: "flex-1 gap-8 fm-typo-en-title-sm-800" }, Rs = { class: "flex gap-8" }, Vs = {
|
|
1096
|
-
key: 0,
|
|
1097
|
-
class: "xs:w-full"
|
|
1098
|
-
}, Os = /* @__PURE__ */ re({
|
|
1099
|
-
__name: "TransferForm2",
|
|
1100
|
-
props: {
|
|
1101
|
-
modelValue: {},
|
|
1102
|
-
disabled: { type: Boolean },
|
|
1103
|
-
suppliers: {},
|
|
1104
|
-
skus: {},
|
|
1105
|
-
lastClosingDate: {}
|
|
1106
|
-
},
|
|
1107
|
-
emits: ["validation-success", "form:ready"],
|
|
1108
|
-
setup(t, { expose: y, emit: o }) {
|
|
1109
|
-
const l = t, d = o, s = $t(), { t: n } = ae(), w = Z(), p = Me(), a = xe(), c = Qe(), r = ms(), i = P(
|
|
1110
|
-
() => r.templates.value.find((v) => v._id === s.template)
|
|
1111
|
-
), m = P(() => s.status === "DRAFT" || !s._rev);
|
|
1112
|
-
We(async () => {
|
|
1113
|
-
try {
|
|
1114
|
-
if (!s.template) return;
|
|
1115
|
-
await r.loadTemplate(s.template);
|
|
1116
|
-
} finally {
|
|
1117
|
-
d("form:ready");
|
|
1118
|
-
}
|
|
1119
|
-
});
|
|
1120
|
-
const u = P(
|
|
1121
|
-
() => w.currentLocation.type === Be.restaurant
|
|
1122
|
-
);
|
|
1123
|
-
w.watchLocation(async () => {
|
|
1124
|
-
location && (s.supplier || (s.supplier = a.suppliers.find((v) => v) ?? s.supplier));
|
|
1125
|
-
});
|
|
1126
|
-
const b = Ye(), C = Zt(
|
|
1127
|
-
() => s,
|
|
1128
|
-
(v) => {
|
|
1129
|
-
Object.assign(s, v);
|
|
1130
|
-
}
|
|
1131
|
-
), T = P({
|
|
1132
|
-
get() {
|
|
1133
|
-
var v;
|
|
1134
|
-
return typeof ((v = s == null ? void 0 : s.supplier) == null ? void 0 : v.internal) == "string" ? D.TRANSFER : D.PURCHASE;
|
|
1135
|
-
},
|
|
1136
|
-
set(v) {
|
|
1137
|
-
var K;
|
|
1138
|
-
const g = typeof ((K = s == null ? void 0 : s.supplier) == null ? void 0 : K.internal) == "string" ? D.TRANSFER : D.PURCHASE;
|
|
1139
|
-
v !== g && (s.supplier = v === D.PURCHASE ? C.locationOptionsTypePurchase.value[0] : C.locationOptionsTypeTransfer.value[0]);
|
|
1140
|
-
}
|
|
1141
|
-
}), Q = P(() => C.transferLocationOptions.value), M = P({
|
|
1142
|
-
get() {
|
|
1143
|
-
return s.supplier._id;
|
|
1144
|
-
},
|
|
1145
|
-
set(v) {
|
|
1146
|
-
C.transferLocationModel.value = v;
|
|
1147
|
-
}
|
|
1148
|
-
}), X = P({
|
|
1149
|
-
get() {
|
|
1150
|
-
return s.remark ?? void 0;
|
|
1151
|
-
},
|
|
1152
|
-
set(v) {
|
|
1153
|
-
s.remark = v;
|
|
1154
|
-
}
|
|
1155
|
-
}), { backdatePo: B, backdateSwitch: H, backdateModel: G, backdateTimeModel: L } = Qt({
|
|
1156
|
-
getEffectiveAt() {
|
|
1157
|
-
return s.effectiveAt;
|
|
1158
|
-
},
|
|
1159
|
-
setEffectiveAt(v) {
|
|
1160
|
-
s.effectiveAt = v;
|
|
1161
|
-
}
|
|
1162
|
-
}), { comparePricesToggle: N, comparePriceFetching: J, comparePriceBySku: h } = fs(), _ = R();
|
|
1163
|
-
y({
|
|
1164
|
-
validateInputs: () => {
|
|
1165
|
-
var v, g;
|
|
1166
|
-
(g = (v = _.value) == null ? void 0 : v.validateInputs) == null || g.call(v);
|
|
1167
|
-
},
|
|
1168
|
-
resetInputsValidation: () => {
|
|
1169
|
-
var v, g;
|
|
1170
|
-
(g = (v = _.value) == null ? void 0 : v.resetInputsValidation) == null || g.call(v);
|
|
1171
|
-
},
|
|
1172
|
-
resetInputs: () => {
|
|
1173
|
-
var v, g;
|
|
1174
|
-
(g = (v = _.value) == null ? void 0 : v.resetInputs) == null || g.call(v);
|
|
1175
|
-
}
|
|
1176
|
-
});
|
|
1177
|
-
const U = It({
|
|
1178
|
-
updateItem: (v) => {
|
|
1179
|
-
s.items = s.items.map((g) => g.sku._id !== v.sku._id ? g : v);
|
|
1180
|
-
},
|
|
1181
|
-
deleteItem: (v) => {
|
|
1182
|
-
s.items = s.items.filter((g) => g.sku._id !== v.sku._id);
|
|
1183
|
-
},
|
|
1184
|
-
get supplier() {
|
|
1185
|
-
return s.supplier;
|
|
1186
|
-
},
|
|
1187
|
-
get items() {
|
|
1188
|
-
return s.items;
|
|
1189
|
-
},
|
|
1190
|
-
get transferType() {
|
|
1191
|
-
return T.value;
|
|
1192
|
-
},
|
|
1193
|
-
get template() {
|
|
1194
|
-
return i.value;
|
|
1195
|
-
},
|
|
1196
|
-
get disabled() {
|
|
1197
|
-
return l.disabled;
|
|
1198
|
-
}
|
|
1199
|
-
}), le = P(() => U.columnDefs.value);
|
|
1200
|
-
function j() {
|
|
1201
|
-
var he, fe, _e;
|
|
1202
|
-
let v;
|
|
1203
|
-
((I) => {
|
|
1204
|
-
I.IsInTemplate = "IsInTemplate", I.IsOutsideTemplate = "IsOutsideTemplate";
|
|
1205
|
-
})(v || (v = {}));
|
|
1206
|
-
const g = [
|
|
1207
|
-
{
|
|
1208
|
-
id: "IsInTemplate",
|
|
1209
|
-
label: n("inventory.transfer.form.items.fromTemplate.title"),
|
|
1210
|
-
sublabel: n("inventory.transfer.form.items.fromTemplate.sublabel")
|
|
1211
|
-
},
|
|
1212
|
-
{
|
|
1213
|
-
id: "IsOutsideTemplate",
|
|
1214
|
-
label: n("inventory.transfer.form.items.other.title"),
|
|
1215
|
-
collapse: !0
|
|
1216
|
-
}
|
|
1217
|
-
], K = new Set((_e = (fe = (he = i.value) == null ? void 0 : he.purchaseOrder) == null ? void 0 : fe.items) == null ? void 0 : _e.map((I) => I.sku._id)), me = p.skus.map(
|
|
1218
|
-
(I) => ({
|
|
1219
|
-
label: I.name,
|
|
1220
|
-
sublabel: I.code,
|
|
1221
|
-
value: I,
|
|
1222
|
-
groupId: K.has(I._id) ? "IsInTemplate" : "IsOutsideTemplate"
|
|
1223
|
-
/* IsOutsideTemplate */
|
|
1224
|
-
})
|
|
1225
|
-
), Fe = me.filter((I) => {
|
|
1226
|
-
var ee;
|
|
1227
|
-
return (ee = s.items) == null ? void 0 : ee.find((ie) => ie.sku._id === I.value._id);
|
|
1228
|
-
}).map((I) => I.value);
|
|
1229
|
-
b.open({
|
|
1230
|
-
title: n("inventory.transfer.form.items.selectItem"),
|
|
1231
|
-
closeButton: !0,
|
|
1232
|
-
contentComponent: wt,
|
|
1233
|
-
contentComponentProps: {
|
|
1234
|
-
modelValue: Fe,
|
|
1235
|
-
items: me,
|
|
1236
|
-
groups: K.size ? g : void 0
|
|
1237
|
-
},
|
|
1238
|
-
primaryActions: {
|
|
1239
|
-
text: n("common.confirm"),
|
|
1240
|
-
close: !0
|
|
1241
|
-
},
|
|
1242
|
-
secondaryActions: {
|
|
1243
|
-
text: n("common.close"),
|
|
1244
|
-
close: !0,
|
|
1245
|
-
variant: "tertiary"
|
|
1246
|
-
}
|
|
1247
|
-
}).onPrimary((I) => {
|
|
1248
|
-
const ee = s.items ?? [], ie = I.map((W) => {
|
|
1249
|
-
var Ce, ye;
|
|
1250
|
-
const ue = ee.find((ce) => ce.sku._id === W._id);
|
|
1251
|
-
if (ue)
|
|
1252
|
-
return ue;
|
|
1253
|
-
const te = ((ye = (Ce = i.value) == null ? void 0 : Ce.purchaseOrder.items) == null ? void 0 : ye.find(
|
|
1254
|
-
(ce) => ce.sku._id === W._id
|
|
1255
|
-
)) ?? {
|
|
1256
|
-
sku: W,
|
|
1257
|
-
code: W.code,
|
|
1258
|
-
name: W.name,
|
|
1259
|
-
quantity: {
|
|
1260
|
-
amount: 1,
|
|
1261
|
-
precision: 0
|
|
1262
|
-
}
|
|
1263
|
-
};
|
|
1264
|
-
return T.value == D.PURCHASE && (te.totalCost = oe(
|
|
1265
|
-
te.sku,
|
|
1266
|
-
te.quantity,
|
|
1267
|
-
te.measurement,
|
|
1268
|
-
{
|
|
1269
|
-
supplier: s.supplier
|
|
1270
|
-
}
|
|
1271
|
-
)), te;
|
|
1272
|
-
});
|
|
1273
|
-
ie.sort((W, ue) => W.sku.code.localeCompare(ue.sku.code)), s.items = ie;
|
|
1274
|
-
});
|
|
1275
|
-
}
|
|
1276
|
-
function Pe(v) {
|
|
1277
|
-
return v;
|
|
1278
|
-
}
|
|
1279
|
-
return (v, g) => {
|
|
1280
|
-
var ye, ce;
|
|
1281
|
-
const K = F("FmChip"), me = F("FmSelect"), Fe = F("FmTextField"), he = F("FmTextarea"), fe = F("FmSwitch"), _e = F("FmDatePicker"), I = F("FmTimePicker"), ee = F("FmFormGroup"), ie = F("FmIcon"), W = F("FmButton"), ue = F("FmTooltip"), te = F("FmTable"), Ce = F("FmForm");
|
|
1282
|
-
return x(), $("div", hs, [
|
|
1283
|
-
f("div", _s, [
|
|
1284
|
-
(ye = l.modelValue) != null && ye.template ? (x(), q(K, {
|
|
1285
|
-
key: 0,
|
|
1286
|
-
variant: v.disabled ? "warning" : void 0,
|
|
1287
|
-
label: `${e(n)("inventory.transfer.template.title")}: ${((ce = i.value) == null ? void 0 : ce.name) ?? e(n)("inventory.transfer.form.loading")}`,
|
|
1288
|
-
icon: "summarize",
|
|
1289
|
-
compact: ""
|
|
1290
|
-
}, null, 8, ["variant", "label"])) : Y("", !0),
|
|
1291
|
-
k(K, {
|
|
1292
|
-
label: e(w).currentLocation.name,
|
|
1293
|
-
icon: "storefront",
|
|
1294
|
-
compact: ""
|
|
1295
|
-
}, null, 8, ["label"]),
|
|
1296
|
-
v.lastClosingDate ? (x(), q(K, {
|
|
1297
|
-
key: 1,
|
|
1298
|
-
label: `${e(n)("inventory.transfer.form.lastClosing")}: ${e(Ee)(v.lastClosingDate)} ${e(Ct)(v.lastClosingDate)}`,
|
|
1299
|
-
icon: "calendar_month",
|
|
1300
|
-
compact: ""
|
|
1301
|
-
}, null, 8, ["label"])) : Y("", !0)
|
|
1302
|
-
]),
|
|
1303
|
-
k(Ce, {
|
|
1304
|
-
ref_key: "formRef",
|
|
1305
|
-
ref: _,
|
|
1306
|
-
class: "flex flex-col gap-32",
|
|
1307
|
-
disabled: v.disabled,
|
|
1308
|
-
onValidationFailed: console.log,
|
|
1309
|
-
onValidationSuccess: g[12] || (g[12] = (De) => d("validation-success"))
|
|
1310
|
-
}, {
|
|
1311
|
-
default: V(() => {
|
|
1312
|
-
var De;
|
|
1313
|
-
return [
|
|
1314
|
-
f("div", Cs, [
|
|
1315
|
-
f("div", ks, [
|
|
1316
|
-
k(me, {
|
|
1317
|
-
label: e(n)("inventory.transfer.form.type.title"),
|
|
1318
|
-
"model-value": T.value,
|
|
1319
|
-
"onUpdate:modelValue": g[0] || (g[0] = (S) => T.value = S),
|
|
1320
|
-
items: [
|
|
1321
|
-
{
|
|
1322
|
-
label: e(n)("inventory.transfer.form.type.purchase"),
|
|
1323
|
-
value: e(D).PURCHASE,
|
|
1324
|
-
disabled: !e(C).locationOptionsTypePurchase.value.length,
|
|
1325
|
-
sublabel: e(C).locationOptionsTypePurchase.value.length ? void 0 : e(n)("inventory.transfer.form.noSupplierAvailable")
|
|
1326
|
-
},
|
|
1327
|
-
{
|
|
1328
|
-
label: e(n)("inventory.transfer.form.type.transfer"),
|
|
1329
|
-
value: e(D).TRANSFER,
|
|
1330
|
-
disabled: !e(C).locationOptionsTypeTransfer.value.length,
|
|
1331
|
-
sublabel: e(C).locationOptionsTypeTransfer.value.length ? void 0 : e(n)("inventory.transfer.form.noLocationAvailable")
|
|
1332
|
-
}
|
|
1333
|
-
],
|
|
1334
|
-
rules: [e(we)(1)(Q.value)]
|
|
1335
|
-
}, null, 8, ["label", "model-value", "items", "rules"]),
|
|
1336
|
-
k(me, {
|
|
1337
|
-
label: T.value === e(D).PURCHASE ? e(n)("inventory.transfer.form.purchaseFrom") : e(n)("inventory.transfer.form.transferFrom"),
|
|
1338
|
-
modelValue: M.value,
|
|
1339
|
-
"onUpdate:modelValue": g[1] || (g[1] = (S) => M.value = S),
|
|
1340
|
-
items: Q.value
|
|
1341
|
-
}, null, 8, ["label", "modelValue", "items"]),
|
|
1342
|
-
k(Fe, {
|
|
1343
|
-
label: e(n)("inventory.transfer.form.reference"),
|
|
1344
|
-
"label-mark": "optional",
|
|
1345
|
-
modelValue: e(s).ref,
|
|
1346
|
-
"onUpdate:modelValue": g[2] || (g[2] = (S) => e(s).ref = S)
|
|
1347
|
-
}, null, 8, ["label", "modelValue"]),
|
|
1348
|
-
k(he, {
|
|
1349
|
-
label: e(n)("inventory.transfer.form.remark"),
|
|
1350
|
-
"label-mark": "optional",
|
|
1351
|
-
"max-length": 240,
|
|
1352
|
-
modelValue: X.value,
|
|
1353
|
-
"onUpdate:modelValue": g[3] || (g[3] = (S) => X.value = S),
|
|
1354
|
-
class: Re([v.disabled ? "text-fm-color-typo-disabled " : ""])
|
|
1355
|
-
}, null, 8, ["label", "modelValue", "class"]),
|
|
1356
|
-
e(c).enableBackdatePo ? (x(), $("div", ws, [
|
|
1357
|
-
f("div", Ss, [
|
|
1358
|
-
k(fe, {
|
|
1359
|
-
modelValue: e(H),
|
|
1360
|
-
"onUpdate:modelValue": g[4] || (g[4] = (S) => de(H) ? H.value = S : null),
|
|
1361
|
-
label: e(n)("inventory.transfer.form.backdate.title"),
|
|
1362
|
-
sublabel: e(n)("inventory.transfer.form.backdate.subtitle"),
|
|
1363
|
-
"label-placement": "right",
|
|
1364
|
-
disabled: u.value && !v.lastClosingDate || v.disabled
|
|
1365
|
-
}, null, 8, ["modelValue", "label", "sublabel", "disabled"]),
|
|
1366
|
-
g[13] || (g[13] = f("div", { class: "xs:hidden sm:hidden h-48 lg:w-16 md:w-16" }, null, -1)),
|
|
1367
|
-
e(H) ? (x(), $("div", Ts, [
|
|
1368
|
-
f("div", xs, [
|
|
1369
|
-
k(_e, {
|
|
1370
|
-
modelValue: e(G),
|
|
1371
|
-
"onUpdate:modelValue": g[5] || (g[5] = (S) => de(G) ? G.value = S : null)
|
|
1372
|
-
}, null, 8, ["modelValue"])
|
|
1373
|
-
]),
|
|
1374
|
-
f("div", Ps, [
|
|
1375
|
-
k(I, {
|
|
1376
|
-
modelValue: e(L),
|
|
1377
|
-
"onUpdate:modelValue": g[6] || (g[6] = (S) => de(L) ? L.value = S : null)
|
|
1378
|
-
}, null, 8, ["modelValue"])
|
|
1379
|
-
])
|
|
1380
|
-
])) : Y("", !0)
|
|
1381
|
-
]),
|
|
1382
|
-
e(B) ? (x(), q(ee, {
|
|
1383
|
-
key: 0,
|
|
1384
|
-
modelValue: e(B),
|
|
1385
|
-
"onUpdate:modelValue": g[7] || (g[7] = (S) => de(B) ? B.value = S : null),
|
|
1386
|
-
rules: [e(kt)(new Date(v.lastClosingDate), /* @__PURE__ */ new Date())]
|
|
1387
|
-
}, null, 8, ["modelValue", "rules"])) : Y("", !0),
|
|
1388
|
-
u.value && !v.lastClosingDate ? (x(), $("div", Fs, [
|
|
1389
|
-
k(ie, {
|
|
1390
|
-
name: "error",
|
|
1391
|
-
size: "sm",
|
|
1392
|
-
class: "text-fm-color-typo-warning"
|
|
1393
|
-
}),
|
|
1394
|
-
f("span", Ds, A(e(n)("inventory.transfer.form.backdate.error")), 1)
|
|
1395
|
-
])) : Y("", !0)
|
|
1396
|
-
])) : Y("", !0)
|
|
1397
|
-
])
|
|
1398
|
-
]),
|
|
1399
|
-
f("div", Is, [
|
|
1400
|
-
k(ee, {
|
|
1401
|
-
"model-value": e(s).items,
|
|
1402
|
-
rules: [e(we)(1)]
|
|
1403
|
-
}, null, 8, ["model-value", "rules"]),
|
|
1404
|
-
f("div", $s, [
|
|
1405
|
-
f("div", As, A(e(n)("inventory.transfer.form.items.title")), 1),
|
|
1406
|
-
f("div", Rs, [
|
|
1407
|
-
k(W, {
|
|
1408
|
-
disabled: v.disabled,
|
|
1409
|
-
label: e(n)("inventory.transfer.form.items.addItem"),
|
|
1410
|
-
"prepend-icon": "add",
|
|
1411
|
-
variant: "secondary",
|
|
1412
|
-
"text-color": "primary",
|
|
1413
|
-
"bg-color": "transparent",
|
|
1414
|
-
"border-color": "primary",
|
|
1415
|
-
onClick: g[8] || (g[8] = (S) => j()),
|
|
1416
|
-
size: "md"
|
|
1417
|
-
}, null, 8, ["disabled", "label"]),
|
|
1418
|
-
e(s).template ? (x(), q(ue, {
|
|
1419
|
-
key: 0,
|
|
1420
|
-
"z-index": 50
|
|
1421
|
-
}, {
|
|
1422
|
-
content: V(() => [
|
|
1423
|
-
f("div", null, A(e(n)("inventory.transfer.form.items.forecastStock.notAvailable")), 1)
|
|
1424
|
-
]),
|
|
1425
|
-
default: V(() => [
|
|
1426
|
-
k(He, {
|
|
1427
|
-
"onUpdate:poItems": g[9] || (g[9] = (S) => e(s).items = S),
|
|
1428
|
-
disabled: ""
|
|
1429
|
-
})
|
|
1430
|
-
]),
|
|
1431
|
-
_: 1
|
|
1432
|
-
})) : (x(), q(He, {
|
|
1433
|
-
key: 1,
|
|
1434
|
-
"onUpdate:poItems": g[10] || (g[10] = (S) => e(s).items = S),
|
|
1435
|
-
disabled: v.disabled || !!e(s).template
|
|
1436
|
-
}, null, 8, ["disabled"]))
|
|
1437
|
-
])
|
|
1438
|
-
]),
|
|
1439
|
-
T.value === e(D).PURCHASE && m.value && e(c).enableTotalCost && ((De = v.modelValue) != null && De.items.length) ? (x(), $("div", Vs, [
|
|
1440
|
-
k(fe, {
|
|
1441
|
-
label: e(J) ? e(n)("inventory.transfer.form.items.fetchingData") : e(n)("inventory.transfer.form.items.comparePriceHistory"),
|
|
1442
|
-
"prepend-icon": "compare_arrows",
|
|
1443
|
-
"label-placement": "right",
|
|
1444
|
-
"model-value": e(N),
|
|
1445
|
-
"onUpdate:modelValue": g[11] || (g[11] = (S) => de(N) ? N.value = S : null),
|
|
1446
|
-
disabled: e(J) || v.disabled
|
|
1447
|
-
}, null, 8, ["label", "model-value", "disabled"])
|
|
1448
|
-
])) : Y("", !0),
|
|
1449
|
-
(x(), q(te, {
|
|
1450
|
-
"column-defs": le.value,
|
|
1451
|
-
"row-data": e(s).items,
|
|
1452
|
-
key: e(s).items.map((S) => S.sku._id).join("."),
|
|
1453
|
-
"hide-footer": ""
|
|
1454
|
-
}, {
|
|
1455
|
-
"table-row": V((S) => [
|
|
1456
|
-
k(gs, {
|
|
1457
|
-
"compare-price-by-sku": e(h),
|
|
1458
|
-
"show-compare-price": T.value === e(D).PURCHASE && e(N),
|
|
1459
|
-
row: S
|
|
1460
|
-
}, null, 8, ["compare-price-by-sku", "show-compare-price", "row"])
|
|
1461
|
-
]),
|
|
1462
|
-
"list-row": V((S) => [
|
|
1463
|
-
(x(), q(xt, {
|
|
1464
|
-
row: S,
|
|
1465
|
-
key: e(s).items.map((Ie) => Ie.sku._id).join(".")
|
|
1466
|
-
}, {
|
|
1467
|
-
default: V((Ie) => [
|
|
1468
|
-
k(Yt, {
|
|
1469
|
-
"compare-price-by-sku": e(h),
|
|
1470
|
-
"show-compare-price": T.value === e(D).PURCHASE && e(N),
|
|
1471
|
-
row: S,
|
|
1472
|
-
"cell-by-col-id": Ie
|
|
1473
|
-
}, null, 8, ["compare-price-by-sku", "show-compare-price", "row", "cell-by-col-id"])
|
|
1474
|
-
]),
|
|
1475
|
-
_: 2
|
|
1476
|
-
}, 1032, ["row"]))
|
|
1477
|
-
]),
|
|
1478
|
-
_: 1
|
|
1479
|
-
}, 8, ["column-defs", "row-data"]))
|
|
1480
|
-
])
|
|
1481
|
-
];
|
|
1482
|
-
}),
|
|
1483
|
-
_: 1
|
|
1484
|
-
}, 8, ["disabled", "onValidationFailed"])
|
|
1485
|
-
]);
|
|
1486
|
-
};
|
|
1487
|
-
}
|
|
1488
|
-
}), Bs = { class: "flex items-center" }, Us = { class: "fm-typo-en-title-md-800" }, Es = { class: "flex gap-4" }, Gs = /* @__PURE__ */ re({
|
|
1489
|
-
__name: "TransferDialog",
|
|
1490
|
-
props: {
|
|
1491
|
-
mode: {},
|
|
1492
|
-
modelValue: {},
|
|
1493
|
-
template: {},
|
|
1494
|
-
show: { type: Boolean },
|
|
1495
|
-
lastClosingDate: {}
|
|
1496
|
-
},
|
|
1497
|
-
emits: ["update:show", "submitted"],
|
|
1498
|
-
setup(t, { expose: y, emit: o }) {
|
|
1499
|
-
var J;
|
|
1500
|
-
const l = t, d = o, s = Ze(), n = Te(), w = xe(), p = Me(), a = Z(), { t: c } = ae(), r = R(!1), i = R(!1), m = R(!1);
|
|
1501
|
-
async function u(h) {
|
|
1502
|
-
if (h) {
|
|
1503
|
-
i.value = !1;
|
|
1504
|
-
try {
|
|
1505
|
-
await w.readSuppliers(), i.value = !0;
|
|
1506
|
-
} catch {
|
|
1507
|
-
n.open({
|
|
1508
|
-
title: c("inventory.transfer.form.unableToFetchListOfSuppliers.title"),
|
|
1509
|
-
message: c("inventory.transfer.form.unableToFetchListOfSuppliers.message"),
|
|
1510
|
-
type: "error"
|
|
1511
|
-
});
|
|
1512
|
-
}
|
|
1513
|
-
}
|
|
1514
|
-
}
|
|
1515
|
-
a.watchLocation(u);
|
|
1516
|
-
function b() {
|
|
1517
|
-
return {
|
|
1518
|
-
remark: void 0,
|
|
1519
|
-
ref: void 0,
|
|
1520
|
-
stockSnapshotId: void 0,
|
|
1521
|
-
effectiveAt: void 0,
|
|
1522
|
-
items: [],
|
|
1523
|
-
supplier: {
|
|
1524
|
-
_rev: void 0,
|
|
1525
|
-
email: void 0,
|
|
1526
|
-
internal: void 0,
|
|
1527
|
-
contactName: void 0,
|
|
1528
|
-
phoneNumber: void 0,
|
|
1529
|
-
registrationNumber: void 0,
|
|
1530
|
-
supplyItems: void 0,
|
|
1531
|
-
_id: "",
|
|
1532
|
-
name: "",
|
|
1533
|
-
address: {
|
|
1534
|
-
line2: void 0,
|
|
1535
|
-
line1: "",
|
|
1536
|
-
state: "",
|
|
1537
|
-
city: "",
|
|
1538
|
-
postcode: "",
|
|
1539
|
-
country: ""
|
|
1540
|
-
}
|
|
1541
|
-
},
|
|
1542
|
-
status: "DRAFT",
|
|
1543
|
-
_id: "",
|
|
1544
|
-
seqNumber: 0,
|
|
1545
|
-
deliveryOrder: []
|
|
1546
|
-
};
|
|
1547
|
-
}
|
|
1548
|
-
const C = nt(l, "show"), T = R(l.modelValue ?? b()), Q = R(((J = l.modelValue) == null ? void 0 : J._id) ?? `${Math.random()}`);
|
|
1549
|
-
Ue(
|
|
1550
|
-
() => l.show,
|
|
1551
|
-
(h) => {
|
|
1552
|
-
var _;
|
|
1553
|
-
h && (m.value = !1, T.value = l.modelValue ?? b(), Q.value = ((_ = l.modelValue) == null ? void 0 : _._id) ?? `${Math.random()}`);
|
|
1554
|
-
}
|
|
1555
|
-
);
|
|
1556
|
-
const M = P(() => !i.value || !m.value), X = P(() => {
|
|
1557
|
-
switch (l.mode) {
|
|
1558
|
-
case ne.READ:
|
|
1559
|
-
return "View transfer";
|
|
1560
|
-
case ne.CREATE:
|
|
1561
|
-
return c("inventory.transfer.receiveRequest.create.title");
|
|
1562
|
-
case ne.UPDATE:
|
|
1563
|
-
return c("inventory.transfer.receiveRequest.update.title");
|
|
1564
|
-
}
|
|
1565
|
-
return "";
|
|
1566
|
-
}), B = R();
|
|
1567
|
-
y({
|
|
1568
|
-
validateInputs: () => {
|
|
1569
|
-
var h, _;
|
|
1570
|
-
(_ = (h = B.value) == null ? void 0 : h.validateInputs) == null || _.call(h);
|
|
1571
|
-
},
|
|
1572
|
-
resetInputsValidation: () => {
|
|
1573
|
-
var h, _;
|
|
1574
|
-
(_ = (h = B.value) == null ? void 0 : h.resetInputsValidation) == null || _.call(h);
|
|
1575
|
-
},
|
|
1576
|
-
resetInputs: () => {
|
|
1577
|
-
var h, _;
|
|
1578
|
-
(_ = (h = B.value) == null ? void 0 : h.resetInputs) == null || _.call(h);
|
|
1579
|
-
}
|
|
1580
|
-
});
|
|
1581
|
-
async function H() {
|
|
1582
|
-
const h = T.value;
|
|
1583
|
-
r.value = !0, (h.supplier.internal === "warehouse" || h.supplier.internal === "restaurant") && (h.items = h.items.map(({ totalCost: _, ...U }) => U));
|
|
1584
|
-
try {
|
|
1585
|
-
await s.createPurchaseOrder(h), await new Promise((_) => setTimeout(_, 1e3)), n.open({
|
|
1586
|
-
title: c("inventory.transfer.receiveRequest.create.success"),
|
|
1587
|
-
message: c("inventory.transfer.receiveRequest.create.successMessage"),
|
|
1588
|
-
type: "success"
|
|
1589
|
-
}), d("update:show", !1), d("submitted");
|
|
1590
|
-
} catch (_) {
|
|
1591
|
-
n.open({
|
|
1592
|
-
title: c("inventory.transfer.receiveRequest.create.error.title"),
|
|
1593
|
-
message: c("inventory.transfer.receiveRequest.create.error.message"),
|
|
1594
|
-
type: "error"
|
|
1595
|
-
}), console.error("Error in creating purchase order", _);
|
|
1596
|
-
} finally {
|
|
1597
|
-
r.value = !1;
|
|
1598
|
-
}
|
|
1599
|
-
}
|
|
1600
|
-
async function G() {
|
|
1601
|
-
const h = T.value;
|
|
1602
|
-
r.value = !0, (h.supplier.internal === "warehouse" || h.supplier.internal === "restaurant") && (h.items = h.items.map(({ totalCost: _, ...U }) => U));
|
|
1603
|
-
try {
|
|
1604
|
-
await s.updatePurchaseOrder(h), await new Promise((_) => setTimeout(_, 1e3)), n.open({
|
|
1605
|
-
title: c("inventory.transfer.receiveRequest.update.success"),
|
|
1606
|
-
message: c("inventory.transfer.receiveRequest.update.successMessage"),
|
|
1607
|
-
type: "success"
|
|
1608
|
-
}), d("update:show", !1), d("submitted");
|
|
1609
|
-
} catch (_) {
|
|
1610
|
-
n.open({
|
|
1611
|
-
title: c("inventory.transfer.receiveRequest.update.error.title"),
|
|
1612
|
-
message: c("inventory.transfer.receiveRequest.update.error.message"),
|
|
1613
|
-
type: "error"
|
|
1614
|
-
}), console.error("Error in updating purchase order", _);
|
|
1615
|
-
} finally {
|
|
1616
|
-
r.value = !1;
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1619
|
-
function L() {
|
|
1620
|
-
switch (l.mode) {
|
|
1621
|
-
case ne.CREATE:
|
|
1622
|
-
return H();
|
|
1623
|
-
case ne.UPDATE:
|
|
1624
|
-
return G();
|
|
1625
|
-
}
|
|
1626
|
-
}
|
|
1627
|
-
function N() {
|
|
1628
|
-
var h, _;
|
|
1629
|
-
(_ = (h = B.value) == null ? void 0 : h.validateInputs) == null || _.call(h);
|
|
1630
|
-
}
|
|
1631
|
-
return (h, _) => {
|
|
1632
|
-
const U = F("FmButton"), le = F("FmSideSheet");
|
|
1633
|
-
return x(), q(le, {
|
|
1634
|
-
modelValue: e(C),
|
|
1635
|
-
"onUpdate:modelValue": _[3] || (_[3] = (j) => de(C) ? C.value = j : null),
|
|
1636
|
-
"dismiss-away": "",
|
|
1637
|
-
"close-button": "",
|
|
1638
|
-
"max-width": 900
|
|
1639
|
-
}, {
|
|
1640
|
-
"side-sheet-header": V(() => [
|
|
1641
|
-
f("div", Bs, [
|
|
1642
|
-
f("div", Us, A(X.value), 1)
|
|
1643
|
-
])
|
|
1644
|
-
]),
|
|
1645
|
-
default: V(() => [
|
|
1646
|
-
(x(), q(Os, {
|
|
1647
|
-
class: "w-full",
|
|
1648
|
-
ref_key: "formRef",
|
|
1649
|
-
ref: B,
|
|
1650
|
-
"onForm:ready": _[0] || (_[0] = () => m.value = !0),
|
|
1651
|
-
onValidationSuccess: L,
|
|
1652
|
-
modelValue: T.value,
|
|
1653
|
-
"onUpdate:modelValue": _[1] || (_[1] = (j) => T.value = j),
|
|
1654
|
-
disabled: r.value || M.value,
|
|
1655
|
-
suppliers: e(w).suppliers,
|
|
1656
|
-
skus: e(p).skus,
|
|
1657
|
-
key: Q.value,
|
|
1658
|
-
"last-closing-date": h.lastClosingDate
|
|
1659
|
-
}, null, 8, ["modelValue", "disabled", "suppliers", "skus", "last-closing-date"]))
|
|
1660
|
-
]),
|
|
1661
|
-
"side-sheet-footer": V(() => [
|
|
1662
|
-
f("div", Es, [
|
|
1663
|
-
k(U, {
|
|
1664
|
-
loading: r.value,
|
|
1665
|
-
disabled: M.value,
|
|
1666
|
-
label: e(c)("common.save"),
|
|
1667
|
-
onClick: N
|
|
1668
|
-
}, null, 8, ["loading", "disabled", "label"]),
|
|
1669
|
-
k(U, {
|
|
1670
|
-
disabled: M.value,
|
|
1671
|
-
variant: "tertiary",
|
|
1672
|
-
label: e(c)("common.close"),
|
|
1673
|
-
onClick: _[2] || (_[2] = (j) => d("update:show", !1))
|
|
1674
|
-
}, null, 8, ["disabled", "label"])
|
|
1675
|
-
])
|
|
1676
|
-
]),
|
|
1677
|
-
_: 1
|
|
1678
|
-
}, 8, ["modelValue"]);
|
|
1679
|
-
};
|
|
1680
|
-
}
|
|
1681
|
-
});
|
|
1682
|
-
export {
|
|
1683
|
-
Gs as _,
|
|
1684
|
-
tt as a,
|
|
1685
|
-
ps as b,
|
|
1686
|
-
oe as c,
|
|
1687
|
-
$t as d,
|
|
1688
|
-
ms as e,
|
|
1689
|
-
Zt as u
|
|
1690
|
-
};
|