feat(#15): Redesign application form card on overview page
This commit is contained in:
@@ -41,30 +41,64 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #body>
|
<template #body>
|
||||||
<div class="flex flex-col gap-4 sm:gap-6 lg:gap-12 w-full lg:max-w-4xl mx-auto">
|
<div class="flex flex-col gap-4 sm:gap-6 w-full lg:max-w-4xl mx-auto p-4">
|
||||||
<div
|
<UCard
|
||||||
v-for="(applicationFormElem, index) in applicationForms"
|
v-for="(applicationFormElem, index) in applicationForms"
|
||||||
:key="applicationFormElem.id"
|
:key="applicationFormElem.id"
|
||||||
class="flex justify-between items-center p-4 bg-white rounded-lg shadow-md"
|
class="cursor-pointer hover:ring-2 hover:ring-primary transition-all duration-200"
|
||||||
@click="navigateTo(`application-forms/${applicationFormElem.id}/0`)"
|
@click="navigateTo(`application-forms/${applicationFormElem.id}/0`)"
|
||||||
>
|
>
|
||||||
<div>
|
<template #header>
|
||||||
<p class="font-medium text-(--ui-text-highlighted) text-base">
|
<div class="flex items-start justify-between gap-3">
|
||||||
#{{ index }} {{ applicationFormElem.name }}
|
<div class="flex-1 min-w-0">
|
||||||
</p>
|
<h3 class="font-semibold text-lg text-highlighted truncate">
|
||||||
<p class="text-(--ui-text-muted) text-sm">
|
{{ applicationFormElem.name }}
|
||||||
Zuletzt bearbeitet von {{ applicationFormElem.lastModifiedBy.name }} am
|
</h3>
|
||||||
{{ formatDate(applicationFormElem.modifiedAt) }}
|
<p class="text-xs text-muted mt-1">
|
||||||
</p>
|
#{{ index }}
|
||||||
<p class="text-(--ui-text-muted) text-sm">
|
</p>
|
||||||
Erstellt von {{ applicationFormElem.createdBy.name }} am {{ formatDate(applicationFormElem.createdAt) }}
|
</div>
|
||||||
</p>
|
<div class="flex items-center gap-2">
|
||||||
<p class="text-(--ui-text-muted) text-sm">Status: {{ applicationFormElem.status }}</p>
|
<UBadge
|
||||||
|
:label="applicationFormElem.status"
|
||||||
|
:color="getStatusColor(applicationFormElem.status)"
|
||||||
|
variant="subtle"
|
||||||
|
size="sm"
|
||||||
|
/>
|
||||||
|
<UDropdownMenu :items="[getLinksForApplicationForm(applicationFormElem)]" :content="{ align: 'end' }">
|
||||||
|
<UButton
|
||||||
|
icon="i-lucide-ellipsis-vertical"
|
||||||
|
color="neutral"
|
||||||
|
variant="ghost"
|
||||||
|
size="sm"
|
||||||
|
square
|
||||||
|
@click.stop
|
||||||
|
/>
|
||||||
|
</UDropdownMenu>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div class="space-y-3">
|
||||||
|
<div class="flex items-center gap-2 text-sm">
|
||||||
|
<UIcon name="i-lucide-pencil" class="size-4 text-muted shrink-0" />
|
||||||
|
<span class="text-muted">
|
||||||
|
Zuletzt bearbeitet von
|
||||||
|
<span class="font-medium text-highlighted">{{ applicationFormElem.lastModifiedBy.name }}</span>
|
||||||
|
am {{ formatDate(applicationFormElem.modifiedAt) }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex items-center gap-2 text-sm">
|
||||||
|
<UIcon name="i-lucide-user-plus" class="size-4 text-muted shrink-0" />
|
||||||
|
<span class="text-muted">
|
||||||
|
Erstellt von
|
||||||
|
<span class="font-medium text-highlighted">{{ applicationFormElem.createdBy.name }}</span>
|
||||||
|
am {{ formatDate(applicationFormElem.createdAt) }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
</UCard>
|
||||||
<UPageLinks :links="getLinksForApplicationForm(applicationFormElem)" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<DeleteModal
|
<DeleteModal
|
||||||
@@ -151,12 +185,6 @@ const applicationForms = computed({
|
|||||||
|
|
||||||
function getLinksForApplicationForm(applicationForm: ApplicationFormDto) {
|
function getLinksForApplicationForm(applicationForm: ApplicationFormDto) {
|
||||||
return [
|
return [
|
||||||
{
|
|
||||||
label: 'Bearbeiten',
|
|
||||||
icon: 'i-lucide-file-pen',
|
|
||||||
to: `/application-forms/${applicationForm.id}`,
|
|
||||||
disabled: !canWriteApplicationForms.value
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: 'Löschen',
|
label: 'Löschen',
|
||||||
icon: 'i-lucide-trash',
|
icon: 'i-lucide-trash',
|
||||||
@@ -166,6 +194,17 @@ function getLinksForApplicationForm(applicationForm: ApplicationFormDto) {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getStatusColor(status: string) {
|
||||||
|
const statusMap: Record<string, 'success' | 'warning' | 'error' | 'info' | 'neutral'> = {
|
||||||
|
COMPLETED: 'success',
|
||||||
|
IN_PROGRESS: 'warning',
|
||||||
|
DRAFT: 'info',
|
||||||
|
REJECTED: 'error',
|
||||||
|
PENDING: 'warning'
|
||||||
|
}
|
||||||
|
return statusMap[status] || 'neutral'
|
||||||
|
}
|
||||||
|
|
||||||
async function deleteApplicationForm(applicationFormId: string) {
|
async function deleteApplicationForm(applicationFormId: string) {
|
||||||
await deleteApplicationFormById(applicationFormId)
|
await deleteApplicationFormById(applicationFormId)
|
||||||
data.value?.content.splice(
|
data.value?.content.splice(
|
||||||
|
|||||||
Reference in New Issue
Block a user