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