<?php $__env->startSection('title', 'Manage Businesses'); ?>

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

    <h1>Manage Businesses</h1>

    <table class="table table-striped">
        <thead>
            <tr>
                <th>Business Name</th>
                <th>Number of Actions Applied</th>
                <th></th>
            </tr>
        </thead>
        <tbody>
            <?php if(!count($businesses)): ?>
                <tr>
                    <td colspan="3" class="text-center">No businesses created. Why not, <a href="<?php echo e(URL::route('admin.business.create')); ?>">add a new business</a>?</td>
                </tr>
            <?php endif; ?>

            <?php foreach($businesses as $business): ?>
                <tr>
                    <td><?php echo e($business->name); ?></td>
                    <td><?php echo e(count($business->actions)); ?></td>
                    <td>
                        <a class="btn btn-default" href="<?php echo e(URL::route('admin.business.show', $business->id)); ?>">View details</a>&nbsp;
                        <a class="btn btn-default" href="<?php echo e(URL::route('admin.assignedActions.createFor', 'business')); ?>">Assign actions</a>&nbsp;
                        <a class="btn btn-default" href="<?php echo e(URL::route('admin.business.edit', $business->id)); ?>">Edit</a>&nbsp;
                        <form action="<?php echo e(URL::route('admin.business.destroy', $business->id)); ?>" class="inline delete-form" method="post">
                            <?php echo csrf_field(); ?>

                            <input type="hidden" name="_method" value="DELETE">
                            <button class="btn btn-danger">Delete</button>
                        </form>
                    </td>
                </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
<?php $__env->stopSection(); ?>

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