{% extends "base.html" %} {% load static %} {% load i18n %} {% load short_name %} {% load projects_tags %} {% load document_viewer_tags %} {% block head %} {% endblock head %} {% block content %}
{% if is_edit_allowed %}
{% endif %}

{% translate "Projet" %} - {{ project.code }} - {{ project.name }}

{% for thematic in project.thematics.all %} {{ thematic.name }} {% empty %} {% translate "Aucune thématique" %} {% endfor %} {% if project.begin_time %} {{ project.start_date|date:"d-m-Y" }}
{% endif %} {% if project.end_time %} {{ project.end_date|date:"d-m-Y" }}
{% endif %}

{{ project.start_date|date:"d-m-Y"|default:"..." }} {{ project.end_date|date:"d-m-Y"|default:"..." }}

{% if project.is_whole_region %}

{% translate "Toute la Région" %}

{% endif %}


{{ project.description }}

{% if project.pmo_number %} {{ project.pmo_number }} {% endif %}

{% if project.osiris_number %} {{ project.osiris_number }} {% endif %}

{% translate "Documents" %}

{% if can_add_documents %} {% endif %}
{% if can_browse_folder and document_folder %} {% endif %}
{% if use_managed_documents %} {# Nouveau système : visionneuse réutilisable avec tags + versioning #} {% render_document_viewer project_documents modal_id="projectDocViewerModal" show_tags=True show_versions=True location_id=project.id %} {% else %} {# Système hérité ProjectDocument #}
{% for document in project.documents.all %} {% private_file_url document 'file' as doc_file_url %} {% private_file_url document 'thumbnail' as doc_thumb_url %}
{% if can_add_documents %} {% endif %}
{% if document.thumbnail %} {{ document.filename }} {% else %} {{ document.filename }} {% endif %}
{{ document.upload_date|date:"d/m/Y H:i" }}
{% if document.uploaded_by %}{{ document.uploaded_by|short_name }}{% endif %}
{% endfor %}
{% endif %}
{% if can_add_documents %} {% endif %} {# Config JSON pour le JS du formulaire d'ajout #} {% if is_publiclighting_project %}

{% translate "Inventaires Éclairage Public (Excel / DXF)" %}

{% if can_import_publiclighting %} {% endif %}
{% if pl_import_sessions %}
{% for imp in pl_import_sessions %} {% endfor %}
{% translate "Session" %} {% translate "Fichiers" %} {% translate "Statut" %} {% translate "Validation" %} {% translate "Mis à jour" %} {% translate "Action" %}
{{ imp.name }} {% if imp.excel_filename %}
{{ imp.excel_filename }}
{% endif %} {% if imp.dxf_filename %}
{{ imp.dxf_filename }}
{% endif %}
{% if imp.status == 'completed' %} {% translate "Terminé" %} {% elif imp.status == 'partially_applied' %} {% translate "Partiellement appliqué" %} {% elif imp.status == 'in_review' %} {% translate "En validation" %} {% else %} {{ imp.get_status_display }} {% endif %} {% if imp.summary_stats.anomalies %} {{ imp.summary_stats.anomalies }} {% endif %}
{{ imp.summary_stats.validated|default:0 }} / {{ imp.summary_stats.total|default:0 }} {% translate "validés" %} ({{ imp.summary_stats.progress_pct|default:0 }}%)
{{ imp.updated_at|date:"d/m/Y H:i" }} {% if can_import_publiclighting %}
{% if imp.status == 'draft_config' %} {% translate "Configurer" %} {% elif imp.status == 'completed' or imp.status == 'cancelled' %} {% translate "Voir le rapport" %} {% else %} {% translate "Reprendre" %} {% endif %} {% if imp.status != 'completed' and imp.status != 'cancelled' %} {% if imp.status == 'partially_applied' %} {% translate "Abandonner cette session d'import ? Les éléments déjà appliqués seront conservés." as confirm_del_imp %}
{% csrf_token %}
{% else %} {% translate "Supprimer cette session d'import ?" as confirm_del_imp %}
{% csrf_token %}
{% endif %} {% endif %}
{% endif %}
{% else %}

{% translate "Aucun import d'inventaire d'éclairage public n'a encore été lancé pour ce projet." %}

{% endif %}
{% endif %}

{% translate "Tags" %}

{% if is_edit_allowed %} {% endif %}
{% if is_edit_allowed %}
{% csrf_token %}
{% endif %}
{% for tag in project.tags.all %}
{{ tag.name }} {% if is_edit_allowed %}
{% csrf_token %}
{% endif %}
{% empty %}

{% translate "Aucun tag associé" %}

{% endfor %}
{% if project_templates or available_templates %}

{% translate "Attributs supplémentaires" %}

{% if is_edit_allowed and available_templates %} {% endif %}
{% if is_edit_allowed and available_templates %}
{% csrf_token %}
{% endif %}
{% if not project_templates %}

{% translate "Aucun template associé" %}

{% endif %} {% for tpl_data in project_templates %}
{{ tpl_data.template.name }}
{% if is_edit_allowed %}
{% csrf_token %}
{% endif %}
{# Read-only view #}
{% if not tpl_data.attributes %}

{% translate "Aucun attribut défini pour ce template." %}

{% else %} {% for item in tpl_data.attributes %} {% endfor %}
{{ item.attr.name }} {% if item.attr.is_required %}*{% endif %} {% if item.value %} {{ item.value.display_value }} {% else %} — {% endif %}
{% endif %}
{# Edit form (hidden by default) #} {% if is_edit_allowed %}
{% for item in tpl_data.attributes %}
{% if item.attr.help_text %}
{{ item.attr.help_text }}
{% endif %} {% if item.attr.attribute_type == 'text' %} {% elif item.attr.attribute_type == 'number' %} {% elif item.attr.attribute_type == 'boolean' %}
{% with cur=item.value.value_boolean %} {% endwith %}
{% elif item.attr.attribute_type == 'choice' %} {% elif item.attr.attribute_type == 'choice_multiple' %}
{% with cur=item.value.value_choices|default:'' %} {% for ch in item.choices %} {% endfor %} {% endwith %}
{% elif item.attr.attribute_type == 'date' %} {% endif %}
{% endfor %}
{% endif %}
{% if not forloop.last %}
{% endif %} {% endfor %}
{% endif %}

{% translate "Phases" %}

{% if is_edit_allowed %} {% endif %}
{% if project.phases.all %} {% for phase in project.phases.all %}
{{ phase.name }}
{% if phase.start_date and phase.end_date %} {{ phase.start_date|date:"d-m-Y" }} - {{ phase.end_date|date:"d-m-Y" }}
{% endif %} {% if phase.contract %} {% translate "Contrat" %}: {{ phase.contract.contract_number }}
{% endif %} {% if phase.description %}
{{ phase.description|safe }}
{% endif %}
{% if is_edit_allowed %} {% endif %}
{% endfor %} {% else %}

{% translate "Aucune phase définie pour ce projet." %}

{% endif %}

{% translate "Interventions" %}

{% if can_add_interventions %} {% endif %}
{% for interv in interventions %} {% with intervention=interv.intervention %} {% endwith %} {% endfor %}
{% translate "Résumé" %} {% translate "Code" %} {% translate "Titre" %} {% translate "Début" %} {% translate "Statut" %}
{% if interv.can_view_summary %} {% endif %} {% if interv.can_view %} {{ intervention.code }} {% else %} {{ intervention.code }} {% endif %} {{ intervention.title }} {{ intervention.begin_time|date:"d-m-Y H:i" }} {{ intervention.get_status_display }}

{% translate "Commandes" %}

{% if can_manage_orders %}
{% endif %}
{% if orders %} {% for order in orders %} {% endfor %}
{% translate "Code" %} {% translate "Contrat" %} {% translate "Date de commande" %} {% translate "Date de livraison" %} {% translate "Montant total" %} {% translate "Statut" %}
{{ order.order_code }} {{ order.contract.contract_number }} {{ order.order_date|date:"d-m-Y" }} {{ order.delivery_date|date:"d-m-Y" }} {{ order.total_amount|floatformat:2 }} € {{ order.get_order_status_display }} {% if can_manage_orders %} {% endif %}
{% else %} {% endif %}

{% translate "Visites, Réceptions & Constats" %}

{{ project_visits|length }} {% translate "visite(s)" %} {{ open_findings_count }} {% translate "constat(s) ouvert(s)" %} {% if planned_findings_count %} {{ planned_findings_count }} {% translate "alloti(s)" %} {% endif %}
{{ project_visits|length }} {% translate "visite(s)" %} {{ open_findings_count }} {% translate "ouvert(s)" %} {{ planned_findings_count }} {% translate "alloti(s) au projet" %} {{ resolved_findings_count }} {% translate "levé(s) / résolu(s)" %} {% if project_reference_views %} {{ project_reference_views|length }} {% translate "plan(s) / maquette(s)" %} {% endif %}
{% if project_visits %}
{% for visit in project_visits %} {% endfor %}
{% translate "Code" %} {% translate "Date" %} {% translate "Type" %} {% translate "Titre" %} {% translate "Statut" %} {% translate "Résultat" %} {% translate "Inspecteur" %}
{{ visit.code }} {{ visit.conducted_at|date:"d/m/Y H:i" }} {{ visit.get_visit_type_display }} {{ visit.title|default:"-" }} {{ visit.get_status_display }} {{ visit.get_result_status_display }} {% if visit.inspector %}{{ visit.inspector|short_name }}{% else %}-{% endif %}
{% else %}

{% translate "Aucune visite ou réception enregistrée pour ce projet." %}

{% endif %}
{% if project_findings %}
{% for f in project_findings %} {% endfor %}
{% translate "Code" %} {% translate "Objet" %} {% translate "Gravité" %} {% translate "Statut" %} {% translate "Origine" %} {% translate "Entreprise" %} {% translate "Échéance" %}
{{ f.code }} {% if f.is_safety_hazard %} {% endif %}
{{ f.title|default:f.get_finding_nature_display }}
{% if f.is_allotted %} {% translate "Alloti au projet" %} {% endif %}
{{ f.get_severity_display }} {{ f.get_status_display }} {% if f.origin_visit %} {{ f.origin_visit.code }} {% else %} {{ f.get_origin_source_display }} {% endif %} {{ f.assigned_company.name|default:"-" }} {{ f.due_date|date:"d/m/Y"|default:"-" }}
{% else %}

{% translate "Aucun constat ni réserve associé ou alloti à ce projet." %}

{% endif %}
{% if project_reference_views %}
{% for rv in project_reference_views %}
{% if rv.view_type == 'bim_3d' %} BIM 3D {% else %} Plan 2D {% endif %} {{ rv.name }}
{% translate "Page" %} {{ rv.page_number }} {% if rv.view_type == 'plan_2d' %} • {% if rv.affine_matrix %}{% translate "Calé" %}{% else %}{% translate "Non calé" %}{% endif %} {% endif %}
{% if rv.viewer_url %} {% endif %}
{% endfor %}
{% endif %}
{% if is_edit_allowed %} {% endif %} {% if can_manage_members %}

{% translate "Permissions spécifiques" %}

{% if can_manage_members %} {% endif %}
{% for m in members %}
{{ m.user|short_name }}{% if m.can_edit %} - {% translate "Éditeur" %}{% endif %} {% if can_manage_members %} {% endif %}
{% endfor %} {% for ta in team_accesses %}
{{ ta.team.name }} ({{ ta.team.company.name }}){% if ta.can_edit %} - {% translate "Éditeur" %}{% endif %} {% if can_manage_members %} {% endif %}
{% endfor %}
{% endif %} {% if can_manage_members %} {% endif %} {% if can_manage_members %} {% endif %}
{% endblock content%} {% block script %} {{ project.lon|json_script:"lon_value" }} {{ project.lat|json_script:"lat_value" }} {{ status_choices|json_script:"status_choices" }} {{ teams_list|json_script:"teams_list_data" }} {% endblock script %}