<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>DialMD</title>
</head>
<body>
<div style="margin: 0; padding: 1rem; font-family: sans-serif">
    <header style="padding: 0; border: 0; margin: 0 0 1rem;">
        <div style="text-align: center">
            <img src="data:image/png;base64, [encoded data, 11172 characters]"
                 style="height: 60px;" alt="DialMD">
        </div>
        <div style="margin-top: 1.5rem; font-size: 19px">{{ $prescription->hcpPro->name_prefix }} {{ $prescription->hcpPro->name_first }} {{ $prescription->hcpPro->name_last }} <span style="font-size: 13px; opacity: 0.75">{{ $prescription->hcpPro->name_suffix }}</span></div>
        <div style="display: block;">
            <table cellpadding="0" cellspacing="0" border="0" style="width: 100%">
                <tr>
                    <td style="width: 70%">
                        <div style="font-size: 14px; margin-top: 0.6rem; line-height: 1.4; opacity: 0.6">4445 Willard Ave Suite 600<br>Chevy Chase MD 20815</div>
                    </td>
                    <td style="">
                        <div style="text-align: right; font-size: 14px; margin-top: 0.6rem; line-height: 1.4; opacity: 0.6">PH: 202-935-1033<br>FAX: 202-935-1033</div>
                    </td>
                </tr>
            </table>
        </div>
    </header>
    <hr style="border-top: 2px solid #5ca4e8; border-bottom: 0; margin: 1rem 0;">
    <div style="page-break-after: always">
        <h2 style="text-align: center; padding: 2rem 0;">Fax Cover Sheet</h2>
        <div style="margin: auto; width: 14cm; border: 1px solid #aaa; padding: 1rem">
            <div style="margin-bottom: 0.75rem;">
                <b>To: </b>
                <span>{{request()->input('toWho')}}</span>
            </div>
            <div style="margin-bottom: 0.75rem;">
                <b>From: </b>
                <span>DialMD</span>
            </div>
            <div style="margin-bottom: 0.75rem;">
                <b>Re: </b>
                <span>{{request()->input('toFaxNumberCoverSheetMemo')}}</span>
            </div>
            <div style="margin-bottom: 2rem;">
                <b>Attn: </b>
                <span>{{request()->input('toFaxNumberAttentionLine')}}</span>
            </div>
            <table style="border: 0; width: 100%">
                <tr>
                    <td style="width: 50%; padding-right: 1rem; padding-bottom: 0.75rem">
                        <b>Fax#: </b>
                        <span>{{request()->input('toFaxNumber')}}</span>
                    </td>
                    <td style="width: 50%; padding-bottom: 0.75rem">
                        <b>Pages: </b>
                        <span>1</span>
                    </td>
                </tr>
                <tr>
                    <td style="width: 50%; padding-right: 1rem;">
                        <b>Phone: </b>
                        <span>(800) 990-5491</span>
                    </td>
                    <td style="width: 50%;">
                        <b>Date: </b>
                        <span>{{friendlier_date_time(date('Y-m-d'), false)}}</span>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <header style="padding: 0; border: 0; margin: 0 0 1rem;">
        <div style="text-align: center">
        <img src="data:image/png;base64, [encoded data, 11172 characters]"
             style="height: 60px;" alt="DialMD">
        </div>
        <div style="margin-top: 1.5rem; font-size: 19px">{{ $prescription->hcpPro->name_prefix }} {{ $prescription->hcpPro->name_first }} {{ $prescription->hcpPro->name_last }} <span style="font-size: 13px; opacity: 0.75">{{ $prescription->hcpPro->name_suffix }}</span></div>
        <div style="display: block;">
            <table cellpadding="0" cellspacing="0" border="0" style="width: 100%">
                <tr>
                    <td style="width: 70%">
                        <div style="font-size: 14px; margin-top: 0.6rem; line-height: 1.4; opacity: 0.6">4445 Willard Ave Suite 600<br>Chevy Chase MD 20815</div>
                    </td>
                    <td style="">
                        <div style="text-align: right; font-size: 14px; margin-top: 0.6rem; line-height: 1.4; opacity: 0.6">PH: 202-935-1033<br>FAX: 202-935-1033</div>
                    </td>
                </tr>
            </table>
        </div>
    </header>
    <hr style="border-top: 2px solid #5ca4e8; border-bottom: 0; margin: 1rem 0;">

    <?php
    use App\Models\Erx;
    /** @var Erx $prescription */
    $patient = $prescription->patient;
    ?>

    @include('app.patient.prescriptions.pdf.' . $prescription->erx_category)

    <?php if($prescription->logistics_detail_json): ?>
        <?php $logistics = json_decode($prescription->logistics_detail_json); ?>
        <hr style="margin: 0.5rem 0; border-top-width: 0; border-bottom-width: 1px; border-color: #bbb">
        <p><b>Logistics Information</b>:</p>
        <div style="font-size: 14px; opacity: 0.75; ">
            <p style="margin: 0.5rem 0;"><b>{{ $logistics->facilityName }}</b></p>
            <p style="margin: 0.5rem 0;">{{$logistics->facilityCity}} {{$logistics->facilityState}} {{$logistics->facilityZip}}</p>
            <p style="margin: 0.5rem 0;">Phone: {{$logistics->facilityPhone}}</p>
            <p style="margin: 0.5rem 0;">Fax: {{$logistics->facilityFax}}</p>
        </div>
    <?php endif; ?>

    <hr style="margin: 1rem 0 0.5rem; border-top-width: 0; border-bottom-width: 1px; border-color: #bbb">
    <table cellpadding="0" cellspacing="0" border="0" style="width: 100%">
        <tr>
            <td style="vertical-align: middle; white-space: nowrap; width: 100px;">
                Authorizing Signature: Digital Signature Capture at <?= friendlier_date_time($prescription->created_at) ?>
            </td>
            <td style="vertical-align: middle;">
                @if($prescription->hcpPro->signature_base_64)
                    <img src="{{$prescription->hcpPro->signature_base_64}}" style="max-width: 180px;">
                @endif
            </td>
        </tr>
    </table>
</div>
</body>
</html>

