This commit is contained in:
SimonGschnell
2024-05-23 15:40:23 +02:00
parent 186e9e6f08
commit 729509a45d
4 changed files with 57 additions and 12 deletions
@@ -70,6 +70,9 @@ class Stundenplan extends Auth_Controller
{
$this->load->model('ressource/Stundenplan_model', 'StundenplanModel');
$result = $this->StundenplanModel->getRoomDataOnDay('EDV_A2.06','2024-05-21');
//echo($this->db->last_query());
echo json_encode($result);
@@ -19,9 +19,21 @@ class Stundenplan_model extends DB_Model
* @return stdClass
*/
public function getRoomDataOnDay($ort_kurzbz,$date){
$this->addSelect(['*',"CONCAT(UPPER(sp.stg_typ),UPPER(sp.stg_kurzbz),'-',COALESCE(CAST(sp.semester AS varchar),'/'),COALESCE(CAST(sp.verband AS varchar),'/')) as eintrag","lektor","CONCAT(lehrfach,'-',lehrform)"]);
/* $this->addSelect(["lehre.tbl_stundenplan.*","CONCAT(UPPER(sg.typ),UPPER(sg.kurzbz),'-',lehre.tbl_stundenplan.semester,lehre.tbl_stundenplan.verband) as simml"]);
$this->addJoin("public.tbl_lehrverband as lv","lv.studiengang_kz=lehre.tbl_stundenplan.studiengang_kz AND lv.gruppe=lehre.tbl_stundenplan.gruppe AND lv.verband=lehre.tbl_stundenplan.verband AND lv.semester=lehre.tbl_stundenplan.semester","LEFT");
$this->addJoin("public.tbl_studiengang as sg","sg.studiengang_kz=lehre.tbl_stundenplan.studiengang_kz","LEFT");
$res = $this->loadWhere(['ort_kurzbz'=>$ort_kurzbz,'datum'=>$date]);
$res = hasData($res) ? getData($res): null;
return $res;
return $res; */
$this->db->where('ort_kurzbz','EDV_A2.06',true);
$this->db->where('datum','2024-05-21',true);
$query = $this->db->get_compiled_select('lehre.vw_stundenplan sp');
return $this->execQuery($query, [$ort_kurzbz, $date]);
}
/**
+28 -8
View File
@@ -7,7 +7,8 @@ const app = Vue.createApp({
data() {
return {
stunden: [],
events: null
events: null,
testDate: new Date('2024-05-21'),
}
},
created() {
@@ -18,11 +19,33 @@ const app = Vue.createApp({
this.stunden[std.stunde] = std; // TODO(chris): geht besser
});
console.log("this are the loaded stunden", this.stunden)
axios.get(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + '/components/Cis/Stundenplan/RoomInformation').then(res => {
let events;
console.log(" this is the res of the api call room information",res);
if (res.data && res.data.forEach) {
res.data.forEach((el, i) => {
console.log(el,"this is the element that gets changed")
el.id = i;
el.color = '#' + (el.farbe || 'CCCCCC');
el.start = new Date(el.datum + ' ' + this.stunden[el.stunde].beginn);
el.end = new Date(el.datum + ' ' + this.stunden[el.stunde].ende);
el.title = el.lehrfach;
if (el.lehrform)
el.title += '-' + el.lehrform;
});
events = res.data;
//console.log("this are the room events",events)
//this.events = events;
}
}).catch((e)=>{console.log(e,"this is the exception")})
});
axios.get(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + '/components/Cis/Stundenplan').then(res => {
let events;
console.log(" this is the res of the api call stundenplan",res);
if (res.data.retval && res.data.retval.forEach) {
res.data.retval.forEach((el, i) => {
el.id = i;
@@ -34,18 +57,15 @@ const app = Vue.createApp({
el.title += '-' + el.lehrform;
});
events = res.data.retval;
console.log("this are the events of the stundenplan",events)
}
console.log("this are the loaded events",events)
// TODO(chris): do we need that
}).catch((e)=>{console.log(e,"this is the exception")})
}).catch((e)=>{console.log(e,"this is the exception")})
axios.get(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + '/components/Cis/Stundenplan/RoomInformation').then(res => {
console.log(res)
console.log("this string got printed after the get was successfully finished")
}).catch((e)=>{console.log(e,"this is the exception")})
@@ -53,7 +73,7 @@ const app = Vue.createApp({
template: /*html*/`
<div>
<!--initialDate="2023-5-12"-->
<fhc-calendar :events="events" initial-mode="week" show-weeks></fhc-calendar>
<fhc-calendar :initialDate="testDate" :events="events" initial-mode="week" show-weeks></fhc-calendar>
</div>
`,
});
+13 -3
View File
@@ -28,7 +28,8 @@ export default {
},
computed: {
days() {
let tmpDate = new CalendarDate(this.year, 1, 1); // NOTE(chris): somewhere in the middle of the year
let tmpDate = new CalendarDate(this.year,1,1); // NOTE(chris): somewhere in the middle of the year
tmpDate.w = this.week;
let startDay = tmpDate.firstDayOfWeek;
let result = [];
@@ -36,9 +37,11 @@ export default {
result.push(new Date(startDay.getFullYear(), startDay.getMonth(), startDay.getDate() + i));
}
return result;
},
eventsPerDayAndHour() {
const res = {};
console.log("this are the days",this.days)
this.days.forEach(day => {
let key = day.toDateString();
@@ -46,6 +49,7 @@ export default {
nextDay.setDate(nextDay.getDate()+1);
nextDay.setMilliseconds(nextDay.getMilliseconds()-1);
let d = {events:[],lanes:1};
console.log("this are the events",this.events, "and this is the key",key)
if (this.events[key]) {
this.events[key].forEach(evt => {
let event = {orig:evt,lane:1,maxLane:1,start: evt.start < day ? day : evt.start, end: evt.end > nextDay ? nextDay : evt.end,shared:[],setSharedMaxRecursive(doneItems) {
@@ -75,6 +79,9 @@ export default {
}
},
methods: {
printTest:function(param){
console.log("HERE",param)
},
changeToMonth(day) {
if (!this.noMonthView) {
this.date.set(day);
@@ -91,6 +98,7 @@ export default {
},
template: `
<div class="fhc-calendar-week-page">
<div class="d-flex flex-column border-top">
<div class="fhc-calendar-week-page-header border-2 border-bottom text-center d-flex">
<div v-for="day in days" :key="day" class="flex-grow-1" :title="day.toLocaleString(undefined, {dateStyle:'short'})">
@@ -104,8 +112,10 @@ 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}}
<span>test</span>
<a href="#" @click="printTest(event)" 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>
</div>
</div>