Создание события
This commit is contained in:
1 parent
efeca2d1ef
commit
d6623fbec0
3 files changed
+286
-114
No files matched your search
@@ -5,7 +5,7 @@
|
||||
<v-img :src="checkremote(`${spravURL}${x}.jpg`)" @click="whatuser(x)" />
|
||||
</v-avatar>
|
||||
</v-btn>
|
||||
<info-user-card
|
||||
<info-user-card
|
||||
:author="author"
|
||||
:opendialog="open"
|
||||
@update:opendialog="open = $event"
|
||||
|
||||
@@ -3,51 +3,74 @@
|
||||
<v-col class="flex-column pr-0">
|
||||
<v-card class="h-100">
|
||||
<my-helper :pretext="selectedEvent" />
|
||||
<!-- <vue-cal
|
||||
selected-date="2024-04-01"
|
||||
:time-from="9 * 60"
|
||||
:time-to="19 * 60"
|
||||
:disable-views="['years', 'year']"
|
||||
hide-weekends
|
||||
:events="events"
|
||||
:on-event-click="onEventClick"
|
||||
@cell-focus="selectedDate = $event">
|
||||
</vue-cal> -->
|
||||
|
||||
<vue-cal
|
||||
selected-date="2024-04-01"
|
||||
:time-from="8 * 60"
|
||||
:time-to="23 * 60"
|
||||
hide-weekends
|
||||
hide-view-selector
|
||||
events-count-on-year-view
|
||||
editable-events
|
||||
show-all-day-events
|
||||
xsmall
|
||||
locale="ru"
|
||||
:events="events"
|
||||
:on-event-click="onEventClick"
|
||||
:disable-views="['years', 'year', 'week', 'day']"
|
||||
@cell-focus="selectedDate = $event">
|
||||
</vue-cal>
|
||||
<v-dialog v-model="showDialog">
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<v-icon>{{ selectedEvent.icon }}</v-icon>
|
||||
<span>{{ selectedEvent.title }}</span>
|
||||
<v-spacer/>
|
||||
<strong>{{ selectedEvent.start && selectedEvent.start.format('DD/MM/YYYY') }}</strong>
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<p v-html="selectedEvent.contentFull" />
|
||||
<strong>Event details:</strong>
|
||||
<ul>
|
||||
<li>Event starts at: {{ selectedEvent.start && selectedEvent.start.formatTime() }}</li>
|
||||
<li>Event ends at: {{ selectedEvent.end && selectedEvent.end.formatTime() }}</li>
|
||||
</ul>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<vue-cal
|
||||
:selected-date="new Date()"
|
||||
:time-from="8 * 60"
|
||||
:time-to="23 * 60"
|
||||
hide-weekends
|
||||
hide-view-selector
|
||||
events-count-on-year-view
|
||||
editable-events
|
||||
show-all-day-events
|
||||
xsmall
|
||||
locale="ru"
|
||||
:events="events"
|
||||
:on-event-click="onEventClick"
|
||||
active-view="month"
|
||||
:disable-views="['years', 'year', 'week', 'day']"
|
||||
@cell-focus="selectedDate = $event"
|
||||
@event-drag-create="showEventCreationDialog = true"
|
||||
/>
|
||||
|
||||
<event-dialog
|
||||
:event="selectedEvent"
|
||||
:opendialog="showDialog"
|
||||
@update:opendialog="showDialog = $event"
|
||||
/>
|
||||
|
||||
<v-dialog
|
||||
v-model="showEventCreationDialog"
|
||||
:persistent="true"
|
||||
max-width="420"
|
||||
>
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-input
|
||||
v-model="selectedEvent.title"
|
||||
label="Event Title"
|
||||
/>
|
||||
<v-textarea
|
||||
v-model="selectedEvent.content"
|
||||
placeholder="Event Content"
|
||||
/>
|
||||
<v-textarea
|
||||
v-model="selectedEvent.content"
|
||||
placeholder="Event Content"
|
||||
/>
|
||||
<v-flex>
|
||||
<v-select
|
||||
:items="eventsCssClasses"
|
||||
placeholder="Event CSS Class"
|
||||
@change="selectedEvent.class = $event"
|
||||
:value="selectedEvent.class"
|
||||
/>
|
||||
<v-switch
|
||||
v-model="selectedEvent.background"
|
||||
label="background Event"
|
||||
/>
|
||||
</v-flex>
|
||||
<v-flex>
|
||||
<v-btn @click="cancelEventCreation()">Cancel</v-btn>
|
||||
<v-btn @click="closeCreationDialog()">Save</v-btn>
|
||||
</v-flex>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
<!-- <vue-cal
|
||||
locale="ru"
|
||||
xsmall
|
||||
@@ -89,10 +112,33 @@
|
||||
<v-card-title class="text-center"
|
||||
>События на {{ dayformat(selectedDate) }}</v-card-title
|
||||
>
|
||||
<!-- editable-events -->
|
||||
<vue-cal
|
||||
locale="ru"
|
||||
hideTitleBar
|
||||
split
|
||||
header-format="DD"
|
||||
active-view="day"
|
||||
:disable-views="['years', 'year', 'month', 'week']"
|
||||
:selected-date="selectedDate"
|
||||
small
|
||||
:time-from="8 * 60"
|
||||
:time-to="20 * 60"
|
||||
hide-view-selector
|
||||
hide-title-bar
|
||||
hide-weekends
|
||||
|
||||
:events="events"
|
||||
:on-event-create="onEventCreate"
|
||||
:on-event-click="onEventClick"
|
||||
@event-drag-create="showEventCreationDialog = true"
|
||||
>
|
||||
</vue-cal>
|
||||
<!-- <vue-cal
|
||||
locale="ru"
|
||||
xsmall
|
||||
:time="false"
|
||||
:time-from="8 * 60"
|
||||
:time-to="20 * 60"
|
||||
hide-view-selector
|
||||
hideTitleBar
|
||||
split
|
||||
@@ -101,15 +147,15 @@
|
||||
active-view="day"
|
||||
:disable-views="['years', 'year', 'month', 'week']"
|
||||
:selected-date="selectedDate"
|
||||
:time="false"
|
||||
:cell-click-hold="false"
|
||||
:drag-to-create-event="false"
|
||||
editable-events
|
||||
:on-event-click="onEventClick"
|
||||
@cell-dblclick="$refs.vuecal.createEvent(
|
||||
$event,
|
||||
120,
|
||||
{ title: 'New Event', class: 'blue-event' }
|
||||
)"
|
||||
@event-drag-create="showEventCreationDialog = true"
|
||||
:on-event-create="onEventCreate"
|
||||
|
||||
|
||||
>
|
||||
<template #arrow-prev>
|
||||
<v-icon icon="mdi-menu-left"></v-icon>
|
||||
@@ -118,55 +164,81 @@
|
||||
<v-icon icon="mdi-menu-right"></v-icon>
|
||||
</template>
|
||||
<template #today-button> </template>
|
||||
</vue-cal>
|
||||
</vue-cal> -->
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
|
||||
<!-- @cell-dblclick="
|
||||
$refs.vuecal.createEvent($event, 120, {
|
||||
title: 'New Event',
|
||||
class: 'blue-event',
|
||||
})
|
||||
" -->
|
||||
<script>
|
||||
import VueCal from "vue-cal";
|
||||
import "vue-cal/dist/vuecal.css";
|
||||
import { ref } from "vue";
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
import {formaDashTime} from '@/utils/universal_functions'
|
||||
import { formaDashTime } from "@/utils/universal_functions";
|
||||
import EventDialog from "@/components/calendar_of_events/event-dialog.vue";
|
||||
export default {
|
||||
components: { VueCal },
|
||||
components: { VueCal, EventDialog },
|
||||
|
||||
setup() {
|
||||
const selectedEvent= ref({})
|
||||
const showDialog =ref(false)
|
||||
|
||||
const selectedEvent = ref({});
|
||||
const selectedEventCreate = ref(null);
|
||||
const eventsCssClasses = ["bg-red", "bg-blue", "bg-green"];
|
||||
const showDialog = ref(false);
|
||||
const showEventCreationDialog = ref(false);
|
||||
const events = ref([
|
||||
// {
|
||||
// start: '2024-04-15 14:00',
|
||||
// end: '2024-04-25 18:00',
|
||||
// title: 'Need to go shopping',
|
||||
// icon: 'shopping_cart', // Custom attribute.
|
||||
// content: 'Click to see my shopping list',
|
||||
// contentFull: 'My shopping list is rather long:<br><ul><li>Avocados</li><li>Tomatoes</li><li>Potatoes</li><li>Mangoes</li></ul>', // Custom attribute.
|
||||
// class: 'leisure',
|
||||
// repeat: {
|
||||
// every: 'week', // You can repeat on multiple days of the week.
|
||||
// until: '2024-05-30' // Don't need a time here as it will take the same as original event date.
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// start: '2024-04-15 10:00',
|
||||
// end: '2024-04-25 15:00',
|
||||
// title: 'Golf with John',
|
||||
// icon: 'golf_course', // Custom attribute.
|
||||
// content: 'Do I need to tell how many holes?',
|
||||
// contentFull: 'Okay.<br>It will be a 18 hole golf course.', // Custom attribute.
|
||||
// class: 'sport'
|
||||
// }
|
||||
])
|
||||
// {
|
||||
// start: '2024-04-15 14:00',
|
||||
// end: '2024-04-25 18:00',
|
||||
// title: 'Need to go shopping',
|
||||
// icon: 'shopping_cart', // Custom attribute.
|
||||
// content: 'Click to see my shopping list',
|
||||
// contentFull: 'My shopping list is rather long:<br><ul><li>Avocados</li><li>Tomatoes</li><li>Potatoes</li><li>Mangoes</li></ul>', // Custom attribute.
|
||||
// class: 'leisure',
|
||||
// repeat: {
|
||||
// every: 'week', // You can repeat on multiple days of the week.
|
||||
// until: '2024-05-30' // Don't need a time here as it will take the same as original event date.
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// start: '2024-04-15 10:00',
|
||||
// end: '2024-04-25 15:00',
|
||||
// title: 'Golf with John',
|
||||
// icon: 'golf_course', // Custom attribute.
|
||||
// content: 'Do I need to tell how many holes?',
|
||||
// contentFull: 'Okay.<br>It will be a 18 hole golf course.', // Custom attribute.
|
||||
// class: 'sport'
|
||||
// }
|
||||
]);
|
||||
|
||||
const onEventClick = (event, e) => {
|
||||
selectedEvent.value = event
|
||||
showDialog.value = true
|
||||
e.stopPropagation()
|
||||
}
|
||||
selectedEvent.value = event;
|
||||
showDialog.value = true;
|
||||
e.stopPropagation();
|
||||
};
|
||||
|
||||
const onEventCreate = (event, deleteEventFunction) => {
|
||||
console.log(event, deleteEventFunction, 'event, deleteEventFunction')
|
||||
selectedEvent.value = event;
|
||||
showEventCreationDialog.value = true;
|
||||
deleteEventFunction.value = deleteEventFunction;
|
||||
|
||||
return event;
|
||||
};
|
||||
|
||||
const cancelEventCreation = () => {
|
||||
closeCreationDialog();
|
||||
deleteEventFunction();
|
||||
};
|
||||
const closeCreationDialog = () => {
|
||||
showEventCreationDialog.value = false;
|
||||
selectedEvent.value = {};
|
||||
};
|
||||
|
||||
function f_generalvacation() {
|
||||
axiosApiInstance
|
||||
@@ -174,30 +246,34 @@ export default {
|
||||
.then((data) => {
|
||||
for (let x in data.data[0].event) {
|
||||
events.value.push({
|
||||
start: formaDashTime(data.data[0].event[x].cdate),
|
||||
end: formaDashTime(data.data[0].event[x].enddate),
|
||||
title: data.data[0].event[x].name,
|
||||
contentFull: data.data[0].event[x].description,
|
||||
});
|
||||
console.log(formaDashTime(data.data[0].event[x].cdate), 'data.data[0].event[x]')
|
||||
console.log(data.data[0].event[x], 'xxxxxxxxxx')
|
||||
start: formaDashTime(data.data[0].event[x].cdate),
|
||||
end: formaDashTime(data.data[0].event[x].enddate),
|
||||
title: data.data[0].event[x].name,
|
||||
contentFull: data.data[0].event[x].description,
|
||||
icon: "mdi-book-open",
|
||||
class: "bg-indigo-lighten-5 border-sm",
|
||||
});
|
||||
// console.log(
|
||||
// formaDashTime(data.data[0].event[x].cdate),
|
||||
// "data.data[0].event[x]"
|
||||
// );
|
||||
// console.log(data.data[0].event[x], "xxxxxxxxxx");
|
||||
}
|
||||
|
||||
|
||||
// {
|
||||
// start: '2024-04-15 14:00',
|
||||
// end: '2024-04-25 18:00',
|
||||
// title: 'Need to go shopping',
|
||||
// icon: 'shopping_cart', // Custom attribute.
|
||||
// content: 'Click to see my shopping list',
|
||||
// contentFull: 'My shopping list is rather long:<br><ul><li>Avocados</li><li>Tomatoes</li><li>Potatoes</li><li>Mangoes</li></ul>', // Custom attribute.
|
||||
// class: 'leisure',
|
||||
// repeat: {
|
||||
// every: 'week', // You can repeat on multiple days of the week.
|
||||
// until: '2024-05-30' // Don't need a time here as it will take the same as original event date.
|
||||
// }
|
||||
console.log(data.data, 'dataaaaaaaaaaaaa');
|
||||
})
|
||||
// {
|
||||
// start: '2024-04-15 14:00',
|
||||
// end: '2024-04-25 18:00',
|
||||
// title: 'Need to go shopping',
|
||||
// icon: 'shopping_cart', // Custom attribute.
|
||||
// content: 'Click to see my shopping list',
|
||||
// contentFull: 'My shopping list is rather long:<br><ul><li>Avocados</li><li>Tomatoes</li><li>Potatoes</li><li>Mangoes</li></ul>', // Custom attribute.
|
||||
// class: 'leisure',
|
||||
// repeat: {
|
||||
// every: 'week', // You can repeat on multiple days of the week.
|
||||
// until: '2024-05-30' // Don't need a time here as it will take the same as original event date.
|
||||
// }
|
||||
// console.log(data.data, "dataaaaaaaaaaaaa");
|
||||
});
|
||||
// for (let x in data.data) {
|
||||
// if (x == "План-график") {
|
||||
// data.data[x].map((e) => {
|
||||
@@ -213,9 +289,7 @@ export default {
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
f_generalvacation();
|
||||
|
||||
f_generalvacation();
|
||||
|
||||
const selectedDate = ref(null);
|
||||
|
||||
@@ -229,7 +303,20 @@ export default {
|
||||
return mess;
|
||||
}
|
||||
|
||||
return {selectedEvent, events, selectedDate, f_generalvacation, dayformat, showDialog, onEventClick };
|
||||
return {
|
||||
selectedEvent,
|
||||
events,
|
||||
selectedDate,
|
||||
f_generalvacation,
|
||||
dayformat,
|
||||
showDialog,
|
||||
onEventClick,
|
||||
showEventCreationDialog,
|
||||
eventsCssClasses,
|
||||
onEventCreate,
|
||||
closeCreationDialog,
|
||||
cancelEventCreation,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -255,7 +342,7 @@ export default {
|
||||
|
||||
.vuecal__title-bar {
|
||||
background: var(--cards);
|
||||
/* background: linear-gradient(to top right, rgba(19,84,122,.8), rgba(128,208,199,.8)); */
|
||||
|
||||
}
|
||||
.vuecal__flex .vuecal__title {
|
||||
font-family: sans-serif;
|
||||
@@ -280,7 +367,7 @@ export default {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.vuecal__event {
|
||||
/* .vuecal__event {
|
||||
color: #666;
|
||||
background-color: transparent;
|
||||
padding: 10px;
|
||||
@@ -292,7 +379,7 @@ export default {
|
||||
transition: box-shadow 0.3s, left 0.3s, width 0.3s;
|
||||
overflow: hidden;
|
||||
text-align: justify;
|
||||
}
|
||||
} */
|
||||
|
||||
.vuecal--rounded-theme .vuecal__cell-content {
|
||||
width: 30px;
|
||||
@@ -335,4 +422,25 @@ export default {
|
||||
background-color: #3a97694a;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.vuecal__event {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.vuecal__event-title {
|
||||
font-size: 1.2em;
|
||||
font-weight: bold;
|
||||
margin: 4px 0 8px;
|
||||
}
|
||||
|
||||
.vuecal__event-time {
|
||||
display: inline-block;
|
||||
margin-bottom: 12px;
|
||||
padding-bottom: 12px;
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.vuecal__event-content {
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<v-dialog v-model="mydialog" max-width="700">
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<v-icon color="indigo-darken-3" class="pb-1">{{ event.icon }}</v-icon>
|
||||
<v-text-field
|
||||
v-model="event.title"
|
||||
placeholder="Заголовок"
|
||||
/>
|
||||
<span class="pl-3"> {{ event.title }}</span>
|
||||
|
||||
<v-icon :icon="mdi-pencil" color="indigo-darken-3" class="pb-1" />
|
||||
</v-card-title>
|
||||
<v-card-subtitle>
|
||||
<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>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { computed } from "vue";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
opendialog: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
|
||||
event: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
},
|
||||
|
||||
setup(props, { emit }) {
|
||||
const mydialog = computed({
|
||||
get: () => props.opendialog,
|
||||
set: (value) => emit("update:opendialog", value),
|
||||
});
|
||||
|
||||
return {
|
||||
mydialog,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
Reference in new issue
Block a user