Sprint 1: Auth, metro map canvas, services, and retro UI
Authentication: - Laravel Fortify + Sanctum with Inertia views - RBAC middleware (admin, project_owner, team_member, viewer) - Retro terminal-styled login/register/forgot-password pages Metro Map (core UI): - D3.js zoomable SVG canvas with metro line rendering - Station nodes with glow-on-hover, status coloring, tooltips - Breadcrumb navigation for multi-level drill-down - Node preview panel with zoom-in action - C64-style CLI bar with blinking cursor at bottom Backend services: - ProjectService (CRUD, phase transitions, park/stop, audit logging) - ThemaService (CRUD with audit) - MapDataService (strategy map L1, project map L2) - Thin controllers: MapController, ProjectController, ThemaController - 32 routes total (auth + app + API) Style foundation: - Retro-futurism theme: VT323, Press Start 2P, IBM Plex Mono fonts - Dark palette with cyan/orange/green/purple neon accents - Comprehensive seed data (4 themes, 12 projects, commitments, deps) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
42
app/Http/Controllers/MapController.php
Normal file
42
app/Http/Controllers/MapController.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Services\MapDataService;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
|
||||
class MapController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private MapDataService $mapDataService
|
||||
) {}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$mapData = $this->mapDataService->getStrategyMap();
|
||||
|
||||
return Inertia::render('Map/MetroMap', [
|
||||
'mapData' => $mapData,
|
||||
]);
|
||||
}
|
||||
|
||||
public function project(int $projectId)
|
||||
{
|
||||
$mapData = $this->mapDataService->getProjectMap($projectId);
|
||||
|
||||
return Inertia::render('Map/MetroMap', [
|
||||
'mapData' => $mapData,
|
||||
]);
|
||||
}
|
||||
|
||||
public function apiStrategy(Request $request)
|
||||
{
|
||||
return response()->json($this->mapDataService->getStrategyMap());
|
||||
}
|
||||
|
||||
public function apiProject(int $projectId)
|
||||
{
|
||||
return response()->json($this->mapDataService->getProjectMap($projectId));
|
||||
}
|
||||
}
|
||||
91
app/Http/Controllers/ProjectController.php
Normal file
91
app/Http/Controllers/ProjectController.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Enums\ProjectStatus;
|
||||
use App\Models\Project;
|
||||
use App\Services\ProjectService;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
|
||||
class ProjectController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private ProjectService $projectService
|
||||
) {}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'naam' => 'required|string|max:255',
|
||||
'beschrijving' => 'nullable|string',
|
||||
'speerpunt_id' => 'nullable|exists:speerpunten,id',
|
||||
'prioriteit' => 'nullable|string',
|
||||
'startdatum' => 'nullable|date',
|
||||
'streef_einddatum' => 'nullable|date|after:startdatum',
|
||||
]);
|
||||
|
||||
$project = $this->projectService->create($validated);
|
||||
|
||||
return back()->with('success', "Project '{$project->naam}' aangemaakt.");
|
||||
}
|
||||
|
||||
public function show(Project $project)
|
||||
{
|
||||
$project = $this->projectService->getWithDetails($project->id);
|
||||
|
||||
return Inertia::render('Project/Show', [
|
||||
'project' => $project,
|
||||
]);
|
||||
}
|
||||
|
||||
public function update(Request $request, Project $project)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'naam' => 'sometimes|string|max:255',
|
||||
'beschrijving' => 'nullable|string',
|
||||
'prioriteit' => 'nullable|string',
|
||||
'speerpunt_id' => 'nullable|exists:speerpunten,id',
|
||||
'streef_einddatum' => 'nullable|date',
|
||||
]);
|
||||
|
||||
$this->projectService->update($project, $validated);
|
||||
|
||||
return back()->with('success', 'Project bijgewerkt.');
|
||||
}
|
||||
|
||||
public function transition(Request $request, Project $project)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'status' => 'required|string',
|
||||
]);
|
||||
|
||||
$newStatus = ProjectStatus::from($validated['status']);
|
||||
$this->projectService->transitionPhase($project, $newStatus);
|
||||
|
||||
return back()->with('success', 'Projectfase bijgewerkt.');
|
||||
}
|
||||
|
||||
public function park(Request $request, Project $project)
|
||||
{
|
||||
$reason = $request->input('reason', '');
|
||||
$this->projectService->park($project, $reason);
|
||||
|
||||
return back()->with('success', 'Project geparkeerd.');
|
||||
}
|
||||
|
||||
public function stop(Request $request, Project $project)
|
||||
{
|
||||
$reason = $request->input('reason', '');
|
||||
$this->projectService->stop($project, $reason);
|
||||
|
||||
return back()->with('success', 'Project gestopt.');
|
||||
}
|
||||
|
||||
public function destroy(Project $project)
|
||||
{
|
||||
$project->delete();
|
||||
|
||||
return redirect('/map')->with('success', 'Project verwijderd.');
|
||||
}
|
||||
}
|
||||
52
app/Http/Controllers/ThemaController.php
Normal file
52
app/Http/Controllers/ThemaController.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Thema;
|
||||
use App\Services\ThemaService;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
|
||||
class ThemaController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private ThemaService $themaService
|
||||
) {}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return Inertia::render('Thema/Index', [
|
||||
'themas' => $this->themaService->getAll(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'naam' => 'required|string|max:255',
|
||||
'beschrijving' => 'nullable|string',
|
||||
'prioriteit' => 'nullable|string',
|
||||
'periode_start' => 'nullable|date',
|
||||
'periode_eind' => 'nullable|date|after:periode_start',
|
||||
]);
|
||||
|
||||
$this->themaService->create($validated);
|
||||
|
||||
return back()->with('success', 'Thema aangemaakt.');
|
||||
}
|
||||
|
||||
public function update(Request $request, Thema $thema)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'naam' => 'sometimes|string|max:255',
|
||||
'beschrijving' => 'nullable|string',
|
||||
'prioriteit' => 'nullable|string',
|
||||
'periode_start' => 'nullable|date',
|
||||
'periode_eind' => 'nullable|date',
|
||||
]);
|
||||
|
||||
$this->themaService->update($thema, $validated);
|
||||
|
||||
return back()->with('success', 'Thema bijgewerkt.');
|
||||
}
|
||||
}
|
||||
19
app/Http/Middleware/CheckRole.php
Normal file
19
app/Http/Middleware/CheckRole.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class CheckRole
|
||||
{
|
||||
public function handle(Request $request, Closure $next, string ...$roles): Response
|
||||
{
|
||||
if (! $request->user() || ! $request->user()->roles()->whereIn('naam', $roles)->exists()) {
|
||||
abort(403, 'Je hebt geen toegang tot deze functie.');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,21 @@ class HandleInertiaRequests extends Middleware
|
||||
{
|
||||
return [
|
||||
...parent::share($request),
|
||||
//
|
||||
'auth' => [
|
||||
'user' => $request->user() ? [
|
||||
'id' => $request->user()->id,
|
||||
'name' => $request->user()->name,
|
||||
'email' => $request->user()->email,
|
||||
'functie' => $request->user()->functie,
|
||||
'afdeling' => $request->user()->afdeling,
|
||||
'roles' => $request->user()->roles->pluck('naam'),
|
||||
] : null,
|
||||
],
|
||||
'flash' => [
|
||||
'success' => $request->session()->get('success'),
|
||||
'error' => $request->session()->get('error'),
|
||||
],
|
||||
'locale' => app()->getLocale(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user