diff --git a/leave/templates/leave/leave_allocation_request/allocation_request_comment_form.html b/leave/templates/leave/leave_allocation_request/allocation_request_comment_form.html index 6aa3b0918..770522ff1 100644 --- a/leave/templates/leave/leave_allocation_request/allocation_request_comment_form.html +++ b/leave/templates/leave/leave_allocation_request/allocation_request_comment_form.html @@ -1,27 +1,53 @@ -{% load i18n %} +{% load i18n %} +{% if messages %} +
+ {% for message in messages %} +
+
+ {{ message }} +
+
+ {% endfor %} + +
+{% endif %} {% if form.errors %} -
-
- {% for error in form.non_field_errors %} -
- {{ error }} -
- {% endfor %} -
-
+
+
+ {% for error in form.non_field_errors %} +
{{ error }}
+ {% endfor %} +
+
{% endif %} -
+

+ {% trans "Add Comment" %} +

+ + +
+ - {% csrf_token %} - {{form.as_p}} + hx-encoding="multipart/form-data" + > + {% csrf_token %} {{form.as_p}} - \ No newline at end of file + type="submit" + class="oh-btn oh-btn--secondary mt-2 mr-0 oh-btn--w-100-resp" + > + {% trans "Save" %} + + +
diff --git a/leave/templates/leave/leave_allocation_request/comment_view.html b/leave/templates/leave/leave_allocation_request/comment_view.html index 76ec7bc8f..e0daea98f 100644 --- a/leave/templates/leave/leave_allocation_request/comment_view.html +++ b/leave/templates/leave/leave_allocation_request/comment_view.html @@ -1,6 +1,18 @@ {% load basefilters %} {% load i18n %} +{% if messages %} +
+ {% for message in messages %} +
+
+ {{ message }} +
+
+ {% endfor %} +
+{% endif %} + {% if no_comments %}
@@ -19,7 +31,7 @@
{% trans "Comment" %} - +
diff --git a/leave/templates/leave/leave_allocation_request/leave_allocation_request_group_by.html b/leave/templates/leave/leave_allocation_request/leave_allocation_request_group_by.html index 3577f99e2..b02e612dc 100644 --- a/leave/templates/leave/leave_allocation_request/leave_allocation_request_group_by.html +++ b/leave/templates/leave/leave_allocation_request/leave_allocation_request_group_by.html @@ -72,13 +72,13 @@
- - @@ -251,13 +251,13 @@
- - diff --git a/leave/templates/leave/leave_allocation_request/leave_allocation_request_list.html b/leave/templates/leave/leave_allocation_request/leave_allocation_request_list.html index 1c3c049f1..8672390e2 100644 --- a/leave/templates/leave/leave_allocation_request/leave_allocation_request_list.html +++ b/leave/templates/leave/leave_allocation_request/leave_allocation_request_list.html @@ -209,13 +209,13 @@
- - @@ -353,23 +353,13 @@ diff --git a/leave/views.py b/leave/views.py index 31915b0f1..456f330c6 100644 --- a/leave/views.py +++ b/leave/views.py @@ -3207,6 +3207,7 @@ def cut_available_leave(request, instance_id): """ This method is used to create the penalties """ + previous_data = request.GET.urlencode() instance = LeaveRequest.objects.get(id=instance_id) form = PenaltyAccountForm() available = AvailableLeave.objects.filter(employee_id=instance.employee_id) @@ -3230,7 +3231,7 @@ def cut_available_leave(request, instance_id): return render( request, "leave/leave_request/penalty/form.html", - {"available": available, "form": form, "instance": instance}, + {"available": available, "form": form, "instance": instance,"pd":previous_data}, ) @@ -3360,6 +3361,7 @@ def create_allocationrequest_comment(request, leave_id): """ This method renders form and template to create Allocation request comments """ + previous_data = request.GET.urlencode() leave = LeaveAllocationRequest.objects.filter(id=leave_id).first() emp = request.user.employee_get form = LeaveallocationrequestcommentForm( @@ -3427,7 +3429,7 @@ def create_allocationrequest_comment(request, leave_id): return render( request, "leave/leave_allocation_request/allocation_request_comment_form.html", - {"form": form, "request_id": leave_id}, + {"form": form, "request_id": leave_id,"pd":previous_data}, ) @@ -3455,7 +3457,8 @@ def delete_allocationrequest_comment(request, comment_id): """ This method is used to delete Allocation request comments """ - LeaveallocationrequestComment.objects.get(id=comment_id).delete() - + command = LeaveallocationrequestComment.objects.get(id=comment_id) + request_id = command.request_id.id + command.delete() messages.success(request, _("Comment deleted successfully!")) - return HttpResponseRedirect(request.META.get("HTTP_REFERER", "/")) + return redirect("allocation-request-view-comment",leave_id=request_id)