Commit 1e9c9542 authored by LucBUTGH's avatar LucBUTGH
Browse files

Feat: number of divings for a diver and number of divings of all divers for a director

parent 9b97ec59
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
<?php

namespace App\Http\Controllers;

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

class DivingNumberController extends Controller
{
    public function index(): View{
        $request = DivingNumberModel::select()->join('car_registration', 'car_user.us_id', '=', 'car_registration.us_id')
        ->join('car_diving_group', function($dg){
            $dg->on('car_registration.ds_code', '=', 'car_diving_group.ds_code')
            ->on('car_registration.dg_number', '=', 'car_diving_group.dg_number');
        })->count();
        return view('alldiversactivities', ['users'=>$users]);
    }
}
+14 −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 DivingNumberModel extends Model
{
    protected $table = "CAR_USER";
    protected $primaryKey = "US_ID";
    protected $type = "int"; 
    use HasFactory;
}
+5 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class User extends Model
{
@@ -54,6 +55,10 @@ public function hasRole($roleCode)
    {
        return $this->roles->contains('ROL_CODE', $roleCode);
    }


    

}

?>
+24 −0
Original line number Diff line number Diff line
<x-layout>
    <x-page-title>Plongées restantes</x-page-title>
    <div class="shadow-md max-w-full rounded-lg overflow-hidden border-2">
        <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">Noms et Prénoms</th>
                <th scope="col" class="px-6 py-3">Nombre de plongées</th>
            </tr>
            </thead>
            <tbody>
            @foreach ($users as $user)
                <tr class="odd:bg-white even:bg-gray-50 border-b">
                    <td class="px-6 py-4">{{ $dive->DS_DATE }}</td>
                    <td class="px-6 py-4">{{ $dive->CAR_SCHEDULE }}</td>
                    <td class="px-6 py-4">{{ $dive->DL_DEPTH }}</td>
                    <td class="px-6 py-4">{{ $dive->DL_NAME }}</td>
                    <td class="px-6 py-4"><x-button>S'inscrire</x-button><x-button>Voir les inscrits</x-button></td>
                </tr>
            @endforeach
            </tbody>
        </table>
    </div>
</x-layout>
+24 −0
Original line number Diff line number Diff line
<x-layout>
    <x-page-title>Plongées restantes</x-page-title>
    <div class="shadow-md max-w-full rounded-lg overflow-hidden border-2">
        <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">Noms et Prénoms</th>
                <th scope="col" class="px-6 py-3">Nombre de plongées</th>
            </tr>
            </thead>
            <tbody>
            @foreach ($dives as $dive)
                <tr class="odd:bg-white even:bg-gray-50 border-b">
                    <td class="px-6 py-4">{{ $dive->DS_DATE }}</td>
                    <td class="px-6 py-4">{{ $dive->CAR_SCHEDULE }}</td>
                    <td class="px-6 py-4">{{ $dive->DL_DEPTH }}</td>
                    <td class="px-6 py-4">{{ $dive->DL_NAME }}</td>
                    <td class="px-6 py-4"><x-button>S'inscrire</x-button><x-button>Voir les inscrits</x-button></td>
                </tr>
            @endforeach
            </tbody>
        </table>
    </div>
</x-layout>
Loading