From 12b2f3ab07444f3a6f3029d9ae755856a5bcd361 Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Thu, 23 May 2024 15:39:31 +0200 Subject: [PATCH 1/3] adding more information to the cis40 stundenplan --- application/models/content/Content_model.php | 44 +++-- public/js/components/Calendar/Calendar.js | 15 +- .../js/components/Calendar/CalendarModal.js | 155 ++++++++++++++++++ public/js/components/Calendar/Week/Page.js | 8 +- 4 files changed, 201 insertions(+), 21 deletions(-) create mode 100644 public/js/components/Calendar/CalendarModal.js diff --git a/application/models/content/Content_model.php b/application/models/content/Content_model.php index ef073fcf3..ed447b36a 100755 --- a/application/models/content/Content_model.php +++ b/application/models/content/Content_model.php @@ -78,6 +78,31 @@ class Content_model extends DB_Model */ public function getMenu($root_content_id, $uid, $sprache = DEFAULT_LANGUAGE) { + + /*, + { + "content_id": 1000007, + "template_kurzbz": "redirect", + "titel": "Anrechnung", + "content": "", + "menu_open": false, + "aktiv": true, + "childs": [] + } + */ + + /* + { + "content_id": 1000003, + "template_kurzbz": "redirect", + "titel": "COVID-19", + "content": "", + "menu_open": false, + "aktiv": true, + "childs": [] + }, + */ + if ($root_content_id === null) { $res = json_decode('{ "content_id": 1000000, @@ -105,15 +130,6 @@ class Content_model extends DB_Model "aktiv": true, "childs": [] }, - { - "content_id": 1000003, - "template_kurzbz": "redirect", - "titel": "COVID-19", - "content": "", - "menu_open": false, - "aktiv": true, - "childs": [] - }, { "content_id": 1000004, "template_kurzbz": "redirect", @@ -149,16 +165,8 @@ class Content_model extends DB_Model "menu_open": false, "aktiv": true, "childs": [] - }, - { - "content_id": 1000007, - "template_kurzbz": "redirect", - "titel": "Anrechnung", - "content": "", - "menu_open": false, - "aktiv": true, - "childs": [] } + ] }'); return success($res); diff --git a/public/js/components/Calendar/Calendar.js b/public/js/components/Calendar/Calendar.js index 7ade4df60..ae36eab1f 100755 --- a/public/js/components/Calendar/Calendar.js +++ b/public/js/components/Calendar/Calendar.js @@ -5,6 +5,7 @@ import CalendarWeek from './Week.js'; import CalendarWeeks from './Weeks.js'; import CalendarMinimized from './Minimized.js'; import CalendarDate from '../../composables/CalendarDate.js'; +import CalendarModal from './CalendarModal.js'; // TODO(chris): week/month toggle @@ -15,7 +16,8 @@ export default { CalendarYears, CalendarWeek, CalendarWeeks, - CalendarMinimized + CalendarMinimized, + CalendarModal }, provide() { return { @@ -61,6 +63,7 @@ export default { ], data() { return { + currentlySelectedEvent:null, header: '', prevMode: null, currMode: null, @@ -102,6 +105,15 @@ export default { }, methods: { handleInput(day) { + // set the event when clicking on the lernveranstaltung in the data + this.currentlySelectedEvent = day; + console.log(this.currentlySelectedEvent) + // showing the modal + Vue.nextTick(()=>{ + this.$refs.calendarModal.show(); + }) + + console.log(day,"this is the day") this.$emit(day[0], day[1]); } }, @@ -135,6 +147,7 @@ export default { }, template: `
+
` } diff --git a/public/js/components/Calendar/CalendarModal.js b/public/js/components/Calendar/CalendarModal.js new file mode 100644 index 000000000..f8bf57de6 --- /dev/null +++ b/public/js/components/Calendar/CalendarModal.js @@ -0,0 +1,155 @@ +import BsModal from "../Bootstrap/Modal.js"; +import Alert from "../Bootstrap/Alert.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, + topic: null, + profilUpdate: null, + editData: this.value, + fileID: null, + breadcrumb: null, + loading: false, + + result: false, + info: null, + }; + }, + methods: { + updateFileIDFunction: function (newFileID) { + this.fileID = newFileID; + }, + + async submitProfilChange() { + //? check if data is valid before making a request + if (this.topic && this.profilUpdate) { + //? if profil update contains any attachment + if (this.fileID) { + const fileData = await this.uploadFiles(this.fileID); + + this.fileID = fileData ? fileData : null; + } + + //? inserts new row in public.tbl_cis_profil_update + //* calls the update api call if an update field is present in the data that was passed to the modal + const handleApiResponse = (res) => { + //? toggles the loading to false and closes the loading modal + this.loading = false; + this.setLoading(false); + + if (res.data.error == 0) { + this.result = true; + this.hide(); + Alert.popup( + "Ihre Anfrage wurde erfolgreich gesendet. Bitte warten Sie, während sich das Team um Ihre Anfrage kümmert." + ); + } else { + this.result = false; + this.hide(); + Alert.popup( + "Ein Fehler ist aufgetreten: " + JSON.stringify(res.data.retval) + ); + } + }; + + //* v-show on EditProfil modal binded to this.loading + //? hides the EditProfil modal and shows the loading modal by calling a callback that was passed as prop from the parent component + this.loading = true; + this.setLoading(true); + + this.editData.updateID + ? Vue.$fhcapi.ProfilUpdate.updateProfilRequest( + this.topic, + this.profilUpdate, + this.editData.updateID, + this.fileID ? this.fileID[0] : null + ) + .then((res) => { + handleApiResponse(res); + }) + .catch((err) => { + console.error(err); + }) + : Vue.$fhcapi.ProfilUpdate.insertProfilRequest( + this.topic, + this.profilUpdate, + this.fileID ? this.fileID[0] : null + ) + .then((res) => { + handleApiResponse(res); + }) + .catch((err) => { + console.error(err); + }); + } + }, + + uploadFiles: async function (files) { + if (files[0].type !== "application/x.fhc-dms+json") { + let formData = new FormData(); + formData.append("files[]", files[0]); + const result = this.editData.updateID + ? //? updating old attachment by replacing + //* second parameter of api request insertFile checks if the file has to be replaced or not + await Vue.$fhcapi.ProfilUpdate.insertFile( + formData, + this.editData.updateID + ).then((res) => { + return res.data?.map((file) => file.dms_id); + }) + : //? fresh insert of new attachment + await Vue.$fhcapi.ProfilUpdate.insertFile(formData).then((res) => { + return res.data?.map((file) => file.dms_id); + }); + return result; + } else { + //? attachment hasn't been replaced + return false; + } + }, + }, + computed: {}, + created() { + console.log("this is an test") + }, + mounted() { + this.modal = this.$refs.modalContainer.modal; + }, + popup(options) { + return BsModal.popup.bind(this)(null, options); + }, + template: /*html*/ ` + + + + + + `, +}; diff --git a/public/js/components/Calendar/Week/Page.js b/public/js/components/Calendar/Week/Page.js index 47d48b7f7..799b0ca70 100755 --- a/public/js/components/Calendar/Week/Page.js +++ b/public/js/components/Calendar/Week/Page.js @@ -104,8 +104,12 @@ export default {
{{hour}}:00
- - {{event.orig.title}} + +
+ {{event.orig.title}} + {{event.orig.ort_kurzbz}} + {{event.orig.mitarbeiter_kurzbz}} +
From 234ec03db91f1e3d65627cb60fa4c3aea86180ef Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Fri, 24 May 2024 09:37:07 +0200 Subject: [PATCH 2/3] adds the phrase noGrade --- system/phrasesupdate.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index b2bef25ee..8c140ea63 100755 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -2263,6 +2263,26 @@ $phrases = array( ), //**************** CORE/lehre + array( + 'app' => 'core', + 'category' => 'lehre', + 'phrase' => 'noGrades', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Unbewertet', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Not Graded', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), array( 'app' => 'core', 'category' => 'lehre', From 16f90604b6ef94feea16ab60fa02e9e618ebfe13 Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Fri, 24 May 2024 11:17:06 +0200 Subject: [PATCH 3/3] stundenplan modal for LVs and making calendar header sticky --- public/js/apps/Cis/Stundenplan.js | 2 + public/js/components/Calendar/Calendar.js | 2 +- .../js/components/Calendar/CalendarModal.js | 43 +++++++++++++++++-- public/js/components/Calendar/Pane.js | 3 +- public/js/components/Calendar/Week/Page.js | 6 +-- 5 files changed, 47 insertions(+), 9 deletions(-) diff --git a/public/js/apps/Cis/Stundenplan.js b/public/js/apps/Cis/Stundenplan.js index eaa75bca3..25823b193 100755 --- a/public/js/apps/Cis/Stundenplan.js +++ b/public/js/apps/Cis/Stundenplan.js @@ -1,4 +1,5 @@ import FhcCalendar from "../../components/Calendar/Calendar.js"; +import Phrasen from "../../plugin/Phrasen.js"; const app = Vue.createApp({ components: { @@ -50,4 +51,5 @@ const app = Vue.createApp({ } }); app.config.unwrapInjectedRef = true; +app.use(Phrasen); app.mount('#content'); \ No newline at end of file diff --git a/public/js/components/Calendar/Calendar.js b/public/js/components/Calendar/Calendar.js index ae36eab1f..2b4f7b8a3 100755 --- a/public/js/components/Calendar/Calendar.js +++ b/public/js/components/Calendar/Calendar.js @@ -106,7 +106,7 @@ export default { methods: { handleInput(day) { // set the event when clicking on the lernveranstaltung in the data - this.currentlySelectedEvent = day; + this.currentlySelectedEvent = day[1]; console.log(this.currentlySelectedEvent) // showing the modal Vue.nextTick(()=>{ diff --git a/public/js/components/Calendar/CalendarModal.js b/public/js/components/Calendar/CalendarModal.js index f8bf57de6..5f6fd9d09 100644 --- a/public/js/components/Calendar/CalendarModal.js +++ b/public/js/components/Calendar/CalendarModal.js @@ -133,7 +133,16 @@ export default { } }, }, - computed: {}, + 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(); + } + }, created() { console.log("this is an test") }, @@ -145,11 +154,37 @@ export default { }, template: /*html*/ ` - + - + + + `, }; diff --git a/public/js/components/Calendar/Pane.js b/public/js/components/Calendar/Pane.js index bbc21af0c..8ff9b6259 100755 --- a/public/js/components/Calendar/Pane.js +++ b/public/js/components/Calendar/Pane.js @@ -46,7 +46,8 @@ export default { }, template: `