<?php 
use Carbon\Carbon;
?>


<?php $__env->startSection('title', 'Interventi | Esporta'); ?>

<?php $__env->startSection('header_styles'); ?>
<style>
.table-scrollable {
    border: 1px solid #dddddd;
    margin: 10px 0 !important;
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
}
</style>
<?php $__env->stopSection(); ?>

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

<section class="content-header">
                <h1>Intervento</h1>
                <ol class="breadcrumb">
                    <li>
                        <a href="<?php echo e(route('home')); ?>">
                            <i class="livicon" data-name="home" data-size="14" data-color="#000"></i>
                            Home
                        </a>
                    </li>
                    <li>
                        <a href="<?php echo e(URL::to('admin/intervento')); ?>">
                            Intervento
                        </a>
                    </li>
                    <li class="active">Lista</li>
                </ol>
            </section>
            <section class="content">

                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 hidden">
                                <div class="bs-example">
                                    <ul class="nav nav-pills">
                                        <li class="active">
                                            <a href="#">Aperto <span class="badge badge-danger">7</span></a>
                                        </li>
                                        <li>
                                            <a href="#">Assegnato <span class="badge badge-danger">7</span></a>
                                        </li>
                                        <li>
                                            <a href="#">Chiuso <span class="badge badge-danger">7</span></a>
                                        </li>
                                        <li>
                                            <a href="#">Sospeso <span class="badge badge-danger">7</span></a>
                                        </li>                                         
                                        <li class="disabled">
                                            <a href="#">Disabled</a>
                                        </li>
                                    </ul>
                                </div>
                </div>
                
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
    <?php if(Session::has('ok_message')): ?>
        <div class="alert alert-success"><?php echo e(Session::get('ok_message')); ?></div>
    <?php endif; ?>

    <?php echo $__env->make('admin.intervento.filter', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
    
    <label>
        <a class="btn btn-success" href="/admin/intervento/create"><span class="glyphicon glyphicon-plus-sign"></span> Aggiungi</a>
    </label>
    
    <div class="table-scrollable">
    <table class="table table-bordered lista">
        <thead>
        <tr>
            <?php /*
            <th>Azioni</th>
             * 
             */
            ?>
            <th>Anno</th>
            <th>Nr.</th>
            <th>Data inserimento ticket</th>
            <th>Nr. ticket cliente</th>
            <th>Sede intervento</th>
            <th>Cliente</th>
            <th>Tecnico</th>
            
            <th>Data chiusura</th>
            <th>Lavoro eseguito</th>
            <th>Importo</th>
            <th>Spesa</th>
            <th>Orario inizio</th>
            <th>Orario fine</th>
            
            <th>Tipo</th>
            <th>Stato</th>
            
        </tr>
        </thead>

        <tbody>
            <?php foreach($listaIntervento as $ln): ?>
            <tr>
            <?php /*
            <td>
                
                <a class="btn btn-sm btn-info" href="/admin/intervento/{{$ln['id']}}" title="Visualizza"><span class="glyphicon glyphicon-search"></span></a>
                <a class="btn btn-sm btn-warning" href="/admin/intervento/{{$ln['id']}}/edit" title="Modifica"><span class="glyphicon glyphicon-edit"></span></a>
                
            {!! Form::open([
                'method' => 'DELETE',
                'route' => ['admin.intervento.destroy', $ln['id']],
                'onsubmit' => 'return confirm("Sei sicuro di eliminare il record?");',
                'style' => 'display: inline'
                
            ]) !!}
            <button class="btn btn-sm btn-danger" title="Cancella"><span class="glyphicon glyphicon-remove"></span></button>
            {!! Form::close() !!}                

            </td>
            */
            ?>
            <td><?php echo e($ln['anno']); ?></td>
            <td><?php echo e($ln['numero']); ?></td>
            <td><?php echo Carbon::createFromFormat('Y-m-d', $ln['data_inserimento_ticket'])->format('d/m/Y');?></td>
            <td><?php echo e($ln['numero_ticket_cliente']); ?></td>
            <td><?php echo e($ln['sede_intervento']); ?></td>
            <td><?php /* $ln['cliente_id'] */ ?> 
                
                <?php if(!is_null($ln->cliente)): ?> 
                    <?php echo e($ln->cliente->ragione_sociale); ?>

                <?php endif; ?>
            
            </td>
            <td>
                <?php /* $ln['cliente_id'] */ ?> 
                <?php if(!is_null($ln->tecnici)): ?>
                    <?php foreach($ln->tecnici as $tecnico): ?>
                    <?php echo e($tecnico->nome); ?> <?php echo e($tecnico->cognome); ?><br/>
                    <?php endforeach; ?>
                <?php endif; ?>                
            </td>
            
            <td><?php if (!is_null($ln['intervento_data']) && $ln['intervento_data'] != '0000-00-00') echo Carbon::createFromFormat('Y-m-d', $ln['intervento_data'])->format('d/m/Y');?></td>
            <td><?php echo e($ln['intervento_descrizione_risoluzione']); ?></td>
            <td class="text-right"><?php if($ln['importo_ticket'] != 0) echo number_format($ln['importo_ticket'], 2, ',', '.');?></td>
            <td class="text-right"><?php if($ln['spesa_tecnico'] != 0) echo number_format($ln['spesa_tecnico'], 2, ',', '.');?></td>          
            <td><?php echo e($ln['intervento_ora_inizio']); ?></td>
            <td><?php echo e($ln['intervento_ora_fine']); ?></td>
            
            <td><?php echo e($ln['intervento_tipo']); ?></td>
            <td><?php echo e($ln['intervento_stato']); ?></td>
            
            </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
    </div>
    
</div>
                
            </section>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
<script>
</script>
<?php $__env->appendSection(); ?>
<?php echo $__env->make('admin.layouts.main', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>