@extends('layouts')

@section('title')
    User infomation
@stop

@section('content')
    <!-- Small boxes (Stat box) -->
    <section class="content">
        <div class="box box-danger">
            <div class="box-header">
                <h3 class="box-title">User registration</h3>
                <span class="pull-right"><a href="{{ route('register.create') }}" class="btn btn-primary btn-sm">New Staff</a> </span>
            </div>
            <!-- /.box-header -->
            <div class="box-body">
                <table id="example2" class="table table-bordered table-striped table-responsive">
                    <thead>
                    <tr>
                        <th>#</th>
                        <th>Full Name</th>
                        <th>E-mail</th>
                        <th>Username</th>
                        <th>Gender</th>
                        <th style="text-align: center">Email Verification</th>
                        <th>Role</th>
                        <th>Edit</th>
                        <th>Delete</th>
                    </tr>
                    </thead>
                    <tbody>
                    @if (count($user) > 0)
                        <?php $no = 1 ?>
                        @foreach($user as $bin )
                            <tr>
                                <td>{{ $no++ }}</td>
                                <td>{{$bin->name}}</td>
                                <td>{{$bin->email}}</td>
                                <td>{{$bin->username}}</td>
                                <td>
                                    @if ($bin->sex == 'm')
                                        Male
                                    @else
                                        Female
                                    @endif
                                </td>
                                <td style="text-align: center">
                                    @if(($bin->email_verified_at) == null)
                                        <i class="fa fa-times fa-2x text-danger" aria-hidden="true"></i>
                                    @else
                                        <i class="fa fa-check fa-2x text-success" aria-hidden="true"></i>
                                    @endif
                                </td>
                                <td>{{$bin->role}}</td>
                                <td>
                                    <a href="{{ route('register.edit', [$bin->uid]) }}" class="btn btn-success btn-sm btn-flat"><span class="fa fa-edit"></span> Edit</a>
                                </td>
                                <td>
                                    <form method="post" action="{{ route('register-delete', [$bin->id]) }}" >
                                        <input type="hidden" name="_method" value="DELETE">
                                        {{ csrf_field() }}
                                        <button class="btn btn-danger btn-sm btn-flat" onclick = "return confirm('Are you sure you want to delete {{ $bin->name }} ?');"><span class="fa fa-trash"></span> Trash</button>
                                    {{--{!! Form::close() !!}--}}
                                    </form>
                                </td>
                            </tr>
                        @endforeach
                    @endif
                    </tbody>
                </table>
            </div>
            <!-- /.box-body -->
        </div>

    </section>
@stop