@extends('layouts.app')

@section('title', 'Shipper List')

@section('content')
    <div class="container-fluid">

        <!-- Page Heading -->
        <div class="d-sm-flex align-items-center justify-content-between mb-4">
            <h1 class="h3 mb-0 text-gray-800">Shippers</h1>
            <div class="row">
                <div class="col-md-6">
                    <a href="{{ route('shipperlist.createshipper') }}" class="btn btn-sm btn-primary">
                        <i class="fas fa-plus"></i> Add New
                    </a>
                </div>
                <div class="col-md-6">
                    <a href="#" class="btn btn-sm btn-success">
                        <i class="fas fa-check"></i> Export To Excel
                    </a>
                </div>
                
            </div>

        </div>

        {{-- Alert Messages --}}
        @include('common.alert')

        <!-- DataTales Example -->
        <div class="card shadow mb-4">
            <div class="card-header py-3">
                <h6 class="m-0 font-weight-bold text-primary">All Shippers</h6>

            </div>
            <div class="card-body">
                <div class="table-responsive">
                    <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
                        <thead>
                            <tr>
                                <th width="20%">Name</th>
                                <th width="25%">Email</th>
                                <th width="15%">Mobile</th>
                                <th width="15%">FixedLine</th>
                                <th width="15%">Status</th>
                                <th width="10%">Action</th>
                            </tr>
                        </thead>
                        <tbody>
                     




                      
                        @foreach ($shippers as $shrow)
                               
                        <tr>
                                    <td>{{ $shrow->shipper }}</td>
                                    <td>{{ $shrow->email }}</td>
                                    <td>{{ $shrow->mobile_number }}</td>
                                    <td>{{ $shrow->fixed_number }}</td>
                                    
                                    <td>
                                        @if ($shrow->status == 0)
                                            <span class="badge badge-danger">Inactive</span>
                                        @elseif ($shrow->status == 1)
                                            <span class="badge badge-success">Active</span>
                                        @endif
                                    </td>
                                    <td style="display: flex">
                                        @if ($shrow->status == 0)
                                            <a href="{{ route('shipperlist.updateshipperStatus', ['id' => $shrow->id, 'status' => 1]) }}"
                                                class="btn btn-success m-2">
                                                <i class="fa fa-check"></i>
                                            </a>
                                        @elseif ($shrow->status == 1)
                                            <a href="{{ route('shipperlist.updateshipperStatus', ['id' => $shrow->id, 'status' => 0]) }}"
                                                class="btn btn-danger m-2">
                                                <i class="fa fa-ban"></i>
                                            </a> 
                                        @endif
                                        <a href="{{route('shipperlist.shipperdit', ['id' => $shrow->id]) }}"
                                            class="btn btn-primary m-2">
                                            <i class="fa fa-pen"></i>
                                        </a> 
                                        <a class="btn btn-danger m-2" href="#" data-toggle="modal" data-target="#deleteshipperModal">
                                            <i class="fas fa-trash"></i>
                                        </a>
                                        
                                    </td>
                                </tr>

                            @endforeach
                        
                        </tbody>
                    </table>

                    {{ $shippers->links() }}
                   
                </div>
            </div>
        </div>

    </div>
    @if ($shippers->count() > 0 )
@if(isset($shippers) && !empty($shippers))

    @include('shipper.delete-shippermodel')
    
@endif
@endif

@endsection

@section('scripts')
    
@endsection
