{{-- 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">
            @if(session()->has('message'))
            <div class="alert alert-danger">
                {{ session()->get('message') }}
            </div>
            @endif
            <h3 class="card-label">{{ $eventdata[0]->Name }}
            </h3>
        </div>
        <div class="card-toolbar">
            <a href="{{route('newparticipant')}}" class="btn btn-warning">Register New Gymnast
            </a>
        </div>

    </div>
    @if(count($currentparticipants)>0)
    <div class="card-body">
        <table class="table" id="kt_datatable1">
            <thead>
                <tr>
                    <th>Action</th>
                    <th>Name</th>
                    <th>Gender</th>
                    <th>DOB</th>
                    <th>level</th>
                </tr>
            </thead>
            <tbody>
                @foreach ($currentparticipants as $row)
                <tr>
                    <td>
                        <?php if ($row->amountpaid == '' && $row->remarks != 'success') { ?>
                            <form method="post" action="{{route('redirectToPayU')}}">
                                @csrf
                                <input type="hidden" name="orderid" value="{{$row->oid}}" />
                                <input type="submit" class="btn btn-primary font-weight-bolder" value="Pay Now Rs. {{ $row->fees }}">
                            </form>
                        <?php } else { ?>
                            <span class="badge badge-info">Paid Rs. {{ $row->fees }}
                        </span>
                        <?php } ?>
                    </td>
                    <td>{{$row->name}}</td>
                    <td>{{$row->Gender}}</td>
                    <td>{{$row->dob}}</td>
                    <td>{{$row->level}}</td>
                </tr>
                @endforeach
            </tbody>
        </table>
    </div>
    @endif
    @if(count($oldparticipants)>0)
    <div class="card-body">
        <table class="table table-bordered table-hover" id="kt_datatable2">
            <thead>
                <tr>
                    <th>Action</th>
                    <th>Name</th>
                    <th>Gender</th>
                    <th>DOB</th>
                </tr>
            </thead>
            <tbody>
                @foreach ($oldparticipants as $row)
                <tr>
                    <td>
                        <a href="{{route('participant',$row->id)}}" class="btn btn-success">Register
                        </a>
                    </td>
                    <td>{{$row->name}}</td>
                    <td>{{$row->Gender}}</td>
                    <td>{{$row->dob}}</td>
                </tr>
                @endforeach
            </tbody>
        </table>
    </div>
    @endif
</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>

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