[FIX] LEAVE: Delete,approve for compensatory leave updated with hx request

This commit is contained in:
Horilla
2024-06-26 14:25:47 +05:30
parent fc0689ad04
commit 3210e09797
3 changed files with 9 additions and 7 deletions

View File

@@ -258,7 +258,7 @@
{% if comp_leave_request.status != 'approved' %}
<a class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-50" id="delete-link"
hx-confirm="{% trans 'Are you sure you want to delete ?' %}"
hx-post="{% url 'delete-compensatory-leave' comp_leave_request.id %}?{{pd}}"
hx-post="{% url 'delete-compensatory-leave' comp_leave_request.id %}?{{pd}}&list=True"
hx-target="#comp-leave-tabs"
title="{% trans 'Delete' %}">
<ion-icon name="trash-outline"></ion-icon>

View File

@@ -121,8 +121,9 @@
{% endif %}
{% if comp_leave_req.status != 'approved' %}
<a class="oh-btn oh-btn--danger w-100" id="delete-link"
href="{% url 'delete-compensatory-leave' comp_leave_req.id %}"
onclick="return confirm('{% trans "Are you sure you want to delete ?" %}');"
hx-confirm="{% trans 'Are you sure you want to delete ?' %}"
hx-post="{% url 'delete-compensatory-leave' comp_leave_req.id %}?list=False"
hx-target="#comp-leave-tabs"
title="{% trans 'Delete' %}">
<ion-icon
name="trash-outline"
@@ -141,7 +142,9 @@
{% if perms.leave.change_compensatoryleaverequest or request.user|is_reportingmanager %}
{% if comp_leave_req.status == 'requested' %}
<a
href="{% url 'approve-compensatory-leave' comp_leave_req.id %}?individual=True"
hx-confirm="{% trans 'Are you sure you want to approve ?' %}"
hx-post="{% url 'approve-compensatory-leave' comp_leave_req.id %}?individual=True"
hx-target="#comp-leave-tabs"
class="oh-btn oh-btn--success w-100"
title="{% trans 'Approve' %}" >
<ion-icon class="me-1 " name="checkmark-outline"></ion-icon>

View File

@@ -4688,8 +4688,7 @@ def delete_compensatory_leave(request, comp_id):
except:
messages.error(request, _("Sorry, something went wrong!"))
com_leave_requests = CompensatoryLeaveRequest.objects.all()
if com_leave_requests.exists():
if request.GET.get("list") == "True":
return redirect(filter_compensatory_leave)
else:
return HttpResponse("<script>location.reload();</script>")
@@ -4730,7 +4729,7 @@ def approve_compensatory_leave(request, comp_id):
except:
messages.error(request, _("Sorry, something went wrong!"))
if request.GET.get("individual"):
return redirect(view_compensatory_leave)
return HttpResponse("<script>location.reload();</script>")
return redirect(filter_compensatory_leave)