@extends("layouts.main_layout", ['title' => "E-Mensa"])
<?php use Illuminate\Support\Facades\Session; ?>

@section("header")
    <link rel="stylesheet" href="/css/style.css">
@endsection

@section("nav")
    <div class="grid">
        <div>
            <img src="/img/fh-logo.jpg" alt="FH-Logo">
        </div>
        <div>
            <a href="#ankündigung">Ankündigung</a>
            <a href="#speisen">Speisen</a>
            <a href="#zahlen">Zahlen</a>
            <a href="#kontakt">Kontakt</a>
            <a href="#wichtig">Wichtig für uns</a>

        </div>
        <div>

            @if(session("start",0)== 0)
                <a href="/anmeldung">Anmelden</a>
            @else
                Angemeldet als:<br>
                <div>{{ session("name")}}</div>
                <a href="/abmeldung">Abmelden</a>
            @endif
        </div>
    </div>

@endsection

@section("text")
    @if(isset($data))
        {{$id = $data["gerichtid"]}}
    @endif

    @if(isset($gericht))
            <?php
            $gericht = $gericht[0];

            $bildname = $gericht->bildname;

            if ($bildname == Null) {
                $bildname = "00_image_missing.jpg";
            }

            $bildname = "/img/gerichte/" . $bildname;

            ?>

            <div class="grid_bewertung">
                <div>

                </div>
                <div>
                    <img class="bewertung" src="{{$bildname}}" alt="Bild vom Gericht" width= "10" height="10">
                </div>
                <div>
                    <h1>{{$gericht->name}}</h1>


                    <form action="/bewertung_abschicken" method="post">
                        @method("post")
                        @csrf <!-- {{ csrf_field() }} -->
                        <label for="sterne">Sterne 1-4</label>
                        <input id="sterne" name="sterne" type="number" placeholder="1-4" required maxlength="4">

                        <label for="Bemerkung">Bemerkung</label>
                        <input id="bemerkung"  name="bemerkung" type="text" placeholder="Bemerkung" required maxlength="200">

                        <input type="hidden" name="gericht_id" value={{ $id}}>

                        <button type="submit" >Bewerten</button>
                    </form>
                </div>
                <div>

                </div>
            </div>



    @else



    @endif
@endsection

@section("gerichte")


@endsection

@section("footer")

    <tr>
        <td>(c) E-Mensa GmbH</td>
        <td>Şafak Hazinedar & Robert Joel</td>
        <td><a href="">Impressum</a></td>
    </tr>

@endsection
