<%!
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_number} {course_title} Cover Image").format(
              course_number=course.display_number_with_default,
              course_title=get_course_about_section(course, 'title'),
            )}" />
      </div>
      <div class="enrollment-details">
        <div class="sub-title">${_("Confirm your enrollment for:")}
          <span class="course-date-label">${_("course dates")}</span>

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

        <div class="course-title">
          <h1>
            ${course.display_name}
              <span class="course-dates">
                ${course.start_datetime_text()}
                -
                ${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='<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 registered for this course. "
              "Visit your {link_start}dashboard{link_end} to see the course."
            ).format(
              link_start='<a href="{url}">'.format(url=reverse('dashboard')),
              link_end='</a>',
            )}
          </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:
          <a href="${reverse('dashboard')}" class="link-button course-link-bg-color">${_("View Dashboard &nbsp; &nbsp; &#x25b8;")}</a>
        %elif not registered_for_course:
          <form method="post">
            <input type="hidden" name="csrfmiddlewaretoken" value="${ csrf_token }">
            <input type="submit" value="${_("Activate Course Enrollment")} &#x25b8;"
               id="id_active_course_enrollment" name="active_course_enrollment">
          </form>
        %endif
      %endif
    </section>
  </section>
</div>
</%block>
