Sprint 2: Live data, CRUD modals, commitments, document upload
Frontend: - Connect MetroMap to live Inertia props (replace hardcoded demo data) - Drill-down navigation via router.visit for project-level maps - Reactive breadcrumb based on map level - Empty state when no projects exist - Reusable Modal component with retro styling - ProjectForm and CommitmentForm with Inertia useForm - FormInput reusable component (text, date, textarea, select) - FloatingActions FAB button for creating projects/themes Backend: - CommitmentService + CommitmentController (CRUD, mark complete, overdue) - DocumentService + DocumentController (upload, download, delete) - MapController now passes users and speerpunten to frontend - 7 new routes (4 commitment, 3 document) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
61
app/Http/Controllers/CommitmentController.php
Normal file
61
app/Http/Controllers/CommitmentController.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Commitment;
|
||||
use App\Services\CommitmentService;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CommitmentController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private CommitmentService $commitmentService
|
||||
) {}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'beschrijving' => 'required|string',
|
||||
'eigenaar_id' => 'required|exists:users,id',
|
||||
'deadline' => 'required|date',
|
||||
'project_id' => 'required|exists:projects,id',
|
||||
'prioriteit' => 'nullable|string',
|
||||
'bron' => 'nullable|string',
|
||||
'besluit_id' => 'nullable|exists:besluiten,id',
|
||||
]);
|
||||
|
||||
$this->commitmentService->create($validated);
|
||||
|
||||
return back()->with('success', 'Commitment aangemaakt.');
|
||||
}
|
||||
|
||||
public function update(Request $request, Commitment $commitment)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'beschrijving' => 'sometimes|required|string',
|
||||
'eigenaar_id' => 'sometimes|required|exists:users,id',
|
||||
'deadline' => 'sometimes|required|date',
|
||||
'prioriteit' => 'nullable|string',
|
||||
'bron' => 'nullable|string',
|
||||
'status' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$this->commitmentService->update($commitment, $validated);
|
||||
|
||||
return back()->with('success', 'Commitment bijgewerkt.');
|
||||
}
|
||||
|
||||
public function complete(Commitment $commitment)
|
||||
{
|
||||
$this->commitmentService->markComplete($commitment);
|
||||
|
||||
return back()->with('success', 'Commitment afgerond.');
|
||||
}
|
||||
|
||||
public function destroy(Commitment $commitment)
|
||||
{
|
||||
$commitment->delete();
|
||||
|
||||
return back()->with('success', 'Commitment verwijderd.');
|
||||
}
|
||||
}
|
||||
51
app/Http/Controllers/DocumentController.php
Normal file
51
app/Http/Controllers/DocumentController.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Document;
|
||||
use App\Services\DocumentService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class DocumentController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private DocumentService $documentService
|
||||
) {}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'titel' => 'required|string|max:255',
|
||||
'bestand' => 'required|file|max:20480',
|
||||
'project_id' => 'required|exists:projects,id',
|
||||
'fase_id' => 'nullable|exists:fases,id',
|
||||
'type' => 'nullable|string|max:50',
|
||||
]);
|
||||
|
||||
$this->documentService->upload($validated, $request->file('bestand'));
|
||||
|
||||
return back()->with('success', 'Document geupload.');
|
||||
}
|
||||
|
||||
public function download(Document $document)
|
||||
{
|
||||
abort_unless(
|
||||
Storage::disk('local')->exists($document->bestandspad),
|
||||
404,
|
||||
'Bestand niet gevonden.'
|
||||
);
|
||||
|
||||
return Storage::disk('local')->download(
|
||||
$document->bestandspad,
|
||||
$document->titel
|
||||
);
|
||||
}
|
||||
|
||||
public function destroy(Document $document)
|
||||
{
|
||||
$this->documentService->delete($document);
|
||||
|
||||
return back()->with('success', 'Document verwijderd.');
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,9 @@ class MapController extends Controller
|
||||
$mapData = $this->mapDataService->getStrategyMap();
|
||||
|
||||
return Inertia::render('Map/MetroMap', [
|
||||
'mapData' => $mapData,
|
||||
'mapData' => $mapData,
|
||||
'users' => \App\Models\User::select('id', 'name')->get(),
|
||||
'speerpunten' => \App\Models\Speerpunt::select('id', 'naam', 'thema_id')->with('thema:id,naam')->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -26,7 +28,9 @@ class MapController extends Controller
|
||||
$mapData = $this->mapDataService->getProjectMap($projectId);
|
||||
|
||||
return Inertia::render('Map/MetroMap', [
|
||||
'mapData' => $mapData,
|
||||
'mapData' => $mapData,
|
||||
'users' => \App\Models\User::select('id', 'name')->get(),
|
||||
'speerpunten' => \App\Models\Speerpunt::select('id', 'naam', 'thema_id')->with('thema:id,naam')->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user