Phase 1: Responsive tables and Tailwind CSS standardization
- Added responsive table styles with mobile card layouts to base.html - Converted all templates from Bootstrap/plain CSS to Tailwind CSS - Implemented responsive tables with horizontal scroll on desktop - Added mobile card layouts for better readability on small screens - Standardized form layouts with Tailwind responsive grid - Updated all 15 templates for consistent styling: * base.html (responsive table CSS) * index.html (responsive tables + mobile cards) * students.html (Bootstrap -> Tailwind) * student_detail.html (Bootstrap -> Tailwind) * add_student.html (Bootstrap -> Tailwind) * edit_student.html (Bootstrap -> Tailwind) * import_students.html (Bootstrap -> Tailwind) * loan_tablet.html (Bootstrap -> Tailwind) * history.html (plain CSS -> Tailwind) * non_loanable_devices.html (plain CSS -> Tailwind) * add_non_loanable_device.html (plain CSS -> Tailwind) * edit_non_loanable_device.html (plain CSS -> Tailwind) * add_tablet.html (plain CSS -> Tailwind) * add_user.html (plain CSS -> Tailwind) * project_management.html (plain CSS -> Tailwind)
This commit is contained in:
parent
1b28021134
commit
06da5bdf2f
15 changed files with 1766 additions and 1229 deletions
|
|
@ -3,180 +3,199 @@
|
|||
{% block title %}{{ gettext('Students') }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h1 class="page-title">{{ gettext('Students') }}</h1>
|
||||
|
||||
<div class="mb-4">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<p class="text-muted">{{ gettext('Total students:') }} {{ total_students }}</p>
|
||||
</div>
|
||||
<div class="btn-group" role="group">
|
||||
<a href="{{ url_for('add_student') }}" class="btn btn-primary">
|
||||
<i class="bi bi-plus-circle"></i> {{ gettext('Add Student') }}
|
||||
</a>
|
||||
<a href="{{ url_for('import_students') }}" class="btn btn-secondary">
|
||||
<i class="bi bi-upload"></i> {{ gettext('Import CSV') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="space-y-6">
|
||||
{# Page Header #}
|
||||
<div class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4">
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold text-gray-900">{{ gettext('Students') }}</h1>
|
||||
<p class="text-gray-600 mt-1">{{ gettext('Total students:') }} {{ total_students }}</p>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<a href="{{ url_for('add_student') }}"
|
||||
class="inline-flex items-center gap-2 px-4 py-2 bg-cobalt-600 text-white rounded-lg hover:bg-cobalt-700 transition-colors">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path>
|
||||
</svg>
|
||||
{{ gettext('Add Student') }}
|
||||
</a>
|
||||
<a href="{{ url_for('import_students') }}"
|
||||
class="inline-flex items-center gap-2 px-4 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 transition-colors">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"></path>
|
||||
</svg>
|
||||
{{ gettext('Import CSV') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# Search and Filter Form #}
|
||||
<div class="bg-white rounded-lg shadow p-6">
|
||||
<h2 class="text-lg font-semibold text-gray-800 mb-4">{{ gettext('Search & Filter') }}</h2>
|
||||
<form method="get" action="{{ url_for('list_students') }}" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
|
||||
<div>
|
||||
<label for="search" class="block text-sm font-medium text-gray-700 mb-1">{{ gettext('Search') }}</label>
|
||||
<input type="text" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-cobalt-500 focus:border-cobalt-500"
|
||||
id="search" name="search" value="{{ search }}" placeholder="{{ gettext('Name, CIAL, NIF...') }}">
|
||||
</div>
|
||||
|
||||
<!-- Search and Filter Form -->
|
||||
<div class="card mb-4">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0">{{ gettext('Search & Filter') }}</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="get" action="{{ url_for('list_students') }}" class="row g-3">
|
||||
<div class="col-md-4">
|
||||
<label for="search" class="form-label">{{ gettext('Search') }}</label>
|
||||
<input type="text" class="form-control" id="search" name="search"
|
||||
value="{{ search }}" placeholder="{{ gettext('Name, CIAL, NIF...') }}">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label for="gender" class="form-label">{{ gettext('Gender') }}</label>
|
||||
<select class="form-select" id="gender" name="gender">
|
||||
<option value="">{{ gettext('All') }}</option>
|
||||
{% for g in genders %}
|
||||
<option value="{{ g }}" {% if gender == g %}selected{% endif %}>{{ g }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label for="group" class="form-label">{{ gettext('Study Group') }}</label>
|
||||
<select class="form-select" id="group" name="group">
|
||||
<option value="">{{ gettext('All') }}</option>
|
||||
{% for g in groups %}
|
||||
<option value="{{ g }}" {% if group == g %}selected{% endif %}>{{ g }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-2 d-flex align-items-end">
|
||||
<button type="submit" class="btn btn-primary w-100">
|
||||
<i class="bi bi-search"></i> {{ gettext('Search') }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-md-1 d-flex align-items-end">
|
||||
<a href="{{ url_for('list_students') }}" class="btn btn-secondary w-100">
|
||||
<i class="bi bi-x-circle"></i> {{ gettext('Clear') }}
|
||||
<div>
|
||||
<label for="gender" class="block text-sm font-medium text-gray-700 mb-1">{{ gettext('Gender') }}</label>
|
||||
<select class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-cobalt-500 focus:border-cobalt-500" id="gender" name="gender">
|
||||
<option value="">{{ gettext('All') }}</option>
|
||||
{% for g in genders %}
|
||||
<option value="{{ g }}" {% if gender == g %}selected{% endif %}>{{ g }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label for="group" class="block text-sm font-medium text-gray-700 mb-1">{{ gettext('Study Group') }}</label>
|
||||
<select class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-cobalt-500 focus:border-cobalt-500" id="group" name="group">
|
||||
<option value="">{{ gettext('All') }}</option>
|
||||
{% for g in groups %}
|
||||
<option value="{{ g }}" {% if group == g %}selected{% endif %}>{{ g }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex items-end gap-2">
|
||||
<button type="submit" class="flex-1 inline-flex items-center justify-center gap-2 px-4 py-2 bg-cobalt-600 text-white rounded-lg hover:bg-cobalt-700 transition-colors">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
|
||||
</svg>
|
||||
{{ gettext('Search') }}
|
||||
</button>
|
||||
<a href="{{ url_for('list_students') }}" class="inline-flex items-center gap-2 px-4 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 transition-colors">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
|
||||
</svg>
|
||||
{{ gettext('Clear') }}
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{% if students %}
|
||||
{# Desktop Table (hidden on mobile) #}
|
||||
<div class="table-container table-card-mobile">
|
||||
<table class="table-responsive">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ gettext('ID') }}</th>
|
||||
<th>{{ gettext('Name') }}</th>
|
||||
<th>{{ gettext('CIAL Code') }}</th>
|
||||
<th>{{ gettext('NIF/NIE') }}</th>
|
||||
<th>{{ gettext('Gender') }}</th>
|
||||
<th>{{ gettext('Study Group') }}</th>
|
||||
<th>{{ gettext('Birth Date') }}</th>
|
||||
<th class="text-right">{{ gettext('Actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for student in students %}
|
||||
<tr>
|
||||
<td>{{ student.id }}</td>
|
||||
<td>
|
||||
<a href="{{ url_for('student_detail', student_id=student.id) }}" class="text-cobalt-600 hover:text-cobalt-800 font-medium">
|
||||
{{ student.last_name }}, {{ student.first_name }}
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Students Table -->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0">{{ gettext('Student List') }}</h5>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>{{ gettext('ID') }}</th>
|
||||
<th>{{ gettext('Name') }}</th>
|
||||
<th>{{ gettext('CIAL Code') }}</th>
|
||||
<th>{{ gettext('NIF/NIE') }}</th>
|
||||
<th>{{ gettext('Gender') }}</th>
|
||||
<th>{{ gettext('Study Group') }}</th>
|
||||
<th>{{ gettext('Birth Date') }}</th>
|
||||
<th class="text-end">{{ gettext('Actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% if students %}
|
||||
{% for student in students %}
|
||||
<tr>
|
||||
<td>{{ student.id }}</td>
|
||||
<td>
|
||||
<a href="{{ url_for('student_detail', student_id=student.id) }}">
|
||||
{{ student.last_name }}, {{ student.first_name }}
|
||||
</a>
|
||||
</td>
|
||||
<td>{{ student.cial_code }}</td>
|
||||
<td>{{ student.nif_nie_passport or '-' }}</td>
|
||||
<td>{{ student.gender or '-' }}</td>
|
||||
<td>{{ student.study_group or '-' }}</td>
|
||||
<td>{{ student.birth_date or '-' }}</td>
|
||||
<td class="text-end">
|
||||
<div class="btn-group btn-group-sm" role="group">
|
||||
<a href="{{ url_for('student_detail', student_id=student.id) }}"
|
||||
class="btn btn-info btn-sm" title="{{ gettext('View') }}">
|
||||
<i class="bi bi-eye"></i>
|
||||
</a>
|
||||
<a href="{{ url_for('edit_student', student_id=student.id) }}"
|
||||
class="btn btn-warning btn-sm" title="{{ gettext('Edit') }}">
|
||||
<i class="bi bi-pencil"></i>
|
||||
</a>
|
||||
<a href="{{ url_for('delete_student', student_id=student.id) }}"
|
||||
class="btn btn-danger btn-sm"
|
||||
onclick="return confirm('{{ gettext('Are you sure you want to delete this student?') }}')"
|
||||
title="{{ gettext('Delete') }}">
|
||||
<i class="bi bi-trash"></i>
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="8" class="text-center text-muted">
|
||||
{{ gettext('No students found') }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
<td>
|
||||
<code class="text-sm bg-gray-100 px-2 py-1 rounded">{{ student.cial_code }}</code>
|
||||
</td>
|
||||
<td>{{ student.nif_nie_passport }}</td>
|
||||
<td>{{ student.gender }}</td>
|
||||
<td>{{ student.study_group }}</td>
|
||||
<td class="text-sm text-gray-500">{{ student.birth_date }}</td>
|
||||
<td class="text-right">
|
||||
<div class="flex justify-end gap-2">
|
||||
<a href="{{ url_for('student_detail', student_id=student.id) }}"
|
||||
class="inline-flex items-center gap-1 px-3 py-1 bg-blue-100 text-blue-700 rounded-lg text-sm hover:bg-blue-200">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path>
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"></path>
|
||||
</svg>
|
||||
{{ gettext('View') }}
|
||||
</a>
|
||||
<a href="{{ url_for('edit_student', student_id=student.id) }}"
|
||||
class="inline-flex items-center gap-1 px-3 py-1 bg-yellow-100 text-yellow-700 rounded-lg text-sm hover:bg-yellow-200">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path>
|
||||
</svg>
|
||||
{{ gettext('Edit') }}
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{# Mobile Cards (hidden on desktop) #}
|
||||
<div class="mobile-cards hidden">
|
||||
{% for student in students %}
|
||||
<div class="mobile-card">
|
||||
<div class="flex justify-between items-start mb-3">
|
||||
<div>
|
||||
<a href="{{ url_for('student_detail', student_id=student.id) }}" class="text-cobalt-600 hover:text-cobalt-800 font-medium">
|
||||
{{ student.last_name }}, {{ student.first_name }}
|
||||
</a>
|
||||
<div class="text-sm text-gray-500">{{ student.study_group }} | {{ student.gender }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Pagination -->
|
||||
{% if total_pages > 1 %}
|
||||
<div class="card-footer">
|
||||
<nav aria-label="Page navigation">
|
||||
<ul class="pagination justify-content-center mb-0">
|
||||
{% if page > 1 %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="?page={{ page - 1 }}&search={{ search }}&gender={{ gender }}&group={{ group }}">
|
||||
{{ gettext('Previous') }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% for p in range(1, total_pages + 1) %}
|
||||
{% if p == page %}
|
||||
<li class="page-item active"><span class="page-link">{{ p }}</span></li>
|
||||
{% elif p <= 3 or p > total_pages - 3 or (p >= page - 2 and p <= page + 2) %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="?page={{ p }}&search={{ search }}&gender={{ gender }}&group={{ group }}">{{ p }}</a>
|
||||
</li>
|
||||
{% elif p == 4 or p == total_pages - 3 %}
|
||||
<li class="page-item disabled"><span class="page-link">...</span></li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if page < total_pages %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="?page={{ page + 1 }}&search={{ search }}&gender={{ gender }}&group={{ group }}">
|
||||
{{ gettext('Next') }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
<div class="text-muted text-center mt-2">
|
||||
{{ gettext('Showing') }} {{ (page - 1) * per_page + 1 }}-
|
||||
{{ min(page * per_page, total_students) }} {{ gettext('of') }} {{ total_students }}
|
||||
<div class="space-y-2">
|
||||
<div class="card-row">
|
||||
<span class="card-label">{{ gettext('CIAL Code') }}</span>
|
||||
<code class="card-value text-sm bg-gray-100 px-2 py-1 rounded">{{ student.cial_code }}</code>
|
||||
</div>
|
||||
<div class="card-row">
|
||||
<span class="card-label">{{ gettext('NIF/NIE') }}</span>
|
||||
<span class="card-value">{{ student.nif_nie_passport }}</span>
|
||||
</div>
|
||||
<div class="card-row">
|
||||
<span class="card-label">{{ gettext('Birth Date') }}</span>
|
||||
<span class="card-value">{{ student.birth_date }}</span>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="flex justify-end gap-2 mt-4 pt-3 border-t border-gray-100">
|
||||
<a href="{{ url_for('student_detail', student_id=student.id) }}"
|
||||
class="inline-flex items-center gap-1 px-3 py-1 bg-blue-100 text-blue-700 rounded-lg text-sm hover:bg-blue-200">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path>
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"></path>
|
||||
</svg>
|
||||
{{ gettext('View') }}
|
||||
</a>
|
||||
<a href="{{ url_for('edit_student', student_id=student.id) }}"
|
||||
class="inline-flex items-center gap-1 px-3 py-1 bg-yellow-100 text-yellow-700 rounded-lg text-sm hover:bg-yellow-200">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path>
|
||||
</svg>
|
||||
{{ gettext('Edit') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="bg-white rounded-lg shadow p-8 text-center">
|
||||
<svg class="mx-auto h-12 w-12 text-gray-400 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197m13.5-9a2.25 2.25 0 11-4.5 0 2.25 2.25 0 014.5 0zM12 7a4 4 0 11-8 0 4 4 0 018 0z"></path>
|
||||
</svg>
|
||||
<p class="text-gray-500">{{ gettext('No students found.') }}</p>
|
||||
<a href="{{ url_for('add_student') }}"
|
||||
class="mt-4 inline-block px-4 py-2 bg-cobalt-600 text-white rounded-lg hover:bg-cobalt-700">
|
||||
{{ gettext('Add Student') }}
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Show mobile cards on small screens
|
||||
if (window.innerWidth <= 640) {
|
||||
document.querySelector('.table-card-mobile').style.display = 'none';
|
||||
document.querySelector('.mobile-cards').style.display = 'flex';
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue