From 6dbbaa1a4536e16df9b29cba4774ffa776328747 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Wed, 6 Mar 2024 01:46:30 -0500 Subject: [PATCH] Calendar: Fix conditions to show the add button --- .../vue/composables/calendar/calendarActionButtons.js | 10 ++++++---- assets/vue/views/ccalendarevent/CCalendarEventList.vue | 7 +++++++ .../Controller/PlatformConfigurationController.php | 1 + 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/assets/vue/composables/calendar/calendarActionButtons.js b/assets/vue/composables/calendar/calendarActionButtons.js index 23e15b9563..5cce982f54 100644 --- a/assets/vue/composables/calendar/calendarActionButtons.js +++ b/assets/vue/composables/calendar/calendarActionButtons.js @@ -29,13 +29,15 @@ export function useCalendarActionButtons() { const showSessionPlanningButton = ref(false) const showMyStudentsScheduleButton = ref(false) + const isPersonal = !course.value + watchEffect(() => { if ( isAllowedToEdit.value || - (!course.value && - !securityStore.isAuthenticated && - platformConfigStore.getSetting("agenda.allow_personal_agenda")) || - ("1" === courseAllowUserEditAgenda && !securityStore.isAuthenticated && isAllowedToSessionEdit) + (isPersonal && + securityStore.isAuthenticated && + "true" === platformConfigStore.getSetting("agenda.allow_personal_agenda")) || + ("1" === courseAllowUserEditAgenda && securityStore.isAuthenticated && isAllowedToSessionEdit) ) { showAddButton.value = true showImportICalButton.value = true diff --git a/assets/vue/views/ccalendarevent/CCalendarEventList.vue b/assets/vue/views/ccalendarevent/CCalendarEventList.vue index 8a240be864..25ca4b0524 100644 --- a/assets/vue/views/ccalendarevent/CCalendarEventList.vue +++ b/assets/vue/views/ccalendarevent/CCalendarEventList.vue @@ -128,6 +128,7 @@ import { RESOURCE_LINK_PUBLISHED } from "../../components/resource_links/visibil import { useLocale, useParentLocale } from "../../composables/locale" import { storeToRefs } from "pinia" import CalendarSectionHeader from "../../components/ccalendarevent/CalendarSectionHeader.vue" +import { useCalendarActionButtons } from "../../composables/calendar/calendarActionButtons" const store = useStore() const confirm = useConfirm() @@ -137,6 +138,8 @@ const { course, session, group } = storeToRefs(cidReqStore) const { abbreviatedDatetime } = useFormatDate() +const { showAddButton } = useCalendarActionButtons() + const item = ref({}) const dialog = ref(false) const dialogShow = ref(false) @@ -256,6 +259,10 @@ const calendarOptions = ref({ dialogShow.value = true }, select(info) { + if (!showAddButton.value) { + return + } + item.value = {} item.value["parentResourceNode"] = currentUser.value.resourceNode["id"] item.value["allDay"] = info.allDay diff --git a/src/CoreBundle/Controller/PlatformConfigurationController.php b/src/CoreBundle/Controller/PlatformConfigurationController.php index 726f78bb5e..e73a023412 100644 --- a/src/CoreBundle/Controller/PlatformConfigurationController.php +++ b/src/CoreBundle/Controller/PlatformConfigurationController.php @@ -56,6 +56,7 @@ class PlatformConfigurationController extends AbstractController 'registration.allow_terms_conditions', + 'agenda.allow_personal_agenda', 'agenda.personal_calendar_show_sessions_occupation', // 'agenda.agenda_reminders', 'agenda.agenda_collective_invitations',