feat(clients) : add client deletion from list page

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-10 07:44:10 +01:00
parent 2f746ebce4
commit 71e6e83c82

View File

@@ -18,6 +18,7 @@
<th class="px-4 py-3 font-semibold text-neutral-700">Email</th>
<th class="px-4 py-3 font-semibold text-neutral-700">Adresse</th>
<th class="px-4 py-3 font-semibold text-neutral-700">Téléphone</th>
<th class="px-4 py-3 font-semibold text-neutral-700"></th>
</tr>
</thead>
<tbody>
@@ -31,6 +32,14 @@
<td class="px-4 py-3 text-primary-500">{{ client.email ?? '-' }}</td>
<td class="px-4 py-3 text-neutral-700">{{ formatAddress(client) }}</td>
<td class="px-4 py-3 text-primary-500">{{ client.phone ?? '-' }}</td>
<td class="px-4 py-3 text-right">
<button
class="text-red-500 hover:text-red-700"
@click.stop="handleDelete(client.id)"
>
<Icon name="mdi:delete-outline" size="20" />
</button>
</td>
</tr>
<tr v-if="clients.length === 0 && !isLoading">
<td colspan="4" class="px-4 py-8 text-center text-neutral-400">
@@ -55,7 +64,7 @@ import { useClientService } from '~/services/clients'
useHead({ title: 'Clients' })
const { getAll } = useClientService()
const { getAll, remove } = useClientService()
const clients = ref<Client[]>([])
const isLoading = ref(true)
const drawerOpen = ref(false)
@@ -86,6 +95,11 @@ function formatAddress(client: Client): string {
.join(', ') || '-'
}
async function handleDelete(id: number) {
await remove(id)
await loadClients()
}
async function onSaved() {
await loadClients()
}