245 lines
12 KiB
HTML
245 lines
12 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}{% trans %}Classrooms{% endtrans %} - Edu-Space Admin{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="container-fluid pt-5 mt-4">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<h1 class="h3">
|
|
<i class="bi bi-door-open text-primary"></i> {% trans %}Classrooms{% endtrans %}
|
|
</h1>
|
|
<div>
|
|
<a href="{{ url_for('classrooms.add_classroom') }}" class="btn btn-primary">
|
|
<i class="bi bi-plus-circle"></i> {% trans %}Add Classroom{% endtrans %}
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Filters -->
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card border-0 shadow-sm">
|
|
<div class="card-body">
|
|
<form method="GET" class="row g-2 align-items-center">
|
|
<div class="col-md-3">
|
|
<div class="input-group input-group-sm">
|
|
<span class="input-group-text bg-body-tertiary"><i class="bi bi-search"></i></span>
|
|
<input type="text" name="search" class="form-control"
|
|
placeholder="{% trans %}Buscar aula, descripción...{% endtrans %}"
|
|
value="{{ search }}">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Filtro por Edificio -->
|
|
<div class="col-md-3">
|
|
<div class="input-group input-group-sm">
|
|
<span class="input-group-text bg-body-tertiary"><i class="bi bi-buildings text-primary"></i></span>
|
|
<select name="building_id" class="form-select form-select-sm" onchange="this.form.submit()">
|
|
<option value="">{% trans %}Todos los edificios{% endtrans %}</option>
|
|
{% for b in buildings %}
|
|
<option value="{{ b.id }}" {% if building_filter == (b.id|string) %}selected{% endif %}>{{ b.name }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Filtro por Piso -->
|
|
<div class="col-md-2">
|
|
<div class="input-group input-group-sm">
|
|
<span class="input-group-text bg-body-tertiary"><i class="bi bi-layers text-secondary"></i></span>
|
|
<select name="floor" class="form-select form-select-sm" onchange="this.form.submit()">
|
|
<option value="">{% trans %}Todos los pisos{% endtrans %}</option>
|
|
{% for f in floors %}
|
|
<option value="{{ f }}" {% if floor_filter == (f|string) %}selected{% endif %}>
|
|
{% if f == '0' or f == 'PB' %}{% trans %}Planta Baja{% endtrans %}{% else %}{% trans %}Piso{% endtrans %} {{ f }}{% endif %}
|
|
</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-2">
|
|
<div class="form-check pt-1">
|
|
<input class="form-check-input" type="checkbox" name="active_only"
|
|
id="activeOnly" {% if active_only %}checked{% endif %} onchange="this.form.submit()">
|
|
<label class="form-check-label small" for="activeOnly">
|
|
{% trans %}Solo activas{% endtrans %}
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-2 text-md-end">
|
|
<button type="submit" class="btn btn-sm btn-primary me-1">
|
|
<i class="bi bi-filter"></i> {% trans %}Filtrar{% endtrans %}
|
|
</button>
|
|
<a href="{{ url_for('classrooms.list_classrooms') }}" class="btn btn-sm btn-outline-secondary">
|
|
<i class="bi bi-x-circle"></i> {% trans %}Limpiar{% endtrans %}
|
|
</a>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Classrooms Grid -->
|
|
{% if classrooms and classrooms.items %}
|
|
<div class="row mt-4">
|
|
{% for classroom in classrooms.items %}
|
|
<div class="col-lg-4 col-md-6 mb-4">
|
|
<div class="card border-0 shadow-sm h-100">
|
|
<div class="card-body">
|
|
<div class="d-flex justify-content-between align-items-start mb-2">
|
|
<div>
|
|
<h5 class="card-title mb-1 fw-bold text-primary">
|
|
{{ classroom.code }}
|
|
</h5>
|
|
<div class="d-flex flex-wrap gap-1 mb-2">
|
|
<span class="badge bg-primary-subtle text-primary border">
|
|
<i class="bi bi-buildings me-1"></i>{{ classroom.building_name }}
|
|
</span>
|
|
<span class="badge bg-secondary-subtle text-secondary border">
|
|
<i class="bi bi-layers me-1"></i>{{ classroom.floor_display }}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<span class="badge {% if classroom.is_active %}bg-success{% else %}bg-secondary{% endif %}">
|
|
{% if classroom.is_active %}{% trans %}Active{% endtrans %}{% else %}{% trans %}Inactive{% endtrans %}{% endif %}
|
|
</span>
|
|
</div>
|
|
|
|
<div class="row small py-1 bg-body-tertiary rounded px-2 mb-2">
|
|
<div class="col-6">
|
|
<span class="text-muted">{% trans %}Capacidad{% endtrans %}:</span>
|
|
<strong>
|
|
{% if classroom.is_unlimited %}
|
|
<span class="badge bg-primary-subtle text-primary border"><i class="bi bi-infinity me-1"></i>∞</span>
|
|
{% else %}
|
|
{{ classroom.capacity }}
|
|
{% endif %}
|
|
</strong>
|
|
</div>
|
|
<div class="col-6 text-end">
|
|
<span class="text-muted">{% trans %}Ubicación{% endtrans %}:</span>
|
|
<strong class="text-truncate d-inline-block" style="max-width: 100px;">{{ classroom.floor_display }}</strong>
|
|
</div>
|
|
</div>
|
|
|
|
{% if classroom.description %}
|
|
<p class="card-text small text-muted mt-2">
|
|
{{ classroom.description[:100] }}{% if classroom.description|length > 100 %}...{% endif %}
|
|
</p>
|
|
{% endif %}
|
|
|
|
<!-- Resources indicator -->
|
|
<div class="mt-2">
|
|
<small class="text-muted">
|
|
<i class="bi bi-tools"></i>
|
|
{% if classroom.resources %}
|
|
{{ classroom.resources|length }} {% trans %}resources{% endtrans %}
|
|
{% else %}
|
|
{% trans %}No resources registered{% endtrans %}
|
|
{% endif %}
|
|
</small>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card-footer bg-body-tertiary border-0">
|
|
<div class="d-flex justify-content-between">
|
|
<div>
|
|
<a href="{{ url_for('classrooms.view_classroom', id=classroom.id) }}"
|
|
class="btn btn-sm btn-outline-primary">
|
|
<i class="bi bi-eye"></i> {% trans %}View{% endtrans %}
|
|
</a>
|
|
<a href="{{ url_for('classrooms.edit_classroom', id=classroom.id) }}"
|
|
class="btn btn-sm btn-outline-secondary">
|
|
<i class="bi bi-pencil"></i> {% trans %}Edit{% endtrans %}
|
|
</a>
|
|
</div>
|
|
<form method="POST" action="{{ url_for('classrooms.toggle_classroom', id=classroom.id) }}"
|
|
class="d-inline">
|
|
<button type="submit" class="btn btn-sm
|
|
{% if classroom.is_active %}btn-outline-warning{% else %}btn-outline-success{% endif %}">
|
|
{% if classroom.is_active %}
|
|
<i class="bi bi-pause-circle"></i> {% trans %}Deactivate{% endtrans %}
|
|
{% else %}
|
|
<i class="bi bi-play-circle"></i> {% trans %}Activate{% endtrans %}
|
|
{% endif %}
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
<!-- Pagination -->
|
|
{% if classrooms.pages > 1 %}
|
|
<nav aria-label="Classroom pagination">
|
|
<ul class="pagination justify-content-center">
|
|
{% if classrooms.has_prev %}
|
|
<li class="page-item">
|
|
<a class="page-link" href="{{ url_for('classrooms.list_classrooms', page=classrooms.prev_num, search=search, active_only=active_only) }}">
|
|
{% trans %}Previous{% endtrans %}
|
|
</a>
|
|
</li>
|
|
{% endif %}
|
|
|
|
{% for page_num in classrooms.iter_pages() %}
|
|
{% if page_num %}
|
|
{% if page_num != classrooms.page %}
|
|
<li class="page-item">
|
|
<a class="page-link" href="{{ url_for('classrooms.list_classrooms', page=page_num, search=search, active_only=active_only) }}">
|
|
{{ page_num }}
|
|
</a>
|
|
</li>
|
|
{% else %}
|
|
<li class="page-item active">
|
|
<span class="page-link">{{ page_num }}</span>
|
|
</li>
|
|
{% endif %}
|
|
{% else %}
|
|
<li class="page-item disabled">
|
|
<span class="page-link">…</span>
|
|
</li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
{% if classrooms.has_next %}
|
|
<li class="page-item">
|
|
<a class="page-link" href="{{ url_for('classrooms.list_classrooms', page=classrooms.next_num, search=search, active_only=active_only) }}">
|
|
{% trans %}Next{% endtrans %}
|
|
</a>
|
|
</li>
|
|
{% endif %}
|
|
</ul>
|
|
</nav>
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
<div class="row mt-4">
|
|
<div class="col-12">
|
|
<div class="text-center py-5">
|
|
<i class="bi bi-door-open text-muted" style="font-size: 4rem;"></i>
|
|
<h4 class="mt-3 text-muted">{% trans %}No classrooms found{% endtrans %}</h4>
|
|
<p class="text-muted">
|
|
{% if search %}
|
|
{% trans %}No classrooms match your search criteria.{% endtrans %}
|
|
{% else %}
|
|
{% trans %}No classrooms have been registered yet.{% endtrans %}
|
|
{% endif %}
|
|
</p>
|
|
<a href="{{ url_for('classrooms.add_classroom') }}" class="btn btn-primary">
|
|
<i class="bi bi-plus-circle"></i> {% trans %}Add First Classroom{% endtrans %}
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endblock %} |