initial commit
This commit is contained in:
@@ -101,7 +101,6 @@ cloudinary.config(
|
|||||||
api_secret = os.getenv("API_SECRET")
|
api_secret = os.getenv("API_SECRET")
|
||||||
)
|
)
|
||||||
|
|
||||||
MEDIA_URL = f"https://res.cloudinary.com/{os.getenv('CLOUD_NAME')}/"
|
|
||||||
DEFAULT_FILE_STORAGE = 'cloudinary_storage.storage.MediaCloudinaryStorage'
|
DEFAULT_FILE_STORAGE = 'cloudinary_storage.storage.MediaCloudinaryStorage'
|
||||||
|
|
||||||
# Auth redirects
|
# Auth redirects
|
||||||
|
|||||||
@@ -9,70 +9,73 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
{% if issues %}
|
{% if issues %}
|
||||||
<table class="table table-bordered table-hover">
|
<table class="table table-bordered table-hover">
|
||||||
<thead class="table-light">
|
<thead class="table-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th>No.</th>
|
<th>No.</th>
|
||||||
<th>Title</th>
|
<th>Title</th>
|
||||||
<th>Reported By</th>
|
<th>Reported By</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th>Created At</th>
|
<th>Created At</th>
|
||||||
<th>Actions</th>
|
<th>Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for issue in issues %}
|
{% for issue in issues %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ forloop.counter }}</td>
|
<td>{{ forloop.counter }}</td>
|
||||||
<td>{{ issue.title }}</td>
|
<td>{{ issue.title }}</td>
|
||||||
<td>{{ issue.reporter.username }}</td>
|
<td>{{ issue.reporter.username }}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if issue.status == "reported" %}
|
{% if issue.status == "reported" %}
|
||||||
<span class="badge bg-danger">Reported</span>
|
<span class="badge bg-danger">Reported</span>
|
||||||
{% elif issue.status == "acknowledged" %}
|
{% elif issue.status == "acknowledged" %}
|
||||||
<span class="badge bg-info text-dark">Acknowledged</span>
|
<span class="badge bg-info text-dark">Acknowledged</span>
|
||||||
{% elif issue.status == "in_progress" %}
|
{% elif issue.status == "in_progress" %}
|
||||||
<span class="badge bg-warning text-dark">In Progress</span>
|
<span class="badge bg-warning text-dark">In Progress</span>
|
||||||
{% elif issue.status == "resolved" %}
|
{% elif issue.status == "resolved" %}
|
||||||
<span class="badge bg-success">Resolved</span>
|
<span class="badge bg-success">Resolved</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="badge bg-secondary">Unknown</span>
|
<span class="badge bg-secondary">Unknown</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>{{ issue.created_at|date:"M d, Y H:i" }}</td>
|
<td>{{ issue.created_at|date:"M d, Y H:i" }}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if issue.department %}
|
{% if issue.department %}
|
||||||
<span class="fw-bold text-primary">{{ issue.department.name }}</span>
|
<span class="fw-bold text-primary">{{ issue.department.name }}</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<!-- Assign Department Form -->
|
<!-- Assign Department Form -->
|
||||||
<form method="post" action="" class="d-inline">
|
<form method="post" action="" class="d-inline">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="issue_id" value="{{ issue.id }}">
|
<input type="hidden" name="issue_id" value="{{ issue.id }}">
|
||||||
<select name="department" class="form-select form-select-sm d-inline w-auto">
|
<select name="department" class="form-select form-select-sm d-inline w-auto">
|
||||||
<option value="">— Select Department —</option>
|
<option value="">— Select Department —</option>
|
||||||
{% for dept in departments %}
|
{% for dept in departments %}
|
||||||
<option value="{{ dept.id }}">{{ dept.name }}</option>
|
<option value="{{ dept.id }}">{{ dept.name }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
<button type="submit" class="btn btn-sm btn-primary">Assign</button>
|
<button type="submit" class="btn btn-sm btn-primary">Assign</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<!-- Report Fake Button -->
|
<!-- Report Fake Button -->
|
||||||
<a href="{% url 'delete_fake_issue' issue.id %}"
|
<a href="{% url 'delete_fake_issue' issue.id %}" class="btn btn-sm btn-danger ms-1"
|
||||||
class="btn btn-sm btn-danger ms-1"
|
onclick="return confirm('Are you sure you want to delete this issue as FAKE?');">
|
||||||
onclick="return confirm('Are you sure you want to delete this issue as FAKE?');">
|
<i class="fas fa-ban"></i> Report Fake
|
||||||
<i class="fas fa-ban"></i> Report Fake
|
</a>
|
||||||
</a>
|
<a href="{% url 'delete_issue' issue.id %}" class="btn btn-sm btn-outline-danger ms-1"
|
||||||
{% endif %}
|
onclick="return confirm('Are you sure you want to permanently delete this issue? This cannot be undone.');">
|
||||||
</td>
|
<i class="fas fa-trash"></i> Delete
|
||||||
</tr>
|
</a>
|
||||||
{% endfor %}
|
{% endif %}
|
||||||
</tbody>
|
</td>
|
||||||
</table>
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p class="text-muted">No issues reported yet.</p>
|
<p class="text-muted">No issues reported yet.</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -26,4 +26,5 @@ urlpatterns = [
|
|||||||
path('unban-user/<int:user_id>/', views.unban_user, name='unban_user'),
|
path('unban-user/<int:user_id>/', views.unban_user, name='unban_user'),
|
||||||
path('issues/<int:issue_id>/delete_fake/', views.delete_fake_issue, name='delete_fake_issue'),
|
path('issues/<int:issue_id>/delete_fake/', views.delete_fake_issue, name='delete_fake_issue'),
|
||||||
path("reports/", views.superadmin_reports, name="superadmin_reports"),
|
path("reports/", views.superadmin_reports, name="superadmin_reports"),
|
||||||
|
path('delete-issue/<int:issue_id>/', views.delete_issue, name='delete_issue'),
|
||||||
]
|
]
|
||||||
@@ -384,6 +384,14 @@ def superadmin_reports(request):
|
|||||||
}
|
}
|
||||||
return render(request, "core/superadmin_reports.html", context)
|
return render(request, "core/superadmin_reports.html", context)
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
@user_passes_test(superadmin_check)
|
||||||
|
def delete_issue(request, issue_id):
|
||||||
|
issue = get_object_or_404(Issue, id=issue_id)
|
||||||
|
issue.delete()
|
||||||
|
messages.success(request, "Issue deleted successfully.")
|
||||||
|
return redirect('manage_issues')
|
||||||
|
|
||||||
def resolver_check(user):
|
def resolver_check(user):
|
||||||
return user.is_resolver
|
return user.is_resolver
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user