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

{% has_perm user jobs.change_job opt_object as can_edit %}
{% has_perm user jobs.delete_job opt_object as can_delete %}


<div class="t-iconrow">

	{% if can_edit %}
        {% if opt_object.is_pending %}
            <span class="status-pending">{{ opt_object.status_detail|capfirst }}</span>
	    {% else %}
            <span>{{ opt_object.status_detail|capfirst }}</span>
        {% endif %}
	{% endif %}

	<a class="option-link print" href="{% url job.print_view opt_object.slug %}">{% trans "Print" %}</a>
	{% if can_edit %}
		<a class="option-link edit" href="{% url job.edit opt_object.pk %}">{% trans "Edit" %}</a>
	{% endif %}

 {% if can_edit %}
	  <div class="more-options-wrap">
	    <a href="javascript:;" class="more-options-trigger">{% trans "More options" %} <small>&#9660;</small></a>
	    <div class="more-options-target">
	        <ul>
				<li class="divider">
				  <a href="{% url job.edit.meta opt_object.pk %}">{% trans "Edit Meta" %}</a>
				</li>
				
                {% if request.user.is_superuser %}
                    <li>
                    {% if opt_object.object %}
                        <a href="{% url category.update opt_object.object.opt_app_label opt_object.object.opt_module_name opt_object.pk %}">{% trans "Edit Categories" %}</a>
                    {% else %}
                        <a href="{% url category.update opt_object.opt_app_label opt_object.opt_module_name opt_object.pk %}">{% trans "Edit Categories" %}</a>
                    {% endif %}
                    </li>
                {% endif %}
				
				{% if can_delete %}
					<li>
						<a class="option-link delete" href="{% url job.delete opt_object.pk %}">{% trans "Delete" %}</a>
					</li>				
				{% endif %}
			 </ul>
	        </div>
	  </div>
  {% endif %}
</div>
