{% extends "registry/master.html" %}

{% block title %}Volunteer Cancellation - Session Selection{% endblock %}

{% block content %}
<h2>Volunteer Cancellation</h2>
<div style="border: 2pt solid; padding: 0em; margin-bottom: 1em; text-align: center;">
 <div style="border-bottom: 1pt dashed; padding: 1em; background: #F88; text-align: center">
  <div style="font-weight: bold; float: left;">
    <a style="color: #000;"
       href="{{uriPrefix}}/volunteers/{{selectedVolunteer.getRegisterKeyValue}}/"
       title="{{selectedVolunteer.getRegisterKeyValue}}">Volunteer</a>
   </div>
   <div style="font-weight: bold; width: 100%">
    <br />
    {{selectedVolunteer.getLabelValue}}
   </div>
 </div>
 <div style="padding: 1em; background: #EEE;">
  <span style="font-weight: bold; float: left;">
    <a style="color: #000"
       href="{{uriPrefix}}/scanningSessions/{{selectedSession.getRegisterKeyValue}}/"
       title="{{selectedSession.getRegisterKeyValue}}">Session</a>
  </span>
    <br />
    <br />
    <h1>
    {{selectedSession.getLabelValue}}
    </h1>
    <br />
      {% if selectedSession.volunteer %}BOOKED{% else %}NOT BOOKED{% endif %}
    <br />
    <br />
 </div>
 <div style="border-top: 1pt dashed; padding: 1em; background: #CCC;">
  <span style="font-weight: bold; float: left">
  {% if selectedSession.getContact %}
    <a style="color: #000"
       href="{{uriPrefix}}/researchers/{{selectedSession.getContact.getRegisterKeyValue}}/"
       title="{{selectedSession.getContact.getRegisterKeyValue}}">Contact</a>
  {% else %}
       No Contact
  {% endif %}
  </span>
   <div style="font-weight: bold; width: 100%">
    <br />
    {{selectedSession.getContact.getLabelValue}}
   </div>
 </div>
</div>


{% if not isConfirmed %}
  {% if isAlreadyBooked %}
    {% ifequal selectedSession.volunteer selectedVolunteer %}
  <form action="{{uriPrefix}}/volunteers/cancellation/{{selectedVolunteer.getRegisterKeyValue}}/{{selectedSession.getRegisterKeyValue}}/cancel/">
  <input type="submit" value="Cancel Booking &raquo;"/>
  </form>
    {% else %}
  <p>
    Session is already booked (with 
    {{selectedSession.volunteer.getLabelValue}}).
  </p>
    {% endifequal %}
  {% else %}
  <form action="{{uriPrefix}}/volunteers/cancellation/{{selectedVolunteer.getRegisterKeyValue}}/{{selectedSession.getRegisterKeyValue}}/confirm/">
  <input type="submit" value="Re-make Booking &raquo;"/>
  </form>
  {% endif %}
{% else %}
  {% ifequal isConfirmed 'confirm' %}
    {% ifequal selectedSession.volunteer selectedVolunteer %}
  <p>
    Booking has now been re-made. Please notify session contact and volunteer.
  </p>
  <form action="{{uriPrefix}}/volunteers/cancellation/{{selectedVolunteer.getRegisterKeyValue}}/{{selectedSession.getRegisterKeyValue}}/cancel/">
  <input type="submit" value="Re-cancel Booking &raquo;"/>
  </form>
    {% else %}
      {% if selectedSession.volunteer %}
  <p>
    Session is already booked (with 
    {{selectedSession.volunteer.getLabelValue}}).
  </p>
      {% else %}
  <p>
    Booking FAILURE. Please try again, or seek support.
  </p>
      {% endif %}
    {% endifequal %}
  {% else %}
    {% ifequal isConfirmed 'cancel' %}
  <p>
    Booking has now been cancelled. Please notify session contact and volunteer of this cancellation.
  </p>
  <form action="{{uriPrefix}}/volunteers/cancellation/{{selectedVolunteer.getRegisterKeyValue}}/{{selectedSession.getRegisterKeyValue}}/confirm/">
  <input type="submit" value="Re-make Booking &raquo;"/>
  </form>
    {% endifequal %}
  {% endifequal %}
{% endif %}

{% endblock %}


{% block primarysidebar %}
<div class="box">
  <h2>Volunteer Booking</h2>
  {% if view.showInlineHelp %}
  <p>You&rsquo;re currently in the <strong>volunteer booking</strong> 
  section of the {{ systemServiceName }} site.</p>
  {% endif %}
</div>
{% endblock %}

