[UPDT] OFFBOARDING: Added next and previous button to offboarding individual view
This commit is contained in:
@@ -1,5 +1,18 @@
|
||||
{% load i18n %} {% load offboarding_filter %}
|
||||
<div class="oh-modal__dialog-body oh-timeoff-modal__body pb-2">
|
||||
{% load i18n %} {% load offboarding_filter %}
|
||||
{% if request.GET.requests_ids %}
|
||||
<div class="oh-modal__dialog oh-modal__dialog--navigation m-0 p-0">
|
||||
<button hx-get="{% url "offboarding-individual-view" previous %}?requests_ids={{requests_ids}}" hx-target = "#singleView" 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 "offboarding-individual-view" next %}?requests_ids={{requests_ids}}" hx-target = "#singleView" 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>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="oh-modal__dialog-body oh-timeoff-modal__body">
|
||||
<div class="oh-timeoff-modal__profile-content">
|
||||
<div class="oh-profile">
|
||||
<div class="oh-profile-section__edit-photo me-3" style="width: 80px; height: 80px;" >
|
||||
@@ -10,8 +23,8 @@
|
||||
<a class="oh-timeoff-modal__profile-content" style="text-decoration:none;"
|
||||
href ="{% url 'employee-view-individual' employee.employee_id.id %}">
|
||||
<div class="oh-timeoff-modal__profile-info mb-2">
|
||||
<span class="oh-timeoff-modal__user fw-bold">{{employee}}</span>
|
||||
<span class="oh-timeoff-modal__position">{{employee.employee_id.employee_work_info.department_id}}</span>
|
||||
<span class="oh-timeoff-modal__user fw-bold">{{employee.employee_id}}</span>
|
||||
<span class="oh-timeoff-modal__position">{{employee.employee_id.employee_work_info.department_id}} / {{employee.employee_id.employee_work_info.job_position_id}}</span>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
@@ -57,22 +70,23 @@
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="oh-timeoff-modal__stats w-100 mt-3 mb-3">
|
||||
{% if employee.employeetask_set.all %}
|
||||
<div class="oh-timeoff-modal__stats w-100 mt-3">
|
||||
<div class="oh-timeoff-modal__stat">
|
||||
<span class="oh-timeoff-modal__stat-count">{% trans "Tasks" %}</span>
|
||||
<div class="row ms-2">
|
||||
{% for task in employee.employeetask_set.all %}
|
||||
<div class="col-6 ps-0 pb-1">
|
||||
<div class="oh-timeoff-modal__stat-title mb-1 "><span class="oh-dot oh-dot--small me-1 oh-dot--color-{{task.status}}"></span>{{task.task_id.title}} </div>
|
||||
<div class="oh-timeoff-modal__stat-title mb-1 "><span class="oh-dot oh-dot--small me-1 oh-dot--color-{{task.status}}"></span>{{task.task_id.title}} </div>
|
||||
<div class="" id="task{{task.id}}{{employee.id}}">
|
||||
{% include 'offboarding/pipeline/employee_task.html' %}
|
||||
{% include 'offboarding/pipeline/employee_task.html' %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -121,13 +121,15 @@
|
||||
<div class="oh-modal" id="singleModal" role="dialog" aria-labelledby="singleModalModal" aria-hidden="true">
|
||||
<div class="oh-modal__dialog ">
|
||||
<div class="oh-modal__dialog-header">
|
||||
|
||||
<h2 class="oh-modal__dialog-title" id="">
|
||||
{% trans "Details" %}
|
||||
</h2>
|
||||
<button class="oh-modal__close" aria-label="Close">
|
||||
<ion-icon name="close-outline"></ion-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div id="singleView">
|
||||
<div class="oh-modal__dialog-relative" id="singleView">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -52,18 +52,16 @@ from attendance.methods.group_by import group_by_queryset as group_by
|
||||
from recruitment.pipeline_grouper import group_by_queryset
|
||||
|
||||
|
||||
# Create your views here.
|
||||
|
||||
|
||||
def pipeline_grouper(filters={}, offboardings=[]):
|
||||
groups = []
|
||||
|
||||
for offboarding in offboardings:
|
||||
employees = []
|
||||
stages = PipelineStageFilter(
|
||||
filters, queryset=offboarding.offboardingstage_set.all()
|
||||
).qs.order_by("id")
|
||||
all_stages_grouper = []
|
||||
data = {"offboarding": offboarding, "stages": []}
|
||||
data = {"offboarding": offboarding, "stages": [], "employees": []}
|
||||
for stage in stages:
|
||||
all_stages_grouper.append({"grouper": stage, "list": []})
|
||||
stage_employees = PipelineEmployeeFilter(
|
||||
@@ -77,7 +75,9 @@ def pipeline_grouper(filters={}, offboardings=[]):
|
||||
filters.get(page_name),
|
||||
page_name,
|
||||
).object_list
|
||||
|
||||
employees = employees + [
|
||||
employee.id for employee in stage.offboardingemployee_set.all()
|
||||
]
|
||||
data["stages"] = data["stages"] + employee_grouper
|
||||
|
||||
ordered_data = []
|
||||
@@ -96,6 +96,7 @@ def pipeline_grouper(filters={}, offboardings=[]):
|
||||
data = {
|
||||
"offboarding": offboarding,
|
||||
"stages": ordered_data,
|
||||
"employee_ids": employees,
|
||||
}
|
||||
groups.append(data)
|
||||
|
||||
@@ -110,6 +111,7 @@ def pipeline(request):
|
||||
"""
|
||||
Offboarding pipleine view
|
||||
"""
|
||||
employees = []
|
||||
offboardings = PipelineFilter().qs
|
||||
groups = pipeline_grouper({}, offboardings)
|
||||
for item in groups:
|
||||
@@ -117,7 +119,14 @@ def pipeline(request):
|
||||
stage_forms = {}
|
||||
for offboarding in offboardings:
|
||||
stage_forms[str(offboarding.id)] = StageSelectForm(offboarding=offboarding)
|
||||
for stage in offboarding.offboardingstage_set.all():
|
||||
employees = employees + [
|
||||
employee for employee in stage.offboardingemployee_set.all()
|
||||
]
|
||||
|
||||
filter_dict = parse_qs(request.GET.urlencode())
|
||||
requests_ids = json.dumps([instance.id for instance in employees])
|
||||
|
||||
return render(
|
||||
request,
|
||||
"offboarding/pipeline/pipeline.html",
|
||||
@@ -128,6 +137,7 @@ def pipeline(request):
|
||||
"stage_filter": PipelineStageFilter(),
|
||||
"stage_forms": stage_forms,
|
||||
"filter_dict": filter_dict,
|
||||
"requests_ids": requests_ids,
|
||||
},
|
||||
)
|
||||
|
||||
@@ -596,6 +606,14 @@ def offboarding_individual_view(request, emp_id):
|
||||
"offboarding_stages": offboarding_stages,
|
||||
"stage_forms": stage_forms,
|
||||
}
|
||||
|
||||
requests_ids_json = request.GET.get("requests_ids")
|
||||
if requests_ids_json:
|
||||
requests_ids = json.loads(requests_ids_json)
|
||||
previous_id, next_id = closest_numbers(requests_ids, emp_id)
|
||||
context["requests_ids"] = requests_ids_json
|
||||
context["previous"] = previous_id
|
||||
context["next"] = next_id
|
||||
return render(request, "offboarding/pipeline/individual_view.html", context)
|
||||
|
||||
|
||||
@@ -684,7 +702,6 @@ def search_resignation_request(request):
|
||||
if request.GET.get("view"):
|
||||
data_dict.pop("view")
|
||||
|
||||
|
||||
return render(
|
||||
request,
|
||||
template,
|
||||
|
||||
Reference in New Issue
Block a user