ProfilUpdateView Tabulator add columns studiengang, orgform and oezuordnung, tune tabulator options e.g. headerfilter

This commit is contained in:
Harald Bamberger
2025-09-29 13:31:15 +02:00
parent e908215b05
commit 2ede54b60e
2 changed files with 94 additions and 32 deletions
@@ -118,13 +118,47 @@ class Profil_update_model extends DB_Model
$parameters = [];
$query = "
SELECT
profil_update_id, tbl_profil_update.uid, (tbl_person.vorname || ' ' || tbl_person.nachname) AS name , topic, requested_change, tbl_profil_update.updateamum, tbl_profil_update.updatevon, tbl_profil_update.insertamum, tbl_profil_update.insertvon, status, public.tbl_profil_update_status.bezeichnung_mehrsprachig[(" . $lang . ")] as status_translated, status_timestamp, status_message, attachment_id
profil_update_id,
tbl_profil_update.uid,
(tbl_person.vorname || ' ' || tbl_person.nachname) AS name ,
topic,
requested_change,
tbl_profil_update.updateamum,
tbl_profil_update.updatevon,
tbl_profil_update.insertamum,
tbl_profil_update.insertvon,
status,
public.tbl_profil_update_status.bezeichnung_mehrsprachig[(" . $lang . ")] as status_translated,
status_timestamp,
status_message,
attachment_id,
UPPER(public.tbl_studiengang.typ || public.tbl_studiengang.kurzbz) AS studiengang,
COALESCE(of.orgform_kurzbz, public.tbl_studiengang.orgform_kurzbz) AS orgform,
NULL as oezuordnung
FROM public.tbl_profil_update
JOIN public.tbl_profil_update_status ON public.tbl_profil_update_status.status_kurzbz = public.tbl_profil_update.status
JOIN public.tbl_student ON public.tbl_student.student_uid=public.tbl_profil_update.uid
JOIN public.tbl_benutzer ON public.tbl_benutzer.uid = public.tbl_student.student_uid
JOIN public.tbl_person ON public.tbl_benutzer.person_id=public.tbl_person.person_id
JOIN public.tbl_studiengang ON public.tbl_studiengang.studiengang_kz=public.tbl_student.studiengang_kz
LEFT JOIN (
select
pss.prestudent_id, COALESCE(sp.orgform_kurzbz, pss.orgform_kurzbz) as orgform_kurzbz
from (
select
prestudent_id, max(insertamum) as insertamum
from
public.tbl_prestudentstatus
where
datum <= NOW()
group by
prestudent_id
) mpss
join
public.tbl_prestudentstatus pss on pss.prestudent_id = mpss.prestudent_id and pss.insertamum = mpss.insertamum
left join
lehre.tbl_studienplan sp on pss.studienplan_id = sp.studienplan_id
) of ON of.prestudent_id = public.tbl_student.prestudent_id
Where public.tbl_studiengang.oe_kurzbz IN ? ";
$parameters[] = $oe_berechtigung;
if ($whereClause) {
@@ -144,12 +178,33 @@ class Profil_update_model extends DB_Model
}
}
if ($mitarbeiterBerechtigung) {
$this->addSelect(["profil_update_id", "tbl_profil_update.uid", "(tbl_person.vorname || ' ' || tbl_person.nachname) AS name", "topic", "requested_change", "tbl_profil_update.updateamum", "tbl_profil_update.updatevon", "tbl_profil_update.insertamum", "tbl_profil_update.insertvon", "status", "public.tbl_profil_update_status.bezeichnung_mehrsprachig[(" . $lang . ")] AS status_translated", "status_timestamp", "status_message", "attachment_id"]);
$this->addSelect([
"profil_update_id",
"tbl_profil_update.uid",
"(tbl_person.vorname || ' ' || tbl_person.nachname) AS name",
"topic",
"requested_change",
"tbl_profil_update.updateamum",
"tbl_profil_update.updatevon",
"tbl_profil_update.insertamum",
"tbl_profil_update.insertvon",
"status",
"public.tbl_profil_update_status.bezeichnung_mehrsprachig[(" . $lang . ")] AS status_translated",
"status_timestamp",
"status_message",
"attachment_id",
"COALESCE(NULL) as studiengang",
"COALESCE(NULL) as orgform",
"oe.bezeichnung as oezuordnung"
]);
$this->addJoin('tbl_profil_update_status', 'tbl_profil_update_status.status_kurzbz=tbl_profil_update.status');
$this->addJoin('tbl_mitarbeiter', 'tbl_mitarbeiter.mitarbeiter_uid=tbl_profil_update.uid');
$this->addJoin('tbl_benutzer', 'tbl_benutzer.uid=tbl_profil_update.uid');
$this->addJoin('tbl_person', 'tbl_benutzer.person_id=tbl_person.person_id');
$this->addJoin('tbl_benutzerfunktion bf', 'bf.uid = tbl_benutzer.uid AND bf.funktion_kurzbz = \'oezuordnung\' AND NOW() >= COALESCE(bf.datum_von, \'1970-01-01\'::date) AND NOW() <= COALESCE(bf.datum_bis, \'2170-12-31\'::date)', 'LEFT');
$this->addJoin('tbl_organisationseinheit oe', 'oe.oe_kurzbz = bf.oe_kurzbz', 'LEFT');
$mitarbeiterRequests = $this->loadWhere($whereClause);
if (isError($mitarbeiterRequests))
return error("db error: " . getData($mitarbeiterRequests));
$mitarbeiterRequests = getData($mitarbeiterRequests) ?: [];
@@ -184,13 +184,13 @@ export default {
},
height: 600,
layout: "fitColumns",
layout: "fitDataStretchFrozen",
columns: [
{
title: this.$p.t("profilUpdate", "UID"),
field: "uid",
minWidth: 200,
minWidth: 100,
resizable: true,
headerFilter: true,
//responsive:0,
@@ -203,12 +203,40 @@ export default {
headerFilter: true,
//responsive:0,
},
{
title: this.$p.t("lehre", "studiengang") + ' (' + this.$p.t("profil", "studentIn") + ')',
field: "studiengang",
minWidth: 50,
resizable: true,
headerFilter: "list",
headerFilterParams: {valuesLookup:true, listOnEmpty:true, autocomplete:true, sort:"asc"},
//responsive:0,
},
{
title: this.$p.t("lehre", "organisationsform") + ' (' + this.$p.t("profil", "studentIn") + ')',
field: "orgform",
minWidth: 50,
resizable: true,
headerFilter: "list",
headerFilterParams: {valuesLookup:true, listOnEmpty:true, autocomplete:true, sort:"asc"},
//responsive:0,
},
{
title: this.$p.t("lehre", "organisationseinheit") + ' (' + this.$p.t("profil", "mitarbeiterIn") + ')',
field: "oezuordnung",
minWidth: 200,
resizable: true,
headerFilter: "list",
headerFilterParams: {valuesLookup:true, listOnEmpty:true, autocomplete:true, sort:"asc"},
//responsive:0,
},
{
title: this.$p.t("profilUpdate", "Topic"),
field: "topic",
resizable: true,
minWidth: 200,
headerFilter: true,
headerFilter: "list",
headerFilterParams: {valuesLookup:true, listOnEmpty:true, autocomplete:true, sort:"asc"},
//responsive:0,
},
{
@@ -223,7 +251,8 @@ export default {
title: this.$p.t("profilUpdate", "Status"),
field: "status_translated",
hozAlign: "center",
headerFilter: true,
headerFilter: "list",
headerFilterParams: {valuesLookup:true, listOnEmpty:true, autocomplete:true, sort:"asc"},
formatter: (cell, para) => {
let iconClasses = "";
let status = cell.getRow().getData().status;
@@ -248,20 +277,11 @@ export default {
{
title: this.$p.t("profilUpdate", "actions"),
headerSort: false,
frozen: true,
formatter: (cell, params) => {
let STATUS_PENDING =
cell.getRow().getData().status ==
this.profilUpdateStates["Pending"];
let details = this.$p.t('global', 'details');
let html = `<div class="d-flex justify-content-evenly align-items-center">
<button class="btn border-primary border-2" id="showButton"><i class="fa-solid fa-eye fhc-primary-color"></i></button>
${
STATUS_PENDING ?
`<button class="btn border-success border-2" id="acceptButton"><i class='fa fa-lg fa-circle-check text-success'></i></button>
<button class="btn border-danger border-2" id="denyButton"><i class=' fa fa-lg fa-circle-xmark text-danger'></i></button>`
:
``
}
<button class="btn btn-secondary" id="showButton">${details}</button>
</div>`;
// Convert the HTML string to an HTML node
@@ -276,19 +296,6 @@ export default {
this.showAcceptDenyModal(cell.getRow().getData());
});
if (STATUS_PENDING) {
node
.querySelector("#acceptButton")
.addEventListener("click", () => {
this.acceptProfilUpdate(cell.getRow().getData());
});
node
.querySelector("#denyButton")
.addEventListener("click", () => {
this.denyProfilUpdate(cell.getRow().getData());
});
}
return node;
},
minWidth: 200,
@@ -382,7 +389,7 @@ export default {
},
},
created() {
this.$p.loadCategory("profilUpdate").then(() => {
this.$p.loadCategory(["profilUpdate", "lehre", "profil", "global"]).then(() => {
this.categoryLoaded = true;
});
},