API konsolidierung StV Config

This commit is contained in:
cgfhtw
2024-04-29 11:40:46 +02:00
parent b5c830ed35
commit 7bb98479dd
5 changed files with 42 additions and 17 deletions
@@ -1,21 +1,44 @@
<?php
/**
* Copyright (C) 2024 fhcomplete.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
if (! defined('BASEPATH')) exit('No direct script access allowed');
if (!defined('BASEPATH')) exit('No direct script access allowed');
use CI3_Events as Events;
class Config extends FHC_Controller
/**
* This controller operates between (interface) the JS (GUI) and the back-end
* Provides data to the ajax get calls about the StV Config
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
*/
class Config extends FHCAPI_Controller
{
public function __construct()
{
// TODO(chris): access!
parent::__construct();
parent::__construct([
'student' => self::PERM_LOGGED,
'students' => self::PERM_LOGGED
]);
$this->load->library('AuthLib');
$this->load->library('PermissionLib');
// Load Phrases
$this->loadPhrases([
'global',
'person',
@@ -48,10 +71,6 @@ class Config extends FHC_Controller
'title' => 'Status',
'component' => './Stv/Studentenverwaltung/Details/MultiStatus.js'
];
$result['konto'] = [
'title' => 'Konto',
'component' => './Stv/Studentenverwaltung/Details/Konto.js'
];
$result['banking'] = [
'title' => $this->p->t('stv', 'tab_banking'),
'component' => './Stv/Studentenverwaltung/Details/Konto.js',
@@ -77,7 +96,7 @@ class Config extends FHC_Controller
return $result;
});
$this->outputJsonSuccess($result);
$this->terminateWithSuccess($result);
}
public function students()
@@ -111,7 +130,7 @@ class Config extends FHC_Controller
return $result;
});
$this->outputJsonSuccess($result);
$this->terminateWithSuccess($result);
}
protected function kontoColumns()
+3 -1
View File
@@ -20,11 +20,13 @@ import phrasen from "./phrasen.js";
import navigation from "./navigation.js";
import filter from "./filter.js";
import studstatus from "./studstatus.js";
import stv from "./stv.js";
export default {
search,
phrasen,
navigation,
filter,
studstatus
studstatus,
stv
};
+7 -1
View File
@@ -3,5 +3,11 @@ import konto from './stv/konto.js';
export default {
filter,
konto
konto,
configStudent() {
return this.$fhcApi.get('api/frontend/v1/stv/config/student');
},
configStudents() {
return this.$fhcApi.get('api/frontend/v1/stv/config/students');
}
};
-2
View File
@@ -18,7 +18,6 @@
import FhcStudentenverwaltung from "../components/Stv/Studentenverwaltung.js";
import fhcapifactory from "./api/fhcapifactory.js";
import FhcApi from "../plugin/FhcApi.js";
import Phrasen from "../plugin/Phrasen.js";
//import PrimeVue form "../../../../index.ci.php/public/js/components/primevue/config/config.esm.min.js");
@@ -48,7 +47,6 @@ import(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_route
overlay: 1100
}
})
.use(FhcApi)
.use(Phrasen)
.mount('#main');
});
@@ -33,8 +33,8 @@ export default {
<h2 class="h4">{{students[0].titlepre}} {{students[0].vorname}} {{students[0].nachname}} {{students[0].titlepost}}</h2>
</div>
</div>
<fhc-tabs v-if="students.length == 1" ref="tabs" :modelValue="students[0]" config="/components/stv/config/student" :default="$route.params.tab" style="flex: 1 1 0%; height: 0%" @changed="reload"></fhc-tabs>
<fhc-tabs v-else ref="tabs" :modelValue="students" config="/components/stv/config/students" :default="$route.params.tab" style="flex: 1 1 0%; height: 0%" @changed="reload"></fhc-tabs>
<fhc-tabs v-if="students.length == 1" ref="tabs" :modelValue="students[0]" :config="$fhcApi.factory.stv.configStudent()" :default="$route.params.tab" style="flex: 1 1 0%; height: 0%" @changed="reload"></fhc-tabs>
<fhc-tabs v-else ref="tabs" :modelValue="students" :config="$fhcApi.factory.stv.configStudents()" :default="$route.params.tab" style="flex: 1 1 0%; height: 0%" @changed="reload"></fhc-tabs>
</div>
</div>`
};