[UPDT] BASE: Updated base module cbv html files by replace is_reportingmanager with is_manager_of

This commit is contained in:
Horilla
2025-11-27 16:28:22 +05:30
parent a62dba0329
commit c00010109b
14 changed files with 283 additions and 329 deletions

View File

@@ -822,7 +822,7 @@ class JobRoleForm(ModelForm):
raise ValidationError(
f"{job_role} already exists under this job position"
)
cleaned_data.pop("job_position_id", None)
return cleaned_data
def save(self, commit, *args, **kwargs) -> Any:

View File

@@ -1,33 +1,37 @@
{% load i18n %}
{% load basefilters %}
<div class="oh-btn-group" onclick="event.stopPropagation()">
{% if perms.base.change_rotatingshiftassign or request.user|is_reportingmanager %}
<a hx-get="{% url 'rotating-shift-assign-update' instance.id %}?instance_ids={{instance.ordered_ids}}"
hx-target="#genericModalBody" hx-swap="innerHTML" data-target="#genericModal" data-toggle="oh-modal-toggle"
type="button" class="oh-btn oh-btn--light-bkg w-100" title="{% trans 'Edit' %}">
<ion-icon name="create-outline"></ion-icon>
</a>
{% endif %}
{% if perms.base.change_rotatingshiftassign or request.user|is_reportingmanager %}
{% if instance.is_active %}
<a hx-confirm="{% trans 'Do you want to archive this rotating shift assign?' %}"
hx-get="{% url 'rotating-shift-assign-archive' instance.id %}" hx-target="#rotating-shift-container"
title="{% trans 'Archive' %}" class="oh-btn oh-btn--danger-outline oh-btn oh-btn--light-bkg w-100">
{% comment %} <input type="hidden" name="is_active" value="{% trans 'False' %}" id=""> {% endcomment %}
<ion-icon name="archive"></ion-icon>
</a>
{% else %}
<a class="oh-btn oh-btn--danger-outline oh-btn oh-btn--light-bkg w-100" hx-confirm="{% trans 'Do you Want to un-archive this rotating shift assign?' %}" hx-get="{% url 'rotating-shift-assign-archive' instance.id %}?{{pd}}"
hx-target="#rotating-shift-container" title="{% trans 'Un-Archive' %}">
<ion-icon name="archive"></ion-icon>
{% is_manager_of request.user instance as can_manage %}
{% with can_change=perms.base.change_rotatingshiftassign can_delete=perms.base.delete_rotatingshiftassign %}
{% if can_change or can_manage or can_delete %}
<div class="oh-btn-group" onclick="event.stopPropagation()">
{% if can_change or can_manage %}
<a hx-get="{% url 'rotating-shift-assign-update' instance.id %}?instance_ids={{instance.ordered_ids}}"
hx-target="#genericModalBody" hx-swap="innerHTML" data-target="#genericModal" data-toggle="oh-modal-toggle"
type="button" class="oh-btn oh-btn--light-bkg w-100" title="{% trans 'Edit' %}">
<ion-icon name="create-outline"></ion-icon>
</a>
{% endif %}
{% endif %}
{% if perms.base.delete_rotatingshiftassign or request.user|is_reportingmanager %}
<a class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100" hx-confirm="{% trans 'Are you sure you want to delete this rotating shift assign?' %}"
hx-post="{% url 'rotating-shift-assign-delete' instance.id %}" hx-target="#rotating-shift-container" title="{% trans 'Remove' %}">
<ion-icon name="trash-outline"></ion-icon>
</a>
{% endif %}
</div>
{% if can_change or can_manage %}
{% if instance.is_active %}
<a hx-confirm="{% trans 'Do you want to archive this rotating shift assign?' %}"
hx-get="{% url 'rotating-shift-assign-archive' instance.id %}" hx-target="#rotating-shift-container"
title="{% trans 'Archive' %}" class="oh-btn oh-btn--danger-outline oh-btn oh-btn--light-bkg w-100">
{% comment %} <input type="hidden" name="is_active" value="{% trans 'False' %}" id=""> {% endcomment %}
<ion-icon name="archive"></ion-icon>
</a>
{% else %}
<a class="oh-btn oh-btn--danger-outline oh-btn oh-btn--light-bkg w-100" hx-confirm="{% trans 'Do you Want to un-archive this rotating shift assign?' %}" hx-get="{% url 'rotating-shift-assign-archive' instance.id %}?{{pd}}"
hx-target="#rotating-shift-container" title="{% trans 'Un-Archive' %}">
<ion-icon name="archive"></ion-icon>
</a>
{% endif %}
{% endif %}
{% if can_delete or can_manage %}
<a class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100" hx-confirm="{% trans 'Are you sure you want to delete this rotating shift assign?' %}"
hx-post="{% url 'rotating-shift-assign-delete' instance.id %}" hx-target="#rotating-shift-container" title="{% trans 'Remove' %}">
<ion-icon name="trash-outline"></ion-icon>
</a>
{% endif %}
</div>
{% endif %}
{% endwith %}

View File

@@ -1,80 +1,47 @@
{% load basefilters%}
{% load i18n %}
{% if perms.base.change_rotatingshiftassign or request.user|is_reportingmanager %}
<a class="oh-btn oh-btn-group oh-btn--info" data-toggle="oh-modal-toggle"
data-target="#genericModal"
hx-get="{% url "rotating-shift-assign-update" instance.id %}?instances_ids={{ request.GET.instance_ids }}"
hx-target="#genericModalBody"
style="width: 50%;">
<button
style="
background: none;
color: inherit;
border: none;
padding: 0;
font: inherit;
cursor: pointer;
outline: inherit;
"
>
<ion-icon name="create-outline"> </ion-icon>{% trans "Edit" %}</button>
</a>
<form class="oh-btn oh-btn-group oh-btn--primary" style="width: 50%;"
hx-confirm="{% if instance.is_active %}
{% trans 'Do you want to archive this rotating shift assign?' %}
{% else %}
{% trans 'Do you want to un-archive this rotating shift assign?' %}
{% endif %}
"
hx-get="{% url "rotating-shift-assign-archive" instance.id %}?instances_ids={{ request.GET.instance_ids }}"
hx-target="#genericModalBody">
<button
style="
background: none;
color: inherit;
border: none;
padding: 0;
font: inherit;
cursor: pointer;
outline: inherit;
"
>
<ion-icon name="archive-outline"> </ion-icon>
{% if instance.is_active %}
{% trans "Archive" %}
{% else %}
{% trans "Un-archive" %}
{% endif %}
</button>
</form>
{% endif %}
{% if perms.base.delete_rotatingshiftassign or request.user|is_reportingmanager %}
<form class="oh-btn oh-btn-group oh-btn--secondary" style="width: 50%;"
hx-confirm="{% trans 'Are you sure you want to delete this rotating shift assign?' %}"
hx-post="{% url 'rotating-shift-assign-delete' instance.id %}?instances_ids={{ request.GET.instance_ids }}" hx-target="#genericModalBody"
>
{% csrf_token %}
<button
style="
background: none;
color: inherit;
border: none;
padding: 0;
font: inherit;
cursor: pointer;
outline: inherit;"
>
<ion-icon name="trash-outline"> </ion-icon>{% trans "Delete" %}
</button>
</form>
{% endif %}
{% is_manager_of request.user instance as can_manage %}
{% if perms.base.change_rotatingshiftassign or can_manage %}
<a class="oh-btn oh-btn-group oh-btn--info" data-toggle="oh-modal-toggle" data-target="#genericModal"
hx-get="{% url 'rotating-shift-assign-update' instance.id %}?instances_ids={{ request.GET.instance_ids }}"
hx-target="#genericModalBody" style="width: 50%;">
<button
style="background: none; color: inherit; border: none; padding: 0; font: inherit; cursor: pointer; outline: inherit;">
<ion-icon name="create-outline"> </ion-icon>{% trans "Edit" %}
</button>
</a>
<form class="oh-btn oh-btn-group oh-btn--primary" style="width: 50%;"
hx-confirm="{% if instance.is_active %} {% trans 'Do you want to archive this rotating shift assign?' %} {% else %} {% trans 'Do you want to un-archive this rotating shift assign?' %} {% endif %}"
hx-get="{% url 'rotating-shift-assign-archive' instance.id %}?instances_ids={{ request.GET.instance_ids }}"
hx-target="#genericModalBody">
<button
style="background: none; color: inherit; border: none; padding: 0; font: inherit; cursor: pointer; outline: inherit;">
<ion-icon name="archive-outline"> </ion-icon>
{% if instance.is_active %}
{% trans "Archive" %}
{% else %}
{% trans "Un-archive" %}
{% endif %}
</button>
</form>
{% endif %}
{% if perms.base.delete_rotatingshiftassign or can_manage %}
<form class="oh-btn oh-btn-group oh-btn--secondary" style="width: 50%;"
hx-confirm="{% trans 'Are you sure you want to delete this rotating shift assign?' %}"
hx-post="{% url 'rotating-shift-assign-delete' instance.id %}?instances_ids={{ request.GET.instance_ids }}"
hx-target="#genericModalBody">
{% csrf_token %}
<button
style="background: none; color: inherit; border: none; padding: 0; font: inherit; cursor: pointer; outline: inherit;">
<ion-icon name="trash-outline"> </ion-icon>{% trans "Delete" %}
</button>
</form>
{% endif %}
{% if request.GET.detail %}
<script>
$("#reloadMessagesButton").click();
$('.reload-record').click();
</script>
{% endif %}
{% if request.GET.detail %}
<script>
$("#reloadMessagesButton").click();
$('.reload-record').click();
</script>
{% endif %}

View File

@@ -1,70 +1,41 @@
{% load basefilters%}
{% load i18n %}
{% if perms.base.change_rotatingworktypeassign or request.user|is_reportingmanager %}
<a class="oh-btn oh-btn-group oh-btn--info"
data-toggle="oh-modal-toggle"
data-target="#genericModal"
hx-get="{% url "rotating-work-type-assign-update" instance.id %}"
hx-target="#genericModalBody"
style="width: 50%;">
<ion-icon name="create-outline"> </ion-icon>{% trans "Edit" %}
</a>
<form class="oh-btn oh-btn-group oh-btn--primary" style="width: 50%;"
hx-confirm="{% if instance.is_active %}
{% trans 'Do you want to archive this rotating work type assign?' %}
{% else %}
{% trans 'Do you want to Un-archive this rotating work type assign?' %}
{% endif %}
"
hx-get="{% url "rotating-work-type-assign-archive" instance.id %}"
hx-target="#genericModalBody">
<button
style="
background: none;
color: inherit;
border: none;
padding: 0;
font: inherit;
cursor: pointer;
outline: inherit;
"
>
<ion-icon name="archive-outline"> </ion-icon>
{% if instance.is_active %}
{% trans "Archive" %}
{% else %}
{% trans "Un-archive" %}
{% endif %}
</button>
</form>
{% endif %}
{% if perms.base.delete_rotatingshiftassign or request.user|is_reportingmanager %}
<form class="oh-btn oh-btn-group oh-btn--secondary" style="width: 50%;"
hx-confirm="{% trans 'Are you sure you want to delete this rotating work type assign?' %}"
hx-post="{% url 'rotating-work-type-assign-delete' instance.id %}?instances_ids={{request.GET.instance_ids}}" hx-target="#genericModalBody"
>
{% csrf_token %}
<button
style="
background: none;
color: inherit;
border: none;
padding: 0;
font: inherit;
cursor: pointer;
outline: inherit;"
>
<ion-icon name="trash-outline"> </ion-icon>{% trans "Delete" %}
</button>
</form>
{% endif %}
{% is_manager_of request.user instance as can_manage %}
{% if perms.base.change_rotatingworktypeassign or can_manage %}
<a class="oh-btn oh-btn-group oh-btn--info" data-toggle="oh-modal-toggle" data-target="#genericModal"
hx-get="{% url 'rotating-work-type-assign-update' instance.id %}" hx-target="#genericModalBody" style="width: 50%;">
<ion-icon name="create-outline"> </ion-icon>{% trans "Edit" %}
</a>
<form class="oh-btn oh-btn-group oh-btn--primary" style="width: 50%;"
hx-confirm="{% if instance.is_active %} {% trans 'Do you want to archive this rotating work type assign?' %} {% else %} {% trans 'Do you want to Un-archive this rotating work type assign?' %} {% endif %}"
hx-get="{% url 'rotating-work-type-assign-archive' instance.id %}" hx-target="#genericModalBody">
<button
style="background: none; color: inherit; border: none; padding: 0; font: inherit; cursor: pointer; outline: inherit;">
<ion-icon name="archive-outline"> </ion-icon>
{% if instance.is_active %}
{% trans "Archive" %}
{% else %}
{% trans "Un-archive" %}
{% endif %}
</button>
</form>
{% endif %}
{% if perms.base.delete_rotatingshiftassign or can_manage %}
<form class="oh-btn oh-btn-group oh-btn--secondary" style="width: 50%;"
hx-confirm="{% trans 'Are you sure you want to delete this rotating work type assign?' %}"
hx-post="{% url 'rotating-work-type-assign-delete' instance.id %}?instances_ids={{request.GET.instance_ids}}"
hx-target="#genericModalBody">
{% csrf_token %}
<button
style="background: none; color: inherit; border: none; padding: 0; font: inherit; cursor: pointer; outline: inherit;">
<ion-icon name="trash-outline"> </ion-icon>{% trans "Delete" %}
</button>
</form>
{% endif %}
{% if request.GET.deleted %}
<script>
$("#reloadMessagesButton").click()
</script>
<script>
$("#reloadMessagesButton").click()
</script>
{% endif %}

View File

@@ -1,37 +1,39 @@
{% load i18n %}
{% load basefilters %}
{% is_manager_of request.user instance as can_manage %}
{% with can_change=perms.base.change_rotatingworktypeassign can_delete=perms.base.delete_rotatingworktypeassign %}
{% if can_change or can_delete or can_manage %}
<div class="oh-btn-group" onclick="event.stopPropagation()">
{% if perms.base.change_rotatingworktypeassign or request.user|is_reportingmanager %}
{% if can_change or can_manage %}
<a hx-get="{% url 'rotating-work-type-assign-update' instance.id %}?instance_ids={{instance.ordered_ids}}"
hx-target="#genericModalBody" data-target="#genericModal" data-toggle="oh-modal-toggle" type="button"
class="oh-btn oh-btn--light-bkg small-button w-100" title="{% trans 'Edit' %}">
<ion-icon name="create-outline"></ion-icon>
</a>
{% endif %}
{% if perms.base.change_rotatingworktypeassign or request.user|is_reportingmanager %}
{% if can_change or can_manage %}
{% if instance.is_active %}
<a title="{% trans 'Archive' %}" class="oh-btn oh-btn--danger-outline oh-btn--light-bkg small-button w-100"
hx-confirm="{% trans 'Do you want to archive this rotating work type assign?' %}"
hx-get="{% url 'rotating-work-type-assign-archive' instance.id %}" hx-target="#rotating-work-container">
<ion-icon name="archive"></ion-icon>
</a>
<a title="{% trans 'Archive' %}" class="oh-btn oh-btn--danger-outline oh-btn--light-bkg small-button w-100"
hx-confirm="{% trans 'Do you want to archive this rotating work type assign?' %}"
hx-get="{% url 'rotating-work-type-assign-archive' instance.id %}" hx-target="#rotating-work-container">
<ion-icon name="archive"></ion-icon>
</a>
{% else %}
<a title="{% trans 'Un-Archive' %}" class="oh-btn oh-btn--danger-outline oh-btn--light-bkg small-button w-100"
hx-confirm="{% trans 'Do you want to un-archive this rotating work type assign?' %}"
hx-get="{% url 'rotating-work-type-assign-archive' instance.id %}" hx-target="#rotating-work-container">
<ion-icon name="archive"></ion-icon>
</a>
<a title="{% trans 'Un-Archive' %}" class="oh-btn oh-btn--danger-outline oh-btn--light-bkg small-button w-100"
hx-confirm="{% trans 'Do you want to un-archive this rotating work type assign?' %}"
hx-get="{% url 'rotating-work-type-assign-archive' instance.id %}" hx-target="#rotating-work-container">
<ion-icon name="archive"></ion-icon>
</a>
{% endif %}
{% endif %}
{% if perms.base.delete_rotatingworktypeassign or request.user|is_reportingmanager %}
<a title="{% trans 'Remove' %}" class="oh-btn oh-btn--danger-outline oh-btn--light-bkg small-button w-100" hx-confirm="{% trans 'Are you sure you want to delete this rotating work type assign?' %}"
{% if can_delete or can_manage %}
<a title="{% trans 'Remove' %}" class="oh-btn oh-btn--danger-outline oh-btn--light-bkg small-button w-100"
hx-confirm="{% trans 'Are you sure you want to delete this rotating work type assign?' %}"
hx-post="{% url 'rotating-work-type-assign-delete' instance.id %}?{{pd}}" hx-target="#rotating-work-container">
<ion-icon name="trash-outline"></ion-icon>
<ion-icon name="trash-outline"></ion-icon>
</button>
</a>
{% endif %}
</div>
{% endif %}
{% endwith %}

View File

@@ -1,38 +1,41 @@
{% load basefilters %}
{% load static %}
{% load i18n %}
{% load static 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_add=perms.base.add_shiftrequest can_delete=perms.base.delete_shiftrequest %}
{% if is_owner or can_change or can_add or can_delete or can_manage %}
<div class="oh-btn-group" onclick="event.stopPropagation();">
{% if is_owner or can_change or can_manage %}
{% if instance.approved == False and not instance.canceled %}
<a hx-get="{% url 'shift-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-100" title="{% trans 'Edit' %}"><ion-icon
name="create-outline"></ion-icon></a>
{% else %}
<button class="oh-btn oh-btn--light-bkg w-100" disabled><ion-icon name="create-outline"></ion-icon></button>
{% endif %}
{% endif %}
{% if is_owner or can_add or can_manage %}
<a class="oh-btn oh-btn--light-bkg w-100" data-toggle="oh-modal-toggle" data-target="#genericModal"
hx-get="{% url 'shift-request-duplicate' instance.id %}?{{pg}}" title="{% trans 'Duplicate' %}"
hx-target="#genericModalBody" style="cursor: pointer;">
<ion-icon name="copy-outline"></ion-icon>
</a>
{% endif %}
{% load i18n %}
{% if request.user.employee_get == instance.employee_id or perms.base.change_shiftrequest or perms.base.add_shiftrequest or perms.base.delete_shiftrequest or request.user|is_reportingmanager %}
<div class="oh-btn-group" onclick="event.stopPropagation();">
{% if request.user.employee_get == instance.employee_id or perms.base.change_shiftrequest or request.user|is_reportingmanager %}
{% if instance.approved == False and not instance.canceled %}
<a hx-get="{% url 'shift-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-100" title="{% trans 'Edit' %}"><ion-icon
name="create-outline"></ion-icon></a>
{% else %}
<button class="oh-btn oh-btn--light-bkg w-100" disabled><ion-icon name="create-outline"></ion-icon></button>
{% endif %}
{% if is_owner or can_delete or can_manage %}
{% if instance.approved == False and instance.canceled == False %}
<a class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100"
hx-confirm="{% trans 'Are you sure you want to delete this shift request?' %}"
hx-post="{% url 'shift-request-delete' instance.id %}" hx-target="#shift-container"
title="{% trans 'Remove' %}">
<ion-icon name="trash-outline"></ion-icon>
</a>
{% else %}
<button class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100" disabled><ion-icon
name="trash-outline"></ion-icon></button>
{% endif %}
{% endif %}
</div>
{% endif %}
{% if request.user.employee_get == instance.employee_id or perms.base.add_shiftrequest or request.user|is_reportingmanager %}
<a class="oh-btn oh-btn--light-bkg w-100" data-toggle="oh-modal-toggle" data-target="#genericModal"
hx-get="{% url 'shift-request-duplicate' instance.id %}?{{pg}}" title="{% trans 'Duplicate' %}"
hx-target="#genericModalBody" style="cursor: pointer;">
<ion-icon name="copy-outline"></ion-icon>
</a>
{% endif %}
{% if request.user.employee_get == instance.employee_id or perms.base.delete_shiftrequest or request.user|is_reportingmanager %}
{% if instance.approved == False and instance.canceled == False %}
<a class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100" hx-confirm="{% trans 'Are you sure you want to delete this shift request?' %}"
hx-post="{% url 'shift-request-delete' instance.id %}" hx-target="#shift-container" title="{% trans 'Remove' %}">
<ion-icon name="trash-outline"></ion-icon>
</a>
{% else %}
<button class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100" disabled><ion-icon name="trash-outline"></ion-icon></button>
{% endif %}
{% endif %}
</div>
{% endif %}
{% endwith %}

View File

@@ -1,8 +1,9 @@
{% load i18n basefilters static %}
{% is_manager_of request.user instance reallocate_to as can_manage %}
{% with is_owner=request.user.employee_get|equals:instance.reallocate_to can_change=perms.base.change_shiftrequest %}
<div class="oh-sticky-table__right" onclick="event.stopPropagation();">
<div class="oh-btn-group">
{% if request.user.employee_get == instance.reallocate_to and not request.user|is_reportingmanager %}
{% if is_owner and not can_manage %}
{% if instance.approved or instance.reallocate_canceled or instance.reallocate_approved %}
<button class="oh-btn oh-btn--success w-100" disabled>
<ion-icon name="checkmark-outline"></ion-icon>
@@ -19,7 +20,7 @@
{% endif %}
{% endif %}
{% if perms.base.change_shiftrequest or request.user|is_reportingmanager %}
{% if can_change or can_manage %}
{% if instance.reallocate_approved or instance.approved or instance.reallocate_canceled %}
<button class="oh-btn oh-btn--success w-100" disabled>
<ion-icon class="me-1" name="checkmark-outline"></ion-icon>
@@ -36,7 +37,7 @@
{% endif %}
{% endif %}
{% if request.user.employee_get == instance.reallocate_to and not request.user|is_reportingmanager %}
{% if is_owner and not can_manage %}
{% if instance.reallocate_canceled or instance.approved or instance.reallocate_approved %}
<button class="oh-btn oh-btn--danger w-100" disabled>
<ion-icon name="close-circle-outline"></ion-icon>
@@ -53,7 +54,7 @@
{% endif %}
{% endif %}
{% if request.user.employee_get == instance.employee_id and not request.user|is_reportingmanager %}
{% if request.user.employee_get == instance.employee_id and not can_manage %}
{% if instance.approved or instance.reallocate_canceled or instance.reallocate_approved %}
<button class="oh-btn oh-btn--light-bkg w-50" disabled>
<ion-icon name="create-outline"></ion-icon>
@@ -94,7 +95,7 @@
{% endif %}
{% endif %}
{% if request.user|is_reportingmanager %}
{% if can_manage %}
{% if instance.reallocate_canceled or instance.approved or instance.reallocate_approved %}
<button disabled class="oh-btn oh-btn--danger w-100">
<ion-icon class="me-1" name="close-circle-outline"></ion-icon>
@@ -112,3 +113,4 @@
{% endif %}
</div>
</div>
{% endwith %}

View File

@@ -1,10 +1,13 @@
{% load basefilters %}
{% if request.user.employee_get == instance.employee_id or perms.base.view_shiftrequestcomment or request.user|is_reportingmanager %}
<div onclick="event.stopPropagation();">
<button type="button" hx-get="{% url 'view-shift-comment' instance.id %}" hx-target="#commentContainer"
data-target="#activitySidebar" title="View Comment" class="oh-btn oh-btn--light oh-activity-sidebar__open w-100"
style="flex: 1 0 auto; width: 20px; height: 40.68px; padding: 0" onclick="event.stopPropagation()">
<ion-icon name="newspaper-outline" role="img" class="md hydrated" aria-label="newspaper outline"></ion-icon>
</button>
</div>
{% endif %}
{% is_manager_of request.user instance as can_manage %}
{% with is_owner=request.user.employee_get|equals:instance.employee_id can_view=perms.base.view_shiftrequestcomment %}
{% if is_owner or can_view or can_manage %}
<div onclick="event.stopPropagation();">
<button type="button" hx-get="{% url 'view-shift-comment' instance.id %}" hx-target="#commentContainer"
data-target="#activitySidebar" title="View Comment" class="oh-btn oh-btn--light oh-activity-sidebar__open w-100"
style="flex: 1 0 auto; width: 20px; height: 40.68px; padding: 0" onclick="event.stopPropagation()">
<ion-icon name="newspaper-outline" role="img" class="md hydrated" aria-label="newspaper outline"></ion-icon>
</button>
</div>
{% endif %}
{% endwith %}

View File

@@ -1,28 +1,35 @@
{% 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 perms.base.change_shiftrequest or request.user|is_reportingmanager %}
<div class="" onclick="event.stopPropagation();">
<div class="oh-btn-group" >
{% 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 %}
{% 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>
{% elif perms.base.change_shiftrequest or request.user|is_reportingmanager %}
<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 %}
</div>
</div>
{% endif %}
{% 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 %}

View File

@@ -4,8 +4,8 @@
display:none;
}
</style>
{% if perms.base.change_shiftrequest or request.user|is_reportingmanager %}
{% is_manager_of request.user instance as can_manage %}
{% if perms.base.change_shiftrequest or can_manage %}
<div class="oh-btn-group w-100">
{% if instance.approved and instance.canceled %}
<a

View File

@@ -1,26 +1,31 @@
{% load basefilters %}
{% load i18n %}
{% if perms.base.change_shiftrequest or request.user|is_reportingmanager %}
<div class="" onclick="event.stopPropagation();">
<div class="oh-btn-group" >
{% if instance.approved == False and not instance.canceled %}
<a hx-get="{% url 'shift-allocation-request-update' instance.id %}" 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></td>
{% endif %}
{% 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>
{% elif perms.base.change_shiftrequest or request.user|is_reportingmanager %}
<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></td>
{% endif %}
</div>
</div>
{% endif %}
{% is_manager_of request.user instance as can_manage %}
{% if perms.base.change_shiftrequest or can_manage %}
<div class="" onclick="event.stopPropagation();">
<div class="oh-btn-group">
{% if instance.approved == False and not instance.canceled %}
<a hx-get="{% url 'shift-allocation-request-update' instance.id %}" 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></td>
{% endif %}
{% 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>
{% elif perms.base.change_shiftrequest or can_manage %}
<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></td>
{% endif %}
</div>
</div>
{% endif %}

View File

@@ -1,21 +1,23 @@
{% load basefilters %}
{% load i18n %}
{% is_manager_of request.user instance as can_manage %}
{% with can_add=perms.base.add_worktyperequest can_change=perms.base.change_worktyperequest can_delete=perms.base.delete_worktyperequest %}
<div class="" onclick="event.stopPropagation();">
{% if request.user.employee_get == instance.employee_id or perms.base.add_worktyperequest or perms.base.change_worktyperequest or perms.base.delete_worktyperequest or request.user|is_reportingmanager %}
{% if request.user.employee_get == instance.employee_id or can_add or can_change or can_delete or can_manage %}
<div class="oh-btn-group">
{% if request.user.employee_get == instance.employee_id or perms.base.change_worktyperequest or request.user|is_reportingmanager %}
{% if request.user.employee_get == instance.employee_id or can_change or can_manage %}
{% if instance.approved == False and not instance.canceled %}
<a hx-get="{% url 'work-type-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-100" title="{% trans 'Edit' %}"><ion-icon
name="create-outline"></ion-icon></a>
class="oh-btn oh-btn--light-bkg w-100" title="{% trans 'Edit' %}">
<ion-icon name="create-outline"></ion-icon>
</a>
{% else %}
<button class="oh-btn oh-btn--light-bkg w-100" disabled><ion-icon name="create-outline"></ion-icon></button>
{% endif %}
{% endif %}
{% if request.user.employee_get == instance.employee_id or perms.base.add_worktyperequest or request.user|is_reportingmanager %}
{% if request.user.employee_get == instance.employee_id or can_add or can_manage %}
<a onclick="event.stopPropagation();" class="oh-btn oh-btn--light-bkg w-100" data-toggle="oh-modal-toggle"
data-target="#genericModal" hx-get="{% url 'work-type-request-duplicate' instance.id %}?{{pg}}"
title="{% trans 'Duplicate' %}" hx-target="#genericModalBody" style="cursor: pointer;">
@@ -23,7 +25,7 @@
</a>
{% endif %}
{% if request.user.employee_get == instance.employee_id or perms.base.delete_worktyperequest or request.user|is_reportingmanager %}
{% if request.user.employee_get == instance.employee_id or can_delete or can_manage %}
{% if instance.approved == False and instance.canceled == False %}
<a hx-confirm="{% trans 'Are you sure you want to delete this work type request?' %}"
hx-post="{% url 'work-type-request-delete' instance.id %}" hx-target="#work-shift"
@@ -38,3 +40,4 @@
</div>
{% endif %}
</div>
{% endwith %}

View File

@@ -4,48 +4,32 @@
display: none;
}
</style>
{% if perms.base.change_worktyperequest or request.user|is_reportingmanager %}
{% is_manager_of request.user instance as can_manage %}
{% if perms.base.change_worktyperequest or can_manage %}
<div class="oh-btn-group w-100" onclick="event.stopPropagation();">
{% if instance.approved or instance.canceled %}
<a
type="submit"
href="#"
title="{% trans 'Approve' %}"
class="oh-btn oh-btn--success oh-btn--disabled w-50"
>
<a type="submit" href="#" title="{% trans 'Approve' %}" class="oh-btn oh-btn--success oh-btn--disabled w-50">
<ion-icon class="me-1" name="checkmark-outline"></ion-icon>
<span class="txt">{% trans 'Approve' %}</span>
</a>
{% else %}
<a
href="{% url 'work-type-request-approve' instance.id %}"
title="{% trans 'Approve' %}"
<a href="{% url 'work-type-request-approve' instance.id %}" title="{% trans 'Approve' %}"
onclick="return confirm(`{% trans 'Do you want to approve this request?' %}`)"
class="oh-btn oh-btn--success w-50"
>
class="oh-btn oh-btn--success w-50">
<ion-icon class="me-1" name="checkmark-outline"></ion-icon>
<span class="txt">{% trans 'Approve' %}</span>
</a>
{% endif %}
{% if instance.canceled %}
<a
type="submit"
href="#"
title="{% trans 'Reject' %}"
class="oh-btn oh-btn--danger oh-btn--disabled w-50"
>
<a type="submit" href="#" title="{% trans 'Reject' %}" class="oh-btn oh-btn--danger oh-btn--disabled w-50">
<ion-icon class="me-1" name="close-circle-outline"></ion-icon>
<span class="txt">{% trans 'Reject' %}</span>
</a>
{% else %}
<a
href="{% url 'work-type-request-cancel' instance.id %}"
title="{% trans 'Reject' %}"
<a href="{% url 'work-type-request-cancel' instance.id %}" title="{% trans 'Reject' %}"
onclick="return confirm(`{% trans 'Do you want to reject this request?' %}`)"
class="oh-btn oh-btn--danger w-50"
>
class="oh-btn oh-btn--danger w-50">
<ion-icon class="me-1" name="close-circle-outline"></ion-icon>
<span class="txt">{% trans 'Reject' %}</span>
</a>

View File

@@ -1,11 +1,14 @@
{% load basefilters %}
{% if request.user.employee_get == instance.employee_id or perms.base.view_worktyperequestcomment or request.user|is_reportingmanager %}
<div class="" onclick="event.stopPropagation();">
<button type="button" hx-get="{% url 'view-work-type-comment' instance.id %}" hx-target="#commentContainer"
data-toggle='oh-modal-toggle' data-target='#worktypeactivitySidebar' title="View Comment"
class="oh-btn oh-btn--light oh-activity-sidebar__open w-100"
style="flex: 1 0 auto; width:20px;height: 40.68px; padding: 0;">
<ion-icon name="newspaper-outline" role="img" class="md hydrated" aria-label="newspaper outline"></ion-icon>
</button>
</div>
{% is_manager_of request.user instance as can_manage %}
{% with is_owner=request.user.employee_get|equals:instance.employee_id or can_view=perms.base.view_worktyperequestcomment %}
{% if is_owner or can_view or can_manage %}
<div class="" onclick="event.stopPropagation();">
<button type="button" hx-get="{% url 'view-work-type-comment' instance.id %}" hx-target="#commentContainer"
data-toggle='oh-modal-toggle' data-target='#worktypeactivitySidebar' title="View Comment"
class="oh-btn oh-btn--light oh-activity-sidebar__open w-100"
style="flex: 1 0 auto; width:20px;height: 40.68px; padding: 0;">
<ion-icon name="newspaper-outline" role="img" class="md hydrated" aria-label="newspaper outline"></ion-icon>
</button>
</div>
{% endif %}
{% endwith %}