From 6230aa47aeb032dd171842ecfb9aa05d14bf7a32 Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Tue, 18 Jun 2024 15:03:36 +0200 Subject: [PATCH] now also displays the room information inside a modal and does not redirect to the content site --- .../controllers/api/frontend/v1/Ort.php | 26 +++++++++- public/js/api/ort.js | 10 +++- public/js/components/Cis/Cms/ContentModal.js | 47 +++++++++++++++++++ public/js/components/Cis/Mylv/LvUebersicht.js | 3 +- .../components/DashboardWidget/Stundenplan.js | 38 +++++++++++++-- 5 files changed, 117 insertions(+), 7 deletions(-) create mode 100644 public/js/components/Cis/Cms/ContentModal.js diff --git a/application/controllers/api/frontend/v1/Ort.php b/application/controllers/api/frontend/v1/Ort.php index 2bc0f945b..8c4059824 100644 --- a/application/controllers/api/frontend/v1/Ort.php +++ b/application/controllers/api/frontend/v1/Ort.php @@ -33,7 +33,8 @@ class Ort extends FHCAPI_Controller { // NOTE(chris): additional permission checks will be done in SearchBarLib parent::__construct([ - 'ContentID' => self::PERM_LOGGED + 'ContentID' => self::PERM_LOGGED, + 'getOrtKurzbzContent' => self::PERM_LOGGED, ]); $this->load->model('ressource/Ort_model', 'OrtModel'); @@ -67,5 +68,28 @@ class Ort extends FHCAPI_Controller $this->terminateWithSuccess($result->content_id ?? NULL); } + + /** + * @param int $version + * @param string $sprache + * @param boolean $sichtbar + * + * @return $content + */ + public function getOrtKurzbzContent($version = null, $sprache = null, $sichtbar = true) + { + $content_id = $this->input->get("content_id",TRUE); + + $this->load->library('CmsLib'); + + $content = $this->cmslib->getContent($content_id, $version, $sprache, $sichtbar); + + if (isError($content)) + $this->terminateWithError(getError($content), self::ERROR_TYPE_GENERAL); + + $content = hasData($content) ? getData($content) : null; + + $this->terminateWithSuccess($content); + } } diff --git a/public/js/api/ort.js b/public/js/api/ort.js index 32f114565..c92ac0be0 100644 --- a/public/js/api/ort.js +++ b/public/js/api/ort.js @@ -1,5 +1,5 @@ export default { - getContentID($ort_kurbz) { + getContentID($ort_kurbz) { return this.$fhcApi.get( FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + @@ -7,4 +7,12 @@ export default { { ort_kurzbz: $ort_kurbz } ); }, + getOrtKuzbzContent($ort_kurzbz_content_id) { + return this.$fhcApi.get( + FHC_JS_DATA_STORAGE_OBJECT.app_root + + FHC_JS_DATA_STORAGE_OBJECT.ci_router + + "/api/frontend/v1/Ort/getOrtKurzbzContent", + { content_id: $ort_kurzbz_content_id } + ); + }, } \ No newline at end of file diff --git a/public/js/components/Cis/Cms/ContentModal.js b/public/js/components/Cis/Cms/ContentModal.js new file mode 100644 index 000000000..3613648ee --- /dev/null +++ b/public/js/components/Cis/Cms/ContentModal.js @@ -0,0 +1,47 @@ +import BsModal from "../../Bootstrap/Modal"; + + +export default { + + + mixins:[BsModal], + + components:{ + BsModal, + }, + data(){ + return{ + content_id:null, + content:null, + ort_kurzbz:null, + result: false, + }; + }, + methods:{ + modalShown: function(){ + + } + }, + mounted(){ + this.modal = this.$refs.modalContainer; + document.addEventListener("show.bs.modal", function(){ + console.log("modal is shown inside the mounted hook") + }) + }, + + template:/*html*/` + + + + + + ` +}; \ No newline at end of file diff --git a/public/js/components/Cis/Mylv/LvUebersicht.js b/public/js/components/Cis/Mylv/LvUebersicht.js index c21cf200d..b2ee20833 100644 --- a/public/js/components/Cis/Mylv/LvUebersicht.js +++ b/public/js/components/Cis/Mylv/LvUebersicht.js @@ -40,8 +40,7 @@ export default { `, diff --git a/public/js/components/DashboardWidget/Stundenplan.js b/public/js/components/DashboardWidget/Stundenplan.js index d2e1f9693..3a1d3484c 100755 --- a/public/js/components/DashboardWidget/Stundenplan.js +++ b/public/js/components/DashboardWidget/Stundenplan.js @@ -2,7 +2,7 @@ import Phrasen from '../../mixins/Phrasen.js'; import AbstractWidget from './Abstract.js'; import FhcCalendar from '../Calendar/Calendar.js'; import LvUebersicht from '../Cis/Mylv/LvUebersicht.js'; - +import ContentModal from '../Cis/Cms/ContentModal.js' export default { mixins: [ @@ -12,6 +12,7 @@ export default { components: { FhcCalendar, LvUebersicht, + ContentModal, }, data() { @@ -35,6 +36,33 @@ export default { } }, methods: { + + showRoomInfoModal: function(ort_kurzbz){ + + // getting the content_id of the ort_kurzbz + this.$fhcApi.factory.ort.getContentID(ort_kurzbz).then(res =>{ + + let ort_kurzbz_content_id = res.data; + + this.$refs.contentModal.content_id = ort_kurzbz_content_id; + + this.$fhcApi.factory.ort.getOrtKuzbzContent(ort_kurzbz_content_id).then(res =>{ + let result = res.data; + console.log("this is the result of the query", result); + this.$refs.contentModal.content = result; + this.$refs.contentModal.ort_kurzbz = ort_kurzbz; + if(this.$refs.contentModal.content){ + this.$refs.contentModal.show(); + } + + + }) + + + + }) + + }, showLvUebersicht: function (event){ this.$refs.lvUebersicht.lehreinheit = event.lehreinheit_id; @@ -60,6 +88,7 @@ export default { }, created() { + this.$emit('setConfig', false); @@ -89,17 +118,20 @@ export default { template: /*html*/`
+
-
+
{{evt.title}}
- {{evt.ort_kurzbz}} + + + {{evt.ort_kurzbz}} {{evt.start.toLocaleTimeString(undefined, {hour:'numeric',minute:'numeric'})}}-{{evt.end.toLocaleTimeString(undefined, {hour:'numeric',minute:'numeric'})}}