@extends('admin.main')
@section('content')
    <style>
        .previewImage{
            height: 150px;
            width: 95%;
            overflow:hidden;
            object-fit: contain;
        }
    </style>
    <div class="content-wrapper" style="min-height: 916px;">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                Orders
                <!-- <small>Control panel</small> -->
            </h1>
            <ol class="breadcrumb">
                <li><a href="{{ url ('admin') }}"><i class="fa fa-dashboard"></i> Dashboard</a></li>
                <li><a href="{{ url ('admin/orders') }}"><i class="fa fa-list"></i> Orders</a></li>
                <li class="active">Orders Details</li>
               
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-md-12">
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">Order Details</h3>
                            <div class="box-tools pull-right">
                                <a href="{{ url('admin/orders/view/') . '/' . $array_payment_details[0]->CartKey . '/print' }}" type="button" class="btn btn-sm btn-primary"><i class="fa fa-print"></i> Print</a>
                            </div>
                        </div>
                        <!-- <form role="form" id="frm-create-address-book"> -->
                        <div class="box-body">
                            <div class="row">
                                <div class="col-md-12">
                                    <table class="table table-condensed table-bordered">
                                        <tr >
                                            <th class="bg-info" colspan="2">Payer Information</th>
                                            <th class="text-center bg-info">Shipping Address</th>
                                        </tr>
                                        <tr>
                                            <th class="col-md-3">Payer Name</th>
                                            <td>{{ $array_payment_details[0]->Payer_Firstname . ' ' . $array_payment_details[0]->Payer_Lastname }}</td>
                                            <td rowspan="3">
                                                {{ $array_shipping_add[0]->recipient_name }}<br>
                                                {{ $array_shipping_add[0]->line1 . ' ' . $array_shipping_add[0]->line2 . ', ' }}<br>
                                                {{ $array_shipping_add[0]->city . ', ' . $array_shipping_add[0]->state . ' ' . $array_shipping_add[0]->postal_code }}<br>
                                                {{ $array_shipping_add[0]->country_code }}
                                            </td>
                                        </tr>
                                        <tr>
                                            <th class="col-md-3">Payer Email Address</th>
                                            <td>{{ $array_payment_details[0]->Payer_Email }}</td>
                                        </tr>
                                        <tr>
                                            <th class="col-md-3">Payment Method</th>
                                            <td>{{ $array_payment_details[0]->PaymentMethod }}</td>
                                        </tr>
                                        <tr >
                                            <th class="bg-info" colspan="3">Transaction Information</th>
                                        </tr>
                                        <tr>
                                            <th class="col-md-3">Subtotal</th>
                                            <td colspan="2">{{ $array_payment_details[0]->SubTotal . ' ' . $array_payment_details[0]->Currency }}</td>
                                        </tr>
                                        <tr>
                                            <th class="col-md-3">Tax</th>
                                            <td colspan="2">{{ $array_payment_details[0]->Tax . ' ' . $array_payment_details[0]->Currency }}</td>
                                        </tr>
                                        <tr>
                                            <th class="col-md-3">Total</th>
                                            <td colspan="2">{{ $array_payment_details[0]->Total . ' ' . $array_payment_details[0]->Currency  }}</td>
                                        </tr>
                                        <tr>
                                            <th class="col-md-3">Invoice #</th>
                                            <td colspan="2">{{ $array_payment_details[0]->InvoiceNumber  }}</td>
                                        </tr>
                                    </table>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-12">
                                @foreach($item_goup_array as $item)
                                    <div style="border: 1px solid #e2e2e2; padding: 10px; margin-bottom: 10px;">
                                        <div class="row">
                                            <div class="col-md-2">
                                                <div class="text-center">
                                                    @foreach($img_thumb as $img)
                                                        @if($img->ProductId  == $item->ProductId)
                                                            <img class="previewImage" src="{{ minio_url('images/' . $img->Image) }}">
                                                        @endif
                                                    @endforeach
                                                    
                                                </div>
                                            </div>
                                            <div class="col-md-10">
                                                <h4><a href="{{ url('teamstore') . '/' . $item->StoreURL . '/' . 'product/' .  $item->ProductURL }}">{{ $item->ProductName }}</a></h4>
                                                <p>Total Price: ${{ $item->total_price }} &bull; Row(s): {{ $item->qty }} </p>
                                                <div class="table-responsive">  
                                                    <table class="table table-striped table-condensed">

                                                            @if($item->FormUsed=="jersey-and-shorts-form")
                                                                <tr>
                                                                    <th>Name</th>
                                                                    <th>Number</th>
                                                                    <th>Jersey Size</th>
                                                                    <th>Shorts Size</th>
                                                                    <th>Price</th>
                                                                    <th>Quantity</th>
                                                                    <th></th>
                                                                </tr>
                                                            @elseif($item->FormUsed=="tshirt-form")
                                                                <tr>
                                                                    <th>Size</th>
                                                                    <th>Price</th>
                                                                    <th>Quantity</th>
                                                                    <th></th>
                                                                </tr>

                                                            @elseif($item->FormUsed=="quantity-form")
                                                                <tr>
                                                                    <th>Price</th>
                                                                    <th>Quantity</th>
																	<th></th>
                                                                </tr>

                                                            
                                                            @elseif($item->FormUsed=="name-number-form")
                                                                <tr>
                                                                    <th>Name</th>
                                                                    <th>Number</th>
                                                                    <th>Price</th>
                                                                    <th>Quantity</th>
                                                                </tr>
                                                            @elseif($item->FormUsed=="name-number-size-form")
                                                                <tr>
                                                                    <th>Name</th>
                                                                    <th>Number</th>
                                                                    <th>Size</th>
                                                                    <th>Price</th>
                                                                    <th>Quantity</th>
                                                                    <th></th>
                                                                </tr>
                                                            @elseif($item->FormUsed=="name-name2-size-form")
                                                                <tr>
                                                                    <th>Gamer Tag</th>
                                                                    <th>Name</th>
                                                                    <th>Size</th>
                                                                    <th>Price</th>
                                                                    <th>Quantity</th>
                                                                </tr>              
                                                            @elseif($item->FormUsed=="number-form")
                                                                <tr>
                                                                    <th>Number</th>
                                                                    <th>Price</th>
                                                                    <th>Quantity</th>
                                                                </tr>
                                                            @elseif($item->FormUsed=="name-size-form")
                                                                <tr>
                                                                    <th>Name</th>
                                                                    <th>Size</th>
                                                                    <th>Price</th>
                                                                    <th>Quantity</th>
                                                                </tr>
                                                            @elseif($item->FormUsed=="jersey-and-shorts-quantity-form")
                                                                <tr>
                                                                    <th>Jersey Size</th>
                                                                    <th>Shorts Size</th>
                                                                    <th>Price</th>
                                                                    <th>Quantity</th>
                                                                </tr>
                                                            @elseif($item->FormUsed=="number-jersey-shorts-form")
                                                                <tr>
                                                                    <th>Number</th>
                                                                    <th>Jersey Size</th>
                                                                    <th>Shorts Size</th>
                                                                    <th>Price</th>
                                                                    <th>Quantity</th>
                                                                </tr>

                                                            @elseif($item->FormUsed=="number-size-form")
                                                                <tr>
                                                                    <th>Number</th>
                                                                    <th>Size</th>
                                                                    <th>Price</th>
                                                                    <th>Quantity</th>
                                                                </tr>
                                                            @else

                                                            @endif
                                                            

                                                            @foreach($order_item_array as $sub_item)
                                                                @if($sub_item->ProductId == $item->ProductId)

                                                                    @if($item->FormUsed=="jersey-and-shorts-form")
                                                                        <tr>
                                                                            <td> @if($sub_item->Name != '') {{ $sub_item->Name }} @else -- @endif </td>
                                                                            <td>{{ $sub_item->Number }}</td>
                                                                            <td>{{ $sub_item->JerseySize }}</td>
                                                                            <td>{{ $sub_item->ShortsSize }}</td>
                                                                            <td>{{ $sub_item->Price }}</td>
                                                                            <td>{{ $sub_item->Quantity }}</td>
                                                                            <td class="pull-right">
                                                                            <a href="{{ url('admin/orders/download/jersey' . '/' . $sub_item->DesignCode . '/' . $sub_item->Id )}}" class="btn btn-xs btn-primary"><i class="fa fa-download"></i> Download Print File ( JERSEY )</a>
                                                                            <a href="{{ url('admin/orders/download/shorts' . '/' . $sub_item->DesignCode . '/' . $sub_item->Id )}}" class="btn btn-xs btn-primary"><i class="fa fa-download"></i> Download Print File ( SHORTS )</a>
                                                                            </td>
                                                                           
                                                                        </tr>
                                                                    @elseif($item->FormUsed=="tshirt-form")
                                                                        <tr>
                                                                            <td>{{ $sub_item->Size }}</td>
                                                                            <td>{{ $sub_item->Price }}</td>
                                                                            <td>{{ $sub_item->Quantity }}</td>
                                                                            <td><a href="{{ url('admin/orders/download/tshirt' . '/' . $sub_item->DesignCode . '/' . $sub_item->Id )}}" class="btn btn-xs btn-primary"><i class="fa fa-download"></i> Download Print File</a></td>
                                                                            
                                                                        </tr>
                                                                    @elseif($item->FormUsed=="quantity-form")
                                                                        <tr>
                                                                            <td>{{ $sub_item->Price }}</td>
                                                                            <td>{{ $sub_item->Quantity }}</td>
																			<td>
                                                                            <a href="{{ url('admin/orders/download/mask' . '/' . $sub_item->DesignCode . '/' . $sub_item->Id )}}" class="btn btn-xs btn-primary"><i class="fa fa-download"></i> Download Print File</a>
                                                                            </td>
                                                                           
                                                                        </tr>
                                                                    @elseif($item->FormUsed=="name-number-form")
                                                                        <tr>
                                                                            <td>{{ $sub_item->Name }}</td>
                                                                            <td>{{ $sub_item->Number }}</td>
                                                                            <td>{{ $sub_item->Price }}</td>
                                                                            <td>{{ $sub_item->Quantity }}</td> 
                                                                        </tr>
                                                                    @elseif($item->FormUsed=="name-number-size-form")
                                                                        <tr>
                                                                            <td>{{ $sub_item->Name }}</td>
                                                                            <td>{{ $sub_item->Number }}</td>
                                                                            <td>{{ $sub_item->Size }}</td>
                                                                            <td>{{ $sub_item->Price }}</td>
                                                                            <td>{{ $sub_item->Quantity }}</td>
                                                                            <td><a href="{{ url('admin/orders/download/tshirt' . '/' . $sub_item->DesignCode . '/' . $sub_item->Id )}}" class="btn btn-xs btn-primary"><i class="fa fa-download"></i> Download Print File</a></td>
                                                                        </tr>
                                                                    @elseif($item->FormUsed=="number-form")
                                                                        <tr>
                                                                            <td>{{ $sub_item->Number }}</td>
                                                                            <td>{{ $sub_item->Price }}</td>
                                                                            <td>{{ $sub_item->Quantity }}</td>
                                                                        </tr>
                                                                    @elseif($item->FormUsed=="name-name2-size-form")
                                                                        <tr>
                                                                            <td>{{ $sub_item->Name }}</td>
                                                                            <td>{{ $sub_item->Name2 }}</td>
                                                                            <td>{{ $sub_item->Size }}</td>
                                                                            <td>{{ $sub_item->Price }}</td>
                                                                            <td>{{ $sub_item->Quantity }}</td>
                                                                        </tr>
                                                                    @elseif($item->FormUsed=="name-size-form")
                                                                        <tr>
                                                                            <td>{{ $sub_item->Name }}</td>
                                                                            <td>{{ $sub_item->Size }}</td>
                                                                            <td>{{ $sub_item->Price }}</td>
                                                                            <td>{{ $sub_item->Quantity }}</td>
                                                                        </tr>
                                                                    @elseif($item->FormUsed=="jersey-and-shorts-quantity-form")
                                                                        <tr>
                                                                            <td>{{ $sub_item->JerseySize }}</td>
                                                                            <td>{{ $sub_item->ShortsSize }}</td>
                                                                            <td>{{ $sub_item->Price }}</td>
                                                                            <td>{{ $sub_item->Quantity }}</td>
                                                                        </tr>
                                                                    @elseif($item->FormUsed=="number-jersey-shorts-form")
                                                                        <tr>
                                                                            <td>{{ $sub_item->Number }}</td>
                                                                            <td>{{ $sub_item->JerseySize }}</td>
                                                                            <td>{{ $sub_item->ShortsSize }}</td>
                                                                            <td>{{ $sub_item->Price  }}</td>
                                                                            <td>{{ $sub_item->Quantity }}</td>
                                                                        </tr>
                                                                    
                                                                    @elseif($item->FormUsed=="number-size-form")
                                                                        <tr>
                                                                            <td>{{ $sub_item->Number }}</td>
                                                                            <td>{{ $sub_item->JerseySize }}</td>
                                                                            <td>{{ $sub_item->Price  }}</td>
                                                                            <td>{{ $sub_item->Quantity }}</td>
                                                                        </tr>
                                                                    @else

                                                                    @endif
                                                                
                                                                @endif
                                                            @endforeach
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                @endforeach
                                </div>
                            </div>
                        </div>
                    <div>
                </div>
            </div>
        </section>
    <!-- /.content -->
    </div>
@endsection
