@extends('layout.padrao')
@section('title', 'Operational Dashboard')

@section('pesquisa')
    <form class="form-inline w-100 search-listas-int" method="GET" action="{{ route('listLoading','loading') }}">
    {!! Form::text('tipo', 'loading', ['class' => 'form-control', 'hidden'=>'hidden']) !!}    
        <input class="form-control mr-sm-2 text-primary" type="search" placeholder="Search for Loading Plan by: Fantasy Name, User Name OR Booking Number  " name="loading_plan">   
        <button class="btn btn-outline-light " type="submit">Pesquisar</button>
    </form> 
@endsection

@section('content')
    <!--Botão Novo-->
    @can('create', App\Usuario::class)
        @include('include.btn_adicionar',["btn" => "loading"])
    @endcan
    {!! Form::text('tipo', 'loading', ['class' => 'form-control', 'hidden'=>'hidden']) !!}    
    <div class="table-responsive tableMenor">
        <table class="table table-striped table-sm text-center" style="font-size: 10px;">
            <thead>
                <tr class="aling-th" >
                    <th class="icon-action"></th>
                    <th>Process Number</th>
                    <th>Client</th>
                    <th>Product</th>
                    <th>Booking</th>
                    <th>Logistics Plan</th>
                    <th>Isotank Plan</th>
                    <th>Origin<br>Loading Confirmation</th>
                    <th>Stuffing <br> Confirmation</th>
                    <th>BL Draft</th>
                    <th>VGM </th>
                    <th>Vessel <br>Loading Confirmation</th>

                </tr>
            </thead>
            <tbody>
                @foreach($registers as $item)
                    <tr>
                        <td>
                            @can('update', App\Usuario::class)
                                @if($item->loadingType=='BKP')
                                    <a class="icone-padding" href="{{ route('editBookingPlan', $item->id) }}" data-toggle="tooltip" data-placement="top" title="Edit"><i class="fas fa-pencil-alt"></i></a>     
                                     
                                @else
                                    <a alt="Edit" class="icone-padding" href="{{ route('editLoading', $item->id) }}" data-toggle="tooltip" data-placement="top" title="Edit"><i class="fas fa-pencil-alt"></i></a>  
                                @endif
                            @endcan
                            @if($item->status <> 'Pending')
                                @can('delete', App\Usuario::class)
                                    <a class="icone-padding" data-catid={{$item->id}} data-toggle="modal" data-target="#delete" data-toggle="tooltip" data-placement="top" title="Delete">
                                        <i class="fas fa-trash-alt"></i>
                                    </a>
                                @endcan
                                @if($item->loadingType=='BKP')                                 
                                    <a class="icone-padding" href="{{ route('cloneBookingPlan', $item->id) }}" alt="Clonar" data-toggle="tooltip" data-placement="top" title="Clone"><i alt="Clonar" class="fas fa-clone"></i></a>      
                                @else
                                    <a class="icone-padding" href="{{ route('cloneLoading', $item->id) }}" alt="Clonar" data-toggle="tooltip" data-placement="top" title="Clone"><i alt="Clonar" class="fas fa-clone"></i></a>  
                                @endif
                                <a class="icone-padding" href="{{route('previouslyEmail',$item->id)}}" alt="Email" data-toggle="tooltip" data-placement="top" title="Send"><i alt="Email" class="fas fa-paper-plane"></i></a>               
                                
                                <a class="icone-padding" data-catid={{$item->id}} data-toggle="modal" data-target="#link" data-toggle="tooltip" data-placement="top" title="Link">
                                        <i class="fas fas fa-link"></i>
                                </a>  
                            @endif                
                        </td>

                        <td>{{ $item->SAOE }}</td>
                        <td>{{ str_limit($item->clients->fantasyName, $limit = 10, $end = '...')  }}</td>
                        <td>{{ $item->platforms->descricao }}</td>
                        <td>{{ $item->booking }}</td>
                        
                        <td>
                            <i class="{{ ($item->loadingType == 'LGP' ? 'fas fa-check fa-lg' : '') }}" style='color:#20a902;'></i>
                        </td>
                        
                        <td>
                            <i class="{{ ($item->loadingType == 'LGP' ? 'fas fa-check fa-lg' : '') }}" style="color:{{ (empty($item->isotankDetails)) ? '#cccccc' : '#20a902' }};"></i>    
                        </td>
                        <td>
                            <i class="{{ ($item->loadingType == 'LGP' ? 'fas fa-check fa-lg' : ''  )}}" style="color:#ccc"></i>    
                        </td>
                        <td>
                            <i class="{{ ($item->loadingType == 'LGP' ? 'fas fa-check fa-lg' : '' )}}" style='color:#ccc;'></i>    
                        </td>
                        
                        
                            <td>
                                <i class='fas fa-file-export fa-lg ' style='color:#ccc;'></i>
                            </td>
                            <td>
                                <i class='fas fa-truck-loading fa-lg ' style='color:#ccc;'></i>
                            </td>
                            <td>
                                <i class='fas fa-anchor fa-lg ' style='color:#ccc;'></i>
                            </td>
                       

                        




                    </tr>
                    
                @endforeach
                
            </tbody>
        </table>
    </div>
    <div align="center"  class="d-flex justify-content-center">
        {{ $registers->links() }}
    </div>

    <!-- Delete Model -->
    @include('include.modal_deletar', ["rota" => "loadingPlan"])
    
    

@endSection