<?php $__env->startSection('title', 'Users - Edit #' . $user->id); ?>

<?php $__env->startSection('content_header', 'Users <small>edit user</small>'); ?>

<?php $__env->startSection('content'); ?>
    <div class="row">
        <section class="col-lg-12">
            <div class="nav-tabs-custom">
                <?php echo $__env->make('admin.users._partials.tabs', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                <div class="tab-content">
                    <div class="tab-pane active">
                        <form class="form-horizontal" method="POST" action="<?php echo e(route('admin.users.update', $user->id)); ?>">
                            <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
                            <?php if(count($errors) > 0): ?>
                                <div class="alert alert-danger alert-dismissable">
                                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                                    <h4><i class="icon fa fa-ban"></i> <strong>Whoops!</strong> There were some problems with your input.</h4>
                                    <ul>
                                        <?php foreach($errors->all() as $error): ?>
                                            <li><?php echo e($error); ?></li>
                                        <?php endforeach; ?>
                                    </ul>
                                </div>
                            <?php endif; ?>
                            <div class="form-group <?php if($errors->has('name')): ?> has-error <?php endif; ?>">
                                <label for="inputName" class="col-sm-2 control-label">Name</label>
                                <div class="col-sm-10">
                                    <input name="name" type="text" class="form-control" id="inputName" value="<?php echo e(old('name', $user->name)); ?>">
                                </div>
                            </div>
                            <div class="form-group <?php if($errors->has('email')): ?> has-error <?php endif; ?>">
                                <label class="col-sm-2 control-label">Email</label>
                                <div class="col-sm-10">
                                    <p class="form-control-static"><?php echo e($user->email); ?></p>
                                </div>
                            </div>
                            <div class="form-group <?php if($errors->has('role')): ?> has-error <?php endif; ?>">
                                <label for="selectRole" class="col-sm-2 control-label">Role</label>
                                <div class="col-sm-10">
                                    <select name="role" id="selectRole" class="form-control">
                                        <option value="agency" <?php if(old('role', $user->role) == 'agency'): ?> selected <?php endif; ?>>agency</option>
                                        <option value="admin" <?php if(old('role', $user->role) == 'admin'): ?> selected <?php endif; ?>>admin</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group <?php if($errors->has('new_password')): ?> has-error <?php endif; ?>">
                                <label for="inputNewPassword" class="col-sm-2 control-label">New password</label>
                                <div class="col-sm-10">
                                    <input name="new_password" type="password" type="text" class="form-control" id="inputNewPassword">
                                </div>
                            </div>
                            <div class="form-group <?php if($errors->has('companies')): ?> has-error <?php endif; ?>">
                                <label for="selectCompanies" class="col-sm-2 control-label">Companies</label>
                                <div class="col-sm-10">
                                    <select name="companies[]" id="selectCompanies" multiple class="form-control">
                                        <?php foreach($companies as $company): ?>
                                            <option value="<?php echo e($company->id); ?>" <?php if(in_array($company->id, old('companies', $user->companies()->lists('company_id')))): ?> selected <?php endif; ?>><?php echo e($company->name); ?> #<?php echo e($company->id); ?></option>
                                        <?php endforeach; ?>
                                    </select>
                                </div>
                            </div>
                            <hr>
                            <div class="clearfix">
                                <div class="pull-right">
                                    <button type="submit" class="btn btn-success">Save</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </section>
    </div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>