@extends('admin.layouts.app')

@section('header-script')
@include('admin.layouts.datatable-header')
@endsection


@section('content')
<!-- Page-Title -->
<div class="col-md-12">
    <div class="col-md-12 pd-0">
        <div class="u-shadow-v21 nbr g-bg-white rounded notice-board  mg-0 wow slideInUp" data-wow-duration="3s">
            <div class="media g-mb-15">
                <div>
                    <div class="bar-title">
                        <h5><a href=""><span> অংশগ্রহনকারীদরে নামের তালিকা
                                </span></a></h5>
                    </div>
                    <div style="overflow-x:auto;">
                        <table class="table table-dark table-responsive">
                        <thead>
                            <tr>
                                <th scope="col">ক্রমিক</th>
                                <th scope="col">অংশগ্রহনকারীর নাম</th>
                                <th scope="col">শ্রেণি</th>
                                <th scope="col">রোল</th>
                                <th scope="col">ছবি</th>
                                <th scope="col"> Published</th>
                                <th scope="col"> বাছাই</th>
                                <th scope="col"> এক </th>
                                <th scope="col"> দুই</th>
                                <th scope="col"> তিন</th>
                                <th scope="col"> চার</th>
                                <th scope="col"> পাঁচ</th>
                                <th scope="col"> ফাইনাল</th>
                                <th scope="col"> সম্পাদনা</th>
                                <th scope="col"> ডিলিট</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $i = 0; ?>
                            @if(count($users) > 0)

                            @foreach($users as $user)
                            <tr>
                                <?php $i+=1; ?>
                                <th scope="row">{{$i}}</th>
                                <td>{{$user->name}}</td>
                                <td>{{$user->class}}</td>
                                <td>{{$user->roll}}</td>
                                <td>
                                    <div> <a href="{{url('admin/perticipentlist')}}/{{$user->id}}">
                                            <img src="{{ URL::to('public/images/'.$user->picture)}}" height="45"
                                                width="45" />
                                        </a>

                                    </div>
                                </td>
                                <td>
                                    @if($user->permission == 1)
                                    {!! Form::open(['action' => ['AdminController@permission', $user->id],
                                    'method'=> 'POST']) !!}
                                    {!! Form::hidden('permission', 0)!!}
                                    {!! Form::hidden('_method', 'POST') !!}
                                    <button class="btn btn-success" type="submit"><i class="fa fa-check">
                                        </i></button>
                                    {!! Form::close() !!}
                                    @else

                                    {!! Form::open(['action' => ['AdminController@permission', $user->id],
                                    'method'=> 'POST']) !!}
                                    {!! Form::hidden('permission', 1)!!}
                                    {!! Form::hidden('user_id', $user->id)!!}
                                    {!! Form::hidden('round_id', 0)!!}
                                    {!! Form::hidden('status', 0)!!}
                                    {!! Form::hidden('_method', 'POST') !!}
                                    <button class="btn btn-danger" type="submit"><i class="fa fa-close">
                                        </i></button>
                                    {!! Form::close() !!}
                                    @endif
                                </td>


                                <td>
                                    @if($user->permission == 1)
                                    @if($user->selection == 1)
                                    {!! Form::open(['action' => ['AdminController@selection', $user->id],
                                    'method'=> 'POST']) !!}
                                    {!! Form::hidden('selection', 0)!!}
                                    {!! Form::hidden('_method', 'POST') !!}
                                    <button class="btn btn-success" type="submit"><i class="fa fa-refresh"> No
                                        </i></button>
                                    {!! Form::close() !!}

                                    @else

                                    {!! Form::open(['action' => ['AdminController@selection', $user->id],
                                    'method'=> 'POST']) !!}
                                    {!! Form::hidden('selection', 1)!!}
                                    {!! Form::hidden('user_id', $user->id)!!}
                                    {!! Form::hidden('round_id', 1)!!}
                                    {!! Form::hidden('status', 0)!!}
                                    {!! Form::hidden('_method', 'POST') !!}
                                    <button class="btn btn-danger" type="submit"><i class="fa fa-close">
                                        </i></button>
                                    {!! Form::close() !!}

                                    @endif
                                    @else
                                    <div class="btn btn-warning"> Disable</div>
                                    @endif
                                </td>
                                <td>
                                    @if($user->selection == 1)
                                    @if($user->round_1 == 1)
                                    {!! Form::open(['action' => ['AdminController@roundone', $user->id],
                                    'method'=> 'POST']) !!}
                                    {!! Form::hidden('round_1', 0)!!}
                                    {!! Form::hidden('_method', 'POST') !!}
                                    <button class="btn btn-success" type="submit"><i class="fa fa-refresh"> No
                                        </i></button>
                                    {!! Form::close() !!}
                                    @else
                                    {!! Form::open(['action' => ['AdminController@roundone', $user->id],
                                    'method'=> 'POST']) !!}
                                    {!! Form::hidden('round_1', 1)!!}
                                    {!! Form::hidden('_method', 'POST') !!}
                                    <button class="btn btn-danger" type="submit"><i class="fa fa-refresh"> yes
                                        </i></button>
                                    {!! Form::close() !!}
                                    @endif
                                    @else
                                    <div class="btn btn-warning"> Disable</div>
                                    @endif
                                </td>
                                <td>
                                    @if($user->round_1 == 1)
                                    @if($user->round_2 == 1)
                                    {!! Form::open(['action' => ['AdminController@roundtwo', $user->id],
                                    'method'=> 'POST']) !!}
                                    {!! Form::hidden('round_2', 0)!!}
                                    {!! Form::hidden('_method', 'POST') !!}
                                    <button class="btn btn-success" type="submit"><i class="fa fa-refresh"> No
                                        </i></button>
                                    {!! Form::close() !!}
                                    @else
                                    {!! Form::open(['action' => ['AdminController@roundtwo', $user->id],
                                    'method'=> 'POST']) !!}
                                    {!! Form::hidden('round_2', 1)!!}
                                    {!! Form::hidden('_method', 'POST') !!}
                                    <button class="btn btn-danger" type="submit"><i class="fa fa-refresh"> Yes
                                        </i></button>
                                    {!! Form::close() !!}
                                    @endif
                                    @else
                                    <div class="btn btn-warning"> Disable</div>
                                    @endif
                                </td>
                                <td>
                                    @if($user->round_2 == 1)
                                    @if($user->round_3 == 1)
                                    {!! Form::open(['action' => ['AdminController@roundthree', $user->id],
                                    'method'=> 'POST']) !!}
                                    {!! Form::hidden('round_3', 0)!!}
                                    {!! Form::hidden('_method', 'POST') !!}
                                    <button class="btn btn-success" type="submit"><i class="fa fa-refresh"> No
                                        </i></button>
                                    {!! Form::close() !!}
                                    @else
                                    {!! Form::open(['action' => ['AdminController@roundthree', $user->id],
                                    'method'=> 'POST']) !!}
                                    {!! Form::hidden('round_3', 1)!!}
                                    {!! Form::hidden('_method', 'POST') !!}
                                    <button class="btn btn-danger" type="submit"><i class="fa fa-refresh"> Yes
                                        </i></button>
                                    {!! Form::close() !!}
                                    @endif
                                    @else
                                    <div class="btn btn-warning"> Disable</div>
                                    @endif

                                </td>

                                <td>
                                    @if($user->round_3 == 1)
                                    @if($user->round_4 == 1)
                                    {!! Form::open(['action' => ['AdminController@roundfour', $user->id],
                                    'method'=> 'POST']) !!}
                                    {!! Form::hidden('round_4', 0)!!}
                                    {!! Form::hidden('_method', 'POST') !!}
                                    <button class="btn btn-success" type="submit"><i class="fa fa-refresh"> No
                                        </i></button>
                                    {!! Form::close() !!}

                                    @else

                                    {!! Form::open(['action' => ['AdminController@roundfour', $user->id],
                                    'method'=> 'POST']) !!}
                                    {!! Form::hidden('round_4', 1)!!}
                                    {!! Form::hidden('_method', 'POST') !!}
                                    <button class="btn btn-danger" type="submit"><i class="fa fa-refresh"> yes
                                        </i></button>
                                    {!! Form::close() !!}
                                    @endif
                                    @else
                                    <div class="btn btn-warning"> Disable</div>
                                    @endif
                                </td>
                                <td>
                                    @if($user->round_4 == 1)
                                    @if($user->round_5 == 1)
                                    {!! Form::open(['action' => ['AdminController@roundfive', $user->id],
                                    'method'=> 'POST']) !!}
                                    {!! Form::hidden('round_5', 0)!!}
                                    {!! Form::hidden('_method', 'POST') !!}
                                    <button class="btn btn-success" type="submit"><i class="fa fa-refresh"> No
                                        </i></button>
                                    {!! Form::close() !!}

                                    @else

                                    {!! Form::open(['action' => ['AdminController@roundfive', $user->id],
                                    'method'=> 'POST']) !!}
                                    {!! Form::hidden('round_5', 1)!!}
                                    {!! Form::hidden('_method', 'POST') !!}
                                    <button class="btn btn-danger" type="submit"><i class="fa fa-refresh"> Yes
                                        </i></button>
                                    {!! Form::close() !!}
                                    @endif
                                    @else
                                    <div class="btn btn-warning"> Disable</div>
                                    @endif
                                </td>
                                <td>
                                    @if($user->round_5 == 1)
                                    @if($user->round_6 == 1)
                                    {!! Form::open(['action' => ['AdminController@roundsix', $user->id],
                                    'method'=> 'POST']) !!}
                                    {!! Form::hidden('round_6', 0)!!}
                                    {!! Form::hidden('_method', 'POST') !!}
                                    <button class="btn btn-success" type="submit"><i class="fa fa-refresh"> No
                                        </i></button>
                                    {!! Form::close() !!}

                                    @else

                                    {!! Form::open(['action' => ['AdminController@roundsix', $user->id],
                                    'method'=> 'POST']) !!}
                                    {!! Form::hidden('round_6', 1)!!}
                                    {!! Form::hidden('_method', 'POST') !!}
                                    <button class="btn btn-danger" type="submit"><i class="fa fa-refresh"> Yes
                                        </i></button>
                                    {!! Form::close() !!}
                                    @endif
                                    @else
                                    <div class="btn btn-warning"> Disable</div>
                                    @endif
                                </td>
                                <td> <a href="{{url('admin/perticipentlist')}}/{{$user->id}}/edit"
                                        class="btn btn-danger btn-sm">
                                        <span class="glyphicon glyphicon-pencil"> </span>
                                    </a></td>
                                <td>
                                    <form class="form-horizontal" enctype="multipart/form-data" method="POST"
                                        action="{{action('UserController@delete', $user->id)}}">
                                        {{ csrf_field() }}
                                        <a href="{{url('admin/perticipentlist')}}/{{$user->id}}/delete"
                                            class="btn btn-danger btn-sm">
                                            <span class="glyphicon glyphicon-trash"> </span>
                                        </a>
                                    </form>
                                </td>
                            </tr>
                            @endforeach
                            @else
                            <tr>
                                <td> No Data Found</td>
                            </tr>
                            @endif

                        </tbody>
                    </table>
                    {{$users->links()}}
                    </div>
                    <div>



                    </div>
                </div>

            </div>
        </div>
    </div>


    <!-- end row -->
    @endsection

    @section('footer-script')
    @include('admin.layouts.datatable-footer-script')
    @endsection