mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 08:22:17 +00:00
adding more information to the cis40 stundenplan
This commit is contained in:
@@ -78,6 +78,31 @@ class Content_model extends DB_Model
|
||||
*/
|
||||
public function getMenu($root_content_id, $uid, $sprache = DEFAULT_LANGUAGE)
|
||||
{
|
||||
|
||||
/*,
|
||||
{
|
||||
"content_id": 1000007,
|
||||
"template_kurzbz": "redirect",
|
||||
"titel": "Anrechnung",
|
||||
"content": "<content><url><![CDATA[' . site_url('/lehre/anrechnung/RequestAnrechnung') . ']]></url><target><![CDATA[]]></target></content>",
|
||||
"menu_open": false,
|
||||
"aktiv": true,
|
||||
"childs": []
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
{
|
||||
"content_id": 1000003,
|
||||
"template_kurzbz": "redirect",
|
||||
"titel": "COVID-19",
|
||||
"content": "<content><url><![CDATA[' . site_url('/CisHtml/Cms/content/10012') . ']]></url><target><![CDATA[]]></target></content>",
|
||||
"menu_open": false,
|
||||
"aktiv": true,
|
||||
"childs": []
|
||||
},
|
||||
*/
|
||||
|
||||
if ($root_content_id === null) {
|
||||
$res = json_decode('{
|
||||
"content_id": 1000000,
|
||||
@@ -105,15 +130,6 @@ class Content_model extends DB_Model
|
||||
"aktiv": true,
|
||||
"childs": []
|
||||
},
|
||||
{
|
||||
"content_id": 1000003,
|
||||
"template_kurzbz": "redirect",
|
||||
"titel": "COVID-19",
|
||||
"content": "<content><url><![CDATA[' . site_url('/CisHtml/Cms/content/10012') . ']]></url><target><![CDATA[]]></target></content>",
|
||||
"menu_open": false,
|
||||
"aktiv": true,
|
||||
"childs": []
|
||||
},
|
||||
{
|
||||
"content_id": 1000004,
|
||||
"template_kurzbz": "redirect",
|
||||
@@ -149,16 +165,8 @@ class Content_model extends DB_Model
|
||||
"menu_open": false,
|
||||
"aktiv": true,
|
||||
"childs": []
|
||||
},
|
||||
{
|
||||
"content_id": 1000007,
|
||||
"template_kurzbz": "redirect",
|
||||
"titel": "Anrechnung",
|
||||
"content": "<content><url><![CDATA[' . site_url('/lehre/anrechnung/RequestAnrechnung') . ']]></url><target><![CDATA[]]></target></content>",
|
||||
"menu_open": false,
|
||||
"aktiv": true,
|
||||
"childs": []
|
||||
}
|
||||
|
||||
]
|
||||
}');
|
||||
return success($res);
|
||||
|
||||
@@ -5,6 +5,7 @@ import CalendarWeek from './Week.js';
|
||||
import CalendarWeeks from './Weeks.js';
|
||||
import CalendarMinimized from './Minimized.js';
|
||||
import CalendarDate from '../../composables/CalendarDate.js';
|
||||
import CalendarModal from './CalendarModal.js';
|
||||
|
||||
// TODO(chris): week/month toggle
|
||||
|
||||
@@ -15,7 +16,8 @@ export default {
|
||||
CalendarYears,
|
||||
CalendarWeek,
|
||||
CalendarWeeks,
|
||||
CalendarMinimized
|
||||
CalendarMinimized,
|
||||
CalendarModal
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
@@ -61,6 +63,7 @@ export default {
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
currentlySelectedEvent:null,
|
||||
header: '',
|
||||
prevMode: null,
|
||||
currMode: null,
|
||||
@@ -102,6 +105,15 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
handleInput(day) {
|
||||
// set the event when clicking on the lernveranstaltung in the data
|
||||
this.currentlySelectedEvent = day;
|
||||
console.log(this.currentlySelectedEvent)
|
||||
// showing the modal
|
||||
Vue.nextTick(()=>{
|
||||
this.$refs.calendarModal.show();
|
||||
})
|
||||
|
||||
console.log(day,"this is the day")
|
||||
this.$emit(day[0], day[1]);
|
||||
}
|
||||
},
|
||||
@@ -135,6 +147,7 @@ export default {
|
||||
},
|
||||
template: `
|
||||
<div ref="container" class="fhc-calendar card" :class="sizeClass">
|
||||
<calendar-modal v-if="currentlySelectedEvent" :event="currentlySelectedEvent" ref="calendarModal" />
|
||||
<component :is="'calendar-' + mode" @update:mode="mode=$event" @change:range="$emit('change:range',$event)" @input="handleInput" />
|
||||
</div>`
|
||||
}
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
import BsModal from "../Bootstrap/Modal.js";
|
||||
import Alert from "../Bootstrap/Alert.js";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
BsModal,
|
||||
Alert,
|
||||
},
|
||||
mixins: [BsModal],
|
||||
props: {
|
||||
event:Object,
|
||||
title:{
|
||||
type:String,
|
||||
default:"title"
|
||||
},
|
||||
/*
|
||||
* NOTE(chris):
|
||||
* Hack to expose in "emits" declared events to $props which we use
|
||||
* in the v-bind directive to forward all events.
|
||||
* @see: https://github.com/vuejs/core/issues/3432
|
||||
*/
|
||||
onHideBsModal: Function,
|
||||
onHiddenBsModal: Function,
|
||||
onHidePreventedBsModal: Function,
|
||||
onShowBsModal: Function,
|
||||
onShownBsModal: Function,
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
data:this.event,
|
||||
topic: null,
|
||||
profilUpdate: null,
|
||||
editData: this.value,
|
||||
fileID: null,
|
||||
breadcrumb: null,
|
||||
loading: false,
|
||||
|
||||
result: false,
|
||||
info: null,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
updateFileIDFunction: function (newFileID) {
|
||||
this.fileID = newFileID;
|
||||
},
|
||||
|
||||
async submitProfilChange() {
|
||||
//? check if data is valid before making a request
|
||||
if (this.topic && this.profilUpdate) {
|
||||
//? if profil update contains any attachment
|
||||
if (this.fileID) {
|
||||
const fileData = await this.uploadFiles(this.fileID);
|
||||
|
||||
this.fileID = fileData ? fileData : null;
|
||||
}
|
||||
|
||||
//? inserts new row in public.tbl_cis_profil_update
|
||||
//* calls the update api call if an update field is present in the data that was passed to the modal
|
||||
const handleApiResponse = (res) => {
|
||||
//? toggles the loading to false and closes the loading modal
|
||||
this.loading = false;
|
||||
this.setLoading(false);
|
||||
|
||||
if (res.data.error == 0) {
|
||||
this.result = true;
|
||||
this.hide();
|
||||
Alert.popup(
|
||||
"Ihre Anfrage wurde erfolgreich gesendet. Bitte warten Sie, während sich das Team um Ihre Anfrage kümmert."
|
||||
);
|
||||
} else {
|
||||
this.result = false;
|
||||
this.hide();
|
||||
Alert.popup(
|
||||
"Ein Fehler ist aufgetreten: " + JSON.stringify(res.data.retval)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
//* v-show on EditProfil modal binded to this.loading
|
||||
//? hides the EditProfil modal and shows the loading modal by calling a callback that was passed as prop from the parent component
|
||||
this.loading = true;
|
||||
this.setLoading(true);
|
||||
|
||||
this.editData.updateID
|
||||
? Vue.$fhcapi.ProfilUpdate.updateProfilRequest(
|
||||
this.topic,
|
||||
this.profilUpdate,
|
||||
this.editData.updateID,
|
||||
this.fileID ? this.fileID[0] : null
|
||||
)
|
||||
.then((res) => {
|
||||
handleApiResponse(res);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
})
|
||||
: Vue.$fhcapi.ProfilUpdate.insertProfilRequest(
|
||||
this.topic,
|
||||
this.profilUpdate,
|
||||
this.fileID ? this.fileID[0] : null
|
||||
)
|
||||
.then((res) => {
|
||||
handleApiResponse(res);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
uploadFiles: async function (files) {
|
||||
if (files[0].type !== "application/x.fhc-dms+json") {
|
||||
let formData = new FormData();
|
||||
formData.append("files[]", files[0]);
|
||||
const result = this.editData.updateID
|
||||
? //? updating old attachment by replacing
|
||||
//* second parameter of api request insertFile checks if the file has to be replaced or not
|
||||
await Vue.$fhcapi.ProfilUpdate.insertFile(
|
||||
formData,
|
||||
this.editData.updateID
|
||||
).then((res) => {
|
||||
return res.data?.map((file) => file.dms_id);
|
||||
})
|
||||
: //? fresh insert of new attachment
|
||||
await Vue.$fhcapi.ProfilUpdate.insertFile(formData).then((res) => {
|
||||
return res.data?.map((file) => file.dms_id);
|
||||
});
|
||||
return result;
|
||||
} else {
|
||||
//? attachment hasn't been replaced
|
||||
return false;
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {},
|
||||
created() {
|
||||
console.log("this is an test")
|
||||
},
|
||||
mounted() {
|
||||
this.modal = this.$refs.modalContainer.modal;
|
||||
},
|
||||
popup(options) {
|
||||
return BsModal.popup.bind(this)(null, options);
|
||||
},
|
||||
template: /*html*/ `
|
||||
<bs-modal ref="modalContainer" v-bind="$props" body-class="" dialog-class="modal-lg" class="bootstrap-alert" backdrop="false" >
|
||||
|
||||
<template v-slot:default>
|
||||
<p>{{JSON.stringify(data,null,2)}}</p>
|
||||
</template>
|
||||
|
||||
<!-- end of optional footer -->
|
||||
</bs-modal>`,
|
||||
};
|
||||
@@ -104,8 +104,12 @@ export default {
|
||||
<div v-for="hour in hours" :key="hour" class="text-muted text-end small" :ref="'hour' + hour">{{hour}}:00</div>
|
||||
</div>
|
||||
<div v-for="day in eventsPerDayAndHour" :key="day" class="day border-start" :style="{'grid-template-columns': 'repeat(' + day.lanes + ', 1fr)', 'grid-template-rows': 'repeat(' + (1440 / smallestTimeFrame) + ', 1fr)'}">
|
||||
<a href="#" v-for="event in day.events" :key="event" class="small rounded overflow-hidden text-decoration-none text-dark" :style="{'grid-column-start': 1+(event.lane-1)*day.lanes/event.maxLane, 'grid-column-end': 1+event.lane*day.lanes/event.maxLane, 'grid-row-start': dateToMinutesOfDay(event.start), 'grid-row-end': dateToMinutesOfDay(event.end), '--test': dateToMinutesOfDay(event.end), background: event.orig.color}" @click.prevent="$emit('input', event.orig)">
|
||||
{{event.orig.title}}
|
||||
<a href="#" :title="event.orig.title + ' - ' + event.orig.lehrfach_bez + ' [' + event.orig.ort_kurzbz+']'" v-for="event in day.events" :key="event" class="m-2 border border-dark border-2 small rounded overflow-hidden text-decoration-none text-dark" :style="{'grid-column-start': 1+(event.lane-1)*day.lanes/event.maxLane, 'grid-column-end': 1+event.lane*day.lanes/event.maxLane, 'grid-row-start': dateToMinutesOfDay(event.start), 'grid-row-end': dateToMinutesOfDay(event.end), '--test': dateToMinutesOfDay(event.end), background: event.orig.farbe}" @click.prevent="$emit('input', event.orig)">
|
||||
<div class="d-flex flex-column align-items-center justify-content-evenly h-100">
|
||||
<span>{{event.orig.title}}</span>
|
||||
<span>{{event.orig.ort_kurzbz}}</span>
|
||||
<span>{{event.orig.mitarbeiter_kurzbz}}</span>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user