[UPDT]filter tags in employee and base
This commit is contained in:
@@ -250,8 +250,14 @@ def get_key_instances(model, data_dict):
|
||||
nested_instance = get_nested_instances(model, field_names, field_values)
|
||||
if nested_instance is not None:
|
||||
data_dict[key] = nested_instance
|
||||
|
||||
if 'csrfmiddlewaretoken' in data_dict:
|
||||
del data_dict['csrfmiddlewaretoken']
|
||||
|
||||
keys_to_remove = [key for key, value in data_dict.items() if value == ['unknown']]
|
||||
for key in keys_to_remove:
|
||||
del data_dict[key]
|
||||
|
||||
return data_dict
|
||||
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
</div>
|
||||
<div class="oh-dropdown__filter-footer">
|
||||
<button
|
||||
class="oh-btn oh-btn--secondary oh-btn--small w-100"
|
||||
class="oh-btn oh-btn--secondary oh-btn--small w-100 filterButton"
|
||||
id="#employeeFilter"
|
||||
>
|
||||
{% trans "Filter" %}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
{% load basefilters %}
|
||||
<div class="oh-wrapper">
|
||||
<div id="view-container">
|
||||
{% include 'filter_tags.html' %}
|
||||
<div class="oh-sticky-table">
|
||||
<div class="oh-sticky-table__table oh-table--sortable">
|
||||
<div class="oh-sticky-table__thead">
|
||||
|
||||
@@ -93,9 +93,9 @@
|
||||
</div>
|
||||
<div class="oh-dropdown__filter-footer">
|
||||
<button
|
||||
class="oh-btn oh-btn--secondary oh-btn--small w-100"
|
||||
id="#employeeFilter"
|
||||
onclick="employeeFilter(this)"
|
||||
class="oh-btn oh-btn--secondary oh-btn--small w-100 filterButton"
|
||||
id="employeeFilter"
|
||||
{% comment %} onclick="employeeFilter(this)" {% endcomment %}
|
||||
>
|
||||
{% trans "Filter" %}
|
||||
</button>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
{% load basefilters %}
|
||||
{% include 'filter_tags.html' %}
|
||||
<div class="oh-sticky-table">
|
||||
<div class="oh-sticky-table__table oh-table--sortable">
|
||||
<div class="oh-sticky-table__thead">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
{% load attendancefilters %}
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
{% include 'filter_tags.html' %}
|
||||
<div class="oh-sticky-table">
|
||||
<div class="oh-sticky-table__table oh-table--sortable">
|
||||
<div class="oh-sticky-table__thead">
|
||||
|
||||
@@ -204,7 +204,7 @@ x-data="{searchShow: false}"
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-dropdown__filter-footer">
|
||||
<button class="oh-btn oh-btn--secondary oh-btn--small w-100">{% trans "Filter" %}</button>
|
||||
<button class="oh-btn oh-btn--secondary oh-btn--small w-100 filterButton">{% trans "Filter" %}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
{% load attendancefilters %}
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
{% include 'filter_tags.html' %}
|
||||
<div class="oh-sticky-table">
|
||||
<div class="oh-sticky-table__table oh-table--sortable">
|
||||
<div class="oh-sticky-table__thead">
|
||||
|
||||
@@ -200,7 +200,7 @@ x-data="{searchShow: false}"
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-dropdown__filter-footer">
|
||||
<button class="oh-btn oh-btn--secondary oh-btn--small w-100">{% trans "Filter" %}</button>
|
||||
<button class="oh-btn oh-btn--secondary oh-btn--small w-100 filterButton">{% trans "Filter" %}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -3,6 +3,7 @@ views.py
|
||||
|
||||
This module is used to map url pattens with django views or methods
|
||||
"""
|
||||
from urllib.parse import parse_qs
|
||||
import uuid
|
||||
import json
|
||||
from django.shortcuts import render, redirect
|
||||
@@ -65,7 +66,12 @@ from base.filters import (
|
||||
RotatingShiftAssignFilters,
|
||||
RotatingWorkTypeAssignFilter,
|
||||
)
|
||||
from base.methods import choosesubordinates, filtersubordinates, sortby
|
||||
from base.methods import (
|
||||
choosesubordinates,
|
||||
filtersubordinates,
|
||||
get_key_instances,
|
||||
sortby,
|
||||
)
|
||||
|
||||
|
||||
def custom404(request, exception):
|
||||
@@ -883,6 +889,8 @@ def rotating_work_type_assign_view(request):
|
||||
request, rwork_type_assign, "base.view_rotatingworktypeassign"
|
||||
)
|
||||
rwork_type_assign = sortby(request, rwork_type_assign, "orderby")
|
||||
data_dict = parse_qs(previous_data)
|
||||
get_key_instances(RotatingWorkTypeAssign, data_dict)
|
||||
return render(
|
||||
request,
|
||||
"base/rotating_work_type/rotating_work_type_assign_view.html",
|
||||
@@ -891,6 +899,7 @@ def rotating_work_type_assign_view(request):
|
||||
rwork_type_assign, request.GET.get("page")
|
||||
),
|
||||
"pd": previous_data,
|
||||
"filter_dict": data_dict,
|
||||
},
|
||||
)
|
||||
|
||||
@@ -1394,12 +1403,15 @@ def rotating_shift_assign_view(request):
|
||||
request, rshift_assign, "base.view_rotatingshiftassign"
|
||||
)
|
||||
rshift_assign = sortby(request, rshift_assign, "orderby")
|
||||
data_dict = parse_qs(previous_data)
|
||||
get_key_instances(RotatingShiftAssign, data_dict)
|
||||
return render(
|
||||
request,
|
||||
"base/rotating_shift/rotating_shift_assign_view.html",
|
||||
{
|
||||
"rshift_assign": paginator_qry(rshift_assign, request.GET.get("page")),
|
||||
"pd": previous_data,
|
||||
"filter_dict": data_dict,
|
||||
},
|
||||
)
|
||||
|
||||
@@ -1676,12 +1688,15 @@ def work_type_request_search(request):
|
||||
employee_id=employee
|
||||
)
|
||||
work_typ_requests = sortby(request, work_typ_requests, "orderby")
|
||||
data_dict = parse_qs(previous_data)
|
||||
get_key_instances(WorkTypeRequest, data_dict)
|
||||
return render(
|
||||
request,
|
||||
"work_type_request/htmx/requests.html",
|
||||
{
|
||||
"data": paginator_qry(work_typ_requests, request.GET.get("page")),
|
||||
"pd": previous_data,
|
||||
"filter_dict": data_dict,
|
||||
},
|
||||
)
|
||||
|
||||
@@ -2095,12 +2110,15 @@ def shift_request_search(request):
|
||||
employee_id=employee
|
||||
)
|
||||
shift_requests = sortby(request, shift_requests, "orderby")
|
||||
data_dict = parse_qs(previous_data)
|
||||
get_key_instances(ShiftRequest, data_dict)
|
||||
return render(
|
||||
request,
|
||||
"shift_request/htmx/requests.html",
|
||||
{
|
||||
"data": paginator_qry(shift_requests, request.GET.get("page")),
|
||||
"pd": previous_data,
|
||||
"filter_dict": data_dict,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@@ -100,6 +100,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-dropdown__filter-footer">
|
||||
<button class="oh-btn oh-btn--secondary oh-btn--small w-100" id='#employeeFilter' onclick="employeeFilter(this)">{% trans "Filter" %}</button>
|
||||
<button class="oh-btn oh-btn--secondary oh-btn--small w-100 filterButton" id='#employeeFilter' onclick="employeeFilter(this)">{% trans "Filter" %}</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% include 'filter_tags.html' %}
|
||||
<div class="oh-layout--grid-3">
|
||||
{% for emp in data %}
|
||||
<div class="oh-kanban-card" style="color: inherit;text-decoration: none;">
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% include 'filter_tags.html' %}
|
||||
<div class="oh-sticky-table">
|
||||
<div class="oh-sticky-table__table oh-table--sortable">
|
||||
<div class="oh-sticky-table__thead">
|
||||
|
||||
@@ -16,6 +16,7 @@ import json
|
||||
import calendar
|
||||
from datetime import datetime, timedelta, date
|
||||
from collections import defaultdict
|
||||
from urllib.parse import parse_qs
|
||||
import pandas as pd
|
||||
from django.db.models import F
|
||||
from django.conf import settings
|
||||
@@ -42,7 +43,12 @@ from base.models import (
|
||||
EmployeeType,
|
||||
Company,
|
||||
)
|
||||
from base.methods import filtersubordinates, filtersubordinatesemployeemodel, sortby
|
||||
from base.methods import (
|
||||
filtersubordinates,
|
||||
filtersubordinatesemployeemodel,
|
||||
get_key_instances,
|
||||
sortby,
|
||||
)
|
||||
from employee.filters import EmployeeFilter
|
||||
from employee.forms import (
|
||||
EmployeeForm,
|
||||
@@ -60,6 +66,7 @@ def get_language_code(request):
|
||||
language_code = request.LANGUAGE_CODE
|
||||
return JsonResponse({"language_code": language_code})
|
||||
|
||||
|
||||
@login_required
|
||||
def employee_profile(request):
|
||||
"""
|
||||
@@ -545,6 +552,8 @@ def employee_filter_view(request):
|
||||
page_number = request.GET.get("page")
|
||||
template = "employee_personal_info/employee_card.html"
|
||||
view = request.GET.get("view")
|
||||
data_dict = parse_qs(previous_data)
|
||||
get_key_instances(Employee, data_dict)
|
||||
if view == "list":
|
||||
template = "employee_personal_info/employee_list.html"
|
||||
return render(
|
||||
@@ -554,6 +563,7 @@ def employee_filter_view(request):
|
||||
"data": paginator_qry(filter_obj.qs, page_number),
|
||||
"f": filter_obj,
|
||||
"pd": previous_data,
|
||||
"filter_dict": data_dict,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
// Update all elements with the same ID to have null values
|
||||
{% comment %} $('[id="id_' + field_id + '"]').val(''); {% endcomment %}
|
||||
$(`[name=${field_id}]`).val('');
|
||||
console.log( $(`[name=${field_id}]`))
|
||||
$(form_submit_id).click()
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user