Commit 3e932b61 by Julien Jorry

BIG UPDATE FRONT + BO

parent fb315506
/** /**
* STYLES IMPORTES DE BOOTSTRAP * STYLES IMPORTES DE BOOTSTRAP
*/ */
@import "~bootswatch/dist/lumen/variables";
@import "~bootstrap/scss/bootstrap"; @import "~bootstrap/scss/bootstrap";
@import "~bootstrap/scss/bootstrap-grid"; @import "~bootswatch/dist/lumen/bootswatch";
// @import "~bootstrap/scss/bootstrap-grid";
/** /**
* STYLES DE L'APPLICATION DE L'OUTIL DE GESTION DE MONNAIE LOCALE COMPLEMENTAIRE * STYLES DE L'APPLICATION DE L'OUTIL DE GESTION DE MONNAIE LOCALE COMPLEMENTAIRE
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
*/ */
// any CSS you require will output into a single css file (app.css in this case) // any CSS you require will output into a single css file (app.css in this case)
// require('../css/admin.css'); require('../css/admin.css');
require('bootstrap');
require('../js/flash-messages.js');
// Need jQuery? Install it with "yarn add jquery", then uncomment to require it. // Need jQuery? Install it with "yarn add jquery", then uncomment to require it.
// var $ = require('jquery'); $('#flash-messages').flashNotification('init');
\ No newline at end of file
...@@ -22,7 +22,7 @@ global.$ = global.jQuery = $; ...@@ -22,7 +22,7 @@ global.$ = global.jQuery = $;
require('bootstrap'); require('bootstrap');
// require('../css/lumen/_variables.scss'); // require('../css/lumen/_variables.scss');
// require('../css/lumen/_bootswatch.scss'); // require('../css/lumen/_bootswatch.scss');
require('../css/lumen/bootstrap.min.css'); // require('../css/lumen/bootstrap.min.css');
// require('../leaflet/leaflet.css'); // require('../leaflet/leaflet.css');
...@@ -34,6 +34,48 @@ const mlc = require('../js/mlc.js'); ...@@ -34,6 +34,48 @@ const mlc = require('../js/mlc.js');
// require('../../public/bundles/pixsortablebehavior/js/init.js'); // require('../../public/bundles/pixsortablebehavior/js/init.js');
$('#flash-messages').flashNotification('init'); $('#flash-messages').flashNotification('init');
$(function () {
var $collectionHolder;
// setup an "add a groupe presta (marché amap" link
var $addGroupeButton = $('<button type="button" class="add_groupe_link">Ajouter AMAP / Marché</button>');
var $newLinkLi = $('<p></p>').append($addGroupeButton);
/* */
function addGroupeForm($collectionHolder, $newLinkLi) {
// Get the data-prototype explained earlier
var prototype = $collectionHolder.data('prototype');
// get the new index
var index = $collectionHolder.data('index');
// Replace '__name__' in the prototype's HTML to
// instead be a number based on how many items we have
var newForm = prototype.replace(/__name__/g, index);
// increase the index with one for the next item
$collectionHolder.data('index', index + 1);
// Display the form in the page in an li, before the "Add a groupe" link li
var $newFormLi = $('<p></p>').append(newForm);
$newLinkLi.before($newFormLi);
}
jQuery(document).ready(function() {
// Get the ul that holds the collection of groupes
$collectionHolder = $('.groupeprestas');
// add the "add a groupe" anchor and li to the groupes ul
$collectionHolder.append($newLinkLi);
// count the current form inputs we have (e.g. 2), use that as the new
// index when inserting a new item (e.g. 2)
$collectionHolder.data('index', $collectionHolder.find(':input').length);
$addGroupeButton.on('click', function(e) {
// add a new groupe form (see next code block)
addGroupeForm($collectionHolder, $newLinkLi);
});
// BOOTSTRAP TOOLTIPS
$('[data-toggle="tooltip"]').tooltip() $('[data-toggle="tooltip"]').tooltip()
}) });
...@@ -124,7 +124,7 @@ api_platform: ...@@ -124,7 +124,7 @@ api_platform:
# get: ~ # get: ~
# post: ~ # post: ~
# put: ~ # put: ~
# App\Entity\TransfertPrestataireSiege: # App\Entity\TransfertPrestataireComptoir:
# get: ~ # get: ~
# post: ~ # post: ~
# put: ~ # put: ~
......
...@@ -21,7 +21,7 @@ sonata_admin: ...@@ -21,7 +21,7 @@ sonata_admin:
# action: '@SonataAdmin/CRUD/action.html.twig' # action: '@SonataAdmin/CRUD/action.html.twig'
# select: '@SonataAdmin/CRUD/list__select.html.twig' # select: '@SonataAdmin/CRUD/list__select.html.twig'
# filter: '@SonataAdmin/Form/filter_admin_fields.html.twig' # filter: '@SonataAdmin/Form/filter_admin_fields.html.twig'
# dashboard: '@SonataAdmin/Core/dashboard.html.twig' dashboard: '@SonataAdmin/dashboard.html.twig'
# search: '@SonataAdmin/Core/search.html.twig' # search: '@SonataAdmin/Core/search.html.twig'
# batch_confirmation: '@SonataAdmin/CRUD/batch_confirmation.html.twig' # batch_confirmation: '@SonataAdmin/CRUD/batch_confirmation.html.twig'
# inner_list_row: '@SonataAdmin/CRUD/list_inner_row.html.twig' # inner_list_row: '@SonataAdmin/CRUD/list_inner_row.html.twig'
......
framework: framework:
# ide: 'myide://open?url=file://%%f&line=%%l'
ide: sublime
test: true test: true
session: session:
storage_id: session.storage.mock_file storage_id: session.storage.mock_file
...@@ -7,6 +7,7 @@ parameters: ...@@ -7,6 +7,7 @@ parameters:
locale: 'en' locale: 'en'
sonata.user.admin.user.controller: 'App\Controller\CRUD\CRUDController' sonata.user.admin.user.controller: 'App\Controller\CRUD\CRUDController'
sonata.media.admin.media.class: 'App\Admin\MediaAdmin' sonata.media.admin.media.class: 'App\Admin\MediaAdmin'
mlc_title: 'Outil de gestion de monnaie locale complémentaire' # Nom complet (< 100 caractères)
mlc_name: 'Monnaie locale complémentaire' # Nom complet (< 100 caractères) mlc_name: 'Monnaie locale complémentaire' # Nom complet (< 100 caractères)
mlc_name_small: 'MLC' # Nom court (< 25 caractères) mlc_name_small: 'MLC' # Nom court (< 25 caractères)
slogan: 'Un outil de gestion de la MLC' # Slogan (< 200 caractères) slogan: 'Un outil de gestion de la MLC' # Slogan (< 200 caractères)
...@@ -238,6 +239,8 @@ services: ...@@ -238,6 +239,8 @@ services:
group: "Contenu" group: "Contenu"
label: "Rubriques" label: "Rubriques"
public: true public: true
calls:
- [ setSecurity, ['@security.helper']]
admin.faq.gerer: admin.faq.gerer:
class: App\Admin\FaqAdmin class: App\Admin\FaqAdmin
......
...@@ -595,7 +595,7 @@ App\Entity\TransfertPrestataireComptoir: ...@@ -595,7 +595,7 @@ App\Entity\TransfertPrestataireComptoir:
createdAt: '<dateTimeBetween("-200 days", "now")>' createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transfert' parenttype: 'transfert'
App\Entity\TransfertPrestataireSiege: App\Entity\TransfertPrestataireSiege:
tre_pre_cpt{2..11}: tre_pre_sie{2..11}:
operateur: '@userp<current()>' operateur: '@userp<current()>'
type: 'prestataire_siege' type: 'prestataire_siege'
reference: 'test' reference: 'test'
......
...@@ -1613,6 +1613,11 @@ ...@@ -1613,6 +1613,11 @@
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.2.1.tgz", "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.2.1.tgz",
"integrity": "sha512-tt/7vIv3Gm2mnd/WeDx36nfGGHleil0Wg8IeB7eMrVkY0fZ5iTaBisSh8oNANc2IBsCc6vCgCNTIM/IEN0+50Q==" "integrity": "sha512-tt/7vIv3Gm2mnd/WeDx36nfGGHleil0Wg8IeB7eMrVkY0fZ5iTaBisSh8oNANc2IBsCc6vCgCNTIM/IEN0+50Q=="
}, },
"bootswatch": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/bootswatch/-/bootswatch-4.3.1.tgz",
"integrity": "sha512-kNdpo/TnhO++aic1IODLIe1V0lx6pXwHMpwXMacpANDnuVDtgU1MUgUbVMC3rSWm4UcbImfwPraNYgjKDT0BtA=="
},
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
}, },
"dependencies": { "dependencies": {
"bootstrap": "^4.2.1", "bootstrap": "^4.2.1",
"bootswatch": "^4.3.1",
"jquery": "^3.3.1", "jquery": "^3.3.1",
"popper.js": "^1.14.7" "popper.js": "^1.14.7"
} }
......
...@@ -84,7 +84,7 @@ class CotisationAdherentAdmin extends CotisationAdmin ...@@ -84,7 +84,7 @@ class CotisationAdherentAdmin extends CotisationAdmin
->add('expediteur', EntityType::class, array( ->add('expediteur', EntityType::class, array(
'label' => 'Expéditeur', 'label' => 'Expéditeur',
'class' => Adherent::class, 'class' => Adherent::class,
'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Adherent::class)->findBy(array('enabled' => true)), 'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Adherent::class)->findBy(array('enabled' => true), array('lastname'=> 'ASC')),
'placeholder' => 'Choisir un adhérent', 'placeholder' => 'Choisir un adhérent',
'required' => true, 'required' => true,
)) ))
......
...@@ -86,7 +86,7 @@ class CotisationPrestataireAdmin extends CotisationAdmin ...@@ -86,7 +86,7 @@ class CotisationPrestataireAdmin extends CotisationAdmin
->add('expediteur', EntityType::class, array( ->add('expediteur', EntityType::class, array(
'label' => 'Expéditeur', 'label' => 'Expéditeur',
'class' => Prestataire::class, 'class' => Prestataire::class,
'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findBy(array('enabled' => true)), 'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findBy(array('enabled' => true), array('raison'=> 'ASC')),
'placeholder' => 'Choisir un prestataire', 'placeholder' => 'Choisir un prestataire',
'required' => true, 'required' => true,
)) ))
......
...@@ -99,6 +99,7 @@ class GroupeAdmin extends AbstractAdmin ...@@ -99,6 +99,7 @@ class GroupeAdmin extends AbstractAdmin
unset($this->listModes['mosaic']); unset($this->listModes['mosaic']);
$listMapper $listMapper
->addIdentifier('name', null, array('label' => 'Nom du groupe')) ->addIdentifier('name', null, array('label' => 'Nom du groupe'))
->addIdentifier('gestionnaires', null, array('label' => 'Gestionnaires'))
->addIdentifier('content', 'html', array('truncate' => array('length' => 80), 'label' => 'Description')) ->addIdentifier('content', 'html', array('truncate' => array('length' => 80), 'label' => 'Description'))
->addIdentifier('compte', null, array('label' => 'Solde')) ->addIdentifier('compte', null, array('label' => 'Solde'))
->add( ->add(
......
...@@ -2,13 +2,20 @@ ...@@ -2,13 +2,20 @@
namespace App\Admin; namespace App\Admin;
use App\Entity\Prestataire;
use App\Enum\GroupePrestaEnum;
use FOS\CKEditorBundle\Form\Type\CKEditorType; use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Sonata\AdminBundle\Admin\AbstractAdmin; use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\DatagridMapper; use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper; use Sonata\AdminBundle\Show\ShowMapper;
use Sonata\MediaBundle\Form\Type\MediaType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
...@@ -23,6 +30,11 @@ class GroupeprestataireAdmin extends AbstractAdmin ...@@ -23,6 +30,11 @@ class GroupeprestataireAdmin extends AbstractAdmin
'_sort_by' => 'updatedAt', '_sort_by' => 'updatedAt',
]; ];
public function configure()
{
parent::configure();
}
public function setSecurity(Security $security) public function setSecurity(Security $security)
{ {
$this->security = $security; $this->security = $security;
...@@ -39,18 +51,14 @@ class GroupeprestataireAdmin extends AbstractAdmin ...@@ -39,18 +51,14 @@ class GroupeprestataireAdmin extends AbstractAdmin
if (empty($user->getGroupesgere())) { if (empty($user->getGroupesgere())) {
$query->andWhere('false'); $query->andWhere('false');
} else { } else {
$groupe = $user->getGroupesgere();
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getEntityManager();
$connection = $em->getConnection();
$statement = $connection->prepare('SELECT f.id FROM flux f INNER JOIN adherent a ON (a.id = f.prestataire_id OR a.id = f.prestataire_dest_id) WHERE a.groupe_id = '.$groupe->getId());
$statement->execute();
$ids = $statement->fetchAll();
$query $query
->andWhere($query->expr()->in($query->getRootAliases()[0].'.id', ':ids')) ->andWhere($query->getRootAliases()[0].'.groupe = :groupe')
->setParameter('ids', $ids) ->setParameter('groupe', $user->getGroupesgere())
; ;
} }
} }
// dump($query->getQuery());
// exit();
return $query; return $query;
} }
...@@ -60,29 +68,74 @@ class GroupeprestataireAdmin extends AbstractAdmin ...@@ -60,29 +68,74 @@ class GroupeprestataireAdmin extends AbstractAdmin
*/ */
protected function configureFormFields(FormMapper $formMapper) protected function configureFormFields(FormMapper $formMapper)
{ {
$user = $this->security->getUser();
$prestataires = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findBy(array('enabled' => true));
$groupepresta = $this->getSubject(); $groupepresta = $this->getSubject();
if ($this->isCurrentRoute('create') && $user->getGroupesgere() != null) {
$groupepresta->setGroupe($user->getGroupesgere());
}
$formMapper $formMapper
->add('type', TextType::class, array( ->with('Informations', ['class' => 'col-md-7'])
'label' => 'Type (marche/amap) :', ->add('type', ChoiceType::class, array(
'required' => true 'required' => true,
'choices' => GroupePrestaEnum::getAvailableTypes(),
'choice_label' => function ($choice) {
return GroupePrestaEnum::getTypeName($choice);
},
)) ))
->add('name', TextType::class, array( ->add('name', TextType::class, array(
'label' => 'Nom du groupe :', 'label' => 'Nom du groupe :',
'required' => true 'required' => true
)) ))
->add('content', CKEditorType::class, array( ;
'label' => 'Texte', if (($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) && $this->security->getUser()->getGroupesgere() != null) {
'required' => false, $prestataires = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findBy(array('enabled' => true, 'groupe' => $this->security->getUser()->getGroupesgere()));
}
if ($user->isGranted('ROLE_SUPER_ADMIN') || $user->isGranted('ROLE_ADMIN_SIEGE')) {
$formMapper
->add('groupe', null, array(
'label' => 'Groupe local',
'required' => true,
)) ))
->add('horaires', TextareaType::class, array( ;
}
$formMapper
->add('horaires', CKEditorType::class, array(
'label' => 'Horaires :', 'label' => 'Horaires :',
'required' => false 'required' => false
)) ))
->add('content', CKEditorType::class, array(
'label' => 'Texte',
'required' => false,
))
->add('enabled', CheckboxType::class, array( ->add('enabled', CheckboxType::class, array(
'label' => 'Activé ?', 'label' => 'Activé ?',
'required' => false, 'required' => false,
'label_attr' => array('class' => 'checkbox-inline') 'label_attr' => array('class' => 'checkbox-inline')
)) ))
->end()
->with('Image', ['class' => 'col-md-5'])
->add('image', MediaType::class, array(
'provider' => 'sonata.media.provider.image',
'context' => 'groupe',
'label' => 'Image'
))
->end()
->with('Prestataires', ['class' => 'col-md-5'])
->add('prestataires', CollectionType::class, array(
'label' => 'Prestataires',
'entry_type' => EntityType::class,
'entry_options' => array(
'class' => Prestataire::class,
'choices' => $prestataires,
// 'choice_label' => 'name',
'placeholder' => 'Choisir un prestataire',
'required' => false,
'label' => false),
'by_reference' => false,
'allow_add' => true,
'allow_delete' => true
))
; ;
} }
...@@ -91,7 +144,15 @@ class GroupeprestataireAdmin extends AbstractAdmin ...@@ -91,7 +144,15 @@ class GroupeprestataireAdmin extends AbstractAdmin
*/ */
protected function configureListFields(ListMapper $listMapper) protected function configureListFields(ListMapper $listMapper)
{ {
$user = $this->security->getUser();
unset($this->listModes['mosaic']); unset($this->listModes['mosaic']);
if ($user->isGranted('ROLE_SUPER_ADMIN') || $user->isGranted('ROLE_ADMIN_SIEGE')) {
$listMapper
->addIdentifier('groupe', null, array(
'label' => 'Groupe gestionnaire'
))
;
}
$listMapper $listMapper
->addIdentifier('name', null, array( ->addIdentifier('name', null, array(
'label' => 'Nom du groupe' 'label' => 'Nom du groupe'
...@@ -121,6 +182,27 @@ class GroupeprestataireAdmin extends AbstractAdmin ...@@ -121,6 +182,27 @@ class GroupeprestataireAdmin extends AbstractAdmin
; ;
} }
protected function configureRoutes(RouteCollection $collection)
{
parent::configureRoutes($collection);
$collection->remove('delete');
}
public function getBatchActions()
{
$actions = parent::getBatchActions();
unset($actions['delete']);
return $actions;
}
public function getDashboardActions()
{
$actions = parent::getDashboardActions();
unset($actions['list']);
return $actions;
}
// @TODO : NE FONCTIONNE PAS : pour pouvoir classer par nombre de prestataires ! // @TODO : NE FONCTIONNE PAS : pour pouvoir classer par nombre de prestataires !
// voir https://github.com/sonata-project/SonataDoctrineORMAdminBundle/issues/297 // voir https://github.com/sonata-project/SonataDoctrineORMAdminBundle/issues/297
// public function createQuery($context = 'list') // public function createQuery($context = 'list')
......
...@@ -59,6 +59,31 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -59,6 +59,31 @@ class PrestataireAdmin extends AbstractAdmin
parent::configure(); parent::configure();
} }
/**
* {@inheritdoc}
*/
public function createQuery($context = 'list')
{
$user = $this->security->getUser();
$query = parent::createQuery($context);
$query
->innerJoin($query->getRootAliases()[0] .'.user', 'u')
->addSelect('u')
;
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
if (empty($user->getGroupesgere())) {
$query->andWhere('false');
} else {
$groupe = $user->getGroupesgere();
$query
->andWhere($query->getRootAliases()[0] . '.groupe = :group')
->setParameter('group', $groupe)
;
}
}
return $query;
}
protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null) protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null)
{ {
if (!$childAdmin && !in_array($action, ['edit', 'show'])) { if (!$childAdmin && !in_array($action, ['edit', 'show'])) {
...@@ -414,29 +439,4 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -414,29 +439,4 @@ class PrestataireAdmin extends AbstractAdmin
return $actions; return $actions;
} }
/**
* {@inheritdoc}
*/
public function createQuery($context = 'list')
{
$user = $this->security->getUser();
$query = parent::createQuery($context);
$query
->innerJoin($query->getRootAliases()[0] .'.user', 'u')
->addSelect('u')
;
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
if (empty($user->getGroupesgere())) {
$query->andWhere('false');
} else {
$groupe = $user->getGroupesgere();
$query
->andWhere($query->getRootAliases()[0] . '.groupe = :group')
->setParameter('group', $groupe)
;
}
}
return $query;
}
} }
...@@ -16,19 +16,24 @@ use Symfony\Component\Form\Extension\Core\Type\CheckboxType; ...@@ -16,19 +16,24 @@ use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType; use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Security\Core\Security;
class RubriqueAdmin extends AbstractAdmin class RubriqueAdmin extends AbstractAdmin
{ {
protected $security;
protected $datagridValues = [ protected $datagridValues = [
'_sort_order' => 'ASC', '_sort_order' => 'ASC',
'_sort_by' => 'name', '_sort_by' => 'name',
]; ];
/** public function configure()
* {@inheritdoc} {
*/ parent::configure();
protected function configureShowFields(ShowMapper $showMapper) }
public function setSecurity(Security $security)
{ {
$this->security = $security;
} }
/** /**
...@@ -36,6 +41,11 @@ class RubriqueAdmin extends AbstractAdmin ...@@ -36,6 +41,11 @@ class RubriqueAdmin extends AbstractAdmin
*/ */
protected function configureFormFields(FormMapper $formMapper) protected function configureFormFields(FormMapper $formMapper)
{ {
$user = $this->security->getUser();
$prestataires = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findBy(array('enabled' => true));
// if (($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) && $this->security->getUser()->getGroupesgere() != null) {
// $prestataires = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findBy(array('enabled' => true, 'groupe' => $this->security->getUser()->getGroupesgere()));
// }
$groupe = $this->getSubject(); $groupe = $this->getSubject();
$formMapper $formMapper
->with("Création d'une rubrique") ->with("Création d'une rubrique")
...@@ -52,7 +62,7 @@ class RubriqueAdmin extends AbstractAdmin ...@@ -52,7 +62,7 @@ class RubriqueAdmin extends AbstractAdmin
'entry_type' => EntityType::class, 'entry_type' => EntityType::class,
'entry_options' => array( 'entry_options' => array(
'class' => Prestataire::class, 'class' => Prestataire::class,
'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findBy(array('enabled' => true)), 'choices' => $prestataires,
// 'choice_label' => 'name', // 'choice_label' => 'name',
'placeholder' => 'Choisir un prestataire', 'placeholder' => 'Choisir un prestataire',
'required' => false, 'required' => false,
...@@ -75,6 +85,14 @@ class RubriqueAdmin extends AbstractAdmin ...@@ -75,6 +85,14 @@ class RubriqueAdmin extends AbstractAdmin
$collection->remove('delete'); $collection->remove('delete');
} }
// public function getBatchActions()
// {
// $actions = parent::getBatchActions();
// unset($actions['delete']);
// return $actions;
// }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
...@@ -53,8 +53,7 @@ class TransfertAdmin extends FluxAdmin ...@@ -53,8 +53,7 @@ class TransfertAdmin extends FluxAdmin
->setParameter('ids', $ids) ->setParameter('ids', $ids)
; ;
} }
} } else if ($user->isGranted('ROLE_COMPTOIR')) {
if ($user->isGranted('ROLE_COMPTOIR')) {
if (empty($user->getComptoirsgere())) { if (empty($user->getComptoirsgere())) {
$query->andWhere('false'); $query->andWhere('false');
} else { } else {
......
...@@ -19,11 +19,11 @@ class GroupePrestaController extends AbstractController ...@@ -19,11 +19,11 @@ class GroupePrestaController extends AbstractController
} }
/** /**
* @Route("/groupe/prestataires/{typeslug}/liste", name="groupepresta_liste") * @Route("/groupe/prestataires/{type}/liste", name="groupepresta_liste")
*/ */
public function listeGroupePrestaAction($typeslug, Request $request) public function listeGroupePrestaAction($type, Request $request)
{ {
$groupe = $this->em->getRepository(Groupeprestataire::class)->findBy(array('typeslug' => $typeslug, 'enabled' => true)); $groupe = $this->em->getRepository(Groupeprestataire::class)->findBy(array('type' => $type, 'enabled' => true));
if (empty($groupes)) { if (empty($groupes)) {
return $this->redirectToRoute('index'); return $this->redirectToRoute('index');
} }
...@@ -34,11 +34,11 @@ class GroupePrestaController extends AbstractController ...@@ -34,11 +34,11 @@ class GroupePrestaController extends AbstractController
} }
/** /**
* @Route("/groupe/prestataires/{typeslug}/carte", name="groupepresta_carte") * @Route("/groupe/prestataires/{type}/carte", name="groupepresta_carte")
*/ */
public function carteGroupePrestaAction($typeslug, Request $request) public function carteGroupePrestaAction($type, Request $request)
{ {
$groupes = $this->em->getRepository(Groupeprestataire::class)->findBy(array('typeslug' => $typeslug, 'enabled' => true)); $groupes = $this->em->getRepository(Groupeprestataire::class)->findBy(array('type' => $type, 'enabled' => true));
if (empty($groupes)) { if (empty($groupes)) {
return $this->redirectToRoute('index'); return $this->redirectToRoute('index');
} }
......
...@@ -41,12 +41,21 @@ class UserAdherentController extends AbstractController ...@@ -41,12 +41,21 @@ class UserAdherentController extends AbstractController
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$this->em->persist($form->getData());
$this->em->flush();
$this->addFlash(
'success',
'Infos du prestataire modifiée !'
);
$referer = $request->headers->get('referer');
if ($referer && !$request->isXmlHttpRequest()) {
return $this->redirect($referer);
} elseif (!$request->isXmlHttpRequest()) {
return new Response('', Response::HTTP_BAD_REQUEST);
}
} }
return $this->render('adherent/infos.html.twig', array( return $this->redirectToRoute('index');
'user' => $this->getUser(),
'form' => $form->createView()
));
} }
/** /**
......
<?php
namespace App\Controller;
use App\Entity\Adherent;
use App\Entity\Cotisation;
use App\Entity\Geoloc;
use App\Entity\Groupe;
use App\Entity\TransactionAdherentPrestataire;
use App\Entity\TransfertComptoirAdherent;
use App\Entity\TransfertPrestataireComptoir;
use App\Entity\Usergroup;
use App\Form\Type\AdherentInfosFormType;
use App\Form\Type\AdhererFormType;
use App\Form\Type\GroupeInfosFormType;
use App\Form\Type\TransactionAdherentPrestataireFormType;
use App\Form\Type\TransfertComptoirAdherentFormType;
use App\Form\Type\TransfertPrestataireComptoirFormType;
use Doctrine\ORM\EntityManagerInterface;
use FOS\UserBundle\Model\UserManagerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class UserComptoirController extends AbstractController
{
protected $em;
protected $um;
public function __construct(EntityManagerInterface $em, UserManagerInterface $um)
{
$this->em = $em;
$this->um = $um;
}
/**
* @Route("/user/comptoir/infos", name="comptoir_infos")
* @IsGranted("ROLE_COMPTOIR")
*/
public function groupeInfosAction(Request $request)
{
$form = $this->createForm(ComptoirInfosFormType::class, $this->getUser()->getComptoirsgere());
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$data = $form->getData();
$this->em->persist($data);
$this->em->flush();
$this->addFlash(
'success',
'Comptoir bien modifié !'
);
$referer = $request->headers->get('referer');
if ($referer && !$request->isXmlHttpRequest()) {
return $this->redirect($referer);
} elseif (!$request->isXmlHttpRequest()) {
return new Response('', Response::HTTP_BAD_REQUEST);
}
}
return $this->redirectToRoute('index');
}
/**
* @Route("/user/comptoir/transfert/adherent/", name="transfertComptoirAdherent")
* @IsGranted("ROLE_COMPTOIR")
*/
public function transfertComptoirAdherentAction(Request $request)
{
$entity = new TransfertComptoirAdherent();
$entity->setOperateur($this->getUser());
$form = $this->createForm(TransfertComptoirAdherentFormType::class, $entity);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$data = $form->getData();
$this->em->persist($data);
$this->em->flush();
$this->addFlash(
'success',
'Transfert bien effectuée !'
);
$referer = $request->headers->get('referer');
if ($referer && !$request->isXmlHttpRequest()) {
return $this->redirect($referer);
} elseif (!$request->isXmlHttpRequest()) {
return new Response('', Response::HTTP_BAD_REQUEST);
}
}
return $this->render('flux/transaction.html.twig', [
'form' => $form->createView(),
'compte' => $this->getUser()->getComptoirsgere()->getCompte(),
'title' => 'Transfert à un adhérent'
]);
}
/**
* @Route("/user/comptoir/reconversion/", name="transfertPrestataireComptoir")
* @IsGranted("ROLE_COMPTOIR")
*/
public function transfertPrestataireComptoirAction(Request $request)
{
$entity = new TransfertPrestataireComptoir();
$entity->setOperateur($this->getUser());
$form = $this->createForm(TransfertPrestataireComptoirFormType::class, $entity);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$data = $form->getData();
$this->em->persist($data);
$this->em->flush();
$this->addFlash(
'success',
'Reconversion bien effectuée !'
);
$referer = $request->headers->get('referer');
if ($referer && !$request->isXmlHttpRequest()) {
return $this->redirect($referer);
} elseif (!$request->isXmlHttpRequest()) {
return new Response('', Response::HTTP_BAD_REQUEST);
}
}
return $this->render('flux/transaction.html.twig', [
'form' => $form->createView(),
'compte' => $this->getUser()->getComptoirsgere()->getCompte(),
'title' => "Reconversion d'un prestataire"
]);
}
}
<?php
namespace App\Controller;
use App\Entity\User;
use App\Form\Type\RegistrationFormType;
use Doctrine\ORM\EntityManagerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class UserController extends AbstractController
{
private $em;
public function __construct(EntityManagerInterface $em)
{
$this->em = $em;
}
/**
* @Route("/userinfos", name="user_infos")
* @IsGranted("ROLE_USER")
*/
public function userInfosAction(Request $request)
{
$form = $this->createForm(RegistrationFormType::class, $this->getUser());
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$this->em->persist($form->getData());
$this->em->flush();
$this->addFlash(
'success',
"Infos de l'utilisateur modifiée !"
);
$referer = $request->headers->get('referer');
if ($referer && !$request->isXmlHttpRequest()) {
return $this->redirect($referer);
} elseif (!$request->isXmlHttpRequest()) {
return new Response('', Response::HTTP_BAD_REQUEST);
}
}
return $this->redirectToRoute('index');
// return $this->render('presta/infos.html.twig', array(
// 'form' => $form->createView()
// ));
}
}
...@@ -5,16 +5,19 @@ namespace App\Controller; ...@@ -5,16 +5,19 @@ namespace App\Controller;
use App\Entity\Adherent; use App\Entity\Adherent;
use App\Entity\Cotisation; use App\Entity\Cotisation;
use App\Entity\Geoloc; use App\Entity\Geoloc;
use App\Entity\Groupe;
use App\Entity\TransactionAdherentPrestataire; use App\Entity\TransactionAdherentPrestataire;
use App\Entity\TransfertGroupeComptoir; use App\Entity\TransfertGroupeComptoir;
use App\Entity\Usergroup; use App\Entity\Usergroup;
use App\Form\Type\AdherentInfosFormType; use App\Form\Type\AdherentInfosFormType;
use App\Form\Type\AdhererFormType; use App\Form\Type\AdhererFormType;
use App\Form\Type\GroupeInfosFormType;
use App\Form\Type\TransactionAdherentPrestataireFormType; use App\Form\Type\TransactionAdherentPrestataireFormType;
use App\Form\Type\TransfertGroupeComptoirFormType; use App\Form\Type\TransfertGroupeComptoirFormType;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use FOS\UserBundle\Model\UserManagerInterface; use FOS\UserBundle\Model\UserManagerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
...@@ -32,21 +35,31 @@ class UserGestionnaireGroupeController extends AbstractController ...@@ -32,21 +35,31 @@ class UserGestionnaireGroupeController extends AbstractController
} }
/** /**
* @Route("/groupe/infos", name="groupe_infos") * @Route("/user/groupe/infos", name="groupe_infos")
* @IsGranted("ROLE_ADHERENT") * @Security("is_granted('ROLE_GESTION_GROUPE') or is_granted('ROLE_CONTACT')")
*/ */
public function groupeInfosAction(Request $request) public function groupeInfosAction(Request $request)
{ {
// $form = $this->createForm(AdherentInfosFormType::class, $this->getUser()->getAdherent()); $form = $this->createForm(GroupeInfosFormType::class, $this->getUser()->getGroupesgere());
// $form->handleRequest($request); $form->handleRequest($request);
// if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
// } $data = $form->getData();
$this->em->persist($data);
$this->em->flush();
$this->addFlash(
'success',
'Groupe local bien modifié !'
);
$referer = $request->headers->get('referer');
if ($referer && !$request->isXmlHttpRequest()) {
return $this->redirect($referer);
} elseif (!$request->isXmlHttpRequest()) {
return new Response('', Response::HTTP_BAD_REQUEST);
}
}
// return $this->render('adherent/infos.html.twig', array( return $this->redirectToRoute('index');
// 'user' => $this->getUser(),
// 'form' => $form->createView()
// ));
} }
/** /**
......
...@@ -5,9 +5,12 @@ namespace App\Controller; ...@@ -5,9 +5,12 @@ namespace App\Controller;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use App\Entity\Rubrique; use App\Entity\Rubrique;
use App\Entity\TransactionPrestataireAdherent; use App\Entity\TransactionPrestataireAdherent;
use App\Entity\TransfertPrestataireSiege;
use App\Entity\TypePrestataire; use App\Entity\TypePrestataire;
use App\Form\Type\GroupePrestataireInscriptionFormType;
use App\Form\Type\PrestataireInfosFormType; use App\Form\Type\PrestataireInfosFormType;
use App\Form\Type\TransactionPrestataireAdherentFormType; use App\Form\Type\TransactionPrestataireAdherentFormType;
use App\Form\Type\TransfertPrestataireSiegeFormType;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
...@@ -35,12 +38,57 @@ class UserPrestataireController extends AbstractController ...@@ -35,12 +38,57 @@ class UserPrestataireController extends AbstractController
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$this->em->persist($form->getData()); $this->em->persist($form->getData());
$this->em->flush(); $this->em->flush();
$this->addFlash(
'success',
'Infos du prestataire modifiée !'
);
$referer = $request->headers->get('referer');
if ($referer && !$request->isXmlHttpRequest()) {
return $this->redirect($referer);
} elseif (!$request->isXmlHttpRequest()) {
return new Response('', Response::HTTP_BAD_REQUEST);
}
}
return $this->redirectToRoute('index');
}
/**
* @Route("/prestatairegroupes/inscription", name="groupeprestataire_inscription")
* @IsGranted("ROLE_PRESTATAIRE")
*/
public function groupePrestataireInscriptionAction(Request $request)
{
$form = $this->createForm(GroupePrestataireInscriptionFormType::class, $this->getUser()->getPrestataire());
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$prestataire = $form->getData();
// $this->getUser()->getPrestataire()->setGroupeprestataires($prestataire->getGroupeprestataires()->getValues());
// dump($prestataire);
// exit();
// dump($this->getUser()->getPrestataire()->getGroupeprestataires());
// exit();
// $this->em->persist($this->getUser()->getPrestataire());
$this->em->persist($prestataire);
$this->em->flush();
$this->addFlash(
'success',
'Information bien prise en compte !'
);
if ($request->isXmlHttpRequest()) {
return new JsonResponse(array('status' => 'success'));
} else {
$referer = $request->headers->get('referer');
if ($referer && !$request->isXmlHttpRequest()) {
return $this->redirect($referer);
} elseif (!$request->isXmlHttpRequest()) {
return new Response('', Response::HTTP_BAD_REQUEST);
}
}
} }
return $this->render('presta/infos.html.twig', array( return $this->redirectToRoute('index');
'user' => $this->getUser(),
'form' => $form->createView()
));
} }
/** /**
...@@ -80,4 +128,39 @@ class UserPrestataireController extends AbstractController ...@@ -80,4 +128,39 @@ class UserPrestataireController extends AbstractController
]); ]);
} }
/**
* @Route("/prestataire/transfert/siege/", name="transactionPrestataireSiege")
* @IsGranted("ROLE_PRESTATAIRE")
*/
public function transfertPrestataireSiegeAction(Request $request)
{
$entity = new TransfertPrestataireSiege();
$entity->setOperateur($this->getUser());
$entity->setExpediteur($this->getUser()->getPrestataire());
$form = $this->createForm(TransfertPrestataireSiegeFormType::class, $entity);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$data = $form->getData();
$this->em->persist($data);
$this->em->flush();
$this->addFlash(
'success',
'Reconversion envoyée, elle sera validée lorsque le virement sera effectué !'
);
$referer = $request->headers->get('referer');
if ($referer && !$request->isXmlHttpRequest()) {
return $this->redirect($referer);
} elseif (!$request->isXmlHttpRequest()) {
return new Response('', Response::HTTP_BAD_REQUEST);
}
}
return $this->render('flux/transaction.html.twig', [
'form' => $form->createView(),
'compte' => $this->getUser()->getPrestataire()->getCompte(),
'title' => 'Reconversion de monnaie au siège'
]);
}
} }
...@@ -39,7 +39,7 @@ class Adherent ...@@ -39,7 +39,7 @@ class Adherent
/** /**
* @var Groupe $groupe * @var Groupe $groupe
* *
* @ORM\ManyToOne(targetEntity="App\Entity\Groupe", inversedBy="adherents") * @ORM\ManyToOne(targetEntity="Groupe", inversedBy="adherents")
*/ */
private $groupe; private $groupe;
......
...@@ -248,6 +248,9 @@ abstract class Flux ...@@ -248,6 +248,9 @@ abstract class Flux
if ($flux->getMontant() <= 0) { if ($flux->getMontant() <= 0) {
throw new \Exception("[FLUX] Opération impossible ! Montant inférieur ou égal à zéro !"); throw new \Exception("[FLUX] Opération impossible ! Montant inférieur ou égal à zéro !");
} }
if ($flux->getExpediteur() == $flux->getDestinataire()) {
throw new \Exception("[FLUX] Opération impossible ! Expediteur et destinataire sont les mêmes !");
}
$compteExp = $flux->getExpediteur()->getCompte() - $flux->getMontant(); $compteExp = $flux->getExpediteur()->getCompte() - $flux->getMontant();
if ($flux->getParenttype() != 'cotisation' || ($flux->getParenttype() == 'cotisation' && $flux->getMoyen() == MoyenEnum::MOYEN_MLC)) { if ($flux->getParenttype() != 'cotisation' || ($flux->getParenttype() == 'cotisation' && $flux->getMoyen() == MoyenEnum::MOYEN_MLC)) {
if ($compteExp < 0) { if ($compteExp < 0) {
......
...@@ -11,6 +11,7 @@ use App\Entity\EntityTrait\ContactEmailTelTrait; ...@@ -11,6 +11,7 @@ use App\Entity\EntityTrait\ContactEmailTelTrait;
use App\Entity\EntityTrait\EnablableEntityTrait; use App\Entity\EntityTrait\EnablableEntityTrait;
use App\Entity\EntityTrait\GeolocEntityTrait; use App\Entity\EntityTrait\GeolocEntityTrait;
use App\Entity\EntityTrait\NameSlugContentEntityTrait; use App\Entity\EntityTrait\NameSlugContentEntityTrait;
use App\Enum\GroupePrestaEnum;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo; use Gedmo\Mapping\Annotation as Gedmo;
...@@ -47,17 +48,9 @@ class Groupeprestataire ...@@ -47,17 +48,9 @@ class Groupeprestataire
protected $type; protected $type;
/** /**
* @var string|null
*
* @Gedmo\Slug(fields={"type"})
* @ORM\Column(length=50, unique=true)
*/
protected $typeslug;
/**
* @var ArrayCollection|Prestataire[] * @var ArrayCollection|Prestataire[]
* *
* @ORM\ManyToMany(targetEntity="Prestataire", inversedBy="groupeprestataires", cascade={"persist"}, fetch="EXTRA_LAZY") * @ORM\ManyToMany(targetEntity="Prestataire", inversedBy="groupeprestataires", cascade={"persist"})
*/ */
protected $prestataires; protected $prestataires;
...@@ -75,6 +68,13 @@ class Groupeprestataire ...@@ -75,6 +68,13 @@ class Groupeprestataire
*/ */
private $horaires; private $horaires;
/**
* @var \Application\Sonata\MediaBundle\Entity\Media
* @ORM\ManyToOne(targetEntity="App\Application\Sonata\MediaBundle\Entity\Media", cascade={"persist"}, fetch="LAZY")
* @ORM\JoinColumn(name="media_id", referencedColumnName="id")
*/
protected $image;
public function __construct() public function __construct()
{ {
$this->prestataires = new ArrayCollection(); $this->prestataires = new ArrayCollection();
...@@ -103,26 +103,11 @@ class Groupeprestataire ...@@ -103,26 +103,11 @@ class Groupeprestataire
*/ */
public function setType($type) public function setType($type)
{ {
$this->type = $type; if (!in_array($type, GroupePrestaEnum::getAvailableTypes())) {
return $this; throw new \InvalidArgumentException("Type de groupe invalide [amap, marche] !");
}
/**
* Get typeslug
* @return string
*/
public function getTypeSlug()
{
return $this->typeslug;
} }
$this->type = $type;
/**
* Set typeslug
* @return $this
*/
public function setTypeSlug($typeslug)
{
$this->typeslug = $typeslug;
return $this; return $this;
} }
...@@ -197,8 +182,36 @@ class Groupeprestataire ...@@ -197,8 +182,36 @@ class Groupeprestataire
return $this->groupe; return $this->groupe;
} }
/**
* Get image
* @return image|null
*/
public function getImage()
{
return $this->image;
}
/**
* Set image
* @return $this
*/
public function setImage($image)
{
$this->image = $image;
return $this;
}
public function getPrestatairesCount() public function getPrestatairesCount()
{ {
return $this->getPrestataires()->count(); return $this->getPrestataires()->count();
} }
public function __toString(): string
{
$return = $this->getName();
if ($this->type != null) {
$return .= ' ('.strtoupper($this->type).')';
}
return $return;
}
} }
...@@ -5,7 +5,9 @@ namespace App\Entity; ...@@ -5,7 +5,9 @@ namespace App\Entity;
use App\Entity\EntityTrait\EnablableEntityTrait; use App\Entity\EntityTrait\EnablableEntityTrait;
use App\Entity\EntityTrait\GeolocEntityTrait; use App\Entity\EntityTrait\GeolocEntityTrait;
use App\Entity\EntityTrait\HasCompteEntity; use App\Entity\EntityTrait\HasCompteEntity;
use App\Entity\Groupeprestataire;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo; use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\Mapping\Annotation\Slug; use Gedmo\Mapping\Annotation\Slug;
...@@ -149,13 +151,14 @@ class Prestataire ...@@ -149,13 +151,14 @@ class Prestataire
/** /**
* @var Groupe $groupe * @var Groupe $groupe
* *
* @ORM\ManyToOne(targetEntity="App\Entity\Groupe", inversedBy="prestataires") * @ORM\ManyToOne(targetEntity="Groupe", inversedBy="prestataires")
*/ */
private $groupe; private $groupe;
/** /**
* @var ArrayCollection|Amap/Marché[] * AMAP / Marché
* @ORM\ManyToMany(targetEntity="Groupeprestataire", mappedBy="prestataires", fetch="EXTRA_LAZY") * @var ArrayCollection|Groupeprestataire[]
* @ORM\ManyToMany(targetEntity="Groupeprestataire", cascade={"persist"}, mappedBy="prestataires")
* @ORM\JoinTable(name="groupes_prestataires") * @ORM\JoinTable(name="groupes_prestataires")
*/ */
private $groupeprestataires; private $groupeprestataires;
...@@ -457,6 +460,16 @@ class Prestataire ...@@ -457,6 +460,16 @@ class Prestataire
} }
/** /**
* @param Amap[]|ArrayCollection
* @return this
*/
public function setGroupeprestataires($groupeprestataires)
{
$this->groupeprestataires = $groupeprestataires;
return $this;
}
/**
* @param Amap $amap * @param Amap $amap
* @return $this * @return $this
*/ */
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace App\Entity; namespace App\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/** /**
* TRANSFERT * TRANSFERT
...@@ -25,10 +26,28 @@ class TransfertPrestataireSiege extends Transfert ...@@ -25,10 +26,28 @@ class TransfertPrestataireSiege extends Transfert
protected $destinataire; protected $destinataire;
/** /**
* @var boolean
* @Assert\Type("bool")
* @ORM\Column(type="boolean")
*/
protected $reconverti = false;
public function getReconverti(): bool
{
return $this->reconverti;
}
public function setReconverti(bool $reconverti)
{
$this->reconverti = $reconverti;
return $this;
}
/**
* @return string * @return string
*/ */
public function getType(): string public function getType(): string
{ {
return 'prestataire_siege'; return 'prestataire_siege'; //reconversion
} }
} }
<?php
namespace App\Enum;
abstract class GroupePrestaEnum
{
const MOYEN_AMAP = "amap";
const MOYEN_MARCHE = "marche";
/** @var array user friendly named type */
protected static $typeName = [
self::MOYEN_AMAP => 'AMAP',
self::MOYEN_MARCHE => 'Marché',
];
/**
* @param string $typeShortName
* @return string
*/
public static function getTypeName($typeShortName)
{
if (!isset(static::$typeName[$typeShortName])) {
return "Unknown type ($typeShortName)";
}
return static::$typeName[$typeShortName];
}
/**
* @return array<string>
*/
public static function getAvailableTypes()
{
return [
self::MOYEN_AMAP,
self::MOYEN_MARCHE
];
}
}
...@@ -8,6 +8,7 @@ abstract class MoyenEnum ...@@ -8,6 +8,7 @@ abstract class MoyenEnum
const MOYEN_ESPECE = "espece"; const MOYEN_ESPECE = "espece";
const MOYEN_CHEQUE = "cheque"; const MOYEN_CHEQUE = "cheque";
const MOYEN_VIREMENT = "virement"; const MOYEN_VIREMENT = "virement";
const MOYEN_TRANSFERT = "transfert";
const MOYEN_HELLOASSO = "helloasso"; const MOYEN_HELLOASSO = "helloasso";
const MOYEN_MLC = "mlc"; const MOYEN_MLC = "mlc";
const MOYEN_AUTRE = "autre"; const MOYEN_AUTRE = "autre";
...@@ -19,6 +20,7 @@ abstract class MoyenEnum ...@@ -19,6 +20,7 @@ abstract class MoyenEnum
self::MOYEN_ESPECE => 'Espèce', self::MOYEN_ESPECE => 'Espèce',
self::MOYEN_CHEQUE => 'Chèque', self::MOYEN_CHEQUE => 'Chèque',
self::MOYEN_VIREMENT => 'Virement', self::MOYEN_VIREMENT => 'Virement',
self::MOYEN_TRANSFERT => 'Transfert',
self::MOYEN_HELLOASSO => 'HelloAsso', self::MOYEN_HELLOASSO => 'HelloAsso',
self::MOYEN_MLC => 'MLC', self::MOYEN_MLC => 'MLC',
self::MOYEN_AUTRE => 'Autre', self::MOYEN_AUTRE => 'Autre',
...@@ -47,6 +49,7 @@ abstract class MoyenEnum ...@@ -47,6 +49,7 @@ abstract class MoyenEnum
self::MOYEN_ESPECE, self::MOYEN_ESPECE,
self::MOYEN_CHEQUE, self::MOYEN_CHEQUE,
self::MOYEN_VIREMENT, self::MOYEN_VIREMENT,
self::MOYEN_TRANSFERT,
self::MOYEN_HELLOASSO, self::MOYEN_HELLOASSO,
self::MOYEN_MLC, self::MOYEN_MLC,
self::MOYEN_AUTRE self::MOYEN_AUTRE
......
...@@ -4,16 +4,30 @@ namespace App\Factory; ...@@ -4,16 +4,30 @@ namespace App\Factory;
use App\Entity\TransactionAdherentAdherent; use App\Entity\TransactionAdherentAdherent;
use App\Entity\TransactionAdherentPrestataire; use App\Entity\TransactionAdherentPrestataire;
use App\Entity\TransactionComptoirAdherent;
use App\Entity\TransactionComptoirGroupe;
use App\Entity\TransactionComptoirPrestataire;
use App\Entity\TransactionPrestataireAdherent; use App\Entity\TransactionPrestataireAdherent;
use App\Entity\TransactionPrestatairePrestataire; use App\Entity\TransactionPrestatairePrestataire;
use App\Entity\TransfertGroupeComptoir; use App\Entity\TransfertGroupeComptoir;
use App\Entity\TransfertPrestataireComptoir;
use App\Entity\TransfertPrestataireSiege;
use App\Entity\TransfertSiegeGroupe; use App\Entity\TransfertSiegeGroupe;
use App\Entity\User; use App\Entity\User;
use App\Enum\MoyenEnum;
use App\Form\Type\AdherentInfosFormType;
use App\Form\Type\ComptoirInfosFormType;
use App\Form\Type\GroupeInfosFormType;
use App\Form\Type\GroupePrestataireInscriptionFormType;
use App\Form\Type\PrestataireInfosFormType;
use App\Form\Type\RegistrationFormType;
use App\Form\Type\TransactionAdherentAdherentFormType; use App\Form\Type\TransactionAdherentAdherentFormType;
use App\Form\Type\TransactionAdherentPrestataireFormType; use App\Form\Type\TransactionAdherentPrestataireFormType;
use App\Form\Type\TransactionPrestataireAdherentFormType; use App\Form\Type\TransactionPrestataireAdherentFormType;
use App\Form\Type\TransactionPrestatairePrestataireFormType; use App\Form\Type\TransactionPrestatairePrestataireFormType;
use App\Form\Type\TransfertGroupeComptoirFormType; use App\Form\Type\TransfertGroupeComptoirFormType;
use App\Form\Type\TransfertPrestataireComptoirFormType;
use App\Form\Type\TransfertPrestataireSiegeFormType;
use App\Form\Type\TransfertSiegeGroupeFormType; use App\Form\Type\TransfertSiegeGroupeFormType;
use Symfony\Component\Form\FormFactoryInterface as FormF; use Symfony\Component\Form\FormFactoryInterface as FormF;
use Symfony\Component\Routing\RouterInterface; use Symfony\Component\Routing\RouterInterface;
...@@ -29,6 +43,66 @@ class FormFactory ...@@ -29,6 +43,66 @@ class FormFactory
$this->router = $router; $this->router = $router;
} }
public function getUserInfosForm(User $user)
{
if (empty($user)) {
return null;
}
$form = $this->ff->create(RegistrationFormType::class, $user, array('action' => $this->router->generate('user_infos')));
return $form->createView();
}
public function getGroupeInfosForm(User $user)
{
if (empty($user) || empty($user->getGroupesgere())) {
return null;
}
$form = $this->ff->create(GroupeInfosFormType::class, $user->getGroupesgere(), array('action' => $this->router->generate('groupe_infos')));
return $form->createView();
}
public function getComptoirInfosForm(User $user)
{
if (empty($user) || empty($user->getComptoirsgere())) {
return null;
}
$form = $this->ff->create(ComptoirInfosFormType::class, $user->getComptoirsgere(), array('action' => $this->router->generate('comptoir_infos')));
return $form->createView();
}
public function getPrestataireInfosForm(User $user)
{
if (empty($user) || empty($user->getPrestataire())) {
return null;
}
$form = $this->ff->create(PrestataireInfosFormType::class, $user->getPrestataire(), array('action' => $this->router->generate('prestataire_infos')));
return $form->createView();
}
public function getAdherentInfosForm(User $user)
{
if (empty($user) || empty($user->getAdherent())) {
return null;
}
$form = $this->ff->create(AdherentInfosFormType::class, $user->getAdherent(), array('action' => $this->router->generate('adherent_infos')));
return $form->createView();
}
public function getGroupePrestataireInscriptionForm(User $user)
{
if (empty($user) || empty($user->getPrestataire())) {
return null;
}
$form = $this->ff->create(GroupePrestataireInscriptionFormType::class, $user->getPrestataire(), array('action' => $this->router->generate('groupeprestataire_inscription')));
return $form->createView();
}
public function getTransactionAdherentAdherentForm(User $user) public function getTransactionAdherentAdherentForm(User $user)
{ {
if (empty($user) || empty($user->getAdherent())) { if (empty($user) || empty($user->getAdherent())) {
...@@ -81,20 +155,50 @@ class FormFactory ...@@ -81,20 +155,50 @@ class FormFactory
return $form->createView(); return $form->createView();
} }
// public function getTransfertComptoirToXForm(User $user, $destinataire) public function getTransfertPrestataireSiegeForm(User $user)
// { {
// $type = strtolower($type); if (empty($user) || empty($user->getPrestataire())) {
// if (empty($user) || empty($user->getComptoirsgere()) || !($type == 'adherent' || $type == 'groupe' || $type == 'prestataire')) { return null;
// return null; }
// } $entity = new TransfertPrestataireSiege();
// $class = 'TransactionComptoir'.ucwords($type); // $entity->setReconverti(false);
// $entity = new $class(); // $entity->setMoyen(MoyenEnum::MOYEN_MLC); //TODO : MOYEN_MLC correct ?
// $entity->setOperateur($user); // $entity->setOperateur($user);
// $entity->setExpediteur($user->getComptoirsgere()); $entity->setExpediteur($user->getPrestataire());
// $form = $this->ff->create('App\Form\Type\TransactionComptoir'.ucwords($type).'FormType', $entity, array('action' => $this->router->generate('transactionComptoir'.ucwords($type)))); $form = $this->ff->create(TransfertPrestataireSiegeFormType::class, $entity, array('action' => $this->router->generate('transactionPrestataireSiege')));
// return $form->createView(); return $form->createView();
// } }
public function getTransfertPrestataireComptoirForm(User $user)
{
if (empty($user) || empty($user->getComptoirsgere())) {
return null;
}
$entity = new TransfertPrestataireComptoir();
// $entity->setReconverti(false);
// $entity->setMoyen(MoyenEnum::MOYEN_MLC); //TODO : MOYEN_MLC correct ?
// $entity->setOperateur($user);
$entity->setDestinataire($user->getComptoirsgere());
$form = $this->ff->create(TransfertPrestataireComptoirFormType::class, $entity, array('action' => $this->router->generate('transfertPrestataireComptoir')));
return $form->createView();
}
public function getTransfertComptoirToXForm(User $user, $type)
{
$type = strtolower($type);
if (empty($user) || empty($user->getComptoirsgere()) || !($type == 'adherent' || $type == 'groupe' || $type == 'prestataire')) {
return null;
}
$class = "App\Entity\TransfertComptoir".ucwords($type);
$entity = new $class();
$entity->setOperateur($user);
$entity->setExpediteur($user->getComptoirsgere());
$form = $this->ff->create('App\Form\Type\TransfertComptoir'.ucwords($type).'FormType', $entity, array('action' => $this->router->generate('transfertComptoir'.ucwords($type))));
return $form->createView();
}
// public function getTransfertGroupeComptoirForm(User $user) // public function getTransfertGroupeComptoirForm(User $user)
// { // {
......
<?php
namespace App\Form\Type;
use App\Entity\Comptoir;
use App\Entity\User;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Sonata\MediaBundle\Form\Type\MediaType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
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;
class ComptoirInfosFormType extends AbstractType
{
protected $container;
protected $em;
public function __construct(ContainerInterface $container, EntityManagerInterface $em)
{
$this->container = $container;
$this->em = $em;
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', TextType::class, array(
'label' => 'Nom :',
'required' => true
))
->add('content', CKEditorType::class, array(
'label' => 'Description :',
'required' => false
))
->add('media', MediaType::class, array(
'provider' => 'sonata.media.provider.image',
'context' => 'comptoir',
'label' => 'Image'
))
->add('save', SubmitType::class, ['label' => "Modifier"])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => Comptoir::class,
'cascade_validation' => true
]);
}
public function getBlockPrefix()
{
return 'formComptoirInfos';
}
}
...@@ -35,17 +35,32 @@ class FluxFormType extends AbstractType ...@@ -35,17 +35,32 @@ class FluxFormType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$flux = $options['data']; $flux = $options['data'];
if (empty($this->security->getUser()) || empty($this->security->getUser()->getId()) || empty($flux) || empty($flux->getExpediteur())) { if (empty($this->security->getUser()) || empty($this->security->getUser()->getId())) {
throw new \Exception("[FLUX] Opération impossible ! Pas d'utilisateur connecté !"); throw new \Exception("[FLUX] Opération impossible ! Pas d'utilisateur connecté !");
} }
$maxvalue = $flux->getExpediteur()->getCompte(); if (empty($flux)) {
throw new \Exception("[FLUX] Opération impossible ! Pas de flux paramétré !");
}
// if (empty($flux) || empty($flux->getExpediteur())) {
// throw new \Exception("[FLUX] Opération impossible ! Pas d'expediteur paramétré !");
// }
$builder $builder
->add('operateur', HiddenType::class, array( ->add('operateur', HiddenType::class, array(
'data' => $this->security->getUser()->getId(), 'data' => $this->security->getUser()->getId(),
'data_class' => null, 'data_class' => null,
'entity_class' => User::class, 'entity_class' => User::class,
'em' => $this->em 'em' => $this->em
));
if (empty($flux->getExpediteur())) {
$builder
->add('montant', MoneyType::class, array(
'label' => 'Montant :',
'required' => true
)) ))
;
} else {
$maxvalue = $flux->getExpediteur()->getCompte();
$builder
->add('montant', MoneyType::class, array( ->add('montant', MoneyType::class, array(
'label' => 'Montant :', 'label' => 'Montant :',
'required' => true, 'required' => true,
...@@ -56,6 +71,9 @@ class FluxFormType extends AbstractType ...@@ -56,6 +71,9 @@ class FluxFormType extends AbstractType
]), ]),
], ],
)) ))
;
}
$builder
->add('reference', TextType::class, array( ->add('reference', TextType::class, array(
'label' => 'Reference :', 'label' => 'Reference :',
'required' => true 'required' => true
......
<?php
namespace App\Form\Type;
use App\Entity\Groupe;
use App\Entity\User;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
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;
class GroupeInfosFormType extends AbstractType
{
protected $container;
protected $em;
public function __construct(ContainerInterface $container, EntityManagerInterface $em)
{
$this->container = $container;
$this->em = $em;
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', TextType::class, array(
'label' => 'Nom :',
'required' => true
))
->add('content', CKEditorType::class, array(
'label' => 'Description :',
'required' => false
))
->add('save', SubmitType::class, ['label' => "Modifier"])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => Groupe::class,
'cascade_validation' => true
]);
}
public function getBlockPrefix()
{
return 'formGroupeInfos';
}
}
<?php
namespace App\Form\Type;
use App\Entity\Groupeprestataire;
use App\Entity\Prestataire;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver;
class GroupePrestataireInscriptionFormType extends AbstractType
{
protected $em;
public function __construct(EntityManagerInterface $em)
{
$this->em = $em;
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$presta = $options['data'];
$builder
// ->add('groupeprestataires', CollectionType::class, array(
// 'label' => 'AMAP / Marchés',
// 'entry_type' => EntityType::class,
// 'entry_options' => array(
// 'class' => Groupeprestataire::class,
// 'choices' => $this->em->getRepository(Groupeprestataire::class)->findBy(array('enabled' => true)),
// 'choice_label' => 'name',
// 'placeholder' => 'Faites votre choix',
// 'required' => false,
// 'label' => false),
// 'by_reference' => false,
// 'allow_add' => true,
// 'allow_delete' => true
// ))
->add('groupeprestataires', CollectionType::class, array(
'label' => 'AMAP / Marchés',
'entry_type' => EntityType::class,
'entry_options' => array(
'class' => Groupeprestataire::class,
'choices' => $this->em->getRepository(Groupeprestataire::class)->findBy(array('enabled' => true)),
'choice_label' => 'name',
'placeholder' => 'groupe',
'required' => false,
'label' => false),
'by_reference' => false,
'allow_add' => true,
'allow_delete' => true,
// 'data' => $presta->getGroupeprestataires()
))
// ->add('groupeprestataires', EntityType::class, array(
// 'label' => 'AMAP / Marchés',
// // 'entry_type' => EntityType::class,
// 'class' => Groupeprestataire::class,
// 'choices' => $this->em->getRepository(Groupeprestataire::class)->findBy(array('enabled' => true)),
// 'choice_label' => 'name',
// 'placeholder' => 'Faites votre choix',
// 'required' => false,
// 'expanded' => true,
// 'multiple' => true,
// // 'mapped' => false,
// // 'data' => $presta->getGroupeprestataires()
// ))
->add('save', SubmitType::class, ['label' => "Valider"])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => Prestataire::class,
'cascade_validation' => true
]);
}
public function getBlockPrefix()
{
return 'groupe_presta_inscription';
}
}
...@@ -5,6 +5,7 @@ namespace App\Form\Type; ...@@ -5,6 +5,7 @@ namespace App\Form\Type;
use App\Entity\Adherent; use App\Entity\Adherent;
use App\Entity\Groupe; use App\Entity\Groupe;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use App\Entity\Rubrique;
use App\Entity\User; use App\Entity\User;
use App\Enum\MoyenEnum; use App\Enum\MoyenEnum;
use App\Form\Type\GeolocFormType; use App\Form\Type\GeolocFormType;
...@@ -18,6 +19,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareTrait; ...@@ -18,6 +19,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
...@@ -64,10 +66,6 @@ class PrestataireInfosFormType extends AbstractType ...@@ -64,10 +66,6 @@ class PrestataireInfosFormType extends AbstractType
'label' => 'Métier responsable :', 'label' => 'Métier responsable :',
'required' => true 'required' => true
)) ))
->add('user', RegistrationFormType::class, array(
'label' => false,
'required' => false
))
->add('groupe', ChoiceType::class, array( ->add('groupe', ChoiceType::class, array(
'required' => true, 'required' => true,
'disabled' => true, 'disabled' => true,
...@@ -80,8 +78,21 @@ class PrestataireInfosFormType extends AbstractType ...@@ -80,8 +78,21 @@ class PrestataireInfosFormType extends AbstractType
'label' => 'ADRESSE', 'label' => 'ADRESSE',
'required' => false 'required' => false
)) ))
->add('rubriques', CollectionType::class, array(
'label' => 'Rubriques',
'entry_type' => EntityType::class,
'entry_options' => array(
'class' => Rubrique::class,
'choices' => $this->container->get('doctrine')->getRepository(Rubrique::class)->findByEnabled(true),
'choice_label' => 'name',
'placeholder' => 'Rubrique',
'required' => false,
'label' => false),
'by_reference' => false,
'allow_add' => true,
'allow_delete' => true
))
->add('save', SubmitType::class, ['label' => "Modifier"]) ->add('save', SubmitType::class, ['label' => "Modifier"])
->add('save2', SubmitType::class, ['label' => "Modifier"])
; ;
} }
......
...@@ -4,6 +4,7 @@ namespace App\Form\Type; ...@@ -4,6 +4,7 @@ namespace App\Form\Type;
use App\Entity\Adherent; use App\Entity\Adherent;
use App\Entity\TransactionAdherentAdherent; use App\Entity\TransactionAdherentAdherent;
use App\Enum\MoyenEnum;
use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
...@@ -22,13 +23,13 @@ class TransactionAdherentAdherentFormType extends TransactionFormType ...@@ -22,13 +23,13 @@ class TransactionAdherentAdherentFormType extends TransactionFormType
)) ))
->add('destinataire', EntityType::class, array( ->add('destinataire', EntityType::class, array(
'class' => Adherent::class, 'class' => Adherent::class,
'choices' => $this->em->getRepository(Adherent::class)->findBy(array('enabled' => true)), 'choices' => $this->em->getRepository(Adherent::class)->findbyExclude($this->security->getUser()->getAdherent()),
'placeholder' => 'Adherent', 'placeholder' => 'Adherent',
'required' => true, 'required' => true,
'label' => 'Adherent :', 'label' => 'Adherent :',
)) ))
->add('moyen', HiddenType::class, array( ->add('moyen', HiddenType::class, array(
'data' => 'virement' 'data' => MoyenEnum::MOYEN_VIREMENT
)) ))
; ;
} }
......
...@@ -23,7 +23,7 @@ class TransactionAdherentPrestataireFormType extends TransactionFormType ...@@ -23,7 +23,7 @@ class TransactionAdherentPrestataireFormType extends TransactionFormType
)) ))
->add('destinataire', EntityType::class, array( ->add('destinataire', EntityType::class, array(
'class' => Prestataire::class, 'class' => Prestataire::class,
'choices' => $this->em->getRepository(Prestataire::class)->findBy(array('enabled' => true)), 'choices' => $this->em->getRepository(Prestataire::class)->findBy(array('enabled' => true), array('raison'=> 'ASC')),
'placeholder' => 'Prestataire', 'placeholder' => 'Prestataire',
'required' => true, 'required' => true,
'label' => 'Prestataire :', 'label' => 'Prestataire :',
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace App\Form\Type; namespace App\Form\Type;
use App\Enum\MoyenEnum;
use App\Form\Type\FluxFormType; use App\Form\Type\FluxFormType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
...@@ -15,6 +16,9 @@ class TransactionFormType extends FluxFormType ...@@ -15,6 +16,9 @@ class TransactionFormType extends FluxFormType
'data' => 'transaction', 'data' => 'transaction',
'data_class' => null 'data_class' => null
)) ))
->add('moyen', HiddenType::class, array(
'data' => MoyenEnum::MOYEN_TRANSFERT
))
; ;
} }
......
...@@ -23,7 +23,7 @@ class TransactionPrestatairePrestataireFormType extends TransactionFormType ...@@ -23,7 +23,7 @@ class TransactionPrestatairePrestataireFormType extends TransactionFormType
)) ))
->add('destinataire', EntityType::class, array( ->add('destinataire', EntityType::class, array(
'class' => Prestataire::class, 'class' => Prestataire::class,
'choices' => $this->em->getRepository(Prestataire::class)->findBy(array('enabled' => true)), 'choices' => $this->em->getRepository(Prestataire::class)->findbyExclude($this->security->getUser()->getPrestataire()),
'placeholder' => 'Prestataire', 'placeholder' => 'Prestataire',
'required' => true, 'required' => true,
'label' => 'Prestataire :', 'label' => 'Prestataire :',
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace App\Form\Type; namespace App\Form\Type;
use App\Enum\MoyenEnum;
use App\Form\Type\FluxFormType; use App\Form\Type\FluxFormType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
...@@ -15,6 +16,9 @@ class TransfertFormType extends FluxFormType ...@@ -15,6 +16,9 @@ class TransfertFormType extends FluxFormType
'data' => 'transfert', 'data' => 'transfert',
'data_class' => null 'data_class' => null
)) ))
->add('moyen', HiddenType::class, array(
'data' => MoyenEnum::MOYEN_TRANSFERT
))
; ;
} }
......
...@@ -4,6 +4,7 @@ namespace App\Form\Type; ...@@ -4,6 +4,7 @@ namespace App\Form\Type;
use App\Entity\Comptoir; use App\Entity\Comptoir;
use App\Entity\Groupe; use App\Entity\Groupe;
use App\Entity\Prestataire;
use App\Entity\TransfertPrestataireComptoir; use App\Entity\TransfertPrestataireComptoir;
use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\HiddenType;
...@@ -15,18 +16,18 @@ class TransfertPrestataireComptoirFormType extends TransfertFormType ...@@ -15,18 +16,18 @@ class TransfertPrestataireComptoirFormType extends TransfertFormType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder $builder
->add('expediteur', HiddenType::class, array( ->add('destinataire', HiddenType::class, array(
'data' => $this->security->getUser()->getPrestataire()->getId(), 'data' => $this->security->getUser()->getComptoirsgere()->getId(),
'data_class' => null, 'data_class' => null,
'entity_class' => Prestataire::class, 'entity_class' => Comptoir::class,
'em' => $this->em 'em' => $this->em
)) ))
->add('destinataire', EntityType::class, array( ->add('expediteur', EntityType::class, array(
'class' => Comptoir::class, 'class' => Prestataire::class,
'choices' => $this->em->getRepository(Comptoir::class)->findBy(array('enabled' => true)), 'choices' => $this->em->getRepository(Prestataire::class)->findBy(array('enabled' => true), array('raison' => 'ASC')),
'placeholder' => 'Comptoir', 'placeholder' => 'Prestataire',
'required' => true, 'required' => true,
'label' => 'Comptoir :', 'label' => 'Prestataire :',
)) ))
; ;
} }
......
<?php
namespace App\Form\Type;
use App\Entity\Prestataire;
use App\Entity\Siege;
use App\Entity\TransfertPrestataireSiege;
use App\Entity\User;
use App\Enum\MoyenEnum;
use App\Form\Type\TransfertFormType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class TransfertPrestataireSiegeFormType extends TransfertFormType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('expediteur', HiddenType::class, array(
'data' => $this->security->getUser()->getPrestataire()->getId(),
'data_class' => null,
'entity_class' => Prestataire::class,
'em' => $this->em
))
->add('destinataire', HiddenType::class, array(
'data' => 1,
'data_class' => null,
'entity_class' => Siege::class,
'em' => $this->em
))
;
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'class' => TransfertPrestataireSiege::class,
));
}
public function getParent()
{
return TransfertFormType::class;
}
public function getBlockPrefix()
{
return 'formTransfertPrestataireSiege';
}
}
<?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 Version20190305161833 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('ALTER TABLE flux ADD reconverti TINYINT(1) DEFAULT NULL');
}
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('ALTER TABLE flux DROP reconverti');
}
}
<?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 Version20190306145550 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('ALTER TABLE groupeprestaire ADD media_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE groupeprestaire ADD CONSTRAINT FK_FB9ABBCEEA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id)');
$this->addSql('CREATE INDEX IDX_FB9ABBCEEA9FDD75 ON groupeprestaire (media_id)');
}
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('ALTER TABLE groupeprestaire DROP FOREIGN KEY FK_FB9ABBCEEA9FDD75');
$this->addSql('DROP INDEX IDX_FB9ABBCEEA9FDD75 ON groupeprestaire');
$this->addSql('ALTER TABLE groupeprestaire DROP media_id');
}
}
<?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 Version20190306150045 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('DROP INDEX UNIQ_FB9ABBCED7E16479 ON groupeprestaire');
$this->addSql('ALTER TABLE groupeprestaire DROP typeslug');
}
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('ALTER TABLE groupeprestaire ADD typeslug VARCHAR(50) NOT NULL COLLATE utf8mb4_unicode_ci');
$this->addSql('CREATE UNIQUE INDEX UNIQ_FB9ABBCED7E16479 ON groupeprestaire (typeslug)');
}
}
...@@ -18,4 +18,22 @@ class AdherentRepository extends ServiceEntityRepository ...@@ -18,4 +18,22 @@ class AdherentRepository extends ServiceEntityRepository
{ {
parent::__construct($registry, Adherent::class); parent::__construct($registry, Adherent::class);
} }
/**
* @return Adherent[] Returns an array of Adherent objects
*/
public function findbyExclude(Adherent $adherent)
{
$qb = $this->createQueryBuilder('p');
return $qb
->leftjoin('p.user', 'u')
->where('p.id != :presta')
->andWhere('p.enabled = :enabled')
->setParameter('presta', $adherent->getId())
->setParameter('enabled', true)
->orderBy('u.lastname', 'ASC')
->getQuery()
->getResult()
;
}
} }
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
namespace App\Repository; namespace App\Repository;
use App\Entity\Adherent; use App\Entity\Adherent;
use App\Entity\Comptoir;
use App\Entity\Flux; use App\Entity\Flux;
use App\Entity\Groupe;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface; use Symfony\Bridge\Doctrine\RegistryInterface;
...@@ -37,6 +39,7 @@ class FluxRepository extends ServiceEntityRepository ...@@ -37,6 +39,7 @@ class FluxRepository extends ServiceEntityRepository
return $qb return $qb
->where($qb->expr()->in('f.id', ':ids')) ->where($qb->expr()->in('f.id', ':ids'))
->setParameter('ids', $results) ->setParameter('ids', $results)
->orderBy('f.createdAt', 'DESC')
->getQuery() ->getQuery()
; ;
} }
...@@ -49,7 +52,7 @@ class FluxRepository extends ServiceEntityRepository ...@@ -49,7 +52,7 @@ class FluxRepository extends ServiceEntityRepository
{ {
$em = $this->getEntityManager(); $em = $this->getEntityManager();
$connection = $em->getConnection(); $connection = $em->getConnection();
$statement = $connection->prepare("SELECT f.id FROM flux f WHERE f.adherent_id = :id"); $statement = $connection->prepare("SELECT f.id FROM flux f WHERE f.adherent_id = :id OR f.adherent_dest_id = :id");
$statement->bindValue('id', $adherent->getId()); $statement->bindValue('id', $adherent->getId());
$statement->execute(); $statement->execute();
$results = $statement->fetchAll(); $results = $statement->fetchAll();
...@@ -57,6 +60,49 @@ class FluxRepository extends ServiceEntityRepository ...@@ -57,6 +60,49 @@ class FluxRepository extends ServiceEntityRepository
return $qb return $qb
->where($qb->expr()->in('f.id', ':ids')) ->where($qb->expr()->in('f.id', ':ids'))
->setParameter('ids', $results) ->setParameter('ids', $results)
->orderBy('f.createdAt', 'DESC')
->getQuery()
;
}
/**
* @param Comptoir $comptoir [description]
* @return Query Returns a query fo finding an array of Flux
*/
public function getQueryByComptoir(Comptoir $comptoir)
{
$em = $this->getEntityManager();
$connection = $em->getConnection();
$statement = $connection->prepare("SELECT f.id FROM flux f WHERE f.comptoir_id = :id");
$statement->bindValue('id', $comptoir->getId());
$statement->execute();
$results = $statement->fetchAll();
$qb = $this->createQueryBuilder('f');
return $qb
->where($qb->expr()->in('f.id', ':ids'))
->setParameter('ids', $results)
->orderBy('f.createdAt', 'DESC')
->getQuery()
;
}
/**
* @param Groupe $groupe [description]
* @return Query Returns a query fo finding an array of Flux
*/
public function getQueryByGroupe(Groupe $groupe)
{
$em = $this->getEntityManager();
$connection = $em->getConnection();
$statement = $connection->prepare("SELECT f.id FROM flux f WHERE f.groupe_id = :id");
$statement->bindValue('id', $groupe->getId());
$statement->execute();
$results = $statement->fetchAll();
$qb = $this->createQueryBuilder('f');
return $qb
->where($qb->expr()->in('f.id', ':ids'))
->setParameter('ids', $results)
->orderBy('f.createdAt', 'DESC')
->getQuery() ->getQuery()
; ;
} }
......
...@@ -36,4 +36,21 @@ class PrestataireRepository extends ServiceEntityRepository ...@@ -36,4 +36,21 @@ class PrestataireRepository extends ServiceEntityRepository
->getResult() ->getResult()
; ;
} }
/**
* @return Prestataire[] Returns an array of Prestataire objects
*/
public function findbyExclude(Prestataire $presta)
{
$qb = $this->createQueryBuilder('p');
return $qb
->where('p.id != :presta')
->andWhere('p.enabled = :enabled')
->setParameter('presta', $presta->getId())
->setParameter('enabled', true)
->orderBy('p.raison', 'ASC')
->getQuery()
->getResult()
;
}
} }
...@@ -8,6 +8,7 @@ use App\Entity\Groupe; ...@@ -8,6 +8,7 @@ use App\Entity\Groupe;
use App\Entity\News; use App\Entity\News;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use App\Entity\Rubrique; use App\Entity\Rubrique;
use App\Entity\Siege;
use App\Entity\User; use App\Entity\User;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserInterface;
...@@ -30,6 +31,7 @@ class AppExtension extends AbstractExtension ...@@ -30,6 +31,7 @@ class AppExtension extends AbstractExtension
public function getFunctions() public function getFunctions()
{ {
return [ return [
new \Twig_SimpleFunction('getSiege', array($this, 'getSiege')),
new \Twig_SimpleFunction('getLastNews', array($this, 'getLastNews')), new \Twig_SimpleFunction('getLastNews', array($this, 'getLastNews')),
new \Twig_SimpleFunction('getAllPrestataires', array($this, 'getAllPrestataires')), new \Twig_SimpleFunction('getAllPrestataires', array($this, 'getAllPrestataires')),
new \Twig_SimpleFunction('getAllComptoirs', array($this, 'getAllComptoirs')), new \Twig_SimpleFunction('getAllComptoirs', array($this, 'getAllComptoirs')),
...@@ -43,6 +45,11 @@ class AppExtension extends AbstractExtension ...@@ -43,6 +45,11 @@ class AppExtension extends AbstractExtension
]; ];
} }
public function getSiege()
{
return $this->container->get('doctrine')->getRepository(Siege::class)->findOneById(1);
}
public function getLastNews($limit = 5) public function getLastNews($limit = 5)
{ {
return $this->container->get('doctrine')->getRepository(News::class)->findBy(array('enabled' => true), array('createdAt' => 'DESC'), $limit); return $this->container->get('doctrine')->getRepository(News::class)->findBy(array('enabled' => true), array('createdAt' => 'DESC'), $limit);
...@@ -81,6 +88,10 @@ class AppExtension extends AbstractExtension ...@@ -81,6 +88,10 @@ class AppExtension extends AbstractExtension
$query = $this->container->get('doctrine')->getRepository(Flux::class)->getQueryByPrestataire($user->getPrestataire()); $query = $this->container->get('doctrine')->getRepository(Flux::class)->getQueryByPrestataire($user->getPrestataire());
} else if ($user->getAdherent() != null) { } else if ($user->getAdherent() != null) {
$query = $this->container->get('doctrine')->getRepository(Flux::class)->getQueryByAdherent($user->getAdherent()); $query = $this->container->get('doctrine')->getRepository(Flux::class)->getQueryByAdherent($user->getAdherent());
} else if ($user->getComptoirsgere() != null) {
$query = $this->container->get('doctrine')->getRepository(Flux::class)->getQueryByComptoir($user->getComptoirsgere());
} else if ($user->getGroupesgere() != null) {
$query = $this->container->get('doctrine')->getRepository(Flux::class)->getQueryByGroupe($user->getGroupesgere());
} }
if ($query != null) { if ($query != null) {
$pagination = $this->paginator->paginate( $pagination = $this->paginator->paginate(
......
...@@ -23,16 +23,48 @@ class FormExtension extends AbstractExtension ...@@ -23,16 +23,48 @@ class FormExtension extends AbstractExtension
public function getFunctions() public function getFunctions()
{ {
return [ return [
new \Twig_SimpleFunction('getUserInfosForm', array($this, 'getUserInfosForm')),
new \Twig_SimpleFunction('getGroupeInfosForm', array($this, 'getGroupeInfosForm')),
new \Twig_SimpleFunction('getComptoirInfosForm', array($this, 'getComptoirInfosForm')),
new \Twig_SimpleFunction('getPrestataireInfosForm', array($this, 'getPrestataireInfosForm')),
new \Twig_SimpleFunction('getAdherentInfosForm', array($this, 'getAdherentInfosForm')),
new \Twig_SimpleFunction('getGroupePrestataireInscriptionForm', array($this, 'getGroupePrestataireInscriptionForm')),
new \Twig_SimpleFunction('getTransactionAdherentAdherentForm', array($this, 'getTransactionAdherentAdherentForm')), new \Twig_SimpleFunction('getTransactionAdherentAdherentForm', array($this, 'getTransactionAdherentAdherentForm')),
new \Twig_SimpleFunction('getTransactionAdherentPrestataireForm', array($this, 'getTransactionAdherentPrestataireForm')), new \Twig_SimpleFunction('getTransactionAdherentPrestataireForm', array($this, 'getTransactionAdherentPrestataireForm')),
new \Twig_SimpleFunction('getTransactionPrestataireAdherentForm', array($this, 'getTransactionPrestataireAdherentForm')), new \Twig_SimpleFunction('getTransactionPrestataireAdherentForm', array($this, 'getTransactionPrestataireAdherentForm')),
new \Twig_SimpleFunction('getTransactionPrestatairePrestataireForm', array($this, 'getTransactionPrestatairePrestataireForm')), new \Twig_SimpleFunction('getTransactionPrestatairePrestataireForm', array($this, 'getTransactionPrestatairePrestataireForm')),
new \Twig_SimpleFunction('getTransfertPrestataireSiegeForm', array($this, 'getTransfertPrestataireSiegeForm')),
new \Twig_SimpleFunction('getTransfertPrestataireComptoirForm', array($this, 'getTransfertPrestataireComptoirForm')),
new \Twig_SimpleFunction('getTransfertComptoirToXForm', array($this, 'getTransfertComptoirToXForm')), new \Twig_SimpleFunction('getTransfertComptoirToXForm', array($this, 'getTransfertComptoirToXForm')),
new \Twig_SimpleFunction('getTransfertGroupeComptoirForm', array($this, 'getTransfertGroupeComptoirForm')), new \Twig_SimpleFunction('getTransfertGroupeComptoirForm', array($this, 'getTransfertGroupeComptoirForm')),
new \Twig_SimpleFunction('getTransfertSiegeGroupeForm', array($this, 'getTransfertSiegeGroupeForm')), new \Twig_SimpleFunction('getTransfertSiegeGroupeForm', array($this, 'getTransfertSiegeGroupeForm')),
]; ];
} }
public function getPrestataireInfosForm(User $user)
{
return $this->container->get('app.formfactory')->getPrestataireInfosForm($user);
}
public function getAdherentInfosForm(User $user)
{
return $this->container->get('app.formfactory')->getAdherentInfosForm($user);
}
public function getUserInfosForm(User $user)
{
return $this->container->get('app.formfactory')->getUserInfosForm($user);
}
public function getGroupeInfosForm(User $user)
{
return $this->container->get('app.formfactory')->getGroupeInfosForm($user);
}
public function getComptoirInfosForm(User $user)
{
return $this->container->get('app.formfactory')->getComptoirInfosForm($user);
}
public function getGroupePrestataireInscriptionForm(User $user)
{
return $this->container->get('app.formfactory')->getGroupePrestataireInscriptionForm($user);
}
public function getTransactionAdherentAdherentForm(User $user) public function getTransactionAdherentAdherentForm(User $user)
{ {
return $this->container->get('app.formfactory')->getTransactionAdherentAdherentForm($user); return $this->container->get('app.formfactory')->getTransactionAdherentAdherentForm($user);
...@@ -49,9 +81,17 @@ class FormExtension extends AbstractExtension ...@@ -49,9 +81,17 @@ class FormExtension extends AbstractExtension
{ {
return $this->container->get('app.formfactory')->getTransactionPrestatairePrestataireForm($user); return $this->container->get('app.formfactory')->getTransactionPrestatairePrestataireForm($user);
} }
public function getTransfertComptoirToXForm(User $user) public function getTransfertPrestataireSiegeForm(User $user)
{
return $this->container->get('app.formfactory')->getTransfertPrestataireSiegeForm($user);
}
public function getTransfertPrestataireComptoirForm(User $user)
{
return $this->container->get('app.formfactory')->getTransfertPrestataireComptoirForm($user);
}
public function getTransfertComptoirToXForm(User $user, $destinataire)
{ {
return $this->container->get('app.formfactory')->getTransfertComptoirToXForm($user); return $this->container->get('app.formfactory')->getTransfertComptoirToXForm($user, $destinataire);
} }
public function getTransfertGroupeComptoirForm(User $user) public function getTransfertGroupeComptoirForm(User $user)
{ {
......
{% extends 'block/block_collapse.html.twig' %}
{% block blocktitle %}
<i class="fa fa-user-tie mr-4"></i> {{'Modifier vos informations'|trans}}
{% endblock blocktitle %}
{% block blocksubtitle %}
{% endblock blocksubtitle %}
{% block blockcontent %}
{% set form = getAdherentInfosForm(app.user) %}
{{form_start(form)}}
{{ form_row(form.user)}}
{{ form_row(form.groupe)}}
{{ form_row(form.geoloc) }}
{{ form_row(form.save) }}
{{form_end(form)}}
{% endblock blockcontent %}
\ No newline at end of file
<div class="card mb-3"> <div class="card mb-3 {% if app.user.adherent.ecompte > 0 %}border-success{% else %}border-error{% endif %}">
<div class="card-header">Solde de mon compte : <b>{{app.user.adherent.ecompte}}</b></div> <div class="card-header"><i class="fa fa-coins mr-4"></i> Solde de mon compte : <b>{{app.user.adherent.ecompte}}</b></div>
</div> </div>
\ No newline at end of file
{% extends 'block/onetransaction.html.twig' %} {% extends 'block/onetransaction.html.twig' %}
{% block blocktitle %} {% block blocktitle %}
<i class="fa fa-user mr-4"></i> Virement vers un adhérent <i class="fa fa-exchange-alt mr-4"></i> Virement vers un adhérent
{% endblock blocktitle %} {% endblock blocktitle %}
{% block blockcontent %} {% block blockcontent %}
{% set form = getTransactionAdherentAdherentForm(app.user) %} {% set form = getTransactionAdherentAdherentForm(app.user) %}
......
{% extends 'block/onetransaction.html.twig' %} {% extends 'block/onetransaction.html.twig' %}
{% block blocktitle %} {% block blocktitle %}
<i class="fa fa-user mr-4"></i> Virement vers un prestataire <i class="fa fa-exchange-alt mr-4"></i> Virement vers un prestataire
{% endblock blocktitle %} {% endblock blocktitle %}
{% block blockcontent %} {% block blockcontent %}
{% set form = getTransactionAdherentPrestataireForm(app.user) %} {% set form = getTransactionAdherentPrestataireForm(app.user) %}
......
{% set idcard = idcard|default(random(500)) %} {% set idcard = idcard|default(random(500)) %}
{% set collapse = collapse is defined ? collapse : 'collapse' %}
<div class="card mb-3"> <div class="card mb-3">
<div class="card-header" style='cursor:pointer;' onmouseover="$(this).addClass('border-primary');" onmouseout="$(this).removeClass('border-primary');" data-toggle="collapse" data-target="#collapse{{idcard}}" aria-expanded="false" aria-controls="collapse{{idcard}}">{% block blocktitle %}TITLE with blocktitle{% endblock blocktitle %}</div> <div class="card-header" style='cursor:pointer;' onmouseover="$(this).addClass('border-primary');" onmouseout="$(this).removeClass('border-primary');" data-toggle="collapse" data-target="#collapse{{idcard}}" aria-expanded="false" aria-controls="collapse{{idcard}}">{% block blocktitle %}TITLE with blocktitle{% endblock blocktitle %}</div>
<div class="card-body collapse" id="collapse{{idcard}}"> <div class="card-body {{collapse}}" id="collapse{{idcard}}" data-parent="#accordion">
<h4 class="card-title">{% block blocksubtitle %}SUBTITLE with blocksubtitle{% endblock blocksubtitle %}</h4> <h4 class="card-title">{% block blocksubtitle %}SUBTITLE with blocksubtitle{% endblock blocksubtitle %}</h4>
<div class="card-text"> <div class="card-text">
{% block blockcontent %}CONTENT with blockcontent{% endblock blockcontent %} {% block blockcontent %}CONTENT with blockcontent{% endblock blockcontent %}
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
{% extends 'block/block_collapse.html.twig' %} {% extends 'block/block_collapse.html.twig' %}
{% block blocktitle %} {% block blocktitle %}
<i class="fa fa-user mr-4"></i> Mes cotisations <i class="fa fa-clipboard-list mr-4"></i> Mes cotisations
{% endblock blocktitle %} {% endblock blocktitle %}
{% block blocksubtitle %} {% block blocksubtitle %}
{% endblock blocksubtitle %} {% endblock blocksubtitle %}
......
{% set compte = compte|default('[ERREUR] !') %}
{% set soldelabel = soldelabel|default('Solde'|trans) %}
{% set icon = icon|default('fa-coins'|trans) %}
<div class="card mb-3">
<div class="card-header"><i class="fa {{icon}} mr-4"></i> {{soldelabel}} : <b>{{compte}}</b></div>
</div>
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
{% extends 'block/block_collapse.html.twig' %} {% extends 'block/block_collapse.html.twig' %}
{% block blocktitle %} {% block blocktitle %}
<i class="fa fa-user mr-4"></i> Opérations <i class="fa fa-list-alt mr-4"></i> Opérations
{% endblock blocktitle %} {% endblock blocktitle %}
{% block blocksubtitle %} {% block blocksubtitle %}
{% endblock blocksubtitle %} {% endblock blocksubtitle %}
......
{# UNIQUEMENT POUR LES TESTS #}
{% if app.environment == 'dev' %}
{% set routeName = routeName|default('index')%}
{% if is_granted('ROLE_PREVIOUS_ADMIN') %}
<div class='w-100 text-center'>
<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=_exit'>
EXIT
</a>
</div>
{% else %}
<div class='mb-2'>
<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=user_prestataire'>
PRESTATAIRE
</a>
<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=user_adherent'>
ADHERENT
</a>
<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=user_adminsiege'>
ADMIN SIEGE
</a>
<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=user_comptoir'>
COMPTOIR
</a>
<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=user_gestiongroupe'>
GESTION GROUPE
</a>
<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=user_contact'>
CONTACT
</a>
<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=user_tresorier'>
TRESORIER
</a>
<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=user_controleur'>
CONTROLEUR
</a>
<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=user_redacteur'>
REDACTEUR
</a>
</div>
{% endif %}
{% endif %}
{# ACTIONS PRINCIPALES POUR CHAQUE UTILISATEUR CONNECTE #}
<div id="accordion">
{% if is_granted('ROLE_ADMIN_SIEGE') %}
{% set siege = getSiege() %}
{% set compte = siege.getCompte() %}
{% set soldelabel = 'Solde du siège'|trans %}
{% include 'block/solde.html.twig' with {'compte': compte, 'soldelabel': soldelabel} %}
{% include 'block/userinfos.html.twig' %}
{% elseif is_granted('ROLE_REDACTEUR') %}
{% elseif is_granted('ROLE_TRESORIER') %}
{% set siege = getSiege() %}
{% set compte = siege.getCompte() %}
{% set soldelabel = 'Solde du siège'|trans %}
{% include 'block/solde.html.twig' with {'compte': compte, 'soldelabel': soldelabel} %}
{% include 'block/userinfos.html.twig' %}
{# {% include 'block/soldegroupes.html.twig' %} #}
{% elseif is_granted('ROLE_CONTROLEUR') %}
{% include 'block/userinfos.html.twig' %}
{% elseif is_granted('ROLE_GESTION_GROUPE') %}
{% if app.user.groupesgere != null %}
{% set compte = app.user.groupesgere.compte %}
{% set soldelabel = 'Solde du groupe'|trans %}
{% include 'block/solde.html.twig' with {'compte': compte, 'soldelabel': soldelabel} %}
{% endif %}
{% include 'groupe/block/infos.html.twig' %}
{% include 'block/userinfos.html.twig' %}
{% elseif is_granted('ROLE_COMPTOIR') %}
{% if app.user.comptoirsgere != null %}
{% set compte = app.user.comptoirsgere.compte %}
{% set soldelabel = 'Solde du comptoir "'|trans ~ app.user.comptoirsgere ~ '"' %}
{% include 'block/solde.html.twig' with {'compte': compte, 'soldelabel': soldelabel} %}
{% endif %}
{% include 'comptoir/block/infos.html.twig' %}
{% include 'block/userinfos.html.twig' %}
{% include 'block/transactions.html.twig' %}
{% include 'comptoir/block/transaction_adherent.html.twig' %}
{% include 'comptoir/block/reconversion.html.twig' %}
{% elseif is_granted('ROLE_CONTACT') %}
{% if app.user.groupesgere != null %}
{% set compte = app.user.groupesgere.compte %}
{% set soldelabel = 'Solde du groupe'|trans %}
{% include 'block/solde.html.twig' with {'compte': compte, 'soldelabel': soldelabel} %}
{% endif %}
{% include 'groupe/block/infos.html.twig' %}
{% include 'block/userinfos.html.twig' %}
{% include 'block/transactions.html.twig' %}
{% elseif is_granted('ROLE_SUPER_ADMIN') %}
{% set siege = getSiege() %}
{% set compte = siege.getCompte() %}
{% set soldelabel = 'Solde du siège'|trans %}
{% include 'block/solde.html.twig' with {'compte': compte, 'soldelabel': soldelabel} %}
{% include 'block/userinfos.html.twig' %}
{% elseif is_granted('ROLE_PRESTATAIRE') %}
{% include 'presta/block/solde.html.twig' %}
{% include 'presta/block/infos.html.twig' %}
{% include 'block/userinfos.html.twig' %}
{% include 'block/cotisations.html.twig' %}
{% include 'block/transactions.html.twig' %}
{% include 'groupepresta/block/inscription.html.twig' %}
{% include 'presta/block/transaction_presta.html.twig' %}
{% include 'presta/block/transaction_adherent.html.twig' %}
{% include 'presta/block/reconversion.html.twig' %}
{% elseif is_granted('ROLE_ADHERENT') %}
{% include 'adherent/block/solde.html.twig' %}
{% include 'adherent/block/infos.html.twig' %}
{% include 'block/cotisations.html.twig' %}
{% include 'block/transactions.html.twig' %}
{% include 'adherent/block/transaction_presta.html.twig' %}
{% include 'adherent/block/transaction_adherent.html.twig' %}
{% else %}
{% include 'presta/block/carte.html.twig' with {'title': 'Situer les Prestataires'|trans}%}
{% endif %}
</div>
\ No newline at end of file
{% extends 'block/block_collapse.html.twig' %}
{% block blocktitle %}
<i class="fa fa-user-cog mr-4"></i> {{'Compte utilisateur'|trans}}
{% endblock blocktitle %}
{% block blocksubtitle %}
{% endblock blocksubtitle %}
{% block blockcontent %}
{% set form = getUserInfosForm(app.user) %}
{{form_start(form)}}
{{ form_row(form.email) }}
{{ form_row(form.firstname) }}
{{ form_row(form.lastname) }}
{{ form_row(form.plainPassword) }}
<input type="submit" id="_submit" name="_submit" value="{{ 'Valider'|trans }}" />
{{form_end(form)}}
{% endblock blockcontent %}
\ No newline at end of file
{#
This file is part of the Sonata package.
(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
{% extends base_template %}
{% block title %}{{ 'title_dashboard'|trans({}, 'SonataAdminBundle') }}{% endblock%}
{% block breadcrumb %}{% endblock %}
{% block content %}
{# AJOUT POUR LA MLC #}
<div class="box">
<div class="box-header text-center">
<h3 class="box-title">{{'ADMINISTRATION'|trans }}</h3>
</div>
<div class="box-body">
{% include 'block/useradmin.html.twig' with {'routeName': 'sonata_admin_dashboard'}%}
</div>
</div>
{% set has_left = false %}
{% for block in blocks.left %}
{% if block.roles|length == 0 or is_granted_affirmative(block.roles) %}
{% set has_left = true %}
{% endif %}
{% endfor %}
{% set has_center = false %}
{% for block in blocks.center %}
{% if block.roles|length == 0 or is_granted_affirmative(block.roles) %}
{% set has_center = true %}
{% endif %}
{% endfor %}
{% set has_right = false %}
{% for block in blocks.right %}
{% if block.roles|length == 0 or is_granted_affirmative(block.roles) %}
{% set has_right = true %}
{% endif %}
{% endfor %}
{% set has_top = false %}
{% for block in blocks.top %}
{% if block.roles|length == 0 or is_granted_affirmative(block.roles) %}
{% set has_top = true %}
{% endif %}
{% endfor %}
{% set has_bottom = false %}
{% for block in blocks.bottom %}
{% if block.roles|length == 0 or is_granted_affirmative(block.roles) %}
{% set has_bottom = true %}
{% endif %}
{% endfor %}
{{ sonata_block_render_event('sonata.admin.dashboard.top', { 'admin_pool': sonata_admin.adminPool }) }}
{% if has_top %}
<div class="row">
{% for block in blocks.top %}
{% if block.roles|length == 0 or is_granted_affirmative(block.roles) %}
<div class="{{ block.class }}">
{{ sonata_block_render({ 'type': block.type, 'settings': block.settings}) }}
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
<div class="row">
{% set width_left = 4 %}
{% set width_right = 4 %}
{% set width_center = 4 %}
{# if center block is not present we make left and right ones wider #}
{% if not has_center %}
{% set width_left = 6 %}
{% set width_right = 6 %}
{% endif %}
{# if there is no right and left block present we make center one full width #}
{% if not has_left and not has_right %}
{% set width_center = 12 %}
{% endif %}
{# don't show left column if only center one is present #}
{% if has_left or has_right %}
<div class="col-md-{{ width_left }}">
{% for block in blocks.left %}
{% if block.roles|length == 0 or is_granted_affirmative(block.roles) %}
{{ sonata_block_render({ 'type': block.type, 'settings': block.settings}) }}
{% endif %}
{% endfor %}
</div>
{% endif %}
{% if has_center %}
<div class="col-md-{{ width_center }}">
{% for block in blocks.center %}
{% if block.roles|length == 0 or is_granted_affirmative(block.roles) %}
{{ sonata_block_render({ 'type': block.type, 'settings': block.settings}) }}
{% endif %}
{% endfor %}
</div>
{% endif %}
{# don't show right column if only center one is present #}
{% if has_left or has_right %}
<div class="col-md-{{ width_right }}">
{% for block in blocks.right %}
{% if block.roles|length == 0 or is_granted_affirmative(block.roles) %}
{{ sonata_block_render({ 'type': block.type, 'settings': block.settings}) }}
{% endif %}
{% endfor %}
</div>
{% endif %}
</div>
{% if has_bottom %}
<div class="row">
{% for block in blocks.bottom %}
{% if block.roles|length == 0 or is_granted_affirmative(block.roles) %}
<div class="{{ block.class }}">
{{ sonata_block_render({ 'type': block.type, 'settings': block.settings}) }}
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
{{ sonata_block_render_event('sonata.admin.dashboard.bottom', { 'admin_pool': sonata_admin.adminPool }) }}
{% endblock %}
{# {#
This file is part of the Sonata package. Modified for MLC from Sonata package.
(c) Thomas Rabaix <thomas.rabaix@sonata-project.org> (c) Julien Jorry <julien.jorry@gmail.com>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#} #}
...@@ -28,6 +25,7 @@ file that was distributed with this source code. ...@@ -28,6 +25,7 @@ file that was distributed with this source code.
{% block meta_tags %} {% block meta_tags %}
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="UTF-8"> <meta charset="UTF-8">
<link rel="shortcut icon" href="{{parameter('favicon_url')}}" type="image/x-icon" />
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'> <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
{% endblock %} {% endblock %}
...@@ -128,6 +126,8 @@ file that was distributed with this source code. ...@@ -128,6 +126,8 @@ file that was distributed with this source code.
{% endblock %} {% endblock %}
{% block logo %} {% block logo %}
{% spaceless %} {% spaceless %}
{# MLC : LIEN VERS LE FRONT SUR LE LOGO #}
{# <a class="logo" href="{{ path('index') }}"> #}
<a class="logo" href="{{ path('sonata_admin_dashboard') }}"> <a class="logo" href="{{ path('sonata_admin_dashboard') }}">
{% if 'single_image' == sonata_admin.adminPool.getOption('title_mode') or 'both' == sonata_admin.adminPool.getOption('title_mode') %} {% if 'single_image' == sonata_admin.adminPool.getOption('title_mode') or 'both' == sonata_admin.adminPool.getOption('title_mode') %}
<img src="{{ asset(sonata_admin.adminPool.titlelogo) }}" alt="{{ sonata_admin.adminPool.title }}"> <img src="{{ asset(sonata_admin.adminPool.titlelogo) }}" alt="{{ sonata_admin.adminPool.title }}">
...@@ -140,6 +140,16 @@ file that was distributed with this source code. ...@@ -140,6 +140,16 @@ file that was distributed with this source code.
{% endblock %} {% endblock %}
{% block sonata_nav %} {% block sonata_nav %}
<nav class="navbar navbar-static-top" role="navigation"> <nav class="navbar navbar-static-top" role="navigation">
{# MLC : AJOUT POUR LIEN VERS LE FRONT #}
{% block front %}
<a href="{{path('index')}}" class="sidebar-front"
role="button" title="{{ "Page d'accueil"|trans({}, 'app') }}">
<i class="fa fa-lg fa-home"></i>
<span class="sr-only">{{ "Page d'accueil"|trans({}, 'app') }}</span>
</a>
{% endblock front %}
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" <a href="#" class="sidebar-toggle" data-toggle="offcanvas"
role="button" title="{{ 'toggle_navigation'|trans({}, 'SonataAdminBundle') }}"> role="button" title="{{ 'toggle_navigation'|trans({}, 'SonataAdminBundle') }}">
<span class="sr-only">{{ 'toggle_navigation'|trans({}, 'SonataAdminBundle') }}</span> <span class="sr-only">{{ 'toggle_navigation'|trans({}, 'SonataAdminBundle') }}</span>
...@@ -398,8 +408,9 @@ file that was distributed with this source code. ...@@ -398,8 +408,9 @@ file that was distributed with this source code.
{% endblock %} {% endblock %}
{% endif %} {% endif %}
{# AJOUT POUR EDITABLE BOOLEAN #} {# MLC : AJOUT POUR EDITABLE BOOLEAN #}
{% block js %} {% block js %}
{{ encore_entry_script_tags('admin') }}
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$.datepicker.regional['fr'] = { $.datepicker.regional['fr'] = {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
{# FAVICON #} {# FAVICON #}
<link rel="shortcut icon" href="{{parameter('favicon_url')}}" type="image/x-icon" /> <link rel="shortcut icon" href="{{parameter('favicon_url')}}" type="image/x-icon" />
{# UTILISER LES FONT AWESOME POUR L'ICONOGRAPHIE #} {# UTILISER LES FONT AWESOME POUR L'ICONOGRAPHIE #}
<link rel="stylesheet" href="/fontawesome/css/all.css"> <link rel="stylesheet" href="/fontawesome/css/all.min.css">
{# UTILISER LEAFLET POUR LA CARTE #} {# UTILISER LEAFLET POUR LA CARTE #}
<link rel="stylesheet" href="/leaflet/leaflet.css"> <link rel="stylesheet" href="/leaflet/leaflet.css">
......
...@@ -54,23 +54,20 @@ ...@@ -54,23 +54,20 @@
{# MENU ADHERENT CONNECTE #} {# MENU ADHERENT CONNECTE #}
{% if is_granted('ROLE_ADHERENT') %} {% if is_granted('ROLE_ADHERENT') %}
<a href="{{ path('adherent_infos') }}" class="dropdown-item">{{ 'Mes infos'|trans }}</a> {# <a href="{{ path('adherent_infos') }}" class="dropdown-item">{{ 'Mes infos'|trans }}</a>
<a href="{{ path('transactionAdherentPrestataire') }}" class="dropdown-item">{{ 'Transaction vers presta'|trans }}</a> <a href="{{ path('transactionAdherentPrestataire') }}" class="dropdown-item">{{ 'Transaction vers presta'|trans }}</a>
<a href="{{ path('transactionAdherentAdherent') }}" class="dropdown-item">{{ 'Transaction vers adherent'|trans }}</a> <a href="{{ path('transactionAdherentAdherent') }}" class="dropdown-item">{{ 'Transaction vers adherent'|trans }}</a> #}
{% endif %} {% endif %}
{# MENU PRESTATAIRE CONNECTE #} {# MENU PRESTATAIRE CONNECTE #}
{% if is_granted('ROLE_PRESTATAIRE') %} {% if is_granted('ROLE_PRESTATAIRE') %}
<a href="{{ path('prestataire_infos') }}" class="dropdown-item">{{ 'Mes infos'|trans }}</a> {# <a href="{{ path('prestataire_infos') }}" class="dropdown-item">{{ 'Mes infos'|trans }}</a>
<a href="{{ path('transactionPrestataireAdherent') }}" class="dropdown-item">{{ 'Transaction vers adherent'|trans }}</a> <a href="{{ path('transactionPrestataireAdherent') }}" class="dropdown-item">{{ 'Transaction vers adherent'|trans }}</a>
<a href="{{ path('transactionPrestatairePrestataire') }}" class="dropdown-item">{{ 'Transaction vers presta'|trans }}</a> <a href="{{ path('transactionPrestatairePrestataire') }}" class="dropdown-item">{{ 'Transaction vers presta'|trans }}</a> #}
{% endif %} {% endif %}
{# MENU PRESTATAIRE CONNECTE #} {# MENU TRESORIER CONNECTE #}
{% if is_granted('ROLE_TRESORIER') %} {% if is_granted('ROLE_TRESORIER') %}
<a href="{{ path('prestataire_infos') }}" class="dropdown-item">{{ 'Mes infos'|trans }}</a>
<a href="{{ path('transactionPrestataireAdherent') }}" class="dropdown-item">{{ 'Transaction vers adherent'|trans }}</a>
<a href="{{ path('transactionPrestatairePrestataire') }}" class="dropdown-item">{{ 'Transaction vers presta'|trans }}</a>
{% endif %} {% endif %}
{% if app.user.groups|length > 1 %} {% if app.user.groups|length > 1 %}
......
{% extends 'block/block_collapse.html.twig' %}
{% block blocktitle %}
<i class="fa fa-cogs mr-4"></i> {{'Configuration du Comptoir'|trans}}
{% endblock blocktitle %}
{% block blocksubtitle %}
{% endblock blocksubtitle %}
{% block blockcontent %}
{% set form = getComptoirInfosForm(app.user) %}
{{form_start(form)}}
{{ form_row(form.name) }}
{{ form_row(form.content) }}
{{ form_row(form.media) }}
{{ form_row(form.save) }}
{{form_end(form)}}
{% endblock blockcontent %}
\ No newline at end of file
{% extends 'block/onetransaction.html.twig' %}
{% block blocktitle %}
<i class="fa fa-external-link-alt mr-4"></i> Reconversion
{% endblock blocktitle %}
{% block blockcontent %}
{% set form = getTransfertPrestataireComptoirForm(app.user) %}
{{ parent() }}
{% endblock blockcontent %}
\ No newline at end of file
{% extends 'block/onetransaction.html.twig' %}
{% block blocktitle %}
<i class="fa fa-exchange-alt mr-4"></i> Virement vers un adhérent
{% endblock blocktitle %}
{% block blockcontent %}
{% set form = getTransfertComptoirToXForm(app.user, 'adherent') %}
{{ parent() }}
{% endblock blockcontent %}
\ No newline at end of file
{% extends 'block/block_collapse.html.twig' %}
{% block blocktitle %}
<i class="fa fa-cogs mr-4"></i> {{'Configuration du Groupe local'|trans}}
{% endblock blocktitle %}
{% block blocksubtitle %}
{% endblock blocksubtitle %}
{% block blockcontent %}
{% set form = getGroupeInfosForm(app.user) %}
{{form_start(form)}}
{{ form_row(form.name) }}
{{ form_row(form.content) }}
{{ form_row(form.save) }}
{{form_end(form)}}
{% endblock blockcontent %}
\ No newline at end of file
{% extends 'block/block_collapse.html.twig' %}
{% block blocktitle %}
<i class="fa fa-apple-alt mr-4"></i> {{'Inscription AMAP/Marchés'|trans}}
{% endblock blocktitle %}
{% block blocksubtitle %}
{% endblock blocksubtitle %}
{% block blockcontent %}
{% set form = getGroupePrestataireInscriptionForm(app.user) %}
{{form_start(form)}}
<div class="groupeprestas" data-prototype="{{ form_widget(form.groupeprestataires.vars.prototype)|e }}">
{% for groupe in form.groupeprestataires %}
{{ form_row(groupe) }}
{% endfor %}
</div>
{{ form_row(form.save) }}
{{form_end(form)}}
{% endblock blockcontent %}
\ No newline at end of file
...@@ -3,32 +3,19 @@ ...@@ -3,32 +3,19 @@
{% block content %} {% block content %}
<div class='container homepage'> <div class='container homepage'>
<div class='row mt-3'> <div class='row mt-3'>
<div class='col-12 col-md-3'> <div class='col-12 order-2 order-md-1 col-md-3'>
{% block colonne_gauche %} {% block colonne_gauche %}
{% include 'common/stats.html.twig' %} {% include 'common/stats.html.twig' %}
{% include 'common/groupes.html.twig' %} {% include 'common/groupes.html.twig' %}
{% include 'common/rubriques.html.twig' %} {% include 'common/rubriques.html.twig' %}
{% endblock colonne_gauche %} {% endblock colonne_gauche %}
</div> </div>
<div class='col-12 col-md-6 text-center'> <div class='col-12 order-1 order-md-2 col-md-6 text-center'>
{% block colonne_centre %} {% block colonne_centre %}
{% include 'presta/block/carte.html.twig' with {'title': 'Situer les Prestataires'|trans}%} {% include 'block/useradmin.html.twig' %}
{% if is_granted('ROLE_PRESTATAIRE') %}
{% include 'presta/block/solde.html.twig' %}
{% include 'block/cotisations.html.twig' %}
{% include 'block/transactions.html.twig' %}
{% include 'presta/block/transaction_presta.html.twig' %}
{% include 'presta/block/transaction_adherent.html.twig' %}
{% elseif is_granted('ROLE_ADHERENT') %}
{% include 'adherent/block/solde.html.twig' %}
{% include 'block/cotisations.html.twig' %}
{% include 'block/transactions.html.twig' %}
{% include 'adherent/block/transaction_presta.html.twig' %}
{% include 'adherent/block/transaction_adherent.html.twig' %}
{% endif %}
{% endblock colonne_centre %} {% endblock colonne_centre %}
</div> </div>
<div class='col-12 col-md-3'> <div class='col-12 order-3 order-md-3 col-md-3'>
{% block colonne_droite %} {% block colonne_droite %}
{% if app.user is null %} {% if app.user is null %}
<a class='btn btn-secondary w-100 mb-4' title='{{'Se connecter'|trans}}' href="{{path('fos_user_security_login')}}">{{'Se connecter'|trans}}</a> <a class='btn btn-secondary w-100 mb-4' title='{{'Se connecter'|trans}}' href="{{path('fos_user_security_login')}}">{{'Se connecter'|trans}}</a>
......
...@@ -4,4 +4,4 @@ ...@@ -4,4 +4,4 @@
<div class='cartetitle mb-3'> <div class='cartetitle mb-3'>
<h4><i class="fa fa-map"></i> Situer les Prestataires</h4> <h4><i class="fa fa-map"></i> Situer les Prestataires</h4>
</div> </div>
<div id="{{id}}" style="{{style}}"></div> <div id="{{id}}" style="{{style}}" class='my-3'></div>
\ No newline at end of file \ No newline at end of file
{% extends 'block/block_collapse.html.twig' %}
{% block blocktitle %}
<i class="fa fa-user-tie mr-4"></i> {{'Professionnel'|trans}}
{% endblock blocktitle %}
{% block blocksubtitle %}
{% endblock blocksubtitle %}
{% block blockcontent %}
{% set form = getPrestataireInfosForm(app.user) %}
{{form_start(form)}}
{{ form_row(form.groupe) }}
{{ form_row(form.raison) }}
{{ form_row(form.statut) }}
{{ form_row(form.siret) }}
{{ form_row(form.iban) }}
{{ form_row(form.responsable) }}
{{ form_row(form.metier) }}
{{ form_row(form.rubriques) }}
{{ form_row(form.geoloc) }}
{{ form_row(form.save) }}
{{form_end(form)}}
{% endblock blockcontent %}
\ No newline at end of file
{% extends 'block/onetransaction.html.twig' %}
{% block blocktitle %}
<i class="fa fa-external-link-alt mr-4"></i> Reconversion
{% endblock blocktitle %}
{% block blockcontent %}
{% set form = getTransfertPrestataireSiegeForm(app.user) %}
{{ parent() }}
{% endblock blockcontent %}
\ No newline at end of file
<div class="card mb-3"> <div class="card mb-3 {% if app.user and app.user.prestataire and app.user.prestataire.compte > 0 %}border-success{% else %}border-error{% endif %}">
<div class="card-header">Solde de mon compte : <b>{{app.user.prestataire.compte}}</b></div> <div class="card-header"><i class="fa fa-coins mr-4"></i> Solde de mon compte : <b>{{app.user.prestataire.compte}}</b></div>
</div> </div>
\ No newline at end of file
{% extends 'block/onetransaction.html.twig' %} {% extends 'block/onetransaction.html.twig' %}
{% block blocktitle %} {% block blocktitle %}
<i class="fa fa-user mr-4"></i> Virement vers un adhérent <i class="fa fa-exchange-alt mr-4"></i> Virement vers un adhérent
{% endblock blocktitle %} {% endblock blocktitle %}
{% block blockcontent %} {% block blockcontent %}
{% set form = getTransactionPrestataireAdherentForm(app.user) %} {% set form = getTransactionPrestataireAdherentForm(app.user) %}
......
{% extends 'block/onetransaction.html.twig' %} {% extends 'block/onetransaction.html.twig' %}
{% block blocktitle %} {% block blocktitle %}
<i class="fa fa-user mr-4"></i> Virement vers un prestataire <i class="fa fa-exchange-alt mr-4"></i> Virement vers un prestataire
{% endblock blocktitle %} {% endblock blocktitle %}
{% block blockcontent %} {% block blockcontent %}
{% set form = getTransactionPrestatairePrestataireForm(app.user) %} {% set form = getTransactionPrestatairePrestataireForm(app.user) %}
......
{% extends 'common/layout.html.twig' %}
{% block content %}
<div class='container prestataire_infos'>
<div class="row">
<div class="col-sm-12 col-md-6">
<div class='infos mt-4'>
{{form_start(form)}}
<h4><a class="btn btn-block btn-secondary" data-toggle="collapse" href="#infospresta" role="button" aria-expanded="false" aria-controls="infospresta"><span class="btn-label"><i class="fas fa-cogs mr-2"></i></span>Modifier les informations du prestataire</a></h4>
<div class="collapse" id="infospresta">
<div class="card card-body">
{{ form_row(form.groupe) }}
{{ form_row(form.raison) }}
{{ form_row(form.statut) }}
{{ form_row(form.siret) }}
{{ form_row(form.iban) }}
{{ form_row(form.responsable) }}
{{ form_row(form.metier) }}
{{ form_row(form.geoloc) }}
{{ form_row(form.save) }}
</div>
</div>
<h4><a class="btn btn-block btn-secondary" data-toggle="collapse" href="#infosuser" role="button" aria-expanded="false" aria-controls="infosuser">Modifier les informations du l'utilisateur</a></h4>
<div class="collapse" id="infosuser">
<div class="card card-body">
{{ form_row(form.user) }}
{{ form_row(form.save2) }}
</div>
</div>
{{form_end(form)}}
</div>
</div>
<div class="col-sm-12 col-md-6">
{% if app.user.prestataire is not null and app.user.prestataire.compte >= 0 %}
<div class='compte mt-4'>
<h4>Mon compte :</h4>
<ul class='list-group'>
<li class="list-group-item">{{(app.user.prestataire.compte)|number_format(2, '.', ',')}}</li>
</ul>
</div>
{% endif %}
{% if app.user.cotisations|length > 0 %}
<div class='cotisations mt-4'>
<h4>Mes cotisations :</h4>
<ul class='list-group'>
{% for cotisation in app.user.cotisations %}
<li class="list-group-item">{{cotisation.annee|upper}} : {{cotisation.montant}}&euro; (payée le {{cotisation.createdAt|date('d-m-Y')}})</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% if getAllFlux(app.user, app.request).getTotalItemCount > 0 %}
<div class='flux mt-4'>
<h4>Mes transactions :</h4>
<h5>({{getAllFlux(app.user, app.request).getTotalItemCount}})</h5>
<ul class='list-group'>
{% for flux in getAllFlux(app.user, app.request) %}
<li class="list-group-item">{{flux.parenttype|capitalize}} à {{flux.destinataire}} {{flux.montant}}&euro; (payée le {{flux.createdAt|date('d-m-Y')}})</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% if app.user.prestataire.rubriques|length > 0 %}
<div class='flux mt-4'>
<h4>Mes rubriques :</h4>
<ul class='list-group'>
{% for rubrique in app.user.prestataire.rubriques %}
{% if rubrique.enabled %}
<li class="list-group-item">{{rubrique.name|capitalize}}</li>
{% endif %}
{% endfor %}
</ul>
</div>
{% endif %}
</div>
</div>
</div>
{% endblock %}
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