Spaces:
Runtime error
Runtime error
{% extends 'base.html' %} | |
{% block content %} | |
<h2 class="text-center">Student Dashboard</h2> | |
<!-- All Available PDFs Section --> | |
<div class="mt-4"> | |
<h3>All Available PDFs</h3> | |
<table class="table table-striped"> | |
<thead> | |
<tr> | |
<th>File Name</th> | |
<th>Subject</th> | |
<th>Author</th> | |
<th>Year</th> | |
<th>Actions</th> | |
</tr> | |
</thead> | |
<tbody> | |
{% for file in all_files %} | |
<tr> | |
<td>{{ file.file_name }}</td> | |
<td>{{ file.subject_name }}</td> | |
<td>{{ file.author_name }}</td> | |
<td>{{ file.year }}</td> | |
<td> | |
<a href="/uploads/{{ file.file_name }}" class="btn btn-success btn-sm">Download</a> | |
<a href="/bookmark/{{ file.id }}" class="btn btn-warning btn-sm"> | |
{% if file in bookmarked_files %} | |
Unbookmark | |
{% else %} | |
Bookmark | |
{% endif %} | |
</a> | |
</td> | |
</tr> | |
{% endfor %} | |
</tbody> | |
</table> | |
</div> | |
<!-- PDFs Uploaded by Student Section --> | |
<div class="mt-4"> | |
<h3>Your Uploaded PDFs</h3> | |
{% if user_uploaded_files %} | |
<table class="table table-striped"> | |
<thead> | |
<tr> | |
<th>File Name</th> | |
<th>Subject</th> | |
<th>Author</th> | |
<th>Year</th> | |
<th>Actions</th> | |
</tr> | |
</thead> | |
<tbody> | |
{% for file in user_uploaded_files %} | |
<tr> | |
<td>{{ file.file_name }}</td> | |
<td>{{ file.subject_name }}</td> | |
<td>{{ file.author_name }}</td> | |
<td>{{ file.year }}</td> | |
<td> | |
<a href="/uploads/{{ file.file_name }}" class="btn btn-success btn-sm">Download</a> | |
<a href="/delete/{{ file.id }}" class="btn btn-danger btn-sm">Delete</a> | |
</td> | |
</tr> | |
{% endfor %} | |
</tbody> | |
</table> | |
{% else %} | |
<p>No PDFs uploaded by you yet.</p> | |
{% endif %} | |
</div> | |
<!-- Bookmarked PDFs Section --> | |
<div class="mt-4"> | |
<h3>Your Bookmarked PDFs</h3> | |
{% if bookmarked_files %} | |
<table class="table table-striped"> | |
<thead> | |
<tr> | |
<th>File Name</th> | |
<th>Subject</th> | |
<th>Author</th> | |
<th>Year</th> | |
<th>Actions</th> | |
</tr> | |
</thead> | |
<tbody> | |
{% for file in bookmarked_files %} | |
<tr> | |
<td>{{ file.file_name }}</td> | |
<td>{{ file.subject_name }}</td> | |
<td>{{ file.author_name }}</td> | |
<td>{{ file.year }}</td> | |
<td> | |
<a href="/uploads/{{ file.file_name }}" class="btn btn-success btn-sm">Download</a> | |
<a href="/bookmark/{{ file.id }}" class="btn btn-warning btn-sm">Unbookmark</a> | |
</td> | |
</tr> | |
{% endfor %} | |
</tbody> | |
</table> | |
{% else %} | |
<p>No PDFs bookmarked yet.</p> | |
{% endif %} | |
</div> | |
<!-- Upload New PDF Section --> | |
<div class="mt-4"> | |
<h3>Upload a New PDF</h3> | |
<form method="POST" action="/upload" enctype="multipart/form-data"> | |
<div class="mb-3"> | |
<label for="file" class="form-label">File</label> | |
<input type="file" class="form-control" id="file" name="file" required> | |
</div> | |
<div class="mb-3"> | |
<label for="subject_name" class="form-label">Subject Name</label> | |
<input type="text" class="form-control" id="subject_name" name="subject_name" required> | |
</div> | |
<div class="mb-3"> | |
<label for="category" class="form-label">Category (Book/Material)</label> | |
<input type="text" class="form-control" id="category" name="category" required> | |
</div> | |
<div class="mb-3"> | |
<label for="subject_code" class="form-label">Subject Code</label> | |
<input type="text" class="form-control" id="subject_code" name="subject_code" required> | |
</div> | |
<div class="mb-3"> | |
<label for="year" class="form-label">Year</label> | |
<input type="text" class="form-control" id="year" name="year" required> | |
</div> | |
<div class="mb-3"> | |
<label for="author_name" class="form-label">Author Name</label> | |
<input type="text" class="form-control" id="author_name" name="author_name" required> | |
</div> | |
<button type="submit" class="btn btn-primary">Upload</button> | |
</form> | |
</div> | |
{% endblock %} | |