{% set absUrl = app.request.getSchemeAndHttpHost() ~ app.request.baseUrl|replace({'/app_dev.php': ''}) %}
{% set userData = app.session.get('userData') %}
<!DOCTYPE html>
<html class="no-js" lang="en" dir="ltr">
<head>
	<meta charset="utf-8">
	<meta http-equiv="x-ua-compatible" content="ie=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>CPAP Pro - Appointment Notice</title>
</head>
<body style="font-family:'Arial'; font-size:18px;">
<!------ 1ST PAGE ------>
{#{% include '@RxConnexion/Patient/FaxTemplate/FreedomTemplate/frsi_fax_cover.wkpdf.twig' with {patientLetter: patientLetter} %}#}
{#<div style="page-break-before: always"></div>#}
{% set schedule = anf.schedule %}
{% set patient = anf.patient %}
{% set patientInsurance = patient.activePatientInsurance %}
{% if 'Referring Affiliate' == anf.affiliateType %}
	{% set rhf = anf.patientReferringHealthFacility.referringHealthFacility %}
	{% set attn = rhf.description %}
	{% set phoneNo = rhf.phoneNo %}
	{% set faxNo = rhf.faxNo %}
	{% set notes = '' %}
{% elseif 'Referring Physician' == anf.affiliateType %}
	{% set rp = anf.patientReferringProvider.referringProvider %}
	{% set attn = rp.honorific ~ ' ' ~ rp.fullName|title %}
	{% if rp.phoneNo != '' or rp.phoneNo is not null %}
		{% set phoneNo = rp.phoneNo %}
	{% else %}
		{% set phoneNo = '' %}
		{% for prhf in patient.patientReferringHealthFacilities %}
			{% for rhfp in rp.referringHealthFacilityProviders %}
				{% if prhf.referringHealthFacility.id == rhfp.referringHealthFacility.id %}
					{% set phoneNo = prhf.referringHealthFacility.phoneNo %}
				{% endif %}
			{% endfor %}
		{% endfor %}
	{% endif %}
	{% if rp.faxNo != '' or rp.faxNo is not null %}
		{% set faxNo = rp.faxNo %}
	{% else %}
		{% set faxNo = '' %}
		{% for prhf in patient.patientReferringHealthFacilities %}
			{% for rhfp in rp.referringHealthFacilityProviders %}
				{% if prhf.referringHealthFacility.id == rhfp.referringHealthFacility.id %}
					{% set faxNo = prhf.referringHealthFacility.faxNo %}
				{% endif %}
			{% endfor %}
		{% endfor %}
	{% endif %}
	{% set notes = rp.note %}
{% else %}
	{% set ins = anf.patientInsurance.insurance %}
	{% set attn = ins.description %}
	{% set phoneNo = ins.phoneNo %}
	{% set faxNo = ins.faxNo %}
	{% set notes = '' %}
{% endif %}

{% set referringHealthFacility = '' %}
{% for prhf in patient.patientReferringHealthFacilities %}
	{% if prhf.startDate >= 'now'|date('Y-m-d') and (prhf.endDate is null or prhf.endDate >= 'now'|date('Y-m-d')) %}
		{% set referringHealthFacility = prhf.referringHealthFacility.description %}
	{% endif %}
{% endfor %}

{% set referringProvider = '' %}
{% for prp in patient.patientReferringProviders %}
	{% if prp.startDate >= 'now'|date('Y-m-d') and (prp.endDate is null or prp.endDate >= 'now'|date('Y-m-d')) %}
		{% set referringProvider = prp.referringProvider.fullName %}
		{% set rpPhoneNo = prp.referringProvider.phoneNo %}
	{% endif %}
{% endfor %}

<div style="width:768px; position: relative; padding:0px; margin: 0 auto; box-shadow:3px 1px 10px 1px;">
	<div style="border: none;">
		<div style="margin-bottom: 40px;">
			<div style="color: #ED226D; font-size: 24px;"><strong>NOTICE OF APPOINTMENT</strong></div>
		</div>
		<div style="width: 100%; margin-bottom: 30px;">
			<div style="width:50%; float: left;">
				<div>Referring Physician: {{ referringProvider }}</div>
				<div>Clinic Name: {{ referringHealthFacility }}</div>
				<div>Phone #: {{ phoneNo }}</div>
				<div style="margin-bottom: 15px;">Fax #: {{ faxNo }}</div>
				<div>RE: {{ patient.fullName }}</div>
				<div>DOB: {{ patient.birthDate|date('m/d/Y') }}</div>
				<div>PHN #: {{ patient.personalHealthNo }}</div>
				<div>Phone #: {{ patient.phoneNo }}</div>
			</div>
			<div style="width:50%; float: right;">
				Date: {{ 'now'|date('m/d/Y') }}
			</div>
		</div>
		<div style="margin-top: 50px; width: 100%; float: left;">
			<div>Thank you for the referral. We have booked the above patient for a Home Sleep Apnea Test (HSAT) on</div>
			<div>Date: {{ schedule.scheduleDate|date('m/d/Y') }}</div>
		</div>
		<div style="margin-top: 50px; width: 100%; float: left;">
			{% set faxBodySelection = schedule.faxBodySelection|split(',') %}
			<div>
				<div><input type="checkbox" {{ 1 in faxBodySelection ? 'checked' : '' }}> Patient is aware of the appointment.</div>
				<div><input type="checkbox" {{ 2 in faxBodySelection ? 'checked' : '' }}> Message left on the voicemail.</div>
				<div><input type="checkbox" {{ 3 in faxBodySelection ? 'checked' : '' }}> Patient is not aware of the appointment. Please inform the patient. We are also still trying to contact them.</div>
			</div>
		</div>
		<div style="margin-top: 50px; width: 100%; float: left;">
			<span>The consultation will be done virtually through Telesleepcare. We will send the home sleep apnea testing device via courier to the patient and it will be picked up the next day.</span>
		</div>
		<div style="margin-top: 50px; width: 100%; float: left;">
			<span>We will fax the result back as soon as possible.</span>
		</div>
		<div style="margin-top: 50px; width: 100%;  float: left;">
			<div>Kind Regards,</div>
			<div>CPAP Pros Admin</div>
		</div>
	</div>
</div>
</body>
</html>