<?php $__env->startSection("content"); ?>
<div>
    <ol class="breadcrumb">
      <li><a href="<?php echo e(URL::route('user.home')); ?>"><?php echo trans('messages.home'); ?></a></li>
      <li class="active"><?php echo trans('messages.access-controls'); ?></li>
    </ol>
</div>
<?php if(Session::has('message')): ?>
    <div class="alert alert-info"><?php echo Session::get('message'); ?></div>
<?php endif; ?>
<div class="panel panel-default">
            <div class="panel-heading ">
                <span class="glyphicon glyphicon-user"></span>
                <?php echo trans('messages.assign-roles-to-users'); ?>

            </div>
            <div class="panel-body" >
            <?php echo Form::open(array('route'=>'role.assign')); ?>

            <table class="table table-striped table-hover table-bordered">
                <thead>
                    <tr>
                        <th><?php echo Lang::choice('messages.user',2); ?></th>
                        <th colspan="<?php echo count($roles); ?>"><?php echo Lang::choice('messages.role',2); ?></th>
                    </tr>
                </thead>
                <tbody>
                <tr>
                    <td></td>
                    <?php $__empty_1 = true; foreach($roles as $role): $__empty_1 = false; ?>
                        <td><?php echo $role->name; ?></td>
                    <?php endforeach; if ($__empty_1): ?>
                        <td><?php echo trans('messages.no-roles-found'); ?></td>
                    <?php endif; ?>
                </tr>
                <?php $__empty_1 = true; foreach($users as $userKey=>$user): $__empty_1 = false; ?>
                    <tr>
                        <td><?php echo $user->username; ?></td>
                        <?php $__empty_2 = true; foreach($roles as $roleKey=>$role): $__empty_2 = false; ?>
                        <td>
                            <?php if($role == Role::getAdminRole() && $user == User::getAdminUser()): ?>
                                <span class="glyphicon glyphicon-lock"></span>
                                <?php echo Form::checkbox('userRoles['.$userKey.']['.$roleKey.']', '1', $user->hasRole($role->name),
                                array('style'=>'display:none')); ?>

                            <?php else: ?>
                               <?php echo Form::checkbox('userRoles['.$userKey.']['.$roleKey.']', '1', $user->hasRole($role->name)); ?>

                            <?php endif; ?>
                        </td>
                        <?php endforeach; if ($__empty_2): ?>
                            <td>[-]</td>
                        <?php endif; ?>
                    </tr>
                <?php endforeach; if ($__empty_1): ?>
                <tr><td colspan="2"><?php echo trans('messages.no-users-found'); ?></td></tr>
                <?php endif; ?> 
                </tbody>
            </table>
            <div class="form-group actions-row">
                    <?php echo Form::button("<span class='glyphicon glyphicon-save'></span> ".trans('messages.save'), 
                        array('class' => 'btn btn-primary', 'onclick' => 'submit()')); ?>

            </div>
            <?php echo Form::close(); ?>

        </div>
    </div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make("layout", array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>