Добавить даты в сторе
This commit is contained in:
iriska-gri committed 2024-05-24 15:45:43 +03:00
1 parent df9a32223c
commit 76dd9c80b8
8 files changed
+275 -171

No files matched your search

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