@konnectio/core
Version:
Konnectio Core Frontend Integration.
160 lines (159 loc) • 5.74 kB
JavaScript
import { d as C, u as y, c as A, r as i, h as _, b as r, a as h, g as n, F as x, f as u, w as v, S as I, e as t, t as T, k as E, _ as S, l as w, m as F, p as M } from "./mitt-CWSmi8M-.js";
import { G as P } from "./style-DJF9fHLt.js";
import { a as U, b as H, c, d as $, T as N, e as W, _ as L, C as G } from "./SelectField.vue_vue_type_style_index_0_lang-Cev1TH7y.js";
import { _ as O } from "./_.vue_vue_type_style_index_0_lang-CW619CRS.js";
import { A as D } from "./ActionField-BsmMIhW6.js";
const j = { class: "konnectio-cancel-reservation-form" }, q = /* @__PURE__ */ C({
__name: "CancelReservationForm",
setup(p) {
const { t: e } = y(), { display: s } = U(), { cancelReservation: m } = H(), R = A(() => [
{
label: e("cancelReservation.cancellationReasonRegret"),
value: c.Regret
},
{
label: e("cancelReservation.cancellationReasonMistake"),
value: c.BookingMistake
},
{
label: e("cancelReservation.cancellationReasonSickness"),
value: c.Sickness
},
{
label: e("cancelReservation.cancellationReasonTestBooking"),
value: c.TestBooking
},
{
label: e("cancelReservation.cancellationReasonBadWeather"),
value: c.BadWeather
},
{
label: e("cancelReservation.cancellationReasonOther"),
value: c.Other
}
]), o = i(""), f = i(void 0), k = i(""), d = i(!1), b = i(!1);
function B() {
if (o.value === "") {
s({
message: e("alert.error.reservationIdEmpty"),
type: "error"
});
return;
}
b.value = !0;
}
function V() {
m({
id: o.value,
reason: f.value,
remark: k.value
}), b.value = !1;
}
return (le, a) => (r(), _("form", j, [
b.value ? (r(), _(x, { key: 1 }, [
u($, {
modelValue: f.value,
"onUpdate:modelValue": a[2] || (a[2] = (l) => f.value = l),
label: n(e)("cancelReservation.reasonLabel"),
placeholder: n(e)("cancelReservation.reasonPlaceholder"),
options: R.value,
searchable: !1,
icon: "ban"
}, null, 8, ["modelValue", "label", "placeholder", "options"]),
u(N, {
modelValue: k.value,
"onUpdate:modelValue": a[3] || (a[3] = (l) => k.value = l),
type: "textarea",
name: "remark",
label: n(e)("cancelReservation.remarkLabel"),
icon: "info-circle",
placeholder: n(e)("cancelReservation.remarkPlaceholder")
}, null, 8, ["modelValue", "label", "placeholder"]),
u(W, {
label: n(e)("cancelReservation.confirmCancellationButton"),
"full-width": !0,
disabled: !1,
"is-loading": d.value,
"onUpdate:isLoading": a[4] || (a[4] = (l) => d.value = l),
onClickEvent: V
}, null, 8, ["label", "is-loading"])
], 64)) : (r(), h(D, {
key: 0,
modelValue: o.value,
"onUpdate:modelValue": a[0] || (a[0] = (l) => o.value = l),
icon: "octagon-check",
label: n(e)("cancelReservation.reservationIdLabel"),
buttonLabel: n(e)("cancelReservation.checkReservationIdButton"),
placeholder: n(e)("cancelReservation.reservationIdPlaceholder"),
"is-loading": d.value,
"onUpdate:isLoading": a[1] || (a[1] = (l) => d.value = l),
onAction: B
}, null, 8, ["modelValue", "label", "buttonLabel", "placeholder", "is-loading"]))
]));
}
}), z = /* @__PURE__ */ L(q, [["__scopeId", "data-v-8e11fd35"]]), J = { class: "konnectio-cancel-reservation-module" }, K = { class: "konnectio-cancel-reservation-title" }, Q = ["innerHTML"], X = { class: "konnectio-cancel-reservation-main" }, Y = /* @__PURE__ */ C({
name: "CancelReservationLayout",
__name: "CancelReservation",
props: {
accessToken: {},
styling: {}
},
setup(p) {
const { t: e } = y(), s = p, m = A(() => ({
panelMaxWidth: "800px",
...s.styling
}));
return (R, o) => (r(), h(G, { styling: m.value }, {
default: v(() => [
(r(), h(I, null, {
default: v(() => [
t("div", null, [
u(O, { "access-token": R.accessToken }, {
default: v(() => [
t("div", J, [
t("h2", K, [
t("span", null, T(n(e)("cancelReservation.title")), 1)
]),
t("div", {
innerHTML: n(e)("cancelReservation.cancellationNotice"),
class: "konnectio-cancel-reservation-description"
}, null, 8, Q),
t("div", X, [
u(z)
])
])
]),
_: 1
}, 8, ["access-token"])
])
]),
fallback: v(() => o[0] || (o[0] = [
t("div", null, null, -1)
])),
_: 1
}))
]),
_: 1
}, 8, ["styling"]));
}
}), g = /* @__PURE__ */ L(Y, [["__scopeId", "data-v-6270ad61"]]), Z = E(), ee = S, ae = ee();
class ne extends HTMLElement {
vueApp;
constructor() {
super();
}
disconnectedCallback() {
this.vueApp.unmount();
}
connectedCallback() {
const e = w(g, this.attributes);
this.vueApp = F(g, e), this.vueApp.provide("emitter", ae), this.vueApp.use(M), this.vueApp.use(Z), this.vueApp.use(P);
const s = document.createElement("div");
this.vueApp.mount(s), this.appendChild(s.children[0]);
}
}
window.customElements.define("konnectio-cancel-reservation", ne);
export {
ne as default
};
//# sourceMappingURL=cancel-reservation.js.map