Merge pull request '38_calendar_back' (#92) from 38_calendar_back into develop

Reviewed-on: http://sulaco.nodered.ru:5223/COD2/PORTAL_COD2/pulls/92
Reviewed-by: lexxik753 <lexx@a.com>
Reviewed-by: aphilippov <philippov129@gmail.com>
Reviewed-by: Nukeap <kuroedovo@narod.ru>
This commit is contained in:
Nukeap committed 2024-04-17 07:19:08 +00:00
commit db7c263d35
24 files changed
+977 -922

No files matched your search

+2 -1
View File
@@ -1,3 +1,4 @@
from django.contrib import admin from django.contrib import admin
from .models import *
# Register your models here. # Register your models here.
+52 -1
View File
@@ -1,3 +1,54 @@
from django.db import models from django.db import models
from accounts.models import *
# Create your models here. # Create your models here.
from django.conf import settings
from enum import Enum
from ckeditor_uploader.fields import RichTextUploadingField
class FilesEvent(models.Model):
""" Прикрепленные файлы к событию"""
name = models.CharField(max_length=300, verbose_name='Название файла')
link = models.FileField(upload_to='documents/%Y/%m/%d')
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 FrequencyEvents(EnumChoice):
default = "Без периода"
daily = "Ежедневно"
weekly = "Еженедельно"
monthly = "Ежемесячно"
annually = "Ежегодно"
twice_a_year = "Два раза в год"
class CalendarEvents(models.Model):
""" Основные данные по событиям"""
name=models.CharField(max_length=300, verbose_name='Название события')
description = RichTextUploadingField(null=True, blank= True, verbose_name='Описание события')
cdate =models.DateTimeField(default=datetime.now, verbose_name='Дата создания')
enddate = models.DateTimeField(null=True, blank= True, default=datetime.now().replace(hour=23,minute=0,second=0,microsecond=0) + timedelta(days=7), verbose_name='Дата снятия с публикации')
frequency = models.CharField(verbose_name='Периодичность', null=True, blank= True, max_length=255, db_index=True, choices=FrequencyEvents.get_choices(), default=FrequencyEvents.get_choices()[0][1])
author = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Автор события')
docfile = models.ForeignKey(FilesEvent, on_delete=models.PROTECT, null=True, blank= True, related_name='get_files_events', verbose_name='Прикрепеленные файлы')
place = models.CharField(null=True, blank= True, max_length=500, verbose_name='Место проведения события')
calendarname = models.ForeignKey(CalendarEventsName, on_delete=models.PROTECT, related_name='get_calendar_events_name', verbose_name='Название для календаря')
class Meta:
verbose_name = "Календарь событий"
verbose_name_plural = "Календарь событий"
def __str__(self):
return str(self.name)
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='Событие')
@@ -0,0 +1,3 @@
from rest_framework import serializers
from .models import *
from userauth.serializers import *
+1 -1
View File
@@ -4,5 +4,5 @@ from rest_framework.routers import DefaultRouter
from .views import * from .views import *
urlpatterns = [ urlpatterns = [
path('calendarEvents/', CalendarEventsAPIView.as_view(), name='calendarEvents'),
] ]
+30
View File
@@ -1,3 +1,33 @@
from django.shortcuts import render from django.shortcuts import render
from .serializers import *
from .models import *
from rest_framework.views import APIView
from rest_framework.response import Response
class CalendarEventsAPIView(APIView):
def get(self, request):
return Response('ku')
def post(self, request):
namecalendar, created = CalendarEventsName.objects.update_or_create(name=request.data['participants'],
defaults = {'name':request.data['participants'], 'author_id': self.request.user.id})
# print(self.request.user.id, '111111111111111111111111111111111111111111111111')
for cal in request.data['calendar']:
CalendarEvents.objects.update_or_create(calendarname_id=namecalendar.pk,
name = cal['summary'],
author_id = self.request.user.id,
defaults = {'name': cal['summary'],
'description': cal['description'],
'cdate':cal['start'],
'enddate': cal['end'],
'author_id': self.request.user.id,
'place': cal['location'],
'calendarname_id': namecalendar.pk
})
# print(cal['summary'],'1---------------------------')
# print(cal['description'],'2---------------------------')
return Response('ru')
# Create your views here. # Create your views here.
+7
View File
@@ -101,3 +101,10 @@ class ScreensaverSerializer(serializers.ModelSerializer):
model = Screensaver model = Screensaver
fields = '__all__' fields = '__all__'
class BaseSenderSerializer(serializers.ModelSerializer):
""" Получить ссылку на картинку для дня рождения. Название 'День рождения'
автоматически добавляется в таблицу, если его до этого не было """
class Meta:
model = BaseSender
fields = ['img']
+28 -28
View File
@@ -140,7 +140,7 @@ class NewsCrossroadAPIView(ListAPIView):
} for y in CommentNews.objects.filter(news_id=request.data['news']))} } for y in CommentNews.objects.filter(news_id=request.data['news']))}
return Response(back) return Response(back)
class CarouselsAPIView(ListAPIView): class CarouselsAPIView(ListAPIView):
""" """
@@ -166,41 +166,41 @@ class CarouselsAPIView(ListAPIView):
result = CarouselsSerializer(queryset, many= True).data result = CarouselsSerializer(queryset, many= True).data
manbrd = DictEmployee.objects.filter(birthdate__month=date.today().month, birthdate__day__gte=date.today().day).order_by('birthdate__day') manbrd = DictEmployee.objects.filter(birthdate__month=date.today().month, birthdate__day__gte=date.today().day).order_by('birthdate__day')
dr_img = BaseSender.objects.update_or_create(name="День рождения", defaults={'name':"День рождения"})
mess = ''
if len(manbrd) > 0 : if len(manbrd) > 0 :
nowday= manbrd.filter(birthdate__day=date.today().day) nowday= manbrd.filter(birthdate__day=date.today().day)
brdimage = BirthdayImage.objects.order_by("?")[:len(nowday)+1] brdimage = BirthdayImage.objects.order_by("?")[:len(nowday)+1]
allbirthday = {
"title":'Дни рождения',
"text": "В этом месяце:\n"+"\n".join([f"{x.birthdate.strftime('%d')} - {x.fio}" for x in manbrd]),
"link": "/media/"+str(brdimage[0].img),
"published": 'true',
"sender": "/media/default/dr.png",
}
if len(nowday) > 0 : try:
allbirthday = {
"title":'Дни рождения',
"text": "В этом месяце:\n"+"\n".join([f"{x.birthdate.strftime('%d')} - {x.fio}" for x in manbrd]),
"link": "/media/"+str(brdimage[0].img),
"published": 'true',
"sender": BaseSenderSerializer(dr_img).data,
}
if len(nowday) > 0 :
brdtext = BirthdayText.objects.order_by("?")[:len(nowday)]
for k in nowday:
brdtext = BirthdayText.objects.order_by("?")[:len(nowday)] result.append({
"title":'Поздравляем:',
"text": f"{k.fio}!"+"\n"+ f"{brdtext[0].text}",
for k in nowday: "link": "/media/"+str(brdimage[0].img),
"published": 'true',
result.append({ "sender": BaseSenderSerializer(dr_img).data,
"title":'Поздравляем:', })
"text": f"{k.fio}!"+"\n"+ f"{brdtext[0].text}",
"link": "/media/"+str(brdimage[0].img),
"published": 'true',
"sender": "/media/default/dr.png",
})
result.append(allbirthday) result.append(allbirthday)
except:
mess = 'Добавьте открытку в панели администратора в Таблицу - "Открытки. Изображения". Либо текст поздравления в Таблицу - "Открытки. Тексты поздравлений"'
return Response({"result": result, "mess": mess})
return Response(result)
class ScreensaverAPIView(ListAPIView): class ScreensaverAPIView(ListAPIView):
"""Получаем ссылку на картинку для экрана перед входом на сайт. Выбирает все записи с месяца и дня меньше и равного текущему и окончание больше или равному текущему дню и месяцу. Год не учитывается. Выбирается одна рандомная запись""" """Получаем ссылку на картинку для экрана перед входом на сайт. Выбирает все записи с месяца и дня меньше и равного текущему и окончание больше или равному текущему дню и месяцу. Год не учитывается. Выбирается одна рандомная запись"""
+1
View File
@@ -65,5 +65,6 @@ urlpatterns = [
path('api/feedback/', include('feedback.urls')), path('api/feedback/', include('feedback.urls')),
path('api/general_vacation/', include('general_vacation.urls')), path('api/general_vacation/', include('general_vacation.urls')),
path('api/about_inspection/', include('about_inspection.urls')), path('api/about_inspection/', include('about_inspection.urls')),
path('api/calendar_of_events/', include('calendar_of_events.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
@@ -1,198 +0,0 @@
<template>
<full-calendar :options="calendarOptions" />
</template>
<script>
import {reactive, ref, onMounted} from 'vue'
import { axiosApiInstance } from '@/utils/axios-api'
export default {
name: 'calendar-full',
props: {
initial: {
type: String,
default: 'multiMonthYear'
}
},
setup(props) {
const calendarOptions = reactive({
plugins: [ dayGridPlugin, interactionPlugin, timeGridPlugin, listPlugin, multiMonthPlugin ],
initialView: props.initial,
dayMaxEventRows: 3
,
locale: 'ru',
buttonText: {
today: 'Сегодня',
month: 'Месяц',
week: 'Неделя',
day: 'День',
list: 'Список',
year: 'Год'
},
firstDay:'1',
events: [],
editable: true,
headerToolbar: {
left: 'prev',
center: 'title',
right: 'next'
}
,
aspectRatio: 1,
multiMonthMaxColumns: 2,
displayEventEnd: true,
height: '100%',
stickyHeaderDates: true,
dayMaxEventRows: 2,
moreLinkContent: function(arg) {
return arg.shortText + ' события'
},
views: {
multiMonthYear: {
moreLinkContent: function(arg) {
return arg.num
},
},
},
allDayText: 'Весь день',
noEventsContent: 'На сегодня событий нет',
selectable: true,
})
function f_generalvacation() {
axiosApiInstance.get('api/general_vacation/generalvacation/')
.then(data => {
for (let x in data.data) {
if (x=="План-график") {
data.data[x].map(e=>{
calendarOptions.events.push({ description: 'description for All Day Event', title: e.name, start: e.start_work_period, end: e.end_work_period})
}
)
}
}
})
}
onMounted(() => {
f_generalvacation()
})
// genvacation.value[0].planned_date
return { calendarOptions }
}
}
</script>
<style>
#fc-dom-1:first-letter {
text-transform: capitalize;
}
.fc-toolbar {
/* padding: 0px; */
background-color: #f8f8f8;
}
.fc-day-header {
font-weight: bold;
text-align: center;
}
.fc-day {
border: none;
}
.fc-time-grid-event {
background-color: #e6e6e6;
border: none;
color: #000;
}
.fc-event-title {
font-weight: bold;
}
.fc .fc-toolbar.fc-header-toolbar {
padding-bottom: 0.2em;
margin-bottom: 0px;
}
.fc .fc-popover {
top: 0px!important
;
left: 450px!important;
overflow: auto;
min-width: 500px;
height: 380px;
}
.fc-h-event .fc-event-title {
display: initial!important;
}
/* .fc .fc-daygrid-day-events {
margin-top: -7px;
} */
.fc {
/* background-color: #ffffff; */
background-color: var('bg-main_theme');
}
.fc-button {
padding: 1px!important;
border-radius: 1em!important;
line-height: 0!important;
background-color: transparent!important;
border-color: transparent!important;
}
.fc-icon {
color: #000;
display: flex;
}
.fc-button:focus, .fc-icon {
outline: none!important;
}
.fc-button,
.fc-buttonactive,
.fc-button:focus {
border:none!important;
}
.fc-header-toolbar {
background: white !important;
}
</style>
@@ -2,7 +2,11 @@
<v-card max-width='400' density="compact" class="bg-transparent"> <v-card max-width='400' density="compact" class="bg-transparent">
<v-card-text class="pb-0">Оставлено комментариев</v-card-text> <v-card-text class="pb-0">Оставлено комментариев</v-card-text>
<v-card-subtitle>Последний комментарий оставлен {{formaComaTime(comment.time_create)}}</v-card-subtitle> <v-card-subtitle>Последний комментарий оставлен {{formaComaTime(comment.time_create)}}</v-card-subtitle>
<v-card-title>{{comment.comment}}</v-card-title>
<v-card-text class="text-caption">
{{comment.comment}}
</v-card-text>
<!-- <v-card-title class="text-wrap"></v-card-title> -->
</v-card> </v-card>
</template> </template>
@@ -1,287 +1,281 @@
<template> <template>
<pattern-card <pattern-card
:title="'Рейтинг посещаемости страниц портала'" :title="'Рейтинг посещаемости страниц портала'"
:ico="'mdi-chart-bar'" :ico="'mdi-chart-bar'"
>
<template v-slot:filling>
<v-data-table-virtual
:headers="headers"
:items="tabledata"
height="400"
class="mytable"
item-value="name"
@update:sortBy=customSort
v-model:sort-by="sortBy"
density="compact"
> >
<template v-slot:header.name> <template v-slot:filling>
<!-- v-model:sort-by="sortBy" --> <v-data-table-virtual
<v-switch :headers="headers"
:label="untot" :items="tabledata"
false-value='уникальные' height="400"
true-value='всего' class="mytable"
hide-details item-value="name"
v-model="untot" @update:sortBy="customSort"
class="myleft ml-n4" v-model:sort-by="sortBy"
density="compact"
/> >
<template v-slot:header.name>
</template> <v-switch
<template v-slot:item.name="{ value }"> :label="untot"
<span class="font-weight-medium text-grey-darken-3 myleft text-subtitle-2"> false-value="уникальные"
{{ value }} true-value="всего"
</span> hide-details
</template> v-model="untot"
<template v-slot:item.now="{ value, item }"> class="myleft ml-n4"
<span class="font-weight-medium text-subtitle-2 "> />
<v-tooltip
v-if="value>0"
location="bottom"
>
<template v-slot:activator="{ props }">
<span v-bind="props" :class="'untot'=='уникальные'?getColorTooday1(value):getColorTooday2(value) " class="cursor-help font-weight-medium text-subtitle-1 " >
{{value}}
</span>
</template>
<v-row
no-gutters
>
<v-col>
<v-row
no-gutters v-for="n in item.now.unic"
:key="n"
>
<v-col >
{{n}}
</v-col>
</v-row>
</v-col>
</v-row>
</v-tooltip>
</span>
</template>
<template v-slot:item.period="{ value, item }">
<span class="font-weight-medium text-subtitle-2">
<v-tooltip
v-if="value>0"
location="bottom"
>
<template v-slot:activator="{ props }">
<span v-bind="props" :class="'untot'=='уникальные'?getColorPeriod1(value):getColorPeriod2(value)" class="cursor-help font-weight-medium text-subtitle-1" >
{{value}}
<!-- {{modelrating?val.now.unique.length:val.now.countall}} -->
</span>
</template>
<v-row
no-gutters
>
<v-col>
<v-row
no-gutters v-for="n in item.period.unic"
:key="n"
>
<v-col>
{{n}}
</v-col>
</v-row>
</v-col>
</v-row>
</v-tooltip>
</span>
</template>
</v-data-table-virtual>
</template> </template>
</pattern-card> <template v-slot:item.name="{ value }">
<span class="font-weight-medium cursor-default text-grey-darken-3 myleft text-subtitle-2"
>
{{ value }}
</span>
</template>
<template v-slot:item.now="{ value, item }">
<span class="font-weight-medium text-subtitle-2">
<v-tooltip v-if="value > 0" location="bottom">
<template v-slot:activator="{ props }">
<span
v-bind="props"
:class="
'untot' == 'уникальные'
? getColorTooday1(value)
: getColorTooday2(value)
"
class="cursor-help font-weight-medium text-subtitle-1"
>
{{ value }}
</span>
</template>
<v-row no-gutters>
<v-col>
<v-row no-gutters v-for="n in item.now.unic" :key="n">
<v-col>
{{ n }}
</v-col>
</v-row>
</v-col>
</v-row>
</v-tooltip>
</span>
</template>
<template v-slot:item.period="{ value, item }">
<span class="font-weight-medium text-subtitle-2">
<v-tooltip v-if="value > 0" location="bottom">
<template v-slot:activator="{ props }">
<span
v-bind="props"
:class="
'untot' == 'уникальные'
? getColorPeriod1(value)
: getColorPeriod2(value)
"
class="cursor-help font-weight-medium text-subtitle-1"
>
{{ value }}
</span>
</template>
<v-row no-gutters>
<v-col>
<v-row no-gutters v-for="n in item.period.unic" :key="n">
<v-col>
{{ n }}
</v-col>
</v-row>
</v-col>
</v-row>
</v-tooltip>
</span>
</template>
</v-data-table-virtual>
</template>
</pattern-card>
</template> </template>
<script> <script>
import { ref, watch } from 'vue' import { ref, watch } from "vue";
import PatternCard from '@/components/UI/aboutportal/pattern-card.vue' import PatternCard from "@/components/UI/aboutportal/pattern-card.vue";
import TooltipText from '@/components/UI/tooltip-text.vue' import TooltipText from "@/components/UI/tooltip-text.vue";
import {splitname, formatDash} from '@/utils/universal_functions' import { splitname, formatDash } from "@/utils/universal_functions";
export default { export default {
components: { TooltipText, PatternCard },
components: { TooltipText, PatternCard }, props: {
pages_count: {
props: { type: Array,
pages_count: { default: () => [],
type: Array,
default: () => [],
}
}, },
},
setup(props) { setup(props) {
const sortBy = ref([
const sortBy = ref([ {
{ key: "now",
"key": "now", order: "desc",
"order": "desc" },
} ]);
])
const untot=ref('уникальные') const untot = ref("уникальные");
let headers = ref([ let headers = ref([
{ title: '', align: 'start', key: 'name' }, { title: "", align: "start", key: "name" },
{ title: 'сегодня', align: 'center', key: 'now', {
value: item => `${untot.value=='уникальные'?item.now.unic.size:item.now.total}`, title: "сегодня",
}, align: "center",
{ title: 'за период', align: 'center', key: 'period', key: "now",
value: item => `${untot.value=='уникальные'?item.period.unic.size:item.period.total}` }, value: (item) =>
]) `${
untot.value == "уникальные" ? item.now.unic.size : item.now.total
}`,
},
{
title: "за период",
align: "center",
key: "period",
value: (item) =>
`${
untot.value == "уникальные"
? item.period.unic.size
: item.period.total
}`,
},
]);
const datas = ()=>{ const datas = () => {
let data = [];
let data = [] props.pages_count.forEach((e) => {
props.pages_count.forEach((e) => { let ind = data.findIndex((el) => el.name == e.pages);
if (ind == -1) {
let ind = data.findIndex(el=>el.name==e.pages) let ob = {
if(ind==-1){ name: e.pages,
let ob = {name:e.pages, now:{unic:new Set(),total:0}, period:{unic:new Set(),total:0}} now: { unic: new Set(), total: 0 },
if (e.visitdate == formatDash(new Date())){ period: { unic: new Set(), total: 0 },
ob.now.unic.add(splitname(e.user)) };
ob.now.total = e.count if (e.visitdate == formatDash(new Date())) {
ob.now.unic.add(splitname(e.user));
} ob.now.total = e.count;
ob.period.unic.add(splitname(e.user)) }
ob.period.total = e.count ob.period.unic.add(splitname(e.user));
data.push(ob) ob.period.total = e.count;
} data.push(ob);
else{ } else {
if (e.visitdate == formatDash(new Date())){ if (e.visitdate == formatDash(new Date())) {
data[ind].now.unic.add(splitname(e.user)) data[ind].now.unic.add(splitname(e.user));
data[ind].now.total +=e.count data[ind].now.total += e.count;
} }
data[ind].period.unic.add(splitname(e.user))
data[ind].period.total +=e.count
}
})
return data
}
const modelrating = ref(false)
const getColorTooday1 = (pages) => {
if (pages > 10) return 'text-green'
else if (pages > 5) return 'text-orange'
else return 'text-red'
}
const getColorPeriod1 = (pages) => {
if (pages > 30) return 'text-green'
else if (pages > 15) return 'text-orange'
else return 'text-red'
}
const getColorTooday2 = (pages) => {
if (pages > 50) return 'text-green'
else if (pages > 25) return 'text-orange'
else return 'text-red'
}
const getColorPeriod2 = (pages) => {
if (pages > 100) return 'text-green'
else if (pages > 50) return 'text-orange'
else return 'text-red'
}
const getColorNow = (pages) => {
if (pages > 10) return 'text-green'
else if (pages > 5) return 'text-orange'
else return 'text-red'
}
const customSort= ()=> {
let arr=tabledata.value
if (sortBy.value!==undefined && sortBy.value.length>0){
let factor=sortBy.value[0].order=='desc'?[-1,1]:[1,-1]
if (untot.value=='уникальные'){
arr.sort((a,b)=>{
if (a[sortBy.value[0].key].unic.size>b[sortBy.value[0].key].unic.size) return factor[0]
if (a[sortBy.value[0].key].unic.size<b[sortBy.value[0].key].unic.size) return factor[1]
return 0 })
}else{
arr.sort((a,b)=>{
if (a[sortBy.value[0].key].total>b[sortBy.value[0].key].total) return factor[0]
if (a[sortBy.value[0].key].total<b[sortBy.value[0].key].total) return factor[1]
return 0 })
data[ind].period.unic.add(splitname(e.user));
data[ind].period.total += e.count;
} }
});
return data;
};
const modelrating = ref(false);
const getColorTooday1 = (pages) => {
if (pages > 10) return "text-green";
else if (pages > 5) return "text-orange";
else return "text-red";
};
const getColorPeriod1 = (pages) => {
if (pages > 30) return "text-green";
else if (pages > 15) return "text-orange";
else return "text-red";
};
const getColorTooday2 = (pages) => {
if (pages > 50) return "text-green";
else if (pages > 25) return "text-orange";
else return "text-red";
};
const getColorPeriod2 = (pages) => {
if (pages > 100) return "text-green";
else if (pages > 50) return "text-orange";
else return "text-red";
};
const getColorNow = (pages) => {
if (pages > 10) return "text-green";
else if (pages > 5) return "text-orange";
else return "text-red";
};
const customSort = () => {
let arr = tabledata.value;
if (sortBy.value !== undefined && sortBy.value.length > 0) {
let factor = sortBy.value[0].order == "desc" ? [-1, 1] : [1, -1];
if (untot.value == "уникальные") {
arr.sort((a, b) => {
if (
a[sortBy.value[0].key].unic.size >
b[sortBy.value[0].key].unic.size
)
return factor[0];
if (
a[sortBy.value[0].key].unic.size <
b[sortBy.value[0].key].unic.size
)
return factor[1];
return 0;
});
} else {
arr.sort((a, b) => {
if (a[sortBy.value[0].key].total > b[sortBy.value[0].key].total)
return factor[0];
if (a[sortBy.value[0].key].total < b[sortBy.value[0].key].total)
return factor[1];
return 0;
});
} }
tabledata.value=arr }
tabledata.value = arr;
};
} const tabledata = ref(datas());
const tabledata = ref(datas()) watch(
watch(()=>props.pages_count,(newValue)=>{ () => props.pages_count,
if (newValue!==[]){ (newValue) => {
tabledata.value=datas() if (newValue !== []) {
customSort() tabledata.value = datas();
customSort();
} }
}) }
// tabledata.value=datas.value );
return { // tabledata.value=datas.value
tabledata, return {
sortBy, tabledata,
customSort, sortBy,
untot, customSort,
modelrating, untot,
getColorTooday1, modelrating,
getColorPeriod1, getColorTooday1,
getColorTooday2, getColorPeriod1,
getColorPeriod2, getColorTooday2,
getColorNow, getColorPeriod2,
headers, getColorNow,
datas headers,
datas,
} };
} },
} };
</script> </script>
<style> <style>
.v-table { .v-table {
flex: 1!important; flex: 1 !important;
} }
.mytable tr { .mytable tr {
font-size: 13px; font-size: 13px;
} }
.mytable i{ .mytable i {
font-size: 10px; font-size: 10px;
} }
.myleft { .myleft {
float: left; float: left;
} }
</style> </style>
+158 -219
View File
@@ -1,191 +1,126 @@
<template> <template>
<v-row> <v-row>
<v-col class="flex-column pr-0"> <v-col class="flex-column pr-0">
<v-card class="h-100"> <v-card class="h-100">
<!-- xsmall
:time="false"
hide-view-selector
active-view="month"
:disable-views="['years', 'year', 'week', 'day']"
@cell-focus="selectedDate = $event"
:events="events"
class="vuecal--blue-theme vuecal--rounded-theme" -->
<vue-cal <vue-cal
locale="ru" locale="ru"
xsmall xsmall
:time="false" :time="false"
hide-view-selector hide-view-selector
:disable-views="['years', 'year', 'week', 'day']" :disable-views="['years', 'year', 'week', 'day']"
events-count-on-year-view events-count-on-year-view
active-view="month" active-view="month"
:events="events" :events="events"
todayButton todayButton
@cell-focus="selectedDate = $event" @cell-focus="selectedDate = $event"
> >
<template #arrow-prev> <template #arrow-prev>
<v-icon icon="mdi-menu-left"></v-icon> <v-icon icon="mdi-menu-left"></v-icon>
</template> </template>
<template #arrow-next> <template #arrow-next>
<v-icon icon="mdi-menu-right"></v-icon> <v-icon icon="mdi-menu-right"></v-icon>
</template> </template>
<template #today-button> <template #today-button>
<v-tooltip text="Сегодня" location="bottom">
<template v-slot:activator="{ props }">
<v-icon
@click="selectedDate = new Date()"
v-bind="props"
<v-tooltip text="Сегодня" location="bottom"> icon="mdi-crosshairs-gps"
<template v-slot:activator="{ props }"> size="x-small"
class="pt-1 pr-3"
<v-icon @click="selectedDate =new Date()" v-bind="props" icon="mdi-crosshairs-gps" size="x-small" class="pt-1 pr-3" color="more_details_btn"/> color="more_details_btn"
</template> />
</v-tooltip> </template>
</v-tooltip>
</template>
</template>
</vue-cal> </vue-cal>
</v-card> </v-card>
</v-col> </v-col>
<v-col> <v-col>
<!-- todayButton --> <v-card class="h-100">
<v-card-title class="text-center"
<v-card class="h-100"> >События на {{ dayformat(selectedDate) }}</v-card-title
<v-card-title class="text-center">События на {{dayformat(selectedDate)}}</v-card-title>
<!-- <v-card-text>ddd</v-card-text> -->
<vue-cal
locale="ru"
xsmall
:time="false"
hide-view-selector
hideTitleBar
split
header-format= "DD"
:events="events"
active-view="day"
:disable-views="['years', 'year', 'month', 'week']"
:selected-date="selectedDate"
> >
<template #arrow-prev> <vue-cal
<v-icon icon="mdi-menu-left"></v-icon> locale="ru"
</template> xsmall
<template #arrow-next> :time="false"
<v-icon icon="mdi-menu-right"></v-icon> hide-view-selector
</template> hideTitleBar
<template #today-button> split
header-format="DD"
:events="events"
active-view="day"
:disable-views="['years', 'year', 'month', 'week']"
:selected-date="selectedDate"
<!-- <v-tooltip text="Сегодня" location="bottom"> >
<template v-slot:activator="{ props }"> <template #arrow-prev>
<v-icon v-bind="props" icon="mdi-crosshairs-gps" size="x-small" class="pt-1 pr-3" color="more_details_btn"/> <v-icon icon="mdi-menu-left"></v-icon>
</template> </template>
</v-tooltip> --> <template #arrow-next>
<v-icon icon="mdi-menu-right"></v-icon>
</template>
<template #today-button>
</template> </template>
</vue-cal> </vue-cal>
</v-card> </v-card>
</v-col> </v-col>
</v-row> </v-row>
</template> </template>
<script> <script>
import VueCal from 'vue-cal' import VueCal from "vue-cal";
import 'vue-cal/dist/vuecal.css' import "vue-cal/dist/vuecal.css";
import { ref, onMounted } from 'vue' import { ref, onMounted } from "vue";
import { axiosApiInstance } from '@/utils/axios-api' import { axiosApiInstance } from "@/utils/axios-api";
export default { export default {
components: { VueCal },
setup() {
const events = ref([]);
function f_generalvacation() {
axiosApiInstance
components: { VueCal }, .get("api/general_vacation/generalvacation/")
.then((data) => {
setup() { for (let x in data.data) {
const events = ref([ if (x == "План-график") {
data.data[x].map((e) => {
]) events.value.push({
function f_generalvacation() { name: e.name,
axiosApiInstance.get('api/general_vacation/generalvacation/') start: e.start_work_period,
.then(data => { end: e.end_work_period,
content: e.name,
});
for (let x in data.data) { });
if (x=="План-график") {
data.data[x].map(e=>{
events.value.push({ name: e.name, start: e.start_work_period, end: e.end_work_period, content: e.name})
}
)
}
}
})
}
onMounted(() => {
f_generalvacation()
})
const selectedDate = ref(null)
function dayformat(days) {
const d = new Date(days)
let mess= 'сегодня'
if (d.getFullYear() != '1970'){
mess = `${d.getDate()} число`
} }
}
});
}
return mess onMounted(() => {
} f_generalvacation();
});
const selectedDate = ref(null);
function dayformat(days) {
const d = new Date(days);
let mess = "сегодня";
if (d.getFullYear() != "1970") {
mess = `${d.getDate()} число`;
}
return mess;
}
return { events, selectedDate, f_generalvacation, dayformat };
return { events, selectedDate, f_generalvacation, dayformat } },
} };
}
</script> </script>
<style> <style>
/* Dot indicator */ /* Dot indicator */
.vuecal__cell-events-count { .vuecal__cell-events-count {
width: 20px; width: 20px;
@@ -196,90 +131,94 @@ export default {
} }
.vuecal { .vuecal {
border-radius: 6px; border-radius: 6px;
} }
.vuecal__title-bar { .vuecal__title-bar {
border-top-left-radius: 3px; border-top-left-radius: 3px;
border-top-right-radius: 3px; border-top-right-radius: 3px;
} }
.vuecal__title-bar { .vuecal__title-bar {
background: var(--cards) background: var(--cards);
/* background: linear-gradient(to top right, rgba(19,84,122,.8), rgba(128,208,199,.8)); */ /* background: linear-gradient(to top right, rgba(19,84,122,.8), rgba(128,208,199,.8)); */
} }
.vuecal__flex .vuecal__title { .vuecal__flex .vuecal__title {
font-family: sans-serif; font-family: sans-serif;
} }
.vuecal__cell-events-count { .vuecal__cell-events-count {
position: absolute; position: absolute;
left: 50%; left: 50%;
top: 65%; top: 65%;
transform: translate(-50%); transform: translate(-50%);
min-width: 15px; min-width: 15px;
height: 15px; height: 15px;
line-height: 15px; line-height: 15px;
padding: 0; padding: 0;
background: linear-gradient(to top right, rgba(19,84,122,.8), rgba(128,208,199,.8)); background: linear-gradient(
color: #f8fff9!important; to top right,
border-radius: 12px; rgba(19, 84, 122, 0.8),
font-size: 10px; rgba(128, 208, 199, 0.8)
box-sizing: border-box; );
color: #f8fff9 !important;
border-radius: 12px;
font-size: 10px;
box-sizing: border-box;
} }
.vuecal__event { .vuecal__event {
color: #666; color: #666;
background-color: transparent; background-color: transparent;
padding: 10px; padding: 10px;
position: relative; position: relative;
box-sizing: border-box; box-sizing: border-box;
left: 0; left: 0;
width: 100%; width: 100%;
z-index: 1; z-index: 1;
transition: box-shadow .3s,left .3s,width .3s; transition: box-shadow 0.3s, left 0.3s, width 0.3s;
overflow: hidden; overflow: hidden;
text-align: justify; text-align: justify;
} }
.vuecal--rounded-theme .vuecal__cell-content { .vuecal--rounded-theme .vuecal__cell-content {
width: 30px; width: 30px;
height: 30px; height: 30px;
flex-grow: 0; flex-grow: 0;
border: 1px solid #00a5bc00; border: 1px solid #00a5bc00;
background: #c2e9d78c; background: #c2e9d78c;
border-radius: 30px; border-radius: 30px;
color: #333; color: #333;
} }
.vuecal__cell-content { .vuecal__cell-content {
cursor: pointer; cursor: pointer;
} }
.vuecal__body { .vuecal__body {
position: relative; position: relative;
overflow: auto; overflow: auto;
height: 0; height: 0;
} }
.vuecal--no-time .vuecal__event { .vuecal--no-time .vuecal__event {
min-height: 20px; min-height: 20px;
}
.vuecal__cell--selected:before {border-color: rgba(30, 65, 49, 0.5);}
.vuecal__cell--today, .vuecal__cell--current {
background-color: rgba(238, 181, 214, 0.548);
} }
.vuecal__cell--selected:before { .vuecal__cell--selected:before {
border-color: rgba(30, 65, 49, 0); border-color: rgba(30, 65, 49, 0.5);
}
.vuecal__cell--today,
.vuecal__cell--current {
background-color: rgba(238, 181, 214, 0.548);
}
.vuecal__cell--selected:before {
border-color: rgba(30, 65, 49, 0);
} }
.vuecal__cell--selected { .vuecal__cell--selected {
background-color: #3a97694a; background-color: #3a97694a;
z-index: 2; z-index: 2;
} }
</style>
</style>
+1 -1
View File
@@ -3,7 +3,7 @@
<v-menu <v-menu
v-model="menu" v-model="menu"
:close-on-content-click="false" :close-on-content-click="false"
:nudge-width="500" :max-width="800"
offset-x offset-x
> >
<template v-slot:activator="{ on, attrs }"> <template v-slot:activator="{ on, attrs }">
@@ -1,10 +1,85 @@
<template> <template>
<div>
<!-- <my-helper :pretext="kl" /> -->
<v-btn @click="useICalReader"> ical</v-btn>
</div>
</template> </template>
<script> <script>
export default { // import {useICalReader} from '@/utils/universal_functions'
import { baseURL, axiosApiInstance } from '@/utils/axios-api'
import { ref } from 'vue';
import ical from "ical.js";
import { formatDash } from '@/utils/universal_functions'
const burl = baseURL.slice(0,-1)
export default {
setup() {
const participant = ref('')
const calendar = ref('')
const useICalReader = async () => {
const response = await fetch(`${burl}/media/ical/calendar.ics`);
const data = await response.text();
const jcalData = ical.parse(data);
const icalComponent = new ical.Component(jcalData);
const name = icalComponent.getFirstPropertyValue("x-wr-calname");
const events = icalComponent
.getAllSubcomponents("vevent")
.map((vevent) => new ical.Event(vevent));
const calendarEvents = events.map((event) => {
return {
summary: event.summary,
description: event.description,
organizer: event.organizer,
start: event.startDate.toJSDate(),
end: event.endDate.toJSDate(),
location: event.location,
attendees: event.attendees
}
})
participant.value = name
calendar.value = calendarEvents
console.log(name, 'name')
console.log(calendarEvents, 'calendarEventse')
f_feedbackdata()
// return {
// type: "calendar",
// title: name,
// calendar: calendarEvents,
// }
}
// const s= useICalReader(`${burl}/media/ical/calendar.ics`)
// console.log(s.value, 'ddddddddd')
function f_feedbackdata() {
axiosApiInstance.post(`api/calendar_of_events/calendarEvents/`, {
participants: participant.value,
calendar: calendar.value
})
.then(data => {
console.log(data,'datas')
}
)
}
return {
useICalReader
}
}
} }
</script> </script>
+96 -86
View File
@@ -1,109 +1,119 @@
<template> <template>
<v-carousel
<v-carousel cycle
cycle interval="10000"
interval="10000" cover
cover height="450"
height="450" hide-delimiters
hide-delimiters hide-delimiter-background
hide-delimiter-background show-arrows="hover"
show-arrows="hover" color="white"
color="white" >
<v-carousel-item
v-for="(x, i) in carous"
:key="i"
:src="`${burl}${x.link}`"
cover
eager
> >
<v-container
<v-carousel-item fill-height
v-for="(x, i) in carous" :key="i" fluid
:src="`${burl}${x.link}`" pa-0
cover ma-0
eager pb-3
class="flex-column h-100 d-flex"
>
<v-card
v-if="x.text != '' || x.title != null"
class="bgCard h-100 d-flex flex-column"
> >
<v-container <v-card-title
fill-height v-if="x.title != null"
fluid class="text-h3 text-uppercase titles text-text_carous ma-1 mb-0"
pa-0 ma-0 pb-3 >
class="flex-column h-100 d-flex" <v-row no-gutters>
> <v-col class="align-self-center">
<v-card {{ x.title }}
v-if="x.text != '' || x.title != null" </v-col>
class="bgCard h-100 d-flex flex-column" <v-col class="flex-grow-0">
> <v-img
width="50"
<v-card-title v-if="x.title != null" :aspect-ratio="1"
class="text-h3 text-uppercase titles text-text_carous ma-1 mb-0"> :src="`${burl}${x.sender}`"
<v-row no-gutters > cover
<v-col class="align-self-center"> />
{{x.title}} </v-col>
</v-row>
</v-col> </v-card-title>
<v-col class="flex-grow-0"> <v-card-text
<v-img v-if="x.text != ''"
width="50" class="w-50 flex-grow-0 text-h6 bgText overflow-auto ma-1 pa-0"
:aspect-ratio="1" >
:src="`${burl}${x.sender}`" <v-textarea
cover class="text-text_caroustext-black textareas font-weight-medium nocursor"
/> :model-value="x.text"
variant="solo"
</v-col> readonly
</v-row> auto-grow
</v-card-title> rows="1"
<v-card-text hide-details
v-if="x.text != ''" flat
class=" w-50 flex-grow-0 text-h6 bgText overflow-auto ma-1 pa-0" bg-color="transparent"
> />
</v-card-text>
<v-textarea </v-card>
class="text-text_caroustext-black textareas font-weight-medium nocursor" </v-container>
:model-value=x.text </v-carousel-item>
variant='solo' </v-carousel>
readonly
auto-grow
rows="1"
hide-details
flat
bg-color="transparent"
/>
</v-card-text>
</v-card>
</v-container>
</v-carousel-item>
</v-carousel>
</template> </template>
<script> <script>
import { ref } from 'vue' import { ref } from "vue";
import {getfromserver} from '@/utils/universal_functions' import { baseURL } from "@/utils/axios-api";
import { baseURL } from '@/utils/axios-api' import { axiosApiInstance } from "@/utils/axios-api";
import { useAlertStore } from "@/store/useAlertStore";
export default { export default {
setup() {
const burl = baseURL.slice(0, -1);
setup() { const carous = ref([{ link: "newsimage/default.jpg" }]);
const burl = baseURL.slice(0,-1) const feedalert = useAlertStore().alert;
const carous=ref([{link: "newsimage/default.jpg"}]) const getfromserver = () => {
axiosApiInstance.get("api/navigation/carousels/").then((result) => {
getfromserver("api/navigation/carousels/", carous) if (result.data.mess != "") {
feedalert.alert = true;
return { feedalert.text = result.data.mess;
burl, feedalert.color = "red-darken-2";
carous feedalert.ico = "mdi-alert-outline";
} }
} carous.value = result.data.result;
});
};
} getfromserver();
return {
burl,
carous,
};
},
};
</script> </script>
<style> <style>
.titles { .titles {
font-family: cursive!important; font-family: cursive !important;
background: #ffffff8c; background: #ffffff8c;
} }
.textareas .v-field__input { .textareas .v-field__input {
font-size: 1.3em!important; font-size: 1.3em !important;
} }
.nocursor textarea { .nocursor textarea {
cursor: default !important; cursor: default !important;
} }
</style> </style>
+14 -15
View File
@@ -214,7 +214,8 @@
<v-row class="flex-grow-0" v-if="accountStore.user.is_staff"> <v-row class="flex-grow-0" v-if="accountStore.user.is_staff">
<v-col> <v-col>
<v-list nav density active-class="noneoutline"> <default-portal-menu-list :rail=rail />
<!-- <v-list nav density="compact" active-class="noneoutline">
<default-portal-menu-list :aMenuItem="supperuser"/> <default-portal-menu-list :aMenuItem="supperuser"/>
<div v-if="getDevelopment()"> <div v-if="getDevelopment()">
@@ -223,7 +224,7 @@
</v-list> </v-list> -->
</v-col> </v-col>
</v-row> </v-row>
<v-row no-gutters class="flex-grow-0"> <v-row no-gutters class="flex-grow-0">
@@ -240,9 +241,11 @@
<v-main v-if="accountStore.cod2user" class="d-flex bg-main_theme"> <v-main v-if="accountStore.cod2user" class="d-flex bg-main_theme">
<router-view /> <router-view />
<v-expand-x-transition>
<alert-default /> <alert-default />
</v-expand-x-transition>
</v-main> </v-main>
<v-main v-else class="d-flex align-center text-h3 bg-teal-lighten-2"> <v-main v-else class="d-flex align-center text-h3 bg-teal-lighten-2">
@@ -299,6 +302,7 @@ import VcardUser from '@/components/UI/fiousercard/vcardUser.vue'
import PageCounter from '@/components/UI/defaultportal/page-counter.vue' import PageCounter from '@/components/UI/defaultportal/page-counter.vue'
import DefaultPortalMenuList from '@/layouts/default/DefaultPortalMenuList.vue' import DefaultPortalMenuList from '@/layouts/default/DefaultPortalMenuList.vue'
import {getDevelopment} from '@/utils/universal_functions' import {getDevelopment} from '@/utils/universal_functions'
export default { export default {
components: { components: {
@@ -357,15 +361,6 @@ export default {
// 'https://materialdesignicons.com/cdn/1.6.50-dev/' // 'https://materialdesignicons.com/cdn/1.6.50-dev/'
const supperuser = [
{
name: 'Панель администратора',
ico: 'mdi-wrench',
link: baseURL+'admin'
},
]
const oRasrab = [ const oRasrab = [
{ {
@@ -447,7 +442,11 @@ export default {
ico: 'mdi-city', ico: 'mdi-city',
path: "/inspection" path: "/inspection"
}, },
{
name: 'ical',
ico: 'mdi-calendar',
path: "/ical"
},
// { // {
// name: 'К празднику', // name: 'К празднику',
@@ -485,7 +484,7 @@ export default {
// feedalert, // feedalert,
alert, alert,
burl, burl,
supperuser,
closeinfo, closeinfo,
baseURL, baseURL,
getDevelopment getDevelopment
@@ -1,40 +1,88 @@
<template> <template>
<div> <div>
<v-list-item <v-list nav density="compact" class="text-blue-grey-lighten-1">
v-for="(x, key) in aMenuItem" <div v-for="(list, key) in aMenuItem" :key="key">
:key="key" <div v-if="showProm(key)">
:title="x.name" <v-list-item
:value="x.name" v-for="x in list"
:href="x.link" :key="x"
:target="x.link?'_blank':''" :title="x.name"
slim :value="x.name"
class="text-blue-grey-lighten-1" :href="x.link"
> :target="x.link ? '_blank' : ''"
<template v-slot:prepend> slim
<v-icon :icon="x.ico" size="x_small"/> >
<v-tooltip <template v-slot:prepend>
v-if="rail" <v-icon :icon="x.ico" size="x_small" />
activator="parent" <v-tooltip v-if="rail" activator="parent" location="top">
location="top" </v-tooltip>
> </template>
{{ x.name }} </v-list-item>
</v-tooltip> </div>
</template> </div>
</v-list-item> </v-list>
</div> </div>
</template> </template>
<script> <script>
import { baseURL } from "@/utils/axios-api";
import { getDevelopment } from "@/utils/universal_functions";
export default { export default {
props: { props: {
aMenuItem: { rail: {
type: Array, type: Boolean,
default: () => [] default: false
},
},
setup() {
const gittlink = () => {
const link =
baseURL == "http://127.0.0.1:8000/"
? "http://sulaco.nodered.ru:5223/COD2/PORTAL_COD2/projects"
: "http://maestro.cod2.regions.tax.nalog.ru:3333/COD2/PORTAL_COD2/projects/22";
return link;
};
const aMenuItem = {
prom: [
{
name: "Панель администратора",
ico: "mdi-wrench",
link: baseURL + "admin",
}, },
} ],
} my: [
{
name: "Gitt",
ico: "mdi-github",
link: gittlink(),
},
{
name: "Swagger",
ico: "mdi-puzzle",
link: "http://127.0.0.1:8000/swagger/",
},
],
};
const showProm = (data) => {
let show = true;
if (data == "my" && getDevelopment() == false) {
show = false;
}
return show;
};
return {
aMenuItem,
getDevelopment,
showProm,
};
},
};
</script> </script>
<style> <style></style>
</style>
+18 -1
View File
@@ -4,4 +4,21 @@
Импорт глобальный, прописан в src/front/src/components/UI/index.js Импорт глобальный, прописан в src/front/src/components/UI/index.js
*Описание входящих параметров в useAlertStore.md* #### Строка импорта:
```
import { useAlertStore } from '@/store/useAlertStore'
```
#### Переменная в setup:
```
const feedalert = useAlertStore().alert
```
#### Переменная alert содержит ключи:
|Ключ|Тип|Значение по умолчанию|Описание|
|-|--------|--------|--------|
|alert|boolean|false|Запуск/скрытие отоборажения на экране|
|text|string|''|Тект, который будет отображаться в алерте|
|ico|string|'mdi-plus'|Замена иконки, отображаемой слева от текста|
|color|string|''|Замена цвета|
@@ -4,14 +4,14 @@
:color=feedalert.color :color=feedalert.color
:icon=feedalert.ico :icon=feedalert.ico
theme="dark" theme="dark"
max-height="40" min-height="40"
width = "500" min-width = "500"
position="fixed" position="fixed"
location = "bottom" location = "bottom"
class="mb-2" class="mb-2"
v-model="feedalert.alert" v-model="feedalert.alert"
:text=feedalert.text :text=feedalert.text
variant = "tonal"
density="compact" density="compact"
> >
</v-alert> </v-alert>
@@ -35,7 +35,7 @@ export default {
feedalert.ico="" feedalert.ico=""
feedalert.color="" feedalert.color=""
feedalert.alert = false feedalert.alert = false
}, 3000) }, 8000)
}, {deep:true}) }, {deep:true})
+9
View File
@@ -136,6 +136,15 @@ const routes = [
ico: "mdi-city" ico: "mdi-city"
} }
}, },
{
path: '/ical',
name: 'UsersInfoPage',
component: () => import('@/components/calendar_of_events/load-ical.vue'),
meta:{
title:"Для работы над календарем",
ico: "mdi-account"
}
},
], ],
}, },
] ]
+137 -70
View File
@@ -1,94 +1,161 @@
const str = 'hello'; const str = "hello";
import {useAccountStore} from '@/store/AccountStore' import { useAccountStore } from "@/store/AccountStore";
import {useAppStore} from '@/store/app' import { useAppStore } from "@/store/app";
import { baseURL } from '@/utils/axios-api' import { baseURL } from "@/utils/axios-api";
import { axiosApiInstance, clearAxios } from '@/utils/axios-api' import { axiosApiInstance, clearAxios } from "@/utils/axios-api";
import { useRouter } from 'vue-router' import { useRouter } from "vue-router";
import moment from 'moment' import moment from "moment";
import { ref, onMounted } from "vue";
export function formatComa(date) { export function formatComa(date) {
return moment(date).format('DD.MM.YYYY') return moment(date).format("DD.MM.YYYY");
}
export function formatDash(date) {
return moment(date).format('YYYY-MM-DD')
}
export function formaComaTime(date) {
return moment(date).format('DD.MM.YYYY H:mm')
}
export function checking_for_entry (where, what) {
if (!where.includes(what))
{
where.push(what)
}
} }
export function getfromserver(path, reactive){ export function formatDash(date) {
try{ return moment(date).format("YYYY-MM-DD");
}
axiosApiInstance.get(path).then(result => {
reactive.value = result.data})} export function formaComaTime(date) {
catch(e){ return moment(date).format("DD.MM.YYYY H:mm");
console.log(e); }
}
export function checking_for_entry(where, what) {
if (!where.includes(what)) {
where.push(what);
} }
}
export function getfromserverfree(path, reactive){ export function getfromserver(path, reactive) {
try{ try {
clearAxios.get(path).then(result => { axiosApiInstance.get(path).then((result) => {
reactive.value = result.data})} reactive.value = result.data;
catch(e){ });
console.log(e); } catch (e) {
} console.log(e);
} }
}
export function getfromserverfree(path, reactive) {
try {
clearAxios.get(path).then((result) => {
reactive.value = result.data;
export function checkremote(filecheck){ });
} catch (e) {
return process.env.NODE_ENV == 'development'? "https://pixelbox.ru/wp-content/uploads/2021/11/avatar-whatsapp-pixelbox.ru-36.jpg":filecheck console.log(e);
} }
}
export function checkremote(filecheck) {
return process.env.NODE_ENV == "development"
? "https://pixelbox.ru/wp-content/uploads/2021/11/avatar-whatsapp-pixelbox.ru-36.jpg"
: filecheck;
}
export default str; export default str;
export function splitname (name) { export function splitname(name) {
return name.familyname + ' ' + name.name[0] + '.' + name.parentname[0]+ '.' return name.familyname + " " + name.name[0] + "." + name.parentname[0] + ".";
} }
export function pagecounter(){ export function pagecounter() {
const router = useRouter();
const router = useRouter() const accountStore = useAccountStore();
const accountStore = useAccountStore() const appStore = useAppStore();
const appStore = useAppStore()
let postdata = { let postdata = {
user__id: "user" in accountStore &&"id" in accountStore.user? accountStore.user.id: null, user__id:
"user" in accountStore && "id" in accountStore.user
? accountStore.user.id
: null,
page: router.currentRoute.value.meta.title, page: router.currentRoute.value.meta.title,
fullPath: router.currentRoute.value.fullPath, fullPath: router.currentRoute.value.fullPath,
ico: router.currentRoute.value.meta.ico ico: router.currentRoute.value.meta.ico,
} };
clearAxios.post(`${baseURL}api/watcher/counter/`, postdata).then((result) => {
appStore.countvisitor = result.data;
});
}
clearAxios.post(`${baseURL}api/watcher/counter/`, postdata) export function getDevelopment() {
.then(result => { return process.env.NODE_ENV == "development" ? true : false;
appStore.countvisitor = result.data }
})
export function useICalReader(url) {
} ///
const events = ref([]);
export function getDevelopment() { const loadICalFile = async () => {
return process.env.NODE_ENV == 'development'?true:false try {
} const response = await fetch(url);
const data = await response.text();
const jcalData = ical.parse(data);
const icalComponent = new ical.Component(jcalData);
const name = icalComponent.getFirstPropertyValue("x-wr-calname");
const events = icalComponent
.getAllSubcomponents("vevent")
.map((vevent) => new ical.Event(vevent));
const calendarEvents = events.map((event) => {
return {
summary: event.summary,
description: event.description,
organizer: event.organizer,
attendee_count: event.attendees.length,
duration_seconds: event.duration.toSeconds(),
start: event.startDate.toJSDate().getTime() / 1000,
end: event.endDate.toJSDate().getTime() / 1000,
location: event.location,
}
})
return {
type: "calendar",
title: name,
calendar: calendarEvents,
}
// const vevents = comp.getAllSubcomponents('vevent')
// const eventsData = vevents.map(vevent => ({
// vevent: vevent,
// summary: vevent.getFirstPropertyValue('summary'),
// start: vevent.getFirstPropertyValue('dtstart'),
// end: vevent.getFirstPropertyValue('dtend')
// }))
// events.value = eventsData
} catch (error) {
console.error(error);
}
};
onMounted(() => {
loadICalFile();
});
return {
events,
};
}
// export function useICalReader(filePath) {
// const icsContent = ref('')
// const fetchICalFile = async () => {
// try {
// const response = await fetch(filePath)
// if (!response.ok) {
// throw new Error('Ошибка при загрузке файла')
// }
// const data = await response.text()
// icsContent.value = data
// } catch (error) {
// console.error('Ошибка при чтении файла:', error)
// }
// }
// return { icsContent, fetchICalFile }
// }
@@ -172,7 +172,6 @@ export default {
const getInspectionDirections = () => { const getInspectionDirections = () => {
axiosApiInstance.get('api/about_inspection/getinspectiondirections/').then(res => { axiosApiInstance.get('api/about_inspection/getinspectiondirections/').then(res => {
directionworks.value = res.data directionworks.value = res.data
console.log(directionworks.value)
}) })
-1
View File
@@ -170,7 +170,6 @@ setup(){
let periodusers = new Set([]) let periodusers = new Set([])
let brdata = {} let brdata = {}
console.log(alldata.value.staff, 'alldata.value.periodalldata.value.periodalldata.value.periodalldata.value.period')
let filtr = alldata.value.period let filtr = alldata.value.period
+2 -2
View File
@@ -109,7 +109,7 @@
import CarouselList from '@/components/carousel-list.vue' import CarouselList from '@/components/carousel-list.vue'
import CarouselNumbers from '@/components/carousel-numbers.vue' import CarouselNumbers from '@/components/carousel-numbers.vue'
import CalendarFull from '@/components/UI/Calendar-full.vue'
import NewsHome from '@/components/news-home.vue' import NewsHome from '@/components/news-home.vue'
import LoadRound from '@/components/load-round.vue' import LoadRound from '@/components/load-round.vue'
@@ -124,7 +124,7 @@
CarouselList, CarouselList,
CarouselNumbers, CarouselNumbers,
CalendarFull,
LoadRound, LoadRound,
DigitalLetna, DigitalLetna,