adds a childaction for the rooms when searching for a room to see the eventoverview of the room

This commit is contained in:
SimonGschnell
2024-07-22 14:07:00 +02:00
parent f4bf3eec86
commit 9170653260
7 changed files with 162 additions and 116 deletions
+2 -2
View File
@@ -116,7 +116,7 @@ class Cms extends FHC_Controller
}
}
public function getRoomInformation(){
$this->load->view('CisVue/Cms/RoomInformation');
public function getRoomInformation($ort_kurzbz){
$this->load->view('CisVue/Cms/RoomInformation',['ort_kurzbz'=>$ort_kurzbz]);
}
}
+1 -1
View File
@@ -170,7 +170,7 @@ class Content_model extends DB_Model
"content_id": 1000008,
"template_kurzbz": "redirect",
"titel": "room information (to delete)",
"content": "<content><url><![CDATA[' . site_url('/CisVue/Cms/getRoomInformation') . ']]></url><target><![CDATA[]]></target></content>",
"content": "<content><url><![CDATA[' . site_url('/CisVue/Cms/getRoomInformation/EDV_F4.26') . ']]></url><target><![CDATA[]]></target></content>",
"menu_open": false,
"aktiv": true,
"childs": []
@@ -9,9 +9,12 @@ $this->load->view('templates/CISHTML-Header', $includesArray);
?>
<div >
<h2>Room Information</h2>
<h2>Room Information: <?php echo $ort_kurzbz ?></h2>
<hr>
<div id="content"></div>
<div id="content">
<room-information ort_kurzbz="<?php echo $ort_kurzbz ?>"></room-information>
</div>
</div>
<?php $this->load->view('templates/CISHTML-Footer', $includesArray); ?>
+8
View File
@@ -52,6 +52,14 @@ Vue.createApp({
action: function(data) {
return data.booklink;
}
},
{
label: "Raumübersicht",
icon: "fas fa-bookmark",
type: "link",
action: function(data) {
return data.roomoverview;
}
}
]
},
+6 -111
View File
@@ -1,121 +1,16 @@
import FhcCalendar from "../../components/Calendar/Calendar.js";
import CalendarDate from "../../composables/CalendarDate.js";
import FhcApi from "../../plugin/FhcApi.js";
import Phrasen from "../../plugin/Phrasen.js";
import RoomInformation from "../../components/Cis/Mylv/RoomInformation.js";
const app = Vue.createApp({
components: {
FhcCalendar
RoomInformation
},
data() {
return {
stunden: [],
events: null,
calendarWeek: new CalendarDate(new Date()),
events_loaded:false,
}
},
computed:{
currentDate: function(){
return new Date(this.calendarWeek.y, this.calendarWeek.m, this.calendarWeek.d);
},
weekFirstDay: function(){
return this.calendarDateToString(this.calendarWeek.cdFirstDayOfWeek);
},
weekLastDay: function(){
return this.calendarDateToString(this.calendarWeek.cdLastDayOfWeek);
},
},
methods:{
// returns the string YYYY-MM-DD if param is instance of CalendarDate and null otherwise
calendarDateToString: function(calendarDate){
return calendarDate instanceof CalendarDate?
[calendarDate.y, calendarDate.m+1, calendarDate.d].join('-'):
null;
},
},
created() {
this.$fhcApi.factory.stundenplan.getStunden().then(res =>{
res.data.forEach(std => {
this.stunden[std.stunde] = std; // TODO(chris): geht besser
});
// old testing room EDV_A6.09
this.$fhcApi.factory.stundenplan.getRoomInfo('EDV_F4.26', this.weekFirstDay, this.weekLastDay).then(res =>{
let events;
if (res.data && res.data.forEach) {
res.data.forEach((el, i) => {
el.id = i;
if(el.type === 'reservierung')
{
el.color = '#' + (el.farbe || 'FFFFFF');
}else{
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;
});
this.events = res.data;
}
// reservierungen are loaded with the stundenplan
/* this.$fhcApi.factory.stundenplan.getReservierungen('EDV_F4.26', this.weekFirstDay, this.weekLastDay).then(res => {
if (res.data && res.data.forEach) {
res.data.forEach((el, i) => {
el.reservierung = true;
el.color = '#' + (el.farbe || 'ffffff');
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.titel;
if (el.lehrform)
el.title += '-' + el.lehrform;
});
}
let reservierungs_events = res.data;
this.events = [...(this.events?this.events:[]),...reservierungs_events];
}); */
});
});
},
template: /*html*/`
<div>
<fhc-calendar v-slot="{event,day}" :initialDate="currentDate" :events="events" initial-mode="week" show-weeks>
<a class="text-decoration-none text-dark" href="#" :title="event.orig.title + ' - ' + event.orig.lehrfach_bez + ' [' + event.orig.ort_kurzbz+']'" >
<div class="d-flex flex-column align-items-center justify-content-evenly h-100" >
<!-- render content for stundenplan -->
<span >{{event.orig.topic}}</span>
<span v-for="gruppe in event.orig.gruppe.split('/')" :key="gruppe">{{gruppe}}</span>
<span v-for="lektor in event.orig.lektor.split('/')" :key="lektor">{{lektor}}</span>
<!-- add the beschreibung if the event is a reservierung -->
<span v-if="event.orig.type === 'reservierung'">{{event.orig.beschreibung}}</span>
</div>
</a>
</fhc-calendar>
</div>
`,
}
}
});
app.config.unwrapInjectedRef = true;
app.use(FhcApi);
app.use(Phrasen);
app.mount('#content');
@@ -0,0 +1,123 @@
import FhcCalendar from "../../Calendar/Calendar.js";
import CalendarDate from "../../../composables/CalendarDate.js";
export default{
props:{
ort_kurzbz: {
type: String,
required: true,
}
},
components: {
FhcCalendar
},
data() {
return {
stunden: [],
events: null,
calendarWeek: new CalendarDate(new Date()),
events_loaded:false,
}
},
computed:{
currentDate: function(){
return new Date(this.calendarWeek.y, this.calendarWeek.m, this.calendarWeek.d);
},
weekFirstDay: function(){
return this.calendarDateToString(this.calendarWeek.cdFirstDayOfWeek);
},
weekLastDay: function(){
return this.calendarDateToString(this.calendarWeek.cdLastDayOfWeek);
},
},
methods:{
// returns the string YYYY-MM-DD if param is instance of CalendarDate and null otherwise
calendarDateToString: function(calendarDate){
return calendarDate instanceof CalendarDate?
[calendarDate.y, calendarDate.m+1, calendarDate.d].join('-'):
null;
},
},
created() {
this.$fhcApi.factory.stundenplan.getStunden().then(res =>{
res.data.forEach(std => {
this.stunden[std.stunde] = std; // TODO(chris): geht besser
});
// old testing room EDV_A6.09
this.$fhcApi.factory.stundenplan.getRoomInfo(this.ort_kurzbz, this.weekFirstDay, this.weekLastDay).then(res =>{
let events;
if (res.data && res.data.forEach) {
res.data.forEach((el, i) => {
el.id = i;
if(el.type === 'reservierung')
{
el.color = '#' + (el.farbe || 'FFFFFF');
}else{
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;
});
this.events = res.data;
}
// reservierungen are loaded with the stundenplan
/* this.$fhcApi.factory.stundenplan.getReservierungen('EDV_F4.26', this.weekFirstDay, this.weekLastDay).then(res => {
if (res.data && res.data.forEach) {
res.data.forEach((el, i) => {
el.reservierung = true;
el.color = '#' + (el.farbe || 'ffffff');
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.titel;
if (el.lehrform)
el.title += '-' + el.lehrform;
});
}
let reservierungs_events = res.data;
this.events = [...(this.events?this.events:[]),...reservierungs_events];
}); */
});
});
},
template: /*html*/`
<div>
<fhc-calendar v-slot="{event,day}" :initialDate="currentDate" :events="events" initial-mode="week" show-weeks>
<a class="text-decoration-none text-dark" href="#" :title="event.orig.title + ' - ' + event.orig.lehrfach_bez + ' [' + event.orig.ort_kurzbz+']'" >
<div class="d-flex flex-column align-items-center justify-content-evenly h-100" >
<!-- render content for stundenplan -->
<span >{{event.orig.topic}}</span>
<span v-for="gruppe in event.orig.gruppe.split('/')" :key="gruppe">{{gruppe}}</span>
<span v-for="lektor in event.orig.lektor.split('/')" :key="lektor">{{lektor}}</span>
<!-- add the beschreibung if the event is a reservierung -->
<span v-if="event.orig.type === 'reservierung'">{{event.orig.beschreibung}}</span>
</div>
</a>
</fhc-calendar>
</div>
`,
};
+17
View File
@@ -15,6 +15,19 @@ export default {
return FHC_JS_DATA_STORAGE_OBJECT.app_root+'cms/content.php?content_id='+data.content_id;
}
}; */
this.res.roomoverview= FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
`/CisVue/Cms/getRoomInformation/${this.res.ort_kurzbz}`;
if(this.res.content_id !=="N/A"){
this.res.infolink= FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
`/CisVue/Cms/content/${this.res.content_id}`;
}else{
this.res.infolink= '#';
}
},
emits: [ 'actionexecuted' ],
template: /*html*/`
@@ -37,6 +50,10 @@ export default {
<div class="searchbar_tablecell">Standort</div>
<div class="searchbar_tablecell">{{ res.standort }}</div>
</div>
<div class="searchbar_tablerow">
<div class="searchbar_tablecell">data</div>
<div class="searchbar_tablecell">{{ JSON.stringify(res,null,2) }}</div>
</div>
<div class="searchbar_tablerow">
<div class="searchbar_tablecell">Sitzplätze</div>
<div class="searchbar_tablecell">{{ res.sitzplaetze }}</div>