{% extends "base.html" %} {% block title %}{{ contract.name }} - Contrat GMAO{% endblock %} {% block content %}

{{ contract.name }}

{% if contract.contract_number %}N° {{ contract.contract_number }}{% endif %}
Modifier
Statut : {{ contract.status }} {% if contract.is_active %} — Contrat actif{% endif %} {% if contract.is_expiring_soon %} — Expire dans {{ contract.days_until_expiry }} jours{% endif %} {% if contract.must_send_notice_now %} — Preavis a envoyer avant le {{ contract.notice_deadline_calculated.strftime('%d/%m/%Y') }} {% endif %}
Entreprise
{% if contract.company %} {{ contract.company.name }} {% else %}—{% endif %}
Lot / Equipement
{% if contract.lot %}Lot: {{ contract.lot.name }}{% endif %} {% if contract.equipment %}{{ contract.equipment.name }}{% endif %} {% if not contract.lot and not contract.equipment %}—{% endif %}
Maintenance couverte par ce contrat
{% if covered_tasks %}
{% for task in covered_tasks %}{% endfor %}
Tâche / lotPériodicitéÉquipements / périmètreÉchéances
{{ task.tache or 'Tâche sans nom' }}
{{ task.lot.name if task.lot else 'Lot non défini' }}
{{ task.periodicite or (task.jours_entre_interventions|string + ' jours' if task.jours_entre_interventions else 'À définir') }}{% if task.scope_mode == 'manual' %}Sélection manuelle ({{ task.equipment_scope|length }}){% else %}Équipements actifs du lot{% endif %}{% set occurrences = covered_occurrences|selectattr('lot_task_id','equalto',task.id)|list %}{{ occurrences|length }} occurrence(s){% if occurrences %}
Dernière : {{ occurrences[0].scheduled_date.strftime('%d/%m/%Y') if occurrences[0].scheduled_date else '—' }}
{% endif %}
{% else %}

Aucune tâche préventive n'est encore rattachée à ce contrat.

{% endif %}
Visites du prestataire
Passages & contrôles
{% for visit in contract.visits %} {% else %}{% endfor %}
Date / fenêtreModeStatutCompte rendu
{{ visit.scheduled_date.strftime('%d/%m/%Y') }}{% if visit.window_end %} → {{ visit.window_end.strftime('%d/%m/%Y') }}{% endif %}{% if visit.start_time %}
{{ visit.start_time.strftime('%H:%M') }}{% if visit.end_time %}–{{ visit.end_time.strftime('%H:%M') }}{% endif %}
{% endif %}
{{ visit.display_mode }}{% if visit.accompaniment_mode != 'none' %}
Accompagnement : {{ visit.accompaniment_minutes or ('toute la durée' if visit.accompaniment_mode == 'full' else 'à définir') }}
{% endif %}
{{ visit.status|replace('_',' ') }}{{ visit.report or '—' }}{% if visit.status == 'passage_libre' %}
{% elif visit.status not in ('realisee','non_venue') %}
{% endif %}
Aucune visite générée
Dates
Signe le{{ contract.signed_date.strftime('%d/%m/%Y') if contract.signed_date else '—' }}
Date de debut{{ contract.start_date.strftime('%d/%m/%Y') if contract.start_date else '—' }}
Date de fin {% if contract.end_date %} {{ contract.end_date.strftime('%d/%m/%Y') }} {% if contract.days_until_expiry is not none %} {% if contract.days_until_expiry < 0 %}Expire {% elif contract.days_until_expiry <= 90 %}{{ contract.days_until_expiry }}j restants {% else %}({{ contract.days_until_expiry }}j){% endif %} {% endif %} {% else %}Duree indeterminee{% endif %}
Visites extérieures{% if contract.visit_interval_days %}Tous les {{ contract.visit_interval_days }} jours · prochaine visite {{ contract.next_visit_date.strftime('%d/%m/%Y') if contract.next_visit_date else 'à planifier' }}{% else %}—{% endif %}
Reconduction et preavis
Tacite reconduction {% if contract.tacit_renewal %}Oui (tous les {{ contract.renewal_period_days }} jours) {% else %}Non{% endif %}
Delai de preavis{{ contract.notice_period_days }} jours avant la fin{% if not contract.notice_period_days %}—{% endif %}
Date limite preavis {% if contract.notice_deadline_calculated %} {{ contract.notice_deadline_calculated.strftime('%d/%m/%Y') }} {% if contract.must_send_notice_now %}URGENT{% endif %} {% else %}—{% endif %}
{% if contract.annual_amount or contract.notes %}
{% if contract.annual_amount %}
Montant annuel
{{ "%.2f"|format(contract.annual_amount) }} EUR {% endif %} {% if contract.notes %}
Notes

{{ contract.notes }}

{% endif %}
{% endif %}
{% endblock %}