Commit 207f4e5f authored by Julien Sailly's avatar Julien Sailly
Browse files

feat: displaying how many dives can be done on header

parent 5fd9541f
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -48,6 +48,17 @@ public function index(): View
                                                                'datesA' => $dateDivesAfter]);
    }

    public static function getDivingNumber($userId): int
    {
        $usersCount = DivingNumberModel::join('CAR_REGISTRATION', 'CAR_USER.us_id', '=', 'CAR_REGISTRATION.us_id')
        ->join('CAR_DIVING_SESSION', 'CAR_REGISTRATION.ds_code', '=', 'CAR_DIVING_SESSION.ds_code')
        ->where('CAR_USER.us_id', $userId)
        ->whereYear('CAR_DIVING_SESSION.ds_date', '=', now()->year)
        ->count();
        $usersCount = 99 - $usersCount ;
        return $usersCount;
    }

    public function allIndex(Request $request): View
    {

+6 −0
Original line number Diff line number Diff line
@@ -178,6 +178,12 @@ function removePalanqueZone(nbZone) {
    });
}

/**
 * To-Do
 * 
 * 1. Faire fonctionner la suppression des palanquées en gérant l'ID de ces dernières qui est inconsistent
 */

async function getDiver(ds_code) {
    let response = await fetch(`/api/dives/${ds_code}/divers`);
    let data = await response.json().then((data) => proccessDiverData(data));
+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
                    </x-button>
                </a>
            @else
                <p class="text-white mr-4">{{ App\Http\Controllers\DivingNumberController::getDivingNumber(session('user')->US_ID) }} / 99</p>
                <button type="button"
                        class="flex text-sm bg-blue-500 rounded-full md:me-0 focus:ring-4 focus:ring-blue-700"
                        id="user-menu-button" aria-expanded="false" data-dropdown-toggle="user-dropdown"