diff --git a/public/js/api/factory/addons.js b/public/js/api/factory/addons.js new file mode 100644 index 000000000..23fd19e39 --- /dev/null +++ b/public/js/api/factory/addons.js @@ -0,0 +1,25 @@ +/** + * 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 . + */ + +export default { + getLvMenu(lvid, studiensemester_kurzbz) { + return { + method: 'get', + url: `/api/frontend/v1/LvMenu/getLvMenu/${lvid}/${studiensemester_kurzbz}` + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/authinfo.js b/public/js/api/factory/authinfo.js new file mode 100644 index 000000000..5cf88604f --- /dev/null +++ b/public/js/api/factory/authinfo.js @@ -0,0 +1,25 @@ +/** + * 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 . + */ + +export default { + getAuthUID() { + return { + method: 'get', + url: '/api/frontend/v1/AuthInfo/getAuthUID' + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/betriebsmittel.js b/public/js/api/factory/betriebsmittel.js new file mode 100644 index 000000000..bc007a20e --- /dev/null +++ b/public/js/api/factory/betriebsmittel.js @@ -0,0 +1,22 @@ +/** + * 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 . + */ + +import person from "./betriebsmittel/person.js"; + +export default { + person +}; diff --git a/public/js/api/factory/betriebsmittel/person.js b/public/js/api/factory/betriebsmittel/person.js new file mode 100644 index 000000000..912a5df31 --- /dev/null +++ b/public/js/api/factory/betriebsmittel/person.js @@ -0,0 +1,63 @@ +/** + * 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 . + */ + +export default { + getAllBetriebsmittel(type, id) { + return { + method: 'get', + url: 'api/frontend/v1/betriebsmittel/betriebsmittelP/getAllBetriebsmittel/' + type + '/' + id + }; + }, + addNewBetriebsmittel(person_id, params) { + return { + method: 'post', + url: 'api/frontend/v1/betriebsmittel/betriebsmittelP/addNewBetriebsmittel/' + person_id, + params + }; + }, + loadBetriebsmittel(betriebsmittelperson_id) { + return { + method: 'post', + url: 'api/frontend/v1/betriebsmittel/betriebsmittelP/loadBetriebsmittel/' + betriebsmittelperson_id + }; + }, + updateBetriebsmittel(betriebsmittelperson_id, params) { + return { + method: 'post', + url: 'api/frontend/v1/betriebsmittel/betriebsmittelP/updateBetriebsmittel/' + betriebsmittelperson_id, + params + }; + }, + deleteBetriebsmittel(betriebsmittelperson_id) { + return { + method: 'post', + url: 'api/frontend/v1/betriebsmittel/betriebsmittelP/deleteBetriebsmittel/' + betriebsmittelperson_id + }; + }, + getTypenBetriebsmittel() { + return { + method: 'get', + url: 'api/frontend/v1/betriebsmittel/betriebsmittelP/getTypenBetriebsmittel/' + }; + }, + loadInventarliste(query) { + return { + method: 'get', + url: 'api/frontend/v1/betriebsmittel/betriebsmittelP/loadInventarliste/' + query + }; + } +}; diff --git a/public/js/api/factory/checkperson.js b/public/js/api/factory/checkperson.js new file mode 100644 index 000000000..dc5546cf5 --- /dev/null +++ b/public/js/api/factory/checkperson.js @@ -0,0 +1,37 @@ +/** + * 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 . + */ + +export default { + updatePersonUnrulyStatus(person_id, unruly) { + const params = { person_id, unruly } + const url = '/api/frontend/v1/checkperson/CheckPerson/updatePersonUnrulyStatus'; + return { + method: 'post', + url, + params + }; + }, + filterPerson(params, base = '') { + // TODO(chris): seems to be called from nowhere? + const url = base + '/api/frontend/v1/checkperson/CheckPerson/filterPerson'; + return { + method: 'post', + url, + params + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/cis/dashboard.js b/public/js/api/factory/cis/dashboard.js new file mode 100644 index 000000000..cb1ec16bb --- /dev/null +++ b/public/js/api/factory/cis/dashboard.js @@ -0,0 +1,25 @@ +/** + * 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 . + */ + +export default { + getViewData() { + return { + method: 'get', + url: '/api/frontend/v1/Cis4FhcApi/getViewData' + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/cis/menu.js b/public/js/api/factory/cis/menu.js new file mode 100644 index 000000000..829c5ff04 --- /dev/null +++ b/public/js/api/factory/cis/menu.js @@ -0,0 +1,25 @@ +/** + * 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 . + */ + +export default { + getMenu() { + return { + method: 'get', + url: '/api/frontend/v1/CisMenu/getMenu' + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/cms.js b/public/js/api/factory/cms.js new file mode 100644 index 000000000..59ad4af5a --- /dev/null +++ b/public/js/api/factory/cms.js @@ -0,0 +1,64 @@ +/** + * 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 . + */ + +export default { + content(content_id, version=null, sprache=null, sichtbar=null) { + return { + method: 'get', + url: '/api/frontend/v1/Cms/content', + params: { + content_id, + ...(version ? { version } : {}), + ...(sprache ? { sprache } : {}), + ...(sichtbar ? { sichtbar } : {}) + } + }; + }, + //api function used for the news View that renders the html + getNews(page = 1, page_size = 10, sprache) { + return { + method: 'get', + url: '/api/frontend/v1/Cms/getNews', + params: { + page, + page_size, + sprache + }, + }; + }, + //api function used for the widget component + news(limit) { + return { + method: 'get', + url: '/api/frontend/v1/Cms/news', + params: { limit } + }; + }, + getNewsRowCount() { + return { + method: 'get', + url: '/api/frontend/v1/Cms/getNewsRowCount' + }; + }, + getNewsExtra() { + // TODO(chris): seems to be called from nowhere? + return { + method: 'get', + url: '/api/frontend/v1/Cms/getStudiengangInfoForNews' + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/filter.js b/public/js/api/factory/filter.js new file mode 100644 index 000000000..5207fe1cf --- /dev/null +++ b/public/js/api/factory/filter.js @@ -0,0 +1,95 @@ +/** + * 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 . + */ + +export default { + saveCustomFilter(wsParams) { + return { + method: 'post', + url: '/api/frontend/v1/filter/saveCustomFilter', + params: { + filterUniqueId: wsParams.filterUniqueId, + filterType: wsParams.filterType, + customFilterName: wsParams.customFilterName + } + }; + }, + removeCustomFilter(wsParams) { + return { + method: 'post', + url: '/api/frontend/v1/filter/removeCustomFilter', + params: { + filterUniqueId: wsParams.filterUniqueId, + filterType: wsParams.filterType, + filterId: wsParams.filterId + } + }; + }, + applyFilterFields(wsParams) { + return { + method: 'post', + url: '/api/frontend/v1/filter/applyFilterFields', + params: { + filterUniqueId: wsParams.filterUniqueId, + filterType: wsParams.filterType, + filterFields: wsParams.filterFields + } + }; + }, + addFilterField(wsParams) { + return { + method: 'post', + url: '/api/frontend/v1/filter/addFilterField', + params: { + filterUniqueId: wsParams.filterUniqueId, + filterType: wsParams.filterType, + filterField: wsParams.filterField + } + }; + }, + removeFilterField(wsParams) { + return { + method: 'post', + url: '/api/frontend/v1/filter/removeFilterField', + params: { + filterUniqueId: wsParams.filterUniqueId, + filterType: wsParams.filterType, + filterField: wsParams.filterField + } + }; + }, + getFilterById(wsParams) { + return { + method: 'get', + url: '/api/frontend/v1/filter/getFilter', + params: { + filterUniqueId: wsParams.filterUniqueId, + filterType: wsParams.filterType, + filterId: wsParams.filterId + } + }; + }, + getFilter(wsParams) { + return { + method: 'get', + url: '/api/frontend/v1/filter/getFilter', + params: { + filterUniqueId: wsParams.filterUniqueId, + filterType: wsParams.filterType + } + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/lehre.js b/public/js/api/factory/lehre.js new file mode 100644 index 000000000..84c8e8662 --- /dev/null +++ b/public/js/api/factory/lehre.js @@ -0,0 +1,39 @@ +/** + * 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 . + */ + +export default { + getStudentenMail(lehreinheit_id) { + // TODO(chris): seems to be called from nowhere? + return { + method: 'get', + url: '/api/frontend/v1/Lehre/lvStudentenMail', + params: { lehreinheit_id } + }; + }, + getLvInfo(studiensemester_kurzbz, lehrveranstaltung_id) { + return { + method: 'get', + url: `/api/frontend/v1/Lehre/LV/${studiensemester_kurzbz}/${lehrveranstaltung_id}` + }; + }, + getStudentPruefungen(lehrveranstaltung_id) { + return { + method: 'get', + url: `/api/frontend/v1/Lehre/Pruefungen/${lehrveranstaltung_id}` + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/navigation.js b/public/js/api/factory/navigation.js new file mode 100644 index 000000000..896801dd7 --- /dev/null +++ b/public/js/api/factory/navigation.js @@ -0,0 +1,33 @@ +/** + * 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 . + */ + +export default { + getHeader(navigation_page) { + return { + method: 'get', + url: '/api/frontend/v1/navigation/header', + params: { navigation_page } + }; + }, + getMenu(navigation_page) { + return { + method: 'get', + url: '/api/frontend/v1/navigation/menu', + params: { navigation_page } + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/notiz.js b/public/js/api/factory/notiz.js new file mode 100644 index 000000000..074d4b6a5 --- /dev/null +++ b/public/js/api/factory/notiz.js @@ -0,0 +1,22 @@ +/** + * 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 . + */ + +import person from "./notiz/person.js"; + +export default { + person +}; diff --git a/public/js/api/factory/notiz/person.js b/public/js/api/factory/notiz/person.js new file mode 100644 index 000000000..33b572d1a --- /dev/null +++ b/public/js/api/factory/notiz/person.js @@ -0,0 +1,87 @@ +/** + * 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 . + */ + +export default { + getNotizen(id, type) { + return { + method: 'get', + url: 'api/frontend/v1/notiz/notizPerson/getNotizen/' + id + '/' + type + }; + }, + getUid() { + return { + method: 'get', + url: 'api/frontend/v1/notiz/notizPerson/getUid/' + }; + }, + addNewNotiz(id, params) { + return { + method: 'post', + url: 'api/frontend/v1/notiz/notizPerson/addNewNotiz/' + id, + params + }; + }, + loadNotiz(notiz_id) { + return { + method: 'post', + url: 'api/frontend/v1/notiz/notizPerson/loadNotiz/', + params: { + notiz_id + } + }; + }, + loadDokumente(notiz_id) { + return { + method: 'post', + url: 'api/frontend/v1/notiz/notizPerson/loadDokumente/', + params: { + notiz_id + } + }; + }, + deleteNotiz(notiz_id, type_id, id) { + return { + method: 'post', + url: 'api/frontend/v1/notiz/notizPerson/deleteNotiz/', + params: { + notiz_id, + type_id, + id + } + }; + }, + updateNotiz(notiz_id, params) { + return { + method: 'post', + url: 'api/frontend/v1/notiz/notizPerson/updateNotiz/' + notiz_id, + params + }; + }, + getMitarbeiter(event) { + return { + method: 'get', + url: 'api/frontend/v1/notiz/notizPerson/getMitarbeiter/' + event + }; + }, + isBerechtigt(id, type_id) { + // TODO(chris): seems to be called from nowhere? + return { + method: 'get', + url: 'api/frontend/v1/notiz/notizPerson/isBerechtigt/' + }; + } +}; diff --git a/public/js/api/factory/ort.js b/public/js/api/factory/ort.js new file mode 100644 index 000000000..90488df1b --- /dev/null +++ b/public/js/api/factory/ort.js @@ -0,0 +1,26 @@ +/** + * 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 . + */ + +export default { + getContentID(ort_kurbz) { + return { + method: 'get', + url: '/api/frontend/v1/Ort/ContentID', + params: { ort_kurzbz: ort_kurbz } + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/phrasen.js b/public/js/api/factory/phrasen.js new file mode 100644 index 000000000..a87e4f4be --- /dev/null +++ b/public/js/api/factory/phrasen.js @@ -0,0 +1,45 @@ +/** + * 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 . + */ + +export default { + loadCategory(category) { + return { + method: 'get', + url: '/api/frontend/v1/phrasen/loadModule/' + category + }; + }, + setLanguage(categories,language) { + const params = {categories, language} + return { + method: 'post', + url: '/api/frontend/v1/phrasen/setLanguage', + params + }; + }, + getLanguage() { + return { + method: 'get', + url: '/api/frontend/v1/phrasen/getLanguage' + }; + }, + getActiveDbLanguages() { + return { + method: 'get', + url: '/api/frontend/v1/phrasen/getAllLanguages' + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/profil.js b/public/js/api/factory/profil.js new file mode 100644 index 000000000..5da1f202d --- /dev/null +++ b/public/js/api/factory/profil.js @@ -0,0 +1,73 @@ +/** + * 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 . + */ + +export default { + getView(uid) { + return { + method: 'get', + url: `/api/frontend/v1/Profil/getView/${uid}` + }; + }, + fotoSperre(value) { + return { + method: 'get', + url: `/api/frontend/v1/Profil/fotoSperre/${value}` + }; + + }, + isStudent(uid) { + // TODO(chris): seems to be called from nowhere? + return { + method: 'get', + url: '/api/frontend/v1/Profil/isStudent', + params: { uid } + }; + }, + isMitarbeiter(uid) { + return { + method: 'get', + url: `/api/frontend/v1/Profil/isMitarbeiter/${uid}` + }; + }, + getZustellAdresse() { + // TODO(chris): seems to be called from nowhere? + return { + method: 'get', + url: '/api/frontend/v1/Profil/getZustellAdresse' + }; + }, + getZustellKontakt() { + // TODO(chris): seems to be called from nowhere? + return { + method: 'get', + url: '/api/frontend/v1/Profil/getZustellKontakt' + }; + }, + getGemeinden(nation, zip) { + return { + method: 'get', + url: `/api/frontend/v1/Profil/getGemeinden/${nation}/${zip}` + }; + + }, + getAllNationen() { + return { + method: 'get', + url: '/api/frontend/v1/Profil/getAllNationen' + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/profilUpdate.js b/public/js/api/factory/profilUpdate.js new file mode 100644 index 000000000..42e87ae0e --- /dev/null +++ b/public/js/api/factory/profilUpdate.js @@ -0,0 +1,110 @@ +/** + * 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 . + */ + +export default { + //! API calls for profil update requests + getStatus() { + return { + method: 'get', + url: '/api/frontend/v1/ProfilUpdate/getStatus' + }; + }, + getTopic() { + return { + method: 'get', + url: '/api/frontend/v1/ProfilUpdate/getTopic' + }; + }, + acceptProfilRequest({profil_update_id, uid, status_message, topic, requested_change}) { + return { + method: 'post', + url: '/api/frontend/v1/ProfilUpdate/acceptProfilRequest', + params: { + profil_update_id, + uid, + status_message, + topic, + requested_change + } + }; + }, + denyProfilRequest({profil_update_id, uid, topic, status_message}) { + return { + method: 'post', + url: '/api/frontend/v1/ProfilUpdate/denyProfilRequest', + params: { + profil_update_id, + uid, + topic, + status_message + } + }; + }, + insertFile(dms, replace = null) { + return { + method: 'post', + url: `/api/frontend/v1/ProfilUpdate/insertFile/${replace}`, + params: dms + }; + }, + getProfilRequestFiles(requestID) { + return { + method: 'get', + url: `/api/frontend/v1/ProfilUpdate/getProfilRequestFiles/${requestID}` + }; + }, + selectProfilRequest(uid = null, id = null) { + return { + method: 'get', + url: '/api/frontend/v1/ProfilUpdate/selectProfilRequest', + params: { + ...(uid ? { uid } : {}), + ...(id ? { id } : {}) + } + }; + }, + insertProfilRequest(topic, payload, fileID = null) { + return { + method: 'post', + url: '/api/frontend/v1/ProfilUpdate/insertProfilRequest', + params: { + topic, + payload, + ...(fileID ? { fileID } : {}) + } + }; + }, + updateProfilRequest(topic, payload, ID, fileID = null) { + return { + method: 'post', + url: '/api/frontend/v1/ProfilUpdate/updateProfilRequest', + params: { + topic, + payload, + ID, + ...(fileID ? { fileID } : {}) + } + }; + }, + deleteProfilRequest(requestID) { + return { + method: 'post', + url: '/api/frontend/v1/ProfilUpdate/deleteProfilRequest', + params: { requestID } + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/searchbar.js b/public/js/api/factory/searchbar.js new file mode 100644 index 000000000..a7bd73b88 --- /dev/null +++ b/public/js/api/factory/searchbar.js @@ -0,0 +1,26 @@ +/** + * 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 . + */ + +export default { + search(params) { + return { + method: 'post', + url: '/api/frontend/v1/searchbar/search', + params + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/studiengang.js b/public/js/api/factory/studiengang.js new file mode 100644 index 000000000..6d5ae15aa --- /dev/null +++ b/public/js/api/factory/studiengang.js @@ -0,0 +1,32 @@ +/** + * 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 . + */ + +export default { + studiengangInformation() { + return { + method: 'get', + url: '/api/frontend/v1/Studgang/getStudiengangInfo' + }; + }, + getStudiengangByKz(studiengang_kz) { + return { + method: 'get', + url: '/api/frontend/v1/organisation/StudiengangEP/getStudiengangByKz', + params: { studiengang_kz } + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/studstatus.js b/public/js/api/factory/studstatus.js new file mode 100644 index 000000000..459594f8d --- /dev/null +++ b/public/js/api/factory/studstatus.js @@ -0,0 +1,28 @@ +/** + * 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 . + */ + +import abmeldung from "./studstatus/abmeldung.js"; +import unterbrechung from "./studstatus/unterbrechung.js"; +import wiederholung from "./studstatus/wiederholung.js"; +import leitung from "./studstatus/leitung.js"; + +export default { + abmeldung, + unterbrechung, + wiederholung, + leitung +}; \ No newline at end of file diff --git a/public/js/api/factory/studstatus/abmeldung.js b/public/js/api/factory/studstatus/abmeldung.js new file mode 100644 index 000000000..81fe5fda7 --- /dev/null +++ b/public/js/api/factory/studstatus/abmeldung.js @@ -0,0 +1,45 @@ +/** + * 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 . + */ + +export default { + getDetails(antrag_id, prestudent_id) { + const url = '/api/frontend/v1/studstatus/abmeldung/' + + (antrag_id !== undefined ? 'getDetailsForAntrag/' + antrag_id : 'getDetailsForNewAntrag/' + prestudent_id); + return { + method: 'get', + url + }; + }, + create(studiensemester, prestudent_id, grund) { + return { + method: 'post', + url: '/api/frontend/v1/studstatus/abmeldung/createAntrag', + params: { + studiensemester, + prestudent_id, + grund + } + }; + }, + cancel(antrag_id) { + return { + method: 'post', + url: '/api/frontend/v1/studstatus/abmeldung/cancelAntrag', + params: { antrag_id } + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/studstatus/leitung.js b/public/js/api/factory/studstatus/leitung.js new file mode 100644 index 000000000..cc6b87d25 --- /dev/null +++ b/public/js/api/factory/studstatus/leitung.js @@ -0,0 +1,100 @@ +/** + * 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 . + */ + +export default { + getStgs() { + return { + method: 'get', + url: '/api/frontend/v1/studstatus/leitung/getActiveStgs' + }; + }, + getAntraege(url, config, params) { + return { + method: 'get', + url: '/api/frontend/v1/studstatus/leitung/getAntraege/' + url + }; + }, + getHistory(antrag_id) { + return { + method: 'get', + url: '/api/frontend/v1/studstatus/leitung/getHistory/' + antrag_id + }; + }, + getPrestudents(query, signal) { + return { + method: 'post', + url: '/api/frontend/v1/studstatus/leitung/getPrestudents', + params: { query } + }; + }, + approve(antrag) { + return { + method: 'post', + url: '/api/frontend/v1/studstatus/leitung/approveAntrag', + params: antrag + }; + }, + reject(antrag) { + return { + method: 'post', + url: '/api/frontend/v1/studstatus/leitung/rejectAntrag', + params: antrag + }; + }, + reopen(antrag) { + return { + method: 'post', + url: '/api/frontend/v1/studstatus/leitung/reopenAntrag', + params: antrag + }; + }, + pause(antrag) { + return { + method: 'post', + url: '/api/frontend/v1/studstatus/leitung/pauseAntrag', + params: antrag + }; + }, + unpause(antrag) { + return { + method: 'post', + url: '/api/frontend/v1/studstatus/leitung/unpauseAntrag', + params: antrag + }; + }, + object(antrag) { + return { + method: 'post', + url: '/api/frontend/v1/studstatus/leitung/objectAntrag', + params: antrag + }; + }, + approveObjection(antrag) { + return { + method: 'post', + url: '/api/frontend/v1/studstatus/leitung/approveObjection', + params: antrag + }; + }, + denyObjection(antrag) { + return { + method: 'post', + url: '/api/frontend/v1/studstatus/leitung/denyObjection', + params: antrag + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/studstatus/unterbrechung.js b/public/js/api/factory/studstatus/unterbrechung.js new file mode 100644 index 000000000..bf772bf42 --- /dev/null +++ b/public/js/api/factory/studstatus/unterbrechung.js @@ -0,0 +1,49 @@ +/** + * 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 . + */ + +export default { + getDetails(antrag_id, prestudent_id) { + const url = '/api/frontend/v1/studstatus/unterbrechung/' + + (antrag_id !== undefined ? 'getDetailsForAntrag/' + antrag_id : 'getDetailsForNewAntrag/' + prestudent_id); + return { + method: 'get', + url + }; + }, + create(studiensemester, prestudent_id, grund, datum_wiedereinstieg, attachment) { + return { + method: 'post', + url: '/api/frontend/v1/studstatus/unterbrechung/createAntrag', + params: { + studiensemester, + prestudent_id, + grund, + datum_wiedereinstieg, + attachment + } + }; + }, + cancel(antrag_id) { + return { + method: 'post', + url: '/api/frontend/v1/studstatus/unterbrechung/cancelAntrag', + params: { + antrag_id + } + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/studstatus/wiederholung.js b/public/js/api/factory/studstatus/wiederholung.js new file mode 100644 index 000000000..3591bb6ed --- /dev/null +++ b/public/js/api/factory/studstatus/wiederholung.js @@ -0,0 +1,63 @@ +/** + * 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 . + */ + +export default { + getDetails(prestudent_id) { + const url = '/api/frontend/v1/studstatus/wiederholung/getDetailsForNewAntrag/' + prestudent_id; + return { + method: 'get', + url + }; + }, + getLvs(antrag_id) { + const url = '/api/frontend/v1/studstatus/wiederholung/getLvs/' + antrag_id; + return { + method: 'get', + url + }; + }, + create(prestudent_id, studiensemester) { + return { + method: 'post', + url: '/api/frontend/v1/studstatus/wiederholung/createAntrag', + params: { + prestudent_id, + studiensemester + } + }; + }, + cancel(prestudent_id, studiensemester) { + return { + method: 'post', + url: '/api/frontend/v1/studstatus/wiederholung/cancelAntrag', + params: { + prestudent_id, + studiensemester + } + }; + }, + saveLvs(forbiddenLvs, mandatoryLvs) { + return { + method: 'post', + url: '/api/frontend/v1/studstatus/wiederholung/saveLvs', + params: { + forbiddenLvs, + mandatoryLvs + } + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/stundenplan.js b/public/js/api/factory/stundenplan.js new file mode 100644 index 000000000..3cfa3c641 --- /dev/null +++ b/public/js/api/factory/stundenplan.js @@ -0,0 +1,66 @@ +/** + * 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 . + */ + +export default { + getRoomInfo(ort_kurzbz, start_date, end_date) { + return { + method: 'get', + url: '/api/frontend/v1/Stundenplan/getRoomplan', + params: { ort_kurzbz, start_date, end_date } + }; + }, + getStundenplan(start_date, end_date, lv_id) { + return { + method: 'get', + url: '/api/frontend/v1/Stundenplan/getStundenplan', + params: { start_date, end_date, lv_id } + }; + }, + getStunden() { + // TODO(chris): seems to be called from nowhere? + return { + method: 'get', + url: '/api/frontend/v1/Stundenplan/Stunden' + }; + }, + getOrtReservierungen(ort_kurzbz, start_date, end_date) { + return { + method: 'get', + url: `/api/frontend/v1/Stundenplan/Reservierungen/${ort_kurzbz}`, + params: { start_date, end_date } + }; + }, + getStundenplanReservierungen(start_date, end_date) { + return { + method: 'get', + url: '/api/frontend/v1/Stundenplan/Reservierungen', + params: { start_date, end_date } + }; + }, + getLehreinheitStudiensemester(lehreinheit_id) { + return { + method: 'get', + url: `/api/frontend/v1/Stundenplan/getLehreinheitStudiensemester/${lehreinheit_id}` + }; + }, + studiensemesterDateInterval(date) { + return { + method: 'get', + url: `/api/frontend/v1/Stundenplan/studiensemesterDateInterval/${date}` + }; + }, +}; \ No newline at end of file diff --git a/public/js/api/factory/stv.js b/public/js/api/factory/stv.js new file mode 100644 index 000000000..7ea387263 --- /dev/null +++ b/public/js/api/factory/stv.js @@ -0,0 +1,48 @@ +/** + * 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 . + */ + +import app from './stv/app.js'; +import lists from './stv/lists.js'; +import verband from './stv/verband.js'; +import students from './stv/students.js'; +import filter from './stv/filter.js'; +import konto from './stv/konto.js'; +import kontakt from './stv/kontakt.js'; +import prestudent from './stv/prestudent.js'; +import status from './stv/status.js'; +import details from './stv/details.js'; +import exam from './stv/exam.js'; +import abschlusspruefung from './stv/abschlusspruefung.js'; +import grades from './stv/grades.js'; +import mobility from './stv/mobility.js'; + +export default { + app, + lists, + verband, + students, + filter, + konto, + kontakt, + prestudent, + status, + details, + exam, + abschlusspruefung, + grades, + mobility +}; \ No newline at end of file diff --git a/public/js/api/factory/stv/abschlusspruefung.js b/public/js/api/factory/stv/abschlusspruefung.js new file mode 100644 index 000000000..37e442b19 --- /dev/null +++ b/public/js/api/factory/stv/abschlusspruefung.js @@ -0,0 +1,111 @@ +/** + * 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 . + */ + +export default { + getAbschlusspruefung(uid) { + return { + method: 'get', + url: 'api/frontend/v1/stv/abschlusspruefung/getAbschlusspruefung/' + uid + }; + }, + addNewAbschlusspruefung(params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/abschlusspruefung/insertAbschlusspruefung/', + params + }; + }, + loadAbschlusspruefung(id) { + return { + method: 'post', + url: 'api/frontend/v1/stv/abschlusspruefung/loadAbschlusspruefung/', + params: { id } + }; + }, + updateAbschlusspruefung(params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/abschlusspruefung/updateAbschlusspruefung/', + params + }; + }, + deleteAbschlusspruefung(id) { + return { + method: 'post', + url: 'api/frontend/v1/stv/abschlusspruefung/deleteAbschlusspruefung/', + params: { id } + }; + }, + getTypenAbschlusspruefung() { + return { + method: 'get', + url: 'api/frontend/v1/stv/abschlusspruefung/getTypenAbschlusspruefung/' + }; + }, + getTypenAntritte() { + return { + method: 'get', + url: 'api/frontend/v1/stv/abschlusspruefung/getTypenAntritte/' + }; + }, + getBeurteilungen() { + return { + method: 'get', + url: 'api/frontend/v1/stv/abschlusspruefung/getBeurteilungen/' + }; + }, + getAkadGrade(studiengang_kz) { + return { + method: 'post', + url: 'api/frontend/v1/stv/abschlusspruefung/getAkadGrade/', + params: { studiengang_kz } + }; + }, + getTypStudiengang(studiengang_kz) { + // TODO(chris): seems to be called from nowhere? + return { + method: 'post', + url: 'api/frontend/v1/stv/abschlusspruefung/getTypStudiengang/', + params: { studiengang_kz } + }; + }, + getMitarbeiter(searchString) { + return { + method: 'get', + url: 'api/frontend/v1/stv/abschlusspruefung/getMitarbeiter/' + searchString + }; + }, + getPruefer(searchString) { + return { + method: 'get', + url: 'api/frontend/v1/stv/abschlusspruefung/getPruefer/' + searchString + }; + }, + getNoten() { + return { + method: 'get', + url: 'api/frontend/v1/stv/abschlusspruefung/getNoten/' + }; + }, + checkForExistingExams(uids) { + return { + method: 'post', + url: 'api/frontend/v1/stv/abschlusspruefung/checkForExistingExams/', + params: { uid } + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/stv/app.js b/public/js/api/factory/stv/app.js new file mode 100644 index 000000000..6fcf46700 --- /dev/null +++ b/public/js/api/factory/stv/app.js @@ -0,0 +1,31 @@ +/** + * 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 . + */ + +export default { + configStudent() { + return { + method: 'get', + url: 'api/frontend/v1/stv/config/student' + }; + }, + configStudents() { + return { + method: 'get', + url: 'api/frontend/v1/stv/config/students' + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/stv/details.js b/public/js/api/factory/stv/details.js new file mode 100644 index 000000000..282b0003e --- /dev/null +++ b/public/js/api/factory/stv/details.js @@ -0,0 +1,32 @@ +/** + * 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 . + */ + +export default { + get(prestudent_id) { + return { + method: 'post', + url: 'api/frontend/v1/stv/student/get/' + prestudent_id + }; + }, + save(prestudent_id, params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/student/save/' + prestudent_id, + params + }; + }, +}; \ No newline at end of file diff --git a/public/js/api/factory/stv/exam.js b/public/js/api/factory/stv/exam.js new file mode 100644 index 000000000..0a03cf8f5 --- /dev/null +++ b/public/js/api/factory/stv/exam.js @@ -0,0 +1,101 @@ +/** + * 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 . + */ + +export default { + getPruefungen(uid) { + return { + method: 'get', + url: 'api/frontend/v1/stv/pruefung/getPruefungen/' + uid + }; + }, + loadPruefung(pruefung_id) { + return { + method: 'get', + url: 'api/frontend/v1/stv/pruefung/loadPruefung/' + pruefung_id + }; + }, + getTypenPruefungen() { + return { + method: 'get', + url: 'api/frontend/v1/stv/pruefung/getTypenPruefungen' + }; + }, + getAllLehreinheiten(params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/pruefung/getAllLehreinheiten/', + params + }; + }, + getLvsByStudent(uid) { + return { + method: 'get', + url: 'api/frontend/v1/stv/pruefung/getLvsByStudent/' + uid + }; + }, + getLvsandLesByStudent(uid, semester) { + return { + method: 'get', + url: 'api/frontend/v1/stv/pruefung/getLvsandLesByStudent/' + uid + '/' + semester + }; + }, + getLvsAndMas(uid) { + return { + method: 'get', + url: 'api/frontend/v1/stv/pruefung/getLvsAndMas/' + uid + }; + }, + getMitarbeiterLv(id) { + return { + method: 'get', + url: 'api/frontend/v1/stv/pruefung/getMitarbeiterLv/' + id + }; + }, + getNoten() { + return { + method: 'get', + url: 'api/frontend/v1/stv/pruefung/getNoten' + }; + }, + checkZeugnisnoteLv(params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/pruefung/checkZeugnisnoteLv/', + params + }; + }, + addPruefung(params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/pruefung/insertPruefung/', + params + }; + }, + updatePruefung(id, params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/pruefung/updatePruefung/' + id, + params + }; + }, + deletePruefung(id) { + return { + method: 'post', + url: 'api/frontend/v1/stv/pruefung/deletePruefung/' + id + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/stv/filter.js b/public/js/api/factory/stv/filter.js new file mode 100644 index 000000000..b81121702 --- /dev/null +++ b/public/js/api/factory/stv/filter.js @@ -0,0 +1,32 @@ +/** + * 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 . + */ + +export default { + getStg() { + return { + method: 'get', + url: 'api/frontend/v1/stv/filter/getStg' + }; + }, + setStg(studiengang_kz) { + return { + method: 'post', + url: 'api/frontend/v1/stv/filter/setStg', + params: { studiengang_kz } + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/stv/grades.js b/public/js/api/factory/stv/grades.js new file mode 100644 index 000000000..ea0d025eb --- /dev/null +++ b/public/js/api/factory/stv/grades.js @@ -0,0 +1,96 @@ +/** + * 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 . + */ + +export default { + list() { + return { + method: 'get', + url: 'api/frontend/v1/stv/grades/list' + }; + }, + getCertificate(prestudent_id, all) { + all = all ? '/all' : ''; + return { + method: 'get', + url: 'api/frontend/v1/stv/grades/getCertificate/' + prestudent_id + all + }; + }, + getTeacherProposal(prestudent_id, all) { + all = all ? '/all' : ''; + return { + method: 'get', + url: 'api/frontend/v1/stv/grades/getTeacherProposal/' + prestudent_id + all + }; + }, + getRepeaterGrades(prestudent_id, all) { + all = all ? '/all' : ''; + return { + method: 'get', + url: 'api/frontend/v1/stv/grades/getRepeaterGrades/' + prestudent_id + all + }; + }, + updateCertificate({lehrveranstaltung_id, student_uid, studiensemester_kurzbz, note, lehrveranstaltung_bezeichnung}) { + return { + method: 'post', + url: 'api/frontend/v1/stv/grades/updateCertificate', + params: { + lehrveranstaltung_id, + student_uid, + studiensemester_kurzbz, + note + } + }; + }, + deleteCertificate({lehrveranstaltung_id, student_uid, studiensemester_kurzbz, lehrveranstaltung_bezeichnung}) { + return { + method: 'post', + url: 'api/frontend/v1/stv/grades/deleteCertificate', + params: { + lehrveranstaltung_id, + student_uid, + studiensemester_kurzbz + } + }; + }, + copyTeacherProposalToCertificate({lehrveranstaltung_id, student_uid, studiensemester_kurzbz, lehrveranstaltung_bezeichnung}) { + return { + method: 'post', + url: 'api/frontend/v1/stv/grades/copyTeacherProposalToCertificate', + params: { + lehrveranstaltung_id, + student_uid, + studiensemester_kurzbz + } + }; + }, + copyRepeaterGradeToCertificate({studierendenantrag_lehrveranstaltung_id, lv_bezeichnung}) { + return { + method: 'post', + url: 'api/frontend/v1/stv/grades/copyRepeaterGradeToCertificate', + params: { + studierendenantrag_lehrveranstaltung_id + } + }; + }, + getGradeFromPoints(points, lehrveranstaltung_id) { + return { + method: 'post', + url: 'api/frontend/v1/stv/grades/getGradeFromPoints', + params: { points, lehrveranstaltung_id } + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/stv/kontakt.js b/public/js/api/factory/stv/kontakt.js new file mode 100644 index 000000000..ef77f6d6b --- /dev/null +++ b/public/js/api/factory/stv/kontakt.js @@ -0,0 +1,28 @@ +/** + * 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 . + */ + +import address from './kontakt/address.js'; +import bankaccount from './kontakt/bankaccount.js'; +import contact from './kontakt/contact.js'; +import company from './kontakt/company.js'; + +export default { + address, + bankaccount, + contact, + company +}; \ No newline at end of file diff --git a/public/js/api/factory/stv/kontakt/address.js b/public/js/api/factory/stv/kontakt/address.js new file mode 100644 index 000000000..78027835f --- /dev/null +++ b/public/js/api/factory/stv/kontakt/address.js @@ -0,0 +1,71 @@ +/** + * 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 . + */ + +export default { + get(uid) { + return { + method: 'get', + url: 'api/frontend/v1/stv/kontakt/getAdressen/' + uid + }; + }, + add(uid, params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/kontakt/addNewAddress/' + uid, + params + }; + }, + load(address_id){ + return { + method: 'post', + url: 'api/frontend/v1/stv/kontakt/loadAddress/', + params: { address_id } + }; + }, + update(address_id, params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/kontakt/updateAddress/' + address_id, + params + }; + }, + delete(address_id) { + return { + method: 'post', + url: 'api/frontend/v1/stv/kontakt/deleteAddress/', + params: { address_id } + }; + }, + getTypes() { + return { + method: 'get', + url: 'api/frontend/v1/stv/kontakt/getAdressentypen/' + }; + }, + getPlaces(plz) { + return { + method: 'get', + url: 'api/frontend/v1/stv/address/getPlaces/' + plz + }; + }, + getNations() { + return { + method: 'get', + url: 'api/frontend/v1/stv/address/getNations/' + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/stv/kontakt/bankaccount.js b/public/js/api/factory/stv/kontakt/bankaccount.js new file mode 100644 index 000000000..7af230878 --- /dev/null +++ b/public/js/api/factory/stv/kontakt/bankaccount.js @@ -0,0 +1,53 @@ +/** + * 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 . + */ + +export default { + get(uid) { + return { + method: 'get', + url: 'api/frontend/v1/stv/kontakt/getBankverbindung/' + uid + }; + }, + add(uid, params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/kontakt/addNewBankverbindung/' + uid, + params + }; + }, + load(bankverbindung_id) { + return { + method: 'post', + url: 'api/frontend/v1/stv/kontakt/loadBankverbindung/', + params: { bankverbindung_id } + }; + }, + update(bankverbindung_id, params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/kontakt/updateBankverbindung/' + bankverbindung_id, + params + }; + }, + delete(bankverbindung_id) { + return { + method: 'post', + url: 'api/frontend/v1/stv/kontakt/deleteBankverbindung/', + params: { bankverbindung_id } + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/stv/kontakt/company.js b/public/js/api/factory/stv/kontakt/company.js new file mode 100644 index 000000000..e97a3de1e --- /dev/null +++ b/public/js/api/factory/stv/kontakt/company.js @@ -0,0 +1,25 @@ +/** + * 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 . + */ + +export default { + get(searchString) { + return { + method: 'get', + url: 'api/frontend/v1/stv/kontakt/getFirmen/' + searchString + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/stv/kontakt/contact.js b/public/js/api/factory/stv/kontakt/contact.js new file mode 100644 index 000000000..7193a65c9 --- /dev/null +++ b/public/js/api/factory/stv/kontakt/contact.js @@ -0,0 +1,65 @@ +/** + * 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 . + */ + +export default { + get(uid) { + return { + method: 'get', + url: 'api/frontend/v1/stv/kontakt/getKontakte/' + uid + }; + }, + add(uid, params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/kontakt/addNewContact/' + uid, + params + }; + }, + load(kontakt_id) { + return { + method: 'post', + url: 'api/frontend/v1/stv/kontakt/loadContact/', + params: { kontakt_id } + }; + }, + update(kontakt_id, params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/kontakt/updateContact/' + kontakt_id, + params + }; + }, + delete(kontakt_id) { + return { + method: 'post', + url: 'api/frontend/v1/stv/kontakt/deleteContact/', + params: { kontakt_id } + }; + }, + getTypes() { + return { + method: 'get', + url: 'api/frontend/v1/stv/kontakt/getKontakttypen/' + }; + }, + getStandorteByFirma(searchString) { + return { + method: 'get', + url: 'api/frontend/v1/stv/kontakt/getStandorteByFirma/' + searchString + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/stv/konto.js b/public/js/api/factory/stv/konto.js new file mode 100644 index 000000000..6c17d460d --- /dev/null +++ b/public/js/api/factory/stv/konto.js @@ -0,0 +1,74 @@ +/** + * 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 . + */ + +export default { + get(person_id, only_open, studiengang_kz) { + return { + method: 'post', + url: 'api/frontend/v1/stv/konto/get', + params: { + person_id, + only_open, + studiengang_kz + } + }; + }, + checkDoubles(params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/konto/checkDoubles', + params, + config: { + confirmErrorHandler: error => true + } + }; + }, + insert(params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/konto/insert', + params + }; + }, + counter(params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/konto/counter', + params + }; + }, + edit(params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/konto/update', + params + }; + }, + delete(buchungsnr) { + return { + method: 'post', + url: 'api/frontend/v1/stv/konto/delete', + params: { buchungsnr } + }; + }, + getBuchungstypen() { + return { + method: 'get', + url: 'api/frontend/v1/stv/konto/getBuchungstypen' + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/stv/lists.js b/public/js/api/factory/stv/lists.js new file mode 100644 index 000000000..4e7904d00 --- /dev/null +++ b/public/js/api/factory/stv/lists.js @@ -0,0 +1,55 @@ +/** + * 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 . + */ + +export default { + getSprachen() { + return { + method: 'get', + url: 'api/frontend/v1/stv/lists/getSprachen' + }; + }, + getGeschlechter() { + return { + method: 'get', + url: 'api/frontend/v1/stv/lists/getGeschlechter' + }; + }, + getAusbildungen() { + return { + method: 'get', + url: 'api/frontend/v1/stv/lists/getAusbildungen' + }; + }, + getStgs() { + return { + method: 'get', + url: 'api/frontend/v1/stv/lists/getStgs' + }; + }, + getOrgforms() { + return { + method: 'get', + url: 'api/frontend/v1/stv/lists/getOrgforms' + }; + }, + getStudiensemester() { + return { + method: 'get', + url: 'api/frontend/v1/stv/lists/getStudiensemester' + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/stv/mobility.js b/public/js/api/factory/stv/mobility.js new file mode 100644 index 000000000..262dbcf55 --- /dev/null +++ b/public/js/api/factory/stv/mobility.js @@ -0,0 +1,128 @@ +/** + * 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 . + */ + +export default { + getMobilitaeten(uid) { + return { + method: 'get', + url: 'api/frontend/v1/stv/mobility/getMobilitaeten/' + uid + }; + }, + getProgramsMobility() { + return { + method: 'get', + url: 'api/frontend/v1/stv/mobility/getProgramsMobility/' + }; + }, + addNewMobility(params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/mobility/insertMobility/', + params + }; + }, + loadMobility(bisio_id) { + return { + method: 'get', + url: 'api/frontend/v1/stv/mobility/loadMobility/' + bisio_id + }; + }, + updateMobility(params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/mobility/updateMobility/', + params + }; + }, + deleteMobility(bisio_id) { + return { + method: 'post', + url: 'api/frontend/v1/stv/mobility/deleteMobility/' + bisio_id + }; + }, + getLVList(studiengang_kz) { + return { + method: 'get', + url: 'api/frontend/v1/stv/mobility/getLVList/' + studiengang_kz + }; + }, + getAllLehreinheiten(params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/mobility/getAllLehreinheiten/', + params + }; + }, + getLvsandLesByStudent(uid) { + return { + method: 'get', + url: 'api/frontend/v1/stv/mobility/getLvsandLesByStudent/' + uid + }; + }, + getPurposes(bisio_id) { + return { + method: 'get', + url: 'api/frontend/v1/stv/mobility/getPurposes/' + bisio_id + }; + }, + getSupports(bisio_id) { + return { + method: 'get', + url: 'api/frontend/v1/stv/mobility/getSupports/' + bisio_id + }; + }, + getListPurposes() { + return { + method: 'get', + url: 'api/frontend/v1/stv/mobility/getListPurposes/' + }; + }, + getListSupports() { + return { + method: 'get', + url: 'api/frontend/v1/stv/mobility/getListSupports/' + }; + }, + deleteMobilityPurpose(params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/mobility/deleteMobilityPurpose/' + params.bisio_id, + params + }; + }, + addMobilityPurpose(params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/mobility/addMobilityPurpose/' + params.bisio_id, + params + }; + }, + deleteMobilitySupport(params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/mobility/deleteMobilitySupport/' + params.bisio_id, + params + }; + }, + addMobilitySupport(params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/mobility/addMobilitySupport/' + params.bisio_id, + params + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/stv/prestudent.js b/public/js/api/factory/stv/prestudent.js new file mode 100644 index 000000000..a49dd1d7a --- /dev/null +++ b/public/js/api/factory/stv/prestudent.js @@ -0,0 +1,150 @@ +/** + * 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 . + */ + +export default { + //------------- Prestudent.js------------------------------------------------------ + get(prestudent_id) { + return { + method: 'post', + url: 'api/frontend/v1/stv/prestudent/get/' + prestudent_id + }; + }, + updatePrestudent(prestudent_id, params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/prestudent/updatePrestudent/' + prestudent_id, + params + }; + }, + getBezeichnungZGV() { + return { + method: 'get', + url: 'api/frontend/v1/stv/prestudent/getBezeichnungZGV/' + }; + }, + getBezeichnungMZgv() { + return { + method: 'get', + url: 'api/frontend/v1/stv/prestudent/getBezeichnungMZgv/' + }; + }, + getBezeichnungDZgv() { + return { + method: 'get', + url: 'api/frontend/v1/stv/prestudent/getBezeichnungDZgv/' + }; + }, + getStgs() { + return { + method: 'get', + url: 'api/frontend/v1/stv/lists/getStgs/' + }; + }, + getAusbildung() { + return { + method: 'get', + url: 'api/frontend/v1/stv/prestudent/getAusbildung/' + }; + }, + getAufmerksamdurch() { + return { + method: 'get', + url: 'api/frontend/v1/stv/prestudent/getAufmerksamdurch/' + }; + }, + getBerufstaetigkeit() { + return { + method: 'get', + url: 'api/frontend/v1/stv/prestudent/getBerufstaetigkeit/' + }; + }, + getTypenStg() { + return { + method: 'get', + url: 'api/frontend/v1/stv/prestudent/getTypenStg/' + }; + }, + getBisstandort() { + return { + method: 'get', + url: 'api/frontend/v1/stv/prestudent/getBisstandort/' + }; + }, + //------------- MultiStatus.js------------------------------------------------------ + getHistoryPrestudent(prestudent_id) { + return { + method: 'get', + url: 'api/frontend/v1/stv/status/getHistoryPrestudent/' + prestudent_id + }; + }, + getMaxSem(studiengang_kzs) { + return { + method: 'post', + url: 'api/frontend/v1/stv/status/getMaxSemester/', + params: { studiengang_kzs } + }; + }, + advanceStatus({prestudent_id, status_kurzbz, studiensemester_kurzbz, ausbildungssemester}) { + return { + method: 'post', + url: 'api/frontend/v1/stv/status/advanceStatus/' + + prestudent_id + '/' + + status_kurzbz + '/' + + studiensemester_kurzbz + '/' + + ausbildungssemester + }; + }, + confirmStatus({prestudent_id, status_kurzbz, studiensemester_kurzbz, ausbildungssemester}) { + return { + method: 'post', + url: 'api/frontend/v1/stv/status/confirmStatus/' + + prestudent_id + '/' + + status_kurzbz + '/' + + studiensemester_kurzbz + '/' + + ausbildungssemester + }; + }, + isLastStatus(id) { + return { + method: 'get', + url: 'api/frontend/v1/stv/status/isLastStatus/' + id + }; + }, + deleteStatus({prestudent_id, status_kurzbz, studiensemester_kurzbz, ausbildungssemester}) { + return { + method: 'post', + url: 'api/frontend/v1/stv/status/deleteStatus/' + + prestudent_id + '/' + + status_kurzbz + '/' + + studiensemester_kurzbz + '/' + + ausbildungssemester + }; + }, + getLastBismeldestichtag() { + return { + method: 'get', + url: 'api/frontend/v1/stv/status/getLastBismeldestichtag/' + }; + }, + //------------- History.js------------------------------------------------------ + getHistoryPrestudents(person_id) { + return { + method: 'get', + url: 'api/frontend/v1/stv/prestudent/getHistoryPrestudents/' + person_id + }; + }, +}; \ No newline at end of file diff --git a/public/js/api/factory/stv/status.js b/public/js/api/factory/stv/status.js new file mode 100644 index 000000000..11e7f4fde --- /dev/null +++ b/public/js/api/factory/stv/status.js @@ -0,0 +1,98 @@ +/** + * 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 . + */ + +export default { + //------------- Modal.js------------------------------------------------------ + insertStatus(id, params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/status/insertStatus/' + id, + params + }; + }, + loadStatus({prestudent_id, status_kurzbz, studiensemester_kurzbz, ausbildungssemester}) { + return { + method: 'post', + url: 'api/frontend/v1/stv/status/loadStatus/' + + prestudent_id + '/' + + status_kurzbz + '/' + + studiensemester_kurzbz + '/' + + ausbildungssemester + }; + }, + updateStatus({ + prestudent_id, + status_kurzbz, + studiensemester_kurzbz, + ausbildungssemester + }, params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/status/updateStatus/' + + prestudent_id + '/' + + status_kurzbz + '/' + + studiensemester_kurzbz + '/' + + ausbildungssemester, + params + }; + }, + getStudienplaene(prestudent_id) { + return { + method: 'get', + url: 'api/frontend/v1/stv/prestudent/getStudienplaene/' + prestudent_id + }; + }, + getStudiengang(prestudent_id) { + return { + method: 'get', + url: 'api/frontend/v1/stv/prestudent/getStudiengang/' + prestudent_id + }; + }, + getStatusgruende() { + return { + method: 'get', + url: 'api/frontend/v1/stv/status/getStatusgruende/' + }; + }, + getStati() { + return { + method: 'get', + url: 'api/frontend/v1/stv/lists/getStati/' + }; + }, + //------------- Dropdown.js------------------------------------------------------ + addStudent(id, params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/status/addStudent/' + id, + params + }; + }, + changeStatus(id, params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/status/changeStatus/' + id, + params + }; + }, + getStatusarray() { + return { + method: 'get', + url: 'api/frontend/v1/stv/status/getStatusarray/' + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/stv/students.js b/public/js/api/factory/stv/students.js new file mode 100644 index 000000000..582ba04e8 --- /dev/null +++ b/public/js/api/factory/stv/students.js @@ -0,0 +1,50 @@ +/** + * 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 . + */ + +export default { + uid(uid) { + return { + method: 'get', + url: 'api/frontend/v1/stv/students/uid/' + uid + }; + }, + prestudent(prestudent_id) { + return { + method: 'get', + url: 'api/frontend/v1/stv/students/prestudent/' + prestudent_id + }; + }, + person(person_id) { + return { + method: 'get', + url: 'api/frontend/v1/stv/students/person/' + person_id + }; + }, + verband(relative_path) { + return { + method: 'get', + url: 'api/frontend/v1/stv/students/' + relative_path + }; + }, + check(params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/student/check', + params + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/stv/verband.js b/public/js/api/factory/stv/verband.js new file mode 100644 index 000000000..114931e4c --- /dev/null +++ b/public/js/api/factory/stv/verband.js @@ -0,0 +1,43 @@ +/** + * 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 . + */ + +export default { + get(path) { + let url = 'api/frontend/v1/stv/verband'; + if (path) + url += '/' + path; + return { + method: 'get', + url + }; + }, + favorites: { + get() { + return { + method: 'get', + url: 'api/frontend/v1/stv/favorites' + }; + }, + set(favorites) { + return { + method: 'post', + url: 'api/frontend/v1/stv/favorites/set', + params: { favorites } + }; + } + } +}; \ No newline at end of file diff --git a/public/js/api/factory/widget/ampeln.js b/public/js/api/factory/widget/ampeln.js new file mode 100644 index 000000000..b634766a8 --- /dev/null +++ b/public/js/api/factory/widget/ampeln.js @@ -0,0 +1,37 @@ +/** + * 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 . + */ + +export default { + open() { + return { + method: 'get', + url: '/api/frontend/v1/Ampeln/open' + }; + }, + all() { + return { + method: 'get', + url: '/api/frontend/v1/Ampeln/all' + }; + }, + confirm(ampel_id) { + return { + method: 'get', + url: `/api/frontend/v1/Ampeln/confirm/${ampel_id}` + }; + } +}; \ No newline at end of file diff --git a/public/js/api/factory/widget/bookmark.js b/public/js/api/factory/widget/bookmark.js new file mode 100644 index 000000000..9768e25ac --- /dev/null +++ b/public/js/api/factory/widget/bookmark.js @@ -0,0 +1,45 @@ +/** + * 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 . + */ + +export default { + getBookmarks() { + return { + method: 'get', + url: '/api/frontend/v1/Bookmark/getBookmarks' + }; + }, + delete(bookmark_id) { + return { + method: 'get', + url: `/api/frontend/v1/Bookmark/delete/${bookmark_id}` + }; + }, + update({ bookmark_id, url, title, tag=null }) { + return { + method: 'post', + url: `/api/frontend/v1/Bookmark/update/${bookmark_id}`, + params: { url, title } + }; + }, + insert({ url, title, tag }) { + return { + method: 'post', + url: `/api/frontend/v1/Bookmark/insert`, + params: { url, title, tag } + }; + } +}; \ No newline at end of file diff --git a/public/js/api/udf.js b/public/js/api/udf.js new file mode 100644 index 000000000..77d1e92cb --- /dev/null +++ b/public/js/api/udf.js @@ -0,0 +1,26 @@ +/** + * 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 . + */ + +export default { + load({ ciModel, pk }) { + return { + method: 'post', + url: '/api/frontend/v1/udf/load/' + ciModel, + params: pk + }; + } +}; \ No newline at end of file diff --git a/public/js/apps/Bismeldestichtag/Bismeldestichtag.js b/public/js/apps/Bismeldestichtag/Bismeldestichtag.js index 877805b8f..d6e5a4a27 100644 --- a/public/js/apps/Bismeldestichtag/Bismeldestichtag.js +++ b/public/js/apps/Bismeldestichtag/Bismeldestichtag.js @@ -23,7 +23,7 @@ import {CoreRESTClient} from '../../RESTClient.js'; import {CoreFetchCmpt} from '../../components/Fetch.js'; import {BismeldestichtagAPIs} from './API.js'; -import Phrasen from '../../plugin/Phrasen.js'; +import PluginsPhrasen from '../../plugins/Phrasen.js'; const bismeldestichtagApp = Vue.createApp({ data: function() { @@ -237,4 +237,4 @@ const bismeldestichtagApp = Vue.createApp({ } }); -bismeldestichtagApp.use(Phrasen).mount('#main'); +bismeldestichtagApp.use(PluginsPhrasen).mount('#main'); diff --git a/public/js/apps/Cis.js b/public/js/apps/Cis.js index 482c2774a..b62592ebd 100644 --- a/public/js/apps/Cis.js +++ b/public/js/apps/Cis.js @@ -1,9 +1,7 @@ import FhcSearchbar from "../components/searchbar/searchbar.js"; import CisMenu from "../components/Cis/Menu.js"; -import FhcApi from '../plugin/FhcApi.js'; -import Phrasen from '../plugin/Phrasen.js'; -import fhcapifactory from "./api/fhcapifactory.js"; -Vue.$fhcapi = fhcapifactory; +import PluginsPhrasen from '../plugins/Phrasen.js'; +import ApiSearchbar from '../api/factory/searchbar.js'; const app = Vue.createApp({ name: 'CisApp', @@ -113,16 +111,15 @@ const app = Vue.createApp({ }, methods: { searchfunction: function(searchsettings) { - return Vue.$fhcapi.search.search(searchsettings); + return this.$api.call(ApiSearchbar.search(searchsettings)); } } }); -app.use(FhcApi); app.use(primevue.config.default, { zIndex: { overlay: 9000, tooltip: 8000 } }) -app.use(Phrasen); +app.use(PluginsPhrasen); app.mount('#cis-header'); diff --git a/public/js/apps/Cis/Documents.js b/public/js/apps/Cis/Documents.js index bcb01b6e8..de03769b4 100644 --- a/public/js/apps/Cis/Documents.js +++ b/public/js/apps/Cis/Documents.js @@ -1,4 +1,4 @@ -import Phrasen from '../../plugin/Phrasen.js'; +import PluginsPhrasen from '../../plugins/Phrasen.js'; import {setScrollbarWidth} from "../../helpers/CssVarCalcHelpers.js"; const app = Vue.createApp({ @@ -89,5 +89,5 @@ const app = Vue.createApp({ setScrollbarWidth(); -app.use(Phrasen); +app.use(PluginsPhrasen); app.mount('#content'); diff --git a/public/js/apps/Cis/ProfilUpdateRequests.js b/public/js/apps/Cis/ProfilUpdateRequests.js index 05ce939e4..fc874cf0a 100644 --- a/public/js/apps/Cis/ProfilUpdateRequests.js +++ b/public/js/apps/Cis/ProfilUpdateRequests.js @@ -1,6 +1,7 @@ import ProfilUpdateView from "../../components/Cis/ProfilUpdate/ProfilUpdateView.js"; -import Phrasen from "../../plugin/Phrasen.js"; +import PluginsPhrasen from "../../plugins/Phrasen.js"; +import ApiProfilUpdate from '../../api/factory/ProfilUpdate.js'; // TODO: sobald in verwendung den vue router pfad zu ProfilUpdateView definieren und diese app in component auslagern const app = Vue.createApp({ @@ -23,7 +24,8 @@ const app = Vue.createApp({ }, methods: {}, created() { - this.$fhcApi.factory.profilUpdate.getStatus() + this.$api + .call(ApiProfilUpdate.getStatus()) .then((response) => { this.profilUpdateStates = response.data; }) @@ -32,4 +34,4 @@ const app = Vue.createApp({ }); }, }); -app.use(Phrasen).mount("#content"); \ No newline at end of file +app.use(PluginsPhrasen).mount("#content"); \ No newline at end of file diff --git a/public/js/apps/Dashboard/Admin.js b/public/js/apps/Dashboard/Admin.js index 0470f82a7..4a5fcee2f 100644 --- a/public/js/apps/Dashboard/Admin.js +++ b/public/js/apps/Dashboard/Admin.js @@ -1,7 +1,6 @@ import {CoreNavigationCmpt} from '../../components/navigation/Navigation.js'; import DashboardAdmin from '../../components/Dashboard/Admin.js'; -import FhcApi from '../../plugin/FhcApi.js'; -import Phrasen from '../../plugin/Phrasen.js'; +import PluginsPhrasen from '../../plugins/Phrasen.js'; const app = Vue.createApp({ name: 'AdminApp', @@ -13,6 +12,5 @@ const app = Vue.createApp({ DashboardAdmin } }); -app.use(FhcApi); -app.use(Phrasen); +app.use(PluginsPhrasen); app.mount('#main'); \ No newline at end of file diff --git a/public/js/apps/Dashboard/Fhc.js b/public/js/apps/Dashboard/Fhc.js index ea8d512df..3b6bb5683 100644 --- a/public/js/apps/Dashboard/Fhc.js +++ b/public/js/apps/Dashboard/Fhc.js @@ -1,6 +1,5 @@ import FhcDashboard from '../../components/Dashboard/Dashboard.js'; -import FhcApi from '../../plugin/FhcApi.js'; -import Phrasen from '../../plugin/Phrasen.js'; +import PluginsPhrasen from '../../plugins/Phrasen.js'; import contrast from '../../directives/contrast.js'; import {setScrollbarWidth} from "../../helpers/CssVarCalcHelpers.js"; import Stundenplan, {DEFAULT_MODE_STUNDENPLAN} from "../../components/Cis/Stundenplan/Stundenplan.js"; @@ -259,13 +258,12 @@ const app = Vue.createApp({ // kind of a bandaid for bad css on some pages to avoid horizontal scroll setScrollbarWidth(); app.use(router); -app.use(FhcApi); app.use(primevue.config.default, { zIndex: { overlay: 9000, tooltip: 8000 } }) -app.use(Phrasen); +app.use(PluginsPhrasen); app.directive('contrast', contrast); app.mount('#fhccontent'); \ No newline at end of file diff --git a/public/js/apps/LogsViewer/LogsViewer.js b/public/js/apps/LogsViewer/LogsViewer.js index 8aefa1d67..eeb4b38a7 100644 --- a/public/js/apps/LogsViewer/LogsViewer.js +++ b/public/js/apps/LogsViewer/LogsViewer.js @@ -21,7 +21,7 @@ import {LogsViewerTabulatorEventHandlers} from './TabulatorSetup.js'; import {CoreFilterCmpt} from '../../components/filter/Filter.js'; import {CoreNavigationCmpt} from '../../components/navigation/Navigation.js'; -import Phrasen from '../../plugin/Phrasen.js'; +import PluginsPhrasen from '../../plugins/Phrasen.js'; const logsViewerApp = Vue.createApp({ data: function() { @@ -42,5 +42,5 @@ const logsViewerApp = Vue.createApp({ } }); -logsViewerApp.use(Phrasen).mount('#main'); +logsViewerApp.use(PluginsPhrasen).mount('#main'); diff --git a/public/js/apps/Studentenverwaltung.js b/public/js/apps/Studentenverwaltung.js index fbbee8e1d..a22f1f187 100644 --- a/public/js/apps/Studentenverwaltung.js +++ b/public/js/apps/Studentenverwaltung.js @@ -18,7 +18,7 @@ import FhcStudentenverwaltung from "../components/Stv/Studentenverwaltung.js"; import fhcapifactory from "./api/fhcapifactory.js"; -import Phrasen from "../plugin/Phrasen.js"; +import PluginsPhrasen from "../plugins/Phrasen.js"; const ciPath = FHC_JS_DATA_STORAGE_OBJECT.app_root.replace(/(https:|)(^|\/\/)(.*?\/)/g, '') + FHC_JS_DATA_STORAGE_OBJECT.ci_router; @@ -43,5 +43,5 @@ app overlay: 1100 } }) - .use(Phrasen) + .use(PluginsPhrasen) .mount('#main'); diff --git a/public/js/apps/lehre/Antrag.js b/public/js/apps/lehre/Antrag.js index bb7de3485..97b4bda97 100644 --- a/public/js/apps/lehre/Antrag.js +++ b/public/js/apps/lehre/Antrag.js @@ -1,7 +1,7 @@ import StudierendenantragAntrag from "../../components/Studierendenantrag/Antrag.js"; import StudierendenantragStatus from "../../components/Studierendenantrag/Status.js"; import StudierendenantragInfoblock from "../../components/Studierendenantrag/Infoblock.js"; -import Phrasen from '../../plugin/Phrasen.js'; +import PluginsPhrasen from '../../plugins/Phrasen.js'; const app = Vue.createApp({ name: 'AntragApp', @@ -21,5 +21,5 @@ const app = Vue.createApp({ } }); app - .use(Phrasen) + .use(PluginsPhrasen) .mount('#wrapper'); \ No newline at end of file diff --git a/public/js/apps/lehre/Antrag/Leitung.js b/public/js/apps/lehre/Antrag/Leitung.js index 22c3fa3f5..8fd8b117e 100644 --- a/public/js/apps/lehre/Antrag/Leitung.js +++ b/public/js/apps/lehre/Antrag/Leitung.js @@ -1,5 +1,5 @@ import StudierendenantragLeitung from '../../../components/Studierendenantrag/Leitung.js'; -import Phrasen from '../../../plugin/Phrasen.js'; +import PluginsPhrasen from '../../../plugins/Phrasen.js'; const app = Vue.createApp({ name: 'LeitungApp', @@ -8,6 +8,6 @@ const app = Vue.createApp({ } }); app - .use(Phrasen) + .use(PluginsPhrasen) .use(primevue.config.default,{zIndex: {overlay: 9999}}) .mount('#wrapper'); \ No newline at end of file diff --git a/public/js/apps/lehre/Antrag/Lvzuweisung.js b/public/js/apps/lehre/Antrag/Lvzuweisung.js index ecad05fa5..7504e7dcf 100644 --- a/public/js/apps/lehre/Antrag/Lvzuweisung.js +++ b/public/js/apps/lehre/Antrag/Lvzuweisung.js @@ -1,5 +1,5 @@ import LvZuweisung from '../../../components/Studierendenantrag/Lvzuweisung.js'; -import Phrasen from '../../../plugin/Phrasen.js'; +import PluginsPhrasen from '../../../plugins/Phrasen.js'; const app = Vue.createApp({ name: 'LvzuweisungApp', @@ -13,5 +13,5 @@ const app = Vue.createApp({ } }); app - .use(Phrasen) + .use(PluginsPhrasen) .mount('#wrapper'); \ No newline at end of file diff --git a/public/js/apps/lehre/Antrag/Student.js b/public/js/apps/lehre/Antrag/Student.js index 1848daea4..46150c541 100644 --- a/public/js/apps/lehre/Antrag/Student.js +++ b/public/js/apps/lehre/Antrag/Student.js @@ -1,5 +1,5 @@ import LvPopup from '../../../components/Studierendenantrag/Leitung/LvPopup.js'; -import Phrasen from '../../../plugin/Phrasen.js'; +import PluginsPhrasen from '../../../plugins/Phrasen.js'; const app = Vue.createApp({ name: 'StudentApp', @@ -8,5 +8,5 @@ const app = Vue.createApp({ } }); app - .use(Phrasen) + .use(PluginsPhrasen) .mount('#wrapper'); \ No newline at end of file diff --git a/public/js/apps/lehre/lvplanung/LvTemplates.js b/public/js/apps/lehre/lvplanung/LvTemplates.js index 5bb8694a0..655d611ce 100644 --- a/public/js/apps/lehre/lvplanung/LvTemplates.js +++ b/public/js/apps/lehre/lvplanung/LvTemplates.js @@ -17,9 +17,7 @@ import LvTemplateUebersicht from '../../../lehre/lvplanung/LvTemplateUebersicht.js'; import {CoreNavigationCmpt} from '../../../components/navigation/Navigation.js'; -import FhcAlert from '../../../plugin/FhcAlert.js'; -import FhcApi from "../../../plugin/FhcApi.js"; -import Phrasen from "../../../plugin/Phrasen.js"; +import PluginsPhrasen from "../../../plugins/Phrasen.js"; const lvTemplatesApp = Vue.createApp({ @@ -32,7 +30,5 @@ const lvTemplatesApp = Vue.createApp({ lvTemplatesApp .use(primevue.config.default,{zIndex: {overlay: 9999}}) - .use(FhcAlert) - .use(FhcApi) - .use(Phrasen) + .use(PluginsPhrasen) .mount('#main') \ No newline at end of file diff --git a/public/js/components/Betriebsmittel/Betriebsmittel.js b/public/js/components/Betriebsmittel/Betriebsmittel.js index d1c07db33..39681ffb4 100644 --- a/public/js/components/Betriebsmittel/Betriebsmittel.js +++ b/public/js/components/Betriebsmittel/Betriebsmittel.js @@ -35,13 +35,9 @@ export default { return { tabulatorOptions: { ajaxURL: 'dummy', - ajaxRequestFunc: this.endpoint.getAllBetriebsmittel, - ajaxParams: () => { - return { - type: this.typeId, - id: this.id - }; - }, + ajaxRequestFunc: () => this.$api.call( + this.endpoint.getAllBetriebsmittel(this.typeId, this.id) + ), ajaxResponse: (url, params, response) => response.data, columns: [ {title: "Nummer", field: "nummer", width: 150}, @@ -221,7 +217,9 @@ export default { .then(result => result ? betriebsmittelperson_id : Promise.reject({handled: true})) - .then(this.endpoint.deleteBetriebsmittel) + .then(betriebsmittelperson_id => this.$api.call( + this.endpoint.deleteBetriebsmittel(betriebsmittelperson_id)) + ) .then(result => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete')); window.scrollTo(0, 0); @@ -234,8 +232,8 @@ export default { this.formData.uid = this.uid; if (this.formData.betriebsmitteltyp == 'Inventar') this.formData.betriebsmittel_id = this.formData.inventarData?.betriebsmittel_id; - return this.endpoint - .addNewBetriebsmittel(this.$refs.betriebsmittelData, this.id, this.formData) + return this.$refs.betriebsmittelData + .call(this.endpoint.addNewBetriebsmittel(this.id, this.formData)) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); this.$refs.betriebsmittelModal.hide(); @@ -248,8 +246,11 @@ export default { updateBetriebsmittel(betriebsmittelperson_id) { if (this.formData.betriebsmitteltyp == 'Inventar') this.formData.betriebsmittel_id = this.formData.inventarData?.betriebsmittel_id; - return this.endpoint - .updateBetriebsmittel(this.$refs.betriebsmittelData, betriebsmittelperson_id, this.formData) + return this.$refs.betriebsmittelData + .call(this.endpoint.updateBetriebsmittel( + betriebsmittelperson_id, + this.formData + )) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); this.$refs.betriebsmittelModal.hide(); @@ -262,8 +263,8 @@ export default { loadBetriebsmittel(betriebsmittelperson_id) { this.resetModal(); this.statusNew = false; - return this.endpoint - .loadBetriebsmittel(betriebsmittelperson_id) + return this.$api + .call(this.endpoint.loadBetriebsmittel(betriebsmittelperson_id)) .then(result => { this.formData = result.data; }) @@ -271,8 +272,8 @@ export default { }, searchInventar(event) { const encodedQuery = encodeURIComponent(event.query); - return this.endpoint - .loadInventarliste(encodedQuery) + return this.$api + .call(this.endpoint.loadInventarliste(encodedQuery)) .then(result => { this.filteredInventar = result.data; }); @@ -294,8 +295,8 @@ export default { } }, created() { - return this.endpoint - .getTypenBetriebsmittel() + return this.$api + .call(this.endpoint.getTypenBetriebsmittel()) .then(result => { this.listBetriebsmitteltyp = result.data; }) diff --git a/public/js/components/Calendar/Day/Page.js b/public/js/components/Calendar/Day/Page.js index a57fb97af..f8d05f7de 100644 --- a/public/js/components/Calendar/Day/Page.js +++ b/public/js/components/Calendar/Day/Page.js @@ -1,6 +1,9 @@ import CalendarDate from '../../../composables/CalendarDate.js'; import LvModal from "../../../components/Cis/Mylv/LvModal.js"; +import ApiStundenplan from '../../../api/factory/stundenplan.js'; +import ApiAddons from '../../../api/factory/addons.js'; + function ggt(m, n) { return n == 0 ? m : ggt(n, m % n); } @@ -245,17 +248,20 @@ export default { }, fetchLvMenu(event) { if (event && event.type == 'lehreinheit') { - this.$fhcApi.factory.stundenplan.getLehreinheitStudiensemester(event.lehreinheit_id[0]).then( - res => res.data - ).then( - studiensemester_kurzbz => { - this.$fhcApi.factory.addons.getLvMenu(event.lehrveranstaltung_id, studiensemester_kurzbz).then(res => { - if (res.data) { - this.lvMenu = res.data; - } - }); - } - ) + this.$api + .call(ApiStundenplan.getLehreinheitStudiensemester(event.lehreinheit_id[0])) + .then(res => res.data) + .then(studiensemester_kurzbz => this.$api.call( + ApiAddons.getLvMenu( + event.lehreinheit_id, + studiensemester_kurzbz + ) + )) + .then(res => { + if (res.data) { + this.lvMenu = res.data; + } + }); } }, hourGridIdentifier(hour) { diff --git a/public/js/components/Cis/Cms/Content.js b/public/js/components/Cis/Cms/Content.js index d657322ba..f99d299f6 100644 --- a/public/js/components/Cis/Cms/Content.js +++ b/public/js/components/Cis/Cms/Content.js @@ -2,6 +2,8 @@ import raum_contentmittitel from './Content_types/Raum_contentmittitel.js' import general from './Content_types/General.js' import BsConfirm from "../../Bootstrap/Confirm.js"; +import ApiCms from '../../../api/factory/cms.js'; + export default { name: "ContentComponent", props: { @@ -30,33 +32,35 @@ export default { }, methods: { fetchContent(){ - return this.$fhcApi.factory.cms.content(this.content_id_internal, this.version, this.sprache, this.sichtbar).then(res => { - this.content = res.data.content; - this.content_type = res.data.type; - - document.querySelectorAll("#cms [data-confirm]").forEach((el) => { - el.addEventListener("click", (evt) => { - evt.preventDefault(); - BsConfirm.popup(el.dataset.confirm) - .then(() => { - Axios.get(el.href) - .then((res) => { - // TODO(chris): check for success then show message and/or reload - location = location; - }) - .catch((err) => console.error("ERROR:", err)); - }) - .catch(() => { - }); + return this.$api + .call(ApiCms.content(this.content_id_internal, this.version, this.sprache, this.sichtbar)) + .then(res => { + this.content = res.data.content; + this.content_type = res.data.type; + + document.querySelectorAll("#cms [data-confirm]").forEach((el) => { + el.addEventListener("click", (evt) => { + evt.preventDefault(); + BsConfirm.popup(el.dataset.confirm) + .then(() => { + Axios.get(el.href) + .then((res) => { + // TODO(chris): check for success then show message and/or reload + location = location; + }) + .catch((err) => console.error("ERROR:", err)); + }) + .catch(() => { + }); + }); + }); + document.querySelectorAll("#cms [data-href]").forEach((el) => { + el.href = el.dataset.href.replace( + /^ROOT\//, + FHC_JS_DATA_STORAGE_OBJECT.app_root + ); }); }); - document.querySelectorAll("#cms [data-href]").forEach((el) => { - el.href = el.dataset.href.replace( - /^ROOT\//, - FHC_JS_DATA_STORAGE_OBJECT.app_root - ); - }); - }); } }, watch:{ diff --git a/public/js/components/Cis/Cms/ContentModal.js b/public/js/components/Cis/Cms/ContentModal.js index b7533305f..40cd32fb9 100644 --- a/public/js/components/Cis/Cms/ContentModal.js +++ b/public/js/components/Cis/Cms/ContentModal.js @@ -1,6 +1,7 @@ import BsModal from "../../Bootstrap/Modal.js"; import RaumContent from "./Content_types/Raum_contentmittitel.js"; +import ApiCms from '../../../api/factory/cms.js'; export default { @@ -34,12 +35,13 @@ export default { // this method is always called when the modal is shown modalShown: function(){ - if(this.content_id){ - this.$fhcApi.factory.cms.content(this.content_id).then(res =>{ - this.content = res.data.content; - this.type = res.data.type; - - }) + if (this.content_id) { + this.$api + .call(ApiCms.content(this.content_id)) + .then(res => { + this.content = res.data.content; + this.type = res.data.type; + }); } }, }, diff --git a/public/js/components/Cis/Cms/News.js b/public/js/components/Cis/Cms/News.js index 1567cbef4..d9c00bc67 100644 --- a/public/js/components/Cis/Cms/News.js +++ b/public/js/components/Cis/Cms/News.js @@ -2,6 +2,8 @@ import Pagination from "../../Pagination/Pagination.js"; import StudiengangInformation from "./StudiengangInformation/StudiengangInformation.js"; import BsConfirm from "../../Bootstrap/Confirm.js"; +import ApiCms from '../../../api/factory/cms.js'; + export default { name: "NewsComponent", components: { @@ -27,53 +29,55 @@ export default { }, }, methods: { - fetchNews: function(){ - return this.$fhcApi.factory.cms.getNews(this.page, this.page_size, this.sprache) - .then(res => res.data) - .then(result => { - this.content = result; + fetchNews() { + return this.$api + .call(ApiCms.getNews(this.page, this.page_size, this.sprache)) + .then(res => res.data) + .then(result => { + this.content = result; - document.querySelectorAll("#cms [data-confirm]").forEach((el) => { - el.addEventListener("click", (evt) => { - evt.preventDefault(); - BsConfirm.popup(el.dataset.confirm) - .then(() => { - Axios.get(el.href) - .then((res) => { - // TODO(chris): check for success then show message and/or reload - location = location; + document.querySelectorAll("#cms [data-confirm]").forEach((el) => { + el.addEventListener("click", (evt) => { + evt.preventDefault(); + BsConfirm.popup(el.dataset.confirm) + .then(() => { + Axios.get(el.href) + .then((res) => { + // TODO(chris): check for success then show message and/or reload + location = location; + }) + .catch((err) => console.error("ERROR:", err)); }) - .catch((err) => console.error("ERROR:", err)); - }) - .catch(() => { + .catch(() => { + }); }); + }); + document.querySelectorAll("#cms [data-href]").forEach((el) => { + el.href = el.dataset.href.replace( + /^ROOT\//, + FHC_JS_DATA_STORAGE_OBJECT.app_root + ); + }); }); - }); - document.querySelectorAll("#cms [data-href]").forEach((el) => { - el.href = el.dataset.href.replace( - /^ROOT\//, - FHC_JS_DATA_STORAGE_OBJECT.app_root - ); - }); - }); - }, - loadNewPageContent: function (data) { - this.$fhcApi.factory.cms.getNews(data.page, data.rows) - .then(res => res.data) - .then(result => { - this.content = result; - }); - - }, + }, + loadNewPageContent(data) { + this.$api + .call(ApiCms.getNews(data.page, data.rows)) + .then(res => res.data) + .then(result => { + this.content = result; + }); + } }, created() { this.fetchNews(); - this.$fhcApi.factory.cms.getNewsRowCount() - .then(res => res.data) - .then(result => { - this.maxPageCount = result; - }); + this.$api + .call(ApiCms.getNewsRowCount()) + .then(res => res.data) + .then(result => { + this.maxPageCount = result; + }); }, template: /*html*/ `

News

diff --git a/public/js/components/Cis/Cms/StudiengangInformation/StudiengangInformation.js b/public/js/components/Cis/Cms/StudiengangInformation/StudiengangInformation.js index f12c58e2e..01ac2cd83 100644 --- a/public/js/components/Cis/Cms/StudiengangInformation/StudiengangInformation.js +++ b/public/js/components/Cis/Cms/StudiengangInformation/StudiengangInformation.js @@ -1,6 +1,8 @@ import StudiengangPerson from "./StudiengangPerson.js"; import StudiengangVertretung from "./StudiengangVertretung.js"; +import ApiStudiengang from '../../../../api/factory/studiengang.js'; + export default { data(){ return{ @@ -108,13 +110,12 @@ computed:{ return `https://moodle.technikum-wien.at/course/view.php?idnumber=dl` + this.studiengang.studiengang_kz; }, }, -mounted(){ - this.$fhcApi.factory.studiengang.studiengangInformation() - .then(res => res.data) - .then(studiengangInformationen => { - Object.assign(this, studiengangInformationen); - }); - -}, - + mounted() { + this.$api + .call(ApiStudiengang.studiengangInformation()) + .then(res => res.data) + .then(studiengangInformationen => { + Object.assign(this, studiengangInformationen); + }); + } }; \ No newline at end of file diff --git a/public/js/components/Cis/Menu.js b/public/js/components/Cis/Menu.js index ebab00109..cada49636 100644 --- a/public/js/components/Cis/Menu.js +++ b/public/js/components/Cis/Menu.js @@ -1,6 +1,8 @@ import CisMenuEntry from "./Menu/Entry.js"; import FhcSearchbar from "../searchbar/searchbar.js"; -import CisSprachen from "./Sprachen.js" +import CisSprachen from "./Sprachen.js"; + +import ApiCisMenu from '../../api/factory/cis/menu.js'; export default { components: { @@ -50,12 +52,13 @@ export default { } }, methods: { - fetchMenu: function(){ - return this.$fhcApi.factory.menu.getMenu() - .then(res => res.data) - .then(menu => { - this.entries = menu; - }) + fetchMenu() { + return this.$api + .call(ApiCisMenu.getMenu()) + .then(res => res.data) + .then(menu => { + this.entries = menu; + }); }, checkSettingsVisibility: function (event) { // hides the settings collapsible if the user clicks somewhere else diff --git a/public/js/components/Cis/Mylv/LvModal.js b/public/js/components/Cis/Mylv/LvModal.js index 9c42e312f..6c85e4157 100644 --- a/public/js/components/Cis/Mylv/LvModal.js +++ b/public/js/components/Cis/Mylv/LvModal.js @@ -3,6 +3,9 @@ import Alert from "../../Bootstrap/Alert.js"; import LvMenu from "./LvMenu.js" import LvInfo from "./LvInfo.js" +import ApiStundenplan from '../../../api/factory/stundenplan.js'; +import ApiAddons from '../../../api/factory/addons.js'; + export default { components: { BsModal, @@ -47,17 +50,20 @@ export default { if(!this.showMenu) return; if (this.event.type == 'lehreinheit') { - this.$fhcApi.factory.stundenplan.getLehreinheitStudiensemester(this.event.lehreinheit_id[0]).then( - res=>res.data - ).then( - studiensemester_kurzbz =>{ - this.$fhcApi.factory.addons.getLvMenu(this.event.lehrveranstaltung_id, studiensemester_kurzbz).then(res => { - if (res.data) { - this.menu = res.data; - } - }); - } - ) + this.$api + .call(ApiStundenplan.getLehreinheitStudiensemester(this.event.lehreinheit_id[0])) + .then(res => res.data) + .then(studiensemester_kurzbz => this.$api.call( + ApiAddons.getLvMenu( + this.event.lehrveranstaltung_id, + studiensemester_kurzbz + ) + )) + .then(res => { + if (res.data) { + this.menu = res.data; + } + }); } }, }, diff --git a/public/js/components/Cis/Mylv/LvUebersicht.js b/public/js/components/Cis/Mylv/LvUebersicht.js index 13972af5e..fddf97d38 100644 --- a/public/js/components/Cis/Mylv/LvUebersicht.js +++ b/public/js/components/Cis/Mylv/LvUebersicht.js @@ -1,5 +1,8 @@ import BsModal from "../../Bootstrap/Modal.js"; import LvMenu from "./LvMenu.js"; + +import ApiAddons from '../../../api/factory/addons.js'; + export default { props:{ @@ -34,13 +37,15 @@ export default { this.isMenuSelected = false; }, showModal: function(){ - if(!this.preselectedMenu){ - this.$fhcApi.factory.addons.getLvMenu(this.event.lehrveranstaltung_id, this.event.studiensemester_kurzbz).then(res =>{ - if(res.data){ - this.menu = res.data; - } - }); - }else{ + if (!this.preselectedMenu) { + this.$api + .call(ApiAddons.getLvMenu(this.event.lehrveranstaltung_id, this.event.studiensemester_kurzbz)) + .then(res => { + if (res.data) { + this.menu = res.data; + } + }); + } else { this.isMenuSelected = true; } }, diff --git a/public/js/components/Cis/Mylv/RoomInformation.js b/public/js/components/Cis/Mylv/RoomInformation.js index 8a7354305..3a1e1146c 100644 --- a/public/js/components/Cis/Mylv/RoomInformation.js +++ b/public/js/components/Cis/Mylv/RoomInformation.js @@ -3,6 +3,8 @@ import CalendarDate from "../../../composables/CalendarDate.js"; import LvModal from "../../../components/Cis/Mylv/LvModal.js"; import LvInfo from "../../../components/Cis/Mylv/LvInfo.js" +import ApiStudenplan from '../../../api/factory/stundenplan.js'; + export const DEFAULT_MODE_RAUMINFO = 'Week' const RoomInformation = { @@ -163,8 +165,8 @@ const RoomInformation = { // bundles the room_events and the reservierungen together into the this.events array Promise.allSettled([ - this.$fhcApi.factory.stundenplan.getRoomInfo(this.propsViewData.ort_kurzbz, this.monthFirstDay, this.monthLastDay), - this.$fhcApi.factory.stundenplan.getOrtReservierungen(this.propsViewData.ort_kurzbz, this.monthFirstDay, this.monthLastDay) + this.$api.call(ApiStudenplan.getRoomInfo(this.propsViewData.ort_kurzbz, this.monthFirstDay, this.monthLastDay)), + this.$api.call(ApiStudenplan.getOrtReservierungen(this.propsViewData.ort_kurzbz, this.monthFirstDay, this.monthLastDay)) ]).then((result) => { let promise_events = []; result.forEach((promise_result) => { diff --git a/public/js/components/Cis/Mylv/Semester/Studiengang/Lv.js b/public/js/components/Cis/Mylv/Semester/Studiengang/Lv.js index ea19652c6..e699900ff 100644 --- a/public/js/components/Cis/Mylv/Semester/Studiengang/Lv.js +++ b/public/js/components/Cis/Mylv/Semester/Studiengang/Lv.js @@ -3,6 +3,9 @@ import LvInfo from "./Lv/Info.js"; import Phrasen from "../../../../../mixins/Phrasen.js"; import LvUebersicht from "../../LvUebersicht.js"; +import ApiLehre from '../../../../../api/factory/lehre.js'; +import ApiAddons from '../../../../../api/factory/addons.js'; + // TODO(chris): L10n export default { @@ -75,8 +78,9 @@ export default { }, methods: { - fetchMenu(lehrveranstaltung_id = this.lehrveranstaltung_id, studien_semester = this.studien_semester){ - return this.$fhcApi.factory.addons.getLvMenu(lehrveranstaltung_id, studien_semester) + fetchMenu(lehrveranstaltung_id = this.lehrveranstaltung_id, studien_semester = this.studien_semester) { + return this.$api + .call(ApiAddons.getLvMenu(lehrveranstaltung_id, studien_semester)) .then(res => { this.menu = res.data; }) @@ -139,13 +143,13 @@ export default { this.fetchMenu(this.lehrveranstaltung_id, newValue); } }, - created(){ - this.$fhcApi.factory.lehre.getStudentPruefungen(this.lehrveranstaltung_id) - .then(res => res.data) - .then(pruefungen =>{ - this.pruefungenData = pruefungen; - }); - + created() { + this.$api + .call(ApiLehre.getStudentPruefungen(this.lehrveranstaltung_id)) + .then(res => res.data) + .then(pruefungen => { + this.pruefungenData = pruefungen; + }); }, mounted() { this.fetchMenu(this.lehrveranstaltung_id, this.studien_semester); diff --git a/public/js/components/Cis/Mylv/Semester/Studiengang/Lv/Info.js b/public/js/components/Cis/Mylv/Semester/Studiengang/Lv/Info.js index 2c0f7f044..28afbd1ce 100644 --- a/public/js/components/Cis/Mylv/Semester/Studiengang/Lv/Info.js +++ b/public/js/components/Cis/Mylv/Semester/Studiengang/Lv/Info.js @@ -1,4 +1,4 @@ - +import ApiLehre from '../../../../../../api/factory/lehre.js'; const infos = {}; @@ -57,7 +57,7 @@ export default { } }, created() { - this.$fhcApi.factory.lehre.getLvInfo(this.studien_semester, this.lehrveranstaltung_id) + this.$api.call(ApiLehre.getLvInfo(this.studien_semester, this.lehrveranstaltung_id)) .then( res => res.data ).then(data =>{ diff --git a/public/js/components/Cis/Profil/MitarbeiterProfil.js b/public/js/components/Cis/Profil/MitarbeiterProfil.js index a31594755..07a6339e4 100644 --- a/public/js/components/Cis/Profil/MitarbeiterProfil.js +++ b/public/js/components/Cis/Profil/MitarbeiterProfil.js @@ -10,6 +10,8 @@ import ProfilEmails from "./ProfilComponents/ProfilEmails.js"; import RoleInformation from "./ProfilComponents/RoleInformation.js"; import ProfilInformation from "./ProfilComponents/ProfilInformation.js"; +import ApiProfilUpdate from '../../../api/factory/profilUpdate.js'; + export default { components: { CoreFilterCmpt, @@ -162,7 +164,8 @@ export default { hideEditProfilModal: function () { //? checks the editModal component property result, if the user made a successful request or not if (this.$refs.editModal.result) { - this.$fhcApi.factory.profilUpdate.selectProfilRequest() + this.$api + .call(ApiProfilUpdate.selectProfilRequest()) .then((request) => { if (!request.error && request) { this.data.profilUpdates = request.data; @@ -195,13 +198,15 @@ export default { }, fetchProfilUpdates: function () { - this.$fhcApi.factory.profilUpdate.selectProfilRequest().then((res) => { - if (!res.error && res) { - this.data.profilUpdates = res.data?.length - ? res.data.sort(this.sortProfilUpdates) - : null; - } - }); + this.$api + .call(ApiProfilUpdate.selectProfilRequest()) + .then((res) => { + if (!res.error && res) { + this.data.profilUpdates = res.data?.length + ? res.data.sort(this.sortProfilUpdates) + : null; + } + }); }, setTableColumnTitles() { // reevaluates computed phrasen if(this.$refs.betriebsmittelTable) this.$refs.betriebsmittelTable.tabulator.setColumns(this.betriebsmittel_table_options.columns) diff --git a/public/js/components/Cis/Profil/Profil.js b/public/js/components/Cis/Profil/Profil.js index 73dd8b132..edb55e6b3 100644 --- a/public/js/components/Cis/Profil/Profil.js +++ b/public/js/components/Cis/Profil/Profil.js @@ -4,6 +4,9 @@ import ViewStudentProfil from "./StudentViewProfil.js"; import ViewMitarbeiterProfil from "./MitarbeiterViewProfil.js"; import Loading from "../../Loader.js"; +import ApiProfil from '../../../api/factory/profil.js'; +import ApiProfilUpdate from '../../../api/factory/profilUpdate.js'; + Vue.$collapseFormatter = function (data) { //data - an array of objects containing the column title and value for each cell var container = document.createElement("div"); @@ -132,7 +135,8 @@ export const Profil = { methods: { async load() { // fetch profilUpdateStates to provide them to children components - await this.$fhcApi.factory.profilUpdate.getStatus() + await this.$api + .call(ApiProfilUpdate.getStatus()) .then((response) => { this.profilUpdateStates = response.data; }) @@ -140,7 +144,8 @@ export const Profil = { console.error(error); }); - this.$fhcApi.factory.profilUpdate.getTopic() + this.$api + .call(ApiProfilUpdate.getTopic()) .then((response) => { this.profilUpdateTopic = response.data; }) @@ -150,14 +155,16 @@ export const Profil = { let uid = this.uid ?? location.pathname.split("/").pop(); - this.$fhcApi.factory.profil.getView(uid).then((res) => { - if (!res.data) { - this.notFoundUID = uid; - } else { - this.view = res.data?.view; - this.data = res.data?.data; - } - }); + this.$api + .call(ApiProfil.getView(uid)) + .then((res) => { + if (!res.data) { + this.notFoundUID = uid; + } else { + this.view = res.data?.view; + this.data = res.data?.data; + } + }); }, zustellAdressenCount() { if (!this.data || !this.data.adressen) { diff --git a/public/js/components/Cis/Profil/ProfilComponents/FetchProfilUpdates.js b/public/js/components/Cis/Profil/ProfilComponents/FetchProfilUpdates.js index 4c7411cdf..d5e85b944 100644 --- a/public/js/components/Cis/Profil/ProfilComponents/FetchProfilUpdates.js +++ b/public/js/components/Cis/Profil/ProfilComponents/FetchProfilUpdates.js @@ -1,4 +1,8 @@ import EditProfil from "../ProfilModal/EditProfil.js"; + +import ApiProfil from '../../../../api/factory/profil.js'; +import ApiProfilUpdate from '../../../../api/factory/profilUpdate.js'; + //? EditProfil is the modal used to edit the profil updates export default { components: {EditProfil}, @@ -52,11 +56,13 @@ export default { }; const filesFromDatabase = - await this.$fhcApi.factory.profilUpdate.getProfilRequestFiles( - updateRequest.profil_update_id - ).then((res) => { - return res.data; - }); + await this.$api + .call(ApiProfilUpdate.getProfilRequestFiles( + updateRequest.profil_update_id + )) + .then((res) => { + return res.data; + }); files = filesFromDatabase; if (files) { @@ -77,7 +83,7 @@ export default { if (view === "EditAdresse") { - const isMitarbeiter = await this.$fhcApi.factory.profil.isMitarbeiter(updateRequest.uid).then((res) => res.data); + const isMitarbeiter = await this.$api.call(ApiProfil.isMitarbeiter(updateRequest.uid)).then((res) => res.data); if (isMitarbeiter) { content["isMitarbeiter"] = isMitarbeiter; @@ -106,16 +112,16 @@ export default { }, deleteRequest: function (item) { - this.$fhcApi.factory.profilUpdate.deleteProfilRequest(item.profil_update_id).then( - (res) => { + this.$api + .call(ApiProfil.deleteProfilRequest(item.profil_update_id)) + .then((res) => { if (res.data.error) { //? open alert console.error("error happened", res.data); } else { this.$emit("fetchUpdates"); } - } - ); + }); }, getView: function (topic, status) { diff --git a/public/js/components/Cis/Profil/ProfilComponents/ProfilInformation.js b/public/js/components/Cis/Profil/ProfilComponents/ProfilInformation.js index e42229576..e39b4d57d 100644 --- a/public/js/components/Cis/Profil/ProfilComponents/ProfilInformation.js +++ b/public/js/components/Cis/Profil/ProfilComponents/ProfilInformation.js @@ -1,3 +1,5 @@ +import ApiProfil from '../../../../api/factory/profil.js'; + export default { props: { title: { @@ -24,10 +26,12 @@ export default { if (!this.data) { return; } - this.$fhcApi.factory.profil.fotoSperre(!this.FotoSperre).then(res => { - this.FotoSperre = res.data.foto_sperre; - }) - }, + this.$api + .call(ApiProfil.fotoSperre(!this.FotoSperre)) + .then(res => { + this.FotoSperre = res.data.foto_sperre; + }); + } }, computed: { get_image_base64_src: function () { diff --git a/public/js/components/Cis/Profil/ProfilModal/EditProfil.js b/public/js/components/Cis/Profil/ProfilModal/EditProfil.js index cbfde34be..26ab7ff1d 100644 --- a/public/js/components/Cis/Profil/ProfilModal/EditProfil.js +++ b/public/js/components/Cis/Profil/ProfilModal/EditProfil.js @@ -3,6 +3,8 @@ import Alert from "../../../Bootstrap/Alert.js"; import EditProfilSelect from "./EditProfilSelect.js"; import Loader from "../../../Loader.js"; +import ApiProfilUpdate from '../../../../api/factory/profilUpdate.js'; + export default { components: { BsModal, @@ -96,12 +98,13 @@ export default { //? if an updateID is present, updateProfilRequest is called, else insertProfilRequest is called this.editData.updateID ? - this.$fhcApi.factory.profilUpdate.updateProfilRequest( - this.topic, - this.profilUpdate, - this.editData.updateID, - this.fileID ? this.fileID[0] : null - ) + this.$api + .call(ApiProfilUpdate.updateProfilRequest( + this.topic, + this.profilUpdate, + this.editData.updateID, + this.fileID ? this.fileID[0] : null + )) .then((res) => { handleApiResponse(res); }) @@ -112,11 +115,12 @@ export default { this.hide(); }) : - this.$fhcApi.factory.profilUpdate.insertProfilRequest( - this.topic, - this.profilUpdate, - this.fileID ? this.fileID[0] : null - ) + this.$api + .call(ApiProfilUpdate.insertProfilRequest( + this.topic, + this.profilUpdate, + this.fileID ? this.fileID[0] : null + )) .then((res) => { handleApiResponse(res); }) @@ -136,16 +140,20 @@ export default { const result = this.editData.updateID ? //? updating old attachment by replacing //* second parameter of api request insertFile checks if the file has to be replaced or not - await this.$fhcApi.factory.profilUpdate.insertFile( - formData, - this.editData.updateID - ).then((res) => { - return res.data?.map((file) => file.dms_id); - }) + await this.$api + .call(ApiProfilUpdate.insertFile( + formData, + this.editData.updateID + )) + .then((res) => { + return res.data?.map((file) => file.dms_id); + }) : //? fresh insert of new attachment - await this.$fhcApi.factory.profilUpdate.insertFile(formData).then((res) => { - return res.data?.map((file) => file.dms_id); - }); + await this.$api + .call(ApiProfilUpdate.insertFile(formData)) + .then((res) => { + return res.data?.map((file) => file.dms_id); + }); return result; } else { //? attachment hasn't been replaced diff --git a/public/js/components/Cis/Profil/ProfilModal/EditProfilComponents/EditAdresse.js b/public/js/components/Cis/Profil/ProfilModal/EditProfilComponents/EditAdresse.js index 2aca5c4ce..8f174dabc 100644 --- a/public/js/components/Cis/Profil/ProfilModal/EditProfilComponents/EditAdresse.js +++ b/public/js/components/Cis/Profil/ProfilModal/EditProfilComponents/EditAdresse.js @@ -1,3 +1,5 @@ +import ApiProfil from '../../../../../api/factory/profil.js'; + export default { components: { AutoComplete: primevue.autocomplete, @@ -52,8 +54,8 @@ export default { this.data.plz > 999 && this.data.plz < 32000 ) { - this.$fhcApi.factory.profil - .getGemeinden(this.data.nation, this.data.plz) + this.$api + .call(ApiProfil.getGemeinden(this.data.nation, this.data.plz)) .then((res) => { if (res.data.length) { this.gemeinden = [ @@ -120,10 +122,12 @@ export default { created() { // get all available nationen - this.$fhcApi.factory.profil.getAllNationen().then((res)=>{ - this.nationenList = res.data; - this.getGemeinde(); - }) + this.$api + .call(ApiProfil.getAllNationen()) + .then(res => { + this.nationenList = res.data; + this.getGemeinde(); + }); this.originalValue = JSON.stringify(this.data); this.zustellAdressenCount = this.getZustelladressenCount(); diff --git a/public/js/components/Cis/Profil/ProfilModal/EditProfilComponents/Status.js b/public/js/components/Cis/Profil/ProfilModal/EditProfilComponents/Status.js index 437bb1fb5..a0492a2da 100644 --- a/public/js/components/Cis/Profil/ProfilModal/EditProfilComponents/Status.js +++ b/public/js/components/Cis/Profil/ProfilModal/EditProfilComponents/Status.js @@ -1,6 +1,8 @@ import Adresse from "../../ProfilComponents/Adresse.js"; import Kontakt from "../../ProfilComponents/Kontakt.js"; +import ApiProfilUpdate from '../../../../../api/factory/profilUpdate.js'; + export default { components: { Adresse, @@ -65,11 +67,11 @@ export default { topic: { type: String }, }, created() { - this.$fhcApi.factory.profilUpdate.getProfilRequestFiles(this.updateID).then( - (res) => { + this.$api + .call(ApiProfilUpdate.getProfilRequestFiles(this.updateID)) + .then((res) => { this.files = res.data; - } - ); + }); }, template: /*html*/ `
diff --git a/public/js/components/Cis/Profil/StudentProfil.js b/public/js/components/Cis/Profil/StudentProfil.js index 364feecd2..635033fda 100644 --- a/public/js/components/Cis/Profil/StudentProfil.js +++ b/public/js/components/Cis/Profil/StudentProfil.js @@ -10,6 +10,8 @@ import ProfilInformation from "./ProfilComponents/ProfilInformation.js"; import FetchProfilUpdates from "./ProfilComponents/FetchProfilUpdates.js"; import EditProfil from "./ProfilModal/EditProfil.js"; +import ApiProfilUpdate from '../../../api/factory/profilUpdate.js'; + export default { components: { CoreFilterCmpt, @@ -114,19 +116,22 @@ export default { ); }, fetchProfilUpdates: function () { - this.$fhcApi.factory.profilUpdate.selectProfilRequest().then((res) => { - if (!res.error && res) { - this.data.profilUpdates = res.data?.length - ? res.data.sort(this.sortProfilUpdates) - : null; - } - }); + this.$api + .call(ApiProfilUpdate.selectProfilRequest()) + .then((res) => { + if (!res.error && res) { + this.data.profilUpdates = res.data?.length + ? res.data.sort(this.sortProfilUpdates) + : null; + } + }); }, hideEditProfilModal: function () { //? checks the editModal component property result, if the user made a successful request or not if (this.$refs.editModal.result) { - this.$fhcApi.factory.profilUpdate.selectProfilRequest() + this.$api + .call(ApiProfilUpdate.selectProfilRequest()) .then((request) => { if (!request.error && res) { this.data.profilUpdates = request.data; diff --git a/public/js/components/Cis/ProfilUpdate/AcceptDenyUpdate.js b/public/js/components/Cis/ProfilUpdate/AcceptDenyUpdate.js index f3746af63..d9495f073 100644 --- a/public/js/components/Cis/ProfilUpdate/AcceptDenyUpdate.js +++ b/public/js/components/Cis/ProfilUpdate/AcceptDenyUpdate.js @@ -3,6 +3,8 @@ import Alert from "../../Bootstrap/Alert.js"; import Kontakt from "../Profil/ProfilComponents/Kontakt.js"; import Adresse from "../Profil/ProfilComponents/Adresse.js"; +import ApiProfilUpdate from '../../../api/factory/profilUpdate.js'; + export default { components: { BsModal, @@ -62,11 +64,12 @@ export default { handleRequest: function (type) { this.loading = true; this.setLoading(true); - this.$fhcApi.factory.profilUpdate[ - type.toLowerCase() == "accept" - ? "acceptProfilRequest" - : "denyProfilRequest" - ](this.data) + this.$api + .call(ApiProfilUpdate[ + type.toLowerCase() == "accept" + ? "acceptProfilRequest" + : "denyProfilRequest" + ](this.data)) .then((res) => { this.result = true; }) @@ -93,11 +96,13 @@ export default { created() { // only fetching the profilUpdate Attachemnts if the profilUpdate actually has attachments if (this.value.attachment_id) { - this.$fhcApi.factory.profilUpdate.getProfilRequestFiles( - this.data.profil_update_id - ).then((res) => { - this.files = res.data; - }); + this.$api + .call(ApiProfilUpdate.getProfilRequestFiles( + this.data.profil_update_id + )) + .then((res) => { + this.files = res.data; + }); } }, mounted() { diff --git a/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js b/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js index c30f1ab89..0f9d64541 100644 --- a/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js +++ b/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js @@ -3,6 +3,8 @@ import AcceptDenyUpdate from "./AcceptDenyUpdate.js"; import Alert from "../../../components/Bootstrap/Alert.js"; import Loading from "../../../components/Loader.js"; +import ApiProfilUpdate from '../../../api/factory/profilUpdate.js'; + const sortProfilUpdates = (ele1, ele2, thisPointer) => { let result = 0; if (ele1.status === thisPointer.profilUpdateStates["Pending"]) { @@ -127,7 +129,8 @@ export default { "acceptUpdate" )}`, action: (e, column) => { - this.$fhcApi.factory.profilUpdate.acceptProfilRequest(column.getData()) + this.$api + .call(ApiProfilUpdate.acceptProfilRequest(column.getData())) .then((res) => { this.$refs.UpdatesTable.tabulator.setData(); }) @@ -143,7 +146,8 @@ export default { "denyUpdate" )}`, action: (e, column) => { - this.$fhcApi.factory.profilUpdate.denyProfilRequest(column.getData()) + this.$api + .call(ApiProfilUpdate.denyProfilRequest(column.getData())) .then((res) => { this.$refs.UpdatesTable.tabulator.setData(); }) @@ -296,7 +300,8 @@ export default { }, methods: { denyProfilUpdate: function (data) { - this.$fhcApi.factory.profilUpdate.denyProfilRequest(data) + this.$api + .call(ApiProfilUpdate.denyProfilRequest(data)) .then((res) => { // block when the request was successful }) @@ -306,7 +311,8 @@ export default { }); }, acceptProfilUpdate: function (data) { - this.$fhcApi.factory.profilUpdate.acceptProfilRequest(data) + this.$api + .call(ApiProfilUpdate.acceptProfilRequest(data)) .then((res) => { // block when the request was successful }) diff --git a/public/js/components/Cis/Sprachen.js b/public/js/components/Cis/Sprachen.js index fd53d06db..4e450c136 100644 --- a/public/js/components/Cis/Sprachen.js +++ b/public/js/components/Cis/Sprachen.js @@ -10,7 +10,7 @@ export default { if(this.allActiveLanguages.some(l => l.sprache === lang)) { const isReload = document.querySelector('[cis4Reload]') - this.$p.setLanguage(lang, this.$fhcApi) + this.$p.setLanguage(lang) .then(res => res.data) .then(data => { diff --git a/public/js/components/Cis/Stundenplan/Stundenplan.js b/public/js/components/Cis/Stundenplan/Stundenplan.js index 3fee43058..664e9ec87 100644 --- a/public/js/components/Cis/Stundenplan/Stundenplan.js +++ b/public/js/components/Cis/Stundenplan/Stundenplan.js @@ -4,6 +4,9 @@ import LvModal from "../Mylv/LvModal.js"; import LvInfo from "../Mylv/LvInfo.js" import LvMenu from "../Mylv/LvMenu.js" +import ApiStundenplan from '../../../api/factory/stundenplan.js'; +import ApiAuthinfo from '../../../api/factory/authinfo.js'; + export const DEFAULT_MODE_STUNDENPLAN = 'Week' const Stundenplan = { @@ -101,7 +104,7 @@ const Stundenplan = { }, methods:{ fetchStudiensemesterDetails: async function (date) { - return this.$fhcApi.factory.stundenplan.studiensemesterDateInterval(date); + return this.$api.call(ApiStundenplan.studiensemesterDateInterval(date)); }, convertTime: function([hour,minute]){ let date = new Date(); @@ -199,8 +202,8 @@ const Stundenplan = { }, loadEvents: function(){ Promise.allSettled([ - this.$fhcApi.factory.stundenplan.getStundenplan(this.monthFirstDay, this.monthLastDay, this.propsViewData.lv_id), - this.$fhcApi.factory.stundenplan.getStundenplanReservierungen(this.monthFirstDay, this.monthLastDay) + this.$api.call(ApiStundenplan.getStundenplan(this.monthFirstDay, this.monthLastDay, this.propsViewData.lv_id)), + this.$api.call(ApiStundenplan.getStundenplanReservierungen(this.monthFirstDay, this.monthLastDay)) ]).then((result) => { let promise_events = []; result.forEach((promise_result) => { @@ -232,12 +235,13 @@ const Stundenplan = { }); }, }, - created() - { - this.$fhcApi.factory.authinfo.getAuthUID().then((res) => res.data) - .then(data=>{ - this.uid = data.uid; - }) + created() { + this.$api + .call(ApiAuthinfo.getAuthUID()) + .then(res => res.data) + .then(data => { + this.uid = data.uid; + }); this.loadEvents(); }, beforeUnmount() { diff --git a/public/js/components/Dashboard/Dashboard.js b/public/js/components/Dashboard/Dashboard.js index 74a65ecaa..83c7efed2 100644 --- a/public/js/components/Dashboard/Dashboard.js +++ b/public/js/components/Dashboard/Dashboard.js @@ -2,6 +2,8 @@ import DashboardSection from "./Section.js"; import DashboardWidgetPicker from "./Widget/Picker.js"; import ObjectUtils from "../../helpers/ObjectUtils.js"; +import ApiDashboard from '../../api/factory/cis/dashboard.js'; + export default { components: { DashboardSection, @@ -163,8 +165,8 @@ export default { }).catch(err => console.error('ERROR:', err)); }, async beforeMount() { - if(!this.viewData.name || !this.viewData.uid) { - const res = await this.$fhcApi.factory.dashboard.getViewData() + if (!this.viewData.name || !this.viewData.uid) { + const res = await this.$api.call(ApiDashboard.getViewData()); this.viewDataInternal = res.data } }, diff --git a/public/js/components/DashboardWidget/Ampel.js b/public/js/components/DashboardWidget/Ampel.js index 925942079..a12de7726 100644 --- a/public/js/components/DashboardWidget/Ampel.js +++ b/public/js/components/DashboardWidget/Ampel.js @@ -1,6 +1,8 @@ import AbstractWidget from './Abstract.js'; import BaseOffcanvas from '../Base/Offcanvas.js'; +import ApiAmpeln from '../../api/factory/widget/ampeln.js'; + let _idcounter = 0; export default { @@ -76,16 +78,16 @@ export default { // maybe we also want to reset the source (open/alle) of the displayed ampeln }, fetchNonConfirmedActiveAmpeln() { - this.$fhcApi.factory - .ampeln.open() + this.$api + .call(ApiAmpeln.open()) .then(res => { this.activeAmpeln = res.data; }) .catch(error => this.$fhcAlert.handleSystemError); }, fetchAllActiveAmpeln() { - this.$fhcApi.factory - .ampeln.all() + this.$api + .call(ApiAmpeln.all()) .then(res => { this.allAmpeln = res.data; }) @@ -93,8 +95,8 @@ export default { }, async confirm(ampelId) { - this.$fhcApi.factory - .ampeln.confirm(ampelId) + this.$api + .call(ApiAmpeln.confirm(ampelId)) .then(() => { this.$fhcAlert.alertSuccess(this.$p.t('ampeln', 'ampelBestaetigt')); // update the ampeln by refetching them diff --git a/public/js/components/DashboardWidget/News.js b/public/js/components/DashboardWidget/News.js index b7bd2f367..54f28c448 100644 --- a/public/js/components/DashboardWidget/News.js +++ b/public/js/components/DashboardWidget/News.js @@ -1,6 +1,8 @@ import AbstractWidget from './Abstract.js'; import BsModal from '../Bootstrap/Modal.js'; +import ApiCms from '../../api/factory/cms.js'; + const MAX_LOADED_NEWS = 30; export default { @@ -132,8 +134,8 @@ export default { }, created() { this.$emit("setConfig", false); - this.$fhcApi.factory.cms - .news(MAX_LOADED_NEWS) + this.$api + .call(ApiCms.news(MAX_LOADED_NEWS)) .then(res => res.data) .then((news) => { this.allNewsList = Array.from(Object.values(news)); diff --git a/public/js/components/DashboardWidget/Stundenplan.js b/public/js/components/DashboardWidget/Stundenplan.js index 7bb972590..7696c7a3f 100644 --- a/public/js/components/DashboardWidget/Stundenplan.js +++ b/public/js/components/DashboardWidget/Stundenplan.js @@ -5,6 +5,9 @@ import LvModal from '../Cis/Mylv/LvModal.js'; import ContentModal from '../Cis/Cms/ContentModal.js' import CalendarDate from '../../composables/CalendarDate.js'; +import ApiStundenplan from '../../api/factory/stundenplan.js'; +import ApiOrt from '../../api/factory/ort.js'; + export default { mixins: [ Phrasen, @@ -80,20 +83,20 @@ export default { }, showRoomInfoModal: function(ort_kurzbz){ // getting the content_id of the ort_kurzbz - this.$fhcApi.factory.ort.getContentID(ort_kurzbz).then(res =>{ - this.roomInfoContentID = res.data; - this.ort_kurzbz = ort_kurzbz; + this.$api + .call(ApiOrt.getContentID(ort_kurzbz)) + .then(res => { + this.roomInfoContentID = res.data; + this.ort_kurzbz = ort_kurzbz; - // only showing the modal after vue was able to set the reactive data - Vue.nextTick(()=>{this.$refs.contentModal.show();}); - - - }).catch(err =>{ - console.err(err); - this.ort_kurzbz = null; - this.roomInfoContentID = null; - }); - + // only showing the modal after vue was able to set the reactive data + Vue.nextTick(() => { this.$refs.contentModal.show(); }); + }) + .catch(err => { + console.err(err); + this.ort_kurzbz = null; + this.roomInfoContentID = null; + }); }, showLvUebersicht: function (event){ this.selectedEvent= event; @@ -122,8 +125,8 @@ export default { loadEvents: function () { Promise.allSettled([ - this.$fhcApi.factory.stundenplan.getStundenplan(this.monthFirstDay, this.monthLastDay), - this.$fhcApi.factory.stundenplan.getStundenplanReservierungen(this.monthFirstDay, this.monthLastDay) + this.$api.call(ApiStundenplan.getStundenplan(this.monthFirstDay, this.monthLastDay)), + this.$api.call(ApiStundenplan.getStundenplanReservierungen(this.monthFirstDay, this.monthLastDay)) ]).then((result) => { let promise_events = []; result.forEach((promise_result) => { diff --git a/public/js/components/DashboardWidget/Url.js b/public/js/components/DashboardWidget/Url.js index 7f836bf1c..2b1dea81d 100644 --- a/public/js/components/DashboardWidget/Url.js +++ b/public/js/components/DashboardWidget/Url.js @@ -3,6 +3,8 @@ import FormInput from "../Form/Input.js"; import BsModal from "../Bootstrap/Modal.js"; import AbstractWidget from './Abstract.js'; +import ApiBookmark from '../../api/factory/widget/bookmark.js'; + export default { name: "WidgetsUrl", mixins: [AbstractWidget], @@ -62,12 +64,12 @@ export default { event.preventDefault(); if(!this.bookmark_id || !this.url_input || !this.title_input) return; - this.$fhcApi.factory.bookmark - .update({ + this.$api + .call(ApiBookmark.update({ bookmark_id: this.bookmark_id, title: this.title_input, url: this.url_input, - }) + })) .then((res) => res.data) .then((result) => { this.$fhcAlert.alertInfo(this.$p.t("bookmark", "bookmarkUpdated")); @@ -92,12 +94,12 @@ export default { // early return if validation failed if (!this.isValidationSuccessfull()) return; - this.$fhcApi.factory.bookmark - .insert({ + this.$api + .call(ApiBookmark.insert({ tag: this.config.tag, title: this.title_input, url: this.url_input, - }) + })) .then((res) => res.data) .then((result) => { this.$fhcAlert.alertInfo(this.$p.t("bookmark", "bookmarkAdded")); @@ -124,8 +126,8 @@ export default { return !Object.values(this.validation).some(value => value === true); }, async fetchBookmarks() { - await this.$fhcApi.factory.bookmark - .getBookmarks() + await this.$api + .call(ApiBookmark.getBookmarks()) .then((res) => res.data) .then((result) => { this.shared = result; @@ -138,8 +140,8 @@ export default { // early return if the confirm dialog was not confirmed if (!isConfirmed) return; - this.$fhcApi.factory.bookmark - .delete(bookmark_id) + this.$api + .call(ApiBookmark.delete(bookmark_id)) .then((res) => res.data) .then((result) => { this.$fhcAlert.alertInfo(this.$p.t("bookmark", "bookmarkDeleted")); diff --git a/public/js/components/Form/Form.js b/public/js/components/Form/Form.js index f83dc5ed4..3cf340232 100644 --- a/public/js/components/Form/Form.js +++ b/public/js/components/Form/Form.js @@ -42,7 +42,9 @@ export default { return a; }, {}); }, + /* Depricated Code start */ factory() { + console.warn('
.factory is deprecated! Use .call() instead.'); const factory = Object.create(Object.getPrototypeOf(this.$fhcApi.factory), Object.getOwnPropertyDescriptors(this.$fhcApi.factory)); factory.$fhcApi = { get: this.get, @@ -51,6 +53,7 @@ export default { }; return factory; } + /* Depricated Code end */ }, methods: { get(...args) { @@ -59,7 +62,12 @@ export default { else args.unshift(this); - return this.$fhcApi.get(...args); + /* Depricated Code start */ + if (!this.$api) + return this.$fhcApi.get(...args); + /* Depricated Code end */ + + return this.$api.get(...args); }, post(...args) { if (typeof args[0] == 'object' && args[0].clearValidation && args[0].setFeedback) @@ -67,7 +75,15 @@ export default { else args.unshift(this); - return this.$fhcApi.post(...args); + /* Depricated Code start */ + if (!this.$api) + return this.$fhcApi.post(...args); + /* Depricated Code end */ + + return this.$api.post(...args); + }, + call(factory, overwriteconfig) { + return this.$api.call(factory, overwriteconfig, this); }, _sendFeedbackToInput(inputs, feedback, valid) { if (inputs.length) { diff --git a/public/js/components/Notiz/Notiz.js b/public/js/components/Notiz/Notiz.js index f5b721300..13e969c50 100644 --- a/public/js/components/Notiz/Notiz.js +++ b/public/js/components/Notiz/Notiz.js @@ -48,7 +48,7 @@ export default { return { tabulatorOptions: { ajaxURL: 'dummy', - ajaxRequestFunc: this.endpoint.getNotizen, + ajaxRequestFunc: () => this.$api.call(this.endpoint.getNotizen(this.id, this.typeId)), ajaxParams: () => { return { id: this.id, @@ -338,7 +338,8 @@ export default { this.$refs.formNotiz.clearValidation(); - return this.endpoint.addNewNotiz(this.$refs.formNotiz, this.id, formData) + return this.$refs.formNotiz + .call(this.endpoint.addNewNotiz(this.id, formData)) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); this.resetFormData(); @@ -353,7 +354,8 @@ export default { }); }, deleteNotiz(notiz_id) { - return this.endpoint.deleteNotiz(notiz_id, this.typeId, this.id) + return this.$api + .call(this.endpoint.deleteNotiz(notiz_id, this.typeId, this.id)) .then(result => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete')); this.reload(); @@ -365,7 +367,8 @@ export default { }); }, loadNotiz(notiz_id) { - return this.endpoint.loadNotiz(notiz_id) + return this.$api + .call(this.endpoint.loadNotiz(notiz_id)) .then(result => { this.notizData = result.data; this.notizData.typeId = this.typeId; @@ -375,7 +378,8 @@ export default { .catch(this.$fhcAlert.handleSystemError); }, loadDocEntries(notiz_id) { - return this.endpoint.loadDokumente(notiz_id) + return this.$api + .call(this.endpoint.loadDokumente(notiz_id)) .then( result => { this.notizData.anhang = result.data; @@ -389,7 +393,8 @@ export default { Object.entries(this.notizData.anhang).forEach(([k, v]) => formData.append(k, v)); this.$refs.formNotiz.clearValidation(); - return this.endpoint.updateNotiz(this.$refs.formNotiz, notiz_id, formData) + return this.$refs.formNotiz + .call(this.endpoint.updateNotiz(notiz_id, formData)) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); this.resetFormData(); @@ -426,14 +431,16 @@ export default { }; }, getUid() { - return this.endpoint.getUid() + return this.$api + .call(this.endpoint.getUid()) .then(result => { this.notizData.intVerfasser = result.data; }) .catch(this.$fhcAlert.handleSystemError); }, search(event) { - return this.endpoint.getMitarbeiter(event.query) + return this.$api + .call(this.endpoint.getMitarbeiter(event.query)) .then(result => { this.filteredMitarbeiter = result.data.retval; }); diff --git a/public/js/components/Studierendenantrag/Form/Abmeldung.js b/public/js/components/Studierendenantrag/Form/Abmeldung.js index 7486f9095..248998ffd 100644 --- a/public/js/components/Studierendenantrag/Form/Abmeldung.js +++ b/public/js/components/Studierendenantrag/Form/Abmeldung.js @@ -3,6 +3,8 @@ import CoreForm from '../../Form/Form.js'; import FormValidation from '../../Form/Validation.js'; import FormInput from '../../Form/Input.js'; +import ApiStudstatusAbmeldung from '../../../api/factory/studstatus/abmeldung.js'; + var _uuid = 0; export default { @@ -43,8 +45,8 @@ export default { }, methods: { load() { - return this.$fhcApi.factory - .studstatus.abmeldung.getDetails(this.studierendenantragId, this.prestudentId) + return this.$api + .call(ApiStudstatusAbmeldung.getDetails(this.studierendenantragId, this.prestudentId)) .then(result => { this.data = result.data; if (this.data.status) { @@ -70,12 +72,12 @@ export default { this.saving = true; this.$refs.form.clearValidation(); - this.$refs.form.factory - .studstatus.abmeldung.create( + this.$refs.form + .call(ApiStudstatusAbmeldung.create( this.data.studiensemester_kurzbz, this.data.prestudent_id, this.formData.grund - ) + )) .then(result => { if (result.data === true) @@ -111,10 +113,7 @@ export default { this.saving = true; this.$refs.form.clearValidation(); - this.$refs.form.factory - .studstatus.abmeldung.cancel( - this.data.studierendenantrag_id - ) + this.$refs.form.call(ApiStudstatusAbmeldung.cancel(this.data.studierendenantrag_id)) .then(result => { if (Number.isInteger(result.data)) document.location = document.location.replace(/abmeldung\/([0-9]*)\/[0-9]*[\/]?$/, 'abmeldung/$1') + "/" + result.data; diff --git a/public/js/components/Studierendenantrag/Form/AbmeldungStgl.js b/public/js/components/Studierendenantrag/Form/AbmeldungStgl.js index 450769362..81106e64c 100644 --- a/public/js/components/Studierendenantrag/Form/AbmeldungStgl.js +++ b/public/js/components/Studierendenantrag/Form/AbmeldungStgl.js @@ -3,6 +3,9 @@ import CoreForm from '../../Form/Form.js'; import FormValidation from '../../Form/Validation.js'; import FormInput from '../../Form/Input.js'; +import ApiStudstatusAbmeldung from '../../../api/factory/studstatus/abmeldung.js'; +import ApiCheckperson from '../../../api/factory/checkperson.js'; + var _uuid = 0; export default { @@ -45,8 +48,8 @@ export default { }, methods: { load() { - return this.$fhcApi.factory - .studstatus.abmeldung.getDetails(this.studierendenantragId, this.prestudentId) + return this.$api + .call(ApiStudstatusAbmeldung.getDetails(this.studierendenantragId, this.prestudentId)) .then(result => { this.data = result.data; if (this.data.status) { @@ -71,21 +74,22 @@ export default { this.saving = true; this.$refs.form.clearValidation(); - this.$refs.form.factory - .studstatus.abmeldung.create( + this.$refs.form + .call(ApiStudstatusAbmeldung.create( this.data.studiensemester_kurzbz, this.data.prestudent_id, this.formData.grund - ) + )) .then(result => { - if(this.unrulyInternal) { - this.$fhcApi.factory.checkperson.updatePersonUnrulyStatus(this.data.person_id, true).then( - (res)=> { - if(res?.meta?.status === "success") { + if (this.unrulyInternal) { + this.$api + .call(ApiCheckperson.updatePersonUnrulyStatus(this.data.person_id, true)) + .then(res => { + if (res?.meta?.status === "success") { this.$fhcAlert.alertSuccess(this.$p.t('studierendenantrag', 'antrag_unruly_updated')) } - }) + }); } if (result.data === true) diff --git a/public/js/components/Studierendenantrag/Form/Unterbrechung.js b/public/js/components/Studierendenantrag/Form/Unterbrechung.js index a58cf5e77..20bda7138 100644 --- a/public/js/components/Studierendenantrag/Form/Unterbrechung.js +++ b/public/js/components/Studierendenantrag/Form/Unterbrechung.js @@ -3,6 +3,7 @@ import CoreForm from '../../Form/Form.js'; import FormValidation from '../../Form/Validation.js'; import FormInput from '../../Form/Input.js'; +import ApiStudstatusUnterbrechung from '../../../api/factory/studstatus/unterbrechung.js'; export default { components: { @@ -72,8 +73,11 @@ export default { }, methods: { load() { - return this.$fhcApi.factory - .studstatus.unterbrechung.getDetails(this.studierendenantragId, this.prestudentId) + return this.$api + .call(ApiStudstatusUnterbrechung.getDetails( + this.studierendenantragId, + this.prestudentId + )) .then( result => { this.data = result.data; @@ -99,14 +103,14 @@ export default { this.saving = true; this.$refs.form.clearValidation(); - this.$refs.form.factory - .studstatus.unterbrechung.create( + this.$refs.form + .call(ApiStudstatusUnterbrechung.create( this.stsem !== null && this.data.studiensemester[this.stsem].studiensemester_kurzbz, this.data.prestudent_id, this.data.grund, this.stsem !== null && this.currentWiedereinstieg, this.attachment - ) + )) .then(result => { if (Number.isInteger(result.data)) document.location += "/" + result.data; @@ -141,10 +145,10 @@ export default { this.saving = true; this.$refs.form.clearValidation(); - this.$refs.form.factory - .studstatus.unterbrechung.cancel( + this.$refs.form + .call(ApiStudstatusUnterbrechung.cancel( this.data.studierendenantrag_id - ) + )) .then(result => { if (Number.isInteger(result.data)) document.location = document.location.replace(/unterbrechung\/([0-9]*)\/[0-9]*[\/]?$/, 'unterbrechung/$1') + "/" + result.data; diff --git a/public/js/components/Studierendenantrag/Form/Wiederholung.js b/public/js/components/Studierendenantrag/Form/Wiederholung.js index a899d242c..7b81d916c 100644 --- a/public/js/components/Studierendenantrag/Form/Wiederholung.js +++ b/public/js/components/Studierendenantrag/Form/Wiederholung.js @@ -2,6 +2,7 @@ import {CoreFetchCmpt} from '../../Fetch.js'; import CoreForm from '../../Form/Form.js'; import FormValidation from '../../Form/Validation.js'; +import ApiStudstatusWiederholung from '../../../api/factory/studstatus/wiederholung.js'; export default { components: { @@ -49,10 +50,10 @@ export default { }, methods: { load() { - return this.$fhcApi.factory - .studstatus.wiederholung.getDetails( + return this.$api + .call(ApiStudstatusWiederholung.getDetails( this.prestudentId - ) + )) .then(result => { this.data = result.data; if (!this.data.status || this.data.status == 'ErsteAufforderungVersandt' || this.data.status == 'ZweiteAufforderungVersandt') { @@ -87,11 +88,11 @@ export default { }); this.saving = true; - this.$refs.form.factory - .studstatus.wiederholung[func]( + this.$refs.form + .call(ApiStudstatusWiederholung[func]( this.data.prestudent_id, this.data.studiensemester_kurzbz - ) + )) .then(result => { if (result.data === true) document.location += ""; diff --git a/public/js/components/Studierendenantrag/Leitung.js b/public/js/components/Studierendenantrag/Leitung.js index 36e3a505d..dc412c6c2 100644 --- a/public/js/components/Studierendenantrag/Leitung.js +++ b/public/js/components/Studierendenantrag/Leitung.js @@ -6,6 +6,9 @@ import LvPopup from './Leitung/LvPopup.js'; import BsAlert from '../Bootstrap/Alert.js'; import FhcLoader from '../Loader.js'; +import ApiStudstatusLeitung from '../../api/factory/studstatus/leitung.js'; +import ApiStudstatusAbmeldung from '../../api/factory/studstatus/abmeldung.js'; + export default { components: { LeitungHeader, @@ -39,8 +42,8 @@ export default { }, methods: { loadFilter() { - this.$fhcApi.factory - .studstatus.leitung.getStgs() + this.$api + .call(ApiStudstatusLeitung.getStgs()) .then(result => this.stgs = result.data) .catch(this.$fhcAlert.handleSystemError); }, @@ -98,8 +101,8 @@ export default { } } else { this.$refs.loader.show(); - this.$fhcApi.factory - .studstatus.leitung.approve(oks) + this + ._singleOrMultiApiCall(oks, ApiStudstatusLeitung.approve) .then(this.showResults); } }, @@ -130,37 +133,38 @@ export default { .catch(() => {}); } else { this.$refs.loader.show(); - this.$fhcApi.factory - .studstatus.leitung.reject(gruende) + + this + ._singleOrMultiApiCall(gruende, ApiStudstatusLeitung.reject) .then(this.showResults); } }, actionReopen(evt) { var antraege = evt || this.selectedData; this.$refs.loader.show(); - this.$fhcApi.factory - .studstatus.leitung.reopen(gruende) + this + ._singleOrMultiApiCall(antraege, ApiStudstatusLeitung.reopen) .then(this.showResults); }, actionPause(evt) { var antraege = evt || this.selectedData; this.$refs.loader.show(); - this.$fhcApi.factory - .studstatus.leitung.pause(antraege) + this + ._singleOrMultiApiCall(antraege, ApiStudstatusLeitung.pause) .then(this.showResults); }, actionUnpause(evt) { var antraege = evt || this.selectedData; this.$refs.loader.show(); - this.$fhcApi.factory - .studstatus.leitung.unpause(antraege) + this + ._singleOrMultiApiCall(antraege, ApiStudstatusLeitung.unpause) .then(this.showResults); }, actionObject(evt) { var antraege = evt || this.selectedData; this.$refs.loader.show(); - this.$fhcApi.factory - .studstatus.leitung.object(antraege) + this + ._singleOrMultiApiCall(antraege, ApiStudstatusLeitung.object) .then(this.showResults); }, actionoObjectionDeny(evt, gruende) { @@ -189,24 +193,35 @@ export default { .catch(() => {}); } else { this.$refs.loader.show(); - this.$fhcApi.factory - .studstatus.leitung.denyObjection(gruende) + this + ._singleOrMultiApiCall(gruende, ApiStudstatusLeitung.denyObjection) .then(this.showResults); } }, actionObjectionApprove(evt, gruende) { var antraege = evt || this.selectedData; this.$refs.loader.show(); - this.$fhcApi.factory - .studstatus.leitung.approveObjection(antraege) + this + ._singleOrMultiApiCall(antraege, ApiStudstatusLeitung.approveObjection) .then(this.showResults); }, actionCancel(evt) { var antraege = evt || this.selectedData; this.$refs.loader.show(); - this.$fhcApi.factory - .studstatus.abmeldung.cancel(antraege) - .then(this.showResults); + if (Array.isArray(antraege)) { + Promise + .allSettled( + antraege.map(antrag => this.$api.call( + ApiStudstatusAbmeldung.cancel(antrag.studierendenantrag_id), + { errorHeader: '#' + antrag.studierendenantrag_id } + )) + ) + .then(this.showResults); + } else { + this.$api + .call(ApiStudstatusAbmeldung.cancel(antraege)) + .then(this.showResults); + } }, showResults(results) { let fulfilled = results.filter(res => res.status == 'fulfilled'); @@ -214,6 +229,16 @@ export default { //fulfilled.forEach(a => this.$fhcAlert.alertDefault('success', '#' + a.value.data, 'Approved, ...')); if (fulfilled.length) this.reload(); + }, + _singleOrMultiApiCall(antraege, endpoint) { + if (Array.isArray(antraege)) { + return Promise + .allSettled(antraege.map(antrag => this.$api.call( + endpoint(antrag), + { errorHeader: '#' + antrag.studierendenantrag_id } + ))); + } + return this.$api.call(endpoint(antraege)); } }, created() { diff --git a/public/js/components/Studierendenantrag/Leitung/Actions/New.js b/public/js/components/Studierendenantrag/Leitung/Actions/New.js index e9152febe..a6cd69219 100644 --- a/public/js/components/Studierendenantrag/Leitung/Actions/New.js +++ b/public/js/components/Studierendenantrag/Leitung/Actions/New.js @@ -1,6 +1,8 @@ import BsAlert from '../../../Bootstrap/Alert.js'; import BsModal from '../../../Bootstrap/Modal.js'; +import ApiStudstatusLeitung from '../../../../api/factory/studstatus/leitung.js'; + export default { components: { BsModal, @@ -47,8 +49,11 @@ export default { } this.abortController = new AbortController(); - this.$fhcApi.factory - .studstatus.leitung.getPrestudents(evt.query, this.abortController.signal) + this.$api + .call(ApiStudstatusLeitung.getPrestudents(evt.query), { + signal: this.abortController.signal, + timeout: 30000 + }) .then(result => { this.data = result.data; this.abortController = null; diff --git a/public/js/components/Studierendenantrag/Leitung/LvPopup.js b/public/js/components/Studierendenantrag/Leitung/LvPopup.js index cfd4b05ac..b9567de40 100644 --- a/public/js/components/Studierendenantrag/Leitung/LvPopup.js +++ b/public/js/components/Studierendenantrag/Leitung/LvPopup.js @@ -1,6 +1,8 @@ import BsAlert from '../../Bootstrap/Alert.js'; import {CoreFetchCmpt} from "../../Fetch.js"; +import ApiStudstatusWiederholung from '../../../api/factory/studstatus/wiederholung.js'; + export default { components: { CoreFetchCmpt @@ -45,8 +47,8 @@ export default { loadlvs() { if (!this.antragId) return new Promise(() => {}); - return this.$fhcApi.factory - .studstatus.wiederholung.getLvs(this.antragId); + return this.$api + .call(ApiStudstatusWiederholung.getLvs(this.antragId)); }, submit(result) { this.result = [result, this.check]; diff --git a/public/js/components/Studierendenantrag/Leitung/Table.js b/public/js/components/Studierendenantrag/Leitung/Table.js index 8201462b4..fa5f50939 100644 --- a/public/js/components/Studierendenantrag/Leitung/Table.js +++ b/public/js/components/Studierendenantrag/Leitung/Table.js @@ -3,6 +3,8 @@ import {CoreFetchCmpt} from '../../Fetch.js'; import LvPopup from './LvPopup.js'; import { dateFilter } from '../../../tabulator/filters/Dates.js'; +import ApiStudstatusLeitung from '../../../api/factory/studstatus/leitung.js'; + export default { components: { BsModal, @@ -50,12 +52,12 @@ export default { getHistory() { if (this.lastHistoryClickedId === null) return null; - return this.$fhcApi.factory - .studstatus.leitung.getHistory(this.lastHistoryClickedId) + return this.$api + .call(ApiStudstatusLeitung.getHistory(this.lastHistoryClickedId)) .then(res => { this.historyData = res.data.sort((a, b) => a.insertamum > b.insertamum); }) - .catch(this.$fhcApi.handleSystemError); + .catch(this.$fhcAlert.handleSystemError); }, getHistoryStatus(data, index) { if (data.insertvon == 'Studienabbruch') @@ -112,7 +114,8 @@ export default { height: '65vh', layout: "fitDataFill", ajaxURL: '/' + (this.filter || ''), - ajaxRequestFunc: this.$fhcApi.factory.studstatus.leitung.getAntraege, + ajaxRequestFunc: url => this.$api.call(ApiStudstatusLeitung.getAntraege(url)), + ajaxResponse: (url, params, response) => response.data, persistence: { // NOTE(chris): do not store column titles sort: true, //persist column sorting filter: true, //persist filters diff --git a/public/js/components/Studierendenantrag/Lvzuweisung.js b/public/js/components/Studierendenantrag/Lvzuweisung.js index dd6f7cdf6..64ee426c6 100644 --- a/public/js/components/Studierendenantrag/Lvzuweisung.js +++ b/public/js/components/Studierendenantrag/Lvzuweisung.js @@ -1,5 +1,7 @@ import StudierendenantragStatus from './Status.js'; +import ApiStudstatusWiederholung from '../../api/factory/studstatus/wiederholung.js'; + export default { components: { StudierendenantragStatus @@ -56,8 +58,11 @@ export default { anmerkung: lv.antrag_anmerkung || "", studiensemester_kurzbz: this.lvs2sem })); - this.$fhcApi.factory - .studstatus.wiederholung.saveLvs(forbiddenLvs, mandatoryLvs) + this.$api + .call(ApiStudstatusWiederholung.saveLvs( + forbiddenLvs, + mandatoryLvs + )) .then(response => { this.$fhcAlert.alertSuccess('Speichern erfolgreich'); this.statusCode = response.data[0].studierendenantrag_statustyp_kurzbz; @@ -78,8 +83,9 @@ export default { mounted() { this.$p .loadCategory(['ui', 'lehre', 'studierendenantrag', 'global']) - .then(() => this.antragId) - .then(this.$fhcApi.factory.studstatus.wiederholung.getLvs) + .then(() => this.$api.call( + ApiStudstatusWiederholung.getLvs(this.antragId) + )) .then(result => { let res = {}; for (var k in result.data) { diff --git a/public/js/components/Stv/Studentenverwaltung.js b/public/js/components/Stv/Studentenverwaltung.js index 87eeabfe6..3f066b519 100644 --- a/public/js/components/Stv/Studentenverwaltung.js +++ b/public/js/components/Stv/Studentenverwaltung.js @@ -22,6 +22,9 @@ import StvList from "./Studentenverwaltung/List.js"; import StvDetails from "./Studentenverwaltung/Details.js"; import StvStudiensemester from "./Studentenverwaltung/Studiensemester.js"; +import ApiSearchbar from "../../api/factory/searchbar.js"; +import ApiStv from "../../api/factory/stv.js"; + export default { components: { @@ -109,7 +112,9 @@ export default { methods: { onSelectVerband({link, studiengang_kz}) { this.studiengangKz = studiengang_kz; - this.$refs.stvList.updateUrl(this.$fhcApi.factory.stv.students.verband(link)); + this.$refs.stvList.updateUrl( + ApiStv.students.verband(link) + ); }, studiensemesterChanged(v) { this.studiensemesterKurzbz = v; @@ -118,54 +123,64 @@ export default { }, reloadList() { this.$refs.stvList.reload(); + }, + searchfunction(params) { + return this.$api.call(ApiSearchbar.search(params)); } }, created() { - this.$fhcApi - .get('api/frontend/v1/stv/address/getNations') + this.$api + .call(ApiStv.kontakt.address.getNations()) .then(result => { this.lists.nations = result.data; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi - .get('api/frontend/v1/stv/lists/getSprachen') + + this.$api + .call(ApiStv.lists.getSprachen()) .then(result => { this.lists.sprachen = result.data; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi - .get('api/frontend/v1/stv/lists/getGeschlechter') + + this.$api + .call(ApiStv.lists.getGeschlechter()) .then(result => { this.lists.geschlechter = result.data; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi - .get('api/frontend/v1/stv/lists/getAusbildungen') + + this.$api + .call(ApiStv.lists.getAusbildungen()) .then(result => { this.lists.ausbildungen = result.data; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi - .get('api/frontend/v1/stv/lists/getStgs') + + this.$api + .call(ApiStv.lists.getStgs()) .then(result => { this.lists.stgs = result.data; this.lists.active_stgs = this.lists.stgs.filter(stg => stg.aktiv); }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi - .get('api/frontend/v1/stv/lists/getOrgforms') + + this.$api + .call(ApiStv.lists.getOrgforms()) .then(result => { this.lists.orgforms = result.data; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi - .factory.stv.konto.getBuchungstypen() + + this.$api + .call(ApiStv.konto.getBuchungstypen()) .then(result => { this.lists.buchungstypen = result.data; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi - .get('api/frontend/v1/stv/lists/getStudiensemester') + + this.$api + .call(ApiStv.lists.getStudiensemester()) .then(result => { this.lists.studiensemester = result.data; this.lists.studiensemester_desc = result.data.toReversed(); @@ -174,11 +189,20 @@ export default { }, mounted() { if (this.$route.params.id) { - this.$refs.stvList.updateUrl(this.$fhcApi.factory.stv.students.uid(this.$route.params.id), true); + this.$refs.stvList.updateUrl( + ApiStv.students.uid(this.$route.params.id), + true + ); } else if (this.$route.params.prestudent_id) { - this.$refs.stvList.updateUrl(this.$fhcApi.factory.stv.students.prestudent(this.$route.params.prestudent_id), true); + this.$refs.stvList.updateUrl( + ApiStv.students.prestudent(this.$route.params.prestudent_id), + true + ); } else if (this.$route.params.person_id) { - this.$refs.stvList.updateUrl(this.$fhcApi.factory.stv.students.person(this.$route.params.person_id), true); + this.$refs.stvList.updateUrl( + ApiStv.students.person(this.$route.params.person_id), + true + ); } }, @@ -187,7 +211,7 @@ export default {
diff --git a/public/js/components/Stv/Studentenverwaltung/Details.js b/public/js/components/Stv/Studentenverwaltung/Details.js index b42611095..4a35c54e5 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details.js +++ b/public/js/components/Stv/Studentenverwaltung/Details.js @@ -1,5 +1,7 @@ import FhcTabs from "../../Tabs.js"; +import ApiStvApp from '../../../api/factory/stv/app.js'; + // TODO(chris): alt & title // TODO(chris): phrasen @@ -39,14 +41,14 @@ export default { } }, created() { - this.$fhcApi - .factory.stv.configStudent() + this.$api + .call(ApiStvApp.configStudent()) .then(result => { this.configStudent = result.data; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi - .factory.stv.configStudents() + this.$api + .call(ApiStvApp.configStudents()) .then(result => { this.configStudents = result.data; }) diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Abschlusspruefung/Abschlusspruefung.js b/public/js/components/Stv/Studentenverwaltung/Details/Abschlusspruefung/Abschlusspruefung.js index a37ab7a97..e2cb0ec54 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Abschlusspruefung/Abschlusspruefung.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Abschlusspruefung/Abschlusspruefung.js @@ -5,6 +5,9 @@ import FormInput from '../../../../Form/Input.js'; import PvAutoComplete from "../../../../../../../index.ci.php/public/js/components/primevue/autocomplete/autocomplete.esm.min.js"; import AbschlusspruefungDropdown from "./AbschlusspruefungDropdown.js"; +import ApiStudiengang from '../../../../../api/factory/studiengang.js'; +import ApiStvAbschlusspruefung from '../../../../../api/factory/stv/abschlusspruefung.js'; + export default { components: { CoreFilterCmpt, @@ -57,12 +60,7 @@ export default { return { tabulatorOptions: { ajaxURL: 'dummy', - ajaxRequestFunc: this.$fhcApi.factory.stv.abschlusspruefung.getAbschlusspruefung, - ajaxParams: () => { - return { - id: this.student.uid - }; - }, + ajaxRequestFunc: () => this.$api.call(ApiStvAbschlusspruefung.getAbschlusspruefung(this.student.uid)), ajaxResponse: (url, params, response) => response.data, columns: [ {title: "vorsitz", field: "vorsitz_nachname"}, @@ -272,9 +270,10 @@ export default { methods: { getStudiengangByKz(){ this.stgInfo = { typ: '', oe_kurzbz: '' }; - this.$fhcApi.factory.studiengang.getStudiengangByKz(this.stg_kz) - .then(result => this.stgInfo = result.data) - .catch(this.$fhcAlert.handleSystemError); + this.api + .call(ApiStudiengang.getStudiengangByKz(this.stg_kz)) + .then(result => this.stgInfo = result.data) + .catch(this.$fhcAlert.handleSystemError); }, actionNewAbschlusspruefung() { this.resetForm(); @@ -303,7 +302,8 @@ export default { formData: this.formData }; - return this.$fhcApi.factory.stv.abschlusspruefung.addNewAbschlusspruefung(this.$refs.formFinalExam, dataToSend) + return this.$refs.formFinalExam + .call(ApiStvAbschlusspruefung.addNewAbschlusspruefung(dataToSend)) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); this.hideModal('finalexamModal'); @@ -321,7 +321,8 @@ export default { this.$refs.table.reloadTable(); }, loadAbschlusspruefung(abschlusspruefung_id) { - return this.$fhcApi.factory.stv.abschlusspruefung.loadAbschlusspruefung(abschlusspruefung_id) + return this.$api + .call(ApiStvAbschlusspruefung.loadAbschlusspruefung(abschlusspruefung_id)) .then(result => { this.formData = result.data; //TODO(Manu) check if cisRoot is okay @@ -335,7 +336,8 @@ export default { id: abschlusspruefung_id, formData: this.formData }; - return this.$fhcApi.factory.stv.abschlusspruefung.updateAbschlusspruefung(this.$refs.formFinalExam, dataToSend) + return this.$refs.formFinalExam + .call(ApiStvAbschlusspruefung.updateAbschlusspruefung(dataToSend)) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); this.hideModal('finalexamModal'); @@ -347,7 +349,8 @@ export default { }); }, deleteAbschlusspruefung(abschlusspruefung_id) { - return this.$fhcApi.factory.stv.abschlusspruefung.deleteAbschlusspruefung(abschlusspruefung_id) + return this.$api + .call(ApiStvAbschlusspruefung.deleteAbschlusspruefung(abschlusspruefung_id)) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete')); }) @@ -381,7 +384,8 @@ export default { } this.abortController.mitarbeiter = new AbortController(); - return this.$fhcApi.factory.stv.abschlusspruefung.getMitarbeiter(event.query) + return this.$api + .call(ApiStvAbschlusspruefung.getMitarbeiter(event.query)) .then(result => { this.filteredMitarbeiter = result.data.retval; }); @@ -392,7 +396,8 @@ export default { } this.abortController.pruefer = new AbortController(); - return this.$fhcApi.factory.stv.abschlusspruefung.getPruefer(event.query) + return this.$api + .call(ApiStvAbschlusspruefung.getPruefer(event.query)) .then(result => { this.filteredPruefer = result.data.retval; }); @@ -422,33 +427,43 @@ export default { }, }, created() { - this.$fhcApi.factory.stv.abschlusspruefung.getTypenAbschlusspruefung() + this.$api + .call(ApiStvAbschlusspruefung.getTypenAbschlusspruefung()) .then(result => { this.arrTypen = result.data; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi.factory.stv.abschlusspruefung.getTypenAntritte() + + this.$api + .call(ApiStvAbschlusspruefung.getTypenAntritte()) .then(result => { this.arrAntritte = result.data; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi.factory.stv.abschlusspruefung.getBeurteilungen() + + this.$api + .call(ApiStvAbschlusspruefung.getBeurteilungen()) .then(result => { this.arrBeurteilungen = result.data; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi.factory.stv.abschlusspruefung.getNoten() + + this.$api + .call(ApiStvAbschlusspruefung.getNoten()) .then(result => { this.arrNoten = result.data; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi.factory.stv.abschlusspruefung.getAkadGrade(this.student.studiengang_kz) + + this.$api + .call(ApiStvAbschlusspruefung.getAkadGrade(this.student.studiengang_kz)) .then(result => { this.arrAkadGrad = result.data; }) .catch(this.$fhcAlert.handleSystemError); if (!this.student.length) { - this.$fhcApi.factory.studiengang.getStudiengangByKz(this.student.studiengang_kz) + this.$api + .call(ApiStudiengang.getStudiengangByKz(this.student.studiengang_kz)) .then(result => { this.stgInfo = result.data; this.setDefaultFormData(); diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Abschlusspruefung/AbschlusspruefungDropdown.js b/public/js/components/Stv/Studentenverwaltung/Details/Abschlusspruefung/AbschlusspruefungDropdown.js index 13a68a68f..d637b125f 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Abschlusspruefung/AbschlusspruefungDropdown.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Abschlusspruefung/AbschlusspruefungDropdown.js @@ -1,3 +1,5 @@ +import ApiStvAbschlusspruefung from '../../../../../api/factory/stv/abschlusspruefung.js'; + export default { inject: { $reloadList: { @@ -76,7 +78,8 @@ export default { return labels[documentKey] || documentKey; }, checkUidsIfExistingFinalExams(uids) { - return this.$fhcApi.factory.stv.abschlusspruefung.checkForExistingExams(uids) + return this.$api + .call(ApiStvAbschlusspruefung.checkForExistingExams(uids)) .catch(this.$fhcAlert.handleSystemError); }, printDocument(document, lang, format) { diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Betriebsmittel.js b/public/js/components/Stv/Studentenverwaltung/Details/Betriebsmittel.js index 9d2970a54..f2090c2a6 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Betriebsmittel.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Betriebsmittel.js @@ -1,5 +1,7 @@ import CoreBetriebsmittel from "../../../Betriebsmittel/Betriebsmittel.js"; +import ApiBetriebsmittelPerson from '../../../../api/factory/betriebsmittel/person.js'; + export default { components: { CoreBetriebsmittel @@ -7,10 +9,15 @@ export default { props: { modelValue: Object }, + data() { + return { + endpoint: ApiBetriebsmittelPerson + }; + }, template: `
{ this.data = result.data; if (!this.data.familienstand) @@ -107,7 +110,8 @@ export default { return; this.$refs.form.clearValidation(); - return this.$fhcApi.factory.stv.details.save(this.$refs.form, this.modelValue.prestudent_id, this.changed) + return this.$refs.form + .call(ApiStvDetails.save(this.modelValue.prestudent_id, this.changed)) .then(result => { this.original = {...this.data}; this.changed = {}; diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js index 13d3dcc12..d8b6fb2c3 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Address.js @@ -5,6 +5,9 @@ import BsModal from "../../../../Bootstrap/Modal.js"; import FormForm from '../../../../Form/Form.js'; import FormInput from '../../../../Form/Input.js'; +import ApiStvAddress from '../../../../../api/factory/stv/kontakt/address.js'; +import ApiStvCompany from '../../../../../api/factory/stv/kontakt/company.js'; + export default{ components: { CoreFilterCmpt, @@ -21,12 +24,7 @@ export default{ return { tabulatorOptions: { ajaxURL: 'dummy', - ajaxRequestFunc: this.$fhcApi.factory.stv.kontakt.getAdressen, - ajaxParams: () => { - return { - id: this.uid - }; - }, + ajaxRequestFunc: () => this.$api.call(ApiStvAddress.get(this.uid)), ajaxResponse: (url, params, response) => response.data, //autoColumns: true, columns:[ @@ -230,7 +228,7 @@ export default{ }, watch: { uid() { - this.$refs.table.tabulator.setData('api/frontend/v1/stv/Kontakt/getAdressen/' + this.uid); + this.reload(); }, }, methods:{ @@ -262,22 +260,23 @@ export default{ }, addNewAddress(addressData) { this.addressData.plz = this.addressData.address.plz; - return this.$fhcApi.factory.stv.kontakt.addNewAddress(this.$refs.addressData, this.uid, this.addressData) + return this.$refs.addressData + .call(ApiStvAddress.add(this.uid, this.addressData)) .then(response => { - this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); + this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); this.hideModal('adressModal'); this.resetModal(); - }).catch(this.$fhcAlert.handleSystemError) - .finally(() => { - this.reload(); - }); + }) + .catch(this.$fhcAlert.handleSystemError) + .finally(this.reload); }, reload() { this.$refs.table.reloadTable(); }, loadAdress(adresse_id) { this.statusNew = false; - return this.$fhcApi.factory.stv.kontakt.loadAddress(adresse_id) + return this.$api + .call(ApiStvAddress.load(adresse_id)) .then(result => { this.addressData = result.data; this.addressData.address = {}; @@ -288,23 +287,24 @@ export default{ }, updateAddress(adresse_id) { this.addressData.plz = this.addressData.address.plz; - return this.$fhcApi.factory.stv.kontakt.updateAddress(this.$refs.addressData, adresse_id, - this.addressData - ).then(response => { - this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); + return this.$refs.addressData + .call(ApiStvAddress.update(adresse_id, this.addressData)) + .then(response => { + this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); this.hideModal('adressModal'); this.resetModal(); - }).catch(this.$fhcAlert.handleSystemError) - .finally(() => { - this.reload(); - }); + }) + .catch(this.$fhcAlert.handleSystemError) + .finally(this.reload); }, deleteAddress(adresse_id) { - return this.$fhcApi.factory.stv.kontakt.deleteAddress(adresse_id) + return this.$api + .call(ApiStvAddress.delete(adresse_id)) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete')); - }).catch(this.$fhcAlert.handleSystemError) - .finally(()=> { + }) + .catch(this.$fhcAlert.handleSystemError) + .finally(() => { window.scrollTo(0, 0); this.reload(); }); @@ -317,7 +317,8 @@ export default{ this.abortController.places = new AbortController(); - return this.$fhcApi.factory.stv.kontakt.getPlaces(this.addressData.address.plz) + return this.$api + .call(ApiStvAddress.getPlaces(this.addressData.address.plz)) .then(result => { this.places = result.data; }); @@ -329,7 +330,8 @@ export default{ this.abortController.firmen = new AbortController(); - return this.$fhcApi.factory.stv.kontakt.getFirmen(event.query) + return this.$api + .call(ApiStvCompany.get(event.query)) .then(result => { this.filteredFirmen = result.data.retval; }); @@ -356,13 +358,15 @@ export default{ }, }, created() { - this.$fhcApi.factory.stv.kontakt.getNations() + this.$api + .call(ApiStvAddress.getNations()) .then(result => { this.nations = result.data; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi.factory.stv.kontakt.getAdressentypen() + this.$api + .call(ApiStvAddress.getTypes()) .then(result => { this.adressentypen = result.data; }) diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Bankaccount.js b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Bankaccount.js index 5570276e7..2db1f9d8f 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Bankaccount.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Bankaccount.js @@ -3,6 +3,8 @@ import BsModal from "../../../../Bootstrap/Modal.js"; import FormForm from '../../../../Form/Form.js'; import FormInput from '../../../../Form/Input.js'; +import ApiStvBankaccount from '../../../../../api/factory/stv/kontakt/bankaccount.js'; + export default{ components: { CoreFilterCmpt, @@ -17,12 +19,7 @@ export default{ return{ tabulatorOptions: { ajaxURL: 'dummy', - ajaxRequestFunc: this.$fhcApi.factory.stv.kontakt.getBankverbindung, - ajaxParams: () => { - return { - id: this.uid - }; - }, + ajaxRequestFunc: () => this.$api.call(ApiStvBankaccount.get(this.uid)), ajaxResponse: (url, params, response) => response.data, columns:[ {title:"Name", field:"name"}, @@ -143,8 +140,8 @@ export default{ } }, watch: { - uid(){ - this.$refs.table.tabulator.setData('api/frontend/v1/stv/Kontakt/getBankverbindung/' + this.uid); + uid() { + this.reload(); } }, methods:{ @@ -169,50 +166,58 @@ export default{ .catch(this.$fhcAlert.handleSystemError); }, addNewBankverbindung(bankverbindungData) { - return this.$fhcApi.factory.stv.kontakt.addNewBankverbindung(this.$refs.bankverbindungData, this.uid, this.bankverbindungData) - .then(response => { + return this.$refs.bankverbindungData + .call(ApiStvBankaccount.add(this.uid, this.bankverbindungData)) + .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); this.hideModal('bankverbindungModal'); this.resetModal(); - }).catch(this.$fhcAlert.handleSystemError) + }) + .catch(this.$fhcAlert.handleSystemError) .finally(() => { - window.scrollTo(0, 0); - this.reload(); - }); + window.scrollTo(0, 0); + this.reload(); + }); }, loadBankverbindung(bankverbindung_id){ this.statusNew = false; - return this.$fhcApi.factory.stv.kontakt.loadBankverbindung(bankverbindung_id) - .then( - result => { + this.$api + .call(ApiStvBankaccount.load(bankverbindung_id)) + .then(result => { this.bankverbindungData = result.data; return result; }) .catch(this.$fhcAlert.handleSystemError); }, - updateBankverbindung(bankverbindung_id){ - return this.$fhcApi.factory.stv.kontakt.updateBankverbindung(this.$refs.bankverbindungData, bankverbindung_id, - this.bankverbindungData) + updateBankverbindung(bankverbindung_id) { + return this.$refs.bankverbindungData + .call(ApiStvBankaccount.update( + bankverbindung_id, + this.bankverbindungData + )) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); this.hideModal('bankverbindungModal'); this.resetModal(); - }).catch(this.$fhcAlert.handleSystemError) - .finally(() => { - window.scrollTo(0, 0); - this.reload(); - }); + }) + .catch(this.$fhcAlert.handleSystemError) + .finally(() => { + window.scrollTo(0, 0); + this.reload(); + }); }, - deleteBankverbindung(bankverbindung_id){ - return this.$fhcApi.factory.stv.kontakt.deleteBankverbindung(bankverbindung_id) + deleteBankverbindung(bankverbindung_id) { + return this.$api + .call(ApiStvBankaccount.delete(bankverbindung_id)) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete')); - }).catch(this.$fhcAlert.handleSystemError) - .finally(()=> { - window.scrollTo(0, 0); - this.resetModal(); - this.reload(); - }); + }) + .catch(this.$fhcAlert.handleSystemError) + .finally(()=> { + window.scrollTo(0, 0); + this.resetModal(); + this.reload(); + }); }, hideModal(modalRef){ this.$refs[modalRef].hide(); diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Contact.js b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Contact.js index 87dc70eb1..46a9a449e 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Contact.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Kontakt/Contact.js @@ -4,6 +4,9 @@ import PvAutoComplete from "../../../../../../../index.ci.php/public/js/componen import FormForm from '../../../../Form/Form.js'; import FormInput from '../../../../Form/Input.js'; +import ApiStvContact from '../../../../../api/factory/stv/kontakt/contact.js'; +import ApiStvCompany from '../../../../../api/factory/stv/kontakt/company.js'; + export default{ components: { CoreFilterCmpt, @@ -19,12 +22,7 @@ export default{ return{ tabulatorOptions: { ajaxURL: 'dummy', - ajaxRequestFunc: this.$fhcApi.factory.stv.kontakt.getKontakte, - ajaxParams: () => { - return { - id: this.uid - }; - }, + ajaxRequestFunc: () => this.$api.call(ApiStvContact.get(this.uid)), ajaxResponse: (url, params, response) => response.data, columns:[ {title:"Typ", field:"kontakttyp"}, @@ -167,7 +165,7 @@ export default{ }, watch: { uid() { - this.$refs.table.tabulator.setData('api/frontend/v1/stv/Kontakt/getKontakte/' + this.uid); + this.reload(); }, contactData: { handler(newVal) { @@ -200,31 +198,34 @@ export default{ .catch(this.$fhcAlert.handleSystemError); }, addNewContact(formData) { - return this.$fhcApi.factory.stv.kontakt.addNewContact(this.$refs.contactData, this.uid, this.contactData) + return this.$refs.contactData + .call(ApiStvContact.add(this.uid, this.contactData)) .then(response => { - this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); - this.hideModal("contactModal"); - this.resetModal(); - }).catch(this.$fhcAlert.handleSystemError) + this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); + this.hideModal("contactModal"); + this.resetModal(); + }) + .catch(this.$fhcAlert.handleSystemError) .finally(() => { - window.scrollTo(0, 0); - this.reload(); - }); + window.scrollTo(0, 0); + this.reload(); + }); }, - loadContact(kontakt_id){ + loadContact(kontakt_id) { this.statusNew = false; if(this.contactData.firma_id) this.loadStandorte(this.contactData.firma_id); - return this.$fhcApi.factory.stv.kontakt.loadContact(kontakt_id) - .then( - result => { - this.contactData = result.data; - return result; - }) + return this.$api + .call(ApiStvContact.load(kontakt_id)) + .then(result => { + this.contactData = result.data; + return result; + }) .catch(this.$fhcAlert.handleSystemError); }, - deleteContact(kontakt_id){ - return this.$fhcApi.factory.stv.kontakt.deleteContact(kontakt_id) + deleteContact(kontakt_id) { + return this.$api + .call(ApiStvContact.delete(kontakt_id)) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete')); }) @@ -233,27 +234,28 @@ export default{ window.scrollTo(0, 0); this.resetModal(); this.reload(); - }); + }); }, - updateContact(kontakt_id){ - return this.$fhcApi.factory.stv.kontakt.updateContact(this.$refs.contactData, kontakt_id, - this.contactData) + updateContact(kontakt_id) { + return this.$refs.contactData + .call(ApiStvContact.update(kontakt_id, this.contactData)) .then(response => { - this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); - this.hideModal('contactModal'); - this.resetModal(); - this.reload(); - }).catch(this.$fhcAlert.handleSystemError) - .finally(()=> { - window.scrollTo(0, 0); - this.reload(); - }); + this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); + this.hideModal('contactModal'); + this.resetModal(); + this.reload(); + }) + .catch(this.$fhcAlert.handleSystemError) + .finally(()=> { + window.scrollTo(0, 0); + this.reload(); + }); }, - hideModal(modalRef){ + hideModal(modalRef) { this.$refs[modalRef].hide(); }, - reload(){ + reload() { this.$refs.table.reloadTable(); }, searchFirma(event) { @@ -263,7 +265,8 @@ export default{ this.abortController.firmen = new AbortController(); - return this.$fhcApi.factory.stv.kontakt.getFirmen(event.query) + return this.$api + .call(ApiStvCompany.get(event.query)) .then(result => { this.filteredFirmen = result.data.retval; }); @@ -275,12 +278,13 @@ export default{ this.abortController.standorte = new AbortController(); - return this.$fhcApi.factory.stv.kontakt.getStandorteByFirma(firmen_id) + return this.$api + .call(ApiStvContact.getStandorteByFirma(firmen_id)) .then(result => { this.filteredOrte = result.data; }); }, - resetModal(){ + resetModal() { this.contactData = {}; this.contactData.zustellung = true; this.contactData.kontakttyp = 'email'; @@ -294,8 +298,9 @@ export default{ this.statusNew = true; }, }, - created(){ - this.$fhcApi.factory.stv.kontakt.getKontakttypen() + created() { + this.$api + .call(ApiStvContact.getTypes()) .then(result => { this.kontakttypen = result.data; }) diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Konto.js b/public/js/components/Stv/Studentenverwaltung/Details/Konto.js index 30fbcd448..b2c8160fb 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Konto.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Konto.js @@ -3,6 +3,9 @@ import FormInput from "../../../Form/Input.js"; import KontoNew from "./Konto/New.js"; import KontoEdit from "./Konto/Edit.js"; +import ApiStvFilter from '../../../../api/factory/stv/filter.js'; +import ApiStvKonto from '../../../../api/factory/stv/konto.js'; + const LOCAL_STORAGE_ID_FILTER = 'stv_details_konto_2024-01-11_filter'; export default { @@ -78,7 +81,7 @@ export default { this.$fhcAlert .confirmDelete() .then(result => result ? cell.getData().buchungsnr : Promise.reject({handled:true})) - .then(this.$fhcApi.factory.stv.konto.delete) + .then(buchungsnr => this.$api.call(ApiStvKonto.delete(buchungsnr))) .then(() => { // TODO(chris): deleting a child also removes the siblings! //cell.getRow().delete(); @@ -94,14 +97,21 @@ export default { return Object.values(columns); }, tabulatorOptions() { - return this.$fhcApi.factory.stv.konto.tabulatorConfig({ + return { + ajaxURL: 'dummy', + ajaxRequestFunc: () => this.$api.call(ApiStvKonto.get( + this.modelValue.person_id || this.modelValue.map(e => e.person_id), + this.filter, + this.studiengang_kz_intern ? this.stg_kz : '' + )), + ajaxResponse: (url, params, response) => response.data, dataTree: true, columns: this.tabulatorColumns, selectable: true, selectableRangeMode: 'click', index: 'buchungsnr', persistenceID: 'stv-details-konto' - }, this); + }; } }, watch: { @@ -124,11 +134,11 @@ export default { this.$refs.new.open(); }, actionCounter(selected) { - this.$fhcApi - .factory.stv.konto.counter({ + this.$api + .call(ApiStvKonto.counter({ buchungsnr: selected.map(e => e.buchungsnr), buchungsdatum: this.counterdate - }) + })) .then(result => result.data) .then(this.updateData) .then(() => this.$p.t('ui/gespeichert')) @@ -172,8 +182,8 @@ export default { if (type == 'open') window.localStorage.setItem(LOCAL_STORAGE_ID_FILTER, this.filter ? 1 : 0); else if (type == 'current_stg') - this.$fhcApi.factory - .stv.filter.setStg(this.studiengang_kz) + this.$api + .call(ApiStvFilter.setStg(this.studiengang_kz)) .catch(this.$fhcAlert.handleSystemError); this.$nextTick(this.$refs.table.reloadTable); @@ -181,8 +191,8 @@ export default { }, created() { this.filter = window.localStorage.getItem(LOCAL_STORAGE_ID_FILTER) == 1; - this.$fhcApi.factory - .stv.filter.getStg() + this.$api + .call(ApiStvFilter.getStg()) .then(result => this.studiengang_kz = result.data) .catch(this.$fhcAlert.handleSystemError); }, diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Konto/Edit.js b/public/js/components/Stv/Studentenverwaltung/Details/Konto/Edit.js index 4627e803c..fb02e30a2 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Konto/Edit.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Konto/Edit.js @@ -3,6 +3,7 @@ import CoreForm from "../../../../Form/Form.js"; import FormValidation from "../../../../Form/Validation.js"; import FormInput from "../../../../Form/Input.js"; +import ApiKonto from '../../../../../api/factory/stv/konto.js'; export default { components: { @@ -33,8 +34,8 @@ export default { this.$refs.form.clearValidation(); this.loading = true; - this.$fhcApi - .factory.stv.konto.edit(this.$refs.form, this.data) + this.$refs.form + .call(ApiKonto.edit(this.data)) .then(result => { this.$emit('saved', result.data); this.loading = false; diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Konto/New.js b/public/js/components/Stv/Studentenverwaltung/Details/Konto/New.js index 1b22310ba..dc6dbb253 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Konto/New.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Konto/New.js @@ -4,6 +4,7 @@ import CoreForm from "../../../../Form/Form.js"; import FormValidation from "../../../../Form/Validation.js"; import FormInput from "../../../../Form/Input.js"; +import ApiKonto from '../../../../../api/factory/stv/konto.js'; export default { components: { @@ -58,8 +59,8 @@ export default { studiengang_kz: this.stgKz }, ...this.data}; - this.$fhcApi - .factory.stv.konto.checkDoubles(this.$refs.form, data) + this.$refs.form + .call(ApiKonto.checkDoubles(data)) .then(result => result.data ? Promise.all( result.errors @@ -68,7 +69,7 @@ export default { ) : Promise.resolve()) .then(() => data) - .then((data) => this.$fhcApi.factory.stv.konto.insert(this.$refs.form, data)) + .then(data => this.$refs.form.call(ApiKonto.insert(data))) .then(result => { this.$emit('saved', result.data); this.loading = false; diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Mobility/List/Purpose.js b/public/js/components/Stv/Studentenverwaltung/Details/Mobility/List/Purpose.js index 80539dc10..477270f32 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Mobility/List/Purpose.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Mobility/List/Purpose.js @@ -4,6 +4,8 @@ import BsModal from "../../../../../Bootstrap/Modal.js"; import CoreForm from '../../../../../Form/Form.js'; import FormInput from '../../../../../Form/Input.js'; +import ApiStvMobility from '../../../../../../api/factory/stv/mobility.js'; + export default { components: { CoreFilterCmpt, @@ -27,17 +29,8 @@ export default { ajaxURL: 'dummy', ajaxRequestFunc: (url, config, params) => { if (this.bisio_id) { - //fake params for getting api call with tabulator to run - const config = { - method: "get", - }; - const params = { - id: this.bisio_id, - }; - return this.$fhcApi.factory.stv.mobility.getPurposes('dummy', config, params) - } - else - { + return this.$api.call(ApiStvMobility.getPurposes(this.bisio_id)); + } else { // use local data return new Promise((resolve) => { const localData = this.localData; @@ -45,11 +38,6 @@ export default { }); } }, - ajaxParams: () => { - return { - id: this.bisio_id || "local" - }; - }, ajaxResponse: (url, params, response) => response.data || this.localData, diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Mobility/List/Support.js b/public/js/components/Stv/Studentenverwaltung/Details/Mobility/List/Support.js index c39adad06..6f1ad7f5b 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Mobility/List/Support.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Mobility/List/Support.js @@ -4,6 +4,8 @@ import BsModal from "../../../../../Bootstrap/Modal.js"; import CoreForm from '../../../../../Form/Form.js'; import FormInput from '../../../../../Form/Input.js'; +import ApiStvMobility from '../../../../../../api/factory/stv/mobility.js'; + export default { components: { CoreFilterCmpt, @@ -27,17 +29,8 @@ export default { ajaxURL: 'dummy', ajaxRequestFunc: (url, config, params) => { if (this.bisio_id) { - //fake params for getting api call with tabulator to run - const config = { - method: "get", - }; - const params = { - id: this.bisio_id, - }; - return this.$fhcApi.factory.stv.mobility.getSupports('dummy', config, params) - } - else - { + return this.$api.call(ApiStvMobility.getSupports(this.bisio_id)); + } else { // use local data return new Promise((resolve) => { const localData = this.localData; @@ -45,11 +38,6 @@ export default { }); } }, - ajaxParams: () => { - return { - id: this.bisio_id || "local" - }; - }, ajaxResponse: (url, params, response) => response.data || this.localData, columns: [ diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Mobility/Mobility.js b/public/js/components/Stv/Studentenverwaltung/Details/Mobility/Mobility.js index bc8b71615..aa6f86ee5 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Mobility/Mobility.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Mobility/Mobility.js @@ -5,6 +5,7 @@ import FormInput from '../../../../Form/Input.js'; import MobilityPurpose from './List/Purpose.js'; import MobilitySupport from './List/Support.js'; +import ApiStvMobility from '../../../../../api/factory/stv/mobility.js'; export default { components: { @@ -34,12 +35,9 @@ export default { return { tabulatorOptions: { ajaxURL: 'dummy', - ajaxRequestFunc: this.$fhcApi.factory.stv.mobility.getMobilitaeten, - ajaxParams: () => { - return { - id: this.student.uid - }; - }, + ajaxRequestFunc: () => this.$api.call( + ApiStvMobility.getMobilitaeten(this.student.uid) + ), ajaxResponse: (url, params, response) => response.data, columns: [ {title: "Kurzbz", field: "kurzbz"}, @@ -213,7 +211,8 @@ export default { uid: this.student.uid, formData: this.formData }; - return this.$fhcApi.factory.stv.mobility.addNewMobility(this.$refs.formMobility, dataToSend) + return this.$refs.formMobility + .call(ApiStvMobility.addNewMobility(dataToSend)) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); this.hideModal("mobilityModal"); @@ -247,7 +246,8 @@ export default { lv_id: lv_id, studiensemester_kurzbz: studiensemester_kurzbz }; - return this.$fhcApi.factory.stv.mobility.getAllLehreinheiten(data) + return this.$api + .call(ApiStvMobility.getAllLehreinheiten(data)) .then(response => { this.listLes = response.data; }) @@ -260,7 +260,8 @@ export default { this.$refs.table.reloadTable(); }, loadMobility(bisio_id) { - return this.$fhcApi.factory.stv.mobility.loadMobility(bisio_id) + return this.$api + .call(ApiStvMobility.loadMobility(bisio_id)) .then(result => { this.formData = result.data; if(this.formData.lehrveranstaltung_id === null) { @@ -280,7 +281,8 @@ export default { formData: this.formData, uid: this.student.uid, }; - this.$fhcApi.factory.stv.mobility.updateMobility(this.$refs.formMobility, dataToSend) + this.$refs.formMobility + .call(ApiStvMobility.updateMobility(dataToSend)) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); this.hideModal("mobilityModal"); @@ -292,7 +294,8 @@ export default { }); }, deleteMobility(bisio_id) { - return this.$fhcApi.factory.stv.mobility.deleteMobility(bisio_id) + return this.api + .call(ApiStvMobility.deleteMobility(bisio_id)) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete')); }) @@ -322,7 +325,8 @@ export default { bisio_id : bisio_id, zweck_code: zweck_code }; - return this.$fhcApi.factory.stv.mobility.addMobilityPurpose(params) + return this.$api + .call(ApiStvMobility.addMobilityPurpose(params)) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); @@ -335,7 +339,8 @@ export default { bisio_id : bisio_id, zweck_code: zweck_code }; - return this.$fhcApi.factory.stv.mobility.deleteMobilityPurpose(params) + return this.$api + .call(ApiStvMobility.deleteMobilityPurpose(params)) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete')); @@ -352,7 +357,8 @@ export default { bisio_id : bisio_id, aufenthaltfoerderung_code: aufenthaltfoerderung_code }; - return this.$fhcApi.factory.stv.mobility.addMobilitySupport(params) + return this.$api + .call(ApiStvMobility.addMobilitySupport(params)) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); @@ -365,7 +371,8 @@ export default { bisio_id : bisio_id, aufenthaltfoerderung_code: aufenthaltfoerderung_code }; - return this.$fhcApi.factory.stv.mobility.deleteMobilitySupport(params) + return this.$api + .call(ApiStvMobility.deleteMobilitySupport(params)) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete')); @@ -378,27 +385,36 @@ export default { }, }, created() { - this.$fhcApi.factory.stv.mobility.getProgramsMobility() + this.$api + .call(ApiStvMobility.getProgramsMobility()) .then(result => { this.programsMobility = result.data; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi.factory.stv.mobility.getLVList(this.student.studiengang_kz) + + this.$api + .call(ApiStvMobility.getLVList(this.student.studiengang_kz)) .then(result => { this.listLvs = result.data; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi.factory.stv.mobility.getListPurposes() + + this.$api + .call(ApiStvMobility.getListPurposes()) .then(result => { this.listPurposes = result.data; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi.factory.stv.mobility.getListSupports() + + this.$api + .call(ApiStvMobility.getListSupports()) .then(result => { this.listSupports = result.data; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi.factory.stv.mobility.getLvsandLesByStudent(this.student.uid) + + this.$api + .call(ApiStvMobility.getLvsandLesByStudent(this.student.uid)) .then(result => { this.listLvsAndLes = result.data; }) diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Noten/Repeater.js b/public/js/components/Stv/Studentenverwaltung/Details/Noten/Repeater.js index a80b1e4c1..ee70a721c 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Noten/Repeater.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Noten/Repeater.js @@ -1,5 +1,7 @@ import {CoreFilterCmpt} from "../../../../filter/Filter.js"; +import ApiStvGrades from '../../../../../api/factory/stv/grades.js'; + export default { components: { CoreFilterCmpt @@ -20,15 +22,10 @@ export default { tabulatorOptions() { return { ajaxURL: 'dummy', - ajaxRequestFunc: (url, config, params) => { - return this.$fhcApi.factory.stv.grades.getRepeaterGrades(params.prestudent_id, params.stdsem); - }, - ajaxParams: () => { - return { - prestudent_id: this.student.prestudent_id, - stdsem: this.allSemester - }; - }, + ajaxRequestFunc: () => this.$api.call(ApiStvGrades.getRepeaterGrades( + this.student.prestudent_id, + this.allSemester + )), ajaxResponse: (url, params, response) => { return response.data || []; }, @@ -63,8 +60,11 @@ export default { methods: { copyGrades(selected) { const promises = selected.map( - grade => this.$fhcApi.factory - .stv.grades.copyRepeaterGradeToCertificate(grade) + grade => this.$api + .call( + ApiStvGrades.copyRepeaterGradeToCertificate(grade), + { errorHeader: grade.lv_bezeichnung } + ) .then(() => { this.$refs.table.tabulator.deselectRow(this.$refs.table.tabulator.getRows().find(el => el.getData() == grade).getElement()); }) diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Noten/Teacher.js b/public/js/components/Stv/Studentenverwaltung/Details/Noten/Teacher.js index c9ad0cb2f..171202163 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Noten/Teacher.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Noten/Teacher.js @@ -1,5 +1,7 @@ import {CoreFilterCmpt} from "../../../../filter/Filter.js"; +import ApiStvGrades from '../../../../../api/factory/stv/grades.js'; + export default { components: { CoreFilterCmpt @@ -20,15 +22,10 @@ export default { tabulatorOptions() { return { ajaxURL: 'dummy', - ajaxRequestFunc: (url, config, params) => { - return this.$fhcApi.factory.stv.grades.getTeacherProposal(params.prestudent_id, params.stdsem); - }, - ajaxParams: () => { - return { - prestudent_id: this.student.prestudent_id, - stdsem: this.allSemester - }; - }, + ajaxRequestFunc: () => this.$api.call(ApiStvGrades.getTeacherProposal( + this.student.prestudent_id, + this.allSemester + )), ajaxResponse: (url, params, response) => { return response.data || []; }, @@ -63,8 +60,10 @@ export default { methods: { copyGrades(selected) { const promises = selected.map( - grade => this.$fhcApi.factory - .stv.grades.copyTeacherProposalToCertificate(grade) + grade => this.$api + .call(ApiStvGrades.copyTeacherProposalToCertificate(grade), { + errorHeader: grade.lehrveranstaltung_bezeichnung + }) .then(() => { this.$refs.table.tabulator.deselectRow(this.$refs.table.tabulator.getRows().find(el => el.getData() == grade).getElement()); }) diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis.js b/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis.js index 6e2038193..81745897d 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis.js @@ -2,6 +2,8 @@ import {CoreFilterCmpt} from "../../../../filter/Filter.js"; import ZeugnisActions from './Zeugnis/Actions.js'; import ZeugnisDocuments from './Zeugnis/Documents.js'; +import ApiStvGrades from '../../../../../api/factory/stv/grades.js'; + export default { components: { CoreFilterCmpt, @@ -42,8 +44,8 @@ export default { }, computed: { tabulatorOptions() { - const listPromise = this.$fhcApi.factory - .stv.grades.list() + const listPromise = this.$api + .call(ApiStvGrades.list()) .then(res => res.data.map(({bezeichnung: label, note: value}) => ({label, value}))); let gradeField = { @@ -76,7 +78,7 @@ export default { note_bezeichnung })) // send to backend - .then(this.$fhcApi.factory.stv.grades.updateCertificate) + .then(data => this.$api.call(ApiStvGrades.updateCertificate(data))) // get bezeichnung again .then(() => listPromise) .then(list => list.find(el => el.value == note)) @@ -97,8 +99,14 @@ export default { gradeField.editorParams = { valuesLookup: (cell, filterTerm) => { if (filterTerm) { - return this.$fhcApi.factory - .stv.grades.getGradeFromPoints(filterTerm, cell.getData().lehrveranstaltung_id, true) + return this.$api + .call( + ApiStvGrades.getGradeFromPoints( + filterTerm, + cell.getData().lehrveranstaltung_id + ), + { errorHandling: false } + ) .then(result => result.data === null ? [] @@ -191,15 +199,10 @@ export default { return { ajaxURL: 'dummy', - ajaxRequestFunc: (url, config, params) => { - return this.$fhcApi.factory.stv.grades.getCertificate(params.prestudent_id, params.stdsem); - }, - ajaxParams: () => { - return { - prestudent_id: this.student.prestudent_id, - stdsem: this.allSemester - }; - }, + ajaxRequestFunc: () => this.$api.call(ApiStvGrades.getCertificate( + this.student.prestudent_id, + this.allSemester + )), ajaxResponse: (url, params, response) => { return response.data || []; }, @@ -221,8 +224,11 @@ export default { }, methods: { setGrade(data) { - this.$fhcApi.factory - .stv.grades.updateCertificate(data) + this.$api + .call( + ApiStvGrades.updateCertificate(data), + { errorHeader: data.lehrveranstaltung_bezeichnung } + ) .then(this.$refs.table.reloadTable) .then(() => this.$fhcAlert.alertSuccess(this.$p.t('stv/grades_updated'))) .catch(this.$fhcAlert.handleFormValidation); @@ -232,7 +238,10 @@ export default { return this.$fhcAlert .confirmDelete() .then(result => result ? data : Promise.reject({handled:true})) - .then(this.$fhcApi.factory.stv.grades.deleteCertificate) + .then(data => this.$api.call( + ApiStvGrades.deleteCertificate(data), + { errorHeader: data.lehrveranstaltung_bezeichnung } + )) .then(this.$refs.table.reloadTable) .then(() => this.$fhcAlert.alertSuccess(this.$p.t('ui/successDelete'))) .catch(this.$fhcAlert.handleSystemError); diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis/Actions.js b/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis/Actions.js index b55573549..303098cf9 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis/Actions.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis/Actions.js @@ -2,6 +2,7 @@ import CoreForm from '../../../../../Form/Form.js'; import FormInput from '../../../../../Form/Input.js'; import ZeugnisDocuments from './Documents.js'; +import ApiStvGrades from '../../../../../../api/factory/stv/grades.js'; export default { components: { @@ -62,8 +63,11 @@ export default { if (!query) { return this.suggestions = this.grades; } - this.$refs.points.factory - .stv.grades.getGradeFromPoints(query, this.selected.find(Boolean)?.lehrveranstaltung_id) + this.$refs.points + .call(ApiStvGrades.getGradeFromPoints( + query, + this.selected.find(Boolean)?.lehrveranstaltung_id + )) .then(result => { if (result.data === null) { this.suggestions = []; @@ -84,8 +88,8 @@ export default { } }, created() { - this.$fhcApi.factory - .stv.grades.list() + this.$api + .call(ApiStvGrades.list()) .then(result => { this.grades = result.data; }) diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis/Documents.js b/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis/Documents.js index 4a02e9dfa..ed27dc283 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis/Documents.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Noten/Zeugnis/Documents.js @@ -1,8 +1,8 @@ // NOTE(chris): cache calls globally to prevent multiple calls on the same source const calledPermissionUrls = {}; -async function callPermissionUrl($fhcApi, url) { +async function callPermissionUrl($api, url) { if (!calledPermissionUrls[url]) { - calledPermissionUrls[url] = $fhcApi.get(url); + calledPermissionUrls[url] = $api.get(url); } return (await calledPermissionUrls[url]).data; } @@ -42,7 +42,7 @@ export default { for (const k in this.data) { permissioncheckUrl = permissioncheckUrl.replace("{" + k + "}", this.data[k]); } - if (!await callPermissionUrl(this.$fhcApi, permissioncheckUrl)) + if (!await callPermissionUrl(this.$api, permissioncheckUrl)) continue; } const item = {label: part.title}; @@ -60,7 +60,7 @@ export default { ? this.data[value.slice(1,-1)] : value ); - this.$fhcApi + this.$api .post(this.addParamsToString(part.action.url), post) .then(() => part.action.response || this.$p.t('ui/successSave')) .then(this.$fhcAlert.alertSuccess) diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js index 7fed33d0e..5dfe58325 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Notizen.js @@ -1,5 +1,7 @@ import CoreNotiz from "../../../Notiz/Notiz.js"; +import ApiNotizPerson from '../../../../api/factory/notiz/person.js'; + export default { components: { CoreNotiz @@ -7,12 +9,17 @@ export default { props: { modelValue: Object }, + data() { + return { + endpoint: ApiNotizPerson + }; + }, template: `
result.data) .then(result => { this.data = result; @@ -100,8 +103,9 @@ export default { udfsLoaded(udfs) { this.initialFormData = {...(this.initialFormData || {}), ...udfs}; }, - updatePrestudent(){ - return this.$fhcApi.factory.stv.prestudent.updatePrestudent(this.$refs.form, this.modelValue.prestudent_id, this.deltaArray) + updatePrestudent() { + return this.$refs.form + .call(ApiStvPrestudent.updatePrestudent(this.modelValue.prestudent_id, this.deltaArray)) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); this.initialFormData = {...this.data}; @@ -116,55 +120,64 @@ export default { }, created() { this.loadPrestudent(); - this.$fhcApi.factory.stv.prestudent.getBezeichnungZGV() + this.$api + .call(ApiStvPrestudent.getBezeichnungZGV()) .then(result => result.data) .then(result => { this.listZgvs = result; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi.factory.stv.prestudent.getBezeichnungMZgv() + this.$api + .call(ApiStvPrestudent.getBezeichnungMZgv()) .then(result => result.data) .then(result => { this.listZgvsmaster = result; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi.factory.stv.prestudent.getBezeichnungDZgv() + this.$api + .call(ApiStvPrestudent.getBezeichnungDZgv()) .then(result => result.data) .then(result => { this.listZgvsdoktor = result; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi.factory.stv.prestudent.getStgs() + this.$api + .call(ApiStvPrestudent.getStgs()) .then(result => result.data) .then(result => { this.listStgs = result; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi.factory.stv.prestudent.getAusbildung() + this.$api + .call(ApiStvPrestudent.getAusbildung()) .then(result => result.data) .then(result => { this.listAusbildung = result; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi.factory.stv.prestudent.getAufmerksamdurch() + this.$api + .call(ApiStvPrestudent.getAufmerksamdurch()) .then(result => result.data) .then(result => { this.listAufmerksamdurch = result; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi.factory.stv.prestudent.getBerufstaetigkeit() + this.$api + .call(ApiStvPrestudent.getBerufstaetigkeit()) .then(result => result.data) .then(result => { this.listBerufe = result; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi.factory.stv.prestudent.getTypenStg() + this.$api + .call(ApiStvPrestudent.getTypenStg()) .then(result => result.data) .then(result => { this.listStgTyp = result; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi.factory.stv.prestudent.getBisstandort() + this.$api + .call(ApiStvPrestudent.getBisstandort()) .then(result => result.data) .then(result => { this.listBisStandort = result; diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/History.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/History.js index f573e6d85..0bcb8be72 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/History.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/History.js @@ -1,5 +1,7 @@ import {CoreFilterCmpt} from "../../../../filter/Filter.js"; +import ApiStvPrestudent from '../../../../../api/factory/stv/prestudent.js'; + export default{ components: { CoreFilterCmpt @@ -12,12 +14,7 @@ export default{ return { tabulatorOptions: { ajaxURL: 'dummy', - ajaxRequestFunc: this.$fhcApi.factory.stv.prestudent.getHistoryPrestudents, - ajaxParams: () => { - return { - id: this.personId - }; - }, + ajaxRequestFunc: () => this.$api.call(ApiStvPrestudent.getHistoryPrestudents(this.personId)), ajaxResponse: (url, params, response) => response.data, //autoColumns: true, columns:[ @@ -68,11 +65,7 @@ export default{ }, watch: { personId() { - this.$fhcApi.factory.stv.prestudent.getHistoryPrestudents(this.personId) - .then(result => { - this.$refs.table.tabulator.setData(result.data); - }) - .catch(this.$fhcAlert.handleSystemError); // Handle any errors + this.$refs.table.reloadTable(); }, }, template: ` diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js index 2ea9cd271..b6480c583 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js @@ -5,6 +5,8 @@ import FormInput from '../../../../Form/Input.js'; import StatusModal from '../Status/Modal.js'; import StatusDropdown from '../Status/Dropdown.js'; +import ApiStvPrestudent from '../../../../../api/factory/stv/prestudent.js'; + export default{ components: { CoreFilterCmpt, @@ -58,12 +60,7 @@ export default{ return { tabulatorOptions: { ajaxURL: 'dummy', - ajaxRequestFunc: this.$fhcApi.factory.stv.prestudent.getHistoryPrestudent, - ajaxParams: () => { - return { - id: this.modelValue.prestudent_id - }; - }, + ajaxRequestFunc: () => this.$api.call(ApiStvPrestudent.getHistoryPrestudent(this.modelValue.prestudent_id)), ajaxResponse: (url, params, response) => response.data, columns: [ {title: "Kurzbz", field: "status_kurzbz", tooltip: true}, @@ -322,7 +319,8 @@ export default{ ? [this.modelValue.studiengang_kz] : this.modelValue.map(prestudent => prestudent.studiengang_kz); this.maxSem = 0; - this.$fhcApi.factory.stv.prestudent.getMaxSem(studiengang_kzs) + this.$api + .call(ApiStvPrestudent.getMaxSem(studiengang_kzs)) .then(result => this.maxSem = result.data) .catch(this.$fhcAlert.handleSystemError); }, @@ -345,7 +343,7 @@ export default{ .then(result => { // If confirmed, check if this is the last status return result - ? this.$fhcApi.factory.stv.prestudent.isLastStatus(statusId.prestudent_id) + ? this.$api.call(ApiStvPrestudent.isLastStatus(statusId.prestudent_id)) : Promise.reject({handled: true}); }) .then(result => { @@ -359,7 +357,7 @@ export default{ }) .then(result => { return result - ? this.$fhcApi.factory.stv.prestudent.deleteStatus(statusId) + ? this.$api.call(ApiStvPrestudent.deleteStatus(statusId)) : Promise.reject({handled: true}); }) .then(() => { @@ -376,7 +374,8 @@ export default{ studiensemester_kurzbz: stdsem, ausbildungssemester: ausbildungssemester }; - return this.$fhcApi.factory.stv.prestudent.advanceStatus(statusId) + return this.$api + .call(ApiStvPrestudent.advanceStatus(statusId)) .then(() => this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successAdvance'))) .then(this.reload) .catch(this.$fhcAlert.handleSystemError); @@ -390,7 +389,7 @@ export default{ }; BsConfirm .popup(this.$p.t('stv', 'status_confirm_popup')) - .then(() => this.$fhcApi.factory.stv.prestudent.confirmStatus(statusId)) + .then(() => this.$api.call(ApiStvPrestudent.confirmStatus(statusId))) .then(() => this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successConfirm'))) .then(this.reload) .catch(this.$fhcAlert.handleSystemError); @@ -402,7 +401,8 @@ export default{ }, created() { this.getMaxSem(); - this.$fhcApi.factory.stv.prestudent.getLastBismeldestichtag() + this.$api + .call(ApiStvPrestudent.getLastBismeldestichtag()) .then(result => { this.dataMeldestichtag = result.data[0].meldestichtag; if (this.$refs.table && this.$refs.table.tableBuilt) diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js b/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js index fc3e1acfa..cb545cfed 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Pruefung/Pruefunglist.js @@ -3,6 +3,8 @@ import FormInput from "../../../../Form/Input.js"; import FormForm from '../../../../Form/Form.js'; import BsModal from "../../../../Bootstrap/Modal.js"; +import ApiStvExam from '../../../../../api/factory/stv/exam.js'; + export default{ components: { CoreFilterCmpt, @@ -29,12 +31,7 @@ export default{ return { tabulatorOptions: { ajaxURL: 'dummy', - ajaxRequestFunc: this.$fhcApi.factory.stv.exam.getPruefungen, - ajaxParams: () => { - return { - id: this.uid - }; - }, + ajaxRequestFunc: () => this.$api.call(ApiStvExam.getPruefungen(this.uid)), ajaxResponse: (url, params, response) => response.data, columns: [ {title: "Datum", field: "format_datum"}, @@ -168,7 +165,8 @@ export default{ }, methods:{ loadPruefung(pruefung_id) { - return this.$fhcApi.factory.stv.exam.loadPruefung(pruefung_id) + return this.$api + .call(ApiStvExam.loadPruefung(pruefung_id)) .then(result => { this.pruefungData = result.data; return result; @@ -226,8 +224,9 @@ export default{ }); }, - addPruefung(){ - return this.$fhcApi.factory.stv.exam.addPruefung(this.$refs.examData, this.pruefungData) + addPruefung() { + return this.$refs.examData + .call(ApiStvExam.addPruefung(this.pruefungData)) .then(response => { this.checkData = response.data; if (this.checkData === 2 || this.checkData === 5) @@ -244,13 +243,14 @@ export default{ }, updatePruefung(pruefung_id){ this.checkChangeAfterExamDate(); - return this.$fhcApi.factory.stv.exam.updatePruefung(this.$refs.examData, pruefung_id, this.pruefungData) - .then(response => { - this.checkData = response.data; - this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); - this.hideModal('pruefungModal'); - this.resetModal(); - }).catch(this.$fhcAlert.handleSystemError) + return this.$refs.examData + .call(ApiStvExam.updatePruefung(pruefung_id, this.pruefungData)) + .then(response => { + this.checkData = response.data; + this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); + this.hideModal('pruefungModal'); + this.resetModal(); + }).catch(this.$fhcAlert.handleSystemError) .finally(() => { window.scrollTo(0, 0); this.reload(); @@ -265,13 +265,14 @@ export default{ else this.showHint = false; }, - checkChangeAfterExamDate(){ + checkChangeAfterExamDate() { const data = { student_uid: this.pruefungData.student_uid, studiensemester_kurzbz: this.pruefungData.studiensemester_kurzbz, lehrveranstaltung_id: this.pruefungData.lehrveranstaltung_id }; - return this.$fhcApi.factory.stv.exam.checkZeugnisnoteLv(data) + return this.$api + .call(ApiStvExam.checkZeugnisnoteLv(data)) .then(result => { this.zeugnisData = result.data; let checkDate = this.zeugnisData[0].uebernahmedatum === '' || @@ -282,13 +283,16 @@ export default{ && this.pruefungData.note !== this.zeugnisData[0].note) { this.$fhcAlert.alertInfo(this.$p.t('exam', 'hinweis_changeAfterExamDate')); } - }).catch(this.$fhcAlert.handleSystemError); + }) + .catch(this.$fhcAlert.handleSystemError); }, deletePruefung(pruefung_id) { - return this.$fhcApi.factory.stv.exam.deletePruefung(pruefung_id) + return this.$api + .call(ApiStvExam.deletePruefung(pruefung_id)) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete')); - }).catch(this.$fhcAlert.handleSystemError) + }) + .catch(this.$fhcAlert.handleSystemError) .finally(()=> { window.scrollTo(0, 0); this.reload(); @@ -304,8 +308,9 @@ export default{ reload() { this.$refs.table.reloadTable(); }, - getMaFromLv(lv_id){ - return this.$fhcApi.factory.stv.exam.getMitarbeiterLv(lv_id) + getMaFromLv(lv_id) { + return this.$api + .call(ApiStvExam.getMitarbeiterLv(lv_id)) .then(result => { this.listMas = result.data; }) @@ -316,7 +321,8 @@ export default{ lv_id: lv_id, studiensemester_kurzbz: studiensemester_kurzbz }; - return this.$fhcApi.factory.stv.exam.getAllLehreinheiten(data) + return this.$api + .call(ApiStvExam.getAllLehreinheiten(data)) .then(response => { this.listLes = response.data; }) @@ -355,31 +361,37 @@ export default{ } }, }, - created(){ - this.$fhcApi.factory.stv.exam.getLvsByStudent(this.uid) + created() { + this.$api + .call(ApiStvExam.getLvsByStudent(this.uid)) .then(result => { this.listLvs = result.data; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi.factory.stv.exam.getLvsandLesByStudent(this.uid, this.currentSemester) + this.$api + .call(ApiStvExam.getLvsandLesByStudent(this.uid, this.currentSemester)) .then(result => { this.listLvsAndLes = result.data; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi.factory.stv.exam.getLvsAndMas(this.uid) + + this.$api + .call(ApiStvExam.getLvsAndMas(this.uid)) .then(result => { this.listLvsAndMas = result.data; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi.factory.stv.exam.getTypenPruefungen() + this.$api + .call(ApiStvExam.getTypenPruefungen()) .then(result => { this.listTypesExam = result.data; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi.factory.stv.exam.getNoten() + this.$api + .call(ApiStvExam.getNoten()) .then(result => { this.listMarks = result.data; }) diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Status/Dropdown.js b/public/js/components/Stv/Studentenverwaltung/Details/Status/Dropdown.js index 389f00da8..ab8f83fab 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Status/Dropdown.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Status/Dropdown.js @@ -3,6 +3,8 @@ import BsConfirm from "../../../../Bootstrap/Confirm.js"; import BsPrompt from "../../../../Bootstrap/Prompt.js"; import FormInput from '../../../../Form/Input.js'; +import ApiStvStatus from '../../../../../api/factory/stv/status.js'; + export default { components: { BsModal, @@ -142,7 +144,11 @@ export default { addStudent(data) { Promise .allSettled( - this.prestudentIds.map(prestudent_id => this.$fhcApi.factory.stv.status.addStudent(prestudent_id, data))) + this.prestudentIds.map(prestudent_id => this.$api.call( + ApiStvStatus.addStudent(prestudent_id, data), + { errorHeader: prestudent_id } + )) + ) .then(res => this.showFeedback(res, data.status_kurzbz)); }, changeStatusToAbbrecher(statusgrund_id) { @@ -238,7 +244,11 @@ export default { changeStatus(data) { Promise .allSettled( - this.prestudentIds.map(prestudent_id => this.$fhcApi.factory.stv.status.changeStatus(prestudent_id, data))) + this.prestudentIds.map(prestudent_id => this.$api.call( + ApiStvStatus.changeStatus(prestudent_id, data), + { errorHeader: prestudent_id } + )) + ) .then(res => this.showFeedback(res, data.status_kurzbz)); }, showFeedback(results, status_kurzbz) { @@ -259,7 +269,8 @@ export default { } }, created() { - this.$fhcApi.factory.stv.status.getStatusarray() + this.$api + .call(ApiStvStatus.getStatusarray()) .then(result => result.data) .then(result => { this.listDataToolbar = result; diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Status/Modal.js b/public/js/components/Stv/Studentenverwaltung/Details/Status/Modal.js index fe049f11b..bb78200ba 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Status/Modal.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Status/Modal.js @@ -3,6 +3,8 @@ import CoreForm from '../../../../Form/Form.js'; import FormValidation from '../../../../Form/Validation.js'; import FormInput from '../../../../Form/Input.js'; +import ApiStvStatus from '../../../../../api/factory/stv/status.js'; + export default{ components: { BsModal, @@ -128,7 +130,8 @@ export default{ ausbildungssemester }; - this.$fhcApi.factory.stv.status.loadStatus(this.statusId) + this.$api + .call(ApiStvStatus.loadStatus(this.statusId)) .then(result => { this.statusNew = false; this.formData = result.data; @@ -142,7 +145,8 @@ export default{ } }, insertStatus() { - this.$fhcApi.factory.stv.status.insertStatus(this.$refs.form, this.statusId, this.formData) + this.$refs.form + .call(ApiStvStatus.insertStatus(this.statusId, this.formData)) .then(result => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); this.$reloadList(); @@ -152,7 +156,8 @@ export default{ .catch(this.$fhcAlert.handleSystemError); }, editStatus() { - this.$fhcApi.factory.stv.status.updateStatus(this.$refs.form, this.statusId, this.formData) + this.$refs.form + .call(ApiStvStatus.updateStatus(this.statusId, this.formData)) .then(result => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); this.$reloadList(); @@ -167,19 +172,22 @@ export default{ if (old_id == prestudent.prestudent_id) return Promise.resolve(); - return this.$fhcApi.factory.stv.status.getStudienplaene(prestudent.prestudent_id) + return thid.$api + .call(ApiStvStatus.getStudienplaene(prestudent.prestudent_id)) .then(result => this.studienplaene = result.data) - .then(() => this.$fhcApi.factory.stv.status.getStudiengang(prestudent.prestudent_id)) + .then(() => this.$api.call(ApiStvStatus.getStudiengang(prestudent.prestudent_id))) .then(result => this.mischform = result.data.mischform); } }, created() { - this.$fhcApi.factory.stv.status.getStatusgruende() + this.$api + .call(ApiStvStatus.getStatusgruende()) .then(result => this.statusgruende = result.data) .catch(this.$fhcAlert.handleSystemError); //TODO(Manu) check why it is/was hard coded - this.$fhcApi.factory.stv.status.getStati() + this.$api + .call(ApiStvStatus.getStati()) .then(result => this.stati = result.data) .catch(this.$fhcAlert.handleSystemError); /* this.stati = [ diff --git a/public/js/components/Stv/Studentenverwaltung/List.js b/public/js/components/Stv/Studentenverwaltung/List.js index a161963c9..94d5c51ec 100644 --- a/public/js/components/Stv/Studentenverwaltung/List.js +++ b/public/js/components/Stv/Studentenverwaltung/List.js @@ -107,6 +107,7 @@ export default { } }, + ajaxRequestFunc: (url, params) => this.$api.call({url, params}), ajaxResponse: (url, params, response) => response.data, layout: 'fitDataStretch', @@ -175,7 +176,7 @@ export default { } } }, - updateUrl(url, first) { + updateUrl(endpoint, first) { this.lastSelected = first ? undefined : this.selected; const params = {}, filter = {}; @@ -189,14 +190,14 @@ export default { if (!this.$refs.table.tableBuilt) { if (!this.$refs.table.tabulator) { - this.tabulatorOptions.ajaxURL = url; + this.tabulatorOptions.ajaxURL = endpoint.url; this.tabulatorOptions.ajaxParams = params; } else this.$refs.table.tabulator.on("tableBuilt", () => { - this.$refs.table.tabulator.setData(url, params); + this.$refs.table.tabulator.setData(endpoint.url, params); }); } else - this.$refs.table.tabulator.setData(url, params); + this.$refs.table.tabulator.setData(endpoint.url, params); }, onKeydown(e) { // TODO(chris): this should be in the filter component if (!this.focusObj) diff --git a/public/js/components/Stv/Studentenverwaltung/List/New.js b/public/js/components/Stv/Studentenverwaltung/List/New.js index f66d931b8..dc78aedb6 100644 --- a/public/js/components/Stv/Studentenverwaltung/List/New.js +++ b/public/js/components/Stv/Studentenverwaltung/List/New.js @@ -5,6 +5,8 @@ import FormValidation from '../../../Form/Validation.js'; import FormInput from '../../../Form/Input.js'; import accessibility from '../../../../directives/accessibility.js'; +import ApiStvStudents from '../../../../api/factory/stv/students.js'; + var _uuid = 0; const FORMDATA_DEFAULT = { address: { @@ -106,13 +108,13 @@ export default { return; this.abortController.suggestions = new AbortController(); - // TODO(chris): move to fhcapi.factory - this.$fhcApi - .post('api/frontend/v1/stv/student/check', { + + this.$api + .call(ApiStvStudents.check({ vorname: this.formData.vorname, nachname: this.formData.nachname, gebdatum: this.formData.gebdatum - }, { + }), { signal: this.abortController.suggestions.signal }) .then(result => this.suggestions = result.data) diff --git a/public/js/components/Stv/Studentenverwaltung/Verband.js b/public/js/components/Stv/Studentenverwaltung/Verband.js index d3562b5da..8ae2b6b40 100644 --- a/public/js/components/Stv/Studentenverwaltung/Verband.js +++ b/public/js/components/Stv/Studentenverwaltung/Verband.js @@ -5,6 +5,7 @@ import PvTree from "../../../../../index.ci.php/public/js/components/primevue/tr import PvTreetable from "../../../../../index.ci.php/public/js/components/primevue/treetable/treetable.esm.min.js"; import PvColumn from "../../../../../index.ci.php/public/js/components/primevue/column/column.esm.min.js"; +import ApiStvVerband from '../../../api/factory/stv/verband.js'; export default { components: { @@ -54,8 +55,8 @@ export default { }); this.loading = true; - this.$fhcApi - .get('api/frontend/v1/stv/verband/' + node.data.link) + this.$api + .call(ApiStvVerband.get(node.data.link)) .then(result => result.data) .then(result => { const subNodes = result.map(this.mapResultToTreeData); @@ -106,8 +107,10 @@ export default { this.favnodes = await this.loadNodes(this.favorites.list); } this.favorites.on = !this.favorites.on; - this.$fhcApi - .factory.stv.verband.favorites.set(JSON.stringify(this.favorites)); + this.$api + .call(ApiStvVerband.favorites.set( + JSON.stringify(this.favorites) + )); this.loading = false; }, async loadNodes(links) { @@ -131,8 +134,8 @@ export default { let promises = []; for (let parent in sortedInParents) promises.push( - this.$fhcApi - .get('api/frontend/v1/stv/verband/' + (parent == '_' ? '' : parent)) + this.$api + .call(ApiStvVerband.get(parent == '_' ? '' : parent)) .then(res => res.data) .then(res => res.filter(node => sortedInParents[parent].includes(node.link + ''))) ); @@ -158,8 +161,10 @@ export default { this.favorites.list.push(key.data.link + ''); } - this.$fhcApi - .factory.stv.verband.favorites.set(JSON.stringify(this.favorites)); + this.$api + .call(ApiStvVerband.favorites.set( + JSON.stringify(this.favorites) + )); }, unsetFavFocus(e) { if (e.target.dataset?.linkFavAdd !== undefined) { @@ -179,16 +184,16 @@ export default { } }, mounted() { - this.$fhcApi - .factory.stv.verband.get() + this.$api + .call(ApiStvVerband.get()) .then(result => { this.nodes = result.data.map(this.mapResultToTreeData); this.loading = false; }) .catch(this.$fhcAlert.handleSystemError); - this.$fhcApi - .factory.stv.verband.favorites.get() + this.$api + .call(ApiStvVerband.favorites.get()) .then(result => { if (result.data) { let f = JSON.parse(result.data); diff --git a/public/js/components/Tabs.js b/public/js/components/Tabs.js index cde12e02b..bd81f44f5 100644 --- a/public/js/components/Tabs.js +++ b/public/js/components/Tabs.js @@ -61,7 +61,7 @@ export default { .then(this.initConfig) .catch(this.$fhcAlert.handleSystemError); if (typeof config === 'string' || config instanceof String) - return this.$fhcApi + return this.$api .get(config) .then(result => result.data) .then(this.initConfig) diff --git a/public/js/components/Udf/Udf.js b/public/js/components/Udf/Udf.js index 89f3a2fbc..c765d8a14 100644 --- a/public/js/components/Udf/Udf.js +++ b/public/js/components/Udf/Udf.js @@ -1,6 +1,7 @@ import { CoreFetchCmpt } from '../Fetch.js'; import FormInput from '../Form/Input.js'; +import ApiUdf from '../../api/udf.js'; export default { components: { @@ -72,9 +73,7 @@ export default { }, methods: { loadF(params) { - // TODO(chris): move to fhcapi.factory - return this.$fhcApi - .post('/api/frontend/v1/udf/load/' + params.ciModel, params.pk); + return this.$api.call(ApiUdf.load(params)); }, init(result) { const fields = result.map(el => { diff --git a/public/js/components/filter/Filter.js b/public/js/components/filter/Filter.js index 9c2a13529..cf02dccf5 100644 --- a/public/js/components/filter/Filter.js +++ b/public/js/components/filter/Filter.js @@ -23,6 +23,8 @@ import collapseAutoClose from '../../directives/collapseAutoClose.js'; import moduleLayoutFitDataStretchFrozen from '../../tabulator/layouts/fitDataStretchFrozen.js'; +import ApiFilter from '../../api/factory/filter.js'; + // const FILTER_COMPONENT_NEW_FILTER = 'Filter Component New Filter'; const FILTER_COMPONENT_NEW_FILTER_TYPE = 'Filter Component New Filter Type'; @@ -333,10 +335,14 @@ export const CoreFilterCmpt = { */ getFilter() { if (this.selectedFilter === null) - this.startFetchCmpt(this.$fhcApi.factory.filter.getFilter, null, this.render); + this.startFetchCmpt( + wsParams => this.$api.call(ApiFilter.getFilter(wsParams)), + null, + this.render + ); else this.startFetchCmpt( - this.$fhcApi.factory.filter.getFilterById, + wsParams => this.$api.call(ApiFilter.getFilterById(wsParams)), { filterId: this.selectedFilter }, @@ -509,7 +515,7 @@ export const CoreFilterCmpt = { this.selectedFilter = null; // this.startFetchCmpt( - this.$fhcApi.factory.filter.saveCustomFilter, + wsParams => this.$api.call(ApiFilter.saveCustomFilter(wsParams)), { customFilterName }, @@ -525,7 +531,7 @@ export const CoreFilterCmpt = { this.selectedFilter = null; // this.startFetchCmpt( - this.$fhcApi.factory.filter.removeCustomFilter, + wsParams => this.$api.call(ApiFilter.removeCustomFilter(wsParams)), { filterId: filterId }, @@ -562,7 +568,7 @@ export const CoreFilterCmpt = { applyFilterConfig(filterFields) { this.selectedFilter = null; this.startFetchCmpt( - this.$fhcApi.factory.filter.applyFilterFields, + wsParams => this.$api.call(ApiFilter.applyFilterFields(wsParams)), { filterFields }, diff --git a/public/js/components/navigation/Navigation.js b/public/js/components/navigation/Navigation.js index 6bcd9baf5..1df8070b4 100644 --- a/public/js/components/navigation/Navigation.js +++ b/public/js/components/navigation/Navigation.js @@ -16,6 +16,7 @@ */ import {CoreFetchCmpt} from '../../components/Fetch.js'; +import ApiNavigation from '../../api/factory/navigation.js'; /** * @@ -76,13 +77,13 @@ export const CoreNavigationCmpt = { * */ fetchCmptApiFunctionHeader() { - return this.$fhcApi.factory.navigation.getHeader(this.getNavigationPage()); + return this.$api.call(ApiNavigation.getHeader(this.getNavigationPage())) }, /** * */ fetchCmptApiFunctionSideMenu() { - return this.$fhcApi.factory.navigation.getMenu(this.getNavigationPage()); + return this.$api.call(ApiNavigation.getMenu(this.getNavigationPage())) }, /** * diff --git a/public/js/plugin/FhcAlert.js b/public/js/plugin/FhcAlert.js index 07c13dde7..e7588b770 100644 --- a/public/js/plugin/FhcAlert.js +++ b/public/js/plugin/FhcAlert.js @@ -1,3 +1,4 @@ +console.warn('plugin/FhcAlert.js is DEPRECATED! Use plugins/FhcAlert.js instead.'); /** * Copyright (C) 2022 fhcomplete.org * diff --git a/public/js/plugin/FhcApi.js b/public/js/plugin/FhcApi.js index 0845a1a5e..f6fb6cc02 100644 --- a/public/js/plugin/FhcApi.js +++ b/public/js/plugin/FhcApi.js @@ -1,3 +1,4 @@ +console.warn('plugin/FhcApi.js is DEPRECATED! Use plugins/Api.js instead.'); import FhcAlert from './FhcAlert.js'; import FhcApiFactory from '../api/fhcapifactory.js'; @@ -5,9 +6,12 @@ import FhcApiFactory from '../api/fhcapifactory.js'; export default { install: (app, options) => { if (app.config.globalProperties.$fhcApi) { + /* Depricated Code start */ if (options?.factory) { + console.warn("$fhcApi is DEPRICATED!"); app.config.globalProperties.$fhcApi.factory.addEndpoints(options.factory); } + /* Depricated Code end */ return; } app.use(FhcAlert); @@ -297,11 +301,31 @@ export default { } }; + /* Depricated Code start */ class FhcApiFactoryWrapper { constructor(factorypart, root) { if (root === undefined) { - this.$fhcApi = app.config.globalProperties.$fhcApi; - this.$fhcApi.factory = this; + this.$fhcApi = { + getUri(url) { + console.warn('$fhcApi.factory is DEPRICATED!'); + return app.config.globalProperties.$fhcApi.getUri(url); + }, + get(form, uri, params, config) { + console.warn('$fhcApi.factory is DEPRICATED!'); + return app.config.globalProperties.$fhcApi.get(form, uri, params, config); + }, + post(form, uri, data, config) { + console.warn('$fhcApi.factory is DEPRICATED!'); + return app.config.globalProperties.$fhcApi.post(form, uri, data, config); + } + }; + Object.defineProperty(this.$fhcApi, 'factory', { + get() { + console.warn('$fhcApi.factory is DEPRICATED!'); + return app.config.globalProperties.$fhcApi.factory; + } + }); + app.config.globalProperties.$fhcApi.factory = this; } else { Object.defineProperty(this, '$fhcApi', { get() { @@ -323,15 +347,19 @@ export default { } }); }); + console.warn('$fhcApi.factory.addEndpoints() is DEPRICATED!'); } } const factory = new FhcApiFactoryWrapper(FhcApiFactory); - if (options?.factory) + if (options?.factory) { + console.warn("$fhcApi is DEPRICATED!"); factory.addEndpoints(options.factory); + } app.config.globalProperties.$fhcApi.factory = factory; - + /* Depricated Code end */ + app.provide('$fhcApi', app.config.globalProperties.$fhcApi); } }; \ No newline at end of file diff --git a/public/js/plugin/Phrasen.js b/public/js/plugin/Phrasen.js index fd2db9d9b..fc6ceab01 100644 --- a/public/js/plugin/Phrasen.js +++ b/public/js/plugin/Phrasen.js @@ -1,4 +1,7 @@ +console.warn('plugin/Phrasen.js is DEPRECATED! Use plugins/Phrasen.js instead.'); import FhcApi from './FhcApi.js'; +import PluginsApi from '../plugins/Api.js'; +import ApiPhrasen from '../api/factory/phrasen.js'; const categories = Vue.reactive({}); const loadingModules = {}; @@ -27,26 +30,32 @@ function getValueForLoadedPhrase(category, phrase, params) { const phrasen = { user_language, user_locale, - setLanguage(language, api) { + setLanguage(language) { const catArray = Object.keys(categories) - return api.factory.phrasen.setLanguage(catArray, language).then(res => { - res.data.forEach(row => { - categories[row.category][row.phrase] = row.text + return this.config.globalProperties.$api + .call(ApiPhrasen.setLanguage(catArray, language)) + .then(res => { + res.data.forEach(row => { + categories[row.category][row.phrase] = row.text + }) + + // update the reactive data that holds the current active user_language + user_language.value = language; + + return res }) - - // update the reactive data that holds the current active user_language - user_language.value = language; - - return res - }) }, loadCategory(category) { if (Array.isArray(category)) return Promise.all(category.map(this.config.globalProperties .$p.loadCategory)); + const $fhcApi = this.config.globalProperties.$fhcApi; + const $fhcApiFactory = this.config.globalProperties.$fhcApiFactory; if (!loadingModules[category]) - loadingModules[category] = this.config.globalProperties - .$fhcApi.factory.phrasen.loadCategory(category) + loadingModules[category] = this.config.globalProperties.$api + .call( + ApiPhrasen.loadCategory(category) + ) .then(res => res?.data ? extractCategory(res.data, category) : {}) .then(res => { categories[category] = res; @@ -83,10 +92,11 @@ const phrasen = { export default { install(app, options) { app.use(FhcApi, options?.fhcApi || undefined); + app.use(PluginsApi); app.config.globalProperties.$p = { t: phrasen.t, loadCategory: cat => phrasen.loadCategory.call(app, cat), - setLanguage: phrasen.setLanguage, + setLanguage: lang => phrasen.setLanguage.call(app, lang), user_language: user_language, user_locale, t_ref: phrasen.t_ref diff --git a/public/js/plugin/highchartsVue.js b/public/js/plugin/highchartsVue.js index 3a324db19..4c88e1772 100644 --- a/public/js/plugin/highchartsVue.js +++ b/public/js/plugin/highchartsVue.js @@ -1,3 +1,4 @@ +console.warn('plugin/highchartsVue.js is DEPRECATED! Use plugins/highchartsVue.js instead.'); function doCopy (copy, original, copyArray) { // Callback function to iterate on array or object elements function callback (value, key) { diff --git a/public/js/plugins/Api.js b/public/js/plugins/Api.js new file mode 100644 index 000000000..b087a6235 --- /dev/null +++ b/public/js/plugins/Api.js @@ -0,0 +1,316 @@ +import FhcAlert from './FhcAlert.js'; + + +export default { + install: (app, options) => { + if (app.config.globalProperties.$api) { + return; + } + app.use(FhcAlert); + + function _get_config(form, uri, data, config) { + if (typeof form == 'string' && config === undefined) { + [uri, data, config] = [form, uri, data]; + form = undefined; + } else if (form) { + if (typeof form != 'object') + throw new TypeError('Parameter 1 of _get_config must be an object or a string'); + if (uri === undefined && data === undefined && config === undefined) { + config = form; + form = undefined; + } + } + if (form) { + // NOTE(chris): check if form is fhc-form + if (!form.clearValidation || !form.setFeedback) + throw new TypeError("'form' is not a Form Component"); + + form = { + clearValidation: form.clearValidation, + setFeedback: form.setFeedback + }; + + if (config) + config.form = form; + else + config = {form}; + } + + return [uri, data, config]; + } + + function _clean_return_value(response) { + const result = response.data; + delete response.data; + if (!result.meta) + result.meta = {response}; + else + result.meta.response = response; + return result; + } + const baseURL = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + "/"; + const fhcApiAxios = axios.create({ + timeout: 500000, + baseURL: FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + "/" + }); + + fhcApiAxios.interceptors.request.use(config => { + if (config.method != 'post' || !config.data) + return config; + + if (config.data instanceof FormData) + return config; + + if (!Object.values(config.data).every(item => { + if (item instanceof FileList) + return false; + if (Array.isArray(item)) + return item.every(i => !(i instanceof File)); + return true; + })) { + const newData = Object.entries(config.data).reduce((nd, [key, item]) => { + if (item instanceof FileList) { + for (const file of item) + nd.FormData.append(key + (item.length > 1 ? '[]' : ''), file); + } else if (Array.isArray(item)) { + if (item.every(i => !(i instanceof File))) { + nd.jsondata[key] = item; + } else { + item.forEach(file => nd.FormData.append(key + (item.length > 1 ? '[]' : ''), file)); + } + } else { + nd.jsondata[key] = item; + } + return nd; + }, { + FormData: new FormData(), + jsondata: {} + }); + newData.FormData.append('_jsondata', JSON.stringify(newData.jsondata)); + config.data = newData.FormData; + } + + return config; + }); + + fhcApiAxios.interceptors.response.use(response => { + if (response.config?.errorHandling == 'off' + || response.config?.errorHandling === false + || response.config?.errorHandling == 'fail') + return _clean_return_value(response); + + // NOTE(chris): loop through errors + if (response.data.errors) + response.data.errors = response.data.errors.filter( + err => (response.config[err.type + 'ErrorHandler'] || app.config.globalProperties.$api._defaultErrorHandlers[err.type])(err, response.config) + ); + + return _clean_return_value(response); + }, error => { + if (error.code == 'ERR_CANCELED') + return Promise.reject({...{handled: true}, ...error}); + + if (error.config?.errorHandling == 'off' + || error.config?.errorHandling === false + || error.config?.errorHandling == 'success') + return Promise.reject(error); + + if (error.response) { + if (error.response.status == 404) { + app.config.globalProperties.$fhcAlert.alertDefault('error', error.message, error.request.responseURL, true); + return Promise.reject({...{handled: true}, ...error}); + } + + // NOTE(chris): loop through errors + error.response.data.errors = error.response.data.errors.filter( + err => (error.config[err.type + 'ErrorHandler'] || app.config.globalProperties.$api._defaultErrorHandlers[err.type])(err, error.config) + ); + if (!error.response.data.errors.length) + return Promise.reject({...{handled: true}, ...error}); + } else if (error.request) { + app.config.globalProperties.$fhcAlert.alertDefault('error', error.message, error.request.responseURL); + return Promise.reject({...{handled: true}, ...error}); + } else { + app.config.globalProperties.$fhcAlert.alertError(error.message); + return Promise.reject({...{handled: true}, ...error}); + } + + return Promise.reject(error); + }); + + app.config.globalProperties.$api = { + getUri(url) { + return fhcApiAxios.getUri({url}); + }, + get(form, uri, params, config) { + [uri, params, config] = _get_config(form, uri, params, config); + if (params) { + if (config) + config.params = params; + else + config = {params}; + } + return fhcApiAxios.get(uri, config); + }, + post(form, uri, data, config) { + [uri, data, config] = _get_config(form, uri, data, config); + return fhcApiAxios.post(uri, data, config); + }, + call(factory, configoverwrite, form) { + let {method, url, params, config} = factory; + if (configoverwrite !== undefined) { + config = configoverwrite; + } + if (!method) { + method = 'get'; + } + if (method.toLowerCase) + method = method.toLowerCase(); + if (method == 'get') { + return this.get(form, url, params, config); + } else if (method == 'post') { + return this.post(form, url, params, config); + } else { + console.error("FhcApi: method not allowed:", method); + } + }, + _defaultErrorHandlers: { + validation(error, config) { + const $fhcAlert = app.config.globalProperties.$fhcAlert; + + if (config?.form) { + config.form.clearValidation(); + config.form.setFeedback(false, error.messages); + return false; + } + if (Array.isArray(error.messages)) { + error.messages.forEach($fhcAlert.alertError); + return false; + } else if (typeof error.messages == 'object') { + if (config?.errorHeader) + Object.values(error.messages).forEach( + value => $fhcAlert.alertDefault( + 'error', + Array.isArray(config.errorHeader) ? app.config.globalProperties.$p.t.apply(null, config.errorHeader) : config.errorHeader, + value, + true + ) + ); + else + Object.entries(error.messages).forEach( + ([key, value]) => $fhcAlert.alertDefault('error', key, value, true) + ); + return false; + } + return true; + }, + general(error, config) { + const $fhcAlert = app.config.globalProperties.$fhcAlert; + + if (config?.form) + config.form.setFeedback(false, error.message); + else if (config?.errorHeader) + $fhcAlert.alertDefault( + 'error', + Array.isArray(config.errorHeader) ? app.config.globalProperties.$p.t.apply(null, config.errorHeader) : config.errorHeader, + error.message, + true + ); + else + $fhcAlert.alertError(error.message); + }, + php(error) { + const $fhcAlert = app.config.globalProperties.$fhcAlert; + + var message = ''; + message += 'Message: ' + error.message + '\n\n'; + message += 'Filename: ' + error.filename + '\n'; + message += 'Line Number: ' + error.line + '\n'; + if (error.backtrace && error.backtrace.length) { + message += '\nBacktrace: '; + error.backtrace.forEach(err => { + message += '\n\tFile: ' + err.file + '\n'; + message += '\tLine: ' + err.line + '\n'; + message += '\tFunction: ' + err.function + '\n'; + }); + } + switch (error.severity) { + case 'Warning': + case 'Core Warning': + case 'Compile Warning': + case 'User Warning': + $fhcAlert.alertDefault('warn', 'PHP ' + error.severity, message, true); + break; + case 'Notice': + case 'User Notice': + case 'Runtime Notice': + $fhcAlert.alertDefault('info', 'PHP ' + error.severity, message, true); + break; + default: + message = 'Type: PHP ' + error.severity + '\n\n' + message; + $fhcAlert.alertSystemError(message); + break; + } + }, + exception(error) { + const $fhcAlert = app.config.globalProperties.$fhcAlert; + + var message = ''; + message += 'Type: ' + error.class + '\n\n'; + message += 'Message: ' + error.message + '\n\n'; + message += 'Filename: ' + error.filename + '\n'; + message += 'Line Number: ' + error.line + '\n'; + if (error.backtrace && error.backtrace.length) { + message += '\nBacktrace: '; + error.backtrace.forEach(err => { + message += '\n\tFile: ' + err.file + '\n'; + message += '\tLine: ' + err.line + '\n'; + message += '\tFunction: ' + err.function + '\n'; + }); + } + $fhcAlert.alertSystemError(message); + }, + db(error) { + const $fhcAlert = app.config.globalProperties.$fhcAlert; + + var message = ''; + if (error.heading !== undefined) + message += error.heading + '\n\n'; + if (error.code !== undefined) + message += 'Code: ' + error.code + '\n\n'; + if (error.sql !== undefined) + message += 'SQL: ' + error.sql + '\n\n'; + if (error.message !== undefined) + message += 'Message: ' + error.message + '\n\n'; + else if (error.messages !== undefined) + message += 'Messages: ' + error.messages.join('\n\t') + '\n\n'; + if (error.filename !== undefined) + message += 'Filename: ' + error.filename + '\n'; + if (error.line !== undefined) + message += 'Line Number: ' + error.line + '\n'; + + $fhcAlert.alertSystemError(message); + }, + auth(error, config) { + const $fhcAlert = app.config.globalProperties.$fhcAlert; + + var message = ''; + message += 'Controller name: ' + error.controller + '\n'; + message += 'Method name: ' + error.method + '\n'; + message += 'Required permissions: ' + error.required_permissions; + if (config?.errorHeader) + $fhcAlert.alertDefault( + 'error', + Array.isArray(config.errorHeader) ? app.config.globalProperties.$p.t.apply(null, config.errorHeader) : config.errorHeader, + error.message, + true + ); + else + $fhcAlert.alertDefault('error', error.message, message); + } + } + }; + + app.provide('$api', app.config.globalProperties.$api); + } +}; \ No newline at end of file diff --git a/public/js/plugins/FhcAlert.js b/public/js/plugins/FhcAlert.js new file mode 100644 index 000000000..18af65fcf --- /dev/null +++ b/public/js/plugins/FhcAlert.js @@ -0,0 +1,424 @@ +/** + * Copyright (C) 2022 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 . + * + * @usage: + * Preperations: + * Be sure to have PrimeVue loaded with the toast and confirmdialog + * components as primevue variable + * Install: + * Import this Plugin and install it with the app.use() function. + * Use: + * In your component you can call now the global property $fhcAlert + * which has the following functions: + * + * alertSuccess + * ------------ + * Displays a success message + * @param string message + * @return void + * + * alertInfo + * --------- + * Displays an info message + * @param string message + * @return void + * + * alertWarning + * ------------ + * Displays a warning + * @param string message + * @return void + * + * alertError + * ---------- + * Displays an error + * @param string message + * @return void + * + * alertSystemError + * ---------------- + * Displays an alert with the error details and a button to mail + * the error to the Support Team + * @param string message + * @return void + * + * confirmDelete + * ------------- + * Displays a confirmation dialog and returns a Promise which resolves + * with true or false depending und the pressed button. + * @return Promise + * + * alertDefault + * ------------ + * Displays an alert + * @param string severity can be 'success', 'info', 'warning', 'error' + * @param string title + * @param string message + * @param boolean sticky (optional) defaults to false + * @return void + * + * alertMultiple + * ------------- + * Displays multiple alerts + * @param array messageArray + * @param string severity (optional) defaults to 'info' + * @param string title (optional) defaults to 'Info' + * @param boolean sticky (optional) defaults to false + * @return void + * + * handleSystemError + * ----------------- + * Automatiticly determine how to display an system error and display it. + * This would be used in a catch block of an ajax call. + * @param mixed error + * @return void + * + * handleSystemMessage + * ------------------- + * Automatiticly determine how to display a message and display it. + * @param mixed message + * @return void + */ +import PvConfig from "../../../index.ci.php/public/js/components/primevue/config/config.esm.min.js"; +import PvToast from "../../../index.ci.php/public/js/components/primevue/toast/toast.esm.min.js"; +import PvConfirm from "../../../index.ci.php/public/js/components/primevue/confirmdialog/confirmdialog.esm.min.js"; +import PvConfirmationService from "../../../index.ci.php/public/js/components/primevue/confirmationservice/confirmationservice.esm.min.js"; + +import {CoreRESTClient} from '../RESTClient.js'; + +const helperAppContainer = document.createElement('div'); + +const helperApp = Vue.createApp({ + name: "FhcAlertApp", + components: { + PvToast, + PvConfirm + }, + methods: { + mailToUrl(slotProps) { + let mailTo = 'noreply@technikum-wien.at'; // TODO domain anpassen + let subject = 'Meldung%20Systemfehler'; + let body = ` + Danke, dass Sie uns den Fehler melden. %0D%0A %0D%0A + Bitte beschreiben Sie uns ausführlich das Problem.%0D%0A + Bsp: Ich habe X ausgewählt und Y angelegt. Beim Speichern erhielt ich die Fehlermeldung. [Optional: Ich habe den Browser Z verwendet.]%0D%0A + -----------------------------------------------------------------------------------------------------------------------------------%0D%0A + PROBLEM: ... %0D%0A %0D%0A %0D%0A + + -----------------------------------------------------------------------------------------------------------------------------------%0D%0A + Fehler URL: ` + FHC_JS_DATA_STORAGE_OBJECT.called_path + '/' + FHC_JS_DATA_STORAGE_OBJECT.called_method + `%0D%0A + Fehler Meldung: ` + slotProps.message.detail + `%0D%0A + -----------------------------------------------------------------------------------------------------------------------------------%0D%0A %0D%0A + Wir kümmern uns um eine rasche Behebung des Problems!` + + return "mailto:" + mailTo + "?subject=" + subject + "&body=" + body; + }, + openMessagecard(e) { + bootstrap.Collapse.getOrCreateInstance(e.target.getAttribute('href')).toggle(); + } + }, + unmounted() { + helperAppContainer.parentElement.removeChild(helperAppContainer); + }, + template: ` + + + + + ` +}); + +helperApp.use(PvConfig); +helperApp.use(PvConfirmationService); + +const helperAppInstance = helperApp.mount(helperAppContainer); + +document.body.appendChild(helperAppContainer); + + +export default { + install: (app, options) => { + const $fhcAlert = { + alertSuccess(message) { + if (Array.isArray(message)) + return message.forEach(this.alertSuccess); + helperAppInstance.$refs.toast.add({ severity: 'success', summary: 'Info', detail: message, life: 1000}); + }, + alertInfo(message) { + if (Array.isArray(message)) + return message.forEach(this.alertInfo); + helperAppInstance.$refs.toast.add({ severity: 'info', summary: 'Info', detail: message, life: 3000 }); + }, + alertWarning(message) { + if (Array.isArray(message)) + return message.forEach(this.alertWarning); + helperAppInstance.$refs.toast.add({ severity: 'warn', summary: 'Achtung', detail: message}); + }, + alertError(message) { + if (Array.isArray(message)) + return message.forEach(this.alertError); + helperAppInstance.$refs.toast.add({ severity: 'error', summary: 'Achtung', detail: message }); + }, + alertSystemError(message) { + if (Array.isArray(message)) + return message.forEach(this.alertSystemError); + helperAppInstance.$refs.alert.add({ severity: 'error', summary: 'Systemfehler', detail: message}); + }, + confirmDelete() { + return new Promise((resolve, reject) => { + helperAppInstance.$confirm.require({ + group: 'fhcAlertConfirm', + header: 'Achtung', + message: 'Möchten Sie sicher löschen?', + acceptLabel: 'Löschen', + acceptClass: 'p-button-danger', + rejectLabel: 'Abbrechen', + rejectClass: 'p-button-secondary', + accept() { + resolve(true); + }, + reject() { + resolve(false); + }, + }); + }); + }, + confirm(options) { + return new Promise((resolve, reject) => { + helperAppInstance.$confirm.require({ + group: options?.group ?? 'fhcAlertConfirm', + header: options?.header ?? 'Achtung', + message: options?.message ?? '', + acceptLabel: options?.acceptLabel ?? 'Ok', + acceptClass: options?.acceptClass ?? 'btn btn-primary', + rejectLabel: options?.rejectLabel ?? 'Abbrechen', + rejectClass: options?.rejectClass ?? 'btn btn-outline-secondary', + accept() { + resolve(true); + }, + reject() { + resolve(false); + }, + }); + }); + }, + alertDefault(severity, title, message, sticky = false) { + let options = { severity: severity, summary: title, detail: message}; + + if (!sticky) + options.life = 3000; + + helperAppInstance.$refs.toast.add(options); + }, + alertMultiple(messageArray, severity = 'info', title = 'Info', sticky = false){ + // Check, if array has only string values + if (messageArray.every(message => typeof message === 'string')) { + messageArray.forEach(message => this.alertDefault(severity, title, message, sticky)); + return true; + } + return false; + }, + handleSystemError(error) { + // don't show an error message to the user if the error was an aborted request + if(error.hasOwnProperty('name') && error.name.toLowerCase() === "AbortError".toLowerCase()) + return; + + // Error is string + if (typeof error === 'string') + return $fhcAlert.alertSystemError(error); + + // Error is array of strings + if (Array.isArray(error) && error.every(err => typeof err === 'string')) + return error.every($fhcAlert.alertSystemError); + + // Error has been handled already + if (error.hasOwnProperty('handled') && error.handled) + return; + + // Error is object + if (typeof error === 'object' && error !== null) { + let errMsg = ''; + + + if (error.hasOwnProperty('response') && error.response?.data?.retval) + errMsg += 'Error Message: ' + (error.response.data.retval.message || error.response.data.retval) + '\r\n'; + else if (error.hasOwnProperty('message')) + errMsg += 'Error Message: ' + error.message.toUpperCase() + '\r\n'; + + if (error.hasOwnProperty('config') && error.config.hasOwnProperty('url')) + errMsg += 'Error ConfigURL: ' + error.config.url + '\r\n'; + + if (error.hasOwnProperty('stack')) + errMsg += 'Error Stack: ' + error.stack + '\r\n'; + + // Fallback object error message + if (errMsg == '') + errMsg = 'Error Message: ' + JSON.stringify(error) + '\r\n'; + + errMsg += 'Error Controller Path: ' + FHC_JS_DATA_STORAGE_OBJECT.called_path + '/' + FHC_JS_DATA_STORAGE_OBJECT.called_method; + + return $fhcAlert.alertSystemError(errMsg); + } + + // Fallback + $fhcAlert.alertSystemError('alertSystemError throws Generic Error\r\nError Controller Path: ' + FHC_JS_DATA_STORAGE_OBJECT.called_path + '/' + FHC_JS_DATA_STORAGE_OBJECT.called_method); + }, + handleSystemMessage(message) { + // Message is string + if (typeof message === 'string') + return $fhcAlert.alertWarning(message); + + // Message is array of strings + if (Array.isArray(message)) { + // If Array has only Strings + if (message.every(msg => typeof msg === 'string')) + return message.every($fhcAlert.alertWarning); + + // If Array has only Objects + if (message.every(msg => typeof msg === 'object') && msg !== null) { + return message.every(msg => { + if (msg.hasOwnProperty('data') && msg.data.hasOwnProperty('retval')) { + $fhcAlert.alertWarning(JSON.stringify(msg.data.retval)); + } else { + $fhcAlert.alertSystemError(JSON.stringify(msg)); + } + }); + } + } + + // Message is Object with data property + if (typeof message === 'object' && message !== null){ + if (message.hasOwnProperty('data') && message.data.hasOwnProperty('retval')) { + // NOTE(chris): changed: alertSystemError => alertWarning + $fhcAlert.alertWarning(JSON.stringify(message.data.retval)); + } else { + $fhcAlert.alertSystemError(JSON.stringify(message)); + } + return; + } + + // Fallback + $fhcAlert.alertSystemError('alertSystemError throws Generic Error\r\nError Controller Path: ' + FHC_JS_DATA_STORAGE_OBJECT.called_path + '/' + FHC_JS_DATA_STORAGE_OBJECT.called_method); + }, + resetFormValidation(form) { + const event = new Event('fhc-form-reset'); + form.querySelectorAll(['[data-fhc-form-validate],[data-fhc-form-error]']).forEach(el => el.dispatchEvent(event)); + /*const alert = form.querySelector('div.alert.alert-danger[role="alert"]'); + if (alert) { + alert.innerHTML = ''; + alert.classList.add('d-none'); + } + form.querySelectorAll('.invalid-feedback').forEach(n => n.remove()); + form.querySelectorAll('.is-invalid').forEach(n => n.classList.remove('is-invalid')); + form.querySelectorAll('.is-valid').forEach(n => n.classList.remove('is-valid'));*/ + }, + handleFormValidation(error, form) { + if (form === undefined) { + if (error && error.nodeType === Node.ELEMENT_NODE) + return err => $fhcAlert.handleFormValidation(err, error); + } else { + if (error?.response?.status == 400) { + let errors = CoreRESTClient.getError(error.response.data); + if (typeof errors !== "object") + errors = error.response.data; + + // NOTE(chris): reset form validation + $fhcAlert.resetFormValidation(form); + + // NOTE(chris): set form input validation + const notFound = Object.entries(errors).filter(([key, detail]) => { + const input = form.querySelector('[data-fhc-form-validate="' + key + '"]'); + if (!input) + return true; + + input.dispatchEvent(new CustomEvent('fhc-form-invalidate', {detail})); + + /*const input = form.querySelector('[name="' + key + '"]'); + if (!input) + return true; + input.classList.add('is-invalid'); + const feedback = document.createElement('div'); + feedback.classList.add('invalid-feedback'); + feedback.innerHTML = detail; + input.after(feedback);*/ + return false; + }).map(arr => arr[1]); + + + //const alert = form.querySelector('div.alert.alert-danger[role="alert"]'); + const alert = form.querySelector('[data-fhc-form-error]'); + if (alert && notFound.length) { + alert.dispatchEvent(new CustomEvent('fhc-form-error', {detail: notFound})); + /*notFound.forEach(txt => { + const p = document.createElement('p'); + p.innerHTML = txt; + alert.append(p); + }); + + if (notFound.length) { + alert.lastChild.classList.add('mb-0'); + alert.classList.remove('d-none'); + }*/ + } else { + notFound.forEach($fhcAlert.alertError); + } + return; + } + } + + if (error?.response?.status == 400) { + let errors = CoreRESTClient.getError(error.response.data); + $fhcAlert.alertError((typeof errors === 'object') ? Object.values(errors) : errors); + } else { + $fhcAlert.handleSystemError(error); + } + } + }; + app.config.globalProperties.$fhcAlert = $fhcAlert; + app.provide('$fhcAlert', app.config.globalProperties.$fhcAlert); + } +} \ No newline at end of file diff --git a/public/js/plugins/Phrasen.js b/public/js/plugins/Phrasen.js new file mode 100644 index 000000000..5ec223255 --- /dev/null +++ b/public/js/plugins/Phrasen.js @@ -0,0 +1,100 @@ +import PluginsApi from './Api.js'; +import ApiPhrasen from '../api/factory/phrasen.js'; + +const categories = Vue.reactive({}); +const loadingModules = {}; +let user_language = Vue.ref(FHC_JS_DATA_STORAGE_OBJECT.user_language); +export let user_locale = Vue.computed(()=>{ + if(!user_language.value) return null; + return FHC_JS_DATA_STORAGE_OBJECT.server_languages.find(language => language.sprache == user_language.value).LC_Time; +}); + +function extractCategory(obj, category) { + return obj.filter(e => e.category == category).reduce((res, elem) => { + if (!res[elem.phrase]) + res[elem.phrase] = elem.text; + return res; + }, {}); +} +function getValueForLoadedPhrase(category, phrase, params) { + let result = categories[category][phrase]; + if (!result) + return '<< PHRASE ' + phrase + '>>'; + if (params) + result = result.replace(/\{([^}]*)\}/g, (match, p1) => params[p1] === undefined ? match : params[p1]); + return result; +} + +const phrasen = { + user_language, + user_locale, + setLanguage(language) { + const catArray = Object.keys(categories) + return this.config.globalProperties.$api + .call(ApiPhrasen.setLanguage(catArray, language)) + .then(res => { + res.data.forEach(row => { + categories[row.category][row.phrase] = row.text + }) + + // update the reactive data that holds the current active user_language + user_language.value = language; + + return res + }) + }, + loadCategory(category) { + if (Array.isArray(category)) + return Promise.all(category.map(this.config.globalProperties + .$p.loadCategory)); + + if (!loadingModules[category]) + loadingModules[category] = this.config.globalProperties.$api + .call(ApiPhrasen.loadCategory(category)) + .then(res => res?.data ? extractCategory(res.data, category) : {}) + .then(res => { + categories[category] = res; + }); + return loadingModules[category]; + }, + t_ref(category, phrase, params) { + console.warn('deprecated'); + return Vue.computed(() => this.t(category, phrase, params)); + }, + t(category, phrase, params) { + if (params === undefined && ( + (Array.isArray(category) && category.length == 2) || + (category.split && category.split('/').length == 2)) + ) { + params = phrase; + [category, phrase] = category.split ? category.split('/') : category; + } + if (phrase === undefined) { + console.error('invalid input', category, phrase, params); + return ''; + } + let val = Vue.computed(() => { + if (!categories[category]) + return ''; + return getValueForLoadedPhrase(category, phrase, params); + }); + if (!categories[category]) + this.loadCategory(category); + return val.value; + } +}; + +export default { + install(app, options) { + app.use(PluginsApi); + app.config.globalProperties.$p = { + t: phrasen.t, + loadCategory: cat => phrasen.loadCategory.call(app, cat), + setLanguage: lang => phrasen.setLanguage.call(app, lang), + user_language: user_language, + user_locale, + t_ref: phrasen.t_ref + }; + app.provide('$p', app.config.globalProperties.$p); + } +} \ No newline at end of file diff --git a/public/js/plugins/highchartsVue.js b/public/js/plugins/highchartsVue.js new file mode 100644 index 000000000..3a324db19 --- /dev/null +++ b/public/js/plugins/highchartsVue.js @@ -0,0 +1,113 @@ +function doCopy (copy, original, copyArray) { + // Callback function to iterate on array or object elements + function callback (value, key) { + // Copy the contents of objects + if (Highcharts.isObject(value, !copyArray) && + !Highcharts.isClass(value) && + !Highcharts.isDOMElement(value) + ) { + copy[key] = doCopy(copy[key] || Highcharts.isArray(value) ? [] : {}, value, copyArray) + } else { + // Primitives are copied over directly + copy[key] = original[key] + } + } + + if (Highcharts.isArray(original)) { + original.forEach(callback) + } else { + Highcharts.objectEach(original, callback) + } + return copy + } + +const copyObject = function (obj, copyArray) { + return doCopy({}, obj, copyArray) +} + +const highchartsPlugin = { + + install(app, options) { + + function destroyChart() { + if (this.chart) { + this.chart.destroy() + } + } + + function generateVueComponent(Highcharts, VueVersion) { + const VUE_MAJOR = VueVersion.split('.')[0] + const VERSION_DEPENDENT_PROPS = VUE_MAJOR < 3 + ? { + // Fallback options for Vue v2 to keep backward compatibility. + render: (createElement) => createElement('div', { + ref: 'chart' + }), + beforeDestroy: destroyChart + // The new Vue's 3 syntax. + } : { + render () { + return Vue.h('div', { ref: 'chart' }) + }, + beforeUnmount: destroyChart + } + + return { + template: '
', + props: { + constructorType: { + type: String, + default: 'chart' + }, + options: { + type: Object, + required: true + }, + callback: Function, + updateArgs: { + type: Array, + default: () => [true, true] + }, + highcharts: { + type: Object + }, + deepCopyOnUpdate: { + type: Boolean, + default: true + } + }, + watch: { + options: { + handler (newValue) { + this.chart.update(copyObject(newValue, this.deepCopyOnUpdate), ...this.updateArgs) + }, + deep: true + } + }, + mounted () { + let HC = this.highcharts || Highcharts + + // Check whether the chart configuration object is passed, as well as the constructor is valid. + if (this.options && HC[this.constructorType]) { + this.chart = HC[this.constructorType]( + this.$refs.chart, + copyObject(this.options, true), // Always pass the deep copy when generating a chart. #80 + this.callback ? this.callback : null + ) + } else { + (!this.options) ? console.warn('The "options" parameter was not passed.') : console.warn(`'${this.constructorType}' constructor-type is incorrect. Sometimes this error is caused by the fact, that the corresponding module wasn't imported.`) + } + }, + ...VERSION_DEPENDENT_PROPS + } + } + + app.component( + options.tagName || 'highcharts', + generateVueComponent(options.highcharts || Highcharts, Vue.version) + ) + }, + +} + +export default highchartsPlugin \ No newline at end of file