[UPDT] BASE: Updated rotating work type assign delete and archive method by adding hx-attribute
This commit is contained in:
@@ -1,5 +1,16 @@
|
||||
{% load attendancefilters %} {% load basefilters %} {% load static %}
|
||||
{% load i18n %} {% include 'filter_tags.html' %}
|
||||
{% if messages %}
|
||||
<div class="oh-wrapper">
|
||||
{% for message in messages %}
|
||||
<div class="oh-alert-container">
|
||||
<div class="oh-alert oh-alert--animated {{message.tags}}">
|
||||
{{ message }}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if perms.base.view_worktyperequest %}
|
||||
<div
|
||||
class="oh-checkpoint-badge text-success mb-2"
|
||||
@@ -71,7 +82,7 @@ style="cursor: pointer; display: none"
|
||||
</div>
|
||||
<div class="oh-sticky-table__tbody">
|
||||
{% for rwork_type in rwork_type_list.list %}
|
||||
<div class="oh-sticky-table__tr" hx-get="{% url "rwork-individual-view" rwork_type.id %}?instances_ids={{assign_ids}}" data-toggle="oh-modal-toggle" data-target="#objectDetailsModal" hx-target="#objectDetailsModalTarget" draggable="true">
|
||||
<div class="oh-sticky-table__tr" hx-get="{% url "rwork-individual-view" rwork_type.id %}?{{pd}}&instances_ids={{assign_ids}}" data-toggle="oh-modal-toggle" data-target="#objectDetailsModal" hx-target="#objectDetailsModalTarget" draggable="true">
|
||||
<div class="oh-sticky-table__sd" onclick="event.stopPropagation();">
|
||||
<div class="centered-div">
|
||||
<input
|
||||
@@ -148,36 +159,28 @@ style="cursor: pointer; display: none"
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if perms.base.change_rotatingworktypeassign or request.user|is_reportingmanager %}
|
||||
{% if rwork_type.is_active %}
|
||||
<form onsubmit="return confirm('{% trans "Do you Want to archive this rotating work type assign?" %}')" action="{% url 'rotating-work-type-assign-archive' rwork_type.id %}" >
|
||||
<button class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100" title="{% trans 'Archive' %}">
|
||||
<input type="hidden" name="is_active" value="{% trans 'False' %}" id="">
|
||||
<ion-icon name="archive"></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<form onsubmit="return confirm('{% trans "Do you Want to un-archive this rotating work type assign?" %}')" action="{% url 'rotating-work-type-assign-archive' rwork_type.id %}">
|
||||
<button class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100" title="{% trans 'Un-Archive' %}">
|
||||
<ion-icon name="archive"></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% if rwork_type.is_active %}
|
||||
<form hx-confirm="{% trans 'Do you Want to archive this rotating work type assign?' %}" hx-get="{% url 'rotating-work-type-assign-archive' rwork_type.id %}?{{pd}}" hx-target="#view-container" >
|
||||
<button class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100" title="{% trans 'Archive' %}">
|
||||
<input type="hidden" name="is_active" value="False" id="">
|
||||
<ion-icon name="archive"></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<form hx-confirm="{% trans 'Do you Want to un-archive this rotating work type assign?' %}" hx-get="{% url 'rotating-work-type-assign-archive' rwork_type.id %}?{{pd}}" hx-target="#view-container">
|
||||
<button class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100" title="{% trans 'Un-Archive' %}">
|
||||
<ion-icon name="archive"></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if perms.base.delete_rotatingworktypeassign or request.user|is_reportingmanager %}
|
||||
<form
|
||||
action="{% url 'rotating-work-type-assign-delete' rwork_type.id %}"
|
||||
onsubmit="return confirm('{% trans "Are you sure you want to delete this rotating work type assign?" %}');"
|
||||
method="post"
|
||||
>
|
||||
{% 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>
|
||||
<form hx-confirm="{% trans 'Are you sure you want to delete this rotating work type assign?' %}" hx-post="{% url 'rotating-work-type-assign-delete' rwork_type.id %}?{{pd}}" hx-target="#view-container">
|
||||
{% 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>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,24 +1,38 @@
|
||||
{% load i18n %}
|
||||
{% load i18n %} {% load static %}
|
||||
{% if messages %}
|
||||
<div class="oh-wrapper">
|
||||
{% for message in messages %}
|
||||
<div class="oh-alert-container">
|
||||
<div class="oh-alert oh-alert--animated {{message.tags}}">
|
||||
{{ message }}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="oh-modal__dialog-header">
|
||||
<span
|
||||
class="oh-modal__dialog-title"
|
||||
id="objectDetailsModalLabel"
|
||||
>
|
||||
{% trans "Details" %}
|
||||
</span>
|
||||
<button class="oh-modal__close" aria-label="Close">
|
||||
{% if instance %}
|
||||
<span
|
||||
class="oh-modal__dialog-title"
|
||||
id="objectDetailsModalLabel"
|
||||
>
|
||||
{% trans "Details" %}
|
||||
</span>
|
||||
{% endif %}
|
||||
<button class="oh-modal__close" aria-label="Close" hx-get="{{close_hx_url}}?{{pd}}" hx-target="{{close_hx_target}}">
|
||||
<ion-icon name="close-outline"></ion-icon>
|
||||
</button>
|
||||
</div>
|
||||
{% if instance %}
|
||||
<div class="oh-modal__dialog-body oh-modal__dialog-relative">
|
||||
{% if request.GET.instances_ids %}
|
||||
<div class="oh-modal__dialog oh-modal__dialog--navigation m-0 p-0">
|
||||
<button hx-get="{% url 'rwork-individual-view' previous %}?instances_ids={{assign_ids}}" hx-target = "#objectDetailsModalTarget" class="oh-modal__diaglog-nav oh-modal__nav-prev">
|
||||
<button hx-get="{% url 'rwork-individual-view' previous %}?{{pd}}&instances_ids={{assign_ids}}" hx-target = "#objectDetailsModalTarget" class="oh-modal__diaglog-nav oh-modal__nav-prev">
|
||||
<ion-icon name="chevron-back-outline" class="md hydrated" role="img"
|
||||
aria-label="chevron back outline"></ion-icon>
|
||||
</button>
|
||||
|
||||
<button hx-get="{% url 'rwork-individual-view' next %}?instances_ids={{assign_ids}}" hx-target = "#objectDetailsModalTarget" class="oh-modal__diaglog-nav oh-modal__nav-next">
|
||||
<button hx-get="{% url 'rwork-individual-view' next %}?{{pd}}&instances_ids={{assign_ids}}" hx-target = "#objectDetailsModalTarget" class="oh-modal__diaglog-nav oh-modal__nav-next">
|
||||
<ion-icon name="chevron-forward-outline" class="md hydrated" role="img"
|
||||
aria-label="chevron forward outline"></ion-icon>
|
||||
</button>
|
||||
@@ -120,10 +134,9 @@
|
||||
|
||||
<a class="oh-btn oh-btn--info" hx-get="{% url "rotating-work-type-assign-update" instance.id %}" hx-target="#rotatingWorkTypeAssignUpdateModalLabel" data-toggle="oh-modal-toggle" data-target="#rotating-work-type-update-modal" style="width: 50%;">
|
||||
<ion-icon name="create-outline">
|
||||
</ion-icon>Edit
|
||||
</ion-icon>{% trans "Edit" %}
|
||||
</a>
|
||||
<form class="oh-btn oh-btn--primary" style="width: 50%;" onsubmit="return confirm('Do you Want to archive this rotating work type assign?')" action="{% url "rotating-work-type-assign-archive" instance.id %}">
|
||||
<input type="hidden" name="is_active" value="False" id="">
|
||||
<form class="oh-btn oh-btn--primary" style="width: 50%;" hx-confirm="{% trans 'Do you want to archive this rotating work type assign?' %}" hx-get="{% url 'rotating-work-type-assign-archive' instance.id %}?{{pd}}&instances_ids={{assign_ids}}" hx-target="#objectDetailsModalTarget">
|
||||
<button style="background: none;
|
||||
color: inherit;
|
||||
border: none;
|
||||
@@ -134,13 +147,13 @@
|
||||
<ion-icon name="archive-outline">
|
||||
</ion-icon>
|
||||
{% if instance.is_active %}
|
||||
{% trans "Archive" %}
|
||||
{% trans "Archive" %}
|
||||
{% else %}
|
||||
{% trans "Un-archive" %}
|
||||
{% trans "Un-archive" %}
|
||||
{% endif %}
|
||||
</button>
|
||||
</form>
|
||||
<form class="oh-btn oh-btn--secondary" method="post" style="width: 50%;" onsubmit="return confirm('Do you Want to archive this rotating work type assign?')" action="{% url "rotating-work-type-assign-delete" instance.id %}">
|
||||
<form class="oh-btn 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 %}?{{pd}}&instances_ids={{assign_ids}}" hx-target="#objectDetailsModalTarget">
|
||||
{% csrf_token %}
|
||||
<button style="background: none;
|
||||
color: inherit;
|
||||
@@ -157,3 +170,16 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="oh-modal__dialog-body oh-modal__dialog-relative">
|
||||
<img
|
||||
style="margin-left: 33%; width: 150px; height: 150px"
|
||||
src="{% static 'images/ui/employee_shift.png' %}"
|
||||
class="oh-404__image mb-2"
|
||||
alt="Page not found. 404."
|
||||
/>
|
||||
<h5 class="oh-404__subtitle">
|
||||
{% trans "There are no rotating work type assigned to this employee." %}
|
||||
</h5>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -2,6 +2,17 @@
|
||||
{% load i18n %}
|
||||
{% load basefilters %}
|
||||
{% include 'filter_tags.html' %}
|
||||
{% if messages %}
|
||||
<div class="oh-wrapper">
|
||||
{% for message in messages %}
|
||||
<div class="oh-alert-container">
|
||||
<div class="oh-alert oh-alert--animated {{message.tags}}">
|
||||
{{ message }}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div
|
||||
class="oh-checkpoint-badge text-success mb-2"
|
||||
id="selectAllRWorktypes"
|
||||
@@ -71,7 +82,7 @@
|
||||
</div>
|
||||
<div class="oh-sticky-table__tbody">
|
||||
{% for rwork_type in rwork_type_assign %}
|
||||
<div class="oh-sticky-table__tr" hx-get="{% url "rwork-individual-view" rwork_type.id %}?instances_ids={{assign_ids}}" data-toggle="oh-modal-toggle" data-target="#objectDetailsModal" hx-target="#objectDetailsModalTarget" draggable="true">
|
||||
<div class="oh-sticky-table__tr" hx-get="{% url "rwork-individual-view" rwork_type.id %}?{{pd}}&instances_ids={{assign_ids}}" data-toggle="oh-modal-toggle" data-target="#objectDetailsModal" hx-target="#objectDetailsModalTarget" draggable="true">
|
||||
<div class="oh-sticky-table__sd" onclick="event.stopPropagation();">
|
||||
<div class="centered-div">
|
||||
<input
|
||||
@@ -148,41 +159,40 @@
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if perms.base.change_rotatingworktypeassign or request.user|is_reportingmanager %}
|
||||
{% if rwork_type.is_active %}
|
||||
<form onsubmit="return confirm('{% trans "Do you Want to archive this rotating work type assign?" %}')"
|
||||
action="{% url 'rotating-work-type-assign-archive' rwork_type.id %}" style="width:100%"
|
||||
>
|
||||
<button class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100" title="{% trans 'Archive' %}">
|
||||
<input type="hidden" name="is_active" value="{% trans 'False' %}" id="">
|
||||
<ion-icon name="archive"></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<form onsubmit="return confirm('{% trans "Do you Want to un-archive this rotating work type assign?" %}')"
|
||||
action="{% url 'rotating-work-type-assign-archive' rwork_type.id %}" style="width:100%"
|
||||
>
|
||||
<button class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100" title="{% trans 'Un-Archive' %}">
|
||||
<ion-icon name="archive"></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% if rwork_type.is_active %}
|
||||
<form hx-confirm="{% trans 'Do you want to archive this rotating work type assign?' %}"
|
||||
hx-get="{% url 'rotating-work-type-assign-archive' rwork_type.id %}?{{pd}}" hx-target="#view-container" style="width:100%"
|
||||
>
|
||||
<button class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100" title="{% trans 'Archive' %}">
|
||||
<ion-icon name="archive"></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<form hx-confirm="{% trans 'Do you want to un-archive this rotating work type assign?' %}"
|
||||
hx-get="{% url 'rotating-work-type-assign-archive' rwork_type.id %}?{{pd}}" hx-target="#view-container" style="width:100%"
|
||||
>
|
||||
<button class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100" title="{% trans 'Un-Archive' %}">
|
||||
<ion-icon name="archive"></ion-icon>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if perms.base.delete_rotatingworktypeassign or request.user|is_reportingmanager %}
|
||||
<form
|
||||
action="{% url 'rotating-work-type-assign-delete' rwork_type.id %}"
|
||||
onsubmit="return confirm('{% trans "Are you sure you want to delete this rotating work type assign?" %}');"
|
||||
method="post"
|
||||
style="width:100%"
|
||||
>
|
||||
{% 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>
|
||||
<form
|
||||
hx-confirm="{% trans 'Are you sure you want to delete this rotating work type assign?' %}"
|
||||
hx-post="{% url 'rotating-work-type-assign-delete' rwork_type.id %}?{{pd}}"
|
||||
hx-target="#view-container"
|
||||
style="width:100%"
|
||||
>
|
||||
{% 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>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user