fix: Front end validation on switch.
Add a watcher on limitedPlaces and set to default values options related to occupancy when toogle to false. Increase min places to 1 instead of 0. See issue: #307
This commit is contained in:
parent
67865b6e28
commit
d08c887892
@ -92,7 +92,7 @@
|
||||
|
||||
<div class="box" v-if="limitedPlaces">
|
||||
<b-field :label="$t('Number of places')">
|
||||
<b-numberinput controls-position="compact" min="0" v-model="event.options.maximumAttendeeCapacity" />
|
||||
<b-numberinput controls-position="compact" min="1" v-model="event.options.maximumAttendeeCapacity" />
|
||||
</b-field>
|
||||
<!--
|
||||
<b-field>
|
||||
@ -344,7 +344,7 @@ export default class EditEvent extends Vue {
|
||||
this.unmodifiedEvent = JSON.parse(JSON.stringify(this.event.toEditJSON()));
|
||||
|
||||
this.pictureFile = await buildFileFromIPicture(this.event.picture);
|
||||
this.limitedPlaces = this.event.options.maximumAttendeeCapacity !== 0;
|
||||
this.limitedPlaces = this.event.options.maximumAttendeeCapacity > 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -574,6 +574,15 @@ export default class EditEvent extends Vue {
|
||||
return new EventModel(result.data.event);
|
||||
}
|
||||
|
||||
@Watch('limitedPlaces')
|
||||
updatedEventCapacityOptions(limitedPlaces: boolean) {
|
||||
if (! limitedPlaces) {
|
||||
this.event.options.maximumAttendeeCapacity = 0
|
||||
this.event.options.remainingAttendeeCapacity = 0
|
||||
this.event.options.showRemainingAttendeeCapacity = false
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('needsApproval')
|
||||
updateEventJoinOptions(needsApproval) {
|
||||
if (needsApproval === true) {
|
||||
|
Loading…
Reference in New Issue
Block a user