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

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

<%block name="title"><title>${_("Receipt for Order")} ${order.id}</title></%block>

% if notification is not UNDEFINED:
<section class="notification">
    ${notification}
</section>
% endif

<section class="container cart-list">
    <p><h1>${_(settings.PLATFORM_NAME + " (" + settings.SITE_NAME + ")" + " Electronic Receipt")}</h1></p>
    <h2>${_("Order #")}${order.id}</h2>
    <h2>${_("Date:")} ${order.purchase_time.date().isoformat()}</h2>
    <h2>${_("Items ordered:")}</h2>

        <table>
            <thead>
            <tr>${_("<td>Qty</td><td>Description</td><td>Unit Price</td><td>Price</td><td>Currency</td>")}</tr>
            </thead>
            <tbody>
            % for item in order_items:
            <tr>
                % if item.status == "purchased":
                <td>${item.qty}</td><td>${item.line_desc}</td>
                <td>${"{0:0.2f}".format(item.unit_cost)}</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></td><td></td><td></td><td>${_("Total Amount")}</td></tr>
            <tr><td></td><td></td><td></td><td>${"{0:0.2f}".format(order.total_cost)}</td></tr>
            </tbody>
        </table>
    % if any_refunds:
    <p>
        ${_("Note: items with strikethough like ")}<del>this</del>${_(" have been refunded.")}
    </p>
    % endif

    <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>

</section>
