- 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>
82 lines
2.1 KiB
Vue
82 lines
2.1 KiB
Vue
<script setup lang="ts">
|
|
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 { Button } from '@/components/ui/button';
|
|
import AppLayout from '@/layouts/AppLayout.vue';
|
|
|
|
type WorkspaceUser = {
|
|
id: number;
|
|
name: string;
|
|
email: string;
|
|
};
|
|
|
|
type Props = {
|
|
indexUrl: string;
|
|
storeUrl: string;
|
|
legalForms: Record<string, string>;
|
|
clientStatusLabels: Record<string, string>;
|
|
workspaceUsers: WorkspaceUser[];
|
|
};
|
|
|
|
const props = defineProps<Props>();
|
|
|
|
const form = useForm<ClientFormData>({
|
|
company_name: '',
|
|
legal_form: '',
|
|
ice: '',
|
|
fiscal_id: '',
|
|
rc: '',
|
|
cnss: '',
|
|
patente: '',
|
|
contacts: [
|
|
{
|
|
full_name: '',
|
|
job_title: '',
|
|
email: '',
|
|
phone: '',
|
|
is_principal: true,
|
|
},
|
|
],
|
|
internal_responsible_id: '',
|
|
status: 'actif',
|
|
internal_notes: '',
|
|
});
|
|
|
|
function submit() {
|
|
form.post(props.storeUrl);
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<AppLayout
|
|
:breadcrumbs="[
|
|
{ title: 'Clients', href: props.indexUrl },
|
|
{ title: 'Ajouter un client' },
|
|
]"
|
|
>
|
|
<Head title="Ajouter un client" />
|
|
|
|
<div class="flex flex-col space-y-6 p-4">
|
|
<div class="flex items-center justify-between">
|
|
<Heading
|
|
title="Ajouter un client"
|
|
description="Créer un nouveau client dans le workspace"
|
|
/>
|
|
<Button variant="outline" as-child>
|
|
<Link :href="indexUrl">Retour</Link>
|
|
</Button>
|
|
</div>
|
|
<ClientForm
|
|
:form="form"
|
|
:legal-forms="props.legalForms"
|
|
:client-status-labels="props.clientStatusLabels"
|
|
:workspace-users="props.workspaceUsers"
|
|
submit-label="Créer le client"
|
|
@submit="submit"
|
|
/>
|
|
</div>
|
|
</AppLayout>
|
|
</template>
|