<section style="padding-top: 0.1rem;">

    <div style="margin: 0 0 1rem; font-weight: bold; "><span style="font-size: 16px">Specimen/Physician Information</span></div>

    <table cellpadding="0" cellspacing="0" border="0" style="width: 100%; font-size: 14px; margin-bottom: 1rem;">
        <tr>
            <td style="padding-bottom: 0.25rem; width: 20%; opacity: 0.75;">Order Date:</td>
            <td style="padding-bottom: 0.25rem; width: 30%; opacity: 0.75; font-weight: bold;">{{date('Y-m-d h:i a')}}</td>
            <td style="padding-bottom: 0.25rem; width: 20%; opacity: 0.75;">NPI:</td>
            <td style="padding-bottom: 0.25rem; width: 30%; opacity: 0.75; font-weight: bold;">{{$prescription->hcpPro->hcp_npi}}</td>
        </tr>
        <tr>
            <td style="padding-bottom: 0.25rem; width: 20%; opacity: 0.75;">Test Date:</td>
            <td style="padding-bottom: 0.25rem; width: 30%; opacity: 0.75; font-weight: bold;">-</td>
            <td style="padding-bottom: 0.25rem; width: 20%; opacity: 0.75;">Practice Phone:</td>
            <td style="padding-bottom: 0.25rem; width: 30%; opacity: 0.75; font-weight: bold;">202-935-1033</td>
        </tr>
        <tr>
            <td style="padding-bottom: 0.25rem; width: 20%; opacity: 0.75;">Ordering Physician:</td>
            <td style="padding-bottom: 0.25rem; width: 30%; opacity: 0.75; font-weight: bold;">{{$prescription->hcpPro->displayName()}}</td>
            <td style="padding-bottom: 0.25rem; width: 20%; opacity: 0.75;">Practice Fax:</td>
            <td style="padding-bottom: 0.25rem; width: 30%; opacity: 0.75; font-weight: bold;">202-935-1033</td>
        </tr>
    </table>

    <table cellpadding="0" cellspacing="0" border="0" style="width: 100%">
        <tr>
            <td style="width: 70%">
                <b>Patient Information</b>
            </td>
            <td style="">

            </td>
        </tr>
    </table>

    <div style="font-size: 14px; margin-top: 0.6rem; line-height: 1.4; opacity: 0.6">
        <span>{{ $patient->displayName() }}, {{$patient->sex}}, {{$patient->age_in_years}} years old</span><br>
        <?php
        $addressParts = [];
        if (!!$patient->mailing_address_line1) $addressParts[] = $patient->mailing_address_line1;
        if (!!$patient->mailing_address_line2) $addressParts[] = $patient->mailing_address_line2;
        $addressParts = implode(", ", $addressParts) . ", ";
        $addressPart2 = [];
        if (!!$patient->mailing_address_city) $addressPart2[] = $patient->mailing_address_city;
        if (!!$patient->mailing_address_state) $addressPart2[] = $patient->mailing_address_state;
        $addressParts .= implode(", ", $addressPart2);
        ?>
        <span>{!! $addressParts !!}</span>
    </div>
</section>

<?php $clinical = json_decode($prescription->clinical_detail_json); ?>
<?php if($clinical && @$clinical->items): ?>
    <div style="margin: 1.5rem 0 1rem; font-weight: bold; opacity: 0.5"><span style="font-size: 24px">R</span><span style="font-size: 16px">x</span></div>
    <section style="font-size: 15px;">
        <?php $count = 0; ?>
        <?php foreach ($clinical->items as $item): ?>
        <table cellpadding="0" cellspacing="0" border="0" style="width: 100%; margin-bottom: 5pt">
            <tr>
                <td style="width: 20px; vertical-align: top; opacity: 0.75; font-size: 14px">
                    <span>{{ ++$count }}. </span>
                </td>
                <td style="vertical-align: top">
                    <div>
                        <p style="margin: 0">
                            <b>{{ $item->medication }}</b>
                        </p>
                        <div style="">
                            @if(@$item->frequency)
                                <p style="margin: 0.5rem 0;">Frequency: {{ $item->frequency }}</p>
                            @endif
                            @if(@$item->instructions)
                                <p style="margin: 0.5rem 0;">Instructions: {{ $item->instructions }}</p>
                            @endif
                            @if(@$item->dispense)
                                <p style="margin: 0.5rem 0;">Dispense: {{ $item->dispense }}</p>
                            @endif
                            @if(@$item->refills)
                                <p style="margin: 0.5rem 0;">Refills: {{ $item->refills }}</p>
                            @endif
                        </div>
                    </div>
                </td>
            </tr>
        </table>
        <?php endforeach; ?>
    </section>
<?php endif; ?>


