From e2839972939848fd888271dc9e43f8d93f28447a Mon Sep 17 00:00:00 2001 From: ma0068 Date: Wed, 23 Oct 2024 14:26:33 +0200 Subject: [PATCH] cleanUp Tasks Tab Details --- application/config/stv.php | 8 +- .../api/frontend/v1/stv/Config.php | 3 +- .../api/frontend/v1/stv/Student.php | 8 +- public/js/api/stv.js | 2 + public/js/api/stv/details.js | 10 + .../Studentenverwaltung/Details/Details.js | 176 ++++++++++------- system/phrasesupdate.php | 183 +++++++++++++++++- 7 files changed, 312 insertions(+), 78 deletions(-) create mode 100644 public/js/api/stv/details.js diff --git a/application/config/stv.php b/application/config/stv.php index 6296e8e6b..8b7792e83 100644 --- a/application/config/stv.php +++ b/application/config/stv.php @@ -2,9 +2,15 @@ $config['tabs'] = [ + 'details' => [ + //all fields can be configured to be hidden, see class attribute stv-details-details-name for name + 'hiddenFields' => [], + 'hideUDFs' => false + ], + 'prestudent' => [ - //all fields can be configured to be hidden, see class attribute stv-prestudent-prestudent-name for name + //all fields can be configured to be hidden, see class attribute stv-details-prestudent-name for name 'hiddenFields' => [ //corresponding to config-entry 'ZGV_DOKTOR_ANZEIGEN' in global.config diff --git a/application/controllers/api/frontend/v1/stv/Config.php b/application/controllers/api/frontend/v1/stv/Config.php index 97477fca7..fd318a79f 100644 --- a/application/controllers/api/frontend/v1/stv/Config.php +++ b/application/controllers/api/frontend/v1/stv/Config.php @@ -58,7 +58,8 @@ class Config extends FHCAPI_Controller $result['details'] = [ 'title' => $this->p->t('stv', 'tab_details'), - 'component' => './Stv/Studentenverwaltung/Details/Details.js' + 'component' => './Stv/Studentenverwaltung/Details/Details.js', + 'config' => $config['details'] ]; $result['notes'] = [ 'title' => $this->p->t('stv', 'tab_notes'), diff --git a/application/controllers/api/frontend/v1/stv/Student.php b/application/controllers/api/frontend/v1/stv/Student.php index 89c317ae4..f805be88a 100644 --- a/application/controllers/api/frontend/v1/stv/Student.php +++ b/application/controllers/api/frontend/v1/stv/Student.php @@ -55,7 +55,7 @@ class Student extends FHCAPI_Controller // Load language phrases $this->loadPhrases([ - 'ui' + 'ui', 'lehre' ]); } @@ -223,12 +223,10 @@ class Student extends FHCAPI_Controller // Check PKs if (count($update_lehrverband) + count($update_student) && $uid === null) { - // TODO(chris): phrase - $this->terminateWithValidationErrors(['' => "Kein/e StudentIn vorhanden!"]); + $this->terminateWithValidationErrors(['' => $this->p->t('lehre', 'error_no_student')]); } if (count($update_person) && $person_id === null) { - // TODO(chris): phrase - $this->terminateWithValidationErrors(['' => "Keine Person vorhanden!"]); + $this->terminateWithValidationErrors(['' => $this->p->t('lehre', 'error_no_person')]); } // Do Updates diff --git a/public/js/api/stv.js b/public/js/api/stv.js index 5a8316916..b66ae401e 100644 --- a/public/js/api/stv.js +++ b/public/js/api/stv.js @@ -5,6 +5,7 @@ import konto from './stv/konto.js'; import kontakt from './stv/kontakt.js'; import prestudent from './stv/prestudent.js'; import status from './stv/status.js'; +import details from './stv/details.js'; export default { verband, @@ -14,6 +15,7 @@ export default { kontakt, prestudent, status, + details, configStudent() { return this.$fhcApi.get('api/frontend/v1/stv/config/student'); }, diff --git a/public/js/api/stv/details.js b/public/js/api/stv/details.js new file mode 100644 index 000000000..bdf26739b --- /dev/null +++ b/public/js/api/stv/details.js @@ -0,0 +1,10 @@ +export default { + get(prestudent_id) { + return this.$fhcApi.post('api/frontend/v1/stv/student/get/' + prestudent_id); + }, + save(prestudent_id, data) { + return this.$fhcApi.post('api/frontend/v1/stv/student/save/' + prestudent_id, + data + ); + }, +} diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Details.js b/public/js/components/Stv/Studentenverwaltung/Details/Details.js index ae4f92b20..34ab779ac 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Details.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Details.js @@ -37,7 +37,11 @@ export default { } }, props: { - modelValue: Object + modelValue: Object, + config: { + type: Object, + default: {} + } }, data() { return { @@ -95,8 +99,7 @@ export default { methods: { updateStudent(n) { // TODO(chris): move to fhcapi.factory - this.$fhcApi - .get('api/frontend/v1/stv/student/get/' + n.prestudent_id) + return this.$fhcApi.factory.stv.details.get(n.prestudent_id) .then(result => { this.data = result.data; if (!this.data.familienstand) @@ -110,14 +113,13 @@ export default { return; this.$refs.form.clearValidation(); - this.$refs.form - .post('api/frontend/v1/stv/student/save/' + this.modelValue.prestudent_id, this.changed) + return this.$fhcApi.factory.stv.details.save(this.modelValue.prestudent_id, this.changed) .then(result => { this.original = {...this.data}; this.changed = {}; this.$refs.form.setFeedback(true, result.data); }) - .catch(this.$fhcAlert.handleSystemError) + .catch(this.$fhcAlert.handleSystemError); }, udfsLoaded(udfs) { this.original = {...(this.original || {}), ...udfs}; @@ -141,16 +143,17 @@ export default {