gmao/app_new/pronote/templates/pronote/room_planning.html

197 lines
9.8 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% extends "base.html" %}
{% block title %}Planning {{ room.name }} — GMAO{% endblock %}
{% block content %}
<div class="container-fluid">
<div class="d-flex justify-content-between align-items-center mb-4">
<div>
<h1><i class="bi bi-calendar-week"></i> Planning : {{ room.name }}</h1>
<p class="text-muted mb-0">
{% if room.room_type %}Type : <span class="badge" style="background-color: {{ room.room_type.color|hex_color }}; color: {{ room.room_type.color|text_color }};">{{ room.room_type.name }}</span>{% endif %}
{% if room.building %} | 📍 {{ room.building.name }}{% endif %}
</p>
</div>
<div>
{% if room.room_type and room.room_type.is_teaching %}
<form method="POST" action="{{ url_for('pronote.import_room_planning', room_id=room.id) }}" style="display:inline;">
<input type="hidden" name="week" value="{{ week_start.isoformat() }}">
<button type="submit" class="btn btn-outline-success">
<i class="bi bi-download"></i> Importer 3 semaines depuis Pronote
</button>
</form>
{% endif %}
<a href="{{ url_for('pronote.planning') }}" class="btn btn-outline-secondary">
<i class="bi bi-arrow-left"></i> Retour aux plannings
</a>
</div>
</div>
<!-- Navigation par semaine -->
<div class="row mb-3">
<div class="col">
<div class="d-flex align-items-center justify-content-between">
<div>
<h5 class="mb-0">
<i class="bi bi-calendar-range"></i>
Semaine du {{ week_start.strftime('%d/%m/%Y') }}
au {{ week_end.strftime('%d/%m/%Y') }}
</h5>
</div>
<div class="btn-group" role="group">
<a href="{{ url_for('pronote.room_planning', room_id=room.id, week=prev_week.isoformat()) }}"
class="btn btn-outline-primary btn-sm">
<i class="bi bi-chevron-left"></i> Semaine précédente
</a>
<a href="{{ url_for('pronote.room_planning', room_id=room.id, week=today.isoformat()) }}"
class="btn btn-outline-secondary btn-sm">
Aujourd'hui
</a>
<a href="{{ url_for('pronote.room_planning', room_id=room.id, week=next_week.isoformat()) }}"
class="btn btn-outline-primary btn-sm">
Semaine suivante <i class="bi bi-chevron-right"></i>
</a>
</div>
</div>
</div>
</div>
<!-- Comparaison planning -->
<div class="row">
<!-- Planning interne résolu -->
<div class="col-md-6">
<div class="card">
<div class="card-header bg-light">
<h5 class="mb-0">
<i class="bi bi-database"></i> Planning interne résolu
</h5>
</div>
<div class="card-body p-0">
{% if db_by_day %}
<div class="table-responsive">
<table class="table table-hover mb-0">
{% set days = ['Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi', 'Dimanche'] %}
{% for day_num in [0, 1, 2, 3, 4, 5, 6] %}
{% set day_date = week_start + timedelta(days=day_num) %}
<thead class="table-success">
<tr>
<th colspan="5" style="background-color: #d1e7dd;">
<strong>{{ days[day_num] }} {{ day_date.strftime('%d/%m') }}</strong>
</th>
</tr>
</thead>
<tbody>
{% if day_num in db_by_day %}
{% for s in db_by_day[day_num] %}
<tr>
<td style="width: 100px;"><strong>{{ s.start_time }}</strong></td>
<td>{{ s.subject or '-' }}</td>
<td>{{ s.teacher or '-' }}</td>
<td><span class="badge bg-secondary">{{ s.class_name or '-' }}</span></td>
<td><small>{% if s.source == 'pronote' %}Mis à jour par Pronote{% elif s.source == 'import' %}Importé{% else %}Saisi manuellement{% endif %}</small>{% if s.protected %}<br><small class="text-success">Conservé lors des synchronisations</small>{% endif %}{% if s.conflict_note %}<br><span class="badge bg-warning text-dark">Conflit à résoudre</span><br><small>{{ s.conflict_note }}</small>{% endif %}</td>
</tr>
{% endfor %}
{% else %}
<tr class="table-light">
<td colspan="5" class="text-center text-muted">
<em>Pas de cours</em>
</td>
</tr>
{% endif %}
</tbody>
{% endfor %}
</table>
</div>
{% else %}
<div class="p-3 text-center text-muted">
<i class="bi bi-inbox"></i><br>
Aucun créneau interne pour cette semaine.<br>
<small>Vous pouvez saisir des créneaux manuellement sans Pronote.</small>
</div>
{% endif %}
</div>
</div>
</div>
<!-- État de la source Pronote -->
<div class="col-md-6">
<div class="card">
<div class="card-header bg-light d-flex justify-content-between align-items-center">
<h5 class="mb-0">
<i class="bi bi-wifi"></i> Source Pronote
</h5>
{% if pronote_connected %}
<span class="badge bg-success">Connecté</span>
{% else %}
<span class="badge bg-secondary">Hors ligne</span>
{% endif %}
</div>
<div class="card-body p-0">
{% if pronote_connected %}
<div class="table-responsive">
<table class="table table-hover mb-0">
{% set days = ['Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi', 'Dimanche'] %}
{% for day_num in [0, 1, 2, 3, 4, 5, 6] %}
{% set day_date = week_start + timedelta(days=day_num) %}
<thead class="table-info">
<tr>
<th colspan="4" style="background-color: #cff4fc;">
<strong>{{ days[day_num] }} {{ day_date.strftime('%d/%m') }}</strong>
</th>
</tr>
</thead>
<tbody>
{% if day_num in pronote_by_day %}
{% for p in pronote_by_day[day_num] %}
<tr>
<td style="width: 100px;"><strong>{{ p.heure }}</strong></td>
<td>{{ p.matiere }}</td>
<td>{{ p.prof }}</td>
<td><span class="badge bg-info">{{ p.classe }}</span></td>
</tr>
{% endfor %}
{% else %}
<tr class="table-light">
<td colspan="4" class="text-center text-muted">
<em>Pas de cours</em>
</td>
</tr>
{% endif %}
</tbody>
{% endfor %}
</table>
</div>
{% else %}
<div class="p-3 text-center text-muted">
<i class="bi bi-exclamation-triangle"></i><br>
Pronote nest pas configuré ou momentanément indisponible.
<div class="mt-2">
<small>Le planning interne reste utilisable et conserve les dernières données connues.</small>
</div>
</div>
{% endif %}
</div>
</div>
</div>
</div>
<!-- État de synchronisation -->
{% if room.room_type and room.room_type.is_teaching %}
<div class="alert alert-info mt-3">
<div class="d-flex align-items-center">
<i class="bi bi-info-circle me-2"></i>
<div>
<strong>Synchronisation PRONote</strong>
<p class="mb-0 small">
Le planning en direct est mis à jour automatiquement depuis PRONote.
Pour importer les données localement, cliquez sur "Importer 3 semaines depuis PRONote".
</p>
</div>
</div>
</div>
{% endif %}
</div>
{% endblock %}