Commit afd7c593 authored by cyprien's avatar cyprien
Browse files
parents 76bc549a 190c489a
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -3,15 +3,19 @@
namespace App\Http\Controllers;

use App\Models\DivingSession;
use App\Models\Prerogative;
use App\Models\User;
use Error;
use Illuminate\View\View;

class DivesList extends Controller
{
    function index(): View
    {
        $dives = DivingSession::select('DS_CODE', 'CAR_DIVING_SESSION.DL_ID', 'DS_DATE', 'DL_DEPTH', 'CAR_SCHEDULE', 'DL_NAME')
        $dives = DivingSession::select('DS_CODE', 'CAR_DIVING_SESSION.DL_ID', 'DS_DATE', 'DL_DEPTH', 'CAR_SCHEDULE', 'DL_NAME', 'DS_MAX_DEPTH')
            ->join('CAR_DIVING_LOCATION', 'CAR_DIVING_SESSION.DL_ID', '=', 'CAR_DIVING_LOCATION.DL_ID')
            ->get();
        return view('dives', ['dives' => $dives]);
        $user = session()->get('user');
        return view('dives', ['dives' => $dives, 'userPre' => Prerogative::find($user->PRE_CODE)]);
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
                    <td class="px-6 py-4">{{ $dive->DL_NAME }}</td>
                    <td class="px-8 py-4">
                        <a href='/dives/{{$dive->DS_CODE}}'>
                            @if($userPre->PRE_MAX_DEPTH>$dive->DS_MAX_DEPTH)
                                <x-button color="bg-green-700" colorHover="hover:bg-green-800">
                                    <svg class="w-6 h-6 text-gray-800 dark:text-white" aria-hidden="true"
                                        xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 12">
@@ -28,6 +29,7 @@
                                            stroke-width="2" d="M1 5.917 5.724 10.5 15 1.5"/>
                                    </svg>
                                </x-button>
                            @endif
                        </a>
                        <x-button diveId="dropdownButton-{{$dive->DS_CODE}}">
                            <svg class="w-6 h-6 text-gray-800 dark:text-white" aria-hidden="true"