Loading app/Http/Controllers/HomepageController.php 0 → 100644 +21 −0 Original line number Diff line number Diff line <?php namespace App\Http\Controllers; use App\Models\RoleAttribution; use Illuminate\View\View; class HomepageController extends Controller { function index(): View { if (!session()->has('user')) return view('dashboard'); $roles = RoleAttribution::where('US_ID', '=', session('user')->US_ID)->get(); $highestRole = 'VIS'; if ($roles == null) return view('dashboard'); else $highestRole = array('DIV'); foreach ($roles as $role) { array_push($highestRole, $role->ROL_CODE); } return view('dashboard', ['highestRole' => $highestRole]); } } resources/views/components/square-button.blade.php 0 → 100644 +6 −0 Original line number Diff line number Diff line <a href="{{ $link }}"> <div class="btn btn-primary flex flex-col justify-center items-center @if ($bgColor != null) {{ $bgColor }} @else bg-blue-700 @endif rounded-lg w-[10rem] h-[10rem] shadow"> {{ $slot }} <p class="@if ($textColor != null) {{ $textColor }} @else text-white @endif text-center">{{ $textSubtitle }}</p> </div> </a> resources/views/dashboard.blade.php 0 → 100644 +42 −0 Original line number Diff line number Diff line <x-layout> @if(!session()->has('user')) Vous devez être connecté pour accéder à cette page. @else <x-page-title>Tableau de bord</x-page-title> <h2 class="text-2xl font-semibold text-gray-800">Bonjour {{ session('user')->US_FIRST_NAME . " " . session('user')->US_NAME . "," }}</h2> <div class="flex flex-row justify-evenly mt-10"> <x-square-button bgColor="bg-[#e37373]" textColor="text-black" textSubtitle="Mes plongées" link="#"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-12 h-12"> <path stroke-linecap="round" stroke-linejoin="round" d="M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0ZM3.75 12h.007v.008H3.75V12Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm-.375 5.25h.007v.008H3.75v-.008Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z" /> </svg> </x-square-button> <x-square-button bgColor="bg-[#87c868]" textColor="text-black" textSubtitle="S'inscrire à une plongée" link="{{ route('dives') }}"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-12 h-12"> <path stroke-linecap="round" stroke-linejoin="round" d="M11.35 3.836c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m8.9-4.414c.376.023.75.05 1.124.08 1.131.094 1.976 1.057 1.976 2.192V16.5A2.25 2.25 0 0 1 18 18.75h-2.25m-7.5-10.5H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V18.75m-7.5-10.5h6.375c.621 0 1.125.504 1.125 1.125v9.375m-8.25-3 1.5 1.5 3-3.75" /> </svg> </x-square-button> </div> @if(array_search('RES', $highestRole)) <hr class="mt-8 mb-4"> <h2 class="text-2xl font-semibold text-gray-800">Responsable</h2> <div class="flex flex-row justify-evenly mt-6 mb-14"> <x-square-button bgColor="bg-[#909aef]" textColor="text-black" textSubtitle="Gérer des adhérents" link="#"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-12 h-12"> <path stroke-linecap="round" stroke-linejoin="round" d="M18 18.72a9.094 9.094 0 0 0 3.741-.479 3 3 0 0 0-4.682-2.72m.94 3.198.001.031c0 .225-.012.447-.037.666A11.944 11.944 0 0 1 12 21c-2.17 0-4.207-.576-5.963-1.584A6.062 6.062 0 0 1 6 18.719m12 0a5.971 5.971 0 0 0-.941-3.197m0 0A5.995 5.995 0 0 0 12 12.75a5.995 5.995 0 0 0-5.058 2.772m0 0a3 3 0 0 0-4.681 2.72 8.986 8.986 0 0 0 3.74.477m.94-3.197a5.971 5.971 0 0 0-.94 3.197M15 6.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm6 3a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Zm-13.5 0a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Z" /> </svg> </x-square-button> <x-square-button bgColor="bg-[#ffba35]" textColor="text-black" textSubtitle="Créer une plongée" link="{{ route('create_dive') }}"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-12 h-12"> <path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" /> </svg> </x-square-button> <x-square-button bgColor="bg-[#3b82f6]" textColor="text-black" textSubtitle="Gérer des plongées" link="#"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-12 h-12"> <path stroke-linecap="round" stroke-linejoin="round" d="M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75" /> </svg> </x-square-button> </div> @endif @endif </x-layout> resources/views/welcome.blade.phpdeleted 100644 → 0 +0 −4 Original line number Diff line number Diff line <x-layout> <h1>Header</h1> <p>This is a paragraph</p> </x-layout> routes/web.php +3 −4 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ use App\Http\Controllers\DiversBySession; use App\Http\Controllers\DivesList; use App\Http\Controllers\HomepageController; use App\Models\DivingSession; use App\Http\Controllers\DivingSignUpController; use App\Http\Controllers\DiveSessionCreation; Loading Loading @@ -32,9 +33,7 @@ Route::post('/login', [AuthController::class, 'login']); Route::get('/', function () { return view('welcome'); })->name('homepage'); Route::get('/', [HomepageController::class, 'index'])->name('homepage'); Route::get('/logout', function () { session()->flush(); Loading Loading @@ -64,7 +63,7 @@ ->get('/create/dive', function() { return view('create_dive', ['locations' => DivingLocation::all(), 'boats' => Boat::all(), 'levels' => Prerogative::all(), 'users' => User::all()]); }); })->name('create_dive'); Route::middleware('App\Http\Middleware\rightChecker') ->post('/create/dive', function(Request $request) Loading Loading
app/Http/Controllers/HomepageController.php 0 → 100644 +21 −0 Original line number Diff line number Diff line <?php namespace App\Http\Controllers; use App\Models\RoleAttribution; use Illuminate\View\View; class HomepageController extends Controller { function index(): View { if (!session()->has('user')) return view('dashboard'); $roles = RoleAttribution::where('US_ID', '=', session('user')->US_ID)->get(); $highestRole = 'VIS'; if ($roles == null) return view('dashboard'); else $highestRole = array('DIV'); foreach ($roles as $role) { array_push($highestRole, $role->ROL_CODE); } return view('dashboard', ['highestRole' => $highestRole]); } }
resources/views/components/square-button.blade.php 0 → 100644 +6 −0 Original line number Diff line number Diff line <a href="{{ $link }}"> <div class="btn btn-primary flex flex-col justify-center items-center @if ($bgColor != null) {{ $bgColor }} @else bg-blue-700 @endif rounded-lg w-[10rem] h-[10rem] shadow"> {{ $slot }} <p class="@if ($textColor != null) {{ $textColor }} @else text-white @endif text-center">{{ $textSubtitle }}</p> </div> </a>
resources/views/dashboard.blade.php 0 → 100644 +42 −0 Original line number Diff line number Diff line <x-layout> @if(!session()->has('user')) Vous devez être connecté pour accéder à cette page. @else <x-page-title>Tableau de bord</x-page-title> <h2 class="text-2xl font-semibold text-gray-800">Bonjour {{ session('user')->US_FIRST_NAME . " " . session('user')->US_NAME . "," }}</h2> <div class="flex flex-row justify-evenly mt-10"> <x-square-button bgColor="bg-[#e37373]" textColor="text-black" textSubtitle="Mes plongées" link="#"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-12 h-12"> <path stroke-linecap="round" stroke-linejoin="round" d="M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0ZM3.75 12h.007v.008H3.75V12Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm-.375 5.25h.007v.008H3.75v-.008Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z" /> </svg> </x-square-button> <x-square-button bgColor="bg-[#87c868]" textColor="text-black" textSubtitle="S'inscrire à une plongée" link="{{ route('dives') }}"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-12 h-12"> <path stroke-linecap="round" stroke-linejoin="round" d="M11.35 3.836c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m8.9-4.414c.376.023.75.05 1.124.08 1.131.094 1.976 1.057 1.976 2.192V16.5A2.25 2.25 0 0 1 18 18.75h-2.25m-7.5-10.5H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V18.75m-7.5-10.5h6.375c.621 0 1.125.504 1.125 1.125v9.375m-8.25-3 1.5 1.5 3-3.75" /> </svg> </x-square-button> </div> @if(array_search('RES', $highestRole)) <hr class="mt-8 mb-4"> <h2 class="text-2xl font-semibold text-gray-800">Responsable</h2> <div class="flex flex-row justify-evenly mt-6 mb-14"> <x-square-button bgColor="bg-[#909aef]" textColor="text-black" textSubtitle="Gérer des adhérents" link="#"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-12 h-12"> <path stroke-linecap="round" stroke-linejoin="round" d="M18 18.72a9.094 9.094 0 0 0 3.741-.479 3 3 0 0 0-4.682-2.72m.94 3.198.001.031c0 .225-.012.447-.037.666A11.944 11.944 0 0 1 12 21c-2.17 0-4.207-.576-5.963-1.584A6.062 6.062 0 0 1 6 18.719m12 0a5.971 5.971 0 0 0-.941-3.197m0 0A5.995 5.995 0 0 0 12 12.75a5.995 5.995 0 0 0-5.058 2.772m0 0a3 3 0 0 0-4.681 2.72 8.986 8.986 0 0 0 3.74.477m.94-3.197a5.971 5.971 0 0 0-.94 3.197M15 6.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm6 3a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Zm-13.5 0a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Z" /> </svg> </x-square-button> <x-square-button bgColor="bg-[#ffba35]" textColor="text-black" textSubtitle="Créer une plongée" link="{{ route('create_dive') }}"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-12 h-12"> <path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" /> </svg> </x-square-button> <x-square-button bgColor="bg-[#3b82f6]" textColor="text-black" textSubtitle="Gérer des plongées" link="#"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-12 h-12"> <path stroke-linecap="round" stroke-linejoin="round" d="M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75" /> </svg> </x-square-button> </div> @endif @endif </x-layout>
resources/views/welcome.blade.phpdeleted 100644 → 0 +0 −4 Original line number Diff line number Diff line <x-layout> <h1>Header</h1> <p>This is a paragraph</p> </x-layout>
routes/web.php +3 −4 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ use App\Http\Controllers\DiversBySession; use App\Http\Controllers\DivesList; use App\Http\Controllers\HomepageController; use App\Models\DivingSession; use App\Http\Controllers\DivingSignUpController; use App\Http\Controllers\DiveSessionCreation; Loading Loading @@ -32,9 +33,7 @@ Route::post('/login', [AuthController::class, 'login']); Route::get('/', function () { return view('welcome'); })->name('homepage'); Route::get('/', [HomepageController::class, 'index'])->name('homepage'); Route::get('/logout', function () { session()->flush(); Loading Loading @@ -64,7 +63,7 @@ ->get('/create/dive', function() { return view('create_dive', ['locations' => DivingLocation::all(), 'boats' => Boat::all(), 'levels' => Prerogative::all(), 'users' => User::all()]); }); })->name('create_dive'); Route::middleware('App\Http\Middleware\rightChecker') ->post('/create/dive', function(Request $request) Loading