mirror of
https://forge.chapril.org/tykayn/osm-commerces
synced 2025-06-20 01:44:42 +02:00
133 lines
4.4 KiB
Twig
133 lines
4.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;
|
|
display: none;
|
|
}
|
|
.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 javascripts %}
|
|
{{ parent() }}
|
|
<script src='{{ asset('js/maplibre/maplibre-gl.js') }}'></script>
|
|
<script src="{{ asset('js/utils.js') }}"></script>
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const searchInput = document.getElementById('citySearch');
|
|
const suggestionList = document.getElementById('citySuggestions');
|
|
|
|
if (searchInput && suggestionList) {
|
|
setupCitySearch('citySearch', 'citySuggestions', function(suggestion) {
|
|
document.getElementById('selectedZipCode').value = suggestion.postcode;
|
|
});
|
|
}
|
|
});
|
|
</script>
|
|
{% 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">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h3 class="card-title">Labourer une ville</h3>
|
|
<form id="labourerForm" onsubmit="handleAddCityFormSubmit(event)">
|
|
<div class="search-container">
|
|
<input type="text"
|
|
id="citySearch"
|
|
class="form-control"
|
|
placeholder="Rechercher une ville..."
|
|
autocomplete="off">
|
|
<div id="citySuggestions" class="suggestion-list"></div>
|
|
</div>
|
|
<input type="hidden" name="zip_code" id="selectedZipCode">
|
|
<button type="submit" class="btn btn-primary mt-3">Labourer cette ville</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row mt-4">
|
|
<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>{{ stat.name }}</td>
|
|
<td>{{ stat.zone }}</td>
|
|
<td>{{ stat.completionPercent }}%</td>
|
|
<td>{{ stat.places|length }}</td>
|
|
<td>
|
|
<a href="{{ path('app_admin_stats', {'zip_code': stat.zone}) }}" class="btn btn-sm btn-primary">Voir les statistiques</a>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|