<?php $__env->startSection('title', 'View action details'); ?>

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

    <div class="page-header">
        <h1>Action details <small>"<?php echo e($action->name); ?>"</small></h1>
    </div>

    <h2>Assigned Businesses</h2>

    <table class="table">
        <thead>
            <tr>
                <th>Business</th>
                <th>Modifier</th>
                <th></th>
            </tr>
        </thead>
        <tbody>
            <?php if(!count($action->businesses)): ?>
                <tr>
                    <td colspan="3">No businesses assigned. Why not <a href="<?php echo e(URL::route('admin.assignedActions.createFor', 'business')); ?>">assign one</a>?</td>
                </tr>
            <?php endif; ?>

            <?php foreach($action->businesses as $business): ?>
                <tr>
                    <td><?php echo e($business->name); ?></td>
                    <td><?php echo e($business->pivot->modifier); ?></td>
                    <td>
                        <a href="<?php echo e(URL::route('admin.business.show', $business->id)); ?>" class="btn btn-default">View business</a>
                        <a href="<?php echo e(URL::route('admin.assignedActions.edit', ['business', $business->id, $action->id])); ?>" class="btn btn-default">Edit assignment</a>
                    </td>
                </tr>
            <?php endforeach; ?>
        </tbody>
    </table>

    <hr>

    <h2>Assigned Outputs</h2>

    <table class="table">
        <thead>
            <tr>
                <th>Business</th>
                <th></th>
            </tr>
        </thead>
        <tbody>
            <?php if(!count($action->outputs)): ?>
                <tr>
                    <td colspan="3">No outputs assigned. Why not <a href="<?php echo e(URL::route('admin.assignedActions.createFor', 'business')); ?>">assign one</a>?</td>
                </tr>
            <?php endif; ?>

            <?php foreach($action->outputs as $output): ?>
                <tr>
                    <td><?php echo e($output->name); ?></td>
                    <td>
                        <a href="<?php echo e(URL::route('admin.output.show', $output->id)); ?>" class="btn btn-default">View output</a>
                        <a href="<?php echo e(URL::route('admin.assignedActions.edit', ['output', $output->id, $action->id])); ?>" class="btn btn-default">Edit assignment</a>
                    </td>
                </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
</div>
<?php $__env->stopSection(); ?>

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