<?php $__env->startSection('title', 'Add an action to business'); ?>

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

    <div class="page-header">
        <h1>Link <?php echo e($business->name); ?> to an action</h1>
    </div>

    <form name="AssignBusiness" method="POST" class="form-horizontal clearfix" enctype="multipart/form-data" action="<?php echo e(URL::route('admin.business.saveAction', $business->id)); ?>">

        <?php echo csrf_field(); ?>


        <div class="form-group">
            <label for="action_id" class="col-sm-2 control-label">Add a new action</label>
            <div class="col-sm-10">
                <select name="action_id" id="action_id" class="form-control ">
                    <option>Please select action</option>
                    <?php foreach($actions as $action): ?>
                        <option value="<?php echo e($action->id); ?>"><?php echo e($action->name); ?></option>
                    <?php endforeach; ?>
                </select>
            </div>
        </div>

        <div class="col-sm-2">
        </div>

        <div class="col-sm-10">
            <button type="submit" class="btn btn-default">Assign action to business</button>
        </div>

    </form>

    <table class="table push-down">
        <thead>
            <tr>
                <th>Action</th>
                <th>Multiplier</th>
                <th></th>
            </tr>
        </thead>
        <tbody>
            <?php if(!count($business->actions)): ?>
                <tr>
                    <td colspan="3">No actions yet assigned. Use the form above to assign some.</td>
                </tr>
            <?php endif; ?>
            <?php foreach($business->actions as $action): ?>
                <tr>
                    <td><?php echo e($action->name); ?></td>
                    <td><?php echo e($action->multiplier); ?></td>
                    <td><a href="<?php echo e(URL::route('admin.assignedActions.edit')); ?>"></a></td>
                </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
<?php $__env->stopSection(); ?>

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