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

@ -18,43 +18,34 @@
</div>
{% if available_tablets %}
<div class="p-6 overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
{# Desktop Table (hidden on mobile) #}
<div class="table-container table-card-mobile">
<table class="table-responsive">
<thead>
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
{{ _('Brand') }}
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
{{ _('Model') }}
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
{{ _('Serial Number') }}
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
{{ _('Notes') }}
</th>
<th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">
{{ _('Actions') }}
</th>
<th>{{ _('Brand') }}</th>
<th>{{ _('Model') }}</th>
<th>{{ _('Serial Number') }}</th>
<th>{{ _('Notes') }}</th>
<th class="text-right">{{ _('Actions') }}</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<tbody>
{% for tablet in available_tablets %}
<tr class="hover:bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap">
<tr>
<td>
<div class="font-medium text-gray-900">{{ tablet.brand }}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-gray-500">
<td class="text-gray-500">
{{ tablet.model }}
</td>
<td class="px-6 py-4 whitespace-nowrap">
<td>
<code class="text-sm bg-gray-100 px-2 py-1 rounded">{{ tablet.serial_number }}</code>
</td>
<td class="px-6 py-4 whitespace-nowrap text-gray-500">
<td class="text-gray-500">
{{ tablet.notes or '-' }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-right">
<td class="text-right">
<a href="/loan_tablet?tablet_id={{ tablet.id }}"
class="inline-flex items-center gap-1 px-3 py-1 bg-green-100 text-green-700 rounded-lg text-sm hover:bg-green-200">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
@ -69,6 +60,41 @@
</tbody>
</table>
</div>
{# Mobile Cards (hidden on desktop) #}
<div class="mobile-cards hidden p-6">
{% for tablet in available_tablets %}
<div class="mobile-card">
<div class="flex justify-between items-start mb-3">
<div>
<div class="font-medium text-gray-900">{{ tablet.brand }}</div>
<div class="text-sm text-gray-500">{{ tablet.model }}</div>
</div>
<a href="/loan_tablet?tablet_id={{ tablet.id }}"
class="inline-flex items-center gap-1 px-3 py-1 bg-green-100 text-green-700 rounded-lg text-sm hover:bg-green-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="M12 6v6m0 0v6m0-6h6m-6 0H6"></path>
</svg>
{{ _('Loan') }}
</a>
</div>
<div class="space-y-2">
<div class="card-row">
<span class="card-label">{{ _('Serial Number') }}</span>
<code class="card-value text-sm bg-gray-100 px-2 py-1 rounded">{{ tablet.serial_number }}</code>
</div>
{% if tablet.notes %}
<div class="card-row">
<span class="card-label">{{ _('Notes') }}</span>
<span class="card-value text-sm">{{ tablet.notes }}</span>
</div>
{% endif %}
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="p-8 text-center text-gray-500">
<svg class="mx-auto h-12 w-12 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
@ -100,45 +126,37 @@
</div>
{% if active_loans %}
<div class="p-6 overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
{# Desktop Table (hidden on mobile) #}
<div class="table-container table-card-mobile">
<table class="table-responsive">
<thead>
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
{{ _('Tablet') }}
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
{{ _('Serial Number') }}
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
{{ _('Borrower') }}
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
{{ _('Loan Date') }}
</th>
<th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">
{{ _('Actions') }}
</th>
<th>{{ _('Tablet') }}</th>
<th>{{ _('Serial Number') }}</th>
<th>{{ _('Borrower') }}</th>
<th>{{ _('Loan Date') }}</th>
<th class="text-right">{{ _('Actions') }}</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<tbody>
{% for loan in active_loans %}
<tr class="hover:bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap">
<tr>
<td>
<div class="font-medium text-gray-900">{{ loan.brand }} {{ loan.model }}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<td>
<code class="text-sm bg-gray-100 px-2 py-1 rounded">{{ loan.serial_number }}</code>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<td>
<div class="font-medium text-gray-900">{{ loan.name }}</div>
<div class="text-sm text-gray-500">{{ loan.identification }}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
<td class="text-sm text-gray-500">
{{ loan.loan_date[:10] if loan.loan_date else _('N/A') }}
{{ loan.loan_date[11:16] if loan.loan_date else '' }}
<br>
<span class="text-xs">{{ loan.loan_date[11:16] if loan.loan_date else '' }}</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-right">
<td class="text-right">
<a href="/return_tablet/{{ loan.id }}"
class="inline-flex items-center gap-1 px-3 py-1 bg-red-100 text-red-700 rounded-lg text-sm hover:bg-red-200">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
@ -153,6 +171,46 @@
</tbody>
</table>
</div>
{# Mobile Cards (hidden on desktop) #}
<div class="mobile-cards hidden p-6">
{% for loan in active_loans %}
<div class="mobile-card">
<div class="flex justify-between items-start mb-3">
<div>
<div class="font-medium text-gray-900">{{ loan.brand }} {{ loan.model }}</div>
<div class="text-sm text-gray-500">{{ loan.name }}</div>
</div>
<a href="/return_tablet/{{ loan.id }}"
class="inline-flex items-center gap-1 px-3 py-1 bg-red-100 text-red-700 rounded-lg text-sm hover:bg-red-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="M9 5l7 7-7 7"></path>
</svg>
{{ _('Return') }}
</a>
</div>
<div class="space-y-2">
<div class="card-row">
<span class="card-label">{{ _('Serial Number') }}</span>
<code class="card-value text-sm bg-gray-100 px-2 py-1 rounded">{{ loan.serial_number }}</code>
</div>
<div class="card-row">
<span class="card-label">{{ _('Borrower') }}</span>
<div class="card-value text-right">
<div>{{ loan.name }}</div>
<div class="text-xs text-gray-500">{{ loan.identification }}</div>
</div>
</div>
<div class="card-row">
<span class="card-label">{{ _('Loan Date') }}</span>
<span class="card-value">{{ loan.loan_date[:10] if loan.loan_date else _('N/A') }}</span>
</div>
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="p-8 text-center text-gray-500">
<svg class="mx-auto h-12 w-12 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
@ -164,4 +222,12 @@
{% endif %}
</div>
</div>
<script>
// Show mobile cards on small screens
if (window.innerWidth <= 640) {
document.querySelectorAll('.table-card-mobile').forEach(el => el.style.display = 'none');
document.querySelectorAll('.mobile-cards').forEach(el => el.style.display = 'flex');
}
</script>
{% endblock %}