feat: L'Ami Fiduciaire V1.0.0 — full codebase with Story 0.1 complete

Initial commit of the L'Ami Fiduciaire SaaS platform built on Laravel 12,
Vue 3, Inertia.js 2, and Tailwind CSS 4.

Story 0.1 (rename folders to declarations in database) is implemented and
code-reviewed: migration, rollback, and 6 Pest tests all passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 23:33:10 +00:00
commit 35545c2a8f
1517 changed files with 246774 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Http\Requests\Settings;
use App\Concerns\PasswordValidationRules;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
class PasswordUpdateRequest extends FormRequest
{
use PasswordValidationRules;
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'current_password' => $this->currentPasswordRules(),
'password' => $this->passwordRules(),
];
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Http\Requests\Settings;
use App\Concerns\PasswordValidationRules;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
class ProfileDeleteRequest extends FormRequest
{
use PasswordValidationRules;
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'password' => $this->currentPasswordRules(),
];
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Http\Requests\Settings;
use App\Concerns\ProfileValidationRules;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
class ProfileUpdateRequest extends FormRequest
{
use ProfileValidationRules;
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return $this->profileRules($this->user()->id);
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\Settings;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Laravel\Fortify\Features;
use Laravel\Fortify\InteractsWithTwoFactorState;
class TwoFactorAuthenticationRequest extends FormRequest
{
use InteractsWithTwoFactorState;
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return Features::enabled(Features::twoFactorAuthentication());
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [];
}
}

View File

@@ -0,0 +1,72 @@
<?php
namespace App\Http\Requests;
use App\Enums\ClientStatus;
use App\Enums\LegalForm;
use BenSampo\Enum\Rules\EnumValue;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use Illuminate\Validation\Validator;
class StoreClientRequest extends FormRequest
{
/**
* Prepare the data for validation.
*/
protected function prepareForValidation(): void
{
if ($this->has('internal_responsible_id') && $this->internal_responsible_id === '') {
$this->merge(['internal_responsible_id' => null]);
}
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return $this->user() !== null;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'company_name' => ['required', 'string', 'max:255'],
'legal_form' => ['required', new EnumValue(LegalForm::class)],
'ice' => ['nullable', 'string', 'max:50'],
'fiscal_id' => ['nullable', 'string', 'max:50'],
'rc' => ['nullable', 'string', 'max:50'],
'cnss' => ['nullable', 'string', 'max:50'],
'patente' => ['nullable', 'string', 'max:50'],
'contacts' => ['required', 'array', 'min:1', 'max:20'],
'contacts.*.full_name' => ['required', 'string', 'max:255'],
'contacts.*.job_title' => ['nullable', 'string', 'max:255'],
'contacts.*.email' => ['nullable', 'string', 'email', 'max:255'],
'contacts.*.phone' => ['nullable', 'string', 'max:50'],
'contacts.*.is_principal' => ['required', 'boolean'],
'internal_responsible_id' => ['nullable', 'integer', 'exists:users,id'],
'status' => ['nullable', Rule::in(ClientStatus::getValues())],
'internal_notes' => ['nullable', 'string', 'max:65535'],
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after(function (Validator $validator) {
$contacts = $this->input('contacts', []);
$principalCount = collect($contacts)->where('is_principal', true)->count();
if ($principalCount !== 1) {
$validator->errors()->add('contacts', 'Exactement un responsable doit être marqué comme principal.');
}
});
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class StoreFolderMentionRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return $this->user() !== null;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
$workspaceId = $this->session()->get('current_workspace_id');
return [
'user_id' => [
'required',
'integer',
Rule::exists('workspace_user', 'user_id')
->where('workspace_id', $workspaceId),
],
'message' => ['required', 'string', 'max:500'],
];
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace App\Http\Requests;
use App\Enums\MessageType;
use BenSampo\Enum\Rules\EnumValue;
use Illuminate\Foundation\Http\FormRequest;
class StoreFolderMessageRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return $this->user() !== null;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
$rules = [
'type' => ['required', new EnumValue(MessageType::class)],
'body' => ['required', 'string', 'max:65535'],
'files' => ['nullable', 'array'],
'files.*' => ['file', 'max:10240'], // 10MB per file
];
$type = $this->input('type');
if (in_array($type, ['situation', 'confirmation'])) {
$rules['files'] = ['required', 'array', 'min:1'];
}
return $rules;
}
/**
* Get custom attributes for validator errors.
*
* @return array<string, string>
*/
public function attributes(): array
{
return [
'body' => 'message',
'files' => 'fichiers',
];
}
}

View File

@@ -0,0 +1,111 @@
<?php
namespace App\Http\Requests;
use App\Enums\FolderPriority;
use App\Enums\FolderStatus;
use App\Enums\FolderType;
use BenSampo\Enum\Rules\EnumValue;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use Illuminate\Validation\Validator;
class StoreFolderRequest extends FormRequest
{
/**
* Prepare the data for validation.
*/
protected function prepareForValidation(): void
{
$merge = [];
if ($this->has('assigned_to') && $this->assigned_to === '') {
$merge['assigned_to'] = null;
}
if ($this->filled('period_month') && (int) $this->period_month === 0) {
$merge['period_month'] = null;
}
if ($this->filled('period_quarter') && (int) $this->period_quarter === 0) {
$merge['period_quarter'] = null;
}
if ($merge !== []) {
$this->merge($merge);
}
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return $this->user() !== null;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
$workspaceId = $this->session()->get('current_workspace_id');
return [
'client_id' => [
'required',
'integer',
Rule::exists('clients', 'id')->where('workspace_id', $workspaceId),
],
'title' => ['required', 'string', 'max:255'],
'type' => ['required', new EnumValue(FolderType::class)],
'period_year' => ['required', 'integer', 'min:2000', 'max:2100'],
'period_month' => ['nullable', 'integer', 'min:1', 'max:12'],
'period_quarter' => ['nullable', 'integer', 'min:1', 'max:4'],
'due_date' => ['nullable', 'date'],
'status' => ['nullable', Rule::in(FolderStatus::getValues())],
'priority' => ['nullable', Rule::in(FolderPriority::getValues())],
'assigned_to' => [
'nullable',
'integer',
Rule::exists('users', 'id'),
],
'notes_internal' => ['nullable', 'string', 'max:65535'],
'notes_client' => ['nullable', 'string', 'max:65535'],
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after(function (Validator $validator) {
$type = $this->input('type');
if ($type === 'vat') {
$validator->errors()->add(
'type',
'Veuillez sélectionner TVA mensuelle ou TVA trimestrielle.',
);
}
if ($type === 'vat_monthly') {
$month = $this->input('period_month');
if ($month === null || $month === '') {
$validator->errors()->add('period_month', 'Le mois est requis pour la TVA mensuelle.');
}
$this->merge(['period_quarter' => null]);
}
if ($type === 'vat_quarterly') {
$quarter = $this->input('period_quarter');
if ($quarter === null || $quarter === '') {
$validator->errors()->add('period_quarter', 'Le trimestre est requis pour la TVA trimestrielle.');
}
$this->merge(['period_month' => null]);
}
});
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace App\Http\Requests;
use App\Enums\UserGroup;
use App\Models\User;
use BenSampo\Enum\Rules\EnumValue;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class StoreUserRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return $this->user() !== null;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', Rule::unique(User::class)],
'password' => ['required', 'string', 'min:8', 'confirmed'],
'group' => ['required', new EnumValue(UserGroup::class)],
];
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Http\Requests;
use App\Enums\WorkspaceUserRole;
use App\Models\Workspace;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class StoreWorkspaceRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return $this->user() !== null;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'name' => ['required', 'string', 'max:255'],
'slug' => ['nullable', 'string', 'max:255', Rule::unique(Workspace::class)],
'user_ids' => ['array'],
'user_ids.*' => ['integer', 'exists:users,id'],
'user_roles' => ['nullable', 'array'],
'user_roles.*' => ['string', 'in:' . implode(',', WorkspaceUserRole::getValues())],
];
}
}

View File

@@ -0,0 +1,73 @@
<?php
namespace App\Http\Requests;
use App\Enums\ClientStatus;
use App\Enums\LegalForm;
use BenSampo\Enum\Rules\EnumValue;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use Illuminate\Validation\Validator;
class UpdateClientRequest extends FormRequest
{
/**
* Prepare the data for validation.
*/
protected function prepareForValidation(): void
{
if ($this->has('internal_responsible_id') && $this->internal_responsible_id === '') {
$this->merge(['internal_responsible_id' => null]);
}
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return $this->user() !== null;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'company_name' => ['required', 'string', 'max:255'],
'legal_form' => ['required', new EnumValue(LegalForm::class)],
'ice' => ['nullable', 'string', 'max:50'],
'fiscal_id' => ['nullable', 'string', 'max:50'],
'rc' => ['nullable', 'string', 'max:50'],
'cnss' => ['nullable', 'string', 'max:50'],
'patente' => ['nullable', 'string', 'max:50'],
'contacts' => ['required', 'array', 'min:1', 'max:20'],
'contacts.*.id' => ['nullable', 'integer'],
'contacts.*.full_name' => ['required', 'string', 'max:255'],
'contacts.*.job_title' => ['nullable', 'string', 'max:255'],
'contacts.*.email' => ['nullable', 'string', 'email', 'max:255'],
'contacts.*.phone' => ['nullable', 'string', 'max:50'],
'contacts.*.is_principal' => ['required', 'boolean'],
'internal_responsible_id' => ['nullable', 'integer', 'exists:users,id'],
'status' => ['nullable', Rule::in(ClientStatus::getValues())],
'internal_notes' => ['nullable', 'string', 'max:65535'],
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after(function (Validator $validator) {
$contacts = $this->input('contacts', []);
$principalCount = collect($contacts)->where('is_principal', true)->count();
if ($principalCount !== 1) {
$validator->errors()->add('contacts', 'Exactement un responsable doit être marqué comme principal.');
}
});
}
}

View File

@@ -0,0 +1,111 @@
<?php
namespace App\Http\Requests;
use App\Enums\FolderPriority;
use App\Enums\FolderStatus;
use App\Enums\FolderType;
use BenSampo\Enum\Rules\EnumValue;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use Illuminate\Validation\Validator;
class UpdateFolderRequest extends FormRequest
{
/**
* Prepare the data for validation.
*/
protected function prepareForValidation(): void
{
$merge = [];
if ($this->has('assigned_to') && $this->assigned_to === '') {
$merge['assigned_to'] = null;
}
if ($this->filled('period_month') && (int) $this->period_month === 0) {
$merge['period_month'] = null;
}
if ($this->filled('period_quarter') && (int) $this->period_quarter === 0) {
$merge['period_quarter'] = null;
}
if ($merge !== []) {
$this->merge($merge);
}
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return $this->user() !== null;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
$workspaceId = $this->session()->get('current_workspace_id');
return [
'client_id' => [
'required',
'integer',
Rule::exists('clients', 'id')->where('workspace_id', $workspaceId),
],
'title' => ['required', 'string', 'max:255'],
'type' => ['required', new EnumValue(FolderType::class)],
'period_year' => ['required', 'integer', 'min:2000', 'max:2100'],
'period_month' => ['nullable', 'integer', 'min:1', 'max:12'],
'period_quarter' => ['nullable', 'integer', 'min:1', 'max:4'],
'due_date' => ['nullable', 'date'],
'status' => ['nullable', Rule::in(FolderStatus::getValues())],
'priority' => ['nullable', Rule::in(FolderPriority::getValues())],
'assigned_to' => [
'nullable',
'integer',
Rule::exists('users', 'id'),
],
'notes_internal' => ['nullable', 'string', 'max:65535'],
'notes_client' => ['nullable', 'string', 'max:65535'],
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after(function (Validator $validator) {
$type = $this->input('type');
if ($type === 'vat') {
$validator->errors()->add(
'type',
'Veuillez sélectionner TVA mensuelle ou TVA trimestrielle.',
);
}
if ($type === 'vat_monthly') {
$month = $this->input('period_month');
if ($month === null || $month === '') {
$validator->errors()->add('period_month', 'Le mois est requis pour la TVA mensuelle.');
}
$this->merge(['period_quarter' => null]);
}
if ($type === 'vat_quarterly') {
$quarter = $this->input('period_quarter');
if ($quarter === null || $quarter === '') {
$validator->errors()->add('period_quarter', 'Le trimestre est requis pour la TVA trimestrielle.');
}
$this->merge(['period_month' => null]);
}
});
}
}

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Http\Requests;
use App\Enums\UserGroup;
use App\Models\User;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class UpdateUserRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return $this->user() !== null;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
/** @var User $user */
$user = $this->route('user');
return [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', Rule::unique(User::class)->ignore($user->id)],
'password' => ['nullable', 'string', 'min:8', 'confirmed'],
'group' => ['required', Rule::in(UserGroup::getValues())],
];
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Http\Requests;
use App\Enums\WorkspaceUserRole;
use App\Models\Workspace;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class UpdateWorkspaceRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return $this->user() !== null;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
/** @var Workspace $workspace */
$workspace = $this->route('workspace');
return [
'name' => ['required', 'string', 'max:255'],
'slug' => ['nullable', 'string', 'max:255', Rule::unique(Workspace::class)->ignore($workspace->id)],
'user_ids' => ['array'],
'user_ids.*' => ['integer', 'exists:users,id'],
'user_roles' => ['nullable', 'array'],
'user_roles.*' => ['string', 'in:' . implode(',', WorkspaceUserRole::getValues())],
];
}
}