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

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-col class="flex-column pr-0">
<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"
xsmall
:time="false"
hide-view-selector
:disable-views="['years', 'year', 'week', 'day']"
events-count-on-year-view
active-view="month"
:events="events"
@@ -34,7 +77,7 @@
</template>
</v-tooltip>
</template>
</vue-cal>
</vue-cal> -->
</v-card>
</v-col>
<v-col>
@@ -54,6 +97,15 @@
active-view="day"
:disable-views="['years', 'year', 'month', 'week']"
: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>
<v-icon icon="mdi-menu-left"></v-icon>
@@ -78,7 +130,42 @@ export default {
components: { VueCal },
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() {
axiosApiInstance
.get("api/calendar_of_events/calendarEvents/")
@@ -116,7 +203,7 @@ export default {
return mess;
}
return { events, selectedDate, f_generalvacation, dayformat };
return {selectedEvent, events, selectedDate, f_generalvacation, dayformat, showDialog, onEventClick };
},
};
</script>
@@ -1,25 +1,32 @@
<template>
<div>
<!-- <my-helper :pretext="kl" /> -->
<v-btn @click="useICalReader"> ical</v-btn>
<v-btn @click="useICalReader"> ical</v-btn>
</div>
</template>
<script>
// import {useICalReader} from '@/utils/universal_functions'
import { baseURL, axiosApiInstance } from '@/utils/axios-api'
import { ref } from 'vue';
import { baseURL, axiosApiInstance } from "@/utils/axios-api";
import { ref } from "vue";
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 {
setup() {
const participant = ref('')
const calendar = ref('')
const participant = ref("");
const calendar = ref("");
const useICalReader = async () => {
const response = await fetch(`${burl}/media/ical/calendar.ics`);
const data = await response.text();
@@ -39,50 +46,32 @@ export default {
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,
// }
}
attendees: event.attendees,
};
});
participant.value = name;
calendar.value = calendarEvents;
console.log(name, "name");
console.log(calendarEvents, "calendarEventse");
f_feedbackdata();
};
// 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')
}
)
axiosApiInstance
.post(`api/calendar_of_events/calendarEvents/`, {
participants: participant.value,
calendar: calendar.value,
})
.then((data) => {
console.log(data, "datas");
});
}
return {
useICalReader
}
}
}
useICalReader, selectedEvent
};
},
};
</script>
<style>
</style>
<style></style>