bugfix phrases tabulator, refactor Prestudent.js using FHCAPI_CONTROLLER

This commit is contained in:
ma0068
2024-03-25 13:28:28 +01:00
parent b907f01ebb
commit 65c7db7ae4
8 changed files with 442 additions and 116 deletions
@@ -90,8 +90,8 @@ export default {
methods: {
loadPrestudent() {
CoreRESTClient
.get('components/stv/Prestudent/get/' + this.modelValue.prestudent_id)
this.$fhcApi
.get('api/frontend/v1/stv/prestudent/get/' + this.modelValue.prestudent_id)
.then(result => result.data)
.then(result => {
this.data = result;
@@ -101,85 +101,73 @@ export default {
.catch(this.$fhcAlert.handleSystemError);
},
updatePrestudent(){
CoreRESTClient.post('components/stv/Prestudent/updatePrestudent/' + this.modelValue.prestudent_id,
this.deltaArray
).then(response => {
if (!response.data.error) {
this.$fhcAlert.alertSuccess('Speichern erfolgreich');
this.deltaArray = [];
this.actionUpdate = false;
} else {
const errorData = response.data.retval;
Object.entries(errorData).forEach(entry => {
const [key, value] = entry;
this.$fhcAlert.alertError(value);
});
}
}).catch(error => {
if (error.response && error.response.data) {
this.$fhcAlert.alertError(error.response.data);
} else {
this.$fhcAlert.alertError("Fehler bei Speicherroutine aufgetreten");
}
}).finally(() => {
window.scrollTo(0, 0);
});
this.$refs.form
.post('api/frontend/v1/stv/prestudent/updatePrestudent/' + this.modelValue.prestudent_id, this.deltaArray)
.then(response => {
this.$fhcAlert.alertSuccess('Speichern erfolgreich');
this.deltaArray = [];
this.actionUpdate = false;
})
.catch(this.$fhcAlert.handleSystemError)
.finally(() => {
window.scrollTo(0, 0);
});
},
},
created() {
this.loadPrestudent();
CoreRESTClient
.get('components/stv/Prestudent/getBezeichnungZGV')
.then(result => CoreRESTClient.getData(result.data) || [])
this.$fhcApi
.get('api/frontend/v1/stv/prestudent/getBezeichnungZGV')
.then(result => result.data)
.then(result => {
this.listZgvs = result;
})
.catch(this.$fhcAlert.handleSystemError);
CoreRESTClient
.get('components/stv/Prestudent/getBezeichnungMZGV')
.then(result => CoreRESTClient.getData(result.data) || [])
this.$fhcApi
.get('api/frontend/v1/stv/prestudent/getBezeichnungMZgv')
.then(result => result.data)
.then(result => {
this.listZgvsmaster = result;
})
.catch(this.$fhcAlert.handleSystemError);
CoreRESTClient
.get('components/stv/Prestudent/getBezeichnungDZGV')
.then(result => CoreRESTClient.getData(result.data) || [])
this.$fhcApi
.get('api/frontend/v1/stv/prestudent/getBezeichnungDZgv')
.then(result => result.data)
.then(result => {
this.listZgvsdoktor = result;
})
.catch(this.$fhcAlert.handleSystemError);
CoreRESTClient
CoreRESTClient //TODO(manu) FHCAPI
.get('components/stv/Lists/getStgs')
.then(result => CoreRESTClient.getData(result.data) || [])
.then(result => {
this.listStgs = result;
})
.catch(this.$fhcAlert.handleSystemError);
CoreRESTClient
.get('components/stv/Prestudent/getAusbildung')
.then(result => CoreRESTClient.getData(result.data) || [])
this.$fhcApi
.get('api/frontend/v1/stv/prestudent/getAusbildung')
.then(result => result.data)
.then(result => {
this.listAusbildung = result;
})
.catch(this.$fhcAlert.handleSystemError);
CoreRESTClient
.get('components/stv/Prestudent/getAufmerksamdurch')
.then(result => CoreRESTClient.getData(result.data) || [])
this.$fhcApi
.get('api/frontend/v1/stv/prestudent/getAufmerksamdurch')
.then(result => result.data)
.then(result => {
this.listAufmerksamdurch = result;
})
.catch(this.$fhcAlert.handleSystemError);
CoreRESTClient
.get('components/stv/Prestudent/getBerufstaetigkeit')
.then(result => CoreRESTClient.getData(result.data) || [])
this.$fhcApi
.get('api/frontend/v1/stv/prestudent/getBerufstaetigkeit')
.then(result => result.data)
.then(result => {
this.listBerufe = result;
})
.catch(this.$fhcAlert.handleSystemError);
CoreRESTClient
.get('components/stv/Prestudent/getTypenStg')
.then(result => CoreRESTClient.getData(result.data) || [])
this.$fhcApi
.get('api/frontend/v1/stv/prestudent/getTypenStg')
.then(result => result.data)
.then(result => {
this.listStgTyp = result;
})
@@ -192,7 +180,7 @@ export default {
<div class="position-sticky top-0 z-1">
<button type="submit" class="btn btn-primary position-absolute top-0 end-0" :disabled="!deltaLength">Speichern</button>
</div>
<fieldset class="overflow-hidden">
<fieldset>
<legend>{{$p.t('lehre', 'title_zgv')}} {{modelValue.nachname}} {{modelValue.vorname}}</legend>
<div class="row mb-3">
@@ -383,7 +371,7 @@ export default {
<!-- </template>-->
</fieldset>
<fieldset class="overflow-hidden">
<fieldset>
<legend>PrestudentIn</legend>
<div class="row mb-3">
@@ -1,5 +1,4 @@
import {CoreFilterCmpt} from "../../../../filter/Filter.js";
import {CoreRESTClient} from "../../../../../RESTClient";
export default{
components: {
@@ -11,7 +10,9 @@ export default{
data() {
return {
tabulatorOptions: {
ajaxURL: CoreRESTClient._generateRouterURI('components/stv/Prestudent/getHistoryPrestudents/' + this.person_id),
ajaxURL: 'api/frontend/v1/stv/Prestudent/getHistoryPrestudents/' + this.person_id,
ajaxRequestFunc: this.$fhcApi.get,
ajaxResponse: (url, params, response) => response.data,
//autoColumns: true,
columns:[
{title:"StSem", field:"studiensemester_kurzbz"},
@@ -22,7 +23,24 @@ export default{
{title:"UID", field:"student_uid"},
{title:"Status", field:"status"}
],
// tabulatorEvents: [],
tabulatorEvents: [
{
event: 'tableBuilt',
handler: async () => {
await this.$p.loadCategory(['lehre']);
let cm = this.$refs.table.tabulator.columnManager;
cm.getColumnByField('orgform_kurzbz').component.updateDefinition({
title: this.$p.t('lehre', 'organisationsform')
});
cm.getColumnByField('bezeichnung').component.updateDefinition({
title: this.$p.t('lehre', 'studienplan')
});
}
}
],
layout: 'fitDataFill',
layoutColumnsOnNewData: false,
height: 'auto',
@@ -30,24 +48,12 @@ export default{
},
}
},
async mounted(){
await this.$p.loadCategory(['lehre']);
let cm = this.$refs.table.tabulator.columnManager;
cm.getColumnByField('orgform_kurzbz').component.updateDefinition({
title: this.$p.t('lehre', 'organisationsform')
});
cm.getColumnByField('bezeichnung').component.updateDefinition({
title: this.$p.t('lehre', 'studienplan')
});
},
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"
>
@@ -149,7 +149,56 @@ export default{
height: 'auto',
selectable: false,
},
tabulatorEvents: [],
tabulatorEvents: [
{
event: 'tableBuilt',
handler: async () => {
await this.$p.loadCategory(['lehre','global','person']);
let cm = this.$refs.table.tabulator.columnManager;
/* cm.getColumnByField('lehrverband').component.updateDefinition({
title: this.$p.t('lehre', 'lehrverband')
});*/
cm.getColumnByField('format_bestaetigtam').component.updateDefinition({
title: this.$p.t('lehre', 'bestaetigt_am')
});
cm.getColumnByField('format_bewerbung_abgeschicktamum').component.updateDefinition({
title: this.$p.t('lehre', 'bewerbung_abgeschickt_am')
});
cm.getColumnByField('bezeichnung').component.updateDefinition({
title: this.$p.t('lehre', 'studienplan')
});
cm.getColumnByField('actions').component.updateDefinition({
title: this.$p.t('global', 'aktionen')
});
cm.getColumnByField('format_datum').component.updateDefinition({
title: this.$p.t('global', 'datum')
});
cm.getColumnByField('anmerkung').component.updateDefinition({
title: this.$p.t('global', 'anmerkung')
});
cm.getColumnByField('bestaetigtvon').component.updateDefinition({
title: this.$p.t('lehre', 'bestaetigt_von')
});
cm.getColumnByField('format_insertamum').component.updateDefinition({
title: this.$p.t('lehre', 'insert_am')
});
cm.getColumnByField('insertvon').component.updateDefinition({
title: this.$p.t('lehre', 'insert_von')
});
}
}
],
statusData: {},
listStudiensemester: [],
maxSem: Array.from({ length: 11 }, (_, index) => index),
@@ -472,54 +521,8 @@ export default{
})
.catch(this.$fhcAlert.handleSystemError);
},
async mounted(){
await this.$p.loadCategory(['lehre','global','person']);
mounted(){
let cm = this.$refs.table.tabulator.columnManager;
/* cm.getColumnByField('lehrverband').component.updateDefinition({
title: this.$p.t('lehre', 'lehrverband')
});*/
cm.getColumnByField('format_bestaetigtam').component.updateDefinition({
title: this.$p.t('lehre', 'bestaetigt_am')
});
cm.getColumnByField('format_bewerbung_abgeschicktamum').component.updateDefinition({
title: this.$p.t('lehre', 'bewerbung_abgeschickt_am')
});
cm.getColumnByField('bezeichnung').component.updateDefinition({
title: this.$p.t('lehre', 'studienplan')
});
cm.getColumnByField('actions').component.updateDefinition({
title: this.$p.t('global', 'aktionen')
});
cm.getColumnByField('format_datum').component.updateDefinition({
title: this.$p.t('global', 'datum')
});
cm.getColumnByField('anmerkung').component.updateDefinition({
title: this.$p.t('global', 'anmerkung')
});
/* cm.getColumnByField('format_bestaetigtam').component.updateDefinition({
title: this.$p.t('lehre', 'bestaetigt_am')
});*/
cm.getColumnByField('bestaetigtvon').component.updateDefinition({
title: this.$p.t('lehre', 'bestaetigt_von')
});
cm.getColumnByField('format_insertamum').component.updateDefinition({
title: this.$p.t('lehre', 'insert_am')
});
cm.getColumnByField('insertvon').component.updateDefinition({
title: this.$p.t('lehre', 'insert_von')
});
},
template: `
<div class="stv-list h-100 pt-3">