P-38
This commit is contained in:
1 parent
bf3766e6d5
commit
5e462e9e35
7 files changed
+201
-166
No files matched your search
Generated
+4
-4
@@ -43,7 +43,7 @@
|
|||||||
"vue-router": "^4.0.0",
|
"vue-router": "^4.0.0",
|
||||||
"vue3-autocounter": "^1.0.6",
|
"vue3-autocounter": "^1.0.6",
|
||||||
"vuelidate": "^0.7.7",
|
"vuelidate": "^0.7.7",
|
||||||
"vuetify": "^3.6.6",
|
"vuetify": "^3.6.7",
|
||||||
"webfontloader": "^1.0.0",
|
"webfontloader": "^1.0.0",
|
||||||
"yup": "^1.4.0"
|
"yup": "^1.4.0"
|
||||||
},
|
},
|
||||||
@@ -21709,9 +21709,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/vuetify": {
|
"node_modules/vuetify": {
|
||||||
"version": "3.6.6",
|
"version": "3.6.7",
|
||||||
"resolved": "https://registry.npmjs.org/vuetify/-/vuetify-3.6.6.tgz",
|
"resolved": "https://registry.npmjs.org/vuetify/-/vuetify-3.6.7.tgz",
|
||||||
"integrity": "sha512-7RkL0kuLsVUbc0YCwhPhVq54gSFKt5xv+SOrF01dxwJz7Ke3tAbvO616WhhQIfS78h1q/Ev952WJj5jpsdK58g==",
|
"integrity": "sha512-oj7zrNbjKFlSS38449K9/ad9mc/o25bxuTFT9rs2AtSNnOA+BOLIVJCAPlmLGWoQGslPh80RzckXDedoifs+TQ==",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^12.20 || >=14.13"
|
"node": "^12.20 || >=14.13"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
"vue-router": "^4.0.0",
|
"vue-router": "^4.0.0",
|
||||||
"vue3-autocounter": "^1.0.6",
|
"vue3-autocounter": "^1.0.6",
|
||||||
"vuelidate": "^0.7.7",
|
"vuelidate": "^0.7.7",
|
||||||
"vuetify": "^3.6.6",
|
"vuetify": "^3.6.7",
|
||||||
"webfontloader": "^1.0.0",
|
"webfontloader": "^1.0.0",
|
||||||
"yup": "^1.4.0"
|
"yup": "^1.4.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,70 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<!-- <my-helper :pretext="kl" /> -->
|
|
||||||
<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 ical from "ical.js";
|
|
||||||
|
|
||||||
const burl = baseURL.slice(0, -1);
|
|
||||||
|
|
||||||
export default {
|
|
||||||
setup() {
|
|
||||||
const participant = ref("");
|
|
||||||
const calendar = ref("");
|
|
||||||
const useICalReader = async () => {
|
|
||||||
const response = await fetch(`${burl}/media/ical/calendar.ics`);
|
|
||||||
const data = await response.text();
|
|
||||||
const jcalData = ical.parse(data);
|
|
||||||
const icalComponent = new ical.Component(jcalData);
|
|
||||||
const name = icalComponent.getFirstPropertyValue("x-wr-calname");
|
|
||||||
|
|
||||||
const events = icalComponent
|
|
||||||
.getAllSubcomponents("vevent")
|
|
||||||
.map((vevent) => new ical.Event(vevent));
|
|
||||||
|
|
||||||
const calendarEvents = events.map((event) => {
|
|
||||||
let attendees = [];
|
|
||||||
event.attendees.map((att) => {
|
|
||||||
attendees.push(att.jCal[1].cn);
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
|
||||||
summary: event.summary,
|
|
||||||
description: event.description,
|
|
||||||
organizer: event.organizer,
|
|
||||||
start: event.startDate.toJSDate(),
|
|
||||||
end: event.endDate.toJSDate(),
|
|
||||||
location: event.location,
|
|
||||||
attendees: attendees,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
participant.value = name;
|
|
||||||
calendar.value = calendarEvents;
|
|
||||||
f_feedbackdata();
|
|
||||||
};
|
|
||||||
|
|
||||||
function f_feedbackdata() {
|
|
||||||
axiosApiInstance
|
|
||||||
.post(`api/calendar_of_events/calendarEvents/`, {
|
|
||||||
participants: participant.value,
|
|
||||||
calendar: calendar.value,
|
|
||||||
})
|
|
||||||
.then((data) => {
|
|
||||||
console.log(data, "datas");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
useICalReader,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style></style>
|
|
||||||
@@ -1,104 +1,105 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<my-helper :pretext="events" />
|
<v-btn @click="f_feedbackdata"> ical</v-btn>
|
||||||
<v-sheet
|
|
||||||
class="d-flex"
|
<v-file-input
|
||||||
height="54"
|
:show-size="1000"
|
||||||
tile
|
color="deep-purple-accent-4"
|
||||||
>
|
label="File input"
|
||||||
<v-select
|
placeholder="Select your files"
|
||||||
v-model="type"
|
prepend-icon="mdi-paperclip"
|
||||||
:items="types"
|
|
||||||
class="ma-2"
|
|
||||||
label="View Mode"
|
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
dense
|
counter
|
||||||
hide-details
|
multiple
|
||||||
></v-select>
|
accept=".ics"
|
||||||
<v-select
|
@input="handleFilesUpload"
|
||||||
v-model="weekday"
|
/>
|
||||||
:items="weekdays"
|
|
||||||
class="ma-2"
|
|
||||||
label="weekdays"
|
|
||||||
variant="outlined"
|
|
||||||
dense
|
|
||||||
hide-details
|
|
||||||
></v-select>
|
|
||||||
</v-sheet>
|
|
||||||
<v-sheet>
|
|
||||||
<v-calendar
|
|
||||||
ref="calendar"
|
|
||||||
v-model="value"
|
|
||||||
:events="events"
|
|
||||||
:view-mode="type"
|
|
||||||
:weekdays="weekday"
|
|
||||||
></v-calendar>
|
|
||||||
</v-sheet>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { useDate } from 'vuetify'
|
import { axiosApiInstance } from "@/utils/axios-api";
|
||||||
import myHelper from '../UI/my-helper.vue'
|
import { ref, computed } from "vue";
|
||||||
|
import ical from "ical.js";
|
||||||
|
|
||||||
|
// const burl = baseURL.slice(0, -1);
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { myHelper },
|
setup() {
|
||||||
data: () => ({
|
|
||||||
type: 'month',
|
|
||||||
types: ['month', 'week', 'day'],
|
|
||||||
weekday: [0, 1, 2, 3, 4, 5, 6],
|
|
||||||
weekdays: [
|
|
||||||
{ title: 'Sun - Sat', value: [0, 1, 2, 3, 4, 5, 6] },
|
|
||||||
{ title: 'Mon - Sun', value: [1, 2, 3, 4, 5, 6, 0] },
|
|
||||||
{ title: 'Mon - Fri', value: [1, 2, 3, 4, 5] },
|
|
||||||
{ title: 'Mon, Wed, Fri', value: [1, 3, 5] },
|
|
||||||
],
|
|
||||||
value: [new Date()],
|
|
||||||
events: [],
|
|
||||||
colors: ['blue', 'indigo', 'deep-purple', 'cyan', 'green', 'orange', 'grey darken-1'],
|
|
||||||
titles: ['Meeting', 'Holiday', 'PTO', 'Travel', 'Event', 'Birthday', 'Conference', 'Party'],
|
|
||||||
}),
|
|
||||||
mounted () {
|
|
||||||
const adapter = useDate()
|
|
||||||
this.getEvents({ start: adapter.startOfDay(adapter.startOfMonth(new Date())), end: adapter.endOfDay(adapter.endOfMonth(new Date())) })
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
getEvents ({ start, end }) {
|
|
||||||
const events = []
|
|
||||||
|
|
||||||
const min = start
|
const participant = ref("");
|
||||||
const max = end
|
const calendar = ref("");
|
||||||
const days = (max.getTime() - min.getTime()) / 86400000
|
const calendarEvents = ref([]);
|
||||||
const eventCount = this.rnd(days, days + 20)
|
|
||||||
|
|
||||||
for (let i = 0; i < eventCount; i++) {
|
|
||||||
const allDay = this.rnd(0, 3) === 0
|
|
||||||
const firstTimestamp = this.rnd(min.getTime(), max.getTime())
|
|
||||||
const first = new Date(firstTimestamp - (firstTimestamp % 900000))
|
|
||||||
const secondTimestamp = this.rnd(2, allDay ? 288 : 8) * 900000
|
|
||||||
const second = new Date(first.getTime() + secondTimestamp)
|
|
||||||
|
|
||||||
events.push({
|
function f_feedbackdata() {
|
||||||
title: this.titles[this.rnd(0, this.titles.length - 1)],
|
|
||||||
start: first,
|
axiosApiInstance
|
||||||
end: second,
|
.post(`api/calendar_of_events/calendarEvents/`, {
|
||||||
color: this.colors[this.rnd(0, this.colors.length - 1)],
|
participants: participant.value,
|
||||||
allDay: !allDay,
|
calendar: calendar.value }).then((data) => {
|
||||||
|
console.log(data, "datas");
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
this.events = events
|
const handleFilesUpload = (event) => {
|
||||||
},
|
const file = event.target.files[0];
|
||||||
getEventColor (event) {
|
|
||||||
return event.color
|
if (file) {
|
||||||
},
|
readFile(file);
|
||||||
rnd (a, b) {
|
|
||||||
return Math.floor((b - a + 1) * Math.random()) + a
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const readFile = (file) => {
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.readAsText(file);
|
||||||
|
reader.onload = (event) => {
|
||||||
|
parseICS(event.target.result);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
const parseICS = (text) => {
|
||||||
|
const jcalData = ical.parse(text);
|
||||||
|
const icalComponent = new ical.Component(jcalData);
|
||||||
|
const name = icalComponent.getFirstPropertyValue("x-wr-calname");
|
||||||
|
|
||||||
|
const events = icalComponent
|
||||||
|
.getAllSubcomponents("vevent")
|
||||||
|
.map((vevent) => new ical.Event(vevent));
|
||||||
|
|
||||||
|
const calendarEvents = events.map((event) => {
|
||||||
|
let attendees = [];
|
||||||
|
event.attendees.map((att) => {
|
||||||
|
attendees.push(att.jCal[1].cn);
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
name: event.summary,
|
||||||
|
description: event.description,
|
||||||
|
// organizer: event.organizer, Может, удалить?
|
||||||
|
startdate: event.startDate.toJSDate(),
|
||||||
|
enddate: event.endDate.toJSDate(),
|
||||||
|
place: event.location,
|
||||||
|
// attendees: attendees, ? Такая же история 0 в базе нет
|
||||||
|
cdate: new Date(event.component.jCal[1][6][3]),
|
||||||
|
content: ''
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
participant.value = name;
|
||||||
|
calendar.value = calendarEvents;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
handleFilesUpload,
|
||||||
|
calendarEvents,
|
||||||
|
f_feedbackdata
|
||||||
|
};
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style></style>
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<v-btn @click="useICalReader"> ical</v-btn>
|
||||||
|
<my-helper :pretext="events" />
|
||||||
|
<v-sheet
|
||||||
|
class="d-flex"
|
||||||
|
height="54"
|
||||||
|
tile
|
||||||
|
>
|
||||||
|
<v-select
|
||||||
|
v-model="type"
|
||||||
|
:items="types"
|
||||||
|
class="ma-2"
|
||||||
|
label="View Mode"
|
||||||
|
variant="outlined"
|
||||||
|
dense
|
||||||
|
hide-details
|
||||||
|
></v-select>
|
||||||
|
<v-select
|
||||||
|
v-model="weekday"
|
||||||
|
:items="weekdays"
|
||||||
|
class="ma-2"
|
||||||
|
label="weekdays"
|
||||||
|
variant="outlined"
|
||||||
|
dense
|
||||||
|
hide-details
|
||||||
|
></v-select>
|
||||||
|
</v-sheet>
|
||||||
|
<v-sheet>
|
||||||
|
<v-calendar
|
||||||
|
ref="calendar"
|
||||||
|
v-model="value"
|
||||||
|
:events="events"
|
||||||
|
:view-mode="type"
|
||||||
|
:weekdays="weekday"
|
||||||
|
></v-calendar>
|
||||||
|
</v-sheet>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { useDate } from 'vuetify'
|
||||||
|
import myHelper from '../UI/my-helper.vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { myHelper },
|
||||||
|
data: () => ({
|
||||||
|
type: 'month',
|
||||||
|
types: ['month', 'week', 'day'],
|
||||||
|
weekday: [0, 1, 2, 3, 4, 5, 6],
|
||||||
|
weekdays: [
|
||||||
|
{ title: 'Sun - Sat', value: [0, 1, 2, 3, 4, 5, 6] },
|
||||||
|
{ title: 'Mon - Sun', value: [1, 2, 3, 4, 5, 6, 0] },
|
||||||
|
{ title: 'Mon - Fri', value: [1, 2, 3, 4, 5] },
|
||||||
|
{ title: 'Mon, Wed, Fri', value: [1, 3, 5] },
|
||||||
|
],
|
||||||
|
value: [new Date()],
|
||||||
|
events: [],
|
||||||
|
colors: ['blue', 'indigo', 'deep-purple', 'cyan', 'green', 'orange', 'grey darken-1'],
|
||||||
|
titles: ['Meeting', 'Holiday', 'PTO', 'Travel', 'Event', 'Birthday', 'Conference', 'Party'],
|
||||||
|
}),
|
||||||
|
mounted () {
|
||||||
|
const adapter = useDate()
|
||||||
|
this.getEvents({ start: adapter.startOfDay(adapter.startOfMonth(new Date())), end: adapter.endOfDay(adapter.endOfMonth(new Date())) })
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getEvents ({ start, end }) {
|
||||||
|
const events = []
|
||||||
|
|
||||||
|
const min = start
|
||||||
|
const max = end
|
||||||
|
const days = (max.getTime() - min.getTime()) / 86400000
|
||||||
|
const eventCount = this.rnd(days, days + 20)
|
||||||
|
|
||||||
|
for (let i = 0; i < eventCount; i++) {
|
||||||
|
const allDay = this.rnd(0, 3) === 0
|
||||||
|
const firstTimestamp = this.rnd(min.getTime(), max.getTime())
|
||||||
|
const first = new Date(firstTimestamp - (firstTimestamp % 900000))
|
||||||
|
const secondTimestamp = this.rnd(2, allDay ? 288 : 8) * 900000
|
||||||
|
const second = new Date(first.getTime() + secondTimestamp)
|
||||||
|
|
||||||
|
events.push({
|
||||||
|
title: this.titles[this.rnd(0, this.titles.length - 1)],
|
||||||
|
start: first,
|
||||||
|
end: second,
|
||||||
|
color: this.colors[this.rnd(0, this.colors.length - 1)],
|
||||||
|
allDay: !allDay,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
this.events = events
|
||||||
|
},
|
||||||
|
getEventColor (event) {
|
||||||
|
return event.color
|
||||||
|
},
|
||||||
|
rnd (a, b) {
|
||||||
|
return Math.floor((b - a + 1) * Math.random()) + a
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -8,14 +8,13 @@ import { ru } from 'vuetify/locale'
|
|||||||
import { VTimePicker } from 'vuetify/labs/VTimePicker'
|
import { VTimePicker } from 'vuetify/labs/VTimePicker'
|
||||||
|
|
||||||
export default createVuetify({
|
export default createVuetify({
|
||||||
components: {
|
|
||||||
VTimePicker,
|
|
||||||
},
|
|
||||||
locale: {
|
locale: {
|
||||||
messages: { ru },
|
messages: { ru },
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
VCalendar,
|
VCalendar,
|
||||||
|
VTimePicker,
|
||||||
},
|
},
|
||||||
theme: {
|
theme: {
|
||||||
defaultTheme: 'light'
|
defaultTheme: 'light'
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ export default {
|
|||||||
console.log(safetyData.value, "-------------------------------");
|
console.log(safetyData.value, "-------------------------------");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
getSafety()
|
||||||
onMounted(() => getSafety())
|
// onMounted(() => getSafety())
|
||||||
onUpdated(() => getSafety())
|
onUpdated(() => getSafety())
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in new issue
Block a user