feat: complete Epic 1 — team management & permission system

- Story 1.1: Permission enum, config, AuthorizesPermissions & HasWorkspaceScope traits, member→worker migration
- Story 1.2: Team page with member list, invitation system with queued email
- Story 1.3: Role assignment (Manager/Worker) and member removal with activity logging
- Story 1.4: Owner-only permission toggle matrix for Managers (manage team, view logs, configure portal)
- Story 1.5: Role-based access enforcement — Workers see only assigned declarations/clients, sidebar scoping
- Story 1.6: Workspace switcher dropdown for multi-workspace users with session-based switching
- 83 new/modified files, 182 tests passing with zero regressions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-18 00:12:50 +00:00
parent 5dffd2d063
commit c89d1879bf
83 changed files with 5850 additions and 314 deletions

View File

@@ -3,8 +3,8 @@ import { Head, Link, useForm } from '@inertiajs/vue3';
import ClientForm from '@/components/ClientForm.vue';
import type { ClientFormData } from '@/components/ClientForm.vue';
import Heading from '@/components/Heading.vue';
import AppLayout from '@/layouts/AppLayout.vue';
import { Button } from '@/components/ui/button';
import AppLayout from '@/layouts/AppLayout.vue';
type WorkspaceUser = {
id: number;

View File

@@ -1,10 +1,13 @@
<script setup lang="ts">
import { Head, Link, useForm } from '@inertiajs/vue3';
import ClientForm from '@/components/ClientForm.vue';
import type { ClientContactData, ClientFormData } from '@/components/ClientForm.vue';
import type {
ClientContactData,
ClientFormData,
} from '@/components/ClientForm.vue';
import Heading from '@/components/Heading.vue';
import AppLayout from '@/layouts/AppLayout.vue';
import { Button } from '@/components/ui/button';
import AppLayout from '@/layouts/AppLayout.vue';
type WorkspaceUser = {
id: number;

View File

@@ -2,9 +2,9 @@
import { Head, Link, router } from '@inertiajs/vue3';
import { Building2 } from 'lucide-vue-next';
import Heading from '@/components/Heading.vue';
import AppLayout from '@/layouts/AppLayout.vue';
import Pagination from '@/components/Pagination.vue';
import { Button } from '@/components/ui/button';
import AppLayout from '@/layouts/AppLayout.vue';
type Client = {
id: number;
@@ -36,9 +36,12 @@ type Props = {
clients: PaginatedData<Client>;
createUrl: string;
workspaceName: string;
canCreate: boolean;
canEdit: boolean;
canDelete: boolean;
};
defineProps<Props>();
const props = defineProps<Props>();
function destroy(client: Client) {
if (
@@ -73,11 +76,7 @@ function getLegalFormLabel(legalForm: string): string {
</script>
<template>
<AppLayout
:breadcrumbs="[
{ title: 'Clients' },
]"
>
<AppLayout :breadcrumbs="[{ title: 'Clients' }]">
<Head title="Clients" />
<div class="flex flex-col space-y-6 p-4">
@@ -87,40 +86,42 @@ function getLegalFormLabel(legalForm: string): string {
title="Clients"
:description="`Gérer les clients du workspace « ${workspaceName} »`"
/>
<Button as-child>
<Button v-if="props.canCreate" as-child>
<Link :href="createUrl">Ajouter un client</Link>
</Button>
</div>
<div
class="rounded-xl border border-sidebar-border/70 dark:border-sidebar-border overflow-hidden"
class="overflow-hidden rounded-xl border border-sidebar-border/70 dark:border-sidebar-border"
>
<div class="overflow-x-auto">
<table class="w-full text-sm">
<thead class="border-b border-sidebar-border/70 bg-muted/50">
<thead
class="border-b border-sidebar-border/70 bg-muted/50"
>
<tr>
<th
class="h-10 px-4 text-left font-medium align-middle"
class="h-10 px-4 text-left align-middle font-medium"
>
Raison sociale
</th>
<th
class="h-10 px-4 text-left font-medium align-middle"
class="h-10 px-4 text-left align-middle font-medium"
>
Forme juridique
</th>
<th
class="h-10 px-4 text-left font-medium align-middle"
class="h-10 px-4 text-left align-middle font-medium"
>
ICE
</th>
<th
class="h-10 px-4 text-left font-medium align-middle"
class="h-10 px-4 text-left align-middle font-medium"
>
Statut
</th>
<th
class="h-10 px-4 text-right font-medium align-middle"
class="h-10 px-4 text-right align-middle font-medium"
>
Actions
</th>
@@ -147,20 +148,33 @@ function getLegalFormLabel(legalForm: string): string {
{{ client.ice || '—' }}
</td>
<td class="px-4 py-3 text-muted-foreground">
{{ client.status ? statusLabels[client.status] ?? client.status : '—' }}
{{
client.status
? (statusLabels[client.status] ??
client.status)
: '—'
}}
</td>
<td class="px-4 py-3 text-right space-x-2">
<Button variant="outline" size="sm" as-child>
<Link :href="client.showUrl"
>Voir</Link
>
<td class="space-x-2 px-4 py-3 text-right">
<Button
variant="outline"
size="sm"
as-child
>
<Link :href="client.showUrl">Voir</Link>
</Button>
<Button variant="outline" size="sm" as-child>
<Button
v-if="props.canEdit"
variant="outline"
size="sm"
as-child
>
<Link :href="client.editUrl"
>Modifier</Link
>
</Button>
<Button
v-if="props.canDelete"
variant="destructive"
size="sm"
@click="destroy(client)"
@@ -174,10 +188,12 @@ function getLegalFormLabel(legalForm: string): string {
colspan="5"
class="px-4 py-8 text-center text-muted-foreground"
>
<div class="flex flex-col items-center gap-2">
<div
class="flex flex-col items-center gap-2"
>
<Building2 class="h-10 w-10" />
<p>Aucun client pour le moment.</p>
<Button as-child>
<Button v-if="props.canCreate" as-child>
<Link :href="createUrl"
>Ajouter votre premier
client</Link