UNPKG

@konnectio/core

Version:

Konnectio Core Frontend Integration.

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