<%! from django.utils.translation import ugettext as _ %>
<%! from django.core.urlresolvers import reverse %>
<%! from django.conf import settings %>
<%! from microsite_configuration import microsite %>

<%inherit file="../main.html" />

<%block name="bodyclass">purchase-receipt</%block>

<%block name="pagetitle">${_("Register for [Course Name] | Receipt (Order")} ${order.id})</%block>

<%block name="content">

<div class="container">
  <section class="notification">
    <h2>${_("Thank you for your Purchase!")}</h2>
    <p>${_("Please print this receipt page for your records. You should also have received a receipt in your email.")}</p>
    % for inst in instructions:
      <p>${inst}</p>
    % endfor
  </section>

  <section class="wrapper cart-list">
    <div class="wrapper-content-main">
      <article class="content-main">
        <h1>${_("{platform_name} ({site_name}) Electronic Receipt").format(platform_name=microsite.get_value('platform_name', settings.PLATFORM_NAME), site_name=microsite.get_value('SITE_NAME', settings.SITE_NAME))}</h1>
        <hr />

        <table class="order-receipt">
          <tbody>
          <tr>
            <td colspan="2"><h3 class="order-number">${_("Order #")}${order.id}</h3></td>
            <td></td>
            <td colspan="2"><h3 class="order-date">${_("Date:")} ${order.purchase_time.date().isoformat()}</h3></td>
          </tr>
          <tr>
            <td colspan="5"><h2 class="items-ordered">${_("Items ordered:")}</h2></td>
          </tr>
          <tr>
            <th class="qty">${_("Qty")}</th>
            <th class="desc">${_("Description")}</th>
            <th class="url">${_("URL")}</th>
            <th class="u-pr">${_("Unit Price")}</th>
            <th class="pri">${_("Price")}</th>
            <th class="curr">${_("Currency")}</th>
          </tr>
          % for item in order_items:

            <% course_id = reverse('info', args=[item.course_id.to_deprecated_string()]) %>

            <tr class="order-item">
              % if item.status == "purchased":
                <td>${item.qty}</td>
                <td>${item.line_desc}</td>
                <td><a href="${course_id}" class="enter-course">${_('View Course')}</a></td>
                <td>${"{0:0.2f}".format(item.unit_cost)}
                    % if item.list_price != None:
                        <span class="old-price"> ${"{0:0.2f}".format(item.list_price)}</span>
                    % endif
                    </td>
                <td>${"{0:0.2f}".format(item.line_cost)}</td>
                <td>${item.currency.upper()}</td></tr>
              % elif item.status == "refunded":
                <td><del>${item.qty}</del></td>
                <td><del>${item.line_desc}</del></td>
                <td><del>${"{0:0.2f}".format(item.unit_cost)}</del></td>
                <td><del>${"{0:0.2f}".format(item.line_cost)}</del></td>
                <td><del>${item.currency.upper()}</del></td></tr>
              % endif
          % endfor
          <tr>
            <td colspan="3"></td>
            <th>${_("Total Amount")}</th>
            <td></td>
          </tr>
          <tr>
            <td colspan="3"></td>
            <td>${"{0:0.2f}".format(order.total_cost)}</td>
            <td></td>
          </tr>
          </tbody>
        </table>

        % if any_refunds:
          <p>
	    ## Translators: Please keep the "<del>" and "</del>" tags around your translation of the word "this" in your translation.
            ${_("Note: items with strikethough like <del>this</del> have been refunded.")}
          </p>
        % endif
        % if order.total_cost > 0:
            <h2>${_("Billed To:")}</h2>
            <p>
              ${order.bill_to_cardtype} ${_("#:")} ${order.bill_to_ccnum}<br />
              ${order.bill_to_first} ${order.bill_to_last}<br />
              ${order.bill_to_street1}<br />
              ${order.bill_to_street2}<br />
              ${order.bill_to_city}, ${order.bill_to_state} ${order.bill_to_postalcode}<br />
              ${order.bill_to_country.upper()}<br />
            </p>
         % endif
      </article>
    </div>
  </section>
</div>
</%block>
