diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 27b75412927f0668db2c10c2b2bd6a76e3db1f7d..77d6cce34ed35aebbfed61ec48a6ad128080a304 100755 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -743,16 +743,14 @@ class ProfileController extends Controller return view('create.diplome'); } elseif ($param === 'parcour') { return view('create.parcour'); - } elseif (!$param) { - return view('create.index'); } } public function createindex() { $this->authorize('createAll', \App\Models\User::class); - $groups = Group::paginate(10); - $diplomes = Diplome::paginate(10); - $parcours = Parcour::paginate(10); + $groups = Group::all(); + $diplomes = Diplome::all(); + $parcours = Parcour::all(); return view('create.index', compact('groups', 'diplomes', 'parcours')); } @@ -761,6 +759,22 @@ class ProfileController extends Controller $data = $request->all(); Group::create($data); - return redirect()->route('createindex'); + return redirect()->route('create.index'); } -} + + public function diplome_store(Request $request) + { + $data = $request->all(); + Diplome::create($data); + + return redirect()->route('create.index'); + } + + public function parcour_store(Request $request) + { + $data = $request->all(); + Parcour::create($data); + + return redirect()->route('create.index'); + } +} \ No newline at end of file diff --git a/resources/views/create/diplome.blade.php b/resources/views/create/diplome.blade.php new file mode 100644 index 0000000000000000000000000000000000000000..7e35257510383d63552c79cf7e9001bfe7ac18f1 --- /dev/null +++ b/resources/views/create/diplome.blade.php @@ -0,0 +1,30 @@ +<x-home-layout> + <div class="flex flex-col gap-3"> + <h2 class="text-4xl font-semibold text-white">Créer un Diplome</h2> + <div class="p-4 px-6 bg-white shadow dark:bg-black bg-opacity-20 dark:bg-opacity-20 sm:rounded-lg"> + <form class="space-y-6" action="{{ route('create.diplome.store') }}" method="POST"> + @csrf + @method('PUT') + + <div> + <x-input-label for="title" :value="__('Titre du Diplome')" /> + <x-text-input id="title" name="title" type="text" placeholder="BUT Métiers du multimédia et de l'Internet" class="block w-full mt-1" /> + </div> + + <div> + <x-input-label for="code" :value="__('Nom du Diplome')" /> + <x-text-input id="code" name="code" type="text" placeholder="MMI3" class="block w-full mt-1" /> + </div> + + <div> + <x-input-label for="annee" :value="__('Année')" /> + <x-text-input id="annee" name="annee" type="text" placeholder="23_24" class="block w-full mt-1" /> + </div> + + <div> + <x-primary-button>{{ __('Ajouter le diplome') }}</x-primary-button> + </div> + </form> + </div> + </div> +</x-home-layout> diff --git a/resources/views/create/group.blade.php b/resources/views/create/group.blade.php index 10ad311a34ada2171992d8b2d396fd12417e711b..5bf3bcb297bbc0ad83f14a2a55b6e37bbceebb1f 100644 --- a/resources/views/create/group.blade.php +++ b/resources/views/create/group.blade.php @@ -2,7 +2,7 @@ <div class="flex flex-col gap-3"> <h2 class="text-4xl font-semibold text-white">Créer un groupe</h2> <div class="p-4 px-6 bg-white shadow dark:bg-black bg-opacity-20 dark:bg-opacity-20 sm:rounded-lg"> - <form class="space-y-6" action="{{ route('group.store') }}" method="POST"> + <form class="space-y-6" action="{{ route('create.group.store') }}" method="POST"> @csrf @method('PUT') diff --git a/resources/views/create/index.blade.php b/resources/views/create/index.blade.php index af079d4fbb068e599d7b9e0b69b845daecbf0457..0ebc75a0dda313bbe5b641328e3642b28a882c29 100644 --- a/resources/views/create/index.blade.php +++ b/resources/views/create/index.blade.php @@ -3,20 +3,31 @@ <div class="flex flex-col gap-3"> <h2 class="text-4xl font-semibold text-white">Création</h2> </div> - <div class="grid grid-cols-1 gap-3 xl:grid-cols-3 lg:grid-cols-2" > + <div class="grid grid-cols-1 gap-3" > <div class="flex flex-col justify-between gap-6 p-3 bg-white h-fit dark:bg-black bg-opacity-20 dark:bg-opacity-20 rounded-xl"> <div> <h3 class="text-2xl font-semibold text-white">Groupes</h3> <span class="text-gray-300">Voici tous les groupes</span> </div> <div class="text-left text-gray-400"> - <ul> - @foreach ($groups as $group) - <li>{{$group->label}}</li> - @endforeach - </ul> + <table class="min-w-full"> + <thead> + <tr> + <th scope="col" class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-white sm:pl-0">Label</th> + <th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-white">Description</th> + </tr> + </thead> + <tbody> + @foreach ($groups as $group) + <tr class="border-y"> + <td class="py-5 pl-4 pr-3 text-sm whitespace-nowrap sm:pl-0">{{$group->label}}</td> + <td class="px-3 py-5 text-sm text-gray-400 whitespace-nowrap">{{ $group->description }}</td> + </tr> + @endforeach + </tbody> + </table> </div> - <a href="#" class="px-5 py-2 text-white bg-white rounded-full dark:bg-black bg-opacity-30 dark:bg-opacity-30 dark:hover:bg-opacity-60 w-fit">En créer un</a> + <a href="{{ route('create.param', 'group') }}" class="px-5 py-2 text-white bg-white rounded-full dark:bg-black bg-opacity-30 dark:bg-opacity-30 dark:hover:bg-opacity-60 w-fit">En créer un</a> </div> <div class="flex flex-col justify-between gap-6 p-3 bg-white h-fit dark:bg-black bg-opacity-20 dark:bg-opacity-20 rounded-xl"> <div> @@ -24,13 +35,26 @@ <span class="text-gray-300">Voici tous les diplomes</span> </div> <div class="text-left text-gray-400"> - <ul> - @foreach ($diplomes as $diplome) - <li>{{$diplome->code}}</li> - @endforeach - </ul> + <table class="min-w-full"> + <thead> + <tr> + <th scope="col" class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-white sm:pl-0">Titre</th> + <th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-white">Code</th> + <th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-white">Année</th> + </tr> + </thead> + <tbody> + @foreach ($diplomes as $diplome) + <tr class="border-y"> + <td class="py-5 pl-4 pr-3 text-sm whitespace-nowrap sm:pl-0">{{$diplome->title}}</td> + <td class="px-3 py-5 text-sm text-gray-400 whitespace-nowrap">{{ $diplome->code }}</td> + <td class="px-3 py-5 text-sm text-gray-400 whitespace-nowrap">{{ $diplome->annee }}</td> + </tr> + @endforeach + </tbody> + </table> </div> - <a href="#" class="px-5 py-2 text-white bg-white rounded-full dark:bg-black bg-opacity-30 dark:bg-opacity-30 dark:hover:bg-opacity-60 w-fit">En créer un</a> + <a href="{{ route('create.param', 'diplome') }}" class="px-5 py-2 text-white bg-white rounded-full dark:bg-black bg-opacity-30 dark:bg-opacity-30 dark:hover:bg-opacity-60 w-fit">En créer un</a> </div> <div class="flex flex-col justify-between gap-6 p-3 bg-white h-fit dark:bg-black bg-opacity-20 dark:bg-opacity-20 rounded-xl"> <div> @@ -38,13 +62,22 @@ <span class="text-gray-300">Voici tous les parcours</span> </div> <div class="text-left text-gray-400"> - <ul> - @foreach ($parcours as $parcour) - <li>{{$parcour->label}}</li> - @endforeach - </ul> + <table class="min-w-full"> + <thead> + <tr> + <th scope="col" class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-white sm:pl-0">Label</th> + </tr> + </thead> + <tbody> + @foreach ($parcours as $parcour) + <tr class="border-y"> + <td class="py-5 pl-4 pr-3 text-sm whitespace-nowrap sm:pl-0">{{$parcour->label}}</td> + </tr> + @endforeach + </tbody> + </table> </div> - <a href="#" class="px-5 py-2 text-white bg-white rounded-full dark:bg-black bg-opacity-30 dark:bg-opacity-30 dark:hover:bg-opacity-60 w-fit">En créer un</a> + <a href="{{ route('create.param', 'parcour') }}" class="px-5 py-2 text-white bg-white rounded-full dark:bg-black bg-opacity-30 dark:bg-opacity-30 dark:hover:bg-opacity-60 w-fit">En créer un</a> </div> </div> diff --git a/resources/views/create/parcour.blade.php b/resources/views/create/parcour.blade.php new file mode 100644 index 0000000000000000000000000000000000000000..4e63f1e88eb903b89b01960c364c7540cf88bfc7 --- /dev/null +++ b/resources/views/create/parcour.blade.php @@ -0,0 +1,20 @@ +<x-home-layout> + <div class="flex flex-col gap-3"> + <h2 class="text-4xl font-semibold text-white">Créer un Parcours</h2> + <div class="p-4 px-6 bg-white shadow dark:bg-black bg-opacity-20 dark:bg-opacity-20 sm:rounded-lg"> + <form class="space-y-6" action="{{ route('create.parcour.store') }}" method="POST"> + @csrf + @method('PUT') + + <div> + <x-input-label for="label" :value="__('Nom du Parcours')" /> + <x-text-input id="label" name="label" type="text" placeholder="DW" class="block w-full mt-1" /> + </div> + + <div> + <x-primary-button>{{ __('Ajouter le parcours') }}</x-primary-button> + </div> + </form> + </div> + </div> +</x-home-layout> diff --git a/resources/views/layouts/navbar.blade.php b/resources/views/layouts/navbar.blade.php index def85219ed8f993dc3cee2c88240fba1f34123eb..acad0b8abe39f458510d028ae4245c4354134698 100755 --- a/resources/views/layouts/navbar.blade.php +++ b/resources/views/layouts/navbar.blade.php @@ -82,7 +82,7 @@ </x-nav-list> @endcan @can('createAll', \App\Models\User::class) - <x-nav-list :href="route('createindex')" :active="request()->routeIs('createindex')" > + <x-nav-list :href="route('create.index')" :active="request()->routeIs('create.*')" > <svg width="27" height="27" viewBox="0 0 27 27" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M8.48828 13.966H13.2883M13.2883 13.966H18.0883M13.2883 13.966V9.16602M13.2883 13.966V18.766" stroke="white" stroke-width="2.00593" stroke-linecap="round" stroke-linejoin="round"/> <path d="M13.2883 25.9661C19.9157 25.9661 25.2883 20.5934 25.2883 13.9661C25.2883 7.33864 19.9157 1.96606 13.2883 1.96606C6.66091 1.96606 1.28833 7.33864 1.28833 13.9661C1.28833 20.5934 6.66091 25.9661 13.2883 25.9661Z" stroke="white" stroke-width="2.00593" stroke-linecap="round" stroke-linejoin="round"/> diff --git a/routes/web.php b/routes/web.php index dc355a688323c1409b7795775c310f6eb194307b..0fe3cb0be739f2332e32f7bad56c4c60d43146aa 100755 --- a/routes/web.php +++ b/routes/web.php @@ -154,15 +154,23 @@ Route::middleware('auth')->group(function () { Route::get('/create', [ProfileController::class, 'createindex']) - ->name('createindex') + ->name('create.index') ->breadcrumbs(fn (Trail $trail) => $trail->parent('home') - ->push('Page d\'index de création', route('createindex'))); + ->push('Page d\'index de création', route('create.index'))); Route::get('/create/{param}', [ProfileController::class, 'create']) - ->name('create'); + ->name('create.param'); Route::put('/group', [ProfileController::class, 'group_store']) - ->name('group.store') + ->name('create.group.store') ->breadcrumbs(fn (Trail $trail) => $trail->parent('home') - ->push('Créer un Groupe', route('createindex'))); + ->push('Créer un Groupe', route('create.index'))); + Route::put('/diplome', [ProfileController::class, 'diplome_store']) + ->name('create.diplome.store') + ->breadcrumbs(fn (Trail $trail) => $trail->parent('home') + ->push('Créer un Diplome', route('create.index'))); + Route::put('/parcour', [ProfileController::class, 'parcour_store']) + ->name('create.parcour.store') + ->breadcrumbs(fn (Trail $trail) => $trail->parent('home') + ->push('Créer un Parcour', route('create.index'))); #endregion #region Routes pour le Footer de tous les utilisateurs