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

@@ -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>