[UPDT] HELPDESK: Updated department managers view in settings and removed toggle form from tags and ticket type

This commit is contained in:
Horilla
2025-10-13 10:39:58 +05:30
parent c0cd7d5736
commit 9d9e1b4f57
5 changed files with 90 additions and 61 deletions

View File

@@ -39,6 +39,7 @@ class DepartmentManagersListView(HorillaListView):
model = DepartmentManager
filter_class = DepartmentManagerFilter
show_toggle_form = False
columns = [
(_("Department"), "department"),

View File

@@ -32,6 +32,7 @@ class TagsListView(HorillaListView):
model = Tags
filter_class = TagsFilter
show_toggle_form = False
def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)

View File

@@ -69,18 +69,15 @@ class TicketsListView(HorillaListView):
model = TicketType
filter_class = TicketTypeFilter
show_toggle_form = False
columns = [
(_("Ticket Type"), "title"),
(_("Type"), "type"),
(_("Type"), "get_type_display"),
(_("Prefix"), "prefix"),
]
header_attrs = {
"title": """
style = "width:200px !important"
"""
}
header_attrs = {"title": """ style = "width:200px !important" """}
sortby_mapping = [
("Ticket Type", "title"),

View File

@@ -1,63 +1,92 @@
{% extends 'settings.html' %}
{% load i18n %}
{% block settings %}{% load static %}
<meta name="csrf-token" content="{{ csrf_token }}">
{% include "generic/components.html" %}
{% load i18n static %}
{% block settings %}
<div class="oh-inner-sidebar-content">
{% if perms.helpdesk.view_departmentmanager %}
<div class="oh-inner-sidebar-content__header d-flex justify-content-between align-items-center">
<h2 class="oh-inner-sidebar-content__title">{{model.get_verbose_name_plural}}</h2>
{% if perms.helpdesk.add_departmentmanager %}
<button
class="oh-btn oh-btn--secondary oh-btn--shadow"
data-toggle="oh-modal-toggle"
data-target="#objectCreateModal"
hx-get="{% url 'department-manager-create' %}"
hx-target="#objectCreateModalTarget"
{% if perms.helpdesk.view_departmentmanager %}
<div
class="oh-inner-sidebar-content__header d-flex justify-content-between align-items-center"
>
<h3 class="text-lg font-semibold">
{{model.get_verbose_name_plural}}
</h3>
{% if perms.helpdesk.add_departmentmanager %}
<button
class="oh-btn oh-btn--secondary oh-btn--shadow"
data-toggle="oh-modal-toggle"
data-target="#objectCreateModal"
hx-get="{% url 'department-manager-create' %}"
hx-target="#objectCreateModalTarget"
>
<ion-icon name="add-outline" class="me-1"></ion-icon>
{% trans "Create" %}
</button>
{% endif %}
</div>
<div
class="oh-checkpoint-badge mb-2"
id="selectedInstances"
data-ids="[]"
data-clicked=""
style="display: none"
></div>
<div
class="oh-wrapper"
id="listContainer"
hx-get="{% url 'department-manager-list' %}"
hx-trigger="load"
>
<div class="animated-background"></div>
</div>
{% comment %}
{% if department_managers %}
{% include 'department_managers/department_managers_view.html' %}
{% else %}
<div
style="
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100%;
"
>
<ion-icon name="add-outline" class="me-1"></ion-icon>
{% trans "Create" %}
</button>
{% endif %}
</div> {% endcomment %}
{% comment %} ------------------------------------------------------ {% endcomment %}
<div
class="oh-checkpoint-badge mb-2"
id="selectedInstances"
data-ids="[]"
data-clicked=""
style="display: none"
></div>
<div
class="oh-wrapper"
id="listContainer">
<div class="animated-background">
</div>
<img
style="
display: block;
width: 15%;
margin: 20px auto;
filter: opacity(0.5);
"
src="{% static 'images/ui/manager.png' %}"
class=""
alt="Page not found. 404."
/>
<h5 class="oh-404__subtitle">
{% trans "There is no department managers at this moment." %}
</h5>
</div>
{% endif %}
{% endcomment %}
{% endif %}
</div>
{% comment %} ---------------------------------------------------- {% endcomment %}
{% comment %} {% if department_managers %}
{% include 'department_managers/department_managers_view.html' %}
{% else %}
<div style="display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%;">
<img style="display: block; width: 15%; margin: 20px auto; filter: opacity(0.5);" src="{% static 'images/ui/manager.png' %}" class="" alt="Page not found. 404." />
<h5 class="oh-404__subtitle">{% trans "There is no department managers at this moment." %}</h5>
</div>
{% endif %} {% endcomment %}
{% endif %}
</div>
<button id="getDepartmentEmployeesButton" hx-get="{% url "get-department-employee" %}" hx-target="#id_manager" hidden></button>
<button
id="getDepartmentEmployeesButton"
hx-get="{% url 'get-department-employee' %}"
hx-target="#id_manager"
hidden
></button>
<script>
function getDepartmentEmployees(element){
var dep_id = element.val()
$('#getDepartmentEmployeesButton').attr('hx-vals', JSON.stringify({ dep_id: dep_id })).click();
function getDepartmentEmployees(element) {
var dep_id = element.val();
$("#getDepartmentEmployeesButton")
.attr("hx-vals", JSON.stringify({ dep_id: dep_id }))
.click();
}
</script>
{% endblock settings %}

View File

@@ -1748,9 +1748,10 @@ def get_department_employees(request):
else None
)
if department:
employees_queryset = department.employeeworkinformation_set.all().values_list(
"employee_id__id", "employee_id__employee_first_name"
)
employees_qs = department.employeeworkinformation_set.all()
employees_queryset = [
(emp.employee_id.id, emp.employee_id) for emp in employees_qs
]
else:
employees_queryset = None
employees = list(employees_queryset)