- Add Flask-Babel for internationalization - Configure app for Spanish (default) and English - Add language switcher in navigation - Wrap all UI text in templates with gettext() - Create translation directory structure - Add complete Spanish translations (58 strings) - Add English translations (template) - Compile .po to .mo files - Add extract_translations.py script for future updates - Add compile_translations.py script Spanish is now the default language, with English available via ?lang=en Translated strings include: - Navigation (Home, Add Tablet, Add User, etc.) - User Loans interface (Search, Filter, Status, etc.) - Table headers (User, Tablet, Serial Number, etc.) - Buttons (Loan, Return, Search, etc.) - Messages (No users found, No active loans, etc.) - All UI text across all templates
126 lines
6.4 KiB
HTML
126 lines
6.4 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block content %}
|
|
<div class="space-y-6">
|
|
<!-- Back Navigation -->
|
|
<div class="flex items-center gap-4">
|
|
<a href="/user_loans"
|
|
class="inline-flex items-center gap-2 px-4 py-2 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 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="M15 19l-7-7 7-7"></path>
|
|
</svg>
|
|
{{ _('Back to All Users') }}
|
|
</a>
|
|
</div>
|
|
|
|
<!-- User Header -->
|
|
<div class="bg-white rounded-lg shadow p-6">
|
|
<div class="flex flex-col sm:flex-row sm:items-center gap-4">
|
|
<div class="flex-shrink-0">
|
|
<div class="w-16 h-16 bg-green-100 rounded-full flex items-center justify-center">
|
|
<span class="text-2xl font-bold text-green-600">{{ user.name[:1].upper() }}</span>
|
|
</div>
|
|
</div>
|
|
<div class="flex-1">
|
|
<h1 class="text-xl font-bold text-gray-900">{{ user.name }}</h1>
|
|
<p class="text-gray-500">
|
|
{{ _('ID') }}: {{ user.id }} | {{ _('Identification') }}: {{ user.identification or _('N/A') }}
|
|
</p>
|
|
<div class="flex gap-4 mt-2">
|
|
<div class="flex items-center gap-2">
|
|
<span class="w-3 h-3 bg-green-500 rounded-full"></span>
|
|
<span class="text-sm text-gray-600">{{ active_count }} {{ _('Active Loans') }}</span>
|
|
</div>
|
|
<div class="flex items-center gap-2">
|
|
<span class="w-3 h-3 bg-gray-400 rounded-full"></span>
|
|
<span class="text-sm text-gray-600">{{ returned_count }} {{ _('Returned') }}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="flex gap-2">
|
|
{% if user.email %}
|
|
<a href="mailto:{{ user.email }}"
|
|
class="px-3 py-1 bg-blue-100 text-blue-700 rounded-lg text-sm hover:bg-blue-200">
|
|
{{ _('Email') }}
|
|
</a>
|
|
{% endif %}
|
|
{% if user.phone %}
|
|
<a href="tel:{{ user.phone }}"
|
|
class="px-3 py-1 bg-purple-100 text-purple-700 rounded-lg text-sm hover:bg-purple-200">
|
|
{{ _('Call') }}
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Loan History -->
|
|
<div class="bg-white rounded-lg shadow">
|
|
<div class="p-6 border-b border-gray-200">
|
|
<h2 class="text-lg font-semibold text-gray-800">{{ _('Loan History') }}</h2>
|
|
</div>
|
|
|
|
{% if loans %}
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full divide-y divide-gray-200">
|
|
<thead class="bg-gray-50">
|
|
<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">
|
|
{{ _('Loan Date') }}
|
|
</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|
{{ _('Return Date') }}
|
|
</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|
{{ _('Status') }}
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="bg-white divide-y divide-gray-200">
|
|
{% for loan in loans %}
|
|
<tr class="hover:bg-gray-50">
|
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
<div class="font-medium text-gray-900">{{ loan.brand }} {{ loan.model }}</div>
|
|
<div class="text-sm text-gray-500">{{ loan.serial_number }}</div>
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap 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 '' }}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
|
{% if loan.return_date %}
|
|
{{ loan.return_date[:10] }} {{ loan.return_date[11:16] }}
|
|
{% else %}
|
|
<span class="text-gray-400 italic">{{ _('Not returned') }}</span>
|
|
{% endif %}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full
|
|
{% if loan.status == 'active' %}bg-green-100 text-green-800
|
|
{% elif loan.status == 'returned' %}bg-gray-100 text-gray-800
|
|
{% else %}bg-yellow-100 text-yellow-800
|
|
{% endif %}">
|
|
{{ loan.status|title }}
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</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">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path>
|
|
</svg>
|
|
<p>{{ _('No loan history for this user') }}</p>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|