Make AppConfig a general Component

This commit is contained in:
chfhtw
2025-11-13 08:48:54 +01:00
parent 7fdfa94d11
commit 7566e8aac2
2 changed files with 20 additions and 13 deletions
@@ -15,15 +15,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import BsModal from "../../Bootstrap/Modal.js";
import FhcForm from "../../Form/Form.js";
import FormInput from "../../Form/Input.js";
import ApiStvConfig from '../../../api/factory/stv/config.js';
import BsModal from "./Bootstrap/Modal.js";
import FhcForm from "./Form/Form.js";
import FormInput from "./Form/Input.js";
export default {
name: 'StvConfig',
name: 'AppConfig',
components: {
BsModal,
FhcForm,
@@ -33,7 +31,14 @@ export default {
'update:modelValue'
],
props: {
modelValue: Object
modelValue: {
type: Object,
required: true
},
endpoints: {
type: Object,
required: true
}
},
data() {
return {
@@ -44,7 +49,7 @@ export default {
methods: {
update() {
this.$refs.form
.call(ApiStvConfig.set(this.tempValues))
.call(this.endpoints.set(this.tempValues))
.then(() => {
// TODO(chris): phrase
this.$emit('update:modelValue', { ...this.tempValues });
@@ -56,7 +61,7 @@ export default {
},
created() {
this.$api
.call(ApiStvConfig.get())
.call(this.endpoints.get())
.then(res => {
this.setup = {};
Object.keys(res.data).forEach(key => {
@@ -19,15 +19,16 @@ import CoreSearchbar from "../searchbar/searchbar.js";
import NavLanguage from "../navigation/Language.js";
import VerticalSplit from "../verticalsplit/verticalsplit.js";
import AppMenu from "../AppMenu.js";
import AppConfig from "../AppConfig.js";
import StvVerband from "./Studentenverwaltung/Verband.js";
import StvList from "./Studentenverwaltung/List.js";
import StvDetails from "./Studentenverwaltung/Details.js";
import StvStudiensemester from "./Studentenverwaltung/Studiensemester.js";
import StvConfig from "./Studentenverwaltung/Config.js";
import ApiSearchbar from "../../api/factory/searchbar.js";
import ApiStv from "../../api/factory/stv.js";
import ApiStvVerband from '../../api/factory/stv/verband.js';
import ApiStvConfig from '../../api/factory/stv/config.js';
export default {
@@ -37,11 +38,11 @@ export default {
NavLanguage,
VerticalSplit,
AppMenu,
AppConfig,
StvVerband,
StvList,
StvDetails,
StvStudiensemester,
StvConfig
StvStudiensemester
},
props: {
defaultSemester: String,
@@ -89,6 +90,7 @@ export default {
data() {
return {
appconfig: {},
configEndpoints: ApiStvConfig,
selected: [],
searchbaroptions: {
origin: 'stv',
@@ -480,6 +482,6 @@ export default {
</main>
</div>
</div>
<stv-config ref="config" v-model="appconfig"></stv-config>
<app-config ref="config" v-model="appconfig" :endpoints="configEndpoints"></app-config>
</div>`
};