From 8762e87658523265fe469b2943fa0845f502d375 Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Wed, 17 Jan 2024 15:24:44 +0100 Subject: [PATCH] Noten: Switch all/current semester --- .../controllers/components/stv/Noten.php | 4 +- .../Details/Noten/Zeugnis.js | 54 +++++++++++++------ 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/application/controllers/components/stv/Noten.php b/application/controllers/components/stv/Noten.php index dfde2892b..fb61de065 100644 --- a/application/controllers/components/stv/Noten.php +++ b/application/controllers/components/stv/Noten.php @@ -30,7 +30,7 @@ class Noten extends Auth_Controller return $this->outputJson($result); } - public function getZeugnis($prestudent_id) + public function getZeugnis($prestudent_id, $all = null) { $this->load->model('crm/Student_model', 'StudentModel'); $this->load->model('education/Zeugnisnote_model', 'ZeugnisnoteModel'); @@ -47,7 +47,7 @@ class Noten extends Auth_Controller $student_uid = current(getData($result))->student_uid; - $studiensemester_kurzbz = $this->variablelib->getVar('semester_aktuell'); + $studiensemester_kurzbz = ($all === null) ? $this->variablelib->getVar('semester_aktuell') : null; $result = $this->ZeugnisnoteModel->getZeugnisnoten($student_uid, $studiensemester_kurzbz); if (isError($result)) { diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis.js b/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis.js index 95875f868..0f5bcc62e 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis.js @@ -2,6 +2,8 @@ import {CoreFilterCmpt} from "../../../../filter/Filter.js"; import {CoreRESTClient} from '../../../../../RESTClient.js'; import ZeugnisActions from './Zeugnis/Actions.js'; +const LOCAL_STORAGE_ID = 'stv_details_noten_zeugnis_2024-01-11_stdsem_all'; + export default { components: { CoreFilterCmpt, @@ -13,12 +15,13 @@ export default { data() { return { validStudent: true, - tabulatorEvents: [] + tabulatorEvents: [], + stdsem: '' }; }, computed: { ajaxURL() { - return CoreRESTClient._generateRouterURI('components/stv/Noten/getZeugnis/' + this.student.prestudent_id); + return CoreRESTClient._generateRouterURI('components/stv/Noten/getZeugnis/' + this.student.prestudent_id + this.stdsem); }, tabulatorOptions() { return { @@ -59,29 +62,50 @@ export default { }; } }, + watch: { + ajaxURL(n) { + if (this.$refs.table) + this.$refs.table.tabulator.setData(n); + } + }, methods: { setGrades(selected) { CoreRESTClient .post('components/stv/Noten/update', selected) .then(this.$refs.table.reloadTable) .catch(this.$fhcAlert.handleFormValidation); + }, + saveStdsem(event) { + window.localStorage.setItem(LOCAL_STORAGE_ID, event.target.value ? 'true' : ''); } }, + created() { + const savedPath = window.localStorage.getItem(LOCAL_STORAGE_ID); + this.stdsem = savedPath ? '/all' : ''; + }, + // TODO(chris): phrasen template: `
Kein Student
- - - +
` }; \ No newline at end of file