Refactoring FhcApi_Factory

This commit is contained in:
ma0068
2025-04-24 08:23:24 +02:00
parent a4777724dc
commit ed6b9310ae
2 changed files with 43 additions and 7 deletions
+35
View File
@@ -0,0 +1,35 @@
/**
* Copyright (C) 2025 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/>.
*/
export default {
getCourselist(params) {
return {
method: 'get',
url: 'api/frontend/v1/stv/LvTermine/getStundenplan/' + params.student_uid + '/'
+ params.start_date + '/'
+ params.end_date + '/'
+ params.group_consecutiveHours + '/'
+ params.dbStundenplanTable
};
},
getStudiensemester(){
return {
method: 'get',
url: 'api/frontend/v1/stv/LvTermine/getStudiensemester/'
};
},
}
@@ -2,6 +2,8 @@ import {CoreFilterCmpt} from "../../../../filter/Filter.js";
import FormInput from "../../../../Form/Input.js";
import FormForm from '../../../../Form/Form.js';
import ApiStvCoursedates from "../../../../../api/factory/stv/coursedates.js";
export default {
name: "TblCourseList",
components: {
@@ -46,16 +48,14 @@ export default {
initTabulatorOptions(){
this.tabulatorOptions = {
ajaxURL: 'dummy',
ajaxRequestFunc: this.$fhcApi.factory.stv.courselist.getCourselist,
ajaxParams: () => {
return {
ajaxRequestFunc: () => this.$api.call(
ApiStvCoursedates.getCourselist({
student_uid: this.student.uid,
start_date: this.dataSem.start,
end_date: this.dataSem.ende,
group_consecutiveHours: true,
dbStundenplanTable: this.dbStundenplanTable
};
},
dbStundenplanTable: this.dbStundenplanTable})
),
ajaxResponse: (url, params, response) => {
return response.data;
},
@@ -153,7 +153,8 @@ export default {
},
},
created(){
this.$fhcApi.factory.stv.courselist.getStudiensemester()
this.$api
.call(ApiStvCoursedates.getStudiensemester())
.then(result => {
this.listStudiensemester = result.data;
this.getDatesOfSemester(this.currentSemester);