{% load base_tags %}
{% load perm_tags %}
{% load i18n %}

{% has_perm user site_settings.change_setting as can_edit_setting %}

{% if nav_object %}

{% endif %}

	<ul id="module-tabs" class="tabs">
	
    {% if user.is_authenticated %}
	<li class="dropdown" data-dropdown="dropdown">
	    <a href="#" class="dropdown-toggle">{% trans "Tendenci" %}</a>
        <ul class="dropdown-menu">
            <a href="{% url dashboard %}" title="Tendenci Home Page">{% trans "Dashboard" %}</a>
            <li><a href="{% url profile.index %}">{% trans "My Profile" %}</a></li>
            <li><a href="{% url auth_logout %}">{% trans "Log Off" %}</a></li>
        </ul>
	</li>
    {% endif %}

	<li class="dropdown active" data-dropdown="dropdown">
		<a href="#" class="dropdown-toggle">{% trans 'Recurring Payment' %}</a>
		{% if nav_object %}
	        <div class="dropdown-menu">
	        <ul class="first">
	            <li class="heading">{% trans "All R.P." %}</li>
	            <li class="divider"></li>
	        {% else %}
	            <div>
	            <ul class="dropdown-menu">
	        {% endif %}
			
			{% if request.user.is_superuser %}
				<li><a href="{% url admin:recurring_payments_recurringpayment_add %}">{% trans "Add" %}</a></li>
				<li><a href="{% url recurring_payment.customers %}">{% trans "Customers" %}</a></li>
				<li><a href="{% url admin:recurring_payments_recurringpayment_changelist %}">Admin Backend</a></li>
			{% endif %}
			
			</ul>	
			
			{% if nav_object %}
				<ul>
                <li class="heading">{% trans "This R.P." %}</li>
                <li class="divider"></li>
				{% if request.user.is_superuser or user.id == nav_object.user.id %}
				<li><a href="{{ nav_object.get_absolute_url }}">{% trans "View" %}</a></li>
				{% if request.user.is_superuser %}
				<li><a href="{% url admin:recurring_payments_recurringpayment_change nav_object.id %}">{% trans "Edit" %}</a></li>
				{% endif %}
				{% if nav_object.status_detail == 'active' %}
				<li><a href="{% url recurring_payment.disable_account nav_object.id %}" class="disable">{% trans "Disable Account" %}</a></li>
				<li><a href="{% url recurring_payment.authnet.update_payment_info  nav_object.id %}">{% trans "Payment Method" %}</a></li>
				{% endif %}
				{% endif %}
				
				</ul>
			{% endif %}
		</div>
		
	</li>
	{% if MODULE_NEWS_ENABLED %}
	<li><a href="{% url invoices %}">{% firstof MODULE_INVOICES_LABEL trans 'Invoices' %}</a></li>
	{% endif %}
	</ul>

{% if nav_object %}
 <!-- disable recurring payment account form -->
    <form name="rp-disable" method="POST" action="{% url recurring_payment.disable_account nav_object.id  %}">{% csrf_token %}
        <input type="hidden" name="action" value="Disable Account">
    </form>
{% endif %}