diff --git a/application/controllers/api/frontend/v1/vertraege/Vertraege.php b/application/controllers/api/frontend/v1/vertraege/Vertraege.php index 0d4b06a30..04f1df69c 100644 --- a/application/controllers/api/frontend/v1/vertraege/Vertraege.php +++ b/application/controllers/api/frontend/v1/vertraege/Vertraege.php @@ -75,8 +75,20 @@ class Vertraege extends FHCAPI_Controller $this->terminateWithSuccess((getData($result) ?: [])); } - public function getStatiOfContract($vertrag_id) + public function getStatiOfContract($person_id, $vertrag_id) { + //check if vertrag_id corresponds with person_id and return null if not + $result = $this->VertragModel->loadWhere( + array( + 'vertrag_id' => $vertrag_id, + 'person_id' => $person_id + ) + ); + if(!hasData($result)) + { + $this->terminateWithSuccess([]); + } + $result = $this->VertragModel->getStatiOfContract($vertrag_id); if (isError($result)) { diff --git a/public/js/api/factory/vertraege/vertraege.js b/public/js/api/factory/vertraege/vertraege.js index 714856cfe..1eff24a6b 100644 --- a/public/js/api/factory/vertraege/vertraege.js +++ b/public/js/api/factory/vertraege/vertraege.js @@ -40,10 +40,10 @@ export default { url: 'api/frontend/v1/vertraege/Vertraege/getAllContractTypes/' }; }, - getStatiOfContract(vertrag_id){ + getStatiOfContract(person_id, vertrag_id){ return { method: 'get', - url: 'api/frontend/v1/vertraege/Vertraege/getStatiOfContract/' + vertrag_id + url: 'api/frontend/v1/vertraege/Vertraege/getStatiOfContract/' + person_id + '/' + vertrag_id }; }, configPrintDocument() { diff --git a/public/js/components/Vertraege/List/Details.js b/public/js/components/Vertraege/List/Details.js index 47eb629a3..a8f50743a 100644 --- a/public/js/components/Vertraege/List/Details.js +++ b/public/js/components/Vertraege/List/Details.js @@ -198,7 +198,7 @@ export default {
{{$p.t('vertrag', 'vertragDetails')}}
- + this.$api.call( - this.endpoint.getStatiOfContract(this.vertrag_id) + this.endpoint.getStatiOfContract(this.person_id, this.vertrag_id) ), ajaxResponse: (url, params, response) => response.data, columns: [ @@ -199,9 +203,11 @@ export default { } }, watch: { + person_id() { + this.$refs.table.tabulator.setData('api/frontend/v1/vertraege/vertraege/getStatiOfContract/' + this.person_id + '/' + this.vertrag_id); + }, vertrag_id() { - //this.reloadTable(); - this.$refs.table.tabulator.setData('api/frontend/v1/vertraege/vertraege/getStatiOfContract/' + this.vertrag_id); + this.$refs.table.tabulator.setData('api/frontend/v1/vertraege/vertraege/getStatiOfContract/' + this.person_id + '/' + this.vertrag_id); }, formDataParent: { handler(newVal, oldVal) { diff --git a/public/js/components/Vertraege/Vertraege.js b/public/js/components/Vertraege/Vertraege.js index 202f517f3..27a154672 100644 --- a/public/js/components/Vertraege/Vertraege.js +++ b/public/js/components/Vertraege/Vertraege.js @@ -601,6 +601,7 @@ export default {