diff --git a/application/controllers/api/frontend/v1/stv/Archiv.php b/application/controllers/api/frontend/v1/stv/Archiv.php index 91fc9643d..cc636951d 100644 --- a/application/controllers/api/frontend/v1/stv/Archiv.php +++ b/application/controllers/api/frontend/v1/stv/Archiv.php @@ -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'); diff --git a/public/js/api/factory/stv/archiv.js b/public/js/api/factory/stv/archiv.js new file mode 100644 index 000000000..4205a5ecc --- /dev/null +++ b/public/js/api/factory/stv/archiv.js @@ -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} + }; + } +}; diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Archiv.js b/public/js/components/Stv/Studentenverwaltung/Details/Archiv.js index fd174e16f..0efa9519c 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Archiv.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Archiv.js @@ -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: '', - crossElement: '' - } - }, - { - title: "Selfservice", - field: "stud_selfservice", - formatter:"tickCross", - hozAlign:"center", - formatterParams: { - tickElement: '', - crossElement: '' - }, - }, - {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: '', - crossElement: '' - } - }, - { - 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 = ''; - 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: '', + crossElement: '' } - - let deleteButton = document.createElement('button'); - deleteButton.className = 'btn btn-outline-secondary'; - deleteButton.innerHTML = ''; - 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: '', + crossElement: '' + }, + }, + {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: '', + crossElement: '' + } + }, + { + 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 = ''; + 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 = ''; + 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: ` diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Archiv/Edit.js b/public/js/components/Stv/Studentenverwaltung/Details/Archiv/Edit.js index e819eb252..c280a50f4 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Archiv/Edit.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Archiv/Edit.js @@ -93,15 +93,14 @@ export default { v-model="data.signiert" > - + + - ` -}; \ No newline at end of file +};