|
|
|
@ -1,130 +1,134 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<FullCalendar ref="cal" :options="calendarOptions"/> |
|
|
|
<FullCalendar |
|
|
|
|
|
|
|
ref="cal" |
|
|
|
|
|
|
|
:options="calendarOptions" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
<Loading :visible="isLoading"/> |
|
|
|
<Loading :visible="isLoading" /> |
|
|
|
|
|
|
|
|
|
|
|
<!-- Add form--> |
|
|
|
<!-- Add form--> |
|
|
|
<q-dialog v-model="dialog" persistent> |
|
|
|
<Dialog |
|
|
|
<q-card style="min-width: 800px"> |
|
|
|
v-model:visible="dialog" |
|
|
|
<q-card-section> |
|
|
|
:header="item['@id'] ? t('Edit event') : t('Add event')" |
|
|
|
<div class="text-h6">{{ item['@id'] ? $t('Edit event') : $t('Add event') }}</div> |
|
|
|
:modal="true" |
|
|
|
</q-card-section> |
|
|
|
> |
|
|
|
|
|
|
|
|
|
|
|
<q-card-section class="q-pt-none"> |
|
|
|
|
|
|
|
<CCalendarEventForm |
|
|
|
<CCalendarEventForm |
|
|
|
v-if="dialog" |
|
|
|
v-if="dialog" |
|
|
|
ref="createForm" |
|
|
|
ref="createForm" |
|
|
|
:values="item" |
|
|
|
:values="item" |
|
|
|
> |
|
|
|
/> |
|
|
|
</CCalendarEventForm> |
|
|
|
<template #footer> |
|
|
|
</q-card-section> |
|
|
|
<Button |
|
|
|
|
|
|
|
:label="t('Cancel')" |
|
|
|
<q-card-actions align="right" class="text-primary"> |
|
|
|
class="p-button-outlined p-button-plain" |
|
|
|
<q-btn v-close-popup flat :label="$t('Cancel')" /> |
|
|
|
icon="pi pi-times" |
|
|
|
<q-btn :label="item['@id'] ? $t('Edit') : $t('Add') " flat @click="onCreateEventForm"/> |
|
|
|
@click="dialog = false" |
|
|
|
</q-card-actions> |
|
|
|
/> |
|
|
|
</q-card> |
|
|
|
<Button |
|
|
|
</q-dialog> |
|
|
|
:label="item['@id'] ? t('Edit') : t('Add')" |
|
|
|
|
|
|
|
class="p-button-secondary" |
|
|
|
|
|
|
|
@click="onCreateEventForm" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
</Dialog> |
|
|
|
|
|
|
|
|
|
|
|
<!-- Show form--> |
|
|
|
<!-- Show form--> |
|
|
|
<q-dialog v-model="dialogShow" persistent> |
|
|
|
<Dialog |
|
|
|
<q-card style="min-width: 500px"> |
|
|
|
v-model:visible="dialogShow" |
|
|
|
<q-card-section> |
|
|
|
:header="t('Event')" |
|
|
|
|
|
|
|
:modal="true" |
|
|
|
|
|
|
|
> |
|
|
|
<CCalendarEventInfo :event="item" /> |
|
|
|
<CCalendarEventInfo :event="item" /> |
|
|
|
</q-card-section> |
|
|
|
|
|
|
|
<q-card-actions align="right" class="text-primary"> |
|
|
|
<template #footer> |
|
|
|
<q-btn color="primary" flat no-caps :label="$t('Delete')" @click="confirmDelete"/> |
|
|
|
<Button |
|
|
|
<q-btn v-if="isEventEditable" color="primary" flat no-caps :label="$t('Edit')" @click="dialog = true"/> |
|
|
|
:label="t('Cancel')" |
|
|
|
<q-btn v-close-popup flat no-caps :label="$t('Close')" /> |
|
|
|
class="p-button-outlined p-button-plain" |
|
|
|
</q-card-actions> |
|
|
|
icon="pi pi-times" |
|
|
|
</q-card> |
|
|
|
@click="dialogShow = false" |
|
|
|
</q-dialog> |
|
|
|
/> |
|
|
|
|
|
|
|
<Button |
|
|
|
|
|
|
|
:label="t('Delete')" |
|
|
|
|
|
|
|
class="p-button-outlined p-button-danger" |
|
|
|
|
|
|
|
icon="pi pi-trash" |
|
|
|
|
|
|
|
@click="confirmDelete" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
<Button |
|
|
|
|
|
|
|
v-if="isEventEditable" |
|
|
|
|
|
|
|
:label="t('Edit')" |
|
|
|
|
|
|
|
class="p-button-secondary" |
|
|
|
|
|
|
|
@click="dialog = true" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
</Dialog> |
|
|
|
|
|
|
|
|
|
|
|
<!-- Show form--> |
|
|
|
<!-- Show form--> |
|
|
|
<q-dialog v-model="showSessionDialog"> |
|
|
|
<Dialog |
|
|
|
<q-card> |
|
|
|
v-model:visible="sessionState.showSessionDialog" |
|
|
|
<q-card-section class="row items-center q-pb-none" icon="mdi-book-open"> |
|
|
|
:header="t('Session')" |
|
|
|
<div class="text-h6">{{ sessionAsEvent.title }}</div> |
|
|
|
:modal="true" |
|
|
|
<q-space/> |
|
|
|
> |
|
|
|
<q-btn v-close-popup dense flat icon="close" round/> |
|
|
|
<div class="flex flex-col gap-4"> |
|
|
|
</q-card-section> |
|
|
|
<h5>{{ sessionState.sessionAsEvent.title }}</h5> |
|
|
|
|
|
|
|
<p |
|
|
|
<q-card-section> |
|
|
|
v-if="sessionState.sessionAsEvent.start" |
|
|
|
<div v-if="sessionAsEvent.start"> |
|
|
|
v-t="{ path: 'From: {date}', args: { 'date': useAbbreviatedDatetime(sessionState.sessionAsEvent.start) } }" |
|
|
|
<q-icon name="event"/> |
|
|
|
/> |
|
|
|
{{ $t('From:') }} |
|
|
|
<p |
|
|
|
{{ $filters.abbreviatedDatetime(sessionAsEvent.start) }} |
|
|
|
v-if="sessionState.sessionAsEvent.end" |
|
|
|
|
|
|
|
v-t="{ path: 'Until: {date}', args: { 'date': useAbbreviatedDatetime(sessionState.sessionAsEvent.end) } }" |
|
|
|
|
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div v-if="sessionAsEvent.end"> |
|
|
|
<template #footer> |
|
|
|
<q-icon name="event"/> |
|
|
|
<a |
|
|
|
{{ $t('Until:') }} |
|
|
|
v-t="'Go to session'" |
|
|
|
{{ $filters.abbreviatedDatetime(sessionAsEvent.end) }} |
|
|
|
:href="`/sessions/${sessionState.sessionAsEvent.id}/about`" |
|
|
|
</div> |
|
|
|
class="btn btn--secondary" |
|
|
|
</q-card-section> |
|
|
|
/> |
|
|
|
<q-card-actions align="right" class="text-primary"> |
|
|
|
</template> |
|
|
|
<q-btn color="primary" flat :label="$t('Go to session')" type="a" |
|
|
|
</Dialog> |
|
|
|
:href="`/sessions/${sessionAsEvent.id}/about`" /> |
|
|
|
|
|
|
|
</q-card-actions> |
|
|
|
|
|
|
|
</q-card> |
|
|
|
|
|
|
|
</q-dialog> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script setup> |
|
|
|
import {mapActions, mapGetters, useStore} from 'vuex'; |
|
|
|
import { computed, inject, reactive, ref, watch } from 'vue'; |
|
|
|
import {mapFields} from 'vuex-map-fields'; |
|
|
|
import { useStore } from 'vuex'; |
|
|
|
import Loading from '../../components/Loading.vue'; |
|
|
|
import { useRoute } from 'vue-router'; |
|
|
|
import Toolbar from '../../components/Toolbar.vue'; |
|
|
|
import { useI18n } from 'vue-i18n'; |
|
|
|
import {computed, reactive, ref, toRefs, onMounted} from "vue"; |
|
|
|
import axios from 'axios'; |
|
|
|
|
|
|
|
import { useConfirm } from 'primevue/useconfirm'; |
|
|
|
|
|
|
|
import { useAbbreviatedDatetime } from '../../composables/formatDate.js'; |
|
|
|
|
|
|
|
|
|
|
|
//import '@fullcalendar/core/vdom' // solve problem with Vite |
|
|
|
import Loading from '../../components/Loading.vue'; |
|
|
|
import FullCalendar from '@fullcalendar/vue3'; |
|
|
|
import FullCalendar from '@fullcalendar/vue3'; |
|
|
|
import dayGridPlugin from '@fullcalendar/daygrid'; |
|
|
|
import dayGridPlugin from '@fullcalendar/daygrid'; |
|
|
|
import interactionPlugin from '@fullcalendar/interaction'; |
|
|
|
import interactionPlugin from '@fullcalendar/interaction'; |
|
|
|
import timeGridPlugin from '@fullcalendar/timegrid'; |
|
|
|
import timeGridPlugin from '@fullcalendar/timegrid'; |
|
|
|
import axios from "axios"; |
|
|
|
import CCalendarEventForm from '../../components/ccalendarevent/Form.vue'; |
|
|
|
import CCalendarEventForm from "../../components/ccalendarevent/Form.vue"; |
|
|
|
import CCalendarEventInfo from '../../components/ccalendarevent/Info'; |
|
|
|
import CreateMixin from "../../mixins/CreateMixin"; |
|
|
|
import { ENTRYPOINT } from '../../config/entrypoint'; |
|
|
|
import {useRoute, useRouter} from "vue-router"; |
|
|
|
|
|
|
|
import {useQuasar} from 'quasar'; |
|
|
|
|
|
|
|
import CCalendarEventInfo from "../../components/ccalendarevent/Info"; |
|
|
|
|
|
|
|
import {ENTRYPOINT} from "../../config/entrypoint"; |
|
|
|
|
|
|
|
import {useI18n} from "vue-i18n"; |
|
|
|
|
|
|
|
import allLocales from '@fullcalendar/core/locales-all'; |
|
|
|
import allLocales from '@fullcalendar/core/locales-all'; |
|
|
|
import toInteger from "lodash/toInteger"; |
|
|
|
import toInteger from 'lodash/toInteger'; |
|
|
|
const servicePrefix = 'CCalendarEvent'; |
|
|
|
import Dialog from 'primevue/dialog'; |
|
|
|
|
|
|
|
import Button from 'primevue/button'; |
|
|
|
export default { |
|
|
|
|
|
|
|
name: 'CCalendarEventList', |
|
|
|
|
|
|
|
components: { |
|
|
|
|
|
|
|
CCalendarEventInfo, |
|
|
|
|
|
|
|
CCalendarEventForm, |
|
|
|
|
|
|
|
Loading, |
|
|
|
|
|
|
|
Toolbar, |
|
|
|
|
|
|
|
FullCalendar |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mixins: [CreateMixin], |
|
|
|
const store = useStore(); |
|
|
|
//mixins: [ShowMixin], |
|
|
|
const route = useRoute(); |
|
|
|
setup() { |
|
|
|
const confirm = useConfirm(); |
|
|
|
const $q = useQuasar(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const calendarOptions = ref([]); |
|
|
|
const item = ref({}); |
|
|
|
const item = ref({}); |
|
|
|
const dialog = ref(false); |
|
|
|
const dialog = ref(false); |
|
|
|
const dialogShow = ref(false); |
|
|
|
const dialogShow = ref(false); |
|
|
|
const isEventEditable = ref(false); |
|
|
|
const isEventEditable = ref(false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const store = useStore(); |
|
|
|
const currentUser = computed(() => store.getters['security/getUser']); |
|
|
|
const route = useRoute(); |
|
|
|
const { t, locale } = useI18n(); |
|
|
|
const currentUser = computed(() => store.getters['security/getUser']); |
|
|
|
|
|
|
|
const { t, locale } = useI18n(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let currentEvent = null; |
|
|
|
let currentEvent = null; |
|
|
|
|
|
|
|
|
|
|
|
const sessionState = reactive({ |
|
|
|
const sessionState = reactive({ |
|
|
|
sessionAsEvent: { |
|
|
|
sessionAsEvent: { |
|
|
|
id: '', |
|
|
|
id: '', |
|
|
|
title: '', |
|
|
|
title: '', |
|
|
|
@ -133,69 +137,83 @@ export default { |
|
|
|
extendedProps: {}, |
|
|
|
extendedProps: {}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
showSessionDialog: false |
|
|
|
showSessionDialog: false |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const cid = toInteger(route.query.cid); |
|
|
|
const cid = toInteger(route.query.cid); |
|
|
|
const sid = toInteger(route.query.sid); |
|
|
|
const sid = toInteger(route.query.sid); |
|
|
|
const gid = toInteger(route.query.gid); |
|
|
|
const gid = toInteger(route.query.gid); |
|
|
|
|
|
|
|
|
|
|
|
if (cid) { |
|
|
|
if (cid) { |
|
|
|
let courseIri = '/api/courses/' + cid; |
|
|
|
let courseIri = '/api/courses/' + cid; |
|
|
|
store.dispatch('course/findCourse', { id: courseIri }); |
|
|
|
store.dispatch('course/findCourse', { id: courseIri }); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function onCreated(item) { |
|
|
|
async function getCalendarEvents ({ startStr, endStr }) { |
|
|
|
//showNotification(t('Updated')); |
|
|
|
const calendarEvents = await axios.get( |
|
|
|
reFetch(); |
|
|
|
ENTRYPOINT + 'c_calendar_events', |
|
|
|
} |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
async function getCalendarEvents({startStr, endStr}) { |
|
|
|
|
|
|
|
const calendarEvents = await axios.get(ENTRYPOINT + 'c_calendar_events', { |
|
|
|
|
|
|
|
params: { |
|
|
|
params: { |
|
|
|
'startDate': startStr, |
|
|
|
'startDate': startStr, |
|
|
|
'endDate': endStr, |
|
|
|
'endDate': endStr, |
|
|
|
// 'startDate[after]': startStr, |
|
|
|
// 'startDate[after]': startStr, |
|
|
|
// 'startDate[before]': startStr, |
|
|
|
// 'startDate[before]': startStr, |
|
|
|
//'startDate[between]': startStr+'..'+endStr, |
|
|
|
//'startDate[between]': startStr+'..'+endStr, |
|
|
|
'cid': cid, |
|
|
|
'cid': cid, |
|
|
|
'sid': sid, |
|
|
|
'sid': sid, |
|
|
|
'gid': gid, |
|
|
|
'gid': gid, |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return calendarEvents.data['hydra:member']; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
async function getSessions({startStr, endStr}) { |
|
|
|
return calendarEvents.data['hydra:member'].map(event => ({ |
|
|
|
|
|
|
|
...event, |
|
|
|
|
|
|
|
start: event.startDate, |
|
|
|
|
|
|
|
end: event.endDate, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function getSessions ({ startStr, endStr }) { |
|
|
|
if ('true' !== window.config['agenda.personal_calendar_show_sessions_occupation']) { |
|
|
|
if ('true' !== window.config['agenda.personal_calendar_show_sessions_occupation']) { |
|
|
|
return []; |
|
|
|
return []; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const sessions = await axios.get(ENTRYPOINT + `users/${currentUser.value['id']}/sessions_rel_users`, { |
|
|
|
const sessions = await axios.get( |
|
|
|
|
|
|
|
ENTRYPOINT + `session_rel_users`, |
|
|
|
|
|
|
|
{ |
|
|
|
params: { |
|
|
|
params: { |
|
|
|
|
|
|
|
'user': currentUser.value['@id'], |
|
|
|
'displayStartDate[after]': startStr, |
|
|
|
'displayStartDate[after]': startStr, |
|
|
|
'displayEndDate[before]': endStr |
|
|
|
'displayEndDate[before]': endStr, |
|
|
|
|
|
|
|
'relationType': 3 |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return sessions.data['hydra:member']; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// @todo fix locale connection between fullcalendar + chamilo |
|
|
|
return sessions.data['hydra:member'].map(sessionRelUser => ({ |
|
|
|
|
|
|
|
...sessionRelUser.session, |
|
|
|
|
|
|
|
title: sessionRelUser.session.name, |
|
|
|
|
|
|
|
start: sessionRelUser.session.displayStartDate, |
|
|
|
|
|
|
|
end: sessionRelUser.session.displayEndDate, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @todo fix locale connection between fullcalendar + chamilo |
|
|
|
|
|
|
|
|
|
|
|
if ('en_US' === locale.value) { |
|
|
|
if ('en_US' === locale.value) { |
|
|
|
locale.value = 'en'; |
|
|
|
locale.value = 'en'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ('fr_FR' === locale.value) { |
|
|
|
if ('fr_FR' === locale.value) { |
|
|
|
locale.value = 'fr'; |
|
|
|
locale.value = 'fr'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ('pl_PL' === locale.value) { |
|
|
|
if ('pl_PL' === locale.value) { |
|
|
|
locale.value = 'pl'; |
|
|
|
locale.value = 'pl'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
calendarOptions.value = { |
|
|
|
const calendarOptions = ref({ |
|
|
|
plugins: [ |
|
|
|
plugins: [ |
|
|
|
dayGridPlugin, |
|
|
|
dayGridPlugin, |
|
|
|
timeGridPlugin, |
|
|
|
timeGridPlugin, |
|
|
|
@ -222,10 +240,10 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
nowIndicator: true, |
|
|
|
nowIndicator: true, |
|
|
|
initialView: 'dayGridMonth', |
|
|
|
initialView: 'dayGridMonth', |
|
|
|
startParam: "startDate[after]", |
|
|
|
startParam: 'startDate[after]', |
|
|
|
endParam: 'endDate[before]', |
|
|
|
endParam: 'endDate[before]', |
|
|
|
selectable: true, |
|
|
|
selectable: true, |
|
|
|
eventClick(EventClickArg) { |
|
|
|
eventClick (EventClickArg) { |
|
|
|
let event = EventClickArg.event.toPlainObject(); |
|
|
|
let event = EventClickArg.event.toPlainObject(); |
|
|
|
|
|
|
|
|
|
|
|
if (event.extendedProps['@type'] && event.extendedProps['@type'] === 'Session') { |
|
|
|
if (event.extendedProps['@type'] && event.extendedProps['@type'] === 'Session') { |
|
|
|
@ -238,7 +256,7 @@ export default { |
|
|
|
|
|
|
|
|
|
|
|
currentEvent = event; |
|
|
|
currentEvent = event; |
|
|
|
|
|
|
|
|
|
|
|
item.value = {...event.extendedProps}; |
|
|
|
item.value = { ...event.extendedProps }; |
|
|
|
|
|
|
|
|
|
|
|
item.value['title'] = event.title; |
|
|
|
item.value['title'] = event.title; |
|
|
|
item.value['startDate'] = event.start; |
|
|
|
item.value['startDate'] = event.start; |
|
|
|
@ -260,7 +278,7 @@ export default { |
|
|
|
|
|
|
|
|
|
|
|
dialogShow.value = true; |
|
|
|
dialogShow.value = true; |
|
|
|
}, |
|
|
|
}, |
|
|
|
dateClick(info) { |
|
|
|
dateClick (info) { |
|
|
|
item.value = {}; |
|
|
|
item.value = {}; |
|
|
|
item.value['parentResourceNodeId'] = currentUser.value.resourceNode['id']; |
|
|
|
item.value['parentResourceNodeId'] = currentUser.value.resourceNode['id']; |
|
|
|
item.value['collective'] = false; |
|
|
|
item.value['collective'] = false; |
|
|
|
@ -270,7 +288,7 @@ export default { |
|
|
|
|
|
|
|
|
|
|
|
dialog.value = true; |
|
|
|
dialog.value = true; |
|
|
|
}, |
|
|
|
}, |
|
|
|
select(info) { |
|
|
|
select (info) { |
|
|
|
item.value = {}; |
|
|
|
item.value = {}; |
|
|
|
item.value['parentResourceNodeId'] = currentUser.value.resourceNode['id']; |
|
|
|
item.value['parentResourceNodeId'] = currentUser.value.resourceNode['id']; |
|
|
|
item.value['collective'] = false; |
|
|
|
item.value['collective'] = false; |
|
|
|
@ -280,47 +298,31 @@ export default { |
|
|
|
|
|
|
|
|
|
|
|
dialog.value = true; |
|
|
|
dialog.value = true; |
|
|
|
}, |
|
|
|
}, |
|
|
|
events(info, successCallback, failureCallback) { |
|
|
|
events (info, successCallback) { |
|
|
|
Promise |
|
|
|
Promise |
|
|
|
.all([getCalendarEvents(info), getSessions(info)]) |
|
|
|
.all([getCalendarEvents(info), getSessions(info)]) |
|
|
|
.then(values => { |
|
|
|
.then(values => { |
|
|
|
const calendarEvents = Array.prototype.slice.call(values[0]) |
|
|
|
const events = values[0].concat(values[1]); |
|
|
|
.map(event => ({ |
|
|
|
|
|
|
|
...event, |
|
|
|
|
|
|
|
start: event.startDate, |
|
|
|
|
|
|
|
end: event.endDate, |
|
|
|
|
|
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const sessionEvents = values[1].map(sessionRelUser => ( |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
...sessionRelUser.session, |
|
|
|
|
|
|
|
title: sessionRelUser.session.name, |
|
|
|
|
|
|
|
start: sessionRelUser.session.displayStartDate, |
|
|
|
|
|
|
|
end: sessionRelUser.session.displayEndDate, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const events = [...calendarEvents, ...sessionEvents]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
successCallback(events); |
|
|
|
successCallback(events); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const cal = ref(null); |
|
|
|
const cal = ref(null); |
|
|
|
function reFetch() { |
|
|
|
|
|
|
|
const calendarApi = cal.value.getApi(); |
|
|
|
function reFetch () { |
|
|
|
calendarApi.refetchEvents(); |
|
|
|
cal.value.getApi().refetchEvents(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function confirmDelete() { |
|
|
|
function confirmDelete () { |
|
|
|
$q.dialog({ |
|
|
|
confirm.require({ |
|
|
|
title: 'Delete', |
|
|
|
message: t('Are you sure you want to delete this event?'), |
|
|
|
message: 'Are you sure you want to delete this event?', |
|
|
|
header: t('Delete'), |
|
|
|
persistent: true, |
|
|
|
icon: 'pi pi-exclamation-triangle', |
|
|
|
cancel: true |
|
|
|
acceptClass: 'p-button-danger', |
|
|
|
}) |
|
|
|
rejectClass: 'p-button-plain p-button-outlined', |
|
|
|
.onOk(function () { |
|
|
|
accept () { |
|
|
|
if (item.value['parentResourceNodeId'] === currentUser.value['id']) { |
|
|
|
if (item.value['parentResourceNodeId'] === currentUser.value['id']) { |
|
|
|
store.dispatch('ccalendarevent/del', item.value); |
|
|
|
store.dispatch('ccalendarevent/del', item.value); |
|
|
|
|
|
|
|
|
|
|
|
@ -332,7 +334,7 @@ export default { |
|
|
|
.filter(resourceLinkFromEntity => resourceLinkFromEntity['user']['id'] === currentUser.value['id']); |
|
|
|
.filter(resourceLinkFromEntity => resourceLinkFromEntity['user']['id'] === currentUser.value['id']); |
|
|
|
|
|
|
|
|
|
|
|
if (filteredLinks.length > 0) { |
|
|
|
if (filteredLinks.length > 0) { |
|
|
|
store.dispatch('resourcelink/del', {'@id': `/api/resource_links/${filteredLinks[0]['id']}`}) |
|
|
|
store.dispatch('resourcelink/del', { '@id': `/api/resource_links/${filteredLinks[0]['id']}` }); |
|
|
|
|
|
|
|
|
|
|
|
currentEvent.remove(); |
|
|
|
currentEvent.remove(); |
|
|
|
dialogShow.value = false; |
|
|
|
dialogShow.value = false; |
|
|
|
@ -340,60 +342,60 @@ export default { |
|
|
|
reFetch(); |
|
|
|
reFetch(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isLoading = computed(() => store.getters['ccalendarevent/isLoading']); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const createForm = ref(null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function onCreateEventForm () { |
|
|
|
|
|
|
|
if (createForm.value.v$.$invalid) { |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
let itemModel = createForm.value.v$.item.$model; |
|
|
|
cal, |
|
|
|
|
|
|
|
onCreated, |
|
|
|
|
|
|
|
calendarOptions, |
|
|
|
|
|
|
|
dialog, |
|
|
|
|
|
|
|
item, |
|
|
|
|
|
|
|
dialogShow, |
|
|
|
|
|
|
|
reFetch, |
|
|
|
|
|
|
|
isEventEditable, |
|
|
|
|
|
|
|
confirmDelete, |
|
|
|
|
|
|
|
...toRefs(sessionState), |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
computed: { |
|
|
|
|
|
|
|
...mapFields('ccalendarevent', { |
|
|
|
|
|
|
|
isLoading: 'isLoading', |
|
|
|
|
|
|
|
created: 'created', |
|
|
|
|
|
|
|
violations: 'violations', |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
...mapGetters('ccalendarevent', ['find']), |
|
|
|
|
|
|
|
...mapGetters({ |
|
|
|
|
|
|
|
'isAuthenticated': 'security/isAuthenticated', |
|
|
|
|
|
|
|
'isAdmin': 'security/isAdmin', |
|
|
|
|
|
|
|
'isCurrentTeacher': 'security/isCurrentTeacher', |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
|
|
|
|
onCreateEventForm() { |
|
|
|
|
|
|
|
const createForm = this.$refs.createForm; |
|
|
|
|
|
|
|
createForm.v$.$touch(); |
|
|
|
|
|
|
|
if (!createForm.v$.$invalid) { |
|
|
|
|
|
|
|
let itemModel = createForm.v$.item.$model; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (itemModel['@id']) { |
|
|
|
if (itemModel['@id']) { |
|
|
|
this.updateItem(itemModel); |
|
|
|
store.dispatch('ccalendarevent/update', itemModel); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.create(itemModel); |
|
|
|
store.dispatch('ccalendarevent/create', itemModel); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.reFetch(); |
|
|
|
dialog.value = false; |
|
|
|
this.dialog = false; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const flashMessageList = inject('flashMessageList'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
watch( |
|
|
|
|
|
|
|
() => store.state.ccalendarevent.created, |
|
|
|
|
|
|
|
(created) => { |
|
|
|
|
|
|
|
flashMessageList.value.push({ |
|
|
|
|
|
|
|
severity: 'success', |
|
|
|
|
|
|
|
detail: t( |
|
|
|
|
|
|
|
'{resource} created', |
|
|
|
|
|
|
|
{ 'resource': created.resourceNode.title } |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reFetch(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
); |
|
|
|
...mapActions('ccalendarevent', { |
|
|
|
|
|
|
|
create: 'create', |
|
|
|
watch( |
|
|
|
deleteItem: 'del', |
|
|
|
() => store.state.ccalendarevent.updated, |
|
|
|
reset: 'resetShow', |
|
|
|
(updated) => { |
|
|
|
retrieve: 'loadWithQuery', |
|
|
|
flashMessageList.value.push({ |
|
|
|
updateItem: 'update' |
|
|
|
severity: 'success', |
|
|
|
}), |
|
|
|
detail: t( |
|
|
|
}, |
|
|
|
'{resource} updated', |
|
|
|
servicePrefix |
|
|
|
{ 'resource': updated.resourceNode.title } |
|
|
|
}; |
|
|
|
), |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reFetch(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
); |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|