P-52 решен вопрос с праздниками

This commit is contained in:
iriska-gri committed 2024-05-27 13:08:22 +03:00
1 parent 96ceeb3252
commit 37599fc85a
7 files changed
+179 -74

No files matched your search

@@ -0,0 +1,152 @@
<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-btn></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>
<pre>
{{ week }}
</pre>
</v-locale-provider>
</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>
</v-row>
</template>
<script>
import { axiosApiInstance } from "@/utils/axios-api";
import { ref, onMounted } from "vue";
import { useWeekendsStore } from "@/store/WeekendsStore";
// const burl = baseURL.slice(0, -1);
export default {
setup() {
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();
});
}
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,
};
},
};
</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>
@@ -1,48 +1,6 @@
<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-btn></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
>
<v-btn @click="refpuk"> </v-btn>
</v-date-picker>
</v-locale-provider>
</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>
</v-row>
<!-- <div>
<div>
<v-btn @click="f_feedbackdata"> ical</v-btn>
<v-file-input
@@ -57,12 +15,12 @@
accept=".ics"
@input="handleFilesUpload"
/>
</div> -->
</div>
</template>
<script>
import { axiosApiInstance } from "@/utils/axios-api";
import { ref, computed, onMounted } from "vue";
import { ref, onMounted } from "vue";
import ical from "ical.js";
import { useWeekendsStore } from '@/store/WeekendsStore'
@@ -167,17 +125,5 @@ export default {
</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>
+2 -2
View File
@@ -134,9 +134,9 @@ const routes = [
path: "/ical",
name: "Calendar",
component: () =>
import("@/components/calendar_of_events/load-ical.vue"),
import("@/components/calendar_of_events/BigCalendar.vue"),
meta: {
title: "Для работы над календарем",
title: "Календарь",
ico: "mdi-account",
},
},
+2 -2
View File
@@ -4,8 +4,8 @@ import { ref } from 'vue'
export const useWeekendsStore = defineStore('weekends', () => {
const week = ref({ '2024': {'05': '09'} })
// const week = ref({ '2024': {'5': ["2024-05-08", "2024-05-11"], '6': ["2024-06-08", "2024-06-11"]} })
const week = ref({})
return { week }
},