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

{% block body %}
<div class='span8'></div>
{% for order_item in order_items %}
    <h3>Subscription Type:
        {% if order_item.product.child.renewal %} Renewal{% elif order_item.is_gift %} Gift{% else %} New{% endif %}
    </h3>
    <h5><a href="{% url 'view_order_detail' order.pk %}">Order: #{{order.pk}}</a></h5>
    <table class="table table-condensed table-bordered">
        <tbody>
        <tr><td>Paper:</td><td>{{order_item.product.title}}</td></tr>
        <tr><td>Duration:</td><td>{{order_item.product.child.duration}}</td></tr>
        <tr><td>Shipping Method:</td><td>{{order_item.product.child.shipping_method}}</td></tr>
        <tr><td>Email:</td><td>{{order.user.email}}</td></tr>

        <tr><th colspan="2">{% if not order_item.is_gift %}Shipping Address:{% else %}Gift From:{% endif %}</th></tr>
        <tr><td>Name:</td><td>{{order.user.first_name}} {{order.user.last_name}}</td></tr>
        <tr><td>Company:</td><td>{{order.user.my_profile.company}}</td></tr>
        <tr><td>address1:</td><td>{{order.user.my_profile.address1}}</td></tr>
        <tr><td>address2:</td><td>{{order.user.my_profile.address2}}</td></tr>
        <tr><td>City:</td><td>{{order.user.my_profile.city}}</td></tr>
        <tr><td>State:</td><td>{{order.user.my_profile.region}}</td></tr>
        <tr><td>Country:</td><td>{{order.user.my_profile.country}}</td></tr>
        <tr><td>Other:</td><td>{{order.user.my_profile.country_other}}</td></tr>
        <tr><td>Zip:</td><td>{{order.user.my_profile.postal_code}}{% if order.user.my_profile.plus_four %}-{{order.user.my_profile.plus_four}}{% endif %}</td></tr>
        <tr><td>Phone:</td><td>{{order.user.my_profile.phone}}</td></tr>

        {% if not order_item.is_gift %}
        <tr><th colspan="2">Secondary Shipping Address:</th></tr>
        <tr><td>Date Effective:</td>
            <td>{% if order.user.my_profile.secondary_address.address_from %}From: {{ order.user.my_profile.secondary_address.address_from }}{% endif %}
                {% if order.user.my_profile.secondary_address.address_to %}To: {{ order.user.my_profile.secondary_address.address_to }}{% endif %}</td></tr>
        <tr><td>Name:</td><td>{{order.user.my_profile.secondary_address.first_name}} {{order.user.my_profile.secondary_address.last_name}}</td></tr>
        <tr><td>Company:</td><td>{{order.user.my_profile.secondary_address.company}}</td></tr>
        <tr><td>address1:</td><td>{{order.user.my_profile.secondary_address.address1}}</td></tr>
        <tr><td>address2:</td><td>{{order.user.my_profile.secondary_address.address2}}</td></tr>
        <tr><td>City:</td><td>{{order.user.my_profile.secondary_address.city}}</td></tr>
        <tr><td>State:</td><td>{{order.user.my_profile.secondary_address.region}}</td></tr>
        <tr><td>Country:</td><td>{{order.user.my_profile.secondary_address.country}}</td></tr>
        <tr><td>Other:</td><td>{{order.user.my_profile.secondary_address.country_other}}</td></tr>
        <tr><td>Zip:</td><td>{{order.user.my_profile.secondary_address.postal_code}}{% if order.user.my_profile.secondary_address.plus_four %}-{{order.user.my_profile.secondary_address.plus_four}}{% endif %}</td></tr>
        <tr><td>Phone:</td><td>{{order.user.my_profile.secondary_address.phone}}</td></tr>
        {% else %}
        <tr><th colspan="2">Gift To:</th></tr>
        <tr><td>Name:</td><td>{{order_item.gift_detail.first_name}} {{order_item.gift_detail.last_name}}</td></tr>
        <tr><td>Company:</td><td>{{order_item.gift_detail.company}}</td></tr>
        <tr><td>address1:</td><td>{{order_item.gift_detail.address1}}</td></tr>
        <tr><td>address2:</td><td>{{order_item.gift_detail.address2}}</td></tr>
        <tr><td>City:</td><td>{{order_item.gift_detail.city}}</td></tr>
        <tr><td>State:</td><td>{{order_item.gift_detail.region}}</td></tr>
        <tr><td>Country:</td><td>{{order_item.gift_detail.country}}</td></tr>
        <tr><td>Other:</td><td>{{order_item.gift_detail.country_other}}</td></tr>
        <tr><td>Zip:</td><td>{{order_item.gift_detail.postal_code}}{% if order_item.gift_detail.plus_four %}-{{order_item.gift_detail.plus_four}}{% endif %}</td></tr>
        <tr><td>Phone:</td><td>{{order_item.gift_detail.phone}}</td></tr>
        <tr><td>Email:</td><td>{{order_item.gift_detail.email}}</td></tr>
        <tr><th colspan="2">Gift Detail:</th></tr>
        <tr><td>Next Renewal:</td><td>{% if order_item.gift_detail.bill_on_renewal == "PURCHASER"%}Bill Purchaser{% else %}Bill Recipient{% endif %}</td></tr>
        <tr><td>Gift Card:</td><td>{% if not order_item.gift_detail.gift_card_delivery %}No gift card{% elif order_item.gift_detail.gift_card_delivery == "PURCHASER" %}Send gift card to purchaser{% else %}Send gift cards to sender{% endif %}</td></tr>
        <tr><td>Gift Card Text:</td><td>{{order_item.gift_detail.message}}</td></tr>
        {% endif %}

        </tbody>
    </table>
{% endfor %}

{% endblock body %}
