[FIX] PAYROLL: Fixed contract sortby issues

This commit is contained in:
Horilla
2024-04-09 10:03:48 +05:30
parent af98809564
commit f786b93bb6
2 changed files with 3 additions and 3 deletions

View File

@@ -43,8 +43,8 @@
</div>
<div class="oh-sticky-table__th">{% trans "Contract" %}</div>
<div data-cell-index="1" data-cell-title='{% trans "Employee" %}'
class="oh-sticky-table__th {% if request.sort_option.order == '-employee_id' %}arrow-up {% elif request.sort_option.order == 'employee_id' %}arrow-down {% else %} arrow-up-down {% endif %}"
hx-target="#payroll-contract-container" hx-get="{% url 'contract-filter' %}?{{pd}}&orderby=employee_id"
class="oh-sticky-table__th {% if request.sort_option.order == '-employee_id__employee_first_name' %}arrow-up {% elif request.sort_option.order == 'employee_id__employee_first_name' %}arrow-down {% else %} arrow-up-down {% endif %}"
hx-target="#payroll-contract-container" hx-get="{% url 'contract-filter' %}?{{pd}}&orderby=employee_id__employee_first_name"
>{% trans "Employee" %}</div>
<div data-cell-index="2" data-cell-title='{% trans "Start Date" %}'
class="oh-sticky-table__th {% if request.sort_option.order == '-contract_start_date' %}arrow-up {% elif request.sort_option.order == 'contract_start_date' %}arrow-down {% else %} arrow-up-down {% endif %}"

View File

@@ -329,12 +329,12 @@ def contract_filter(request):
template = "payroll/contract/group_by.html"
else:
contracts = sortby(request, contracts, "orderby")
contracts = paginator_qry(contracts, request.GET.get("page"))
contract_ids_json = json.dumps(
[instance.id for instance in contracts.object_list]
)
contracts = sortby(request, contracts, "orderby")
data_dict = parse_qs(query_string)
get_key_instances(Contract, data_dict)
keys_to_remove = [key for key, value in data_dict.items() if value == ["unknown"]]