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>
58 lines
1.7 KiB
PHP
58 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Client;
|
|
|
|
use App\Enums\ActorType;
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\RedirectResponse;
|
|
use Illuminate\Http\Request;
|
|
use Inertia\Inertia;
|
|
use Inertia\Response;
|
|
|
|
class ConfirmController extends Controller
|
|
{
|
|
/**
|
|
* Show the confirmation page.
|
|
*/
|
|
public function show(Request $request, string $token): Response
|
|
{
|
|
$invitation = $request->attributes->get('folder_invitation');
|
|
$folder = $invitation->folder;
|
|
|
|
$folder->load(['client']);
|
|
|
|
return Inertia::render('client/Confirm', [
|
|
'folder' => [
|
|
'id' => $folder->id,
|
|
'title' => $folder->title,
|
|
'client_name' => $folder->client->company_name,
|
|
],
|
|
'token' => $token,
|
|
'submitUrl' => route('client.confirm.store', ['token' => $token]),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Store the confirmation (client confirms).
|
|
*/
|
|
public function store(Request $request, string $token): RedirectResponse
|
|
{
|
|
$invitation = $request->attributes->get('folder_invitation');
|
|
$folder = $invitation->folder;
|
|
|
|
$request->validate([
|
|
'signature' => ['required', 'string', 'max:255'],
|
|
]);
|
|
|
|
$folder->update([
|
|
'validated_at' => now(),
|
|
'confirmed_by_type' => ActorType::Client,
|
|
'confirmed_by_id' => $folder->client_id,
|
|
'confirmation_signature' => $request->input('signature'),
|
|
'status' => \App\Enums\FolderStatus::Validated,
|
|
]);
|
|
|
|
return back()->with('flash', ['type' => 'success', 'message' => 'Validation enregistrée. Merci.']);
|
|
}
|
|
}
|