2023-08-03 22:37:57 +02:00

56 lines
2.3 KiB
Vue

<script setup>
defineProps({
messages: {
type: Object,
default: {},
},
});
</script>
<template>
<InertiaHead title="Wiadomości" />
<div class="p-4">
<header class="pb-4">
<h1 class="text-3xl font-roboto font-light">Wiadomości</h1>
</header>
<div class="overflow-x-auto">
<table v-if="messages.data.length" class="table-fixed w-full min-w-[600px] border-separate border-spacing-y-2 cursor-pointer">
<colgroup>
<col class="w-[40px] max-w-[60px]" />
<col class="w-[250px]" />
<col class="w-auto" />
<col class="w-[50px]" />
</colgroup>
<thead class="text-left bg-gray-100">
<th class="w-[40px] max-w-[60px] p-2 text-center">ID</th>
<th class="w-[250px] p-2">Wysyłający</th>
<th class="p-2">E-mail</th>
<th class="w-[50px] p-2"></th>
</thead>
<tbody>
<InertiaLink
as="tr"
v-for="(message, key) in messages.data"
:key="key"
class="px-3 py-2 bg-white hover:bg-neutral-200 rounded-md z-10"
:href="`/dashboard/message/${message.id}`">
<td class="p-2 w-[60px] text-center">#{{ message.id }}</td>
<td class="p-2 whitespace-nowrap overflow-hidden overflow-ellipsis">{{ message.sender }}</td>
<td class="p-2">{{ message.email }}</td>
<td class="flex items-center justify-end gap-2 p-3 z-50">
<InertiaLink
as="button"
class="px-3 py-3 text-red-600 hover:text-red-800"
:href="`/dashboard/message/${message.id}/delete`"
title="Usuń wiadomość z listy"><FontAwesomeIcon :icon="['fas', 'trash']" /></InertiaLink>
</td>
</InertiaLink>
</tbody>
</table>
<div v-else>
Lista pusta!
</div>
</div>
</div>
</template>