Commit 9fcb72ea authored by Andgel Brissaud's avatar Andgel Brissaud
Browse files

feat: basic drop down menu for participants

parent 75792691
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
<button class="m-1 @if (isset($color) && $color != "") {{ $color }} @else bg-gray-400 @endif @if (isset($colorHover) && $colorHover != "") {{ $colorHover }} @else hover:bg-gray-500 @endif text-gray-800 font-bold py-2 px-4 rounded inline-flex items-center">
<button class="
    m-1 
    @if (isset($color) && $color != "") 
        {{ $color }} 
    @else 
        bg-gray-400 
    @endif 
    @if (isset($colorHover) && $colorHover != "") 
        {{ $colorHover }} 
    @else hover:bg-gray-500 
    @endif 
    text-gray-800 font-bold py-2 px-4 rounded inline-flex items-center
    @if (isset($diveId) && $diveId!="")
    diveDropdownButton
    @endif
" 
@if (isset($diveId) && $diveId!="")
    id = "{{$diveId}}"
@endif

>
    {{ $slot }}
</button>
+5 −0
Original line number Diff line number Diff line
<tr id="{{$id}}" class="odd:bg-white even:bg-gray-50 border-b hidden">
    <td>
       {{$slot}} 
    </td>
</tr>
 No newline at end of file
+31 −3
Original line number Diff line number Diff line
@@ -31,15 +31,13 @@
                                </svg>
                            </x-button>
                        </a>
                        <a href="/dives/list-divers/{{$dive->DS_CODE}}">
                            <x-button>
                        <x-button diveId="dropdownButton-{{$dive->DS_CODE}}">
                            <svg class="w-6 h-6 text-gray-800 dark: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>
                        </a>
                        @if ($errors->any())
                            <div class="alert alert-danger">
                                <ul>
@@ -51,8 +49,38 @@
                        @endif
                    </td>
                </tr>
                <x-drop-down id="dropdown{{$dive->DS_CODE}}">
                    @php
                    $participants = $dive->getParticipants();
                    @endphp

                    @foreach($participants as $user)   
                        <p>{{$user->US_NAME}} {{$user->US_FIRST_NAME}}</p>
                    @endforeach
                </x-drop-down>
            @endforeach
            </tbody>
        </table>
    </div>

    <script>
        let buttons = document.getElementsByClassName('diveDropdownButton');

        console.log(buttons.length)

        for(let i = 0; i < buttons.length; i++){
            button = buttons[i]
            button.addEventListener('click', (evt) => {
                toggleDropDownMenu(evt);
            });
        }

        function toggleDropDownMenu(evt){
            let button = evt.currentTarget
            let sessionCode = button.id.split('-')[1];
            console.log('dropdown'+sessionCode);
            let disclosure = document.getElementById('dropdown'+sessionCode);
            disclosure.classList.toggle('hidden');
        }
    </script>
</x-layout>
+0 −7
Original line number Diff line number Diff line
@foreach($users as $user)   
<p>{{$user->US_NAME}} {{$user->US_FIRST_NAME}}</p>
@endforeach

<x-button>
    <a href="/dives">Retour à la séance</a>
</x-button>
 No newline at end of file