Commit 6ef383e1 authored by Julien Sailly's avatar Julien Sailly
Browse files

feat: dives list and action implemented

parent 096797dc
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -33,4 +33,14 @@ function show($id) {
        $divingSession->DS_DATE = strftime('%d/%m/%Y', strtotime($divingSession->DS_DATE));
        return view('dive_infos_palanque', ['dive' => $divingSession, 'divers' => $divingSession->getParticipants(), 'creator' => $creator, 'security' => $security, 'director' => $director]);
    }

    function showManagementList() {
        $userID = session('user')->US_ID;
        $dives = DivingSession::select('DS_CODE', 'DS_ACTIVE', 'CAR_DIVING_SESSION.DL_ID', 'DS_DATE', 'DL_DEPTH', 'CAR_SCHEDULE', 'DL_NAME', 'DS_MAX_DEPTH')
            ->join('CAR_DIVING_LOCATION', 'CAR_DIVING_SESSION.DL_ID', '=', 'CAR_DIVING_LOCATION.DL_ID')
            ->where('DS_ACTIVE', '=', 1, 'and', 'DS_DATE', '>=', date('Y-m-d'), 'and', 'US_ID_CAR_DIRECT', '=', $userID)
            ->orderBy('DS_DATE', 'asc')
            ->get();
        return view('dives_list_management', ['dives' => $dives]);
    }
}
+55 −0
Original line number Diff line number Diff line
<x-layout>
    <link rel="stylesheet" href="/css/drop-down.css">
    <link rel="stylesheet" href="{{ asset('/css/app.css') }}">
    <x-page-title>Gestion de mes plongées en tant que directeur</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">Date</th>
                <th scope="col" class="px-6 py-3">Plage horaire</th>
                <th scope="col" class="px-6 py-3">Profondeur</th>
                <th scope="col" class="px-6 py-3">Lieu</th>
                <th scope="col" class="px-6 py-3">Actions</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 }}m</td>
                    <td class="px-6 py-4">{{ $dive->DL_NAME }}</td>
                    <td class="px-8 py-4">
                        <a href="{{ route('dives_show', ['id' => $dive->DS_CODE]) }}">
                            <x-button>
                                <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
                                    <path stroke-linecap="round" stroke-linejoin="round" d="m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z" />
                                </svg>
                            </x-button>
                        </a>
                        <x-button diveId="dropdownButton-{{$dive->DS_CODE}}">
                            <svg class="w-6 h-6 text-gray-800 text-white" aria-hidden="true"
                                 xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 18">
                                <path
                                    d="M14 2a3.963 3.963 0 0 0-1.4.267 6.439 6.439 0 0 1-1.331 6.638A4 4 0 1 0 14 2Zm1 9h-1.264A6.957 6.957 0 0 1 15 15v2a2.97 2.97 0 0 1-.184 1H19a1 1 0 0 0 1-1v-1a5.006 5.006 0 0 0-5-5ZM6.5 9a4.5 4.5 0 1 0 0-9 4.5 4.5 0 0 0 0 9ZM8 10H5a5.006 5.006 0 0 0-5 5v2a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1v-2a5.006 5.006 0 0 0-5-5Z"/>
                            </svg>
                        </x-button>
                    </td>
                </tr>
                <x-drop-down id="dropdown{{$dive->DS_CODE}}">
                    @php
                        $participants = $dive->getParticipants();
                    @endphp
                    <div class="drop-down">
                        @foreach($participants as $user)
                            <p class = "drop-down-items">{{$user->US_NAME}} {{$user->US_FIRST_NAME}}</p>
                        @endforeach
                    </div>
                </x-drop-down>
            @endforeach
            </tbody>
        </table>
    </div>
</x-layout>
<script type="text/javascript" src="/js/drop-down.js"></script>
+3 −0
Original line number Diff line number Diff line
@@ -151,3 +151,6 @@
Route::middleware('App\Http\Middleware\rightChecker')
    ->get('dive/{id}', [DivesList::class, 'show'])
    ->name('dives_show');

Route::middleware('App\Http\Middleware\rightChecker')
    ->get('manage/dives', [DivesList::class, 'showManagementList']);