Commit 0fe81b91 authored by Waterfox's avatar Waterfox
Browse files

Merge branch 'DivingCreation' of...

Merge branch 'DivingCreation' of https://forge.info.unicaen.fr/git/but-info-sae3-2024-groupe3 into DivingCreation
parents c061716a 6fa77487
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
<?php

namespace App\Http\Controllers;

use App\Models\DivingSignUpModel;
use Illuminate\Http\Request;

class DivingSignUpController extends Controller
{
    public function show(){
        $userid = session()->get('userid');
        if(!preg_match('/[0-9]+/', $userid))
            return DivingSignUpController::error();
        return view('diving-sign-up');
    }

    public function index($ds_code){
        $userid = session()->get('userid');
        $request = DivingSignUpModel::select()->where('US_ID', $userid)->where('DS_CODE', $ds_code)->count();
        if(!$request == 0)
            return redirect()->route('signup')->withErrors(['already_registered' => 'Error already registered']);
        $request = DivingSignUpModel::insert(['US_ID' => $userid, 'DS_CODE' => $ds_code]);
        return redirect()->route('signup')->with('Success', 'inscription success');
    }

    public static function error(){
        return view('diving-sign-up')->withErrors(['userid' => 'Error with userid']);
    }
}
+15 −0
Original line number Diff line number Diff line
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class DivingSignUpModel extends Model
{
    protected $table = 'car_registration';
    protected $primaryKey = ['us_id', 'ds_code'];
    protected $keyType = ['int', 'string'];
    protected $fillable = ['US_ID', 'DS_CODE'];
    use HasFactory;
}
+39 −0
Original line number Diff line number Diff line
:root
{
  --black : #151414aa;
  --white: #ffffff;
  --whiteGrayer : #ebebeb;
  --grey : #D9D9D9;
  --blue : #002550;
  --blueLighter : #4d64b8;
  --yellow : #ffbe55;
  --yellowDarker : #daa654;

  --good : #00ff04;
  --bad : #dc2323;

  --BigTitle : 32px;
  --title : 25px;
  --font : 20px;
}

body{
    font-family: 'Montserrat', sans-serif;
}

h1{
    font-family: 'Space Grotesk', sans-serif; 
    font-weight: bold;
}

.clickable{
    background-color: var(--yellow);
    color: var(--black);
    transition: opacity 0.4s ease-out;
}

.clickable:hover{
    cursor: pointer;
    background-color: var(--yellowDarker);
    color: var(--white)
}
 No newline at end of file
+1 −0

File added.

Preview size limit exceeded, changes collapsed.

+34 −1
Original line number Diff line number Diff line
<x-layout>

    <link rel="stylesheet" href="../css/app.css">

    <x-page-title>Créer une plongée</x-page-title>
    <h1>Création d'une plongée</h1>
    <div style="display : flex; flex-direction: row">
        <div style="width: 50%;">
            <img src="{{ asset('resources/img/Diver1.png') }}" alt="Illustration de plongueur">
        </div>
        <form action="/create/dive" method="POST">
            <h1 class="text-4xl" style="font-family: 'Space Grotesk', sans-serif; font-weight: bold;">Création d'une plongée</h1>
            <div>
                <label for="locationInput">Site : </label>
                <select name="location" id="locationInput">
@@ -16,6 +23,31 @@
                    @endforeach
                </select>
            </div>
            <div>
                <div class="flex -mx-3">
                    <div class="w-full px-3 mb-5">
                        <label for="" class="text-xs font-semibold px-1">Mail</label>
                        <div class="flex">
                            <div class="w-10 z-10 pl-1 text-center pointer-events-none flex items-center justify-center"><i class="mdi mdi-email-outline text-gray-400 text-lg"></i></div>
                            <input type="email" id="mail" name="mail" class="w-full -ml-10 pl-10 pr-3 py-2 rounded-lg border-2 border-gray-200 outline-none focus:border-indigo-500" placeholder="johnsmith@example.com">
                        </div>
                    </div>
                </div>
                <div class="flex -mx-3">
                    <div class="w-full px-3 mb-12">
                        <label for="" class="text-xs font-semibold px-1">Mot de passe</label>
                        <div class="flex">
                            <div class="w-10 z-10 pl-1 text-center pointer-events-none flex items-center justify-center"><i class="mdi mdi-lock-outline text-gray-400 text-lg"></i></div>
                            <input type="password" id="password" name="password" class="w-full -ml-10 pl-10 pr-3 py-2 rounded-lg border-2 border-gray-200 outline-none focus:border-indigo-500" placeholder="************">
                        </div>
                    </div>
                </div>
                <div class="flex -mx-3">
                    <div class="w-full px-3 mb-5">
                        <input class="clickable block w-full max-w-xs mx-auto bg-yellow-400 hover:bg-yellow-500 focus:bg-yellow-500 text-black rounded-lg px-3 py-3 font-semibold" type="submit" value="CREER">
                    </div>
                </div>
            </div>
            <h2>Nombres d'inscrits</h2>
        <div>
            <label for="maxInput">Nombre maximum d'inscrits : </label>
@@ -72,4 +104,5 @@
        </div>
        <input type="submit" value="Créer">
    </form>
    </div>
</x-layout>
Loading