Merge branch 'feature-30660/FHC4_StudierendenGUI_Prototyp' of github.com:FH-Complete/FHC-Core into feature-30660/FHC4_StudierendenGUI_Prototyp

This commit is contained in:
ma0068
2024-04-19 07:08:01 +02:00
5 changed files with 381 additions and 17 deletions
+6
View File
@@ -22,9 +22,15 @@ export default {
insert(data) {
return this.$fhcApi.post('api/frontend/v1/stv/konto/insert', data);
},
counter(data) {
return this.$fhcApi.post('api/frontend/v1/stv/konto/counter', data);
},
edit(data) {
return this.$fhcApi.post('api/frontend/v1/stv/konto/update', data);
},
delete(buchungsnr) {
return this.$fhcApi.post('api/frontend/v1/stv/konto/delete', {buchungsnr});
},
getBuchungstypen() {
return this.$fhcApi.get('api/frontend/v1/stv/konto/getBuchungstypen');
}
@@ -5,7 +5,7 @@ import KontoEdit from "./Konto/Edit.js";
// TODO(chris): Phrasen
// TODO(chris): multi pers
// TODO(chris): gegenb.(date) multi, löschen multi, best. multi(recht)
// TODO(chris): best. multi(recht)
export default {
components: {
@@ -24,7 +24,8 @@ export default {
data() {
return {
filter: false,
studiengang_kz: false
studiengang_kz: false,
counterdate: new Date()
};
},
computed: {
@@ -154,6 +155,24 @@ export default {
);
container.append(button);
button = document.createElement('button');
button.className = 'btn btn-outline-secondary';
button.innerHTML = '<i class="fa fa-trash"></i>';
button.addEventListener('click', evt => {
evt.stopPropagation();
this.$fhcAlert
.confirmDelete()
.then(result => result ? cell.getData().buchungsnr : Promise.reject({handled:true}))
.then(this.$fhcApi.factory.stv.konto.delete)
.then(() => {
// TODO(chris): deleting a child also removes the siblings!
//cell.getRow().delete();
this.reload();
})
.catch(this.$fhcAlert.handleSystemError);
});
container.append(button);
return container;
},
frozen: true
@@ -182,10 +201,24 @@ export default {
updateData(data) {
if (!data)
return this.reload();
this.$refs.table.tabulator.updateData(data);
// TODO(chris): check children (!delete?, multiple children)
//this.$refs.table.tabulator.updateOrAddData(data.map(row => row.buchungsnr_verweis ? {buchungsnr:row.buchungsnr_verweis, _children:row} : row));
this.$refs.table.tabulator.updateOrAddData(data);
},
actionNew() {
this.$refs.new.open();
},
actionCounter(selected) {
this.$fhcApi
.factory.stv.konto.counter({
buchungsnr: selected.map(e => e.buchungsnr),
buchungsdatum: this.counterdate
})
.then(result => result.data)
.then(this.updateData)
.then(() => 'Daten wurden gespeichert')
.then(this.$fhcAlert.alertSuccess)
.catch(this.$fhcAlert.handleSystemError);
}
},
created() {
@@ -221,11 +254,35 @@ export default {
table-only
:side-menu="false"
:tabulator-options="tabulatorOptions"
reload
new-btn-show
new-btn-label="Buchung"
:new-btn-disabled="stg_kz === ''"
@click:new="actionNew"
>
<template #actions="{selected}">
<div class="input-group w-auto">
<form-input
type="DatePicker"
v-model="counterdate"
input-group
:enable-time-picker="false"
auto-apply
@cleared="counterdate = new Date()"
>
</form-input>
<button
class="btn btn-outline-secondary"
@click="actionCounter(selected)"
:disabled="!selected.length"
>
Gegenbuchen
</button>
</div>
<button v-if="config.showZahlungsbestaetigung" class="btn btn-outline-secondary" @click="actionDownloadPdfs">
<i class="fa fa-download"></i> Zahlungsbestaetigung
</button>
</template>
</core-filter-cmpt>
<konto-new ref="new" :config="config" @saved="updateData" :person-ids="personIds" :stg-kz="stg_kz"></konto-new>
<konto-edit ref="edit" :config="config" @saved="updateData"></konto-edit>