improvements 2

This commit is contained in:
cgfhtw
2023-09-04 16:52:46 +02:00
parent 1009f73109
commit bd92777b96
13 changed files with 1158 additions and 336 deletions
+15 -67
View File
@@ -15,77 +15,25 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import FhcSearchbar from "../components/searchbar/searchbar.js";
import StvVerband from "../components/Studienverwaltung/Verband.js";
import StvList from "../components/Studienverwaltung/List.js";
import StvDetails from "../components/Studienverwaltung/Details.js";
import VerticalSplit from "../components/verticalsplit/verticalsplit.js";
import FhcStudentenverwaltung from "../components/Stv/Studentenverwaltung.js";
import fhcapifactory from "./api/fhcapifactory.js";
Vue.$fhcapi = fhcapifactory;
const app = Vue.createApp({
components: {
FhcSearchbar,
StvVerband,
StvList,
StvDetails,
VerticalSplit
},
data() {
return {
selected: [],
searchbaroptions: {
types: [
"person",
"student",
"prestudent"
],
actions: {
person: {
defaultaction: {
type: "link",
action: function(data) {
return data.profil;
}
},
childactions: [
{
"label": "testchildaction1",
"icon": "fas fa-check-circle",
"type": "function",
"action": function(data) {
alert('person testchildaction 01 ' + JSON.stringify(data));
}
},
{
"label": "testchildaction2",
"icon": "fas fa-file-csv",
"type": "function",
"action": function(data) {
alert('person testchildaction 02 ' + JSON.stringify(data));
}
}
]
}
}
},
}
},
computed: {
lastSelected() {
return this.selected[this.selected.length - 1];
}
},
methods: {
onSelectVerband(link) {
this.$refs.stvList.updateUrl(link);
},
searchfunction(searchsettings) {
return Vue.$fhcapi.Search.search(searchsettings);
}
}
const ciPath = FHC_JS_DATA_STORAGE_OBJECT.app_root.replace(/(https:|)(^|\/\/)(.*?\/)/g, '') + FHC_JS_DATA_STORAGE_OBJECT.ci_router;
const router = VueRouter.createRouter({
history: VueRouter.createWebHistory(),
routes: [
{ path: `/${ciPath}/studentenverwaltung`, component: FhcStudentenverwaltung },
{ path: `/${ciPath}/studentenverwaltung/:id`, component: FhcStudentenverwaltung }
]
});
app.use(primevue.config.default).mount('#main');
const app = Vue.createApp();
app
.use(router)
.use(primevue.config.default)
.mount('#main');
@@ -1,69 +0,0 @@
import {CoreFilterCmpt} from "../filter/Filter.js";
import {CoreRESTClient} from '../../RESTClient.js';
export default {
components: {
CoreFilterCmpt
},
props: {
selected: Array
},
emits: [
'update:selected'
],
data() {
return {
tabulatorOptions: {
ajaxURL: CoreRESTClient._generateRouterURI("components/Studentenverwaltung/getStudents"),
//autoColumns: true,
columns:[
{title:"UID", field:"uid"},
{title:"TitelPre", field:"titelpre"},
{title:"Nachname", field:"nachname"},
{title:"Vorname", field:"vorname"},
{title:"Wahlname", field:"wahlname", visible:false},
// TODO(chris): IMPLEMENT!
],
height: 'auto',
selectable: true
},
tabulatorEvents: [
{
event: 'rowSelectionChanged',
handler: this.rowSelectionChanged
}
]
}
},
methods: {
actionNewPrestudent() {
console.log('actionNewPrestudent');
},
rowSelectionChanged(data) {
this.$emit('update:selected', data);
},
updateUrl(url) {
this.$refs.table.tabulator.setData(CoreRESTClient._generateRouterURI(url));
console.log(CoreRESTClient._generateRouterURI(url));
}
},
mounted() {
},
template: `
<div class="stv-list h-100 pt-3">
<core-filter-cmpt
ref="table"
:tabulator-options="tabulatorOptions"
:tabulator-events="tabulatorEvents"
table-only
:side-menu="false"
reload
new-btn-show
new-btn-label="Prestudent"
@click:new="actionNewPrestudent"
>
</core-filter-cmpt>
</div>`
};
@@ -0,0 +1,117 @@
/**
* Copyright (C) 2022 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 <https://www.gnu.org/licenses/>.
*/
import FhcSearchbar from "../searchbar/searchbar.js";
import VerticalSplit from "../verticalsplit/verticalsplit.js";
import StvVerband from "./Studentenverwaltung/Verband.js";
import StvList from "./Studentenverwaltung/List.js";
import StvDetails from "./Studentenverwaltung/Details.js";
export default {
components: {
FhcSearchbar,
StvVerband,
StvList,
StvDetails,
VerticalSplit
},
data() {
return {
selected: [],
searchbaroptions: {
types: [
"person",
"student",
"prestudent"
],
actions: {
person: {
defaultaction: {
type: "link",
action: function(data) {
return data.profil;
}
},
childactions: [
{
"label": "testchildaction1",
"icon": "fas fa-check-circle",
"type": "function",
"action": function(data) {
alert('person testchildaction 01 ' + JSON.stringify(data));
}
},
{
"label": "testchildaction2",
"icon": "fas fa-file-csv",
"type": "function",
"action": function(data) {
alert('person testchildaction 02 ' + JSON.stringify(data));
}
}
]
}
}
},
}
},
computed: {
lastSelected() {
return this.selected[this.selected.length - 1];
}
},
methods: {
onSelectVerband(link) {
this.$refs.stvList.updateUrl(link);
},
searchfunction(searchsettings) {
return Vue.$fhcapi.Search.search(searchsettings);
}
},
mounted() {
if (this.$route.params.id) {
this.$refs.stvList.updateUrl('components/stv/students/uid/' + this.$route.params.id);
}
},
template: `
<header class="navbar navbar-expand-lg navbar-dark bg-dark flex-md-nowrap p-0 shadow">
<a class="navbar-brand col-md-4 col-lg-3 col-xl-2 me-0 px-3" href="<?= site_url('Studentenverwaltung'); ?>">FHC 4.0</a>
<button class="navbar-toggler d-md-none m-1 collapsed" type="button" data-bs-toggle="offcanvas" data-bs-target="#sidebarMenu" aria-controls="sidebarMenu" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
<fhc-searchbar :searchoptions="searchbaroptions" :searchfunction="searchfunction" class="searchbar w-100"></fhc-searchbar>
</header>
<div class="container-fluid overflow-hidden">
<div class="row h-100">
<nav id="sidebarMenu" class="bg-light offcanvas offcanvas-start col-md p-md-0 h-100">
<div class="offcanvas-header justify-content-end px-1 d-md-none">
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<stv-verband @select-verband="onSelectVerband"></stv-verband>
</nav>
<main class="col-md-8 ms-sm-auto col-lg-9 col-xl-10">
<vertical-split>
<template #top>
<stv-list ref="stvList" v-model:selected="selected"></stv-list>
</template>
<template #bottom>
<stv-details :student="lastSelected"></stv-details>
</template>
</vertical-split>
</main>
</div>
</div>`
};
@@ -0,0 +1,30 @@
import DetailsDetails from './Details/Details.js';
import DetailsNotizen from './Details/Notizen.js';
export default {
components: {
DetailsDetails,
DetailsNotizen
},
props: {
student: Object
},
data() {
return {
component: 'DetailsDetails',
tabs: {
DetailsDetails: 'Details',
DetailsNotizen: 'Notizen'
}
}
},
template: `
<div class="stv-details h-100 pb-3">
<ul class="nav nav-tabs">
<li v-for="(title, comp) in tabs" class="nav-item" :key="comp">
<a class="nav-link" :class="{active: comp == component}" :aria-current="comp == component ? 'page' : ''" href="#" @click="component=comp">{{title}}</a>
</li>
</ul>
<component :is="component" :student="student"></component>
</div>`
};
@@ -0,0 +1,87 @@
export default {
props: {
student: Object
},
data() {
return {
person_id: '',
bpk: '',
anrede: '',
titelpre: '',
titelpost: '',
nachname: '',
vorname: '',
vornamen: '',
wahlname: '',
gebdatum: '',
gebort: '',
gebnation: ''
}
},
watch: {
student(n) {
this.person_id = n.person_id;
this.bpk = n.bpk;
this.anrede = n.anrede;
this.titelpre = n.titelpre;
this.titelpost = n.titelpost;
this.nachname = n.nachname;
this.vorname = n.vorname;
this.vornamen = n.vornamen;
this.wahlname = n.wahlname;
this.gebdatum = n.gebdatum;
// TODO(chris): gebdatum > datepicker
// TODO(chris): gebort & getnation?
}
},
template: `
<div class="stv-details-details h-100 pb-3">
<fieldset>
<legend>Person</legend>
<div class="row mb-3">
<label for="stv-details-person_id" class="col-sm-1 col-form-label">Person ID</label>
<div class="col-sm-3">
<input id="stv-details-person_id" type="text" class="form-control" v-model="person_id">
</div>
<label for="stv-details-bpk" class="col-sm-1 col-form-label">BPK</label>
<div class="col-sm-3">
<input id="stv-details-bpk" type="text" class="form-control" v-model="bpk">
</div>
</div>
<div class="row mb-3">
<label for="stv-details-anrede" class="col-sm-1 col-form-label">Anrede</label>
<div class="col-sm-3">
<input id="stv-details-anrede" type="text" class="form-control" v-model="anrede">
</div>
<label for="stv-details-titelpre" class="col-sm-1 col-form-label">Titel Pre</label>
<div class="col-sm-3">
<input id="stv-details-titelpre" type="text" class="form-control" v-model="titelpre">
</div>
<label for="stv-details-titelpost" class="col-sm-1 col-form-label">Titel Post</label>
<div class="col-sm-3">
<input id="stv-details-titelpost" type="text" class="form-control" v-model="titelpost">
</div>
</div>
<div class="row mb-3">
<label for="stv-details-wahlname" class="col-sm-1 col-form-label">Wahlname</label>
<div class="col-sm-3">
<input id="stv-details-wahlname" type="text" class="form-control" v-model="wahlname">
</div>
</div>
<div class="row mb-3">
<label for="stv-details-gebdatum" class="col-sm-1 col-form-label">Geburtsdatum</label>
<div class="col-sm-3">
<input id="stv-details-gebdatum" type="text" class="form-control" v-model="gebdatum">
</div>
<label for="stv-details-gebort" class="col-sm-1 col-form-label">Geburtsort</label>
<div class="col-sm-3">
<input id="stv-details-gebort" type="text" class="form-control" v-model="gebort">
</div>
<label for="stv-details-gebnation" class="col-sm-1 col-form-label">Geburtsnation</label>
<div class="col-sm-3">
<input id="stv-details-gebnation" type="text" class="form-control" v-model="gebnation">
</div>
</div>
</fieldset>
</div>`
};
@@ -3,7 +3,7 @@ export default {
student: Object
},
template: `
<div class="stv-details h-100 pb-3">
{{student}}
<div class="stv-details-details h-100 pb-3">
NOT YET IMPLEMENTED
</div>`
};
@@ -0,0 +1,114 @@
import {CoreFilterCmpt} from "../../filter/Filter.js";
import {CoreRESTClient} from '../../../RESTClient.js';
export default {
components: {
CoreFilterCmpt
},
props: {
selected: Array
},
emits: [
'update:selected'
],
data() {
return {
tabulatorOptions: {
columns:[
{title:"UID", field:"uid"},
{title:"TitelPre", field:"titelpre"},
{title:"Nachname", field:"nachname"},
{title:"Vorname", field:"vorname"},
{title:"Wahlname", field:"wahlname", visible:false},
{title:"Vornamen", field:"vornamen", visible:false},
{title:"TitelPost", field:"titelpost"},
{title:"SVNR", field:"svnr"},
{title:"Ersatzkennzeichen", field:"ersatzkennzeichen"},
{title:"Geburtsdatum", field:"geburtsdatum_iso"},
{title:"Geschlecht", field:"geschlecht"},
{title:"Sem.", field:"semester"},
{title:"Verb.", field:"verband"},
{title:"Grp.", field:"gruppe"},
{title:"Studiengang", field:"studiengang"},
{title:"Studiengang_kz", field:"studiengang_kz", visible:false},
{title:"Personenkennzeichen", field:"matrikelnummer"},
{title:"PersonID", field:"person_id"},
{title:"Status", field:"status"},
{title:"Status Datum", field:"status_datum_iso", visible:false},
{title:"Status Bestaetigung", field:"status_bestaetigung_iso", visible:false},
{title:"Status Datum ISO", field:"status_datum_iso", visible:false},
{title:"Status Bestaetigung ISO", field:"status_bestaetigung_iso", visible:false},
{title:"EMail (Privat)", field:"mail_privat", visible:false},
{title:"EMail (Intern)", field:"mail_intern", visible:false},
{title:"Anmerkungen", field:"anmerkungen", visible:false},
{title:"AnmerkungPre", field:"anmerkungpre", visible:false},
{title:"OrgForm", field:"orgform"},
{title:"Aufmerksamdurch", field:"orgform", visible:false},
{title:"Gesamtpunkte", field:"punkte", visible:false},
{title:"Aufnahmegruppe", field:"aufnahmegruppe_kurzbz", visible:false},
{title:"Dual", field:"dual_bezeichnung", visible:false},
{title:"Matrikelnummer", field:"matr_nr", visible:false},
{title:"Studienplan", field:"studienplan_bezeichnung"},
{title:"PreStudentInnenID", field:"prestudent_id"},
{title:"Priorität", field:"priorisierung_realtiv"},
{title:"Mentor", field:"mentor", visible:false},
{title:"Aktiv", field:"aktiv", visible:false},
{title:"GeburtsdatumISO", field:"geburtsdatum_iso", visible:false},
],
layout: 'fitDataFill',
layoutColumnsOnNewData: false,
height: 'auto',
selectable: true,
//persistence: true
},
tabulatorEvents: [
{
event: 'rowSelectionChanged',
handler: this.rowSelectionChanged
}
]
}
},
methods: {
actionNewPrestudent() {
console.log('actionNewPrestudent');
},
rowSelectionChanged(data) {
this.$emit('update:selected', data);
},
updateUrl(url) {
this.$refs.table.tabulator.on("dataProcessed", () => {
let rows = this.$refs.table.tabulator.getRows();
if (rows.length && rows.length == 1) {
console.log();
this.$refs.table.tabulator.selectRow();
}
});
if (!this.$refs.table.tableBuilt)
this.$refs.table.tabulator.on("tableBuilt", () => {
this.$refs.table.tabulator.setData(CoreRESTClient._generateRouterURI(url));
});
else
this.$refs.table.tabulator.setData(CoreRESTClient._generateRouterURI(url));
}
},
mounted() {
},
template: `
<div class="stv-list h-100 pt-3">
<core-filter-cmpt
ref="table"
:tabulator-options="tabulatorOptions"
:tabulator-events="tabulatorEvents"
table-only
:side-menu="false"
reload
new-btn-show
new-btn-label="Prestudent"
@click:new="actionNewPrestudent"
>
</core-filter-cmpt>
</div>`
};
@@ -1,4 +1,4 @@
import {CoreRESTClient} from '../../RESTClient.js';
import {CoreRESTClient} from '../../../RESTClient.js';
export default {
components: {
@@ -17,55 +17,50 @@ export default {
methods: {
onExpandTreeNode(node) {
if (!node.children) {
let url = '';
if (node.data.studiengang_kz) {
url = "getStudiengang/" + node.data.studiengang_kz;
}
if (url) {
if (node.data.link) {
this.loading = true;
CoreRESTClient
.get("components/Studentenverwaltung/" + url)
.get("components/stv/verband/" + node.data.link)
.then(result => result.data)
.then(result => {
const subNodes = result.data.map(this.mapResultToTreeData);
const subNodes = result.map(this.mapResultToTreeData);
node.children = subNodes;
this.loading = false;
})
.catch(error => {
console.error(error);
});
}
}
},
onSelectTreeNode(node) {
if (node.link)
this.$emit('selectVerband', node.link);
if (node.data.link)
this.$emit('selectVerband', 'components/stv/students/' + node.data.link);
},
mapResultToTreeData(el) {
const cp = {
key: ("" + el.link).replace('/', '-'),
data: el
};
if (el.studiengang_kz !== undefined) {
cp.key = el.studiengang_kz;
cp.data.name = el.kurzbzlang + ' (' + (el.typ + el.kurzbz).toUpperCase() + ') - ' + el.bezeichnung;
cp.leaf = false;
cp.link = 'components/Studentenverwaltung/getStudents/' + el.studiengang_kz;
}
if (el.children)
cp.children = el.children.map(this.mapResultToTreeData);
else
cp.leaf = el.leaf || false;
return cp;
}
},
mounted() {
CoreRESTClient
.get("components/Studentenverwaltung")
.get("components/stv/verband")
.then(result => result.data)
.then(result => {
if(CoreRESTClient.isError(result)) {
console.error(CoreRESTClient.getError(result));
} else if (CoreRESTClient.hasData(result)) {
this.nodes = CoreRESTClient.getData(result).map(this.mapResultToTreeData);
}
this.nodes = result.map(this.mapResultToTreeData);
this.loading = false;
})
.catch(error => {
console.error(error);
});
},
template: `