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:
ijuanes 2026-06-24 15:53:55 +01:00
parent 1b28021134
commit 06da5bdf2f
15 changed files with 1766 additions and 1229 deletions

View file

@ -3,99 +3,154 @@
{% block title %}{{ gettext('Import Students from CSV') }}{% endblock %}
{% block content %}
<div class="container-fluid">
<div class="row">
<div class="col-12 col-lg-8 offset-lg-2">
<h1 class="page-title">{{ gettext('Import Students from CSV') }}</h1>
<div class="card mb-4">
<div class="card-header">
<h5 class="mb-0">{{ gettext('Instructions') }}</h5>
</div>
<div class="card-body">
<ul>
<li>{{ gettext('Upload a CSV file with student data') }}</li>
<li>{{ gettext('The file should be encoded in ISO-8859-1 (Latin-1)') }}</li>
<li>{{ gettext('Required columns: Apellidos, Nombre (will be split), C.I.A.L., Fecha Nac.') }}</li>
<li>{{ gettext('Optional columns: NIF/NIE/Pas., Registro, Expediente, Sexo, Grupo') }}</li>
<li>{{ gettext('The "Estudio" column will be discarded') }}</li>
<li>{{ gettext('Duplicate students (by CIAL code or NIF/NIE) will be skipped') }}</li>
</ul>
<p class="text-muted">
{{ gettext('Example CSV format:') }}<br>
<code>Nº Or.,"Apellidos, Nombre",Fecha Nac.,C.I.A.L.,NIF/NIE/Pas.,Registro,Expediente,Sexo,Grupo,Estudio</code>
</p>
</div>
<div class="max-w-4xl mx-auto space-y-6">
{# Page Header #}
<div>
<h1 class="text-2xl font-bold text-gray-900">{{ gettext('Import Students from CSV') }}</h1>
<p class="text-gray-600 mt-1">{{ gettext('Bulk import student data from a CSV file') }}</p>
</div>
{# Instructions Card #}
<div class="bg-white rounded-lg shadow overflow-hidden">
<div class="bg-cobalt-600 px-6 py-4">
<h2 class="text-lg font-semibold text-white">{{ gettext('Instructions') }}</h2>
</div>
<div class="p-6">
<ul class="space-y-2 text-gray-700">
<li class="flex items-start gap-2">
<svg class="w-5 h-5 text-cobalt-600 mt-0.5 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
{{ gettext('Upload a CSV file with student data') }}
</li>
<li class="flex items-start gap-2">
<svg class="w-5 h-5 text-cobalt-600 mt-0.5 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
{{ gettext('The file should be encoded in ISO-8859-1 (Latin-1)') }}
</li>
<li class="flex items-start gap-2">
<svg class="w-5 h-5 text-cobalt-600 mt-0.5 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
{{ gettext('Required columns: Apellidos, Nombre (will be split), C.I.A.L., Fecha Nac.') }}
</li>
<li class="flex items-start gap-2">
<svg class="w-5 h-5 text-cobalt-600 mt-0.5 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
{{ gettext('Optional columns: NIF/NIE/Pas., Registro, Expediente, Sexo, Grupo') }}
</li>
<li class="flex items-start gap-2">
<svg class="w-5 h-5 text-cobalt-600 mt-0.5 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
{{ gettext('The "Estudio" column will be discarded') }}
</li>
<li class="flex items-start gap-2">
<svg class="w-5 h-5 text-cobalt-600 mt-0.5 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
{{ gettext('Duplicate students (by CIAL code or NIF/NIE) will be skipped') }}
</li>
</ul>
<div class="mt-4 p-3 bg-gray-50 rounded-lg">
<p class="text-sm text-gray-600">
{{ gettext('Example CSV format:') }}<br>
<code class="text-xs bg-gray-200 px-2 py-1 rounded">Nº Or.,"Apellidos, Nombre",Fecha Nac.,C.I.A.L.,NIF/NIE/Pas.,Registro,Expediente,Sexo,Grupo,Estudio</code>
</p>
</div>
<div class="card">
<div class="card-header">
<h5 class="mb-0">{{ gettext('Upload CSV File') }}</h5>
</div>
</div>
{# Upload Form #}
<div class="bg-white rounded-lg shadow overflow-hidden">
<div class="bg-green-600 px-6 py-4">
<h2 class="text-lg font-semibold text-white">{{ gettext('Upload CSV File') }}</h2>
</div>
<div class="p-6">
<form method="POST" action="{{ url_for('import_students') }}" enctype="multipart/form-data" class="space-y-4">
<div>
<label for="csv_file" class="block text-sm font-medium text-gray-700 mb-1">{{ gettext('CSV File') }} *</label>
<input type="file" id="csv_file" name="csv_file" accept=".csv" required
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">
<p class="mt-1 text-sm text-gray-500">{{ gettext('Select a CSV file to upload') }}</p>
</div>
<div class="card-body">
<form method="POST" action="{{ url_for('import_students') }}" enctype="multipart/form-data">
<div class="mb-3">
<label for="csv_file" class="form-label">{{ gettext('CSV File') }} *</label>
<input class="form-control" type="file" id="csv_file" name="csv_file"
accept=".csv" required>
<div class="form-text">{{ gettext('Select a CSV file to upload') }}</div>
</div>
<div class="d-flex justify-content-end gap-2">
<a href="{{ url_for('list_students') }}" class="btn btn-secondary">
<i class="bi bi-x-circle"></i> {{ gettext('Cancel') }}
</a>
<button type="submit" class="btn btn-primary">
<i class="bi bi-upload"></i> {{ gettext('Import Students') }}
</button>
</div>
</form>
</div>
</div>
<!-- Sample Data Preview -->
<div class="card mt-4">
<div class="card-header">
<h5 class="mb-0">{{ gettext('Sample Data Format') }}</h5>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered table-sm mb-0">
<thead class="table-light">
<tr>
<th>{{ gettext('Nº Or.') }}</th>
<th>{{ gettext('Apellidos, Nombre') }}</th>
<th>{{ gettext('Fecha Nac.') }}</th>
<th>{{ gettext('C.I.A.L.') }}</th>
<th>{{ gettext('NIF/NIE/Pas.') }}</th>
<th>{{ gettext('Registro') }}</th>
<th>{{ gettext('Expediente') }}</th>
<th>{{ gettext('Sexo') }}</th>
<th>{{ gettext('Grupo') }}</th>
<th>{{ gettext('Estudio') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>PERIQUITA DE LOS PALOTES, JUANITA</td>
<td>24/08/2009</td>
<td>B19L64119K</td>
<td>24587243H</td>
<td>4847</td>
<td></td>
<td>M</td>
<td>1º FPB BÁSICA</td>
<td>1º CFGB Servicios Socioculturales...</td>
</tr>
</tbody>
</table>
</div>
<div class="mt-3 text-muted small">
{{ gettext('Note: The "Estudio" field will be discarded during import.') }}
</div>
<div class="flex justify-end gap-3">
<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-5 h-5" 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('Cancel') }}
</a>
<button type="submit"
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="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"></path>
</svg>
{{ gettext('Import Students') }}
</button>
</div>
</form>
</div>
</div>
{# Sample Data Preview #}
<div class="bg-white rounded-lg shadow overflow-hidden">
<div class="bg-gray-600 px-6 py-4">
<h2 class="text-lg font-semibold text-white">{{ gettext('Sample Data Format') }}</h2>
</div>
<div class="p-6">
<div class="table-container">
<table class="table-responsive">
<thead>
<tr>
<th>{{ gettext('Nº Or.') }}</th>
<th>{{ gettext('Apellidos, Nombre') }}</th>
<th>{{ gettext('Fecha Nac.') }}</th>
<th>{{ gettext('C.I.A.L.') }}</th>
<th>{{ gettext('NIF/NIE/Pas.') }}</th>
<th>{{ gettext('Registro') }}</th>
<th>{{ gettext('Expediente') }}</th>
<th>{{ gettext('Sexo') }}</th>
<th>{{ gettext('Grupo') }}</th>
<th class="text-gray-400 line-through">{{ gettext('Estudio') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>García López, María</td>
<td>15/03/2005</td>
<td>12345678A</td>
<td>12345678A</td>
<td>REG001</td>
<td>EXP001</td>
<td>F</td>
<td>2º ESO A</td>
<td class="text-gray-400 line-through">ESO</td>
</tr>
<tr>
<td>2</td>
<td>Martínez Ruiz, Carlos</td>
<td>22/07/2004</td>
<td>87654321B</td>
<td>87654321B</td>
<td>REG002</td>
<td>EXP002</td>
<td>M</td>
<td>3º ESO B</td>
<td class="text-gray-400 line-through">ESO</td>
</tr>
</tbody>
</table>
</div>
<p class="mt-3 text-sm text-gray-500">
<span class="text-gray-400 line-through">{{ gettext('Estudio') }}</span>
{{ gettext('column will be discarded during import') }}
</p>
</div>
</div>
</div>