<!DOCTYPE html>
<html>

@include('includes.head')


<body class="hold-transition skin-blue fixed sidebar-mini">
    <!-- Site wrapper -->
    <div class="wrapper">

        @include('includes.header')
        <!-- =============================================== -->

        <!-- Left side column. contains the sidebar -->
        @include('includes.side-nav')

        <!-- =============================================== -->

        <!-- Content Wrapper. Contains page content -->
        <div class="content-wrapper">
            <!-- Content Header (Page header) -->
            <section class="content-header">
                <h1>
                    System Users
                    <small>Manage System Users</small>
                </h1>
                <ol class="breadcrumb">
                    <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
                    <li><a href="#">Human Resources</a></li>
                    <li class="active">System Users</li>
                </ol>
            </section>

            <!-- Main content -->
            <section class="content">
                @include('includes.messages')
                <!-- Default box -->
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">System Users</h3>

                        <div class="box-tools pull-right">
                            <a href="{{ route('hr.staff.create') }}" class="btn btn-block btn-primary btn-flat"
                                data-toggle="tooltip" title="Create System User">
                                <i class="fa fa-plus"></i> Create User</a>

                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-12">
                            <div class="box-body">
                                <table class="table table-bordered table-hover">
                                    <tr>
                                        <th>Sl No.</th>
                                        <th style="width: 180px">User Reference</th>
                                        <th>Name</th>
                                        <th>Email</th>
                                        <th>Phone Number</th>
                                        <th>Role</th>
                                        <th style="width: 150px">Action</th>
                                    </tr>
                                    @foreach($records as $index=>$record)
                                    <tr>
                                        <td>{{$index + $records->firstItem()}}</td>
                                        <td>{{$record->ref}}</td>
                                        <td>{{$record->name}}</td>
                                        <td>{{$record->email}}</td>
                                        <td>{{$record->phone_number}}</td>
                                        <td>{{$record->role_name}}</td>


                                            @if ($record->is_super_user)
                                            <td>
                                                NA
                                            </td>
                                            @else
                                            <td>
                                                <div class="btn-group">
                                                    <a href="{{route('hr.staff.view',$record->id)}}" type="button"
                                                        class="btn btn-info btn-flat">View</a>
                                                    <button type="button" class="btn btn-info btn-flat dropdown-toggle"
                                                        data-toggle="dropdown">
                                                        <span class="caret"></span>
                                                        <span class="sr-only">Toggle Dropdown</span>
                                                    </button>
                                                    <ul class="dropdown-menu" role="menu">
                                                        <li><a href="{{route('hr.staff.view',$record->id)}}">View</a></li>
                                                        <li><a href="#">Update</a></li>

                                                    </ul>
                                                </div>
                                            </td>
                                            @endif


                                    </tr>
                                    @endforeach

                                </table>
                                {{ $records->appends(request()->input())->links() }}
                            </div>
                            <!-- /.box-body -->

                        </div>

                    </div>

                </div>
                <!-- /.box -->

            </section>
            <!-- /.content -->
        </div>
        <!-- /.content-wrapper -->

        @include('includes.footer')

    </div>
    <!-- ./wrapper -->

    @include('includes.scripts')
</body>

</html>
