{% extends is_mobile|yesno:"mobile/mobile_base.html,base.html" %} {% load static %} {% load i18n %} {% block head %} {% if is_edit_mode %}{% translate "Modifier le constat" %}{% else %}{% translate "Nouveau constat terrain" %}{% endif %} {% endblock head %} {% block content %}

{% if is_edit_mode %} {% translate "Modifier le constat" %} {{ finding.code }} {% else %} {% translate "Nouveau constat terrain" %} {% endif %}

{% translate "Annuler" %}
{# Alerte garantie automatique #}
{% csrf_token %} {% if next_url %}{% endif %} {{ form.lon }} {{ form.lat }} {% if form.non_field_errors or form.errors %}
{{ form.non_field_errors }} {% for field in form %} {% if field.errors %}
{{ field.label }} : {{ field.errors|join:", " }}
{% endif %} {% endfor %}
{% endif %}
{# ─── Colonne gauche : Saisie guidée rapide ─────────────────────────── #}
{# 1. Nature du constat tout en haut #}
{% translate "Nature du constat" %}
{{ form.finding_nature }}
{% for val, lbl, ic, col in nature_cards %} {% endfor %}
{# 2. Photos / Médias (mode continu WebRTC + ajout cumulatif) #}
{% translate "Photos & Pièces jointes" %}
{% if existing_media %}
{% for m in existing_media %}
{% endfor %}
{% endif %}
{# 3. Recherche symptôme (+ bouton Raccourcis) + Thématiques + Catégories #}
{% translate "Qualification rapide" %}
{# Recherche directe de symptôme + Aide au choix + Raccourcis #}
{% if has_symptom_guide %} {% endif %} {% if quick_shortcuts %} {% endif %}
{% translate "La thématique, la catégorie et la gravité seront sélectionnées automatiquement." %}
{# Panneau contextuel dynamique : variantes (surface/tunnel…), rebonds 'Voir plutôt' et consignes terrain #}

{# Thématiques en cartes visuelles (synchronisées avec #id_thematic caché ou select) #}
{{ form.thematic }}
{% for thm in thematics %}
{{ thm.name }}
{% endfor %}
{% if form.thematic.errors %}
{{ form.thematic.errors }}
{% endif %}
{# Catégorie & Sous-catégorie #}
{{ form.category }}
{# Symptôme #}
{{ form.symptom }}
{# Checklist dynamique (catégorie / thématique) #}
{% translate "Checklist" %}
{# 4. Gravité, Description & Visibilité #}
{% translate "Détails & Gravité" %}
{{ form.is_safety_hazard }}
{{ form.severity }}
{% for val, lbl, col in severity_cards %} {% endfor %}
{{ form.title }}
{{ form.visibility }}
{% translate "Interne par défaut." %}
{{ form.description }}
{# 5. Options avancées organisées en onglets sobres (Suivi réservé aux internes) #}
{# Navigation par onglets internes #}
{% if can_manage_tracking %} {% endif %}
{# Onglet 1 : Suivi, Responsable & Rattachement Projet / Marché (internes non-viewers) #} {% if can_manage_tracking %}
{% translate "Portée de suivi" %}
{{ form.tracking_scope }}
{% for val, lbl, ic in scope_cards %} {% endfor %}
{% translate "Responsable & Échéances" %}
{{ form.assigned_company }}
{{ form.due_date }}
{{ form.warranty_until }}
{% translate "Rattachement projet & marché" %}
{{ form.project }}
{{ form.phase }}
{{ form.contract }}
{% endif %} {# Onglet 2 : Indice d'état GC (masqué automatiquement pour nature=measurement / information) #}
{% translate "Indice d'état (Génie Civil 1–4)" %}
{{ form.condition_index }}
{% for val, lbl, col in condition_cards %} {% endfor %}
{% translate "Cotation technique réservée aux inspections d'ouvrages / patrimoine." %}
{# Onglet 3 : Mesures multiples #}
{% translate "Ajoutez une ou plusieurs mesures physiques (luxmètre, fissure, épaisseur, cote…)." %}
{% translate "Libellé / Point" %}
{% translate "Valeur" %}
{% translate "Unité" %}
{% translate "Référence" %}
{% translate "Aucune mesure encodée." %}
{% for meas in existing_measurements %}
{% endfor %}
{# Onglet 4 : Métrés / Quantités #}
{% translate "Encodez des quantités estimatives (Q1 × Q2 × Q3) transférables vers l'intervention." %}
{% translate "Description du poste" %}
Q1
Q2
Q3
{% translate "Aucune ligne de métré encodée." %}
{% for q in existing_quantities %}
{% endfor %}
{# ─── Colonne droite : Localisation interactive, Patrimoine & Constats proches ── #}
{% translate "Localisation & Patrimoine" %}
{% translate "Cliquez sur la carte pour placer le point ou sélectionnez un asset, une localisation ou un constat existant." %}
{# Cibles patrimoniales liées + Suggestions auto #}
{# Recherche rapide asset / localisation par code ou nom #}
{{ form.address }}
{{ form.linear_location }}
{# Modale Assistant guidé « Aide au choix du symptôme » #} {% if has_symptom_guide %} {% endif %} {# Modale Raccourcis symptômes courants #} {% if quick_shortcuts %} {% endif %} {# Modale Caméra WebRTC (mode continu Desktop & Mobile) #} {% include "findings/_camera_modal.html" %} {# Modale unifiée clic carte (Assets + Localisations + Constats existants) #}
{% endblock content %} {% block script %} {% endblock script %}