mirror of
https://forge.chapril.org/tykayn/osm-commerces
synced 2025-06-20 01:44:42 +02:00
add local mapbox script, update objects
This commit is contained in:
parent
c6e05463b1
commit
b1f6433b7d
13 changed files with 309 additions and 182 deletions
|
@ -33,10 +33,18 @@ table.js-sort-table th:active {
|
|||
background-color: #e0e0e0;
|
||||
}
|
||||
|
||||
#mapLoader {
|
||||
position: relative;
|
||||
top: 200px;
|
||||
left: 50%;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.maplibregl-popup-content {
|
||||
overflow-y: auto;
|
||||
overflow: auto;
|
||||
min-width: 300px;
|
||||
max-height: 400px;
|
||||
|
||||
}
|
||||
|
||||
.maplibregl-popup-content h1,
|
||||
|
|
41
migrations/Version20250603172628.php
Normal file
41
migrations/Version20250603172628.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250603172628 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql(<<<'SQL'
|
||||
ALTER TABLE place ADD lat INT DEFAULT NULL
|
||||
SQL);
|
||||
$this->addSql(<<<'SQL'
|
||||
ALTER TABLE place ADD lon INT DEFAULT NULL
|
||||
SQL);
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql(<<<'SQL'
|
||||
ALTER TABLE place DROP lat
|
||||
SQL);
|
||||
$this->addSql(<<<'SQL'
|
||||
ALTER TABLE place DROP lon
|
||||
SQL);
|
||||
}
|
||||
}
|
49
public/js/mapbox/mapbox-gl.js
Normal file
49
public/js/mapbox/mapbox-gl.js
Normal file
File diff suppressed because one or more lines are too long
|
@ -92,6 +92,10 @@ final class AdminController extends AbstractController
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* rediriger vers l'url unique quand on est admin
|
||||
*/
|
||||
#[Route('/admin/commerce/{id}', name: 'app_admin_commerce')]
|
||||
public function commerce(int $id): Response
|
||||
{
|
||||
|
@ -115,6 +119,10 @@ final class AdminController extends AbstractController
|
|||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* récupérer les commerces de la zone, créer les nouveaux lieux, et mettre à jour les existants
|
||||
*/
|
||||
#[Route('/admin/labourer/{zip_code}', name: 'app_admin_labourer')]
|
||||
public function labourer_zone(string $zip_code): Response
|
||||
{
|
||||
|
@ -122,29 +130,32 @@ final class AdminController extends AbstractController
|
|||
$results = $this->motocultrice->labourer($zip_code);
|
||||
|
||||
|
||||
// Récupérer les commerces existants dans la base de données pour cette zone
|
||||
$commerces = $this->entityManager->getRepository(Place::class)->findBy(['zip_code' => $zip_code]);
|
||||
|
||||
|
||||
// Récupérer ou créer les stats pour cette zone
|
||||
$stats = $this->entityManager->getRepository(Stats::class)->findOneBy(['zone' => $zip_code]);
|
||||
|
||||
|
||||
if (!$stats) {
|
||||
$stats = new Stats();
|
||||
$stats->setZone($zip_code);
|
||||
|
||||
// for commerce, set stats
|
||||
// Récupérer les commerces existants dans la base de données pour cette zone
|
||||
|
||||
|
||||
|
||||
}
|
||||
$commerces = $stats->getPlaces();
|
||||
// for commerce, set stats
|
||||
foreach ($commerces as $commerce) {
|
||||
$commerce->setStats($stats);
|
||||
$this->entityManager->persist($commerce);
|
||||
$stats->addPlace($commerce);
|
||||
}
|
||||
|
||||
// rebuild et persist
|
||||
$stats->computeCompletionPercent();
|
||||
$this->entityManager->persist($stats);
|
||||
$this->entityManager->flush();
|
||||
}
|
||||
|
||||
// rebuild et persist
|
||||
$stats->computeCompletionPercent();
|
||||
$this->entityManager->persist($stats);
|
||||
$this->entityManager->flush();
|
||||
// Si le nom de la zone n'est pas défini, le récupérer via OSM
|
||||
if (!$stats->getName()) {
|
||||
$city_name = $this->motocultrice->get_city_osm_from_zip_code($zip_code);
|
||||
|
@ -155,9 +166,6 @@ final class AdminController extends AbstractController
|
|||
}
|
||||
}
|
||||
|
||||
$commerces = $this->entityManager->getRepository(Place::class)->findBy(['zip_code' => $zip_code]);
|
||||
|
||||
|
||||
// Initialiser les compteurs
|
||||
$counters = [
|
||||
'avec_horaires' => 0,
|
||||
|
@ -203,59 +211,80 @@ final class AdminController extends AbstractController
|
|||
|
||||
if ($commerces) {
|
||||
// Extraire les osm_object_ids des commerces existants
|
||||
$osm_object_ids = array_map(function($commerce) {
|
||||
return $commerce->getOsmId();
|
||||
}, $commerces);
|
||||
foreach ($commerces as $commerce) {
|
||||
$osm_object_ids[] = $commerce->getOsmKind() . '_' . $commerce->getOsmId();
|
||||
}
|
||||
}
|
||||
// pour chaque résultat, vérifier que l'on a pas déjà un commerce avec le même osm_object_id
|
||||
|
||||
$new_places_list = array_filter($results, function($commerce) use ($osm_object_ids) {
|
||||
return !in_array($commerce['id'], $osm_object_ids);
|
||||
return !in_array($commerce['type'] . '_' . $commerce['id'], $osm_object_ids);
|
||||
});
|
||||
$existing_places_list = array_filter($results, function($commerce) use ($osm_object_ids) {
|
||||
return in_array($commerce['id'], $osm_object_ids);
|
||||
return in_array($commerce['type'] . '_' . $commerce['id'], $osm_object_ids);
|
||||
});
|
||||
|
||||
$new_places_counter = 0;
|
||||
|
||||
// var_dump($osm_object_ids);
|
||||
// var_dump($new_places_list);
|
||||
// var_dump($existing_places_list);
|
||||
// die();
|
||||
// on crée un commerce pour chaque résultat qui reste
|
||||
foreach ($new_places_list as $np) {
|
||||
$new_place = new Place();
|
||||
|
||||
$main_tag = $this->motocultrice->find_main_tag($np['tags']);
|
||||
if( !in_array($np['id'] . '_' . $np['type'] , $osm_object_ids )) {
|
||||
$new_place = new Place();
|
||||
|
||||
$new_place
|
||||
->setUuidForUrl($this->motocultrice->uuid_create())
|
||||
->setModifiedDate(new \DateTime())
|
||||
->setStats($stats)
|
||||
->setDead(false)
|
||||
->setOptedOut(false)
|
||||
->setOsmId($np['id'])
|
||||
->setMainTag($main_tag && isset($np['tags'][$main_tag]) ? $np['tags'][$main_tag] : "")
|
||||
->setOsmKind($np['type'])
|
||||
->setAskedHumainsSupport(false)
|
||||
->setLastContactAttemptDate(null)
|
||||
->update_place_from_overpass_data($np);
|
||||
$this->entityManager->persist($new_place);
|
||||
$main_tag = $this->motocultrice->find_main_tag($np['tags']);
|
||||
|
||||
$fullMainTag = $main_tag && isset($np['tags'][$main_tag]) ? $main_tag.'='.$np['tags'][$main_tag] : "";
|
||||
var_dump($fullMainTag);
|
||||
$new_place
|
||||
->setUuidForUrl($this->motocultrice->uuid_create())
|
||||
->setModifiedDate(new \DateTime())
|
||||
->setStats($stats)
|
||||
->setDead(false)
|
||||
->setOptedOut(false)
|
||||
->setZipCode($zip_code)
|
||||
->setOsmId($np['id'])
|
||||
->setMainTag($fullMainTag)
|
||||
->setOsmKind($np['type'])
|
||||
->setAskedHumainsSupport(false)
|
||||
->setLastContactAttemptDate(null)
|
||||
->update_place_from_overpass_data($np);
|
||||
$this->entityManager->persist($new_place);
|
||||
$new_place->setStats($stats);
|
||||
|
||||
$stats->addPlace($new_place);
|
||||
$new_places_counter++;
|
||||
}
|
||||
}
|
||||
|
||||
// Mise à jour des commerces existants avec les données Overpass
|
||||
foreach ($commerces as $existing_places_list) {
|
||||
foreach ($commerces as $existing_place) {
|
||||
foreach ($results as $result) {
|
||||
if ($existing_places_list->getOsmId() == $result['id'] && $existing_places_list->getOsmKind() == $result['type']) {
|
||||
$existing_places_list->update_place_from_overpass_data($result);
|
||||
$this->entityManager->persist($existing_places_list);
|
||||
if ($existing_place->getOsmId() == $result['id'] && $existing_place->getOsmKind() == $result['type']) {
|
||||
$existing_place->update_place_from_overpass_data($result);
|
||||
$existing_place->setStats($stats);
|
||||
|
||||
$this->entityManager->persist($existing_place);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->entityManager->persist($stats);
|
||||
$this->entityManager->flush();
|
||||
|
||||
|
||||
$stats = $this->entityManager->getRepository(Stats::class)->findOneBy(['zone' => $zip_code]);
|
||||
return $this->render('admin/labourage_results.html.twig', [
|
||||
'results' => $results,
|
||||
'commerces' => $commerces,
|
||||
'commerces' => $stats->getPlaces(),
|
||||
'zone' => $zip_code,
|
||||
'stats' => $stats,
|
||||
'new_places_counter' => $new_places_counter,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -85,6 +85,12 @@ class Place
|
|||
#[ORM\Column(nullable: true)]
|
||||
private ?\DateTime $displayed_date = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $lat = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $lon = null;
|
||||
|
||||
public function getMainTag(): ?string
|
||||
{
|
||||
return $this->main_tag;
|
||||
|
@ -120,15 +126,36 @@ class Place
|
|||
}
|
||||
return round($filled_fields / $total_fields * 100);
|
||||
}
|
||||
|
||||
public function guess_main_tag(array $tags_converted) {
|
||||
$main_tag = null;
|
||||
if (isset($tags_converted['amenity']) && $tags_converted['amenity'] != '') {
|
||||
$main_tag = 'amenity='.$tags_converted['amenity'];
|
||||
}
|
||||
if (isset($tags_converted['shop']) && $tags_converted['shop'] != '') {
|
||||
$main_tag = 'shop='.$tags_converted['shop'];
|
||||
}
|
||||
if (isset($tags_converted['tourism']) && $tags_converted['tourism'] != '') {
|
||||
$main_tag = 'tourism='.$tags_converted['tourism'];
|
||||
}
|
||||
if (isset($tags_converted['office']) && $tags_converted['office'] != '') {
|
||||
$main_tag = 'office='.$tags_converted['office'];
|
||||
}
|
||||
if (isset($tags_converted['healthcare']) && $tags_converted['healthcare'] != '') {
|
||||
$main_tag = 'healthcare='.$tags_converted['healthcare'];
|
||||
}
|
||||
return $main_tag;
|
||||
}
|
||||
/**
|
||||
* mettre à jour le lieu selon les tags osm
|
||||
*/
|
||||
public function update_place_from_overpass_data(array $overpass_data) {
|
||||
|
||||
if ( ! isset($overpass_data['tags']) || $overpass_data['tags'] == null) {
|
||||
if ( ! isset($overpass_data['tags']) || $overpass_data['tags'] == null) {
|
||||
return;
|
||||
}
|
||||
// var_dump($overpass_data);
|
||||
$orignal_overpass_data = $overpass_data;
|
||||
|
||||
$overpass_data = array_merge([
|
||||
'id' => '',
|
||||
'type' => '',
|
||||
|
@ -142,61 +169,35 @@ class Place
|
|||
'wheelchair' => '',
|
||||
'note' => ''
|
||||
], $overpass_data['tags'] );
|
||||
// var_dump($overpass_data);
|
||||
|
||||
if (isset($tags_converted['amenity']) && $tags_converted['amenity'] != '') {
|
||||
$this->setMainTag('amenity='.$tags_converted['amenity']);
|
||||
}
|
||||
if (isset($tags_converted['shop']) && $tags_converted['shop'] != '') {
|
||||
$this->setMainTag('shop='.$tags_converted['shop']);
|
||||
}
|
||||
if (isset($tags_converted['tourism']) && $tags_converted['tourism'] != '') {
|
||||
$this->setMainTag('tourism='.$tags_converted['tourism']);
|
||||
}
|
||||
if (isset($tags_converted['office']) && $tags_converted['office'] != '') {
|
||||
$this->setMainTag('office='.$tags_converted['office']);
|
||||
}
|
||||
if (isset($tags_converted['healthcare']) && $tags_converted['healthcare'] != '') {
|
||||
$this->setMainTag('healthcare='.$tags_converted['healthcare']);
|
||||
}
|
||||
|
||||
|
||||
$main_tag = $this->guess_main_tag($orignal_overpass_data['tags']);
|
||||
if($main_tag){
|
||||
$this->setMainTag($main_tag);
|
||||
}
|
||||
$this
|
||||
// ->setOsmId($overpass_data['id'])
|
||||
// ->setOsmKind($overpass_data['type'] )
|
||||
->setOsmId( $orignal_overpass_data['id'])
|
||||
->setOsmKind($orignal_overpass_data['type'] )
|
||||
->setLat($orignal_overpass_data['lat'])
|
||||
->setLon($orignal_overpass_data['lon'])
|
||||
->setName(isset($overpass_data['name']) && $overpass_data['name'] != '' ? $overpass_data['name'] : null);
|
||||
|
||||
if (isset($overpass_data['postcode']) && $overpass_data['postcode'] != ''){
|
||||
$this->setZipCode($overpass_data['postcode']);
|
||||
}
|
||||
if (isset($overpass_data['email']) && $overpass_data['email'] != ''){
|
||||
$this->setEmail($overpass_data['email']);
|
||||
}
|
||||
if (isset($overpass_data['tags']['opening_hours']) && $overpass_data['opening_hours'] != ''){
|
||||
$this->setHasOpeningHours($overpass_data['opening_hours']);
|
||||
}
|
||||
if (isset($overpass_data['tags']) && isset($overpass_data['tags']['note']) && $overpass_data['tags']['note'] != ''){
|
||||
$this->setNote($overpass_data['tags']['note']);
|
||||
}
|
||||
if (isset($overpass_data['tags']) && isset($overpass_data['tags']['addr:housenumber']) && $overpass_data['tags']['addr:housenumber'] != ''){
|
||||
$this->setHasAddress($overpass_data['tags']['addr:housenumber']);
|
||||
}
|
||||
if (isset($overpass_data['tags']) && isset($overpass_data['tags']['website']) && $overpass_data['tags']['website'] != ''){
|
||||
$this->setHasWebsite($overpass_data['tags']['website']);
|
||||
}
|
||||
if (isset($overpass_data['tags']) && isset($overpass_data['tags']['wheelchair']) && $overpass_data['tags']['wheelchair'] != ''){
|
||||
$this->setHasWheelchair($overpass_data['tags']['wheelchair']);
|
||||
}
|
||||
if (isset($overpass_data['tags']) && isset($overpass_data['tags']['note']) && $overpass_data['tags']['note'] != ''){
|
||||
$this->setHasNote($overpass_data['tags']['note']);
|
||||
}
|
||||
if (isset($overpass_data['tags']) && isset($overpass_data['tags']['note']) && $overpass_data['tags']['note'] != ''){
|
||||
$this->setHasNote($overpass_data['tags']['note']);
|
||||
$this->setNoteContent($overpass_data['tags']['note']);
|
||||
}
|
||||
$mapping = [
|
||||
['key' => 'postcode', 'setter' => 'setZipCode', 'source' => $overpass_data],
|
||||
['key' => 'email', 'setter' => 'setEmail', 'source' => $overpass_data],
|
||||
['key' => 'opening_hours', 'setter' => 'setHasOpeningHours', 'source' => $overpass_data['tags'] ?? []],
|
||||
['key' => 'note', 'setter' => 'setNote', 'source' => $overpass_data['tags'] ?? []],
|
||||
['key' => 'addr:housenumber', 'setter' => 'setHasAddress', 'source' => $overpass_data['tags'] ?? []],
|
||||
['key' => 'website', 'setter' => 'setHasWebsite', 'source' => $overpass_data['tags'] ?? []],
|
||||
['key' => 'wheelchair', 'setter' => 'setHasWheelchair', 'source' => $overpass_data['tags'] ?? []],
|
||||
['key' => 'note', 'setter' => 'setHasNote', 'source' => $overpass_data['tags'] ?? []],
|
||||
];
|
||||
|
||||
|
||||
// Remplir les clés attendues avec des valeurs par défaut si non définies
|
||||
|
||||
foreach ($mapping as $map) {
|
||||
if (isset($map['source'][$map['key']]) && $map['source'][$map['key']] !== '') {
|
||||
$this->{$map['setter']}($map['source'][$map['key']]);
|
||||
}
|
||||
}
|
||||
|
||||
$this
|
||||
// ->setOsmId($overpass_data['id'])
|
||||
|
@ -506,4 +507,28 @@ class Place
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLat(): ?int
|
||||
{
|
||||
return $this->lat;
|
||||
}
|
||||
|
||||
public function setLat(?int $lat): static
|
||||
{
|
||||
$this->lat = $lat;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLon(): ?int
|
||||
{
|
||||
return $this->lon;
|
||||
}
|
||||
|
||||
public function setLon(?int $lon): static
|
||||
{
|
||||
$this->lon = $lon;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ class Stats
|
|||
/**
|
||||
* @var Collection<int, Place>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: Place::class, mappedBy: 'stats')]
|
||||
#[ORM\OneToMany(targetEntity: Place::class, mappedBy: 'stats', cascade: ['persist', 'remove'])]
|
||||
private Collection $places;
|
||||
|
||||
// nombre de commerces dans la zone
|
||||
|
|
|
@ -9,17 +9,17 @@
|
|||
</style>
|
||||
|
||||
<div class="example-wrapper">
|
||||
<h1>Labourage fait sur la zone "{{ zone }}" ✅</h1>
|
||||
<h1>Labourage fait sur la zone "{{ stats.zone }} {{stats.name}}" ✅</h1>
|
||||
<a href="{{ path('app_admin_labourer', {'zip_code': stats.zone}) }}" class="btn btn-primary" id="labourer">Labourer les mises à jour</a>
|
||||
<a href="{{ path('app_admin_stats', {'zip_code': stats.zone}) }}" class="btn btn-primary" id="labourer">Voir les résultats</a>
|
||||
|
||||
<p>
|
||||
lieux trouvés en plus: {{ results|length }}
|
||||
lieux trouvés en plus: {{ new_places_counter }}
|
||||
</p>
|
||||
|
||||
{# {{ dump(results) }} #}
|
||||
<hr>
|
||||
|
||||
|
||||
<p>
|
||||
commerces existants déjà en base: {{ commerces|length }}
|
||||
</p>
|
||||
|
@ -30,49 +30,7 @@ commerces existants déjà en base: {{ commerces|length }}
|
|||
|
||||
<tbody>
|
||||
{% for commerce in commerces %}
|
||||
<tr>
|
||||
<td>
|
||||
{# {{ dump(commerce) }} #}
|
||||
<a href="{{ path('app_admin_commerce',
|
||||
{
|
||||
'id': commerce.id
|
||||
}
|
||||
) }}">
|
||||
{% if commerce.name is not null and commerce.name != '' %}
|
||||
{{ commerce.name }},
|
||||
{% else %}
|
||||
(un lieu sans nom)
|
||||
{% endif %}
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
<td>
|
||||
{{ commerce.address }}
|
||||
</td>
|
||||
<td>
|
||||
{{ commerce.email }}
|
||||
</td>
|
||||
<td>
|
||||
{{ commerce.website }}
|
||||
</td>
|
||||
<td>
|
||||
{# {{ commerce.opening_hours }} #}
|
||||
</td>
|
||||
<td>
|
||||
{{ commerce.note }}
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://www.openstreetmap.org/{{ commerce.getOsmKind() }}/{{ commerce.getOsmId() }}" target="_blank">
|
||||
<i class="bi bi-eye"></i>
|
||||
voir sur osm</a>
|
||||
<a href="{{ path('app_admin_delete', {'id': commerce.id}) }}">
|
||||
<i class="bi bi-trash"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% include 'admin/stats/row.html.twig' %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}{{ 'display.stats'|trans }}{% endblock %}
|
||||
{% block title %}{{ 'display.stats'|trans }}- {{ stats.zone }}
|
||||
{{ stats.name }} {% endblock %}
|
||||
|
||||
{% block stylesheets %}
|
||||
{{ parent() }}
|
||||
|
@ -10,12 +11,15 @@
|
|||
{% block body %}
|
||||
<div class="container">
|
||||
<div class="mt-4 p-4">
|
||||
<h1 class="title">{{ 'display.stats'|trans }}</h1>
|
||||
<p>
|
||||
{{ stats.zone }}
|
||||
{{ stats.name }}
|
||||
</p>
|
||||
<a href="{{ path('app_admin_labourer', {'zip_code': stats.zone}) }}" class="btn btn-primary" id="labourer">Labourer les mises à jour</a>
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-12">
|
||||
<h1 class="title">{{ 'display.stats'|trans }} - {{ stats.zone }}
|
||||
{{ stats.name }} - {{ stats.completionPercent }}% complété</h1>
|
||||
</div>
|
||||
<div class="col-md-6 col-12">
|
||||
<a href="{{ path('app_admin_labourer', {'zip_code': stats.zone}) }}" class="btn btn-primary" id="labourer">Labourer les mises à jour</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-3 col-12">
|
||||
{{ stats.getCompletionPercent() }} % complété sur les critères donnés.
|
||||
|
@ -41,16 +45,28 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="map" style="height: 400px;"></div>
|
||||
|
||||
{# <div id="query" style="height: 400px;"> #}
|
||||
{# <pre>
|
||||
{{query_places|raw}}
|
||||
</pre> #}
|
||||
<div id="maploader">
|
||||
<div class="spinner-border" role="status">
|
||||
<i class="bi bi-load bi-spin"></i>
|
||||
<span class="visually-hidden">Chargement de la carte...</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="map" style="height: 400px;"></div>
|
||||
|
||||
</div>
|
||||
<div class="card mt-4">
|
||||
<h1 class="card-title">Tableau des {{ stats.getPlacesCount() }} lieux</h1>
|
||||
<a href="{{ path('app_admin_export_csv', {'zip_code': stats.zone}) }}" class="btn btn-primary">Exporter en CSV</a>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-12">
|
||||
<h1 class="card-title p-4">Tableau des {{ stats.places |length }} lieux</h1>
|
||||
</div>
|
||||
<div class="col-md-6 col-12">
|
||||
<a class="btn btn-primary pull-right" href="{{ path('app_admin_export_csv', {'zip_code': stats.zone}) }}" class="btn btn-primary">
|
||||
<i class="bi bi-filetype-csv"></i>
|
||||
Exporter en CSV
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-bordered table-striped table-hover table-responsive">
|
||||
{% include 'admin/stats/table-head.html.twig' %}
|
||||
<tbody>
|
||||
|
@ -62,7 +78,7 @@
|
|||
</div>
|
||||
|
||||
<h2>requête overpass</h2>
|
||||
<pre>
|
||||
<pre class="p-4 bg-light">
|
||||
{{query_places|raw}}
|
||||
</pre>
|
||||
</div>
|
||||
|
@ -137,6 +153,9 @@ out skel qt;`;
|
|||
}
|
||||
|
||||
console.log('map chargé',data.elements);
|
||||
|
||||
document.getElementById('maploader').classList.add('d-none');
|
||||
|
||||
data.elements.forEach(element => {
|
||||
// Cherche les coordonnées à la racine ou dans center
|
||||
const lat = element.lat || (element.center && element.center.lat);
|
||||
|
|
|
@ -41,13 +41,19 @@
|
|||
{% endif %}
|
||||
|
||||
{{ commerce.mainTag }}
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
<td class="{{ commerce.hasAddress() ? 'filled' : '' }}">{{ commerce.address }}</td>
|
||||
<td class="{{ commerce.hasWebsite() ? 'filled' : '' }}">{{ commerce.website }}</td>
|
||||
<td class="{{ commerce.hasWheelchair() ? 'filled' : '' }}">{{ commerce.wheelchair }}</td>
|
||||
<td class="{{ commerce.hasNote() ? 'filled' : '' }}">{{ commerce.note }}</td>
|
||||
<td class="{{ commerce.noteContent ? 'filled' : '' }}">{{ commerce.noteContent }}</td>
|
||||
<td class="{{ commerce.noteContent ? 'filled' : '' }}">{{ commerce.noteContent }}</td>
|
||||
<td>
|
||||
<a href="https://www.openstreetmap.org/{{ commerce.osmKind }}/{{ commerce.osmId }}" target="_blank">
|
||||
<i class="bi bi-globe"></i>
|
||||
{{ commerce.osmId }}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ commerce.osmKind }}
|
||||
</td>
|
||||
</tr>
|
|
@ -24,5 +24,11 @@
|
|||
<th>
|
||||
<i class="bi bi-pencil-square"></i>
|
||||
Texte de la note</th>
|
||||
<th>
|
||||
|
||||
Osm id</th>
|
||||
<th>
|
||||
|
||||
Osm kind</th>
|
||||
</tr>
|
||||
</thead>
|
|
@ -254,7 +254,7 @@ out skel qt;`;
|
|||
<td>
|
||||
<a href="{{ path('app_admin_stats', {'zip_code': stat.zone}) }}">{{ stat.zone }} {{ stat.name }}</a>
|
||||
</td>
|
||||
<td>{{ stat.placesCount }}</td>
|
||||
<td>{{ stat.places |length }}</td>
|
||||
<td style="background : rgba(0 , 255, 0, {{stat.completionPercent / 100 }} )">{{ stat.completionPercent }}</td>
|
||||
<td>
|
||||
<a class="btn btn-sm btn-primary" href="{{ path('app_admin_stats', {'zip_code': stat.zone}) }}"><i class="bi bi-eye"></i></a>
|
||||
|
|
|
@ -111,15 +111,18 @@
|
|||
<div class="col-12 mt-4">
|
||||
<div class="actions-modification">
|
||||
|
||||
<a class="btn btn-info" href="{{ path('app_public_index') }}">{{ 'display.contact_humans'|trans }}</a>
|
||||
<a class="btn btn-info" href="{{ path('app_public_index') }}">
|
||||
<i class="bi bi-people"></i>
|
||||
{{ 'display.contact_humans'|trans }}
|
||||
</a>
|
||||
|
||||
<button id="showAllFields" class="btn btn-secondary mx-4">
|
||||
<i class="bi bi-eye"></i>
|
||||
Voir aussi les champs déjà remplis
|
||||
</button>
|
||||
</button>
|
||||
|
||||
<button id="closedCommerce" class="btn btn-danger mx-4">
|
||||
<i class="bi bi-x-circle"></i>
|
||||
<button id="closedCommerce" class="btn btn-danger mx-4 mt-4">
|
||||
<i class="bi bi-x-circle"></i>
|
||||
Je souhaite signaler que ce commerce est fermé
|
||||
</button>
|
||||
</div>
|
||||
|
@ -128,8 +131,6 @@
|
|||
</div>
|
||||
<div class="row justify-content-center mt-4">
|
||||
<div class="col-12 col-lg-10 col-xl-8">
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="d-flex flex-column flex-md-row align-items-md-center justify-content-between">
|
||||
|
@ -144,9 +145,6 @@
|
|||
{{ 'display.view_on_osm'|trans }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="{{ path('app_admin_stats', {'zip_code': zone ?? '-1'}) }}" class="btn btn-outline-secondary">
|
||||
<i class="bi bi-bar-chart"></i>
|
||||
{{ 'display.view_stats'|trans }}
|
||||
|
@ -170,12 +168,11 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{% block javascripts %}
|
||||
{{ parent() }}
|
||||
<script src='https://api.mapbox.com/mapbox-gl-js/v2.15.0/mapbox-gl.js'></script>
|
||||
<script src={{asset('js/mapbox/mapbox-gl.js')}}></script>
|
||||
<script>
|
||||
function check_validity(e) {
|
||||
let errors = [];
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
{% block stylesheets %}
|
||||
{{ parent() }}
|
||||
{# <link href='https://api.mapbox.com/mapbox-gl-js/v2.15.0/mapbox-gl.css' rel='stylesheet' /> #}
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
|
@ -32,18 +31,8 @@
|
|||
<br>
|
||||
<a href="{{ path('app_public_index') }}">Retour à la page d'accueil</a>
|
||||
</div>
|
||||
{# <h2>Tags</h2> #}
|
||||
|
||||
{# {{dump(commerce)}} #}
|
||||
|
||||
{# {% if commerce.tags_converted."contact:email" is defined %}
|
||||
<a class="btn btn-primary" href="mailto:{{ commerce.tags_converted."contact:email" }}">C'est mon commerce, le modifier</a>
|
||||
{% else %}
|
||||
<a class="btn btn-primary" href="{{ path('app_public_index') }}">C'est mon commerce, pour le modifier je souhaite ajouter mon email de contact</a>
|
||||
{% endif %} #}
|
||||
|
||||
{% endblock %}
|
||||
{% block javascripts %}
|
||||
{{ parent() }}
|
||||
{# <script src='https://api.mapbox.com/mapbox-gl-js/v2.15.0/mapbox-gl.js'></script> #}
|
||||
{% endblock %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue