Commit ce44d2c1 by Damien Moulard

Merge branch '8841-frontend-presta-better-visibility' into 'develop'

8841 frontend presta better visibility

See merge request !155
parents e4dfcb8d cf62a03a
...@@ -204,7 +204,11 @@ Quand CCAS_MODE = 1, pour que les reconversions CCAS soient effectuées et les e ...@@ -204,7 +204,11 @@ Quand CCAS_MODE = 1, pour que les reconversions CCAS soient effectuées et les e
57 1 1 * * kohinos php /home/kohinos/kohinos/bin/console kohinos:ssa:export-ccas-transactions 57 1 1 * * kohinos php /home/kohinos/kohinos/bin/console kohinos:ssa:export-ccas-transactions
27 2 10 * * kohinos rm -f /home/kohinos/kohinos/ccastransactions/* 27 2 10 * * kohinos rm -f /home/kohinos/kohinos/ccastransactions/*
Pour activer l'export de données vers un serveur distant : Pour activer la gestion automatique de la rubrique des nouveaux prestataires (1 fois /jour) :
0 1 * * * kohinos php /home/kohinos/kohinos/bin/console kohinos:ssa:manage-new-prestas-rubrique
Pour activer l'export de données vers un serveur distant (1 fois /mois) :
0 0 1 * * kohinos php /home/kohinos/kohinos/bin/console kohinos:ssa:export-and-upload-data 0 0 1 * * kohinos php /home/kohinos/kohinos/bin/console kohinos:ssa:export-and-upload-data
......
...@@ -437,4 +437,11 @@ form[name="formEncaissement"] label { ...@@ -437,4 +437,11 @@ form[name="formEncaissement"] label {
#infoForUserModal .modal-body { #infoForUserModal .modal-body {
word-break: break-all; word-break: break-all;
}
.presta-map-filter-container {
display: flex;
justify-content: center;
flex-wrap: wrap;
gap: 5px;
} }
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
"/build/app.3644f7b2.js" "/build/app.3644f7b2.js"
], ],
"css": [ "css": [
"/build/app.ec67f059.css" "/build/app.13f8bbf1.css"
] ]
}, },
"admin": { "admin": {
......
{ {
"build/app.css": "/build/app.ec67f059.css", "build/app.css": "/build/app.13f8bbf1.css",
"build/app.js": "/build/app.3644f7b2.js", "build/app.js": "/build/app.3644f7b2.js",
"build/admin.css": "/build/admin.4de55830.css", "build/admin.css": "/build/admin.4de55830.css",
"build/admin.js": "/build/admin.63735322.js", "build/admin.js": "/build/admin.63735322.js",
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
"build/fonts/fa-regular-400.eot": "/build/fonts/fa-regular-400.5e1bdc3d.eot", "build/fonts/fa-regular-400.eot": "/build/fonts/fa-regular-400.5e1bdc3d.eot",
"build/fonts/fa-regular-400.ttf": "/build/fonts/fa-regular-400.b25f26d4.ttf", "build/fonts/fa-regular-400.ttf": "/build/fonts/fa-regular-400.b25f26d4.ttf",
"build/ckeditor/skins/moono-lisa/icons_hidpi.png": "/build/ckeditor/skins/moono-lisa/icons_hidpi.png", "build/ckeditor/skins/moono-lisa/icons_hidpi.png": "/build/ckeditor/skins/moono-lisa/icons_hidpi.png",
"build/ckeditor/plugins/image/dialogs/image.js": "/build/ckeditor/plugins/image/dialogs/image.js",
"build/fonts/source-sans-pro-v14-latin-300.woff": "/build/fonts/source-sans-pro-v14-latin-300.25d1ce45.woff", "build/fonts/source-sans-pro-v14-latin-300.woff": "/build/fonts/source-sans-pro-v14-latin-300.25d1ce45.woff",
"build/fonts/source-sans-pro-v14-latin-regular.woff": "/build/fonts/source-sans-pro-v14-latin-regular.33e6b01f.woff", "build/fonts/source-sans-pro-v14-latin-regular.woff": "/build/fonts/source-sans-pro-v14-latin-regular.33e6b01f.woff",
"build/fonts/source-sans-pro-v14-latin-600.woff": "/build/fonts/source-sans-pro-v14-latin-600.720fb921.woff", "build/fonts/source-sans-pro-v14-latin-600.woff": "/build/fonts/source-sans-pro-v14-latin-600.720fb921.woff",
...@@ -116,6 +117,7 @@ ...@@ -116,6 +117,7 @@
"build/ckeditor/plugins/link/dialogs/anchor.js": "/build/ckeditor/plugins/link/dialogs/anchor.js", "build/ckeditor/plugins/link/dialogs/anchor.js": "/build/ckeditor/plugins/link/dialogs/anchor.js",
"build/ckeditor/skins/moono/images/hidpi/lock.png": "/build/ckeditor/skins/moono/images/hidpi/lock.png", "build/ckeditor/skins/moono/images/hidpi/lock.png": "/build/ckeditor/skins/moono/images/hidpi/lock.png",
"build/ckeditor/skins/moono-lisa/images/hidpi/refresh.png": "/build/ckeditor/skins/moono-lisa/images/hidpi/refresh.png", "build/ckeditor/skins/moono-lisa/images/hidpi/refresh.png": "/build/ckeditor/skins/moono-lisa/images/hidpi/refresh.png",
"build/ckeditor/plugins/image/images/noimage.png": "/build/ckeditor/plugins/image/images/noimage.png",
"build/images/source-sans-pro-v14-latin-300.svg": "/build/images/source-sans-pro-v14-latin-300.4e7fe004.svg", "build/images/source-sans-pro-v14-latin-300.svg": "/build/images/source-sans-pro-v14-latin-300.4e7fe004.svg",
"build/ckeditor/skins/moono/images/hidpi/lock-open.png": "/build/ckeditor/skins/moono/images/hidpi/lock-open.png", "build/ckeditor/skins/moono/images/hidpi/lock-open.png": "/build/ckeditor/skins/moono/images/hidpi/lock-open.png",
"build/ckeditor/skins/moono/images/hidpi/anchor.png": "/build/ckeditor/skins/moono/images/hidpi/anchor.png", "build/ckeditor/skins/moono/images/hidpi/anchor.png": "/build/ckeditor/skins/moono/images/hidpi/anchor.png",
......
...@@ -93,6 +93,17 @@ class RubriqueAdmin extends AbstractAdmin ...@@ -93,6 +93,17 @@ class RubriqueAdmin extends AbstractAdmin
'required' => false, 'required' => false,
'label_attr' => ['class' => 'checkbox-inline'], 'label_attr' => ['class' => 'checkbox-inline'],
]) ])
->add('isPrestaMapFilter', CheckboxType::class, [
'label' => 'Est un filtre de la carte des Points de vente ?',
'required' => false,
'label_attr' => ['class' => 'checkbox-inline'],
])
->add('isRubriqueForNewPresta', CheckboxType::class, [
'label' => 'Est la rubrique des nouveaux points de vente ?',
'help' => 'Les nouveaux points de vente y sont automatiquement ajoutés une fois par jour. Il ne peut y avoir qu\'une seule rubrique pour les nouveaux points de vente.',
'required' => false,
'label_attr' => ['class' => 'checkbox-inline'],
])
->end() ->end()
->with('Image', ['class' => 'col-md-6']) ->with('Image', ['class' => 'col-md-6'])
->add('media', MediaType::class, [ ->add('media', MediaType::class, [
......
<?php
declare(strict_types=1);
namespace App\Command;
use App\Entity\Rubrique;
use App\Entity\Prestataire;
use App\Utils\CustomEntityManager;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
/**
* This command is used to add or delete prestataire to/from the nes prestataires rubrique.
* This way, this rubrique always only contains the new prestataires (created in the last 2 months).
*/
class ManageNewPrestaRubriqueCommand extends Command
{
protected static $defaultName = 'kohinos:ssa:manage-new-prestas-rubrique';
protected $em;
protected $io;
public function __construct(CustomEntityManager $em) {
$this->em = $em;
parent::__construct();
}
protected function configure()
{
$this
->setDescription('SSA : ajouter ou supprimer les prestaires de la rubrique des nouveaux prestataires')
;
}
/**
* @param InputInterface $input
* @param OutputInterface $output
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->io = new SymfonyStyle($input, $output);
$this->io->title('START');
$rubrique = $this->em->getRepository(Rubrique::class)->findOneBy(['isRubriqueForNewPresta' => true, 'enabled' => true]);
if (null === $rubrique) {
return 0;
}
$newPrestas = $this->em->getRepository(Prestataire::class)->findNewPrestataires();
foreach ($newPrestas as $p) {
// add if doesn't exist
$p->addRubrique($rubrique);
$this->em->persist($p);
}
// get all other prestas
$otherPrestas = $this->em->getRepository(Prestataire::class)->findbyListExclude($newPrestas);
foreach ($otherPrestas as $p) {
// remove if exists
$p->removeRubrique($rubrique);
$this->em->persist($p);
}
$this->em->flush();
$this->em->clear();
$this->io->success('End');
$memoryUsage = memory_get_usage(true) / 1024 / 1024;
$this->io->text("Batch finished with memory: ${memoryUsage}M");
return 0;
}
}
...@@ -596,7 +596,7 @@ class IndexController extends AbstractController ...@@ -596,7 +596,7 @@ class IndexController extends AbstractController
try { try {
// GEOCODING ADDRESS : // GEOCODING ADDRESS :
$httpClient = new \Http\Adapter\Guzzle6\Client(); $httpClient = new \Http\Adapter\Guzzle6\Client();
$provider = Nominatim::withOpenStreetMapServer($httpClient, 'Mozilla/5.0'); $provider = Nominatim::withOpenStreetMapServer($httpClient, 'Kohinos_SSA/2.4.5 (contact@caisse-alimentaire-commune.fr)');
$geocoder = new \Geocoder\StatefulGeocoder($provider, 'fr'); $geocoder = new \Geocoder\StatefulGeocoder($provider, 'fr');
// Query geocoding from complete address // Query geocoding from complete address
$result = $geocoder->geocodeQuery(GeocodeQuery::create($request->get('adresse') . ' ' . $request->get('cpostal') . ' ' . $request->get('ville'))); $result = $geocoder->geocodeQuery(GeocodeQuery::create($request->get('adresse') . ' ' . $request->get('cpostal') . ' ' . $request->get('ville')));
......
...@@ -11,6 +11,7 @@ use App\Entity\SelfEvalPrestaQuiz; ...@@ -11,6 +11,7 @@ use App\Entity\SelfEvalPrestaQuiz;
use App\Form\Type\DistributorSelfEvalPrestaQuizType; use App\Form\Type\DistributorSelfEvalPrestaQuizType;
use App\Form\Type\ProducerSelfEvalPrestaQuizType; use App\Form\Type\ProducerSelfEvalPrestaQuizType;
use App\Form\Type\SelfEvalPrestaQuizType; use App\Form\Type\SelfEvalPrestaQuizType;
use App\Application\Sonata\MediaBundle\Entity\Media;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
...@@ -146,10 +147,9 @@ class PrestatairesController extends FrontController ...@@ -146,10 +147,9 @@ class PrestatairesController extends FrontController
if (!$this->isFrontActivated()) { if (!$this->isFrontActivated()) {
return $this->redirectToRoute('index'); return $this->redirectToRoute('index');
} }
$rubriques = $this->em->getRepository(Rubrique::class)->findBy(['enabled' => true], ['name' => 'ASC']);
return $this->render('@kohinos/presta/rubriques.html.twig', [ return $this->render('@kohinos/presta/rubriques.html.twig', [
'rubriques' => $rubriques, 'rubriques' => $this->em->getRepository(Rubrique::class)->findBy(['enabled' => true], ['isRubriqueForNewPresta' => 'DESC', 'name' => 'ASC']),
]); ]);
} }
......
...@@ -57,6 +57,19 @@ class Rubrique ...@@ -57,6 +57,19 @@ class Rubrique
*/ */
protected $media; protected $media;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default": false})
*/
private $isPrestaMapFilter;
/**
* One Rubrique is dedicated to new prestataires.
* Prestataires will be automatically added to or deleted from this Rubrique to it containse only the most recently added Prestataires.
*
* @ORM\Column(type="boolean", nullable=false, options={"default": false})
*/
private $isRubriqueForNewPresta;
public function __construct() public function __construct()
{ {
$this->prestataires = new ArrayCollection(); $this->prestataires = new ArrayCollection();
...@@ -136,4 +149,28 @@ class Rubrique ...@@ -136,4 +149,28 @@ class Rubrique
{ {
return $this->getTitle() ? $this->getTitle() : 'Rubrique'; return $this->getTitle() ? $this->getTitle() : 'Rubrique';
} }
public function getIsPrestaMapFilter(): ?bool
{
return $this->isPrestaMapFilter;
}
public function setIsPrestaMapFilter(bool $isPrestaMapFilter): self
{
$this->isPrestaMapFilter = $isPrestaMapFilter;
return $this;
}
public function getIsRubriqueForNewPresta(): ?bool
{
return $this->isRubriqueForNewPresta;
}
public function setIsRubriqueForNewPresta(bool $isRubriqueForNewPresta): self
{
$this->isRubriqueForNewPresta = $isRubriqueForNewPresta;
return $this;
}
} }
...@@ -40,7 +40,7 @@ class GeolocListener ...@@ -40,7 +40,7 @@ class GeolocListener
if (empty($entity->getLat()) && empty($entity->getLon())) { if (empty($entity->getLat()) && empty($entity->getLon())) {
// GEOCODING ADDRESS : // GEOCODING ADDRESS :
$httpClient = new \Http\Adapter\Guzzle6\Client(); $httpClient = new \Http\Adapter\Guzzle6\Client();
$provider = Nominatim::withOpenStreetMapServer($httpClient, 'Mozilla/5.0'); $provider = Nominatim::withOpenStreetMapServer($httpClient, 'Kohinos_SSA/2.4.5 (contact@caisse-alimentaire-commune.fr)');
$geocoder = new \Geocoder\StatefulGeocoder($provider, 'fr'); $geocoder = new \Geocoder\StatefulGeocoder($provider, 'fr');
$fullAddress = $entity->getAdresse() . ' ' . $entity->getCpostal() . ' ' . $entity->getVille(); $fullAddress = $entity->getAdresse() . ' ' . $entity->getCpostal() . ' ' . $entity->getVille();
// Query geocoding from complete address // Query geocoding from complete address
......
<?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 Version20260408075326 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('ALTER TABLE rubrique ADD is_presta_map_filter TINYINT(1) DEFAULT \'0\' NOT NULL');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE rubrique DROP is_presta_map_filter');
}
}
<?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 Version20260513075023 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('ALTER TABLE rubrique ADD is_rubrique_for_new_presta TINYINT(1) DEFAULT \'0\' NOT NULL');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE rubrique DROP is_rubrique_for_new_presta');
}
}
...@@ -338,6 +338,48 @@ class PrestataireRepository extends ServiceEntityRepository ...@@ -338,6 +338,48 @@ class PrestataireRepository extends ServiceEntityRepository
return $return; return $return;
} }
/**
* Find by excluding prestataires in parameter list
* @return Prestataire[] Returns an array of Prestataire objects
*/
public function findbyListExclude(Array $prestas)
{
$excludeIds = [];
foreach ($prestas as $p) {
$excludeIds[] = strval($p->getId());
}
$qb = $this->createQueryBuilder('p');
$qb = $this->addDefaultFilter($qb);
return $qb
->andWhere('p.id NOT IN (:ids)')
->setParameter('ids', $excludeIds)
->orderBy('p.raison', 'ASC')
->getQuery()
->getResult()
;
}
/**
* @return Prestataire[] Returns an array of Prestataire objects
*/
public function findNewPrestataires()
{
$qb = $this->createQueryBuilder('p');
$qb = $this->addDefaultFilter($qb);
$from = date('Y-m-d H:i:s',strtotime("-2 months"));
return $qb
->andWhere('p.createdAt > :from')
->setParameter('from', $from)
->orderBy('p.raison', 'ASC')
->getQuery()
->getResult()
;
}
public function findAllForSsaExport() public function findAllForSsaExport()
{ {
$qb = $this->createQueryBuilder('p'); $qb = $this->createQueryBuilder('p');
...@@ -346,9 +388,6 @@ class PrestataireRepository extends ServiceEntityRepository ...@@ -346,9 +388,6 @@ class PrestataireRepository extends ServiceEntityRepository
->leftjoin('p.geolocs', 'g') ->leftjoin('p.geolocs', 'g')
->leftjoin('p.rubriques', 'r') ->leftjoin('p.rubriques', 'r')
->leftjoin('p.users', 'u') ->leftjoin('p.users', 'u')
// ->where('p.enabled = :enabled')
// ->andWhere('u.enabled = :userEnabled')
// ->setParameters(['enabled' => true, 'userEnabled' => true])
->orderBy('p.raison', 'ASC') ->orderBy('p.raison', 'ASC')
->getQuery() ->getQuery()
->getResult() ->getResult()
......
<?php
namespace App\Repository;
use App\Entity\Rubrique;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method RubriqueItem|null find($id, $lockMode = null, $lockVersion = null)
* @method RubriqueItem|null findOneBy(array $criteria, array $orderBy = null)
* @method RubriqueItem[] findAll()
* @method RubriqueItem[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class RubriqueRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Rubrique::class);
}
}
...@@ -114,6 +114,7 @@ class AppExtension extends AbstractExtension ...@@ -114,6 +114,7 @@ class AppExtension extends AbstractExtension
}), }),
new \Twig_SimpleFunction('showInformationModal', [$this, 'showInformationModal']), new \Twig_SimpleFunction('showInformationModal', [$this, 'showInformationModal']),
new \Twig_SimpleFunction('getInformationPopupData', [$this, 'getInformationPopupData']), new \Twig_SimpleFunction('getInformationPopupData', [$this, 'getInformationPopupData']),
new \Twig_SimpleFunction('getRubriqueFiltersForPrestaMap', [$this, 'getRubriqueFiltersForPrestaMap']),
]; ];
} }
...@@ -617,4 +618,12 @@ class AppExtension extends AbstractExtension ...@@ -617,4 +618,12 @@ class AppExtension extends AbstractExtension
{ {
return $this->em->getRepository(InformationPopup::class)->findOneBy(['enabled' => true]); return $this->em->getRepository(InformationPopup::class)->findOneBy(['enabled' => true]);
} }
/**
* If the information modale is shown, get its data
*/
public function getRubriqueFiltersForPrestaMap()
{
return $this->em->getRepository(Rubrique::class)->findBy(['enabled' => true, 'isPrestaMapFilter' => true], ['name' => 'ASC']);
}
} }
...@@ -33,13 +33,21 @@ ...@@ -33,13 +33,21 @@
{% import _self as self %} {% import _self as self %}
{% for menuItem in items %} {% for menuItem in items %}
{% set url = menuItem.url %} {% set url = menuItem.url %}
{% if tav_env == 1 and menuItem.name == "Carte des prestataires" %}
{% set name = "Carte des points de vente" %} {# In tav env, only display some entries with a different name for prestataires menu #}
{% elseif tav_env == 1 and menuItem.name == "Liste des prestataires" %} {% if tav_env == 1 and "prestataires" in url %}
{% set name = "Liste des points de vente" %} {% set name = null %}
{% if 'carte' in url %}
{% set name = "Carte des points de vente" %}
{% elseif 'rubriques' in url %}
{% set name = "Les différents points de vente" %}
{% endif %}
{% if name != null %}
<a href="{{ url }}" class="dropdown-item {% if currentPath == url %}current{% endif %}" {% if menuItem.target %} target="_blank"{% endif %}>{{ name }}</a>
{% endif %}
{% else %} {% else %}
{% set name = menuItem.name %} <a href="{{ url }}" class="dropdown-item {% if currentPath == url %}current{% endif %}" {% if menuItem.target %} target="_blank"{% endif %}>{{ menuItem.name }}</a>
{% endif %} {% endif %}
<a href="{{ url }}" class="dropdown-item {% if currentPath == url %}current{% endif %}" {% if menuItem.target %} target="_blank"{% endif %}>{{ name }}</a>
{% endfor %} {% endfor %}
{% endmacro %} {% endmacro %}
\ No newline at end of file
...@@ -2,7 +2,11 @@ ...@@ -2,7 +2,11 @@
{% if rubriques == null or rubriques|length > 0 %} {% if rubriques == null or rubriques|length > 0 %}
<div class="card mb-2"> <div class="card mb-2">
<div class="card-header"> <div class="card-header">
<i class="fa fa-flag"></i> <span class='h4 ml-2'>{{ 'Rubriques'|trans }}</span> {% if tav_env == 1 %}
<i class="fa fa-flag"></i> <span class='h4 ml-2'>{{ 'Les différents points de vente'|trans }}</span>
{% else %}
<i class="fa fa-flag"></i> <span class='h4 ml-2'>{{ 'Rubriques'|trans }}</span>
{% endif %}
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="card-text"> <div class="card-text">
......
{% set id = id|default('mapid') %} {% set id = id|default('mapid') %}
{% set style = style|default('') %} {% set style = style|default('') %}
{% set title = title|default('Carte') %} {% set title = title|default('Carte') %}
{% set rubriquesFilter = getRubriqueFiltersForPrestaMap() %}
<div class='cartetitle mb-3'> <div class='cartetitle mb-3'>
<h4><i class="fa fa-map"></i> {{title}}</h4> <h4><i class="fa fa-map"></i> {{title}}</h4>
</div> </div>
<div id="{{id}}" style="{{style}}" class='my-3'></div> <div id="{{id}}" style="{{style}}" class='my-3'></div>
\ No newline at end of file <div class="presta-map-filter-container">
{% for rubrique in rubriquesFilter %}
<button class="btn btn-primary presta-map-filter" data-rubrique-slug="{{rubrique.slug}}">{{ rubrique.name }}</button>
{% endfor %}
</div>
\ No newline at end of file
{% set idmap = id|default('mapid') %} {% set idmap = id|default('mapid') %}
{% set prestataires = getAllPrestataires() %} {% set prestataires = getAllPrestataires() %}
<script> <script>
var mymap = null;
var mapFilters = [];
$(function () { $(function () {
$('[data-toggle="tooltip"]').tooltip() $('[data-toggle="tooltip"]').tooltip();
if ($('#{{idmap}}').length) {
var mymap = L.map('{{idmap}}').setView({{KOH_MAP_CENTER}}, {{KOH_MAP_ZOOM}}); function drawMap() {
if ($('#{{idmap}}').length) {
L.tileLayer('https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', {maxZoom: 18, attribution: '&copy; Openstreetmap France | &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}).addTo(mymap); mymap = L.map('{{idmap}}').setView({{KOH_MAP_CENTER}}, {{KOH_MAP_ZOOM}});
L.tileLayer('https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', {maxZoom: 18, attribution: '&copy; Openstreetmap France | &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}).addTo(mymap);
{# AJOUTER LES MARQUEURS SUR LA CARTE #}
{% set count = 1 %} {# AJOUT DES MARQUEURS SUR LA CARTE #}
{% for presta in prestataires %} {% set count = 1 %}
{% if presta.geolocs|length > 0 %} {% for presta in prestataires %}
{% for geolocp in presta.geolocs %} {% if presta.geolocs|length > 0 %}
{% if geolocp.enabled and geolocp.geoloc.lat != null and geolocp.geoloc.lon != null %} {% for geolocp in presta.geolocs %}
{% if presta.rubriques|length > 0 and presta.rubriques.first.media is not null %} {% if geolocp.enabled and geolocp.geoloc.lat != null and geolocp.geoloc.lon != null %}
var icon = L.icon({
iconSize: [50, 50], // get presta rubriques
iconAnchor: [25,50], var prestaRubriquesSlug = [];
className: 'kohinos-map-icon', {% for rubrique in presta.rubriques %}
iconUrl : '{% path presta.rubriques.first.media, "preview" %}' prestaRubriquesSlug.push('{{ rubrique.slug }}')
}); {% endfor %}
var marker_{{count}} = L.marker([{{geolocp.geoloc.lat}}, {{geolocp.geoloc.lon}}], {icon: icon}).addTo(mymap);
{% else %} // add presta to map if there's no filter or if one of its rubriques match any active filter
var marker_{{count}} = L.marker([{{geolocp.geoloc.lat}}, {{geolocp.geoloc.lon}}]).addTo(mymap); if (
{% endif %} mapFilters.length === 0
marker_{{count}}.bindPopup("{% spaceless %}{% if presta.media != null %}{% set media %}{% thumbnail presta.media, 'small' %}{% endset %} {{ media|raw|replace({'"' : "'"})|raw }}<br/><br/>{% endif %} || mapFilters.length > 0
<a href='{{ path('show_prestataire', {'slug': presta.slug}) }}'> && mapFilters.some(el => prestaRubriquesSlug.includes(el))
<strong style='font-size:16px;'>{{presta.__toString()}}</strong> ) {
</a> // On récupère la rubrique des nouveaux prestataires en priorité, sinon la première rubrique de la liste
<br/> {% set media = null %}
{% if presta.horaires is not null %} {% if presta.rubriques|length > 0 %}
<p>{{presta.horaires}}</p> {% for rubrique in presta.rubriques %}
{% endif %} {% if rubrique.isRubriqueForNewPresta %}
{% for rubrique in presta.rubriques %} {% set media = rubrique.media %}
<a class='maprubrique' href='{{ path('show_rubrique', {'slug': rubrique.slug}) }}'>{{rubrique.name|replace({"\n": '<br/>'})}}</a>{% if not loop.last %} - {% endif %} {% elseif media is null and rubrique.media is not null %}
{% endfor %} {% set media = rubrique.media %}
{% endspaceless %}"); {% endif %}
{% set count = count+1 %} {% endfor %}
{% endif %} {% endif %}
{% endfor %}
{% endif %} {% if media is not null %}
{% endfor %} var icon = L.icon({
} iconSize: [50, 50],
}) iconAnchor: [25,50],
className: 'kohinos-map-icon',
iconUrl : '{% path media, "preview" %}'
});
var marker_{{count}} = L.marker([{{geolocp.geoloc.lat}}, {{geolocp.geoloc.lon}}], {icon: icon}).addTo(mymap);
{% else %}
var marker_{{count}} = L.marker([{{geolocp.geoloc.lat}}, {{geolocp.geoloc.lon}}]).addTo(mymap);
{% endif %}
marker_{{count}}.bindPopup("{% spaceless %}{% if presta.media != null %}{% set media %}{% thumbnail presta.media, 'small' %}{% endset %} {{ media|raw|replace({'"' : "'"})|raw }}<br/><br/>{% endif %}
{% if date(presta.getCreatedAt()) > date('-2months') %}
<strong style='font-size:16px;'>[Nouveau] </strong>
{% endif %}
<a href='{{ path('show_prestataire', {'slug': presta.slug}) }}'>
<strong style='font-size:16px;'>{{presta.__toString()}}</strong>
</a>
<br/>
{% if presta.horaires is not null %}
<p>{{presta.horaires}}</p>
{% endif %}
{% for rubrique in presta.rubriques %}
<a class='maprubrique' href='{{ path('show_rubrique', {'slug': rubrique.slug}) }}'>{{rubrique.name|replace({"\n": '<br/>'})}}</a>{% if not loop.last %} - {% endif %}
{% endfor %}
{% endspaceless %}");
{% set count = count+1 %}
}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
}
}
drawMap();
// Listeners for map filters buttons
$('.presta-map-filter').each(function() {
$(this).click(() => {
let slug = $(this).data('rubriqueSlug');
let activeFilterIndex = mapFilters.indexOf(slug);
if (activeFilterIndex === -1) {
// add rubrique slug to fiters array if it doesn't exist...
mapFilters.push(slug);
$(this).removeClass('btn-primary').addClass('btn-success');
} else {
// ... else, add it
mapFilters.splice(activeFilterIndex, 1);
$(this).addClass('btn-primary').removeClass('btn-success');
}
// Redraw map
mymap.remove();
drawMap();
});
});
});
</script> </script>
...@@ -3,7 +3,12 @@ ...@@ -3,7 +3,12 @@
{% block content %} {% block content %}
<div class='container rubriquelist mt-2'> <div class='container rubriquelist mt-2'>
{% include '@kohinos/block/breadcrumb.html.twig' with {'label' : 'Rubriques'|trans} %} {% include '@kohinos/block/breadcrumb.html.twig' with {'label' : 'Rubriques'|trans} %}
<h1>{{ 'Rubriques'|trans }}</h1> {% if tav_env == 1 %}
<h1>{{ 'Les différents points de vente'|trans }}</h1>
{% else %}
<h1>{{ 'Rubriques'|trans }}</h1>
{% endif %}
<br/>
<div class="row"> <div class="row">
{% for rubrique in rubriques %} {% for rubrique in rubriques %}
{% if rubrique.prestataires|length > 0 %} {% if rubrique.prestataires|length > 0 %}
...@@ -13,7 +18,11 @@ ...@@ -13,7 +18,11 @@
{% if rubrique.media is not null %} {% if rubrique.media is not null %}
{% thumbnail rubrique.media, 'small' %} {% thumbnail rubrique.media, 'small' %}
{% endif %} {% endif %}
<a class='rubrique' href='{{ path('show_rubrique', {'slug': rubrique.slug}) }}'>{{rubrique.name}}</a> {% if rubrique.id == 'new_prestataires' %}
<span class='rubrique' id="new-prestataires-rubrique-title">{{rubrique.name}}</span>
{% else %}
<a class='rubrique' href='{{ path('show_rubrique', {'slug': rubrique.slug}) }}'>{{rubrique.name}}</a>
{% endif %}
</h5> </h5>
{% if rubrique.content|length > 0 %} {% if rubrique.content|length > 0 %}
<div class="card-body"> <div class="card-body">
......
...@@ -8,21 +8,29 @@ ...@@ -8,21 +8,29 @@
<div class="card mb-2"> <div class="card mb-2">
<div class="card-header"> <div class="card-header">
<h1>{{ presta.raison }}</h1> <h1>{{ presta.raison }}</h1>
{% if presta.acceptemlc %} {% if tav_env == 0 %}
<span class='fa-stack fa-lg' data-toggle='tooltip' data-placement='bottom' title="Accepte la monnaie électronique"> {% if presta.acceptemlc %}
<i class='fa fa-at fa-stack-1x'></i> <span class='fa-stack fa-lg' data-toggle='tooltip' data-placement='bottom' title="Accepte la monnaie électronique">
<i class='fa fa-fw fa-stack-2x'></i> <i class='fa fa-at fa-stack-1x'></i>
</span> <i class='fa fa-fw fa-stack-2x'></i>
{% else %} </span>
<span class='fa-stack fa-lg' data-toggle='tooltip' data-placement='bottom' title="N'accepte pas la monnaie électronique"> {% else %}
<i class='fa fa-at fa-stack-1x'></i> <span class='fa-stack fa-lg' data-toggle='tooltip' data-placement='bottom' title="N'accepte pas la monnaie électronique">
<i class='fa fa-ban fa-stack-2x text-danger'></i> <i class='fa fa-at fa-stack-1x'></i>
</span> <i class='fa fa-ban fa-stack-2x text-danger'></i>
</span>
{% endif %}
{% endif %} {% endif %}
{% if presta.rubriques|length > 0%} {% if presta.rubriques|length > 0%}
{% for rubrique in presta.rubriques %} {% if tav_env == 1 %}
<a class='rubrique ml-2' href='{{ path('show_rubrique', {'slug': rubrique.slug}) }}'>{{ rubrique.name }}</a> {% set presta_rubrique_class = 'mr-2' %}
{% endfor %} {% else %}
{% set presta_rubrique_class = 'ml-2' %}
{% endif %}
{% for rubrique in presta.rubriques %}
<a class='rubrique {{ presta_rubrique_class }}' href='{{ path('show_rubrique', {'slug': rubrique.slug}) }}'>{{ rubrique.name }}</a>
{% endfor %}
{% endif %} {% endif %}
{# @TODO : ajouter le lien d'édition uniquement quand l'utilisateur peut l'éditer (Voter?) #} {# @TODO : ajouter le lien d'édition uniquement quand l'utilisateur peut l'éditer (Voter?) #}
{% if app.user and (is_granted('ROLE_SUPER_ADMIN') or is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_EDIT')) %} {% if app.user and (is_granted('ROLE_SUPER_ADMIN') or is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_EDIT')) %}
...@@ -36,22 +44,22 @@ ...@@ -36,22 +44,22 @@
</div> </div>
{% endif %} {% endif %}
{% if presta.statut != null %} {% if presta.statut != null %}
<h6 class="card-title text-muted mb-3">{{ presta.statut }}</h6> <h5 class="card-title text-muted mb-3">{{ presta.statut }}</h5>
{% endif %} {% endif %}
{% if presta.groupe != null %} {% if presta.groupe != null and tav_env == 0 %}
<h4 class="card-subtitle mb-3">{{'Groupe local'|trans}} : <a href='{{ path('show_groupe', {'slug': presta.groupe.slug}) }}'>{{ presta.groupe.__toString() }}</a></h4> <h5 class="card-subtitle mb-3">{{'Groupe local'|trans}} : <a href='{{ path('show_groupe', {'slug': presta.groupe.slug}) }}'>{{ presta.groupe.__toString() }}</a></h5>
{% endif %} {% endif %}
{% if presta.siret != null %} {% if presta.siret != null and tav_env == 0 %}
<h5 class="card-subtitle mb-3">{{'SIRET'|trans}} : {{ presta.siret }}</h5> <h5 class="card-subtitle mb-3">{{'SIRET'|trans}} : {{ presta.siret }}</h5>
{% endif %} {% endif %}
{% if app.user and presta_extra_data and presta.conventionnement != null and presta.conventionnement > 0 %} {% if app.user and presta_extra_data and presta.conventionnement != null and presta.conventionnement > 0 %}
<h5 class="card-subtitle mb-3">{{'Pourcentage de conventionnement'|trans}} : {{ presta.conventionnement * 100 }}%</h5> <h5 class="card-subtitle mb-3">{{'Pourcentage de conventionnement'|trans}} : {{ presta.conventionnement * 100 }}%</h5>
{% endif %} {% endif %}
{% if presta.horaires != null %} {% if presta.horaires != null %}
<h6 class="card-subtitle text-muted mb-3">{{'Horaires'|trans}} : {{ presta.horaires|raw }}</h6> <h5 class="card-subtitle text-muted mb-3">{{'Horaires'|trans}} : {{ presta.horaires|raw }}</h5>
{% endif %} {% endif %}
{% if presta.web != null %} {% if presta.web != null %}
<h6 class="card-subtitle mb-3">{{'Site web'|trans}} : <a href='{{ presta.web }}' target='_blank' rel='noopener noreferrer'>{{ presta.web }}</a></h6> <h5 class="card-subtitle mb-3">{{'Site web'|trans}} : <a href='{{ presta.web }}' target='_blank' rel='noopener noreferrer'>{{ presta.web }}</a></h5>
{% endif %} {% endif %}
{# {% if presta.responsable != null and presta.metier != null %} {# {% if presta.responsable != null and presta.metier != null %}
<h6 class="card-title my-3">Responsable : {{ presta.responsable }} ({{ presta.metier }})</h6> <h6 class="card-title my-3">Responsable : {{ presta.responsable }} ({{ presta.metier }})</h6>
......
...@@ -2,7 +2,12 @@ ...@@ -2,7 +2,12 @@
{% block content %} {% block content %}
<div class='container newslist mt-2'> <div class='container newslist mt-2'>
{% include '@kohinos/block/breadcrumb.html.twig' with {'label': rubrique.name, 'label2': 'Rubriques', 'url2': path('rubriques_prestataire') } %} {% if tav_env == 1 %}
{% set label2Name = 'Les différents points de vente' %}
{% else %}
{% set label2Name = 'Rubriques' %}
{% endif %}
{% include '@kohinos/block/breadcrumb.html.twig' with {'label': rubrique.name, 'label2': label2Name, 'url2': path('rubriques_prestataire') } %}
<h1 class='text-primary'> <h1 class='text-primary'>
{% if rubrique.media is not null %} {% if rubrique.media is not null %}
<span style='width:100px;'>{% thumbnail rubrique.media, 'small' %}</span> <span style='width:100px;'>{% thumbnail rubrique.media, 'small' %}</span>
......
...@@ -9,6 +9,7 @@ Encore ...@@ -9,6 +9,7 @@ Encore
{from: './node_modules/ckeditor/lang', to: 'ckeditor/lang/[path][name].[ext]', pattern: /fr\.js|en\.js$/}, {from: './node_modules/ckeditor/lang', to: 'ckeditor/lang/[path][name].[ext]', pattern: /fr\.js|en\.js$/},
{from: './node_modules/ckeditor/plugins', to: 'ckeditor/plugins/[path][name].[ext]', pattern: /(\/lang\/(fr\.js|en\.js)|(^lang\/.*))/}, {from: './node_modules/ckeditor/plugins', to: 'ckeditor/plugins/[path][name].[ext]', pattern: /(\/lang\/(fr\.js|en\.js)|(^lang\/.*))/},
{from: './node_modules/ckeditor/plugins/link', to: 'ckeditor/plugins/link/[path][name].[ext]'}, {from: './node_modules/ckeditor/plugins/link', to: 'ckeditor/plugins/link/[path][name].[ext]'},
{from: './node_modules/ckeditor/plugins/image', to: 'ckeditor/plugins/image/[path][name].[ext]'},
{from: './node_modules/ckeditor/skins', to: 'ckeditor/skins/[path][name].[ext]'} {from: './node_modules/ckeditor/skins', to: 'ckeditor/skins/[path][name].[ext]'}
]) ])
// directory where compiled assets will be stored // directory where compiled assets will be stored
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment