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

@ -1,45 +1,149 @@
{% extends "base.html" %}
{% block content %}
<div class="section">
<h2>{{ _('Non-Loanable Devices Inventory') }}</h2>
<p>{{ _('These devices are tracked in inventory but cannot be loaned to users.') }}</p>
<a href="/add_non_loanable_device" class="btn">{{ _('Add Non-Loanable Device') }}</a>
{% if devices %}
<div class="table-container">
<table>
<thead>
<tr>
<th>{{ _('Type') }}</th>
<th>{{ _('Brand') }}</th>
<th>{{ _('Model') }}</th>
<th>{{ _('Serial Number') }}</th>
<th>{{ _('Location') }}</th>
<th>{{ _('Status') }}</th>
<th>{{ _('Actions') }}</th>
</tr>
</thead>
<tbody>
{% for device in devices %}
<tr>
<td>{{ device.device_type }}</td>
<td>{{ device.brand }}</td>
<td>{{ device.model }}</td>
<td>{{ device.serial_number }}</td>
<td>{{ device.location or '-' }}</td>
<td>{{ device.status }}</td>
<td>
<a href="/edit_non_loanable_device/{{ device.id }}" class="btn">{{ _('Edit') }}</a>
<a href="/delete_non_loanable_device/{{ device.id }}" class="btn btn-danger" onclick="return confirm('{{ _("Are you sure you want to delete this device?") }}')">{{ _('Delete') }}</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p>{{ _('No non-loanable devices registered.') }}</p>
{% endif %}
<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">{{ _('Non-Loanable Devices Inventory') }}</h1>
<p class="text-gray-600 mt-1">{{ _('These devices are tracked in inventory but cannot be loaned to users.') }}</p>
</div>
<a href="/add_non_loanable_device"
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>
{{ _('Add Non-Loanable Device') }}
</a>
</div>
{% if devices %}
{# Desktop Table (hidden on mobile) #}
<div class="table-container table-card-mobile">
<table class="table-responsive">
<thead>
<tr>
<th>{{ _('Type') }}</th>
<th>{{ _('Brand') }}</th>
<th>{{ _('Model') }}</th>
<th>{{ _('Serial Number') }}</th>
<th>{{ _('Location') }}</th>
<th>{{ _('Status') }}</th>
<th class="text-right">{{ _('Actions') }}</th>
</tr>
</thead>
<tbody>
{% for device in devices %}
<tr>
<td>{{ device.device_type }}</td>
<td>{{ device.brand }}</td>
<td>{{ device.model }}</td>
<td>
<code class="text-sm bg-gray-100 px-2 py-1 rounded">{{ device.serial_number }}</code>
</td>
<td>{{ device.location or '-' }}</td>
<td>
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium
{% if device.status == 'available' %}bg-green-100 text-green-800
{% elif device.status == 'maintenance' %}bg-yellow-100 text-yellow-800
{% else %}bg-gray-100 text-gray-800{% endif %}">
{{ device.status }}
</span>
</td>
<td class="text-right">
<div class="flex justify-end gap-2">
<a href="/edit_non_loanable_device/{{ device.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="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>
{{ _('Edit') }}
</a>
<a href="/delete_non_loanable_device/{{ device.id }}"
onclick="return confirm('{{ _("%") }}')"
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="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"></path>
</svg>
{{ _('Delete') }}
</a>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{# Mobile Cards (hidden on desktop) #}
<div class="mobile-cards hidden">
{% for device in devices %}
<div class="mobile-card">
<div class="flex justify-between items-start mb-3">
<div>
<div class="font-medium text-gray-900">{{ device.brand }} {{ device.model }}</div>
<div class="text-sm text-gray-500">{{ device.device_type }}</div>
</div>
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium
{% if device.status == 'available' %}bg-green-100 text-green-800
{% elif device.status == 'maintenance' %}bg-yellow-100 text-yellow-800
{% else %}bg-gray-100 text-gray-800{% endif %}">
{{ device.status }}
</span>
</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">{{ device.serial_number }}</code>
</div>
{% if device.location %}
<div class="card-row">
<span class="card-label">{{ _('Location') }}</span>
<span class="card-value">{{ device.location }}</span>
</div>
{% endif %}
</div>
<div class="flex justify-end gap-2 mt-4 pt-3 border-t border-gray-100">
<a href="/edit_non_loanable_device/{{ device.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="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>
{{ _('Edit') }}
</a>
<a href="/delete_non_loanable_device/{{ device.id }}"
onclick="return confirm('{{ _("%") }}')"
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="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"></path>
</svg>
{{ _('Delete') }}
</a>
</div>
</div>
{% endfor %}
</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="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z"></path>
</svg>
<p class="text-gray-500">{{ _('No non-loanable devices registered.') }}</p>
<a href="/add_non_loanable_device"
class="mt-4 inline-block px-4 py-2 bg-cobalt-600 text-white rounded-lg hover:bg-cobalt-700">
{{ _('Add Device') }}
</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 %}