ff-admin/src/components/admin/management/setting/AppSetting.vue

68 lines
2.1 KiB
Vue
Raw Normal View History

2025-04-28 12:39:32 +02:00
<template>
2025-04-29 13:10:30 +02:00
<BaseSetting title="Anwendungs Einstellungen" :submit-function="submit" v-slot="{ enableEdit }">
<div class="w-full">
<label for="custom_login_message">Nachricht unter Login (optional)</label>
<input
id="custom_login_message"
type="text"
:readonly="!enableEdit"
:value="appSettings['app.custom_login_message']"
/>
2025-04-28 12:39:32 +02:00
</div>
2025-04-29 13:10:30 +02:00
<div class="w-full flex flex-row items-center gap-2">
<div
v-if="!enableEdit"
class="border-2 border-gray-500 rounded-sm"
:class="appSettings['app.show_link_to_calendar'] ? 'bg-gray-500' : 'h-3.5 w-3.5'"
>
<CheckIcon v-if="appSettings['app.show_link_to_calendar']" class="h-2.5 w-2.5 stroke-4 text-white" />
2025-04-28 14:36:47 +02:00
</div>
2025-04-29 13:10:30 +02:00
<input v-else id="show_link_to_calendar" type="checkbox" :checked="appSettings['app.show_link_to_calendar']" />
<label for="show_link_to_calendar">Kalender-Link anzeigen</label>
2025-04-28 12:39:32 +02:00
</div>
2025-04-29 13:10:30 +02:00
</BaseSetting>
2025-04-28 12:39:32 +02:00
</template>
<script setup lang="ts">
2025-04-29 13:10:30 +02:00
import { useAbilityStore } from "@/stores/ability";
2025-04-28 14:36:47 +02:00
import { useSettingStore } from "@/stores/admin/management/setting";
import { CheckIcon } from "@heroicons/vue/24/outline";
2025-04-29 13:10:30 +02:00
import { mapActions, mapState } from "pinia";
2025-04-28 12:39:32 +02:00
import { defineComponent } from "vue";
2025-04-29 13:10:30 +02:00
import BaseSetting from "./BaseSetting.vue";
2025-04-28 12:39:32 +02:00
</script>
<script lang="ts">
2025-04-28 14:36:47 +02:00
export default defineComponent({
2025-04-29 13:10:30 +02:00
data() {
return {
enableEdit: false as boolean,
status: undefined as undefined | "loading" | "success" | "failed",
};
},
2025-04-28 14:36:47 +02:00
computed: {
...mapState(useSettingStore, ["readByTopic"]),
2025-04-29 13:10:30 +02:00
...mapState(useAbilityStore, ["can"]),
2025-04-28 14:36:47 +02:00
appSettings() {
return this.readByTopic("app");
},
},
2025-04-29 13:10:30 +02:00
methods: {
...mapActions(useSettingStore, ["updateSettings"]),
submit(e: any) {
const formData = e.target.elements;
return this.updateSettings([
{
key: "app.custom_login_message",
value: formData.custom_login_message.value || null,
},
{
key: "app.show_link_to_calendar",
value: formData.show_link_to_calendar.checked || null,
},
]);
},
},
2025-04-28 14:36:47 +02:00
});
2025-04-28 12:39:32 +02:00
</script>