diff --git a/civicfix/core/__pycache__/models.cpython-313.pyc b/civicfix/core/__pycache__/models.cpython-313.pyc index 145a2a6..a1defd5 100644 Binary files a/civicfix/core/__pycache__/models.cpython-313.pyc and b/civicfix/core/__pycache__/models.cpython-313.pyc differ diff --git a/civicfix/core/__pycache__/urls.cpython-313.pyc b/civicfix/core/__pycache__/urls.cpython-313.pyc index 136a0af..b8179ac 100644 Binary files a/civicfix/core/__pycache__/urls.cpython-313.pyc and b/civicfix/core/__pycache__/urls.cpython-313.pyc differ diff --git a/civicfix/core/__pycache__/views.cpython-313.pyc b/civicfix/core/__pycache__/views.cpython-313.pyc index a4513e6..4a4eff7 100644 Binary files a/civicfix/core/__pycache__/views.cpython-313.pyc and b/civicfix/core/__pycache__/views.cpython-313.pyc differ diff --git a/civicfix/core/models.py b/civicfix/core/models.py index c3b25cf..36dcebc 100644 --- a/civicfix/core/models.py +++ b/civicfix/core/models.py @@ -61,7 +61,6 @@ class IssueCategory(models.Model): def __str__(self): return self.name -# issues/models.py class Issue(models.Model): STATUS_REPORTED = 'reported' STATUS_ACKNOWLEDGED = 'acknowledged' diff --git a/civicfix/core/templates/core/base.html b/civicfix/core/templates/core/base.html index 0173209..5e59ead 100644 --- a/civicfix/core/templates/core/base.html +++ b/civicfix/core/templates/core/base.html @@ -75,6 +75,7 @@ +
{% if user.is_authenticated %} {% else %} + Login Register {% endif %}
+ diff --git a/civicfix/core/templates/dashboard/department_dashboard.html b/civicfix/core/templates/dashboard/department_dashboard.html new file mode 100644 index 0000000..16a50e2 --- /dev/null +++ b/civicfix/core/templates/dashboard/department_dashboard.html @@ -0,0 +1,56 @@ +{% extends "core/base.html" %} + +{% block content %} +
+
+
+

Department Dashboard

+

Welcome, {{ request.user.username }}. Your Departments: + {% for dept in departments %} {{ dept.name }}{% if not forloop.last %}, {% endif %}{% endfor %} +

+
+
+ {% if issues %} + + + + + + + + + + + + + {% for issue in issues %} + + + + + + + + + {% endfor %} + +
#TitleCategoryReported ByStatusCreated At
{{ forloop.counter }}{{ issue.title }}{{ issue.category.name|default:"—" }}{{ issue.reporter.username }} + {% if issue.status == "reported" %} + Reported + {% elif issue.status == "acknowledged" %} + Acknowledged + {% elif issue.status == "in_progress" %} + In Progress + {% elif issue.status == "resolved" %} + Resolved + {% else %} + Unknown + {% endif %} + {{ issue.created_at|date:"M d, Y H:i" }}
+ {% else %} +

No issues assigned to your departments yet.

+ {% endif %} +
+
+
+{% endblock %} diff --git a/civicfix/core/templates/dashboard/superadmin_dashboard.html b/civicfix/core/templates/dashboard/superadmin_dashboard.html index 0ab3c71..76f9beb 100644 --- a/civicfix/core/templates/dashboard/superadmin_dashboard.html +++ b/civicfix/core/templates/dashboard/superadmin_dashboard.html @@ -1,4 +1,3 @@ - {% extends "core/base.html" %} {% block content %} diff --git a/civicfix/core/urls.py b/civicfix/core/urls.py index 1565a84..c90588d 100644 --- a/civicfix/core/urls.py +++ b/civicfix/core/urls.py @@ -9,7 +9,6 @@ urlpatterns = [ path("superadmin/departments//", views.department_detail, name="department_detail"), path("superadmin/manage/", views.manage_issues, name="manage_issues"), path("superadmin/assign-department//", views.assign_department, name="assign_department"), - path('register/', views.register, name='register'), path('login/', views.custom_login, name='login'), path('logout/', auth_views.LogoutView.as_view(), name='logout'), @@ -19,5 +18,6 @@ urlpatterns = [ path("issues//", views.issue_detail, name="issue_detail"), path("issues//comment/", views.add_comment, name="add_comment"), path("issues//comment//", views.add_comment, name="add_comment"), - path('vote//', views.vote_issue, name='vote_issue'), + path('vote//', views.vote_issue, name='vote_issue'), + path("department/", views.department_dashboard, name="department_dashboard"), ] \ No newline at end of file diff --git a/civicfix/core/views.py b/civicfix/core/views.py index 760396e..33fda57 100644 --- a/civicfix/core/views.py +++ b/civicfix/core/views.py @@ -239,7 +239,7 @@ def department_detail(request, pk): email=email, password=password ) - user.is_staff = True + user.is_resolver = True user.save() department.users.add(user) messages.success(request, f"User '{username}' created and added to department.") @@ -301,4 +301,12 @@ def assign_department(request, issue_id): else: messages.error(request, "Please select a department.") - return redirect("manage_issues") # redirect back to the issues page \ No newline at end of file + return redirect("manage_issues") + +def resolver_check(user): + return user.is_resolver + +@login_required +@user_passes_test(resolver_check) +def department_dashboard(request): + return render(request, "dashboard/department_dashboard.html") \ No newline at end of file