<?php $__env->startSection('title'); ?> Create Security <?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>

<div class='col-lg-4 col-lg-offset-4'>

    <h1><i class='fa fa-user'></i> Edit Security</h1>

    <?php echo Form::model($user->toArray() + $security->toArray(), ['role' => 'form',
        'action' => array('SecurityController@update', $security->id), 'method' => 'PUT']); ?>


    <div class='form-group'>
        <?php echo Form::label('username', 'Username'); ?>

        <?php echo Form::text('username', null, ['placeholder' => 'Username', 'class' => 'form-control', 'required']); ?>


        <?php if($errors->has('username')): ?>
        <div class='bg-danger alert'><?php echo $errors->first('username'); ?></div>
        <?php endif; ?>
    </div>

    <div class='form-group'>
        <?php echo Form::label('password', 'Password'); ?>

        <?php echo Form::text('password', null, ['placeholder' => 'Password', 'class' => 'form-control', 'required']); ?>


        <?php if($errors->has('password')): ?>
        <div class='bg-danger alert'><?php echo $errors->first('password'); ?></div>
        <?php endif; ?>
    </div>

    <div class='form-group'>
        <?php echo Form::label('name', 'Name'); ?>

        <?php echo Form::text('name', null, ['placeholder' => 'Name', 'class' => 'form-control', 'required']); ?>


        <?php if($errors->has('name')): ?>
        <div class='bg-danger alert'><?php echo $errors->first('name'); ?></div>
        <?php endif; ?>
    </div>

    <?php if(empty($buildings)): ?>
        <h3>No Buildings</h3>
    <?php else: ?>
        <h3>Buildings</h3>

        <?php if($errors->has('buildings')): ?>
        <div class='bg-danger alert'><?php echo $errors->first('buildings'); ?></div>
        <?php endif; ?>

        <div class="form-group">
            <?php foreach($buildings as $b): ?>
                <?php $building = $b['building']; ?>
                <?php echo Form::checkbox('building_group[]', $building->id, $b['selected'],
                array('id' => 'building' . $building->id)); ?>

                <?php echo Form::label('building' . $building->id, $building->address); ?>

                <br>
            <?php endforeach; ?>
        </div>
    <?php endif; ?>

    <div class='form-group'>
        <?php echo Form::submit('Update Security', ['class' => 'btn btn-primary']); ?>

    </div>

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


</div>

<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>