<%!
from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse
from courseware.courses import course_image_url, get_course_about_section
%>
<%inherit file="../main.html" />
<%namespace name='static' file='/static_content.html'/>
<%block name="pagetitle">${_("Confirm Enrollment")}</%block>

<%block name="content">
<div class="container">
  <section class="wrapper confirm-enrollment">
    <header class="page-header">
      <h1 class="title">
        ${_("{site_name} -  Confirm Enrollment").format(site_name=site_name)}
      </h1>
    </header>
    <section>
      <div class="course-image">
        <img style="width: 100%; height: auto;" src="${course_image_url(course)}"
             alt="${course.display_number_with_default | h} ${get_course_about_section(course, 'title')} Cover Image"/>
      </div>
      <div class="enrollment-details">
        <div class="sub-title">
          ${_("Confirm your enrollment for: {span_start}course dates{span_end}").format(
              span_start='<span class="course-date-label">',
              span_end='</span>'
            )}

          <div class="clearfix"></div>
        </div>

        <div class="course-title">
          <h1>
            ${_("{course_name}").format(course_name=course.display_name)}
              <span class="course-dates">${_("{start_date}").format(start_date=course.start_datetime_text())} -  ${_("{end_date}").format(end_date=course.end_datetime_text())}
              </span>
          </h1>
        </div>
        <hr>
        <div>
          % if reg_code_already_redeemed:
          <p class="enrollment-text">
            ${_("You've clicked a link for an enrollment code that has already been used."
            " Check your {link_start}course dashboard{link_end} to see if you're enrolled in the course,"
            " or contact your company's administrator."
            ).format(
              link_start=u'<a href="{url}">'.format(url=reverse('dashboard')),
              link_end='</a>'
            )}
          </p>
          % elif redemption_success:
          <p class="enrollment-text">
            ${_("You have successfully enrolled in {course_name}."
            " This course has now been added to your dashboard.").format(course_name=course.display_name)}
          </p>
          % elif registered_for_course:
          <p class="enrollment-text">
            ${_("You're already enrolled for this course."
            " Visit your {link_start}dashboard{link_end} to see the course."
            ).format(
              link_start=u'<a href="{url}">'.format(url=reverse('dashboard')),
              link_end='</a>'
            )}
          </p>
          % elif course_full:
          <p class="enrollment-text">
            ${_("The course you are enrolling for is full.")}
          </p>
          % elif enrollment_closed:
          <p class="enrollment-text">
            ${_("The course you are enrolling for is closed.")}
          </p>
          % elif redeem_code_error:
          <p class="enrollment-text">
            ${_("There was an error processing your redeem code.")}
          </p>
          % else:
          <p class="enrollment-text">
            ${_("You're about to activate an enrollment code for {course_name} by {site_name}. "
            "This code can only be used one time, so you should only activate this code if you're its intended"
            " recipient.").format(course_name=course.display_name, site_name=site_name)}
          </p>
          % endif
        </div>
      </div>
      % if not reg_code_already_redeemed:
        %if redemption_success:
          <% course_url = reverse('info', args=[course.id.to_deprecated_string()]) %>
          <a href="${course_url}" class="link-button course-link-bg-color">${_("View Course")} <i class="icon fa fa-caret-right"></i></a>
        %elif not registered_for_course:
          <form method="post">
            <input type="hidden" name="csrfmiddlewaretoken" value="${ csrf_token }">
            <button type="submit" id="id_active_course_enrollment"
               name="active_course_enrollment">${_("Activate Course Enrollment")} <i class="icon fa fa-caret-right"></i></button>
          </form>
        %endif
      %endif
    </section>
  </section>
</div>
</%block>
