{% extends "jobs/base.html" %}
{% load pagination_tags %}
{% load job_tags %}
{% load base_tags %}
{% load perm_tags %}
{% load base_filters %}
{% load i18n %}

{% block title %}{% trans "Job Pricing List" %}{% endblock %}

{% block extra_head %}
{{ block.super }}
<link rel="stylesheet" href="{{ STATIC_URL }}css/jobs.css">
{% endblock %}

{% block body %}
<div class="t">
{% job_pricing_nav request.user %}
    <h1>{% trans "Job Pricing List" %}</h1>  

    {% autopaginate job_pricings 10 %}
	
	<div class="jobs-wrap">
    {% for jp in job_pricings %}
    	{% has_perm user jobs.view_jobpricing jp as can_view %}
    	{% if can_view %}
		<div class="job-wrap-search">

			<div class="options options-search">
                <div class="quick-options">
					{% job_pricing_options request.user jp %} 	       
                </div>
			</div>

            <h2><a href="{% url job_pricing.view jp.pk %}">{% trans "Duration:" %} {{ jp.duration }}</a></h2>
            <div class="content">{% trans "Regular Price:" %} {{ jp.regular_price|format_currency }}</div>
            <div class="content">{% trans "Premium Price:" %} {{ jp.premium_price|format_currency }}</div>
            <div class="content">{% trans "Member Regular Price:" %} {{ jp.regular_price_member|format_currency }}</div>
            <div class="content">{% trans "Member Premium Price:" %} {{ jp.premium_price_member|format_currency }}</div>
            <div class="content">{% trans "Show Member Pricing:" %} {{ jp.show_member_pricing }}</div>
            <div class="content">{% trans "Status:" %} <b>{% if jp.status %}Active{%else%}Inactive{%endif%}</b></div>
			<div class="meta">
            	<div class="submitted">{% blocktrans with jp.create_dt|date:"long" as create_date and jp.creator as creat %}Created on {{ create_date }} by {{ creat }}{% endblocktrans %}</div>
            </div>

            <!-- delete-job form -->
            <form name="job-pricing-delete" method="POST" action="{% url job_pricing.delete jp.pk %}">{% csrf_token %}
                <input type="hidden" name="action" value="delete">
            </form>
		</div>
		{% endif %}
	
	{% empty %}
		<div>{% trans "0 Results Found" %}</div>
    {% endfor %}
	</div>

    {% paginate %}
</div>
{% endblock %}

{% block extra_body %}
    {{ block.super }}
    <script type="text/javascript">
		$(document).ready(function(){

			// delete confirmation
			$('.delete').click(function(){
				var delete_job_pricing = confirm('Permenantly delete this job price?');	// confirm
				if(delete_job_pricing) $(this).parents('.job-wrap-search').find('form[name="job-pricing-delete"]').submit() // delete: if OK
				return false;	// cancel
			});
		});
    </script>
    
{% endblock %}
