P-42 Отжать цвет
This commit is contained in:
1 parent
aeb322199c
commit
9cb92daeca
8 files changed
+322
-25
No files matched your search
@@ -55,14 +55,11 @@ 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='Событие')
|
||||
|
||||
# <<<<<<< HEAD
|
||||
|
||||
################################################
|
||||
# Модели(Таблицы) для хранения календаря
|
||||
class Calendar(models.Model):
|
||||
cl_name = models.CharField(max_length=300, verbose_name='Название');
|
||||
cl_color = models.CharField(max_length=300, verbose_name='Цвет');
|
||||
cl_descr = models.CharField(max_length=300, verbose_name='Описание');
|
||||
cl_name = models.CharField(max_length=300, verbose_name='Название')
|
||||
cl_color = models.CharField(max_length=300, verbose_name='Цвет')
|
||||
cl_descr = models.CharField(max_length=300, verbose_name='Описание')
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Календарь"
|
||||
@@ -72,9 +69,9 @@ class Calendar(models.Model):
|
||||
return str(self.cl_name)
|
||||
|
||||
class CalendarPatricipants(models.Model):
|
||||
patrcipant_calendar = models.ForeignKey(DictEmployee, editable=False, on_delete=models.PROTECT, verbose_name='Участник');
|
||||
calendar = models.ForeignKey(Calendar, on_delete=models.PROTECT, related_name='get_calendar', verbose_name='Календарь');
|
||||
is_editable = models.BooleanField(default=False, verbose_name='Редактирование');
|
||||
patrcipant_calendar = models.ForeignKey(DictEmployee, editable=False, on_delete=models.PROTECT, verbose_name='Участник')
|
||||
calendar = models.ForeignKey(Calendar, on_delete=models.PROTECT, related_name='get_calendar', verbose_name='Календарь')
|
||||
is_editable = models.BooleanField(default=False, verbose_name='Редактирование')
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Участники календаря"
|
||||
@@ -98,8 +95,8 @@ class CalendarEvent(models.Model):
|
||||
return str(self.calendar_event)
|
||||
|
||||
class CalendarFiles(models.Model):
|
||||
calendar_event = models.ForeignKey(CalendarEvent, on_delete=models.PROTECT, related_name='get_calendar_event_files', verbose_name='Событие');
|
||||
file = models.FileField(upload_to='calendar/%Y/%m/%d');
|
||||
calendar_event = models.ForeignKey(CalendarEvent, on_delete=models.PROTECT, related_name='get_calendar_event_files', verbose_name='Событие')
|
||||
file = models.FileField(upload_to='calendar/%Y/%m/%d')
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Файлы календаря"
|
||||
@@ -110,7 +107,7 @@ class CalendarFiles(models.Model):
|
||||
|
||||
class TableEventParticipant(models.Model):
|
||||
participant_event = models.ForeignKey(DictEmployee, on_delete=models.PROTECT, related_name='get_participant_event', verbose_name='Участник');
|
||||
calendar_table = models.ForeignKey(Calendar, on_delete=models.PROTECT, related_name='get_calendar_table', verbose_name='Календарь');
|
||||
calendar_table = models.ForeignKey(Calendar, on_delete=models.PROTECT, related_name='get_calendar_table', verbose_name='Календарь')
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Участники таблицы"
|
||||
@@ -124,11 +121,6 @@ class TableEventParticipant(models.Model):
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# =======
|
||||
class ExclusionDates(models.Model):
|
||||
""" Таблица, которая содержит даты-исключения. То есть, все праздничные дни,
|
||||
которые не попадают на выходные и все будни, которые праздничные """
|
||||
@@ -140,4 +132,4 @@ class ExclusionDates(models.Model):
|
||||
|
||||
def __str__(self):
|
||||
return str(self.exclusiondate)
|
||||
# >>>>>>> 96ceeb3252de4f48195eb5969f6b3d1d7affbe84
|
||||
|
||||
@@ -2,6 +2,16 @@ from rest_framework import serializers
|
||||
from .models import *
|
||||
from userauth.serializers import *
|
||||
|
||||
class DepartmentsSerializer(serializers.ModelSerializer):
|
||||
staff =serializers.SerializerMethodField('get_staff')
|
||||
class Meta:
|
||||
model = DictDepartment
|
||||
fields = ['id', 'name', 'staff']
|
||||
|
||||
def get_staff(self, obj):
|
||||
user = DictEmployee.objects.filter(id_dict_department = obj.id, deleted=0).order_by('fio')
|
||||
return InfoUserCardSerializer(user, many=True).data
|
||||
|
||||
class ParticipantsEventSerializer(serializers.ModelSerializer):
|
||||
""" Состав участников в событии """
|
||||
user = serializers.SerializerMethodField('get_user')
|
||||
|
||||
@@ -7,6 +7,7 @@ from rest_framework.response import Response
|
||||
import json
|
||||
from django.db.models.functions import TruncYear
|
||||
from userauth.serializers import *
|
||||
from django.db.models import Q
|
||||
|
||||
class CalendarEventsAPIView(APIView):
|
||||
|
||||
@@ -77,7 +78,9 @@ class GetCalendars(ListAPIView):
|
||||
|
||||
class CreateEventsAPIView(APIView):
|
||||
def get(self, request):
|
||||
user = DictEmployee.objects.filter(deleted=0).order_by('id_dict_position__order_position','familyname')
|
||||
resp = InfoUserCardSerializer(user, many=True).data
|
||||
print(resp, 'ffffffffffffffffffffff')
|
||||
department = DictDepartment.objects.filter(Q(deleted=0), ~Q(id=0)).order_by('order_department')
|
||||
# user = DictEmployee.objects.filter(deleted=0).order_by('id_dict_position__order_position','familyname')
|
||||
# resp = InfoUserCardSerializer(user, many=True).data
|
||||
resp = DepartmentsSerializer(department, many = True).data
|
||||
# print(department, 'ffffffffffffffffffffff')
|
||||
return Response(resp)
|
||||
@@ -1,8 +1,22 @@
|
||||
<template>
|
||||
<v-row no-gutters>
|
||||
<v-col class="flex-grow-0 d-flex flex-column">
|
||||
<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"
|
||||
@@ -31,6 +45,9 @@
|
||||
</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> -->
|
||||
@@ -65,11 +82,11 @@ 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 },
|
||||
components: { EventCreate, CalendarMy },
|
||||
|
||||
setup() {
|
||||
const showDialog = ref(false);
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
<template>
|
||||
<v-dialog v-model="dialog_create_event" max-width="636">
|
||||
<v-card height="436" class="pa-3">
|
||||
<v-card-title class="pr-0 pl-2 d-flex justify-space-between">
|
||||
Новый календарь
|
||||
<v-icon
|
||||
icon="mdi-close cursor-pointer"
|
||||
size="small"
|
||||
color="grey"
|
||||
@click="dialog_create_event = false"
|
||||
></v-icon>
|
||||
</v-card-title>
|
||||
<v-card-text class="d-flex py-0 px-3">
|
||||
<v-row no-gutters class="flex-column">
|
||||
<v-col class="d-flex flex-column">
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col class="text-body-2 text-text_grey" lg="2">
|
||||
Название
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-textarea
|
||||
density="compact"
|
||||
label="Описание"
|
||||
row-height="25"
|
||||
rows="1"
|
||||
variant="outlined"
|
||||
hide-details
|
||||
></v-textarea></v-col
|
||||
></v-row>
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col class="text-body-2 text-text_grey" lg="2"> Цвет </v-col>
|
||||
<v-col v-for="(x, key) in color" :key="key">
|
||||
<v-avatar
|
||||
class="cursor-pointer"
|
||||
@click="colorPik(x.color, key)"
|
||||
size="x-small"
|
||||
:color="x.color"
|
||||
:variant="x.ton ? 'tonal' : 'flat'"
|
||||
/> </v-col
|
||||
></v-row>
|
||||
{{color}}
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col class="text-body-2 text-text_grey" lg="2">
|
||||
Участники
|
||||
</v-col>
|
||||
<v-col>
|
||||
<!-- <v-select
|
||||
v-model="value"
|
||||
:items="items"
|
||||
label="Выберите из списка или найдите по ФИО"
|
||||
chips
|
||||
multiple
|
||||
hide-details
|
||||
></v-select> -->
|
||||
</v-col
|
||||
></v-row>
|
||||
</v-col>
|
||||
<v-col class="d-flex flex-grow-0">
|
||||
<v-textarea
|
||||
density="compact"
|
||||
label="Описание"
|
||||
row-height="25"
|
||||
rows="4"
|
||||
variant="outlined"
|
||||
hide-details
|
||||
shaped
|
||||
no-resize
|
||||
></v-textarea>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-btn
|
||||
class="text-subtitle-1"
|
||||
elevation="0"
|
||||
width="150"
|
||||
@click="dialog_create_event = false"
|
||||
>Отменить</v-btn
|
||||
>
|
||||
<v-btn
|
||||
class="text-subtitle-1 font-weight-regular"
|
||||
color="btn_text"
|
||||
variant="flat"
|
||||
elevation="0"
|
||||
width="150"
|
||||
>Создать</v-btn
|
||||
>
|
||||
</v-card-actions>
|
||||
<!-- <v-row no-gutters class="gap flex-column">
|
||||
v-col*
|
||||
</v-row> -->
|
||||
|
||||
<!-- <v-row>
|
||||
<v-col>
|
||||
<v-textarea
|
||||
v-model="newcalendar.cl_name"
|
||||
placeholder="Название календаря"
|
||||
no-resize
|
||||
|
||||
rows="1"
|
||||
hide-details
|
||||
|
||||
|
||||
density="compact"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
|
||||
{{newcalendar}} -->
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { computed, ref } from "vue";
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
opendialog: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
|
||||
setup(props, { emit }) {
|
||||
const dialog_create_event = computed({
|
||||
get: () => props.opendialog,
|
||||
set: (value) => emit("update:opendialog", value),
|
||||
});
|
||||
|
||||
const confirmation = () => {
|
||||
axiosApiInstance
|
||||
.get(`api/calendar_of_events/createEvents/`)
|
||||
.then((data) => {
|
||||
console.log(data.data, "datadatadatawwwwwwwwwwww");
|
||||
});
|
||||
};
|
||||
|
||||
const color = ref([
|
||||
{ color: "#F44336", ton: false },
|
||||
{ color: "#E91E63", ton: false },
|
||||
{ color: "#FF5722", ton: false },
|
||||
{ color: "#FFC107", ton: false },
|
||||
{ color: "#FFEB3B", ton: false },
|
||||
{ color: "#CDDC39", ton: false },
|
||||
{ color: "#8BC34A", ton: false },
|
||||
{ color: "#4CAF50", ton: false },
|
||||
{ color: "#00BCD4", ton: false },
|
||||
{ color: "#03A9F4", ton: false },
|
||||
{ color: "#2196F3", ton: false },
|
||||
{ color: "#3F51B5", ton: false },
|
||||
{ color: "#673AB7", ton: false },
|
||||
{ color: "#9C27B0", ton: false },
|
||||
{ color: "#607D8B", ton: false },
|
||||
{ color: "#795548", ton: false },
|
||||
]);
|
||||
|
||||
const colorPik = (col, key) => {
|
||||
|
||||
color.value.map((e, k) => {
|
||||
// e.ton = false
|
||||
|
||||
if (k != key ) {
|
||||
e.ton = !color.value[k].ton;
|
||||
}
|
||||
|
||||
|
||||
else if ((k == key) && color.value[k].ton == true ) {
|
||||
e.ton = false
|
||||
console.log(k, key, color.value[k].ton, 'kuku');
|
||||
}
|
||||
console.log(k, key, color.value[k].ton)
|
||||
|
||||
});
|
||||
|
||||
console.log(color, key, "col");
|
||||
};
|
||||
|
||||
confirmation();
|
||||
|
||||
const newcalendar = ref({
|
||||
cl_name: "",
|
||||
cl_color: "",
|
||||
cl_descr: "",
|
||||
patrcipant_calendar: [],
|
||||
});
|
||||
|
||||
return {
|
||||
dialog_create_event,
|
||||
newcalendar,
|
||||
color,
|
||||
colorPik,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
@@ -0,0 +1,71 @@
|
||||
<template>
|
||||
<v-list density="compact">
|
||||
<v-list-group value="Admin">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-list-item v-bind="props">
|
||||
<template v-slot:prepend>
|
||||
<div @click.stop="">
|
||||
<span> Мои календари </span>
|
||||
</div>
|
||||
|
||||
<v-btn
|
||||
size="x-small"
|
||||
icon="mdi-plus"
|
||||
variant="text"
|
||||
@click.stop="showDialog = true"
|
||||
></v-btn>
|
||||
</template>
|
||||
</v-list-item>
|
||||
</template>
|
||||
|
||||
<v-list-item
|
||||
v-for="(x, i) in mycalendar"
|
||||
:key="i"
|
||||
:title="x.name"
|
||||
:value="x.name"
|
||||
>
|
||||
<template v-slot:prepend="{ isActive }">
|
||||
<v-checkbox-btn
|
||||
:color="x.color"
|
||||
:model-value="isActive"
|
||||
v-model="x.chek"
|
||||
/>
|
||||
</template>
|
||||
</v-list-item>
|
||||
</v-list-group>
|
||||
<calendar-create
|
||||
@update:opendialog="showDialog = $event"
|
||||
:opendialog="showDialog"
|
||||
/>
|
||||
</v-list>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref, onMounted, computed } from "vue";
|
||||
import calendarCreate from "./calendar-create.vue";
|
||||
|
||||
export default {
|
||||
components: { calendarCreate },
|
||||
setup(props, { emit }) {
|
||||
const showDialog = ref(false);
|
||||
const selected = ref(true);
|
||||
const subscribe = [
|
||||
{ name: "Дни рождения", chek: true, id: 0, color: "yellow" },
|
||||
];
|
||||
|
||||
const mycalendar = ref([
|
||||
{ name: "Портал ЦОД2", chek: false, id: 1, color: "red" },
|
||||
{ name: "Личный календарь", chek: true, id: 2, color: "green" },
|
||||
]);
|
||||
|
||||
return {
|
||||
mycalendar,
|
||||
subscribe,
|
||||
selected,
|
||||
showDialog,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
@@ -6,6 +6,7 @@
|
||||
rows="1"
|
||||
placeholder="Название календаря"
|
||||
/> -->
|
||||
|
||||
<v-text-field v-model="dataToEdit.name" placeholder="Заголовок" />
|
||||
</v-card-title>
|
||||
<v-card-subtitle>
|
||||
@@ -29,6 +30,7 @@
|
||||
density="compact"
|
||||
v-bind="props"
|
||||
>
|
||||
|
||||
<template v-slot:prepend-inner>
|
||||
<v-icon
|
||||
v-bind="props"
|
||||
@@ -69,7 +71,7 @@
|
||||
language: 'ru',
|
||||
}"
|
||||
/> -->
|
||||
|
||||
{{dataToEdit}}
|
||||
<v-textarea
|
||||
v-model="dataToEdit.place"
|
||||
placeholder="Местопроведение события"
|
||||
|
||||
@@ -29,6 +29,7 @@ export default createVuetify({
|
||||
main_theme: "#f7f7f7",
|
||||
scrollbar: '#367F8A',
|
||||
cards: '#F5F5F5',
|
||||
text_grey: '#7A7A7A', //Цвет серого текста
|
||||
text_carous: '#242424',
|
||||
navigation: '#004D40', // Цвет текста и иконок в левом навигационном меню
|
||||
black_grey: '#3C3C3C', // Цвет для карусели с цифрами в работе
|
||||
@@ -55,6 +56,7 @@ export default createVuetify({
|
||||
main_theme: "#101311",
|
||||
scrollbar: '#367F8A',
|
||||
cards: '#F5F5F5',
|
||||
text_grey: '#7A7A7A', //Цвет серого текста
|
||||
text_carous: '#242424',
|
||||
navigation: '#FDF5E6',
|
||||
black_grey: '#3C3C3C',
|
||||
|
||||
Reference in new issue
Block a user