<script setup>
import AppLayout from '@/Layouts/AppLayout.vue';
import List from '@/Components/List.vue';
import ListItem from '@/Components/ListItem.vue';
import Pagination from '@/Components/Pagination.vue';
import SearchInput from '@/Components/SearchInput.vue';
import SectionTitle from '@/Components/SectionTitle.vue';
const props = defineProps({
    client_cases: Object,
    filters: Object
});

const search = {
    search: props.filters.search,
    route: {
        link: 'clientCase'
    }
}

</script>
<template>
    <AppLayout title="Client cases">
        <template #header>
            <h2 class="font-semibold text-xl text-gray-800 leading-tight">
                Contracts
            </h2>
        </template>
        <div class="py-12">
            <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
                <div class="px-3 bg-white overflow-hidden shadow-xl sm:rounded-lg">
                    <div class="mx-auto max-w-4x1 py-3">
                        <div class="flex justify-end">
                            <SearchInput :options="search" />
                        </div>
                        <List>
                            <ListItem v-for="clientCase in client_cases.data">
                                <div class="flex justify-between shadow rounded border-solid border-l-4 border-red-400 p-3">
                                    <div class="flex min-w-0 gap-x-4">
                                        <div class="min-w-0 flex-auto">
                                            <p class="text-sm font-semibold leading-6 text-gray-900"><a :href="route('clientCase.show', {uuid: clientCase.uuid})">{{ clientCase.person.full_name }}</a></p>
                                            <p class="mt-1 truncate text-xs leading-5 text-gray-500">{{ clientCase.person.nu }}</p>
                                        </div>
                                    </div>
                                    <div class="hidden shrink-0 sm:flex sm:flex-col sm:items-end">
                                        <p class="text-sm leading-6 text-gray-900">{{ clientCase.person.tax_number }}</p>
                                        <div class="mt-1 flex items-center gap-x-1.5">
                                            <p class="text-xs leading-5 text-gray-500">{{ clientCase.person.name }}</p>
                                        </div>
                                    </div>
                                </div>
                            </ListItem>
                        </List>
                    </div>
                    <Pagination :links="client_cases.links" :from="client_cases.from" :to="client_cases.to" :total="client_cases.total" />
                </div>
            </div>
        </div>
    </AppLayout>
</template>