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

No files matched your search

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