P-54
Добавить даты в сторе
This commit is contained in:
1 parent
df9a32223c
commit
76dd9c80b8
8 files changed
+275
-171
No files matched your search
@@ -50,11 +50,11 @@ class GetVacancies(ListAPIView):
|
|||||||
|
|
||||||
class PostResponseVacancies(ListAPIView):
|
class PostResponseVacancies(ListAPIView):
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
|
||||||
a = ResponseVacancy.objects.create(**json.loads(request.data['data']), file = request.data['file'] if 'file' in request.data else None)
|
a = ResponseVacancy.objects.create(**json.loads(request.data['data']), file = request.data['file'] if 'file' in request.data else None)
|
||||||
|
okib = DictDepartment.objects.get(id=22)
|
||||||
data = {'sendto':[a.vacancy.department.id_chief.lotus], 'subject': f'Отклик на вакансию {a.vacancy.name} от {a.fio}', 'body_text':f'Почта:{a.email} ----- Телефон: {a.tel} ---- Сопроводительное письмо: {a.text}'}
|
data = {'sendto':[a.vacancy.department.id_chief.lotus, okib.id_chief.lotus], 'subject': f'Отклик на вакансию {a.vacancy.name} от {a.fio}', 'body_text':f'Почта:{a.email} ----- Телефон: {a.tel} ---- Сопроводительное письмо: {a.text}'}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
requests.post('http://10.252.44.13:8005/', data = data, files = [request.data['file']] if 'file' in request.data else [], timeout=2)
|
requests.post('http://10.252.44.13:8005/', data = data, files = [request.data['file']] if 'file' in request.data else [], timeout=2)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.utils.safestring import mark_safe
|
|
||||||
|
|
||||||
from .models import *
|
from .models import *
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
|
|
||||||
|
class ExclusionDatesAdmin(admin.ModelAdmin):
|
||||||
|
list_display=('exclusiondate',)
|
||||||
|
|
||||||
|
admin.site.register(ExclusionDates, ExclusionDatesAdmin)
|
||||||
@@ -2,7 +2,7 @@ from django.db import models
|
|||||||
from accounts.models import *
|
from accounts.models import *
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from enum import Enum
|
# from enum import Enum
|
||||||
from ckeditor_uploader.fields import RichTextUploadingField
|
from ckeditor_uploader.fields import RichTextUploadingField
|
||||||
|
|
||||||
class CalendarEventsName(models.Model):
|
class CalendarEventsName(models.Model):
|
||||||
@@ -10,18 +10,18 @@ class CalendarEventsName(models.Model):
|
|||||||
name=models.CharField(max_length=300, verbose_name='Название Календаря')
|
name=models.CharField(max_length=300, verbose_name='Название Календаря')
|
||||||
author = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Автор Календаря')
|
author = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Автор Календаря')
|
||||||
|
|
||||||
class EnumChoice(Enum):
|
# class EnumChoice(Enum):
|
||||||
@classmethod
|
# @classmethod
|
||||||
def get_choices(cls):
|
# def get_choices(cls):
|
||||||
return [(enum_.name, enum_.value) for enum_ in cls]
|
# return [(enum_.name, enum_.value) for enum_ in cls]
|
||||||
|
|
||||||
class FrequencyEvents(EnumChoice):
|
# class FrequencyEvents(EnumChoice):
|
||||||
default = "Без периода"
|
# default = "Без периода"
|
||||||
daily = "Ежедневно"
|
# daily = "Ежедневно"
|
||||||
weekly = "Еженедельно"
|
# weekly = "Еженедельно"
|
||||||
monthly = "Ежемесячно"
|
# monthly = "Ежемесячно"
|
||||||
annually = "Ежегодно"
|
# annually = "Ежегодно"
|
||||||
twice_a_year = "Два раза в год"
|
# twice_a_year = "Два раза в год"
|
||||||
|
|
||||||
class CalendarEvents(models.Model):
|
class CalendarEvents(models.Model):
|
||||||
""" Основные данные по событиям"""
|
""" Основные данные по событиям"""
|
||||||
@@ -54,3 +54,15 @@ class ParticipantsEvent(models.Model):
|
|||||||
""" Участники события """
|
""" Участники события """
|
||||||
participant = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Участник события')
|
participant = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Участник события')
|
||||||
event = models.ForeignKey(CalendarEvents, on_delete=models.PROTECT, related_name='get_calendar_events', verbose_name='Событие')
|
event = models.ForeignKey(CalendarEvents, on_delete=models.PROTECT, related_name='get_calendar_events', verbose_name='Событие')
|
||||||
|
|
||||||
|
class ExclusionDates(models.Model):
|
||||||
|
""" Таблица, которая содержит даты-исключения. То есть, все праздничные дни,
|
||||||
|
которые не попадают на выходные и все будни, которые праздничные """
|
||||||
|
exclusiondate = models.DateField(null=True, blank= True, verbose_name='Дата-исключение')
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name = "Дата-исключение"
|
||||||
|
verbose_name_plural = "Даты-исключение"
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return str(self.exclusiondate)
|
||||||
@@ -1,6 +1,48 @@
|
|||||||
<template>
|
<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>
|
||||||
|
|
||||||
<div>
|
<v-navigation-drawer
|
||||||
|
v-model="drawer_right"
|
||||||
|
floating
|
||||||
|
permanent
|
||||||
|
location="right"
|
||||||
|
rail-width="400"
|
||||||
|
rail
|
||||||
|
>
|
||||||
|
</v-navigation-drawer>
|
||||||
|
</v-row>
|
||||||
|
<!-- <div>
|
||||||
<v-btn @click="f_feedbackdata"> ical</v-btn>
|
<v-btn @click="f_feedbackdata"> ical</v-btn>
|
||||||
|
|
||||||
<v-file-input
|
<v-file-input
|
||||||
@@ -15,32 +57,55 @@
|
|||||||
accept=".ics"
|
accept=".ics"
|
||||||
@input="handleFilesUpload"
|
@input="handleFilesUpload"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div> -->
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { axiosApiInstance } from "@/utils/axios-api";
|
import { axiosApiInstance } from "@/utils/axios-api";
|
||||||
import { ref, computed } from "vue";
|
import { ref, computed, onMounted } from "vue";
|
||||||
|
|
||||||
import ical from "ical.js";
|
import ical from "ical.js";
|
||||||
|
import { useWeekendsStore } from '@/store/WeekendsStore'
|
||||||
|
|
||||||
// const burl = baseURL.slice(0, -1);
|
// const burl = baseURL.slice(0, -1);
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setup() {
|
setup() {
|
||||||
|
const week= useWeekendsStore()
|
||||||
|
const drawer_right = ref(false);
|
||||||
|
const cal = ref(null)
|
||||||
|
const participant = ref("");
|
||||||
|
const calendar = ref("");
|
||||||
|
const calendarEvents = ref([]);
|
||||||
|
const selectdate = ref(new Date())
|
||||||
|
const hol = ['2024-05-09', '2024-05-11']
|
||||||
|
|
||||||
const participant = ref("");
|
const addWeekend = () => {
|
||||||
const calendar = ref("");
|
console.log(week);
|
||||||
const calendarEvents = ref([]);
|
}
|
||||||
|
|
||||||
|
addWeekend()
|
||||||
|
onMounted(()=>{
|
||||||
|
|
||||||
|
cal.value.$el.querySelectorAll(".v-date-picker-month__day").forEach((e)=>{
|
||||||
|
if (hol.includes(e.getAttribute("data-v-date"))) {
|
||||||
|
e.querySelectorAll("span").forEach(n=>{n.classList.add("text-red")})
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
function f_feedbackdata() {
|
function f_feedbackdata() {
|
||||||
|
axiosApiInstance
|
||||||
axiosApiInstance
|
.post(`api/calendar_of_events/calendarEvents/`, {
|
||||||
.post(`api/calendar_of_events/calendarEvents/`, {
|
participants: participant.value,
|
||||||
participants: participant.value,
|
calendar: calendar.value,
|
||||||
calendar: calendar.value }).then((data) => {
|
|
||||||
console.log(data, "datas");
|
|
||||||
})
|
})
|
||||||
|
.then((data) => {
|
||||||
|
console.log(data, "datas");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleFilesUpload = (event) => {
|
const handleFilesUpload = (event) => {
|
||||||
@@ -54,11 +119,9 @@ function f_feedbackdata() {
|
|||||||
const readFile = (file) => {
|
const readFile = (file) => {
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.readAsText(file);
|
reader.readAsText(file);
|
||||||
reader.onload = (event) => {
|
reader.onload = (event) => {
|
||||||
parseICS(event.target.result);
|
parseICS(event.target.result);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
const parseICS = (text) => {
|
const parseICS = (text) => {
|
||||||
const jcalData = ical.parse(text);
|
const jcalData = ical.parse(text);
|
||||||
@@ -73,7 +136,7 @@ function f_feedbackdata() {
|
|||||||
let attendees = [];
|
let attendees = [];
|
||||||
event.attendees.map((att) => {
|
event.attendees.map((att) => {
|
||||||
attendees.push(att.jCal[1].cn);
|
attendees.push(att.jCal[1].cn);
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
name: event.summary,
|
name: event.summary,
|
||||||
description: event.description,
|
description: event.description,
|
||||||
@@ -83,23 +146,38 @@ function f_feedbackdata() {
|
|||||||
place: event.location,
|
place: event.location,
|
||||||
// attendees: attendees, ? Такая же история 0 в базе нет
|
// attendees: attendees, ? Такая же история 0 в базе нет
|
||||||
cdate: new Date(event.component.jCal[1][6][3]),
|
cdate: new Date(event.component.jCal[1][6][3]),
|
||||||
content: ''
|
content: "",
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
participant.value = name;
|
participant.value = name;
|
||||||
calendar.value = calendarEvents;
|
calendar.value = calendarEvents;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
handleFilesUpload,
|
handleFilesUpload,
|
||||||
calendarEvents,
|
calendarEvents,
|
||||||
f_feedbackdata
|
f_feedbackdata,
|
||||||
|
drawer_right,
|
||||||
|
selectdate,
|
||||||
|
cal
|
||||||
};
|
};
|
||||||
|
},
|
||||||
}}
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style></style>
|
<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,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<v-btn @click="useICalReader"> ical</v-btn>
|
<v-btn @click="useICalReader"> ical</v-btn>
|
||||||
<my-helper :pretext="events" />
|
<!-- <my-helper :pretext="events" /> -->
|
||||||
<v-sheet
|
<v-sheet
|
||||||
class="d-flex"
|
class="d-flex"
|
||||||
height="54"
|
height="54"
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
<template v-slot:append>
|
<template v-slot:append>
|
||||||
<template v-if="accountStore.cod2user">
|
<template v-if="accountStore.cod2user">
|
||||||
<vcard-user :author="accountStore.user" />
|
<vcard-user :author="accountStore.user" />
|
||||||
<my-helper :pretext="accountStore.user"></my-helper>
|
|
||||||
<v-tooltip location="bottom">
|
<v-tooltip location="bottom">
|
||||||
<template v-slot:activator="{ props }">
|
<template v-slot:activator="{ props }">
|
||||||
<v-btn
|
<v-btn
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
<v-list-item
|
<v-list-item
|
||||||
v-if="
|
v-if="
|
||||||
(x.path == '/portal'
|
(x.path == '/portal'
|
||||||
? accountStore.user.is_staff
|
? accountStore.user.is_superuser
|
||||||
: true) && !('submenu' in x)
|
: true) && !('submenu' in x)
|
||||||
"
|
"
|
||||||
:key="x.key"
|
:key="x.key"
|
||||||
|
|||||||
+119
-126
@@ -1,180 +1,173 @@
|
|||||||
// Composables
|
// Composables
|
||||||
import { createRouter, createWebHistory } from 'vue-router'
|
import { createRouter, createWebHistory } from "vue-router";
|
||||||
// import { useAccountStore } from "@/store/AccountStore";
|
import { useAccountStore } from "@/store/AccountStore";
|
||||||
|
|
||||||
|
|
||||||
// const accountStore = useAccountStore()
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
path: '/',
|
path: "/",
|
||||||
component: () => import('@/layouts/default/DefaultPortal.vue'),
|
component: () => import("@/layouts/default/DefaultPortal.vue"),
|
||||||
meta:{
|
meta: {
|
||||||
title:"Вход"
|
title: "Вход",
|
||||||
},
|
},
|
||||||
|
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/',
|
path: "/",
|
||||||
name: 'HomePage',
|
name: "HomePage",
|
||||||
component: () => import('@/views/HomePage.vue'),
|
component: () => import("@/views/HomePage.vue"),
|
||||||
meta:{
|
meta: {
|
||||||
title:"Портал МИ ФНС России по ЦОД №2",
|
title: "Портал МИ ФНС России по ЦОД №2",
|
||||||
ico: "mdi-arrow-top-right"
|
ico: "mdi-arrow-top-right",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: '/okib',
|
path: "/okib",
|
||||||
name: 'OKiBPage',
|
name: "OKiBPage",
|
||||||
component: () => import('@/views/nested_view/o_OKiB.vue'),
|
component: () => import("@/views/nested_view/o_OKiB.vue"),
|
||||||
meta:{
|
meta: {
|
||||||
title:"Отдел кадров и безопасности",
|
title: "Отдел кадров и безопасности",
|
||||||
ico: "mdi-comment-account-outline"
|
ico: "mdi-comment-account-outline",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/providing',
|
path: "/providing",
|
||||||
name: 'ProvidingActivitiesPage',
|
name: "ProvidingActivitiesPage",
|
||||||
component: () => import('@/views/ProvidingActivitiesPage.vue'),
|
component: () => import("@/views/ProvidingActivitiesPage.vue"),
|
||||||
meta:{
|
meta: {
|
||||||
title:"Обеспечивающая деятельность",
|
title: "Обеспечивающая деятельность",
|
||||||
ico: "mdi-bulletin-board"
|
ico: "mdi-bulletin-board",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/faq',
|
path: "/faq",
|
||||||
name: 'FAQPage',
|
name: "FAQPage",
|
||||||
component: () => import('@/views/FAQPage.vue'),
|
component: () => import("@/views/FAQPage.vue"),
|
||||||
meta:{
|
meta: {
|
||||||
title:"Часто задаваемые вопросы",
|
title: "Часто задаваемые вопросы",
|
||||||
ico: "mdi-comment-question-outline"
|
ico: "mdi-comment-question-outline",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/feedback',
|
path: "/feedback",
|
||||||
name: 'FeedbackPage',
|
name: "FeedbackPage",
|
||||||
component: () => import('@/views/FeedbackPage.vue'),
|
component: () => import("@/views/FeedbackPage.vue"),
|
||||||
meta:{
|
meta: {
|
||||||
title:"Обратная связь",
|
title: "Обратная связь",
|
||||||
ico: "mdi-thumb-up-outline"
|
ico: "mdi-thumb-up-outline",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/labor',
|
path: "/labor",
|
||||||
name: 'LaborProtection',
|
name: "LaborProtection",
|
||||||
component: () => import('@/views/LaborProtection.vue'),
|
component: () => import("@/views/LaborProtection.vue"),
|
||||||
meta:{
|
meta: {
|
||||||
title:"Охрана труда",
|
title: "Охрана труда",
|
||||||
ico: "mdi-pharmacy"
|
ico: "mdi-pharmacy",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/securyty',
|
path: "/securyty",
|
||||||
name: 'SecurityPage',
|
name: "SecurityPage",
|
||||||
component: () => import('@/views/SecurityPage.vue'),
|
component: () => import("@/views/SecurityPage.vue"),
|
||||||
meta:{
|
meta: {
|
||||||
title:"Безопасность",
|
title: "Безопасность",
|
||||||
ico: "mdi-security"
|
ico: "mdi-security",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/safety/:chapter',
|
path: "/safety/:chapter",
|
||||||
component: () => import('@/views/safety/ChaptersSafety.vue'),
|
component: () => import("@/views/safety/ChaptersSafety.vue"),
|
||||||
meta: {
|
meta: {
|
||||||
title: "Разделы безопасности",
|
title: "Разделы безопасности",
|
||||||
ico: "mdi-fire-extinguisher",
|
ico: "mdi-fire-extinguisher",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/inspection',
|
path: "/inspection",
|
||||||
name: 'AboutInspectionPage',
|
name: "AboutInspectionPage",
|
||||||
component: () => import('@/views/AboutInspectionPage.vue'),
|
component: () => import("@/views/AboutInspectionPage.vue"),
|
||||||
meta:{
|
meta: {
|
||||||
title:"Об инспекции",
|
title: "Об инспекции",
|
||||||
ico: "mdi-city"
|
ico: "mdi-city",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/portal',
|
path: "/portal",
|
||||||
name: 'AboutPortalPage',
|
name: "AboutPortalPage",
|
||||||
component: () => import('@/views/AboutPortalPage.vue'),
|
component: () => import("@/views/AboutPortalPage.vue"),
|
||||||
meta:{
|
meta: {
|
||||||
title:"О портале",
|
title: "О портале",
|
||||||
ico: "mdi-information-variant",
|
ico: "mdi-information-variant",
|
||||||
requiresAuth: true
|
requiresAuth: true,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/news',
|
path: "/news",
|
||||||
name: 'AboutNewsPage',
|
name: "AboutNewsPage",
|
||||||
component: () => import('@/views/NewsPage.vue'),
|
component: () => import("@/views/NewsPage.vue"),
|
||||||
meta:{
|
meta: {
|
||||||
title:"Лента новостей",
|
title: "Лента новостей",
|
||||||
ico: "mdi-newspaper"
|
ico: "mdi-newspaper",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/newsfull',
|
path: "/newsfull",
|
||||||
name: 'FullNewsPage',
|
name: "FullNewsPage",
|
||||||
component: () => import('@/components/news-full.vue'),
|
component: () => import("@/components/news-full.vue"),
|
||||||
meta:{
|
meta: {
|
||||||
title:"Одна новость",
|
title: "Одна новость",
|
||||||
ico: "mdi-newspaper"
|
ico: "mdi-newspaper",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: '/fnshol',
|
path: "/fnshol",
|
||||||
name: 'FnsHol.vue',
|
name: "FnsHol.vue",
|
||||||
component: () => import('@/views/FnsHol.vue'),
|
component: () => import("@/views/FnsHol.vue"),
|
||||||
meta:{
|
meta: {
|
||||||
title:"К празднику",
|
title: "К празднику",
|
||||||
ico: "mdi-city"
|
ico: "mdi-city",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/ical',
|
path: "/ical",
|
||||||
name: 'Calendar',
|
name: "Calendar",
|
||||||
component: () => import('@/components/calendar_of_events/load-ical.vue'),
|
component: () =>
|
||||||
meta:{
|
import("@/components/calendar_of_events/load-ical.vue"),
|
||||||
title:"Для работы над календарем",
|
meta: {
|
||||||
ico: "mdi-account"
|
title: "Для работы над календарем",
|
||||||
}
|
ico: "mdi-account",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]
|
];
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(process.env.BASE_URL),
|
history: createWebHistory(process.env.BASE_URL),
|
||||||
routes,
|
routes,
|
||||||
})
|
});
|
||||||
|
|
||||||
// const accountStore = useAccountStore();
|
|
||||||
|
|
||||||
function isSuperuser() {
|
function isSuperuser() {
|
||||||
let a= false
|
const accountStore = useAccountStore();
|
||||||
if (a=== true) {
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
router.beforeEach((to,from, next)=>{
|
if (accountStore.user.is_superuser === false) {
|
||||||
console.log(to,from, '-----sdsd----------------------------------------------------f')
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
router.beforeEach((to, from, next) => {
|
||||||
if (to.meta.requiresAuth && isSuperuser()) {
|
if (to.meta.requiresAuth && isSuperuser()) {
|
||||||
document.title = to.meta.title;
|
document.title = to.meta.title;
|
||||||
next()
|
next("/");
|
||||||
}
|
} else {
|
||||||
else {
|
document.title = to.meta.title;
|
||||||
console.log('22222222222222');
|
next();
|
||||||
next()
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
})
|
export default router;
|
||||||
|
|
||||||
|
|
||||||
export default router
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Utilities
|
||||||
|
import { defineStore } from 'pinia'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
|
export const useWeekendsStore = defineStore('weekends', () => {
|
||||||
|
|
||||||
|
const week = ref({ '2024': {'05': '09'} })
|
||||||
|
|
||||||
|
|
||||||
|
return { week }
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
Reference in new issue
Block a user