<?php $__env->startSection('actions'); ?>
    <div class="btn-group">
        <a href="<?php echo e(URL::action('CompaniesController@getAddCompany')); ?>" type="button" class="btn btn-dark">
            New Company
        </a>
    </div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('title'); ?>
    <i class="icon icon-company-settings"></i> Companies
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
    <div class="table-responsive">
        <table class="table hr-table hr-table2 table-hover">
            <thead>
            <tr>
                <th> Company</th>
                <th> Domain</th>
                <th> Contact</th>
                <th> Email</th>
                <th> Capacity</th>
                <th> Activation Date</th>
                <th> Last Deactivation Date</th>
                <th> Actions</th>
            </tr>
            </thead>
            <tbody>
            <?php foreach($companies as $item): ?>
                <tr>
                    <td> <?php echo e($item->name); ?></td>
                    <td><a href="http://<?php echo e($item->domain); ?>.<?php echo e(env('DOMAIN')); ?>"> <?php echo e($item->domain); ?>.<?php echo e(env('DOMAIN')); ?></a></td>
                    <td> <?php echo e($item->user_name); ?></td>
                    <td> <?php echo e($item->user_email); ?></td>
                    <td> <?php echo e($item->capacity); ?></td>
                    <td> <?php echo e($item->activated_at); ?></td>
                    <td> <?php echo e($item->deactivated_at); ?></td>
                    <td>
                        <div class="hr-actions-cell">
                            <a href="<?php echo e(URL::action('CompaniesController@getDetails',['id'=>$item->id],false)); ?>"
                               class="btn btn-dark">
                                Details
                            </a>
                            <?php /*<a href="<?php echo e(URL::action('CompaniesController@getTransactions',['id'=>$item->id])); ?>"*/ ?>
                            <?php /*class="btn btn-dark">*/ ?>
                            <?php /*Transactions*/ ?>
                            <?php /*</a>*/ ?>
                            <a class="btn btn-<?php echo e(($item->active)?"red":"green"); ?>"
                               data-target="#change_active_status<?php echo e($item->id); ?>" data-toggle="modal">
                                <?php echo e(($item->active)?"Deactivate":"Activate"); ?>

                            </a>
                            <a  href="<?php echo e(URL::action('CompaniesController@getAccessAsAdmin',['id'=>$item->id])); ?>" class="btn btn-info">
                                Access
                            </a>
                        </div>
                    </td>

                    <div class="modal fade" id="change_active_status<?php echo e($item->id); ?>">
                        <div class="modal-dialog">
                            <div class="modal-content">
                                <div class="modal-body">
                                    <form method="post"
                                          action="<?php echo e(URL::action('CompaniesController@postChangeActiveStatus')); ?>">
                                        <?php echo csrf_field(); ?>

                                        <input type="hidden" value="<?php echo e($item->id); ?>" name="company_id">
                                        <input type="hidden" value="<?php echo e(($item->active)?'true':'false'); ?>"
                                               name="status">
                                        <div class="help-block">Are you sure you want
                                            to <?php echo e(($item->active)?"deactivate":"activate"); ?> the
                                            company "<?php echo e($item->name); ?>"
                                        </div>
                                        <div class="form-actions">
                                            <button type="submit" class="btn btn-<?php echo e(($item->active)?"red":"green"); ?>">
                                                <?php echo e(($item->active)?"Deactivate":"Activate"); ?>

                                            </button>
                                            <button type="button" data-dismiss="modal" class="btn btn-dark">
                                                Back to safety
                                            </button>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </tr>
            <?php endforeach; ?>
            </tbody>
        </table>
    </div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>