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/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 7ade4df60..2b4f7b8a3 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[1]; + 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..5f6fd9d09 --- /dev/null +++ b/public/js/components/Calendar/CalendarModal.js @@ -0,0 +1,190 @@ +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: { + 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") + }, + 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/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: `