117 lines
3.2 KiB
Vue
117 lines
3.2 KiB
Vue
<script setup>
|
|
import { ref, onMounted } from 'vue';
|
|
import AdminAppLayout from "../../../../resources/js/layouts/AdminAppLayout.vue";
|
|
import ShadowedBox from "../../../Views/Components/ShadowedBox.vue";
|
|
import { useAjax } from "../../../../resources/js/components/ajaxHandler.js";
|
|
import { toast } from "vue3-toastify";
|
|
|
|
const { request } = useAjax()
|
|
|
|
const form = ref({
|
|
localGroup: '',
|
|
localGroupPlural: '',
|
|
parentGroup: '',
|
|
parentGroupPlural: '',
|
|
})
|
|
|
|
onMounted(async () => {
|
|
const response = await request('/api/v1/admin/settings')
|
|
Object.assign(form.value, response?.groupLabels ?? {})
|
|
})
|
|
|
|
async function save() {
|
|
const response = await request('/api/v1/admin/settings', {
|
|
method: 'POST',
|
|
body: form.value,
|
|
})
|
|
|
|
if (response && response.status === 'success') {
|
|
toast.success(response.message)
|
|
} else {
|
|
toast.error(response?.message ?? 'Fehler beim Speichern')
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<AdminAppLayout title="Einstellungen">
|
|
<shadowed-box style="width: 95%; margin: 20px auto; padding: 20px; overflow-x: hidden;">
|
|
<h3>Bezeichnungen der Gruppen</h3>
|
|
<p class="hint">
|
|
Gelten für alle Mandanten: in Anmeldungen, Teilnehmendenlisten, Exporten und in der Verwaltung.
|
|
</p>
|
|
<table class="data-table">
|
|
<thead>
|
|
<tr>
|
|
<th></th>
|
|
<th>Einzahl</th>
|
|
<th>Mehrzahl</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<th>Gruppe (Mandant)</th>
|
|
<td><input type="text" v-model="form.localGroup" class="form-input" placeholder="z. B. Stamm" /></td>
|
|
<td><input type="text" v-model="form.localGroupPlural" class="form-input" placeholder="z. B. Stämme" /></td>
|
|
</tr>
|
|
<tr>
|
|
<th>Übergeordnete Gruppe</th>
|
|
<td><input type="text" v-model="form.parentGroup" class="form-input" placeholder="z. B. Bund" /></td>
|
|
<td><input type="text" v-model="form.parentGroupPlural" class="form-input" placeholder="z. B. Bünde" /></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<button class="btn-save" @click="save">Speichern</button>
|
|
</shadowed-box>
|
|
</AdminAppLayout>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.hint {
|
|
color: #6b7280;
|
|
font-size: 0.9rem;
|
|
}
|
|
|
|
.data-table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
}
|
|
|
|
.data-table th {
|
|
text-align: left;
|
|
padding: 8px 12px;
|
|
color: #374151;
|
|
border-bottom: 1px solid #e5e7eb;
|
|
}
|
|
|
|
.data-table td {
|
|
padding: 8px 12px;
|
|
border-bottom: 1px solid #e5e7eb;
|
|
}
|
|
|
|
.form-input {
|
|
width: 100%;
|
|
padding: 6px 10px;
|
|
border: 1px solid #d1d5db;
|
|
border-radius: 6px;
|
|
font-size: 0.95rem;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.btn-save {
|
|
margin-top: 15px;
|
|
padding: 8px 20px;
|
|
border: none;
|
|
border-radius: 6px;
|
|
cursor: pointer;
|
|
font-weight: bold;
|
|
font-size: 0.9rem;
|
|
background-color: #16a34a;
|
|
color: #ffffff;
|
|
}
|
|
|
|
.btn-save:hover {
|
|
background-color: #15803d;
|
|
}
|
|
</style>
|