Spaces:
No application file
No application file
| {% extends "base.html" %} | |
| {% block content %} | |
| <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem;"> | |
| <h2>π¨βπ Students</h2> | |
| <a href="{{ url_for('add_student') }}" class="btn btn-success">+ Add Student</a> | |
| </div> | |
| <!-- Search Bar --> | |
| <div class="card" style="margin-bottom: 1.5rem; padding: 1rem;"> | |
| <form method="GET" action="{{ url_for('students') }}" style="display: flex; gap: 1rem; align-items: center;"> | |
| <input type="text" | |
| name="q" | |
| value="{{ search_query or '' }}" | |
| placeholder="π Search by Student ID or Name..." | |
| style="flex: 1; padding: 0.75rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 1rem;"> | |
| <button type="submit" class="btn" style="padding: 0.75rem 1.5rem;">Search</button> | |
| {% if search_query %} | |
| <a href="{{ url_for('students') }}" class="btn" style="padding: 0.75rem 1.5rem; background: #6b7280;">Clear</a> | |
| {% endif %} | |
| </form> | |
| {% if search_query %} | |
| <div style="margin-top: 0.5rem; color: #6b7280; font-size: 0.9rem;"> | |
| Found {{ students|length }} student(s) matching "{{ search_query }}" | |
| </div> | |
| {% endif %} | |
| </div> | |
| <div class="card"> | |
| <table> | |
| <tr> | |
| <th>Student ID</th> | |
| <th>Name</th> | |
| <th>Email</th> | |
| <th>Department</th> | |
| <th>Contact</th> | |
| <th>Issued Books</th> | |
| <th>Actions</th> | |
| </tr> | |
| {% for student in students %} | |
| <tr> | |
| <td>{{ student.id }}</td> | |
| <td> | |
| <a href="{{ url_for('view_student', student_id=student.id) }}" | |
| style="color: #2563eb; text-decoration: none; font-weight: 600;"> | |
| {{ student.name }} | |
| </a> | |
| </td> | |
| <td>{{ student.email }}</td> | |
| <td>{{ student.department }}</td> | |
| <td>{{ student.contact }}</td> | |
| <td> | |
| {% set issues = student_issues.get(student.id, []) %} | |
| {% if issues %} | |
| <span style="color: #2563eb; font-weight: 600;">{{ issues|length }} active book(s)</span> | |
| <div style="margin-top: 0.5rem; font-size: 0.85rem; color: #6b7280;"> | |
| {% for issue in issues %} | |
| <div style="padding: 0.25rem 0;"> | |
| π {{ issue.book_id }} | |
| {% if issue.is_overdue() %} | |
| <span style="color: red; font-weight: bold;">β Overdue</span> | |
| {% endif %} | |
| </div> | |
| {% endfor %} | |
| </div> | |
| {% else %} | |
| <span style="color: #9ca3af;">No active books</span> | |
| {% endif %} | |
| </td> | |
| <td> | |
| <a href="{{ url_for('edit_student', student_id=student.id) }}" class="btn">Edit</a> | |
| <form method="POST" action="{{ url_for('delete_student', student_id=student.id) }}" style="display: inline;"> | |
| <button type="submit" class="btn btn-danger" onclick="return confirm('Delete?')">Delete</button> | |
| </form> | |
| </td> | |
| </tr> | |
| {% endfor %} | |
| </table> | |
| </div> | |
| {% endblock %} | |