diff --git a/application/controllers/api/frontend/v1/vertraege/Config.php b/application/controllers/api/frontend/v1/vertraege/Config.php index 72d38e93e..a4ebd8c48 100644 --- a/application/controllers/api/frontend/v1/vertraege/Config.php +++ b/application/controllers/api/frontend/v1/vertraege/Config.php @@ -37,6 +37,7 @@ class Config extends FHCAPI_Controller public function printDocument() { $params = []; + $menu = []; Events::trigger( 'multiActionPrintHonorarvertrag', @@ -47,7 +48,15 @@ class Config extends FHCAPI_Controller $params ); - //TODO(Manu) check warning - $this->terminateWithSuccess($menu[0]); + if (is_array($menu) && isset($menu[0])) + { + $this->terminateWithSuccess($menu[0]); + } + else + { + // $this->terminateWithError('Error with Event 'multiActionPrintHonorarvertrag'); + $this->terminateWithSuccess(); + + } } } diff --git a/public/js/api/factory/vertraege/vertraege.js b/public/js/api/factory/vertraege/vertraege.js index 8d39a24c9..c442bd8c3 100644 --- a/public/js/api/factory/vertraege/vertraege.js +++ b/public/js/api/factory/vertraege/vertraege.js @@ -22,12 +22,6 @@ export default { url: 'api/frontend/v1/vertraege/Vertraege/getAllVertraege/' + person_id }; }, -/* getAllContractsNotAssigned2(person_id) { - return { - method: 'get', - url: 'api/frontend/v1/vertraege/Vertraege/getAllContractsNotAssigned/' + person_id - }; - },*/ getAllContractsNotAssigned(person_id) { return { method: 'get', @@ -134,25 +128,32 @@ export default { }, getMitarbeiter(){ return { - method: 'post', + method: 'get', url: 'api/frontend/v1/vertraege/vertraege/getMitarbeiter/', }; - //return this.$fhcApi.post('api/frontend/v1/vertraege/vertraege/getMitarbeiter/'); }, getHeader(person_id){ - return this.$fhcApi.post('api/frontend/v1/vertraege/vertraege/getHeader/' + person_id); + return { + method: 'get', + url: 'api/frontend/v1/vertraege/vertraege/getHeader/' + person_id, + }; }, getPersonAbteilung(person_id){ - return this.$fhcApi.post('api/frontend/v1/vertraege/vertraege/getPersonAbteilung/' + person_id); + return { + method: 'get', + url: 'api/frontend/v1/vertraege/vertraege/getPersonAbteilung/' + person_id, + }; }, getLeitungOrg(oekurzbz){ - return this.$fhcApi.post('api/frontend/v1/vertraege/vertraege/getLeitungOrg/' + oekurzbz); + return { + method: 'get', + url: 'api/frontend/v1/vertraege/vertraege/getLeitungOrg/' + oekurzbz, + }; }, getMitarbeiterUid(person_id){ return { method: 'get', url: 'api/frontend/v1/vertraege/vertraege/getMitarbeiterUid/' + person_id }; - // return this.$fhcApi.get('api/frontend/v1/vertraege/vertraege/getMitarbeiterUid/' + person_id); }, }; \ No newline at end of file diff --git a/public/js/components/DetailHeader/DetailHeader.js b/public/js/components/DetailHeader/DetailHeader.js index a50b39e8c..8bed35beb 100644 --- a/public/js/components/DetailHeader/DetailHeader.js +++ b/public/js/components/DetailHeader/DetailHeader.js @@ -1,9 +1,21 @@ +import ApiCoreVertraege from "../../api/factory/vertraege/vertraege.js"; + export default { name: 'DetailHeader', + inject: { + domain: { + from: 'configDomain', + default: 'technikum-wien.at' + }, + }, props: { headerData: { type: Object, - required: true + required: false + }, + person_id: { + type: Number, + required: false }, typeHeader: { type: String, @@ -20,87 +32,177 @@ export default { appRoot() { return FHC_JS_DATA_STORAGE_OBJECT.app_root; }, + validatedHeaderData() { + if (this.typeHeader === 'student') return this.headerData; + if (this.typeHeader === 'mitarbeiter') return this.person_id; + return null; + } + }, + created(){ + if(this.person_id) { + this.getHeader(this.person_id); + + this.loadDepartmentData(this.person_id) + .then(() => { + // Call getLeitungOrg only after departmentData is loaded + this.getLeitungOrg(this.departmentData.oe_kurzbz); + }) + .catch((error) => { + console.error("Error loading department data:", error); + }); + } + }, + watch: { + person_id: { + handler(newVal) { + if (newVal) { + this.getHeader(this.person_id); + this.loadDepartmentData(this.person_id). + then(() => { + this.getLeitungOrg(this.departmentData.oe_kurzbz); + }); + } + }, + deep: true, + }, }, data(){ - return{}; + return{ + headerDataMa: {}, + departmentData: {}, + leitungData: {}, + }; }, methods: { - //TODO(Manu) finish for Vertragsverwaltung - getVorgesetzer(){}, + getHeader(person_id) { + return this.$api + .call(ApiCoreVertraege.getHeader(person_id)) + .then(result => { + this.headerDataMa = result.data; + + }) + .catch(this.$fhcAlert.handleSystemError); + }, + loadDepartmentData(person_id) { + return this.$api + .call(ApiCoreVertraege.getPersonAbteilung(person_id)) + .then(result => { + this.departmentData = result.data; + }) + .catch(this.$fhcAlert.handleSystemError); + }, + getLeitungOrg(oekurzbz){ + return this.$api + .call(ApiCoreVertraege.getLeitungOrg(oekurzbz)) + .then(result => { + this.leitungData = result.data; + }) + .catch(this.$fhcAlert.handleSystemError); + }, + redirectToLeitung(){ + this.$emit('redirectToLeitung', { + person_id: this.leitungData.person_id}); + } }, template: `
+ Email + + {{headerDataMa.uid}}@{{domain}} + + + {{headerDataMa.alias}}@{{domain}} + + | DW {{headerDataMa?.telefonklappe}} +
+- Email - - {{headerData.uid}}@{{domain}} - - - {{headerData.alias}}@{{domain}} - - | DW {{headerData?.telefonklappe}} -
- -