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 );