@extends('admin.main')
@section('content')
    <style>
        .previewImage {
            height: 150px;
            width: 95%;
            overflow: hidden;
            object-fit: contain;
        }

    </style>
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                Tracking
                <!-- <small>Optional description</small> -->
            </h1>
            <ol class="breadcrumb">
                <li><a href="{{ url('admin') }}"><i class="fa fa-dashboard"></i> Dashboard</a></li>
                <li class="active"> Tracking</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content container-fluid">
            <div class="row">
                <div class="col-md-12">
                    <div class="box">
                        <div class="box-header with-border">
                            <h4 class="box-title">Tracking</h4>
                            {{-- <button class="btn btn-primary pull-right" data-toggle="modal" data-target="#modal_show_stores"> <i class="fa fa-plus"></i> Add</button> --}}
                        </div>
                        <div class="box-body">
                            <div class="row">

                                {{-- <div class="col-md-3">
                                <div class="form-group">
                                    <label class="control-label">Filter By Store</label>
                                    <div id="store_filter"></div>
                                </div>
                            </div> --}}

                            <form action="{{ route('import') }}" method="POST" enctype="multipart/form-data">
                                {{ csrf_field() }}
                                Choose your xls/csv File : <input type="file" name="file" class="form-control">
                             
                                <input type="submit" class="btn btn-primary btn-lg" style="margin-top: 3%">
                            </form>
                                <div class="col-md-12" style="margin-bottom: 20px">
                                    <form action="{{ url('admin/tracking') }}">
                                        <div class="input-group">

                                            {{-- <input type="hidden" class="form-control" name="invoiceNumber"> --}}
                                            <input type="text" class="form-control"
                                                value="{{ Request::get('invoiceNumber') }}" name="invoiceNumber"
                                                placeholder="Enter Invoice Number" required>
                                            <span class="input-group-btn">
                                                <button class="btn btn-default" type="submit">Submit</button>
                                            </span>

                                        </div><!-- /input-group -->
                                    </form>
                                </div>
                                <div class="col-md-12">
                                    <table class="table table-bordered table-condensed">
                                        <thead>
                                            <tr>
                                                <th>Invoice Number</th>
                                                <th>Tracking Status</th>
                                                <th>Scanned By</th>
                                                <th>Date Created</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            @if (count($tracking) > 0)
                                                @foreach ($tracking as $track)
                                                    <tr>
                                                        <td>{{ $track->InvoiceNumber }}</td>

                                                        @if ($track->StepId == 10)
                                                        <td>{{ $track->StepLabel }} via {{ $track->Carrier }} 
                                                        <a href="{{  $track->Link . $track->TrackingNumber }}" target="_blank">Click here.</a>
                                                        </td>
                                                        @else
                                                        <td>{{ $track->StepLabel }}</td>
                                                        @endif
                                                        
                                                        <td>{{ $track->Name }}</td>
                                                        <td>{{ $track->DateCreated }}</td>

                                                    </tr>
                                                @endforeach
                                            @else
                                                <tr>
                                                    <td colspan="4" colspan="text-center">No Record Found</td>
                                                </tr>
                                            @endif

                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <!-- /.content -->
    </div>
    {{-- <div class="modal fade" id="modal_show_stores" role="dialog">
    <div class="modal-dialog">
        <!-- Modal content-->
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">List of Teamstore</h4>
            </div>
            <div class="modal-body">
                <div id="modal_store_order_details_body_content">
                    <p> Loading content <i class="fa fa-spinner fa-spin"></i> </p>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div> --}}
@endsection
