| {% extends "base.html" %} |
| {% block title %}Dashboard β Task 1{% endblock %} |
|
|
| {% block content %} |
|
|
| |
| <div class="card" style="margin-bottom:2rem;"> |
| <h2>Upload Files</h2> |
| <p class="subtitle">Accepted formats: PDF, PNG, JPEG (max 2 files at a time)</p> |
|
|
| <form method="POST" action="/upload" enctype="multipart/form-data" id="upload-form"> |
| <div class="file-inputs"> |
| <div class="file-input-wrapper"> |
| <span>π File 1</span> |
| <input type="file" name="file1" accept=".pdf,.png,.jpg,.jpeg" required> |
| </div> |
| </div> |
| <button type="submit" class="btn btn-primary" style="margin-top:1.2rem;">β¬ Upload</button> |
| </form> |
| </div> |
|
|
| |
| <div class="card"> |
| <h2>Your Files</h2> |
| <p class="subtitle">{{ files | length }} file{{ 's' if files | length != 1 else '' }} stored</p> |
|
|
| {% if files %} |
| <div class="table-wrap"> |
| <table> |
| <thead> |
| <tr> |
| <th>#</th> |
| <th>Filename</th> |
| <th>Type</th> |
| <th>Uploaded</th> |
| <th>Actions</th> |
| </tr> |
| </thead> |
| <tbody> |
| {% for f in files %} |
| <tr> |
| <td>{{ loop.index }}</td> |
| <td>{{ f.filename }}</td> |
| <td> |
| {% set ext = f.file_type | replace('.','') %} |
| <span class="badge badge-{{ ext }}">{{ ext | upper }}</span> |
| </td> |
| <td>{{ f.upload_timestamp.strftime('%d %b %Y, %H:%M') if f.upload_timestamp else 'β' }}</td> |
| <td class="actions"> |
| <a href="/download/{{ f.id }}" class="btn btn-outline btn-sm">β¬ Download</a> |
| <form action="/delete/{{ f.id }}" method="get" style="display:inline;" |
| onsubmit="return confirm('Delete this file?')"> |
| <button type="submit" class="btn btn-danger btn-sm">π Delete</button> |
| </form> |
| </td> |
| </tr> |
| {% endfor %} |
| </tbody> |
| </table> |
| </div> |
| {% else %} |
| <div class="empty-state"> |
| <div class="icon">π</div> |
| <p>No files yet β upload your first file above!</p> |
| </div> |
| {% endif %} |
| </div> |
|
|
| {% endblock %} |
|
|