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