<%!
from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse
from openedx.core.lib.courses import course_image_url
%>
<%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 class="item-image" src="${course_image_url(course)}"
            alt="${_("{course_number} {course_title} Cover Image").format(
              course_number=course.display_number_with_default,
              course_title=course.display_name_with_default_escaped,
            )}"/>
      </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) | h}
              <span class="course-dates">
                ${_("{start_date} - {end_date}").format(
                  start_date=course.start_datetime_text(),
                  end_date=course.end_datetime_text()
                )}
              </span>
          </h1>
        </div>
        <hr>
        <div>
          <p class="enrollment-text">
            % if reg_code_already_redeemed:
              ${_("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>'
              )}
            % elif redemption_success:
              ${_("You have successfully enrolled in {course_name}."
              " This course has now been added to your dashboard.").format(course_name=course.display_name) | h}
            % elif registered_for_course:
              ${_("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>'
              )}
            % elif course_full:
              ${_("The course you are enrolling for is full.")}
            % elif enrollment_closed:
              ${_("The course you are enrolling for is closed.")}
            % elif redeem_code_error:
              ${_("There was an error processing your redeem code.")}
            % else:
              ${_("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) | h}
            % endif
          </p>
        </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" aria-hidden="true"></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" aria-hidden="true"></i></button>
          </form>
        %endif
      %endif
    </section>
  </section>
</div>
</%block>
