ScoDoc-PE/app/templates/entreprises/entreprises.html

101 lines
4.7 KiB
HTML

{# -*- mode: jinja-html -*- #}
{% extends 'base.html' %}
{% block app_content %}
{% include 'entreprises/nav.html' %}
{% if logs %}
<div class="container">
<h3>Dernières opérations <a href="{{ url_for('entreprises.logs') }}">Voir tout</a></h3>
<ul>
{% for log in logs %}
<li><span style="margin-right: 10px;">{{ log.date.strftime('%d %b %Hh%M') }}</span><span>{{ log.text|safe }} par {{ log.authenticated_user|get_nomcomplet }}</span></li>
{% endfor %}
</ul>
</div>
{% endif %}
<div class="container boutons">
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesChange, None) %}
<a class="btn btn-default" href="{{ url_for('entreprises.add_entreprise') }}">Ajouter une entreprise</a>
{% endif %}
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesExport, None) %}
<a class="btn btn-default" href="{{ url_for('entreprises.import_entreprises') }}">Importer des entreprises</a>
{% endif %}
{% if entreprises %}
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesExport, None) %}
<a class="btn btn-default" href="{{ url_for('entreprises.export_entreprises') }}">Exporter la liste des entreprises</a>
{% endif %}
{% endif %}
</div>
<div class="container">
<h1>Liste des entreprises</h1>
{% if entreprises.items %}
<div class="table-responsive">
<table class="table table-bordered table-hover">
<tr>
<th>SIRET</th>
<th>Nom</th>
<th>Adresse</th>
<th>Code postal</th>
<th>Ville</th>
<th>Pays</th>
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesChange, None) %}
<th>Action</th>
{% endif %}
</tr>
{% for entreprise in entreprises.items %}
<tr class="table-row active">
<th><a href="{{ url_for('entreprises.fiche_entreprise', id=entreprise.id) }}">{{ entreprise.siret }}</a></th>
<th>{{ entreprise.nom }}</th>
<th>{{ entreprise.adresse }}</th>
<th>{{ entreprise.codepostal }}</th>
<th>{{ entreprise.ville }}</th>
<th>{{ entreprise.pays }}</th>
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesChange, None) %}
<th>
<div class="btn-group">
<a class="btn btn-default dropdown-toggle" data-toggle="dropdown" href="#">Action
<span class="caret"></span>
</a>
<ul class="dropdown-menu pull-right">
<li><a href="{{ url_for('entreprises.edit_entreprise', id=entreprise.id) }}">Modifier</a></li>
<li><a href="{{ url_for('entreprises.delete_entreprise', id=entreprise.id) }}" style="color:red">Supprimer</a></li>
</ul>
</div>
</th>
{% endif %}
</tr>
{% endfor %}
</table>
</div>
<div class="text-center">
<a href="{{ url_for('entreprises.index', page=entreprises.prev_num) }}" class="btn btn-default {% if entreprises.page == 1 %}disabled{% endif %}">
&laquo;
</a>
{% for page_num in entreprises.iter_pages(left_edge=1, right_edge=1, left_current=1, right_current=2) %}
{% if page_num %}
{% if entreprises.page == page_num %}
<a href="{{ url_for('entreprises.index', page=page_num) }}" class="btn btn-inverse">{{ page_num }}</a>
{% else %}
<a href="{{ url_for('entreprises.index', page=page_num) }}" class="btn btn-default">{{ page_num }}</a>
{% endif %}
{% else %}
...
{% endif %}
{% endfor %}
<a href="{{ url_for('entreprises.index', page=entreprises.next_num) }}" class="btn btn-default {% if entreprises.page == entreprises.pages %}disabled{% endif %}">
&raquo;
</a>
</div>
<p class="text-center">
Page {{ entreprises.page }} sur {{ entreprises.pages }}
</p>
{% else %}
<div>Aucune entreprise présent dans la base</div>
{% endif %}
</div>
{% endblock %}