@extends('layouts.app')

@section('content')
    <div class="row nomargins">
        <div class="card card-primary">
            <aside class="panel panel-default">
                <div class="panel-heading">
                    <a href="{{route('createRole')}}" class="btn btn-raised btn-primary">New Role</a>
                    <hr/>

                    <h3 class="text-center">All Store Users</h3>
                </div>

                <div class="panel-body">
                    @include('includes.flash')
                    <table id="dataTables" class="display table-responsive table-stripped" width="100%" cellspacing="0">
                        <thead>

                        <tr>
                            <th>S/N</th>
                            <th>Name</th>
                            <th>Branch</th>
                            <th>Role</th>
                            <th>Email</th>
                            <th>Status</th>
                            <th>Action</th>
                        </tr>

                        </thead>

                        <tbody>
                        <?php $i = 0; ?>
                        @foreach($roles as $role)
                            <tr>
                                <td><?= ++$i; ?></td>
                                <td>{!!$role->name!!}</td>
                                <td>
                                    {!!$role->storeName!!}
                                </td>
                                <td>
                                    {!!$role->role_id!!}
                                </td>
                                <td>{!!$role->email!!}</td>
                                <td>
                                    {!!$role->status == 0? 'Inactive':'Active'!!}
                                </td>
                                <td>
                                    <div class="btn-group">
                                        <button type="button" class="btn btn-primary btn-raised">Action</button>
                                        <button type="button" class="btn btn-primary btn-raised dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                            <i class="zmdi zmdi-chevron-down right only"></i>
                                        </button>
                                        <ul class="dropdown-menu dropdown-menu-primary">
                                            <li class="">
                                                <a href="{{route('edRole', $role->id)}}" data-store="{{$role->store_id}}">Edit Role  &nbsp;&nbsp; &nbsp;<i class="fa fa-edit" style=""></i></a>
                                            </li>

                                            <li>
                                                <a href="{{url('admin/roles'.$role->id.'/delete')}}" id="delete-btn" onclick="return confirm('Are you sure you want to delete the product?')" data-action="{{'/product/'.$role->id.'/delete'}}">Delete &nbsp; &nbsp; &nbsp; &nbsp;<i class="fa fa-trash" style=""></i></a>
                                            </li>

                                            <li role="separator" class="divider"></li>

                                            <li>

                                            </li>
                                        </ul>
                                    </div>
                                </td>
                            </tr>
                        @endforeach

                        </tbody>
                    </table>
                </div>

                <div class="panel-footer"></div>
            </aside>
        </div>
    </div>

@endsection

