feat(frontend): Add applicationFormTemplate, add list for application froms, refactoring

This commit is contained in:
2025-03-08 17:38:00 +01:00
parent 59a8c5d900
commit 8b800432ad
11 changed files with 279 additions and 42 deletions

View File

@@ -7,15 +7,9 @@
</template>
<template #right>
<UTooltip text="Notifications" :shortcuts="['N']">
<UButton color="neutral" variant="ghost" square>
<UChip color="error" inset>
<UIcon name="i-lucide-bell" class="size-5 shrink-0" />
</UChip>
</UButton>
</UTooltip>
<UButton icon="i-lucide-plus" size="md" class="rounded-full" @click="navigateTo('/create')" />
<UDropdownMenu :items="items">
<UButton icon="i-lucide-plus" size="md" class="rounded-full" />
</UDropdownMenu>
</template>
</UDashboardNavbar>
@@ -25,17 +19,47 @@
</template>
<template #body>
<div>
<pre>{{ session }}</pre>
<h1>{{ session.data ? 'Du bist eingeloggt' : 'Nicht eingeloggt' }}</h1>
<button v-if="session?.data" @click="authClient.signOut()">Sign out</button>
</div>
<Register />
<Login />
<UPageList>
<UPageCard
v-for="(applicationFormElem, index) in applicationForm"
:key="index"
variant="ghost"
:to="`application-forms/${applicationFormElem.id}`"
>
<template #body>
#{{ index }} {{ applicationFormElem.id }} {{ applicationFormElem.createdAt }}
{{ applicationFormElem.isTemplate }}
</template>
</UPageCard>
</UPageList>
</template>
</UDashboardPanel>
</template>
<script setup lang="ts">
const session = authClient.useSession()
import type { PagedApplicationFormDto } from '~/.api-client'
const { getAllApplicationForms } = useApplicationForm()
const items = [
[
{
label: 'Neuer Mitbestimmungsantrag',
icon: 'i-lucide-send',
to: '/create'
}
]
]
const { data } = await useAsyncData<PagedApplicationFormDto>(async () => {
return await getAllApplicationForms()
})
const applicationForm = computed({
get: () => data?.value?.content ?? [],
set: (val) => {
if (val && data.value) {
data.value.content = val
}
}
})
</script>