fix [P-290]: правка доступных календарей для редактирования событий
This commit is contained in:
1 parent
67b201a5fe
commit
bc89809b9b
3 files changed
+26
-9
No files matched your search
@@ -15,7 +15,7 @@
|
||||
<event-create
|
||||
@closeDialog="closeEventDialog"
|
||||
:eventCalendar="eventFromCalendar"
|
||||
:myCalendars="calendarStore.myCalendars"
|
||||
:allCalendars="allCalendars"
|
||||
@getCalendar="getCalendar"
|
||||
@update:eventCalendar="eventFromCalendar = $event"
|
||||
ref="createEvents"
|
||||
@@ -224,7 +224,8 @@ export default {
|
||||
showViewDialog,
|
||||
selectedEventForView,
|
||||
allCalendars,
|
||||
eventKey, calendarKey
|
||||
eventKey,
|
||||
calendarKey,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<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-title class="pr-0 pl-2 d-flex justify-space-between pb-3">
|
||||
|
||||
@@ -160,8 +160,8 @@
|
||||
@postFiles="postFiles"
|
||||
/>
|
||||
</v-row>
|
||||
<v-row no-gutters class="align-center pt-6" >
|
||||
<v-col >
|
||||
<v-row no-gutters class="align-center pt-6">
|
||||
<v-col>
|
||||
<v-textarea
|
||||
density="compact"
|
||||
label="Дополнительное описание"
|
||||
@@ -170,7 +170,6 @@
|
||||
auto-grow
|
||||
v-model="propsEvent.event.description"
|
||||
class="scrollable-textarea pt-3"
|
||||
|
||||
></v-textarea> </v-col
|
||||
></v-row>
|
||||
</v-row>
|
||||
@@ -179,7 +178,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { axiosApiInstance } from '@/utils/axios-api';
|
||||
import { useAccountStore } from '@/store/AccountStore';
|
||||
import DialogCreate from '@/components/calendar_of_events/UI_calendar/dialogCreate.vue';
|
||||
@@ -208,7 +207,7 @@ export default {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
myCalendars: {
|
||||
allCalendars: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
@@ -470,7 +469,24 @@ export default {
|
||||
// const isNewEvent = computed(() => !propsEvent.value.event.id);
|
||||
|
||||
// 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);
|
||||
|
||||
|
||||
Reference in new issue
Block a user