osm-commerces/templates/public/dashboard.html.twig
2025-06-18 00:41:24 +02:00

143 lines
No EOL
5.4 KiB
Twig

{% extends 'base.html.twig' %}
{% block title %}Tableau de bord{% endblock %}
{% block stylesheets %}
{{ parent() }}
<link href='{{ asset('js/maplibre/maplibre-gl.css') }}' rel='stylesheet' />
<style>
.hidden {
display: none;
}
#mapDashboard {
height: 400px;
width: 100%;
margin-bottom: 1rem;
}
.suggestion-list {
position: absolute;
background: white;
border: 1px solid #ddd;
border-radius: 4px;
max-height: 200px;
overflow-y: auto;
width: 100%;
z-index: 1000;
}
.suggestion-item {
padding: 8px 12px;
cursor: pointer;
border-bottom: 1px solid #eee;
}
.suggestion-item:hover {
background-color: #f5f5f5;
}
.suggestion-name {
font-weight: bold;
}
.suggestion-details {
font-size: 0.9em;
color: #666;
}
.suggestion-type {
margin-right: 8px;
}
.search-container {
position: relative;
margin-bottom: 1rem;
}
</style>
{% endblock %}
{% block body %}
<div class="container">
<div class="row">
<div class="col-12">
<h1 class="mb-4">Tableau de bord</h1>
</div>
</div>
<div class="row">
<div class="col-12">
<h2>Statistiques par ville</h2>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Ville</th>
<th>Code postal</th>
<th>Complétion</th>
<th>Nombre de commerces</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for stat in stats %}
<tr>
<td><a href="{{ path('app_admin_stats', {'insee_code': stat.zone}) }}" title="Voir les statistiques de cette ville">
{{ stat.name }}
{% if not stat.name and stat.zone starts with '751' %}
Paris {{ stat.zone|slice(-2) }}e.
{% endif %}
</a></td>
<td>{{ stat.zone }}</td>
<td>{{ stat.completionPercent }}%</td>
<td>{{ stat.places|length }}</td>
<td>
<div class="btn-group" role="group">
<a href="{{ path('app_admin_stats', {'insee_code': stat.zone}) }}" class="btn btn-sm btn-primary" title="Voir les statistiques de cette ville">
<i class="bi bi-eye"></i>
</a>
<a href="{{ path('app_admin_labourer', {'insee_code': stat.zone}) }}"
class="btn btn-sm btn-success btn-labourer"
data-zip-code="{{ stat.zone }}"
title="Labourer cette ville"
>
<i class="bi bi-recycle"></i>
</a>
<a href="{{ path('app_admin_delete_by_zone', {'insee_code': stat.zone}) }}"
class="btn btn-sm btn-danger"
onclick="return confirm('Êtes-vous sûr de vouloir supprimer cette zone ?')"
title="Supprimer cette ville"
>
<i class="bi bi-trash"></i>
</a>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% include 'public/labourage-form.html.twig' %}
</div>
{% endblock %}
{% block javascripts %}
{{ parent() }}
<script src='{{ asset('js/maplibre/maplibre-gl.js') }}'></script>
<script src='{{ asset('js/utils.js') }}'></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Initialiser les tooltips Bootstrap
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl)
});
// Colorer les cellules de pourcentage
colorizePercentageCells('td:nth-child(3)');
// colorier selon le nombre de lieux
colorizePercentageCellsRelative('td:nth-child(4)', '154, 205, 50');
enableLabourageForm();
performSearch('dieppe');
});
</script>
{% endblock %}