2026-03-11 23:33:10 +00:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { Head, Link, router } from '@inertiajs/vue3';
|
|
|
|
|
import { FolderOpen } from 'lucide-vue-next';
|
|
|
|
|
import Heading from '@/components/Heading.vue';
|
|
|
|
|
import Pagination from '@/components/Pagination.vue';
|
|
|
|
|
import { Button } from '@/components/ui/button';
|
2026-03-12 18:25:32 +00:00
|
|
|
import AppLayout from '@/layouts/AppLayout.vue';
|
2026-03-11 23:33:10 +00:00
|
|
|
|
2026-03-12 18:25:32 +00:00
|
|
|
type Declaration = {
|
2026-03-11 23:33:10 +00:00
|
|
|
id: number;
|
|
|
|
|
title: string;
|
|
|
|
|
type: string;
|
|
|
|
|
client_name: string;
|
|
|
|
|
status: string;
|
|
|
|
|
due_date: string | null;
|
|
|
|
|
showUrl: string;
|
|
|
|
|
editUrl: string;
|
|
|
|
|
destroyUrl: string;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
type PaginatedData<T> = {
|
|
|
|
|
data: T[];
|
|
|
|
|
from: number | null;
|
|
|
|
|
to: number | null;
|
|
|
|
|
total: number;
|
|
|
|
|
current_page: number;
|
|
|
|
|
last_page: number;
|
|
|
|
|
per_page: number;
|
|
|
|
|
path: string;
|
|
|
|
|
first_page_url: string;
|
|
|
|
|
prev_page_url: string | null;
|
|
|
|
|
next_page_url: string | null;
|
|
|
|
|
last_page_url: string;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
type Props = {
|
2026-03-12 18:25:32 +00:00
|
|
|
declarations: PaginatedData<Declaration>;
|
2026-03-11 23:33:10 +00:00
|
|
|
createUrl: string;
|
|
|
|
|
workspaceName: string;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
defineProps<Props>();
|
|
|
|
|
|
2026-03-12 18:25:32 +00:00
|
|
|
function destroy(declaration: Declaration) {
|
2026-03-11 23:33:10 +00:00
|
|
|
if (
|
|
|
|
|
window.confirm(
|
2026-03-12 18:25:32 +00:00
|
|
|
`Êtes-vous sûr de vouloir supprimer « ${declaration.title} » ?`,
|
2026-03-11 23:33:10 +00:00
|
|
|
)
|
|
|
|
|
) {
|
2026-03-12 18:25:32 +00:00
|
|
|
router.delete(declaration.destroyUrl);
|
2026-03-11 23:33:10 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const typeLabels: Record<string, string> = {
|
|
|
|
|
vat: 'TVA',
|
|
|
|
|
vat_monthly: 'TVA mensuelle',
|
|
|
|
|
vat_quarterly: 'TVA trimestrielle',
|
|
|
|
|
corporate_tax: 'IS',
|
|
|
|
|
income_tax: 'IR',
|
|
|
|
|
cnss: 'CNSS',
|
|
|
|
|
annual_balance: 'Bilan',
|
|
|
|
|
other: 'Autre',
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const statusLabels: Record<string, string> = {
|
|
|
|
|
draft: 'Brouillon',
|
|
|
|
|
waiting_documents: 'En attente documents',
|
|
|
|
|
documents_received: 'Documents reçus',
|
|
|
|
|
processing: 'En cours de traitement',
|
|
|
|
|
additional_documents_requested: 'Pièces complémentaires demandées',
|
|
|
|
|
waiting_client_validation: 'En attente validation client',
|
|
|
|
|
validated: 'Validé',
|
|
|
|
|
closed: 'Clôturé',
|
|
|
|
|
cancelled: 'Annulé',
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2026-03-12 18:25:32 +00:00
|
|
|
<AppLayout :breadcrumbs="[{ title: 'Déclarations' }]">
|
|
|
|
|
<Head title="Déclarations" />
|
2026-03-11 23:33:10 +00:00
|
|
|
|
|
|
|
|
<div class="flex flex-col space-y-6 p-4">
|
|
|
|
|
<div class="flex items-center justify-between">
|
|
|
|
|
<Heading
|
|
|
|
|
variant="small"
|
2026-03-12 18:25:32 +00:00
|
|
|
title="Déclarations"
|
|
|
|
|
:description="`Gérer les déclarations du workspace « ${workspaceName} »`"
|
2026-03-11 23:33:10 +00:00
|
|
|
/>
|
|
|
|
|
<Button as-child>
|
2026-03-12 18:25:32 +00:00
|
|
|
<Link :href="createUrl">Nouvelle déclaration</Link>
|
2026-03-11 23:33:10 +00:00
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div
|
2026-03-12 18:25:32 +00:00
|
|
|
class="overflow-hidden rounded-xl border border-sidebar-border/70 dark:border-sidebar-border"
|
2026-03-11 23:33:10 +00:00
|
|
|
>
|
|
|
|
|
<div class="overflow-x-auto">
|
|
|
|
|
<table class="w-full text-sm">
|
2026-03-12 18:25:32 +00:00
|
|
|
<thead
|
|
|
|
|
class="border-b border-sidebar-border/70 bg-muted/50"
|
|
|
|
|
>
|
2026-03-11 23:33:10 +00:00
|
|
|
<tr>
|
|
|
|
|
<th
|
2026-03-12 18:25:32 +00:00
|
|
|
class="h-10 px-4 text-left align-middle font-medium"
|
2026-03-11 23:33:10 +00:00
|
|
|
>
|
|
|
|
|
Titre
|
|
|
|
|
</th>
|
|
|
|
|
<th
|
2026-03-12 18:25:32 +00:00
|
|
|
class="h-10 px-4 text-left align-middle font-medium"
|
2026-03-11 23:33:10 +00:00
|
|
|
>
|
|
|
|
|
Client
|
|
|
|
|
</th>
|
|
|
|
|
<th
|
2026-03-12 18:25:32 +00:00
|
|
|
class="h-10 px-4 text-left align-middle font-medium"
|
2026-03-11 23:33:10 +00:00
|
|
|
>
|
|
|
|
|
Type
|
|
|
|
|
</th>
|
|
|
|
|
<th
|
2026-03-12 18:25:32 +00:00
|
|
|
class="h-10 px-4 text-left align-middle font-medium"
|
2026-03-11 23:33:10 +00:00
|
|
|
>
|
|
|
|
|
Statut
|
|
|
|
|
</th>
|
|
|
|
|
<th
|
2026-03-12 18:25:32 +00:00
|
|
|
class="h-10 px-4 text-left align-middle font-medium"
|
2026-03-11 23:33:10 +00:00
|
|
|
>
|
|
|
|
|
Date limite
|
|
|
|
|
</th>
|
|
|
|
|
<th
|
2026-03-12 18:25:32 +00:00
|
|
|
class="h-10 px-4 text-right align-middle font-medium"
|
2026-03-11 23:33:10 +00:00
|
|
|
>
|
|
|
|
|
Actions
|
|
|
|
|
</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
<tr
|
2026-03-12 18:25:32 +00:00
|
|
|
v-for="declaration in declarations.data"
|
|
|
|
|
:key="declaration.id"
|
2026-03-11 23:33:10 +00:00
|
|
|
class="border-b border-sidebar-border/50 last:border-0"
|
|
|
|
|
>
|
|
|
|
|
<td class="px-4 py-3 font-medium">
|
|
|
|
|
<Link
|
2026-03-12 18:25:32 +00:00
|
|
|
:href="declaration.showUrl"
|
2026-03-11 23:33:10 +00:00
|
|
|
class="hover:underline"
|
|
|
|
|
>
|
2026-03-12 18:25:32 +00:00
|
|
|
{{ declaration.title }}
|
2026-03-11 23:33:10 +00:00
|
|
|
</Link>
|
|
|
|
|
</td>
|
|
|
|
|
<td class="px-4 py-3 text-muted-foreground">
|
2026-03-12 18:25:32 +00:00
|
|
|
{{ declaration.client_name }}
|
2026-03-11 23:33:10 +00:00
|
|
|
</td>
|
|
|
|
|
<td class="px-4 py-3 text-muted-foreground">
|
2026-03-12 18:25:32 +00:00
|
|
|
{{
|
|
|
|
|
typeLabels[declaration.type] ??
|
|
|
|
|
declaration.type
|
|
|
|
|
}}
|
2026-03-11 23:33:10 +00:00
|
|
|
</td>
|
|
|
|
|
<td class="px-4 py-3 text-muted-foreground">
|
2026-03-12 18:25:32 +00:00
|
|
|
{{
|
|
|
|
|
statusLabels[declaration.status] ??
|
|
|
|
|
declaration.status
|
|
|
|
|
}}
|
2026-03-11 23:33:10 +00:00
|
|
|
</td>
|
|
|
|
|
<td class="px-4 py-3 text-muted-foreground">
|
2026-03-12 18:25:32 +00:00
|
|
|
{{ declaration.due_date || '—' }}
|
2026-03-11 23:33:10 +00:00
|
|
|
</td>
|
2026-03-12 18:25:32 +00:00
|
|
|
<td class="space-x-2 px-4 py-3 text-right">
|
|
|
|
|
<Button
|
|
|
|
|
variant="outline"
|
|
|
|
|
size="sm"
|
|
|
|
|
as-child
|
|
|
|
|
>
|
|
|
|
|
<Link :href="declaration.showUrl"
|
2026-03-11 23:33:10 +00:00
|
|
|
>Voir</Link
|
|
|
|
|
>
|
|
|
|
|
</Button>
|
2026-03-12 18:25:32 +00:00
|
|
|
<Button
|
|
|
|
|
variant="outline"
|
|
|
|
|
size="sm"
|
|
|
|
|
as-child
|
|
|
|
|
>
|
|
|
|
|
<Link :href="declaration.editUrl"
|
2026-03-11 23:33:10 +00:00
|
|
|
>Modifier</Link
|
|
|
|
|
>
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
variant="destructive"
|
|
|
|
|
size="sm"
|
2026-03-12 18:25:32 +00:00
|
|
|
@click="destroy(declaration)"
|
2026-03-11 23:33:10 +00:00
|
|
|
>
|
|
|
|
|
Supprimer
|
|
|
|
|
</Button>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
2026-03-12 18:25:32 +00:00
|
|
|
<tr v-if="!declarations.data.length">
|
2026-03-11 23:33:10 +00:00
|
|
|
<td
|
|
|
|
|
colspan="6"
|
|
|
|
|
class="px-4 py-8 text-center text-muted-foreground"
|
|
|
|
|
>
|
2026-03-12 18:25:32 +00:00
|
|
|
<div
|
|
|
|
|
class="flex flex-col items-center gap-2"
|
|
|
|
|
>
|
2026-03-11 23:33:10 +00:00
|
|
|
<FolderOpen class="h-10 w-10" />
|
2026-03-12 18:25:32 +00:00
|
|
|
<p>
|
|
|
|
|
Aucune déclaration pour le moment.
|
|
|
|
|
</p>
|
2026-03-11 23:33:10 +00:00
|
|
|
<Button as-child>
|
|
|
|
|
<Link :href="createUrl"
|
2026-03-12 18:25:32 +00:00
|
|
|
>Créer votre première
|
|
|
|
|
déclaration</Link
|
2026-03-11 23:33:10 +00:00
|
|
|
>
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<Pagination
|
|
|
|
|
:pagination="{
|
2026-03-12 18:25:32 +00:00
|
|
|
from: declarations.from ?? 0,
|
|
|
|
|
to: declarations.to ?? 0,
|
|
|
|
|
total: declarations.total,
|
|
|
|
|
current_page: declarations.current_page,
|
|
|
|
|
last_page: declarations.last_page,
|
|
|
|
|
per_page: declarations.per_page,
|
2026-03-11 23:33:10 +00:00
|
|
|
}"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</AppLayout>
|
|
|
|
|
</template>
|