@konnectio/core
Version:
Konnectio Core Frontend Integration.
120 lines (119 loc) • 4.22 kB
JavaScript
import { d as D, s as T, u as U, r as w, c as l, h as u, b as n, f as d, w as S, i as g, F as x, a as V, g as i, B as z, j as I, n as $ } from "./mitt-CWSmi8M-.js";
import { u as _, g as j, T as G, d as M, e as R, w as q, _ as H } from "./SelectField.vue_vue_type_style_index_0_lang-Cev1TH7y.js";
import { _ as J } from "./AvailabilitySkeleton.vue_vue_type_style_index_0_scoped_86730e88_lang-XzdmauPt.js";
const K = {
class: "konnectio-search-button",
key: "search"
}, O = /* @__PURE__ */ D({
__name: "EventAvailabilityForm",
props: {
redirection: { type: Boolean, default: !0 },
link: {},
selectedLocation: { default: NaN },
hideLocations: { type: Boolean, default: !1 }
},
setup(E) {
const a = E, {
eventLocation: v,
eventLocations: m,
hasEventLocations: N,
eventLocationControl: C,
eventDate: f
} = T(_()), { updateEventAvailability: B } = _(), { fetchListings: p } = j(), { t: s } = U(), b = w(C.value), k = w(/* @__PURE__ */ new Date()), c = l({
get: () => a.redirection ? b.value : v.value,
set: (e) => {
a.redirection ? b.value = Number(e) : v.value = Number(e);
}
}), r = l({
get: () => a.redirection ? k.value : f.value,
set: (e) => {
a.redirection ? k.value = e : f.value = e;
}
}), F = l(() => typeof a.link != "string"), y = l(() => {
const e = m.value.find(({ id: t }) => t === a.selectedLocation);
return e ? e.name : "";
}), L = l(() => N.value && !a.hideLocations);
function A() {
if (a.redirection === !0)
if (B({
date: r.value,
location: c.value
}), F.value) {
const e = q();
a.link[e] ? window.location.replace(a.link[e]) : a.link.en && window.location.replace(a.link.en);
} else
window.location.replace(a.link);
else
p();
}
function h() {
a.redirection === !1 && p();
}
return (e, t) => (n(), u("form", {
class: $([
"konnectio-event-search-form",
{ "has-locations": L.value },
{ "auto-search": !e.redirection }
]),
onSubmit: I(A, ["prevent"])
}, [
d(z, {
class: "konnectio-event-search-form-content",
tag: "ul"
}, {
default: S(() => [
L.value ? (n(), u(x, { key: 0 }, [
isNaN(e.selectedLocation) ? (n(), V(M, {
modelValue: c.value,
"onUpdate:modelValue": t[1] || (t[1] = (o) => c.value = o),
key: "location",
label: i(s)("general.location"),
icon: "location-dot",
"icon-type": "fas",
"icon-placement": "label",
"label-key": "name",
"value-key": "id",
options: i(m),
searchable: !1,
onChanged: h
}, null, 8, ["modelValue", "label", "options"])) : (n(), V(G, {
key: 0,
modelValue: y.value,
"onUpdate:modelValue": t[0] || (t[0] = (o) => y.value = o),
label: i(s)("general.location"),
icon: "location-dot",
"icon-type": "fas",
"icon-placement": "label",
readonly: ""
}, null, 8, ["modelValue", "label"]))
], 64)) : g("", !0),
d(J, {
modelValue: r.value,
"onUpdate:modelValue": [
t[2] || (t[2] = (o) => r.value = o),
h
],
key: "date",
label: i(s)("event.selectDate"),
"icon-type": "fas",
"icon-placement": "label",
"include-weekday": !0,
"min-date": /* @__PURE__ */ new Date()
}, null, 8, ["modelValue", "label", "min-date"]),
e.redirection === !0 ? (n(), u("li", K, [
d(R, {
type: "submit",
label: i(s)("availability.buttonLabel"),
"full-width": ""
}, null, 8, ["label"])
])) : g("", !0)
]),
_: 1
})
], 34));
}
}), X = /* @__PURE__ */ H(O, [["__scopeId", "data-v-fe590a00"]]);
export {
X as E
};
//# sourceMappingURL=EventAvailabilityForm-CcQwnzol.js.map