<!DOCTYPE html>
<html lang="en" dir="ltr">

<head>
    <?php
      $appInternalName = config('app.internalName');
      $appConfig = config('constants.' . $appInternalName);
      $storeOrderDetailJson = $order->detailJson();
    $storeOrderSelectedOptions = json_decode(@$storeOrderDetailJson->selected_options ?? "{}");
    $selectedLab = @$storeOrderSelectedOptions->lab;
     ?>
    <meta charset="utf-8">
    <title>{{$appConfig['name']}}</title>
    <link rel="icon" href="{{asset($appConfig['favicon'])}}">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
    <link rel="stylesheet" href="{{asset('vendor/fontawesome/css/all.min.css')}}">
    <link rel="stylesheet" href="{{asset('css/style.css')}}">
    <link rel="stylesheet" href="{{asset('css/flyer.css')}}">
    <style>
        :root {
        --pry-color:{{$appConfig['primaryColor']}};
      }
    </style>
</head>

<body>
    <div class="print-none bg-white py-3 mb-4">
        <div class="container p-0" style="width:8.5in">
            <div class="row justify-content-between align-items-center">
                <div class="col-5 text-start">
                    <a href="{{url()->previous()}}"><i class="fal fa-angle-left me-1"></i> Go back</a>
                </div>
                <div class="col-5">
                    <a href="javascript:;" onclick="return printPDF()" class="btn btn-dark py-3 w-100 rounded-0 shadow"><i class="fal fa-print me-1"></i> Print</a>
                </div>
            </div>
        </div>
    </div>
    <div class="coupon-container px-5 py-4">
      <div class="d-flex align-items-center justify-content-between my-4">
        <span class="navbar-brand"><img src="{{asset($appConfig['logo'])}}" height="60" alt=""></span>
        <h4 class="md-title text-pry m-0">INVOICE</h4>
      </div>
      <div class="mb-3 d-flex align-items-start justify-content-between">
        <div class="">
          <p class="f-fallback" style="color: #000; font-size: 16px;"><b>The {{$appConfig['name']}} Team</b>
          <span style="display:block;" class="mt-3">Basic Nutrition, Inc.</span>

          11140 Rockville Pike<br>
          Rockville, MD 20852
          </p>
        </div>
        <div class="text-end">
          <p class="mb-3" style="color: #000; font-size: 16px;"><b>Contact Us</b></p>
          <p style="font-size:15px">{{$appConfig['supportEmail']}}</p>
          <p style="font-size:15px">{{$appConfig['supportPhone']}}</p>
          <p style="font-size:15px">{{$appConfig['productUrl']}}</p>
        </div>
      </div>
        <table border="0" cellspacing="0" cellpadding="0" style="background:#fff; 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-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($order->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: #{{$order->orderNumber()}}</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">Tests Ordered</span></td>
                                </tr>
                                <tr height="15">
                                    <td colspan="5"></td>
                                </tr>
                                @foreach($order->testsRequested() as  $tkey => $test)
                                <tr>
                                  <td colspan="3" style="padding:0 0 0 15px;vertical-align:top;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif">
                                    <span style="font-weight:600;">{{ str_replace('Check ', '', toHumanReadable($test)) }}</span>
                                  </td>
                                  <td align="right" valign="top" style="padding:0 5px;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif">
                                    <span style="font-weight:600;white-space:nowrap;display:block;">${{number_format(config('app.'.$test), 2)}}</span>
                                  </td>
                                </tr>
                                @endforeach
                            </tbody>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <table border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0;width:100%;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>
                                <tr height="28">
                                    <td align="right" style="color:#000;font-size:14px;font-weight:600;padding:0 30px 0 0;border:none;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">
                                        ${{number_format($order->total(), 2)}}
                                    </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-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;">Lab Information</span><br> <br>
                            @if($selectedLab)
                                <?= selected_lab_html_address($selectedLab); ?>
                            @else
                            ---
                            @endif
                          </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;">Bill To:</span> <br>
                            {{$order->client->displayName()}}<br>
                            <br>
                            @if($order->paymentMethod)
                            <span style="font-weight:bold;">Payment Method: </span> <br>
                            <span style="margin-right:5px;text-transform:uppercase;">{{$order->paymentMethod->brand()}}</span> {{$order->paymentMethod->displayNameShort()}}
                            @endif
                          </td>
                        </tr>
                      </tbody>
                    </table>
                  </td>
                </tr>
            </tbody>
        </table>
    </div>
    <div class="print-none mt-4">
        <footer class="bg-dark text-md-center py-2 d-flex justify-content-center flex-wrap">
            <div class="text-white mt-lg-0 mt-2">
                <small class="opacity-75">&copy; Copyright {{date('Y')}} Basic Nutrition, Inc. All rights reserved. <br class="d-lg-block d-none"> <span class="trademark trademark-inline">{{$appConfig['name']}}</span> is a registered trademark of
                    Basic Nutrition, Inc.</small>
            </div>
        </footer>
    </div>
</body>
<script type="text/javascript">
    function printPDF() {
        window.print();
    }
</script>

</html>
