Skip to content

Commit

Permalink
Swap the :checked state to a v-model that applies on change event.
Browse files Browse the repository at this point in the history
  • Loading branch information
MelissaAutumn committed Oct 2, 2024
1 parent 45d9245 commit 6d53e03
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions frontend/src/components/ScheduleCreation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ const defaultSchedule: Schedule = {
const scheduleInput = ref({ ...defaultSchedule });
// For comparing changes, and resetting to default.
const referenceSchedule = ref({ ...defaultSchedule });
const generateZoomLink = ref(scheduleInput.value.meeting_link_provider === MeetingLinkProviderType.Zoom);
onMounted(() => {
// Retrieve the current external connections
Expand All @@ -139,6 +140,8 @@ onMounted(() => {
scheduleInput.value = { ...defaultSchedule };
}
generateZoomLink.value = scheduleInput.value.meeting_link_provider === MeetingLinkProviderType.Zoom;
// Set a new reference
referenceSchedule.value = { ...scheduleInput.value };
});
Expand Down Expand Up @@ -348,7 +351,7 @@ const toggleActive = async (newValue: boolean) => {
// Work-around for v-model and value not working for some reason...
const toggleZoomLinkCreation = () => {
if (scheduleInput.value.meeting_link_provider === MeetingLinkProviderType.None) {
if (generateZoomLink.value) {
scheduleInput.value.meeting_link_provider = MeetingLinkProviderType.Zoom;
return;
}
Expand Down Expand Up @@ -443,7 +446,7 @@ watch(
{{ scheduleCreationError }}
</alert-box>

<div class="px-4 mb-1">
<div class="mb-1 px-4">
<label for="scheduleName" class="flex-column flex">
<input
id="scheduleName"
Expand Down Expand Up @@ -647,7 +650,7 @@ watch(
<checkbox-input
name="generateZoomLink"
:label="t('label.generateZoomLink')"
:checked="scheduleInput.meeting_link_provider === MeetingLinkProviderType.Zoom"
v-model="generateZoomLink"
:disabled="!scheduleInput.active || !hasZoomAccount"
@change="toggleZoomLinkCreation"
/>
Expand Down

0 comments on commit 6d53e03

Please sign in to comment.