Commit 59f37ed0 by Julien Jorry

- Fix bugs retour Stephan

- Ajout de multiples contacts pour les comptoirs
- fix some js/css
parent 0adf6b51
......@@ -19,6 +19,10 @@
border: 1px solid #FF4136 !important;
}
.leaflet-container {
z-index: 4;
}
.card {
position: relative;
display: -webkit-box;
......
......@@ -20,4 +20,7 @@ body {
}
label.required:after {
content: '*';
}
.leaflet-container {
z-index: 4;
}
\ No newline at end of file
......@@ -9,7 +9,6 @@
require('../css/admin.css');
require('bootstrap');
require('../js/geoloc.js');
// require('../leaflet/leaflet.css');
$('#flash-messages').flashNotification('init');
......
......@@ -9,8 +9,6 @@
// UTILISER LES FONT AWESOME POUR L'ICONOGRAPHIE
require('../../public/fontawesome/css/all.min.css');
// UTILISER LEAFLET POUR LA CARTE
require('../../public/leaflet/leaflet.css');
// CSS DU KOHINOS
require('../css/app.css');
// THEME BOOTSTRAP / BOOTSWATCH + CONFIGURATION GLOBALE (COULEURS, FONTS...)
......
......@@ -15,7 +15,7 @@ parameters:
app.import.header:
groupe:
header: 'name;content;compte'
example: 'Groupe local n°1;<b>Groupe local n°1</b>;123,45'
example: 'Groupe local n°1;<b>Groupe local n°1</b>;123'
file: '/csv/groupe.csv'
comptoir:
header: 'groupe;name;content;phone;adresse;cpostal;ville;compte'
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"devDependencies": {
"@symfony/webpack-encore": "^0.28.2",
"@symfony/webpack-encore": "^0.30.2",
"node-sass": "^4.13.1",
"sass-loader": "^7.1.0",
"sass-loader": "^8.0.0",
"webpack-notifier": "^1.6.0"
},
"license": "UNLICENSED",
......@@ -18,6 +18,6 @@
"bootswatch": "^4.3.1",
"ckeditor": "^4.0.0",
"jquery": "^3.3.1",
"popper.js": "@^1.16.0"
"popper.js": "^1.16.1"
}
}
......@@ -2,20 +2,20 @@
"entrypoints": {
"app": {
"js": [
"/build/runtime.6cf710cd.js",
"/build/app.f9856349.js"
"/build/runtime.420770e4.js",
"/build/app.a6090119.js"
],
"css": [
"/build/app.f6a68444.css"
"/build/app.b1a10d11.css"
]
},
"admin": {
"js": [
"/build/runtime.6cf710cd.js",
"/build/admin.a7f557fb.js"
"/build/runtime.420770e4.js",
"/build/admin.da628ab6.js"
],
"css": [
"/build/admin.fecc301b.css"
"/build/admin.b8c3eca8.css"
]
}
}
......
{
"build/admin.css": "/build/admin.fecc301b.css",
"build/admin.js": "/build/admin.a7f557fb.js",
"build/app.css": "/build/app.f6a68444.css",
"build/app.js": "/build/app.f9856349.js",
"build/runtime.js": "/build/runtime.6cf710cd.js",
"build/admin.css": "/build/admin.b8c3eca8.css",
"build/admin.js": "/build/admin.da628ab6.js",
"build/app.css": "/build/app.b1a10d11.css",
"build/app.js": "/build/app.a6090119.js",
"build/runtime.js": "/build/runtime.420770e4.js",
"build/ckeditor/adapters/jquery.js": "/build/ckeditor/adapters/jquery.js",
"build/ckeditor/ckeditor.js": "/build/ckeditor/ckeditor.js",
"build/ckeditor/config.js": "/build/ckeditor/config.js",
......@@ -2651,22 +2651,19 @@
"build/ckeditor/skins/moono/readme.md": "/build/ckeditor/skins/moono/readme.md",
"build/ckeditor/skins/moono/skin.js": "/build/ckeditor/skins/moono/skin.js",
"build/ckeditor/styles.js": "/build/ckeditor/styles.js",
"build/fonts/fa-brands-400.woff2": "/build/fonts/fa-brands-400.4b115e11.woff2",
"build/fonts/fa-brands-400.woff": "/build/fonts/fa-brands-400.b90365bc.woff",
"build/fonts/fa-brands-400.ttf": "/build/fonts/fa-brands-400.c39278f7.ttf",
"build/fonts/fa-brands-400.eot": "/build/fonts/fa-brands-400.d9d17590.eot",
"build/fonts/fa-regular-400.eot": "/build/fonts/fa-regular-400.414ff5da.eot",
"build/fonts/fa-regular-400.woff": "/build/fonts/fa-regular-400.5dd3976c.woff",
"build/fonts/fa-regular-400.woff2": "/build/fonts/fa-regular-400.65779ebc.woff2",
"build/fonts/fa-regular-400.ttf": "/build/fonts/fa-regular-400.f6c6f6c8.ttf",
"build/fonts/fa-solid-900.woff2": "/build/fonts/fa-solid-900.46280631.woff2",
"build/fonts/fa-solid-900.woff": "/build/fonts/fa-solid-900.61969d43.woff",
"build/fonts/fa-solid-900.eot": "/build/fonts/fa-solid-900.b5596f4d.eot",
"build/fonts/fa-solid-900.ttf": "/build/fonts/fa-solid-900.b70cea03.ttf",
"build/images/fa-brands-400.svg": "/build/images/fa-brands-400.80533988.svg",
"build/images/fa-regular-400.svg": "/build/images/fa-regular-400.e7e957c8.svg",
"build/images/fa-solid-900.svg": "/build/images/fa-solid-900.82905d8d.svg",
"build/images/layers-2x.png": "/build/images/layers-2x.4f0283c6.png",
"build/images/layers.png": "/build/images/layers.a6137456.png",
"build/images/marker-icon.png": "/build/images/marker-icon.2273e3d8.png"
"build/fonts/fa-brands-400.eot": "/build/fonts/fa-brands-400.0f120fbb.eot",
"build/fonts/fa-brands-400.woff2": "/build/fonts/fa-brands-400.3dc44d22.woff2",
"build/fonts/fa-brands-400.woff": "/build/fonts/fa-brands-400.4bd5553b.woff",
"build/fonts/fa-brands-400.ttf": "/build/fonts/fa-brands-400.7ef5344e.ttf",
"build/fonts/fa-regular-400.woff2": "/build/fonts/fa-regular-400.3dc6ca01.woff2",
"build/fonts/fa-regular-400.eot": "/build/fonts/fa-regular-400.5e1bdc3d.eot",
"build/fonts/fa-regular-400.woff": "/build/fonts/fa-regular-400.649e2df1.woff",
"build/fonts/fa-regular-400.ttf": "/build/fonts/fa-regular-400.b25f26d4.ttf",
"build/fonts/fa-solid-900.eot": "/build/fonts/fa-solid-900.008c261a.eot",
"build/fonts/fa-solid-900.ttf": "/build/fonts/fa-solid-900.0a08f058.ttf",
"build/fonts/fa-solid-900.woff2": "/build/fonts/fa-solid-900.496d5fc1.woff2",
"build/fonts/fa-solid-900.woff": "/build/fonts/fa-solid-900.c73abe64.woff",
"build/images/fa-brands-400.svg": "/build/images/fa-brands-400.05d20183.svg",
"build/images/fa-regular-400.svg": "/build/images/fa-regular-400.9a0810d6.svg",
"build/images/fa-solid-900.svg": "/build/images/fa-solid-900.a838c42a.svg"
}
\ No newline at end of file
name;content;compte
Nom du groupe local;Description du groupe (html);Compte du groupe en monnaie locale
Groupe local n°1;<b>Groupe local n°1</b>;123,45
\ No newline at end of file
Nom du groupe local;Description du groupe (html);Compte de billet MLC
Groupe local n°1;<b>Groupe local n°1</b>;123
\ No newline at end of file
......@@ -79,7 +79,7 @@ class AdherentAdmin extends AbstractAdmin
;
if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
$query->andWhere('false');
$query->andWhere('false = true');
}
} else {
$query
......@@ -144,7 +144,9 @@ class AdherentAdmin extends AbstractAdmin
->with('Adresse', ['class' => 'col-md-5'])
->add('geoloc', GeolocFormType::class, array(
'label' => false,
'required' => false
'required' => true,
'with_geoloc' => false,
'with_latlon' => false
))
->end()
->end()
......
......@@ -2,8 +2,10 @@
namespace App\Admin;
use App\Entity\ContactComptoir;
use App\Entity\Geoloc;
use App\Entity\Groupe;
use App\Form\Type\ContactEntityFormType;
use App\Form\Type\GeolocFormType;
use Doctrine\ORM\EntityRepository;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
......@@ -14,8 +16,10 @@ use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper;
use Sonata\DoctrineORMAdminBundle\Filter\CallbackFilter;
use Sonata\MediaBundle\Form\Type\MediaType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Form\Extension\Core\Type\TextType;
......@@ -48,8 +52,8 @@ class ComptoirAdmin extends AbstractAdmin
$query = parent::createQuery($context);
$user = $this->security->getUser();
if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
$query->andWhere('false');
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT') || $user->isGranted('ROLE_TRESORIER')) {
$query->andWhere('false = true');
}
} else {
$query
......@@ -71,8 +75,20 @@ class ComptoirAdmin extends AbstractAdmin
$geoloc = new Geoloc();
$comptoir->setGeoloc($geoloc);
}
// get the current Image instance
$imageHelp = null;
if (!empty($comptoir) && !empty($comptoir->getMedia())) {
$image = $comptoir->getMedia();
if ($image && ($webPath = $image->getWebPath())) {
// get the container so the full path to the image can be set
$container = $this->getConfigurationPool()->getContainer();
$fullPath = $container->get('request_stack')->getCurrentRequest()->getBasePath().'/'.$webPath;
// add a 'help' option containing the preview's img tag
$imageHelp = '<img src="'.$fullPath.'" class="admin-preview" />';
}
}
$formMapper
->with('Comptoir', ['class' => 'col-md-8']);
->with('Comptoir', ['class' => 'col-md-6']);
if (($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) && !empty($this->getRequest()->getSession()->get('_groupegere'))) {
$formMapper->add('groupe', null, array(
'label' => 'Groupe local',
......@@ -96,21 +112,31 @@ class ComptoirAdmin extends AbstractAdmin
'label' => 'Nom',
'required' => true,
))
->add('email', null, array(
'label' => 'Email',
'required' => false,
))
->add('tel', null, array(
'label' => 'Téléphone',
'required' => false,
))
->add('content', CKEditorType::class, array(
'label' => 'Description :',
'required' => false
))
->add('enabled', null, array('label' => 'Activé ?'))
->end()
->with('Geoloc', ['class' => 'col-md-4'])
->with('Contact(s)', ['class' => 'col-md-6'])
->add('contacts', CollectionType::class, array(
'entry_type' => ContactEntityFormType::class,
'entry_options' => array('label' => false, 'data_class' => ContactComptoir::class),
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
'label' => false
))
->end()
->with('Image', ['class' => 'col-md-6'])
->add('media', MediaType::class, array(
'provider' => 'sonata.media.provider.image',
'context' => 'prestataire',
'help' => $imageHelp,
'required' => false
))
->end()
->with('Geoloc', ['class' => 'col-md-6'])
->add('geoloc', GeolocFormType::class, array(
'label' => false,
'required' => true
......
......@@ -43,8 +43,8 @@ class CotisationAdherentAdmin extends CotisationAdmin
// ->andWhere('u.adherent IS NOT NULL')
;
if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
$query->andWhere('false');
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT') || $user->isGranted('ROLE_TRESORIER')) {
$query->andWhere('false = true');
}
} else {
$groupe = $this->getRequest()->getSession()->get('_groupegere');
......
......@@ -45,8 +45,8 @@ class CotisationPrestataireAdmin extends CotisationAdmin
// ->andWhere('u.prestataire IS NOT NULL')
;
if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
$query->andWhere('false');
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT') || $user->isGranted('ROLE_TRESORIER')) {
$query->andWhere('false = true');
}
} else {
$groupe = $this->getRequest()->getSession()->get('_groupegere');
......
......@@ -54,8 +54,8 @@ class GroupeprestataireAdmin extends AbstractAdmin
$user = $this->security->getUser();
$query = parent::createQuery($context);
if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
$query->andWhere('false');
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT') || $user->isGranted('ROLE_TRESORIER')) {
$query->andWhere('false = true');
}
} else {
$query
......
......@@ -4,6 +4,7 @@ namespace App\Admin;
use App\Admin\UserAdmin;
use App\Entity\Adherent;
use App\Entity\ContactPrestataire;
use App\Entity\Cotisation;
use App\Entity\CotisationPrestataire;
use App\Entity\EtatPrestataire;
......@@ -15,7 +16,7 @@ use App\Entity\Rubrique;
use App\Entity\User;
use App\Entity\Usergroup;
use App\Enum\MoyenEnum;
use App\Form\Type\ContactPrestataireFormType;
use App\Form\Type\ContactEntityFormType;
use App\Form\Type\CotisationFormType;
use App\Form\Type\GeolocPrestataireFormType;
use App\Form\Type\UserFormType;
......@@ -96,9 +97,9 @@ class PrestataireAdmin extends AbstractAdmin
$user = $this->security->getUser();
$query = parent::createQuery($context);
if ($user->hasRole('ROLE_GESTION_GROUPE') || $user->hasRole('ROLE_CONTACT')) {
if ($user->hasRole('ROLE_GESTION_GROUPE') || $user->hasRole('ROLE_CONTACT') || $user->isGranted('ROLE_TRESORIER')) {
if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
$query->andWhere('false');
$query->andWhere('false = true');
} else {
$query
->andWhere($query->getRootAliases()[0].'.groupe = :group')
......@@ -225,8 +226,8 @@ class PrestataireAdmin extends AbstractAdmin
->end()
->with('Contact(s)', ['class' => 'col-md-6'])
->add('contacts', CollectionType::class, array(
'entry_type' => ContactPrestataireFormType::class,
'entry_options' => array('label' => false),
'entry_type' => ContactEntityFormType::class,
'entry_options' => array('label' => false, 'data_class' => ContactPrestataire::class),
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
......
......@@ -67,9 +67,9 @@ class TransfertAdmin extends FluxAdmin
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$fluxtable = $em->getMetadataFactory()->getMetadataFor(Flux::class)->getTableName();
if ($this->rolecheck->isGranted('ROLE_GESTION_GROUPE') || $this->rolecheck->isGranted('ROLE_CONTACT')) {
if ($this->rolecheck->isGranted('ROLE_GESTION_GROUPE') || $this->rolecheck->isGranted('ROLE_CONTACT') || $user->isGranted('ROLE_TRESORIER')) {
if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
$query->andWhere('false');
$query->andWhere('false = true');
} else {
$groupe = $this->getRequest()->getSession()->get('_groupegere');
$connection = $em->getConnection();
......@@ -84,7 +84,7 @@ class TransfertAdmin extends FluxAdmin
}
} elseif ($this->rolecheck->isGranted('ROLE_COMPTOIR')) {
if (empty($this->getRequest()->getSession()->get('_comptoirgere'))) {
$query->andWhere('false');
$query->andWhere('false = true');
} else {
$comptoir = $this->getRequest()->getSession()->get('_comptoirgere');
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
......
......@@ -120,10 +120,10 @@ class IndexController extends AbstractController
public function installationAction(Request $request)
{
$siege = $this->em->getRepository(Siege::class)->findOneById(1);
if (!empty($siege)) {
// Installation déjà effectuée !
return $this->redirectToRoute('index');
}
// if (!empty($siege)) {
// // Installation déjà effectuée !
// return $this->redirectToRoute('index');
// }
$repogroup = $this->em->getRepository(Usergroup::class);
$group = $repogroup->findOneBy(array('name' => 'Super Admin'));
if (empty($group)) {
......@@ -311,7 +311,7 @@ class IndexController extends AbstractController
* @Route("/login/groupe/choice/{usergrpid}/{grpid}", name="groupe_choice")
* @ParamConverter("group", class="App:Usergroup", options={"mapping": {"usergrpid": "id"}})
* @ParamConverter("groupe", class="App:Groupe", options={"mapping": {"grpid": "id"}})
* @IsGranted("ROLE_GESTION_GROUPE")
* @IsGranted({"ROLE_GESTION_GROUPE", "ROLE_CONTACT", "ROLE_TRESORIER"})
*/
public function groupeChoiceAction(Usergroup $group, Groupe $groupe, Request $request)
{
......
......@@ -52,7 +52,7 @@ class PrestatairesController extends FrontController
return $this->redirectToRoute('index');
}
$type_presta = $this->em->getRepository(TypePrestataire::class)->findOneBy(array('slug' => 'prestataire'));
$prestas = $this->em->getRepository(Prestataire::class)->findBy(array('enabled' => true, 'typeprestataire' => $type_presta), array('raison' => 'ASC'));
$prestas = $this->em->getRepository(Prestataire::class)->findBy(array('enabled' => true, 'mlc' => false, 'typeprestataire' => $type_presta), array('raison' => 'ASC'));
return $this->render('presta/liste_prestataires.html.twig', array(
'prestas' => $prestas,
......@@ -69,7 +69,7 @@ class PrestatairesController extends FrontController
return $this->redirectToRoute('index');
}
$type_partner = $this->em->getRepository(TypePrestataire::class)->findOneBy(array('slug' => 'partenaire'));
$partners = $this->em->getRepository(Prestataire::class)->findBy(array('enabled' => true, 'typeprestataire' => $type_partner), array('raison' => 'ASC'));
$partners = $this->em->getRepository(Prestataire::class)->findBy(array('enabled' => true, 'mlc' => false, 'typeprestataire' => $type_partner), array('raison' => 'ASC'));
return $this->render('presta/liste_prestataires.html.twig', array(
'prestas' => $partners,
......
......@@ -23,19 +23,10 @@ use Symfony\Component\Translation\TranslatorInterface;
class UserAdherentController extends FluxController
{
protected $em;
protected $translator;
public function __construct(EntityManagerInterface $em, TranslatorInterface $translator)
{
$this->em = $em;
$this->translator = $translator;
}
/**
* @Route("/adherent/infos", name="adherent_infos")
* @IsGranted("ROLE_ADHERENT")
*/
* @Route("/adherent/infos", name="adherent_infos")
* @IsGranted("ROLE_ADHERENT")
*/
public function adherentInfosAction(Request $request)
{
$form = $this->createForm(AdherentInfosFormType::class, $this->getUser()->getAdherent());
......
......@@ -30,7 +30,7 @@ class UserGestionnaireGroupeController extends FluxController
{
/**
* @Route("/user/groupe/infos", name="groupe_infos")
* @Security("is_granted('ROLE_GESTION_GROUPE') or is_granted('ROLE_CONTACT')")
* @IsGranted({"ROLE_GESTION_GROUPE", "ROLE_CONTACT", "ROLE_TRESORIER"})
*/
public function groupeInfosAction(Request $request)
{
......
......@@ -2,7 +2,7 @@
namespace App\Entity;
use App\Entity\EntityTrait\ContactEmailTelTrait;
use App\Entity\ContactComptoir;
use App\Entity\EntityTrait\EnablableEntityTrait;
use App\Entity\EntityTrait\GeolocEntityTrait;
use App\Entity\EntityTrait\HasCompteEntity;
......@@ -38,7 +38,6 @@ class Comptoir
TimestampableEntity,
EnablableEntityTrait,
GeolocEntityTrait,
ContactEmailTelTrait,
HasCompteEntity;
/**
......@@ -72,6 +71,13 @@ class Comptoir
*/
private $gestionnaires;
/**
* @var ArrayCollection|ContactComptoir[]
* @ORM\OneToMany(targetEntity="ContactComptoir", cascade={"persist"}, mappedBy="comptoir")
* @Groups({"read", "write"})
*/
private $contacts;
public function __construct()
{
$this->gestionnaires = new ArrayCollection();
......@@ -154,6 +160,52 @@ class Comptoir
return $this;
}
/**
* getcontacts
* @return ArrayCollection contact
*/
public function getContacts()
{
return $this->contacts;
}
/**
* setContacts
* @param [type] $contacts [description]
*/
public function setContacts($contacts): self
{
$this->contacts = $contacts;
return $this;
}
/**
* @param ContactComptoir $contact
* @return $this
*/
public function addContact(ContactComptoir $contact): self
{
if (!$this->contacts->contains($contact)) {
$this->contacts[] = $contact;
$contact->setComptoir($this);
}
return $this;
}
/**
* @param ContactComptoir $contact
* @return $this
*/
public function removeContact(ContactComptoir $contact): self
{
if ($this->contacts->contains($contact)) {
$this->contacts->removeElement($contact);
$contact->setComptoir(null);
}
return $this;
}
public function __toString(): string
{
return (!empty($this->name)?$this->name:'Comptoir');
......
<?php
namespace App\Entity;
use App\Entity\Comptoir;
use App\Entity\EntityTrait\ContactEmailTelTrait;
use App\Entity\EntityTrait\EnablableEntityTrait;
use App\Entity\EntityTrait\NameSlugContentEntityTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* ApiResource(
* attributes={"security"="is_granted('ROLE_ADMIN_COMPTOIR_GERER_VIEW')"},
* collectionOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_COMPTOIR_GERER_LIST')"},
* "post"={"security"="is_granted('ROLE_ADMIN_COMPTOIR_GERER_EDIT')"}
* },
* itemOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_COMPTOIR_GERER_VIEW')"},
* "put"={"security"="is_granted('ROLE_ADMIN_COMPTOIR_GERER_EDIT')"},
* },
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* @ORM\Entity
* @ORM\Table(name="contact_comptoir")
*/
class ContactComptoir
{
use NameSlugContentEntityTrait,
TimestampableEntity,
EnablableEntityTrait,
ContactEmailTelTrait;
/**
* @var Comptoir
*
* @ORM\ManyToOne(targetEntity="Comptoir", cascade={"persist"}, inversedBy="contacts")
* @ORM\JoinColumn(name="comptoir_id", referencedColumnName="id", nullable=false)
*/
private $comptoir;
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
public function getId(): ?int
{
return $this->id;
}
/**
* Get comptoir
* @return
*/
public function getComptoir(): Comptoir
{
return $this->comptoir;
}
/**
* Set comptoir
* @return $this
*/
public function setComptoir($comptoir): self
{
$this->comptoir = $comptoir;
return $this;
}
}
......@@ -38,13 +38,6 @@ class ContactPrestataire
ContactEmailTelTrait;
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @var Prestataire
*
* @ORM\ManyToOne(targetEntity="Prestataire", cascade={"persist"}, inversedBy="contacts")
......@@ -52,6 +45,13 @@ class ContactPrestataire
*/
private $prestataire;
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
public function getId(): ?int
{
return $this->id;
......
......@@ -13,7 +13,7 @@ use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* FLUX = TRANSFERT ou TRANSACTION ou COTISATIONS
* FLUX = TRANSFERT ou TRANSACTION ou COTISATIONS ou RECONVERSIONS
* @ORM\Entity(repositoryClass="App\Repository\FluxRepository")
* @ORM\HasLifecycleCallbacks()
* @ORM\InheritanceType("SINGLE_TABLE")
......
......@@ -50,7 +50,7 @@ class AdherentInfosFormType extends AbstractType
))
->add('geoloc', GeolocFormType::class, array(
'label' => false,
'required' => false,
'required' => true,
'with_geoloc' => false,
'with_latlon' => false
))
......
......@@ -57,7 +57,7 @@ class AdhererFormType extends AbstractType
// ))
->add('geoloc', GeolocFormType::class, array(
'label' => false,
'required' => false,
'required' => true,
'with_geoloc' => false,
'with_latlon' => false
))
......
<?php
namespace App\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Routing\RouterInterface;
class ContactEntityFormType extends AbstractType
{
private $router;
public function __construct(RouterInterface $router)
{
$this->router = $router;
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', TextType::class, array(
'label' => "Nom du contact / description :",
'required' => true,
))
->add('tel', TextType::class, array(
'label' => "Téléphone :",
'required' => false,
))
->add('email', TextType::class, array(
'label' => "Email :",
'required' => false,
))
->add('enabled', CheckboxType::class, array(
'label' => 'Public ?',
'required' => false,
'label_attr' => array('class' => 'checkbox-inline')
))
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => null,
]);
}
public function getBlockPrefix()
{
return 'formContact';
}
}
......@@ -23,7 +23,7 @@ class RetraitComptoirPrestataireFormType extends RetraitFormType
))
->add('destinataire', EntityType::class, array(
'class' => Prestataire::class,
'choices' => $this->em->getRepository(Prestataire::class)->findBy(array('enabled' => true), array('raison'=> 'ASC')),
'choices' => $this->em->getRepository(Prestataire::class)->findBy(array('enabled' => true, 'mlc' => false), array('raison'=> 'ASC')),
'placeholder' => 'Prestataire',
'required' => true,
'label' => 'Prestataire :',
......
......@@ -23,7 +23,7 @@ class TransactionAdherentPrestataireFormType extends TransactionFormType
))
->add('destinataire', EntityType::class, array(
'class' => Prestataire::class,
'choices' => $this->em->getRepository(Prestataire::class)->findBy(array('enabled' => true), array('raison'=> 'ASC')),
'choices' => $this->em->getRepository(Prestataire::class)->findBy(array('enabled' => true, 'mlc' => false), array('raison'=> 'ASC')),
'placeholder' => 'Prestataire',
'required' => true,
'label' => 'Prestataire :',
......
......@@ -24,7 +24,7 @@ class TransfertPrestataireComptoirFormType extends TransfertFormType
))
->add('expediteur', EntityType::class, array(
'class' => Prestataire::class,
'choices' => $this->em->getRepository(Prestataire::class)->findBy(array('enabled' => true), array('raison' => 'ASC')),
'choices' => $this->em->getRepository(Prestataire::class)->findBy(array('enabled' => true, 'mlc' => false), array('raison' => 'ASC')),
'placeholder' => 'Prestataire',
'required' => true,
'label' => 'Prestataire :',
......
......@@ -23,7 +23,7 @@ class VenteComptoirPrestataireFormType extends VenteFormType
))
->add('destinataire', EntityType::class, array(
'class' => Prestataire::class,
'choices' => $this->em->getRepository(Prestataire::class)->findBy(array('enabled' => true), array('raison'=> 'ASC')),
'choices' => $this->em->getRepository(Prestataire::class)->findBy(array('enabled' => true, 'mlc' => false), array('raison'=> 'ASC')),
'placeholder' => 'Prestataire',
'required' => true,
'label' => 'Prestataire :',
......
<?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 Version20200527135350 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE contact_comptoir (id INT AUTO_INCREMENT NOT NULL, comptoir_id INT NOT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, tel VARCHAR(20) DEFAULT NULL, email VARCHAR(100) DEFAULT NULL, UNIQUE INDEX UNIQ_3CC75FC9989D9B62 (slug), INDEX IDX_3CC75FC9AEB0C1F5 (comptoir_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE contact_comptoir ADD CONSTRAINT FK_3CC75FC9AEB0C1F5 FOREIGN KEY (comptoir_id) REFERENCES comptoir (id)');
$this->addSql('ALTER TABLE comptoir DROP tel, DROP email');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('DROP TABLE contact_comptoir');
$this->addSql('ALTER TABLE comptoir ADD tel VARCHAR(20) CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_general_ci`, ADD email VARCHAR(100) CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_general_ci`');
}
}
......@@ -101,6 +101,9 @@
"doctrine/reflection": {
"version": "v1.0.0"
},
"doctrine/sql-formatter": {
"version": "1.0.1"
},
"egulias/email-validator": {
"version": "2.1.6"
},
......@@ -197,9 +200,6 @@
"imagine/imagine": {
"version": "v0.7.1"
},
"jdorn/sql-formatter": {
"version": "v1.2.17"
},
"jms/metadata": {
"version": "1.7.0"
},
......
......@@ -171,7 +171,9 @@
{% include 'adherent/block/transaction_adherent.html.twig' %}
{% else %}
{% include 'presta/block/carte.html.twig' with {'title': 'Situer les Prestataires'|trans}%}
{% if KOH_USE_WORDPRESS is defined and KOH_USE_WORDPRESS == 'false' %}
{% include 'presta/block/carte.html.twig' with {'title': 'Situer les Prestataires'|trans}%}
{% endif %}
{% endif %}
{% endif %}
</div>
\ No newline at end of file
......@@ -81,13 +81,12 @@
{# https://stackoverflow.com/questions/34369951/how-to-get-add-to-home-screen-pop-up-on-site-open-in-mobile-browser #}
<script>
if ('serviceWorker' in navigator) {
console.log("Will the service worker register?");
navigator.serviceWorker.register('js/service-worker.js')
.then(function(reg){
console.log("Yes, it did.");
}).catch(function(err) {
console.log("No it didn't. This happened:", err)
});
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/js/service-worker.js')
.then(function(reg){
}).catch(function(err) {
});
}
}
</script>
......
......@@ -13,7 +13,7 @@
{% for comptoir in comptoirs %}
{% if comptoir.geoloc != null and comptoir.geoloc.lat != null and comptoir.geoloc.lon != null%}
var marker_{{count}} = L.marker([{{comptoir.geoloc.lat}}, {{comptoir.geoloc.lon}}]).addTo(mymap);
marker_{{count}}.bindPopup("{% spaceless %}{% if comptoir.media != null %}{% thumbnail comptoir.media, 'small' %}<br/><br/>{% endif %}
marker_{{count}}.bindPopup("{% spaceless %}{% if comptoir.media != null %}{% set media %}{% thumbnail comptoir.media, 'small' %}{% endset %} {{ media|raw|replace({'"' : "'"})|raw }}<br/><br/>{% endif %}
<a href='{{ path('show_comptoir', {'slug': comptoir.slug}) }}'>
<strong>{{comptoir.__toString()}}</strong>
<br/>{% endspaceless %}");
......
......@@ -2,25 +2,38 @@
<div class="card-header" style='cursor:pointer;'>
<h2>
<a href='{{ path('show_comptoir', {'slug': comptoir.slug}) }}'>{{comptoir.name}}</a>
{% if comptoir.groupe != null %}
<h5 class="card-subtitle">{{'Groupe local'|trans}} : <a href='{{ path('show_groupe', {'slug': comptoir.groupe.slug}) }}'>{{comptoir.groupe.__toString()}}</a></h5>
{% endif %}
</h2>
</div>
<div class="card-body">
{% if comptoir.groupe != null %}
<h5 class="card-subtitle mb-4">{{'Groupe local'|trans}} : <a href='{{ path('show_groupe', {'slug': comptoir.groupe.slug}) }}'>{{comptoir.groupe.__toString()}}</a></h5>
{% endif %}
{% if comptoir.tel != null %}
<h5 class="card-subtitle mb-1">{{ 'Téléphone'|trans }} : {{comptoir.tel}}</h5>
{% endif %}
{% if comptoir.email != null %}
<h6 class="card-subtitle mb-3">{{ 'Email'|trans }} : {{ comptoir.email|safe_email|raw }}</h6>
{% if comptoir.content != null or comptoir.media != null %}
<div class="card-text mb-3 clearfix">
{% if comptoir.media != null %}
<img class="w-25 float-right mr-2" src="{% path comptoir.media, 'big' %}" alt="{{comptoir.name}}">
{% endif %}
{% if comptoir.content != null %}
<p>{{comptoir.content|truncate(50, true, '...')|raw}}</p>
{% endif %}
</div>
{% endif %}
{% if comptoir.getFullAddresse() != null %}
<h5 class="card-title">{{ 'Adresse'|trans }} :</h5>
<h6 class="card-title text-muted mb-3">{{comptoir.getFullAddresse()}}</h6>
{# @TODO : afficher la carte avec le POI du comptoir #}
{% endif %}
{# {% if comptoir.content != null %}
<div class="card-text">
{{comptoir.content|raw}}
</div>
{% endif %} #}
{% if comptoir.contacts|length > 0%}
<h5 class="card-title">{{ 'Contact'|trans }}{{ (comptoir.contacts|filter(v => v.enabled)|length > 1) ? 's' : '' }} :</h5>
<ul class="list-group">
{% for contact in comptoir.contacts|filter(v => v.enabled) %}
<li class="list-group-item">
<b>{{contact.name}}</b><br/>
{% if contact.tel != null %}{{contact.tel}}<br/>{% endif %}
{% if contact.email != null %}{{contact.email}}{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
</div>
</div>
\ No newline at end of file
......@@ -7,39 +7,49 @@
<div class="card mb-2">
<div class="card-header">
<h1>{{comptoir.name}}</h1>
{% if comptoir.groupe != null %}
<h5 class="card-subtitle">{{'Groupe local'|trans}} : <a href='{{ path('show_groupe', {'slug': comptoir.groupe.slug}) }}'>{{comptoir.groupe.__toString()}}</a></h5>
{% endif %}
{# @TODO : ajouter le lien d'édition uniquement quand l'utilisateur peut l'éditer (Voter?) #}
{% if app.user and is_granted('ROLE_SUPER_ADMIN') %}
<a class='btn btn-primary float-right' href="{{ path('comptoir_edit', {'id': comptoir.id}) }}">Edit</a>
{% endif %}
</div>
<div class="card-body">
{% if comptoir.groupe != null %}
<h4 class="card-subtitle mb-3">{{ 'Groupe local'|trans }} : <a href='{{ path('show_groupe', {'slug': comptoir.groupe.slug}) }}'>{{comptoir.groupe.__toString()}}</a></h4>
{% endif %}
{% if comptoir.tel != null %}
<h5 class="card-subtitle mb-3">{{ 'Téléphone'|trans }} : {{comptoir.tel}}</h5>
{% endif %}
{% if comptoir.email != null %}
<h6 class="card-subtitle mb-3">{{ 'Email'|trans }} : {{ comptoir.email|safe_email|raw }}</h6>
{% if comptoir.content != null or comptoir.media != null %}
<div class="card-text mb-3 clearfix">
{% if comptoir.media != null %}
<img class="w-25 float-right mr-2" src="{% path comptoir.media, 'big' %}" alt="{{comptoir.name}}">
{% endif %}
{% if comptoir.content != null %}
<p>{{comptoir.content|raw}}</p>
{% endif %}
</div>
{% endif %}
{% if comptoir.getFullAddresse() != null %}
<h5 class="card-title">{{ 'Adresse'|trans }} :</h5>
<h6 class="card-title text-muted mb-3">{{comptoir.getFullAddresse()}}</h6>
{# @TODO : afficher la carte avec le POI du comptoir #}
{% endif %}
{% if comptoir.content != null %}
<div class="card-text">
{{comptoir.content|raw}}
</div>
{% endif %}
{% if comptoir.contacts|length > 0%}
<h5 class="card-title">{{ 'Contact'|trans }}{{ (comptoir.contacts|filter(v => v.enabled)|length > 1) ? 's' : '' }} :</h5>
<ul class="list-group">
{% for contact in comptoir.contacts|filter(v => v.enabled) %}
<li class="list-group-item">
<b>{{contact.name}}</b><br/>
{% if contact.tel != null %}{{contact.tel}}<br/>{% endif %}
{% if contact.email != null %}{{contact.email}}{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
</div>
<div class="card-header"><h2>{{ 'Prestataires du groupe'|trans }} ({{ comptoir.groupe.prestataires|length }}) :</h2></div>
<div class="row m-2">
{% for presta in comptoir.groupe.prestataires %}
{% for presta in comptoir.groupe.prestataires|filter(v => v.enabled and not v.mlc) %}
<div class="col-6 mb-2">
{% include 'presta/onepresta.html.twig' %}
</div>
{# <li class="list-group-item">
<a href='{{ path('show_prestataire', {'slug': presta.slug}) }}'>{{presta.raison}}</a>
</li> #}
{% endfor %}
</ul>
</div>
......
......@@ -14,7 +14,7 @@
{% if groupepresta.geoloc != null and groupepresta.geoloc.lat != null and groupepresta.geoloc.lon != null%}
var marker_{{count}} = L.marker([{{groupepresta.geoloc.lat}}, {{groupepresta.geoloc.lon}}]).addTo(mymap);
marker_{{count}}.bindPopup("{% spaceless %}
{% if groupepresta.media != null %}{% thumbnail groupepresta.media, 'small' %}<br/><br/>{% endif %}
{% if groupepresta.media != null %}{% set media %}{% thumbnail groupepresta.media, 'small' %}{% endset %} {{ media|raw|replace({'"' : "'"})|raw }}<br/><br/>{% endif %}
<a href='{{ path('show_groupeprestataire', {'slug': groupepresta.slug}) }}'>
<strong>{{groupepresta.__toString()}}</strong>
</a>
......
......@@ -28,7 +28,7 @@
</div>
<div class="card-header"><h2>{{ groupepresta.groupe.prestataires|length }} {{'prestataires'|trans}} :</h2></div>
<ul class="list-group list-group-flush">
{% for presta in groupepresta.groupe.prestataires %}
{% for presta in groupepresta.groupe.prestataires|filter(v => v.enabled and not v.mlc) %}
<li class="list-group-item">
<a href='{{ path('show_prestataire', {'slug': presta.slug}) }}'>{{presta.raison}}</a>
</li>
......
......@@ -12,7 +12,7 @@
<div class="card-body">
<div class="card-text">
<em>Toutes les informations demandées ci-dessous sont obligatoires mais sont modifiables ensuite dans l'interface d'administration...</em><br/><br/>
{{form_start(form)}}
{{ form_start(form)}}
{{ form_row(form.config) }}
{{ form_row(form.groupe) }}
{{ form_row(form.comptoir) }}
......
......@@ -12,7 +12,7 @@
{% set count = 1 %}
{% for presta in prestataires %}
{% if presta.geolocs|length > 0 %}
{% for geolocp in presta.geolocs %}
{% for geolocp in presta.geolocs %}
{% if geolocp.enabled and geolocp.geoloc.lat != null and geolocp.geoloc.lon != null %}
{% if presta.rubriques.first.media is not null %}
var icon = L.icon({
......@@ -25,7 +25,7 @@
{% else %}
var marker_{{count}} = L.marker([{{geolocp.geoloc.lat}}, {{geolocp.geoloc.lon}}]).addTo(mymap);
{% endif %}
marker_{{count}}.bindPopup("{% spaceless %}{% if presta.media != null %}{#% thumbnail presta.media, 'small' %#}<br/><br/>{% endif %}
marker_{{count}}.bindPopup("{% spaceless %}{% if presta.media != null %}{% set media %}{% thumbnail presta.media, 'small' %}{% endset %} {{ media|raw|replace({'"' : "'"})|raw }}<br/><br/>{% endif %}
<a target='_blank' href='{{ path('show_prestataire', {'slug': presta.slug}) }}'>
<strong style='font-size:16px;'>{{presta.__toString()}}</strong>
</a>
......
......@@ -57,14 +57,12 @@
</ul>
{% endif %}
{% if presta.contacts|length > 0%}
<div class="card-header"><h2>{{ 'Contact(s)'|trans }} :</h2></div>
<div class="card-header"><h2>{{ (presta.contacts|filter(v => v.enabled)|length > 1) ? 's' : '' }} :</h2></div>
<ul class="list-group list-group-flush">
{% for contact in presta.contacts %}
{% if contact.enabled %}
<li class="list-group-item">
{{contact.name}} : {% if contact.tel != null %}{{contact.tel}}{% endif %}{% if contact.email != null %}{{contact.email}}{% endif %}
</li>
{% endif %}
{% for contact in presta.contacts|filter(v => v.enabled) %}
<li class="list-group-item">
{{contact.name}} : {% if contact.tel != null %}{{contact.tel}}{% endif %}{% if contact.email != null %}{{contact.email}}{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
......
......@@ -705,6 +705,22 @@
<source>Cotiser en MLC</source>
<target>Cotiser en MLC</target>
</trans-unit>
<trans-unit id="akpKKLm" resname="Formulaire de contact">
<source>Formulaire de contact</source>
<target>Formulaire de contact</target>
</trans-unit>
<trans-unit id="gsEYSi1" resname="Nom :">
<source>Nom :</source>
<target>Nom :</target>
</trans-unit>
<trans-unit id="JLff1s." resname="Email :">
<source>Email :</source>
<target>Email :</target>
</trans-unit>
<trans-unit id="MGcd4WY" resname="Message :">
<source>Message :</source>
<target>Message :</target>
</trans-unit>
</body>
</file>
</xliff>
......@@ -721,6 +721,22 @@
<source>Cotiser en MLC</source>
<target>Cotiser en MLC</target>
</trans-unit>
<trans-unit id="akpKKLm" resname="Formulaire de contact">
<source>Formulaire de contact</source>
<target>Formulaire de contact</target>
</trans-unit>
<trans-unit id="gsEYSi1" resname="Nom :">
<source>Nom :</source>
<target>Nom :</target>
</trans-unit>
<trans-unit id="JLff1s." resname="Email :">
<source>Email :</source>
<target>Email :</target>
</trans-unit>
<trans-unit id="MGcd4WY" resname="Message :">
<source>Message :</source>
<target>Message :</target>
</trans-unit>
</body>
</file>
</xliff>
This source diff could not be displayed because it is too large. You can view the blob instead.
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