mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-01 19:09:27 +00:00
Konto filters for Student list
This commit is contained in:
@@ -320,6 +320,8 @@ class Students extends FHC_Controller
|
||||
break;
|
||||
}
|
||||
|
||||
$this->addFilter($studiensemester_kurzbz);
|
||||
|
||||
$this->outputJson([]);
|
||||
}
|
||||
|
||||
@@ -426,6 +428,8 @@ class Students extends FHC_Controller
|
||||
|
||||
}
|
||||
|
||||
$this->addFilter($studiensemester_kurzbz);
|
||||
|
||||
$result = $this->PrestudentModel->loadWhere($where);
|
||||
|
||||
if (isError($result)) {
|
||||
@@ -497,6 +501,8 @@ class Students extends FHC_Controller
|
||||
$this->PrestudentModel->addSelect('p.zugangscode');
|
||||
$this->PrestudentModel->addSelect('p.bpk');
|
||||
|
||||
$this->addFilter($studiensemester_kurzbz);
|
||||
|
||||
$result = $this->PrestudentModel->loadWhere([
|
||||
'tbl_prestudent.prestudent_id' => $prestudent_id
|
||||
]);
|
||||
@@ -570,6 +576,8 @@ class Students extends FHC_Controller
|
||||
$this->PrestudentModel->addSelect('p.zugangscode');
|
||||
$this->PrestudentModel->addSelect('p.bpk');
|
||||
|
||||
$this->addFilter($studiensemester_kurzbz);
|
||||
|
||||
$result = $this->PrestudentModel->loadWhere([
|
||||
's.student_uid' => $student_uid
|
||||
]);
|
||||
@@ -643,6 +651,8 @@ class Students extends FHC_Controller
|
||||
$this->PrestudentModel->addSelect('p.zugangscode');
|
||||
$this->PrestudentModel->addSelect('p.bpk');
|
||||
|
||||
$this->addFilter($studiensemester_kurzbz);
|
||||
|
||||
$result = $this->PrestudentModel->loadWhere([
|
||||
'p.person_id' => $person_id
|
||||
]);
|
||||
@@ -654,4 +664,45 @@ class Students extends FHC_Controller
|
||||
$this->outputJson(getData($result) ?: []);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds additional filters to the query
|
||||
*
|
||||
* @param string $studiensemester_kurzbz
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function addFilter($studiensemester_kurzbz)
|
||||
{
|
||||
$filter = $this->input->get('filter');
|
||||
if (isset($filter['konto_count_0'])) {
|
||||
$bt = $this->PrestudentModel->escape($filter['konto_count_0']);
|
||||
$stdsem = $this->PrestudentModel->escape($studiensemester_kurzbz);
|
||||
|
||||
$this->PrestudentModel->db->where('(
|
||||
SELECT count(*)
|
||||
FROM public.tbl_konto
|
||||
WHERE person_id=tbl_prestudent.person_id
|
||||
AND buchungstyp_kurzbz=' . $bt . '
|
||||
AND studiensemester_kurzbz=' . $stdsem . '
|
||||
) =', 0);
|
||||
$this->PrestudentModel->db->where('get_rolle_prestudent(tbl_prestudent.prestudent_id, NULL) !=', 'Incoming');
|
||||
}
|
||||
if (isset($filter['konto_missing_counter'])) {
|
||||
$bt = $this->PrestudentModel->escape($filter['konto_missing_counter']);
|
||||
$stg = '';
|
||||
if ($this->variablelib->getVar('kontofilterstg') == 'true')
|
||||
$stg = ' AND studiengang_kz=tbl_prestudent.studiengang_kz';
|
||||
|
||||
$bt = $bt == 'alle' ? '' : ' AND buchungstyp_kurzbz=' . $bt;
|
||||
|
||||
$this->PrestudentModel->db->where('(
|
||||
SELECT sum(betrag)
|
||||
FROM public.tbl_konto
|
||||
WHERE person_id=tbl_prestudent.person_id' .
|
||||
$bt .
|
||||
$stg . '
|
||||
) !=', 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,3 +104,7 @@ html {
|
||||
background-color: #f8d7da!important;
|
||||
border-color: #f5c2c7!important;
|
||||
}
|
||||
|
||||
.has-filter .fa-filter {
|
||||
color: var(--bs-success);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@ export default {
|
||||
CoreFilterCmpt,
|
||||
ListNew
|
||||
},
|
||||
inject: [
|
||||
'lists'
|
||||
],
|
||||
props: {
|
||||
selected: Array,
|
||||
studiengangKz: Number,
|
||||
@@ -79,7 +82,9 @@ export default {
|
||||
}
|
||||
],
|
||||
focusObj: null, // TODO(chris): this should be in the filter component
|
||||
lastSelected: null
|
||||
lastSelected: null,
|
||||
filterKontoCount0: undefined,
|
||||
filterKontoMissingCounter: undefined
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -110,17 +115,29 @@ export default {
|
||||
},
|
||||
updateUrl(url, first) {
|
||||
this.lastSelected = first ? undefined : this.selected;
|
||||
|
||||
if (url)
|
||||
url = CoreRESTClient._generateRouterURI(url);
|
||||
|
||||
const params = {}, filter = {};
|
||||
if (this.filterKontoCount0)
|
||||
filter.konto_count_0 = this.filterKontoCount0;
|
||||
if (this.filterKontoMissingCounter)
|
||||
filter.konto_missing_counter = this.filterKontoMissingCounter;
|
||||
|
||||
if (filter.konto_count_0 || filter.konto_missing_counter)
|
||||
params.filter = filter;
|
||||
|
||||
if (!this.$refs.table.tableBuilt) {
|
||||
if (!this.$refs.table.tabulator) {
|
||||
this.tabulatorOptions.ajaxURL = url;
|
||||
this.tabulatorOptions.ajaxParams = params;
|
||||
} else
|
||||
this.$refs.table.tabulator.on("tableBuilt", () => {
|
||||
this.$refs.table.tabulator.setData(url);
|
||||
this.$refs.table.tabulator.setData(url, params);
|
||||
});
|
||||
} else
|
||||
this.$refs.table.tabulator.setData(url);
|
||||
this.$refs.table.tabulator.setData(url, params);
|
||||
},
|
||||
onKeydown(e) { // TODO(chris): this should be in the filter component
|
||||
if (!this.focusObj)
|
||||
@@ -179,7 +196,7 @@ export default {
|
||||
// TODO(chris): filter component column chooser has no accessibilty features
|
||||
template: `
|
||||
<div class="stv-list h-100 pt-3">
|
||||
<div class="tablulator-container d-flex flex-column h-100" tabindex="0" @focusin="onFocus" @focusout="onBlur" @keydown="onKeydown">
|
||||
<div class="tablulator-container d-flex flex-column h-100" :class="{'has-filter': filterKontoCount0 || filterKontoMissingCounter}" tabindex="0" @focusin="onFocus" @focusout="onBlur" @keydown="onKeydown">
|
||||
<core-filter-cmpt
|
||||
ref="table"
|
||||
:tabulator-options="tabulatorOptions"
|
||||
@@ -191,6 +208,35 @@ export default {
|
||||
new-btn-label="InteressentIn"
|
||||
@click:new="actionNewPrestudent"
|
||||
>
|
||||
<template #filter>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="input-group mb-3">
|
||||
<label class="input-group-text col-4" for="stv-list-filter-konto-count-0">Liste filtern auf nicht belastet:</label>
|
||||
<select class="form-select" id="stv-list-filter-konto-count-0" v-model="filterKontoCount0" @input="$nextTick(updateUrl)">
|
||||
<option v-for="typ in lists.buchungstypen" :key="typ.buchungstyp_kurzbz" :value="typ.buchungstyp_kurzbz">
|
||||
{{ typ.beschreibung }}
|
||||
</option>
|
||||
</select>
|
||||
<button v-if="filterKontoCount0" class="btn btn-outline-secondary" @click="filterKontoCount0 = undefined; updateUrl()">
|
||||
<i class="fa fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<label class="input-group-text col-4" for="stv-list-filter-konto-missing-counter">Liste filtern auf fehlende Gegenbuchungen:</label>
|
||||
<select class="form-select" id="stv-list-filter-konto-missing-counter" v-model="filterKontoMissingCounter" @input="$nextTick(updateUrl)">
|
||||
<option value="alle">alle Buchungstypen</option>
|
||||
<option v-for="typ in lists.buchungstypen" :key="typ.buchungstyp_kurzbz" :value="typ.buchungstyp_kurzbz">
|
||||
{{ typ.beschreibung }}
|
||||
</option>
|
||||
</select>
|
||||
<button v-if="filterKontoMissingCounter" class="btn btn-outline-secondary" @click="filterKontoMissingCounter = undefined; updateUrl()">
|
||||
<i class="fa fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</core-filter-cmpt>
|
||||
</div>
|
||||
<list-new ref="new" :studiengang-kz="studiengangKz" :studiensemester-kurzbz="studiensemesterKurzbz"></list-new>
|
||||
|
||||
@@ -543,7 +543,7 @@ export const CoreFilterCmpt = {
|
||||
</div>
|
||||
<div class="d-flex gap-1 align-items-baseline flex-grow-1 justify-content-end">
|
||||
<span v-if="!tableOnly">[ {{ filterName }} ]</span>
|
||||
<a v-if="!tableOnly" href="#" class="btn btn-link px-0 text-dark" data-bs-toggle="collapse" :data-bs-target="'#collapseFilters' + idExtra">
|
||||
<a v-if="!tableOnly || $slots.filter" href="#" class="btn btn-link px-0 text-dark" data-bs-toggle="collapse" :data-bs-target="'#collapseFilters' + idExtra">
|
||||
<span class="fa-solid fa-xl fa-filter"></span>
|
||||
</a>
|
||||
<a href="#" class="btn btn-link px-0 text-dark" data-bs-toggle="collapse" :data-bs-target="'#collapseColumns' + idExtra">
|
||||
@@ -576,6 +576,14 @@ export const CoreFilterCmpt = {
|
||||
@apply-filter-config="applyFilterConfig"
|
||||
@save-custom-filter="handlerSaveCustomFilter"
|
||||
></filter-config>
|
||||
<div
|
||||
v-else-if="$slots.filter"
|
||||
:id="'collapseFilters' + idExtra"
|
||||
class="card-body collapse"
|
||||
:data-bs-parent="'#filterCollapsables' + idExtra"
|
||||
>
|
||||
<slot name="filter"></slot>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tabulator -->
|
||||
|
||||
Reference in New Issue
Block a user