huh new thing
This commit is contained in:
1 parent
0975a125c7
commit
9a842c12bf
29 files changed
+2811
-295
No files matched your search
@@ -1,5 +1,5 @@
|
||||
{% extends "admin/base_site.html" %}
|
||||
{% block page_title %}Manage Subjects{% endblock %}
|
||||
{% block page_title %}{{ title }}{% endblock %}
|
||||
{% load static %}
|
||||
{% block extrastyle %}
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
|
||||
@@ -7,91 +7,184 @@
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"
|
||||
rel="stylesheet" />
|
||||
<style>
|
||||
.course-filter, .duration-filter {
|
||||
margin-bottom: 20px;
|
||||
.page-header {
|
||||
background-color: #f8f9fa;
|
||||
padding: 1rem;
|
||||
margin-bottom: 2rem;
|
||||
border-bottom: 1px solid #dee2e6;
|
||||
}
|
||||
|
||||
.card {
|
||||
box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
|
||||
border-radius: 0.5rem;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.table {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.table thead th {
|
||||
background-color: #f8f9fa;
|
||||
border-bottom: 2px solid #dee2e6;
|
||||
color: #495057;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.table td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.btn-action {
|
||||
padding: 0.375rem 0.75rem;
|
||||
font-size: 0.875rem;
|
||||
border-radius: 0.25rem;
|
||||
transition: all 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
.btn-edit {
|
||||
background-color: #ffc107;
|
||||
border-color: #ffc107;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.btn-edit:hover {
|
||||
background-color: #e0a800;
|
||||
border-color: #d39e00;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.btn-delete {
|
||||
background-color: #dc3545;
|
||||
border-color: #dc3545;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn-delete:hover {
|
||||
background-color: #c82333;
|
||||
border-color: #bd2130;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
padding: 3rem;
|
||||
text-align: center;
|
||||
background-color: #f8f9fa;
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
|
||||
.empty-state-icon {
|
||||
font-size: 3rem;
|
||||
color: #6c757d;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.search-box {
|
||||
max-width: 300px;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<div class="container py-4">
|
||||
<h1 class="h3 mb-4">Manage Subjects</h1>
|
||||
<!-- Course Filter -->
|
||||
<div class="course-filter">
|
||||
<form method="get" class="form-inline">
|
||||
<div class="form-group mb-3">
|
||||
<label for="course" class="form-label">Select Course</label>
|
||||
<select class="form-control" id="course" name="course">
|
||||
<option value="">All Courses</option>
|
||||
{% for course in courses %}
|
||||
<option value="{{ course.id }}"
|
||||
{% if course.id == selected_course_id %}selected{% endif %}>
|
||||
{{ course.name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div class="page-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row align-items-center">
|
||||
<div class="col">
|
||||
<h1 class="h3 mb-0">Manage Subjects</h1>
|
||||
</div>
|
||||
<!-- Duration Filter -->
|
||||
<div class="form-group mb-3">
|
||||
<label for="duration" class="form-label">Select Duration</label>
|
||||
<select class="form-control" id="duration" name="duration">
|
||||
<option value="">All Durations</option>
|
||||
<option value="1" {% if selected_duration == "1" %}selected{% endif %}>1</option>
|
||||
<option value="2" {% if selected_duration == "2" %}selected{% endif %}>2</option>
|
||||
<option value="3" {% if selected_duration == "3" %}selected{% endif %}>3</option>
|
||||
<option value="4" {% if selected_duration == "4" %}selected{% endif %}>4</option>
|
||||
<option value="5" {% if selected_duration == "5" %}selected{% endif %}>5</option>
|
||||
<option value="6" {% if selected_duration == "6" %}selected{% endif %}>6</option>
|
||||
</select>
|
||||
<div class="col-auto">
|
||||
<a href="{% url 'add_subject' %}" class="btn btn-primary">
|
||||
<i class="fas fa-plus me-1"></i> Add New Subject
|
||||
</a>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="fas fa-search"></i> Filter
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
<!-- Subjects Table -->
|
||||
{% if subjects %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%">S.N</th>
|
||||
<th width="30%">Subject Name</th>
|
||||
<th width="20%">Course Name</th>
|
||||
<th width="25%">Duration</th>
|
||||
<th width="20%">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for subject in subjects %}
|
||||
<tr>
|
||||
<td>{{ forloop.counter }}</td>
|
||||
<td>{{ subject.name }}</td>
|
||||
<td>{{ subject.course.name }}</td>
|
||||
<td>
|
||||
{{ subject.duration }}
|
||||
{% if subject.course.course_type == 'semester' %}
|
||||
Semesters
|
||||
{% else %}
|
||||
Years
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{% url 'edit_subject' subject.id %}"
|
||||
class="btn btn-action btn-edit me-2">
|
||||
<i class="fas fa-edit me-1"></i>Edit
|
||||
</a>
|
||||
<a href="{% url 'delete_subject' subject.id %}"
|
||||
class="btn btn-action btn-delete">
|
||||
<i class="fas fa-trash-alt me-1"></i>Delete
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="alert alert-info">No subjects found for the selected filters.</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<!-- Search and Filter -->
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-6">
|
||||
<div class="search-box">
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
id="subjectSearch"
|
||||
placeholder="Search subjects..." />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if subjects %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%">S.N</th>
|
||||
<th width="25%">Subject Name</th>
|
||||
<th width="20%">Course</th>
|
||||
<th width="20%">Duration</th>
|
||||
<th width="20%">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for subject in subjects %}
|
||||
<tr>
|
||||
<td>{{ forloop.counter }}</td>
|
||||
<td>{{ subject.name }}</td>
|
||||
<td>{{ subject.course.name }}</td>
|
||||
<td>
|
||||
{{ subject.duration }}
|
||||
{% if subject.course.course_type == 'semester' %}
|
||||
Semesters
|
||||
{% else %}
|
||||
Years
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{% url 'edit_subject' subject.id %}"
|
||||
class="btn btn-action btn-edit me-2">
|
||||
<i class="fas fa-edit me-1"></i>Edit
|
||||
</a>
|
||||
<a href="{% url 'delete_subject' subject.id %}"
|
||||
class="btn btn-action btn-delete">
|
||||
<i class="fas fa-trash-alt me-1"></i>Delete
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="empty-state">
|
||||
<i class="fas fa-book empty-state-icon"></i>
|
||||
<h3>No Subjects Found</h3>
|
||||
<p class="text-muted">Start by adding your first subject using the button above.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% block extrajs %}
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script>
|
||||
document
|
||||
.getElementById("subjectSearch")
|
||||
.addEventListener("keyup", function () {
|
||||
const searchText = this.value.toLowerCase();
|
||||
const tableRows = document.querySelectorAll("tbody tr");
|
||||
|
||||
tableRows.forEach((row) => {
|
||||
const subjectName = row.cells[1].textContent.toLowerCase();
|
||||
const courseName = row.cells[2].textContent.toLowerCase();
|
||||
|
||||
if (subjectName.includes(searchText) || courseName.includes(searchText)) {
|
||||
row.style.display = "";
|
||||
} else {
|
||||
row.style.display = "none";
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user