forked from ScoDoc/ScoDoc
tableau avec datatables
This commit is contained in:
parent
799f3542cc
commit
b849c350f1
@ -53,10 +53,7 @@ def index():
|
|||||||
"""
|
"""
|
||||||
Permet d'afficher une page avec la liste des entreprises et une liste des dernières opérations
|
Permet d'afficher une page avec la liste des entreprises et une liste des dernières opérations
|
||||||
"""
|
"""
|
||||||
page = request.args.get("page", 1, type=int)
|
entreprises = Entreprise.query.filter_by(visible=True)
|
||||||
entreprises = Entreprise.query.filter_by(visible=True).paginate(
|
|
||||||
page=page, per_page=10
|
|
||||||
)
|
|
||||||
logs = EntrepriseLog.query.order_by(EntrepriseLog.date.desc()).limit(LOGS_LEN).all()
|
logs = EntrepriseLog.query.order_by(EntrepriseLog.date.desc()).limit(LOGS_LEN).all()
|
||||||
return render_template(
|
return render_template(
|
||||||
"entreprises/entreprises.html",
|
"entreprises/entreprises.html",
|
||||||
@ -103,12 +100,10 @@ def contacts():
|
|||||||
"""
|
"""
|
||||||
Permet d'afficher une page la liste des contacts et une liste des dernières opérations
|
Permet d'afficher une page la liste des contacts et une liste des dernières opérations
|
||||||
"""
|
"""
|
||||||
page = request.args.get("page", 1, type=int)
|
|
||||||
contacts = (
|
contacts = (
|
||||||
db.session.query(EntrepriseContact, Entreprise)
|
db.session.query(EntrepriseContact, Entreprise)
|
||||||
.join(Entreprise, EntrepriseContact.entreprise_id == Entreprise.id)
|
.join(Entreprise, EntrepriseContact.entreprise_id == Entreprise.id)
|
||||||
.filter_by(visible=True)
|
.filter_by(visible=True)
|
||||||
.paginate(page=page, per_page=10)
|
|
||||||
)
|
)
|
||||||
logs = EntrepriseLog.query.order_by(EntrepriseLog.date.desc()).limit(LOGS_LEN).all()
|
logs = EntrepriseLog.query.order_by(EntrepriseLog.date.desc()).limit(LOGS_LEN).all()
|
||||||
return render_template(
|
return render_template(
|
||||||
@ -902,7 +897,7 @@ def import_entreprises():
|
|||||||
entreprises_import = []
|
entreprises_import = []
|
||||||
siret_list = []
|
siret_list = []
|
||||||
ligne = 0
|
ligne = 0
|
||||||
titles = ["siret", "nom_entreprise", "adresse", "ville", "codepostal", "pays"]
|
titles = ["siret", "nom", "adresse", "ville", "code_postal", "pays"]
|
||||||
if data[1][0] != titles:
|
if data[1][0] != titles:
|
||||||
flash("Veuillez utilisez la feuille excel à remplir")
|
flash("Veuillez utilisez la feuille excel à remplir")
|
||||||
return render_template(
|
return render_template(
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
{# -*- mode: jinja-html -*- #}
|
{# -*- mode: jinja-html -*- #}
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block styles %}
|
||||||
|
{{super()}}
|
||||||
|
<script src="/ScoDoc/static/jQuery/jquery-1.12.4.min.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/ScoDoc/static/DataTables2022/datatables.min.css">
|
||||||
|
<script type="text/javascript" charset="utf8" src="/ScoDoc/static/DataTables2022/datatables.min.js"></script>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block app_content %}
|
{% block app_content %}
|
||||||
{% include 'entreprises/nav.html' %}
|
{% include 'entreprises/nav.html' %}
|
||||||
|
|
||||||
@ -19,63 +26,77 @@
|
|||||||
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesExport, None) %}
|
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesExport, None) %}
|
||||||
<a class="btn btn-default" href="{{ url_for('entreprises.import_contacts') }}">Importer des contacts</a>
|
<a class="btn btn-default" href="{{ url_for('entreprises.import_contacts') }}">Importer des contacts</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesExport, None) and contacts.items %}
|
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesExport, None) and contacts %}
|
||||||
<a class="btn btn-default" href="{{ url_for('entreprises.export_contacts') }}">Exporter la liste des contacts</a>
|
<a class="btn btn-default" href="{{ url_for('entreprises.export_contacts') }}">Exporter la liste des contacts</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Liste des contacts</h1>
|
<h1>Liste des contacts</h1>
|
||||||
{% if contacts.items %}
|
<table id="table-contacts">
|
||||||
<div class="table-responsive">
|
<thead>
|
||||||
<table class="table table-bordered table-hover">
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>Nom</th>
|
<td data-priority="1">Nom</td>
|
||||||
<th>Prenom</th>
|
<td data-priority="3">Prenom</td>
|
||||||
<th>Telephone</th>
|
<td data-priority="4">Telephone</td>
|
||||||
<th>Mail</th>
|
<td data-priority="5">Mail</td>
|
||||||
<th>Poste</th>
|
<td data-priority="6">Poste</td>
|
||||||
<th>Service</th>
|
<td data-priority="7">Service</td>
|
||||||
<th>Entreprise</th>
|
<td data-priority="2">Entreprise</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% for contact in contacts.items %}
|
</thead>
|
||||||
<tr class="table-row active">
|
<tbody>
|
||||||
<th>{{ contact[0].nom }}</th>
|
{% for contact in contacts %}
|
||||||
<th>{{ contact[0].prenom }}</th>
|
<tr>
|
||||||
<th>{{ contact[0].telephone }}</th>
|
<td>{{ contact[0].nom }}</td>
|
||||||
<th>{{ contact[0].mail }}</th>
|
<td>{{ contact[0].prenom }}</td>
|
||||||
<th>{{ contact[0].poste}}</th>
|
<td>{{ contact[0].telephone }}</td>
|
||||||
<th>{{ contact[0].service}}</th>
|
<td>{{ contact[0].mail }}</td>
|
||||||
<th><a href="{{ url_for('entreprises.fiche_entreprise', id=contact[1].id) }}">{{ contact[1].nom }}</a></th>
|
<td>{{ contact[0].poste}}</td>
|
||||||
|
<td>{{ contact[0].service}}</td>
|
||||||
|
<td><a href="{{ url_for('entreprises.fiche_entreprise', id=contact[1].id) }}">{{ contact[1].nom }}</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td>Nom</td>
|
||||||
|
<td>Prenom</td>
|
||||||
|
<td>Telephone</td>
|
||||||
|
<td>Mail</td>
|
||||||
|
<td>Poste</td>
|
||||||
|
<td>Service</td>
|
||||||
|
<td>Entreprise</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-center">
|
<script>
|
||||||
<a href="{{ url_for('entreprises.contacts', page=contacts.prev_num) }}" class="btn btn-default {% if contacts.page == 1 %}disabled{% endif %}">
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
«
|
let table = new DataTable('#table-contacts',
|
||||||
</a>
|
{
|
||||||
{% for page_num in contacts.iter_pages(left_edge=1, right_edge=1, left_current=1, right_current=2) %}
|
"autoWidth": false,
|
||||||
{% if page_num %}
|
"responsive": {
|
||||||
{% if contacts.page == page_num %}
|
"details": true
|
||||||
<a href="{{ url_for('entreprises.contacts', page=page_num) }}" class="btn btn-inverse">{{ page_num }}</a>
|
},
|
||||||
{% else %}
|
"pageLength": 10,
|
||||||
<a href="{{ url_for('entreprises.contacts', page=page_num) }}" class="btn btn-default">{{ page_num }}</a>
|
"language": {
|
||||||
{% endif %}
|
"emptyTable": "Aucune donnée disponible dans le tableau",
|
||||||
{% else %}
|
"info": "Affichage de _START_ à _END_ sur _TOTAL_ entrées",
|
||||||
...
|
"infoEmpty": "Affichage de 0 à 0 sur 0 entrées",
|
||||||
{% endif %}
|
"infoFiltered": "(filtrées depuis un total de _MAX_ entrées)",
|
||||||
{% endfor %}
|
"lengthMenu": "Afficher _MENU_ entrées",
|
||||||
<a href="{{ url_for('entreprises.contacts', page=contacts.next_num) }}" class="btn btn-default {% if contacts.page == contacts.pages %}disabled{% endif %}">
|
"loadingRecords": "Chargement...",
|
||||||
»
|
"processing": "Traitement...",
|
||||||
</a>
|
"search": "Rechercher:",
|
||||||
</div>
|
"zeroRecords": "Aucune entrée correspondante trouvée",
|
||||||
<p class="text-center">
|
"paginate": {
|
||||||
Page {{ contacts.page }} sur {{ contacts.pages }}
|
"next": "Suivante",
|
||||||
</p>
|
"previous": "Précédente"
|
||||||
{% else %}
|
}
|
||||||
<div>Aucun contact présent dans la base</div>
|
}
|
||||||
{% endif %}
|
});
|
||||||
</div>
|
});
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -1,6 +1,13 @@
|
|||||||
{# -*- mode: jinja-html -*- #}
|
{# -*- mode: jinja-html -*- #}
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block styles %}
|
||||||
|
{{super()}}
|
||||||
|
<script src="/ScoDoc/static/jQuery/jquery-1.12.4.min.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/ScoDoc/static/DataTables2022/datatables.min.css">
|
||||||
|
<script type="text/javascript" charset="utf8" src="/ScoDoc/static/DataTables2022/datatables.min.js"></script>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block app_content %}
|
{% block app_content %}
|
||||||
{% include 'entreprises/nav.html' %}
|
{% include 'entreprises/nav.html' %}
|
||||||
|
|
||||||
@ -22,80 +29,93 @@
|
|||||||
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesExport, None) %}
|
{% 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>
|
<a class="btn btn-default" href="{{ url_for('entreprises.import_entreprises') }}">Importer des entreprises</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if entreprises %}
|
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesExport, None) and entreprises %}
|
||||||
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesExport, None) and entreprises.items%}
|
|
||||||
<a class="btn btn-default" href="{{ url_for('entreprises.export_entreprises') }}">Exporter la liste des entreprises</a>
|
<a class="btn btn-default" href="{{ url_for('entreprises.export_entreprises') }}">Exporter la liste des entreprises</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Liste des entreprises</h1>
|
<h1>Liste des entreprises</h1>
|
||||||
{% if entreprises.items %}
|
<table id="table-entreprises">
|
||||||
<div class="table-responsive">
|
<thead>
|
||||||
<table class="table table-bordered table-hover" style="margin-bottom:60px;">
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>SIRET</th>
|
<td data-priority="2">SIRET</td>
|
||||||
<th>Nom</th>
|
<td data-priority="1">Nom</td>
|
||||||
<th>Adresse</th>
|
<td data-priority="4">Adresse</td>
|
||||||
<th>Code postal</th>
|
<td data-priority="6">Code postal</td>
|
||||||
<th>Ville</th>
|
<td data-priority="5">Ville</td>
|
||||||
<th>Pays</th>
|
<td data-priority="7">Pays</td>
|
||||||
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesChange, None) %}
|
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesChange, None) %}
|
||||||
<th>Action</th>
|
<td data-priority="3">Action</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
{% for entreprise in entreprises.items %}
|
</thead>
|
||||||
<tr class="table-row active">
|
<tbody>
|
||||||
<th><a href="{{ url_for('entreprises.fiche_entreprise', id=entreprise.id) }}">{{ entreprise.siret }}</a></th>
|
{% for entreprise in entreprises %}
|
||||||
<th>{{ entreprise.nom }}</th>
|
<tr>
|
||||||
<th>{{ entreprise.adresse }}</th>
|
<td><a href="{{ url_for('entreprises.fiche_entreprise', id=entreprise.id) }}">{{ entreprise.siret }}</a></td>
|
||||||
<th>{{ entreprise.codepostal }}</th>
|
<td>{{ entreprise.nom }}</td>
|
||||||
<th>{{ entreprise.ville }}</th>
|
<td>{{ entreprise.adresse }}</td>
|
||||||
<th>{{ entreprise.pays }}</th>
|
<td>{{ entreprise.codepostal }}</td>
|
||||||
|
<td>{{ entreprise.ville }}</td>
|
||||||
|
<td>{{ entreprise.pays }}</td>
|
||||||
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesChange, None) %}
|
{% if current_user.has_permission(current_user.Permission.RelationsEntreprisesChange, None) %}
|
||||||
<th>
|
<td>
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<a class="btn btn-default dropdown-toggle" data-toggle="dropdown" href="#">Action
|
<a class="btn btn-default dropdown-toggle" data-toggle="dropdown" href="#">Action
|
||||||
<span class="caret"></span>
|
<span class="caret"></span>
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu pull-right">
|
<ul class="dropdown-menu pull-left">
|
||||||
<li><a href="{{ url_for('entreprises.edit_entreprise', id=entreprise.id) }}">Modifier</a></li>
|
<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>
|
<li><a href="{{ url_for('entreprises.delete_entreprise', id=entreprise.id) }}" style="color:red">Supprimer</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</th>
|
</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% 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.RelationsEntreprisesChange, None) %}
|
||||||
|
<td>Action</td>
|
||||||
|
{% endif %}
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-center">
|
<script>
|
||||||
<a href="{{ url_for('entreprises.index', page=entreprises.prev_num) }}" class="btn btn-default {% if entreprises.page == 1 %}disabled{% endif %}">
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
«
|
let table = new DataTable('#table-entreprises',
|
||||||
</a>
|
{
|
||||||
{% for page_num in entreprises.iter_pages(left_edge=1, right_edge=1, left_current=1, right_current=2) %}
|
"autoWidth": false,
|
||||||
{% if page_num %}
|
"responsive": {
|
||||||
{% if entreprises.page == page_num %}
|
"details": true
|
||||||
<a href="{{ url_for('entreprises.index', page=page_num) }}" class="btn btn-inverse">{{ page_num }}</a>
|
},
|
||||||
{% else %}
|
"pageLength": 10,
|
||||||
<a href="{{ url_for('entreprises.index', page=page_num) }}" class="btn btn-default">{{ page_num }}</a>
|
"language": {
|
||||||
{% endif %}
|
"emptyTable": "Aucune donnée disponible dans le tableau",
|
||||||
{% else %}
|
"info": "Affichage de _START_ à _END_ sur _TOTAL_ entrées",
|
||||||
...
|
"infoEmpty": "Affichage de 0 à 0 sur 0 entrées",
|
||||||
{% endif %}
|
"infoFiltered": "(filtrées depuis un total de _MAX_ entrées)",
|
||||||
{% endfor %}
|
"lengthMenu": "Afficher _MENU_ entrées",
|
||||||
<a href="{{ url_for('entreprises.index', page=entreprises.next_num) }}" class="btn btn-default {% if entreprises.page == entreprises.pages %}disabled{% endif %}">
|
"loadingRecords": "Chargement...",
|
||||||
»
|
"processing": "Traitement...",
|
||||||
</a>
|
"search": "Rechercher:",
|
||||||
</div>
|
"zeroRecords": "Aucune entrée correspondante trouvée",
|
||||||
|
"paginate": {
|
||||||
<p class="text-center">
|
"next": "Suivante",
|
||||||
Page {{ entreprises.page }} sur {{ entreprises.pages }}
|
"previous": "Précédente"
|
||||||
</p>
|
}
|
||||||
{% else %}
|
}
|
||||||
<div>Aucune entreprise présent dans la base</div>
|
});
|
||||||
{% endif %}
|
});
|
||||||
</div>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -1,6 +1,13 @@
|
|||||||
{# -*- mode: jinja-html -*- #}
|
{# -*- mode: jinja-html -*- #}
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block styles %}
|
||||||
|
{{super()}}
|
||||||
|
<script src="/ScoDoc/static/jQuery/jquery-1.12.4.min.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/ScoDoc/static/DataTables2022/datatables.min.css">
|
||||||
|
<script type="text/javascript" charset="utf8" src="/ScoDoc/static/DataTables2022/datatables.min.js"></script>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block app_content %}
|
{% block app_content %}
|
||||||
{% include 'entreprises/nav.html' %}
|
{% include 'entreprises/nav.html' %}
|
||||||
|
|
||||||
@ -17,18 +24,19 @@
|
|||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Liste des entreprises à valider</h1>
|
<h1>Liste des entreprises à valider</h1>
|
||||||
{% if entreprises %}
|
<table id="table-entreprises-validation">
|
||||||
<div class="table-responsive">
|
<thead>
|
||||||
<table class="table table-bordered table-hover">
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>SIRET</th>
|
<td data-priority="3">SIRET</td>
|
||||||
<th>Nom</th>
|
<td data-priority="1">Nom</td>
|
||||||
<th>Adresse</th>
|
<td data-priority="4">Adresse</td>
|
||||||
<th>Code postal</th>
|
<td data-priority="5">Code postal</td>
|
||||||
<th>Ville</th>
|
<td data-priority="6">Ville</td>
|
||||||
<th>Pays</th>
|
<td data-priority="7">Pays</td>
|
||||||
<th>Action</th>
|
<td data-priority="2">Action</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
{% for entreprise in entreprises %}
|
{% for entreprise in entreprises %}
|
||||||
<tr class="table-row active">
|
<tr class="table-row active">
|
||||||
<th><a href="{{ url_for('entreprises.fiche_entreprise_validation', id=entreprise.id) }}">{{ entreprise.siret }}</a></th>
|
<th><a href="{{ url_for('entreprises.fiche_entreprise_validation', id=entreprise.id) }}">{{ entreprise.siret }}</a></th>
|
||||||
@ -42,10 +50,46 @@
|
|||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td>SIRET</td>
|
||||||
|
<td>Nom</td>
|
||||||
|
<td>Adresse</td>
|
||||||
|
<td>Code postal</td>
|
||||||
|
<td>Ville</td>
|
||||||
|
<td>Pays</td>
|
||||||
|
<td>Action</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
|
||||||
<div>Aucune entreprise à valider</div>
|
<script>
|
||||||
{% endif %}
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
</div>
|
let table = new DataTable('#table-entreprises-validation',
|
||||||
|
{
|
||||||
|
"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 %}
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user