minor update

This commit is contained in:
2025-08-26 12:53:52 +05:30
parent edb1ab6b3a
commit 15e8344d0e
4 changed files with 47 additions and 27 deletions
@@ -89,17 +89,35 @@
{{ issue.description|truncatewords:15 }} {{ issue.description|truncatewords:15 }}
</p> </p>
<div class="d-flex gap-2 align-items-center"> <div class="d-flex gap-2 align-items-center">
<span class="badge bg-secondary">{{ issue.category.name|default:"No Category" }}</span> <span class="badge
<span class="badge bg-{% if issue.status == 'resolved' %}success{% elif issue.status == 'in_progress' %}warning{% else %}primary{% endif %} issue-status"> {% if issue.department.name == 'Roads & Transportation' %} bg-primary
{% elif issue.department.name == 'Sanitation & Waste Management' %} bg-success
{% elif issue.department.name == 'Public Safety' %} bg-danger
{% elif issue.department.name == 'Water & Sewage' %} bg-info text-dark
{% elif issue.department.name == 'Parks & Recreation' %} bg-warning text-dark
{% elif issue.department.name == 'Electricity & Utilities' %} bg-dark
{% elif issue.department.name == 'Environmental Services' %} bg-secondary
{% elif issue.department.name == 'Public Works' %} bg-teal text-white
{% else %} bg-light text-dark
{% endif %}">
{{ issue.department.name|default:"No Department" }}
</span>
<!-- 🔹 Status badge -->
<span class="badge bg-{% if issue.status == 'resolved' %}success
{% elif issue.status == 'in_progress' %}warning
{% else %}primary{% endif %} issue-status">
{{ issue.get_status_display }} {{ issue.get_status_display }}
</span> </span>
<small class="text-muted">{{ issue.created_at|date:"M d, Y" }}</small> <small class="text-muted">{{ issue.created_at|date:"M d, Y" }}</small>
</div> </div>
</div> </div>
{% if issue.photo %} {% if issue.photo %}
<div class="ms-3"> <div class="ms-3">
<img src="{{ issue.photo.url }}" alt="Issue photo" <img src="{{ issue.photo.url }}" alt="Issue photo" class="img-fluid rounded"
class="img-fluid rounded" style="max-height: 60px; max-width: 80px;"> style="max-height: 60px; max-width: 80px;">
</div> </div>
{% endif %} {% endif %}
</div> </div>
@@ -114,6 +132,7 @@
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@@ -146,12 +165,7 @@
{{ issue_form.title }} {{ issue_form.title }}
</div> </div>
</div> </div>
<div class="col-md-6">
<div class="mb-3">
<label class="form-label">Category</label>
{{ issue_form.category }}
</div>
</div>
</div> </div>
<div class="mb-3"> <div class="mb-3">
@@ -6,7 +6,7 @@
<div class="card-header bg-primary text-white"> <div class="card-header bg-primary text-white">
<h3>Department Dashboard</h3> <h3>Department Dashboard</h3>
<p> <p>
Welcome, {{ request.user.username }}. Your Departments: Welcome, {{ request.user.username }}. Department:
{% for dept in departments %} {% for dept in departments %}
<span class="badge bg-light text-dark">{{ dept.name }}</span> <span class="badge bg-light text-dark">{{ dept.name }}</span>
{% empty %} {% empty %}
@@ -21,7 +21,6 @@
<tr> <tr>
<th>#</th> <th>#</th>
<th>Title</th> <th>Title</th>
<th>Category</th>
<th>Reported By</th> <th>Reported By</th>
<th>Status</th> <th>Status</th>
<th>Created At</th> <th>Created At</th>
@@ -33,7 +32,6 @@
<tr> <tr>
<td>{{ forloop.counter }}</td> <td>{{ forloop.counter }}</td>
<td>{{ issue.title }}</td> <td>{{ issue.title }}</td>
<td>{{ issue.category.name|default:"—" }}</td>
<td>{{ issue.reporter.username }}</td> <td>{{ issue.reporter.username }}</td>
<td> <td>
{% if issue.status == "reported" %} {% if issue.status == "reported" %}
@@ -13,7 +13,6 @@
<tr> <tr>
<th>#</th> <th>#</th>
<th>Title</th> <th>Title</th>
<th>Category</th>
<th>Reported By</th> <th>Reported By</th>
<th>Status</th> <th>Status</th>
<th>Created At</th> <th>Created At</th>
@@ -25,7 +24,6 @@
<tr> <tr>
<td>{{ forloop.counter }}</td> <td>{{ forloop.counter }}</td>
<td>{{ issue.title }}</td> <td>{{ issue.title }}</td>
<td>{{ issue.category.name|default:"—" }}</td>
<td>{{ issue.reporter.username }}</td> <td>{{ issue.reporter.username }}</td>
<td> <td>
{% if issue.status == "reported" %} {% if issue.status == "reported" %}
@@ -20,12 +20,12 @@
</option> </option>
</select> </select>
<select name="category" class="form-select"> <select name="department" class="form-select">
<option value="">All Categories</option> <option value="">All Departments</option>
{% for cat in categories %} {% for dept in departments %}
{% with cat.id|stringformat:"s" as cat_id %} {% with dept.id|stringformat:"s" as dept_id %}
<option value="{{ cat_id }}" {% if request.GET.category|default:'' == cat_id %}selected{% endif %}> <option value="{{ dept_id }}" {% if request.GET.department|default:'' == dept_id %}selected{% endif %}>
{{ cat.name }} {{ dept.name }}
</option> </option>
{% endwith %} {% endwith %}
{% endfor %} {% endfor %}
@@ -52,12 +52,22 @@
{% endif %} {% endif %}
<div class="card-body d-flex flex-column"> <div class="card-body d-flex flex-column">
<!-- Category Badge --> <!-- Department Badge -->
<span <span class="badge
class="badge bg-{% if issue.category.name == 'Roads' %}warning text-dark{% elif issue.category.name == 'Sanitation' %}success{% else %}info{% endif %} mb-2"> {% if issue.department.name == 'Roads & Transportation' %} bg-primary
{{ issue.category.name|default:"General" }} {% elif issue.department.name == 'Sanitation & Waste Management' %} bg-success
{% elif issue.department.name == 'Public Safety' %} bg-danger
{% elif issue.department.name == 'Water & Sewage' %} bg-info text-dark
{% elif issue.department.name == 'Parks & Recreation' %} bg-warning text-dark
{% elif issue.department.name == 'Electricity & Utilities' %} bg-dark
{% elif issue.department.name == 'Environmental Services' %} bg-secondary
{% elif issue.department.name == 'Public Works' %} bg-teal text-white
{% else %} bg-light text-dark
{% endif %} mb-2">
{{ issue.department.name|default:"General" }}
</span> </span>
<!-- Title + Description --> <!-- Title + Description -->
<h5 class="card-title">{{ issue.title|truncatewords:6 }}</h5> <h5 class="card-title">{{ issue.title|truncatewords:6 }}</h5>
<p class="card-text text-muted flex-grow-1"> <p class="card-text text-muted flex-grow-1">
@@ -86,7 +96,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="card-footer bg-transparent d-flex justify-content-between align-items-center"> <div class="card-footer bg-transparent d-flex justify-content-between align-items-center">
<small <small
class="text-{% if issue.status == 'resolved' %}success{% elif issue.status == 'in_progress' %}warning{% else %}info{% endif %}"> class="text-{% if issue.status == 'resolved' %}success{% elif issue.status == 'in_progress' %}warning{% else %}info{% endif %}">
@@ -100,7 +110,7 @@
</a> </a>
</div> </div>
</div> </div>
</div> </div>
{% empty %} {% empty %}