From d0f632a9c0ad55c25c6939af36f9ac3fbcf72c1a Mon Sep 17 00:00:00 2001 From: Horilla Date: Wed, 22 Oct 2025 15:14:36 +0530 Subject: [PATCH] [UPDT] BASE: Formatted pages and removed toggle form --- base/cbv/department.py | 23 ++--------------------- base/cbv/employee_shift.py | 12 +++--------- base/cbv/employee_type.py | 11 +++-------- base/cbv/settings_work_type.py | 5 ++--- 4 files changed, 10 insertions(+), 41 deletions(-) diff --git a/base/cbv/department.py b/base/cbv/department.py index 61c9088b9..7e5eefacb 100644 --- a/base/cbv/department.py +++ b/base/cbv/department.py @@ -6,7 +6,6 @@ from typing import Any from django.contrib import messages from django.http import HttpResponse -from django.middleware.csrf import get_token from django.shortcuts import render from django.urls import reverse from django.utils.decorators import method_decorator @@ -15,7 +14,6 @@ from django.utils.translation import gettext_lazy as _ from base.filters import DepartmentViewFilter from base.forms import DepartmentForm from base.models import Department -from horilla.horilla_middlewares import _thread_locals from horilla_views.cbv_methods import login_required, permission_required from horilla_views.generic.cbv.views import ( HorillaFormView, @@ -33,6 +31,7 @@ class DepartmentListView(HorillaListView): model = Department filter_class = DepartmentViewFilter + show_toggle_form = False def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) @@ -68,20 +67,7 @@ class DepartmentListView(HorillaListView): } ) - # - - row_attrs = """ - id="departmentTr{get_delete_instance}" - """ + row_attrs = """ id="departmentTr{get_delete_instance}" """ columns = [ (_("Department"), "department"), @@ -90,11 +76,6 @@ class DepartmentListView(HorillaListView): (_("Department"), "department"), ] - header_attrs = { - "department": """ style="width:300px !important" """, - "action": """ style="width:180px !important" """, - } - records_per_page = 7 diff --git a/base/cbv/employee_shift.py b/base/cbv/employee_shift.py index 543ebbd6e..becf5ae92 100644 --- a/base/cbv/employee_shift.py +++ b/base/cbv/employee_shift.py @@ -24,7 +24,6 @@ class EmployeeShiftListView(HorillaListView): def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) - # self.action_method = "actions_col" self.view_id = "shift_view" self.search_url = reverse("employee-shift-list") self.actions = [] @@ -59,6 +58,7 @@ class EmployeeShiftListView(HorillaListView): model = EmployeeShift filter_class = EmployeeShiftFilter + show_toggle_form = False bulk_update_fields = [ "weekly_full_time", @@ -67,19 +67,13 @@ class EmployeeShiftListView(HorillaListView): columns = [ (_("Shift"), "employee_shift"), - (_("Weekly Full Time"), "weekly_full_time"), - (_("Full Time"), "full_time"), ] sortby_mapping = [ ("Shift", "employee_shift"), - ("Weekly Full Time", "weekly_full_time"), - ("Full Time", "full_time"), ] - row_attrs = """ - id = "shiftTr{get_instance_id}" - """ + row_attrs = """ id = "shiftTr{get_instance_id}" """ @method_decorator(login_required, name="dispatch") @@ -100,6 +94,6 @@ class EmployeeShiftNav(HorillaNavView): hx-get="{reverse('employee-shift-create-view')}" """ - nav_title = _("Shift") + nav_title = _("Employee Shift") filter_instance = EmployeeShiftFilter() search_swap_target = "#listContainer" diff --git a/base/cbv/employee_type.py b/base/cbv/employee_type.py index e75a04e86..3705225e0 100644 --- a/base/cbv/employee_type.py +++ b/base/cbv/employee_type.py @@ -64,19 +64,14 @@ class EmployeeTypeListView(HorillaListView): model = EmployeeType filter_class = EmployeeTypeFilter + show_toggle_form = False columns = [ (_("Employee Type"), "employee_type"), ] - header_attrs = { - "employee_type": """ - style="width:400px !important;" - """ - } + header_attrs = {"employee_type": """ style="width:400px !important;" """} - row_attrs = """ - id = "employeeTypeTr{get_instance_id}" - """ + row_attrs = """ id = "employeeTypeTr{get_instance_id}" """ @method_decorator(login_required, name="dispatch") diff --git a/base/cbv/settings_work_type.py b/base/cbv/settings_work_type.py index aca2ac91c..a43ddad71 100644 --- a/base/cbv/settings_work_type.py +++ b/base/cbv/settings_work_type.py @@ -57,14 +57,13 @@ class WorkTypeList(HorillaListView): model = WorkType filter_class = WorkTypeFilter + show_toggle_form = False columns = [ (_("Work Type"), "work_type"), ] - row_attrs = """ - id="workTypeTr{get_delete_instance}" - """ + row_attrs = """ id="workTypeTr{get_delete_instance}" """ header_attrs = { "work_type": """ style="width:300px !important" """,