{% extends "pbp_store/admin_base.html" %}
{% load url from future %}
{% load catalog_filters %}

{% block body %}
<h2>Order #{{order.pk}}</h2>

<table id="order" class="table table-condensed table-bordered">
<tr><td>Order Date:</td><td> {{order.date}}</td></tr>
<tr><td>Status:</td><td> {{order.get_status_display}}</td></tr>
{% if order.orderpayment %}
    <tr><td>Payment Status:</td><td> {{order.orderpayment.payment_state}}</td></tr>
    <tr><td>Shipping Status:</td><td> {{order.orderpayment.shipping_state}}</td></tr>
{% else %}
    <tr><td>Payment Status:</td><td> N/A</td></tr>
    <tr><td>Shipping Status:</td><td> N/A</td></tr>
{% endif %}

<tr><td>Email:</td><td> {{order.email}}</td></tr>
<tr><td>Phone:</td><td> {{order.phone}}</td></tr>

<tr><th colspan='2'>Shipping address:</th></tr>

<tr><td>Name</td><td>{{order.shipping_name}}</td></tr>
<tr><td>Address 1</td><td>{{order.shipping_address_1}}</td></tr>
<tr><td>Address 2</td><td>{{order.shipping_address_2}}</td></tr>
<tr><td>City</td><td>{{order.shipping_city}}</td></tr>
<tr><td>State</td><td>{{order.shipping_state}}</td></tr>
<tr><td>Country</td><td>{{order.shipping_country}}</td></tr>
<tr><td>Zip</td><td>{{order.shipping_zip}}</td></tr>

<tr><th colspan='2'>Billing:</th></tr>

<tr><td>Name</td><td>{{order.billing_name}}</td></tr>
<tr><td>Address 1</td><td>{{order.billing_address_1}}</td></tr>
<tr><td>Address 2</td><td>{{order.billing_address_2}}</td></tr>
<tr><td>City</td><td>{{order.billing_city}}</td></tr>
<tr><td>State</td><td>{{order.billing_state}}</td></tr>
<tr><td>Country</td><td>{{order.billing_country}}</td></tr>
<tr><td>Zip</td><td>{{order.billing_zip}}</td></tr>
</table>

<h3> Order Details </h3>
  <table id="receipt" class="table table-condensed table-bordered">
        <thead>
        <tr>
            <th scope="col">Name</th>
            <th scope="col">Price</th>
            <th scope="col">Quantity</th>
            <th class="right" scope="col">Total</th>
        </tr>
        </thead>
        <tfoot>
            <tr>
                <td colspan="4" class="right" style="height:30px;">
                Order Total: {{ order.total|currency }}
                </td>
            </tr>
        </tfoot>
        <tbody>
        {% for item in order.order_items %}
        <tr>
            <td>{{ item.name }}</td>
            <td>{{ item.price|currency }}</td>
            <td>{{ item.quantity }}</td>
            <td class="right">{{ item.total|currency }}</td>
        </tr>
        {% endfor %}
        </tbody>
    </table>

<h3>Order Payment</h3>
{{order.orderpayment}}

{% if order.orderpayment.is_google %}
    
    <h4>Google Payment</h4>
    {% with google_payment=order.orderpayment.google_payment %}

    <table id="google_payment" class="table table-condensed table-bordered">
    <tr><td>Order Date:</td><td> {{order.date}}</td></tr>
    <tr><td>Notify Type</td><td>{{google_payment.notify_type}}</td></tr>
    <tr><td>Serial Number</td><td>{{google_payment.serial_number}}</td></tr>
    <tr><td>Google Order Number</td><td>{{google_payment.google_order_number}}</td></tr>
    <tr><td>Buyer Id</td><td>{{google_payment.buyer_id}}</td></tr>
    <tr><td>Private data</td><td>{{google_payment.private_data}}</td></tr>
    
        <tr><th colspan='2'>Shipping address:</th></tr>
    
    <tr><td>Contact Name</td><td>{{google_payment.shipping_contact_name}}</td></tr>
    <tr><td>Address 1</td><td>{{google_payment.shipping_address1}}</td></tr>
    <tr><td>Address 2</td><td>{{google_payment.shipping_address2}}</td></tr>
    <tr><td>City</td><td>{{google_payment.shipping_city}}</td></tr>
    <tr><td>Postal code</td><td>{{google_payment.shipping_postal_code}}</td></tr>
    <tr><td>Region</td><td>{{google_payment.shipping_region}}</td></tr>
    <tr><td>Country</td><td>{{google_payment.shipping_country_code}}</td></tr>
    <tr><td>Email</td><td>{{google_payment.shipping_email}}</td></tr>
    <tr><td>Company</td><td>{{google_payment.shipping_company_name}}</td></tr>
    <tr><td>Fax</td><td>{{google_payment.shipping_fax}}</td></tr>
    <tr><td>Phone</td><td>{{google_payment.shipping_phone}}</td></tr>
    
        <tr><th colspan='2'>Billing:</th></tr>
    
    <tr><td>Name</td><td>{{google_payment.billing_contact_name}}</td></tr>
    <tr><td>Address 1</td><td>{{google_payment.billing_address1}}</td></tr>
    <tr><td>Address 2</td><td>{{google_payment.billing_address2}}</td></tr>
    <tr><td>City</td><td>{{google_payment.billing_city}}</td></tr>
    <tr><td>Postal Code</td><td>{{google_payment.billing_postal_code}}</td></tr>
    <tr><td>Region</td><td>{{google_payment.billing_region}}</td></tr>
    <tr><td>Country</td><td>{{google_payment.billing_country_code}}</td></tr>
    <tr><td>Email</td><td>{{google_payment.billing_email}}</td></tr>
    <tr><td>Company</td><td>{{google_payment.billing_company_name}}</td></tr>
    <tr><td>Fax</td><td>{{google_payment.billing_fax}}</td></tr>
    <tr><td>Phone</td><td>{{google_payment.billing_phone}}</td></tr>
    
    <tr><td>Marketing email allowed</td><td>{{google_payment.marketing_email_allowed}}</td></tr>
    <tr><td>Num cart items</td><td>{{google_payment.num_cart_items}}</td></tr>
    <tr><td>Cart Items</td><td>{{google_payment.cart_items}}</td></tr>
    <tr><td>Total Tax</td><td>{{google_payment.total_tax|currency}}</td></tr>
    <tr><td>Tax Currency</td><td>{{google_payment.total_tax_currency}}</td></tr>
    <tr><td>Adjustment Total</td><td>{{google_payment.adjustment_total|currency}}</td></tr>
    <tr><td>Adjustment currency</td><td>{{google_payment.adjustment_total_currency}}</td></tr>
    <tr><td>Order Total</td><td>{{google_payment.order_total|currency}}</td></tr>
    <tr><td>Order Currency</td><td>{{google_payment.order_total_currency}}</td></tr>
    <tr><td>Financial Order State</td><td>{{google_payment.financial_order_state}}</td></tr>
    <tr><td>Fulfillment Order State</td><td>{{google_payment.fulfillment_order_state}}</td></tr>
    <tr><td>TimeStamp</td><td>{{google_payment.timestamp}}</td></tr>
    <tr><td>Created At</td><td>{{google_payment.created_at}}</td></tr>
    <tr><td>Last updated</td><td>{{google_payment.updated_at}}</td></tr>
    </table>
    {% endwith %}
{% endif %}

{% if order.orderpayment.is_amazon %}
    Amazon order: {{order.orderpayment.is_amazon}}
{% endif %}

{% endblock body %}