

<?php $__env->startSection('content'); ?>
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">Virtuals</div>

                <div class="card-body">
                    <form action="/search" method="GET" role="search">
                        <?php echo e(csrf_field()); ?>

                        <div class="input-group">
                            <input type="text" class="form-control" name="q"
                                placeholder="Search virtual"><span class="input-group-btn">
                            </span>
                            <button type="submit" class="btn btn-default">
                                <span class="glyphicon glyphicon-search">Search</span>
                            </button>
                        </div>
                        <label class="checkbox-inline">
                            <input type="checkbox" name="state[]" value=0> Requested
                        </label>
                        <label class="checkbox-inline">
                            <input type="checkbox" name="state[]" value=1> Waiting
                        </label>
                        <label class="checkbox-inline">
                            <input type="checkbox" name="state[]" value=2> Deployed
                        </label>
                        <label class="checkbox-inline">
                            <input type="checkbox" name="state[]" value=3> Request delete
                        </label>
                        <label class="checkbox-inline">
                            <input type="checkbox" name="state[]" value=4> Delete
                        </label>
                    </form>
                    <table class="table">
                        <thead>
                          <tr>
                            <th scope="col">Creator</th>
                            <th scope="col">System</th>
                            <th scope="col">State</th>
                            <th scope="col">Actions</th>
                          </tr>
                        </thead>
                        <tbody>
                        <?php $__empty_1 = true; $__currentLoopData = $virtuals; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $virtual): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <tr>
                                <td><?php echo e($virtual->user_name); ?></td>
                                <td><?php echo e($virtual->system); ?></td>
                                <td>                                    
                                <?php switch($virtual->ready):
                                    case (0): ?>
                                            Requested   
                                        <?php break; ?>;
                                    <?php case (1): ?>
                                            Waiting to deploy
                                        <?php break; ?>;
                                    <?php case (2): ?>
                                            Deployed
                                        <?php break; ?>;
                                    <?php case (3): ?>
                                            Asked to delete
                                        <?php break; ?>;
                                    <?php case (4): ?>
                                            Deleting
                                        <?php break; ?>;
                                    <?php default: ?>
                                        Undefined
                                <?php endswitch; ?> 
                                </td>
                                <td>
                                    <?php if(($virtual->ready == '0')||($virtual->ready == '1')): ?>
                                        <form action="<?php echo e(route('virtuals.destroy', $virtual)); ?>" method="POST" class="float-left">
                                            <?php echo csrf_field(); ?>
                                            <?php echo e(method_field('DELETE')); ?>

                                            <button type="submit" class="btn btn-warning">Delete</button>
                                        </form>
                                    <?php endif; ?>
                                    <?php if($virtual->ready < '2'): ?>
                                      <form action="<?php echo e(route('virtuals.show', $virtual->id)); ?>" method="GET">
                                            <?php echo csrf_field(); ?>
                                            <button type="submit" class="btn btn-secondary float-left">Show</button>
                                        </form>
                                    <?php endif; ?> 

                                    <?php if($virtual->ready == '2'): ?>
                                        <form action="/virtuals/<?php echo e($virtual->id); ?>/requestdelete" method="GET">
                                            <?php echo csrf_field(); ?>
                                            <button type="submit" class="btn btn-warning float-left">Delete Virtual</button>
                                        </form> 
                                    <?php endif; ?> 
                                    <?php if($virtual->ready == '3'): ?>
                                    <form action="/virtuals/<?php echo e($virtual->id); ?>/canceldelete" method="GET">
                                        <?php echo csrf_field(); ?>
                                        <button type="submit" class="btn btn-success float-left">Cancel delete</button>
                                    </form> 
                                    <form action="/virtuals/<?php echo e($virtual->id); ?>/delete" method="GET">
                                        <?php echo csrf_field(); ?>
                                        <button type="submit" class="btn btn-warning float-left">Delete</button>
                                    </form> 
                                    <?php endif; ?> 
                        
                                </td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <tr>
                                <td>No Virtuals</td>                                
                            </tr>
                        <?php endif; ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH G:\Skola\dipl\virtual\resources\views/virtuals/index.blade.php ENDPATH**/ ?>