140 lines
3.3 KiB
Vue
140 lines
3.3 KiB
Vue
<template>
|
|
<v-row no-gutters>
|
|
<v-col class="flex-grow-0 d-flex flex-column">
|
|
<mini-calendar />
|
|
</v-col>
|
|
<v-col class="d-flex flex-column">
|
|
<custom-calendar />
|
|
</v-col>
|
|
<!--
|
|
<v-navigation-drawer
|
|
floating
|
|
permanent
|
|
location="right"
|
|
rail-width="400"
|
|
rail
|
|
>
|
|
</v-navigation-drawer> -->
|
|
<v-dialog v-model="showDialog" max-width="700">
|
|
<event-create
|
|
@closeDialog="showDialog = false"
|
|
:eventCalendar="eventFromCalendar"
|
|
@getCalendar="getCalendar"
|
|
@update:eventCalendar="eventFromCalendar = $event"
|
|
ref="createEvents"
|
|
/>
|
|
</v-dialog>
|
|
</v-row>
|
|
</template>
|
|
|
|
<script>
|
|
import { ref, onMounted } from 'vue';
|
|
import { useWeekendsStore } from '@/store/WeekendsStore';
|
|
import EventCreate from '@/components/calendar_of_events/event-create.vue';
|
|
// import { useAccountStore } from '@/store/AccountStore';
|
|
import CustomCalendar from '@/components/calendar_of_events/UI_calendar/CustomCalendar.vue';
|
|
import { useCalendarStore } from '@/store/calendarStore';
|
|
import { storeToRefs } from 'pinia';
|
|
import MiniCalendar from '@/components/calendar_of_events/UI_calendar/MiniCalendar.vue';
|
|
|
|
export default {
|
|
components: { EventCreate, MiniCalendar, CustomCalendar },
|
|
setup() {
|
|
// const accountStore = useAccountStore();
|
|
const showDialog = ref(false);
|
|
const week = useWeekendsStore();
|
|
const selectdate = ref(new Date());
|
|
const MyYear = ref(selectdate.value.getFullYear());
|
|
const MyMonth = ref(selectdate.value.getMonth() + 1);
|
|
const calendarForMy = ref([]);
|
|
const eventFromCalendar = ref({});
|
|
const createEvents = ref(null);
|
|
|
|
const calendarStore = useCalendarStore();
|
|
|
|
const { selectedDate } = storeToRefs(calendarStore); // синхронизируем с date-picker
|
|
|
|
const handleSaveEvent = (eventData) => {
|
|
if (eventData.id) {
|
|
calendarStore.updatedEvent(eventData);
|
|
} else {
|
|
calendarStore.addEvent(eventData);
|
|
}
|
|
};
|
|
|
|
const getMonth = (month) => {
|
|
MyMonth.value = month + 1;
|
|
};
|
|
const getYear = (year) => {
|
|
MyYear.value = year;
|
|
};
|
|
|
|
const getCalendar = () => {
|
|
|
|
calendarStore.loadCalendars();
|
|
};
|
|
|
|
getCalendar();
|
|
|
|
|
|
onMounted(() => {
|
|
week.getWeekend(MyYear.value);
|
|
});
|
|
|
|
|
|
const CheckingStore = () => {
|
|
if (MyYear.value in week.week) {
|
|
weekendsData();
|
|
} else {
|
|
week.getWeekend(MyYear.value);
|
|
}
|
|
};
|
|
|
|
return {
|
|
selectedDate,
|
|
getMonth,
|
|
getYear,
|
|
week,
|
|
CheckingStore,
|
|
showDialog,
|
|
calendarForMy,
|
|
// accountStore,
|
|
getCalendar,
|
|
eventFromCalendar,
|
|
createEvents,
|
|
calendarStore,
|
|
handleSaveEvent,
|
|
};
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style scoped>
|
|
.minCal:deep(.v-date-picker-month__days) {
|
|
/* display: grid !important;
|
|
grid-template-columns: repeat(7, 32px) !important;
|
|
gap: 3px !important;
|
|
width: 250px !important;
|
|
justify-content: center !important;
|
|
margin: 0 auto !important; */
|
|
}
|
|
|
|
.minCal .v-date-picker-monWth__day {
|
|
height: 31px;
|
|
width: 31px;
|
|
}
|
|
|
|
.minCal .v-btn--icon.v-btn--density-default {
|
|
width: calc(var(--v-btn-height) + 12px);
|
|
height: calc(var(--v-btn-height) + 6px);
|
|
}
|
|
|
|
.minCal .v-btn__content {
|
|
font-weight: 410;
|
|
}
|
|
|
|
.minCal:deep(.v-date-picker-years__content) {
|
|
gap: 0;
|
|
}
|
|
</style>
|