obsolete use of viewData object from cisRouterView

This commit is contained in:
adisposkofh
2026-05-26 17:33:38 +02:00
parent b0f90cafb6
commit d7b2964e4e
5 changed files with 33 additions and 15 deletions
@@ -25,12 +25,6 @@ class ProjektabgabeUebersicht extends Auth_Controller
*/
public function index()
{
// TODO create permission
$viewData = array(
'uid' => getAuthUID(),
'showEdit' => true
);
$this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'ProjektabgabeUebersicht']);
$this->load->view('CisRouterView/CisRouterView.php', ['route' => 'ProjektabgabeUebersicht']);
}
}
@@ -27,11 +27,12 @@ class PaabgabeUebersicht extends FHCAPI_Controller
public function __construct()
{
parent::__construct([
'viewData' => self::PERM_LOGGED,
'getPaAbgaben' => array('lehre/abgabetool:r'),
'getStudiengaenge' => array('lehre/abgabetool:r'),
'getTermine' => array('lehre/abgabetool:r'),
'getPaAbgabetypen' => array('lehre/abgabetool:r'),
'downloadZip' => array('lehre/abgabetool:r')
'downloadZip' => array('lehre/abgabetool:r'),
//'downloadProjektarbeit' => array('lehre/abgabetool:r')
]);
@@ -45,6 +46,17 @@ class PaabgabeUebersicht extends FHCAPI_Controller
]);
}
public function viewData()
{
$viewData = [
"uid" => getAuthUID(),
// TODO create permission
"showEdit" => true,
];
$this->terminateWithSuccess($viewData);
}
/**
* Get Projektabgaben for search criteria.
*/
@@ -26,5 +26,11 @@ export default {
method: 'get',
url: '/api/frontend/v1/education/PaabgabeUebersicht/getPaAbgabetypen'
};
},
getViewData() {
return {
method: 'get',
url: '/api/frontend/v1/education/PaabgabeUebersicht/viewData'
};
}
};
@@ -4,9 +4,6 @@ import Loader from "../../Loader.js";
export const ProjektabgabeUebersicht = {
name: "ProjektabgabeUebersicht",
props: {
viewData: Object // NOTE: this is inherited from router-view
},
components: {
CoreFilterCmpt,
Loader
@@ -60,7 +57,7 @@ export const ProjektabgabeUebersicht = {
});
container.append(downloadButton);
if (this.viewData.showEdit)
if (this.showEdit)
{
let editButton = document.createElement('button');
editButton.className = 'btn btn-outline-secondary';
@@ -116,7 +113,9 @@ export const ProjektabgabeUebersicht = {
this.tableBuiltResolve()
}
}
]};
],
showEdit: null,
};
},
methods: {
tableResolve(resolve) {
@@ -220,7 +219,12 @@ export const ProjektabgabeUebersicht = {
if (this.selectedTermin) url.searchParams.append('abgabedatum', this.selectedTermin);
if (this.personSearchString) url.searchParams.append('personSearchString', this.personSearchString);
window.open(url.toString(), '_blank');
}
},
async getViewData() {
const viewDataResponse = await this.$api.call(ApiPaabgabe.getViewData());
const viewData = viewDataResponse.data;
this.showEdit = viewData.showEdit;
},
},
computed: {
isDarkMode() {
@@ -236,7 +240,8 @@ export const ProjektabgabeUebersicht = {
return FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + '/api/frontend/v1/education/PaabgabeUebersicht/downloadZip';
}
},
created() {
async created() {
await this.getViewData();
this.phrasenPromise = this.$p.loadCategory(['abgabetool', 'global', 'person', 'ui']);
this.phrasenPromise.then(()=> {this.phrasenResolved = true});
},
@@ -75,6 +75,7 @@ export default {
},
methods: {
switchFilter(evt) {
console.log(evt);
this.$emit('switchFilter', evt.currentTarget.value);
},
applyFilterConfig() {