{{-- 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">
        <form action="" method="POST" target="new" class="form-horizontal" id="adminprintsheetform">
            @csrf
            <div class="row">

                <div class="form-group row">

                    <div class="col-sm-2">
                        <select class="form-control" id="eventid" name="eventid" required>
                            <option value="" selected="">Event</option>
                            <?php
                            foreach ($events as $row) {
                                echo "<option value='" . $row['id'] . "'";
                                echo ">" . $row['Name'] . "</option>";
                            }
                            ?>
                        </select>
                    </div>

                    <div class="col-sm-2">
                        <select class="form-control" id="level" name="level">
                            <option value="">Level</option>
                            <option value="L1">L1</option>
                            <option value="L2">L2</option>
                            <option value="L3">L3</option>
                        </select>
                    </div>


                    <div class="col-sm-2">
                        <select class="form-control" id="gender" name="gender">
                            <option value="">Gender</option>
                            <option value="M">M</option>
                            <option value="F">F</option>
                        </select>
                    </div>

                    <div class="col-sm-2">
                        <select class="form-control" id="club" name="club">
                            <option value="">Club</option>
                            @foreach ($clubs as $row)
                            <option value="{{$row->club}}">{{$row->club}}</option>
                            @endforeach
                        </select>
                    </div>
                    <div class="col-sm-2">
                        <select class="form-control" id="apid" name="apid">
                            <option value="">Apparatus</option>
                            <option value="8">Balance Beam</option>
                            <option value="9">Floor Exercise</option>
                            <option value="13">High Bar</option>
                            <option value="11">Parallel Bars</option>
                            <option value="14">Pommel Horse</option>
                            <option value="10">Still Rings</option>
                            <option value="6">Vault</option>
                        </select>
                    </div>

                </div>
            </div>
            <div class="row">
                <div class="col-lg-12 ml-lg-auto">
                    <table>
                        <tbody>
                            <tr>
                                <td><input type="submit" name="btnSubmit" class="btn btn-primary btn-sm btnsubmit" data-target="signsheet" style="width:180px;" value="Signsheet"></td>
                                <td>Select Event,Category,Gender.Print empty sign sheet</td>
                            </tr>
                            <tr>
                                <td colspan="2">&nbsp;</td>
                            </tr>
                            <tr>
                                <td><input type="submit" name="btnSubmit" class="btn btn-primary btn-sm btnsubmit" data-target="scoresheet" style="width:180px;" value="Scoresheet"></td>
                                <td>Select Event,Category,Gender.Print empty score sheet</td>
                            </tr>
                            <tr>
                                <td colspan="2">&nbsp;</td>
                            </tr>
                            <tr>
                                <td><input type="submit" name="btnSubmit" class="btn btn-primary btn-sm btnsubmit" data-target="leaderboardrpt" style="width:180px;" value="Leaderboard"></td>
                                <td>Click to View Leaderboard.</td>
                            </tr>
                            <tr>
                                <td colspan="2">&nbsp;</td>
                            </tr>
                            <tr>
                                <td><input type="submit" name="btnSubmit" class="btn btn-primary btn-sm btnsubmit" data-target="allaroundrpt" style="width:180px;" value="All Around"></td>
                                <td>Click to View All Around Result.</td>
                            </tr>
                            <tr>
                                <td colspan="2">&nbsp;</td>
                            </tr>
                            <tr>
                                <td><input type="submit" name="btnSubmit" class="btn btn-primary btn-sm btnsubmit" data-target="printagimresult.php" style="width:180px;" value="PrintResultpdf"></td>
                                <td>Use this page print complete results.</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </form>
    </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 type="text/javascript">
    $(document).ready(function() {
        $(".btnsubmit").on("click", function() {
            $("#adminprintsheetform").attr("action", $(this).attr('data-target'));
            $("#adminprintsheetform").submit();
        })
    });
</script>

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