@feedmepos/mf-inventory-portal 0.0.19-dev.15 → 0.0.19-dev.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ApprovalView-CRHU3Bv0.js → ApprovalView-YVJ8rI2M.js} +5 -5
- package/dist/{BindingsDialog-ChIRg0d3.js → BindingsDialog-C7ZO5bXe.js} +9 -9
- package/dist/{BindingsPicker-BJAbeiDf.js → BindingsPicker-BDsVbM3L.js} +1 -1
- package/dist/{BindingsTable-5MxWD_qa.js → BindingsTable-BiVQ4mvK.js} +1 -1
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-vuSl8LVG.js +308 -0
- package/dist/{IngredientsView-qXrDtzSK.js → IngredientsView-CKDZsR2e.js} +5 -5
- package/dist/{IntegrationView-D6yFqod1.js → IntegrationView-DQZeJKul.js} +2 -2
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DGurlvYg.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DDcFEUcz.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-2Ady4pB4.js → PremiumBadge.vue_vue_type_script_setup_true_lang-6plo8rnV.js} +1 -1
- package/dist/{PurchaseOrderPrintPreview-BWwjMRqb.js → PurchaseOrderPrintPreview-Df-gYZFA.js} +1 -1
- package/dist/{ReceiveRequestView-C94SWDaj.js → ReceiveRequestView-CxW1ONAk.js} +8 -8
- package/dist/{RecipeView-CG9H_ZOo.js → RecipeView-B8eIaR2f.js} +4 -4
- package/dist/{StockView-BdXGfDNl.js → StockView-CqgqPyvI.js} +8 -8
- package/dist/SupplierView-CPHQT1Hn.js +817 -0
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-DktBkwCx.js → TransferDetails.vue_vue_type_script_setup_true_lang-CBmoU3pN.js} +4 -4
- package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-DV6IxKMM.js +1435 -0
- package/dist/TransferTemplateView-BR2-tTiQ.js +1290 -0
- package/dist/{UnitView-Dx2vWJXi.js → UnitView-vUCf46QM.js} +5 -5
- package/dist/{WarehouseView-UkmUZnqH.js → WarehouseView-B3D5kkAU.js} +3 -3
- package/dist/api/purchase-order-template.d.ts +4 -0
- package/dist/api/supplier.d.ts +6 -4
- package/dist/{app-BLzTa0Ut.js → app-Ds9lsiAo.js} +5542 -5522
- package/dist/app.js +1 -1
- package/dist/{array-AvWd53LI.js → array-ClJzD_Lt.js} +3 -3
- package/dist/components/ChangeLocationComponent.vue.d.ts +14 -11
- package/dist/components/FmInventoryTableToolbar.vue.d.ts +0 -2
- package/dist/components/FmMultiselectDialogProps.d.ts +1 -0
- package/dist/{decimal-DLYVb_I_.js → decimal-BZJuYjv-.js} +1 -1
- package/dist/format-unit-display-Dw4iQUDG.js +707 -0
- package/dist/{id-to-date-CKplrnj_.js → id-to-date-CLG4t5Zp.js} +1 -1
- package/dist/layout/SingleColumnLayout.vue.d.ts +1 -0
- package/dist/{layout-B9sdKjL9.js → layout-b03Lvqhx.js} +1 -1
- package/dist/stores/feature.d.ts +1 -0
- package/dist/stores/location.d.ts +1 -0
- package/dist/stores/supplier.d.ts +9 -9
- package/dist/supplier-C9OQNEl0.js +69 -0
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/views/supplier/components/SupplierDialogProps.d.ts +0 -1
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +583 -1
- package/dist/{xlsx-C3AV6UrJ.js → xlsx-B5RUBjKV.js} +1209 -1209
- package/dist/{xlsx.util-slrhXhsk.js → xlsx.util-H2UkpLte.js} +4 -4
- package/package.json +3 -3
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D0j4VOis.js +0 -306
- package/dist/SupplierView-ClL2oc8K.js +0 -813
- package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-BE95F9r1.js +0 -1437
- package/dist/TransferTemplateView-BXrNS8pg.js +0 -1279
- package/dist/format-unit-display-D_Z4TNZd.js +0 -668
- package/dist/supplier-BZ6HZcYB.js +0 -60
|
@@ -0,0 +1,1290 @@
|
|
|
1
|
+
import { defineComponent as X, onMounted as ve, computed as A, ref as q, watch as be, inject as We, resolveComponent as D, openBlock as I, createElementBlock as N, createElementVNode as n, createVNode as p, withCtx as B, renderSlot as Se, withDirectives as Re, normalizeClass as pe, vModelText as Me, reactive as Ke, h as O, toDisplayString as F, unref as e, createBlock as j, createCommentVNode as J, isRef as Be, Fragment as Ue, renderList as Ze, onUnmounted as Je, normalizeStyle as Xe, Teleport as et, mergeProps as Ie, normalizeProps as tt, guardReactiveProps as st } from "vue";
|
|
2
|
+
import { _ as ot, a as nt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-vuSl8LVG.js";
|
|
3
|
+
import { useI18n as Z } from "@feedmepos/mf-common";
|
|
4
|
+
import { P as L, a as lt, f as at, b as rt, c as De, d as it } from "./format-unit-display-Dw4iQUDG.js";
|
|
5
|
+
import { F as ae, R as Ae } from "./row-action.enum-PMKMRrZR.js";
|
|
6
|
+
import { $ as ce, t as Ve, I as ut, a0 as dt, a1 as mt, a as z, D as Oe, R as fe, a2 as ct, a3 as pt, r as me, a4 as ft, l as Pe, A as ye, M as Le, G as qe, a5 as yt, a6 as Ee, b as _e, u as vt, j as Ne, y as bt, a7 as _t, a8 as xt } from "./app-Ds9lsiAo.js";
|
|
7
|
+
import { F as E, _ as ze, u as ht } from "./layout-b03Lvqhx.js";
|
|
8
|
+
import { useBreakpoints as He, components as K, FmButtonVariant as gt, useDialog as kt, useSnackbar as Ct, useProxiedModel as je } from "@feedmepos/ui-library";
|
|
9
|
+
import { storeToRefs as wt } from "pinia";
|
|
10
|
+
import { d as Qe, c as re, u as Tt, _ as Ft } from "./TransferDialog.vue_vue_type_script_setup_true_lang-DV6IxKMM.js";
|
|
11
|
+
import { _ as Ye } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-6plo8rnV.js";
|
|
12
|
+
import { useRouter as $t } from "vue-router";
|
|
13
|
+
import { u as St } from "./supplier-C9OQNEl0.js";
|
|
14
|
+
const Rt = { class: "flex flex-col" }, Mt = { class: "flex flex-col" }, It = { class: "flex-1" }, Dt = { class: "flex items-center" }, At = { class: "flex-1" }, Vt = { class: "flex-1" }, Ot = /* @__PURE__ */ X({
|
|
15
|
+
__name: "FmMinMaxInput",
|
|
16
|
+
props: {
|
|
17
|
+
rules: {},
|
|
18
|
+
label: {},
|
|
19
|
+
minPlaceholder: {},
|
|
20
|
+
maxPlaceholder: {},
|
|
21
|
+
modelValue: {},
|
|
22
|
+
precision: {},
|
|
23
|
+
minLength: {},
|
|
24
|
+
maxLength: {},
|
|
25
|
+
inputmode: {},
|
|
26
|
+
type: {},
|
|
27
|
+
readonly: { type: Boolean },
|
|
28
|
+
labelMark: {},
|
|
29
|
+
prependIcon: {},
|
|
30
|
+
appendIcon: {},
|
|
31
|
+
showValidBorder: { type: Boolean },
|
|
32
|
+
labelInfo: {},
|
|
33
|
+
showWordCount: { type: Boolean },
|
|
34
|
+
invalid: { type: Boolean },
|
|
35
|
+
autofocus: { type: Boolean },
|
|
36
|
+
formatter: { type: Function },
|
|
37
|
+
decimal: {},
|
|
38
|
+
datalist: {},
|
|
39
|
+
shiftDatalist: { type: Boolean },
|
|
40
|
+
datalistMaxHeight: {},
|
|
41
|
+
datalistMinHeight: {},
|
|
42
|
+
offsetDatalist: {},
|
|
43
|
+
datalistPlacement: {},
|
|
44
|
+
datalistZIndex: {},
|
|
45
|
+
datalistWidth: {},
|
|
46
|
+
disabled: { type: Boolean },
|
|
47
|
+
focused: { type: Boolean },
|
|
48
|
+
helperText: {},
|
|
49
|
+
helperState: {}
|
|
50
|
+
},
|
|
51
|
+
setup(i) {
|
|
52
|
+
const b = i, d = Qe("modelValue"), l = ut();
|
|
53
|
+
ve(() => {
|
|
54
|
+
const { min: m, max: t } = d ?? {};
|
|
55
|
+
if (!(!m || !t) && m.precision !== t.precision) {
|
|
56
|
+
const s = Math.max(m.precision, t.precision), a = ce(m, s), v = ce(t, s);
|
|
57
|
+
d.min = a, d.max = v;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
const f = A(() => {
|
|
61
|
+
const { min: m, max: t } = d ?? {};
|
|
62
|
+
return Math.max((m == null ? void 0 : m.precision) ?? 0, (t == null ? void 0 : t.precision) ?? 0, b.precision ?? 0);
|
|
63
|
+
}), _ = A(() => ({
|
|
64
|
+
...d
|
|
65
|
+
})), h = (m) => {
|
|
66
|
+
if (!m) return "";
|
|
67
|
+
const t = dt(m), s = f.value, a = ce(t, s);
|
|
68
|
+
return mt(
|
|
69
|
+
+z(a),
|
|
70
|
+
a.precision
|
|
71
|
+
);
|
|
72
|
+
}, r = q(h(d.min)), o = q(h(d.max));
|
|
73
|
+
be([r, o], ([m, t]) => {
|
|
74
|
+
const s = d ?? {}, a = l(m), v = l(t), g = f.value;
|
|
75
|
+
if (m !== "" && a === !0) {
|
|
76
|
+
const x = Ve(+m, g);
|
|
77
|
+
s.min = x;
|
|
78
|
+
} else
|
|
79
|
+
s.min = null;
|
|
80
|
+
if (t !== "" && v === !0) {
|
|
81
|
+
const x = Ve(+t, g);
|
|
82
|
+
s.max = x;
|
|
83
|
+
} else
|
|
84
|
+
s.max = null;
|
|
85
|
+
d.min = s.min, d.max = s.max;
|
|
86
|
+
});
|
|
87
|
+
const u = Symbol.for("fm:form-state"), c = We(u, null), y = A(() => b.disabled ?? (c == null ? void 0 : c.getDisabled()) ?? !1), k = q(), S = q(), $ = q(!1), T = q(!1), P = A(() => $.value || T.value), U = A(() => [...[
|
|
88
|
+
function() {
|
|
89
|
+
return typeof l(r.value) == "string" || typeof l(o.value) == "string" ? "Must be a number" : !0;
|
|
90
|
+
},
|
|
91
|
+
function(s) {
|
|
92
|
+
return !s || !s.min || !s.max ? !0 : +z(s.min) > +z(s.max) ? "Min must be less than or equal to max" : !0;
|
|
93
|
+
}
|
|
94
|
+
], ...b.rules ?? []]);
|
|
95
|
+
return (m, t) => {
|
|
96
|
+
const s = D("FmLabel"), a = D("FmField"), v = D("FmFormGroup");
|
|
97
|
+
return I(), N("div", Rt, [
|
|
98
|
+
n("div", Mt, [
|
|
99
|
+
n("div", It, [
|
|
100
|
+
p(s, {
|
|
101
|
+
label: m.label,
|
|
102
|
+
disabled: m.disabled,
|
|
103
|
+
required: m.labelMark === "required",
|
|
104
|
+
optional: m.labelMark === "optional"
|
|
105
|
+
}, null, 8, ["label", "disabled", "required", "optional"])
|
|
106
|
+
]),
|
|
107
|
+
p(a, { focused: P.value }, {
|
|
108
|
+
default: B(() => [
|
|
109
|
+
n("div", Dt, [
|
|
110
|
+
Se(m.$slots, "prepend"),
|
|
111
|
+
t[6] || (t[6] = n("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400 pr-4" }, "Min.", -1)),
|
|
112
|
+
n("div", At, [
|
|
113
|
+
Re(n("input", {
|
|
114
|
+
type: "text",
|
|
115
|
+
ref_key: "minInputRef",
|
|
116
|
+
ref: k,
|
|
117
|
+
onFocus: t[0] || (t[0] = () => $.value = !0),
|
|
118
|
+
onBlur: t[1] || (t[1] = () => $.value = !1),
|
|
119
|
+
"onUpdate:modelValue": t[2] || (t[2] = (g) => r.value = g),
|
|
120
|
+
class: pe({
|
|
121
|
+
"fm-text-field--input fm-typo-en-body-lg-400": !0,
|
|
122
|
+
"text-fm-color-typo-primary": !y.value,
|
|
123
|
+
"text-fm-color-typo-disabled": y.value
|
|
124
|
+
})
|
|
125
|
+
}, null, 34), [
|
|
126
|
+
[Me, r.value]
|
|
127
|
+
])
|
|
128
|
+
]),
|
|
129
|
+
t[7] || (t[7] = n("div", { class: "block h-32 mx-4 w-[1px] bg-fm-color-neutral-gray-200" }, null, -1)),
|
|
130
|
+
t[8] || (t[8] = n("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400 pr-4" }, "Max.", -1)),
|
|
131
|
+
n("div", Vt, [
|
|
132
|
+
Re(n("input", {
|
|
133
|
+
type: "text",
|
|
134
|
+
ref_key: "maxInputRef",
|
|
135
|
+
ref: S,
|
|
136
|
+
onFocus: t[3] || (t[3] = () => T.value = !0),
|
|
137
|
+
onBlur: t[4] || (t[4] = () => T.value = !1),
|
|
138
|
+
"onUpdate:modelValue": t[5] || (t[5] = (g) => o.value = g),
|
|
139
|
+
class: pe({
|
|
140
|
+
"fm-text-field--input fm-typo-en-body-lg-400": !0,
|
|
141
|
+
"text-fm-color-typo-primary": !y.value,
|
|
142
|
+
"text-fm-color-typo-disabled": y.value
|
|
143
|
+
})
|
|
144
|
+
}, null, 34), [
|
|
145
|
+
[Me, o.value]
|
|
146
|
+
])
|
|
147
|
+
]),
|
|
148
|
+
Se(m.$slots, "append")
|
|
149
|
+
])
|
|
150
|
+
]),
|
|
151
|
+
_: 3
|
|
152
|
+
}, 8, ["focused"])
|
|
153
|
+
]),
|
|
154
|
+
p(v, {
|
|
155
|
+
class: "flex-1",
|
|
156
|
+
"model-value": _.value,
|
|
157
|
+
info: m.labelInfo,
|
|
158
|
+
rules: U.value,
|
|
159
|
+
"helper-text": m.helperText,
|
|
160
|
+
"helper-state": m.helperState
|
|
161
|
+
}, null, 8, ["model-value", "info", "rules", "helper-text", "helper-state"])
|
|
162
|
+
]);
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
function Pt() {
|
|
167
|
+
return function(b) {
|
|
168
|
+
return !b || !b.min || !b.max ? "Required" : !0;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function Lt(i, b) {
|
|
172
|
+
return function(l) {
|
|
173
|
+
return !l || !l.min || !l.max ? !0 : +z(l.min) < i ? `Must be between ${i} and ${b}` : +z(l.max) > b ? `Must be between ${i} and ${b}` : !0;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
var M = /* @__PURE__ */ ((i) => (i.Code = "Code", i.Name = "Name", i.DefaultAmount = "DefaultAmount", i.Limit = "Limit", i.MinimumAmount = "MinimumAmount", i.Step = "Step", i.Cost = "Cost", i.Delete = "Delete", i))(M || {});
|
|
177
|
+
const Bt = () => {
|
|
178
|
+
const { t: i } = Z();
|
|
179
|
+
return O(
|
|
180
|
+
Ye,
|
|
181
|
+
{
|
|
182
|
+
zIndex: 50,
|
|
183
|
+
class: "whitespace-nowrap"
|
|
184
|
+
},
|
|
185
|
+
i("inventory.transfer.form.items.table.Cost", [Ee()])
|
|
186
|
+
);
|
|
187
|
+
};
|
|
188
|
+
function Ut(i) {
|
|
189
|
+
const { t: b } = Z(), d = Ke({}), { breakpoints: l } = He();
|
|
190
|
+
ve(() => {
|
|
191
|
+
for (const r of i.items) {
|
|
192
|
+
if (!r.totalCost)
|
|
193
|
+
continue;
|
|
194
|
+
const o = re(r.sku, r.quantity, r.measurement, {
|
|
195
|
+
supplier: i.supplier
|
|
196
|
+
}), u = r.totalCost ?? Oe.reset();
|
|
197
|
+
o ? d[r.sku._id] = o.amount !== u.amount || o.precision !== u.precision : d[r.sku._id] = !0;
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
function f(r) {
|
|
201
|
+
var u, c, y, k, S, $, T;
|
|
202
|
+
return !!(((c = (u = r.defaultCost) == null ? void 0 : u.costPerUnit) == null ? void 0 : c.amount) ?? ((T = ($ = (S = (k = (y = i.supplier) == null ? void 0 : y.supplyItems) == null ? void 0 : k.find((P) => P.skuId === r._id)) == null ? void 0 : S.defaultCost) == null ? void 0 : $.costPerUnit) == null ? void 0 : T.amount));
|
|
203
|
+
}
|
|
204
|
+
const _ = [
|
|
205
|
+
{
|
|
206
|
+
id: "Code",
|
|
207
|
+
header: () => b("inventory.transfer.form.items.table.Code"),
|
|
208
|
+
accessorKey: "code",
|
|
209
|
+
size: 96,
|
|
210
|
+
cell(r) {
|
|
211
|
+
const o = r.row.original;
|
|
212
|
+
return O(K.FmTextField, {
|
|
213
|
+
modelValue: o.code,
|
|
214
|
+
"onUpdate:modelValue": (u) => {
|
|
215
|
+
i.updateItem({
|
|
216
|
+
...o,
|
|
217
|
+
code: u
|
|
218
|
+
});
|
|
219
|
+
},
|
|
220
|
+
key: o.sku._id,
|
|
221
|
+
rules: [fe()],
|
|
222
|
+
labelMark: "required"
|
|
223
|
+
});
|
|
224
|
+
},
|
|
225
|
+
enableSorting: !1
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
id: "Name",
|
|
229
|
+
header: () => b("inventory.transfer.form.items.table.Name"),
|
|
230
|
+
minSize: 300,
|
|
231
|
+
cell(r) {
|
|
232
|
+
const o = r.row.original;
|
|
233
|
+
return O(K.FmTextField, {
|
|
234
|
+
modelValue: o.name,
|
|
235
|
+
"onUpdate:modelValue": (u) => {
|
|
236
|
+
i.updateItem({
|
|
237
|
+
...o,
|
|
238
|
+
name: u
|
|
239
|
+
});
|
|
240
|
+
},
|
|
241
|
+
key: o.sku._id,
|
|
242
|
+
rules: [fe()],
|
|
243
|
+
labelMark: "required"
|
|
244
|
+
});
|
|
245
|
+
},
|
|
246
|
+
enableSorting: !1
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
id: "DefaultAmount",
|
|
250
|
+
header: () => b("inventory.transfer.form.items.table.DefaultAmount2"),
|
|
251
|
+
minSize: 200,
|
|
252
|
+
cell(r) {
|
|
253
|
+
const o = r.row.original;
|
|
254
|
+
return O(ct, {
|
|
255
|
+
style: {
|
|
256
|
+
flex: "1 1 0%"
|
|
257
|
+
},
|
|
258
|
+
modelValue: {
|
|
259
|
+
amount: o.quantity ?? { amount: 1, precision: 0 },
|
|
260
|
+
measurement: o.measurement ?? null
|
|
261
|
+
},
|
|
262
|
+
disabled: i.disabled,
|
|
263
|
+
key: o.sku._id,
|
|
264
|
+
unit: o.sku.unit,
|
|
265
|
+
"onUpdate:modelValue": (u) => {
|
|
266
|
+
i.updateItem({
|
|
267
|
+
...o,
|
|
268
|
+
quantity: u.amount,
|
|
269
|
+
measurement: u.measurement
|
|
270
|
+
});
|
|
271
|
+
},
|
|
272
|
+
rules: [
|
|
273
|
+
pt(
|
|
274
|
+
+z(
|
|
275
|
+
o.minimumQuantity ?? {
|
|
276
|
+
amount: 1,
|
|
277
|
+
precision: me(o.sku.unit, o.measurement)
|
|
278
|
+
}
|
|
279
|
+
)
|
|
280
|
+
),
|
|
281
|
+
ft(
|
|
282
|
+
o.maximumQuantity ? +z(o.maximumQuantity) : 1 / 0
|
|
283
|
+
)
|
|
284
|
+
],
|
|
285
|
+
applyDefaultRules: !0
|
|
286
|
+
});
|
|
287
|
+
},
|
|
288
|
+
enableSorting: !1
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
id: "Limit",
|
|
292
|
+
header: () => "Limit",
|
|
293
|
+
// TODO: i18n,
|
|
294
|
+
minSize: 280,
|
|
295
|
+
cell(r) {
|
|
296
|
+
const o = r.row.original;
|
|
297
|
+
return O(Ot, {
|
|
298
|
+
style: {
|
|
299
|
+
flex: "1 1 0%"
|
|
300
|
+
},
|
|
301
|
+
modelValue: {
|
|
302
|
+
min: o.minimumQuantity,
|
|
303
|
+
max: o.maximumQuantity
|
|
304
|
+
},
|
|
305
|
+
disabled: i.disabled,
|
|
306
|
+
key: o.sku._id,
|
|
307
|
+
unit: o.sku.unit,
|
|
308
|
+
"onUpdate:modelValue": (u) => {
|
|
309
|
+
const c = { ...o };
|
|
310
|
+
u != null && u.min && (c.minimumQuantity = u.min), u != null && u.max && (c.maximumQuantity = u.max), i.updateItem(c);
|
|
311
|
+
},
|
|
312
|
+
rules: [
|
|
313
|
+
Pt(),
|
|
314
|
+
Lt(
|
|
315
|
+
+z({
|
|
316
|
+
amount: 1,
|
|
317
|
+
precision: me(o.sku.unit, o.measurement)
|
|
318
|
+
}),
|
|
319
|
+
1 / 0
|
|
320
|
+
)
|
|
321
|
+
],
|
|
322
|
+
disableUnit: !0,
|
|
323
|
+
applyDefaultRules: !0
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
id: "Step",
|
|
329
|
+
header: () => b("inventory.transfer.form.items.table.Step"),
|
|
330
|
+
minSize: 100,
|
|
331
|
+
cell(r) {
|
|
332
|
+
const o = r.row.original;
|
|
333
|
+
return O(K.FmTextField, {
|
|
334
|
+
modelValue: z(o.quantityStep ?? Oe.reset(), !1),
|
|
335
|
+
key: o.sku._id,
|
|
336
|
+
"onUpdate:modelValue": (u) => {
|
|
337
|
+
i.updateItem({
|
|
338
|
+
...o,
|
|
339
|
+
quantityStep: Pe(+u)
|
|
340
|
+
});
|
|
341
|
+
},
|
|
342
|
+
rules: [
|
|
343
|
+
ye({
|
|
344
|
+
amount: 1,
|
|
345
|
+
precision: me(o.sku.unit, o.measurement)
|
|
346
|
+
}),
|
|
347
|
+
Le(o.sku.unit, o.measurement)
|
|
348
|
+
]
|
|
349
|
+
});
|
|
350
|
+
},
|
|
351
|
+
enableSorting: !1
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
id: "Cost",
|
|
355
|
+
header: Bt,
|
|
356
|
+
size: 180,
|
|
357
|
+
cell(r) {
|
|
358
|
+
const o = r.row.original, u = f(o.sku), c = l.value.xs || l.value.sm;
|
|
359
|
+
return !d[o.sku._id] && u ? O(
|
|
360
|
+
"div",
|
|
361
|
+
{
|
|
362
|
+
class: "flex gap-4 fm-typo-en-body-md-400 items-center",
|
|
363
|
+
key: o.sku._id
|
|
364
|
+
},
|
|
365
|
+
[
|
|
366
|
+
O(K.FmButton, {
|
|
367
|
+
prependIcon: "edit",
|
|
368
|
+
variant: gt.Tertiary,
|
|
369
|
+
onClick() {
|
|
370
|
+
i.updateItem({
|
|
371
|
+
...o,
|
|
372
|
+
totalCost: re(o.sku, o.quantity, o.measurement, {
|
|
373
|
+
supplier: i.supplier
|
|
374
|
+
})
|
|
375
|
+
}), d[o.sku._id] = !0;
|
|
376
|
+
},
|
|
377
|
+
disabled: i.disabled
|
|
378
|
+
}),
|
|
379
|
+
O(
|
|
380
|
+
"div",
|
|
381
|
+
{
|
|
382
|
+
class: "flex flex-col"
|
|
383
|
+
},
|
|
384
|
+
[
|
|
385
|
+
O(
|
|
386
|
+
"span",
|
|
387
|
+
{
|
|
388
|
+
class: [i.disabled ? "text-fm-color-typo-disabled" : ""]
|
|
389
|
+
},
|
|
390
|
+
c ? qe(
|
|
391
|
+
re(o.sku, o.quantity, o.measurement, {
|
|
392
|
+
supplier: i.supplier
|
|
393
|
+
})
|
|
394
|
+
) : z(
|
|
395
|
+
re(o.sku, o.quantity, o.measurement, {
|
|
396
|
+
supplier: i.supplier
|
|
397
|
+
})
|
|
398
|
+
)
|
|
399
|
+
),
|
|
400
|
+
O(
|
|
401
|
+
"span",
|
|
402
|
+
{
|
|
403
|
+
class: [
|
|
404
|
+
"fm-typo-en-body-sm-400",
|
|
405
|
+
i.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-neutral-gray-400"
|
|
406
|
+
]
|
|
407
|
+
},
|
|
408
|
+
b("inventory.transfer.form.items.autoCalculated")
|
|
409
|
+
)
|
|
410
|
+
]
|
|
411
|
+
)
|
|
412
|
+
]
|
|
413
|
+
) : O(
|
|
414
|
+
K.FmTextField,
|
|
415
|
+
{
|
|
416
|
+
modelValue: z(o.totalCost ?? { amount: 0, precision: 0 }),
|
|
417
|
+
key: o.sku._id,
|
|
418
|
+
"onUpdate:modelValue": (y) => {
|
|
419
|
+
i.updateItem({
|
|
420
|
+
...o,
|
|
421
|
+
totalCost: {
|
|
422
|
+
...Pe(+y),
|
|
423
|
+
currency: yt()
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
},
|
|
427
|
+
rules: [ye(0), Le(2)]
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
prepend() {
|
|
431
|
+
return c ? O(
|
|
432
|
+
"div",
|
|
433
|
+
{
|
|
434
|
+
class: [
|
|
435
|
+
"text-fm-typo-en-body-lg-400",
|
|
436
|
+
i.disabled ? "text-fm-color-typo-disabled" : ""
|
|
437
|
+
]
|
|
438
|
+
},
|
|
439
|
+
Ee()
|
|
440
|
+
) : null;
|
|
441
|
+
},
|
|
442
|
+
append() {
|
|
443
|
+
return u ? O(K.FmButton, {
|
|
444
|
+
prependIcon: "close",
|
|
445
|
+
variant: "tertiary",
|
|
446
|
+
onClick() {
|
|
447
|
+
i.updateItem({
|
|
448
|
+
...o,
|
|
449
|
+
totalCost: null
|
|
450
|
+
}), d[o.sku._id] = !1;
|
|
451
|
+
},
|
|
452
|
+
disabled: i.disabled
|
|
453
|
+
}) : null;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
);
|
|
457
|
+
},
|
|
458
|
+
enableSorting: !1
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
id: "Delete",
|
|
462
|
+
header: "",
|
|
463
|
+
cell(r) {
|
|
464
|
+
const o = r.row.original;
|
|
465
|
+
return O(K.FmButton, {
|
|
466
|
+
class: "delete-button",
|
|
467
|
+
key: o.sku._id,
|
|
468
|
+
type: "button",
|
|
469
|
+
icon: "delete",
|
|
470
|
+
variant: "tertiary",
|
|
471
|
+
size: "md",
|
|
472
|
+
disabled: i.disabled,
|
|
473
|
+
onClick: () => {
|
|
474
|
+
i.deleteItem(o);
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
},
|
|
478
|
+
enableSorting: !1,
|
|
479
|
+
size: 40,
|
|
480
|
+
meta: {
|
|
481
|
+
cellClass: "",
|
|
482
|
+
headerClass: ""
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
];
|
|
486
|
+
return {
|
|
487
|
+
columnDefs: A(() => _e().enableTotalCost && i.transferType === L.PURCHASE ? _ : _.filter((o) => o.id !== "Cost"))
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
const qt = { class: "flex flex-col gap-8 py-16" }, Et = { class: "flex items-center" }, Nt = { class: "flex-1 flex gap-1 items-center" }, zt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Ht = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, jt = { class: "flex gap-8 w-full" }, Qt = { class: "flex-1 flex flex-col gap-4" }, Yt = { class: "flex-1 flex flex-col gap-4" }, Gt = { class: "flex gap-8 w-full" }, Wt = { class: "flex-1 flex flex-col gap-4" }, Kt = { class: "flex-1 flex flex-col gap-4" }, Zt = { class: "flex gap-8 w-full" }, Jt = { class: "flex-1 flex flex-col gap-4" }, Xt = { class: "flex-1 flex flex-col gap-4" }, es = /* @__PURE__ */ X({
|
|
491
|
+
__name: "TransferTemplateItem",
|
|
492
|
+
props: {
|
|
493
|
+
cellByColId: {},
|
|
494
|
+
row: {}
|
|
495
|
+
},
|
|
496
|
+
setup(i) {
|
|
497
|
+
const { t: b } = Z();
|
|
498
|
+
return (d, l) => {
|
|
499
|
+
var _, h, r, o, u, c, y, k, S, $, T, P, U, m, t, s, a, v, g, x, R, C, V, w, H, Q, ee, te, Y, se, G, oe, ne, W, le;
|
|
500
|
+
const f = D("FmLabel");
|
|
501
|
+
return I(), N("div", qt, [
|
|
502
|
+
n("div", Et, [
|
|
503
|
+
n("div", Nt, [
|
|
504
|
+
n("span", zt, " (" + F(d.row.original.sku.code) + ") ", 1),
|
|
505
|
+
n("span", Ht, F(d.row.original.sku.name), 1)
|
|
506
|
+
]),
|
|
507
|
+
n("div", null, [
|
|
508
|
+
p(e(E), {
|
|
509
|
+
render: (r = (h = (_ = d.cellByColId.Delete) == null ? void 0 : _.column) == null ? void 0 : h.columnDef) == null ? void 0 : r.cell,
|
|
510
|
+
props: (u = (o = d.cellByColId.Delete) == null ? void 0 : o.getContext) == null ? void 0 : u.call(o)
|
|
511
|
+
}, null, 8, ["render", "props"])
|
|
512
|
+
])
|
|
513
|
+
]),
|
|
514
|
+
n("div", jt, [
|
|
515
|
+
n("div", Qt, [
|
|
516
|
+
p(f, {
|
|
517
|
+
label: e(b)(`inventory.transfer.form.items.table.${e(M).Code}`)
|
|
518
|
+
}, null, 8, ["label"]),
|
|
519
|
+
p(e(E), {
|
|
520
|
+
render: (k = (y = (c = d.cellByColId[e(M).Code]) == null ? void 0 : c.column) == null ? void 0 : y.columnDef) == null ? void 0 : k.cell,
|
|
521
|
+
props: ($ = (S = d.cellByColId[e(M).Code]) == null ? void 0 : S.getContext) == null ? void 0 : $.call(S)
|
|
522
|
+
}, null, 8, ["render", "props"]),
|
|
523
|
+
l[0] || (l[0] = n("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
524
|
+
]),
|
|
525
|
+
n("div", Yt, [
|
|
526
|
+
p(f, {
|
|
527
|
+
label: e(b)(`inventory.transfer.form.items.table.${e(M).Name}`)
|
|
528
|
+
}, null, 8, ["label"]),
|
|
529
|
+
p(e(E), {
|
|
530
|
+
render: (U = (P = (T = d.cellByColId[e(M).Name]) == null ? void 0 : T.column) == null ? void 0 : P.columnDef) == null ? void 0 : U.cell,
|
|
531
|
+
props: (t = (m = d.cellByColId[e(M).Name]) == null ? void 0 : m.getContext) == null ? void 0 : t.call(m)
|
|
532
|
+
}, null, 8, ["render", "props"]),
|
|
533
|
+
l[1] || (l[1] = n("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
534
|
+
])
|
|
535
|
+
]),
|
|
536
|
+
n("div", Gt, [
|
|
537
|
+
n("div", Wt, [
|
|
538
|
+
p(f, {
|
|
539
|
+
label: e(b)(`inventory.transfer.form.items.table.${e(M).Limit}`)
|
|
540
|
+
}, null, 8, ["label"]),
|
|
541
|
+
p(e(E), {
|
|
542
|
+
render: (v = (a = (s = d.cellByColId[e(M).Limit]) == null ? void 0 : s.column) == null ? void 0 : a.columnDef) == null ? void 0 : v.cell,
|
|
543
|
+
props: (x = (g = d.cellByColId[e(M).Limit]) == null ? void 0 : g.getContext) == null ? void 0 : x.call(g)
|
|
544
|
+
}, null, 8, ["render", "props"]),
|
|
545
|
+
l[2] || (l[2] = n("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
546
|
+
]),
|
|
547
|
+
n("div", Kt, [
|
|
548
|
+
p(f, {
|
|
549
|
+
label: e(b)(`inventory.transfer.form.items.table.${e(M).Step}`)
|
|
550
|
+
}, null, 8, ["label"]),
|
|
551
|
+
p(e(E), {
|
|
552
|
+
render: (V = (C = (R = d.cellByColId[e(M).Step]) == null ? void 0 : R.column) == null ? void 0 : C.columnDef) == null ? void 0 : V.cell,
|
|
553
|
+
props: (H = (w = d.cellByColId[e(M).Step]) == null ? void 0 : w.getContext) == null ? void 0 : H.call(w)
|
|
554
|
+
}, null, 8, ["render", "props"]),
|
|
555
|
+
l[3] || (l[3] = n("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
556
|
+
])
|
|
557
|
+
]),
|
|
558
|
+
n("div", Zt, [
|
|
559
|
+
n("div", Jt, [
|
|
560
|
+
p(f, {
|
|
561
|
+
label: e(b)(`inventory.transfer.form.items.table.${e(M).DefaultAmount}`)
|
|
562
|
+
}, null, 8, ["label"]),
|
|
563
|
+
p(e(E), {
|
|
564
|
+
render: (te = (ee = (Q = d.cellByColId[e(M).DefaultAmount]) == null ? void 0 : Q.column) == null ? void 0 : ee.columnDef) == null ? void 0 : te.cell,
|
|
565
|
+
props: (se = (Y = d.cellByColId[e(M).DefaultAmount]) == null ? void 0 : Y.getContext) == null ? void 0 : se.call(Y)
|
|
566
|
+
}, null, 8, ["render", "props"]),
|
|
567
|
+
l[4] || (l[4] = n("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
568
|
+
]),
|
|
569
|
+
n("div", Xt, [
|
|
570
|
+
p(Ye, { "z-index": 50 }, {
|
|
571
|
+
default: B(() => [
|
|
572
|
+
p(f, {
|
|
573
|
+
label: e(b)(`inventory.transfer.form.items.table.${e(M).Cost}2`)
|
|
574
|
+
}, null, 8, ["label"])
|
|
575
|
+
]),
|
|
576
|
+
_: 1
|
|
577
|
+
}),
|
|
578
|
+
p(e(E), {
|
|
579
|
+
render: (ne = (oe = (G = d.cellByColId[e(M).Cost]) == null ? void 0 : G.column) == null ? void 0 : oe.columnDef) == null ? void 0 : ne.cell,
|
|
580
|
+
props: (le = (W = d.cellByColId[e(M).Cost]) == null ? void 0 : W.getContext) == null ? void 0 : le.call(W)
|
|
581
|
+
}, null, 8, ["render", "props"]),
|
|
582
|
+
l[5] || (l[5] = n("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
583
|
+
])
|
|
584
|
+
])
|
|
585
|
+
]);
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
}), ts = { class: "flex flex-col gap-16" }, ss = { key: 0 }, os = { class: "flex flex-col gap-24" }, ns = { class: "flex flex-col gap-16" }, ls = { class: "flex" }, as = { class: "flex-1 gap-8 fm-typo-en-title-sm-800" }, rs = /* @__PURE__ */ X({
|
|
589
|
+
__name: "TransferTemplateForm",
|
|
590
|
+
props: {
|
|
591
|
+
modelValue: {},
|
|
592
|
+
disabled: { type: Boolean }
|
|
593
|
+
},
|
|
594
|
+
setup(i, { expose: b }) {
|
|
595
|
+
const d = i, l = Qe(), { t: f } = Z(), _ = Ne(), h = vt(), r = St(), o = A(() => _.businessLevel);
|
|
596
|
+
be(
|
|
597
|
+
() => d.modelValue,
|
|
598
|
+
(t) => {
|
|
599
|
+
console.log("TransferTemplateForm.model", t);
|
|
600
|
+
}
|
|
601
|
+
), _.watchLocation(async () => {
|
|
602
|
+
location && (l.purchaseOrder.supplier || (l.purchaseOrder.supplier = r.suppliers.find((t) => t) ?? l.purchaseOrder.supplier));
|
|
603
|
+
});
|
|
604
|
+
const u = kt(), c = Tt(
|
|
605
|
+
() => l.purchaseOrder,
|
|
606
|
+
(t) => {
|
|
607
|
+
l.purchaseOrder = {
|
|
608
|
+
...l.purchaseOrder,
|
|
609
|
+
...t
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
), y = A({
|
|
613
|
+
get() {
|
|
614
|
+
var t, s;
|
|
615
|
+
return typeof ((s = (t = l.purchaseOrder) == null ? void 0 : t.supplier) == null ? void 0 : s.internal) == "string" ? L.TRANSFER : L.PURCHASE;
|
|
616
|
+
},
|
|
617
|
+
set(t) {
|
|
618
|
+
var a, v;
|
|
619
|
+
const s = typeof ((v = (a = l.purchaseOrder) == null ? void 0 : a.supplier) == null ? void 0 : v.internal) == "string" ? L.TRANSFER : L.PURCHASE;
|
|
620
|
+
t !== s && (l.purchaseOrder.supplier = t === L.PURCHASE ? c.locationOptionsTypePurchase.value[0] : c.locationOptionsTypeTransfer.value[0]);
|
|
621
|
+
}
|
|
622
|
+
}), k = A(() => c.transferLocationOptions.value), S = A({
|
|
623
|
+
get() {
|
|
624
|
+
return l.purchaseOrder.supplier._id;
|
|
625
|
+
},
|
|
626
|
+
set(t) {
|
|
627
|
+
c.transferLocationModel.value = t;
|
|
628
|
+
}
|
|
629
|
+
}), $ = A({
|
|
630
|
+
get() {
|
|
631
|
+
return l.purchaseOrder.remark ?? void 0;
|
|
632
|
+
},
|
|
633
|
+
set(t) {
|
|
634
|
+
l.purchaseOrder.remark = t;
|
|
635
|
+
}
|
|
636
|
+
}), T = q();
|
|
637
|
+
b({
|
|
638
|
+
validateInputs: () => {
|
|
639
|
+
var t, s;
|
|
640
|
+
(s = (t = T.value) == null ? void 0 : t.validateInputs) == null || s.call(t);
|
|
641
|
+
},
|
|
642
|
+
resetInputsValidation: () => {
|
|
643
|
+
var t, s;
|
|
644
|
+
(s = (t = T.value) == null ? void 0 : t.resetInputsValidation) == null || s.call(t);
|
|
645
|
+
},
|
|
646
|
+
resetInputs: () => {
|
|
647
|
+
var t, s;
|
|
648
|
+
(s = (t = T.value) == null ? void 0 : t.resetInputs) == null || s.call(t);
|
|
649
|
+
}
|
|
650
|
+
});
|
|
651
|
+
const P = Ut({
|
|
652
|
+
updateItem: (t) => {
|
|
653
|
+
l.purchaseOrder.items = l.purchaseOrder.items.map((s) => s.sku._id !== t.sku._id ? s : t);
|
|
654
|
+
},
|
|
655
|
+
deleteItem: (t) => {
|
|
656
|
+
l.purchaseOrder.items = l.purchaseOrder.items.filter(
|
|
657
|
+
(s) => s.sku._id !== t.sku._id
|
|
658
|
+
);
|
|
659
|
+
},
|
|
660
|
+
get supplier() {
|
|
661
|
+
return l.purchaseOrder.supplier;
|
|
662
|
+
},
|
|
663
|
+
get items() {
|
|
664
|
+
return l.purchaseOrder.items;
|
|
665
|
+
},
|
|
666
|
+
get transferType() {
|
|
667
|
+
return y.value;
|
|
668
|
+
},
|
|
669
|
+
get disabled() {
|
|
670
|
+
return d.disabled;
|
|
671
|
+
}
|
|
672
|
+
}), U = A(() => P.columnDefs.value);
|
|
673
|
+
function m() {
|
|
674
|
+
const t = h.skus.map((a) => ({
|
|
675
|
+
label: a.name,
|
|
676
|
+
sublabel: a.code,
|
|
677
|
+
value: a
|
|
678
|
+
})), s = t.filter((a) => {
|
|
679
|
+
var v;
|
|
680
|
+
return (v = l.purchaseOrder.items) == null ? void 0 : v.find((g) => g.sku._id === a.value._id);
|
|
681
|
+
}).map((a) => a.value);
|
|
682
|
+
u.open({
|
|
683
|
+
title: f("inventory.transfer.form.items.selectItem"),
|
|
684
|
+
closeButton: !0,
|
|
685
|
+
contentComponent: bt,
|
|
686
|
+
contentComponentProps: {
|
|
687
|
+
modelValue: s,
|
|
688
|
+
items: t
|
|
689
|
+
},
|
|
690
|
+
primaryActions: {
|
|
691
|
+
text: f("common.confirm"),
|
|
692
|
+
close: !0
|
|
693
|
+
},
|
|
694
|
+
secondaryActions: {
|
|
695
|
+
text: f("common.close"),
|
|
696
|
+
close: !0,
|
|
697
|
+
variant: "tertiary"
|
|
698
|
+
}
|
|
699
|
+
}).onPrimary((a) => {
|
|
700
|
+
const v = l.purchaseOrder.items ?? [], g = a.map((x) => {
|
|
701
|
+
const R = v.find((w) => w.sku._id === x._id);
|
|
702
|
+
if (R)
|
|
703
|
+
return R;
|
|
704
|
+
const C = { amount: 1, precision: me(x.unit) }, V = {
|
|
705
|
+
sku: x,
|
|
706
|
+
code: x.code,
|
|
707
|
+
name: x.name,
|
|
708
|
+
quantity: C,
|
|
709
|
+
minimumQuantity: C,
|
|
710
|
+
maximumQuantity: C,
|
|
711
|
+
quantityStep: C
|
|
712
|
+
};
|
|
713
|
+
return y.value == L.PURCHASE && (V.totalCost = re(
|
|
714
|
+
V.sku,
|
|
715
|
+
V.quantity,
|
|
716
|
+
V.measurement,
|
|
717
|
+
{
|
|
718
|
+
supplier: l.purchaseOrder.supplier
|
|
719
|
+
}
|
|
720
|
+
)), V;
|
|
721
|
+
});
|
|
722
|
+
g.sort((x, R) => x.sku.code.localeCompare(R.sku.code)), l.purchaseOrder.items = g;
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
return (t, s) => {
|
|
726
|
+
const a = D("FmChip"), v = D("FmTextField"), g = D("FmSelect"), x = D("FmTextarea"), R = D("FmButton"), C = D("FmTable"), V = D("FmForm");
|
|
727
|
+
return I(), j(V, {
|
|
728
|
+
ref_key: "formRef",
|
|
729
|
+
ref: T,
|
|
730
|
+
class: "flex flex-col gap-32",
|
|
731
|
+
disabled: t.disabled
|
|
732
|
+
}, {
|
|
733
|
+
default: B(() => [
|
|
734
|
+
n("div", ts, [
|
|
735
|
+
o.value ? (I(), N("div", ss, [
|
|
736
|
+
p(a, {
|
|
737
|
+
label: "Business template",
|
|
738
|
+
compact: ""
|
|
739
|
+
})
|
|
740
|
+
])) : J("", !0),
|
|
741
|
+
n("div", os, [
|
|
742
|
+
p(v, {
|
|
743
|
+
label: e(f)("inventory.transfer.form.name"),
|
|
744
|
+
"label-mark": "required",
|
|
745
|
+
modelValue: e(l).name,
|
|
746
|
+
"onUpdate:modelValue": s[0] || (s[0] = (w) => e(l).name = w),
|
|
747
|
+
rules: [e(fe)()]
|
|
748
|
+
}, null, 8, ["label", "modelValue", "rules"]),
|
|
749
|
+
p(g, {
|
|
750
|
+
label: e(f)("inventory.transfer.form.type.title"),
|
|
751
|
+
"model-value": y.value,
|
|
752
|
+
"onUpdate:modelValue": s[1] || (s[1] = (w) => y.value = w),
|
|
753
|
+
items: [
|
|
754
|
+
{
|
|
755
|
+
label: e(f)(
|
|
756
|
+
`inventory.transfer.form.type.${e(L).PURCHASE.toLocaleLowerCase()}`
|
|
757
|
+
),
|
|
758
|
+
value: e(L).PURCHASE,
|
|
759
|
+
disabled: !e(c).locationOptionsTypePurchase.value.length,
|
|
760
|
+
sublabel: e(c).locationOptionsTypePurchase.value.length ? void 0 : e(f)("inventory.transfer.form.noSupplierAvailable")
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
label: e(f)(
|
|
764
|
+
`inventory.transfer.form.type.${e(L).TRANSFER.toLocaleLowerCase()}`
|
|
765
|
+
),
|
|
766
|
+
value: e(L).TRANSFER,
|
|
767
|
+
disabled: !e(c).locationOptionsTypeTransfer.value.length,
|
|
768
|
+
sublabel: e(c).locationOptionsTypeTransfer.value.length ? void 0 : e(f)("inventory.transfer.form.noLocationAvailable")
|
|
769
|
+
}
|
|
770
|
+
],
|
|
771
|
+
rules: [e(ye)(1)(k.value)]
|
|
772
|
+
}, null, 8, ["label", "model-value", "items", "rules"]),
|
|
773
|
+
p(g, {
|
|
774
|
+
label: y.value === e(L).PURCHASE ? e(f)("inventory.transfer.form.purchaseFrom") : e(f)("inventory.transfer.form.transferFrom"),
|
|
775
|
+
modelValue: S.value,
|
|
776
|
+
"onUpdate:modelValue": s[2] || (s[2] = (w) => S.value = w),
|
|
777
|
+
items: k.value
|
|
778
|
+
}, null, 8, ["label", "modelValue", "items"]),
|
|
779
|
+
p(v, {
|
|
780
|
+
label: e(f)("inventory.transfer.form.reference"),
|
|
781
|
+
"label-mark": "optional",
|
|
782
|
+
modelValue: e(l).purchaseOrder.ref,
|
|
783
|
+
"onUpdate:modelValue": s[3] || (s[3] = (w) => e(l).purchaseOrder.ref = w)
|
|
784
|
+
}, null, 8, ["label", "modelValue"]),
|
|
785
|
+
p(x, {
|
|
786
|
+
label: e(f)("inventory.transfer.form.remark"),
|
|
787
|
+
"label-mark": "optional",
|
|
788
|
+
"max-length": 240,
|
|
789
|
+
modelValue: $.value,
|
|
790
|
+
"onUpdate:modelValue": s[4] || (s[4] = (w) => $.value = w),
|
|
791
|
+
class: pe({ "text-fm-color-typo-disabled": t.disabled })
|
|
792
|
+
}, null, 8, ["label", "modelValue", "class"])
|
|
793
|
+
])
|
|
794
|
+
]),
|
|
795
|
+
n("div", ns, [
|
|
796
|
+
n("div", ls, [
|
|
797
|
+
n("div", as, F(e(f)("inventory.transfer.form.items.title")), 1),
|
|
798
|
+
p(R, {
|
|
799
|
+
disabled: t.disabled,
|
|
800
|
+
label: e(f)("inventory.transfer.form.items.addItem"),
|
|
801
|
+
"prepend-icon": "add",
|
|
802
|
+
variant: "plain",
|
|
803
|
+
class: "border-2 rounded-lg border-fm-color-primary",
|
|
804
|
+
onClick: s[5] || (s[5] = (w) => m()),
|
|
805
|
+
size: "md"
|
|
806
|
+
}, null, 8, ["disabled", "label"])
|
|
807
|
+
]),
|
|
808
|
+
(I(), j(C, {
|
|
809
|
+
"column-defs": U.value,
|
|
810
|
+
"row-data": e(l).purchaseOrder.items,
|
|
811
|
+
key: e(l).purchaseOrder.items.map((w) => w.sku._id).join("."),
|
|
812
|
+
"hide-footer": ""
|
|
813
|
+
}, {
|
|
814
|
+
"list-row": B((w) => [
|
|
815
|
+
(I(), j(ze, {
|
|
816
|
+
row: w,
|
|
817
|
+
key: e(l).purchaseOrder.items.map((H) => H.sku._id).join(".")
|
|
818
|
+
}, {
|
|
819
|
+
default: B((H) => [
|
|
820
|
+
p(es, {
|
|
821
|
+
row: w,
|
|
822
|
+
"cell-by-col-id": H
|
|
823
|
+
}, null, 8, ["row", "cell-by-col-id"])
|
|
824
|
+
]),
|
|
825
|
+
_: 2
|
|
826
|
+
}, 1032, ["row"]))
|
|
827
|
+
]),
|
|
828
|
+
_: 1
|
|
829
|
+
}, 8, ["column-defs", "row-data"]))
|
|
830
|
+
])
|
|
831
|
+
]),
|
|
832
|
+
_: 1
|
|
833
|
+
}, 8, ["disabled"]);
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
}), is = { class: "flex items-center" }, us = { class: "fm-typo-en-title-md-800" }, ds = { class: "flex gap-4" }, ms = /* @__PURE__ */ X({
|
|
837
|
+
__name: "TransferTemplateDialog",
|
|
838
|
+
props: {
|
|
839
|
+
mode: {},
|
|
840
|
+
modelValue: {},
|
|
841
|
+
show: { type: Boolean }
|
|
842
|
+
},
|
|
843
|
+
emits: ["update:show", "submitted"],
|
|
844
|
+
setup(i, { expose: b, emit: d }) {
|
|
845
|
+
var t;
|
|
846
|
+
const l = i, f = d, _ = lt(), h = Ct(), { t: r } = Z(), o = je(l, "show");
|
|
847
|
+
function u() {
|
|
848
|
+
return {
|
|
849
|
+
_id: "",
|
|
850
|
+
name: "",
|
|
851
|
+
purchaseOrder: {
|
|
852
|
+
remark: void 0,
|
|
853
|
+
ref: void 0,
|
|
854
|
+
stockSnapshotId: void 0,
|
|
855
|
+
effectiveAt: void 0,
|
|
856
|
+
items: [],
|
|
857
|
+
supplier: {
|
|
858
|
+
_rev: void 0,
|
|
859
|
+
email: void 0,
|
|
860
|
+
internal: void 0,
|
|
861
|
+
contactName: void 0,
|
|
862
|
+
phoneNumber: void 0,
|
|
863
|
+
registrationNumber: void 0,
|
|
864
|
+
supplyItems: void 0,
|
|
865
|
+
_id: "",
|
|
866
|
+
name: "",
|
|
867
|
+
address: {
|
|
868
|
+
line2: void 0,
|
|
869
|
+
line1: "",
|
|
870
|
+
state: "",
|
|
871
|
+
city: "",
|
|
872
|
+
postcode: "",
|
|
873
|
+
country: ""
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
const c = q(l.modelValue ?? u()), y = q(((t = l.modelValue) == null ? void 0 : t._id) ?? `${Math.random()}`);
|
|
880
|
+
be(
|
|
881
|
+
() => l.show,
|
|
882
|
+
(s) => {
|
|
883
|
+
var a;
|
|
884
|
+
s && (c.value = l.modelValue ?? u(), y.value = ((a = l.modelValue) == null ? void 0 : a._id) ?? `${Math.random()}`);
|
|
885
|
+
}
|
|
886
|
+
);
|
|
887
|
+
const k = q(!1), S = A(() => {
|
|
888
|
+
switch (l.mode) {
|
|
889
|
+
case ae.READ:
|
|
890
|
+
return "";
|
|
891
|
+
case ae.CREATE:
|
|
892
|
+
return r("inventory.transfer.template.create.title");
|
|
893
|
+
case ae.UPDATE:
|
|
894
|
+
return r("inventory.transfer.template.update.title");
|
|
895
|
+
}
|
|
896
|
+
return "";
|
|
897
|
+
}), $ = q();
|
|
898
|
+
b({
|
|
899
|
+
validateInputs: () => {
|
|
900
|
+
var s, a;
|
|
901
|
+
(a = (s = $.value) == null ? void 0 : s.validateInputs) == null || a.call(s);
|
|
902
|
+
},
|
|
903
|
+
resetInputsValidation: () => {
|
|
904
|
+
var s, a;
|
|
905
|
+
(a = (s = $.value) == null ? void 0 : s.resetInputsValidation) == null || a.call(s);
|
|
906
|
+
},
|
|
907
|
+
resetInputs: () => {
|
|
908
|
+
var s, a;
|
|
909
|
+
(a = (s = $.value) == null ? void 0 : s.resetInputs) == null || a.call(s);
|
|
910
|
+
}
|
|
911
|
+
});
|
|
912
|
+
async function T() {
|
|
913
|
+
const s = c.value;
|
|
914
|
+
if (s) {
|
|
915
|
+
k.value = !0, (s.purchaseOrder.supplier.internal === "warehouse" || s.purchaseOrder.supplier.internal === "restaurant") && (s.purchaseOrder.items = s.purchaseOrder.items.map(
|
|
916
|
+
({ totalCost: a, ...v }) => v
|
|
917
|
+
));
|
|
918
|
+
try {
|
|
919
|
+
await _.createTemplate(s), await new Promise((a) => setTimeout(a, 1e3)), h.open({
|
|
920
|
+
title: r("inventory.transfer.template.create.success"),
|
|
921
|
+
message: r("inventory.transfer.template.create.successMessage"),
|
|
922
|
+
type: "success"
|
|
923
|
+
}), f("update:show", !1), f("submitted");
|
|
924
|
+
} catch (a) {
|
|
925
|
+
h.open({
|
|
926
|
+
title: r("inventory.transfer.template.create.error"),
|
|
927
|
+
message: r("inventory.transfer.template.create.errorMessage"),
|
|
928
|
+
type: "error"
|
|
929
|
+
}), console.error("Error in creating transfer template", a);
|
|
930
|
+
} finally {
|
|
931
|
+
k.value = !1;
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
async function P() {
|
|
936
|
+
const s = c.value;
|
|
937
|
+
if (s) {
|
|
938
|
+
k.value = !0, (s.purchaseOrder.supplier.internal === "warehouse" || s.purchaseOrder.supplier.internal === "restaurant") && (s.purchaseOrder.items = s.purchaseOrder.items.map(
|
|
939
|
+
({ totalCost: a, ...v }) => v
|
|
940
|
+
));
|
|
941
|
+
try {
|
|
942
|
+
await _.updateTemplate(s), await new Promise((a) => setTimeout(a, 1e3)), h.open({
|
|
943
|
+
title: r("inventory.transfer.template.update.success"),
|
|
944
|
+
message: r("inventory.transfer.template.update.successMessage"),
|
|
945
|
+
type: "success"
|
|
946
|
+
}), f("update:show", !1), f("submitted");
|
|
947
|
+
} catch (a) {
|
|
948
|
+
h.open({
|
|
949
|
+
title: r("inventory.transfer.template.update.error"),
|
|
950
|
+
message: r("inventory.transfer.template.update.errorMessage"),
|
|
951
|
+
type: "error"
|
|
952
|
+
}), console.error("Error in updating transfer template", a);
|
|
953
|
+
} finally {
|
|
954
|
+
k.value = !1;
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
function U() {
|
|
959
|
+
switch (l.mode) {
|
|
960
|
+
case ae.CREATE:
|
|
961
|
+
return T();
|
|
962
|
+
case ae.UPDATE:
|
|
963
|
+
return P();
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
function m() {
|
|
967
|
+
var s, a;
|
|
968
|
+
(a = (s = $.value) == null ? void 0 : s.validateInputs) == null || a.call(s);
|
|
969
|
+
}
|
|
970
|
+
return (s, a) => {
|
|
971
|
+
const v = D("FmButton"), g = D("FmSideSheet");
|
|
972
|
+
return I(), j(g, {
|
|
973
|
+
modelValue: e(o),
|
|
974
|
+
"onUpdate:modelValue": a[2] || (a[2] = (x) => Be(o) ? o.value = x : null),
|
|
975
|
+
"dismiss-away": "",
|
|
976
|
+
"close-button": "",
|
|
977
|
+
"max-width": 1200
|
|
978
|
+
}, {
|
|
979
|
+
"side-sheet-header": B(() => [
|
|
980
|
+
n("div", is, [
|
|
981
|
+
n("div", us, F(S.value), 1)
|
|
982
|
+
])
|
|
983
|
+
]),
|
|
984
|
+
default: B(() => [
|
|
985
|
+
(I(), j(rs, {
|
|
986
|
+
class: "w-full",
|
|
987
|
+
ref_key: "formRef",
|
|
988
|
+
ref: $,
|
|
989
|
+
onValidationSuccess: U,
|
|
990
|
+
"model-value": c.value,
|
|
991
|
+
"onUpdate:modelValue": a[0] || (a[0] = (x) => c.value = x),
|
|
992
|
+
disabled: k.value,
|
|
993
|
+
key: y.value
|
|
994
|
+
}, null, 8, ["model-value", "disabled"]))
|
|
995
|
+
]),
|
|
996
|
+
"side-sheet-footer": B(() => [
|
|
997
|
+
n("div", ds, [
|
|
998
|
+
p(v, {
|
|
999
|
+
loading: k.value,
|
|
1000
|
+
label: e(r)("common.save"),
|
|
1001
|
+
onClick: m
|
|
1002
|
+
}, null, 8, ["loading", "label"]),
|
|
1003
|
+
p(v, {
|
|
1004
|
+
disabled: k.value,
|
|
1005
|
+
variant: "tertiary",
|
|
1006
|
+
label: e(r)("common.close"),
|
|
1007
|
+
onClick: a[1] || (a[1] = (x) => f("update:show", !1))
|
|
1008
|
+
}, null, 8, ["disabled", "label"])
|
|
1009
|
+
])
|
|
1010
|
+
]),
|
|
1011
|
+
_: 1
|
|
1012
|
+
}, 8, ["modelValue"]);
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
}), cs = { class: "flex flex-col gap-16 w-full h-full" }, ps = { class: "flex justify-between" }, fs = { class: "fm-typo-en-body-lg-600" }, ys = { class: "flex flex-col gap-8" }, vs = { class: "flex flex-col gap-4" }, bs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _s = { class: "flex gap-1" }, xs = { class: "fm-typo-en-body-lg-600" }, hs = {
|
|
1016
|
+
key: 0,
|
|
1017
|
+
class: "flex flex-col gap-4"
|
|
1018
|
+
}, gs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ks = { class: "fm-typo-en-body-lg-600" }, Cs = { class: "flex flex-col gap-4" }, ws = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ts = { class: "fm-typo-en-body-lg-600" }, Fs = {
|
|
1019
|
+
key: 1,
|
|
1020
|
+
class: "flex flex-col gap-4"
|
|
1021
|
+
}, $s = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ss = { class: "fm-typo-en-body-lg-600" }, Rs = {
|
|
1022
|
+
key: 2,
|
|
1023
|
+
class: "flex flex-col gap-4"
|
|
1024
|
+
}, Ms = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Is = { class: "fm-typo-en-body-lg-600" }, Ds = {
|
|
1025
|
+
key: 3,
|
|
1026
|
+
class: "flex flex-col gap-4"
|
|
1027
|
+
}, As = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Vs = { class: "fm-typo-en-body-lg-600" }, Os = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Ps = { class: "flex flex-col gap-8" }, Ls = { class: "fm-typo-en-body-lg-600" }, Bs = { class: "flex w-full gap-4" }, Us = { class: "grow fm-typo-en-body-lg-400 line-clamp-2" }, qs = { class: "fm-typo-en-body-lg-600 shrink-0" }, Es = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, Ns = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, zs = {
|
|
1028
|
+
key: 0,
|
|
1029
|
+
class: "shrink-0 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
|
|
1030
|
+
}, Hs = { class: "flex gap-8 xs:flex-col" }, js = /* @__PURE__ */ X({
|
|
1031
|
+
__name: "TransferTemplateDetails",
|
|
1032
|
+
props: {
|
|
1033
|
+
template: {},
|
|
1034
|
+
show: { type: Boolean }
|
|
1035
|
+
},
|
|
1036
|
+
emits: ["update:show", "action:use", "action:edit"],
|
|
1037
|
+
setup(i, { emit: b }) {
|
|
1038
|
+
const d = i, l = b, f = _e(), { t: _ } = Z(), h = A(() => {
|
|
1039
|
+
var c;
|
|
1040
|
+
return (c = d.template) == null ? void 0 : c.purchaseOrder;
|
|
1041
|
+
}), r = A(
|
|
1042
|
+
() => {
|
|
1043
|
+
var c, y, k, S;
|
|
1044
|
+
return ((y = (c = h.value) == null ? void 0 : c.supplier) == null ? void 0 : y.internal) === "restaurant" || ((S = (k = h.value) == null ? void 0 : k.supplier) == null ? void 0 : S.internal) === "warehouse" ? L.TRANSFER : L.PURCHASE;
|
|
1045
|
+
}
|
|
1046
|
+
), o = q(!0), u = je(d, "show");
|
|
1047
|
+
return (c, y) => {
|
|
1048
|
+
var U;
|
|
1049
|
+
const k = D("FmChip"), S = D("FmMenuDivider"), $ = D("FmCard"), T = D("FmButton"), P = D("FmSideSheet");
|
|
1050
|
+
return I(), j(P, {
|
|
1051
|
+
header: e(_)("inventory.transfer.template.details.view", { template: (U = c.template) == null ? void 0 : U.name }),
|
|
1052
|
+
modelValue: e(u),
|
|
1053
|
+
"onUpdate:modelValue": y[2] || (y[2] = (m) => Be(u) ? u.value = m : null),
|
|
1054
|
+
"dismiss-away": o.value,
|
|
1055
|
+
"close-button": "",
|
|
1056
|
+
"max-width": 500
|
|
1057
|
+
}, {
|
|
1058
|
+
default: B(() => {
|
|
1059
|
+
var m;
|
|
1060
|
+
return [
|
|
1061
|
+
n("div", cs, [
|
|
1062
|
+
p($, {
|
|
1063
|
+
variant: "outlined",
|
|
1064
|
+
class: "flex flex-col gap-8 px-12 py-16"
|
|
1065
|
+
}, {
|
|
1066
|
+
default: B(() => {
|
|
1067
|
+
var t, s, a, v, g, x, R, C, V;
|
|
1068
|
+
return [
|
|
1069
|
+
n("div", ps, [
|
|
1070
|
+
n("div", fs, F(e(_)("inventory.transfer.template.details.templateSummary")), 1),
|
|
1071
|
+
n("div", null, [
|
|
1072
|
+
p(k, {
|
|
1073
|
+
label: e(_)(
|
|
1074
|
+
`inventory.transfer.receiveRequest.details.type.${r.value.toLocaleLowerCase()}`
|
|
1075
|
+
),
|
|
1076
|
+
class: "fm-chip-transfer-info",
|
|
1077
|
+
compact: ""
|
|
1078
|
+
}, null, 8, ["label"])
|
|
1079
|
+
])
|
|
1080
|
+
]),
|
|
1081
|
+
p(S),
|
|
1082
|
+
n("div", ys, [
|
|
1083
|
+
n("div", vs, [
|
|
1084
|
+
n("div", bs, [
|
|
1085
|
+
n("div", _s, F(e(_)("inventory.transfer.receiveRequest.details.createdAt")), 1)
|
|
1086
|
+
]),
|
|
1087
|
+
n("div", xs, F(e(at)(((t = c.template) == null ? void 0 : t._id) ?? "")), 1)
|
|
1088
|
+
]),
|
|
1089
|
+
(s = h.value) != null && s.effectiveAt ? (I(), N("div", hs, [
|
|
1090
|
+
n("div", gs, F(e(_)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
|
|
1091
|
+
n("div", ks, F(e(_t)(new Date((a = h.value) == null ? void 0 : a.effectiveAt))), 1)
|
|
1092
|
+
])) : J("", !0),
|
|
1093
|
+
n("div", Cs, [
|
|
1094
|
+
n("div", ws, F(e(_)("inventory.transfer.receiveRequest.details.type.title")), 1),
|
|
1095
|
+
n("div", Ts, F(e(_)(
|
|
1096
|
+
`inventory.transfer.receiveRequest.details.type.${r.value.toLocaleLowerCase("en-US")}`
|
|
1097
|
+
)), 1)
|
|
1098
|
+
]),
|
|
1099
|
+
(g = (v = h.value) == null ? void 0 : v.supplier) != null && g.name ? (I(), N("div", Fs, [
|
|
1100
|
+
n("div", $s, F(e(_)("inventory.transfer.receiveRequest.details.from")), 1),
|
|
1101
|
+
n("div", Ss, F((R = (x = h.value) == null ? void 0 : x.supplier) == null ? void 0 : R.name), 1)
|
|
1102
|
+
])) : J("", !0),
|
|
1103
|
+
(C = h.value) != null && C.ref ? (I(), N("div", Rs, [
|
|
1104
|
+
n("div", Ms, F(e(_)("inventory.transfer.receiveRequest.details.reference")), 1),
|
|
1105
|
+
n("div", Is, F(h.value.ref), 1)
|
|
1106
|
+
])) : J("", !0),
|
|
1107
|
+
(V = h.value) != null && V.remark ? (I(), N("div", Ds, [
|
|
1108
|
+
n("div", As, F(e(_)("inventory.transfer.receiveRequest.details.remark")), 1),
|
|
1109
|
+
n("div", Vs, F(h.value.remark), 1)
|
|
1110
|
+
])) : J("", !0)
|
|
1111
|
+
])
|
|
1112
|
+
];
|
|
1113
|
+
}),
|
|
1114
|
+
_: 1
|
|
1115
|
+
}),
|
|
1116
|
+
n("div", Os, [
|
|
1117
|
+
n("div", Ps, [
|
|
1118
|
+
n("div", Ls, F(e(_)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
|
|
1119
|
+
(I(!0), N(Ue, null, Ze(((m = h.value) == null ? void 0 : m.items) ?? [], (t) => (I(), N("div", {
|
|
1120
|
+
key: t.code,
|
|
1121
|
+
class: "flex flex-col"
|
|
1122
|
+
}, [
|
|
1123
|
+
n("div", Bs, [
|
|
1124
|
+
n("div", Us, F(t.name), 1),
|
|
1125
|
+
y[3] || (y[3] = n("div", { class: "flex-1 min-w-32" }, null, -1)),
|
|
1126
|
+
n("div", qs, F(e(rt)(t.quantity, t.sku.unit, t.measurement)), 1)
|
|
1127
|
+
]),
|
|
1128
|
+
n("div", Es, [
|
|
1129
|
+
n("div", Ns, F(t.code), 1),
|
|
1130
|
+
t.totalCost && e(f).enableTotalCost ? (I(), N("div", zs, " (" + F(e(qe)(t.totalCost)) + ") ", 1)) : J("", !0)
|
|
1131
|
+
])
|
|
1132
|
+
]))), 128))
|
|
1133
|
+
])
|
|
1134
|
+
])
|
|
1135
|
+
])
|
|
1136
|
+
];
|
|
1137
|
+
}),
|
|
1138
|
+
"side-sheet-footer": B(() => [
|
|
1139
|
+
n("div", Hs, [
|
|
1140
|
+
p(T, {
|
|
1141
|
+
label: e(_)("inventory.transfer.template.use"),
|
|
1142
|
+
onClick: y[0] || (y[0] = (m) => l("action:use"))
|
|
1143
|
+
}, null, 8, ["label"]),
|
|
1144
|
+
p(T, {
|
|
1145
|
+
label: e(_)("common.edit"),
|
|
1146
|
+
onClick: y[1] || (y[1] = (m) => l("action:edit")),
|
|
1147
|
+
variant: "tertiary"
|
|
1148
|
+
}, null, 8, ["label"])
|
|
1149
|
+
])
|
|
1150
|
+
]),
|
|
1151
|
+
_: 1
|
|
1152
|
+
}, 8, ["header", "modelValue", "dismiss-away"]);
|
|
1153
|
+
};
|
|
1154
|
+
}
|
|
1155
|
+
}), Qs = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 h-full" }, Ys = { class: "flex-1 flex flex-col gap-8" }, Gs = { class: "flex flex-col" }, Ws = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ks = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Zs = { class: "fm-typo-en-body-lg-400" }, Js = { class: "fm-typo-en-body-lg-400 line-clamp-1" }, Xs = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, fo = /* @__PURE__ */ X({
|
|
1156
|
+
__name: "TransferTemplateView",
|
|
1157
|
+
setup(i) {
|
|
1158
|
+
const { t: b } = Z(), { createTemplate: d, viewTemplate: l } = De(), { templateDialogProps: f, transferFormDialogProps: _, templateDetailsProps: h } = wt(
|
|
1159
|
+
De()
|
|
1160
|
+
), r = it(), o = ht(), u = Ne(), c = _e(), { breakpoints: y } = He();
|
|
1161
|
+
u.watchLocation(r.fetchTemplates), ve(() => {
|
|
1162
|
+
c.mustManageBusinessOnlyPoTemplate && (u.businessLevel = !0);
|
|
1163
|
+
}), Je(() => {
|
|
1164
|
+
u.businessLevel = !1;
|
|
1165
|
+
});
|
|
1166
|
+
const k = A(() => u.businessLevel), S = A(
|
|
1167
|
+
() => r.loading.value || !u._currentLocation
|
|
1168
|
+
), $ = A(
|
|
1169
|
+
() => k.value ? r.businessTemplates.value : r.locationTemplates.value
|
|
1170
|
+
), T = q(""), P = A(() => y.value.xs || y.value.sm ? 10 : 20);
|
|
1171
|
+
function U(a) {
|
|
1172
|
+
switch (a) {
|
|
1173
|
+
case Ae.Add:
|
|
1174
|
+
return d();
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
const m = $t();
|
|
1178
|
+
function t() {
|
|
1179
|
+
m.push({ name: xt.RECEIVE_REQUEST });
|
|
1180
|
+
}
|
|
1181
|
+
function s(a) {
|
|
1182
|
+
return a;
|
|
1183
|
+
}
|
|
1184
|
+
return (a, v) => {
|
|
1185
|
+
const g = D("FmTable");
|
|
1186
|
+
return I(), N(Ue, null, [
|
|
1187
|
+
p(ot, {
|
|
1188
|
+
title: e(b)("inventory.transfer.template.title2"),
|
|
1189
|
+
actions: [
|
|
1190
|
+
{
|
|
1191
|
+
label: e(b)("inventory.transfer.template.create.title"),
|
|
1192
|
+
value: e(Ae).Add,
|
|
1193
|
+
isPrimary: !0,
|
|
1194
|
+
prependIcon: "add"
|
|
1195
|
+
}
|
|
1196
|
+
],
|
|
1197
|
+
"onClick:action": U,
|
|
1198
|
+
"using-business-helper-text": "You are managing business-level template list. These templates will be made visible to all locations."
|
|
1199
|
+
}, {
|
|
1200
|
+
default: B(() => {
|
|
1201
|
+
var x;
|
|
1202
|
+
return [
|
|
1203
|
+
n("div", Qs, [
|
|
1204
|
+
p(nt, {
|
|
1205
|
+
searchable: "",
|
|
1206
|
+
"change-location": !e(c).mustManageBusinessOnlyPoTemplate,
|
|
1207
|
+
search: T.value,
|
|
1208
|
+
"onUpdate:search": v[0] || (v[0] = (R) => T.value = R),
|
|
1209
|
+
actions: [{ icon: "refresh", onClick: e(r).fetchTemplates }],
|
|
1210
|
+
"show-business": ""
|
|
1211
|
+
}, null, 8, ["change-location", "search", "actions"]),
|
|
1212
|
+
(I(), j(g, {
|
|
1213
|
+
style: Xe(e(o).tableHeight),
|
|
1214
|
+
"column-defs": e(r).columnDefs,
|
|
1215
|
+
"row-data": $.value,
|
|
1216
|
+
"search-value": T.value,
|
|
1217
|
+
loading: S.value,
|
|
1218
|
+
key: (x = e(u)._currentLocation) == null ? void 0 : x.dbName,
|
|
1219
|
+
onRowClick: v[1] || (v[1] = (R) => e(l)(R.original)),
|
|
1220
|
+
"page-size": P.value
|
|
1221
|
+
}, {
|
|
1222
|
+
"list-row": B((R) => [
|
|
1223
|
+
p(ze, {
|
|
1224
|
+
row: R,
|
|
1225
|
+
onRowClick: (C) => e(l)(C)
|
|
1226
|
+
}, {
|
|
1227
|
+
default: B((C) => {
|
|
1228
|
+
var V, w, H, Q, ee, te, Y, se, G, oe, ne, W, le, ie, xe, he, ge, ke, ue, Ce, we, Te, Fe, de, $e;
|
|
1229
|
+
return [
|
|
1230
|
+
n("div", Ys, [
|
|
1231
|
+
n("div", Gs, [
|
|
1232
|
+
n("div", Ws, [
|
|
1233
|
+
p(e(E), {
|
|
1234
|
+
render: (H = (w = (V = C._id) == null ? void 0 : V.column) == null ? void 0 : w.columnDef) == null ? void 0 : H.cell,
|
|
1235
|
+
props: (ee = (Q = C._id) == null ? void 0 : Q.getContext) == null ? void 0 : ee.call(Q)
|
|
1236
|
+
}, null, 8, ["render", "props"])
|
|
1237
|
+
]),
|
|
1238
|
+
n("div", Ks, [
|
|
1239
|
+
p(e(E), {
|
|
1240
|
+
render: (se = (Y = (te = C.name) == null ? void 0 : te.column) == null ? void 0 : Y.columnDef) == null ? void 0 : se.cell,
|
|
1241
|
+
props: (oe = (G = C.name) == null ? void 0 : G.getContext) == null ? void 0 : oe.call(G)
|
|
1242
|
+
}, null, 8, ["render", "props"])
|
|
1243
|
+
]),
|
|
1244
|
+
n("div", Zs, [
|
|
1245
|
+
p(e(E), {
|
|
1246
|
+
render: (le = (W = (ne = C.supplier) == null ? void 0 : ne.column) == null ? void 0 : W.columnDef) == null ? void 0 : le.cell,
|
|
1247
|
+
props: (xe = (ie = C.supplier) == null ? void 0 : ie.getContext) == null ? void 0 : xe.call(ie)
|
|
1248
|
+
}, null, 8, ["render", "props"])
|
|
1249
|
+
]),
|
|
1250
|
+
n("div", Js, F(R.original.purchaseOrder.items.length ? R.original.purchaseOrder.items.map((Ge) => Ge.name).join(", ") : "No items"), 1),
|
|
1251
|
+
n("div", Xs, [
|
|
1252
|
+
p(e(E), {
|
|
1253
|
+
render: (ke = (ge = (he = C.ref) == null ? void 0 : he.column) == null ? void 0 : ge.columnDef) == null ? void 0 : ke.cell,
|
|
1254
|
+
props: (Ce = (ue = C.ref) == null ? void 0 : ue.getContext) == null ? void 0 : Ce.call(ue)
|
|
1255
|
+
}, null, 8, ["render", "props"])
|
|
1256
|
+
])
|
|
1257
|
+
]),
|
|
1258
|
+
n("div", null, [
|
|
1259
|
+
p(e(E), {
|
|
1260
|
+
render: (Fe = (Te = (we = C.type) == null ? void 0 : we.column) == null ? void 0 : Te.columnDef) == null ? void 0 : Fe.cell,
|
|
1261
|
+
props: ($e = (de = C.type) == null ? void 0 : de.getContext) == null ? void 0 : $e.call(de)
|
|
1262
|
+
}, null, 8, ["render", "props"])
|
|
1263
|
+
])
|
|
1264
|
+
])
|
|
1265
|
+
];
|
|
1266
|
+
}),
|
|
1267
|
+
_: 2
|
|
1268
|
+
}, 1032, ["row", "onRowClick"])
|
|
1269
|
+
]),
|
|
1270
|
+
_: 1
|
|
1271
|
+
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
1272
|
+
])
|
|
1273
|
+
];
|
|
1274
|
+
}),
|
|
1275
|
+
_: 1
|
|
1276
|
+
}, 8, ["title", "actions"]),
|
|
1277
|
+
(I(), j(et, { to: "body" }, [
|
|
1278
|
+
p(Ft, Ie(e(_), { onSubmitted: t }), null, 16),
|
|
1279
|
+
p(js, tt(st(e(h))), null, 16),
|
|
1280
|
+
p(ms, Ie(e(f), {
|
|
1281
|
+
onSubmitted: v[2] || (v[2] = (x) => e(r).fetchTemplates())
|
|
1282
|
+
}), null, 16)
|
|
1283
|
+
]))
|
|
1284
|
+
], 64);
|
|
1285
|
+
};
|
|
1286
|
+
}
|
|
1287
|
+
});
|
|
1288
|
+
export {
|
|
1289
|
+
fo as default
|
|
1290
|
+
};
|