From 917065326096f9be0e9e9c5dd114cd109f14d097 Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Mon, 22 Jul 2024 14:07:00 +0200 Subject: [PATCH] adds a childaction for the rooms when searching for a room to see the eventoverview of the room --- application/controllers/CisVue/Cms.php | 4 +- application/models/content/Content_model.php | 2 +- .../views/CisVue/Cms/RoomInformation.php | 7 +- public/js/apps/Cis.js | 8 ++ public/js/apps/Cis/RoomInformation.js | 117 +---------------- .../js/components/Cis/Mylv/RoomInformation.js | 123 ++++++++++++++++++ public/js/components/searchbar/raum.js | 17 +++ 7 files changed, 162 insertions(+), 116 deletions(-) create mode 100644 public/js/components/Cis/Mylv/RoomInformation.js diff --git a/application/controllers/CisVue/Cms.php b/application/controllers/CisVue/Cms.php index f8bd61a7b..17700b223 100755 --- a/application/controllers/CisVue/Cms.php +++ b/application/controllers/CisVue/Cms.php @@ -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]); } } diff --git a/application/models/content/Content_model.php b/application/models/content/Content_model.php index f42a395f9..c703ee3c1 100755 --- a/application/models/content/Content_model.php +++ b/application/models/content/Content_model.php @@ -170,7 +170,7 @@ class Content_model extends DB_Model "content_id": 1000008, "template_kurzbz": "redirect", "titel": "room information (to delete)", - "content": "", + "content": "", "menu_open": false, "aktiv": true, "childs": [] diff --git a/application/views/CisVue/Cms/RoomInformation.php b/application/views/CisVue/Cms/RoomInformation.php index c14b68024..5111a56bd 100644 --- a/application/views/CisVue/Cms/RoomInformation.php +++ b/application/views/CisVue/Cms/RoomInformation.php @@ -9,9 +9,12 @@ $this->load->view('templates/CISHTML-Header', $includesArray); ?>
-

Room Information

+

Room Information:


-
+
+ +
+
load->view('templates/CISHTML-Footer', $includesArray); ?> diff --git a/public/js/apps/Cis.js b/public/js/apps/Cis.js index b514f3662..5294778bb 100755 --- a/public/js/apps/Cis.js +++ b/public/js/apps/Cis.js @@ -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; + } } ] }, diff --git a/public/js/apps/Cis/RoomInformation.js b/public/js/apps/Cis/RoomInformation.js index 62920cb66..f11326c11 100644 --- a/public/js/apps/Cis/RoomInformation.js +++ b/public/js/apps/Cis/RoomInformation.js @@ -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*/` -
- - - -
- - - {{event.orig.topic}} - {{gruppe}} - {{lektor}} - - {{event.orig.beschreibung}} - - -
-
-
-
- `, + } + } }); app.config.unwrapInjectedRef = true; -app.use(FhcApi); app.use(Phrasen); app.mount('#content'); \ No newline at end of file diff --git a/public/js/components/Cis/Mylv/RoomInformation.js b/public/js/components/Cis/Mylv/RoomInformation.js new file mode 100644 index 000000000..885130a5f --- /dev/null +++ b/public/js/components/Cis/Mylv/RoomInformation.js @@ -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*/` +
+ + + +
+ + + {{event.orig.topic}} + {{gruppe}} + {{lektor}} + + {{event.orig.beschreibung}} + + +
+
+
+
+ `, +}; \ No newline at end of file diff --git a/public/js/components/searchbar/raum.js b/public/js/components/searchbar/raum.js index 69e303ed4..87fcc7747 100755 --- a/public/js/components/searchbar/raum.js +++ b/public/js/components/searchbar/raum.js @@ -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 {
Standort
{{ res.standort }}
+
+
data
+
{{ JSON.stringify(res,null,2) }}
+
Sitzplätze
{{ res.sitzplaetze }}