@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>
        Reports
        <!-- <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"> Reports</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">Reports</h4>
                    </div>
                    <div class="box-body">
                        <div class="row">
                            <div class="col-md-3">
                                <div class="form-group">
                                    <label class="control-label">Select Date From: <span class="required">*</span></label>
                                    <input type="text" name="min" class="form-control datepicker-reports" id="min" placeholder="Select Date" required  autocomplete="off"/>
                                </div>
                            </div>
                            <div class="col-md-3">
                                <div class="form-group">
                                    <label class="control-label">Select Date To: <span class="required">*</span></label>
                                    <input type="text" name="max" class="form-control datepicker-reports" id="max" placeholder="Select Date" required autocomplete="off"/>
                                </div>
                            </div>
                            <div class="col-md-3">
                                <div class="form-group">
                                    <label class="control-label">Filter By Store</label>
                                    <div id="store_filter"></div>
                                </div>
                            </div>
                            <div class="col-md-12">
                                
                                <table class="table table-bordered table-condensed nowrap" id="tbl_store_orders">
                                    <thead>
                                        <tr>
                                            <th>Teamstore</th>
                                            <th>Invoice No.</th>
                                            <th>Product Name</th>
                                            <th>Name</th>
                                            <th>Number</th>
                                            <th>Size</th>
                                            <th>Jersey Size</th>
                                            <th>Short Size</th>
                                            <th>Price</th>
                                            <th>Quantity</th>
                                            <th>#</th>
                                            <th>Payer Email</th>
                                            <th>Payer Fullname</th>
                                            <th>Recipient Name</th>
                                            <th>Address Line 1</th>
                                            <th>Address Line 2</th>
                                            <th>City</th>
                                            <th>State</th>
                                            <th>Postal Code</th>
                                            <th>Country Code</th>
                                            <th>Date Ordered</th>
                                            <th class="text-center">Action</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        @foreach($array_store_orders as $item_order)
                                            <tr>
                                                <td>{{ $item_order->StoreName }}</td>
                                                <td>{{ $item_order->InvoiceNumber }}</td>
                                                <td>{{ $item_order->ProductName }}</td>
                                                <td>{{ $item_order->Name }}</td>
                                                <td>{{ $item_order->Number }}</td>
                                                <td>{{ $item_order->Size }}</td>
                                                <td>{{ $item_order->JerseySize }}</td>
                                                <td>{{ $item_order->ShortsSize }}</td>
                                                <td>{{ $item_order->Price . ' ' .  $item_order->Currency }}</td>
                                                <td>{{ $item_order->Quantity }} </td>
                                                <td>{{ date('Y/m/d', strtotime($item_order->date_ordered)) }}</td>
                                                <td>{{ $item_order->Payer_Email }} </td>
                                                <td>{{ $item_order->Payer_Firstname . ' ' . $item_order->Payer_Lastname }} </td>
                                                <td>{{ $item_order->recipient_name  }} </td>
                                                <td>{{ $item_order->line1  }} </td>
                                                <td>{{ $item_order->line2  }} </td>
                                                <td>{{ $item_order->city  }} </td>
                                                <td>{{ $item_order->state  }} </td>
                                                <td>{{ $item_order->postal_code  }} </td>
                                                <td>{{ $item_order->country_code  }} </td>
                                                <td>{{ date('F j, Y g:i a', strtotime($item_order->date_ordered)) }}</td>
                                                <td class="text-center">
                                                    <a href="#" data-pid="{{ $item_order->ProductId }}" data-id="{{ $item_order->Order_Id }}"  data-ck="{{ $item_order->CartKey }}" class="btn btn-default btn-xs btn-order-item-details">View Details</a>
                                                </td>
                                            </tr>
                                        @endforeach
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!-- /.content -->
</div>
<div class="modal fade" id="modal_store_order_details" role="dialog">
    <div class="modal-dialog modal-lg">

        <!-- Modal content-->
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Order Details</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