Files
ihrm/base/templates/cbv/shift_request/confirm_allocated.html

36 lines
1.9 KiB
HTML

{% load basefilters %}
{% load i18n %}
{% is_manager_of request.user instance as can_manage %}
{% with is_owner=request.user.employee_get|equals:instance.employee_id can_change=perms.base.change_shiftrequest can_delete=perms.base.delete_shiftrequest %}
{% if is_owner or can_change or can_delete or can_manage %}
<div class="" onclick="event.stopPropagation();">
<div class="oh-btn-group">
{% if is_owner or can_change or can_manage %}
{% if instance.approved == False and not instance.canceled %}
<a hx-get="{% url 'shift-allocation-request-update' instance.id %}?instance_ids={{instance.ordered_ids}}"
hx-target='#genericModalBody' data-toggle="oh-modal-toggle" data-target='#genericModal'
class="oh-btn oh-btn--light-bkg w-50" title="{% trans 'Edit' %}">
<ion-icon name="create-outline"></ion-icon>
</a>
{% else %}
<button class="oh-btn oh-btn--light-bkg w-50" disabled><ion-icon name="create-outline"></ion-icon></button>
{% endif %}
{% endif %}
{% if is_owner or can_delete or can_manage %}
{% if instance.approved == False and instance.canceled == False %}
<form action="{% url 'shift-request-delete' instance.id %}" onsubmit="return confirm('{% trans "Are you sure you want to delete this shift request?" %}');" method='post' class="w-50">
{% csrf_token %}
<button type='submit' class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100" title="{% trans 'Remove' %}"><ion-icon name="trash-outline"></ion-icon></button>
</form>
{% else %}
<button class="oh-btn oh-btn--light-bkg w-50" disabled><ion-icon name="trash-outline"></ion-icon></button>
{% endif %}
{% endif %}
</div>
</div>
{% endif %}
{% endwith %}