diff --git a/application/controllers/api/frontend/v1/StudstatusAntraege.php b/application/controllers/api/frontend/v1/StudstatusAntraege.php
new file mode 100644
index 000000000..44dc4134d
--- /dev/null
+++ b/application/controllers/api/frontend/v1/StudstatusAntraege.php
@@ -0,0 +1,145 @@
+.
+ */
+
+if (! defined('BASEPATH')) exit('No direct script access allowed');
+
+class StudstatusAntraege extends FHCAPI_Controller
+{
+
+ /**
+ * Object initialization
+ */
+ public function __construct()
+ {
+ parent::__construct([
+ 'getTodos' => self::PERM_LOGGED
+ ]);
+
+ //load models
+ $this->load->model('education/Studierendenantrag_model', 'StudierendenantragModel');
+ $this->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel');
+
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // Public methods
+
+ /**
+ * gets all todos of antraegen of the user with stg leitungsfunction
+ * or list of open antraege for user with assistance function
+ * @access public
+ * @return array || []
+ */
+ public function getTodos()
+ {
+ $uid = getAuthUID();
+
+ //at first get studiengang with leitungsfunktion
+ $result = $this->BenutzerfunktionModel->getSTGLByUID($uid);
+
+ if(hasData($result))
+ {
+ $funktionen = getData($result);
+
+ $studiengaenge = [];
+
+ foreach ($funktionen as $funktion) {
+ $studiengaenge[] = $funktion->studiengang_kz;
+ }
+
+ $dataAntrage = [];
+
+ $result = $this->StudierendenantragModel->getOpenAntraegeForStgl($studiengaenge);
+
+ if (isError($result)) {
+ $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
+ }
+ $dataAntrage[] = getData($result) ?: [];
+ $statusRole = 1;
+
+ $this->terminateWithSuccess([count($dataAntrage) > 0 ? $dataAntrage[0] : $dataAntrage, $statusRole]);
+
+ }
+
+ //TODO delete after check if needed or not
+ //get studiengaenge of assistance (regarding benutzerfunktion)
+ //$result = $this->BenutzerfunktionModel->getSTGAssByUID($uid);
+ /* if(hasData($result)) {
+ $statusRole = 2;
+ $funktionen = getData($result);
+
+ $studiengaenge = [];
+
+ foreach ($funktionen as $funktion) {
+ $studiengaenge[] = $funktion->studiengang_kz;
+ }
+
+ $ci->addMeta('stgAss', $studiengaenge);
+ $dataAntrage = [];
+
+ foreach ($studiengaenge as $studiengang)
+ {
+ $result = $this->StudierendenantragModel->getOpenAntraegeForAss($studiengang);
+
+ if (isError($result)) {
+ $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
+ }
+ if(hasData($result)) {
+ $dataAntrage[] = getData($result);
+ $statusRole = 2;
+ }
+ }
+ }
+ else
+ {
+ $statusRole = 0;
+ $dataAntrage = [];
+ //$this->terminateWithSuccess([[], $statusRole]);
+ }*/
+
+ //get studiengaenge of assistance (regarding rights)
+ $stgAss = $this->permissionlib->getSTG_isEntitledFor('student/studierendenantrag');
+ if(!is_array($stgAss))
+ {
+ $statusRole = 0;
+ $this->terminateWithSuccess([[], $statusRole]);
+ }
+ else {
+ $statusRole = 2;
+ $studiengaenge = [];
+
+ foreach ($stgAss as $stg) {
+ $studiengaenge[] = (int) $stg;
+ }
+
+ $dataAntrage = [];
+ $result = $this->StudierendenantragModel->getOpenAntraegeForAss($studiengaenge);
+
+ if (isError($result)) {
+ $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
+ }
+ if(hasData($result)) {
+ $dataAntrage[] = getData($result);
+ $statusRole = 2;
+ }
+
+ $this->terminateWithSuccess([count($dataAntrage) > 0 ? $dataAntrage[0] : $dataAntrage, $statusRole]);
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/application/models/education/Studierendenantrag_model.php b/application/models/education/Studierendenantrag_model.php
index 677d01f04..f7519b6a3 100644
--- a/application/models/education/Studierendenantrag_model.php
+++ b/application/models/education/Studierendenantrag_model.php
@@ -490,4 +490,75 @@ class Studierendenantrag_model extends DB_Model
return hasData($this->load());
}
+
+ /**
+ * Loads all todos for a certain studiengangsleiter
+ *
+ * @param integer $stg_kz
+ *
+ * @return stdClass
+ */
+ public function getOpenAntraegeForStgl($stg_kz)
+ {
+ $qry = "
+ SELECT
+ studierendenantrag_id,
+ prestudent_id,
+ typ,
+ person.nachname,
+ person.vorname,
+ ps.studiengang_kz
+ FROM campus.tbl_studierendenantrag a
+ JOIN public.tbl_prestudent ps USING (prestudent_id)
+ JOIN public.tbl_person person USING (person_id)
+ WHERE studiengang_kz in ?
+ AND (
+ (typ IN ('Abmeldung', 'AbmeldungStgl', 'Unterbrechung')
+ AND campus.get_status_studierendenantrag(a.studierendenantrag_id) = 'Erstellt')
+ OR
+ (typ = 'Wiederholung'
+ AND campus.get_status_studierendenantrag(a.studierendenantrag_id) = 'Lvszugewiesen')
+ )
+ ORDER BY typ;
+ ";
+
+ $params = array($stg_kz);
+ return $this->execQuery($qry, $params);
+ }
+
+ /**
+ * Lists all open antraege for a certain stg
+ *
+ * @param Array $stg_kz
+ *
+ * @return stdClass
+ */
+ public function getOpenAntraegeForAss($stg_kz)
+ {
+ $qry = "
+ SELECT
+ UPPER(stg.typ) || UPPER(stg.kurzbz) || ' ' || stg.bezeichnung AS studiengang,
+ COUNT(*) AS anzahl
+ FROM campus.tbl_studierendenantrag
+ JOIN public.tbl_prestudent p USING (prestudent_id)
+ JOIN public.tbl_studiengang stg ON p.studiengang_kz=stg.studiengang_kz
+ JOIN campus.tbl_studierendenantrag_status as s ON campus.get_status_id_studierendenantrag(campus.tbl_studierendenantrag.studierendenantrag_id) = studierendenantrag_status_id
+ JOIN campus.tbl_studierendenantrag_statustyp as st USING (studierendenantrag_statustyp_kurzbz)
+ WHERE (
+ s.studierendenantrag_statustyp_kurzbz NOT IN('Zurueckgezogen', 'Genehmigt', 'Abgelehnt', 'EinspruchAbgelehnt', 'Abgemeldet', 'Pause', 'EmailVersandt')
+ OR (
+ s.studierendenantrag_statustyp_kurzbz = 'Genehmigt'
+ AND tbl_studierendenantrag.typ = 'AbmeldungStgl'
+ )
+ )
+ AND p.studiengang_kz IN ?
+ GROUP BY studiengang
+ ORDER BY studiengang
+ "
+ ;
+
+ $params = array($stg_kz);
+ return $this->execQuery($qry, $params);
+ }
+
}
diff --git a/application/models/person/Benutzerfunktion_model.php b/application/models/person/Benutzerfunktion_model.php
index dff422b7d..8c5986462 100644
--- a/application/models/person/Benutzerfunktion_model.php
+++ b/application/models/person/Benutzerfunktion_model.php
@@ -321,6 +321,40 @@ class Benutzerfunktion_model extends DB_Model
return $record;
}
+ /**
+ * Get active Assistenz(en) of the user by UID.
+ * @param $uid
+ */
+ public function getSTGAssByUID($uid)
+ {
+ $query = '
+ SELECT
+ uid,
+ oe_kurzbz,
+ studiengang_kz,
+ typ,
+ tbl_studiengang.bezeichnung
+ FROM
+ public.tbl_benutzerfunktion
+ JOIN public.tbl_studiengang USING (oe_kurzbz)
+ WHERE
+ funktion_kurzbz = \'ass\'
+ AND (datum_von IS NULL OR datum_von <= now())
+ AND (datum_bis IS NULL OR datum_bis >= now())
+ AND uid = ?
+ ORDER BY
+ oe_kurzbz
+ ';
+
+ $parameters_array = array();
+ if (is_string($uid))
+ {
+ $parameters_array[] = $uid;
+ }
+
+ return $this->execQuery($query, $parameters_array);
+ }
+
function updateBenutzerfunktion($funktionJson)
{
$funktionJson['updatevon'] = getAuthUID();
diff --git a/public/js/api/factory/widget/studstatus.js b/public/js/api/factory/widget/studstatus.js
new file mode 100644
index 000000000..96f55652a
--- /dev/null
+++ b/public/js/api/factory/widget/studstatus.js
@@ -0,0 +1,25 @@
+/**
+ * Copyright (C) 2026 fhcomplete.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see
{{countTodosLeitung}} {{$p.t('dashboard','antraegeToEdit')}}:
+ +