191 lines
4.7 KiB
Vue
191 lines
4.7 KiB
Vue
<template>
|
|
<v-row no-gutters>
|
|
<v-col class="flex-grow-0 d-flex flex-column">
|
|
<v-card class="h-100 rounded-0 d-flex flex-colmn" width="250">
|
|
<v-row no-gutters class="flex-column">
|
|
<v-col class="flex-grow-0">
|
|
<v-text-field
|
|
density="compact"
|
|
clearable
|
|
append-inner-icon="mdi-magnify"
|
|
hide-details
|
|
class="py-3"
|
|
label="Найти событие"
|
|
rows="1"
|
|
no-resize
|
|
variant="outlined"
|
|
/>
|
|
</v-col>
|
|
<v-col class="flex-grow-0">
|
|
<v-btn
|
|
type="submit"
|
|
class="text-subtitle-1 font-weight-light"
|
|
color="btn_text"
|
|
block
|
|
elevation="1"
|
|
@click="showDialog = true"
|
|
>Создать событие</v-btn
|
|
>
|
|
</v-col>
|
|
<v-col class="w100" lg="3">
|
|
<v-locale-provider locale="ru">
|
|
<v-date-picker
|
|
ref="cal"
|
|
v-model="selectdate"
|
|
color="btn_text"
|
|
class="rounded-0 minCal"
|
|
max-width="250"
|
|
hide-header
|
|
show-adjacent-months
|
|
@click="CheckingStore"
|
|
@update:month="getMonth"
|
|
@update:year="getYear"
|
|
>
|
|
</v-date-picker>
|
|
</v-locale-provider>
|
|
</v-col>
|
|
<v-col>
|
|
<calendar-my />
|
|
</v-col>
|
|
<v-col></v-col>
|
|
</v-row>
|
|
<!-- <v-date-picker show-adjacent-months></v-date-picker> -->
|
|
</v-card></v-col
|
|
>
|
|
<v-col class="bg-green">
|
|
<v-btn @click="drawer_right = !drawer_right">
|
|
{{ drawer_right }}
|
|
</v-btn>
|
|
</v-col>
|
|
|
|
<v-navigation-drawer
|
|
v-model="drawer_right"
|
|
floating
|
|
permanent
|
|
location="right"
|
|
rail-width="400"
|
|
rail
|
|
>
|
|
</v-navigation-drawer>
|
|
{{ showDialog }}
|
|
<event-create
|
|
@update:opendialog="showDialog = $event"
|
|
:opendialog="showDialog"
|
|
/>
|
|
</v-row>
|
|
</template>
|
|
|
|
<script>
|
|
import { axiosApiInstance } from "@/utils/axios-api";
|
|
import { ref, onMounted } from "vue";
|
|
import { useWeekendsStore } from "@/store/WeekendsStore";
|
|
|
|
import EventCreate from "@/components/calendar_of_events/event-create.vue";
|
|
import CalendarMy from "@/components/calendar_of_events/calendar-my.vue";
|
|
// const burl = baseURL.slice(0, -1);
|
|
|
|
export default {
|
|
components: { EventCreate, CalendarMy },
|
|
|
|
setup() {
|
|
const showDialog = ref(false);
|
|
const week = useWeekendsStore().week;
|
|
const drawer_right = ref(false);
|
|
const cal = ref(null);
|
|
const selectdate = ref(new Date());
|
|
const MyYear = ref(selectdate.value.getFullYear());
|
|
const MyMonth = ref(selectdate.value.getMonth() + 1);
|
|
|
|
|
|
|
|
function getWeekend() {
|
|
axiosApiInstance
|
|
.post(`api/calendar_of_events/exclusionDatas/?year=${MyYear.value}`, {})
|
|
.then((data) => {
|
|
week[MyYear.value] = data.data;
|
|
weekendsData();
|
|
});
|
|
}
|
|
|
|
|
|
function getcalendar() {
|
|
|
|
}
|
|
|
|
const getMonth = (month) => {
|
|
MyMonth.value = month + 1;
|
|
};
|
|
const getYear = (year) => {
|
|
MyYear.value = year;
|
|
};
|
|
|
|
const weekendsData = () => {
|
|
cal.value.$el
|
|
.querySelectorAll(".v-date-picker-month__day")
|
|
.forEach((e) => {
|
|
let datas = e.getAttribute("data-v-date");
|
|
let weeks =
|
|
new Date(datas).getDay() === 6 || new Date(datas).getDay() === 0;
|
|
if (weeks) {
|
|
e.querySelectorAll("span").forEach((n) => {
|
|
n.classList.add("text-red");
|
|
});
|
|
}
|
|
|
|
if (MyMonth.value in week[MyYear.value]) {
|
|
if (week[MyYear.value][MyMonth.value].includes(datas)) {
|
|
e.querySelectorAll("span").forEach((n) => {
|
|
n.classList.add("text-red");
|
|
if (n.classList.contains("text-red") && weeks) {
|
|
n.classList.replace("text-red", "text-black");
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|
|
};
|
|
|
|
const CheckingStore = () => {
|
|
if (MyYear.value in week) {
|
|
weekendsData();
|
|
} else {
|
|
getWeekend();
|
|
}
|
|
};
|
|
|
|
onMounted(() => {
|
|
CheckingStore();
|
|
});
|
|
|
|
return {
|
|
drawer_right,
|
|
selectdate,
|
|
cal,
|
|
getMonth,
|
|
getYear,
|
|
weekendsData,
|
|
week,
|
|
CheckingStore,
|
|
showDialog,
|
|
|
|
};
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style>
|
|
.minCal .v-date-picker-month__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;
|
|
}
|
|
</style>
|