Commit fafc5124 authored by LucBUTGH's avatar LucBUTGH
Browse files

fix: dives for divers

parent a64e5416
Loading
Loading
Loading
Loading
+3 −10
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@
use App\Models\DivingNumberModel;
use DateTime;
use Illuminate\Http\Request;
use Illuminate\Database\Query\Expression;
use Illuminate\View\View;

class DivingNumberController extends Controller
@@ -33,21 +32,15 @@ public function index(): View
        ->join('car_diving_location','car_diving_session.dl_id','=','car_diving_location.dl_id')
        ->join('car_role_attribution','car_user.us_id','=','car_role_attribution.Us_id')
        ->join('car_role','car_role_attribution.rol_code','=','car_role.rol_code')

        ->where('car_user.US_ID',3)
        ->where('CAR_DIVING_SESSION.DS_DATE','>=',now())
        ->where('car_user.US_ID',$userId)
        ->get();

        
        
        $dives = 99;
        $usersCount = DivingNumberModel::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');
            })
            ->join('car_diving_session','car_registration.ds_code','=','car_diving_session.ds_code')
            ->where('car_diving_session.ds_date','>=',date("Y").'-00-00')
            ->where('car_user.US_ID', $userId)
            ->whereYear('CAR_USER.US_SUB_DATE', now()->year)            
            ->count();
        $usersCount = 99 - $usersCount;

+3 −3
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
        Vous devez être connecté pour accéder à cette page.
    @else
        <x-page-title>Historique des plongées de {{ session('user')->US_FIRST_NAME . " " . session('user')->US_NAME }}</x-page-title>

        <div class="shadow-md max-w-full w-1/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">
@@ -26,7 +27,6 @@
                        <th scope="col" class="px-6 py-3">Lieu</th>
                        <th scope="col" class="px-6 py-3">Date</th>
                        <th scope="col" class="px-6 py-3">Rôle</th>
                
                    </tr>
                </thead>
                <tbody>
@@ -34,7 +34,7 @@
                        <tr class="odd:bg-white even:bg-gray-50 border-b">
                            <td class="px-6 py-4">{{ $dateA->DL_NAME }}</td>
                            <td class="px-6 py-4">{{ $dateA->DS_DATE }}</td>
                    <td class="px-6 py-4">{{ $date->ROL_LABEL }}</td
                            <td class="px-6 py-4">{{ $dateA->ROL_LABEL }}</td>
                        </tr>
                    @endforeach
                </tbody>
@@ -57,10 +57,10 @@
                            <td class="px-6 py-4">{{ $dateB->DL_NAME }}</td>
                            <td class="px-6 py-4">{{ $dateB->DS_DATE }}</td>
                            <td class="px-6 py-4">{{ $dateB->ROL_LABEL }}</td>

                        </tr>
                    @endforeach
                </tbody>
            </table>
        </div>
    @endif
</x-layout>