Commit c03b2974 authored by Guilhem's avatar Guilhem
Browse files
parents 57ce5995 7080fa65
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
use App\Models\RoleAttribution;
use App\Models\User;
use Illuminate\Http\Request;
use App\Models\DivingNumberModel;

class ManageAdherentController extends Controller {
    function index() {
@@ -12,6 +13,7 @@ function index() {

        $user_role = array();
        $usersInfos = array();
        $userDives = array();

        foreach ($users as $user) {
            $usersInfos[$user->US_ID] = [$user->US_ID, $user->US_FIRST_NAME, $user->US_NAME];
@@ -19,10 +21,17 @@ function index() {
                $user_role[$user->US_ID] = array();
            }
            $user_role[$user->US_ID][] = $user->ROL_CODE;
            $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', $user->US_ID)
                ->whereYear('CAR_DIVING_SESSION.ds_date', '=', now()->year)
                ->count();
            $userDives[$user->US_ID] = $usersCount;
        }

        $users = [$usersInfos, $user_role];

        return view('manageAdherent', ['users' => $users]);
        return view('manageAdherent', ['users' => $users, 'usersDives' => $userDives]);
    }

    function update(Request $request) {
+27 −55
Original line number Diff line number Diff line
@@ -2,82 +2,54 @@
    @if (!session()->has('user'))
        Vous devez être connecté pour accéder à cette page.
    @else
        <x-page-title hrSize="70%">Historique des plongées de
            {{ session('user')->US_FIRST_NAME . ' ' . session('user')->US_NAME }}</x-page-title>
        <x-page-title>Plongées de
            {{ session('user')->US_FIRST_NAME . ' ' . session('user')->US_NAME }} | {{ $usersCount }} plongées restantes</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">
        <p style="font-size: 35px"> A venir </p>
        <hr style="height: 3px;background-color: black;margin-bottom: 30px;margin-top: 5px; width : 20%;">
        <table style="text-align: left; width: 100%; margin-bottom: 50px;">
            <thead class="text-xs text-gray-700 bg-gray-50" style="border-bottom: 1px solid black; font-size: 15px;">
                <tr>
                        <th scope="col" class="px-12 py-3">Nombre de plongées</th>
                    </tr>
                </thead>
                <tbody>
                    <tr class="odd:bg-white even:bg-gray-50 border-b">
                        <td class="px-12 py-4">{{ $usersCount }}</td>
                    </tr>
                </tbody>
            </table>
        </div>

        <x-page-subtitle> A venir </x-page-subtitle>
        <div class="mt-10 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">
                    <tr>
                        <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">Heure</th>
                        <th scope="col" class="px-6 py-3">Rôle</th>
                    <th scope="col" class="px-12 py-3">Date</th>
                    <th scope="col" class="px-12 py-3">Heure</th>
                    <th scope="col" class="px-12 py-3">Rôle</th>
                    <th scope="col" class="px-12 py-3">Lieu</th>
                </tr>
            </thead>
            <tbody>
                @foreach ($datesA as $dateA)
                    <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>
                            @if($dateA->CAR_SCHEDULE == 'Matin')
                                <td class="px-6 py-4">9:00 - 12:00</td>
                            @elseif($dateA->CAR_SCHEDULE == 'Apres-midi')
                                <td class="px-6 py-4">13:00 - 17:00</td>
                            @elseif($dateA->CAR_SCHEDULE == 'Soir')
                                <td class="px-6 py-4">18:00 - 21:00</td>
                            @endif
                            <td class="px-6 py-4">{{ $dateA->ROL_LABEL }}</td>
                        <td class="px-12 py-4">{{ $dateA->DS_DATE }}</td>
                        <td class="px-12 py-4">{{ $dateA->CAR_SCHEDULE }}</td>
                        <td class="px-12 py-4">{{ $dateA->ROL_LABEL }}</td>
                        <td class="px-12 py-4">{{ $dateA->DL_NAME }}</td>
                    </tr>
                @endforeach
            </tbody>
        </table>
        </div>
        
        <x-page-subtitle> Ayant eu lieu </x-page-subtitle>
        <div class="mt-10 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">

        <p style="font-size: 35px"> Ayant eu lieu </p>
        <hr style="height: 3px;background-color: black;margin-bottom: 30px;margin-top: 5px; width : 20%">
        <table style="text-align: left; width: 100%;  margin-bottom: 50px;">
            <thead class="text-xs text-gray-700 bg-gray-50" style="border-bottom: 1px solid black; font-size: 15px;">
                <tr>
                        <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">Heure</th>
                        <th scope="col" class="px-6 py-3">Rôle</th>
                    <th scope="col" class="px-12 py-3">Date</th>
                    <th scope="col" class="px-12 py-3">Heure</th>
                    <th scope="col" class="px-12 py-3">Rôle</th>
                    <th scope="col" class="px-12 py-3">Lieu</th>
                </tr>
            </thead>
            <tbody>
                @foreach ($datesB as $dateB)
                    <tr class="odd:bg-white even:bg-gray-50 border-b">
                            <td class="px-6 py-4">{{ $dateB->DL_NAME }}</td>
                            <td class="px-6 py-4">{{ $dateB->DS_DATE }}</td>
                            @if($dateB->CAR_SCHEDULE == 'Matin')
                                <td class="px-6 py-4">9:00 - 12:00</td>
                            @elseif($dateB->CAR_SCHEDULE == 'Apres-midi')
                                <td class="px-6 py-4">13:00 - 17:00</td>
                            @elseif($dateB->CAR_SCHEDULE == 'Soir')
                                <td class="px-6 py-4">18:00 - 21:00</td>
                            @endif
                            <td class="px-6 py-4">{{ $dateB->ROL_LABEL }}</td>
                        <td class="px-12 py-4">{{ $dateB->DS_DATE }}</td>
                        <td class="px-12 py-4">{{ $dateB->CAR_SCHEDULE }}</td>
                        <td class="px-12 py-4">{{ $dateB->ROL_LABEL }}</td>
                        <td class="px-12 py-4">{{ $dateB->DL_NAME }}</td>
                    </tr>
                @endforeach
            </tbody>
        </table>
        </div>
    @endif
</x-layout>
+1 −0
Original line number Diff line number Diff line
@@ -77,5 +77,6 @@
            </table>
        </div>
    </div>
    
    <script type="text/javascript" src="/js/drop-down.js"></script>
</x-layout>
+4 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
                        <th scope="col" class="px-6 py-3">Sécurité surface</th>
                        <th scope="col" class="px-6 py-3">Pilote</th>
                        <th scope="col" class="px-6 py-3">Directeur de plongée</th>
                        <th scope="col" class="px-6 py-3">Nombre de plongées</th>
                    </tr>
                </thead>
                <tbody>
@@ -48,6 +49,9 @@
                                    name="checkbox_{{ $users[0][$i][0] }}_DIR" value="DIR"
                                    @if (array_search('DIR', $users[1][$i]) !== false) checked @endif>
                            </td>
                            <td class="px-6 py-4">
                                {{$usersDives[$i]}}
                            </td>
                        </tr>
                    @endforeach
                </tbody>
+5 −3
Original line number Diff line number Diff line
@@ -5,6 +5,11 @@
    <div style="display : flex; flex-direction: row">
        <div style="width: 50%; margin-right: 50px; height: 100%; display:flex; align-items: center; flex-direction: column">
            <img src="{{ asset('/images/Diver1.png') }}" alt="Diver illustration">
            <div style="width: 100%">
                @if(isset($error))
                    <x-popup bgPopup="var(--bad)">{{$error}}</x-popup>
                @endif
            </div>
        </div>

        <form action="/dive/update/{{$dive->DS_CODE}}" method="POST" style="width: 70%;">
@@ -187,9 +192,6 @@ class="clickableDelete clickable block w-full max-w-xs mx-auto bg-red-400 hover:
                </form>
            </div>
        </form>
        @if(isset($error))
            <x-popup>{{$error}}</x-popup>
        @endif
    </div>

    <script src="{{ asset('/js/create_div.js') }}"></script>