{% extends "pbp_store/store_base.html" %}
{% load i18n %}
{% load url from future %}
{% load storefront_tags pbp_core_tags account_tags %}

{% block style %}{{ block.super }}
<link rel="stylesheet"
      href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css"
      xmlns="http://www.w3.org/1999/html">
<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
<script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
{% endblock style %}

{% block right-side %}{% endblock right-side %}

{% block body %}
<div id="store_details_sidebar">

    <h2 class="store_sectionhead">Account{% if not request.user.is_authenticated %} Creation{% endif %}</h2>
	<p style="color:#FF0000">NOTE: We have streamlined our online store and are no longer using customer accounts for our storefront.<br>
	This admin section is provided for reference for previous orders only <br>and does not include any orders placed after Nov. 20, 2013.</p> 
	    {% if request.user.is_authenticated %}
    <div class="sub_nav">
        <ul class="sub_nav_list">
            <li class="sub_nav_item_current"><a href="{% url 'profile_edit' %}" >{% trans 'Account'%}</a></li>
            <li class="sub_nav_item"><a href="{% url 'password_change' %}" class="sub_nav_link">Change Password</a></li>
            <li class="sub_nav_item"><a href="{% url 'profile_orders_subs' %}" class="sub_nav_link">Orders/Subscriptions</a></li>
        </ul>
    </div>
    {% endif %}
</div>
<div id="store_details">
    <div class="store_item">
        <form style="margin:0px; padding:0px" action="" method="post">{% csrf_token %}

            <h3 class="store_sectionsubhead">Shipping Address</h3>
            <p class="sub_form_address">
                {% if userform.non_field_errors %}
                <span class='required'>{{ userform.non_field_errors }}</span>
                {% endif %}

                {{ userform.first_name.errors }}{{ userform.last_name.errors }}
                First/Last Name<span class="required">*</span>
                {{ userform.first_name }} {{ userform.last_name }}<br />

                {{ userform.company.errors }}
                Company
                {{ userform.company }}<br />

                {{ userform.address.errors }}
                Address<span class="required">*</span>
                {{ userform.address1 }}<br />
                {{ userform.address2 }}<br />

                {{ userform.city.errors }}
                City<span class="required">*</span>
                {{ userform.city }}<br />

                {{ userform.region.errors }}
                State/Province<span class="required">*</span>
                {{ userform.region }}<br />

                {{ userform.country.errors }}
                Country<span class="required">*</span>
                {{ userform.country }}<br />

                {{ userform.country_other.errors }}
                Other <span class="fine_print">(Foreign only) </span>
                {{ userform.country_other}}<br />

                {{ userform.postal_code.errors }}{{userform.plus_four.errors }}
                ZIP+4<span class="required">*</span>
                {{ userform.postal_code }}-{{ userform.plus_four }}<br />

                {{ userform.phone.errors }}
                Phone<span class="required">*</span>
                {{ userform.phone }}<br />

                {{ userform.email.errors }}
                E-mail<span class="required">*</span>
                {{ userform.email }}<br />
                <span class="fine_print"><a href="{% url 'help' %}#emailhelp" class="basic_link">Why is an e-mail address mandatory?</a></span></br>
                {% if userform.password1 %}
                    {{ userform.password1.errors }}{{ userform.password2.errors }}
                    Password<span class="required">*</span>
                    {{ userform.password1 }}<br />
                    Confirm Password<span class="required">*</span>
                    {{ userform.password2 }}<br />
                {% endif %}

            </p>

            {% if request.user.is_authenticated %}
            <h3 class="store_sectionsubhead">
                Secondary Shipping Address
            </h3>

            <p class="sub_form_address">

                {% if second_address.non_field_errors %}
                <span class='required'>{{ second_address.non_field_errors }}</span>
                {% endif %}

                {{ second_address.address_from.error }}{{ second_address.address_to.error }}
                Date Effective
                {{ second_address.address_from }} to {{ second_address.address_to }}<br />

                {{ second_address.first_name.error }} {{ second_address.last_name.error }}
                First/Last Name
                {{ second_address.first_name }} {{ second_address.last_name }}<br />

                {{ second_address.company.errors }}
                Company
                {{ second_address.company }}<br />

                {{ second_address.address.errors }}
                Address
                {{ second_address.address1 }}<br />
                {{ second_address.address2 }}<br />

                {{ second_address.city.errors }}
                City
                {{ second_address.city }}<br />

                {{ second_address.region.errors }}
                State/Province
                {{ second_address.region }}<br />

                {{ second_address.country.errors }}
                Country
                {{ second_address.country }}<br />

                {{ second_address.country_other.errors }}
                Other <span class="fine_print">(Foreign only) </span>
                {{ second_address.country_other}}<br />

                {{ second_address.postal_code.error }}{{second_address.plus_four.error }}
                ZIP+4
                {{ second_address.postal_code }}-{{ second_address.plus_four }}<br />

                {{ second_address.phone.error }}
                Phone
                {{ second_address.phone }}<br />

            </p>
            {% endif %}

            <p class="checkout"><button type="submit" >
                {% if request.user.is_authenticated %}Update profile
                {% else %}Create Account
                {% endif %}
            </button></p>

        </form>


    </div>

</div>

<script>
    $( "#id_form5-address_from" ).datepicker();
    $( "#id_form5-address_to" ).datepicker();
</script>
<script type="text/javascript" src="{{ MEDIA_URL }}js/pbp_store.js"></script>

{% endblock body %}
