@extends('emails.layout')
@section('salutation')
<span style="color:#00685f">ORDER INVOICE</span>
@endsection

@section('content')
<?php
$appInternalName = config('app.internalName');
$appConfig = config('constants.' . $appInternalName);
?>
<table border="0" cellspacing="0" cellpadding="0" width="600" style="border-collapse:collapse;border-spacing:0;margin-bottom:30px;margin-top:10px;margin-inline:auto;">
    <tbody>
        <tr>
            <td>
                <table border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0;width:100%;color:rgb(51,51,51);font-size:12px;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif">
                    <tbody>
                        <tr height="24" style="background-color:rgb(250,250,250)">
                            <td colspan="5" valign="top" style="text-align:center;text-transform:uppercase;padding:10px;border-top-left-radius:3px;border-bottom-left-radius:3px">
                                <span style="font-size:15px;font-weight:600;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif">Order Information</span>
                            </td>
                        </tr>
                        <tr height="15">
                            <td colspan="5"></td>
                        </tr>
                        <tr>
                            <td colspan="3" style="width:200px;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif">Date:
                                <?= date('F d, Y', strtotime($storeOrder->created_at)) ?>
                            </td>
                            <td colspan="2" align="right" valign="top" style="width:430px;padding:0 6px;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif">Order: #<a style="color:#000" href="" target="_blank">{{$storeOrder->orderNumber()}}</a></td>
                        </tr>
                        <tr height="15">
                            <td colspan="5"></td>
                        </tr>
                        <tr height="24" style="background-color:rgb(250,250,250)">
                            <td colspan="5" valign="top" style="text-align:center;text-transform:uppercase;padding:6px;border-top-left-radius:3px;border-bottom-left-radius:3px"><span style="font-size:15px;font-weight:600">Items For Delivery</span></td>
                        </tr>
                        <tr height="15">
                            <td colspan="5"></td>
                        </tr>
                        <tr>
                            <td valign="top" style="margin:0;width:64px">
                                <div style="padding:5px;margin:0;display:grid;place-items:center;border-radius:14px;border:1px solid rgba(128,128,128,0.2);width:64px;height:64px;">
                                    <img src="{{asset($appConfig['productImages'][0])}}" border="0" alt="" style="object-fit:contain;width:100%;max-height:64px">
                                </div>
                            </td>
                            <td colspan="2" style="padding:0 0 0 15px;vertical-align:top;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif">
                                <span style="font-weight:600;"><a href="{{$appUrl .'/my-account'}}" style="color:#000;text-decoration:none;">{{$appConfig['productName']}}</a></span><br>
                                <span style="color:#333;display:block;margin-top:8px">Qty: {{$storeOrder->number_of_units}}</span>
                            </td>
                            <td align="right" valign="top" style="padding:0 5px;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif">
                                @if($storeOrder->promoCode)
                                <span style="font-weight:600;white-space:nowrap;display:block;">${{$storeOrder->promoCode->discounted_price_per_unit}}</span>
                                <del style="font-weight:400;white-space:nowrap;color:#aaa">${{$appConfig['standardUnitPrice']}}</del>
                                @else
                                <span style="font-weight:600;white-space:nowrap;display:block;">${{$appConfig['standardUnitPrice']}}</span>
                                @endif
                            </td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                <table border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0;width:595px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif">
                    <tbody>
                        <tr height="10">
                            <td colspan="3"></td>
                        </tr>
                        <tr height="10">
                            <td height="1" colspan="3">
                                <div style="line-height:1px;height:1px;background-color:rgb(238,238,238)"></div>
                            </td>
                        </tr>
                        @if($storeOrder->promoCode)
                        <tr height="28">
                            <td align="right" style="color:#00685f;font-size:14px;font-weight:600;padding:0 30px 0 0;border-width:1px;border-color:rgb(238,238,238)">Promo Code</td>
                            <td width="1" style="background-color:rgb(238,238,238);width:1px"></td>
                            <td width="90" align="right" style="width:120px;color:#00685f;font-size:15px;font-weight:600;white-space:nowrap">
                                {{$storeOrder->promoCode->code}}
                            </td>
                        </tr>
                        @endif
                        <tr height="28">
                            <td align="right" style="color:#000;font-size:14px;font-weight:500;padding:0 30px 0 0;border-width:1px;border-color:rgb(238,238,238)">Items</td>
                            <td width="1" style="background-color:rgb(238,238,238);width:1px"></td>
                            <td width="90" align="right" style="width:120px;font-size:16px;font-weight:500;white-space:nowrap">
                                ${{$storeOrder->content_total}}
                            </td>
                        </tr>
                        <tr height="28">
                            <td align="right" style="color:#000;font-size:14px;font-weight:500;padding:0 30px 0 0;border-width:1px;border-color:rgb(238,238,238)">Shipping Total</td>
                            <td width="1" style="background-color:rgb(238,238,238);width:1px"></td>
                            <td width="90" align="right" style="width:120px;font-size:16px;font-weight:500;white-space:nowrap">
                                ${{$storeOrder->shipping_total}}
                            </td>
                        </tr>
                        <tr height="28">
                            <td align="right" style="color:#000;font-size:14px;font-weight:600;padding:0 30px 0 0;border-width:1px;border-color:rgb(238,238,238)">TOTAL</td>
                            <td width="1" style="background-color:rgb(238,238,238);width:1px"></td>
                            <td width="90" align="right" style="width:120px;font-size:16px;font-weight:600;white-space:nowrap">
                                ${{$storeOrder->final_total}}
                            </td>
                        </tr>
                        <tr height="10">
                            <td height="1" colspan="3">
                                <div style="line-height:1px;height:1px;background-color:rgb(238,238,238)"></div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
        <tr height="15">
            <td colspan="3"></td>
        </tr>
        <tr>
            <td>
                <table border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0;color:rgb(51,51,51);background-color:rgb(250,250,250);border-radius:3px;font-size:12px;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif">
                    <tbody>
                        <tr height="66">
                            <td width="620" rowspan="3" style="vertical-align:initial;padding:20px;border-style:solid;border-color:white;border-left-width:0px;border-right-width:0px;border-top-width:0px;border-bottom-width:0px">
                                <span style="color:#000;font-size:15px;padding:5px 0;text-transform:uppercase;font-weight:600;">Shipping Information</span><br> <br>
                                <span style="font-weight:bold;display:block;margin-bottom:10px;">Ship To:</span>
                                {{$storeOrder->client->mailing_address_line1}} {{$storeOrder->client->mailing_address_line2}} <br>
                                {{$storeOrder->client->mailing_address_city}},
                                {{$storeOrder->client->mailing_address_state}},
                                {{$storeOrder->client->mailing_address_zip}}<br>
                                <br>
                                <span style="font-weight:bold;display:block;margin-bottom:10px;">Shipping Method:</span>
                                {{$storeOrder->client->upcoming_fill_shipping_method}}
                            </td>
                            <td width="595" rowspan="3" style="vertical-align:initial;padding:20px;border-style:solid;border-color:white;border-left-width:0px;border-right-width:0px;border-top-width:0px;border-bottom-width:0px">
                                <span style="color:#000;font-size:15px;padding:5px 0;text-transform:uppercase;font-weight:600;">Billing Information</span><br> <br>
                                <span style="font-weight:bold;display:block;margin-bottom:10px;">Bill To:</span>
                                {{$storeOrder->client->displayName()}}<br>
                                <br>
                                <span style="font-weight:bold;display:block;margin-bottom:10px;">Payment Method:</span>
                                <span style="margin-right:5px;text-transform:uppercase;">{!! strip_tags($storeOrder->client->defaultPaymentMethod->displayNameShort()) !!}</span>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
    </tbody>
</table>
@endsection
