Календарь создание и редактирование

This commit is contained in:
iriska-gri committed 2024-04-23 16:56:36 +03:00
1 parent 0e6e928dc9
commit 17f4bc1761
7 files changed
+147 -43

No files matched your search

+2 -1
View File
@@ -1,4 +1,5 @@
from django.contrib import admin
from django.utils.safestring import mark_safe
from .models import *
# Register your models here.
+9
View File
@@ -10,6 +10,15 @@ 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 Meta:
verbose_name = "Вход. Изображение"
verbose_name_plural = "Вход. Изображения"
def __str__(self):
return str(self.name)
class EnumChoice(Enum):
@classmethod
def get_choices(cls):
@@ -2,7 +2,8 @@
<v-row>
<v-col class="flex-column pr-0">
<v-card class="h-100">
<!-- <my-helper :pretext="selectedEvent" /> -->
<my-helper :pretext="selectedEvent" />
<vue-cal
locale="ru"
@@ -1,46 +1,118 @@
<template>
<v-card>
<v-card-title>
<v-text-field v-model="event.title" placeholder="Заголовок" />
<v-card-title>
<v-text-field v-model="event.title" placeholder="Заголовок" />
</v-card-title>
<v-card-subtitle>
<v-menu
v-model="menudate"
:close-on-content-click="false"
:nudge-right="40"
transition="scale-transition"
offset-y
>
<template v-slot:activator="{ props }">
<v-textarea
v-model="event.start"
:value="formatComa(event.start)"
no-resize
class="my-textarea"
rows="1"
hide-details
style="width: 119px"
variant="plain"
density="compact"
v-bind="props"
>
<template v-slot:prepend-inner>
<v-icon
v-bind="props"
icon="mdi-calendar-today"
color="cyan-darken-3"
size="x-small"
/>
</template>
</v-textarea>
</template>
<v-locale-provider locale="ru">
<v-date-picker
v-model="event.start"
show-adjacent-months
hide-header
border
/>
</v-locale-provider>
</v-menu>
<!-- <v-text-field v-model="event.start" placeholder="время" /> -->
<!-- <strong>{{ event.start && event.start.format("DD.MM.YYYY") }}</strong> -->
</v-card-subtitle>
<v-card-text class="pt-2">
<p class="pb-3" v-html="event.contentFull" />
<strong>Время:</strong>
</v-card-title>
<v-card-subtitle>
<v-text-field v-model="event.start" placeholder="время" />
<!-- <strong>{{ event.start && event.start.format("DD.MM.YYYY") }}</strong> -->
</v-card-subtitle>
<v-card-text class="pt-2">
<p class="pb-3" v-html="event.contentFull" />
<strong>Время:</strong>
<ul class="pl-5">
<li>
Начало:
{{ event.start && event.start.formatTime() }}
</li>
<li>
Окончание:
{{ event.end && event.end.formatTime() }}
</li>
</ul>
</v-card-text>
</v-card>
<ul class="pl-5">
<v-text-field
v-model="time"
:active="menu2"
:focus="menu2"
label="Picker in menu"
prepend-icon="mdi-clock-time-four-outline"
readonly
>
<v-menu
v-model="menu2"
:close-on-content-click="false"
activator="parent"
transition="scale-transition"
>
<v-time-picker
v-if="menu2"
v-model="time"
full-width
></v-time-picker>
</v-menu>
</v-text-field>
<li>
Начало:
{{ event.start && event.start.formatTime() }}
</li>
<li>
Окончание:
{{ event.end && event.end.formatTime() }}
</li>
</ul>
</v-card-text>
</v-card>
</template>
<script>
export default {
props: {
import { formatComa, formatDash } from "@/utils/universal_functions";
import { ref } from "vue";
event: {
type: Object,
default: () => {},
},
},
}
export default {
props: {
event: {
type: Object,
default: () => {},
},
},
setup() {
const menudate = ref(false);
const menu2 = ref(false)
const time= ref(null)
return {
menudate,
formatComa,
menu2,
time
};
},
};
</script>
<style>
</style>
<style></style>
@@ -11,7 +11,7 @@
<strong>{{ event.start && event.start.format("DD.MM.YYYY") }}</strong>
</v-card-subtitle>
<v-card-text class="pt-2">
<p class="pb-3" v-html="event.contentFull" />
<p class="pb-3" v-html=formatText(event.contentFull) />
<strong>Время:</strong>
<ul class="pl-5">
@@ -29,6 +29,7 @@
</template>
<script>
import { baseURL } from '@/utils/axios-api'
export default {
props: {
@@ -37,6 +38,17 @@
default: () => {},
},
},
setup() {
const formatText= (text) => {
return text.replaceAll('src="/media/uploads', `src="${baseURL}media/uploads`)
}
return {
formatText
}
}
}
</script>
@@ -10,7 +10,7 @@
/>
</v-card-title>
</v-card>
<event-dialog-edit :event="event" v-if="editEvent" />
<event-dialog-edit :event="event" @returndate="returnend" v-if="editEvent" />
<event-dialog-info :event="event" v-else />
</v-dialog>
</template>
+11 -2
View File
@@ -1,6 +1,15 @@
<template>
<v-snackbar
:timeout="2000"
v-model="feedalert.alert"
:color=feedalert.color
:icon=feedalert.ico
>
<v-alert
{{feedalert.text}}
</v-snackbar>
<!-- <v-alert
:color=feedalert.color
:icon=feedalert.ico
theme="dark"
@@ -14,7 +23,7 @@
density="compact"
>
</v-alert>
</v-alert> -->
</template>