[UPDT] LEAVE: Leave allocation filter
This commit is contained in:
@@ -335,7 +335,7 @@ class LeaveAllocationRequestFilter(FilterSet):
|
||||
leave_type = filters.CharFilter(
|
||||
field_name="leave_type_id__name", lookup_expr="icontains"
|
||||
)
|
||||
employee_id = filters.CharFilter(
|
||||
employee = filters.CharFilter(
|
||||
field_name="employee_id__employee_first_name", lookup_expr="icontains"
|
||||
)
|
||||
number_of_days = filters.NumberFilter(
|
||||
@@ -349,5 +349,7 @@ class LeaveAllocationRequestFilter(FilterSet):
|
||||
model = LeaveAllocationRequest
|
||||
fields = {
|
||||
'created_by':["exact"],
|
||||
"status":["exact"]
|
||||
"status":["exact"],
|
||||
"leave_type_id":["exact"],
|
||||
"employee_id":["exact"]
|
||||
}
|
||||
|
||||
@@ -562,18 +562,19 @@ class UserLeaveRequestCreationForm(ModelForm):
|
||||
}
|
||||
|
||||
class LeaveAllocationRequestForm(ModelForm):
|
||||
class Meta:
|
||||
model = LeaveAllocationRequest
|
||||
fields = [
|
||||
'leave_type_id',
|
||||
'employee_id',
|
||||
'requested_days',
|
||||
'description',
|
||||
]
|
||||
|
||||
def as_p(self, *args, **kwargs):
|
||||
"""
|
||||
Render the form fields as HTML table rows with Bootstrap styling.
|
||||
"""
|
||||
context = {"form": self}
|
||||
table_html = render_to_string("attendance_form.html", context)
|
||||
return table_html
|
||||
return table_html
|
||||
class Meta:
|
||||
model = LeaveAllocationRequest
|
||||
fields = [
|
||||
'leave_type_id',
|
||||
'employee_id',
|
||||
'requested_days',
|
||||
'description'
|
||||
]
|
||||
@@ -1,4 +1,5 @@
|
||||
import calendar
|
||||
from collections.abc import Iterable
|
||||
from datetime import datetime, timedelta
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
@@ -529,3 +530,9 @@ class LeaveAllocationRequest(models.Model):
|
||||
created_at = models.DateTimeField(auto_now="True")
|
||||
reject_reason = models.TextField(blank=True)
|
||||
objects = models.Manager()
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.employee_id}| {self.leave_type_id}| {self.id}"
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
super().save(*args,**kwargs)
|
||||
@@ -15,19 +15,19 @@
|
||||
{% comment %} {% if not request.GET.dashboard %} {% endcomment %}
|
||||
{% if leave_allocation_requests %}
|
||||
<div class="d-flex flex-row-reverse">
|
||||
<span class="m-3 review_ongoing" hx-get="{% url "request-filter" %}?{{pd}}&status=rejected" hx-target="#leaveRequest" style="cursor: pointer">
|
||||
<span class="m-3 review_ongoing" hx-get="{% url 'leave-allocation-request-filter' %}?{{pd}}&status=rejected" hx-target="#userRequest" style="cursor: pointer">
|
||||
<span class="oh-dot oh-dot--small me-1" style="background-color:red"></span>
|
||||
{% trans "Rejected" %}
|
||||
</span>
|
||||
<span class="m-3 review_ongoing" hx-get="{% url "request-filter" %}?{{pd}}&status=cancelled" hx-target="#leaveRequest" style="cursor: pointer">
|
||||
<span class="m-3 review_ongoing" hx-get="{% url 'leave-allocation-request-filter' %}?{{pd}}&status=cancelled" hx-target="#userRequest" style="cursor: pointer">
|
||||
<span class="oh-dot oh-dot--small me-1" style="background-color:grey"></span>
|
||||
{% trans "Cancelled" %}
|
||||
</span>
|
||||
<span class="m-3 confirmed" hx-get="{% url "request-filter" %}?{{pd}}&status=requested" hx-target="#leaveRequest" style="cursor: pointer">
|
||||
<span class="m-3 confirmed" hx-get="{% url 'leave-allocation-request-filter' %}?{{pd}}&status=requested" hx-target="#userRequest" style="cursor: pointer">
|
||||
<span class="oh-dot oh-dot--small me-1" style="background-color:rgb(103, 171, 238)"></span>
|
||||
{% trans "Requested" %}
|
||||
</span>
|
||||
<span class="m-3 paid" hx-get="{% url "request-filter" %}?{{pd}}&status=approved" hx-target="#leaveRequest" style="cursor: pointer">
|
||||
<span class="m-3 paid" hx-get="{% url 'leave-allocation-request-filter' %}?{{pd}}&status=approved" hx-target="#userRequest" style="cursor: pointer">
|
||||
<span class="oh-dot oh-dot--small me-1" style="background-color:yellowgreen"></span>
|
||||
{% trans "Approved" %}
|
||||
</span>
|
||||
@@ -38,46 +38,48 @@
|
||||
<div class="oh-sticky-table__table ">
|
||||
<div class="oh-sticky-table__thead">
|
||||
<div class="oh-sticky-table__tr">
|
||||
<div class="oh-sticky-table__th" hx-get="{% url 'request-filter' %}?{{pd}}&sortby=employee_id" hx-target="#leaveRequest">{% trans "Employee" %}</div>
|
||||
<div class="oh-sticky-table__th" hx-get="{% url 'request-filter' %}?{{pd}}&sortby=leave_type_id" hx-target="#leaveRequest">{% trans "Leave Type" %}</div>
|
||||
<div class="oh-sticky-table__th" hx-get="{% url 'request-filter' %}?{{pd}}&sortby=requested_days" hx-target="#leaveRequest">{% trans "Requested Days" %}</div>
|
||||
<div class="oh-sticky-table__th" hx-get="{% url 'request-filter' %}?{{pd}}&sortby=status" hx-target="#leaveRequest">{% trans "Status" %}</div>
|
||||
<div class="oh-sticky-table__th" hx-get="{% url 'leave-allocation-request-filter' %}?{{pd}}&sortby=employee_id" hx-target="#userRequest">{% trans "Employee" %}</div>
|
||||
<div class="oh-sticky-table__th" hx-get="{% url 'leave-allocation-request-filter' %}?{{pd}}&sortby=leave_type_id" hx-target="#userRequest">{% trans "Leave Type" %}</div>
|
||||
<div class="oh-sticky-table__th" hx-get="{% url 'leave-allocation-request-filter' %}?{{pd}}&sortby=requested_days" hx-target="#userRequest">{% trans "Requested Days" %}</div>
|
||||
<div class="oh-sticky-table__th" hx-get="{% url 'leave-allocation-request-filter' %}?{{pd}}&sortby=created_by" hx-target="#userRequest">{% trans "Created By" %}</div>
|
||||
<div class="oh-sticky-table__th" hx-get="{% url 'leave-allocation-request-filter' %}?{{pd}}&sortby=status" hx-target="#userRequest">{% trans "Status" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Options" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Actions" %}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__tbody">
|
||||
{% for leave_request in leave_allocation_requests %}
|
||||
{% for leave_allocation_request in leave_allocation_requests %}
|
||||
<div class="oh-sticky-table__tr" draggable="true"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#singleViewModal"
|
||||
hx-get="{% url 'leave-allocation-request-single-view' leave_request.id %}"
|
||||
hx-get="{% url 'leave-allocation-request-single-view' leave_allocation_request.id %}"
|
||||
hx-target="#singleViewTarget">
|
||||
<div class="oh-sticky-table__sd {% if leave_request.status == "requested" %} row-status--blue
|
||||
{% elif leave_request.status == "approved" %} row-status--yellow
|
||||
{% elif leave_request.status == "cancelled" %} row-status--gray
|
||||
{% elif leave_request.status == "rejected" %}row-status--red
|
||||
<div class="oh-sticky-table__sd {% if leave_allocation_request.status == "requested" %} row-status--blue
|
||||
{% elif leave_allocation_request.status == "approved" %} row-status--yellow
|
||||
{% elif leave_allocation_request.status == "cancelled" %} row-status--gray
|
||||
{% elif leave_allocation_request.status == "rejected" %}row-status--red
|
||||
{% endif %}" >
|
||||
<div class="oh-profile oh-profile--md">
|
||||
<div class="oh-profile__avatar mr-1">
|
||||
{% if leave_request.employee_id.employee_profile %}
|
||||
<img src="{{leave_request.employee_id.employee_profile.url}}" class="oh-profile__image"
|
||||
{% if leave_allocation_request.employee_id.employee_profile %}
|
||||
<img src="{{leave_allocation_request.employee_id.employee_profile.url}}" class="oh-profile__image"
|
||||
alt="" />
|
||||
{% else %}
|
||||
<img src="https://ui-avatars.com/api/?name={{leave_request.employee_id}}&background=random"
|
||||
<img src="https://ui-avatars.com/api/?name={{leave_allocation_request.employee_id}}&background=random"
|
||||
class="oh-profile__image" alt="" />
|
||||
{% endif %}
|
||||
</div>
|
||||
<span class="oh-profile__name oh-text--dark">{{leave_request.employee_id}}</span>
|
||||
<span class="oh-profile__name oh-text--dark">{{leave_allocation_request.employee_id}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__td {% if leave_request.status == 'cancelled' %} diff-cell{% endif %}">{{leave_request.leave_type_id}}</div>
|
||||
<div class="oh-sticky-table__td {% if leave_request.status == 'cancelled' %} diff-cell{% endif %}">{{leave_request.requested_days}}</div>
|
||||
<div class="oh-sticky-table__td {% if leave_request.status == 'cancelled' %} diff-cell{% endif %}">{{leave_request.get_status_display}}</div>
|
||||
<div class="oh-sticky-table__td {% if leave_allocation_request.status == 'cancelled' %} diff-cell{% endif %}">{{leave_allocation_request.leave_type_id}}</div>
|
||||
<div class="oh-sticky-table__td {% if leave_allocation_request.status == 'cancelled' %} diff-cell{% endif %}">{{leave_allocation_request.requested_days}}</div>
|
||||
<div class="oh-sticky-table__td {% if leave_allocation_request.status == 'cancelled' %} diff-cell{% endif %}">{{leave_allocation_request.created_by}}</div>
|
||||
<div class="oh-sticky-table__td {% if leave_allocation_request.status == 'cancelled' %} diff-cell{% endif %}">{{leave_allocation_request.get_status_display}}</div>
|
||||
<div class="oh-sticky-table__td" onclick="event.stopPropagation()">
|
||||
<div class="oh-btn-group" >
|
||||
{% if leave_request.status == 'requested' or leave_request.status == 'rejected' %}
|
||||
<a type="submit" href="{% url 'request-approve' leave_request.id %}" title="{% trans 'Approve' %}"
|
||||
{% if leave_allocation_request.status == 'requested' or leave_allocation_request.status == 'rejected' %}
|
||||
<a type="submit" href="{% url 'leave-allocation-request-approve' leave_allocation_request.id %}" title="{% trans 'Approve' %}"
|
||||
class="oh-btn oh-btn--success w-100">
|
||||
<ion-icon class="me-1" name="checkmark-outline"></ion-icon>
|
||||
</a>
|
||||
@@ -88,9 +90,9 @@
|
||||
<ion-icon class="me-1" name="checkmark-outline"></ion-icon>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if leave_request.status != 'rejected' %}
|
||||
{% if leave_allocation_request.status != 'rejected' %}
|
||||
<a type="submit" data-toggle="oh-modal-toggle"
|
||||
data-target="#rejectModal" hx-get="{% url 'request-cancel' leave_request.id %}" hx-target="#rejectForm" title="{% trans 'Reject' %}"
|
||||
data-target="#rejectModal" hx-get="{% url 'leave-allocation-request-reject' leave_allocation_request.id %}" hx-target="#rejectForm" title="{% trans 'Reject' %}"
|
||||
class="oh-btn oh-btn--danger w-100">
|
||||
<ion-icon class="me-1" name="close-circle-outline"></ion-icon>
|
||||
|
||||
@@ -107,11 +109,11 @@
|
||||
<div class="oh-sticky-table__td" onclick="event.stopPropagation()">
|
||||
<div class="oh-btn-group">
|
||||
<button class="oh-btn oh-btn--light-bkg w-100" title="{% trans 'Edit' %}" data-toggle="oh-modal-toggle"
|
||||
data-target="#editModal2" hx-get="{% url 'request-update' leave_request.id %}"
|
||||
data-target="#editModal2" hx-get="{% url 'leave-allocation-request-update' leave_allocation_request.id %}"
|
||||
hx-target="#updateForm"><ion-icon name="create-outline"></ion-icon></button>
|
||||
|
||||
<a class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100" id="delete-link"
|
||||
href="{% url 'request-delete' leave_request.id %}" onclick="return confirm('{% trans "Are you sure you want to delete ?" %}');" title="{% trans 'Delete' %}"><ion-icon
|
||||
href="{% url 'leave-allocation-request-delete' leave_allocation_request.id %}" onclick="return confirm('{% trans "Are you sure you want to delete ?" %}');" title="{% trans 'Delete' %}"><ion-icon
|
||||
name="trash-outline"></ion-icon></a>
|
||||
|
||||
</div>
|
||||
@@ -124,36 +126,36 @@
|
||||
{% comment %} start of pagination {% endcomment %}
|
||||
<div class="oh-pagination">
|
||||
<span class="oh-pagination__page">
|
||||
{% trans "Page" %} {{ leave_requests.number }} {% trans "of" %} {{ leave_requests.paginator.num_pages }}.
|
||||
{% trans "Page" %} {{ leave_allocation_requests.number }} {% trans "of" %} {{ leave_allocation_requests.paginator.num_pages }}.
|
||||
</span>
|
||||
<nav class="oh-pagination__nav">
|
||||
<div class="oh-pagination__input-container me-3">
|
||||
<span class="oh-pagination__label me-1">{% trans "Page" %}</span>
|
||||
<input type="number" name="page" class="oh-pagination__input" value="{{leave_requests.number}}"
|
||||
<input type="number" name="page" class="oh-pagination__input" value="{{leave_allocation_requests.number}}"
|
||||
hx-get="{% url 'request-filter' %}?{{pd}}" hx-target="#leaveRequest" min="1" />
|
||||
<span class="oh-pagination__label">{% trans "of" %} {{leave_requests.paginator.num_pages}}</span>
|
||||
<span class="oh-pagination__label">{% trans "of" %} {{leave_allocation_requests.paginator.num_pages}}</span>
|
||||
</div>
|
||||
<ul class="oh-pagination__items">
|
||||
{% if leave_requests.has_previous %}
|
||||
{% if leave_allocation_requests.has_previous %}
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a hx-target='#leaveRequest' hx-get="{% url 'request-filter' %}?{{pd}}&page=1"
|
||||
class="oh-pagination__link">{% trans "First" %}</a>
|
||||
</li>
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a hx-target='#leaveRequest'
|
||||
hx-get="{% url 'request-filter' %}?{{pd}}&page={{ leave_requests.previous_page_number }}"
|
||||
hx-get="{% url 'request-filter' %}?{{pd}}&page={{ leave_allocation_requests.previous_page_number }}"
|
||||
class="oh-pagination__link">{% trans "Previous" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if leave_requests.has_next %}
|
||||
{% if leave_allocation_requests.has_next %}
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a hx-target='#leaveRequest'
|
||||
hx-get="{% url 'request-filter' %}?{{pd}}&page={{ leave_requests.next_page_number }}"
|
||||
hx-get="{% url 'request-filter' %}?{{pd}}&page={{ leave_allocation_requests.next_page_number }}"
|
||||
class="oh-pagination__link">{% trans "Next" %}</a>
|
||||
</li>
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a hx-target='#leaveRequest'
|
||||
hx-get="{% url 'request-filter' %}?{{pd}}&page={{ leave_requests.paginator.num_pages }}"
|
||||
hx-get="{% url 'request-filter' %}?{{pd}}&page={{ leave_allocation_requests.paginator.num_pages }}"
|
||||
class="oh-pagination__link">{% trans "Last" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
@@ -49,12 +49,12 @@
|
||||
<button class="oh-btn ml-2" @click="open = !open">
|
||||
<ion-icon name="filter" class="mr-1"></ion-icon>{% trans "Filter" %}<div id='filterCount'><div>
|
||||
</button>
|
||||
<form method="post" hx-get="{% url 'user-request-filter' %}" hx-target="#userRequest" id='filterForm'>
|
||||
<form method="post" hx-get="{% url 'leave-allocation-request-filter' %}" hx-target="#userRequest" id='filterForm'>
|
||||
<div class="oh-dropdown__menu oh-dropdown__menu--right oh-dropdown__filter p-4" x-show="open"
|
||||
style="display: none;" @click.outside="open = false">
|
||||
<div class="oh-dropdown__filter-body">
|
||||
<div class="oh-accordion" >
|
||||
<div class="oh-accordion-header" onclick="event.stopImmediatePropagation();$(this).parent().toggleClass('oh-accordion--show');">{% trans "Leave Request" %}</div>
|
||||
<div class="oh-accordion-header" onclick="event.stopImmediatePropagation();$(this).parent().toggleClass('oh-accordion--show');">{% trans "Leave Allocation Request" %}</div>
|
||||
<div class="oh-accordion-body" >
|
||||
<div class="row" >
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
@@ -65,17 +65,29 @@
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
<div class="oh-input-group">
|
||||
<label class="oh-label">{% trans "Start Date" %}</label>
|
||||
{{form.start_date}}
|
||||
<label class="oh-label">{% trans "Employee" %}</label>
|
||||
{{form.employee_id}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
<div class="oh-input-group">
|
||||
<label class="oh-label">{% trans "End Date" %}</label>
|
||||
{{form.end_date}}
|
||||
<label class="oh-label">{% trans "Created By" %}</label>
|
||||
{{form.created_by}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
<div class="oh-input-group">
|
||||
<label class="oh-label">{% trans "Requested days Up To" %}</label>
|
||||
{{form.number_of_days}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
<div class="oh-input-group">
|
||||
<label class="oh-label">{% trans "Requested days More Than " %}</label>
|
||||
{{form.number_of_days}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<div class="oh-input-group">
|
||||
<label class="oh-label">{% trans "Status" %}</label>
|
||||
@@ -87,22 +99,22 @@
|
||||
</div>
|
||||
|
||||
<div class="oh-accordion" >
|
||||
<div class="oh-accordion-header" onclick="event.stopImmediatePropagation();$(this).parent().toggleClass('oh-accordion--show');">{% trans "Advanced" %}</div>
|
||||
<div class="oh-accordion-header" onclick="event.stopImmediatePropagation();$(this).parent().toggleClass('oh-accordion--show');">{% trans "Group By" %}</div>
|
||||
<div class="oh-accordion-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
{% comment %} <div class="col-sm-12 col-md-12 col-lg-6">
|
||||
<div class="oh-input-group">
|
||||
<label class="oh-label">{% trans "From Date" %}</label>
|
||||
{{form.from_date}}
|
||||
<label class="oh-label">{% trans "Leave Type" %}</label>
|
||||
{{form.leave_type_id}}
|
||||
</div>
|
||||
</div>
|
||||
</div> {% endcomment %}
|
||||
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
{% comment %} <div class="col-sm-12 col-md-12 col-lg-6">
|
||||
<div class="oh-input-group">
|
||||
<label class="oh-label">{% trans "To Date" %}</label>
|
||||
{{form.to_date}}
|
||||
<label class="oh-label">{% trans "Created By" %}</label>
|
||||
{{form.created_by}}
|
||||
</div>
|
||||
</div>
|
||||
</div> {% endcomment %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -212,7 +224,7 @@
|
||||
|
||||
$(document).on('htmx:load', '#updateForm', function () {
|
||||
{% include 'select2.js' %}
|
||||
$('#startDate #id_start_date_breakdown').select2();
|
||||
$('#id_leave_type_id').select2();
|
||||
$('#endDate #id_end_date_breakdown').select2();
|
||||
});
|
||||
$('#delete-link').on('click', function (event) {
|
||||
|
||||
@@ -154,6 +154,25 @@ urlpatterns = [
|
||||
views.leave_allocation_request_single_view,
|
||||
name= "leave-allocation-request-single-view"
|
||||
),
|
||||
|
||||
path(
|
||||
'leave-allocation-request-update/<int:req_id>',
|
||||
views.leave_allocation_request_update,
|
||||
name= "leave-allocation-request-update"
|
||||
),
|
||||
path(
|
||||
'leave-allocation-request-approve/<int:req_id>',
|
||||
views.leave_allocation_request_approve,
|
||||
name= "leave-allocation-request-approve"
|
||||
),
|
||||
path(
|
||||
'leave-allocation-request-reject/<int:req_id>',
|
||||
views.leave_allocation_request_reject,
|
||||
name= "leave-allocation-request-reject"
|
||||
),
|
||||
path(
|
||||
'leave-allocation-request-delete/<int:req_id>',
|
||||
views.leave_allocation_request_delete,
|
||||
name= "leave-allocation-request-delete"
|
||||
),
|
||||
|
||||
]
|
||||
|
||||
@@ -2394,9 +2394,10 @@ def user_leave_allocation_request_view(request):
|
||||
|
||||
employee = request.user.employee_get
|
||||
leave_allocation_requests = LeaveAllocationRequest.objects.filter(employee_id=employee.id)
|
||||
print (leave_allocation_requests)
|
||||
leave_allocation_request_filter = LeaveAllocationRequestFilter()
|
||||
context = { 'leave_allocation_requests' :leave_allocation_requests,
|
||||
"user_request_view":True,
|
||||
"form":leave_allocation_request_filter.form
|
||||
}
|
||||
return render(request,'leave/leave_allocation_request/leave_allocation_request_view.html',context=context)
|
||||
|
||||
@@ -2416,7 +2417,9 @@ def leave_allocation_request_create(request):
|
||||
if request.method == 'POST':
|
||||
form = LeaveAllocationRequestForm(request.POST)
|
||||
if form.is_valid():
|
||||
form.save
|
||||
leave_allocation_request = form.save(commit=False)
|
||||
leave_allocation_request.created_by = employee
|
||||
leave_allocation_request.save()
|
||||
messages.success(request,_("New Leave allocation request is created"))
|
||||
response = render(
|
||||
request,
|
||||
@@ -2436,9 +2439,39 @@ def leave_allocation_request_create(request):
|
||||
|
||||
@login_required
|
||||
def leave_allocation_request_filter(request):
|
||||
leave_allocation_requests = request.user
|
||||
context = { 'leave_allocation_requests' :leave_allocation_requests,
|
||||
}
|
||||
queryset = LeaveAllocationRequest.objects.all()
|
||||
queryset = sortby(request,queryset,"sortby")
|
||||
leave_allocation_requests_filtered = LeaveAllocationRequestFilter(request.GET,queryset).qs
|
||||
page_number = request.GET.get('page')
|
||||
page_obj = paginator_qry(leave_allocation_requests_filtered,page_number)
|
||||
previous_data = request.GET.urlencode()
|
||||
data_dict = parse_qs(previous_data)
|
||||
data_dict = get_key_instances(LeaveAllocationRequest,data_dict)
|
||||
context = {
|
||||
'leave_allocation_requests' :page_obj,
|
||||
'pd':previous_data,
|
||||
'filter_dict':data_dict
|
||||
}
|
||||
return render(request,
|
||||
'leave/leave_allocation_request/leave_allocation_request_view.html',
|
||||
'leave/leave_allocation_request/leave_allocation_request_list.html',
|
||||
context=context)
|
||||
|
||||
@login_required
|
||||
def leave_allocation_request_update(request,req_id):
|
||||
print('-----update-----')
|
||||
return f"update"
|
||||
|
||||
@login_required
|
||||
def leave_allocation_request_approve(request,req_id):
|
||||
print('-----approve-----')
|
||||
return f"update"
|
||||
|
||||
@login_required
|
||||
def leave_allocation_request_reject(request,req_id):
|
||||
print('-----reject-----')
|
||||
return f"update"
|
||||
|
||||
@login_required
|
||||
def leave_allocation_request_delete(request,req_id):
|
||||
print('-----delete-----')
|
||||
return f"update"
|
||||
Reference in New Issue
Block a user