From 02a81fd52e45e4c5a95498a4fab34a87b6d88ed5 Mon Sep 17 00:00:00 2001 From: Ivymaster Date: Wed, 22 Jul 2026 08:58:58 +0200 Subject: [PATCH 01/11] BUG: fix for available tempus event resource suggestions --- application/models/ressource/Betriebsmittel_model.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/models/ressource/Betriebsmittel_model.php b/application/models/ressource/Betriebsmittel_model.php index 682961cee..cf974086d 100644 --- a/application/models/ressource/Betriebsmittel_model.php +++ b/application/models/ressource/Betriebsmittel_model.php @@ -46,11 +46,11 @@ class Betriebsmittel_model extends DB_Model JOIN lehre.tbl_kalender ON tbl_kalender.eindeutige_gruppen_id = tbl_betriebsmittel_kalender.eindeutige_kalender_gruppen_id WHERE betriebsmittel_id=tbl_betriebsmittel.betriebsmittel_id - AND tbl_kalender.von <= ? - AND tbl_kalender.bis >= ? + AND tbl_kalender.von < ? + AND tbl_kalender.bis > ? )"; - return $this->execQuery($qry, array($from, $to)); + return $this->execQuery($qry, array($to, $from)); } } From 817afa545be6bb5e3c451e505cb35ed6c03c0675 Mon Sep 17 00:00:00 2001 From: Ivymaster Date: Wed, 22 Jul 2026 15:52:31 +0200 Subject: [PATCH 02/11] add tempus kalender tags --- application/config/routes.php | 2 + application/config/tempus.php | 9 +- .../api/frontend/v1/tempus/Tags.php | 53 +++++ application/core/Tag_Controller.php | 30 ++- application/libraries/KalenderLib.php | 186 +++++++++------ application/views/Tempus.php | 1 + public/css/components/calendar/events.css | 3 + public/css/tags.css | 7 + public/js/api/factory/tempus/tag.js | 59 +++++ public/js/components/Tag/Tag.js | 6 +- .../Renderer/Lehreinheit/calendarEvent.js | 49 +++- .../Renderer/Lehreinheit/modalContent.js | 54 ++++- public/js/components/Tempus/Tempus.js | 220 ++++++++++++++++-- .../composables/Tempus/ContextMenuActions.js | 5 + system/dbupdate_3.4.php | 1 + .../dbupdate_3.4/78052_tempus_tag_events.php | 19 ++ system/phrasesupdate.php | 80 +++++++ 17 files changed, 694 insertions(+), 90 deletions(-) create mode 100644 application/controllers/api/frontend/v1/tempus/Tags.php create mode 100644 public/js/api/factory/tempus/tag.js create mode 100644 system/dbupdate_3.4/78052_tempus_tag_events.php diff --git a/application/config/routes.php b/application/config/routes.php index 8024f449a..32c2152a9 100644 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -125,6 +125,8 @@ $route['api/frontend/v1/stv/[sS]tudents/([WS]S[0-9]{4})/person/(:num)'] = 'api/f // load routes from extensions, also look for environment-specific configs $subdirs = ['application/config/extensions', 'application/config/' . ENVIRONMENT . '/extensions']; +$route['api/frontend/v1/tempus/Tags/getTagsByCalendar/(:num)'] = 'api/frontend/v1/tempus/Tags/getTagsByCalendar/$1'; + foreach($subdirs as $subdir) { if(is_dir($subdir)) diff --git a/application/config/tempus.php b/application/config/tempus.php index e3e18b954..833f5655f 100644 --- a/application/config/tempus.php +++ b/application/config/tempus.php @@ -2,4 +2,11 @@ $config['send_update_mails'] = false; $config['calendar_start'] = 7; -$config['calendar_end'] = 23; \ No newline at end of file +$config['calendar_end'] = 23; + + +$config['tempus_tags'] = [ + 'prioone' => ['readonly' => false], + 'priotwo' => ['readonly' => true], + 'hinweis' => ['readonly' => false], +]; \ No newline at end of file diff --git a/application/controllers/api/frontend/v1/tempus/Tags.php b/application/controllers/api/frontend/v1/tempus/Tags.php new file mode 100644 index 000000000..c5223cd9a --- /dev/null +++ b/application/controllers/api/frontend/v1/tempus/Tags.php @@ -0,0 +1,53 @@ + self::BERECHTIGUNG_KURZBZ, + 'getTags' => self::BERECHTIGUNG_KURZBZ, + 'getTagsByCalendar' => self::BERECHTIGUNG_KURZBZ, + 'addTag' => self::BERECHTIGUNG_KURZBZ, + 'updateTag' => self::BERECHTIGUNG_KURZBZ, + 'doneTag' => self::BERECHTIGUNG_KURZBZ, + 'deleteTag' => self::BERECHTIGUNG_KURZBZ + ]); + + $this->config->load('tempus'); + } + + public function getTag($readonly_tags = null) + { + parent::getTag($this->config->item('tempus_tags')); + } + public function getTags($tags = null) + { + parent::getTags($this->config->item('tempus_tags')); + } + public function getTagsByCalendar($eindeutige_kalender_gruppen_id = null) + { + parent::getTagsByAssignmentTypeValue('eindeutige_kalender_gruppen_id', $eindeutige_kalender_gruppen_id, $this->config->item('tempus_tags')); + } + public function addTag($withZuordnung = true, $updatable_tags = null) + { + parent::addTag(true, $this->config->item('tempus_tags')); + } + public function updateTag($updatable_tags = null) + { + parent::updateTag($this->config->item('tempus_tags')); + } + public function deleteTag($withZuordnung = true, $updatable_tags = null) + { + parent::deleteTag(true, $this->config->item('tempus_tags')); + } + public function doneTag($updatable_tags = null) + { + parent::doneTag($this->config->item('tempus_tags')); + } +} diff --git a/application/core/Tag_Controller.php b/application/core/Tag_Controller.php index 5b9bac6c5..6a160c75b 100644 --- a/application/core/Tag_Controller.php +++ b/application/core/Tag_Controller.php @@ -106,7 +106,33 @@ class Tag_Controller extends FHCAPI_Controller $notiztypen = $this->NotiztypModel->loadWhere(array('aktiv' => true)); $this->terminateWithSuccess(hasData($notiztypen) ? getData($notiztypen) : array()); } + public function getTagsByAssignmentTypeValue($zuordnung_typ, $zuordnung_id, $tags = null) + { + $this->NotizzuordnungModel->addSelect( + 'tbl_notizzuordnung.notiz_id as notiz_id, + typ_kurzbz as tag_typ_kurzbz, + array_to_json(bezeichnung_mehrsprachig::varchar[])->>0 as bezeichnung, + style, + beschreibung, + tag, + tbl_notiz.erledigt as done + ' + ); + + if (is_array($tags) && !isEmptyArray($tags)) + { + $tags = $this->_filterTag($tags, false); + $this->NotizzuordnungModel->db->where_in('tbl_notiz_typ.typ_kurzbz', $tags); + } + $this->NotizzuordnungModel->addJoin('public.tbl_notiz', 'public.tbl_notizzuordnung.notiz_id = public.tbl_notiz.notiz_id'); + $this->NotizzuordnungModel->addJoin('public.tbl_notiz_typ', 'public.tbl_notiz.typ = public.tbl_notiz_typ.typ_kurzbz'); + + $this->NotizzuordnungModel->addOrder('prioritaet'); + + $notiztypen = $this->NotizzuordnungModel->loadWhere(array('aktiv' => true, $zuordnung_typ => $zuordnung_id)); + $this->terminateWithSuccess(hasData($notiztypen) ? getData($notiztypen) : array()); + } public function addTag($withZuordnung = true, $updatable_tags = null) { $postData = $this->getPostJson(); @@ -126,7 +152,7 @@ class Tag_Controller extends FHCAPI_Controller if (!in_array($postData->tag_typ_kurzbz, $tags)) $this->terminateWithError($this->p->t('ui', 'keineBerechtigung')); } - + if ($withZuordnung) { $return = array(); @@ -135,7 +161,7 @@ class Tag_Controller extends FHCAPI_Controller $this->terminateWithError('Error occurred', self::ERROR_TYPE_GENERAL); $values = array_unique($postData->values); - + foreach ($values as $value) { $insertResult = $this->addNotiz($postData); diff --git a/application/libraries/KalenderLib.php b/application/libraries/KalenderLib.php index 3a531102f..70b23e891 100644 --- a/application/libraries/KalenderLib.php +++ b/application/libraries/KalenderLib.php @@ -39,56 +39,56 @@ class KalenderLib $end_date = date('Y-m-d', strtotime($end_date . ' +1 day')); $this->_ci->KalenderModel->addSelect('tbl_kalender.kalender_id, - tbl_kalender.eindeutige_gruppen_id, - tbl_kalender.status_kurzbz, - tbl_kalender.typ, - tbl_kalender.von, - tbl_kalender.bis, - tbl_kalender_ort.ort_kurzbz, - tbl_lehreinheit.lehreinheit_id, - tbl_lehreinheit.lehrveranstaltung_id, - tbl_lehreinheit.lehrfach_id, - tbl_lehreinheit.lehrform_kurzbz, - tbl_lehrveranstaltung.oe_kurzbz, - lehrfach.kurzbz AS lehrfach_kurzbz, - lehrfach.bezeichnung AS lehrfach_bezeichnung, - lehrfach.farbe, - COALESCE(orginasator.uid, tbl_lehreinheitmitarbeiter.mitarbeiter_uid) as mitarbeiter_uid, - COALESCE(reservierung_person.vorname, tbl_person.vorname) as vorname, - COALESCE(reservierung_person.nachname, tbl_person.nachname) as nachname, - COALESCE(reservierung_ma.kurzbz, tbl_mitarbeiter.kurzbz) AS ma_kurzbz, - teilnehmergruppe.gruppe_kurzbz as teilnehmerg_grp, - COALESCE ( - UPPER(tbl_studiengang.typ || tbl_studiengang.kurzbz) || - COALESCE(verbandgruppe.semester::varchar, \'\') || - COALESCE(verbandgruppe.verband::varchar, \'\') || - COALESCE(verbandgruppe.gruppe, \'\'), - \'\') as verband_grp, - tbl_kalender_event.beschreibung, - tbl_kalender_event.titel, - teilmitarbeiter.kurzbz as teilnehmer_kurzbz, - teilperson.vorname as teilnehmer_vorname, - teilperson.nachname as teilnehmer_nachname, - teilbenutzer.uid as teilnehmer_uid, - CASE - WHEN tbl_lehreinheitgruppe.gruppe_kurzbz IS NULL THEN - COALESCE( - UPPER(le_studiengang.typ || le_studiengang.kurzbz) || - COALESCE(tbl_lehreinheitgruppe.semester::varchar, \'\') || - COALESCE(tbl_lehreinheitgruppe.verband::varchar, \'\') || - COALESCE(tbl_lehreinheitgruppe.gruppe, \'\'), - \'\') - ELSE tbl_lehreinheitgruppe.gruppe_kurzbz - END AS lehreinheit_gruppe_bezeichnung, - tbl_lehreinheitgruppe.gruppe_kurzbz as le_gruppe_kurzbz, - tbl_lehreinheitgruppe.studiengang_kz as le_studiengang_kz, - tbl_lehreinheitgruppe.semester as le_semester, - tbl_lehreinheitgruppe.verband as le_verband, - tbl_lehreinheitgruppe.gruppe as le_gruppe, - le_gruppe.direktinskription as le_direktinskription, - - - '); + tbl_kalender.eindeutige_gruppen_id, + tbl_kalender.status_kurzbz, + tbl_kalender.typ, + tbl_kalender.von, + tbl_kalender.bis, + tbl_kalender_ort.ort_kurzbz, + tbl_lehreinheit.lehreinheit_id, + tbl_lehreinheit.lehrveranstaltung_id, + tbl_lehreinheit.lehrfach_id, + tbl_lehreinheit.lehrform_kurzbz, + tbl_lehrveranstaltung.oe_kurzbz, + lehrfach.kurzbz AS lehrfach_kurzbz, + lehrfach.bezeichnung AS lehrfach_bezeichnung, + lehrfach.farbe, + COALESCE(orginasator.uid, tbl_lehreinheitmitarbeiter.mitarbeiter_uid) as mitarbeiter_uid, + COALESCE(reservierung_person.vorname, tbl_person.vorname) as vorname, + COALESCE(reservierung_person.nachname, tbl_person.nachname) as nachname, + COALESCE(reservierung_ma.kurzbz, tbl_mitarbeiter.kurzbz) AS ma_kurzbz, + teilnehmergruppe.gruppe_kurzbz as teilnehmerg_grp, + COALESCE ( + UPPER(tbl_studiengang.typ || tbl_studiengang.kurzbz) || + COALESCE(verbandgruppe.semester::varchar, \'\') || + COALESCE(verbandgruppe.verband::varchar, \'\') || + COALESCE(verbandgruppe.gruppe, \'\'), + \'\') as verband_grp, + tbl_kalender_event.beschreibung, + tbl_kalender_event.titel, + teilmitarbeiter.kurzbz as teilnehmer_kurzbz, + teilperson.vorname as teilnehmer_vorname, + teilperson.nachname as teilnehmer_nachname, + teilbenutzer.uid as teilnehmer_uid, + CASE + WHEN tbl_lehreinheitgruppe.gruppe_kurzbz IS NULL THEN + COALESCE( + UPPER(le_studiengang.typ || le_studiengang.kurzbz) || + COALESCE(tbl_lehreinheitgruppe.semester::varchar, \'\') || + COALESCE(tbl_lehreinheitgruppe.verband::varchar, \'\') || + COALESCE(tbl_lehreinheitgruppe.gruppe, \'\'), + \'\') + ELSE tbl_lehreinheitgruppe.gruppe_kurzbz + END AS lehreinheit_gruppe_bezeichnung, + tbl_lehreinheitgruppe.gruppe_kurzbz as le_gruppe_kurzbz, + tbl_lehreinheitgruppe.studiengang_kz as le_studiengang_kz, + tbl_lehreinheitgruppe.semester as le_semester, + tbl_lehreinheitgruppe.verband as le_verband, + tbl_lehreinheitgruppe.gruppe as le_gruppe, + le_gruppe.direktinskription as le_direktinskription, + tag_data_agg.tags as tags, + resource_data_agg.resources as resources + '); $this->_ci->KalenderModel->addJoin('lehre.tbl_kalender_lehreinheit', 'tbl_kalender.kalender_id = tbl_kalender_lehreinheit.kalender_id', 'LEFT'); $this->_ci->KalenderModel->addJoin('lehre.tbl_kalender_event', 'tbl_kalender.kalender_id = tbl_kalender_event.kalender_id', 'LEFT'); @@ -134,6 +134,69 @@ class KalenderLib ); $this->_ci->KalenderModel->addJoin('public.tbl_studiengang le_studiengang', 'le_lehrverband.studiengang_kz = le_studiengang.studiengang_kz', 'LEFT'); + // Include tags in the query + $this->_ci->load->config('tempus'); + $tags = $this->_ci->config->item('tempus_tags'); + + $whereTags = ''; + if (is_array($tags) && !isEmptyArray($tags)) { + $tags = array_keys($tags); + + foreach ($tags as $key => $tag) { + $tags[$key] = $this->_ci->KalenderModel->escape($tag); + } + $whereTags = " AND nt.typ_kurzbz IN (" . implode(",", $tags) . ")"; + } + $subQueryTag = "( + SELECT + tag.eindeutige_kalender_gruppen_id, + COALESCE(json_agg(tag ORDER BY tag.done, tag.prioritaet), '[]'::json) AS tags + FROM ( + SELECT DISTINCT ON (n.notiz_id) + n.notiz_id AS id, + nt.typ_kurzbz, + array_to_json(nt.bezeichnung_mehrsprachig)->>0 AS beschreibung, + n.text AS notiz, + nt.style, + n.erledigt AS done, + nt.prioritaet AS prioritaet, + nz.eindeutige_kalender_gruppen_id + FROM public.tbl_notizzuordnung AS nz + JOIN public.tbl_notiz AS n ON nz.notiz_id = n.notiz_id + JOIN public.tbl_notiz_typ AS nt ON n.typ = nt.typ_kurzbz " . $whereTags . " + ) AS tag + GROUP BY tag.eindeutige_kalender_gruppen_id + ) AS tag_data_agg"; + + $this->_ci->KalenderModel->addJoin($subQueryTag, 'tag_data_agg.eindeutige_kalender_gruppen_id = tbl_kalender.eindeutige_gruppen_id', 'LEFT'); + // End of tags inclusion + + // Include assigned operational resources in the query + $subQueryResource = "( + SELECT + resource.eindeutige_kalender_gruppen_id, + COALESCE(json_agg(resource ORDER BY resource.beschreibung), '[]'::json) AS resources + FROM ( + SELECT + betriebsmittel_kalender.*, + betriebsmittel.beschreibung, + betriebsmittel.verplanen + FROM lehre.tbl_betriebsmittel_kalender AS betriebsmittel_kalender + JOIN wawi.tbl_betriebsmittel AS betriebsmittel + ON betriebsmittel.betriebsmittel_id = betriebsmittel_kalender.betriebsmittel_id + WHERE betriebsmittel.verplanen = TRUE + ) AS resource + GROUP BY resource.eindeutige_kalender_gruppen_id + ) AS resource_data_agg"; + + $this->_ci->KalenderModel->addJoin( + $subQueryResource, + 'resource_data_agg.eindeutige_kalender_gruppen_id = tbl_kalender.eindeutige_gruppen_id', + 'LEFT' + ); + // End of operational resources inclusion + + $this->_ci->KalenderModel->db->where('tbl_kalender.von >=', $start_date); $this->_ci->KalenderModel->db->where('tbl_kalender.bis <', $end_date); @@ -157,6 +220,8 @@ class KalenderLib { $von = new DateTime($row->von); $bis = new DateTime($row->bis); + $resources = isset($row->resources) ? $row->resources : []; + $parsedResources = is_string($resources) ? json_decode($resources, true) : $resources; $events[$id] = (object) [ 'eindeutige_gruppen_id' => $row->eindeutige_gruppen_id, @@ -185,7 +250,9 @@ class KalenderLib 'beschreibung' => isset($row->beschreibung) ? $row->beschreibung : '', 'topic' => [], 'collisions' => false, - 'has_assigned_resources' => isset($row->has_assigned_resources) ? $row->has_assigned_resources : false, + 'has_assigned_resources' => !empty($parsedResources), + 'resources' => is_array($parsedResources) ? $parsedResources : [], + 'tags' => isset($row->tags) ? $row->tags : [], ]; } @@ -443,13 +510,6 @@ class KalenderLib $this->_ci->KalenderModel->db->where_not_in('status_kurzbz', array('deleted')); - $this->_ci->KalenderModel->addSelect([ - "( - SELECT COUNT(*) FROM lehre.tbl_betriebsmittel_kalender - WHERE tbl_betriebsmittel_kalender.eindeutige_kalender_gruppen_id = tbl_kalender.eindeutige_gruppen_id - ) AS has_assigned_resources" - ]); - $data = $this->_ci->KalenderModel->load(); return $this->_mapEvents($data); @@ -961,16 +1021,6 @@ class KalenderLib } } - /* foreach ($specialGroups as $group) - { - $this->_addSpecialGroupToEvent($kalender_id, $group['gruppe_kurzbz'], $group['rolle']); - } - - foreach ($groups as $group) - { - $this->_addGroupToEvent($kalender_id, $group['stg_kz'], $group['semester'], $group['verband'], $group['gruppe'], $group['rolle']); - }*/ - if (isSuccess($kalendereventresult) && !is_null($ort_kurzbz)) { $ortresult = $this->_addKalenderOrt($kalender_id, $ort_kurzbz); diff --git a/application/views/Tempus.php b/application/views/Tempus.php index 346ad56ad..fd6f3a0b7 100644 --- a/application/views/Tempus.php +++ b/application/views/Tempus.php @@ -8,6 +8,7 @@ 'primevue3' => true, 'tabulator5' => true, 'vuedatepicker11' => true, + 'tags' => true, 'phrases' => array( 'global', 'ui', diff --git a/public/css/components/calendar/events.css b/public/css/components/calendar/events.css index 8946c1856..f224c6f7b 100644 --- a/public/css/components/calendar/events.css +++ b/public/css/components/calendar/events.css @@ -86,6 +86,9 @@ pointer-events: none; background-color: transparent !important; border: none !important; + width: fit-content; + margin-left: auto; + margin-right: auto; } .fhc-resize-bar--top { diff --git a/public/css/tags.css b/public/css/tags.css index e92f415b2..61e0d46e9 100644 --- a/public/css/tags.css +++ b/public/css/tags.css @@ -17,6 +17,13 @@ transform: scale(1.15); } +/* add prop that disasbles hover and cursor*/ +.tag.disabled:hover +{ + transform: none; + cursor: default; +} + .tag_rot { background-color: #ff0000ff; } diff --git a/public/js/api/factory/tempus/tag.js b/public/js/api/factory/tempus/tag.js new file mode 100644 index 000000000..6b8a4ce01 --- /dev/null +++ b/public/js/api/factory/tempus/tag.js @@ -0,0 +1,59 @@ +export default { + + getTag(data) + { + return { + method: 'get', + url: '/api/frontend/v1/tempus/Tags/getTag', + params: data + }; + }, + + getTags(data) + { + return { + method: 'get', + url: '/api/frontend/v1/tempus/Tags/getTags' + }; + }, + getTagsByCalendar(calenderGroupId) + { + return { + method: 'get', + url: '/api/frontend/v1/tempus/Tags/getTagsByCalendar/' + calenderGroupId, + }; + }, + addTag(data) + { + return { + method: 'post', + url: '/api/frontend/v1/tempus/Tags/addTag', + params: data + }; + }, + updateTag(data) + { + return { + method: 'post', + url: '/api/frontend/v1/tempus/Tags/updateTag', + params: data + }; + }, + doneTag(data) + { + return { + method: 'post', + url: '/api/frontend/v1/tempus/Tags/doneTag', + params: data + }; + }, + + deleteTag(data) + { + return { + method: 'post', + url: '/api/frontend/v1/tempus/Tags/deleteTag', + params: data + }; + }, +}; diff --git a/public/js/components/Tag/Tag.js b/public/js/components/Tag/Tag.js index 7064c0c17..ecaaa2354 100644 --- a/public/js/components/Tag/Tag.js +++ b/public/js/components/Tag/Tag.js @@ -14,6 +14,10 @@ export default { 'deleted', ], props: { + isListItemShown: { + type: Boolean, + default: true + }, endpoint: { type: Object, required: true @@ -206,7 +210,7 @@ export default { } }, template: ` -
+
+
+ + + + + @@ -1411,6 +1592,17 @@ export default { + Pruefe Tabellen und Attribute!'; diff --git a/system/dbupdate_3.4/78052_tempus_tag_events.php b/system/dbupdate_3.4/78052_tempus_tag_events.php new file mode 100644 index 000000000..64f47d57b --- /dev/null +++ b/system/dbupdate_3.4/78052_tempus_tag_events.php @@ -0,0 +1,19 @@ +db_query("SELECT 1 + FROM information_schema.columns + WHERE table_schema = 'public' + AND table_name = 'tbl_notizzuordnung' + AND column_name = 'eindeutige_kalender_gruppen_id'"); + +if ($db->db_num_rows($result) === 0) +{ + $qry = "ALTER TABLE public.tbl_notizzuordnung + ADD COLUMN eindeutige_kalender_gruppen_id UUID NULL DEFAULT NULL"; + + if (!$db->db_query($qry)) + echo 'public.tbl_notizzuordnung: '.$db->db_last_error().'
'; + else + echo '
public.tbl_notizzuordnung: eindeutige_kalender_gruppen_id column added'; +} diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 001e9db71..7657b8c36 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -61059,6 +61059,86 @@ I have been informed that I am under no obligation to consent to the transmissio ) ) ), + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'tags_assignment_modal_title', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Tag-Zuweisung', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Tag Assignment', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'assigned_tags_subtitle', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Zugewiesene Tags', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Assigned Tags', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'no_assigned_tags', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Keine zugewiesenen Tags', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'No Assigned Tags', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'tags', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Tags', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Tags', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), // generic tabulator phrases END ); From b809392f5d4a8049dc7c89c94dab56ce17b3d90d Mon Sep 17 00:00:00 2001 From: Ivymaster Date: Wed, 22 Jul 2026 16:20:43 +0200 Subject: [PATCH 03/11] add historyModal extraction from tempus component --- public/js/components/Tempus/HistoryModal.js | 68 +++++++++++++++++++++ public/js/components/Tempus/Tempus.js | 28 ++------- 2 files changed, 72 insertions(+), 24 deletions(-) create mode 100644 public/js/components/Tempus/HistoryModal.js diff --git a/public/js/components/Tempus/HistoryModal.js b/public/js/components/Tempus/HistoryModal.js new file mode 100644 index 000000000..9716bc1f1 --- /dev/null +++ b/public/js/components/Tempus/HistoryModal.js @@ -0,0 +1,68 @@ +/** + * Copyright (C) 2024 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 . + */ +import BsModal from "../Bootstrap/Modal.js"; + +export default { + name: "HistoryModal", + components: { + BsModal, + }, + props: { + entries: { + type: Array, + default: () => [], + }, + }, + methods: { + show() { + this.$refs.modal.show(); + }, + hide() { + this.$refs.modal.hide(); + }, + }, + template: ` + + + + + `, +}; diff --git a/public/js/components/Tempus/Tempus.js b/public/js/components/Tempus/Tempus.js index a5f28ef73..af762c554 100644 --- a/public/js/components/Tempus/Tempus.js +++ b/public/js/components/Tempus/Tempus.js @@ -46,6 +46,7 @@ import { getTempusShortcuts } from "./shortcuts.js"; import KeyboardShortcuts from "./KeyboardShortcuts.js"; import { useContextMenuActions } from "../../composables/Tempus/ContextMenuActions.js"; import MultiWeekPlanModal from "./MultiWeekPlanModal.js"; +import HistoryModal from "./HistoryModal.js"; import { getTempusSearchbarOptions } from "./Filters/searchbarOptions.js"; import CoreTag from '../Tag/Tag.js'; @@ -71,6 +72,7 @@ export default { Reservierung, KeyboardShortcuts, MultiWeekPlanModal, + HistoryModal, CoreTag, }, props: { @@ -310,7 +312,7 @@ export default { .call(ApiKalender.getHistory(orig.kalender_id)) .then((result) => { this.historyEntries = result.data ?? []; - this.$refs.historyModel.show(); + this.$refs.historyModal.show(); }); }, syncToLecturer(orig) { @@ -1569,29 +1571,7 @@ export default { - - - - + Date: Wed, 22 Jul 2026 16:36:20 +0200 Subject: [PATCH 04/11] add resourcesAssignmentModal extraction from tempus component --- .../Tempus/ResourcesAssignmentModal.js | 282 ++++++++++++++++++ public/js/components/Tempus/Tempus.js | 252 +--------------- 2 files changed, 288 insertions(+), 246 deletions(-) create mode 100644 public/js/components/Tempus/ResourcesAssignmentModal.js diff --git a/public/js/components/Tempus/ResourcesAssignmentModal.js b/public/js/components/Tempus/ResourcesAssignmentModal.js new file mode 100644 index 000000000..fb366f4ba --- /dev/null +++ b/public/js/components/Tempus/ResourcesAssignmentModal.js @@ -0,0 +1,282 @@ +/** + * Copyright (C) 2024 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 . + */ +import BsModal from "../Bootstrap/Modal.js"; +import FormInput from "../Form/Input.js"; +import ApiOperationalResourceToCalender from "../../api/factory/operationalResourceToCalender.js"; + +export default { + name: "ResourcesAssignmentModal", + components: { + BsModal, + FormInput, + }, + emits: ["saveFinished"], + data() { + return { + calendar: null, + availableResources: [], + filteredAvailableResources: [], + selectedAvailableResource: null, + assignedResources: [], + areFormButtonsDisplayed: false, + }; + }, + computed: { + dropdownParsedAvailableResources() { + return this.availableResources + .map((unit) => ({ + label: unit.beschreibung, + value: unit.betriebsmittel_id, + data: unit, + })) + .sort((a, b) => a.label?.localeCompare(b.label)); + }, + }, + watch: { + selectedAvailableResource(newValue) { + if (!newValue) return; + + this.assignedResources.push({ + betriebsmittel_kalender_id: null, + betriebsmittel_id: newValue.data.betriebsmittel_id, + beschreibung: newValue.data.beschreibung, + anmerkung: "", + isNoteTextareaShown: false, + }); + + this.areFormButtonsDisplayed = true; + }, + }, + methods: { + async open(calendar) { + if (!calendar?.kalender_id) return; + + this.calendar = calendar; + this.availableResources = + await this.fetchSchedulableResourcesByCalender(calendar.kalender_id); + this.filteredAvailableResources = [ + ...this.dropdownParsedAvailableResources, + ]; + this.assignedResources = + await this.fetchAssignedResourcesByCalender(calendar.kalender_id); + + this.show(); + }, + show() { + this.$refs.modal.show(); + }, + hide() { + this.$refs.modal.hide(); + }, + reset() { + this.calendar = null; + this.availableResources = []; + this.filteredAvailableResources = []; + this.selectedAvailableResource = null; + this.assignedResources = []; + this.areFormButtonsDisplayed = false; + }, + async fetchAssignedResourcesByCalender(calenderId) { + const result = await this.$api.call( + ApiOperationalResourceToCalender.getAssignedResourcesByCalender( + calenderId, + ), + ); + + if (result.meta.status === "success") { + return result.data + .filter((unit) => !!unit) + .map((unit) => ({ + isNoteTextareaShown: + unit.anmerkung && unit.anmerkung.trim() !== "", + ...unit, + })); + } + + this.$fhcAlert.alertError( + this.$p.t("ui", "failed_assigned_resources_fetch_error_message"), + ); + return []; + }, + async fetchSchedulableResourcesByCalender(calendarId) { + const result = await this.$api.call( + ApiOperationalResourceToCalender.getSchedulableResourcesByCalendar( + calendarId, + ), + ); + + if (result.meta.status === "success") return result.data; + + this.$fhcAlert.alertError( + this.$p.t("ui", "failed_schedulable_resources_fetch_error_message"), + ); + return []; + }, + filterAvailableResources(event) { + const query = event.query.toLowerCase(); + const unassignedResources = this.dropdownParsedAvailableResources.filter( + (unit) => + !this.assignedResources.some( + (assigned) => assigned.betriebsmittel_id === unit.value, + ), + ); + + this.filteredAvailableResources = query + ? unassignedResources.filter((unit) => + unit.label.toLowerCase().includes(query), + ) + : unassignedResources; + }, + toggleAssignedResourceNoteInput(resource) { + const assignedResource = this.assignedResources.find( + (assigned) => assigned.betriebsmittel_id === resource.betriebsmittel_id, + ); + + if (assignedResource) { + assignedResource.isNoteTextareaShown = + !assignedResource.isNoteTextareaShown; + } + + this.areFormButtonsDisplayed = true; + }, + removeAssignedResource(resource) { + this.assignedResources = this.assignedResources.filter( + (assigned) => + assigned.betriebsmittel_id !== resource.betriebsmittel_id, + ); + this.areFormButtonsDisplayed = true; + }, + async refreshResourcesAssignmentModalData() { + if (!this.calendar?.kalender_id) return; + + this.availableResources = + await this.fetchSchedulableResourcesByCalender( + this.calendar.kalender_id, + ); + this.filteredAvailableResources = [ + ...this.dropdownParsedAvailableResources, + ]; + this.assignedResources = await this.fetchAssignedResourcesByCalender( + this.calendar.kalender_id, + ); + this.selectedAvailableResource = null; + this.areFormButtonsDisplayed = false; + }, + async saveAssignedResourcesToCalendarItem() { + if (!this.calendar?.kalender_id) return; + + const result = await this.$api.call( + ApiOperationalResourceToCalender.storeResourcesToCalendarRelationship( + this.calendar.kalender_id, + this.assignedResources, + ), + ); + + if (result.meta.status === "success") { + this.$fhcAlert.alertSuccess( + this.$p.t("ui", "assigned_resources_save_success_message"), + ); + await this.refreshResourcesAssignmentModalData(); + } else { + this.$fhcAlert.alertError( + this.$p.t("ui", "failed_assigned_resources_save_error_message"), + ); + } + + this.$emit("saveFinished"); + this.hide(); + }, + }, + template: ` + + + + + `, +}; diff --git a/public/js/components/Tempus/Tempus.js b/public/js/components/Tempus/Tempus.js index af762c554..3774d98f9 100644 --- a/public/js/components/Tempus/Tempus.js +++ b/public/js/components/Tempus/Tempus.js @@ -28,7 +28,6 @@ import ApiSearchbar from "../../api/factory/searchbar.js"; import ApiRenderers from "../../api/factory/renderers.js"; import ApiTempusConfig from "../../api/factory/tempus/config.js"; import ApiBetriebsmittel from "../../api/factory/betriebsmittel.js"; -import ApiOperationalResourceToCalender from "../../api/factory/operationalResourceToCalender.js"; import ApiTempusTag from "../../api/factory/tempus/tag.js"; import AppMenu from "../AppMenu.js"; import drop from "../../directives/drop.js"; @@ -47,6 +46,7 @@ import KeyboardShortcuts from "./KeyboardShortcuts.js"; import { useContextMenuActions } from "../../composables/Tempus/ContextMenuActions.js"; import MultiWeekPlanModal from "./MultiWeekPlanModal.js"; import HistoryModal from "./HistoryModal.js"; +import ResourcesAssignmentModal from "./ResourcesAssignmentModal.js"; import { getTempusSearchbarOptions } from "./Filters/searchbarOptions.js"; import CoreTag from '../Tag/Tag.js'; @@ -73,6 +73,7 @@ export default { KeyboardShortcuts, MultiWeekPlanModal, HistoryModal, + ResourcesAssignmentModal, CoreTag, }, props: { @@ -99,7 +100,7 @@ export default { contextMenuActions: useContextMenuActions({ openRaumauswahl: (orig) => this.openRaumauswahl(orig), openResourcesAssignmentModal: (orig) => - this.openResourcesAssignmentModal(orig), + this.$refs.resourcesAssignmentModal?.open(orig), openTagsModal: (orig) => this.openTagsAssignmentModal(orig), openHistory: (orig) => this.openHistory(orig), deleteEntry: (orig) => this.deleteEntry(orig), @@ -169,14 +170,6 @@ export default { endTime: null, }, studiengaenge_all: [], - resourcesAssignmentModal: { - calendar: null, - availableResources: [], - filteredAvailableResources: [], - selectedAvailableResource: null, - assignedResources: [], - areFormButtonsDisplayed: false, - }, tagsAssignmentModal: { calendar: null, availableTags: [], @@ -220,17 +213,6 @@ export default { searchbaroptions() { return getTempusSearchbarOptions(this); }, - dropdownParsedAvailableResources() { - return this.resourcesAssignmentModal.availableResources - .map((unit) => { - return { - label: unit.beschreibung, - value: unit.betriebsmittel_id, - data: unit, - }; - }) - .sort((a, b) => a.label?.localeCompare(b.label)); - }, dropdownParsedAvailableTags() { return this.tagsAssignmentModal.availableTags .map((tag) => { @@ -254,21 +236,6 @@ export default { this.$refs.raumModal.show(); }); }, - async openResourcesAssignmentModal(orig) { - if (!orig?.kalender_id) return; - - this.resourcesAssignmentModal.calendar = orig; - this.resourcesAssignmentModal.availableResources = - await this.fetchSchedulableResourcesByCalender(orig.kalender_id); - this.resourcesAssignmentModal.filteredAvailableResources = [ - ...this.dropdownParsedAvailableResources, - ]; - - this.resourcesAssignmentModal.assignedResources = - await this.fetchAssignedResourcesByCalender(orig.kalender_id); - - this.$refs.resourcesAssignmentModal.show(); - }, async openTagsAssignmentModal(orig) { console.log("openTagsAssignmentModal called with orig:", orig); if (!orig?.kalender_id) return; @@ -827,138 +794,6 @@ export default { this.extraBackgrounds = res; }, - async fetchAssignedResourcesByCalender(calenderId) { - let getAssignedResources = await this.$api.call( - ApiOperationalResourceToCalender.getAssignedResourcesByCalender( - calenderId, - ), - ); - if (getAssignedResources.meta.status === "success") { - return getAssignedResources.data - .filter((unit) => !!unit) - .map((unit) => { - return { - isNoteTextareaShown: - unit.anmerkung && unit.anmerkung.trim() !== "", - ...unit, - }; - }) - .filter((unit) => !!unit); - } else { - this.$fhcAlert.alertError( - this.$p.t("ui", "failed_assigned_resources_fetch_error_message"), - ); - } - - return []; - }, - async fetchSchedulableResourcesByCalender(calendarID) { - let getSchedulableResourcesByCalendar = await this.$api.call( - ApiOperationalResourceToCalender.getSchedulableResourcesByCalendar( - calendarID, - ), - ); - if (getSchedulableResourcesByCalendar.meta.status === "success") { - return getSchedulableResourcesByCalendar.data; - } else { - this.$fhcAlert.alertError( - this.$p.t("ui", "failed_schedulable_resources_fetch_error_message"), - ); - } - - return []; - }, - filterAvailableResources(event) { - this.resourcesAssignmentModal.filteredAvailableResources; - const query = event.query.toLowerCase(); - if (!query) { - return (this.resourcesAssignmentModal.filteredAvailableResources = [ - ...this.dropdownParsedAvailableResources.filter((unit) => { - return !this.resourcesAssignmentModal.assignedResources.some( - (assigned) => assigned.betriebsmittel_id === unit.value, - ); - }), - ]); - } - - return (this.resourcesAssignmentModal.filteredAvailableResources = - this.dropdownParsedAvailableResources - .filter((unit) => { - return !this.resourcesAssignmentModal.assignedResources.some( - (assigned) => assigned.betriebsmittel_id === unit.value, - ); - }) - .filter((unit) => { - return unit.label.toLowerCase().includes(query); - })); - }, - toggleAssignedResourceNoteInput(resource) { - const index = this.resourcesAssignmentModal.assignedResources.findIndex( - (assigned) => assigned.betriebsmittel_id === resource.betriebsmittel_id, - ); - if (index !== -1) { - this.resourcesAssignmentModal.assignedResources[ - index - ].isNoteTextareaShown = - !this.resourcesAssignmentModal.assignedResources[index] - .isNoteTextareaShown; - } - - this.resourcesAssignmentModal.areFormButtonsDisplayed = true; - }, - removeAssignedResource(resource) { - this.resourcesAssignmentModal.assignedResources = - this.resourcesAssignmentModal.assignedResources.filter( - (assigned) => - assigned.betriebsmittel_id !== resource.betriebsmittel_id, - ); - - this.resourcesAssignmentModal.areFormButtonsDisplayed = true; - }, - async refreshResourcesAssignmentModalData(calenderItem) { - this.resourcesAssignmentModal.availableResources = - await this.fetchSchedulableResourcesByCalender( - calenderItem.kalender_id, - ); - this.resourcesAssignmentModal.filteredAvailableResources = [ - ...this.dropdownParsedAvailableResources, - ]; - - this.resourcesAssignmentModal.assignedResources = - await this.fetchAssignedResourcesByCalender(calenderItem.kalender_id); - this.resourcesAssignmentModal.selectedAvailableResource = null; - this.resourcesAssignmentModal.areFormButtonsDisplayed = false; - }, - async saveAssignedResourcesToCalendarItem(calenderItem, assignedResources) { - let getSchedulableResourcesByCalendar = await this.$api.call( - ApiOperationalResourceToCalender.storeResourcesToCalendarRelationship( - calenderItem.kalender_id, - assignedResources, - ), - ); - if (getSchedulableResourcesByCalendar.meta.status === "success") { - this.$fhcAlert.alertSuccess( - this.$p.t("ui", "assigned_resources_save_success_message"), - ); - await this.refreshResourcesAssignmentModalData(calenderItem); - } else { - this.$fhcAlert.alertError( - this.$p.t("ui", "failed_assigned_resources_save_error_message"), - ); - } - - this.$refs.calendar.resetEventLoader(); - this.$refs.resourcesAssignmentModal.hide(); - }, - closeResourcesAssignmentModal() { - this.resourcesAssignmentModal = { - availableResources: [], - filteredAvailableResources: [], - selectedAvailableResource: null, - assignedResources: [], - areFormButtonsDisplayed: false, - }; - }, async fetchAvailableTags() { let getAvailableTags = await this.$api.call( ApiTempusTag.getTags(), @@ -1136,19 +971,6 @@ export default { handler() { this.$refs.calendar.resetEventLoader(); }, - }, - "resourcesAssignmentModal.selectedAvailableResource": function (newVal) { - if (!newVal) return; - - this.resourcesAssignmentModal.assignedResources.push({ - betriebsmittel_kalender_id: null, - betriebsmittel_id: newVal.data.betriebsmittel_id, - beschreibung: newVal.data.beschreibung, - anmerkung: "", - isNoteTextareaShown: false, - }); - - this.resourcesAssignmentModal.areFormButtonsDisplayed = true; }, }, mounted() { @@ -1439,7 +1261,6 @@ export default { - - - - - + @save-finished="$refs.calendar.resetEventLoader()" + /> Date: Wed, 22 Jul 2026 17:01:11 +0200 Subject: [PATCH 05/11] add tagsAssignmentModal extraction from tempus component --- .../components/Tempus/TagsAssignmentModal.js | 193 ++++++++++++++++ public/js/components/Tempus/Tempus.js | 210 +----------------- 2 files changed, 199 insertions(+), 204 deletions(-) create mode 100644 public/js/components/Tempus/TagsAssignmentModal.js diff --git a/public/js/components/Tempus/TagsAssignmentModal.js b/public/js/components/Tempus/TagsAssignmentModal.js new file mode 100644 index 000000000..3c57b208d --- /dev/null +++ b/public/js/components/Tempus/TagsAssignmentModal.js @@ -0,0 +1,193 @@ +/** + * Copyright (C) 2024 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 . + */ +import BsModal from "../Bootstrap/Modal.js"; +import FormInput from "../Form/Input.js"; +import CoreTag from "../Tag/Tag.js"; +import ApiTempusTag from "../../api/factory/tempus/tag.js"; + +export default { + name: "TagsAssignmentModal", + components: { + BsModal, + FormInput, + CoreTag, + }, + emits: ["tagsChanged"], + data() { + return { + calendar: null, + availableTags: [], + filteredAvailableTags: [], + selectedAvailableTag: null, + assignedTags: [], + tagEndpoint: ApiTempusTag, + }; + }, + computed: { + dropdownParsedAvailableTags() { + return this.availableTags.map((tag) => ({ + label: tag.bezeichnung, + value: tag.tag_typ_kurzbz, + data: tag, + })); + }, + }, + methods: { + async open(calendar) { + if (!calendar?.kalender_id) return; + + this.calendar = calendar; + this.availableTags = await this.fetchAvailableTags(); + this.filteredAvailableTags = [...this.dropdownParsedAvailableTags]; + this.assignedTags = await this.fetchAssignedTagsByCalender( + calendar.eindeutige_gruppen_id, + ); + + this.show(); + }, + show() { + this.$refs.modal.show(); + }, + hide() { + this.$refs.modal.hide(); + }, + reset() { + this.calendar = null; + this.availableTags = []; + this.filteredAvailableTags = []; + this.selectedAvailableTag = null; + this.assignedTags = []; + }, + async fetchAvailableTags() { + const result = await this.$api.call(ApiTempusTag.getTags()); + + if (result.meta.status === "success") return result.data; + + this.$fhcAlert.alertError( + this.$p.t("ui", "failed_available_tags_fetch_error_message"), + ); + return []; + }, + async fetchAssignedTagsByCalender(calendarGroupId) { + const result = await this.$api.call( + ApiTempusTag.getTagsByCalendar(calendarGroupId), + ); + + if (result.meta.status === "success") { + return result.data.filter((tag) => !!tag); + } + + this.$fhcAlert.alertError( + this.$p.t("ui", "failed_assigned_tags_fetch_error_message"), + ); + return []; + }, + filterAvailableTags(event) { + const query = event.query.toLowerCase(); + const unassignedTags = this.dropdownParsedAvailableTags.filter( + (tag) => + !this.assignedTags.some( + (assigned) => assigned.tag_id === tag.value, + ), + ); + + this.filteredAvailableTags = query + ? unassignedTags.filter((tag) => + tag.label.toLowerCase().includes(query), + ) + : unassignedTags; + }, + selectTag(event) { + this.selectedAvailableTag = event.value; + this.$refs.tagComponent?.openModal(event.value.data); + }, + editTag(tag) { + this.$refs.tagComponent?.editTag(tag.notiz_id); + }, + async handleCalendarTagChange() { + const calendarGroupId = this.calendar?.eindeutige_gruppen_id; + if (!calendarGroupId) return; + + this.assignedTags = + await this.fetchAssignedTagsByCalender(calendarGroupId); + this.$emit("tagsChanged"); + }, + }, + template: /* html */` + + + + + + `, +}; diff --git a/public/js/components/Tempus/Tempus.js b/public/js/components/Tempus/Tempus.js index 3774d98f9..f6effc5c6 100644 --- a/public/js/components/Tempus/Tempus.js +++ b/public/js/components/Tempus/Tempus.js @@ -28,7 +28,6 @@ import ApiSearchbar from "../../api/factory/searchbar.js"; import ApiRenderers from "../../api/factory/renderers.js"; import ApiTempusConfig from "../../api/factory/tempus/config.js"; import ApiBetriebsmittel from "../../api/factory/betriebsmittel.js"; -import ApiTempusTag from "../../api/factory/tempus/tag.js"; import AppMenu from "../AppMenu.js"; import drop from "../../directives/drop.js"; import AppConfig from "../AppConfig.js"; @@ -39,7 +38,6 @@ import StvVerband from "../Stv/Studentenverwaltung/Verband.js"; import ApiStudiengangTree from "../../api/factory/tempus/studiengangtree.js"; import ApiInfo from "../../api/factory/tempus/info.js"; import StvStudiensemester from "../Stv/Studentenverwaltung/Studiensemester.js"; -import FormInput from "../../../js/components/Form/Input.js"; import Reservierung from "./Reservierung.js"; import { getTempusShortcuts } from "./shortcuts.js"; import KeyboardShortcuts from "./KeyboardShortcuts.js"; @@ -47,8 +45,8 @@ import { useContextMenuActions } from "../../composables/Tempus/ContextMenuActio import MultiWeekPlanModal from "./MultiWeekPlanModal.js"; import HistoryModal from "./HistoryModal.js"; import ResourcesAssignmentModal from "./ResourcesAssignmentModal.js"; +import TagsAssignmentModal from "./TagsAssignmentModal.js"; import { getTempusSearchbarOptions } from "./Filters/searchbarOptions.js"; -import CoreTag from '../Tag/Tag.js'; export default { name: "Tempus", @@ -68,13 +66,12 @@ export default { StvVerband, StvStudiensemester, Multiselect: primevue.multiselect, - FormInput, Reservierung, KeyboardShortcuts, MultiWeekPlanModal, HistoryModal, ResourcesAssignmentModal, - CoreTag, + TagsAssignmentModal, }, props: { defaultSemester: String, @@ -101,7 +98,7 @@ export default { openRaumauswahl: (orig) => this.openRaumauswahl(orig), openResourcesAssignmentModal: (orig) => this.$refs.resourcesAssignmentModal?.open(orig), - openTagsModal: (orig) => this.openTagsAssignmentModal(orig), + openTagsModal: (orig) => this.$refs.tagsAssignmentModal?.open(orig), openHistory: (orig) => this.openHistory(orig), deleteEntry: (orig) => this.deleteEntry(orig), syncToLecturer: (orig) => this.syncToLecturer(orig), @@ -170,15 +167,6 @@ export default { endTime: null, }, studiengaenge_all: [], - tagsAssignmentModal: { - calendar: null, - availableTags: [], - filteredAvailableTags: [], - selectedAvailableTag: null, - assignedTags: [], - areFormButtonsDisplayed: false, - }, - tagEndpoint: ApiTempusTag, }; }, computed: { @@ -213,16 +201,6 @@ export default { searchbaroptions() { return getTempusSearchbarOptions(this); }, - dropdownParsedAvailableTags() { - return this.tagsAssignmentModal.availableTags - .map((tag) => { - return { - label: tag.bezeichnung, - value: tag.tag_typ_kurzbz, - data: tag, - }; - }); - }, }, methods: { async openRaumauswahl(orig) { @@ -236,19 +214,6 @@ export default { this.$refs.raumModal.show(); }); }, - async openTagsAssignmentModal(orig) { - console.log("openTagsAssignmentModal called with orig:", orig); - if (!orig?.kalender_id) return; - - this.tagsAssignmentModal.calendar = orig; - this.tagsAssignmentModal.availableTags = await this.fetchAvailableTags(); - this.tagsAssignmentModal.filteredAvailableTags = [ - ...this.dropdownParsedAvailableTags, - ]; - - this.tagsAssignmentModal.assignedTags = await this.fetchAssignedTagsByCalender(orig.eindeutige_gruppen_id); - this.$refs.tagsAssignmentModal.show(); - }, async deleteEntry(orig) { if (!orig?.kalender_id) return; @@ -794,114 +759,6 @@ export default { this.extraBackgrounds = res; }, - async fetchAvailableTags() { - let getAvailableTags = await this.$api.call( - ApiTempusTag.getTags(), - ); - if (getAvailableTags.meta.status === "success") { - return getAvailableTags.data; - } else { - this.$fhcAlert.alertError( - this.$p.t("ui", "failed_available_tags_fetch_error_message"), - ); - } - - return []; - }, - async fetchAssignedTagsByCalender(calenderId) { - let getAssignedTags = await this.$api.call( - ApiTempusTag.getTagsByCalendar(calenderId), - ); - if (getAssignedTags.meta.status === "success") { - return getAssignedTags.data.filter((unit) => !!unit); - } else { - this.$fhcAlert.alertError( - this.$p.t("ui", "failed_assigned_tags_fetch_error_message"), - ); - } - - return []; - }, - filterAvailableTags(event) { - this.tagsAssignmentModal.filteredAvailableTags; - const query = event.query.toLowerCase(); - if (!query) { - return (this.tagsAssignmentModal.filteredAvailableTags = [ - ...this.dropdownParsedAvailableTags.filter((tag) => { - return !this.tagsAssignmentModal.assignedTags.some( - (assigned) => assigned.tag_id === tag.value, - ); - }), - ]); - } - - return (this.tagsAssignmentModal.filteredAvailableTags = - this.dropdownParsedAvailableTags - .filter((tag) => { - return !this.tagsAssignmentModal.assignedTags.some( - (assigned) => assigned.tag_id === tag.value, - ); - }) - .filter((tag) => { - return tag.label.toLowerCase().includes(query); - })); - }, - removeAssignedTag(tag) { - this.tagsAssignmentModal.assignedTags = - this.tagsAssignmentModal.assignedTags.filter( - (assigned) => assigned.tag_id !== tag.tag_id, - ); - - this.tagsAssignmentModal.areFormButtonsDisplayed = true; - }, - async refreshTagsAssignmentModalData(calenderItem) { - this.tagsAssignmentModal.availableTags = - await this.fetchAvailableTags(); - this.tagsAssignmentModal.filteredAvailableTags = [ - ...this.dropdownParsedAvailableTags, - ]; - - this.tagsAssignmentModal.assignedTags = - await this.fetchAssignedTagsByCalender(calenderItem.eindeutige_gruppen_id); - this.tagsAssignmentModal.selectedAvailableTag = null; - this.tagsAssignmentModal.areFormButtonsDisplayed = false; - }, - async saveAssignedTagsToCalendarItem(calenderItem, assignedTags) { - let saveAssignedTagsByCalender = await this.$api.call( - ApiTempusTag.getTags( - calenderItem.eindeutige_gruppen_id, - assignedTags, - ), - ); - if (saveAssignedTagsByCalender.meta.status === "success") { - this.$fhcAlert.alertSuccess( - this.$p.t("ui", "assigned_tags_save_success_message"), - ); - await this.refreshTagsAssignmentModalData(calenderItem); - } else { - this.$fhcAlert.alertError( - this.$p.t("ui", "failed_assigned_tags_save_error_message"), - ); - } - - this.$refs.calendar.resetEventLoader(); - this.$refs.tagsAssignmentModal.hide(); - }, - closeTagsAssignmentModal() { - this.tagsAssignmentModal = { - availableTags: [], - filteredAvailableTags: [], - selectedAvailableTag: null, - assignedTags: [], - areFormButtonsDisplayed: false, - }; - }, - async handleCalenderTagChange(calenderID) { - this.tagsAssignmentModal.assignedTags = - await this.fetchAssignedTagsByCalender(calenderID); - - this.$refs.calendar.resetEventLoader(); - }, removeLecturer(uid) { if (uid == null) { for (const lect of this.lecturers) delete this.overlayCache[lect.uid]; @@ -1283,66 +1140,11 @@ export default { ref="resourcesAssignmentModal" @save-finished="$refs.calendar.resetEventLoader()" /> - - - - + @tags-changed="$refs.calendar.resetEventLoader()" + /> - Date: Fri, 24 Jul 2026 09:16:40 +0200 Subject: [PATCH 06/11] Add smoke test for calendar event tag assignment --- system/seeders/015_kalender.sql | 11 +++++++++++ system/seeders/016_tag.sql | 5 +++++ .../cypress/e2e/specs/ui/tempus/tempus.smoke.cy.js | 14 ++++++++++++++ tests/cypress/cypress/support/pages/tempus.po.js | 10 ++++++++++ 4 files changed, 40 insertions(+) create mode 100644 system/seeders/016_tag.sql diff --git a/system/seeders/015_kalender.sql b/system/seeders/015_kalender.sql index 345e003a3..4aa274060 100644 --- a/system/seeders/015_kalender.sql +++ b/system/seeders/015_kalender.sql @@ -177,6 +177,17 @@ VALUES (51006, 31), (51004, 32); +-- Calendar setup for tags tests +INSERT INTO lehre.tbl_kalender +(von, bis, typ, status_kurzbz, vorgaenger_kalender_id, eindeutige_gruppen_id, insertamum, insertvon, updateamum, updatevon) +VALUES +(date_trunc('week', CURRENT_DATE) + INTERVAL '6 day' + TIME '16:55:00', date_trunc('week', CURRENT_DATE) + INTERVAL '6 day' + TIME '17:40:00', 'lehreinheit', 'live', NULL, 'ec1bd001-facf-4b21-a671-bcb2d4f037fd', now(), 'demoadmin', NULL, 'demoadmin'); + +INSERT INTO lehre.tbl_kalender_lehreinheit +(lehreinheit_id, kalender_id) +VALUES +(51004, 33); + -- INSERT INTO public.tbl_variablenname -- (name, defaultwert) -- VALUES('ignore_resources_collisions', 'false'); diff --git a/system/seeders/016_tag.sql b/system/seeders/016_tag.sql new file mode 100644 index 000000000..9fef2cf1c --- /dev/null +++ b/system/seeders/016_tag.sql @@ -0,0 +1,5 @@ +INSERT INTO public.tbl_notiz_typ +(typ_kurzbz, bezeichnung_mehrsprachig, beschreibung, automatisiert, aktiv, zuordnung, tag, style, vorrueckung, prioritaet/*, taglib*/) +VALUES +('prioone', '{Prio 1,Prio 1}', '', false, true, NULL, false, 'tag_rot', false, 1/*, NULL*/), +('priotwo', '{Prio 2,Prio 2}', '', false, true, NULL, false, 'tag_gelb', false, 2/*, NULL*/); \ No newline at end of file diff --git a/tests/cypress/cypress/e2e/specs/ui/tempus/tempus.smoke.cy.js b/tests/cypress/cypress/e2e/specs/ui/tempus/tempus.smoke.cy.js index 454c8686a..45fde5243 100644 --- a/tests/cypress/cypress/e2e/specs/ui/tempus/tempus.smoke.cy.js +++ b/tests/cypress/cypress/e2e/specs/ui/tempus/tempus.smoke.cy.js @@ -71,6 +71,20 @@ context("Tempus smoke tests", () => { tempusPage.getResourcesModal().should("be.visible"); }); + it("shows tags modal when selecting Tags from event context menu", () => { + tempusPage.waitForCalendarToFinishLoading(); + tempusPage + .getCalendarEventsByWeekdayAndStartTime("Sunday", "16:55:00") + .should("have.length.greaterThan", 0); + + tempusPage.getCalendarEventsByWeekdayAndStartTime("Sunday", "16:55:00").first().rightclick(); + tempusPage.getEventContextMenuOption("Tags").click({ force: true }); + waitForOk("@fetchTags"); + waitForOk("@fetchTagsByCalendar"); + + tempusPage.getTagsModal().should("be.visible"); + }); + it("shows history modal when selecting History from event context menu", () => { tempusPage.waitForCalendarToFinishLoading(); tempusPage.getCalendarEvents().should("have.length.greaterThan", 0); diff --git a/tests/cypress/cypress/support/pages/tempus.po.js b/tests/cypress/cypress/support/pages/tempus.po.js index 7eeeab146..3f8dd1e42 100644 --- a/tests/cypress/cypress/support/pages/tempus.po.js +++ b/tests/cypress/cypress/support/pages/tempus.po.js @@ -72,6 +72,14 @@ class TempusPage { method: "GET", url: "**/tempus/OperationalResourceToCalenderAPI/getAssignedResourcesByCalender/**", }).as("fetchAssignedResources"); + cy.intercept({ + method: "GET", + url: "**/tempus/Tags/getTags**", + }).as("fetchTags"); + cy.intercept({ + method: "GET", + url: "**/tempus/Tags/getTagsByCalendar/**", + }).as("fetchTagsByCalendar"); cy.intercept({ method: "POST", url: "**/tempus/coursepicker/getByStg**", @@ -345,6 +353,8 @@ class TempusPage { cy .get("[data-cy='resourcesAssignmentModal']") .closest(".bootstrap-modal.show"); + getTagsModal = () => + cy.get("[data-cy='tagsAssignmentModal']").closest(".bootstrap-modal.show") getCalendarEventRoom = (id) => this.getCalendarEventById(id).find("[data-cy='calendar-event-room']"); getStundenrasterToggle = () => From e08ae7b3319cefe388f1d62a862629761828df48 Mon Sep 17 00:00:00 2001 From: Ivymaster Date: Fri, 24 Jul 2026 09:26:05 +0200 Subject: [PATCH 07/11] Add extraction of header component from tempus component --- public/js/components/Tempus/Header.js | 109 ++++++++++++++++++++++++++ public/js/components/Tempus/Tempus.js | 95 +++------------------- 2 files changed, 120 insertions(+), 84 deletions(-) create mode 100644 public/js/components/Tempus/Header.js diff --git a/public/js/components/Tempus/Header.js b/public/js/components/Tempus/Header.js new file mode 100644 index 000000000..7109932fa --- /dev/null +++ b/public/js/components/Tempus/Header.js @@ -0,0 +1,109 @@ +import CoreSearchbar from "../searchbar/searchbar.js"; +import NavLanguage from "../navigation/Language.js"; + +export default { + name: "TempusHeader", + components: { + CoreSearchbar, + NavLanguage, + }, + props: { + tempusRoot: String, + avatarUrl: String, + logoutUrl: String, + searchbaroptions: { + type: Object, + required: true, + }, + searchfunction: { + type: Function, + required: true, + }, + }, + emits: ["focus-searchbar"], + methods: { + focusSearchbar() { + this.$refs.searchbar?.$refs?.input?.focus(); + this.$emit("focus-searchbar"); + }, + }, + template: /* html */ ` + + `, +}; diff --git a/public/js/components/Tempus/Tempus.js b/public/js/components/Tempus/Tempus.js index f6effc5c6..0b83340b2 100644 --- a/public/js/components/Tempus/Tempus.js +++ b/public/js/components/Tempus/Tempus.js @@ -14,8 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -import CoreSearchbar from "../searchbar/searchbar.js"; -import NavLanguage from "../navigation/Language.js"; import VerticalSplit from "../verticalsplit/verticalsplit.js"; import FhcCalendar from "../Calendar/Tempus.js"; import FhcCoursepicker from "./Coursepicker.js"; @@ -47,11 +45,11 @@ import HistoryModal from "./HistoryModal.js"; import ResourcesAssignmentModal from "./ResourcesAssignmentModal.js"; import TagsAssignmentModal from "./TagsAssignmentModal.js"; import { getTempusSearchbarOptions } from "./Filters/searchbarOptions.js"; +import TempusHeader from "./Header.js"; export default { name: "Tempus", components: { - CoreSearchbar, VerticalSplit, FhcCalendar, FhcCoursepicker, @@ -61,7 +59,7 @@ export default { ParkingSlot, AppConfig, AppMenu, - NavLanguage, + TempusHeader, BsModal, StvVerband, StvStudiensemester, @@ -810,7 +808,7 @@ export default { this.hoveredEvent = null; }, focusSearchbar() { - this.$refs.searchbar?.$refs?.input.focus(); + this.$refs.header?.focusSearchbar(); }, }, watch: { @@ -910,85 +908,14 @@ export default { data-cy="tempus" > - +