Commit 32294547 authored by LucBUTGH's avatar LucBUTGH
Browse files

Merge diversbysession

parents fb3c506e 01167038
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\User;
use Illuminate\View\View;


class DiversBySession extends Controller
{
    public function getDiversBySession($ds_code): View
    {
        $parametre = $ds_code;
        $request = User::selectRaw('US_NAME, US_FIRST_NAME')
        ->join('CAR_REGISTRATION','CAR_REGISTRATION.US_ID', '=', 'CAR_USER.US_ID')
        ->where('DS_CODE', $ds_code)
        ->get();

        return view('diversonesession', ['datas' => $request, 'parametre' => $parametre]);
    }
    
    public function getAllSessions(): View
    {
        $sessions = User::
        join('CAR_REGISTRATION', 'CAR_REGISTRATION.US_ID', '=', 'CAR_USER.US_ID')
        ->get();
    
    return view('diversinsessions', compact('sessions'));
    
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -8,7 +8,11 @@
class DivingSignUpModel extends Model
{
    protected $table = 'CAR_REGISTRATION';
<<<<<<< HEAD
    protected $primaryKey = ['us_id', 'ds_code'];
=======
    protected $primaryKey = ['US_ID', 'DS_CODE'];
>>>>>>> diversbysession
    protected $keyType = ['int', 'string'];
    protected $fillable = ['US_ID', 'DS_CODE', 'REG_ACTIVE'];
    use HasFactory;
+23 −0
Original line number Diff line number Diff line
<x-layout>
    <x-page-title>Historique des plongées</x-page-title>
    <div class="shadow-md max-w-full w-2/3 rounded-lg overflow-hidden border-2 mx-auto">
            <table class="text-sm text-left text-gray-500 w-full">
                <thead class="text-xs text-gray-700 uppercase bg-gray-50">
                    <tr>
                        <th scope="col" class="px-6 py-3">Nom</th>
                        <th scope="col" class="px-6 py-3">Prénom</th>
                        <th scope="col" class="px-6 py-3">Session</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach($sessions as $session)
                        <tr class="odd:bg-white even:bg-gray-50 border-b">
                            <td class="px-6 py-4">{{ $session->US_NAME }}</td>
                            <td class="px-6 py-4">{{ $session->US_FIRST_NAME }}</td>
                            <td class="px-6 py-4">{{ $session->DS_CODE }}</td>
                        </tr>
                    @endforeach
                </tbody>
            </table>
    </div>
</x-layout>
+21 −0
Original line number Diff line number Diff line
<x-layout>
    <x-page-title>Historique des plongées de la session {{ $parametre }} </x-page-title>
    <div class="shadow-md max-w-full w-2/3 rounded-lg overflow-hidden border-2 mx-auto">
            <table class="text-sm text-left text-gray-500 w-full">
                <thead class="text-xs text-gray-700 uppercase bg-gray-50">
                    <tr>
                        <th scope="col" class="px-6 py-3">Nom</th>
                        <th scope="col" class="px-6 py-3">Prénom</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach($datas as $data)
                        <tr class="odd:bg-white even:bg-gray-50 border-b">
                            <td class="px-6 py-4">{{ $data->US_NAME }}</td>
                            <td class="px-6 py-4">{{ $data->US_FIRST_NAME }}</td>
                        </tr>
                    @endforeach
                </tbody>
            </table>
    </div>
</x-layout>
+5 −0
Original line number Diff line number Diff line
<?php

use App\Http\Controllers\DiversBySession;
use App\Http\Controllers\DivesList;
use App\Models\DivingSession;
use App\Http\Controllers\DivingSignUpController;
@@ -79,3 +80,7 @@
    DivingSession::find($id)->disable();
    return redirect('/');
});

Route::get('/sessions', [DiversBySession::class,'getAllSessions']);

Route::get('/session/{ds_code}', [DiversBySession::class,'getDiversBySession']);