fix [P-290]: правка доступных календарей для редактирования событий

This commit is contained in:
Inna committed 2025-10-10 14:02:36 +03:00
1 parent 67b201a5fe
commit bc89809b9b
3 files changed
+23 -6

No files matched your search

@@ -15,7 +15,7 @@
<event-create <event-create
@closeDialog="closeEventDialog" @closeDialog="closeEventDialog"
:eventCalendar="eventFromCalendar" :eventCalendar="eventFromCalendar"
:myCalendars="calendarStore.myCalendars" :allCalendars="allCalendars"
@getCalendar="getCalendar" @getCalendar="getCalendar"
@update:eventCalendar="eventFromCalendar = $event" @update:eventCalendar="eventFromCalendar = $event"
ref="createEvents" ref="createEvents"
@@ -224,7 +224,8 @@ export default {
showViewDialog, showViewDialog,
selectedEventForView, selectedEventForView,
allCalendars, allCalendars,
eventKey, calendarKey eventKey,
calendarKey,
}; };
}, },
}; };
@@ -1,5 +1,5 @@
<template> <template>
<v-dialog v-model="internalShow" max-width="800"> <v-dialog v-model="internalShow" max-width="700">
<v-card class="pa-4" min-height="400"> <v-card class="pa-4" min-height="400">
<!-- Заголовок --> <!-- Заголовок -->
<v-card-title class="pr-0 pl-2 d-flex justify-space-between pb-3"> <v-card-title class="pr-0 pl-2 d-flex justify-space-between pb-3">
@@ -170,7 +170,6 @@
auto-grow auto-grow
v-model="propsEvent.event.description" v-model="propsEvent.event.description"
class="scrollable-textarea pt-3" class="scrollable-textarea pt-3"
></v-textarea> </v-col ></v-textarea> </v-col
></v-row> ></v-row>
</v-row> </v-row>
@@ -208,7 +207,7 @@ export default {
type: Object, type: Object,
default: () => {}, default: () => {},
}, },
myCalendars: { allCalendars: {
type: Array, type: Array,
default: () => [], default: () => [],
}, },
@@ -470,7 +469,24 @@ export default {
// const isNewEvent = computed(() => !propsEvent.value.event.id); // const isNewEvent = computed(() => !propsEvent.value.event.id);
// Computed property с защитой от undefined // Computed property с защитой от undefined
const safeCalendars = computed(() => props.myCalendars || []); // const safeCalendars = computed(() => props.allCalendars || []);
const safeCalendars = computed(() => {
const userId = accountStore.user.is_idEmployee;
return (props.allCalendars || []).filter((calendar) => {
// Пользователь - автор календаря (полные права)
if (calendar.author === userId) {
return true;
}
// Пользователь - участник с правами редактора
const participant = calendar.participant?.find((p) => p.participant_calendar === userId);
return participant?.editor === true;
});
});
const isCalendarsReady = computed(() => safeCalendars.value.length > 0); const isCalendarsReady = computed(() => safeCalendars.value.length > 0);