События календаря

This commit is contained in:
iriska-gri committed 2024-04-18 16:33:08 +03:00
1 parent 46bfe0213b
commit 79a62561c5
2 files changed
+129 -53

No files matched your search

+91 -4
View File
@@ -2,12 +2,55 @@
<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">
<vue-cal <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
events-count-on-year-view
editable-events
show-all-day-events
:events="events"
:on-event-click="onEventClick"
@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
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"
@@ -34,7 +77,7 @@
</template> </template>
</v-tooltip> </v-tooltip>
</template> </template>
</vue-cal> </vue-cal> -->
</v-card> </v-card>
</v-col> </v-col>
<v-col> <v-col>
@@ -54,6 +97,15 @@
active-view="day" active-view="day"
:disable-views="['years', 'year', 'month', 'week']" :disable-views="['years', 'year', 'month', 'week']"
:selected-date="selectedDate" :selected-date="selectedDate"
: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' }
)"
> >
<template #arrow-prev> <template #arrow-prev>
<v-icon icon="mdi-menu-left"></v-icon> <v-icon icon="mdi-menu-left"></v-icon>
@@ -78,7 +130,42 @@ export default {
components: { VueCal }, components: { VueCal },
setup() { setup() {
const events = ref([]); const selectedEvent= ref({})
const showDialog =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'
}
])
const onEventClick = (event, e) => {
selectedEvent.value = event
console.log(event, e, '1111111111111');
showDialog.value = true
e.stopPropagation()
}
function f_generalvacation() { function f_generalvacation() {
axiosApiInstance axiosApiInstance
.get("api/calendar_of_events/calendarEvents/") .get("api/calendar_of_events/calendarEvents/")
@@ -116,7 +203,7 @@ export default {
return mess; return mess;
} }
return { events, selectedDate, f_generalvacation, dayformat }; return {selectedEvent, events, selectedDate, f_generalvacation, dayformat, showDialog, onEventClick };
}, },
}; };
</script> </script>
@@ -1,25 +1,32 @@
<template> <template>
<div> <div>
<!-- <my-helper :pretext="kl" /> --> <!-- <my-helper :pretext="kl" /> -->
<v-btn @click="useICalReader"> ical</v-btn> <v-btn @click="useICalReader"> ical</v-btn>
</div> </div>
</template> </template>
<script> <script>
// import {useICalReader} from '@/utils/universal_functions' // import {useICalReader} from '@/utils/universal_functions'
import { baseURL, axiosApiInstance } from '@/utils/axios-api' import { baseURL, axiosApiInstance } from "@/utils/axios-api";
import { ref } from 'vue'; import { ref } from "vue";
import ical from "ical.js"; import ical from "ical.js";
import { formatDash } from '@/utils/universal_functions' import { formatDash } from "@/utils/universal_functions";
const burl = baseURL.slice(0,-1) const burl = baseURL.slice(0, -1);
export default { export default {
setup() { setup() {
const participant = ref('')
const calendar = ref('')
const participant = ref("");
const calendar = ref("");
const useICalReader = async () => { const useICalReader = async () => {
const response = await fetch(`${burl}/media/ical/calendar.ics`); const response = await fetch(`${burl}/media/ical/calendar.ics`);
const data = await response.text(); const data = await response.text();
@@ -39,50 +46,32 @@ export default {
start: event.startDate.toJSDate(), start: event.startDate.toJSDate(),
end: event.endDate.toJSDate(), end: event.endDate.toJSDate(),
location: event.location, location: event.location,
attendees: event.attendees attendees: event.attendees,
} };
}) });
participant.value = name participant.value = name;
calendar.value = calendarEvents calendar.value = calendarEvents;
console.log(name, 'name') console.log(name, "name");
console.log(calendarEvents, 'calendarEventse') console.log(calendarEvents, "calendarEventse");
f_feedbackdata() 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() { function f_feedbackdata() {
axiosApiInstance.post(`api/calendar_of_events/calendarEvents/`, { axiosApiInstance
participants: participant.value, .post(`api/calendar_of_events/calendarEvents/`, {
calendar: calendar.value participants: participant.value,
}) calendar: calendar.value,
.then(data => { })
console.log(data,'datas') .then((data) => {
} console.log(data, "datas");
) });
} }
return { return {
useICalReader useICalReader, selectedEvent
} };
},
} };
}
</script> </script>
<style> <style></style>
</style>