<?php 
use Carbon\Carbon;
?>


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

<?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">
    <?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>
    
    <?php echo $__env->make('admin.intervento.info', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
    
    <div class="table-scrollable">

        

    <table class="table table-bordered lista2">
        <thead>
        <tr>
            <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>
            <td>
                
                <a class="btn btn-sm btn-info" href="/admin/intervento/<?php echo e($ln['id']); ?>" title="Visualizza"><span class="glyphicon glyphicon-search"></span></a>
                <a class="btn btn-sm btn-warning" href="/admin/intervento/<?php echo e($ln['id']); ?>/edit" title="Modifica"><span class="glyphicon glyphicon-edit"></span></a>
                
            <?php echo 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>
            <?php echo 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('footer_scripts'); ?>
<script>
  $(function() {
    $('table.lista2').DataTable({
        //dom: 'Blfrtip',
        dom: '<"nav"B>lfrtip',
        buttons: [
            'colvis',
//            {
//                extend: 'print',
//                orientation: orientation,
//                pageSize: 'LEGAL',
//                exportOptions: {
//                    columns: ':visible'
//                }                
//            },
//            {
//                extend: 'copy',
//                orientation: orientation,
//                pageSize: 'LEGAL',
//                filename: '*_<?php echo date('Y-m-d');?>',
//                exportOptions: {
//                    columns: ':visible'
//                }                
//            },
//            {
//                extend: 'excel',
//                orientation: orientation,
//                pageSize: 'LEGAL',
//                filename: '*_<?php echo date('Y-m-d');?>',
//                exportOptions: {
//                    columns: ':visible'
//                }                
//            }, 
//            {
//                extend: 'pdfHtml5',
//                //orientation: 'landscape',
//                orientation: orientation,
//                pageSize: 'LEGAL',
//                filename: '*_<?php echo date('Y-m-d');?>',
//                exportOptions: {
//                    columns: ':visible'
//                }
//            }
        ],
        "language": {
            "sUrl": "<?php echo e(asset('assets/vendors/datatables/i18n/Italian.lang')); ?>"
        }
    });      
});      
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.layouts.main', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>