@agendize/vue-settings
Version:
Vue agendize's settings component
73 lines (72 loc) • 2.58 kB
JavaScript
import { defineComponent as h, ref as c, openBlock as k, createBlock as A, unref as s, withKeys as _, withCtx as f, createVNode as I } from "vue";
import { u as S } from "./vendor.26bbd9f1.js";
import { ModalDialogBox as b } from "@agendize/design-system";
import { UserSearch as x } from "@agendize/vue-search";
import { ConferenceSpeakerEntity as C } from "@agendize/js-calendar-api";
import { useApi as N } from "@agendize/vue-tools";
import { useToast as m } from "vue-toastification";
const z = /* @__PURE__ */ h({
__name: "AddAttendeeModal",
props: {
organisationEmail: {},
conferenceId: {},
speakers: {}
},
emits: ["close", "attendeeAdded"],
setup(u, { emit: p }) {
const o = u, l = p, { t: r } = S(), i = c(!1), a = c([]);
async function g(t) {
return t.filter((e) => e.anonymous || !e.staffIds || e.staffIds.length === 0 ? !1 : !o.speakers.find((n) => n.userId === e.id));
}
function d() {
l("close");
}
function v() {
i.value = !0;
const t = N(), e = a.value.map((n) => y(n));
t.addConferenceSpeakers(o.organisationEmail, o.conferenceId, e).then((n) => {
m().success(r("settings.conferences.attendee.add.success")), l("attendeeAdded", { speakers: n });
}).catch((n) => {
m().error(r("settings.conferences.attendee.add.failure"));
}).finally(() => {
i.value = !1;
});
}
function y(t) {
const e = new C();
return e.userId = t.id, e.conferenceId = o.conferenceId, e.emailAddress = t.login, e.firstName = t.firstName, e.lastName = t.lastName, e;
}
return (t, e) => (k(), A(s(b), {
id: "addAttendeeModal",
title: s(r)("settings.conferences.attendee.add.title"),
closeDisabled: !1,
closeOnBlurClick: !1,
size: 700,
fixedHeight: !0,
resize: !1,
hasNeutral: !1,
primaryLabel: s(r)("common.action.validate-with-x", { number: a.value.length }),
primaryAction: v,
primaryDisabled: a.value.length == 0 || i.value,
onClose: d,
onKeydown: _(d, ["esc"])
}, {
content: f(() => [
I(s(x), {
id: "addAttendeeModalUserSearch",
multiple: !0,
organisation: t.organisationEmail,
modelValue: a.value,
"onUpdate:modelValue": e[0] || (e[0] = (n) => a.value = n),
filter: g,
version: "v2"
}, null, 8, ["organisation", "modelValue"])
]),
footer: f(() => []),
_: 1
}, 8, ["title", "primaryLabel", "primaryDisabled"]));
}
});
export {
z as default
};