This commit is contained in:
iriska-gri committed 2024-06-06 14:53:16 +03:00
1 parent 043575f962
commit 0b6fe459e5
3 files changed
+118 -49

No files matched your search

@@ -44,7 +44,11 @@
</v-date-picker> </v-date-picker>
</v-locale-provider> </v-locale-provider>
</v-col> </v-col>
<v-col class="flex-column d-flex">
<v-row no-gutters class="h-0 overflow-auto flex-column flex-nowrap">
<v-col> <v-col>
<calendar-my <calendar-my
:calendars=" :calendars="
calendarForMy.filter( calendarForMy.filter(
@@ -53,7 +57,9 @@
" "
title="Мои календари" title="Мои календари"
/> />
<calendar-my <calendar-my
:calendars=" :calendars="
calendarForMy.filter( calendarForMy.filter(
(e) => e.author != accountStore.user.is_idEmployee (e) => e.author != accountStore.user.is_idEmployee
@@ -61,8 +67,12 @@
" "
title="Подписки" title="Подписки"
/> />
</v-col> </v-col>
<v-col></v-col> </v-row>
</v-col>
</v-row> </v-row>
</v-card> </v-card>
</v-col> </v-col>
@@ -97,7 +107,6 @@ import CalendarMy from "@/components/calendar_of_events/calendar-my.vue";
import { axiosApiInstance } from "@/utils/axios-api"; import { axiosApiInstance } from "@/utils/axios-api";
import { useAccountStore } from "@/store/AccountStore"; import { useAccountStore } from "@/store/AccountStore";
export default { export default {
components: { EventCreate, CalendarMy }, components: { EventCreate, CalendarMy },
@@ -119,16 +128,16 @@ export default {
MyYear.value = year; MyYear.value = year;
}; };
console.log(accountStore, 'store')
axiosApiInstance axiosApiInstance
.get("api/calendar_of_events/get_calendars/") .get("api/calendar_of_events/get_calendars/")
.then((res) => { .then((res) => {
console.log(accountStore.calendar,"lo\d"); res.data.forEach(
res.data.forEach(e => e.visible = accountStore.calendar.includes(e.id)?false: true) (e) =>
(e.visible = accountStore.calendar.includes(e.id) ? false : true
)
);
calendarForMy.value = res.data; calendarForMy.value = res.data;
console.log(calendarForMy.value, 'calendarForMy.valuecalendarForMy.valuecalendarForMy.value');
console.log(calendarForMy.value, 'calendarForMy.valuecalendarForMy.value');
}); });
const weekendsData = () => { const weekendsData = () => {
@@ -182,25 +182,23 @@ export default {
// confirmation() // confirmation()
// СМЫСЛ ДЕЛАТЬ РЕАКТИВНОСТЬ? const color = [
const color = ref([ "red",
"#F44336", "pink",
"#E91E63", "deep-orange",
"#FF5722", "amber",
"#FFC107", "yellow",
"#FFEB3B", "lime",
"#CDDC39", "light-green",
"#8BC34A", "green",
"#4CAF50", "light-blue",
"#00BCD4", "blue",
"#03A9F4", "indigo",
"#2196F3", "deep-purple",
"#3F51B5", "purple",
"#673AB7", "blue-grey",
"#9C27B0", "brown",
"#607D8B", ];
"#795548",
]);
const colorPik = (col) => { const colorPik = (col) => {
if (newcalendar.value.cl_color === col) { if (newcalendar.value.cl_color === col) {
@@ -1,11 +1,9 @@
<template> <template>
<v-list density="compact" class="calen"> <v-expansion-panels class="calendar" variant="accordion" flat tile static v-model="openGroup">
<v-list-group value="Admin"> <v-expansion-panel elevation="0" flat tile static>
<template v-slot:activator="{ props }"> <v-expansion-panel-title flat tile static class="py-0 px-3">
<v-list-item v-bind="props">
<template v-slot:prepend>
<div @click.stop=""> <div @click.stop="">
<span> {{ title }} </span> <span class="text-subtitle-2"> {{ title }} </span>
</div> </div>
<v-btn <v-btn
@@ -13,42 +11,64 @@
size="x-small" size="x-small"
icon="mdi-plus" icon="mdi-plus"
variant="text" variant="text"
class="pa-0"
@click.stop="editCreatedCalendar()" @click.stop="editCreatedCalendar()"
></v-btn> ></v-btn>
</template> </v-expansion-panel-title>
</v-list-item> <v-expansion-panel-text flat tile static class="">
</template>
<v-list-item <v-list-item
:key="i" :key="i"
v-for="(x, i) in calendars" v-for="(x, i) in calendars"
:title="x.cl_name"
:value="x.cl_name" :value="x.cl_name"
@click.stop="" @mouseenter="hover=i"
@mouseleave="hover=null"
:class="{'trasitlist': hover===i,
}"
class="pa-0 cursor-default"
> >
<template v-slot:prepend> <template v-slot:prepend>
<v-checkbox-btn <v-checkbox-btn
class="text-caption"
:class="`text-${x.cl_color}`"
v-model="x.visible" v-model="x.visible"
:color="x.cl_color"
@update:modelValue="chekUpdate(x)" @update:modelValue="chekUpdate(x)"
></v-checkbox-btn> ></v-checkbox-btn>
</template> </template>
<template v-slot:title>
<span class="text-body-2"> {{ x.cl_name }} </span>
</template>
<template v-slot:append> <template v-slot:append>
<!-- <my-helper :pretext = x /> -->
<transition name="fade">
<v-btn <v-btn
v-if="
(x.author == accountStore.user.is_idEmployee) ||
(x.participant.some(
(e) =>
e.editor == true &&
e.participant_calendar == accountStore.user.is_idEmployee
))
"
size="x-small" size="x-small"
icon="mdi-pen" icon="mdi-pen"
variant="text" variant="text"
class="transitbtn"
@click.stop="editCreatedCalendar(x)" @click.stop="editCreatedCalendar(x)"
></v-btn> ></v-btn>
</transition>
</template> </template>
</v-list-item> </v-list-item>
</v-list-group> </v-expansion-panel-text>
</v-expansion-panel>
<calendar-create <calendar-create
@update:opendialog="showDialog = $event" @update:opendialog="showDialog = $event"
:opendialog="showDialog" :opendialog="showDialog"
:calendar="calendar" :calendar="calendar"
/> />
</v-list> </v-expansion-panels>
</template> </template>
<script> <script>
@@ -74,6 +94,9 @@ export default {
const showDialog = ref(false); const showDialog = ref(false);
const accountStore = useAccountStore(); const accountStore = useAccountStore();
const calendar = ref({}); const calendar = ref({});
const openGroup = ref([0]);
const trans = ref(false);
const hover = ref(0)
const editCreatedCalendar = (cal) => { const editCreatedCalendar = (cal) => {
calendar.value = cal; calendar.value = cal;
@@ -81,14 +104,13 @@ export default {
}; };
const chekUpdate = (cal) => { const chekUpdate = (cal) => {
// console.log(cal.visible); let setcal = new Set(accountStore.calendar);
let setcal = new Set(accountStore.calendar)
if (cal.visible == false) { if (cal.visible == false) {
setcal.add(cal.id); setcal.add(cal.id);
} else { } else {
setcal.delete(cal.id); setcal.delete(cal.id);
} }
accountStore.calendar= Array.from(setcal) accountStore.calendar = Array.from(setcal);
}; };
return { return {
@@ -96,18 +118,58 @@ export default {
calendar, calendar,
editCreatedCalendar, editCreatedCalendar,
chekUpdate, chekUpdate,
accountStore,
openGroup,
trans,
hover
}; };
}, },
}; };
</script> </script>
<style> <style>
.calen .v-list-group--prepend { .fade-enter-active,
--parent-padding: 0px; .fade-leave-active {
font-size: 14px; transition: opacity 0.1s;
}
.fade-enter,
.fade-leave-to {
transition: opacity 0.2s;
opacity: 0;
} }
.calen .v-list-item-title { .calendar .v-expansion-panel-text__wrapper {
font-size: 14px; padding: 0!important;
padding-right: 10px!important;
} }
.trasitlist:hover .transitbtn {
animation-fill-mode: forwards;
/* transition: opacity 0.1s; */
animation-duration: 0.5s;
animation-name: filli;
}
@keyframes filli {
from {
margin-left: 100%;
opacity: 0;
}
to {
margin-left: 0%;
opacity: 1;
}
}
.transitbtn {
opacity: 0;
/* animation-direction: reverse; */
/* animation-duration: 0.1s;
animation-name: filli; */
}
</style> </style>