UNPKG

@agendize/vue-settings

Version:
847 lines (846 loc) 42.1 kB
import { defineComponent as xa, ref as o, openBlock as _, createElementBlock as E, createElementVNode as d, toDisplayString as B, unref as e, withKeys as pe, Fragment as Ue, renderList as $e, createVNode as m, inject as La, computed as Oa, onMounted as Ga, resolveComponent as Aa, createBlock as Me, withCtx as z, isRef as P, createCommentVNode as _e } from "vue"; import { _ as Ba } from "./View.vue_vue_type_script_setup_true_lang.434f3142.js"; import { i as We, S as Ee } from "./index.d2d0aba2.js"; import { ServiceObjectSearch as Ra } from "@agendize/vue-search"; import { PageWithTabsAndPanel as Ka, Section as A, FieldSelect as Se, Mandatory as b, FieldInput as Pe, FieldTextArea as ja, FieldFile as Ya, FieldEmail as qa, FieldPhone as Va, FieldToggle as Ja, FieldDateTime as _a, FieldUrl as Qa } from "@agendize/design-system"; import { ImageEntity as Xa, StaffEntity as Za } from "@agendize/js-calendar-api"; import { toBase64 as el, formatDate as ka, readBlobFromUrl as al } from "@agendize/vue-tools"; import "./vendor.26bbd9f1.js"; import "@agendize/az-i18n"; import "vue-router"; import "@agendize/vue-acl"; const ll = { class: "az-settings-hours" }, tl = { class: "az-flex az-flex-col az-justify-between" }, sl = { class: "az-body-1 az-font-medium" }, ol = { class: "az-body-2" }, il = { class: "az-flex az-flex-col az-items-end" }, nl = { class: "az-settings-hours-list" }, dl = { class: "az-font-medium" }, rl = /* @__PURE__ */ xa({ __name: "View", props: { api: {}, locale: {}, companyId: {}, workingHours: {}, title: {}, subTitle: {}, objectId: {}, logger: {} }, emits: ["onSave"], setup($, { emit: G }) { const i = $, l = We(i.locale), ie = G, R = o(["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"]), I = o(!1); function X(a) { var D; const F = (D = i.workingHours) == null ? void 0 : D.find((W) => W.day === a); return F ? F.hours.map((W) => `${W.start} - ${W.end}`).join(" / ") : l.global.t("settings.common.day.closed"); } function h() { I.value = !0; } function w(a) { I.value = !1, ie("onSave", a); } return (a, F) => (_(), E("div", ll, [ d("div", tl, [ d("div", null, [ d("div", sl, B(i.title ? i.title : e(l).global.t("settings.company-details.hours.open")), 1), d("div", ol, B(i.subTitle ? i.subTitle : e(l).global.t("settings.company-details.hours.all-weeks")), 1) ]), d("button", { class: "az-btn az-btn-color-secondary az-w-fit", onClick: h, onKeyup: pe(h, ["enter"]) }, B(e(l).global.t("settings.company-details.hours.edit")), 33) ]), d("div", il, [ d("div", nl, [ (_(!0), E(Ue, null, $e(R.value, (D) => (_(), E(Ue, null, [ d("div", dl, B(e(l).global.t(`settings.common.day.${D}`)) + " :", 1), d("div", null, B(X(D)), 1) ], 64))), 256)) ]), m(Ba, { locale: i.locale, display: I.value, workingHours: i.workingHours, onClose: F[0] || (F[0] = (D) => I.value = !1), onSave: w }, null, 8, ["locale", "display", "workingHours"]) ]) ])); } }); function ul($, G, i, l, ie, R, I, X, h) { const w = o(), a = o(), F = o(!0), D = o(), W = o(), Z = o([]), ee = o([]), K = o(), ve = o(void 0), j = o(), ke = o(), ne = o(), de = o(), he = o(), Y = o([]), re = o([]), ae = o([]), ue = o(!0), q = o([]), T = o([{}]), le = o([]), me = o([]), fe = o([]), V = o([""]), te = o(), U = o(), ge = o(), f = We(i), ce = o([]), se = o([]), L = o([]), ye = o([]), be = o(""), O = La("toaster"), xe = o(!0), Ne = o(!0), J = o(!0), we = o(!0), Fe = o(!0), H = o(!0), t = o(!0), De = o(!0), r = o([!0]), c = o(!0), v = o({ title: f.global.t("settings.staff-details.page-title"), subTitle: f.global.t("settings.staff-details.subTitle"), mobileBack: !0, tabs: [ { id: "general", title: f.global.t("settings.staff-details.tabs.general") }, { id: "services", title: f.global.t("settings.staff-details.tabs.services") }, { id: "availabilities", title: f.global.t("settings.staff-details.tabs.availabilities") }, { id: "rights", title: f.global.t("settings.staff-details.tabs.rights") }, { id: "advanced", title: f.global.t("settings.staff-details.tabs.advanced") } ] }); k(); function k() { se.value.push({ value: "none", label: f.global.t("settings.staff-details.roles.none") }), se.value.push({ value: "reader", label: f.global.t("settings.staff-details.roles.reader") }), se.value.push({ value: "scheduler", label: f.global.t("settings.staff-details.roles.scheduler") }), se.value.push({ value: "administrator", label: f.global.t("settings.staff-details.roles.administrator") }), L.value.push({ value: "none", label: f.global.t("settings.staff-details.titles.none") }), L.value.push({ value: "mr", label: f.global.t("settings.staff-details.titles.mr") }), L.value.push({ value: "mrs", label: f.global.t("settings.staff-details.titles.mrs") }), L.value.push({ value: "miss", label: f.global.t("settings.staff-details.titles.miss") }), L.value.push({ value: "dr", label: f.global.t("settings.staff-details.titles.dr") }), L.value.push({ value: "me", label: f.global.t("settings.staff-details.titles.me") }), ye.value.push({ value: "other", label: f.global.t("settings.staff-details.genders.other") }), ye.value.push({ value: "male", label: f.global.t("settings.staff-details.genders.male") }), ye.value.push({ value: "female", label: f.global.t("settings.staff-details.genders.female") }); } function Ce(s) { K.value = void 0, ve.value = s, j.value = void 0, s && el(s).then((u) => { !u || typeof u == "string" && (j.value = u); }); } function p() { F.value = !0, a.value && (Fa(), wa().then((s) => { s && (a.value = s, O == null || O.success(f.global.t("settings.staff-details.save-success")), Na(), (I || X) && (h == null || h.push({ name: Ee.StaffDetails, params: { companyId: l, staffId: s.id } })), Te(), F.value = !1); }).catch((s) => { var u, n; R == null || R.error("vue-settings", "[Staff Details] Error", (u = s.e) == null ? void 0 : u.code, s), ((n = s.e) == null ? void 0 : n.code) === 402 ? O == null || O.error(f.global.t("settings.common.error.max-user")) : O == null || O.error(f.global.t("settings.staff-details.save-error")), F.value = !1; })); } function Na() { const s = Y.value.filter((n) => re.value.indexOf(n) === -1), u = re.value.filter((n) => Y.value.indexOf(n) === -1); (s.length > 0 || u.length > 0) && ae.value.forEach((n) => { var g, y, x; !n.id || (n.members === void 0 && (n.members = []), s.indexOf(n.id) !== -1 && n.members.push({ id: (g = a.value) == null ? void 0 : g.id, firstName: ((y = a.value) == null ? void 0 : y.firstName) || "", lastName: ((x = a.value) == null ? void 0 : x.lastName) || "" }), u.indexOf(n.id) !== -1 && (n.members = n.members.filter((M) => { var C; return M.id !== ((C = a.value) == null ? void 0 : C.id); })), (s.indexOf(n.id) !== -1 || u.indexOf(n.id) !== -1) && $.updateStaffGroup(l, n.id, n)); }); } async function wa() { if (!!a.value) return I || X ? await $.createStaff(l, a.value) : await $.updateStaff(l, ie, a.value); } function Fa() { !a.value || ((ee.value.length || 0) > 0 ? a.value.title = ee.value[0] : a.value.title = "none", a.value.firstName = D.value, a.value.lastName = W.value, a.value.description = ke.value, (Z.value.length || 0) > 0 ? a.value.gender = Z.value[0] : a.value.gender = "none", a.value.picture = Xa.fromFileData(K.value === void 0 && ve.value === void 0, j.value), a.value.email = ne.value, a.value.phone = de.value, a.value.otherPhone = he.value, a.value.availableForWidget = ue.value, a.value.workingHours = le.value, T.value && (a.value.vacations = T.value.filter((s) => s.startDate && s.endDate).map((s) => ({ startDate: ka(s.startDate), endDate: ka(s.endDate) }))), a.value.servicesSkill = q.value.map((s) => s.id), (fe.value.length || 0) > 0 ? a.value.role = fe.value[0] : a.value.role = "none", a.value.externalId = te.value, a.value.externalCalendars = V.value.filter((s) => s).map((s) => ({ url: s }))); } function Te() { var s, u, n, g, y; (s = a.value) != null && s.picture && (K.value = (n = (u = a == null ? void 0 : a.value) == null ? void 0 : u.picture) == null ? void 0 : n.url, ve.value = void 0, X && al((y = (g = a.value) == null ? void 0 : g.picture) == null ? void 0 : y.url, (x) => { var M, C; K.value = ((C = (M = a.value) == null ? void 0 : M.picture) == null ? void 0 : C.url) || "", j.value = x; })); } async function Da() { var s, u, n, g, y, x, M, C, oe, ze, Ve, S, Ie, Le, Oe, Ge, Ae, Be, Re, Ke, je, Ye, qe, Je, Qe, Xe, Ze, ea, aa, la, ta, sa, oa, ia, na, da, ra, ua, fa, ca, va, ma, ga, ba, pa; !a.value || (ee.value = [((s = a.value) == null ? void 0 : s.title) || "none"], (u = U.value) != null && u.titleMandatory && Q("title", (((g = (n = a.value) == null ? void 0 : n.title) == null ? void 0 : g.length) || 0) > 0), D.value = (y = a.value) == null ? void 0 : y.firstName, (x = U.value) != null && x.firstnameMandatory && Q("firstName", (((C = (M = a.value) == null ? void 0 : M.firstName) == null ? void 0 : C.length) || 0) > 0), W.value = (oe = a.value) == null ? void 0 : oe.lastName, (ze = U.value) != null && ze.lastnameMandatory && Q("lastName", (((S = (Ve = a.value) == null ? void 0 : Ve.lastName) == null ? void 0 : S.length) || 0) > 0), ke.value = (Ie = a.value) == null ? void 0 : Ie.description, (Le = U.value) != null && Le.descriptionMandatory && Q("description", (((Ge = (Oe = a.value) == null ? void 0 : Oe.description) == null ? void 0 : Ge.length) || 0) > 0), Z.value = [((Ae = a.value) == null ? void 0 : Ae.gender) || "none"], (Be = U.value) != null && Be.genderMandatory && Q("gender", (((Ke = (Re = a.value) == null ? void 0 : Re.gender) == null ? void 0 : Ke.length) || 0) > 0), Te(), de.value = (je = a.value) == null ? void 0 : je.phone, (Ye = U.value) != null && Ye.mobilePhoneMandatory && Q("phone", (((Je = (qe = a.value) == null ? void 0 : qe.phone) == null ? void 0 : Je.length) || 0) > 0), he.value = (Qe = a.value) == null ? void 0 : Qe.otherPhone, (Xe = U.value) != null && Xe.otherPhoneMandatory && Q("otherPhone", (((ea = (Ze = a.value) == null ? void 0 : Ze.otherPhone) == null ? void 0 : ea.length) || 0) > 0), ne.value = (aa = a.value) == null ? void 0 : aa.email, (la = U.value) != null && la.emailMandatory && Q("email", (((sa = (ta = a.value) == null ? void 0 : ta.email) == null ? void 0 : sa.length) || 0) > 0), ae.value && (ae.value.forEach((N) => { var ha, ya; !N.id || !N.name || !N.members || (ce.value.push({ value: N.id, label: N.name }), ((ha = a.value) == null ? void 0 : ha.id) && ((ya = N.members) == null ? void 0 : ya.filter((Ia) => { var za; return Ia.id === ((za = a.value) == null ? void 0 : za.id); }).length) > 0 && Y.value.push(N.id)); }), X || (re.value = Y.value)), ue.value = (ia = (oa = a.value) == null ? void 0 : oa.availableForWidget) != null ? ia : !0, (na = a.value) != null && na.workingHours && (le.value = [], le.value = (da = a.value) == null ? void 0 : da.workingHours), (ra = a.value) != null && ra.customWorkingHours && (me.value = [], me.value = (ua = a.value) == null ? void 0 : ua.customWorkingHours), (fa = a.value) != null && fa.vacations && (T.value = [], (ca = a.value) == null || ca.vacations.filter((N) => N.startDate && N.endDate).forEach((N) => T.value.push({ startDate: new Date(N.startDate), endDate: new Date(N.endDate) })), T.value.push({ startDate: void 0, endDate: void 0 })), await Sa(), fe.value = [((va = a.value) == null ? void 0 : va.role) || "none"], (ma = a.value) != null && ma.externalCalendars && (V.value = [], r.value = [], (ba = (ga = a.value) == null ? void 0 : ga.externalCalendars) == null || ba.map((N) => { V.value.push(N.url), r.value.push(!0); }), V.value.push(""), r.value.push(!0)), te.value = (pa = a.value) == null ? void 0 : pa.externalId, Ca()); } function Ca() { var s; ge.value = void 0, l && (ge.value = G.userDomain + "/web/widget/?c=" + l + "&staff=" + ((s = a.value) == null ? void 0 : s.id)); } async function Sa() { let s = await $.getAllServices(l, G.email); if (!s.results) return; const u = s.results; q.value = u.filter((n) => { var g, y, x; if ((g = a.value) != null && g.servicesSkill) return (n == null ? void 0 : n.id) && ((x = (y = a.value) == null ? void 0 : y.servicesSkill) == null ? void 0 : x.indexOf(n == null ? void 0 : n.id)) >= 0; if (I) return n == null ? void 0 : n.id; }); } async function Ea() { var n, g, y, x, M, C, oe, ze, Ve; if (I) a.value = new Za(); else if (ie) try { const S = await $.getStaffById(l, ie, G.email); S != null && S.result && (a.value = S == null ? void 0 : S.result, v.value.titleTranslatable = !1, v.value.title = ((g = (n = a.value) == null ? void 0 : n.firstName) != null ? g : "") + " " + ((x = (y = a.value) == null ? void 0 : y.lastName) != null ? x : "")); } catch (S) { R == null || R.error("vue-settings", "loadApiData error", S), h == null || h.push({ name: Ee.Staffs, params: { companyId: l } }); } const s = await $.getAllStaffGroups(l, G.email); s.results && (ae.value = s.results); const u = await $.getCompanyById(l, G.email); if (u.result) { const S = await $.getStaffFormsByAccount((M = u.result) == null ? void 0 : M.owner.userName); S.result && (U.value = S.result); } (oe = (C = u.result) == null ? void 0 : C.address) != null && oe.country ? be.value = u.result.address.country : (ze = G.profileSettings) != null && ze.country ? be.value = (Ve = G.profileSettings) == null ? void 0 : Ve.country : be.value = "FR", await Da(); } function Q(s, u, ...n) { const g = typeof u == "boolean" ? u : u.isValid; switch (s) { case "title": xe.value = g; break; case "lastName": J.value = g; break; case "firstName": Ne.value = g; break; case "gender": we.value = g; break; case "description": Fe.value = g; break; case "email": H.value = g, He(); break; case "phone": t.value = g; break; case "otherPhone": De.value = g; break; case "externalCalendars": const [y] = n; r.value[y] = g; break; case "role": He(); break; } } const Ua = Oa(() => xe.value && Ne.value && J.value && we.value && Fe.value && H.value && t.value && De.value && c.value && r.value.filter((s) => !s).length === 0); function Ma() { V.value.push(""), r.value.push(!0); } function Pa(s, u) { s === V.value[u] && (V.value.splice(u, 1), r.value.splice(u, 1)); } function $a() { T.value.push({}); } function Wa(s, u) { s === T.value[u] && T.value.splice(u, 1); } function Ta() { var s, u, n, g, y, x, M, C, oe; return I ? f.global.t("settings.staff-details.new") : X ? f.global.t("settings.staff-details.clone", { firstName: (s = a.value) == null ? void 0 : s.firstName, lastName: (u = a.value) == null ? void 0 : u.lastName }) : (((n = a.value) == null ? void 0 : n.title) && ((g = a.value) == null ? void 0 : g.title) !== "none" ? f.global.t("settings.staff-details.titles." + ((y = a.value) == null ? void 0 : y.title)) + " " : "") + ((x = a.value) != null && x.lastName ? ((M = a.value) == null ? void 0 : M.lastName) + " " : "") + ((C = a.value) != null && C.firstName ? (oe = a.value) == null ? void 0 : oe.firstName : ""); } Ga(async () => { await Ea(), F.value = !1; }); function Ha() { h == null || h.push({ name: Ee.Staffs }); } function He() { c.value = fe.value.length === 0 || fe.value[0] === "none" || H.value && ne.value !== void 0 && ne.value !== ""; } return { company: w, pageTitle: Ta, staff: a, loading: F, validatedField: Q, staffForms: U, submitReady: Ua, staffTitle: ee, staffFirstName: D, staffLastName: W, staffGender: Z, staffDescription: ke, staffLogo: K, staffLogoFile: ve, staffLogoFileData: j, onStaffLogoUpdated: Ce, staffEmail: ne, staffEmailValid: H, phoneCountry: be, staffPhone: de, staffOtherPhone: he, staffGroups: Y, staffRole: fe, staffRoleValid: c, staffAvailableForWidget: ue, staffWorkingHours: le, staffCustomPeriods: me, staffVacations: T, addVacation: $a, sliceVacation: Wa, serviceStaffs: q, staffExternalCalendars: V, addExternalCalendar: Ma, sliceExternalCalendar: Pa, staffExternalId: te, staffWidgetUrl: ge, staffGroupValues: ce, roles: se, titles: L, genders: ye, onSave: p, back: Ha, pageOptions: v }; } const fl = ["aria-label", "onClick"], cl = ["aria-label", "disabled"], vl = ["disabled"], ml = /* @__PURE__ */ d("i", { class: "fa fa-check", "aria-hidden": "true" }, null, -1), gl = [ ml ], bl = { class: "az-flex az-flex-col az-gap-4" }, pl = { class: "az-settings-split az-flex az-gap-4" }, hl = /* @__PURE__ */ d("div", { class: "az-flex-1", style: { visibility: "hidden" } }, null, -1), yl = { class: "az-settings-split az-flex az-gap-4" }, zl = { class: "az-settings-split az-flex az-gap-4" }, Vl = /* @__PURE__ */ d("div", { class: "az-flex-1", style: { visibility: "hidden" } }, null, -1), _l = /* @__PURE__ */ d("div", { class: "az-divider" }, null, -1), kl = { class: "az-flex az-flex-col az-gap-4" }, xl = { key: 0, class: "az-error-label" }, Nl = { key: 0, class: "az-settings-split az-flex az-gap-4" }, wl = /* @__PURE__ */ d("div", { class: "az-divider" }, null, -1), Fl = { class: "az-flex az-flex-col az-gap-4" }, Dl = { class: "az-flex az-flex-col az-gap-4" }, Cl = /* @__PURE__ */ d("div", { class: "az-divider" }, null, -1), Sl = { class: "az-flex az-flex-col az-gap-4" }, El = { class: "" }, Ul = /* @__PURE__ */ d("div", { class: "az-divider" }, null, -1), Ml = { class: "az-flex az-gap-2 az-flex-col" }, Pl = { class: "az-flex az-gap-4" }, $l = /* @__PURE__ */ d("i", { class: "fas fa-plus", "aria-hidden": "true" }, null, -1), Wl = [ $l ], Tl = ["onClick", "onKeyup"], Hl = /* @__PURE__ */ d("i", { class: "fas fa-xmark", "aria-hidden": "true" }, null, -1), Il = [ Hl ], Ll = { class: "az-flex az-flex-col az-gap-4 az-h-full" }, Ol = { class: "az-flex az-flex-col az-gap-4" }, Gl = { key: 0, class: "az-error-label" }, Al = { class: "az-flex az-flex-col az-gap-1" }, Bl = { class: "az-flex az-gap-2 az-items-center" }, Rl = { class: "az-body-2 az-font-medium", style: { color: "var(--az-black)" } }, Kl = { class: "az-flex az-flex-col az-gap-2" }, jl = { class: "az-flex az-gap-2 az-w-full" }, Yl = /* @__PURE__ */ d("i", { class: "fas fa-plus", "aria-hidden": "true" }, null, -1), ql = [ Yl ], Jl = ["onClick", "onKeyup"], Ql = /* @__PURE__ */ d("i", { class: "fas fa-xmark", "aria-hidden": "true" }, null, -1), Xl = [ Ql ], Zl = /* @__PURE__ */ d("div", { class: "az-divider" }, null, -1), et = { class: "az-flex az-flex-col az-gap-4" }, ct = /* @__PURE__ */ xa({ __name: "View", props: { api: {}, organisation: {}, locale: {}, companyId: {}, staffId: {}, logger: {}, new: { type: Boolean }, clone: { type: Boolean }, router: {} }, emits: ["menuClick"], setup($, { emit: G }) { const i = $, l = We(i.locale); function ie(H) { ge.value = H; } const { company: R, pageTitle: I, staff: X, loading: h, validatedField: w, staffForms: a, submitReady: F, staffTitle: D, staffFirstName: W, staffLastName: Z, staffGender: ee, staffDescription: K, staffLogo: ve, staffLogoFile: j, staffLogoFileData: ke, onStaffLogoUpdated: ne, staffEmail: de, staffEmailValid: he, phoneCountry: Y, staffPhone: re, staffOtherPhone: ae, staffGroups: ue, staffRole: q, staffRoleValid: T, staffAvailableForWidget: le, staffWorkingHours: me, staffCustomPeriods: fe, staffVacations: V, addVacation: te, sliceVacation: U, serviceStaffs: ge, staffExternalCalendars: f, addExternalCalendar: ce, sliceExternalCalendar: se, staffExternalId: L, staffWidgetUrl: ye, staffGroupValues: be, roles: O, titles: xe, genders: Ne, onSave: J, back: we, pageOptions: Fe } = ul(i.api, i.organisation, i.locale, i.companyId, i.staffId, i.logger, i.new, i.clone, i.router); return (H, t) => { const De = Aa("router-link"); return _(), Me(e(Ka), { id: "settings-staff-details", options: e(Fe), locale: i.locale, onMobileBack: e(we) }, { actions: z(() => [ m(De, { to: { name: e(Ee).Staffs, params: { companyId: i.companyId } }, custom: "" }, { default: z(({ navigate: r, href: c, route: v }) => [ d("button", { ref: "cancelButton", "aria-label": e(l).global.t("settings.staff-details.action.back"), class: "az-btn az-btn-color-neutral az-whitespace-nowrap", onClick: r }, B(e(l).global.t("settings.staff-details.action.back")), 9, fl) ]), _: 1 }, 8, ["to"]), d("button", { "aria-label": e(l).global.t("settings.action.save"), disabled: !e(F) || e(h), class: "az-btn az-btn-color-primary", onClick: t[0] || (t[0] = (...r) => e(J) && e(J)(...r)) }, B(e(l).global.t("settings.action.save")), 9, cl) ]), mobileActions: z(() => [ d("button", { class: "az-btn az-btn-color-transparent az-btn-icon-alone", disabled: !e(F) || e(h), onClick: t[1] || (t[1] = (...r) => e(J) && e(J)(...r)), onKeypress: t[2] || (t[2] = pe( (...r) => e(J) && e(J)(...r), ["enter"] )) }, gl, 40, vl) ]), general: z(() => [ m(e(A), { id: "staff-details-general" }, { content: z(() => { var r, c, v, k, Ce; return [ d("div", bl, [ d("div", pl, [ m(e(Se), { id: "staffTitle", modelValue: e(D), "onUpdate:modelValue": t[3] || (t[3] = (p) => P(D) ? D.value = p : null), label: e(l).global.t("settings.staff-details.title.label"), locale: i.locale, mandatory: (r = e(a)) != null && r.titleMandatory ? e(b).mandatory : e(b).optional, placeholder: e(l).global.t("settings.staff-details.title.placeholder"), values: e(xe), class: "az-flex-1", onValidated: t[4] || (t[4] = (p) => { e(w)("title", p); }) }, null, 8, ["modelValue", "label", "locale", "mandatory", "placeholder", "values"]), hl ]), d("div", yl, [ m(e(Pe), { id: "staffLastName", modelValue: e(Z), "onUpdate:modelValue": t[5] || (t[5] = (p) => P(Z) ? Z.value = p : null), label: e(l).global.t("settings.staff-details.lastName.label"), locale: i.locale, mandatory: (c = e(a)) != null && c.lastnameMandatory ? e(b).mandatory : e(b).optional, placeholder: e(l).global.t("settings.staff-details.lastName.placeholder"), class: "az-flex-1", onValidated: t[6] || (t[6] = (p) => { e(w)("lastName", p); }) }, null, 8, ["modelValue", "label", "locale", "mandatory", "placeholder"]), m(e(Pe), { id: "staffFirstName", modelValue: e(W), "onUpdate:modelValue": t[7] || (t[7] = (p) => P(W) ? W.value = p : null), label: e(l).global.t("settings.staff-details.firstName.label"), locale: i.locale, mandatory: (v = e(a)) != null && v.firstnameMandatory ? e(b).mandatory : e(b).optional, placeholder: e(l).global.t("settings.staff-details.firstName.placeholder"), class: "az-flex-1", onValidated: t[8] || (t[8] = (p) => { e(w)("firstName", p); }) }, null, 8, ["modelValue", "label", "locale", "mandatory", "placeholder"]) ]), d("div", zl, [ m(e(Se), { id: "staffGender", modelValue: e(ee), "onUpdate:modelValue": t[9] || (t[9] = (p) => P(ee) ? ee.value = p : null), label: e(l).global.t("settings.staff-details.gender.label"), locale: i.locale, mandatory: (k = e(a)) != null && k.genderMandatory ? e(b).mandatory : e(b).optional, placeholder: e(l).global.t("settings.staff-details.gender.placeholder"), values: e(Ne), class: "az-flex-1", onValidated: t[10] || (t[10] = (p) => { e(w)("gender", p); }) }, null, 8, ["modelValue", "label", "locale", "mandatory", "placeholder", "values"]), Vl ]), m(e(ja), { id: "serviceDescription", modelValue: e(K), "onUpdate:modelValue": t[11] || (t[11] = (p) => P(K) ? K.value = p : null), label: e(l).global.t("settings.staff-details.description.label"), locale: i.locale, mandatory: (Ce = e(a)) != null && Ce.descriptionMandatory ? e(b).mandatory : e(b).optional, placeholder: e(l).global.t("settings.staff-details.description.placeholder"), onValidated: t[12] || (t[12] = (p) => { e(w)("description", p); }) }, null, 8, ["modelValue", "label", "locale", "mandatory", "placeholder"]), m(e(Ya), { disabled: e(h), id: "staffLogo", modelValue: e(j), "onUpdate:modelValue": [ t[13] || (t[13] = (p) => P(j) ? j.value = p : null), e(ne) ], buttonLabel: e(l).global.t("settings.staff-details.photo.button"), defaultFilename: e(ve) ? e(l).global.t("settings.staff-details.photo.default-name") : void 0, fileInfo: { maxSize: 5, extensions: [".png", ".gif", ".jpeg", ".jpg"] }, "helper-message": e(l).global.t("settings.staff-details.photo.helper"), label: e(l).global.t("settings.staff-details.photo.label"), locale: i.locale, mandatory: e(b).optional, placeholder: e(l).global.t("settings.staff-details.photo.placeholder") }, null, 8, ["disabled", "modelValue", "buttonLabel", "defaultFilename", "fileInfo", "helper-message", "label", "locale", "mandatory", "placeholder", "onUpdate:modelValue"]) ]) ]; }), _: 1 }), _l, m(e(A), { id: "staff-details-general-contact", title: e(l).global.t("settings.staff-details.contact.title"), "sub-title": e(l).global.t("settings.staff-details.contact.subtitle") }, { content: z(() => { var r, c, v; return [ d("div", kl, [ d("div", null, [ m(e(qa), { id: "staffEmail", modelValue: e(de), "onUpdate:modelValue": t[14] || (t[14] = (k) => P(de) ? de.value = k : null), label: e(l).global.t("settings.staff-details.email.label"), locale: i.locale, mandatory: ((r = e(a)) == null ? void 0 : r.emailMandatory) || e(q).length > 0 && e(q)[0] !== "none" ? e(b).mandatory : e(b).optional, placeholder: e(l).global.t("settings.staff-details.email.placeholder"), onValidated: t[15] || (t[15] = (k) => { e(w)("email", k); }) }, null, 8, ["modelValue", "label", "locale", "mandatory", "placeholder"]), !e(T) && e(he) ? (_(), E("span", xl, B(e(l).global.t("settings.staff-details.email.roleError")), 1)) : _e("", !0) ]), e(Y) ? (_(), E("div", Nl, [ m(e(Va), { id: "staffPhoneFixe", modelValue: e(re), "onUpdate:modelValue": t[16] || (t[16] = (k) => P(re) ? re.value = k : null), "default-country": e(Y), label: e(l).global.t("settings.staff-details.phone.fixe"), locale: i.locale, mandatory: (c = e(a)) != null && c.otherPhoneMandatory ? e(b).mandatory : e(b).optional, class: "az-flex-1", placeholder: "", onValidated: t[17] || (t[17] = (k) => { e(w)("phone", k); }) }, null, 8, ["modelValue", "default-country", "label", "locale", "mandatory"]), m(e(Va), { id: "staffPhoneMobile", modelValue: e(ae), "onUpdate:modelValue": t[18] || (t[18] = (k) => P(ae) ? ae.value = k : null), "default-country": e(Y), label: e(l).global.t("settings.staff-details.phone.mobile"), locale: i.locale, mandatory: (v = e(a)) != null && v.mobilePhoneMandatory ? e(b).mandatory : e(b).optional, class: "az-flex-1", placeholder: "", onValidated: t[19] || (t[19] = (k) => { e(w)("otherPhone", k); }) }, null, 8, ["modelValue", "default-country", "label", "locale", "mandatory"]) ])) : _e("", !0) ]) ]; }), _: 1 }, 8, ["title", "sub-title"]), wl, m(e(A), { id: "staff-details-general-group", title: e(l).global.t("settings.staff-details.group.title"), "sub-title": e(l).global.t("settings.staff-details.group.subtitle") }, { content: z(() => [ d("div", Fl, [ e(h) ? _e("", !0) : (_(), Me(e(Se), { key: 0, id: "staffGroup", modelValue: e(ue), "onUpdate:modelValue": t[20] || (t[20] = (r) => P(ue) ? ue.value = r : null), label: e(l).global.t("settings.staff-details.group.label"), locale: i.locale, mandatory: e(b).optional, multiple: !0, placeholder: e(l).global.t("settings.staff-details.group.placeholder"), values: e(be) }, null, 8, ["modelValue", "label", "locale", "mandatory", "placeholder", "values"])) ]) ]), _: 1 }, 8, ["title", "sub-title"]) ]), availabilities: z(() => [ m(e(A), { id: "staff-details-availabilities-availableForWidget", title: e(l).global.t("settings.staff-details.availableForWidget.title"), "sub-title": e(l).global.t("settings.staff-details.availableForWidget.subtitle") }, { content: z(() => [ d("div", Dl, [ m(e(Ja), { id: "staffAvailableForWidget", modelValue: e(le), "onUpdate:modelValue": t[21] || (t[21] = (r) => P(le) ? le.value = r : null), label: e(l).global.t("settings.staff-details.availableForWidget.label"), locale: i.locale, mandatory: e(b).ignore }, null, 8, ["modelValue", "label", "locale", "mandatory"]) ]) ]), _: 1 }, 8, ["title", "sub-title"]), Cl, m(e(A), { id: "staff-details-availabilities-hours", title: e(l).global.t("settings.staff-details.hours.title") }, { content: z(() => [ d("div", Sl, [ d("div", El, [ m(rl, { api: i.api, companyId: i.companyId, logger: i.logger, locale: i.locale, workingHours: e(me), onOnSave: t[22] || (t[22] = (r) => me.value = r) }, null, 8, ["api", "companyId", "logger", "locale", "workingHours"]) ]) ]) ]), _: 1 }, 8, ["title"]), Ul, m(e(A), { id: "staff-details-availabilities-unavailable", title: e(l).global.t("settings.staff-details.unavailable.title") }, { content: z(() => [ d("div", Ml, [ (_(!0), E(Ue, null, $e(e(V), (r, c) => (_(), E("div", Pl, [ m(e(_a), { id: `staffVacation-${c}-start`, modelValue: e(V)[c].startDate, "onUpdate:modelValue": (v) => e(V)[c].startDate = v, locale: i.locale, mandatory: e(b).ignore, "max-date": e(V)[c].endDate, label: "", mode: "date", placeholder: "" }, null, 8, ["id", "modelValue", "onUpdate:modelValue", "locale", "mandatory", "max-date"]), m(e(_a), { id: `staffVacation-${c}-end`, modelValue: e(V)[c].endDate, "onUpdate:modelValue": (v) => e(V)[c].endDate = v, locale: i.locale, mandatory: e(b).ignore, "min-date": e(V)[c].startDate, label: "", mode: "date", placeholder: "" }, null, 8, ["id", "modelValue", "onUpdate:modelValue", "locale", "mandatory", "min-date"]), c === e(V).length - 1 ? (_(), E("button", { key: 0, class: "az-btn az-btn-color-neutral az-btn-icon-alone", onClick: t[23] || (t[23] = (...v) => e(te) && e(te)(...v)), onKeyup: t[24] || (t[24] = pe( (...v) => e(te) && e(te)(...v), ["enter"] )) }, Wl, 32)) : (_(), E("button", { key: 1, class: "az-btn az-btn-color-neutral az-btn-icon-alone", onClick: (v) => e(U)(r, c), onKeyup: pe((v) => e(U)(r, c), ["enter"]) }, Il, 40, Tl)) ]))), 256)) ]) ]), _: 1 }, 8, ["title"]) ]), services: z(() => [ e(h) ? _e("", !0) : (_(), Me(e(A), { key: 0, id: "staff-details-services", title: e(l).global.t("settings.staff-details.services.title"), "sub-title": e(l).global.t("settings.staff-details.services.subtitle"), class: "az-h-full" }, { content: z(() => [ d("div", Ll, [ m(e(Ra), { api: H.api, locale: H.locale, services: e(ge), companyId: H.companyId, loading: e(h), "search-label": e(l).global.t("settings.staff-details.services.search.searchLabel"), "modal-title": e(l).global.t("settings.staff-details.services.search.add.title"), "modal-description": e(l).global.t("settings.staff-details.services.search.add.description"), "context-type": `link staff ${H.clone ? "0" : H.staffId} service`, onChangeServices: ie }, null, 8, ["api", "locale", "services", "companyId", "loading", "search-label", "modal-title", "modal-description", "context-type"]) ]) ]), _: 1 }, 8, ["title", "sub-title"])) ]), rights: z(() => [ m(e(A), { id: "staff-details-rights", title: e(l).global.t("settings.staff-details.rights.title") }, { content: z(() => [ d("div", Ol, [ m(e(Se), { id: "staffRole", modelValue: e(q), "onUpdate:modelValue": t[25] || (t[25] = (r) => P(q) ? q.value = r : null), "helper-message": e(l).global.t("settings.staff-details.role.helper"), label: e(l).global.t("settings.staff-details.role.label"), locale: i.locale, mandatory: e(b).mandatory, placeholder: e(l).global.t("settings.staff-details.role.placeholder"), values: e(O), onValidated: t[26] || (t[26] = (r) => { e(w)("role", r); }) }, null, 8, ["modelValue", "helper-message", "label", "locale", "mandatory", "placeholder", "values"]), e(T) ? _e("", !0) : (_(), E("span", Gl, B(e(l).global.t("settings.staff-details.role.error")), 1)) ]) ]), _: 1 }, 8, ["title"]) ]), advanced: z(() => [ m(e(A), { id: "staff-details-advanced-external-calendars", title: e(l).global.t("settings.staff-details.external-calendars") }, { content: z(() => [ d("div", Al, [ d("div", Bl, [ d("div", Rl, B(e(l).global.t("settings.staff-details.icals.title")), 1) ]), d("div", Kl, [ (_(!0), E(Ue, null, $e(e(f), (r, c) => (_(), E("div", jl, [ m(e(Qa), { id: `staffExternalCalendars-${c}`, modelValue: e(f)[c], "onUpdate:modelValue": (v) => e(f)[c] = v, locale: i.locale, mandatory: e(b).ignore, placeholder: e(l).global.t("settings.staff-details.icals.placeholder"), class: "az-w-full", label: "", onValidated: (v) => { e(w)("externalCalendars", v, c); } }, null, 8, ["id", "modelValue", "onUpdate:modelValue", "locale", "mandatory", "placeholder", "onValidated"]), c === e(f).length - 1 ? (_(), E("button", { key: 0, class: "az-btn az-btn-color-neutral az-btn-icon-alone", onClick: t[27] || (t[27] = (...v) => e(ce) && e(ce)(...v)), onKeyup: t[28] || (t[28] = pe( (...v) => e(ce) && e(ce)(...v), ["enter"] )) }, ql, 32)) : (_(), E("button", { key: 1, class: "az-btn az-btn-color-neutral az-btn-icon-alone", onClick: (v) => e(se)(r, c), onKeyup: pe((v) => e(se)(r, c), ["enter"]) }, Xl, 40, Jl)) ]))), 256)) ]) ]) ]), _: 1 }, 8, ["title"]), Zl, m(e(A), { id: "staff-details-advanced-external-ref", title: e(l).global.t("settings.staff-details.external-ref") }, { content: z(() => [ d("div", et, [ m(e(Pe), { id: "staffExternalId", modelValue: e(L), "onUpdate:modelValue": t[29] || (t[29] = (r) => P(L) ? L.value = r : null), "helper-message": e(l).global.t("settings.staff-details.id-externe.helper"), label: e(l).global.t("settings.staff-details.id-externe.label"), locale: i.locale, mandatory: e(b).optional, placeholder: e(l).global.t("settings.staff-details.id-externe.placeholder") }, null, 8, ["modelValue", "helper-message", "label", "locale", "mandatory", "placeholder"]) ]) ]), _: 1 }, 8, ["title"]) ]), _: 1 }, 8, ["options", "locale", "onMobileBack"]); }; } }); export { ct as default };