fix [P-56]: изменение логики отображения событий
This commit is contained in:
1 parent
b4960a8c05
commit
105217c5e5
8 files changed
+145
-169
No files matched your search
@@ -103,10 +103,10 @@ class MyEvents(APIView):
|
|||||||
allcalendars = Calendar.objects.filter(Q(get_participants__participant_calendar__id=request.user.user.id ,get_participants__editor=1) | Q(author__id=request.user.user.id)).distinct()
|
allcalendars = Calendar.objects.filter(Q(get_participants__participant_calendar__id=request.user.user.id ,get_participants__editor=1) | Q(author__id=request.user.user.id)).distinct()
|
||||||
resp = {'mycalendars':CalendarsSerializerForEventEdit(allcalendars, many=True).data }
|
resp = {'mycalendars':CalendarsSerializerForEventEdit(allcalendars, many=True).data }
|
||||||
if request.query_params.get("id") is not None:
|
if request.query_params.get("id") is not None:
|
||||||
# event = Event.objects.get(id = request.query_params.get("id"))
|
event = Event.objects.get(id = request.query_params.get("id"))
|
||||||
# resp['event']=EventSerializerIdRequest(event).data
|
resp['event']=EventSerializerIdRequest(event).data
|
||||||
events = Event.objects.filter(calendar__id = request.query_params.get("id"))
|
# events = Event.objects.filter(calendar__id = request.query_params.get("id"))
|
||||||
resp['events'] = EventSerializerIdRequest(events, many=True).data
|
# resp['events'] = EventSerializerIdRequest(events, many=True).data
|
||||||
return Response(resp)
|
return Response(resp)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -73,8 +73,6 @@ export default {
|
|||||||
calendarStore.loadCalendars();
|
calendarStore.loadCalendars();
|
||||||
};
|
};
|
||||||
|
|
||||||
getCalendar();
|
|
||||||
|
|
||||||
const getEvents = (idEvent, clik) => {
|
const getEvents = (idEvent, clik) => {
|
||||||
axiosApiInstance
|
axiosApiInstance
|
||||||
.get(`api/calendar_of_events/my_events/${idEvent === undefined ? '' : `?id=${idEvent}`}`)
|
.get(`api/calendar_of_events/my_events/${idEvent === undefined ? '' : `?id=${idEvent}`}`)
|
||||||
@@ -95,9 +93,8 @@ export default {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
getEvents();
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
getEvents();
|
||||||
week.getWeekend(MyYear.value);
|
week.getWeekend(MyYear.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
<v-row no-gutters class="mb-4" align="center" justify="space-between">
|
<v-row no-gutters class="mb-4" align="center" justify="space-between">
|
||||||
<v-col md="4" class="flex-grow-0 d-flex align-center">
|
<v-col md="4" class="flex-grow-0 d-flex align-center">
|
||||||
<v-btn
|
<v-btn
|
||||||
|
v-show="!forHomePage"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
class="text-subtitle-2 mr-2"
|
class="text-subtitle-2 mr-2"
|
||||||
@click="handleToday"
|
@click="handleToday"
|
||||||
@@ -34,10 +35,17 @@
|
|||||||
>
|
>
|
||||||
<v-icon size="large">mdi-chevron-right</v-icon>
|
<v-icon size="large">mdi-chevron-right</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<span class="text-h6 text-no-wrap ml-2"> {{ currentTitle }} </span>
|
<span v-if="!forHomePage" class="text-h6 text-no-wrap ml-2">
|
||||||
|
{{ currentTitle }}
|
||||||
|
</span>
|
||||||
|
<span v-else class="text-caption text-no-wrap ml-2">
|
||||||
|
{{ currentTitle }}
|
||||||
|
</span>
|
||||||
</v-col>
|
</v-col>
|
||||||
|
|
||||||
<v-col class="flex-grow-0 d-flex justify-end">
|
<v-col class="flex-grow-0 d-flex justify-end">
|
||||||
<v-btn-toggle
|
<v-btn-toggle
|
||||||
|
v-show="!forHomePage"
|
||||||
v-model="currentView"
|
v-model="currentView"
|
||||||
mandatory
|
mandatory
|
||||||
divided
|
divided
|
||||||
@@ -74,18 +82,28 @@ import { useCalendarStore } from '@/store/calendarStore';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'CustomCalendar',
|
name: 'CustomCalendar',
|
||||||
setup() {
|
props: {
|
||||||
|
view: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
forHomePage: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
setup(props) {
|
||||||
const calendarRef = ref(null);
|
const calendarRef = ref(null);
|
||||||
const currentView = ref('dayGridMonth');
|
const currentView = ref('dayGridMonth');
|
||||||
const calendarApi = ref(null);
|
const calendarApi = ref(null);
|
||||||
const currentTitle = ref('Календарь');
|
const currentTitle = ref('Календарь');
|
||||||
|
|
||||||
const calendarStore = useCalendarStore();
|
const calendarStore = useCalendarStore();
|
||||||
const { selectedDate, lastUpdatedBy, visibleEvents } = storeToRefs(calendarStore);
|
const { selectedDate, lastUpdatedBy, allEvents } = storeToRefs(calendarStore);
|
||||||
|
|
||||||
const calendarOptions = ref({
|
const calendarOptions = ref({
|
||||||
plugins: [dayGridPlugin, timeGridPlugin, multiMonthPlugin, interactionPlugin, listPlugin],
|
plugins: [dayGridPlugin, timeGridPlugin, multiMonthPlugin, interactionPlugin, listPlugin],
|
||||||
initialView: currentView.value,
|
initialView: props.forHomePage ? props.view : currentView.value,
|
||||||
locales: [ruLocale],
|
locales: [ruLocale],
|
||||||
locale: 'ru',
|
locale: 'ru',
|
||||||
firstDay: 1,
|
firstDay: 1,
|
||||||
@@ -202,7 +220,7 @@ export default {
|
|||||||
currentTitle.value = info.view.title;
|
currentTitle.value = info.view.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedDate.value) {
|
if (selectedDate?.value) {
|
||||||
handleDateSelection(selectedDate.value);
|
handleDateSelection(selectedDate.value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -267,7 +285,7 @@ export default {
|
|||||||
if (calendarRef.value) {
|
if (calendarRef.value) {
|
||||||
const api = calendarRef.value.getApi();
|
const api = calendarRef.value.getApi();
|
||||||
api.removeAllEvents();
|
api.removeAllEvents();
|
||||||
visibleEvents.value.forEach((event) => {
|
allEvents.value.forEach((event) => {
|
||||||
api.addEvent({
|
api.addEvent({
|
||||||
id: event.id,
|
id: event.id,
|
||||||
title: event.name,
|
title: event.name,
|
||||||
@@ -281,81 +299,40 @@ export default {
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
updateCalendarEvents();
|
|
||||||
if (calendarRef.value && calendarRef.value.getApi) {
|
if (calendarRef.value && calendarRef.value.getApi) {
|
||||||
calendarApi.value = calendarRef.value.getApi();
|
calendarApi.value = calendarRef.value.getApi();
|
||||||
|
updateCalendarEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedDate.value) {
|
if (selectedDate.value != undefined && selectedDate.value) {
|
||||||
handleDateSelection(selectedDate.value);
|
handleDateSelection(selectedDate.value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// watch(currentView, (newView) => {
|
watch(selectedDate, (newDate) => {
|
||||||
// calendarApi.value?.changeView(newView);
|
if (newDate && calendarApi.value && lastUpdatedBy.value !== 'calendar') {
|
||||||
// });
|
nextTick(() => {
|
||||||
// // Единый watcher для selectedDate
|
calendarApi.value.gotoDate(newDate);
|
||||||
// watch(
|
handleDateSelection(newDate);
|
||||||
// selectedDate,
|
});
|
||||||
// (newDate, oldDate) => {
|
}
|
||||||
// if (!newDate || newDate === oldDate) return;
|
});
|
||||||
|
|
||||||
// // Небольшая задержка для гарантии что FullCalendar обновил DOM
|
watch(currentView, (newView) => {
|
||||||
// setTimeout(() => {
|
if (calendarApi.value) {
|
||||||
// if (calendarApi.value && lastUpdatedBy.value !== 'calendar') {
|
calendarApi.value.changeView(newView);
|
||||||
// try {
|
}
|
||||||
// calendarApi.value.gotoDate(newDate);
|
});
|
||||||
// } catch (error) {
|
|
||||||
// console.warn('Ошибка при переходе к дате:', error);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }, 50);
|
|
||||||
// },
|
|
||||||
// { immediate: true },
|
|
||||||
// );
|
|
||||||
// watch(
|
|
||||||
// () => calendarStore.loadEvents(),
|
|
||||||
// (newEvents) => {
|
|
||||||
// if (calendarRef.value) {
|
|
||||||
// const calendarApi = calendarRef.value.getApi();
|
|
||||||
// calendarApi.removeAllEvents();
|
|
||||||
// calendarApi.addEventSource(newEvents);
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// { deep: true },
|
|
||||||
// );
|
|
||||||
|
|
||||||
// Следим за изменениями событий в Pinia
|
|
||||||
watch(
|
watch(
|
||||||
() => {
|
allEvents,
|
||||||
|
(newEvents) => {
|
||||||
|
// Обновляем события в календаре при каждом изменении allEvents
|
||||||
updateCalendarEvents();
|
updateCalendarEvents();
|
||||||
},
|
},
|
||||||
{ deep: true },
|
{ deep: true },
|
||||||
);
|
); // deep: true на случай, если меняются свойства внутри событий
|
||||||
|
|
||||||
// Следим за изменениями выбранной даты
|
|
||||||
watch(
|
|
||||||
selectedDate,
|
|
||||||
(newDate) => {
|
|
||||||
if (!newDate || lastUpdatedBy.value === 'calendar') return;
|
|
||||||
setTimeout(() => {
|
|
||||||
if (calendarRef.value) {
|
|
||||||
const api = calendarRef.value.getApi();
|
|
||||||
api.gotoDate(newDate);
|
|
||||||
}
|
|
||||||
}, 50);
|
|
||||||
},
|
|
||||||
{ immediate: true },
|
|
||||||
);
|
|
||||||
|
|
||||||
// Следим за изменениями текущего вида
|
|
||||||
watch(currentView, (newView) => {
|
|
||||||
if (calendarRef.value) {
|
|
||||||
const api = calendarRef.value.getApi();
|
|
||||||
api.changeView(newView);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentTitle,
|
currentTitle,
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
import { useCalendarStore } from '@/store/calendarStore';
|
import { useCalendarStore } from '@/store/calendarStore';
|
||||||
import { useAccountStore } from '@/store/AccountStore';
|
import { useAccountStore } from '@/store/AccountStore';
|
||||||
import CalendarMy from '@/components/calendar_of_events/calendar-my.vue';
|
import CalendarMy from '@/components/calendar_of_events/calendar-my.vue';
|
||||||
import { onMounted } from 'vue';
|
import { onMounted, watch } from 'vue';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -82,7 +82,7 @@ export default {
|
|||||||
calendarStore.openEventDialog();
|
calendarStore.openEventDialog();
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadCalendars = async () => {
|
const loadCalendars = () => {
|
||||||
calendarStore.loadCalendars();
|
calendarStore.loadCalendars();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -91,11 +91,11 @@ export default {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Реакция на изменения пользователя
|
// Реакция на изменения пользователя
|
||||||
// watch(user, (newUser) => {
|
watch(user, (newUser) => {
|
||||||
// if (newUser) {
|
if (newUser) {
|
||||||
// loadCalendars();
|
loadCalendars();
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
accountStore,
|
accountStore,
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
:class="`text-${x.cl_color}`"
|
:class="`text-${x.cl_color}`"
|
||||||
:color="x.cl_color"
|
:color="x.cl_color"
|
||||||
v-model="x.visible"
|
v-model="x.visible"
|
||||||
@update:modelValue="chekUpdate(x)"
|
@update:modelValue="toggleVisiblityEvents(x)"
|
||||||
></v-checkbox-btn>
|
></v-checkbox-btn>
|
||||||
<!-- :model-value="x.visible" -->
|
<!-- :model-value="x.visible" -->
|
||||||
</template>
|
</template>
|
||||||
@@ -123,7 +123,7 @@ export default {
|
|||||||
showDialog.value = true;
|
showDialog.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const chekUpdate = (cal) => {
|
const toggleVisiblityEvents = (cal) => {
|
||||||
toggleCalendarVisibility(cal.id, cal.visible);
|
toggleCalendarVisibility(cal.id, cal.visible);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ export default {
|
|||||||
calendar,
|
calendar,
|
||||||
showDialog,
|
showDialog,
|
||||||
editCreatedCalendar,
|
editCreatedCalendar,
|
||||||
chekUpdate,
|
toggleVisiblityEvents,
|
||||||
openGroup,
|
openGroup,
|
||||||
trans,
|
trans,
|
||||||
hover,
|
hover,
|
||||||
|
|||||||
@@ -442,6 +442,7 @@ export default {
|
|||||||
files.value.forEach((e) => postEvent.append('files', e));
|
files.value.forEach((e) => postEvent.append('files', e));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
axiosApiInstance.post('api/calendar_of_events/my_events/', postEvent).then((result) => {
|
axiosApiInstance.post('api/calendar_of_events/my_events/', postEvent).then((result) => {
|
||||||
feedalert.alert = true;
|
feedalert.alert = true;
|
||||||
feedalert.text = result.data.mess;
|
feedalert.text = result.data.mess;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { ref, computed, watch } from 'vue';
|
|||||||
import { axiosApiInstance } from '@/utils/axios-api';
|
import { axiosApiInstance } from '@/utils/axios-api';
|
||||||
import { useAccountStore } from '@/store/AccountStore';
|
import { useAccountStore } from '@/store/AccountStore';
|
||||||
|
|
||||||
export const useCalendarStore = defineStore('calendar', () => {
|
export const useCalendarStore = defineStore('calendarStore', () => {
|
||||||
const accountStore = useAccountStore();
|
const accountStore = useAccountStore();
|
||||||
|
|
||||||
// State
|
// State
|
||||||
@@ -43,7 +43,9 @@ export const useCalendarStore = defineStore('calendar', () => {
|
|||||||
|
|
||||||
// Watcher: автоматически сохраняем hiddenCalendarIds в localStorage при изменении
|
// Watcher: автоматически сохраняем hiddenCalendarIds в localStorage при изменении
|
||||||
watch(
|
watch(
|
||||||
hiddenCalendarIds,
|
() => {
|
||||||
|
hiddenCalendarIds.value;
|
||||||
|
},
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
localStorage.setItem('hiddenCalendars', JSON.stringify(newValue));
|
localStorage.setItem('hiddenCalendars', JSON.stringify(newValue));
|
||||||
},
|
},
|
||||||
@@ -54,13 +56,10 @@ export const useCalendarStore = defineStore('calendar', () => {
|
|||||||
events.value.filter((event) => event.date_start.split('T')[0] === formattedSelectedDate.value),
|
events.value.filter((event) => event.date_start.split('T')[0] === formattedSelectedDate.value),
|
||||||
);
|
);
|
||||||
|
|
||||||
const visibleEvents = computed(() => events.value.filter((event) => event.visible));
|
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
const setSelectedDate = (date, source = 'unknown') => {
|
const setSelectedDate = (date, source = 'unknown') => {
|
||||||
selectedDate.value = new Date(date);
|
selectedDate.value = new Date(date);
|
||||||
lastUpdatedBy.value = source;
|
lastUpdatedBy.value = source;
|
||||||
// загрузить события для текущей даты в дальнейшем
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const setSelectedDateFromCalendar = (info) => {
|
const setSelectedDateFromCalendar = (info) => {
|
||||||
@@ -82,68 +81,37 @@ export const useCalendarStore = defineStore('calendar', () => {
|
|||||||
const response = await axiosApiInstance.get('api/calendar_of_events/my_calendars/');
|
const response = await axiosApiInstance.get('api/calendar_of_events/my_calendars/');
|
||||||
calendars.value = response.data.map((calendar) => ({
|
calendars.value = response.data.map((calendar) => ({
|
||||||
...calendar,
|
...calendar,
|
||||||
// visible: accountStore.calendar.includes(calendar.id),
|
// visible: true,
|
||||||
visible: !hiddenCalendarIds.value.includes(calendar.id),
|
|
||||||
}));
|
}));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Ошибка загрузки календарей:', error);
|
console.error('Ошибка загрузки календарей:', error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const toggleCalendarVisibility = async (calendarId, isVisible) => {
|
const toggleCalendarVisibility = (calendarId) => {
|
||||||
// Обновляем массив скрытых календарей
|
const index = hiddenCalendarIds.value.indexOf(calendarId);
|
||||||
if (isVisible) {
|
if (index === -1) {
|
||||||
// Если календарь стал видимым, удаляем его ID из скрытых
|
// Если ID нет в массиве скрытых, добавляем его (значит, календарь скрывается)
|
||||||
hiddenCalendarIds.value = hiddenCalendarIds.value.filter((id) => id !== calendarId);
|
hiddenCalendarIds.value.push(calendarId);
|
||||||
} else {
|
} else {
|
||||||
// Если календарь скрыли, добавляем его ID в скрытые (если еще нет)
|
// Если ID есть в массиве, удаляем его (значит, календарь показывается)
|
||||||
if (!hiddenCalendarIds.value.includes(calendarId)) {
|
hiddenCalendarIds.value.splice(index, 1);
|
||||||
hiddenCalendarIds.value.push(calendarId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Также обновляем видимость в самом календаре для мгновенной реакции UI
|
|
||||||
const calendarToUpdate = calendars.value.find((cal) => cal.id === calendarId);
|
|
||||||
if (calendarToUpdate) {
|
|
||||||
calendarToUpdate.visible = isVisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Загружаем или скрываем события
|
|
||||||
if (isVisible) {
|
|
||||||
await loadEventsForCalendar(calendarId);
|
|
||||||
} else {
|
|
||||||
events.value = events.value.map((event) =>
|
|
||||||
event.calendar === calendarId ? { ...event, visible: false } : event,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Загрузка событий для конкретного календаря
|
const visibleCalendars = computed(() =>
|
||||||
const loadEventsForCalendar = async (calendarId) => {
|
calendars.value.filter((calendar) => !hiddenCalendarIds.value.includes(calendar.id)),
|
||||||
try {
|
);
|
||||||
isLoading.value = true;
|
|
||||||
const response = await axiosApiInstance.get(`api/calendar_of_events/my_events/`, {
|
|
||||||
params: {
|
|
||||||
id: calendarId,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
// Проверяем, что в ответе есть ключ 'events' и он является массивом
|
const allEvents = computed(() => {
|
||||||
if (response.data.events && Array.isArray(response.data.events)) {
|
return calendars.value
|
||||||
const newEvents = response.data.events.map((event) => ({
|
.filter((calendar) => !hiddenCalendarIds.value.includes(calendar.id))
|
||||||
...event,
|
.flatMap((calendar) => calendar.events)
|
||||||
visible: true,
|
.map((event) => ({
|
||||||
}));
|
...event,
|
||||||
// Удаляем старые события этого календаря (если они есть)
|
color: event.color || calendars.value.find((cal) => cal.id === event.calendar_id)?.cl_color,
|
||||||
events.value = events.value.filter((event) => event.calendar !== calendarId);
|
}));
|
||||||
// Добавляем новые события
|
});
|
||||||
events.value.push(...newEvents);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Ошибка загрузки событий:', error);
|
|
||||||
} finally {
|
|
||||||
isLoading.value = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Создание события
|
// Создание события
|
||||||
const createEvent = async (eventData) => {
|
const createEvent = async (eventData) => {
|
||||||
@@ -186,26 +154,6 @@ export const useCalendarStore = defineStore('calendar', () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Открытие диалога с предзаполненной датой
|
|
||||||
const openEventDialogWithDate = (date = null) => {
|
|
||||||
selectedEvent.value = date
|
|
||||||
? {
|
|
||||||
date_start: date,
|
|
||||||
date_end: date,
|
|
||||||
participant: [accountStore.user.is_idEmployee],
|
|
||||||
files: [],
|
|
||||||
calendar: null,
|
|
||||||
}
|
|
||||||
: null;
|
|
||||||
showEventDialog.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
const visibleCalendars = computed(() => calendars.value.filter((calendar) => calendar.visible));
|
|
||||||
|
|
||||||
const allEvents = computed(() => {
|
|
||||||
return calendars.value.flatMap((calendar) => calendar.events);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Открыть диалог создания/редактирования
|
// Открыть диалог создания/редактирования
|
||||||
const openEventDialog = (event = null) => {
|
const openEventDialog = (event = null) => {
|
||||||
selectedEvent.value = event;
|
selectedEvent.value = event;
|
||||||
@@ -236,7 +184,7 @@ export const useCalendarStore = defineStore('calendar', () => {
|
|||||||
subscribedCalendars,
|
subscribedCalendars,
|
||||||
eventsForSelectedDate,
|
eventsForSelectedDate,
|
||||||
visibleCalendars,
|
visibleCalendars,
|
||||||
visibleEvents,
|
allEvents,
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
setSelectedDate,
|
setSelectedDate,
|
||||||
@@ -247,11 +195,9 @@ export const useCalendarStore = defineStore('calendar', () => {
|
|||||||
updateEvent,
|
updateEvent,
|
||||||
deleteEvent,
|
deleteEvent,
|
||||||
openEventDialog,
|
openEventDialog,
|
||||||
openEventDialogWithDate,
|
|
||||||
closeEventDialog,
|
closeEventDialog,
|
||||||
setSelectedDateFromCalendar,
|
setSelectedDateFromCalendar,
|
||||||
setSelectedDateFromPicker,
|
setSelectedDateFromPicker,
|
||||||
loadEventsForCalendar,
|
|
||||||
toggleCalendarVisibility,
|
toggleCalendarVisibility,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@@ -7,9 +7,12 @@
|
|||||||
<Carousel-list />
|
<Carousel-list />
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
<v-row style="height: 250px">
|
<v-row class="fill-height">
|
||||||
<v-col class="d-flex flex-column flex-grow-0 pa-1">
|
<v-col cols="12" md="6" lg="6">
|
||||||
<!-- <event-calendar/> -->
|
<CustomCalendar :view="'dayGridMonth'" :forHomePage="true" class="mini-calendar" />
|
||||||
|
</v-col>
|
||||||
|
<v-col cols="12" md="6" lg="6">
|
||||||
|
<CustomCalendar :view="'timeGridDay'" :forHomePage="true" class="mini-calendar" />
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-col>
|
</v-col>
|
||||||
@@ -47,7 +50,12 @@
|
|||||||
<v-btn-toggle v-model="toggle" divided variant="outlined" color="teal-darken-4">
|
<v-btn-toggle v-model="toggle" divided variant="outlined" color="teal-darken-4">
|
||||||
<v-tooltip :text="x.pages__page" location="top">
|
<v-tooltip :text="x.pages__page" location="top">
|
||||||
<template v-slot:activator="{ props }">
|
<template v-slot:activator="{ props }">
|
||||||
<v-btn v-bind="props" :icon="x.pages__ico" :to="x.pages__fullPath" color="teal-darken-4" />
|
<v-btn
|
||||||
|
v-bind="props"
|
||||||
|
:icon="x.pages__ico"
|
||||||
|
:to="x.pages__fullPath"
|
||||||
|
color="teal-darken-4"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</v-tooltip>
|
</v-tooltip>
|
||||||
</v-btn-toggle>
|
</v-btn-toggle>
|
||||||
@@ -74,6 +82,8 @@ import NewsHome from '@/components/news-home.vue';
|
|||||||
|
|
||||||
import DigitalLetna from '@/components/digital-letna.vue';
|
import DigitalLetna from '@/components/digital-letna.vue';
|
||||||
import { axiosApiInstance } from '@/utils/axios-api';
|
import { axiosApiInstance } from '@/utils/axios-api';
|
||||||
|
import CustomCalendar from '../components/calendar_of_events/UI_calendar/CustomCalendar.vue';
|
||||||
|
import { useCalendarStore } from '@/store/calendarStore';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -82,6 +92,8 @@ export default {
|
|||||||
DigitalLetna,
|
DigitalLetna,
|
||||||
|
|
||||||
NewsHome,
|
NewsHome,
|
||||||
|
|
||||||
|
CustomCalendar,
|
||||||
},
|
},
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
@@ -90,11 +102,17 @@ export default {
|
|||||||
const toggle = ref(null);
|
const toggle = ref(null);
|
||||||
|
|
||||||
const accountStore = useAccountStore();
|
const accountStore = useAccountStore();
|
||||||
|
const calendarStore = useCalendarStore();
|
||||||
|
|
||||||
pagecounter();
|
pagecounter();
|
||||||
|
|
||||||
|
const fetchMyCalendars = () => {
|
||||||
|
calendarStore.loadCalendars();
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
favoritLinks();
|
favoritLinks();
|
||||||
|
fetchMyCalendars();
|
||||||
});
|
});
|
||||||
|
|
||||||
const favoritLinks = () => {
|
const favoritLinks = () => {
|
||||||
@@ -108,14 +126,14 @@ export default {
|
|||||||
appStore,
|
appStore,
|
||||||
favoritLinks,
|
favoritLinks,
|
||||||
favorit,
|
favorit,
|
||||||
|
fetchMyCalendars,
|
||||||
toggle,
|
toggle,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
.v-picker-title,
|
.v-picker-title,
|
||||||
.v-picker__header,
|
.v-picker__header,
|
||||||
.v-picker__actions {
|
.v-picker__actions {
|
||||||
@@ -164,4 +182,41 @@ export default {
|
|||||||
color: #222 !important;
|
color: #222 !important;
|
||||||
font-family: 'Montserrat', 'Arial', sans-serif;
|
font-family: 'Montserrat', 'Arial', sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mini-calendar {
|
||||||
|
// max-width: 100%;
|
||||||
|
width: 100%;
|
||||||
|
font-size: 12px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mini-calendar :deep(.fc-day) {
|
||||||
|
height: 8px !important;
|
||||||
|
// width: 10px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mini-calendar :deep(.fc-event) {
|
||||||
|
font-size: 0.8em;
|
||||||
|
padding: 0 1px;
|
||||||
|
margin: 1px 0;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
height: 250px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mini-calendar :deep(.fc-daygrid-day-number) {
|
||||||
|
font-size: 1em;
|
||||||
|
padding: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mini-calendar :deep(.fc) {
|
||||||
|
width: 100% !important;
|
||||||
|
max-height: 320px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mini-calendar :deep(.fc .fc-daygrid-week-number) {
|
||||||
|
background-color: transparent !important;
|
||||||
|
border: none !important;
|
||||||
|
color: transparent !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
Reference in new issue
Block a user