<?php $__env->startSection('title'); ?> Edit Building <?php $__env->stopSection(); ?>

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

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

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

    <?php $b = $building->toArray(); $b['daily_reset'] = $building->formatDailyReset(); ?>
    <?php echo Form::model($b, ['role' => 'form', 'action' => array('BuildingController@update', $b['id']),
        'method' => 'PUT']); ?>


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

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


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

    <div class='form-group'>
        <?php echo Form::label('max_nights', 'Maximum Nights Allowed'); ?>

        <?php echo Form::text('max_nights', null, ['placeholder' => 'Maximum Nights Allowed',
            'class' => 'form-control', 'required']); ?>


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

    <div class='form-group'>
        <?php echo Form::label('daily_reset', 'Daily Reset (24 hour format)'); ?>

        <?php echo Form::text('daily_reset', null, ['placeholder' => 'Daily Reset (24 hour format)', 'class' => 'form-control', 'required']); ?>


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

    <?php if(empty($security)): ?>
        <h3>No Security</h3>
    <?php else: ?>
        <h3>Security</h3>

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

        <div class="form-group">
            <?php foreach($security as $sec): ?>
            <?php $s = $sec['security']; ?>
            <?php echo Form::checkbox('security_group[]', $s->id, $sec['selected'],
            array('id' => 'security' . $s->id)); ?>

            <?php echo Form::label('security' . $s->id, $s->name); ?>

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

    <div class='form-group'>
        <?php echo Form::submit('Update', ['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(); ?>