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