feat: implement Story 2.1 — Owner/Manager Command Center Dashboard

- Rewrite DashboardController with cached role-scoped KPI aggregation
  (Cache::remember, 5-min TTL, Declaration::forUser scope)
- Create StatCard.vue component with CVA status variants and a11y
- Rewrite Dashboard.vue with 4-column KPI grid + urgent declarations table
- Add mise_en_demeure status to DeclarationStatus enum with transitions
- Exclude termine, mise_en_demeure, ferme from dashboard queries
- Set deadline proximity red threshold to ≤5 days
- Add abort(404) for non-member workspace access per architecture
- Fix null-safe client access for soft-deleted clients
- Fix hardcoded routes with Wayfinder type-safe imports
- Fix DashboardProps.stats type to allow null
- Add aria-pressed to StatCard for accessibility
- Install shadcn-vue table component (11 files)
- Add 11 Pest feature tests + 3 mise_en_demeure transition tests
- Fix DeclarationFactory eager workspace creation causing slug collisions
- 196 tests pass, 836 assertions, zero regressions
This commit is contained in:
2026-03-20 12:00:24 +00:00
parent e53b013359
commit a2ab6f365d
23 changed files with 1283 additions and 523 deletions

View File

@@ -21,9 +21,6 @@ class DeclarationFactory extends Factory
*/
public function definition(): array
{
$workspace = Workspace::factory()->create();
$client = Client::factory()->create(['workspace_id' => $workspace->id]);
$year = fake()->numberBetween(2024, 2026);
$excludeOldVat = array_filter(DeclarationType::getValues(), fn ($v) => $v !== 'vat');
$type = fake()->randomElement(array_values($excludeOldVat));
@@ -32,8 +29,10 @@ class DeclarationFactory extends Factory
$isVatQuarterly = $type === 'vat_quarterly';
return [
'workspace_id' => $workspace->id,
'client_id' => $client->id,
'workspace_id' => Workspace::factory(),
'client_id' => function (array $attributes) {
return Client::factory()->create(['workspace_id' => $attributes['workspace_id']])->id;
},
'created_by' => null,
'title' => 'Déclaration '.$this->typeLabel($type).' - '.$year,
'type' => $type,

View File

@@ -17,7 +17,7 @@ class WorkspaceFactory extends Factory
*/
public function definition(): array
{
$name = fake()->company();
$name = fake()->unique()->company();
$slug = Str::slug($name);
return [