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