up recherche home
This commit is contained in:
parent
c89751b45c
commit
7887356dd9
3 changed files with 281 additions and 251 deletions
|
@ -2,23 +2,22 @@
|
|||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Stats;
|
||||
use App\Entity\Place;
|
||||
use App\Entity\CityFollowUp;
|
||||
use App\Entity\Demande;
|
||||
use App\Service\Motocultrice;
|
||||
use App\Service\FollowUpService;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use GuzzleHttp\Client;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Mime\Email;
|
||||
use Symfony\Component\Mailer\MailerInterface;
|
||||
use App\Entity\Place;
|
||||
use App\Entity\Stats;
|
||||
use App\Service\ActionLogger;
|
||||
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
||||
use App\Service\FollowUpService;
|
||||
use App\Service\Motocultrice;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use GuzzleHttp\Client;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Mailer\MailerInterface;
|
||||
use Symfony\Component\Mime\Email;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class PublicController extends AbstractController
|
||||
{
|
||||
|
@ -31,7 +30,9 @@ class PublicController extends AbstractController
|
|||
private MailerInterface $mailer,
|
||||
private ActionLogger $actionLogger,
|
||||
private FollowUpService $followUpService
|
||||
) {}
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
#[Route('/propose-email/{email}/{type}/{id}', name: 'app_public_propose_email')]
|
||||
public function proposeEmail(string $email, string $type, int $id): Response
|
||||
|
@ -60,11 +61,11 @@ class PublicController extends AbstractController
|
|||
|
||||
$debug = '';
|
||||
if ($this->getParameter('kernel.environment') !== 'prod') {
|
||||
$debug = 'Bonjour, nous sommes des bénévoles d\'OpenStreetMap France et nous vous proposons de modifier les informations de votre commerce. Voici votre lien unique de modification: ' . $this->generateUrl('app_public_edit', [
|
||||
$debug = 'Voici votre lien unique de modification: <a href="' . $this->generateUrl('app_public_edit', [
|
||||
'zipcode' => $zipCode,
|
||||
'name' => $place_name,
|
||||
'uuid' => $existingPlace->getUuidForUrl()
|
||||
], true);
|
||||
], true) . '">cliquez ici pour accéder au formulaire de modification</a>"';
|
||||
}
|
||||
|
||||
$this->addFlash('success', 'L\'email a été mis à jour. Un email vous sera envoyé avec le lien de modification. ' . $debug);
|
||||
|
@ -195,16 +196,26 @@ class PublicController extends AbstractController
|
|||
$stats = $stats_exist;
|
||||
} else {
|
||||
$stats = new Stats();
|
||||
$stats->setZone((string)$demande->getInsee());
|
||||
$zipcode = (string)$demande->getInsee();
|
||||
$stats->setZone($zipcode);
|
||||
$place->setZipCode($zipcode);
|
||||
$this->entityManager->persist($stats);
|
||||
}
|
||||
|
||||
|
||||
$stats->addPlace($place);
|
||||
$place->setStats($stats);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$place->getUuidForUrl()) {
|
||||
$place->setUuidForUrl(uniqid());
|
||||
}
|
||||
if (!$place->getZipCode()) {
|
||||
$place->setZipCode("00000");
|
||||
}
|
||||
|
||||
$this->entityManager->persist($demande);
|
||||
$this->entityManager->flush();
|
||||
|
||||
|
@ -901,7 +912,7 @@ class PublicController extends AbstractController
|
|||
if ($place) {
|
||||
return $this->redirectToRoute('app_public_edit', [
|
||||
'zipcode' => $place->getZipCode(),
|
||||
'name' => $place->getName() !== '' ? $place->getName() : '?',
|
||||
'name' => $place->getName() ? $place->getName() : '?',
|
||||
'uuid' => $place->getUuidForUrl()
|
||||
]);
|
||||
} else {
|
||||
|
|
|
@ -7,6 +7,7 @@ use Doctrine\Common\Collections\ArrayCollection;
|
|||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
// use App\Service\Motocultrice;
|
||||
#[ORM\Entity(repositoryClass: PlaceRepository::class)]
|
||||
class Place
|
||||
|
@ -195,7 +196,8 @@ class Place
|
|||
return round($filled_fields / $total_fields * 100);
|
||||
}
|
||||
|
||||
public function guess_main_tag(array $tags_converted) {
|
||||
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'];
|
||||
|
@ -214,10 +216,12 @@ class Place
|
|||
}
|
||||
return $main_tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* mettre à jour le lieu selon les tags osm
|
||||
*/
|
||||
public function update_place_from_overpass_data(array $overpass_data) {
|
||||
public function update_place_from_overpass_data(array $overpass_data)
|
||||
{
|
||||
|
||||
if (!isset($overpass_data['tags']) || $overpass_data['tags'] == null) {
|
||||
return;
|
||||
|
@ -319,6 +323,10 @@ class Place
|
|||
|
||||
public function __construct()
|
||||
{
|
||||
$this->setUuidForUrl(uniqid())
|
||||
->setDead(false)
|
||||
->setAskedHumainsSupport(false)
|
||||
->setOptedOut(false);
|
||||
$this->histories = new ArrayCollection();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,13 @@
|
|||
{% if main_tag %}
|
||||
{{ tag_emoji(main_tag) }}
|
||||
{% endif %}
|
||||
{{ commerce_overpass.tags_converted.name }} - {{ commerce.stats.name }}
|
||||
{% if commerce_overpass.tags_converted.name is defined %}
|
||||
{{ commerce_overpass.tags_converted.name }}
|
||||
|
||||
{% endif %}
|
||||
{% if commerce.stats.name is defined %}
|
||||
- {{ commerce.stats.name }}
|
||||
{% endif %}
|
||||
</h1>
|
||||
<div id="map" style="height: 400px; width: 100%;" class="rounded mb-4"></div>
|
||||
|
||||
|
@ -75,7 +81,9 @@
|
|||
<div class="input-group">
|
||||
<input type="text" class="form-control"
|
||||
data-important="true"
|
||||
id="commerce_tag_value__contact:email" name="commerce_tag_value__contact:email" value="{{ commerce_overpass.tags_converted['contact:email'] ?? '' }}">
|
||||
id="commerce_tag_value__contact:email"
|
||||
name="commerce_tag_value__contact:email"
|
||||
value="{{ commerce_overpass.tags_converted['contact:email'] ?? '' }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -92,7 +100,9 @@
|
|||
<div class="input-group">
|
||||
<input type="text" class="form-control"
|
||||
data-important="true"
|
||||
id="commerce_tag_value__contact:website" name="commerce_tag_value__contact:website" value="{{ commerce_overpass.tags_converted['contact:website'] ?? '' }}">
|
||||
id="commerce_tag_value__contact:website"
|
||||
name="commerce_tag_value__contact:website"
|
||||
value="{{ commerce_overpass.tags_converted['contact:website'] ?? '' }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -110,7 +120,8 @@
|
|||
<div class="input-group">
|
||||
<input type="text" class="form-control"
|
||||
data-important="true"
|
||||
id="commerce_tag_value__contact:mastodon" name="commerce_tag_value__contact:mastodon" value="">
|
||||
id="commerce_tag_value__contact:mastodon"
|
||||
name="commerce_tag_value__contact:mastodon" value="">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue