@konnectio/core
Version:
Konnectio Core Frontend Integration.
115 lines (114 loc) • 3.57 kB
JavaScript
import { D as e, Dt as t, Et as n, M as r, O as i, P as a, T as o, Y as s, bt as c, dt as l, f as u, k as d, o as f, u as p, x as m, y as h } from "./mitt-Dp_pykgV.js";
import { C as g, S as _, V as v, n as y, t as b, v as x, w as S } from "./SelectField-CfD2awPl.js";
import { n as C } from "./AvailabilitySkeleton-DVRsnt_Y.js";
//#region src/components/forms/EventAvailabilityForm.vue?vue&type=script&setup=true&lang.ts
var w = {
class: "konnectio-search-button",
key: "search"
}, T = /* @__PURE__ */ _(/* @__PURE__ */ a({
__name: "EventAvailabilityForm",
props: {
redirection: {
type: Boolean,
default: !0
},
link: {},
selectedLocation: { default: NaN },
hideLocations: {
type: Boolean,
default: !1
}
},
setup(a) {
let _ = a, { eventLocation: T, eventLocations: E, hasEventLocations: D, eventLocationControl: O, eventDate: k } = p(g()), { updateEventAvailability: A } = g(), { fetchListings: j } = S(), { t: M } = f(), N = c(O.value), P = c(/* @__PURE__ */ new Date()), F = o({
get: () => _.redirection ? N.value : T.value,
set: (e) => {
_.redirection ? N.value = Number(e) : T.value = Number(e);
}
}), I = o({
get: () => _.redirection ? P.value : k.value,
set: (e) => {
_.redirection ? P.value = e : k.value = e;
}
}), L = o(() => typeof _.link != "string"), R = o(() => {
let e = E.value.find(({ id: e }) => e === _.selectedLocation);
return e ? e.name : "";
}), z = o(() => D.value && !_.hideLocations);
function B() {
if (_.redirection === !0) if (A({
date: I.value,
location: F.value
}), L.value) {
let e = v();
_.link[e] ? window.location.replace(_.link[e]) : _.link.en && window.location.replace(_.link.en);
} else window.location.replace(_.link);
else j();
}
function V() {
_.redirection === !1 && j();
}
return (o, c) => (s(), d("form", {
class: t([
"konnectio-event-search-form",
{ "has-locations": z.value },
{ "auto-search": !a.redirection }
]),
onSubmit: h(B, ["prevent"])
}, [r(u, {
class: "konnectio-event-search-form-content",
tag: "ul"
}, {
default: l(() => [
z.value ? (s(), d(m, { key: 0 }, [isNaN(a.selectedLocation) ? (s(), e(b, {
modelValue: F.value,
"onUpdate:modelValue": c[1] ||= (e) => F.value = e,
key: "location",
label: n(M)("general.location"),
icon: "location-dot",
"icon-type": "fas",
"icon-placement": "label",
"label-key": "name",
"value-key": "id",
options: n(E),
searchable: !1,
onChanged: V
}, null, 8, [
"modelValue",
"label",
"options"
])) : (s(), e(y, {
key: 0,
modelValue: R.value,
"onUpdate:modelValue": c[0] ||= (e) => R.value = e,
label: n(M)("general.location"),
icon: "location-dot",
"icon-type": "fas",
"icon-placement": "label",
readonly: ""
}, null, 8, ["modelValue", "label"]))], 64)) : i("", !0),
r(C, {
modelValue: I.value,
"onUpdate:modelValue": [c[2] ||= (e) => I.value = e, V],
key: "date",
label: n(M)("event.selectDate"),
"icon-type": "fas",
"icon-placement": "label",
"include-weekday": !0,
"min-date": /* @__PURE__ */ new Date()
}, null, 8, [
"modelValue",
"label",
"min-date"
]),
a.redirection === !0 ? (s(), d("li", w, [r(x, {
type: "submit",
label: n(M)("availability.buttonLabel"),
"full-width": ""
}, null, 8, ["label"])])) : i("", !0)
]),
_: 1
})], 34));
}
}), [["__scopeId", "data-v-fe590a00"]]);
//#endregion
export { T as t };