{{-- Extends layout --}}
@extends('layout.default')

{{-- Content --}}
@section('content')

<div class="card card-custom">
    <div class="card-header flex-wrap border-0 pt-6 pb-0">
        <div class="card-title">
            <h3 class="card-label">View Results
            </h3>
        </div>
        <div class="card-toolbar">
        </div>
        @if(session()->has('success'))
        <div class="alert alert-success">
            {{ session()->get('success') }}
        </div>
        @endif
    </div>
    <div class="card-body">
        <div class="row">
            <form class="form" action="{{$action}}" method="POST">
                @csrf
                <div class="form-group row">
                    
                    <div class="col-sm-4">
                        <select class="form-control" id="eventid" name="eventid" required>
                            <option value="" selected="">Select Event</option>
                            <?php
                            foreach ($events as $row) {
                                echo "<option value='" . $row['id'] . "'";
                                if($formdata['eventid']==$row['id']) echo 'selected';
                                echo ">" . $row['Name'] . "</option>";
                            }
                            ?>
                        </select>
                    </div>
                   
                    <div class="col-sm-2">
                        <select class="form-control" id="level" name="level">
                            <option value="">Select Level</option>
                            <option value="L1" {{$formdata['level']=='L1'?'selected':''}}>L1</option>
                            <option value="L2" {{$formdata['level']=='L2'?'selected':''}}>L2</option>
                            <option value="L3" {{$formdata['level']=='L3'?'selected':''}}>L3</option>
                            <option value="L4" {{$formdata['level']=='L4'?'selected':''}}>L4</option>
                            <option value="L5" {{$formdata['level']=='L5'?'selected':''}}>L5</option>
                        </select>
                    </div>

                    
                    <div class="col-sm-2">
                        <select class="form-control" id="gender" name="gender">
                            <option value="">Select Gender</option>
                            <option value="M" {{$formdata['gender']=='M'?'selected':''}}>M</option>
                            <option value="F" {{$formdata['gender']=='F'?'selected':''}}>F</option>
                        </select>
                    </div>

                    <div class="col-lg-2">
                        <button type="submit" class="btn btn-success mr-2">Search</button>
                    </div>
                </div>
            </form>
        </div>
        <div class="row">
            <div class="col-lg-12 ml-lg-auto">
                <table class="table" id="kt_datatable1">
                    <thead>
                        <tr>
                            <th>Gymnast</th>
                            <th>Club</th>
                            <th>Level</th>
                            <th>Apparatus</th>
                            <th>D Score</th>
                            <th>E1</th>
                            <th>E2</th>
                            <th>Penalty</th>
                            <th>Total</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach ($result as $row)
                        <tr>
                            <td>{{ $row ->name }}</td>
                            <td>{{ $row ->club }}</td>
                            <td>{{ $row ->level }}</td>
                            <td>{{ $row ->gname }}</td>
                            <td>{{ $row ->dscore }}</td>
                            <td>{{ $row ->e1 }}</td>
                            <td>{{ $row ->e2 }}</td>
                            <td>{{ $row ->penalty }}</td>
                            <td>{{ $row ->total }}</td>
                        </tr>
                        @endforeach
                    </tbody>
                </table>
            </div>
        </div>

    </div>
</div>
@endsection
{{-- Styles Section --}}
@section('styles')
<link href="{{ asset('plugins/custom/datatables/datatables.bundle.css') }}" rel="stylesheet" type="text/css" />
@endsection
{{-- Scripts Section --}}
@section('scripts')
{{-- vendors --}}
<script src="{{ asset('plugins/custom/datatables/datatables.bundle.js') }}" type="text/javascript"></script>

{{-- page scripts --}}
<script src="{{ asset('js/pages/crud/datatables/extensions/rnrbutton.js') }}" type="text/javascript"></script>

<script src="{{ asset('js/app.js') }}" type="text/javascript"></script>
@endsection