1
0
forked from ScoDoc/ScoDoc
ScoDoc/app/templates/entreprises/entreprises.j2
2024-07-31 13:44:00 +02:00

143 lines
6.4 KiB
Django/Jinja

{# -*- mode: jinja-html -*- #}
{% extends 'base.j2' %}
{% block styles %}
{{super()}}
<script src="/ScoDoc/static/jQuery/jquery-1.12.4.min.js"></script>
<link rel="stylesheet" type="text/css" href="/ScoDoc/static/DataTables/datatables.min.css">
<script type="text/javascript" charset="utf8" src="/ScoDoc/static/DataTables/datatables.min.js"></script>
{% endblock %}
{% block app_content %}
{% include 'entreprises/nav.j2' %}
{% 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_by_username }}</span></li>
{% endfor %}
</ul>
</div>
{% endif %}
<div class="container boutons">
{% if current_user.has_permission(current_user.Permission.RelationsEntrepEdit, None) %}
<a class="btn btn-secondary" href="{{ url_for('entreprises.add_entreprise') }}">Ajouter une entreprise</a>
{% endif %}
{% if current_user.has_permission(current_user.Permission.RelationsEntrepExport, None) %}
<a class="btn btn-secondary" href="{{ url_for('entreprises.import_donnees') }}">Importer des données</a>
{% endif %}
{% if current_user.has_permission(current_user.Permission.RelationsEntrepExport, None) and entreprises %}
<a class="btn btn-secondary" href="{{ url_for('entreprises.export_donnees') }}">Exporter des données</a>
{% endif %}
</div>
<div class="container" style="margin-bottom: 10px;">
<h1>Liste des entreprises</h1>
{% if form %}
<form id="form-entreprise-filter" method="POST" action="">
{{ form.hidden_tag() }}
<div><input id="active" name="active" type="checkbox" onChange="form.submit()" {% if checked[0] %} checked {%
endif %}> {{ form.active.label }}</div>
<div><input id="association" name="association" type="checkbox" onChange="form.submit()" {% if checked[1] %}
checked {% endif %}> {{ form.association.label }}</div>
<div><input id="siret_provisoire" name="siret_provisoire" type="checkbox" onChange="form.submit()" {% if
checked[2] %} checked {% endif %}> {{ form.siret_provisoire.label }}</div>
</form>
{% endif %}
<table id="table-entreprises">
<thead>
<tr>
<td data-priority="2">SIRET</td>
<td data-priority="1">Nom</td>
<td data-priority="4">Adresse</td>
<td data-priority="6">Code postal</td>
<td data-priority="5">Ville</td>
<td data-priority="7">Pays</td>
{% if current_user.has_permission(current_user.Permission.RelationsEntrepEdit, None) %}
<td data-priority="3">Action</td>
{% endif %}
</tr>
</thead>
<tbody>
{% for entreprise in entreprises %}
<tr>
<td><a href="{{ url_for('entreprises.fiche_entreprise', entreprise_id=entreprise.id) }}"
style="{% if not entreprise.active %}color:red;{% endif %}{% if entreprise.siret_provisoire %}font-weight:bold;{% endif %}">{{
entreprise.siret }}</a></td>
<td>{{ entreprise.nom }}</td>
<td>{{ entreprise.adresse }}</td>
<td>{{ entreprise.codepostal }}</td>
<td>{{ entreprise.ville }}</td>
<td>{{ entreprise.pays }}</td>
{% if current_user.has_permission(current_user.Permission.RelationsEntrepEdit, None) %}
<td>
<div class="btn-group">
<a class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" href="#">Action
<span class="caret"></span>
</a>
<ul class="dropdown-menu pull-left">
<li><a
href="{{ url_for('entreprises.edit_entreprise', entreprise_id=entreprise.id) }}">Modifier</a>
</li>
{% if entreprise.active %}
<li><a href="{{ url_for('entreprises.fiche_entreprise_desactiver', entreprise_id=entreprise.id)}}"
style="color:red">Désactiver</a></li>
{% else %}
<li><a href="{{ url_for('entreprises.fiche_entreprise_activer', entreprise_id=entreprise.id)}}"
style="color:lightgreen">Activer</a></li>
{% endif %}
</ul>
</div>
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<td>SIRET</td>
<td>Nom</td>
<td>Adresse</td>
<td>Code postal</td>
<td>Ville</td>
<td>Pays</td>
{% if current_user.has_permission(current_user.Permission.RelationsEntrepEdit, None) %}
<td>Action</td>
{% endif %}
</tr>
</tfoot>
</table>
</div>
<script>
document.addEventListener('DOMContentLoaded', function () {
let table = new DataTable('#table-entreprises',
{
"autoWidth": false,
"responsive": {
"details": true
},
"pageLength": 10,
"language": {
"emptyTable": "Aucune donnée disponible dans le tableau",
"info": "Affichage de _START_ à _END_ sur _TOTAL_ entrées",
"infoEmpty": "Affichage de 0 à 0 sur 0 entrées",
"infoFiltered": "(filtrées depuis un total de _MAX_ entrées)",
"lengthMenu": "Afficher _MENU_ entrées",
"loadingRecords": "Chargement...",
"processing": "Traitement...",
"search": "Rechercher:",
"zeroRecords": "Aucune entrée correspondante trouvée",
"paginate": {
"next": "Suivante",
"previous": "Précédente"
}
}
});
});
</script>
{% endblock %}