@agendize/vue-settings
Version:
Vue agendize's settings component
845 lines (844 loc) • 41.9 kB
JavaScript
import { ref as n, inject as Cl, computed as il, watch as qe, onMounted as Sl, defineComponent as Al, resolveComponent as Ul, openBlock as k, createBlock as be, unref as e, withCtx as m, createVNode as b, createElementVNode as v, toDisplayString as Pe, withKeys as Re, isRef as f, createCommentVNode as oe, createElementBlock as pe, Fragment as Ll, renderList as $l, normalizeStyle as Fl } from "vue";
import { i as ol, S as Me } from "./index.d2d0aba2.js";
import { Mandatory as p, PageWithTabsAndPanel as Bl, Section as S, FieldInput as je, FieldTextArea as Il, FieldToggle as He, FieldFile as El, FieldNumber as Ge, FieldSelect as ne, FieldInterval as wl } from "@agendize/design-system";
import { ImageEntity as Ol, ServiceEntity as Tl } from "@agendize/js-calendar-api";
import { p as Pl } from "./common.6fc78cfb.js";
import { toBase64 as Gl, parseToInt as sl, readBlobFromUrl as Ml } from "@agendize/vue-tools";
import { StaffObjectSearch as Nl } from "@agendize/vue-search";
import { useAcl as ql } from "@agendize/vue-acl";
import "./vendor.26bbd9f1.js";
import "@agendize/az-i18n";
import "vue-router";
function Rl(O, me, r, a, ge, T, re, X, V) {
const _ = n(), l = n(), $ = n(!0), P = n(""), fe = n(""), F = n(), ye = n(void 0), Y = n(), G = n(1), B = n(["green"]), Z = n(), A = n(["public"]), I = n(!0), M = n(60), y = n([["companyAddress"]]), ee = n(), E = n([]), le = n([]), Fe = n([]), N = n([]), q = n([]), R = n([]), j = n([]), ae = n(["location"]), de = n(), ue = n(), te = n(), ce = n(), U = n(!1), he = n(), c = ol(r), L = n([]), H = n([]), ve = n([]), ie = n([]), K = n(!1), z = n(), W = n(), Ve = n(p.ignore), Q = Cl("toaster"), Be = n(!1), Ie = n(!0), Ee = n(!0), we = n(!0), Oe = n(!0), se = n(!0), w = n(!0), t = n(!0), Te = n(!0), s = n(!0), h = n(""), g = [
{ value: "companyAddress", label: c.global.t("settings.service-details.locations.company") },
{ value: "phone", label: c.global.t("settings.service-details.locations.phone") },
{ value: "videoconference", label: c.global.t("settings.service-details.locations.visio") },
{ value: "custom", label: c.global.t("settings.service-details.locations.custom") }
], Ne = n({
title: c.global.t("settings.service-details.title"),
subTitle: c.global.t("settings.service-details.subTitle"),
mobileBack: !0,
tabs: [
{ id: "general", title: c.global.t("settings.service-details.tabs.general") },
{ id: "availabilities", title: c.global.t("settings.service-details.tabs.availabilities") },
{ id: "staffs", title: c.global.t("settings.service-details.tabs.staffs") },
{ id: "options", title: c.global.t("settings.service-details.tabs.options") },
{ id: "advanced", title: c.global.t("settings.service-details.tabs.advanced") }
]
});
nl();
function nl() {
L.value.push({ value: "public", label: c.global.t("settings.service-details.visibilities.public") }), L.value.push({
value: "backoffice",
label: c.global.t("settings.service-details.visibilities.backoffice")
}), L.value.push({ value: "hidden", label: c.global.t("settings.service-details.visibilities.hidden") }), L.value.push({
value: "disabled",
label: c.global.t("settings.service-details.visibilities.disabled")
}), H.value.push({
value: "location",
label: c.global.t("settings.service-details.validations.location")
}), H.value.push({ value: "auto", label: c.global.t("settings.service-details.validations.auto") }), H.value.push({ value: "manager", label: c.global.t("settings.service-details.validations.manager") }), H.value.push({ value: "staff", label: c.global.t("settings.service-details.validations.staff") }), Pl(ve.value, c), ie.value.push({ value: "" + 0, label: c.global.t("settings.common.duration", { minutes: 0 }, 1) });
for (let i = 5; i <= 180; i += 5)
ie.value.push({ value: "" + i, label: c.global.t("settings.common.duration", { minutes: i }, i) });
}
function rl(i) {
F.value = void 0, ye.value = i, Y.value = void 0, i && Gl(i).then((d) => {
!d || typeof d == "string" && (Y.value = d);
});
}
function dl() {
$.value = !0, l.value && (vl(), cl().then((i) => {
i && (l.value = i, ul(), Q == null || Q.success(c.global.t("settings.service-details.save-success")), l.value = i, (re || X) && (V == null || V.push({
name: Me.ServiceDetails,
params: { companyId: a, serviceId: l.value.id }
})), Ke(), $.value = !1);
}).catch((i) => {
T == null || T.error("vue-settings", "[Service Details] Error", i), Q == null || Q.error(c.global.t("settings.service-details.save-error")), $.value = !1;
}));
}
function ul() {
const i = E.value.filter((o) => le.value.indexOf(o) === -1), d = le.value.filter((o) => E.value.indexOf(o) === -1);
(i.length > 0 || d.length > 0) && N.value.forEach((o) => {
var u;
!o.id || (o.members === void 0 && (o.members = []), i.indexOf(o.id) !== -1 && o.members.push({ id: (u = l.value) == null ? void 0 : u.id, name: l.value.name }), d.indexOf(o.id) !== -1 && (o.members = o.members.filter((x) => {
var D;
return x.id !== ((D = l.value) == null ? void 0 : D.id);
})), (i.indexOf(o.id) !== -1 || d.indexOf(o.id) !== -1) && O.updateServiceGroup(a, o.id, o));
});
}
async function cl() {
if (!!l.value)
return re || X ? await O.createService(a, l.value) : await O.updateService(a, ge, l.value);
}
function vl() {
var i, d, o, u, x, D, _e, xe, De, ke, Ce, Se, Ae, Ue, Le, $e;
!l.value || !P.value || (l.value.name = P.value, l.value.description = fe.value, l.value.i18n = {}, l.value.i18n.fr = { name: (i = l.value) == null ? void 0 : i.name, description: (d = l.value) == null ? void 0 : d.description }, l.value.i18n.en = { name: (o = l.value) == null ? void 0 : o.name, description: (u = l.value) == null ? void 0 : u.description }, l.value.i18n.es = { name: (x = l.value) == null ? void 0 : x.name, description: (D = l.value) == null ? void 0 : D.description }, l.value.i18n.de = { name: (_e = l.value) == null ? void 0 : _e.name, description: (xe = l.value) == null ? void 0 : xe.description }, l.value.i18n.nl = { name: (De = l.value) == null ? void 0 : De.name, description: (ke = l.value) == null ? void 0 : ke.description }, l.value.i18n.it = { name: (Ce = l.value) == null ? void 0 : Ce.name, description: (Se = l.value) == null ? void 0 : Se.description }, l.value.i18n.pt = { name: (Ae = l.value) == null ? void 0 : Ae.name, description: (Ue = l.value) == null ? void 0 : Ue.description }, l.value.i18n.jp = { name: (Le = l.value) == null ? void 0 : Le.name, description: ($e = l.value) == null ? void 0 : $e.description }, l.value.picture = Ol.fromFileData(F.value === void 0 && ye.value === void 0, Y.value), M.value > 0 && (l.value.duration = M.value), l.value.capacity = G.value, B.value.length > 0 && (l.value.color = B.value[0]), l.value.price = ee.value || 0, I.value && A.value.length > 0 ? l.value.availability = A.value[0] : l.value.availability = "disabled", l.value.staffsSkill = q.value.map((J) => J.id), R.value.length > 0 ? l.value.preparationDuration = sl(R.value[0]) : l.value.preparationDuration = 0, j.value.length > 0 ? l.value.bufferDuration = sl(j.value[0]) : l.value.bufferDuration = 0, ae.value && ae.value.length > 0 ? l.value.validation = ae.value[0] : l.value.validation = "auto", l.value.externalId = he.value, l.value.locations = y.value.map((J) => Array.isArray(J) ? J[0] : J), l.value.locationCustom = h.value, U.value ? (l.value.appointmentDateScope = "service", l.value.minAppointmentDate = ue.value + "-" + de.value, l.value.maxAppointmentDate = ce.value + "-" + te.value) : l.value.appointmentDateScope = "company", K.value ? l.value.maxCancellationDelay = z.value : l.value.maxCancellationDelay = 0);
}
function Ke() {
var i, d, o;
(i = l.value) != null && i.picture && (F.value = (d = l.value) == null ? void 0 : d.picture.url, ye.value = void 0, X && Ml((o = l.value) == null ? void 0 : o.picture.url, pl));
}
async function bl() {
var x, D, _e, xe, De, ke, Ce, Se, Ae, Ue, Le, $e, J, Qe, Je, Xe, Ye, Ze, el;
if (!l.value)
return;
P.value = (x = l.value) == null ? void 0 : x.name, ze("name", ((_e = (D = l.value) == null ? void 0 : D.name) == null ? void 0 : _e.length) > 0), (xe = l.value) != null && xe.description && (fe.value = (De = l.value) == null ? void 0 : De.description), M.value = (ke = l.value) == null ? void 0 : ke.duration, I.value = ((Ce = l.value) == null ? void 0 : Ce.availability) !== "disabled", (Se = l.value) != null && Se.availability && (A.value = [], A.value.push((Ae = l.value) == null ? void 0 : Ae.availability)), ze("visibility", A.value.length > 0);
const i = (Ue = l.value) == null ? void 0 : Ue.locations.map((C) => [C]);
y.value = i, ze("location", y.value.length > 0), R.value = ["" + ((Le = l.value) == null ? void 0 : Le.preparationDuration)], j.value = ["" + l.value.bufferDuration], Ke(), ($e = l.value) != null && $e.validation && (ae.value = [l.value.validation]), G.value = ((J = l.value) == null ? void 0 : J.capacity) || 1, ze("quantity", G.value > 0), ee.value = (Qe = l.value) == null ? void 0 : Qe.price, he.value = (Je = l.value) == null ? void 0 : Je.externalId, ((Xe = l.value) == null ? void 0 : Xe.appointmentDateScope) === "service" && (U.value = !0);
let d = (Ye = l.value) == null ? void 0 : Ye.minAppointmentDate;
d && (de.value = +d.split("-")[1], ue.value = d.split("-")[0]);
let o = (Ze = l.value) == null ? void 0 : Ze.maxAppointmentDate;
o && (te.value = +o.split("-")[1], ce.value = o.split("-")[0]), l.value.maxCancellationDelay && l.value.maxCancellationDelay > 0 ? (K.value = !0, z.value = l.value.maxCancellationDelay) : (K.value = !1, z.value = void 0), N.value && (N.value.forEach((C) => {
var ll, al;
!C.id || !C.name || !((ll = l.value) != null && ll.id) || !C.members || (Fe.value.push({ value: C.id, label: C.name }), ((al = C.members) == null ? void 0 : al.filter((kl) => {
var tl;
return kl.id === ((tl = l.value) == null ? void 0 : tl.id);
}).length) > 0 && E.value.push(C.id));
}), (X === void 0 || !X) && (le.value = E.value)), await We(), ml();
const u = "" + ((el = l.value) == null ? void 0 : el.color);
B.value = [], ve.value.filter((C) => C.value === u).length === 0 && ve.value.push({ label: u, value: u }), B.value.push(u), h.value = l.value.locationCustom || "";
}
function pl(i) {
var d, o;
F.value = ((o = (d = l.value) == null ? void 0 : d.picture) == null ? void 0 : o.url) || "", Y.value = i;
}
function ml() {
var i;
Z.value = "", a && (Z.value = `${me.userDomain}/web/widget/?c=${a}&service=${(i = l.value) == null ? void 0 : i.id}`);
}
async function We() {
let i = await O.getAllStaffs(a, me.email);
if (!i.results)
return;
const d = i.results;
q.value = d.filter(
(o) => {
var u;
if ((u = l.value) != null && u.staffsSkill)
return (o == null ? void 0 : o.id) && l.value.staffsSkill.indexOf(o.id) >= 0;
if (re)
return o == null ? void 0 : o.id;
}
);
}
async function gl() {
var d, o;
const i = await O.getAllServiceGroups(a, me.email);
if (i.results && (N.value = i.results), re)
l.value = new Tl(), await We();
else if (ge) {
try {
const u = await O.getServiceById(a, ge, me.email);
u != null && u.result && (l.value = u == null ? void 0 : u.result, Ne.value.titleTranslatable = !1, Ne.value.title = (o = (d = l.value) == null ? void 0 : d.name) != null ? o : "");
} catch (u) {
T == null || T.debug("vue-settings", "loadApiData error", u), V == null || V.push({ name: Me.Services, params: { companyId: a } });
}
await bl();
}
}
function ze(i, d) {
const o = typeof d == "boolean" ? d : d.isValid;
switch (i) {
case "name":
Be.value = o;
break;
case "quantity":
Ie.value = o;
break;
case "duration":
Ee.value = o;
break;
case "visibility":
we.value = o;
break;
case "preparation":
Oe.value = o;
break;
case "bufferAfter":
se.value = o;
break;
case "validation":
Te.value = o;
break;
case "location":
w.value = o;
break;
case "interval":
s.value = o;
break;
case "cancellationDelay":
K.value ? t.value = o : t.value = !0;
break;
}
}
function fl() {
y.value.push([void 0]);
}
function yl(i, d) {
i === y.value[d][0] && y.value.splice(d, 1);
}
const hl = il(() => Be.value && Ie.value && Ee.value && we.value && Oe.value && se.value && w.value && Te.value && s.value && t.value);
qe(
[() => A.value, () => I.value],
([i, d], [o, u]) => {
d !== u ? d ? d && i.length > 0 && i[0] === "disabled" && (A.value = ["public"]) : A.value = ["disabled"] : I.value = i.length > 0 && i[0] !== "disabled";
}
), qe(z, (i, d) => {
i && i == 1 ? W.value = c.global.t("settings.service-details.maxCancellationDelay.inputHelper.1hour") : i && i > 1 ? W.value = c.global.t("settings.service-details.maxCancellationDelay.inputHelper.severalHours", { hour: i }) : W.value = void 0;
}), qe(K, (i, d) => {
i ? (z.value == null && (z.value = 24), Ve.value = p.mandatory) : (z.value = void 0, Ve.value = p.ignore);
}), Sl(async () => {
await gl(), $.value = !1;
});
function Vl() {
var i, d;
return re ? c.global.t("settings.service-details.new") : X ? c.global.t("settings.service-details.clone", { name: ((i = l.value) == null ? void 0 : i.name) || "" }) : ((d = l.value) == null ? void 0 : d.name) || "";
}
const zl = il(() => {
var o;
const i = [], d = (o = y.value) == null ? void 0 : o.map((u) => u[0]);
if (d.forEach((u) => {
const x = [];
g.forEach((D) => {
(u === D.value || !d.includes(D.value)) && x.push(D);
}), i.push(x);
}), i.length === 0) {
const u = [];
g.forEach((x) => {
u.push(x);
}), i.push(u);
}
return i;
});
function _l() {
V == null || V.push({ name: Me.Services });
}
function xl(i) {
q.value = i;
}
function Dl(i, d, o, u) {
de.value = i, ue.value = d, te.value = o, ce.value = u;
}
return {
company: _,
service: l,
pageTitle: Vl,
loading: $,
validatedField: ze,
submitReady: hl,
serviceName: P,
serviceDescription: fe,
serviceLogo: F,
serviceLogoFile: ye,
serviceLogoFileData: Y,
onServiceLogoUpdated: rl,
serviceQuantity: G,
serviceColor: B,
serviceVisibility: A,
serviceWidgetUrl: Z,
serviceActif: I,
serviceDuration: M,
serviceLocations: y,
servicePrice: ee,
serviceGroups: E,
serviceGroupValues: Fe,
serviceStaffs: q,
servicePreparationDuration: R,
serviceBufferAfterDuration: j,
serviceValidation: ae,
serviceExternalId: he,
validations: H,
locations: zl,
colors: ve,
durations: ie,
visibilities: L,
onSave: dl,
back: _l,
pageOptions: Ne,
addLocation: fl,
sliceLocation: yl,
allPossibleLocation: g,
customLoc: h,
changeStaffs: xl,
serviceCancellationDelayEnable: K,
serviceCancellationDelayValue: z,
serviceCancellationDelayHelper: W,
serviceCancellationDelayMandatory: Ve,
minAppointmentValue: de,
minAppointmentUnit: ue,
maxAppointmentValue: te,
maxAppointmentUnit: ce,
changeInterval: Dl,
hasIntervalByService: U
};
}
const jl = ["aria-label", "onClick"], Hl = ["aria-label", "disabled"], Kl = ["disabled"], Wl = /* @__PURE__ */ v("i", {
class: "fa fa-check",
"aria-hidden": "true"
}, null, -1), Ql = [
Wl
], Jl = { class: "az-flex az-flex-col az-gap-4" }, Xl = { class: "az-flex az-flex-col" }, Yl = { class: "az-field-helper" }, Zl = /* @__PURE__ */ v("div", { class: "az-divider" }, null, -1), ea = { class: "az-flex az-flex-col az-gap-4" }, la = { class: "az-field-label" }, aa = { class: "az-flex az-flex-col" }, ta = { class: "az-flex az-gap-4 location_container" }, ia = { class: "az-flex-1" }, sa = { class: "az-flex az-gap-2" }, oa = ["onClick", "onKeyup"], na = /* @__PURE__ */ v("i", {
class: "fas fa-xmark",
"aria-hidden": "true"
}, null, -1), ra = [
na
], da = /* @__PURE__ */ v("i", {
class: "fas fa-plus",
"aria-hidden": "true"
}, null, -1), ua = [
da
], ca = /* @__PURE__ */ v("div", { class: "az-divider" }, null, -1), va = { class: "az-flex az-flex-col az-gap-4" }, ba = {
key: 0,
class: "az-divider"
}, pa = { class: "az-flex az-flex-col az-gap-4" }, ma = /* @__PURE__ */ v("div", { class: "az-divider" }, null, -1), ga = { class: "az-flex az-flex-col az-gap-4" }, fa = { class: "az-flex az-flex-col az-gap-4" }, ya = {
key: 0,
class: "az-divider"
}, ha = /* @__PURE__ */ v("div", { class: "az-divider" }, null, -1), Va = {
key: 0,
class: "az-flex az-flex-col az-gap-1"
}, za = /* @__PURE__ */ v("div", { class: "az-divider" }, null, -1), _a = { class: "az-flex az-flex-col az-gap-4" }, xa = { class: "az-flex az-flex-col az-gap-4" }, Da = { class: "az-flex az-flex-col az-gap-4" }, ka = { class: "az-flex az-flex-col az-gap-4" }, Ca = { class: "az-flex az-flex-col az-gap-4" }, Ta = /* @__PURE__ */ Al({
__name: "View",
props: {
id: { default: Math.random().toString(36) },
api: {},
router: {},
organisation: {},
locale: {},
companyId: {},
serviceId: {},
logger: {},
new: { type: Boolean },
clone: { type: Boolean }
},
emits: ["menuClick"],
setup(O, { emit: me }) {
const r = O, a = ol(r.locale), ge = ql(), {
company: T,
service: re,
pageTitle: X,
loading: V,
validatedField: _,
submitReady: l,
serviceName: $,
serviceDescription: P,
serviceLogo: fe,
serviceLogoFile: F,
serviceLogoFileData: ye,
onServiceLogoUpdated: Y,
serviceQuantity: G,
serviceColor: B,
serviceVisibility: Z,
serviceWidgetUrl: A,
serviceActif: I,
serviceDuration: M,
serviceLocations: y,
servicePrice: ee,
serviceGroups: E,
serviceGroupValues: le,
serviceStaffs: Fe,
servicePreparationDuration: N,
serviceBufferAfterDuration: q,
serviceValidation: R,
serviceExternalId: j,
validations: ae,
locations: de,
colors: ue,
durations: te,
visibilities: ce,
onSave: U,
back: he,
pageOptions: c,
addLocation: L,
sliceLocation: H,
allPossibleLocation: ve,
customLoc: ie,
changeStaffs: K,
serviceCancellationDelayEnable: z,
serviceCancellationDelayValue: W,
serviceCancellationDelayHelper: Ve,
serviceCancellationDelayMandatory: Q,
minAppointmentValue: Be,
minAppointmentUnit: Ie,
maxAppointmentValue: Ee,
maxAppointmentUnit: we,
changeInterval: Oe,
hasIntervalByService: se
} = Rl(
r.api,
r.organisation,
r.locale,
r.companyId,
r.serviceId,
r.logger,
r.new,
r.clone,
r.router
);
return (w, t) => {
const Te = Ul("router-link");
return k(), be(e(Bl), {
id: "settings-service-details",
options: e(c),
locale: r.locale,
onMobileBack: e(he)
}, {
actions: m(() => [
b(Te, {
to: { name: e(Me).Services, params: { companyId: r.companyId } },
custom: ""
}, {
default: m(({ navigate: s, href: h, route: g }) => [
v("button", {
ref: "cancelButton",
"aria-label": e(a).global.t("settings.service-details.action.back"),
class: "az-btn az-btn-color-neutral az-whitespace-nowrap",
onClick: s
}, Pe(e(a).global.t("settings.service-details.action.back")), 9, jl)
]),
_: 1
}, 8, ["to"]),
v("button", {
"aria-label": e(a).global.t("settings.action.save"),
disabled: !e(l) || e(V),
class: "az-btn az-btn-color-primary",
onClick: t[0] || (t[0] = (...s) => e(U) && e(U)(...s))
}, Pe(e(a).global.t("settings.action.save")), 9, Hl)
]),
mobileActions: m(() => [
v("button", {
class: "az-btn az-btn-color-transparent az-btn-icon-alone",
disabled: !e(l) || e(V),
onClick: t[1] || (t[1] = (...s) => e(U) && e(U)(...s)),
onKeypress: t[2] || (t[2] = Re(
(...s) => e(U) && e(U)(...s),
["enter"]
))
}, Ql, 40, Kl)
]),
general: m(() => [
b(e(S), { id: "service-details-general" }, {
content: m(() => [
v("div", Jl, [
b(e(je), {
id: `${r.id}_general_name`,
modelValue: e($),
"onUpdate:modelValue": t[3] || (t[3] = (s) => f($) ? $.value = s : null),
label: e(a).global.t("settings.service-details.name.label"),
locale: r.locale,
mandatory: e(p).mandatory,
placeholder: e(a).global.t("settings.service-details.name.placeholder"),
onValidated: t[4] || (t[4] = (s) => {
e(_)("name", s);
})
}, null, 8, ["id", "modelValue", "label", "locale", "mandatory", "placeholder"]),
b(e(Il), {
id: `${r.id}_general_description`,
modelValue: e(P),
"onUpdate:modelValue": t[5] || (t[5] = (s) => f(P) ? P.value = s : null),
label: e(a).global.t("settings.service-details.description.label"),
locale: r.locale,
mandatory: e(p).optional,
placeholder: e(a).global.t("settings.service-details.description.placeholder")
}, null, 8, ["id", "modelValue", "label", "locale", "mandatory", "placeholder"]),
v("div", Xl, [
b(e(He), {
id: `${r.id}_general_actif`,
modelValue: e(I),
"onUpdate:modelValue": t[6] || (t[6] = (s) => f(I) ? I.value = s : null),
label: e(a).global.t("settings.service-details.actif.label"),
locale: r.locale,
mandatory: e(p).ignore,
placeholder: e(a).global.t("settings.service-details.actif.placeholder")
}, null, 8, ["id", "modelValue", "label", "locale", "mandatory", "placeholder"]),
v("div", Yl, Pe(e(a).global.t("settings.service-details.actif.helper")), 1)
]),
e(V) ? oe("", !0) : (k(), be(e(El), {
key: 0,
id: `${r.id}_general_logo`,
modelValue: e(F),
"onUpdate:modelValue": [
t[7] || (t[7] = (s) => f(F) ? F.value = s : null),
e(Y)
],
buttonLabel: e(a).global.t("settings.service-details.illustration.button"),
defaultFilename: e(fe) ? e(a).global.t("settings.service-details.illustration.default-name") : void 0,
fileInfo: { maxSize: 5, extensions: [".png", ".gif", ".jpeg", ".jpg"] },
"helper-message": e(a).global.t("settings.service-details.illustration.helper"),
label: e(a).global.t("settings.service-details.illustration.label"),
locale: r.locale,
mandatory: e(p).optional,
placeholder: e(a).global.t("settings.service-details.illustration.placeholder")
}, null, 8, ["id", "modelValue", "buttonLabel", "defaultFilename", "fileInfo", "helper-message", "label", "locale", "mandatory", "placeholder", "onUpdate:modelValue"])),
b(e(Ge), {
id: `${r.id}_general_duration`,
modelValue: e(M),
"onUpdate:modelValue": t[8] || (t[8] = (s) => f(M) ? M.value = s : null),
label: e(a).global.t("settings.service-details.duration.label"),
locale: r.locale,
mandatory: e(p).mandatory,
placeholder: e(a).global.t("settings.service-details.duration.placeholder"),
minlength: 1,
maxlength: 999,
onValidated: t[9] || (t[9] = (s) => {
e(_)("duration", s);
})
}, null, 8, ["id", "modelValue", "label", "locale", "mandatory", "placeholder"]),
b(e(Ge), {
id: `${r.id}_general_quantity`,
modelValue: e(G),
"onUpdate:modelValue": t[10] || (t[10] = (s) => f(G) ? G.value = s : null),
"helper-message": e(a).global.t("settings.service-details.quantity.helper"),
label: e(a).global.t("settings.service-details.quantity.label"),
locale: r.locale,
mandatory: e(p).mandatory,
placeholder: e(a).global.t("settings.service-details.quantity.placeholder"),
onValidated: t[11] || (t[11] = (s) => {
e(_)("quantity", s);
})
}, null, 8, ["id", "modelValue", "helper-message", "label", "locale", "mandatory", "placeholder"]),
b(e(ne), {
id: `${r.id}_general_color`,
modelValue: e(B),
"onUpdate:modelValue": t[12] || (t[12] = (s) => f(B) ? B.value = s : null),
"helper-message": e(a).global.t("settings.service-details.color.helper"),
label: e(a).global.t("settings.service-details.color.label"),
locale: r.locale,
mandatory: e(p).optional,
placeholder: e(a).global.t("settings.service-details.color.placeholder"),
values: e(ue)
}, null, 8, ["id", "modelValue", "helper-message", "label", "locale", "mandatory", "placeholder", "values"])
])
]),
_: 1
}),
Zl,
b(e(S), {
id: "service-details-location",
title: e(a).global.t("settings.service-details.location.title"),
"sub-title": e(a).global.t("settings.service-details.location.subtitle")
}, {
content: m(() => [
v("div", ea, [
v("div", la, Pe(e(a).global.t("settings.service-details.location.label")), 1),
(k(!0), pe(Ll, null, $l(e(y), (s, h) => (k(), pe("div", aa, [
v("div", ta, [
v("div", ia, [
e(y)[h].length !== 1 || e(y)[h][0] !== "custom" ? (k(), be(e(ne), {
key: 0,
id: `${r.id}_general_location_${h}`,
modelValue: e(y)[h],
"onUpdate:modelValue": (g) => e(y)[h] = g,
label: "",
locale: r.locale,
mandatory: e(p).optional,
placeholder: e(a).global.t("settings.service-details.location.placeholder"),
values: e(de)[h],
onValidated: t[13] || (t[13] = (g) => {
e(_)("location", g);
})
}, null, 8, ["id", "modelValue", "onUpdate:modelValue", "locale", "mandatory", "placeholder", "values"])) : (k(), be(e(je), {
key: 1,
id: `${r.id}_general_location_${h}`,
modelValue: e(ie),
"onUpdate:modelValue": t[14] || (t[14] = (g) => f(ie) ? ie.value = g : null),
label: "",
locale: r.locale,
mandatory: e(p).optional,
placeholder: e(a).global.t("settings.service-details.location.custom.placeholder"),
onValidated: t[15] || (t[15] = (g) => {
e(_)("location", g);
})
}, null, 8, ["id", "modelValue", "locale", "mandatory", "placeholder"]))
]),
v("div", sa, [
e(y).length > 1 ? (k(), pe("button", {
key: 0,
class: "az-btn az-btn-color-neutral az-btn-icon-alone",
onClick: (g) => e(H)(s[0], h),
onKeyup: Re((g) => e(H)(s[0], h), ["enter"])
}, ra, 40, oa)) : oe("", !0),
v("button", {
style: Fl({ visibility: h === e(y).length - 1 && e(ve).length > e(y).length ? "visible" : "hidden" }),
class: "az-btn az-btn-color-neutral az-btn-icon-alone",
onClick: t[16] || (t[16] = (...g) => e(L) && e(L)(...g)),
onKeyup: t[17] || (t[17] = Re(
(...g) => e(L) && e(L)(...g),
["enter"]
))
}, ua, 36)
])
])
]))), 256))
])
]),
_: 1
}, 8, ["title", "sub-title"]),
ca,
b(e(S), {
id: "service-details-price",
title: e(a).global.t("settings.service-details.price.title"),
"sub-title": e(a).global.t("settings.service-details.price.subtitle")
}, {
content: m(() => {
var s;
return [
v("div", va, [
b(e(Ge), {
id: `${r.id}_general_price`,
modelValue: e(ee),
"onUpdate:modelValue": t[18] || (t[18] = (h) => f(ee) ? ee.value = h : null),
label: e(a).global.t("settings.service-details.price.label", { currency: (s = e(T)) == null ? void 0 : s.currency }),
locale: r.locale,
mandatory: e(p).optional,
placeholder: e(a).global.t("settings.service-details.price.placeholder")
}, null, 8, ["id", "modelValue", "label", "locale", "mandatory", "placeholder"])
])
];
}),
_: 1
}, 8, ["title", "sub-title"]),
e(le).length > 0 ? (k(), pe("div", ba)) : oe("", !0),
e(le).length > 0 ? (k(), be(e(S), {
key: 1,
id: "service-details-category",
title: e(a).global.t("settings.service-details.category.title"),
"sub-title": e(a).global.t("settings.service-details.category.subtitle")
}, {
content: m(() => [
v("div", pa, [
b(e(ne), {
id: `${r.id}_general_category`,
modelValue: e(E),
"onUpdate:modelValue": t[19] || (t[19] = (s) => f(E) ? E.value = s : null),
label: e(a).global.t("settings.service-details.category.label"),
locale: r.locale,
mandatory: e(p).optional,
multiple: !0,
translatable: !1,
placeholder: e(a).global.t("settings.service-details.category.placeholder"),
values: e(le)
}, null, 8, ["id", "modelValue", "label", "locale", "mandatory", "placeholder", "values"])
])
]),
_: 1
}, 8, ["title", "sub-title"])) : oe("", !0),
ma,
b(e(S), {
id: "service-details-visibility",
title: e(a).global.t("settings.service-details.visibility.title"),
"sub-title": e(a).global.t("settings.service-details.visibility.subtitle")
}, {
content: m(() => [
v("div", ga, [
b(e(ne), {
id: `${r.id}_general_visibility`,
modelValue: e(Z),
"onUpdate:modelValue": t[20] || (t[20] = (s) => f(Z) ? Z.value = s : null),
label: e(a).global.t("settings.service-details.visibility.label"),
locale: r.locale,
mandatory: e(p).mandatory,
placeholder: e(a).global.t("settings.service-details.visibility.placeholder"),
values: e(ce),
onValidated: t[21] || (t[21] = (s) => {
e(_)("visibility", s);
})
}, null, 8, ["id", "modelValue", "label", "locale", "mandatory", "placeholder", "values"])
])
]),
_: 1
}, 8, ["title", "sub-title"]),
b(e(S), {
id: "service-max-cancellation-delay",
title: e(a).global.t("settings.service-details.maxCancellationDelay.title"),
"sub-title": e(a).global.t("settings.service-details.maxCancellationDelay.subtitle")
}, {
content: m(() => [
v("div", fa, [
b(e(He), {
id: `${r.id}_general_cancellation_delay_enable`,
modelValue: e(z),
"onUpdate:modelValue": t[22] || (t[22] = (s) => f(z) ? z.value = s : null),
label: e(a).global.t("settings.service-details.maxCancellationDelay.switchLabel"),
locale: r.locale,
mandatory: e(p).ignore
}, null, 8, ["id", "modelValue", "label", "locale", "mandatory"]),
e(z) ? (k(), pe("div", ya)) : oe("", !0),
e(z) ? (k(), be(e(Ge), {
key: 1,
id: `${r.id}_general_cancellation_delay_value`,
modelValue: e(W),
"onUpdate:modelValue": t[23] || (t[23] = (s) => f(W) ? W.value = s : null),
label: e(a).global.t("settings.service-details.maxCancellationDelay.inputLabel"),
locale: r.locale,
mandatory: e(Q),
placeholder: e(a).global.t("settings.service-details.maxCancellationDelay.inputPlaceholder"),
minlength: 1,
maxlength: 999,
"helper-message": e(Ve),
onValidated: t[24] || (t[24] = (s) => {
e(_)("cancellationDelay", s);
})
}, null, 8, ["id", "modelValue", "label", "locale", "mandatory", "placeholder", "helper-message"])) : oe("", !0)
])
]),
_: 1
}, 8, ["title", "sub-title"]),
ha,
b(e(S), {
id: "service-details-interval",
title: e(a).global.t("settings.service-details.interval.title"),
"sub-title": e(a).global.t("settings.service-details.interval.description")
}, {
content: m(() => [
b(e(He), {
id: "service-details-interval-duration-toggle",
mandatory: e(p).ignore,
locale: r.locale,
label: e(a).global.t("settings.service-details.interval.active"),
modelValue: e(se),
"onUpdate:modelValue": t[25] || (t[25] = (s) => f(se) ? se.value = s : null)
}, null, 8, ["mandatory", "locale", "label", "modelValue"]),
e(se) ? (k(), pe("div", Va, [
za,
b(e(wl), {
mandatory: e(p).mandatory,
locale: w.locale,
id: "service-details-interval-duration",
"from-value": e(Be),
"from-unit": e(Ie),
"to-value": e(Ee),
"to-unit": e(we),
label: "",
onOnChange: e(Oe),
onValidated: t[26] || (t[26] = (s) => e(_)("interval", s))
}, null, 8, ["mandatory", "locale", "from-value", "from-unit", "to-value", "to-unit", "onOnChange"])
])) : oe("", !0)
]),
_: 1
}, 8, ["title", "sub-title"])
]),
availabilities: m(() => [
b(e(S), {
id: "service-details-buffer",
title: e(a).global.t("settings.service-details.buffer.title"),
"sub-title": e(a).global.t("settings.service-details.buffer.subtitle")
}, {
content: m(() => [
v("div", _a, [
v("div", xa, [
b(e(ne), {
id: "servicePreparation",
modelValue: e(N),
"onUpdate:modelValue": t[27] || (t[27] = (s) => f(N) ? N.value = s : null),
label: e(a).global.t("settings.service-details.buffer.before.label"),
locale: r.locale,
mandatory: e(p).mandatory,
placeholder: e(a).global.t("settings.service-details.buffer.before.placeholder"),
values: e(te),
onValidated: t[28] || (t[28] = (s) => {
e(_)("preparation", s);
})
}, null, 8, ["modelValue", "label", "locale", "mandatory", "placeholder", "values"])
]),
v("div", Da, [
b(e(ne), {
id: "serviceBufferAfter",
modelValue: e(q),
"onUpdate:modelValue": t[29] || (t[29] = (s) => f(q) ? q.value = s : null),
label: e(a).global.t("settings.service-details.buffer.after.label"),
locale: r.locale,
mandatory: e(p).mandatory,
placeholder: e(a).global.t("settings.service-details.buffer.after.placeholder"),
values: e(te),
onValidated: t[30] || (t[30] = (s) => {
e(_)("bufferAfter", s);
})
}, null, 8, ["modelValue", "label", "locale", "mandatory", "placeholder", "values"])
])
])
]),
_: 1
}, 8, ["title", "sub-title"])
]),
staffs: m(() => [
b(e(S), {
id: "service-details-staffs",
title: e(a).global.t("settings.service-details.staffs.title"),
"sub-title": e(a).global.t("settings.service-details.staffs.subtitle"),
class: "az-h-full"
}, {
content: m(() => [
b(e(Nl), {
api: w.api,
acl: e(ge),
locale: w.locale,
staffs: e(Fe),
companyId: w.companyId,
loading: e(V),
"search-label": e(a).global.t("settings.service-details.staffs.search.searchLabel"),
"modal-title": e(a).global.t("settings.service-details.staffs.search.add.title"),
"modal-description": e(a).global.t("settings.service-details.staffs.search.add.description"),
"context-type": `link service ${w.clone ? "0" : w.serviceId} staff`,
onChangeStaffs: e(K)
}, null, 8, ["api", "acl", "locale", "staffs", "companyId", "loading", "search-label", "modal-title", "modal-description", "context-type", "onChangeStaffs"])
]),
_: 1
}, 8, ["title", "sub-title"])
]),
options: m(() => [
b(e(S), {
id: "service-details-validation",
title: e(a).global.t("settings.service-details.validation.title"),
"sub-title": e(a).global.t("settings.service-details.validation.subtitle")
}, {
content: m(() => [
v("div", ka, [
b(e(ne), {
id: "serviceValidation",
modelValue: e(R),
"onUpdate:modelValue": t[31] || (t[31] = (s) => f(R) ? R.value = s : null),
label: e(a).global.t("settings.service-details.validation.label"),
locale: r.locale,
mandatory: e(p).mandatory,
placeholder: e(a).global.t("settings.service-details.validation.placeholder"),
values: e(ae),
onValidated: t[32] || (t[32] = (s) => {
e(_)("validation", s);
})
}, null, 8, ["modelValue", "label", "locale", "mandatory", "placeholder", "values"])
])
]),
_: 1
}, 8, ["title", "sub-title"])
]),
advanced: m(() => [
b(e(S), {
id: "service-details-external-ref",
title: e(a).global.t("settings.service-details.external-ref.title")
}, {
content: m(() => [
v("div", Ca, [
b(e(je), {
id: "serviceExternalId",
modelValue: e(j),
"onUpdate:modelValue": t[33] || (t[33] = (s) => f(j) ? j.value = s : null),
"helper-message": e(a).global.t("settings.service-details.external-id.helper"),
label: e(a).global.t("settings.service-details.external-id.label"),
locale: r.locale,
mandatory: e(p).optional,
placeholder: e(a).global.t("settings.service-details.external-id.placeholder")
}, null, 8, ["modelValue", "helper-message", "label", "locale", "mandatory", "placeholder"])
])
]),
_: 1
}, 8, ["title"])
]),
_: 1
}, 8, ["options", "locale", "onMobileBack"]);
};
}
});
export {
Ta as default
};