From e1c395146ba5cbae62da5b671490e6f83e268f67 Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Mon, 16 Sep 2024 14:55:26 +0200 Subject: [PATCH] refactors the LvMenu into its own component and removes debugging prints --- public/js/apps/Cis.js | 1 - public/js/apps/Cis/MyLv/Student.js | 3 +- .../js/components/Calendar/CalendarModal.js | 229 +++++++++--------- public/js/components/Cis/Mylv/LvMenu.js | 66 +++++ public/js/components/Cis/Mylv/LvUebersicht.js | 47 +--- .../Cis/Mylv/Semester/Studiengang/Lv/Info.js | 216 +++++++++-------- .../ProfilComponents/FetchProfilUpdates.js | 1 - .../Cis/ProfilUpdate/ProfilUpdateView.js | 4 - public/js/components/Dashboard/Admin.js | 1 - .../js/components/Dashboard/Admin/Presets.js | 1 - public/js/components/Dashboard/Dashboard.js | 2 - public/js/components/Pagination/Pagination.js | 2 +- .../Stv/Studentenverwaltung/List/New.js | 2 +- public/js/components/searchbar/searchbar.js | 12 - .../anrechnung/approveAnrechnungDetail.js | 1 - 15 files changed, 314 insertions(+), 274 deletions(-) create mode 100644 public/js/components/Cis/Mylv/LvMenu.js diff --git a/public/js/apps/Cis.js b/public/js/apps/Cis.js index 996457268..b626df690 100755 --- a/public/js/apps/Cis.js +++ b/public/js/apps/Cis.js @@ -86,7 +86,6 @@ Vue.createApp({ return Vue.$fhcapi.Search.search(searchsettings); }, updatesearchtypes: function(newValues){ - console.log(newValues,"this are the new values") this.selectedtypes= newValues; }, diff --git a/public/js/apps/Cis/MyLv/Student.js b/public/js/apps/Cis/MyLv/Student.js index 27c340a2c..ded0178fb 100755 --- a/public/js/apps/Cis/MyLv/Student.js +++ b/public/js/apps/Cis/MyLv/Student.js @@ -1,7 +1,8 @@ import MylvStudent from "../../../components/Cis/Mylv/Student.js"; +import Phrasen from "../../../plugin/Phrasen.js"; Vue.createApp({ components: { MylvStudent } -}).mount('#content'); \ No newline at end of file +}).use(Phrasen).mount('#content'); \ No newline at end of file diff --git a/public/js/components/Calendar/CalendarModal.js b/public/js/components/Calendar/CalendarModal.js index 5d96ad459..2d42e7ece 100644 --- a/public/js/components/Calendar/CalendarModal.js +++ b/public/js/components/Calendar/CalendarModal.js @@ -1,118 +1,123 @@ import BsModal from "../Bootstrap/Modal.js"; import Alert from "../Bootstrap/Alert.js"; +import LvMenu from "../Cis/Mylv/LvMenu.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, - menu: [], - result: false, - info: null, - }; - }, - computed: { - start_time: function(){ - if(!this.data.start) return 'N/A'; - return this.data.start.getHours() + ":" + this.data.start.getMinutes(); - }, - end_time: function(){ - if(!this.data.end) return 'N/A'; - return this.data.end.getHours() + ":" + this.data.end.getMinutes(); - } - }, - methods:{ - onModalShow: function(){ - console.log(this.event) - if (this.event.type == 'lehreinheit') { - this.$fhcApi.factory.stundenplan.getLehreinheitStudiensemester(this.event.lehreinheit_id[0]).then( - res=>res.data - ).then( - studiensemester_kurzbz =>{ - this.$fhcApi.factory.addons.getLvMenu(this.data.lehrveranstaltung_id, studiensemester_kurzbz).then(res => { - //this.$fhcApi.factory.addons.getLvMenu(750, "WS2005").then(res =>{ - if (res.data) { - this.menu = res.data; - } - - }); - } - ) + components: { + BsModal, + Alert, + LvMenu, + }, + 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, + menu: [], + result: false, + info: null, + isMenuSelected:false, + }; + }, + computed: { + start_time: function(){ + if(!this.data.start) return 'N/A'; + return this.data.start.getHours() + ":" + this.data.start.getMinutes(); + }, + end_time: function(){ + if(!this.data.end) return 'N/A'; + return this.data.end.getHours() + ":" + this.data.end.getMinutes(); } - - } - }, - mounted() { - this.modal = this.$refs.modalContainer.modal; - }, - popup(options) { - return BsModal.popup.bind(this)(null, options); - }, - template: /*html*/ ` - - - - - - - - `, + }, + methods:{ + onModalShow: function(){ + if (this.event.type == 'lehreinheit') { + this.$fhcApi.factory.stundenplan.getLehreinheitStudiensemester(this.event.lehreinheit_id[0]).then( + res=>res.data + ).then( + studiensemester_kurzbz =>{ + this.$fhcApi.factory.addons.getLvMenu(this.data.lehrveranstaltung_id, studiensemester_kurzbz).then(res => { + if (res.data) { + this.menu = res.data; + } + }); + } + ) + } + }, + onModalHide:function(){ + this.isMenuSelected = false; + } + }, + mounted() { + this.modal = this.$refs.modalContainer.modal; + }, + popup(options) { + return BsModal.popup.bind(this)(null, options); + }, + template: /*html*/ ` + + + + + + + `, }; diff --git a/public/js/components/Cis/Mylv/LvMenu.js b/public/js/components/Cis/Mylv/LvMenu.js new file mode 100644 index 000000000..f0ce41aca --- /dev/null +++ b/public/js/components/Cis/Mylv/LvMenu.js @@ -0,0 +1,66 @@ + +export default { + props:{ + isMenuSelected:{ + type:Boolean, + default:false, + }, + menu:{ + type:Array, + default:null, + }, + }, + data(){ + return{ + selectedMenu:null, + } + }, + watch:{ + isMenuSelected: function (newValue) { + // if no Menu point has been selected, show all Menu options + if (!newValue){ + this.selectedMenu = null; + } + } + }, + emits:["update:isMenuSelected"], + methods:{ + selectMenu: function (menuItem, index = null) { + + // early return if link is # + if (index != null && menuItem.c4_linkList[index][1] == '#') return; + + switch (menuItem.id) { + case "core_menu_mailanstudierende": window.location.href = menuItem.c4_link; break; + default: + this.selectedMenu = { ...menuItem }; + this.$emit("update:isMenuSelected", true); + } + + if (this.selectedMenu && index != null && menuItem.c4_linkList[index][1] != '#') { + this.selectedMenu.c4_link = menuItem.c4_linkList[index][1]; + this.selectedMenu.name += ' - ' + menuItem.c4_linkList[index][0]; + } + + + }, + }, + template:/*html*/` +
+
+ +

{{selectedMenu.name}}

+
+ +
+
No Menu available
+
+
+ + {{menuItem.name}} + {{text}} + +
+
+ ` +} \ 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 d080bd715..51a9076ba 100644 --- a/public/js/components/Cis/Mylv/LvUebersicht.js +++ b/public/js/components/Cis/Mylv/LvUebersicht.js @@ -1,5 +1,5 @@ import BsModal from "../../Bootstrap/Modal"; - +import LvMenu from "./LvMenu"; export default { props:{ @@ -13,42 +13,26 @@ export default { return { result: false, menu: [], - selectedMenu:null, + isMenuSelected:false, } }, mixins:[BsModal], components:{ BsModal, + LvMenu, }, methods:{ - selectMenu: function(menuItem, index=null){ - - // early return if link is # - if(index != null && menuItem.c4_linkList[index][1] == '#') return; - - switch(menuItem.id){ - case "core_menu_mailanstudierende": window.location.href=menuItem.c4_link; break; - default: - this.selectedMenu= {...menuItem}; - } - - if( this.selectedMenu && index != null && menuItem.c4_linkList[index][1] !='#'){ - this.selectedMenu.c4_link = menuItem.c4_linkList[index][1]; - this.selectedMenu.name += ' - ' + menuItem.c4_linkList[index][0]; - } - }, + hiddenModal: function(){ - this.selectedMenu = null; + this.isMenuSelected = false; }, showModal: function(){ this.$fhcApi.factory.addons.getLvMenu(this.event.lehrveranstaltung_id, this.event.studiensemester_kurzbz).then(res =>{ - //this.$fhcApi.factory.addons.getLvMenu(750, "WS2005").then(res =>{ if(res.data){ this.menu = res.data; } - }); }, }, @@ -56,29 +40,14 @@ export default { this.modal = this.$refs.modalContainer; }, template:/*html*/` - + diff --git a/public/js/components/Cis/Mylv/Semester/Studiengang/Lv/Info.js b/public/js/components/Cis/Mylv/Semester/Studiengang/Lv/Info.js index f3f284b31..764ebbc09 100755 --- a/public/js/components/Cis/Mylv/Semester/Studiengang/Lv/Info.js +++ b/public/js/components/Cis/Mylv/Semester/Studiengang/Lv/Info.js @@ -1,11 +1,13 @@ import BsModal from '../../../../../Bootstrap/Modal.js'; import Phrasen from '../../../../../../mixins/Phrasen.js'; +import LvMenu from '../../../LvMenu.js'; const infos = {}; export default { components: { - BsModal + BsModal, + LvMenu }, mixins: [ BsModal, @@ -35,7 +37,9 @@ export default { }, data: () => ({ result: true, - info: null + info: null, + isMenuSelected: false, + menu: [], }), computed: { lektorNames() { @@ -76,112 +80,130 @@ export default { }).catch(() => this.info = {}); } }, + methods:{ + onModelHide() { + this.isMenuSelected = false; + }, + onModalShow() { + this.$fhcApi.factory.addons.getLvMenu(this.lehrveranstaltung_id, this.studien_semester) + .then(res => { + this.menu = res.data; + }) + .catch((error) => this.$fhcAlert.handleSystemError); + } + }, mounted() { this.modal = this.$refs.modalContainer.modal; }, popup(options) { return BsModal.popup.bind(this)(null, options); }, - template: ` + template: /*html*/` + ` } diff --git a/public/js/components/Cis/Profil/ProfilComponents/FetchProfilUpdates.js b/public/js/components/Cis/Profil/ProfilComponents/FetchProfilUpdates.js index 9caee9468..11c5960e4 100755 --- a/public/js/components/Cis/Profil/ProfilComponents/FetchProfilUpdates.js +++ b/public/js/components/Cis/Profil/ProfilComponents/FetchProfilUpdates.js @@ -46,7 +46,6 @@ export default { let withFiles = false; if (view === "TextInputDokument") { - console.log("text input") data = { titel: updateRequest.topic, value: updateRequest.requested_change.value, diff --git a/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js b/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js index 4f5f6578f..c30f1ab89 100644 --- a/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js +++ b/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js @@ -127,10 +127,6 @@ export default { "acceptUpdate" )}`, action: (e, column) => { - console.log( - "this is the data of the context menu action", - column.getData() - ); this.$fhcApi.factory.profilUpdate.acceptProfilRequest(column.getData()) .then((res) => { this.$refs.UpdatesTable.tabulator.setData(); diff --git a/public/js/components/Dashboard/Admin.js b/public/js/components/Dashboard/Admin.js index b92609ad7..f1a837880 100755 --- a/public/js/components/Dashboard/Admin.js +++ b/public/js/components/Dashboard/Admin.js @@ -73,7 +73,6 @@ export default { }, created() { axios.get(this.apiurl + '/Dashboard').then(res => { - //console.log(res.data.retval); this.dashboards = res.data.retval; }).catch(err => console.error('ERROR:', err)); }, diff --git a/public/js/components/Dashboard/Admin/Presets.js b/public/js/components/Dashboard/Admin/Presets.js index 63e010014..8b7e7d8b9 100755 --- a/public/js/components/Dashboard/Admin/Presets.js +++ b/public/js/components/Dashboard/Admin/Presets.js @@ -144,7 +144,6 @@ export default { }, created() { axios.get(this.apiurl + '/Config/funktionen').then(res => { - //console.log(res.data.retval); this.funktionen = {general: 'GENERAL'}; res.data.retval.forEach(funktion => { this.funktionen[funktion.funktion_kurzbz] = funktion.beschreibung; diff --git a/public/js/components/Dashboard/Dashboard.js b/public/js/components/Dashboard/Dashboard.js index 65ec211eb..bc7199af0 100755 --- a/public/js/components/Dashboard/Dashboard.js +++ b/public/js/components/Dashboard/Dashboard.js @@ -25,7 +25,6 @@ export default { axios.get(this.apiurl + '/Widget/getWidgetsForDashboard', {params:{ db: this.dashboard }}).then(res => { - //console.log(res.data.retval); res.data.retval.forEach(widget => { widget.arguments = JSON.parse(widget.arguments); widget.setup = JSON.parse(widget.setup); @@ -123,7 +122,6 @@ export default { axios.get(this.apiurl + '/Config', {params:{ db: this.dashboard }}).then(res => { - //console.log(res.data.retval); for (var name in res.data.retval.widgets) { let widgets = []; let remove = []; diff --git a/public/js/components/Pagination/Pagination.js b/public/js/components/Pagination/Pagination.js index 8b2688834..60ab9c9a4 100644 --- a/public/js/components/Pagination/Pagination.js +++ b/public/js/components/Pagination/Pagination.js @@ -18,7 +18,7 @@ export default { }, methods: { newPageEvent: function (data) { - //console.log("hier", data.page); + }, }, mounted() {}, diff --git a/public/js/components/Stv/Studentenverwaltung/List/New.js b/public/js/components/Stv/Studentenverwaltung/List/New.js index c02d9ba29..f66d931b8 100644 --- a/public/js/components/Stv/Studentenverwaltung/List/New.js +++ b/public/js/components/Stv/Studentenverwaltung/List/New.js @@ -99,7 +99,7 @@ export default { this.suggestions = []; this.$refs.form.clearValidation(); }, - loadSuggestions() {console.log('loadSuggestions'); + loadSuggestions() { if (this.abortController.suggestions) this.abortController.suggestions.abort(); if (this.person !== null) diff --git a/public/js/components/searchbar/searchbar.js b/public/js/components/searchbar/searchbar.js index 83c4c666b..50e09eeb2 100755 --- a/public/js/components/searchbar/searchbar.js +++ b/public/js/components/searchbar/searchbar.js @@ -79,23 +79,12 @@ export default { watch:{ 'searchsettings.types'(newValue){ this.search(); - - }, - }, beforeMount: function() { this.updateSearchOptions(); }, - mounted(){ - window.addEventListener('resize', (event) =>{ - console.log(this.$refs.settings,"this is the refs of the settings") - this.$refs.settings.hide(); - console.log("resizing") - }); - //console.log(this.$refs.settings.show,"this are the refs") - }, methods: { getActionsForRoom: function(res){ res.booklink= FHC_JS_DATA_STORAGE_OBJECT.app_root + @@ -132,7 +121,6 @@ export default { }, calcSearchResultExtent: function() { var rect = this.$refs.searchbox.getBoundingClientRect(); - //console.log(window.innerWidth + ' ' + window.innerHeight + ' ' + JSON.stringify(rect)); this.$refs.result.style.top = Math.floor(rect.bottom + 3) + 'px'; this.$refs.result.style.right = Math.floor(window.innerWidth - rect.right) + 'px'; this.$refs.result.style.width = Math.floor(window.innerWidth * 0.75) + 'px'; diff --git a/public/js/lehre/anrechnung/approveAnrechnungDetail.js b/public/js/lehre/anrechnung/approveAnrechnungDetail.js index 3a40503b5..14d31f800 100755 --- a/public/js/lehre/anrechnung/approveAnrechnungDetail.js +++ b/public/js/lehre/anrechnung/approveAnrechnungDetail.js @@ -307,7 +307,6 @@ $(function(){ { successCallback: function (data, textStatus, jqXHR) { - console.log(data); if (data.error && data.retval != null) { // Print error message