Add a register category with radio buttons

This commit is contained in:
Massedil 2024-02-15 18:22:39 +01:00
parent 94b96b56cf
commit c61815e2f4
1 changed files with 56 additions and 21 deletions

View File

@ -241,19 +241,36 @@
{{ t('Page limited to my group (asks for auth)') }}
</o-radio>
</div>-->
</section>
<section class="my-4">
<h2>
{{ t("How to register") }}
</h2>
<div class="field">
<o-radio
v-model="registerOption"
name="registerOption"
:native-value="RegisterOption.MOBILIZON"
>{{ t("I want to manage the registration on Mobilizon") }}</o-radio
>
</div>
<div class="field">
<o-radio
v-model="registerOption"
name="registerOption"
:native-value="RegisterOption.EXTERNAL"
>{{
t("I want to manage the registration with an external provider")
}}</o-radio
>
</div>
<o-field
:label="t('External registration')"
v-if="features?.eventExternal"
v-if="registerOption === RegisterOption.EXTERNAL"
:label="t('URL')"
>
<o-switch v-model="externalParticipation">
{{
t("I want to manage the registration with an external provider")
}}
</o-switch>
</o-field>
<o-field v-if="externalParticipation" :label="t('URL')">
<o-input
icon="link"
type="url"
@ -264,7 +281,10 @@
</o-field>
<o-field
v-if="anonymousParticipationConfig?.allowed && !externalParticipation"
v-if="
anonymousParticipationConfig?.allowed &&
registerOption === RegisterOption.MOBILIZON
"
:label="t('Anonymous participations')"
>
<o-switch v-model="eventOptions.anonymousParticipation">
@ -287,27 +307,35 @@
<o-field
:label="t('Participation approval')"
v-show="!externalParticipation"
v-show="registerOption === RegisterOption.MOBILIZON"
>
<o-switch v-model="needsApproval">{{
t("I want to approve every participation request")
}}</o-switch>
</o-field>
<o-field :label="t('Number of places')" v-show="!externalParticipation">
<o-switch>{{ t("Limited number of places") }}</o-switch>
</o-field>
<o-field
:label="t('Showing participants')"
v-show="!externalParticipation"
v-show="registerOption === RegisterOption.MOBILIZON"
>
<o-switch v-model="hideParticipants">{{
t("Hide the number of participants")
}}</o-switch>
</o-field>
<div class="" v-if="limitedPlaces && !externalParticipation">
<o-field
:label="t('Number of places')"
v-show="registerOption === RegisterOption.MOBILIZON"
>
<o-switch v-model="limitedPlaces">{{
t("Limited number of places")
}}</o-switch>
</o-field>
<div
class=""
v-if="limitedPlaces && registerOption === RegisterOption.MOBILIZON"
>
<o-field :label="t('Number of places')" label-for="number-of-places">
<o-input
type="number"
@ -1375,12 +1403,19 @@ const orderedCategories = computed(() => {
return sortBy(eventCategories.value, ["label"]);
});
const externalParticipation = computed({
const RegisterOption = {
MOBILIZON: "mobilizon",
EXTERNAL: "external",
};
const registerOption = computed({
get() {
return event.value?.joinOptions === EventJoinOptions.EXTERNAL;
return event.value?.joinOptions === EventJoinOptions.EXTERNAL
? RegisterOption.EXTERNAL
: RegisterOption.MOBILIZON;
},
set(newValue) {
if (newValue === true) {
if (newValue === RegisterOption.EXTERNAL) {
event.value.joinOptions = EventJoinOptions.EXTERNAL;
} else {
event.value.joinOptions = EventJoinOptions.FREE;