@extends('admin.admin-master') 
@section('content')
<div>&nbsp; </div>
<div>&nbsp; </div>
<h3><i class="fa fa-users"></i> Users </h3>
<div>&nbsp; </div>
<!--- User List table  ---->
<div class="col-md-12">
    <div class="col-md-3"><h4>Total user : {{$users['count_user']}}</h4></div>
    <div class="col-md-9 text-right"><a href="/admin/csv?group_id={{Input::get('group_id')}}" class="btn btn-sm btn-info"><i class="fa fa-download"></i> Download CSV </a></div>
    <div class="clearfix">&nbsp;</div>
    <div class="clearfix">&nbsp;</div>
    <div class="col-md-12">
        <div class="row">
            <div class="col-md-4">
                <?php
                $qzgrp = array();
                $qzgrp[0] = 'Select Quiz Group';
                if (!empty($quiz_group)) {
                    foreach ($quiz_group as $q) {
                        $qzgrp[$q->group_id] = $q->group_name;
                    }
                }
                ?>
                {{Form::select('group_id',$qzgrp,Input::get('group_id'),array('class'=>'form-control input-sm'))}}

            </div>
            <div class="col-md-4"></div>
            <div class="col-md-4"></div>
        </div>
        <div class="clearfix">&nbsp;</div>
        <table class="table input-sm table-condensed table-striped">
            <tr><th class="hidden-xs">Avatar</th><th>Name</th><th class="hidden-xs"> Email </th><th> Join date </th><th> Action  </th></tr>
            @foreach($users['data'] as $u)
            <tr>
             <td class="hidden-xs"><a href="https://facebook.com/{{$u->fbid}}"><img src="https://graph.facebook.com/{{$u->fbid}}/picture" class="img-thumbnail" alt="No Image"></a></td>
              {{---  <td class="hidden-xs">
                <a href="https://facebook.com/2">
                    <img src="{{url()}}/public/images/{{rand(1,10)}}.jpg" class="img-responsive img-thumbnail" width="70">
                </a>
                ---}}
            </td>
            <td> {{$u->name}}</td>
            <td class="hidden-xs"> {{$u->email}}</td>
            <td> {{Util::getdate($u->created_at,'Y-m-d h:s A')}} </td>
            <td nowrap>
                <button data-toggle="tooltip" data-placement="bottom" title="Block/Unblock user" class="btn btn-sm {{($u->status==1)?'btn-info':'btn-danger'}} block-user" uid="{{$u->fbid}}" url="/admin/block-user">{{($u->status==1)?'<i class="fa fa-user"></i>&nbsp;':'<i class="fa fa-user-times"></i>'}}</button>
                <a data-toggle="tooltip" data-placement="bottom" title="View result" class="btn btn-sm {{($u->status==1)?'btn-warning':'btn-danger'}}" uid="{{$u->fbid}}" href="/admin/user-details/{{$u->fbid}}"><i class="fa fa-eye"></i></a>
            </td>
            </tr>
            @endforeach
        </table>
        <center>{{$users['data']->appends(Input::except('page'))->links()}}</center>
    </div>
</div>
<!--- End User List table  ---->
<!---- Modal ------>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">Update new quiz</h4>
            </div>
            <div class="modal-body quiz-form">
            </div>
            <p class="">&nbsp;</p>
        </div>
    </div>
</div>
<script>
    $('select[name="group_id"]').on('change', function() {
        window.location='/admin/users?group_id='+$(this).val();
    });
</script>
<!---// Modal ------->
@stop
