@feedmepos/mf-inventory-portal 1.0.15-dev.2 → 1.0.15-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-CgxrN-aD.js → App-3Zym4rob.js} +2 -2
- package/dist/ApprovalView-C4qLlZua.js +213 -0
- package/dist/{BindingsDialog-B_ZMDl-b.js → BindingsDialog-DHaF8DtC.js} +2 -2
- package/dist/{BindingsPicker-B84BG8zT.js → BindingsPicker-C04HnWZ-.js} +1 -1
- package/dist/{BindingsTable-DrvoykYc.js → BindingsTable-CnZUt7GU.js} +1 -1
- package/dist/{ClosingDraftView-Ds9sI2Eg.js → ClosingDraftView-DaMruAln.js} +41 -41
- package/dist/{ClosingTemplateView-BhZ1OXkD.js → ClosingTemplateView-B3lyKcz-.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-Yuxf-jCh.js → DeliveryOrderPrintPreview-CGPkYOfW.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-D6ktiUO5.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DFJNtwjV.js} +43 -43
- package/dist/{FmMultiselectDialog-4lVsA2Rn.js → FmMultiselectDialog-yR5Mo3U-.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-XmTRSHn_.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DoY67RWl.js} +57 -57
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-B3PvtR0j.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BSuFAwN3.js} +1 -1
- package/dist/IngredientGroupView-B-hyo-7W.js +898 -0
- package/dist/IngredientsView-Cod5ahQy.js +1778 -0
- package/dist/{IntegrationView-BnrCkjWt.js → IntegrationView-D9KZtPN3.js} +5 -5
- package/dist/{InventoryBindingForm-uyHh2TI_.js → InventoryBindingForm-CrRoablh.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CECDj9Pw.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-W9p7khOs.js} +46 -46
- package/dist/{InventoryBindingSummary-DyHCqgIe.js → InventoryBindingSummary-D88BG4ze.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Dx2lMf6h.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-VtM-wvuF.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BCX3vlmU.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Ccx9QvpN.js} +15 -15
- package/dist/{PublishView-BVGyY6nn.js → PublishView-DhE7YE-k.js} +13 -13
- package/dist/{PurchaseOrderPrintPreview-pbYIFiOG.js → PurchaseOrderPrintPreview-CF_VeOeU.js} +4 -4
- package/dist/ReceiveRequestView-Bx9-NHyn.js +2576 -0
- package/dist/{RecipeView-DcgoCf4g.js → RecipeView-JhM5Z4CP.js} +4 -4
- package/dist/{StockView-zO2uL662.js → StockView-u7jlKoO5.js} +108 -108
- package/dist/{SupplierView-I5bqiX_2.js → SupplierView-BDBBQnGy.js} +37 -37
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-BJiobEDM.js +2090 -0
- package/dist/{TransferTemplateView-BDOt17yc.js → TransferTemplateView-CNMHm8Gy.js} +149 -149
- package/dist/{UnitView-BVY5S6-3.js → UnitView-UVgn7ofI.js} +32 -32
- package/dist/{WarehouseView-m6MKrtYq.js → WarehouseView-CEw69mhn.js} +26 -26
- package/dist/{app-DtICLubM.js → app-cfPLYfcH.js} +33227 -25194
- package/dist/app.js +5 -5
- package/dist/components/FmInventoryTableToolbar.vue.d.ts +36 -0
- package/dist/{decimal-C1dAcCf3.js → decimal-BeCLbdwn.js} +1 -1
- package/dist/{feature-Y7qzvbl4.js → feature-dhG2tL_A.js} +79 -79
- package/dist/{format-unit-display-CPqfS4vp.js → format-unit-display-D3UdcFM6.js} +48 -48
- package/dist/{index-DIEdSG3y.js → index-BUou6R58.js} +1 -1
- package/dist/{index-0qsqwB0T.js → index-BkR-Qpc0.js} +4 -4
- package/dist/{stock-CowNp_xM.js → stock-DQPwSZX1.js} +1 -1
- package/dist/{supplier-JVTTlQNL.js → supplier-CAcd6PiU.js} +2 -2
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-Df59lld2.js → use-ingredient-select-dialog-E3qfQso7.js} +5 -5
- package/dist/{use-inventory-binding-dialog-Bxxb93Kz.js → use-inventory-binding-dialog-DRKy4nUx.js} +1 -1
- package/dist/{vue-i18n-DJOdRwc3.js → vue-i18n-DLrqHK28.js} +271 -271
- package/package.json +4 -4
- package/dist/ApprovalView-DNGhkVc9.js +0 -147
- package/dist/IngredientGroupView-usK9stxT.js +0 -8779
- package/dist/IngredientsView-DPx8Z2zo.js +0 -1749
- package/dist/ReceiveRequestView-DZAgH2_u.js +0 -2516
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-NyQg_yR9.js +0 -2020
|
@@ -0,0 +1,2576 @@
|
|
|
1
|
+
import { reactive as vt, onMounted as Be, watch as be, computed as q, h as j, defineComponent as re, openBlock as k, createElementBlock as T, Fragment as ne, renderList as Ie, createElementVNode as l, toDisplayString as R, unref as s, resolveComponent as D, createVNode as c, withCtx as P, createCommentVNode as B, ref as U, createBlock as K, normalizeClass as Y, normalizeStyle as yt, createTextVNode as Te, nextTick as wt, mergeProps as Ke, isRef as Fe, createSlots as Ft, Teleport as $t, normalizeProps as It, guardReactiveProps as Dt } from "vue";
|
|
2
|
+
import { b as qe, O as bt, l as Oe, i as $e, a5 as Qe, P as Tt, as as Vt, A as ze, M as Pt, m as gt, ac as Xe, E as de, aj as Rt, a as Le, at as Et, au as At, av as Ot, G as _t, u as Ze, aw as qt, ax as Ut, a4 as Mt, Z as Nt, ay as zt, C as ht, a0 as Bt, d as Ae, w as Lt, x as Ht, y as jt, az as Ne, a6 as dt, z as Yt, N as Kt, H as Qt, _ as Xt, B as Zt, T as ct } from "./app-cfPLYfcH.js";
|
|
3
|
+
import { u as Ge, a as Gt, P as Ye, b as Wt, _ as Jt, g as es } from "./TransferDetails.vue_vue_type_script_setup_true_lang-BJiobEDM.js";
|
|
4
|
+
import { _ as kt, u as ts, i as ss, e as as } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-Ccx9QvpN.js";
|
|
5
|
+
import { u as os } from "./useTabStorage-BkIVScW_.js";
|
|
6
|
+
import { useBreakpoints as We, components as ye, FmButtonVariant as ls, useSnackbar as Ve, useDialog as ns, useProxiedModel as xt } from "@feedmepos/ui-library";
|
|
7
|
+
import { P as se, u as Ct } from "./format-unit-display-D3UdcFM6.js";
|
|
8
|
+
import { _ as rs, F as is, a as us, b as ds } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-DoY67RWl.js";
|
|
9
|
+
import { u as Je } from "./feature-dhG2tL_A.js";
|
|
10
|
+
import { c as he, u as cs, _ as ms } from "./FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DFJNtwjV.js";
|
|
11
|
+
import { useI18n as ge } from "@feedmepos/mf-common";
|
|
12
|
+
import "./FmMultiselectDialog-yR5Mo3U-.js";
|
|
13
|
+
import { u as et } from "./supplier-CAcd6PiU.js";
|
|
14
|
+
import { _ as ps } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
|
|
15
|
+
import { u as fs } from "./vue-i18n-DLrqHK28.js";
|
|
16
|
+
import "./array-Ca8T3f_G.js";
|
|
17
|
+
var X = /* @__PURE__ */ ((g) => (g.Code = "Code", g.Name = "Name", g.TemplateName = "TemplateName", g.Amount = "Amount", g.Cost = "Cost", g.TotalCost = "TotalCost", g.Delete = "Delete", g))(X || {});
|
|
18
|
+
const vs = () => (ge(), j(
|
|
19
|
+
kt,
|
|
20
|
+
{
|
|
21
|
+
zIndex: 50,
|
|
22
|
+
class: "whitespace-nowrap"
|
|
23
|
+
},
|
|
24
|
+
`Total (${gt()})`
|
|
25
|
+
));
|
|
26
|
+
function ys(g) {
|
|
27
|
+
const { t: x } = ge(), n = vt({}), { breakpoints: i } = We(), _ = Je(), t = qe();
|
|
28
|
+
Be(() => {
|
|
29
|
+
for (const m of g.items) {
|
|
30
|
+
if (!m.totalCost)
|
|
31
|
+
continue;
|
|
32
|
+
const e = he(m.sku, m.quantity, m.measurement, {
|
|
33
|
+
supplier: g.supplier
|
|
34
|
+
}), o = m.totalCost ?? bt.reset();
|
|
35
|
+
e ? n[m.sku._id] = e.amount !== o.amount || e.precision !== o.precision : n[m.sku._id] = !0;
|
|
36
|
+
}
|
|
37
|
+
}), be([() => g.supplier], ([m]) => {
|
|
38
|
+
for (const e of g.items) {
|
|
39
|
+
if (!e.totalCost || n[e.sku._id] || !d(e.sku))
|
|
40
|
+
continue;
|
|
41
|
+
const o = he(e.sku, e.quantity, e.measurement, {
|
|
42
|
+
supplier: m
|
|
43
|
+
});
|
|
44
|
+
g.updateItem({ ...e, totalCost: o });
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
function d(m) {
|
|
48
|
+
var o, p, f, v, S, h, F;
|
|
49
|
+
return !!(((p = (o = m.defaultCost) == null ? void 0 : o.costPerUnit) == null ? void 0 : p.amount) ?? ((F = (h = (S = (v = (f = g.supplier) == null ? void 0 : f.supplyItems) == null ? void 0 : v.find((y) => y.skuId === m._id)) == null ? void 0 : S.defaultCost) == null ? void 0 : h.costPerUnit) == null ? void 0 : F.amount));
|
|
50
|
+
}
|
|
51
|
+
const C = [
|
|
52
|
+
{
|
|
53
|
+
id: "Code",
|
|
54
|
+
header: () => x("inventory.transfer.form.items.table.Code"),
|
|
55
|
+
accessorKey: "code",
|
|
56
|
+
size: 200,
|
|
57
|
+
cell(m) {
|
|
58
|
+
const e = m.row.original;
|
|
59
|
+
return t.isEnabled ? j(
|
|
60
|
+
ye.FmTooltip,
|
|
61
|
+
{
|
|
62
|
+
content: e.code,
|
|
63
|
+
placement: "top",
|
|
64
|
+
variant: "plain",
|
|
65
|
+
zIndex: 50
|
|
66
|
+
},
|
|
67
|
+
j(
|
|
68
|
+
"span",
|
|
69
|
+
{
|
|
70
|
+
class: "flex-auto line-clamp-2 text-ellipsis break-all"
|
|
71
|
+
},
|
|
72
|
+
e.code
|
|
73
|
+
)
|
|
74
|
+
) : j(ye.FmTextField, {
|
|
75
|
+
modelValue: e.code,
|
|
76
|
+
"onUpdate:modelValue": (o) => {
|
|
77
|
+
g.updateItem({
|
|
78
|
+
...e,
|
|
79
|
+
code: o
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
key: e.sku._id,
|
|
83
|
+
rules: [Oe()],
|
|
84
|
+
labelMark: "required"
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
enableSorting: !1
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: "Name",
|
|
91
|
+
header: () => x("inventory.transfer.form.items.table.Name"),
|
|
92
|
+
minSize: 300,
|
|
93
|
+
cell(m) {
|
|
94
|
+
const e = m.row.original;
|
|
95
|
+
return t.isEnabled ? j(
|
|
96
|
+
ye.FmTooltip,
|
|
97
|
+
{
|
|
98
|
+
content: e.name,
|
|
99
|
+
placement: "top",
|
|
100
|
+
variant: "plain",
|
|
101
|
+
zIndex: 50
|
|
102
|
+
},
|
|
103
|
+
j(
|
|
104
|
+
"span",
|
|
105
|
+
{
|
|
106
|
+
class: "flex-auto line-clamp-2 text-ellipsis break-all"
|
|
107
|
+
},
|
|
108
|
+
e.name
|
|
109
|
+
)
|
|
110
|
+
) : j(ye.FmTextField, {
|
|
111
|
+
modelValue: e.name,
|
|
112
|
+
"onUpdate:modelValue": (o) => {
|
|
113
|
+
g.updateItem({
|
|
114
|
+
...e,
|
|
115
|
+
name: o
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
key: e.sku._id,
|
|
119
|
+
rules: [Oe()],
|
|
120
|
+
labelMark: "required"
|
|
121
|
+
});
|
|
122
|
+
},
|
|
123
|
+
enableSorting: !1
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: "TemplateName",
|
|
127
|
+
header: () => x("inventory.transfer.form.items.table.Name"),
|
|
128
|
+
minSize: 300,
|
|
129
|
+
enableSorting: !1,
|
|
130
|
+
cell(m) {
|
|
131
|
+
const e = m.row.original, o = e.code, p = e.name;
|
|
132
|
+
return j(
|
|
133
|
+
ye.FmTooltip,
|
|
134
|
+
{ zIndex: 50 },
|
|
135
|
+
{
|
|
136
|
+
default() {
|
|
137
|
+
return j("div", { class: "flex flex-col w-full" }, [
|
|
138
|
+
j(
|
|
139
|
+
"div",
|
|
140
|
+
{ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
|
|
141
|
+
p
|
|
142
|
+
),
|
|
143
|
+
j(
|
|
144
|
+
"div",
|
|
145
|
+
{
|
|
146
|
+
class: "line-clamp-1 fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
147
|
+
},
|
|
148
|
+
o
|
|
149
|
+
)
|
|
150
|
+
]);
|
|
151
|
+
},
|
|
152
|
+
content() {
|
|
153
|
+
return p;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
id: "Amount",
|
|
161
|
+
header: () => x("inventory.transfer.form.items.table.Amount"),
|
|
162
|
+
minSize: 200,
|
|
163
|
+
cell(m) {
|
|
164
|
+
var p, f, v, S;
|
|
165
|
+
const e = m.row.original, o = (v = (f = (p = g.template) == null ? void 0 : p.purchaseOrder) == null ? void 0 : f.items) == null ? void 0 : v.find(
|
|
166
|
+
(h) => h.sku._id === e.sku._id
|
|
167
|
+
);
|
|
168
|
+
return j(rs, {
|
|
169
|
+
style: {
|
|
170
|
+
flex: "1 1 0%"
|
|
171
|
+
},
|
|
172
|
+
modelValue: {
|
|
173
|
+
amount: e.quantity ?? { amount: 1, precision: 0 },
|
|
174
|
+
measurement: e.measurement ?? null
|
|
175
|
+
},
|
|
176
|
+
key: e.sku._id,
|
|
177
|
+
unit: e.sku.unit,
|
|
178
|
+
"onUpdate:modelValue": (h) => {
|
|
179
|
+
if (!h) return;
|
|
180
|
+
const F = {
|
|
181
|
+
...e,
|
|
182
|
+
quantity: h.amount,
|
|
183
|
+
measurement: h.measurement
|
|
184
|
+
};
|
|
185
|
+
_.enableTotalCost && (F.totalCost = he(
|
|
186
|
+
F.sku,
|
|
187
|
+
F.quantity,
|
|
188
|
+
F.measurement,
|
|
189
|
+
{
|
|
190
|
+
supplier: g.supplier,
|
|
191
|
+
// NOTE: set undefined here if `manualTotalCost[updatedRow.sku._id] = false`, so that the function
|
|
192
|
+
// will return the auto calculated default cost instead of the manual total cost
|
|
193
|
+
manualTotalCost: n[F.sku._id] ? F.totalCost : void 0
|
|
194
|
+
}
|
|
195
|
+
)), g.updateItem(F);
|
|
196
|
+
},
|
|
197
|
+
stepper: o == null ? void 0 : o.quantityStep,
|
|
198
|
+
disableUnit: !!o,
|
|
199
|
+
disabled: g.disabled,
|
|
200
|
+
rules: [
|
|
201
|
+
is(
|
|
202
|
+
+$e(
|
|
203
|
+
((S = e.quantity) == null ? void 0 : S.amount) === 0 ? { amount: 0, precision: 0 } : (o == null ? void 0 : o.minimumQuantity) ?? { amount: 0, precision: 0 }
|
|
204
|
+
)
|
|
205
|
+
),
|
|
206
|
+
us(
|
|
207
|
+
o != null && o.maximumQuantity ? +$e(o == null ? void 0 : o.maximumQuantity) : 1 / 0
|
|
208
|
+
),
|
|
209
|
+
...o != null && o.quantityStep ? [ds(o.quantityStep)] : []
|
|
210
|
+
],
|
|
211
|
+
applyDefaultRules: !0
|
|
212
|
+
});
|
|
213
|
+
},
|
|
214
|
+
enableSorting: !1
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
id: "Cost",
|
|
218
|
+
header: vs,
|
|
219
|
+
size: 180,
|
|
220
|
+
cell(m) {
|
|
221
|
+
const e = m.row.original, o = d(e.sku), p = i.value.xs || i.value.sm;
|
|
222
|
+
return !n[e.sku._id] && o ? j(
|
|
223
|
+
"div",
|
|
224
|
+
{
|
|
225
|
+
class: [
|
|
226
|
+
"flex gap-4 fm-typo-en-body-md-400 items-center",
|
|
227
|
+
g.disabled ? "text-fm-color-typo-disabled" : ""
|
|
228
|
+
],
|
|
229
|
+
key: e.sku._id
|
|
230
|
+
},
|
|
231
|
+
[
|
|
232
|
+
j(ye.FmButton, {
|
|
233
|
+
prependIcon: "edit",
|
|
234
|
+
variant: ls.Tertiary,
|
|
235
|
+
disabled: g.disabled,
|
|
236
|
+
onClick() {
|
|
237
|
+
g.updateItem({
|
|
238
|
+
...e,
|
|
239
|
+
totalCost: he(e.sku, e.quantity, e.measurement, {
|
|
240
|
+
supplier: g.supplier
|
|
241
|
+
})
|
|
242
|
+
}), n[e.sku._id] = !0;
|
|
243
|
+
}
|
|
244
|
+
}),
|
|
245
|
+
j(
|
|
246
|
+
"div",
|
|
247
|
+
{
|
|
248
|
+
class: "flex flex-col"
|
|
249
|
+
},
|
|
250
|
+
[
|
|
251
|
+
j(
|
|
252
|
+
"span",
|
|
253
|
+
p ? Qe(
|
|
254
|
+
he(e.sku, e.quantity, e.measurement, {
|
|
255
|
+
supplier: g.supplier
|
|
256
|
+
})
|
|
257
|
+
) : $e(
|
|
258
|
+
he(e.sku, e.quantity, e.measurement, {
|
|
259
|
+
supplier: g.supplier
|
|
260
|
+
})
|
|
261
|
+
)
|
|
262
|
+
),
|
|
263
|
+
j(
|
|
264
|
+
"span",
|
|
265
|
+
{
|
|
266
|
+
class: [
|
|
267
|
+
"fm-typo-en-body-sm-400",
|
|
268
|
+
g.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-neutral-gray-400"
|
|
269
|
+
]
|
|
270
|
+
},
|
|
271
|
+
x("inventory.transfer.form.items.autoCalculated")
|
|
272
|
+
)
|
|
273
|
+
]
|
|
274
|
+
)
|
|
275
|
+
]
|
|
276
|
+
) : j(
|
|
277
|
+
ye.FmTextField,
|
|
278
|
+
{
|
|
279
|
+
modelValue: $e(e.totalCost ?? { amount: 0, precision: 0 }),
|
|
280
|
+
key: e.sku._id,
|
|
281
|
+
"onUpdate:modelValue": (f) => {
|
|
282
|
+
g.updateItem({
|
|
283
|
+
...e,
|
|
284
|
+
totalCost: {
|
|
285
|
+
...Tt(+f),
|
|
286
|
+
currency: Vt()
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
},
|
|
290
|
+
rules: [ze(0), Pt(2)]
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
prepend() {
|
|
294
|
+
return p ? j(
|
|
295
|
+
"div",
|
|
296
|
+
{
|
|
297
|
+
class: [
|
|
298
|
+
"text-fm-typo-en-body-lg-400",
|
|
299
|
+
g.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
|
|
300
|
+
]
|
|
301
|
+
},
|
|
302
|
+
gt()
|
|
303
|
+
) : null;
|
|
304
|
+
},
|
|
305
|
+
append() {
|
|
306
|
+
return o ? j(ye.FmButton, {
|
|
307
|
+
prependIcon: "close",
|
|
308
|
+
variant: "tertiary",
|
|
309
|
+
disabled: g.disabled,
|
|
310
|
+
onClick() {
|
|
311
|
+
g.updateItem({
|
|
312
|
+
...e,
|
|
313
|
+
// NOTE: different from PO template, if a default cost is reenabled,
|
|
314
|
+
// the total cost will automatically assigned
|
|
315
|
+
totalCost: he(e.sku, e.quantity, e.measurement, {
|
|
316
|
+
supplier: g.supplier
|
|
317
|
+
})
|
|
318
|
+
}), n[e.sku._id] = !1;
|
|
319
|
+
}
|
|
320
|
+
}) : null;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
);
|
|
324
|
+
},
|
|
325
|
+
enableSorting: !1
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
id: "Delete",
|
|
329
|
+
header: "",
|
|
330
|
+
cell(m) {
|
|
331
|
+
const e = m.row.original;
|
|
332
|
+
return j("div", { class: "flex justify-end" }, [
|
|
333
|
+
j(ye.FmButton, {
|
|
334
|
+
key: e.sku._id,
|
|
335
|
+
class: "delete-button",
|
|
336
|
+
type: "button",
|
|
337
|
+
icon: "delete",
|
|
338
|
+
variant: "tertiary",
|
|
339
|
+
size: "md",
|
|
340
|
+
disabled: g.disabled,
|
|
341
|
+
onClick: () => {
|
|
342
|
+
g.deleteItem(e);
|
|
343
|
+
}
|
|
344
|
+
})
|
|
345
|
+
]);
|
|
346
|
+
},
|
|
347
|
+
enableSorting: !1,
|
|
348
|
+
size: 40,
|
|
349
|
+
meta: {
|
|
350
|
+
cellClass: "",
|
|
351
|
+
headerClass: ""
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
];
|
|
355
|
+
return {
|
|
356
|
+
columnDefs: q(() => _.enableTotalCost && g.transferType === se.PURCHASE ? C : C.filter(
|
|
357
|
+
(m) => m.id !== "Cost"
|
|
358
|
+
/* Cost */
|
|
359
|
+
))
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
const bs = { class: "flex flex-col gap-8 px-16 xs:px-4 sm:px-4 py-4 items-center" }, gs = { class: "fm-typo-en-body-lg-600 xs:fm-typo-en-body-md-600 mr-auto xs:w-full" }, _s = { class: "w-[450px] xs:w-full flex" }, hs = { class: "fm-typo-en-body-md-400 whitespace-nowrap" }, ks = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, St = /* @__PURE__ */ re({
|
|
363
|
+
__name: "SupplierPriceHistory",
|
|
364
|
+
props: {
|
|
365
|
+
prices: {}
|
|
366
|
+
},
|
|
367
|
+
setup(g) {
|
|
368
|
+
const x = et();
|
|
369
|
+
function n(i) {
|
|
370
|
+
return x.suppliers.find((_) => _._id === i);
|
|
371
|
+
}
|
|
372
|
+
return (i, _) => (k(), T("div", bs, [
|
|
373
|
+
(k(!0), T(ne, null, Ie(Object.keys(i.prices), (t) => {
|
|
374
|
+
var d;
|
|
375
|
+
return k(), T("div", {
|
|
376
|
+
key: t,
|
|
377
|
+
class: "flex items-center gap-12 xs:gap-4 xs:flex-wrap w-full"
|
|
378
|
+
}, [
|
|
379
|
+
l("div", gs, R((d = n(t)) == null ? void 0 : d.name), 1),
|
|
380
|
+
l("div", _s, [
|
|
381
|
+
(k(!0), T(ne, null, Ie(i.prices[t].slice(0, 3), (C) => {
|
|
382
|
+
var $;
|
|
383
|
+
return k(), T("div", {
|
|
384
|
+
key: C.date,
|
|
385
|
+
class: "flex flex-col w-[150px] xs:flex-1 text-ellipsis cursor-pointer"
|
|
386
|
+
}, [
|
|
387
|
+
l("div", hs, [
|
|
388
|
+
l("span", null, R(C.totalCost ? s(Qe)(C.totalCost) : "No data"), 1),
|
|
389
|
+
_[0] || (_[0] = l("span", { class: "text-fm-color-typo-secondary" }, "/", -1)),
|
|
390
|
+
l("span", null, R(s($e)(C.totalUnit, !1)), 1),
|
|
391
|
+
l("span", null, R((($ = C.measurement) == null ? void 0 : $.abbrev) ?? C.unit.abbrev), 1)
|
|
392
|
+
]),
|
|
393
|
+
l("div", ks, [
|
|
394
|
+
l("span", null, "(#" + R(C.seqNumber) + ")", 1),
|
|
395
|
+
_[1] || (_[1] = l("span", null, R(" "), -1)),
|
|
396
|
+
l("span", null, R(s(Xe)(new Date(C.date))), 1)
|
|
397
|
+
])
|
|
398
|
+
]);
|
|
399
|
+
}), 128))
|
|
400
|
+
])
|
|
401
|
+
]);
|
|
402
|
+
}), 128))
|
|
403
|
+
]));
|
|
404
|
+
}
|
|
405
|
+
}), xs = { class: "flex flex-col gap-8 py-16" }, Cs = { class: "flex items-center" }, Ss = { class: "flex-1 flex gap-1 items-center" }, ws = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Fs = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, $s = { class: "flex gap-8 w-full" }, Is = { class: "flex-1 flex flex-col gap-4" }, Ds = { class: "flex-1 flex flex-col gap-4" }, Ts = { class: "flex gap-8 w-full" }, Vs = { class: "flex-1 flex flex-col gap-4" }, Ps = {
|
|
406
|
+
key: 0,
|
|
407
|
+
class: "flex-1 flex flex-col gap-4"
|
|
408
|
+
}, Rs = /* @__PURE__ */ re({
|
|
409
|
+
__name: "TransferItem",
|
|
410
|
+
props: {
|
|
411
|
+
cellByColId: {},
|
|
412
|
+
comparePriceBySku: {},
|
|
413
|
+
showComparePrice: { type: Boolean },
|
|
414
|
+
row: {}
|
|
415
|
+
},
|
|
416
|
+
setup(g) {
|
|
417
|
+
const { t: x } = ge();
|
|
418
|
+
return (n, i) => {
|
|
419
|
+
var d, C, $, m, e, o, p, f, v, S, h, F, y, w, L, H, N, Q, Z, A, E, V, r, u, O, oe, G;
|
|
420
|
+
const _ = D("FmLabel"), t = D("FmSpacer");
|
|
421
|
+
return k(), T("div", xs, [
|
|
422
|
+
l("div", Cs, [
|
|
423
|
+
l("div", Ss, [
|
|
424
|
+
l("span", ws, " (" + R(n.row.original.sku.code) + ") ", 1),
|
|
425
|
+
l("span", Fs, R(n.row.original.sku.name), 1)
|
|
426
|
+
]),
|
|
427
|
+
l("div", null, [
|
|
428
|
+
c(s(de), {
|
|
429
|
+
render: ($ = (C = (d = n.cellByColId.Delete) == null ? void 0 : d.column) == null ? void 0 : C.columnDef) == null ? void 0 : $.cell,
|
|
430
|
+
props: (e = (m = n.cellByColId.Delete) == null ? void 0 : m.getContext) == null ? void 0 : e.call(m)
|
|
431
|
+
}, null, 8, ["render", "props"])
|
|
432
|
+
])
|
|
433
|
+
]),
|
|
434
|
+
l("div", $s, [
|
|
435
|
+
l("div", Is, [
|
|
436
|
+
c(_, {
|
|
437
|
+
label: s(x)(`inventory.transfer.form.items.table.${s(X).Code}`)
|
|
438
|
+
}, null, 8, ["label"]),
|
|
439
|
+
c(s(de), {
|
|
440
|
+
render: (f = (p = (o = n.cellByColId[s(X).Code]) == null ? void 0 : o.column) == null ? void 0 : p.columnDef) == null ? void 0 : f.cell,
|
|
441
|
+
props: (S = (v = n.cellByColId[s(X).Code]) == null ? void 0 : v.getContext) == null ? void 0 : S.call(v)
|
|
442
|
+
}, null, 8, ["render", "props"]),
|
|
443
|
+
i[0] || (i[0] = l("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
444
|
+
]),
|
|
445
|
+
l("div", Ds, [
|
|
446
|
+
c(_, {
|
|
447
|
+
label: s(x)(`inventory.transfer.form.items.table.${s(X).Name}`)
|
|
448
|
+
}, null, 8, ["label"]),
|
|
449
|
+
c(s(de), {
|
|
450
|
+
render: (y = (F = (h = n.cellByColId[s(X).Name]) == null ? void 0 : h.column) == null ? void 0 : F.columnDef) == null ? void 0 : y.cell,
|
|
451
|
+
props: (L = (w = n.cellByColId[s(X).Name]) == null ? void 0 : w.getContext) == null ? void 0 : L.call(w)
|
|
452
|
+
}, null, 8, ["render", "props"]),
|
|
453
|
+
i[1] || (i[1] = l("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
454
|
+
])
|
|
455
|
+
]),
|
|
456
|
+
l("div", Ts, [
|
|
457
|
+
l("div", Vs, [
|
|
458
|
+
c(_, {
|
|
459
|
+
label: s(x)(`inventory.transfer.form.items.table.${s(X).Amount}`)
|
|
460
|
+
}, null, 8, ["label"]),
|
|
461
|
+
c(s(de), {
|
|
462
|
+
render: (Q = (N = (H = n.cellByColId[s(X).Amount]) == null ? void 0 : H.column) == null ? void 0 : N.columnDef) == null ? void 0 : Q.cell,
|
|
463
|
+
props: (A = (Z = n.cellByColId[s(X).Amount]) == null ? void 0 : Z.getContext) == null ? void 0 : A.call(Z)
|
|
464
|
+
}, null, 8, ["render", "props"]),
|
|
465
|
+
i[2] || (i[2] = l("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
466
|
+
]),
|
|
467
|
+
n.cellByColId[s(X).Cost] ? (k(), T("div", Ps, [
|
|
468
|
+
c(kt, { "z-index": 50 }, {
|
|
469
|
+
default: P(() => [
|
|
470
|
+
c(_, {
|
|
471
|
+
label: s(x)(`inventory.transfer.form.items.table.${s(X).Cost}2`)
|
|
472
|
+
}, null, 8, ["label"])
|
|
473
|
+
]),
|
|
474
|
+
_: 1
|
|
475
|
+
}),
|
|
476
|
+
c(s(de), {
|
|
477
|
+
render: (r = (V = (E = n.cellByColId[s(X).Cost]) == null ? void 0 : E.column) == null ? void 0 : V.columnDef) == null ? void 0 : r.cell,
|
|
478
|
+
props: (O = (u = n.cellByColId[s(X).Cost]) == null ? void 0 : u.getContext) == null ? void 0 : O.call(u)
|
|
479
|
+
}, null, 8, ["render", "props"]),
|
|
480
|
+
i[3] || (i[3] = l("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
481
|
+
])) : B("", !0)
|
|
482
|
+
]),
|
|
483
|
+
n.showComparePrice && Object.keys(n.comparePriceBySku[(oe = n.row.original.sku) == null ? void 0 : oe._id] ?? {}).length > 0 ? (k(), T(ne, { key: 0 }, [
|
|
484
|
+
c(t, { class: "h-8" }),
|
|
485
|
+
c(St, {
|
|
486
|
+
prices: n.comparePriceBySku[(G = n.row.original.sku) == null ? void 0 : G._id]
|
|
487
|
+
}, null, 8, ["prices"])
|
|
488
|
+
], 64)) : B("", !0)
|
|
489
|
+
]);
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
function Es(g) {
|
|
494
|
+
const x = q({
|
|
495
|
+
get() {
|
|
496
|
+
const t = g.getEffectiveAt();
|
|
497
|
+
return t ? new Date(t) : null;
|
|
498
|
+
},
|
|
499
|
+
set(t) {
|
|
500
|
+
g.setEffectiveAt((t == null ? void 0 : t.toISOString()) ?? null);
|
|
501
|
+
}
|
|
502
|
+
}), n = q({
|
|
503
|
+
get() {
|
|
504
|
+
return !!x.value;
|
|
505
|
+
},
|
|
506
|
+
set(t) {
|
|
507
|
+
t ? x.value = /* @__PURE__ */ new Date() : x.value = null;
|
|
508
|
+
}
|
|
509
|
+
}), i = q({
|
|
510
|
+
get() {
|
|
511
|
+
return x.value === null ? "" : Xe(x.value);
|
|
512
|
+
},
|
|
513
|
+
set(t) {
|
|
514
|
+
t ? x.value = /* @__PURE__ */ new Date(`${t} ${_.value}`) : x.value = null;
|
|
515
|
+
}
|
|
516
|
+
}), _ = q({
|
|
517
|
+
get() {
|
|
518
|
+
return x.value === null ? "" : Rt(x.value);
|
|
519
|
+
},
|
|
520
|
+
set(t) {
|
|
521
|
+
t ? x.value = /* @__PURE__ */ new Date(`${i.value} ${t}`) : x.value = null;
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
return {
|
|
525
|
+
backdatePo: x,
|
|
526
|
+
backdateSwitch: n,
|
|
527
|
+
backdateModel: i,
|
|
528
|
+
backdateTimeModel: _
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
const As = {
|
|
532
|
+
width: "24",
|
|
533
|
+
height: "24",
|
|
534
|
+
viewBox: "0 0 24 24",
|
|
535
|
+
fill: "none",
|
|
536
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
537
|
+
}, Os = ["fill"], qs = ["fill"], Us = ["stroke"], Ms = ["stroke"], Ns = /* @__PURE__ */ re({
|
|
538
|
+
__name: "SparkIcon",
|
|
539
|
+
props: {
|
|
540
|
+
size: {
|
|
541
|
+
type: Number,
|
|
542
|
+
default: 24
|
|
543
|
+
},
|
|
544
|
+
color: {
|
|
545
|
+
type: String,
|
|
546
|
+
default: "#c7c7cc"
|
|
547
|
+
}
|
|
548
|
+
},
|
|
549
|
+
setup(g) {
|
|
550
|
+
return (x, n) => (k(), T("svg", As, [
|
|
551
|
+
l("path", {
|
|
552
|
+
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",
|
|
553
|
+
fill: g.color
|
|
554
|
+
}, null, 8, Os),
|
|
555
|
+
l("path", {
|
|
556
|
+
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",
|
|
557
|
+
fill: g.color
|
|
558
|
+
}, null, 8, qs),
|
|
559
|
+
l("path", {
|
|
560
|
+
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",
|
|
561
|
+
stroke: g.color,
|
|
562
|
+
"stroke-width": "1.5",
|
|
563
|
+
"stroke-linecap": "round",
|
|
564
|
+
"stroke-linejoin": "round"
|
|
565
|
+
}, null, 8, Us),
|
|
566
|
+
l("path", {
|
|
567
|
+
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",
|
|
568
|
+
stroke: g.color,
|
|
569
|
+
"stroke-width": "1.5",
|
|
570
|
+
"stroke-linecap": "round",
|
|
571
|
+
"stroke-linejoin": "round"
|
|
572
|
+
}, null, 8, Ms)
|
|
573
|
+
]));
|
|
574
|
+
}
|
|
575
|
+
}), zs = { class: "flex gap-8 items-center" }, Bs = { class: "fm-typo-en-body-lg-600 line-clamp-1" }, Ls = { class: "w-[343px] px-24 py-16 rounded-lg shadow-light-300 flex flex-col gap-[20px]" }, Hs = { class: "flex items-center w-full" }, js = { class: "flex-1" }, Ys = { class: "fm-typo-en-title-sm-800" }, Ks = { class: "flex items-start gap-8" }, Qs = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Xs = { class: "flex gap-1" }, mt = /* @__PURE__ */ re({
|
|
576
|
+
__name: "ForecastStock",
|
|
577
|
+
props: {
|
|
578
|
+
disabled: { type: Boolean }
|
|
579
|
+
},
|
|
580
|
+
emits: ["update:poItems"],
|
|
581
|
+
setup(g, { emit: x }) {
|
|
582
|
+
const n = x, i = U(!1), _ = U(7), t = ts(), d = Ve(), C = Le(), { t: $ } = ge();
|
|
583
|
+
async function m() {
|
|
584
|
+
if (_.value < 1)
|
|
585
|
+
return;
|
|
586
|
+
i.value = !1, await t.readPurchaseOrder(_.value);
|
|
587
|
+
const e = [];
|
|
588
|
+
if (t.purchaseOrderForecast.skus.length <= 0) {
|
|
589
|
+
d.open({
|
|
590
|
+
message: $("inventory.transfer.form.items.forecastStock.notAvailable"),
|
|
591
|
+
type: "info"
|
|
592
|
+
});
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
const o = t.purchaseOrderForecast.skus.reduce((p, f) => {
|
|
596
|
+
const v = C.skus.find((F) => F._id === f.id);
|
|
597
|
+
if (p.find((F) => F.sku._id === f.id) || !v)
|
|
598
|
+
return p;
|
|
599
|
+
const h = {
|
|
600
|
+
sku: v,
|
|
601
|
+
code: v.code,
|
|
602
|
+
name: v.name,
|
|
603
|
+
quantity: {
|
|
604
|
+
amount: f.amount,
|
|
605
|
+
precision: 0
|
|
606
|
+
}
|
|
607
|
+
};
|
|
608
|
+
return p.push(h), p;
|
|
609
|
+
}, e);
|
|
610
|
+
n("update:poItems", o);
|
|
611
|
+
}
|
|
612
|
+
return (e, o) => {
|
|
613
|
+
const p = D("FmButton"), f = D("FmIcon"), v = D("FmStepperField"), S = D("FmPopover");
|
|
614
|
+
return k(), K(S, {
|
|
615
|
+
disabled: e.disabled,
|
|
616
|
+
class: "flex",
|
|
617
|
+
"show-popover": i.value,
|
|
618
|
+
onPopoverChanged: o[3] || (o[3] = (h) => i.value = h)
|
|
619
|
+
}, {
|
|
620
|
+
"popover-button": P(() => [
|
|
621
|
+
c(p, {
|
|
622
|
+
label: "unused",
|
|
623
|
+
variant: "secondary",
|
|
624
|
+
"text-color": e.disabled ? "disabled" : "primary",
|
|
625
|
+
"bg-color": "transparent",
|
|
626
|
+
"border-color": e.disabled ? "disabled" : "primary",
|
|
627
|
+
disabled: e.disabled
|
|
628
|
+
}, {
|
|
629
|
+
default: P(() => [
|
|
630
|
+
l("div", zs, [
|
|
631
|
+
c(Ns, {
|
|
632
|
+
size: 24,
|
|
633
|
+
color: e.disabled ? "#c7c7cc" : "#ff7823"
|
|
634
|
+
}, null, 8, ["color"]),
|
|
635
|
+
l("div", Bs, R(s($)("inventory.transfer.form.items.forecastStock.title")), 1)
|
|
636
|
+
])
|
|
637
|
+
]),
|
|
638
|
+
_: 1
|
|
639
|
+
}, 8, ["text-color", "border-color", "disabled"])
|
|
640
|
+
]),
|
|
641
|
+
default: P(() => [
|
|
642
|
+
l("div", Ls, [
|
|
643
|
+
l("div", Hs, [
|
|
644
|
+
l("div", js, [
|
|
645
|
+
c(ps, { "z-index": 99 }, {
|
|
646
|
+
default: P(() => [
|
|
647
|
+
l("p", Ys, R(s($)("inventory.transfer.form.items.forecastStock.title")), 1)
|
|
648
|
+
]),
|
|
649
|
+
_: 1
|
|
650
|
+
})
|
|
651
|
+
]),
|
|
652
|
+
c(p, {
|
|
653
|
+
icon: "close",
|
|
654
|
+
size: "md",
|
|
655
|
+
variant: "tertiary",
|
|
656
|
+
onClick: o[0] || (o[0] = (h) => i.value = !1)
|
|
657
|
+
})
|
|
658
|
+
]),
|
|
659
|
+
c(v, {
|
|
660
|
+
modelValue: _.value,
|
|
661
|
+
"onUpdate:modelValue": o[1] || (o[1] = (h) => _.value = h),
|
|
662
|
+
label: s($)("inventory.transfer.form.items.forecastStock.days"),
|
|
663
|
+
rules: [s(ze)(1)]
|
|
664
|
+
}, {
|
|
665
|
+
"helper-text": P(() => [
|
|
666
|
+
l("div", Ks, [
|
|
667
|
+
c(f, {
|
|
668
|
+
name: "warning",
|
|
669
|
+
size: "sm",
|
|
670
|
+
class: "text-fm-color-system-warning-300"
|
|
671
|
+
}),
|
|
672
|
+
l("div", Qs, R(s($)("inventory.transfer.form.items.forecastStock.replace")), 1)
|
|
673
|
+
])
|
|
674
|
+
]),
|
|
675
|
+
_: 1
|
|
676
|
+
}, 8, ["modelValue", "label", "rules"]),
|
|
677
|
+
l("div", Xs, [
|
|
678
|
+
o[4] || (o[4] = l("div", { class: "grow" }, null, -1)),
|
|
679
|
+
c(p, {
|
|
680
|
+
label: s($)("common.cancel"),
|
|
681
|
+
variant: "tertiary",
|
|
682
|
+
onClick: o[2] || (o[2] = (h) => i.value = !1)
|
|
683
|
+
}, null, 8, ["label"]),
|
|
684
|
+
c(p, {
|
|
685
|
+
label: s($)("inventory.transfer.form.items.forecastStock.generate"),
|
|
686
|
+
onClick: m
|
|
687
|
+
}, null, 8, ["label"])
|
|
688
|
+
])
|
|
689
|
+
])
|
|
690
|
+
]),
|
|
691
|
+
_: 1
|
|
692
|
+
}, 8, ["disabled", "show-popover"]);
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
});
|
|
696
|
+
function Zs() {
|
|
697
|
+
const g = Ve(), x = Ge(), n = U(!1);
|
|
698
|
+
be(n, (d) => {
|
|
699
|
+
d && (_.value = !0, i().finally(() => {
|
|
700
|
+
_.value = !1;
|
|
701
|
+
}));
|
|
702
|
+
});
|
|
703
|
+
async function i() {
|
|
704
|
+
try {
|
|
705
|
+
const { startDate: d, endDate: C } = Et(6), e = (await x.getPurchaseOrders({ start: d, end: C })).filter(
|
|
706
|
+
(o) => {
|
|
707
|
+
var p, f;
|
|
708
|
+
return o.status === At.enum.COMPLETE && ((p = o.supplier) == null ? void 0 : p.internal) !== "warehouse" && ((f = o.supplier) == null ? void 0 : f.internal) !== "restaurant";
|
|
709
|
+
}
|
|
710
|
+
).reduce((o, p) => {
|
|
711
|
+
const f = new Date(Ot(p._id)), v = p.supplier._id;
|
|
712
|
+
for (const S of p.items) {
|
|
713
|
+
if (!S.totalCost) continue;
|
|
714
|
+
const h = o[S.sku._id] ?? {}, F = h[v] ?? [];
|
|
715
|
+
F.push({
|
|
716
|
+
date: f.toISOString(),
|
|
717
|
+
totalUnit: S.quantity,
|
|
718
|
+
totalCost: S.totalCost,
|
|
719
|
+
unit: S.sku.unit,
|
|
720
|
+
measurement: S.measurement,
|
|
721
|
+
seqNumber: p.seqNumber
|
|
722
|
+
}), h[v] = F, o[S.sku._id] = h;
|
|
723
|
+
}
|
|
724
|
+
return o;
|
|
725
|
+
}, {});
|
|
726
|
+
t.value = e;
|
|
727
|
+
} catch {
|
|
728
|
+
g.open({
|
|
729
|
+
title: "Something went wrong",
|
|
730
|
+
message: "Cannot retrieve supplier purchase history. Please try again."
|
|
731
|
+
}), n.value = !1;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
const _ = U(!1), t = U({});
|
|
735
|
+
return {
|
|
736
|
+
comparePricesToggle: n,
|
|
737
|
+
comparePriceFetching: _,
|
|
738
|
+
comparePriceBySku: t
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
const Gs = { class: "fm-typo-body-md-400 line-clamp-2 w-full" }, Ws = { key: 0 }, Js = ["colspan"], ea = /* @__PURE__ */ re({
|
|
742
|
+
__name: "TransferItemTable",
|
|
743
|
+
props: {
|
|
744
|
+
templateItem: {},
|
|
745
|
+
row: {},
|
|
746
|
+
comparePriceBySku: {},
|
|
747
|
+
showComparePrice: { type: Boolean },
|
|
748
|
+
disabled: { type: Boolean }
|
|
749
|
+
},
|
|
750
|
+
emits: ["update:item"],
|
|
751
|
+
setup(g) {
|
|
752
|
+
function x(n) {
|
|
753
|
+
return n.column.columnDef.meta;
|
|
754
|
+
}
|
|
755
|
+
return (n, i) => {
|
|
756
|
+
var _, t;
|
|
757
|
+
return k(), T(ne, null, [
|
|
758
|
+
l("tr", {
|
|
759
|
+
class: Y(["border-b border-fm-color-neutral-gray-100 hover:bg-fm-color-opacity-sm", {
|
|
760
|
+
"bg-fm-color-neutral-gray-100": n.row.getIsSelected()
|
|
761
|
+
}])
|
|
762
|
+
}, [
|
|
763
|
+
(k(!0), T(ne, null, Ie(n.row.getVisibleCells(), (d) => {
|
|
764
|
+
var C, $, m, e;
|
|
765
|
+
return k(), T("td", {
|
|
766
|
+
key: d.id,
|
|
767
|
+
class: Y(["h-[56px] text-fm-color-typo-primary", ((C = x(d)) == null ? void 0 : C.cellClass) ?? "px-16"]),
|
|
768
|
+
style: yt({
|
|
769
|
+
width: ($ = x(d)) == null ? void 0 : $.width,
|
|
770
|
+
maxWidth: (m = x(d)) == null ? void 0 : m.maxWidth,
|
|
771
|
+
textAlign: ((e = x(d)) == null ? void 0 : e.textAlign) ?? "left"
|
|
772
|
+
})
|
|
773
|
+
}, [
|
|
774
|
+
l("span", Gs, [
|
|
775
|
+
c(s(de), {
|
|
776
|
+
render: d.column.columnDef.cell,
|
|
777
|
+
props: d.getContext()
|
|
778
|
+
}, null, 8, ["render", "props"])
|
|
779
|
+
])
|
|
780
|
+
], 6);
|
|
781
|
+
}), 128))
|
|
782
|
+
], 2),
|
|
783
|
+
n.showComparePrice && Object.keys(n.comparePriceBySku[(_ = n.row.original.sku) == null ? void 0 : _._id] ?? {}).length > 0 ? (k(), T("tr", Ws, [
|
|
784
|
+
l("td", {
|
|
785
|
+
colspan: n.row.getVisibleCells().length
|
|
786
|
+
}, [
|
|
787
|
+
c(St, {
|
|
788
|
+
prices: n.comparePriceBySku[(t = n.row.original.sku) == null ? void 0 : t._id]
|
|
789
|
+
}, null, 8, ["prices"])
|
|
790
|
+
], 8, Js)
|
|
791
|
+
])) : B("", !0)
|
|
792
|
+
], 64);
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
}), ta = {
|
|
796
|
+
key: 0,
|
|
797
|
+
class: "flex flex-col gap-8"
|
|
798
|
+
}, sa = { class: "flex flex-col gap-4" }, aa = { class: "flex items-center gap-4" }, oa = {
|
|
799
|
+
key: 0,
|
|
800
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-error"
|
|
801
|
+
}, la = /* @__PURE__ */ re({
|
|
802
|
+
__name: "NetSuiteField",
|
|
803
|
+
props: {
|
|
804
|
+
required: { type: Boolean },
|
|
805
|
+
disabled: { type: Boolean },
|
|
806
|
+
supplier: {},
|
|
807
|
+
setting: {},
|
|
808
|
+
items: {},
|
|
809
|
+
onChange: { type: Function }
|
|
810
|
+
},
|
|
811
|
+
emits: ["netsuite:ready"],
|
|
812
|
+
setup(g, { emit: x }) {
|
|
813
|
+
const n = qe(), i = g, _ = x, { t } = fs(), d = U(!1), C = U();
|
|
814
|
+
Be(() => {
|
|
815
|
+
var o, p, f, v;
|
|
816
|
+
let e = {
|
|
817
|
+
id: "",
|
|
818
|
+
subsidiary: { id: "", name: "" },
|
|
819
|
+
errors: []
|
|
820
|
+
};
|
|
821
|
+
if (!n.isEnabled || !i.required) {
|
|
822
|
+
_("netsuite:ready", e);
|
|
823
|
+
return;
|
|
824
|
+
}
|
|
825
|
+
try {
|
|
826
|
+
const S = n.currentLocationSubsidiary();
|
|
827
|
+
i.setting ? e = {
|
|
828
|
+
...i.setting,
|
|
829
|
+
subsidiary: {
|
|
830
|
+
id: S.id || "",
|
|
831
|
+
name: S.name
|
|
832
|
+
}
|
|
833
|
+
} : e = {
|
|
834
|
+
...e,
|
|
835
|
+
subsidiary: {
|
|
836
|
+
id: S.id || "",
|
|
837
|
+
name: S.name
|
|
838
|
+
}
|
|
839
|
+
};
|
|
840
|
+
const h = n.getAvailableItems(S.id), F = i.items.filter((y) => {
|
|
841
|
+
if (y.measurement != null) {
|
|
842
|
+
const w = n.getAvailableMeasurements(
|
|
843
|
+
y.sku._id,
|
|
844
|
+
S.id
|
|
845
|
+
);
|
|
846
|
+
return h.includes(y.sku._id) && w.includes(y.measurement.id);
|
|
847
|
+
}
|
|
848
|
+
return h.includes(y.sku._id);
|
|
849
|
+
}).map((y) => y.sku._id);
|
|
850
|
+
i.onChange(
|
|
851
|
+
i.items.filter((y) => F.includes(y.sku._id)),
|
|
852
|
+
e
|
|
853
|
+
);
|
|
854
|
+
} finally {
|
|
855
|
+
i.supplier.internal ? C.value = n.getNetSuiteLocation(
|
|
856
|
+
`${i.supplier.internal}_${i.supplier._id}`
|
|
857
|
+
) : C.value = n.getNetSuiteVendor(i.supplier._id);
|
|
858
|
+
const S = i.supplier.internal ? n.getLocationSubsidiary((o = C.value) == null ? void 0 : o.netSuiteId).id : (p = C.value) == null ? void 0 : p.subsidiaryId, h = i.supplier.internal ? (f = n.currentLocationSubsidiary()) == null ? void 0 : f.id : (v = n.currentVendorSubsidiary(i.supplier._id)) == null ? void 0 : v.id;
|
|
859
|
+
!n.isEnabled || S && n.isEnabled && S == h ? _("netsuite:ready", e) : d.value = !0;
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
const $ = q(
|
|
863
|
+
() => i.supplier.internal ? n.currentLocationSubsidiary() : n.currentVendorSubsidiary(i.supplier._id)
|
|
864
|
+
), m = q(() => {
|
|
865
|
+
var e, o;
|
|
866
|
+
return C.value == null ? `Cannot find the NetSuite location for "${i.supplier.name}"` : `The subsidiary of the request
|
|
867
|
+
location is ${(o = n.getLocationSubsidiary((e = C.value) == null ? void 0 : e.netSuiteId)) == null ? void 0 : o.fullName}`;
|
|
868
|
+
});
|
|
869
|
+
return (e, o) => {
|
|
870
|
+
const p = D("FmLabel"), f = D("FmIcon"), v = D("FmField"), S = D("FmTooltip");
|
|
871
|
+
return s(n).isEnabled && i.required ? (k(), T("div", ta, [
|
|
872
|
+
c(p, {
|
|
873
|
+
label: `NetSuite ${s(t)("inventory.transfer.form.netsuite.subsidiary")}`
|
|
874
|
+
}, null, 8, ["label"]),
|
|
875
|
+
l("div", sa, [
|
|
876
|
+
c(S, {
|
|
877
|
+
"z-index": 51,
|
|
878
|
+
placement: "left",
|
|
879
|
+
disabled: e.disabled
|
|
880
|
+
}, {
|
|
881
|
+
content: P(() => o[0] || (o[0] = [
|
|
882
|
+
Te("This field is locked and based on the location of the request.")
|
|
883
|
+
])),
|
|
884
|
+
default: P(() => [
|
|
885
|
+
c(v, null, {
|
|
886
|
+
default: P(() => {
|
|
887
|
+
var h;
|
|
888
|
+
return [
|
|
889
|
+
l("div", aa, [
|
|
890
|
+
c(f, {
|
|
891
|
+
name: "lock_outline",
|
|
892
|
+
size: "sm",
|
|
893
|
+
color: e.disabled ? "neutral-gray-200" : "neutral-gray-400"
|
|
894
|
+
}, null, 8, ["color"]),
|
|
895
|
+
l("div", {
|
|
896
|
+
class: Y([e.disabled ? "text-fm-color-typo-disabled" : ""])
|
|
897
|
+
}, R((h = $.value) == null ? void 0 : h.fullName), 3)
|
|
898
|
+
])
|
|
899
|
+
];
|
|
900
|
+
}),
|
|
901
|
+
_: 1
|
|
902
|
+
})
|
|
903
|
+
]),
|
|
904
|
+
_: 1
|
|
905
|
+
}, 8, ["disabled"]),
|
|
906
|
+
d.value ? (k(), T("div", oa, R(m.value), 1)) : B("", !0)
|
|
907
|
+
])
|
|
908
|
+
])) : B("", !0);
|
|
909
|
+
};
|
|
910
|
+
}
|
|
911
|
+
}), na = { class: "flex flex-col gap-4" }, ra = { class: "flex items-center gap-8 overflow-x-auto pb-12" }, ia = { class: "flex flex-col gap-16" }, ua = { class: "flex flex-col gap-24" }, da = { class: "flex flex-col gap-8" }, ca = { class: "flex flex-col gap-4" }, ma = { class: "flex items-center gap-4" }, pa = { class: "flex flex-col gap-8" }, fa = { class: "flex flex-col gap-4" }, va = { class: "flex items-center gap-4" }, ya = {
|
|
912
|
+
key: 3,
|
|
913
|
+
class: "p-16 border border-fm-color-neutral-gray-300 fm-corner-radius-md flex flex-col"
|
|
914
|
+
}, ba = {
|
|
915
|
+
key: 0,
|
|
916
|
+
class: "flex-1 flex gap-8 h-48 xs:flex-col xs:pt-16 sm:flex-col sm:pt-16"
|
|
917
|
+
}, ga = { class: "flex-1" }, _a = { class: "flex-1" }, ha = {
|
|
918
|
+
key: 1,
|
|
919
|
+
class: "flex items-center gap-4"
|
|
920
|
+
}, ka = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary translate-y-[1px]" }, xa = { class: "flex flex-col gap-16" }, Ca = { class: "flex-1 gap-8 fm-typo-en-title-sm-600" }, Sa = { class: "flex gap-8" }, wa = { key: 0 }, Fa = /* @__PURE__ */ re({
|
|
921
|
+
__name: "TransferForm2",
|
|
922
|
+
props: {
|
|
923
|
+
modelValue: {},
|
|
924
|
+
request: {},
|
|
925
|
+
disabled: { type: Boolean },
|
|
926
|
+
suppliers: {},
|
|
927
|
+
skus: {},
|
|
928
|
+
lastClosingDate: {}
|
|
929
|
+
},
|
|
930
|
+
emits: ["validation-success", "form:ready"],
|
|
931
|
+
setup(g, { expose: x, emit: n }) {
|
|
932
|
+
const i = g, _ = n, t = _t(), { t: d } = ge(), C = Ze(), $ = Le(), m = qe(), e = et(), o = Je(), p = Ct(), { breakpoints: f } = We(), v = q(() => f.value.xs || f.value.sm), S = vt({
|
|
933
|
+
value: !1
|
|
934
|
+
}), h = U(!1), F = q(
|
|
935
|
+
() => {
|
|
936
|
+
var a;
|
|
937
|
+
return ((a = i.modelValue) == null ? void 0 : a.templateDoc) ?? p.templates.find((b) => b._id === t.template);
|
|
938
|
+
}
|
|
939
|
+
), y = q(() => t.status === "DRAFT" || !t._rev);
|
|
940
|
+
be(F, (a) => {
|
|
941
|
+
a && y.value && (t.supplier = (a == null ? void 0 : a.purchaseOrder.supplier) ?? t.supplier);
|
|
942
|
+
}), Be(() => {
|
|
943
|
+
var a;
|
|
944
|
+
try {
|
|
945
|
+
if (t.items = t.items.map((b) => ({ ...b, id: b.id ?? b.sku._id })), !t.template) return;
|
|
946
|
+
t.items.length || (t.items = ((a = F.value) == null ? void 0 : a.purchaseOrder.items) ?? []);
|
|
947
|
+
} finally {
|
|
948
|
+
h.value = !0;
|
|
949
|
+
}
|
|
950
|
+
}), be([h, S], ([a, b], [M, ae]) => {
|
|
951
|
+
b.value && ae.value && _("form:ready");
|
|
952
|
+
});
|
|
953
|
+
const w = q(
|
|
954
|
+
() => C.currentLocation.type === qt.restaurant
|
|
955
|
+
);
|
|
956
|
+
C.watchLocation(async () => {
|
|
957
|
+
location && (t.supplier || (t.supplier = e.suppliers.find((a) => a) ?? t.supplier));
|
|
958
|
+
});
|
|
959
|
+
const L = ns(), H = cs(
|
|
960
|
+
() => t,
|
|
961
|
+
(a) => {
|
|
962
|
+
Object.assign(t, a);
|
|
963
|
+
},
|
|
964
|
+
!0,
|
|
965
|
+
!0
|
|
966
|
+
), N = q({
|
|
967
|
+
get() {
|
|
968
|
+
var a;
|
|
969
|
+
return typeof ((a = t == null ? void 0 : t.supplier) == null ? void 0 : a.internal) == "string" ? se.TRANSFER : se.PURCHASE;
|
|
970
|
+
},
|
|
971
|
+
set(a) {
|
|
972
|
+
var M;
|
|
973
|
+
const b = typeof ((M = t == null ? void 0 : t.supplier) == null ? void 0 : M.internal) == "string" ? se.TRANSFER : se.PURCHASE;
|
|
974
|
+
a !== b && (t.supplier = a === se.PURCHASE ? H.locationOptionsTypePurchase.value[0] : H.locationOptionsTypeTransfer.value[0]);
|
|
975
|
+
}
|
|
976
|
+
});
|
|
977
|
+
be(
|
|
978
|
+
() => {
|
|
979
|
+
var a;
|
|
980
|
+
return (a = i.modelValue) == null ? void 0 : a.template;
|
|
981
|
+
},
|
|
982
|
+
(a) => {
|
|
983
|
+
o.mustUsePoTemplate && !a && wt(() => {
|
|
984
|
+
var b, M;
|
|
985
|
+
t.supplier = ((M = (b = H.locationOptionsTypeTransfer.value) == null ? void 0 : b.filter(
|
|
986
|
+
(ae) => ae.internal === "restaurant"
|
|
987
|
+
)) == null ? void 0 : M[0]) ?? t.supplier;
|
|
988
|
+
});
|
|
989
|
+
},
|
|
990
|
+
{ immediate: !0 }
|
|
991
|
+
);
|
|
992
|
+
const Q = q(() => {
|
|
993
|
+
let a = H.transferLocationOptions.value;
|
|
994
|
+
return o.mustUsePoTemplate && !t.template && (a = a.filter((b) => {
|
|
995
|
+
var M;
|
|
996
|
+
return (M = b.sublabel) == null ? void 0 : M.startsWith("restaurant");
|
|
997
|
+
})), a;
|
|
998
|
+
}), Z = q({
|
|
999
|
+
get() {
|
|
1000
|
+
return t.supplier._id;
|
|
1001
|
+
},
|
|
1002
|
+
set(a) {
|
|
1003
|
+
H.transferLocationModel.value = a;
|
|
1004
|
+
}
|
|
1005
|
+
}), A = q({
|
|
1006
|
+
get() {
|
|
1007
|
+
return t.remark ?? void 0;
|
|
1008
|
+
},
|
|
1009
|
+
set(a) {
|
|
1010
|
+
t.remark = a;
|
|
1011
|
+
}
|
|
1012
|
+
}), { backdatePo: E, backdateSwitch: V, backdateModel: r, backdateTimeModel: u } = Es({
|
|
1013
|
+
getEffectiveAt() {
|
|
1014
|
+
return t.effectiveAt;
|
|
1015
|
+
},
|
|
1016
|
+
setEffectiveAt(a) {
|
|
1017
|
+
t.effectiveAt = a;
|
|
1018
|
+
}
|
|
1019
|
+
}), { comparePricesToggle: O, comparePriceFetching: oe, comparePriceBySku: G } = Zs(), ce = U();
|
|
1020
|
+
x({
|
|
1021
|
+
validateInputs: () => {
|
|
1022
|
+
var a, b;
|
|
1023
|
+
(b = (a = ce.value) == null ? void 0 : a.validateInputs) == null || b.call(a);
|
|
1024
|
+
},
|
|
1025
|
+
resetInputsValidation: () => {
|
|
1026
|
+
var a, b;
|
|
1027
|
+
(b = (a = ce.value) == null ? void 0 : a.resetInputsValidation) == null || b.call(a);
|
|
1028
|
+
},
|
|
1029
|
+
resetInputs: () => {
|
|
1030
|
+
var a, b;
|
|
1031
|
+
(b = (a = ce.value) == null ? void 0 : a.resetInputs) == null || b.call(a);
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1034
|
+
const ie = q(() => ({
|
|
1035
|
+
updateItem: (a) => {
|
|
1036
|
+
const b = Ut.parse(a);
|
|
1037
|
+
t.items = t.items.map((M) => M.id && M.id !== a.id || !M.id && M.sku._id !== a.sku._id ? M : b);
|
|
1038
|
+
},
|
|
1039
|
+
deleteItem: (a) => {
|
|
1040
|
+
t.items = t.items.filter(
|
|
1041
|
+
(b) => b.id ? b.id !== a.id : b.sku._id !== a.sku._id
|
|
1042
|
+
);
|
|
1043
|
+
}
|
|
1044
|
+
})), ke = ys({
|
|
1045
|
+
updateItem: (a) => ie.value.updateItem(a),
|
|
1046
|
+
deleteItem: (a) => ie.value.deleteItem(a),
|
|
1047
|
+
get supplier() {
|
|
1048
|
+
return t.supplier;
|
|
1049
|
+
},
|
|
1050
|
+
get items() {
|
|
1051
|
+
return t.items;
|
|
1052
|
+
},
|
|
1053
|
+
get transferType() {
|
|
1054
|
+
return N.value;
|
|
1055
|
+
},
|
|
1056
|
+
get template() {
|
|
1057
|
+
return F.value;
|
|
1058
|
+
},
|
|
1059
|
+
get disabled() {
|
|
1060
|
+
return i.disabled;
|
|
1061
|
+
}
|
|
1062
|
+
}), Ue = q(() => ke.columnDefs.value);
|
|
1063
|
+
function Me() {
|
|
1064
|
+
var pe, _e, fe, Ce, Se;
|
|
1065
|
+
const a = (fe = (_e = (pe = F.value) == null ? void 0 : pe.purchaseOrder) == null ? void 0 : _e.items) == null ? void 0 : fe.groupBy((z) => z.sku._id), b = m.isEnabled ? m.getAvailableItems((Se = (Ce = t.netSuite) == null ? void 0 : Ce.subsidiary) == null ? void 0 : Se.id) : [], M = a != null && a.size ? $.skus.filter((z) => a.has(z._id)) : $.skus, ae = m.isEnabled ? M.filter((z) => {
|
|
1066
|
+
var te, J, le, ue;
|
|
1067
|
+
const W = (J = (te = F.value) == null ? void 0 : te.purchaseOrder) == null ? void 0 : J.items.find(
|
|
1068
|
+
(ve) => ve.sku._id === z._id
|
|
1069
|
+
);
|
|
1070
|
+
if (W != null && W.measurement != null) {
|
|
1071
|
+
const ve = m.getAvailableMeasurements(
|
|
1072
|
+
W.sku._id,
|
|
1073
|
+
(ue = (le = t.netSuite) == null ? void 0 : le.subsidiary) == null ? void 0 : ue.id
|
|
1074
|
+
);
|
|
1075
|
+
return b.includes(W.sku._id) && ve.includes(W.measurement.id);
|
|
1076
|
+
}
|
|
1077
|
+
return b.includes(z._id);
|
|
1078
|
+
}).map((z) => z._id) : M.map((z) => z._id), me = M.map(
|
|
1079
|
+
(z) => {
|
|
1080
|
+
var W, te, J, le;
|
|
1081
|
+
return {
|
|
1082
|
+
label: ((te = (W = a == null ? void 0 : a.get(z._id)) == null ? void 0 : W[0]) == null ? void 0 : te.name) ?? z.name,
|
|
1083
|
+
sublabel: ((le = (J = a == null ? void 0 : a.get(z._id)) == null ? void 0 : J[0]) == null ? void 0 : le.code) ?? z.code,
|
|
1084
|
+
value: z,
|
|
1085
|
+
disabled: !ae.includes(z._id)
|
|
1086
|
+
};
|
|
1087
|
+
}
|
|
1088
|
+
), xe = me.filter((z) => {
|
|
1089
|
+
var W;
|
|
1090
|
+
return (W = t.items) == null ? void 0 : W.find((te) => te.sku._id === z.value._id);
|
|
1091
|
+
}).map((z) => z.value);
|
|
1092
|
+
L.open({
|
|
1093
|
+
title: d("inventory.transfer.form.items.selectItem"),
|
|
1094
|
+
closeButton: !0,
|
|
1095
|
+
contentComponent: Bt,
|
|
1096
|
+
contentComponentProps: {
|
|
1097
|
+
modelValue: xe,
|
|
1098
|
+
items: me,
|
|
1099
|
+
virtualScroll: !0
|
|
1100
|
+
},
|
|
1101
|
+
primaryActions: {
|
|
1102
|
+
text: d("common.confirm"),
|
|
1103
|
+
close: !0
|
|
1104
|
+
},
|
|
1105
|
+
secondaryActions: {
|
|
1106
|
+
text: d("common.close"),
|
|
1107
|
+
close: !0,
|
|
1108
|
+
variant: "tertiary"
|
|
1109
|
+
}
|
|
1110
|
+
}).onPrimary((z) => {
|
|
1111
|
+
const W = t.items ?? [], te = z.map((J) => {
|
|
1112
|
+
var ve, Re;
|
|
1113
|
+
const le = W.find((we) => we.sku._id === J._id);
|
|
1114
|
+
if (le)
|
|
1115
|
+
return le;
|
|
1116
|
+
const ue = ((Re = (ve = F.value) == null ? void 0 : ve.purchaseOrder.items) == null ? void 0 : Re.find(
|
|
1117
|
+
(we) => we.sku._id === J._id
|
|
1118
|
+
)) ?? {
|
|
1119
|
+
sku: J,
|
|
1120
|
+
code: J.code,
|
|
1121
|
+
name: J.name,
|
|
1122
|
+
quantity: {
|
|
1123
|
+
amount: 1,
|
|
1124
|
+
precision: 0
|
|
1125
|
+
}
|
|
1126
|
+
};
|
|
1127
|
+
return N.value == se.PURCHASE && (ue.totalCost = he(
|
|
1128
|
+
ue.sku,
|
|
1129
|
+
ue.quantity,
|
|
1130
|
+
ue.measurement,
|
|
1131
|
+
{
|
|
1132
|
+
supplier: t.supplier
|
|
1133
|
+
}
|
|
1134
|
+
)), ue;
|
|
1135
|
+
});
|
|
1136
|
+
te.sort((J, le) => J.sku.code.localeCompare(le.sku.code)), t.items = te;
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1139
|
+
function He(a) {
|
|
1140
|
+
return a;
|
|
1141
|
+
}
|
|
1142
|
+
const De = q(() => {
|
|
1143
|
+
const a = [];
|
|
1144
|
+
return (!o.mustUsePoTemplate || o.mustUsePoTemplate && t.template) && a.push({
|
|
1145
|
+
label: d("inventory.transfer.form.type.purchase"),
|
|
1146
|
+
value: se.PURCHASE
|
|
1147
|
+
}), a.push({
|
|
1148
|
+
label: d("inventory.transfer.form.type.transfer"),
|
|
1149
|
+
value: se.TRANSFER
|
|
1150
|
+
}), a;
|
|
1151
|
+
}), Pe = q(() => {
|
|
1152
|
+
var a;
|
|
1153
|
+
return (a = i.modelValue) == null ? void 0 : a.items.every((b) => b.quantity.amount <= 0);
|
|
1154
|
+
});
|
|
1155
|
+
return (a, b) => {
|
|
1156
|
+
var ve, Re;
|
|
1157
|
+
const M = D("FmChip"), ae = D("FmLabel"), me = D("FmIcon"), xe = D("FmField"), pe = D("FmTooltip"), _e = D("FmSelect"), fe = D("FmTextField"), Ce = D("FmTextarea"), Se = D("FmSwitch"), z = D("FmDatePicker"), W = D("FmTimePicker"), te = D("FmFormGroup"), J = D("FmButton"), le = D("FmTable"), ue = D("FmForm");
|
|
1158
|
+
return k(), T("div", na, [
|
|
1159
|
+
l("div", ra, [
|
|
1160
|
+
(ve = i.modelValue) != null && ve.template ? (k(), K(M, {
|
|
1161
|
+
key: 0,
|
|
1162
|
+
variant: a.disabled ? "warning" : void 0,
|
|
1163
|
+
label: `${s(d)("inventory.transfer.template.title")}: ${((Re = F.value) == null ? void 0 : Re.name) ?? s(d)("inventory.transfer.form.loading")}`,
|
|
1164
|
+
icon: "summarize",
|
|
1165
|
+
compact: ""
|
|
1166
|
+
}, null, 8, ["variant", "label"])) : B("", !0),
|
|
1167
|
+
c(M, {
|
|
1168
|
+
label: s(C).currentLocation.name,
|
|
1169
|
+
icon: "storefront",
|
|
1170
|
+
compact: ""
|
|
1171
|
+
}, null, 8, ["label"]),
|
|
1172
|
+
a.lastClosingDate ? (k(), K(M, {
|
|
1173
|
+
key: 1,
|
|
1174
|
+
label: `${s(d)("inventory.transfer.form.lastClosing")}: ${s(Xe)(a.lastClosingDate)} ${s(Mt)(a.lastClosingDate)}`,
|
|
1175
|
+
icon: "calendar_month",
|
|
1176
|
+
compact: ""
|
|
1177
|
+
}, null, 8, ["label"])) : B("", !0)
|
|
1178
|
+
]),
|
|
1179
|
+
c(ue, {
|
|
1180
|
+
ref_key: "formRef",
|
|
1181
|
+
ref: ce,
|
|
1182
|
+
class: "flex flex-col gap-32",
|
|
1183
|
+
disabled: a.disabled,
|
|
1184
|
+
onValidationFailed: console.log,
|
|
1185
|
+
onValidationSuccess: b[14] || (b[14] = (we) => _("validation-success"))
|
|
1186
|
+
}, {
|
|
1187
|
+
default: P(() => {
|
|
1188
|
+
var we, tt, st, at, ot, lt, nt, rt;
|
|
1189
|
+
return [
|
|
1190
|
+
l("div", ia, [
|
|
1191
|
+
l("div", ua, [
|
|
1192
|
+
(we = i.modelValue) != null && we.template ? (k(), T(ne, { key: 0 }, [
|
|
1193
|
+
l("div", da, [
|
|
1194
|
+
c(ae, {
|
|
1195
|
+
label: s(d)("inventory.transfer.form.type.title")
|
|
1196
|
+
}, null, 8, ["label"]),
|
|
1197
|
+
l("div", ca, [
|
|
1198
|
+
c(pe, {
|
|
1199
|
+
"z-index": 51,
|
|
1200
|
+
placement: "left",
|
|
1201
|
+
disabled: a.disabled
|
|
1202
|
+
}, {
|
|
1203
|
+
content: P(() => b[15] || (b[15] = [
|
|
1204
|
+
Te("This field is locked from template.")
|
|
1205
|
+
])),
|
|
1206
|
+
default: P(() => [
|
|
1207
|
+
c(xe, null, {
|
|
1208
|
+
default: P(() => [
|
|
1209
|
+
l("div", ma, [
|
|
1210
|
+
c(me, {
|
|
1211
|
+
name: "lock_outline",
|
|
1212
|
+
size: "sm",
|
|
1213
|
+
color: a.disabled ? "neutral-gray-200" : "neutral-gray-400"
|
|
1214
|
+
}, null, 8, ["color"]),
|
|
1215
|
+
l("div", {
|
|
1216
|
+
class: Y({ "text-fm-color-typo-disabled": a.disabled })
|
|
1217
|
+
}, R(s(d)(`inventory.transfer.form.type.${N.value.toLocaleLowerCase("en-us")}`)), 3)
|
|
1218
|
+
])
|
|
1219
|
+
]),
|
|
1220
|
+
_: 1
|
|
1221
|
+
})
|
|
1222
|
+
]),
|
|
1223
|
+
_: 1
|
|
1224
|
+
}, 8, ["disabled"]),
|
|
1225
|
+
l("div", {
|
|
1226
|
+
class: Y([
|
|
1227
|
+
"fm-typo-en-body-sm-400",
|
|
1228
|
+
a.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"
|
|
1229
|
+
])
|
|
1230
|
+
}, null, 2)
|
|
1231
|
+
])
|
|
1232
|
+
]),
|
|
1233
|
+
l("div", pa, [
|
|
1234
|
+
c(ae, {
|
|
1235
|
+
label: N.value === s(se).PURCHASE ? s(d)("inventory.transfer.form.purchaseFrom") : s(d)("inventory.transfer.form.transferFrom")
|
|
1236
|
+
}, null, 8, ["label"]),
|
|
1237
|
+
l("div", fa, [
|
|
1238
|
+
c(pe, {
|
|
1239
|
+
"z-index": 51,
|
|
1240
|
+
placement: "left",
|
|
1241
|
+
disabled: a.disabled
|
|
1242
|
+
}, {
|
|
1243
|
+
content: P(() => b[16] || (b[16] = [
|
|
1244
|
+
Te("This field is locked from template.")
|
|
1245
|
+
])),
|
|
1246
|
+
default: P(() => [
|
|
1247
|
+
c(xe, null, {
|
|
1248
|
+
default: P(() => {
|
|
1249
|
+
var I;
|
|
1250
|
+
return [
|
|
1251
|
+
l("div", va, [
|
|
1252
|
+
c(me, {
|
|
1253
|
+
name: "lock_outline",
|
|
1254
|
+
size: "sm",
|
|
1255
|
+
color: a.disabled ? "neutral-gray-200" : "neutral-gray-400"
|
|
1256
|
+
}, null, 8, ["color"]),
|
|
1257
|
+
l("div", {
|
|
1258
|
+
class: Y({ "text-fm-color-typo-disabled": a.disabled })
|
|
1259
|
+
}, R((I = Q.value.find((ee) => ee.value === Z.value)) == null ? void 0 : I.label), 3)
|
|
1260
|
+
])
|
|
1261
|
+
];
|
|
1262
|
+
}),
|
|
1263
|
+
_: 1
|
|
1264
|
+
})
|
|
1265
|
+
]),
|
|
1266
|
+
_: 1
|
|
1267
|
+
}, 8, ["disabled"])
|
|
1268
|
+
])
|
|
1269
|
+
])
|
|
1270
|
+
], 64)) : (k(), T(ne, { key: 1 }, [
|
|
1271
|
+
c(_e, {
|
|
1272
|
+
label: s(d)("inventory.transfer.form.type.title"),
|
|
1273
|
+
"label-mark": "required",
|
|
1274
|
+
modelValue: N.value,
|
|
1275
|
+
"onUpdate:modelValue": b[0] || (b[0] = (I) => N.value = I),
|
|
1276
|
+
items: De.value,
|
|
1277
|
+
rules: [s(ze)(1)(Q.value)]
|
|
1278
|
+
}, {
|
|
1279
|
+
default: P(() => [
|
|
1280
|
+
l("span", {
|
|
1281
|
+
class: Y([
|
|
1282
|
+
"line-clamp-1 fm-typo-en-body-lg-400",
|
|
1283
|
+
a.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
|
|
1284
|
+
])
|
|
1285
|
+
}, R(s(Nt)(N.value)), 3)
|
|
1286
|
+
]),
|
|
1287
|
+
_: 1
|
|
1288
|
+
}, 8, ["label", "modelValue", "items", "rules"]),
|
|
1289
|
+
c(_e, {
|
|
1290
|
+
label: N.value === s(se).PURCHASE ? s(d)("inventory.transfer.form.purchaseFrom") : s(d)("inventory.transfer.form.transferFrom"),
|
|
1291
|
+
"label-mark": "required",
|
|
1292
|
+
modelValue: Z.value,
|
|
1293
|
+
"onUpdate:modelValue": b[1] || (b[1] = (I) => Z.value = I),
|
|
1294
|
+
items: Q.value
|
|
1295
|
+
}, {
|
|
1296
|
+
"menu-wrapper": P((I) => {
|
|
1297
|
+
var ee, Ee;
|
|
1298
|
+
return [
|
|
1299
|
+
c(ms, Ke(I, {
|
|
1300
|
+
items: Q.value,
|
|
1301
|
+
"model-value": (Ee = (ee = a.modelValue) == null ? void 0 : ee.supplier) == null ? void 0 : Ee._id
|
|
1302
|
+
}), null, 16, ["items", "model-value"])
|
|
1303
|
+
];
|
|
1304
|
+
}),
|
|
1305
|
+
default: P(() => {
|
|
1306
|
+
var I;
|
|
1307
|
+
return [
|
|
1308
|
+
l("span", {
|
|
1309
|
+
class: Y([
|
|
1310
|
+
"line-clamp-1 fm-typo-en-body-lg-400",
|
|
1311
|
+
a.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
|
|
1312
|
+
])
|
|
1313
|
+
}, R((I = Q.value.find((ee) => ee.value === Z.value)) == null ? void 0 : I.label), 3)
|
|
1314
|
+
];
|
|
1315
|
+
}),
|
|
1316
|
+
_: 1
|
|
1317
|
+
}, 8, ["label", "modelValue", "items"])
|
|
1318
|
+
], 64)),
|
|
1319
|
+
c(fe, {
|
|
1320
|
+
label: s(d)("inventory.transfer.form.reference"),
|
|
1321
|
+
"label-mark": "optional",
|
|
1322
|
+
modelValue: s(t).ref,
|
|
1323
|
+
"onUpdate:modelValue": b[2] || (b[2] = (I) => s(t).ref = I)
|
|
1324
|
+
}, null, 8, ["label", "modelValue"]),
|
|
1325
|
+
c(Ce, {
|
|
1326
|
+
label: s(d)("inventory.transfer.form.remark"),
|
|
1327
|
+
"label-mark": "optional",
|
|
1328
|
+
"max-length": 240,
|
|
1329
|
+
modelValue: A.value,
|
|
1330
|
+
"onUpdate:modelValue": b[3] || (b[3] = (I) => A.value = I),
|
|
1331
|
+
class: Y([a.disabled ? "text-fm-color-typo-disabled " : ""])
|
|
1332
|
+
}, null, 8, ["label", "modelValue", "class"]),
|
|
1333
|
+
h.value ? (k(), K(la, {
|
|
1334
|
+
key: 2,
|
|
1335
|
+
required: s(t).template != null,
|
|
1336
|
+
disabled: a.disabled,
|
|
1337
|
+
supplier: s(t).supplier,
|
|
1338
|
+
setting: s(t).netSuite,
|
|
1339
|
+
items: s(t).items,
|
|
1340
|
+
onChange: (I, ee) => {
|
|
1341
|
+
s(t).items = I, s(t).netSuite = ee;
|
|
1342
|
+
},
|
|
1343
|
+
"onNetsuite:ready": b[4] || (b[4] = (I) => {
|
|
1344
|
+
S.value = !0;
|
|
1345
|
+
})
|
|
1346
|
+
}, null, 8, ["required", "disabled", "supplier", "setting", "items", "onChange"])) : B("", !0),
|
|
1347
|
+
s(o).enableBackdatePo ? (k(), T("div", ya, [
|
|
1348
|
+
l("div", {
|
|
1349
|
+
class: Y([
|
|
1350
|
+
"flex",
|
|
1351
|
+
{
|
|
1352
|
+
"flex-col": v.value
|
|
1353
|
+
}
|
|
1354
|
+
])
|
|
1355
|
+
}, [
|
|
1356
|
+
c(Se, {
|
|
1357
|
+
modelValue: s(V),
|
|
1358
|
+
"onUpdate:modelValue": b[5] || (b[5] = (I) => Fe(V) ? V.value = I : null),
|
|
1359
|
+
label: s(d)("inventory.transfer.form.backdate.title"),
|
|
1360
|
+
sublabel: s(d)("inventory.transfer.form.backdate.subtitle"),
|
|
1361
|
+
"label-placement": "right",
|
|
1362
|
+
disabled: w.value && !a.lastClosingDate || a.disabled
|
|
1363
|
+
}, null, 8, ["modelValue", "label", "sublabel", "disabled"]),
|
|
1364
|
+
l("div", {
|
|
1365
|
+
class: Y({ hidden: v.value, "w-16": !v.value })
|
|
1366
|
+
}, null, 2),
|
|
1367
|
+
s(V) ? (k(), T("div", ba, [
|
|
1368
|
+
l("div", ga, [
|
|
1369
|
+
c(z, {
|
|
1370
|
+
modelValue: s(r),
|
|
1371
|
+
"onUpdate:modelValue": b[6] || (b[6] = (I) => Fe(r) ? r.value = I : null)
|
|
1372
|
+
}, null, 8, ["modelValue"])
|
|
1373
|
+
]),
|
|
1374
|
+
l("div", _a, [
|
|
1375
|
+
c(W, {
|
|
1376
|
+
modelValue: s(u),
|
|
1377
|
+
"onUpdate:modelValue": b[7] || (b[7] = (I) => Fe(u) ? u.value = I : null)
|
|
1378
|
+
}, null, 8, ["modelValue"])
|
|
1379
|
+
])
|
|
1380
|
+
])) : B("", !0)
|
|
1381
|
+
], 2),
|
|
1382
|
+
s(E) ? (k(), K(te, {
|
|
1383
|
+
key: 0,
|
|
1384
|
+
modelValue: s(E),
|
|
1385
|
+
"onUpdate:modelValue": b[8] || (b[8] = (I) => Fe(E) ? E.value = I : null),
|
|
1386
|
+
rules: [s(zt)(new Date(a.lastClosingDate), /* @__PURE__ */ new Date())]
|
|
1387
|
+
}, null, 8, ["modelValue", "rules"])) : B("", !0),
|
|
1388
|
+
w.value && !a.lastClosingDate ? (k(), T("div", ha, [
|
|
1389
|
+
c(me, {
|
|
1390
|
+
name: "error",
|
|
1391
|
+
size: "sm",
|
|
1392
|
+
class: "text-fm-color-typo-warning"
|
|
1393
|
+
}),
|
|
1394
|
+
l("span", ka, R(s(d)("inventory.transfer.form.backdate.error")), 1)
|
|
1395
|
+
])) : B("", !0)
|
|
1396
|
+
])) : B("", !0)
|
|
1397
|
+
])
|
|
1398
|
+
]),
|
|
1399
|
+
l("div", xa, [
|
|
1400
|
+
c(te, {
|
|
1401
|
+
"model-value": s(t).items,
|
|
1402
|
+
rules: [s(ze)(1)]
|
|
1403
|
+
}, null, 8, ["model-value", "rules"]),
|
|
1404
|
+
l("div", {
|
|
1405
|
+
class: Y([
|
|
1406
|
+
"flex gap-16",
|
|
1407
|
+
{
|
|
1408
|
+
"flex-col items-start": v.value,
|
|
1409
|
+
"items-center": !v.value
|
|
1410
|
+
}
|
|
1411
|
+
])
|
|
1412
|
+
}, [
|
|
1413
|
+
l("div", Ca, R(s(d)("inventory.transfer.form.items.title")), 1),
|
|
1414
|
+
l("div", Sa, [
|
|
1415
|
+
c(J, {
|
|
1416
|
+
disabled: a.disabled,
|
|
1417
|
+
label: s(d)("inventory.transfer.form.items.addItem"),
|
|
1418
|
+
"prepend-icon": "add",
|
|
1419
|
+
variant: "secondary",
|
|
1420
|
+
"text-color": "primary",
|
|
1421
|
+
"bg-color": "transparent",
|
|
1422
|
+
"border-color": "primary",
|
|
1423
|
+
onClick: b[9] || (b[9] = (I) => Me()),
|
|
1424
|
+
size: "md"
|
|
1425
|
+
}, null, 8, ["disabled", "label"]),
|
|
1426
|
+
s(t).template ? (k(), K(pe, {
|
|
1427
|
+
key: 0,
|
|
1428
|
+
"z-index": 50
|
|
1429
|
+
}, {
|
|
1430
|
+
content: P(() => [
|
|
1431
|
+
l("div", null, R(s(d)("inventory.transfer.form.items.forecastStock.notAvailable")), 1)
|
|
1432
|
+
]),
|
|
1433
|
+
default: P(() => [
|
|
1434
|
+
c(mt, {
|
|
1435
|
+
"onUpdate:poItems": b[10] || (b[10] = (I) => s(t).items = I),
|
|
1436
|
+
disabled: ""
|
|
1437
|
+
})
|
|
1438
|
+
]),
|
|
1439
|
+
_: 1
|
|
1440
|
+
})) : (k(), K(mt, {
|
|
1441
|
+
key: 1,
|
|
1442
|
+
"onUpdate:poItems": b[11] || (b[11] = (I) => s(t).items = I),
|
|
1443
|
+
disabled: a.disabled || !!s(t).template
|
|
1444
|
+
}, null, 8, ["disabled"]))
|
|
1445
|
+
])
|
|
1446
|
+
], 2),
|
|
1447
|
+
N.value === s(se).PURCHASE && y.value && s(o).enableTotalCost && ((tt = a.modelValue) != null && tt.items.length) ? (k(), T("div", wa, [
|
|
1448
|
+
c(Se, {
|
|
1449
|
+
label: s(oe) ? s(d)("inventory.transfer.form.items.fetchingData") : s(d)("inventory.transfer.form.items.comparePriceHistory"),
|
|
1450
|
+
"prepend-icon": "compare_arrows",
|
|
1451
|
+
"label-placement": "right",
|
|
1452
|
+
"model-value": s(O),
|
|
1453
|
+
"onUpdate:modelValue": b[12] || (b[12] = (I) => Fe(O) ? O.value = I : null),
|
|
1454
|
+
disabled: s(oe) || a.disabled
|
|
1455
|
+
}, null, 8, ["label", "model-value", "disabled"])
|
|
1456
|
+
])) : B("", !0),
|
|
1457
|
+
c(te, {
|
|
1458
|
+
"model-value": Pe.value,
|
|
1459
|
+
rules: [() => Pe.value ? "Must have at least one non-zero item" : !0]
|
|
1460
|
+
}, null, 8, ["model-value", "rules"]),
|
|
1461
|
+
(k(), K(le, {
|
|
1462
|
+
"column-defs": Ue.value,
|
|
1463
|
+
"column-visibility": {
|
|
1464
|
+
[s(X).Code]: !(((st = a.modelValue) == null ? void 0 : st.template) ?? ((at = a.modelValue) == null ? void 0 : at.templateDoc)),
|
|
1465
|
+
[s(X).Name]: !(((ot = a.modelValue) == null ? void 0 : ot.template) ?? ((lt = a.modelValue) == null ? void 0 : lt.templateDoc)),
|
|
1466
|
+
[s(X).TemplateName]: !!(((nt = a.modelValue) == null ? void 0 : nt.template) ?? ((rt = a.modelValue) == null ? void 0 : rt.templateDoc))
|
|
1467
|
+
},
|
|
1468
|
+
"row-data": s(t).items,
|
|
1469
|
+
key: s(t).items.map((I) => I.sku._id).join("."),
|
|
1470
|
+
"hide-footer": "",
|
|
1471
|
+
"page-size": s(t).items.length
|
|
1472
|
+
}, {
|
|
1473
|
+
"table-row": P((I) => {
|
|
1474
|
+
var ee, Ee, it, ut;
|
|
1475
|
+
return [
|
|
1476
|
+
c(ea, {
|
|
1477
|
+
"compare-price-by-sku": s(G),
|
|
1478
|
+
"show-compare-price": N.value === s(se).PURCHASE && s(O),
|
|
1479
|
+
row: I,
|
|
1480
|
+
"template-item": (ut = (it = (Ee = (ee = a.modelValue) == null ? void 0 : ee.templateDoc) == null ? void 0 : Ee.purchaseOrder) == null ? void 0 : it.items) == null ? void 0 : ut.find(
|
|
1481
|
+
(je) => je.sku._id === I.original.sku._id
|
|
1482
|
+
),
|
|
1483
|
+
"onUpdate:item": b[13] || (b[13] = (je) => ie.value.updateItem(je)),
|
|
1484
|
+
disabled: a.disabled
|
|
1485
|
+
}, null, 8, ["compare-price-by-sku", "show-compare-price", "row", "template-item", "disabled"])
|
|
1486
|
+
];
|
|
1487
|
+
}),
|
|
1488
|
+
"list-row": P((I) => [
|
|
1489
|
+
(k(), K(ht, {
|
|
1490
|
+
row: I,
|
|
1491
|
+
key: s(t).items.map((ee) => ee.sku._id).join(".")
|
|
1492
|
+
}, {
|
|
1493
|
+
default: P((ee) => [
|
|
1494
|
+
c(Rs, {
|
|
1495
|
+
"compare-price-by-sku": s(G),
|
|
1496
|
+
"show-compare-price": N.value === s(se).PURCHASE && s(O),
|
|
1497
|
+
row: I,
|
|
1498
|
+
"cell-by-col-id": ee
|
|
1499
|
+
}, null, 8, ["compare-price-by-sku", "show-compare-price", "row", "cell-by-col-id"])
|
|
1500
|
+
]),
|
|
1501
|
+
_: 2
|
|
1502
|
+
}, 1032, ["row"]))
|
|
1503
|
+
]),
|
|
1504
|
+
_: 1
|
|
1505
|
+
}, 8, ["column-defs", "column-visibility", "row-data", "page-size"]))
|
|
1506
|
+
])
|
|
1507
|
+
];
|
|
1508
|
+
}),
|
|
1509
|
+
_: 1
|
|
1510
|
+
}, 8, ["disabled", "onValidationFailed"])
|
|
1511
|
+
]);
|
|
1512
|
+
};
|
|
1513
|
+
}
|
|
1514
|
+
}), $a = { class: "flex items-center" }, Ia = { class: "fm-typo-en-title-md-800" }, Da = { class: "flex gap-4" }, Ta = /* @__PURE__ */ re({
|
|
1515
|
+
__name: "TransferDialog",
|
|
1516
|
+
props: {
|
|
1517
|
+
mode: {},
|
|
1518
|
+
modelValue: {},
|
|
1519
|
+
templateId: {},
|
|
1520
|
+
show: { type: Boolean },
|
|
1521
|
+
lastClosingDate: {}
|
|
1522
|
+
},
|
|
1523
|
+
emits: ["update:show", "submitted"],
|
|
1524
|
+
setup(g, { expose: x, emit: n }) {
|
|
1525
|
+
var V;
|
|
1526
|
+
const i = g, _ = n, t = Ge(), d = Ct(), C = Ve(), $ = et(), m = Le(), e = Ze(), { t: o } = ge(), p = U(!1), f = U(!1), v = U(!1);
|
|
1527
|
+
async function S(r) {
|
|
1528
|
+
if (r) {
|
|
1529
|
+
f.value = !1;
|
|
1530
|
+
try {
|
|
1531
|
+
await $.readSuppliers(), f.value = !0;
|
|
1532
|
+
} catch {
|
|
1533
|
+
C.open({
|
|
1534
|
+
title: o("inventory.transfer.form.unableToFetchListOfSuppliers.title"),
|
|
1535
|
+
message: o("inventory.transfer.form.unableToFetchListOfSuppliers.message"),
|
|
1536
|
+
type: "error"
|
|
1537
|
+
});
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
e.watchLocation(S);
|
|
1542
|
+
function h() {
|
|
1543
|
+
return {
|
|
1544
|
+
remark: void 0,
|
|
1545
|
+
ref: void 0,
|
|
1546
|
+
stockSnapshotId: void 0,
|
|
1547
|
+
effectiveAt: void 0,
|
|
1548
|
+
items: [],
|
|
1549
|
+
supplier: {
|
|
1550
|
+
_rev: void 0,
|
|
1551
|
+
email: void 0,
|
|
1552
|
+
internal: void 0,
|
|
1553
|
+
contactName: void 0,
|
|
1554
|
+
phoneNumber: void 0,
|
|
1555
|
+
registrationNumber: void 0,
|
|
1556
|
+
supplyItems: void 0,
|
|
1557
|
+
_id: "",
|
|
1558
|
+
name: "",
|
|
1559
|
+
address: {
|
|
1560
|
+
line2: void 0,
|
|
1561
|
+
line1: "",
|
|
1562
|
+
state: "",
|
|
1563
|
+
city: "",
|
|
1564
|
+
postcode: "",
|
|
1565
|
+
country: ""
|
|
1566
|
+
}
|
|
1567
|
+
},
|
|
1568
|
+
status: "DRAFT",
|
|
1569
|
+
_id: "",
|
|
1570
|
+
seqNumber: 0,
|
|
1571
|
+
deliveryOrder: [],
|
|
1572
|
+
template: i.templateId,
|
|
1573
|
+
templateDoc: d.templates.find((u) => u._id === i.templateId)
|
|
1574
|
+
};
|
|
1575
|
+
}
|
|
1576
|
+
const F = xt(i, "show"), y = U(i.modelValue ?? h()), w = U(((V = i.modelValue) == null ? void 0 : V._id) ?? `${Math.random()}`);
|
|
1577
|
+
be(
|
|
1578
|
+
() => i.show,
|
|
1579
|
+
(r) => {
|
|
1580
|
+
var u;
|
|
1581
|
+
r && (v.value = !1, y.value = i.modelValue ?? h(), w.value = ((u = i.modelValue) == null ? void 0 : u._id) ?? `${Math.random()}`);
|
|
1582
|
+
}
|
|
1583
|
+
);
|
|
1584
|
+
const L = q(() => !f.value || !v.value), H = q(() => {
|
|
1585
|
+
switch (i.mode) {
|
|
1586
|
+
case Ae.READ:
|
|
1587
|
+
return "View transfer";
|
|
1588
|
+
case Ae.CREATE:
|
|
1589
|
+
return o("inventory.transfer.receiveRequest.create.title");
|
|
1590
|
+
case Ae.UPDATE:
|
|
1591
|
+
return o("inventory.transfer.receiveRequest.update.title");
|
|
1592
|
+
}
|
|
1593
|
+
return "";
|
|
1594
|
+
}), N = U();
|
|
1595
|
+
x({
|
|
1596
|
+
validateInputs: () => {
|
|
1597
|
+
var r, u;
|
|
1598
|
+
(u = (r = N.value) == null ? void 0 : r.validateInputs) == null || u.call(r);
|
|
1599
|
+
},
|
|
1600
|
+
resetInputsValidation: () => {
|
|
1601
|
+
var r, u;
|
|
1602
|
+
(u = (r = N.value) == null ? void 0 : r.resetInputsValidation) == null || u.call(r);
|
|
1603
|
+
},
|
|
1604
|
+
resetInputs: () => {
|
|
1605
|
+
var r, u;
|
|
1606
|
+
(u = (r = N.value) == null ? void 0 : r.resetInputs) == null || u.call(r);
|
|
1607
|
+
}
|
|
1608
|
+
});
|
|
1609
|
+
async function Q() {
|
|
1610
|
+
const r = y.value;
|
|
1611
|
+
if (p.value = !0, r.items = r.items.filter((u) => u.quantity.amount > 0), !r.items.length) {
|
|
1612
|
+
C.open({
|
|
1613
|
+
title: "Cannot create order",
|
|
1614
|
+
message: "There are no items with non-zero amount in your request.",
|
|
1615
|
+
type: "error"
|
|
1616
|
+
});
|
|
1617
|
+
return;
|
|
1618
|
+
}
|
|
1619
|
+
(r.supplier.internal === "warehouse" || r.supplier.internal === "restaurant") && (r.items = r.items.map(({ totalCost: u, ...O }) => O));
|
|
1620
|
+
try {
|
|
1621
|
+
await t.createPurchaseOrder(r), await new Promise((u) => setTimeout(u, 1e3)), C.open({
|
|
1622
|
+
title: o("inventory.transfer.receiveRequest.create.success"),
|
|
1623
|
+
message: o("inventory.transfer.receiveRequest.create.successMessage"),
|
|
1624
|
+
type: "success"
|
|
1625
|
+
}), _("update:show", !1), _("submitted");
|
|
1626
|
+
} catch (u) {
|
|
1627
|
+
C.open({
|
|
1628
|
+
title: o("inventory.transfer.receiveRequest.create.error.title"),
|
|
1629
|
+
message: o("inventory.transfer.receiveRequest.create.error.message"),
|
|
1630
|
+
type: "error"
|
|
1631
|
+
}), console.error("Error in creating purchase order", u);
|
|
1632
|
+
} finally {
|
|
1633
|
+
p.value = !1;
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
async function Z() {
|
|
1637
|
+
const r = y.value;
|
|
1638
|
+
if (p.value = !0, r.items = r.items.filter((u) => u.quantity.amount > 0), !r.items.length) {
|
|
1639
|
+
C.open({
|
|
1640
|
+
title: "Cannot create order",
|
|
1641
|
+
message: "There are no items with non-zero amount in your request.",
|
|
1642
|
+
type: "error"
|
|
1643
|
+
});
|
|
1644
|
+
return;
|
|
1645
|
+
}
|
|
1646
|
+
(r.supplier.internal === "warehouse" || r.supplier.internal === "restaurant") && (r.items = r.items.map(({ totalCost: u, ...O }) => O));
|
|
1647
|
+
try {
|
|
1648
|
+
await t.updatePurchaseOrder(r), await new Promise((u) => setTimeout(u, 1e3)), C.open({
|
|
1649
|
+
title: o("inventory.transfer.receiveRequest.update.success"),
|
|
1650
|
+
message: o("inventory.transfer.receiveRequest.update.successMessage"),
|
|
1651
|
+
type: "success"
|
|
1652
|
+
}), _("update:show", !1), _("submitted");
|
|
1653
|
+
} catch (u) {
|
|
1654
|
+
C.open({
|
|
1655
|
+
title: o("inventory.transfer.receiveRequest.update.error.title"),
|
|
1656
|
+
message: o("inventory.transfer.receiveRequest.update.error.message"),
|
|
1657
|
+
type: "error"
|
|
1658
|
+
}), console.error("Error in updating purchase order", u);
|
|
1659
|
+
} finally {
|
|
1660
|
+
p.value = !1;
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
function A() {
|
|
1664
|
+
switch (i.mode) {
|
|
1665
|
+
case Ae.CREATE:
|
|
1666
|
+
return Q();
|
|
1667
|
+
case Ae.UPDATE:
|
|
1668
|
+
return Z();
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
function E() {
|
|
1672
|
+
var r, u;
|
|
1673
|
+
(u = (r = N.value) == null ? void 0 : r.validateInputs) == null || u.call(r);
|
|
1674
|
+
}
|
|
1675
|
+
return (r, u) => {
|
|
1676
|
+
const O = D("FmButton"), oe = D("FmSideSheet");
|
|
1677
|
+
return k(), K(oe, {
|
|
1678
|
+
modelValue: s(F),
|
|
1679
|
+
"onUpdate:modelValue": u[3] || (u[3] = (G) => Fe(F) ? F.value = G : null),
|
|
1680
|
+
"dismiss-away": "",
|
|
1681
|
+
"close-button": "",
|
|
1682
|
+
"max-width": 900
|
|
1683
|
+
}, {
|
|
1684
|
+
"side-sheet-header": P(() => [
|
|
1685
|
+
l("div", $a, [
|
|
1686
|
+
l("div", Ia, R(H.value), 1)
|
|
1687
|
+
])
|
|
1688
|
+
]),
|
|
1689
|
+
default: P(() => [
|
|
1690
|
+
(k(), K(Fa, {
|
|
1691
|
+
class: "w-full",
|
|
1692
|
+
ref_key: "formRef",
|
|
1693
|
+
ref: N,
|
|
1694
|
+
"onForm:ready": u[0] || (u[0] = () => v.value = !0),
|
|
1695
|
+
onValidationSuccess: A,
|
|
1696
|
+
modelValue: y.value,
|
|
1697
|
+
"onUpdate:modelValue": u[1] || (u[1] = (G) => y.value = G),
|
|
1698
|
+
disabled: p.value || L.value,
|
|
1699
|
+
suppliers: s($).suppliers,
|
|
1700
|
+
skus: s(m).skus,
|
|
1701
|
+
key: w.value,
|
|
1702
|
+
"last-closing-date": r.lastClosingDate
|
|
1703
|
+
}, null, 8, ["modelValue", "disabled", "suppliers", "skus", "last-closing-date"]))
|
|
1704
|
+
]),
|
|
1705
|
+
"side-sheet-footer": P(() => [
|
|
1706
|
+
l("div", Da, [
|
|
1707
|
+
c(O, {
|
|
1708
|
+
loading: p.value,
|
|
1709
|
+
disabled: L.value,
|
|
1710
|
+
label: s(o)("common.save"),
|
|
1711
|
+
onClick: E
|
|
1712
|
+
}, null, 8, ["loading", "disabled", "label"]),
|
|
1713
|
+
c(O, {
|
|
1714
|
+
disabled: L.value,
|
|
1715
|
+
variant: "tertiary",
|
|
1716
|
+
label: s(o)("common.close"),
|
|
1717
|
+
onClick: u[2] || (u[2] = (G) => _("update:show", !1))
|
|
1718
|
+
}, null, 8, ["disabled", "label"])
|
|
1719
|
+
])
|
|
1720
|
+
]),
|
|
1721
|
+
_: 1
|
|
1722
|
+
}, 8, ["modelValue"]);
|
|
1723
|
+
};
|
|
1724
|
+
}
|
|
1725
|
+
});
|
|
1726
|
+
function Va(g) {
|
|
1727
|
+
const [x, n, i, ..._] = Lt(g), t = i.map((m) => m.toLowerCase().trim().replace(/ /g, "_")), C = ["item_name", "transfer_quantity(uom)", "uom", "scanned_code"].filter((m) => !t.includes(m));
|
|
1728
|
+
if (C.length)
|
|
1729
|
+
throw new Error(
|
|
1730
|
+
`Missing headers (${C.join()}). Excel file does not come from the template.`
|
|
1731
|
+
);
|
|
1732
|
+
return _.map((m, e) => {
|
|
1733
|
+
const o = {};
|
|
1734
|
+
for (const p in t) {
|
|
1735
|
+
const f = t[p];
|
|
1736
|
+
Object.assign(o, { [f]: m[p] });
|
|
1737
|
+
}
|
|
1738
|
+
return {
|
|
1739
|
+
index: e,
|
|
1740
|
+
data: o
|
|
1741
|
+
};
|
|
1742
|
+
});
|
|
1743
|
+
}
|
|
1744
|
+
function Pa(g) {
|
|
1745
|
+
const x = g.SheetNames;
|
|
1746
|
+
try {
|
|
1747
|
+
return x.reduce(
|
|
1748
|
+
(i, _) => {
|
|
1749
|
+
const t = new Array(), d = g.Sheets[_], C = Le(), $ = Va(d), m = [];
|
|
1750
|
+
for (const { index: o, data: p } of $) {
|
|
1751
|
+
p.scanned_code === "" && t.push(`Row ${o + 1}: Scanned code is empty`), p.item_name === "" && t.push(`Row ${o + 1}: Item name is empty`), p.uom === "" && t.push(`Row ${o + 1}: UOM is empty`), p["transfer_quantity(uom)"] === "" && t.push(`Row ${o + 1}: Transfer quantity is empty`);
|
|
1752
|
+
const f = C.skus.find((h) => h.code === p.scanned_code);
|
|
1753
|
+
if (!f) {
|
|
1754
|
+
t.push(`Row ${o + 1}: SKU not found`);
|
|
1755
|
+
continue;
|
|
1756
|
+
}
|
|
1757
|
+
const v = f.unit.abbrev === p.uom;
|
|
1758
|
+
let S = null;
|
|
1759
|
+
if (!v) {
|
|
1760
|
+
const h = f.unit.measurements.find((F) => F.abbrev === p.uom);
|
|
1761
|
+
if (!h) {
|
|
1762
|
+
t.push(`Row ${o + 1}: Measurement not found`);
|
|
1763
|
+
continue;
|
|
1764
|
+
}
|
|
1765
|
+
S = h;
|
|
1766
|
+
}
|
|
1767
|
+
m.push({
|
|
1768
|
+
sku: f,
|
|
1769
|
+
code: p.scanned_code,
|
|
1770
|
+
name: p.item_name,
|
|
1771
|
+
quantity: bt.fromNumber(Number(p["transfer_quantity(uom)"])),
|
|
1772
|
+
measurement: S
|
|
1773
|
+
});
|
|
1774
|
+
}
|
|
1775
|
+
const e = {
|
|
1776
|
+
type: "create",
|
|
1777
|
+
poItems: m,
|
|
1778
|
+
excelSheetName: _,
|
|
1779
|
+
errors: t
|
|
1780
|
+
};
|
|
1781
|
+
return i.importCreateResult.push(e), i;
|
|
1782
|
+
},
|
|
1783
|
+
{
|
|
1784
|
+
invalidExcel: !1,
|
|
1785
|
+
importCreateResult: new Array()
|
|
1786
|
+
}
|
|
1787
|
+
);
|
|
1788
|
+
} catch (n) {
|
|
1789
|
+
return {
|
|
1790
|
+
invalidExcel: !0,
|
|
1791
|
+
invalidExcelMessage: (n == null ? void 0 : n.message) ?? "Invalid excel",
|
|
1792
|
+
importCreateResult: []
|
|
1793
|
+
};
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
const Ra = exports.FfCalculator, Ea = { class: "flex flex-col flex-1" }, Aa = { class: "flex flex-col" }, Oa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" }, qa = {
|
|
1797
|
+
key: 0,
|
|
1798
|
+
class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
|
|
1799
|
+
}, Ua = { key: 0 }, Ma = {
|
|
1800
|
+
class: /* @__PURE__ */ Y(["fm-typo-en-body-lg-600"])
|
|
1801
|
+
}, Na = { class: "flex-1" }, za = { class: "flex-auto line-clamp-2 text-ellipsis break-all fm-typo-en-body-sm-400" }, Ba = { class: "flex-auto line-clamp-2 text-ellipsis break-all" }, La = { class: "text-fm-color-typo-primary" }, Ha = { class: "ml-auto" }, ja = { key: 0 }, Ya = /* @__PURE__ */ re({
|
|
1802
|
+
__name: "XilnexResult",
|
|
1803
|
+
props: {
|
|
1804
|
+
type: {},
|
|
1805
|
+
name: {},
|
|
1806
|
+
items: {},
|
|
1807
|
+
errors: {}
|
|
1808
|
+
},
|
|
1809
|
+
setup(g) {
|
|
1810
|
+
const x = g, { t: n } = ge(), i = U(!1), _ = () => {
|
|
1811
|
+
x.errors.length && (i.value = !i.value);
|
|
1812
|
+
};
|
|
1813
|
+
return (t, d) => {
|
|
1814
|
+
var m;
|
|
1815
|
+
const C = D("FmIcon"), $ = D("FmTooltip");
|
|
1816
|
+
return k(), T("div", Ea, [
|
|
1817
|
+
l("div", {
|
|
1818
|
+
onClick: _,
|
|
1819
|
+
class: Y({
|
|
1820
|
+
"cursor-pointer": t.errors.length
|
|
1821
|
+
})
|
|
1822
|
+
}, [
|
|
1823
|
+
l("div", Aa, [
|
|
1824
|
+
l("div", Oa, [
|
|
1825
|
+
l("div", {
|
|
1826
|
+
class: Y({
|
|
1827
|
+
"text-fm-color-system-error-300": t.errors.length
|
|
1828
|
+
})
|
|
1829
|
+
}, [
|
|
1830
|
+
Te(R(t.name) + " ", 1),
|
|
1831
|
+
t.type === "create" ? (k(), T("span", qa, "(" + R(s(n)("inventory.closing.template.import.new")) + ")", 1)) : B("", !0)
|
|
1832
|
+
], 2),
|
|
1833
|
+
t.errors.length ? (k(), T("div", Ua, [
|
|
1834
|
+
c(C, {
|
|
1835
|
+
name: "error",
|
|
1836
|
+
size: "sm",
|
|
1837
|
+
color: "system-error-300"
|
|
1838
|
+
})
|
|
1839
|
+
])) : B("", !0)
|
|
1840
|
+
]),
|
|
1841
|
+
d[0] || (d[0] = l("hr", { class: "my-2" }, null, -1)),
|
|
1842
|
+
l("div", Ma, [
|
|
1843
|
+
(m = t.items) != null && m.length ? (k(!0), T(ne, { key: 0 }, Ie(t.items, (e, o) => (k(), T("div", {
|
|
1844
|
+
key: o,
|
|
1845
|
+
class: "flex gap-4 mt-2 items-center"
|
|
1846
|
+
}, [
|
|
1847
|
+
l("div", Na, [
|
|
1848
|
+
c($, {
|
|
1849
|
+
content: e.code,
|
|
1850
|
+
placement: "top",
|
|
1851
|
+
"z-index": 51
|
|
1852
|
+
}, {
|
|
1853
|
+
default: P(() => [
|
|
1854
|
+
l("span", za, R(e.code), 1)
|
|
1855
|
+
]),
|
|
1856
|
+
_: 2
|
|
1857
|
+
}, 1032, ["content"]),
|
|
1858
|
+
c($, {
|
|
1859
|
+
content: e.name,
|
|
1860
|
+
placement: "top",
|
|
1861
|
+
"z-index": 51
|
|
1862
|
+
}, {
|
|
1863
|
+
default: P(() => [
|
|
1864
|
+
l("span", Ba, R(e.name), 1)
|
|
1865
|
+
]),
|
|
1866
|
+
_: 2
|
|
1867
|
+
}, 1032, ["content"])
|
|
1868
|
+
]),
|
|
1869
|
+
l("div", null, [
|
|
1870
|
+
l("span", La, R(s(Ra).toFormatString({
|
|
1871
|
+
value: e.quantity
|
|
1872
|
+
})), 1),
|
|
1873
|
+
Te(" " + R(e.measurement ? e.measurement.abbrev : e.sku.unit.abbrev), 1)
|
|
1874
|
+
])
|
|
1875
|
+
]))), 128)) : B("", !0)
|
|
1876
|
+
])
|
|
1877
|
+
]),
|
|
1878
|
+
l("div", Ha, [
|
|
1879
|
+
t.errors.length ? (k(), K(C, {
|
|
1880
|
+
key: 0,
|
|
1881
|
+
name: i.value ? "keyboard_arrow_up" : "keyboard_arrow_down",
|
|
1882
|
+
size: "md"
|
|
1883
|
+
}, null, 8, ["name"])) : B("", !0)
|
|
1884
|
+
])
|
|
1885
|
+
], 2),
|
|
1886
|
+
i.value ? (k(), T("div", {
|
|
1887
|
+
key: 0,
|
|
1888
|
+
class: Y(["flex flex-col gap-4 pl-8 fm-typo-en-body-sm-400", {
|
|
1889
|
+
"text-fm-color-typo-secondary": !t.errors.length,
|
|
1890
|
+
"text-fm-color-system-error-300": t.errors.length
|
|
1891
|
+
}])
|
|
1892
|
+
}, [
|
|
1893
|
+
t.errors.length ? (k(), T("div", ja, [
|
|
1894
|
+
l("ol", null, [
|
|
1895
|
+
(k(!0), T(ne, null, Ie(t.errors, (e, o) => (k(), T("li", { key: o }, R(e), 1))), 128))
|
|
1896
|
+
])
|
|
1897
|
+
])) : B("", !0)
|
|
1898
|
+
], 2)) : B("", !0)
|
|
1899
|
+
]);
|
|
1900
|
+
};
|
|
1901
|
+
}
|
|
1902
|
+
}), Ka = { class: "flex flex-col gap-24" }, Qa = {
|
|
1903
|
+
key: 0,
|
|
1904
|
+
class: "flex items-center gap-8"
|
|
1905
|
+
}, Xa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Za = { class: "flex flex-col gap-8" }, Ga = { class: "line-clamp-2 text-ellipsis break-all" }, Wa = {
|
|
1906
|
+
key: 2,
|
|
1907
|
+
class: "shrink-0"
|
|
1908
|
+
}, Ja = {
|
|
1909
|
+
key: 0,
|
|
1910
|
+
class: "flex flex-col"
|
|
1911
|
+
}, eo = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, to = {
|
|
1912
|
+
key: 0,
|
|
1913
|
+
class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
|
|
1914
|
+
}, so = { class: "fm-typo-en-body-lg-600" }, pt = "Transfer note", ao = /* @__PURE__ */ re({
|
|
1915
|
+
__name: "XilnexImportForm",
|
|
1916
|
+
setup(g, { expose: x }) {
|
|
1917
|
+
const n = U(null), i = Ve(), _ = U(!1), t = U(!1), d = _t(), C = U(!1), $ = qe();
|
|
1918
|
+
U([]);
|
|
1919
|
+
const m = q({
|
|
1920
|
+
get() {
|
|
1921
|
+
var y;
|
|
1922
|
+
return ((y = d.supplier) == null ? void 0 : y.name) ?? "";
|
|
1923
|
+
},
|
|
1924
|
+
set(y) {
|
|
1925
|
+
y && (d.supplier = {
|
|
1926
|
+
name: y,
|
|
1927
|
+
registrationNumber: "",
|
|
1928
|
+
_id: "xilnex",
|
|
1929
|
+
internal: "restaurant",
|
|
1930
|
+
address: {
|
|
1931
|
+
line1: "",
|
|
1932
|
+
line2: "",
|
|
1933
|
+
city: "",
|
|
1934
|
+
state: "",
|
|
1935
|
+
country: "",
|
|
1936
|
+
postcode: ""
|
|
1937
|
+
}
|
|
1938
|
+
});
|
|
1939
|
+
}
|
|
1940
|
+
});
|
|
1941
|
+
Be(async () => {
|
|
1942
|
+
const y = await $.getNetSuiteLocations();
|
|
1943
|
+
console.log(y), C.value = !0;
|
|
1944
|
+
});
|
|
1945
|
+
const e = q({
|
|
1946
|
+
get() {
|
|
1947
|
+
return "";
|
|
1948
|
+
},
|
|
1949
|
+
set(y) {
|
|
1950
|
+
if (y) {
|
|
1951
|
+
const w = d.effectiveAt ? new Date(d.effectiveAt) : /* @__PURE__ */ new Date(), [L, H, N] = y.split("-");
|
|
1952
|
+
w.setFullYear(parseInt(L)), w.setMonth(parseInt(H) - 1), w.setDate(parseInt(N)), d.effectiveAt = w.toISOString();
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
}), o = q({
|
|
1956
|
+
get() {
|
|
1957
|
+
return null;
|
|
1958
|
+
},
|
|
1959
|
+
set(y) {
|
|
1960
|
+
if (y) {
|
|
1961
|
+
const w = d.effectiveAt ? new Date(d.effectiveAt) : /* @__PURE__ */ new Date(), [L, H] = y.split(":");
|
|
1962
|
+
w.setMinutes(parseInt(L)), w.setSeconds(parseInt(H)), d.effectiveAt = w.toISOString();
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
}), p = U(new Array()), f = U([]), v = q(
|
|
1966
|
+
() => !!p.value.length || f.value.some((y) => y.errors.length)
|
|
1967
|
+
), S = U();
|
|
1968
|
+
x({
|
|
1969
|
+
validateInputs: () => {
|
|
1970
|
+
var y, w;
|
|
1971
|
+
(w = (y = S.value) == null ? void 0 : y.validateInputs) == null || w.call(y);
|
|
1972
|
+
},
|
|
1973
|
+
resetInputsValidation: () => {
|
|
1974
|
+
var y, w;
|
|
1975
|
+
(w = (y = S.value) == null ? void 0 : y.resetInputsValidation) == null || w.call(y);
|
|
1976
|
+
},
|
|
1977
|
+
resetInputs: () => {
|
|
1978
|
+
var y, w;
|
|
1979
|
+
(w = (y = S.value) == null ? void 0 : y.resetInputs) == null || w.call(y);
|
|
1980
|
+
}
|
|
1981
|
+
});
|
|
1982
|
+
const { t: h } = ge();
|
|
1983
|
+
async function F(y) {
|
|
1984
|
+
p.value = [], f.value = [];
|
|
1985
|
+
try {
|
|
1986
|
+
_.value = !0;
|
|
1987
|
+
const [w] = await Promise.all([
|
|
1988
|
+
jt(y),
|
|
1989
|
+
// fake buffer
|
|
1990
|
+
new Promise((H) => setTimeout(H, 1e3))
|
|
1991
|
+
]), L = Pa(w);
|
|
1992
|
+
if (L.invalidExcel) {
|
|
1993
|
+
p.value.push(
|
|
1994
|
+
L.invalidExcelMessage ?? h("inventory.ingredient.import.fileError.invalidExcel")
|
|
1995
|
+
);
|
|
1996
|
+
return;
|
|
1997
|
+
}
|
|
1998
|
+
if (f.value = L.importCreateResult, !f.value.length) {
|
|
1999
|
+
p.value.push(h("inventory.ingredient.import.fileError.noData"));
|
|
2000
|
+
return;
|
|
2001
|
+
}
|
|
2002
|
+
d.items = f.value.map((H) => H.poItems).flat();
|
|
2003
|
+
} catch (w) {
|
|
2004
|
+
i.open({
|
|
2005
|
+
title: h("inventory.ingredient.import.fileError.unableToRead"),
|
|
2006
|
+
message: w == null ? void 0 : w.message,
|
|
2007
|
+
type: "error"
|
|
2008
|
+
}), console.error("Error in reading file", w);
|
|
2009
|
+
} finally {
|
|
2010
|
+
p.value.length && i.open({
|
|
2011
|
+
title: h("inventory.ingredient.import.fileError.invalidExcel"),
|
|
2012
|
+
type: "error"
|
|
2013
|
+
}), _.value = !1;
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
return be(n, (y) => {
|
|
2017
|
+
y && F(y);
|
|
2018
|
+
}), (y, w) => {
|
|
2019
|
+
const L = D("FmSelect"), H = D("FmDatePicker"), N = D("FmTimePicker"), Q = D("FmCircularProgress"), Z = D("FmLabel"), A = D("FmIcon"), E = D("FmButton"), V = D("FmForm");
|
|
2020
|
+
return k(), K(V, {
|
|
2021
|
+
ref_key: "formRef",
|
|
2022
|
+
ref: S
|
|
2023
|
+
}, {
|
|
2024
|
+
default: P(() => [
|
|
2025
|
+
l("div", Ka, [
|
|
2026
|
+
c(L, {
|
|
2027
|
+
modelValue: m.value,
|
|
2028
|
+
"onUpdate:modelValue": w[0] || (w[0] = (r) => m.value = r),
|
|
2029
|
+
label: "Transfer from",
|
|
2030
|
+
searchable: "",
|
|
2031
|
+
searchTarget: "label",
|
|
2032
|
+
items: [
|
|
2033
|
+
{ label: "Object", value: null },
|
|
2034
|
+
{ label: "Array", value: ["array", "1"] },
|
|
2035
|
+
{ label: "Number", value: 3 },
|
|
2036
|
+
{ label: "String", value: "4" },
|
|
2037
|
+
{ label: "1", value: "5" },
|
|
2038
|
+
{ label: "2", value: "6" }
|
|
2039
|
+
],
|
|
2040
|
+
"helper-text": "Helper",
|
|
2041
|
+
rules: [s(Oe)()]
|
|
2042
|
+
}, null, 8, ["modelValue", "rules"]),
|
|
2043
|
+
c(H, {
|
|
2044
|
+
modelValue: e.value,
|
|
2045
|
+
"onUpdate:modelValue": w[1] || (w[1] = (r) => e.value = r),
|
|
2046
|
+
label: "Transfer date",
|
|
2047
|
+
rules: [s(Oe)()]
|
|
2048
|
+
}, null, 8, ["modelValue", "rules"]),
|
|
2049
|
+
c(N, {
|
|
2050
|
+
modelValue: o.value,
|
|
2051
|
+
"onUpdate:modelValue": w[2] || (w[2] = (r) => o.value = r),
|
|
2052
|
+
label: "Transfer time",
|
|
2053
|
+
rules: [s(Oe)()]
|
|
2054
|
+
}, null, 8, ["modelValue", "rules"]),
|
|
2055
|
+
t.value ? (k(), T("div", Qa, [
|
|
2056
|
+
l("div", null, [
|
|
2057
|
+
c(Q, {
|
|
2058
|
+
size: "md",
|
|
2059
|
+
color: "neutral-gray-200"
|
|
2060
|
+
})
|
|
2061
|
+
]),
|
|
2062
|
+
l("div", Xa, R(s(h)("inventory.formField.loading")), 1)
|
|
2063
|
+
])) : (k(), T(ne, { key: 1 }, [
|
|
2064
|
+
c(Ht, {
|
|
2065
|
+
"max-file-size": 5,
|
|
2066
|
+
class: Y({
|
|
2067
|
+
"w-full": !0,
|
|
2068
|
+
"h-[200px]": !n.value
|
|
2069
|
+
}),
|
|
2070
|
+
accept: ".xlsx,.xls",
|
|
2071
|
+
label: pt,
|
|
2072
|
+
onFileUpload: w[3] || (w[3] = (r) => n.value = r),
|
|
2073
|
+
"button-label": s(h)("inventory.ingredient.import.selectFile")
|
|
2074
|
+
}, Ft({ _: 2 }, [
|
|
2075
|
+
n.value ? {
|
|
2076
|
+
name: "default",
|
|
2077
|
+
fn: P(({ openFileDialog: r }) => [
|
|
2078
|
+
c(Z, null, {
|
|
2079
|
+
default: P(() => [
|
|
2080
|
+
Te(R(pt))
|
|
2081
|
+
]),
|
|
2082
|
+
_: 1
|
|
2083
|
+
}),
|
|
2084
|
+
l("div", Za, [
|
|
2085
|
+
l("div", {
|
|
2086
|
+
class: Y([
|
|
2087
|
+
"fm-corner-radius-md p-16 flex items-center gap-16",
|
|
2088
|
+
{
|
|
2089
|
+
"border border-fm-color-neutral-gray-100": _.value,
|
|
2090
|
+
"border border-fm-color-neutral-gray-200": !_.value && !v.value,
|
|
2091
|
+
"border border-fm-color-system-error-200": v.value
|
|
2092
|
+
}
|
|
2093
|
+
])
|
|
2094
|
+
}, [
|
|
2095
|
+
_.value ? (k(), K(Q, {
|
|
2096
|
+
key: 0,
|
|
2097
|
+
size: "md",
|
|
2098
|
+
color: "neutral-gray-200"
|
|
2099
|
+
})) : (k(), K(A, {
|
|
2100
|
+
key: 1,
|
|
2101
|
+
name: v.value ? "error" : "attach_file",
|
|
2102
|
+
outline: "",
|
|
2103
|
+
color: v.value ? "system-error-300" : void 0
|
|
2104
|
+
}, null, 8, ["name", "color"])),
|
|
2105
|
+
l("div", {
|
|
2106
|
+
class: Y([
|
|
2107
|
+
"fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center",
|
|
2108
|
+
{
|
|
2109
|
+
"text-fm-color-typo-disabled": _.value,
|
|
2110
|
+
"text-fm-color-typo-primary": !_.value
|
|
2111
|
+
}
|
|
2112
|
+
])
|
|
2113
|
+
}, [
|
|
2114
|
+
l("div", Ga, R(n.value.name), 1)
|
|
2115
|
+
], 2),
|
|
2116
|
+
_.value ? B("", !0) : (k(), T("div", Wa, [
|
|
2117
|
+
c(E, {
|
|
2118
|
+
label: s(h)("inventory.ingredient.import.replaceFile"),
|
|
2119
|
+
variant: v.value ? "destructive" : "secondary",
|
|
2120
|
+
"prepend-icon": v.value ? void 0 : "autorenew",
|
|
2121
|
+
onClick: r
|
|
2122
|
+
}, null, 8, ["label", "variant", "prepend-icon", "onClick"])
|
|
2123
|
+
]))
|
|
2124
|
+
], 2),
|
|
2125
|
+
p.value.length ? (k(), T("div", Ja, [
|
|
2126
|
+
(k(!0), T(ne, null, Ie(p.value, (u, O) => (k(), T("div", {
|
|
2127
|
+
key: O,
|
|
2128
|
+
class: "flex gap-8 items-center"
|
|
2129
|
+
}, [
|
|
2130
|
+
c(A, {
|
|
2131
|
+
name: "error",
|
|
2132
|
+
size: "sm",
|
|
2133
|
+
color: "system-error-300"
|
|
2134
|
+
}),
|
|
2135
|
+
l("div", eo, R(u), 1)
|
|
2136
|
+
]))), 128))
|
|
2137
|
+
])) : B("", !0)
|
|
2138
|
+
])
|
|
2139
|
+
]),
|
|
2140
|
+
key: "0"
|
|
2141
|
+
} : void 0
|
|
2142
|
+
]), 1032, ["class", "button-label"]),
|
|
2143
|
+
n.value ? (k(), T("div", to, [
|
|
2144
|
+
l("div", so, R(s(h)("inventory.ingredient.import.summary")), 1),
|
|
2145
|
+
(k(!0), T(ne, null, Ie(f.value, (r, u) => (k(), K(Ya, {
|
|
2146
|
+
key: u,
|
|
2147
|
+
name: `Transfer Note ${u + 1}`,
|
|
2148
|
+
items: r.poItems,
|
|
2149
|
+
errors: r.errors,
|
|
2150
|
+
type: "create"
|
|
2151
|
+
}, null, 8, ["name", "items", "errors"]))), 128))
|
|
2152
|
+
])) : B("", !0)
|
|
2153
|
+
], 64))
|
|
2154
|
+
])
|
|
2155
|
+
]),
|
|
2156
|
+
_: 1
|
|
2157
|
+
}, 512);
|
|
2158
|
+
};
|
|
2159
|
+
}
|
|
2160
|
+
}), oo = { class: "w-[480px]" }, lo = /* @__PURE__ */ re({
|
|
2161
|
+
__name: "XilnexImportDialog",
|
|
2162
|
+
props: {
|
|
2163
|
+
show: { type: Boolean }
|
|
2164
|
+
},
|
|
2165
|
+
emits: ["update:show", "submitted"],
|
|
2166
|
+
setup(g, { expose: x, emit: n }) {
|
|
2167
|
+
const i = n, t = xt(g, "show"), d = Ve(), C = Ge(), $ = U(!1), m = U(), e = U();
|
|
2168
|
+
x({
|
|
2169
|
+
validateInputs: () => {
|
|
2170
|
+
var f, v;
|
|
2171
|
+
(v = (f = m.value) == null ? void 0 : f.validateInputs) == null || v.call(f);
|
|
2172
|
+
},
|
|
2173
|
+
resetInputsValidation: () => {
|
|
2174
|
+
var f, v;
|
|
2175
|
+
(v = (f = m.value) == null ? void 0 : f.resetInputsValidation) == null || v.call(f);
|
|
2176
|
+
},
|
|
2177
|
+
resetInputs: () => {
|
|
2178
|
+
var f, v;
|
|
2179
|
+
(v = (f = m.value) == null ? void 0 : f.resetInputs) == null || v.call(f);
|
|
2180
|
+
}
|
|
2181
|
+
});
|
|
2182
|
+
function o() {
|
|
2183
|
+
var f, v;
|
|
2184
|
+
(v = (f = m.value) == null ? void 0 : f.validateInputs) == null || v.call(f);
|
|
2185
|
+
}
|
|
2186
|
+
async function p() {
|
|
2187
|
+
var v, S, h, F, y;
|
|
2188
|
+
if (!((S = (v = e.value) == null ? void 0 : v.supplier) != null && S.name)) {
|
|
2189
|
+
d.open({
|
|
2190
|
+
title: "Upload failed",
|
|
2191
|
+
message: "Location is required",
|
|
2192
|
+
type: "error"
|
|
2193
|
+
});
|
|
2194
|
+
return;
|
|
2195
|
+
}
|
|
2196
|
+
if (!((h = e.value) != null && h.items) || ((y = (F = e.value) == null ? void 0 : F.items) == null ? void 0 : y.length) === 0) {
|
|
2197
|
+
d.open({
|
|
2198
|
+
title: "Upload failed",
|
|
2199
|
+
message: "No data to upload",
|
|
2200
|
+
type: "error"
|
|
2201
|
+
});
|
|
2202
|
+
return;
|
|
2203
|
+
}
|
|
2204
|
+
const f = e.value.effectiveAt ? new Date(e.value.effectiveAt) : null;
|
|
2205
|
+
if (!f) {
|
|
2206
|
+
d.open({
|
|
2207
|
+
title: "Invalid date",
|
|
2208
|
+
message: "Transfer date is required",
|
|
2209
|
+
type: "error"
|
|
2210
|
+
});
|
|
2211
|
+
return;
|
|
2212
|
+
}
|
|
2213
|
+
if (f.getTime() > (/* @__PURE__ */ new Date()).getTime()) {
|
|
2214
|
+
d.open({
|
|
2215
|
+
title: "Invalid date",
|
|
2216
|
+
message: "Transfer date cannot be in the future",
|
|
2217
|
+
type: "error"
|
|
2218
|
+
});
|
|
2219
|
+
return;
|
|
2220
|
+
}
|
|
2221
|
+
$.value = !0;
|
|
2222
|
+
try {
|
|
2223
|
+
await C.importFromXilnex(e.value), i("update:show", !1);
|
|
2224
|
+
} catch (w) {
|
|
2225
|
+
await new Promise((L) => setTimeout(L, 1e3)), d.open({
|
|
2226
|
+
title: "Upload failed",
|
|
2227
|
+
message: w == null ? void 0 : w.message,
|
|
2228
|
+
type: "error"
|
|
2229
|
+
});
|
|
2230
|
+
} finally {
|
|
2231
|
+
$.value = !1;
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
return (f, v) => {
|
|
2235
|
+
const S = D("FmSpacer"), h = D("FmButton"), F = D("FmDialog");
|
|
2236
|
+
return k(), K(F, {
|
|
2237
|
+
modelValue: s(t),
|
|
2238
|
+
"onUpdate:modelValue": v[2] || (v[2] = (y) => Fe(t) ? t.value = y : null),
|
|
2239
|
+
overlay: !0,
|
|
2240
|
+
"close-button": !1
|
|
2241
|
+
}, {
|
|
2242
|
+
"dialog-header": P(() => v[3] || (v[3] = [
|
|
2243
|
+
l("div", null, "Xilnex transfer order", -1)
|
|
2244
|
+
])),
|
|
2245
|
+
"dialog-footer": P(() => [
|
|
2246
|
+
c(S, { class: "sm:hidden xs:hidden" }),
|
|
2247
|
+
c(h, {
|
|
2248
|
+
disabled: $.value,
|
|
2249
|
+
class: "sm:w-full xs:w-full",
|
|
2250
|
+
label: "Cancel",
|
|
2251
|
+
size: "md",
|
|
2252
|
+
variant: "tertiary",
|
|
2253
|
+
onClick: v[1] || (v[1] = (y) => i("update:show", !1))
|
|
2254
|
+
}, null, 8, ["disabled"]),
|
|
2255
|
+
c(h, {
|
|
2256
|
+
disabled: $.value,
|
|
2257
|
+
loading: $.value,
|
|
2258
|
+
class: "sm:w-full xs:w-full",
|
|
2259
|
+
label: "Upload",
|
|
2260
|
+
size: "md",
|
|
2261
|
+
variant: "primary",
|
|
2262
|
+
onClick: o
|
|
2263
|
+
}, null, 8, ["disabled", "loading"])
|
|
2264
|
+
]),
|
|
2265
|
+
default: P(() => [
|
|
2266
|
+
l("div", oo, [
|
|
2267
|
+
c(ao, {
|
|
2268
|
+
ref_key: "formRef",
|
|
2269
|
+
ref: m,
|
|
2270
|
+
onValidationSuccess: p,
|
|
2271
|
+
modelValue: e.value,
|
|
2272
|
+
"onUpdate:modelValue": v[0] || (v[0] = (y) => e.value = y)
|
|
2273
|
+
}, null, 8, ["modelValue"])
|
|
2274
|
+
])
|
|
2275
|
+
]),
|
|
2276
|
+
_: 1
|
|
2277
|
+
}, 8, ["modelValue"]);
|
|
2278
|
+
};
|
|
2279
|
+
}
|
|
2280
|
+
}), no = { class: "flex flex-col py-8" }, ro = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, io = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, uo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary line-clamp-1" }, co = {
|
|
2281
|
+
key: 0,
|
|
2282
|
+
class: "fm-typo-en-body-md-400 text-fm-color-typo-primary line-clamp-1"
|
|
2283
|
+
}, mo = { class: "pt-8" }, ft = "ReceiveRequestViewSearchCriteria", Do = /* @__PURE__ */ re({
|
|
2284
|
+
__name: "ReceiveRequestView",
|
|
2285
|
+
setup(g) {
|
|
2286
|
+
const { t: x } = ge(), n = Ve();
|
|
2287
|
+
Ne.object({
|
|
2288
|
+
name: Ne.string().optional().nullable(),
|
|
2289
|
+
startDate: Ne.string().optional().nullable(),
|
|
2290
|
+
endDate: Ne.string().optional().nullable()
|
|
2291
|
+
});
|
|
2292
|
+
const i = q(
|
|
2293
|
+
() => !p._currentLocation || e.loading.value
|
|
2294
|
+
), _ = os(), t = Je(), d = qe();
|
|
2295
|
+
function C() {
|
|
2296
|
+
const A = {
|
|
2297
|
+
name: "",
|
|
2298
|
+
...dt()
|
|
2299
|
+
}, E = _.getItem(ft);
|
|
2300
|
+
if (!E)
|
|
2301
|
+
return A;
|
|
2302
|
+
try {
|
|
2303
|
+
return JSON.parse(E);
|
|
2304
|
+
} catch {
|
|
2305
|
+
return A;
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
function $() {
|
|
2309
|
+
_.setItem(ft, JSON.stringify(m.value));
|
|
2310
|
+
}
|
|
2311
|
+
const m = U(C()), e = Gt(
|
|
2312
|
+
Ye.RECEIVE_REQUEST,
|
|
2313
|
+
m.value
|
|
2314
|
+
), { columnDefs: o } = Wt(
|
|
2315
|
+
Ye.RECEIVE_REQUEST,
|
|
2316
|
+
e
|
|
2317
|
+
), p = Ze();
|
|
2318
|
+
async function f() {
|
|
2319
|
+
const A = `inventory-record_${ct(m.value.startDate).format("DD-MM-YYYY_HH-mm")}-${ct(m.value.endDate).format("DD-MM-YYYY_HH-mm")}.xlsx`, E = e.purchaseOrders.value.flatMap(
|
|
2320
|
+
(r) => r.items.map((u) => {
|
|
2321
|
+
var ke;
|
|
2322
|
+
const O = new Date(ss(r._id) ?? ""), oe = r.effectiveAt ? new Date(r.effectiveAt) : void 0, G = $e(
|
|
2323
|
+
es(u.sku, r.deliveryOrder || [])
|
|
2324
|
+
), ce = $e(u.quantity), ie = ((ke = u == null ? void 0 : u.measurement) == null ? void 0 : ke.abbrev) || u.sku.unit.abbrev;
|
|
2325
|
+
return {
|
|
2326
|
+
"SKU code": u.code,
|
|
2327
|
+
"SKU name": u.name,
|
|
2328
|
+
"PO #": r.seqNumber,
|
|
2329
|
+
"Effective at": oe,
|
|
2330
|
+
Date: O,
|
|
2331
|
+
Status: r.status,
|
|
2332
|
+
Reference: r.ref ?? "",
|
|
2333
|
+
"Received quantity": G,
|
|
2334
|
+
"Ordered quantity": ce,
|
|
2335
|
+
Unit: ie,
|
|
2336
|
+
"Total cost": u.totalCost ? Qe(u.totalCost) : null
|
|
2337
|
+
};
|
|
2338
|
+
})
|
|
2339
|
+
), V = [
|
|
2340
|
+
"SKU code",
|
|
2341
|
+
"SKU name",
|
|
2342
|
+
"PO #",
|
|
2343
|
+
"Date",
|
|
2344
|
+
"Status",
|
|
2345
|
+
"Reference",
|
|
2346
|
+
"Received quantity",
|
|
2347
|
+
"Ordered quantity",
|
|
2348
|
+
"Unit"
|
|
2349
|
+
];
|
|
2350
|
+
t.enableBackdatePo && V.insert("Effective at", 4), t.enableTotalCost && V.push("Total cost"), await as(
|
|
2351
|
+
[
|
|
2352
|
+
{
|
|
2353
|
+
name: "purchases",
|
|
2354
|
+
data: E,
|
|
2355
|
+
columns: V
|
|
2356
|
+
}
|
|
2357
|
+
],
|
|
2358
|
+
A
|
|
2359
|
+
), n.open({
|
|
2360
|
+
title: x("inventory.transfer.receiveRequest.export.success"),
|
|
2361
|
+
message: x("inventory.transfer.receiveRequest.export.message", [A]),
|
|
2362
|
+
type: "success"
|
|
2363
|
+
});
|
|
2364
|
+
}
|
|
2365
|
+
const v = U(dt()), S = U("");
|
|
2366
|
+
be([() => v.value], ([A]) => {
|
|
2367
|
+
!A.startDate || !A.endDate || (m.value.startDate = A.startDate, m.value.endDate = A.endDate, e.updateDateRange(
|
|
2368
|
+
m.value.startDate,
|
|
2369
|
+
m.value.endDate
|
|
2370
|
+
), $());
|
|
2371
|
+
}), be([() => S.value], () => {
|
|
2372
|
+
$();
|
|
2373
|
+
});
|
|
2374
|
+
function h(A) {
|
|
2375
|
+
if (A === "create") {
|
|
2376
|
+
if (i.value) {
|
|
2377
|
+
n.open({
|
|
2378
|
+
title: "Loading data...",
|
|
2379
|
+
message: "Please wait.",
|
|
2380
|
+
type: "info"
|
|
2381
|
+
});
|
|
2382
|
+
return;
|
|
2383
|
+
}
|
|
2384
|
+
return e.promptCreateTransferDialog();
|
|
2385
|
+
}
|
|
2386
|
+
if (A === "upload" && t.enableXilnexTransferNote)
|
|
2387
|
+
return e.promptUploadTransferDialog();
|
|
2388
|
+
if (A === "refresh")
|
|
2389
|
+
return e.fetchData();
|
|
2390
|
+
if (A === "export")
|
|
2391
|
+
return f();
|
|
2392
|
+
}
|
|
2393
|
+
const { breakpoints: F } = We(), y = q(() => F.value.xs || F.value.sm), w = q(() => y.value ? 10 : 20), L = Yt(), H = q(() => [
|
|
2394
|
+
{
|
|
2395
|
+
label: x("inventory.transfer.receiveRequest.actions.create"),
|
|
2396
|
+
value: "create",
|
|
2397
|
+
isPrimary: !0,
|
|
2398
|
+
prependIcon: "add"
|
|
2399
|
+
},
|
|
2400
|
+
...t.enableXilnexTransferNote ? [
|
|
2401
|
+
{
|
|
2402
|
+
label: "Upload",
|
|
2403
|
+
value: "upload"
|
|
2404
|
+
}
|
|
2405
|
+
] : [],
|
|
2406
|
+
{
|
|
2407
|
+
label: x("inventory.common.refresh"),
|
|
2408
|
+
value: "refresh"
|
|
2409
|
+
},
|
|
2410
|
+
{
|
|
2411
|
+
label: x("inventory.common.export"),
|
|
2412
|
+
value: "export"
|
|
2413
|
+
}
|
|
2414
|
+
]), N = q(() => {
|
|
2415
|
+
const A = [
|
|
2416
|
+
{
|
|
2417
|
+
type: "string",
|
|
2418
|
+
key: "status",
|
|
2419
|
+
entity: "purchaseOrder",
|
|
2420
|
+
values: Array.from(
|
|
2421
|
+
new Set(e.purchaseOrders.value.map((V) => V.status))
|
|
2422
|
+
)
|
|
2423
|
+
}
|
|
2424
|
+
], E = [
|
|
2425
|
+
{
|
|
2426
|
+
type: "string",
|
|
2427
|
+
key: "netsuiteTransactionNumber",
|
|
2428
|
+
entity: "purchaseOrder",
|
|
2429
|
+
values: e.purchaseOrders.value.map((V) => {
|
|
2430
|
+
var r, u;
|
|
2431
|
+
return (u = (r = V.netSuite) == null ? void 0 : r.additionalInfo) == null ? void 0 : u.transactionnumber;
|
|
2432
|
+
}).filter((V) => V != null)
|
|
2433
|
+
},
|
|
2434
|
+
{
|
|
2435
|
+
type: "string",
|
|
2436
|
+
key: "netsuiteOrderNo",
|
|
2437
|
+
entity: "purchaseOrder",
|
|
2438
|
+
values: e.purchaseOrders.value.map((V) => {
|
|
2439
|
+
var r;
|
|
2440
|
+
return (r = V.netSuite) == null ? void 0 : r.refNo;
|
|
2441
|
+
}).filter((V) => V != null)
|
|
2442
|
+
},
|
|
2443
|
+
{
|
|
2444
|
+
type: "string",
|
|
2445
|
+
key: "netsuiteOrderId",
|
|
2446
|
+
entity: "purchaseOrder",
|
|
2447
|
+
values: e.purchaseOrders.value.map((V) => {
|
|
2448
|
+
var r;
|
|
2449
|
+
return (r = V.netSuite) == null ? void 0 : r.id;
|
|
2450
|
+
}).filter((V) => V != null)
|
|
2451
|
+
}
|
|
2452
|
+
];
|
|
2453
|
+
return [...A, ...d.isEnabled ? E : []];
|
|
2454
|
+
}), Q = U(null), Z = q(() => {
|
|
2455
|
+
if (!Q.value)
|
|
2456
|
+
return e.purchaseOrders.value;
|
|
2457
|
+
const A = Kt.build(Q.value);
|
|
2458
|
+
return e.purchaseOrders.value.filter((E) => {
|
|
2459
|
+
var V, r, u, O;
|
|
2460
|
+
return Qt(
|
|
2461
|
+
{
|
|
2462
|
+
netsuiteTransactionNumber: (r = (V = E.netSuite) == null ? void 0 : V.additionalInfo) == null ? void 0 : r.transactionnumber,
|
|
2463
|
+
netsuiteOrderNo: (u = E.netSuite) == null ? void 0 : u.refNo,
|
|
2464
|
+
netsuiteOrderId: (O = E.netSuite) == null ? void 0 : O.id,
|
|
2465
|
+
status: E.status
|
|
2466
|
+
},
|
|
2467
|
+
A
|
|
2468
|
+
);
|
|
2469
|
+
});
|
|
2470
|
+
});
|
|
2471
|
+
return (A, E) => {
|
|
2472
|
+
const V = D("FmTable");
|
|
2473
|
+
return k(), K(Xt, {
|
|
2474
|
+
title: s(x)("inventory.transfer.receiveRequest.title2"),
|
|
2475
|
+
actions: H.value,
|
|
2476
|
+
"onClick:action": h
|
|
2477
|
+
}, {
|
|
2478
|
+
default: P(() => {
|
|
2479
|
+
var r;
|
|
2480
|
+
return [
|
|
2481
|
+
l("div", {
|
|
2482
|
+
class: Y([
|
|
2483
|
+
"flex flex-col gap-8 max-h-full",
|
|
2484
|
+
{
|
|
2485
|
+
"p-0": y.value,
|
|
2486
|
+
"px-24 ": !y.value
|
|
2487
|
+
}
|
|
2488
|
+
])
|
|
2489
|
+
}, [
|
|
2490
|
+
c(Zt, {
|
|
2491
|
+
"date-range-query": "",
|
|
2492
|
+
"date-range": v.value,
|
|
2493
|
+
"onUpdate:dateRange": E[0] || (E[0] = (u) => v.value = u),
|
|
2494
|
+
searchable: "",
|
|
2495
|
+
"change-location": "",
|
|
2496
|
+
search: S.value,
|
|
2497
|
+
"onUpdate:search": E[1] || (E[1] = (u) => S.value = u),
|
|
2498
|
+
filterable: "",
|
|
2499
|
+
"filter-attributes": N.value,
|
|
2500
|
+
filter: Q.value,
|
|
2501
|
+
"onUpdate:filter": E[2] || (E[2] = (u) => Q.value = u)
|
|
2502
|
+
}, null, 8, ["date-range", "search", "filter-attributes", "filter"]),
|
|
2503
|
+
(k(), K(V, {
|
|
2504
|
+
style: yt(s(L).tableHeight),
|
|
2505
|
+
"column-defs": s(o),
|
|
2506
|
+
"row-data": Z.value,
|
|
2507
|
+
"search-value": S.value,
|
|
2508
|
+
loading: i.value,
|
|
2509
|
+
onRowClick: E[3] || (E[3] = (u) => s(e).promptShowTransferDetails(u.original)),
|
|
2510
|
+
key: (r = s(p)._currentLocation) == null ? void 0 : r.dbName,
|
|
2511
|
+
"page-size": w.value
|
|
2512
|
+
}, {
|
|
2513
|
+
"list-row": P((u) => [
|
|
2514
|
+
c(ht, {
|
|
2515
|
+
row: u,
|
|
2516
|
+
onRowClick: s(e).promptShowTransferDetails
|
|
2517
|
+
}, {
|
|
2518
|
+
default: P((O) => {
|
|
2519
|
+
var oe, G, ce, ie, ke, Ue, Me, He, De, Pe, a, b, M, ae, me, xe, pe, _e, fe, Ce;
|
|
2520
|
+
return [
|
|
2521
|
+
l("div", no, [
|
|
2522
|
+
l("div", ro, [
|
|
2523
|
+
c(s(de), {
|
|
2524
|
+
render: (ce = (G = (oe = O._id) == null ? void 0 : oe.column) == null ? void 0 : G.columnDef) == null ? void 0 : ce.cell,
|
|
2525
|
+
props: (ke = (ie = O._id) == null ? void 0 : ie.getContext) == null ? void 0 : ke.call(ie)
|
|
2526
|
+
}, null, 8, ["render", "props"])
|
|
2527
|
+
]),
|
|
2528
|
+
l("div", io, [
|
|
2529
|
+
c(s(de), {
|
|
2530
|
+
render: (He = (Me = (Ue = O.supplier_name) == null ? void 0 : Ue.column) == null ? void 0 : Me.columnDef) == null ? void 0 : He.cell,
|
|
2531
|
+
props: (Pe = (De = O.supplier_name) == null ? void 0 : De.getContext) == null ? void 0 : Pe.call(De)
|
|
2532
|
+
}, null, 8, ["render", "props"])
|
|
2533
|
+
]),
|
|
2534
|
+
l("div", uo, R(u.original.items.map((Se) => `${Se.name}`).join(", ")), 1),
|
|
2535
|
+
u.original.ref ? (k(), T("div", co, [
|
|
2536
|
+
c(s(de), {
|
|
2537
|
+
render: (M = (b = (a = O.ref) == null ? void 0 : a.column) == null ? void 0 : b.columnDef) == null ? void 0 : M.cell,
|
|
2538
|
+
props: (me = (ae = O.ref) == null ? void 0 : ae.getContext) == null ? void 0 : me.call(ae)
|
|
2539
|
+
}, null, 8, ["render", "props"])
|
|
2540
|
+
])) : B("", !0),
|
|
2541
|
+
l("div", mo, [
|
|
2542
|
+
c(s(de), {
|
|
2543
|
+
render: (_e = (pe = (xe = O.status) == null ? void 0 : xe.column) == null ? void 0 : pe.columnDef) == null ? void 0 : _e.cell,
|
|
2544
|
+
props: (Ce = (fe = O.status) == null ? void 0 : fe.getContext) == null ? void 0 : Ce.call(fe)
|
|
2545
|
+
}, null, 8, ["render", "props"])
|
|
2546
|
+
])
|
|
2547
|
+
])
|
|
2548
|
+
];
|
|
2549
|
+
}),
|
|
2550
|
+
_: 2
|
|
2551
|
+
}, 1032, ["row", "onRowClick"])
|
|
2552
|
+
]),
|
|
2553
|
+
_: 1
|
|
2554
|
+
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
2555
|
+
], 2),
|
|
2556
|
+
(k(), K($t, { to: "body" }, [
|
|
2557
|
+
c(Ta, Ke(s(e).transferDialogProps.value, {
|
|
2558
|
+
onSubmitted: s(e).fetchData
|
|
2559
|
+
}), null, 16, ["onSubmitted"]),
|
|
2560
|
+
c(Jt, Ke({
|
|
2561
|
+
scope: s(Ye).RECEIVE_REQUEST
|
|
2562
|
+
}, s(e).transferDetailsProps.value, {
|
|
2563
|
+
onSubmitted: s(e).fetchData
|
|
2564
|
+
}), null, 16, ["scope", "onSubmitted"]),
|
|
2565
|
+
c(lo, It(Dt(s(e).xilnexImportDialogProps.value)), null, 16)
|
|
2566
|
+
]))
|
|
2567
|
+
];
|
|
2568
|
+
}),
|
|
2569
|
+
_: 1
|
|
2570
|
+
}, 8, ["title", "actions"]);
|
|
2571
|
+
};
|
|
2572
|
+
}
|
|
2573
|
+
});
|
|
2574
|
+
export {
|
|
2575
|
+
Do as default
|
|
2576
|
+
};
|