<section id="messaging"></section>
<ul data-role="listview" data-inset="true">
    <li><span class="fieldname">Current Status</span><span class="fieldvalue"><%- status %> </span></li>
    <% if (appointmentRequestDetailCode.length > 0) {%>
    <li><span class="fieldname">Detail Code</span><span class="fieldvalue"><%- appointmentRequestDetailCode[0].detailCode.providerMessage %> </span></li>
    <% } %>

    <% if(status == "Booked" && typeof bookedApptDateTime != "undefined" && bookedApptDateTime != null && bookedApptDateTime != ""){ %>
    <li><span class="fieldname">Booked Appointment Date</span><span class="fieldvalue"><%- bookedApptDateTime %> </span></li>
    <% } %>

    <% if(appointmentDate != null && appointmentDate != ""){ %>
    <li><span class="fieldname">Requested Appointment Date</span><span class="fieldvalue"><%- appointmentDate %> <%- appointmentTime %> </span></li>
    <% } %>
</ul>

<ul data-role="listview" data-inset="true">
    <li><span class="fieldname">Full Name</span><span class="fieldvalue"><%- patient.firstName %> <%- patient.lastName %></span></li>
    <li><span class="fieldname">Date of Birth</span><span class="fieldvalue"><%- patient.dateOfBirth %></span></li>
    <li><span class="fieldname">SSN</span><span class="fieldvalue"><%- patient.ssn %></span></li>
</ul>
<ul data-role="listview" data-inset="true">
    <li><span class="fieldname">Last Activity</span><span class="fieldvalue"><%- formatDateToDays(lastUpdatedDate) + ' ' + formatTime(lastUpdatedDate) %></span></li>
    <li><span class="fieldname">Request Submitted</span><span class="fieldvalue"><%- formatDateToDays(createdDate) + ' ' + formatTime(createdDate) %></span></li>
</ul>

<h3>Request Details</h3>
<ul data-role="listview" data-inset="true">
    <li><span class="fieldname">Facility</span><span class="fieldvalue"><%- facility.name %></span></li>
    <li><span class="fieldname">Type of Care</span><span class="fieldvalue"><%- appointmentType %></span></li>
    <li><span class="fieldname">Provider</span><span class="fieldvalue"><%- providerName %><% if (providerOption !== undefined && providerOption.length) { %><br><br> <%- providerOption %><% } %></span></li>
    <li><span class="fieldname">Type of Visit</span><span class="fieldvalue"><%- visitType %></span></li>
    <li><span class="fieldname">Purpose of Visit</span><span class="fieldvalue"><%- purposeOfVisit %></span></li>
    <%
    if (purposeOfVisit == 'Other') {
    %>
    <li><span class="fieldname">Other Purpose of Visit</span><span class="fieldvalue"><%- otherPurposeOfVisit %></span></li>
    <%
    }
    %>

</ul>
<h3>Request Date/Time</h3>
<ul data-role="listview" data-inset="true">
    <% if (requestedPhoneCall) { %>
    <li class="error-message"><span class="alert-icon"></span><span>Patient has requested a phone call: <%- phoneNumber %></span></li>
    <% }%>
    <li><span class="fieldname">Preferred</span><span class="fieldvalue option-date1"><%- optionDate1 %><% if (optionTime2 !== "No Time Selected") { %> <%- optionTime2 %><% } %></span></li>
    <li><span class="fieldname">Second Choice</span><span class="fieldvalue option-date2"><%- optionDate2 %><% if (optionTime2 !== "No Time Selected") { %> <%- optionTime2 %><% } %></span></li>
    <li><span class="fieldname">Third Choice</span><span class="fieldvalue option-date3"><%- optionDate3 %><% if (optionTime3 !== "No Time Selected") { %> <%- optionTime3 %><% } %></span></li>
</ul>

<h3>Patient Contact</h3>
<ul data-role="listview" data-inset="true">
    <li><span class="fieldname">Phone Number</span><span class="fieldvalue"><%- phoneNumber %></span></li>
    <li><span class="fieldname">Best Time(s) To Call</span><span class="fieldvalue"><% _.each(bestTimetoCall, function(i) { %><%- i %><br /><% }); %></span></li>
</ul>
<div class="patient-contact"></div>
