Commit 0c41cf52 authored by Waterfox's avatar Waterfox
Browse files

Add previous dives to session data

parent e1a7985e
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -4,7 +4,27 @@

    <div style="display : flex; flex-direction: row">
        <div style="width: 50%; margin-right: 50px; height: 100%; display:flex; align-items: center; flex-direction: column">
            @if(isset($precedent))
                <img src="{{ asset('/images/Diver1.png') }}" alt="Diver illustration">
            @else
                <p>Plongées crées</p>
                <table>
                    <tr>
                        <th>Date et heure</th>
                        <th>Nombre maximum d'inscrits</th>
                        <th>Site</th>
                        <th>Niveau requis</th>
                    </tr>
                    @foreach ($precedent as $dive)
                        <tr>
                            <td>{{ $dive->DS_DATE }}</td>
                            <td>{{ $dive->DS_MAX_DIVERS }}</td>
                            <td>{{ $dive->DL_NAME }}</td>
                            <td>{{ $dive->PRE_CODE }}</td>
                        </tr>
                    @endforeach
                </table>
            @endif
        </div>
        <form action="/create/dive" method="POST" style="width: 70%;font-size: 20px;">
            @csrf
+6 −0
Original line number Diff line number Diff line
@@ -69,6 +69,12 @@
    ->post('/create/dive', function(Request $request)
{
    $pre = DiveSessionCreation::add($request);

    $previousDives = session('previousDives', []);
    $previousDives[] = $pre;

    session(['previousDives' => $previousDives]);

    return view('create_dive',  ['locations' => DivingLocation::all(),  'boats' => Boat::all(), 'levels' => Prerogative::all(), 'users' => User::all(), 'precedent' => $pre]);
});