diff --git a/application/config/stv.php b/application/config/stv.php index aa885c9e1..675899108 100644 --- a/application/config/stv.php +++ b/application/config/stv.php @@ -58,6 +58,10 @@ $config['tabs'] = //if true, Anrechnungen can be added and edited in tab Anrechnungen 'editableAnrechnungen' => false, ], + 'notes' => [ + //if true, the count of Messages will be shown in the header of the Tab Messages + 'showCountNotes' => true + ] ]; // List of fields to show when ZGV_DOKTOR_ANZEIGEN is defined diff --git a/application/controllers/api/frontend/v1/stv/Config.php b/application/controllers/api/frontend/v1/stv/Config.php index adf9f729e..935928c81 100644 --- a/application/controllers/api/frontend/v1/stv/Config.php +++ b/application/controllers/api/frontend/v1/stv/Config.php @@ -62,10 +62,15 @@ class Config extends FHCAPI_Controller 'component' => './Stv/Studentenverwaltung/Details/Details.js', 'config' => $config['details'] ]; + + $showSuffix = $config['notes']['showCountNotes'] ?? false; $result['notes'] = [ 'title' => $this->p->t('stv', 'tab_notes'), - 'component' => './Stv/Studentenverwaltung/Details/Notizen.js' + 'component' => './Stv/Studentenverwaltung/Details/Notizen.js', + 'config' => $config['notes'], + 'showSuffix' => $showSuffix && ($config['notes']['showCountNotes'] ?? false) ]; + $result['contact'] = [ 'title' => $this->p->t('stv', 'tab_contact'), 'component' => './Stv/Studentenverwaltung/Details/Kontakt.js', diff --git a/application/controllers/api/frontend/v1/stv/Favorites.php b/application/controllers/api/frontend/v1/stv/Favorites.php index b8fe6f3d7..ca8b62da6 100644 --- a/application/controllers/api/frontend/v1/stv/Favorites.php +++ b/application/controllers/api/frontend/v1/stv/Favorites.php @@ -35,8 +35,6 @@ class Favorites extends FHCAPI_Controller // Load models $this->load->model('system/Variable_model', 'VariableModel'); - - // TODO(chris): variable table might be to small to store favorites! } public function index() @@ -62,6 +60,17 @@ class Favorites extends FHCAPI_Controller $favorites = $this->input->post('favorites'); + $removed = []; + while (strlen($favorites) > 64) { + $favObj = json_decode($favorites); + if (!$favObj->list) + break; + $removed[] = array_shift($favObj->list); + $favorites = json_encode($favObj); + } + if ($removed) + $this->addMeta('removed', $removed); + $result = $this->VariableModel->setVariable(getAuthUID(), 'stv_favorites', $favorites); $this->getDataOrTerminateWithError($result); diff --git a/application/controllers/api/frontend/v1/stv/Status.php b/application/controllers/api/frontend/v1/stv/Status.php index 629d5512a..665fb620f 100644 --- a/application/controllers/api/frontend/v1/stv/Status.php +++ b/application/controllers/api/frontend/v1/stv/Status.php @@ -24,7 +24,6 @@ class Status extends FHCAPI_Controller 'updateStatus' => ['admin:rw', 'assistenz:rw'], 'advanceStatus' => ['admin:rw', 'assistenz:rw'], 'confirmStatus' => ['admin:rw', 'assistenz:rw'], - ]); //Load Models @@ -440,9 +439,10 @@ class Status extends FHCAPI_Controller ]); if (!$this->form_validation->run()) + { $this->terminateWithValidationErrors($this->form_validation->error_array()); + } - $this->load->library('PrestudentLib'); $this->db->trans_start(); @@ -628,8 +628,9 @@ class Status extends FHCAPI_Controller ]); if (!$this->form_validation->run()) + { $this->terminateWithValidationErrors($this->form_validation->error_array()); - + } // Start DB transaction $this->db->trans_start(); diff --git a/application/controllers/api/frontend/v1/stv/Student.php b/application/controllers/api/frontend/v1/stv/Student.php index ac09f39bb..21b07b755 100644 --- a/application/controllers/api/frontend/v1/stv/Student.php +++ b/application/controllers/api/frontend/v1/stv/Student.php @@ -106,6 +106,7 @@ class Student extends FHCAPI_Controller $this->PrestudentModel->addSelect('p.staatsbuergerschaft'); $this->PrestudentModel->addSelect('p.matr_nr'); $this->PrestudentModel->addSelect('p.anrede'); + $this->PrestudentModel->addSelect('p.zugangscode'); if (defined('ACTIVE_ADDONS') && strpos(ACTIVE_ADDONS, 'bewerbung') !== false) { $this->PrestudentModel->addSelect( diff --git a/application/core/Notiz_Controller.php b/application/core/Notiz_Controller.php index 472ac7669..c2bb03267 100644 --- a/application/core/Notiz_Controller.php +++ b/application/core/Notiz_Controller.php @@ -21,6 +21,7 @@ abstract class Notiz_Controller extends FHCAPI_Controller 'loadDokumente' => self::DEFAULT_PERMISSION_R, 'getMitarbeiter' => self::DEFAULT_PERMISSION_R, 'isBerechtigt' => self::DEFAULT_PERMISSION_R, + 'getCountNotes' => self::DEFAULT_PERMISSION_R, ]; if(!is_array($permissions)) @@ -459,4 +460,20 @@ abstract class Notiz_Controller extends FHCAPI_Controller return $this->terminateWithSuccess($result); } + public function getCountNotes($person_id) + { + $this->NotizzuordnungModel->addSelect('COUNT(*) AS anzahl', false); + + $result = $this->NotizzuordnungModel->loadWhere( + array('person_id' => $person_id) + ); + + if (isError($result)) { + $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); + } + + $anzahl = current(getData($result)); + return $this->terminateWithSuccess($anzahl->anzahl ?: 0); + } + } \ No newline at end of file diff --git a/public/css/components/primevue.css b/public/css/components/primevue.css index fbbae4e58..5949d6ecc 100644 --- a/public/css/components/primevue.css +++ b/public/css/components/primevue.css @@ -3973,6 +3973,10 @@ border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; } +.p-tabview-panel .btn-close, +.p-tabview-panel .carousel-indicators [data-bs-target] { + box-sizing: content-box; +} .p-toolbar { background: #efefef; diff --git a/public/js/api/factory/notiz/person.js b/public/js/api/factory/notiz/person.js index 33b572d1a..c75e79acf 100644 --- a/public/js/api/factory/notiz/person.js +++ b/public/js/api/factory/notiz/person.js @@ -83,5 +83,11 @@ export default { method: 'get', url: 'api/frontend/v1/notiz/notizPerson/isBerechtigt/' }; + }, + getCountNotes(person_id){ + return { + method: 'get', + url: 'api/frontend/v1/notiz/notizPerson/getCountNotes/' + person_id + }; } }; diff --git a/public/js/components/Form/Validation.js b/public/js/components/Form/Validation.js index 75fd7d724..530f6b514 100644 --- a/public/js/components/Form/Validation.js +++ b/public/js/components/Form/Validation.js @@ -23,7 +23,8 @@ export default { if (!Array.isArray(feedback)) feedback = [feedback]; const ts = Date.now(); - this.feedback[valid ? 'success' : 'danger'] = feedback.map(msg => [msg, ts]); + this.feedback[valid ? 'success' : 'danger'] + .push(...feedback.map(msg => [msg, ts])); } }, mounted() { diff --git a/public/js/components/Notiz/Notiz.js b/public/js/components/Notiz/Notiz.js index 5a3944803..ab4230681 100644 --- a/public/js/components/Notiz/Notiz.js +++ b/public/js/components/Notiz/Notiz.js @@ -296,6 +296,7 @@ export default { showId: false, showLastupdate: false }, + newCount: null } }, methods: { @@ -367,6 +368,7 @@ export default { .catch(this.$fhcAlert.handleSystemError) .finally(() => { window.scrollTo(0, 0); + this.getCountNotes(); }); }, deleteNotiz(notiz_id) { @@ -381,6 +383,7 @@ export default { .catch(this.$fhcAlert.handleSystemError) .finally(() => { window.scrollTo(0, 0); + this.getCountNotes(); }); }, loadNotiz(notiz_id) { @@ -424,6 +427,7 @@ export default { .catch(this.$fhcAlert.handleSystemError) .finally(() => { window.scrollTo(0, 0); + this.getCountNotes(); }); }, reload() { @@ -464,7 +468,6 @@ export default { }); }, initTinyMCE() { - const vm = this; tinymce.init({ target: this.$refs.editor.$refs.input, //Important: not selector: to enable multiple import of component @@ -503,15 +506,30 @@ export default { this.showVariables[columnToShow] = true; }); }, + getCountNotes(){ + return this.$api + .call(this.endpoint.getCountNotes(this.id)) + .then( + result => { + this.newCount = result.data; + this.$nextTick(() => { + this.$emit('updateCount', this.newCount); + }); + }) + .catch(this.$fhcAlert.handleSystemError); + } }, created() { this.initializeShowVariables(); this.getUid(); }, async mounted() { - if(this.showTinyMce){ - this.initTinyMCE(); + if (this.showTinyMce) { + await this.initTinyMCE(); } + this.$nextTick(() => { + this.getCountNotes(); + }); }, watch: { //watcher für Tinymce-Textfeld @@ -548,16 +566,17 @@ export default { this.reload(); } }, - beforeDestroy() { - if(this.showTinyMce) { - this.editor.destroy(); + beforeUnmount() { + if (this.editor && tinymce.get(this.editor.id)) { + tinymce.get(this.editor.id).remove(); + this.editor = null; } }, template: `
- + - - - - + + + + + +
+ {{ message.summary }} +
+
{{ message.detail }}
+
+ +