mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-18 15:32:17 +00:00
Studentenverwaltung archive: switched to new api factory
This commit is contained in:
@@ -34,7 +34,7 @@ class Archiv extends FHCAPI_Controller
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct([
|
||||
'get' => ['admin:r', 'assistenz:r'],
|
||||
'getArchiv' => ['admin:r', 'assistenz:r'],
|
||||
'getArchivVorlagen' => ['admin:r', 'assistenz:r'],
|
||||
'archive' => ['admin:w', 'assistenz:w'],
|
||||
'download' => ['admin:w', 'assistenz:w'],
|
||||
@@ -60,9 +60,9 @@ class Archiv extends FHCAPI_Controller
|
||||
|
||||
* @return void
|
||||
*/
|
||||
public function get()
|
||||
public function getArchiv()
|
||||
{
|
||||
$person_id = $this->input->post('person_id');
|
||||
$person_id = $this->input->get('person_id');
|
||||
|
||||
$this->load->library('form_validation');
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
export default {
|
||||
getArchiv(person_id) {
|
||||
console.log(person_id);
|
||||
return {
|
||||
method: 'get',
|
||||
url: 'api/frontend/v1/stv/archiv/getArchiv',
|
||||
params: { person_id }
|
||||
};
|
||||
},
|
||||
getArchivVorlagen() {
|
||||
return {
|
||||
method: 'get',
|
||||
url: 'api/frontend/v1/stv/archiv/getArchivVorlagen'
|
||||
};
|
||||
},
|
||||
archive(data) {
|
||||
return {
|
||||
method: 'post',
|
||||
url: 'api/frontend/v1/documents/archive',
|
||||
params: data
|
||||
};
|
||||
},
|
||||
archiveSigned(data) {
|
||||
return {
|
||||
method: 'post',
|
||||
url: 'api/frontend/v1/documents/archiveSigned',
|
||||
params: data
|
||||
};
|
||||
},
|
||||
update(data) {
|
||||
return {
|
||||
method: 'post',
|
||||
url: 'api/frontend/v1/stv/archiv/update',
|
||||
params: data
|
||||
};
|
||||
},
|
||||
delete(akte_id, studiengang_kz) {
|
||||
return {
|
||||
method: 'post',
|
||||
url: 'api/frontend/v1/stv/archiv/delete',
|
||||
params: {akte_id, studiengang_kz}
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -2,6 +2,8 @@ import {CoreFilterCmpt} from "../../../filter/Filter.js";
|
||||
import FormInput from "../../../Form/Input.js";
|
||||
import AkteEdit from "./Archiv/Edit.js";
|
||||
|
||||
import ApiStvArchiv from '../../../../api/factory/stv/archiv.js';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
CoreFilterCmpt,
|
||||
@@ -61,119 +63,108 @@ export default {
|
||||
'abschlussdokument_lehrgaenge.xml.php': [
|
||||
'AbschlussdokumentLehrgaenge'
|
||||
]
|
||||
}
|
||||
//studiengang_kz: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
//~ personIds() {
|
||||
//~ if (this.modelValue.person_id)
|
||||
//~ return [this.modelValue.person_id];
|
||||
//~ return this.modelValue.map(e => e.person_id);
|
||||
//~ },
|
||||
tabulatorColumns() {
|
||||
const columns = [
|
||||
{title: "Akte Id", field: "akte_id", visible: false},
|
||||
{title: this.$p.t('stv', 'archiv_title'), field: "titel"},
|
||||
{title: this.$p.t('stv', 'archiv_description'), field: "bezeichnung"},
|
||||
{title: this.$p.t('stv', 'archiv_creation_date'), field: "erstelltam"},
|
||||
{
|
||||
title: this.$p.t('stv', 'archiv_signiert'),
|
||||
field: "signiert",
|
||||
formatter:"tickCross",
|
||||
hozAlign:"center",
|
||||
formatterParams: {
|
||||
tickElement: '<i class="fa fa-check text-success"></i>',
|
||||
crossElement: '<i class="fa fa-xmark text-danger"></i>'
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "Selfservice",
|
||||
field: "stud_selfservice",
|
||||
formatter:"tickCross",
|
||||
hozAlign:"center",
|
||||
formatterParams: {
|
||||
tickElement: '<i class="fa fa-check text-success"></i>',
|
||||
crossElement: '<i class="fa fa-xmark text-danger"></i>'
|
||||
},
|
||||
},
|
||||
{title: this.$p.t('stv', 'archiv_accepted_on_at'), field: "akzeptiertamum"},
|
||||
{
|
||||
title: this.$p.t('stv', 'archiv_gedruckt'),
|
||||
field: "gedruckt",
|
||||
visible: false,
|
||||
formatter:"tickCross",
|
||||
hozAlign:"center",
|
||||
formatterParams: {
|
||||
tickElement: '<i class="fa fa-check text-success"></i>',
|
||||
crossElement: '<i class="fa fa-xmark text-danger"></i>'
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Aktionen', field: 'actions',
|
||||
formatter: (cell, formatterParams, onRendered) => {
|
||||
let container = document.createElement('div');
|
||||
container.className = "d-flex gap-2";
|
||||
|
||||
if (this.config.showEdit)
|
||||
{
|
||||
let editButton = document.createElement('button');
|
||||
editButton.className = 'btn btn-outline-secondary';
|
||||
editButton.innerHTML = '<i class="fa fa-edit"></i>';
|
||||
editButton.addEventListener('click', () =>
|
||||
this.$refs.edit.open(cell.getData())
|
||||
);
|
||||
container.append(editButton);
|
||||
},
|
||||
tabulatorOptions: {
|
||||
ajaxURL: 'dummy',
|
||||
ajaxRequestFunc: () => this.$api.call(
|
||||
ApiStvArchiv.getArchiv(
|
||||
this.modelValue.person_id ? [this.modelValue.person_id] : null || this.modelValue.map(e => e.person_id)
|
||||
)
|
||||
),
|
||||
ajaxResponse: (url, params, response) => response.data,
|
||||
columns: [
|
||||
{title: "Akte Id", field: "akte_id", visible: false},
|
||||
{title: this.$p.t('stv', 'archiv_title'), field: "titel"},
|
||||
{title: this.$p.t('stv', 'archiv_description'), field: "bezeichnung"},
|
||||
{title: this.$p.t('stv', 'archiv_creation_date'), field: "erstelltam"},
|
||||
{
|
||||
title: this.$p.t('stv', 'archiv_signiert'),
|
||||
field: "signiert",
|
||||
formatter:"tickCross",
|
||||
hozAlign:"center",
|
||||
formatterParams: {
|
||||
tickElement: '<i class="fa fa-check text-success"></i>',
|
||||
crossElement: '<i class="fa fa-xmark text-danger"></i>'
|
||||
}
|
||||
|
||||
let deleteButton = document.createElement('button');
|
||||
deleteButton.className = 'btn btn-outline-secondary';
|
||||
deleteButton.innerHTML = '<i class="fa fa-trash"></i>';
|
||||
deleteButton.addEventListener('click', evt => {
|
||||
evt.stopPropagation();
|
||||
this.$fhcAlert
|
||||
.confirmDelete()
|
||||
.then(result => result ? {akte_id: cell.getData().akte_id, studiengang_kz: this.modelValue.studiengang_kz} : Promise.reject({handled:true}))
|
||||
.then(this.$fhcApi.factory.stv.archiv.delete)
|
||||
.then(() => {
|
||||
//cell.getRow().delete();
|
||||
this.reload();
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
});
|
||||
container.append(deleteButton);
|
||||
|
||||
return container;
|
||||
},
|
||||
minWidth: 150, // Ensures Action-buttons will be always fully displayed
|
||||
maxWidth: 150,
|
||||
frozen: true
|
||||
}
|
||||
];
|
||||
return Object.values(columns);
|
||||
},
|
||||
tabulatorOptions() {
|
||||
return this.$fhcApi.factory.stv.archiv.tabulatorConfig({
|
||||
{
|
||||
title: "Selfservice",
|
||||
field: "stud_selfservice",
|
||||
formatter:"tickCross",
|
||||
hozAlign:"center",
|
||||
formatterParams: {
|
||||
tickElement: '<i class="fa fa-check text-success"></i>',
|
||||
crossElement: '<i class="fa fa-xmark text-danger"></i>'
|
||||
},
|
||||
},
|
||||
{title: this.$p.t('stv', 'archiv_accepted_on_at'), field: "akzeptiertamum"},
|
||||
{
|
||||
title: this.$p.t('stv', 'archiv_gedruckt'),
|
||||
field: "gedruckt",
|
||||
visible: false,
|
||||
formatter:"tickCross",
|
||||
hozAlign:"center",
|
||||
formatterParams: {
|
||||
tickElement: '<i class="fa fa-check text-success"></i>',
|
||||
crossElement: '<i class="fa fa-xmark text-danger"></i>'
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Aktionen', field: 'actions',
|
||||
formatter: (cell, formatterParams, onRendered) => {
|
||||
let container = document.createElement('div');
|
||||
container.className = "d-flex gap-2";
|
||||
|
||||
if (this.config.showEdit)
|
||||
{
|
||||
let editButton = document.createElement('button');
|
||||
editButton.className = 'btn btn-outline-secondary';
|
||||
editButton.innerHTML = '<i class="fa fa-edit"></i>';
|
||||
editButton.addEventListener('click', () =>
|
||||
this.$refs.edit.open(cell.getData())
|
||||
);
|
||||
container.append(editButton);
|
||||
}
|
||||
|
||||
let deleteButton = document.createElement('button');
|
||||
deleteButton.className = 'btn btn-outline-secondary';
|
||||
deleteButton.innerHTML = '<i class="fa fa-trash"></i>';
|
||||
deleteButton.addEventListener('click', evt => {
|
||||
evt.stopPropagation();
|
||||
this.$fhcAlert
|
||||
.confirmDelete()
|
||||
.then(result => result ? {akte_id: cell.getData().akte_id, studiengang_kz : this.modelValue.studiengang_kz} : Promise.reject({handled:true}))
|
||||
.then(params => this.$api.call(ApiStvArchiv.delete(params.akte_id, params.studiengang_kz)))
|
||||
.then(() => {
|
||||
//cell.getRow().delete();
|
||||
this.reload();
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
});
|
||||
container.append(deleteButton);
|
||||
|
||||
return container;
|
||||
},
|
||||
minWidth: 150, // Ensures Action-buttons will be always fully displayed
|
||||
maxWidth: 150,
|
||||
frozen: true
|
||||
}
|
||||
],
|
||||
layout:"fitDataTable",
|
||||
columns: this.tabulatorColumns,
|
||||
//selectable: true,
|
||||
//selectableRangeMode: 'click',
|
||||
index: 'akte_id',
|
||||
persistenceID: 'stv-details-archiv'
|
||||
}, this);
|
||||
},
|
||||
tabulatorEvents() {
|
||||
const events = [
|
||||
},
|
||||
tabulatorEvents: [
|
||||
{
|
||||
event: "rowDblClick",
|
||||
handler: (e, row) => {
|
||||
this.actionDownload(row.getData().akte_id);
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
return events;
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
watch: {
|
||||
modelValue() {
|
||||
@@ -195,18 +186,22 @@ export default {
|
||||
for (let archiveData of archiveDataArr)
|
||||
{
|
||||
this.loading = true;
|
||||
|
||||
// sign document depending on signierbar property
|
||||
let archiveFunction =
|
||||
this.selectedVorlage.signierbar
|
||||
? this.$fhcApi.factory.stv.archiv.archiveSigned
|
||||
: this.$fhcApi.factory.stv.archiv.archive;
|
||||
? ApiStvArchiv.archiveSigned
|
||||
: ApiStvArchiv.archive;
|
||||
|
||||
archiveFunction({
|
||||
xml: this.getXmlByXsl(this.selectedVorlage.vorlage_kurzbz),
|
||||
xsl: this.selectedVorlage.vorlage_kurzbz,
|
||||
ss: this.defaultSemester,
|
||||
uid: archiveData.uid,
|
||||
prestudent_id: archiveData.prestudent_id
|
||||
})
|
||||
this.$api.call(
|
||||
archiveFunction({
|
||||
xml: this.getXmlByXsl(this.selectedVorlage.vorlage_kurzbz),
|
||||
xsl: this.selectedVorlage.vorlage_kurzbz,
|
||||
ss: this.defaultSemester,
|
||||
uid: archiveData.uid,
|
||||
prestudent_id: archiveData.prestudent_id
|
||||
})
|
||||
)
|
||||
.then(result => result.data)
|
||||
.then(() => {
|
||||
this.reload();
|
||||
@@ -237,10 +232,10 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$fhcApi
|
||||
.factory.stv.archiv.getArchivVorlagen()
|
||||
.then(result => {this.vorlagenArchiv = result.data; this.selectedVorlage = result.data.filter(o => o.vorlage_kurzbz == 'Zeugnis')[0];})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
this.$api
|
||||
.call(ApiStvArchiv.getArchivVorlagen())
|
||||
.then(result => {this.vorlagenArchiv = result.data; this.selectedVorlage = result.data.filter(o => o.vorlage_kurzbz == 'Zeugnis')[0];})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
|
||||
},
|
||||
template: `
|
||||
|
||||
@@ -93,15 +93,14 @@ export default {
|
||||
v-model="data.signiert"
|
||||
>
|
||||
</form-input>
|
||||
<form-input
|
||||
container-class="form-check"
|
||||
type="checkbox"
|
||||
name="stud_selfservice"
|
||||
:label="'Selfservice'"
|
||||
v-model="data.stud_selfservice"
|
||||
>
|
||||
<form-input
|
||||
container-class="form-check"
|
||||
type="checkbox"
|
||||
name="stud_selfservice"
|
||||
:label="'Selfservice'"
|
||||
v-model="data.stud_selfservice">
|
||||
</form-input>
|
||||
</div>
|
||||
</form-input>
|
||||
</fieldset>
|
||||
|
||||
<template #title>
|
||||
@@ -115,4 +114,4 @@ export default {
|
||||
</template>
|
||||
</bs-modal>
|
||||
</core-form>`
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user