{% extends "facturation/base.html" %}
{% load url from future %}

{% block appbar %}
<h2>Messages Rejet/Signalement/Paiement (norme NOEMIE-PS)</h2>
    {% if noemie %}
    <a href="./">Retourner à la liste NOEMIE</a>
    {% else %}
    <a href="../..">Retourner à la facturation</a>
    {% endif %}
{% endblock %}

{% block content %}

<div id="facturation-contents">

{% if error_message %}
<p><span style="color: #f00;">Erreur : {{ error_message }}</span></p>
{% endif %}

{% if b2_is_configured %}

    {% if noemie %}
    <h1>{{ noemie.nature }} de {{ noemie.from }}</h1>
    le {{ noemie.date }}, sujet {{ noemie.subject }}

    <ul>
    {% for line in noemie.data %}
    <li>
    {{ line.description }}
    <ul>
      {% for segment in line.segments %}
      <li>{{ segment.name }} : {{ segment.value }}</li>
      {% endfor %}
    </ul>
    </li>
    {% endfor %}
    </ul>

    {% elif noemies %}
    <ul>
    {% for noemie in noemies|dictsortreversed:"date" %}
    <li><a href="{{noemie.name}}">{{noemie.date}}</a>: {{ noemie.nature }} de {{ noemie.from }} {{ noemie.subject }}
    </li>
    {% endfor %}
    </ul>
    {% endif %}

{% else %}
    <p><span style="color: #f00;">Système de transmission non configuré.</span></p>
    <p><a href="../..">Retourner à la facturation</a></p>
{% endif %}

</div>

{% endblock %}
