Commit e190a36b by Julien Jorry

update front + transaction form factory + blocks flux ...

parent 185d1980
...@@ -25,7 +25,7 @@ services: ...@@ -25,7 +25,7 @@ services:
# this creates a service per class whose id is the fully-qualified class name # this creates a service per class whose id is the fully-qualified class name
App\: App\:
resource: '../src/*' resource: '../src/*'
exclude: '../src/{DependencyInjection,Listener,Entity,Migrations,Tests,Twig,Kernel.php}' exclude: '../src/{DependencyInjection,Factory,Listener,Entity,Migrations,Tests,Twig,Kernel.php}'
# controllers are imported separately to make sure services can be injected # controllers are imported separately to make sure services can be injected
# as action arguments even if you don't extend any base controller class # as action arguments even if you don't extend any base controller class
...@@ -60,6 +60,11 @@ services: ...@@ -60,6 +60,11 @@ services:
autowire: false autowire: false
arguments: ["@service_container", "@knp_paginator"] arguments: ["@service_container", "@knp_paginator"]
app.twig.form.extension:
class: App\Twig\FormExtension
autowire: false
arguments: ["@service_container"]
app.twig.menu.extension: app.twig.menu.extension:
class: App\Twig\MenuExtension class: App\Twig\MenuExtension
autowire: false autowire: false
...@@ -70,6 +75,11 @@ services: ...@@ -70,6 +75,11 @@ services:
autowire: false autowire: false
arguments: ["@doctrine.orm.entity_manager"] arguments: ["@doctrine.orm.entity_manager"]
app.formfactory:
class: App\Factory\FormFactory
autowire: true
public: true
App\Controller\RegistrationController: App\Controller\RegistrationController:
autowire: false autowire: false
...@@ -99,7 +109,7 @@ services: ...@@ -99,7 +109,7 @@ services:
public: true public: true
calls: calls:
- [ setUserManager, ['@fos_user.user_manager']] - [ setUserManager, ['@fos_user.user_manager']]
- [ setTokenStorage, ['@security.token_storage']] - [ setSecurity, ['@security.helper']]
admin.all.cotisations: admin.all.cotisations:
class: App\Admin\CotisationAdmin class: App\Admin\CotisationAdmin
...@@ -111,7 +121,7 @@ services: ...@@ -111,7 +121,7 @@ services:
label: "Cotisations" label: "Cotisations"
public: true public: true
calls: calls:
- [ setTokenStorage, ['@security.token_storage']] - [ setSecurity, ['@security.helper']]
admin.adherent.cotisations: admin.adherent.cotisations:
class: App\Admin\CotisationAdherentAdmin class: App\Admin\CotisationAdherentAdmin
...@@ -123,7 +133,7 @@ services: ...@@ -123,7 +133,7 @@ services:
label: "Cotisation" label: "Cotisation"
public: true public: true
calls: calls:
- [ setTokenStorage, ['@security.token_storage']] - [ setSecurity, ['@security.helper']]
# admin.prestataire.gerer: # admin.prestataire.gerer:
# class: App\Admin\PrestataireoldAdmin # class: App\Admin\PrestataireoldAdmin
...@@ -149,7 +159,7 @@ services: ...@@ -149,7 +159,7 @@ services:
calls: calls:
- [ setUserManager, ['@fos_user.user_manager']] - [ setUserManager, ['@fos_user.user_manager']]
- [ addChild, ['@sonata.user.admin.user', 'user']] - [ addChild, ['@sonata.user.admin.user', 'user']]
- [ setTokenStorage, ['@security.token_storage']] - [ setSecurity, ['@security.helper']]
admin.prestataire.cotisations: admin.prestataire.cotisations:
class: App\Admin\CotisationPrestataireAdmin class: App\Admin\CotisationPrestataireAdmin
...@@ -161,7 +171,7 @@ services: ...@@ -161,7 +171,7 @@ services:
label: "Cotisation" label: "Cotisation"
public: true public: true
calls: calls:
- [ setTokenStorage, ['@security.token_storage']] - [ setSecurity, ['@security.helper']]
admin.groupe.gerer: admin.groupe.gerer:
class: App\Admin\GroupeAdmin class: App\Admin\GroupeAdmin
...@@ -181,7 +191,7 @@ services: ...@@ -181,7 +191,7 @@ services:
label: "Comptoirs" label: "Comptoirs"
public: true public: true
calls: calls:
- [ setTokenStorage, ['@security.token_storage']] - [ setSecurity, ['@security.helper']]
admin.groupepresta.gerer: admin.groupepresta.gerer:
class: App\Admin\GroupeprestataireAdmin class: App\Admin\GroupeprestataireAdmin
...@@ -193,7 +203,7 @@ services: ...@@ -193,7 +203,7 @@ services:
label: "AMAP / Marchés" label: "AMAP / Marchés"
public: true public: true
calls: calls:
- [ setTokenStorage, ['@security.token_storage']] - [ setSecurity, ['@security.helper']]
admin.news.gerer: admin.news.gerer:
class: App\Admin\NewsAdmin class: App\Admin\NewsAdmin
...@@ -257,7 +267,7 @@ services: ...@@ -257,7 +267,7 @@ services:
public: true public: true
calls: calls:
- [ setSubClasses, [{transaction: 'App\Entity\Transaction', transfert: 'App\Entity\Transfert', cotisation: 'App\Entity\Cotisation'}]] - [ setSubClasses, [{transaction: 'App\Entity\Transaction', transfert: 'App\Entity\Transfert', cotisation: 'App\Entity\Cotisation'}]]
- [ setTokenStorage, ['@security.token_storage']] - [ setSecurity, ['@security.helper']]
admin.transfert.gerer: admin.transfert.gerer:
class: App\Admin\TransfertAdmin class: App\Admin\TransfertAdmin
...@@ -270,7 +280,7 @@ services: ...@@ -270,7 +280,7 @@ services:
pager_type: "simple" pager_type: "simple"
public: true public: true
calls: calls:
- [ setTokenStorage, ['@security.token_storage']] - [ setSecurity, ['@security.helper']]
admin.transaction.gerer: admin.transaction.gerer:
class: App\Admin\TransactionAdmin class: App\Admin\TransactionAdmin
...@@ -283,7 +293,7 @@ services: ...@@ -283,7 +293,7 @@ services:
pager_type: "simple" pager_type: "simple"
public: true public: true
calls: calls:
- [ setTokenStorage, ['@security.token_storage']] - [ setSecurity, ['@security.helper']]
# admin.flux.gerer: # admin.flux.gerer:
# class: App\Admin\FluxAdmin # class: App\Admin\FluxAdmin
......
...@@ -28,13 +28,13 @@ use Symfony\Component\Form\Extension\Core\Type\TextType; ...@@ -28,13 +28,13 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormEvents;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Security;
class AdherentAdmin extends AbstractAdmin class AdherentAdmin extends AbstractAdmin
{ {
protected $baseRouteName = 'adherent'; protected $baseRouteName = 'adherent';
protected $baseRoutePattern = 'adherent'; protected $baseRoutePattern = 'adherent';
protected $tokenStorage; protected $security;
protected $datagridValues = [ protected $datagridValues = [
// reverse order (default = 'ASC') // reverse order (default = 'ASC')
...@@ -45,9 +45,9 @@ class AdherentAdmin extends AbstractAdmin ...@@ -45,9 +45,9 @@ class AdherentAdmin extends AbstractAdmin
// '_per_page' => 32 // '_per_page' => 32
]; ];
public function setTokenStorage(TokenStorageInterface $tokenStorage) public function setSecurity(Security $security)
{ {
$this->tokenStorage = $tokenStorage; $this->security = $security;
} }
public function configure() public function configure()
...@@ -60,7 +60,7 @@ class AdherentAdmin extends AbstractAdmin ...@@ -60,7 +60,7 @@ class AdherentAdmin extends AbstractAdmin
*/ */
public function createQuery($context = 'list') public function createQuery($context = 'list')
{ {
$user = $this->tokenStorage->getToken()->getUser(); $user = $this->security->getUser();
$query = parent::createQuery($context); $query = parent::createQuery($context);
$query $query
->innerJoin($query->getRootAliases()[0] .'.user', 'u') ->innerJoin($query->getRootAliases()[0] .'.user', 'u')
...@@ -173,7 +173,7 @@ class AdherentAdmin extends AbstractAdmin ...@@ -173,7 +173,7 @@ class AdherentAdmin extends AbstractAdmin
return MoyenEnum::getTypeName($choice); return MoyenEnum::getTypeName($choice);
}, },
)); ));
if ($this->tokenStorage->getToken()->getUser()->isGranted('ROLE_TRESORIER')) { if ($this->security->getUser()->isGranted('ROLE_TRESORIER')) {
$formMapper $formMapper
->add('user.cotisations.first.cotisationInfos.recu', CheckboxType::class, array('label' => 'Reçu')); ->add('user.cotisations.first.cotisationInfos.recu', CheckboxType::class, array('label' => 'Reçu'));
} }
......
...@@ -11,19 +11,19 @@ use Sonata\AdminBundle\Form\FormMapper; ...@@ -11,19 +11,19 @@ use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection; use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper; use Sonata\AdminBundle\Show\ShowMapper;
use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Security;
class ComptoirAdmin extends AbstractAdmin class ComptoirAdmin extends AbstractAdmin
{ {
protected $tokenStorage; protected $security;
protected $datagridValues = [ protected $datagridValues = [
'_sort_order' => 'ASC', '_sort_order' => 'ASC',
'_sort_by' => 'name', '_sort_by' => 'name',
]; ];
public function setTokenStorage(TokenStorageInterface $tokenStorage) public function setSecurity(Security $security)
{ {
$this->tokenStorage = $tokenStorage; $this->security = $security;
} }
/** /**
...@@ -32,7 +32,7 @@ class ComptoirAdmin extends AbstractAdmin ...@@ -32,7 +32,7 @@ class ComptoirAdmin extends AbstractAdmin
public function createQuery($context = 'list') public function createQuery($context = 'list')
{ {
$query = parent::createQuery($context); $query = parent::createQuery($context);
$user = $this->tokenStorage->getToken()->getUser(); $user = $this->security->getUser();
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) { if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
if (empty($user->getGroupesgere())) { if (empty($user->getGroupesgere())) {
$query->andWhere('false'); $query->andWhere('false');
......
...@@ -23,7 +23,7 @@ class CotisationAdherentAdmin extends CotisationAdmin ...@@ -23,7 +23,7 @@ class CotisationAdherentAdmin extends CotisationAdmin
*/ */
public function createQuery($context = 'list') public function createQuery($context = 'list')
{ {
$user = $this->tokenStorage->getToken()->getUser(); $user = $this->security->getUser();
$query = parent::createQuery($context); $query = parent::createQuery($context);
$query->leftJoin($query->getRootAliases()[0] . '.operateur', 'u') $query->leftJoin($query->getRootAliases()[0] . '.operateur', 'u')
->andWhere('u.adherent IS NOT NULL') ->andWhere('u.adherent IS NOT NULL')
......
...@@ -14,13 +14,13 @@ use Sonata\AdminBundle\Show\ShowMapper; ...@@ -14,13 +14,13 @@ use Sonata\AdminBundle\Show\ShowMapper;
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\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\DateType; use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Security;
class CotisationAdmin extends AbstractAdmin class CotisationAdmin extends AbstractAdmin
{ {
protected $baseRouteName = 'cotisation'; protected $baseRouteName = 'cotisation';
protected $baseRoutePattern = 'cotisation'; protected $baseRoutePattern = 'cotisation';
protected $tokenStorage; protected $security;
protected $translator; protected $translator;
protected $datagridValues = [ protected $datagridValues = [
...@@ -28,9 +28,9 @@ class CotisationAdmin extends AbstractAdmin ...@@ -28,9 +28,9 @@ class CotisationAdmin extends AbstractAdmin
'_sort_by' => 'createdAt', '_sort_by' => 'createdAt',
]; ];
public function setTokenStorage(TokenStorageInterface $tokenStorage) public function setSecurity(Security $security)
{ {
$this->tokenStorage = $tokenStorage; $this->security = $security;
} }
/** /**
...@@ -64,8 +64,9 @@ class CotisationAdmin extends AbstractAdmin ...@@ -64,8 +64,9 @@ class CotisationAdmin extends AbstractAdmin
'choice_label' => function ($choice) { 'choice_label' => function ($choice) {
return MoyenEnum::getTypeName($choice); return MoyenEnum::getTypeName($choice);
}, },
)); ))
if ($this->tokenStorage->getToken() != null && $this->tokenStorage->getToken()->getUser()->isGranted('ROLE_TRESORIER') ) { ;
if ($this->security->getUser() != null && $this->security->getUser()->isGranted('ROLE_TRESORIER')) {
$formMapper $formMapper
->add('cotisationInfos.recu', CheckboxType::class, array('label' => 'Reçu')); ->add('cotisationInfos.recu', CheckboxType::class, array('label' => 'Reçu'));
} }
...@@ -92,7 +93,7 @@ class CotisationAdmin extends AbstractAdmin ...@@ -92,7 +93,7 @@ class CotisationAdmin extends AbstractAdmin
protected function configureRoutes(RouteCollection $collection) protected function configureRoutes(RouteCollection $collection)
{ {
$collection->remove('delete'); $collection->remove('delete');
if ($this->tokenStorage->getToken() != null && !$this->tokenStorage->getToken()->getUser()->isGranted('ROLE_TRESORIER') ) { if ($this->security->getUser() != null && !$this->security->getUser()->isGranted('ROLE_TRESORIER')) {
$collection->clearExcept('list'); $collection->clearExcept('list');
} }
} }
......
...@@ -18,7 +18,7 @@ class CotisationPrestataireAdmin extends CotisationAdmin ...@@ -18,7 +18,7 @@ class CotisationPrestataireAdmin extends CotisationAdmin
*/ */
public function createQuery($context = 'list') public function createQuery($context = 'list')
{ {
$user = $this->tokenStorage->getToken()->getUser(); $user = $this->security->getUser();
$query = parent::createQuery($context); $query = parent::createQuery($context);
$query->leftJoin($query->getRootAliases()[0] . '.operateur', 'u') $query->leftJoin($query->getRootAliases()[0] . '.operateur', 'u')
->andWhere('u.prestataire IS NOT NULL') ->andWhere('u.prestataire IS NOT NULL')
......
...@@ -11,13 +11,13 @@ use Sonata\AdminBundle\Form\Type\Filter\ChoiceType; ...@@ -11,13 +11,13 @@ use Sonata\AdminBundle\Form\Type\Filter\ChoiceType;
use Sonata\AdminBundle\Route\RouteCollection; use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper; use Sonata\AdminBundle\Show\ShowMapper;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType as SChoiceType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType as SChoiceType;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Security;
use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Translation\TranslatorInterface;
class FluxAdmin extends AbstractAdmin class FluxAdmin extends AbstractAdmin
{ {
protected $translator; protected $translator;
protected $tokenStorage; protected $security;
protected $datagridValues = [ protected $datagridValues = [
'_sort_order' => 'DESC', '_sort_order' => 'DESC',
'_sort_by' => 'createdAt', '_sort_by' => 'createdAt',
...@@ -28,9 +28,9 @@ class FluxAdmin extends AbstractAdmin ...@@ -28,9 +28,9 @@ class FluxAdmin extends AbstractAdmin
$this->translator = $translator; $this->translator = $translator;
} }
public function setTokenStorage(TokenStorageInterface $tokenStorage) public function setSecurity(Security $security)
{ {
$this->tokenStorage = $tokenStorage; $this->security = $security;
} }
/** /**
......
...@@ -11,11 +11,11 @@ use Sonata\AdminBundle\Show\ShowMapper; ...@@ -11,11 +11,11 @@ use Sonata\AdminBundle\Show\ShowMapper;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
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\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Security;
class GroupeprestataireAdmin extends AbstractAdmin class GroupeprestataireAdmin extends AbstractAdmin
{ {
protected $tokenStorage; protected $security;
protected $datagridValues = [ protected $datagridValues = [
// reverse order (default = 'ASC') // reverse order (default = 'ASC')
'_sort_order' => 'DESC', '_sort_order' => 'DESC',
...@@ -23,9 +23,9 @@ class GroupeprestataireAdmin extends AbstractAdmin ...@@ -23,9 +23,9 @@ class GroupeprestataireAdmin extends AbstractAdmin
'_sort_by' => 'updatedAt', '_sort_by' => 'updatedAt',
]; ];
public function setTokenStorage(TokenStorageInterface $tokenStorage) public function setSecurity(Security $security)
{ {
$this->tokenStorage = $tokenStorage; $this->security = $security;
} }
/** /**
...@@ -33,7 +33,7 @@ class GroupeprestataireAdmin extends AbstractAdmin ...@@ -33,7 +33,7 @@ class GroupeprestataireAdmin extends AbstractAdmin
*/ */
public function createQuery($context = 'list') public function createQuery($context = 'list')
{ {
$user = $this->tokenStorage->getToken()->getUser(); $user = $this->security->getUser();
$query = parent::createQuery($context); $query = parent::createQuery($context);
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) { if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
if (empty($user->getGroupesgere())) { if (empty($user->getGroupesgere())) {
......
...@@ -29,13 +29,13 @@ use Symfony\Component\Form\Extension\Core\Type\TextType; ...@@ -29,13 +29,13 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormEvents;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Security;
class PrestataireAdmin extends AbstractAdmin class PrestataireAdmin extends AbstractAdmin
{ {
protected $baseRouteName = 'prestataire'; protected $baseRouteName = 'prestataire';
protected $baseRoutePattern = 'prestataire'; protected $baseRoutePattern = 'prestataire';
protected $tokenStorage; protected $security;
protected $datagridValues = [ protected $datagridValues = [
// reverse order (default = 'ASC') // reverse order (default = 'ASC')
'_sort_order' => 'DESC', '_sort_order' => 'DESC',
...@@ -45,9 +45,9 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -45,9 +45,9 @@ class PrestataireAdmin extends AbstractAdmin
// '_per_page' => 32 // '_per_page' => 32
]; ];
public function setTokenStorage(TokenStorageInterface $tokenStorage) public function setSecurity(Security $security)
{ {
$this->tokenStorage = $tokenStorage; $this->security = $security;
} }
public function configure() public function configure()
...@@ -348,7 +348,7 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -348,7 +348,7 @@ class PrestataireAdmin extends AbstractAdmin
*/ */
public function createQuery($context = 'list') public function createQuery($context = 'list')
{ {
$user = $this->tokenStorage->getToken()->getUser(); $user = $this->security->getUser();
$query = parent::createQuery($context); $query = parent::createQuery($context);
$query $query
->innerJoin($query->getRootAliases()[0] .'.user', 'u') ->innerJoin($query->getRootAliases()[0] .'.user', 'u')
......
...@@ -12,20 +12,20 @@ use Sonata\AdminBundle\Form\Type\Filter\ChoiceType; ...@@ -12,20 +12,20 @@ use Sonata\AdminBundle\Form\Type\Filter\ChoiceType;
use Sonata\AdminBundle\Route\RouteCollection; use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper; use Sonata\AdminBundle\Show\ShowMapper;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType as SChoiceType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType as SChoiceType;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Security;
use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Translation\TranslatorInterface;
class TransfertAdmin extends FluxAdmin class TransfertAdmin extends FluxAdmin
{ {
protected $tokenStorage; protected $security;
protected $datagridValues = [ protected $datagridValues = [
'_sort_order' => 'DESC', '_sort_order' => 'DESC',
'_sort_by' => 'createdAt', '_sort_by' => 'createdAt',
]; ];
public function setTokenStorage(TokenStorageInterface $tokenStorage) public function setSecurity(Security $security)
{ {
$this->tokenStorage = $tokenStorage; $this->security = $security;
} }
/** /**
...@@ -33,7 +33,7 @@ class TransfertAdmin extends FluxAdmin ...@@ -33,7 +33,7 @@ class TransfertAdmin extends FluxAdmin
*/ */
public function createQuery($context = 'list') public function createQuery($context = 'list')
{ {
$user = $this->tokenStorage->getToken()->getUser(); $user = $this->security->getUser();
$query = parent::createQuery($context); $query = parent::createQuery($context);
$query->andWhere($query->getRootAliases()[0].".parenttype = :type") $query->andWhere($query->getRootAliases()[0].".parenttype = :type")
->setParameter('type', 'transfert'); ->setParameter('type', 'transfert');
......
...@@ -48,11 +48,12 @@ class UserPrestataireController extends AbstractController ...@@ -48,11 +48,12 @@ class UserPrestataireController extends AbstractController
* @Route("/prestataire/transaction/{type}/", name="transactionPrestatairePrestataire", defaults={"type": "prestataire"}) * @Route("/prestataire/transaction/{type}/", name="transactionPrestatairePrestataire", defaults={"type": "prestataire"})
* @IsGranted("ROLE_PRESTATAIRE") * @IsGranted("ROLE_PRESTATAIRE")
*/ */
public function transactionPrestataireAdherentAction($type, Request $request) public function transactionPrestataireAction($type, Request $request)
{ {
$entityName = 'App\Entity\TransactionPrestataire'.ucwords($type); $entityName = 'App\Entity\TransactionPrestataire'.ucwords($type);
$entity = new $entityName(); $entity = new $entityName();
$entity->setOperateur($this->getUser()); $entity->setOperateur($this->getUser());
$entity->setExpediteur($this->getUser()->getPrestataire());
$form = $this->createForm('App\Form\Type\TransactionPrestataire'.ucwords($type).'FormType', $entity); $form = $this->createForm('App\Form\Type\TransactionPrestataire'.ucwords($type).'FormType', $entity);
$form->handleRequest($request); $form->handleRequest($request);
......
<?php
namespace App\Factory;
use App\Entity\TransactionAdherentAdherent;
use App\Entity\TransactionAdherentPrestataire;
use App\Entity\TransactionPrestataireAdherent;
use App\Entity\TransactionPrestatairePrestataire;
use App\Entity\TransfertGroupeComptoir;
use App\Entity\TransfertSiegeGroupe;
use App\Entity\User;
use App\Form\Type\TransactionAdherentAdherentFormType;
use App\Form\Type\TransactionAdherentPrestataireFormType;
use App\Form\Type\TransactionPrestataireAdherentFormType;
use App\Form\Type\TransactionPrestatairePrestataireFormType;
use App\Form\Type\TransfertGroupeComptoirFormType;
use App\Form\Type\TransfertSiegeGroupeFormType;
use Symfony\Component\Form\FormFactoryInterface as FormF;
use Symfony\Component\Routing\RouterInterface;
class FormFactory
{
public $ff;
public $router;
public function __construct(FormF $ff, RouterInterface $router)
{
$this->ff = $ff;
$this->router = $router;
}
public function getTransactionAdherentAdherentForm(User $user)
{
if (empty($user) || empty($user->getAdherent())) {
return null;
}
$entity = new TransactionAdherentAdherent();
$entity->setOperateur($user);
$entity->setExpediteur($user->getAdherent());
$form = $this->ff->create(TransactionAdherentAdherentFormType::class, $entity, array('action' => $this->router->generate('transactionAdherentAdherent')));
return $form->createView();
}
public function getTransactionAdherentPrestataireForm(User $user)
{
if (empty($user) || empty($user->getAdherent())) {
return null;
}
$entity = new TransactionAdherentPrestataire();
$entity->setOperateur($user);
$entity->setExpediteur($user->getAdherent());
$form = $this->ff->create(TransactionAdherentPrestataireFormType::class, $entity, array('action' => $this->router->generate('transactionAdherentPrestataire')));
return $form->createView();
}
public function getTransactionPrestataireAdherentForm(User $user)
{
if (empty($user) || empty($user->getPrestataire())) {
return null;
}
$entity = new TransactionPrestataireAdherent();
$entity->setOperateur($user);
$entity->setExpediteur($user->getPrestataire());
$form = $this->ff->create(TransactionPrestataireAdherentFormType::class, $entity, array('action' => $this->router->generate('transactionPrestataireAdherent')));
return $form->createView();
}
public function getTransactionPrestatairePrestataireForm(User $user)
{
if (empty($user) || empty($user->getPrestataire())) {
return null;
}
$entity = new TransactionPrestatairePrestataire();
$entity->setOperateur($user);
$entity->setExpediteur($user->getPrestataire());
$form = $this->ff->create(TransactionPrestatairePrestataireFormType::class, $entity, array('action' => $this->router->generate('transactionPrestatairePrestataire')));
return $form->createView();
}
// public function getTransfertComptoirToXForm(User $user, $destinataire)
// {
// $type = strtolower($type);
// if (empty($user) || empty($user->getComptoirsgere()) || !($type == 'adherent' || $type == 'groupe' || $type == 'prestataire')) {
// return null;
// }
// $class = 'TransactionComptoir'.ucwords($type);
// $entity = new $class();
// $entity->setOperateur($user);
// $entity->setExpediteur($user->getComptoirsgere());
// $form = $this->ff->create('App\Form\Type\TransactionComptoir'.ucwords($type).'FormType', $entity, array('action' => $this->router->generate('transactionComptoir'.ucwords($type))));
// return $form->createView();
// }
// public function getTransfertGroupeComptoirForm(User $user)
// {
// $type = strtolower($type);
// if (empty($user) || empty($user->getGroupesgere())) {
// return null;
// }
// $class = 'Transaction'.ucwords($type).'Comptoir';
// $entity = new TransfertGroupeComptoir();
// $entity->setOperateur($user);
// $entity->setExpediteur($user->getGroupesgere());
// $form = $this->ff->create(TransfertGroupeComptoirFormType::class, $entity, array('action' => $this->router->generate('transfertGroupeComptoir')));
// return $form->createView();
// }
// public function getTransfertSiegeGroupeForm(User $user)
// {
// if (empty($user) || !$user->hasRole('ROLE_ADMIN_SIEGE')) {
// return null;
// }
// $entity = new TransfertSiegeGroupe();
// $entity->setOperateur($user);
// $form = $this->ff->create(TransfertSiegeGroupeFormType::class, $entity, array('action' => $this->router->generate('transfertSiegeGroupe')));
// return $form->createView();
// }
}
...@@ -14,24 +14,24 @@ use Symfony\Component\Form\FormBuilderInterface; ...@@ -14,24 +14,24 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Security;
class AddCotisationFormType extends AbstractType class AddCotisationFormType extends AbstractType
{ {
protected $em; protected $em;
protected $tk; protected $security;
public function __construct(EntityManagerInterface $em, TokenStorageInterface $tk) public function __construct(EntityManagerInterface $em, Security $security)
{ {
$this->em = $em; $this->em = $em;
$this->tk = $tk; $this->security = $security;
} }
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$now = new \DateTime(); $now = new \DateTime();
$flux = $options['data']; $flux = $options['data'];
if (empty($this->tk->getToken()) || empty($this->tk->getToken()->getUser()) || empty($this->tk->getToken()->getUser()->getId()) || empty($flux) || empty($flux->getExpediteur())) { if (empty($this->security) || empty($this->security->getUser()) || empty($this->security->getUser()->getId()) || empty($flux) || empty($flux->getExpediteur())) {
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(); $maxvalue = $flux->getExpediteur()->getCompte();
...@@ -41,7 +41,7 @@ class AddCotisationFormType extends AbstractType ...@@ -41,7 +41,7 @@ class AddCotisationFormType extends AbstractType
'data_class' => null 'data_class' => null
)) ))
->add('operateur', HiddenType::class, array( ->add('operateur', HiddenType::class, array(
'data' => $this->tk->getToken()->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
......
...@@ -26,19 +26,19 @@ use Symfony\Component\Form\FormBuilderInterface; ...@@ -26,19 +26,19 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Security;
class AdherentInfosFormType extends AbstractType class AdherentInfosFormType extends AbstractType
{ {
protected $container; protected $container;
protected $em; protected $em;
protected $tk; protected $security;
public function __construct(ContainerInterface $container, EntityManagerInterface $em, TokenStorageInterface $tk) public function __construct(ContainerInterface $container, EntityManagerInterface $em, Security $security)
{ {
$this->container = $container; $this->container = $container;
$this->em = $em; $this->em = $em;
$this->tk = $tk; $this->security = $security;
} }
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
......
...@@ -26,19 +26,19 @@ use Symfony\Component\Form\FormBuilderInterface; ...@@ -26,19 +26,19 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Security;
class AdhererFormType extends AbstractType class AdhererFormType extends AbstractType
{ {
protected $container; protected $container;
protected $em; protected $em;
protected $tk; protected $security;
public function __construct(ContainerInterface $container, EntityManagerInterface $em, TokenStorageInterface $tk) public function __construct(ContainerInterface $container, EntityManagerInterface $em, Security $security)
{ {
$this->container = $container; $this->container = $container;
$this->em = $em; $this->em = $em;
$this->tk = $tk; $this->security = $security;
} }
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
......
...@@ -17,15 +17,15 @@ use Symfony\Component\Form\FormBuilderInterface; ...@@ -17,15 +17,15 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Security;
class CotisationInfosFormType extends FluxFormType class CotisationInfosFormType extends FluxFormType
{ {
protected $tokenStorage; protected $security;
public function __construct(TokenStorageInterface $tokenStorage) public function __construct(Security $security)
{ {
$this->tokenStorage = $tokenStorage; $this->security = $security;
} }
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
...@@ -50,7 +50,7 @@ class CotisationInfosFormType extends FluxFormType ...@@ -50,7 +50,7 @@ class CotisationInfosFormType extends FluxFormType
'html5' => false, 'html5' => false,
'attr' => ['class' => 'js-datepicker'], 'attr' => ['class' => 'js-datepicker'],
)); ));
if ($this->tokenStorage->getToken() != null && $this->tokenStorage->getToken()->getUser()->isGranted('ROLE_TRESORIER') ) { if ($this->security->getUser() != null && $this->security->getUser()->isGranted('ROLE_TRESORIER') ) {
$builder $builder
->add('recu', CheckboxType::class, array('label' => 'Reçu')); ->add('recu', CheckboxType::class, array('label' => 'Reçu'));
} }
......
...@@ -26,19 +26,16 @@ use Symfony\Component\Form\FormBuilderInterface; ...@@ -26,19 +26,16 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
class PrestataireInfosFormType extends AbstractType class PrestataireInfosFormType extends AbstractType
{ {
protected $container; protected $container;
protected $em; protected $em;
protected $tk;
public function __construct(ContainerInterface $container, EntityManagerInterface $em, TokenStorageInterface $tk) public function __construct(ContainerInterface $container, EntityManagerInterface $em)
{ {
$this->container = $container; $this->container = $container;
$this->em = $em; $this->em = $em;
$this->tk = $tk;
} }
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
......
...@@ -16,7 +16,7 @@ class TransactionAdherentPrestataireFormType extends TransactionFormType ...@@ -16,7 +16,7 @@ class TransactionAdherentPrestataireFormType extends TransactionFormType
{ {
$builder $builder
->add('expediteur', HiddenType::class, array( ->add('expediteur', HiddenType::class, array(
'data' => $this->tk->getToken()->getUser()->getAdherent()->getId(), 'data' => $this->security->getUser()->getAdherent()->getId(),
'data_class' => null, 'data_class' => null,
'entity_class' => Adherent::class, 'entity_class' => Adherent::class,
'em' => $this->em 'em' => $this->em
......
...@@ -16,7 +16,7 @@ class TransactionPrestataireAdherentFormType extends TransactionFormType ...@@ -16,7 +16,7 @@ class TransactionPrestataireAdherentFormType extends TransactionFormType
{ {
$builder $builder
->add('expediteur', HiddenType::class, array( ->add('expediteur', HiddenType::class, array(
'data' => $this->tk->getToken()->getUser()->getPrestataire()->getId(), 'data' => $this->security->getUser()->getPrestataire()->getId(),
'data_class' => null, 'data_class' => null,
'entity_class' => Prestataire::class, 'entity_class' => Prestataire::class,
'em' => $this->em 'em' => $this->em
......
...@@ -16,7 +16,7 @@ class TransactionPrestatairePrestataireFormType extends TransactionFormType ...@@ -16,7 +16,7 @@ class TransactionPrestatairePrestataireFormType extends TransactionFormType
{ {
$builder $builder
->add('expediteur', HiddenType::class, array( ->add('expediteur', HiddenType::class, array(
'data' => $this->tk->getToken()->getUser()->getPrestataire()->getId(), 'data' => $this->security->getUser()->getPrestataire()->getId(),
'data_class' => null, 'data_class' => null,
'entity_class' => Prestataire::class, 'entity_class' => Prestataire::class,
'em' => $this->em 'em' => $this->em
......
...@@ -16,7 +16,7 @@ class TransfertComptoirAdherentFormType extends TransfertFormType ...@@ -16,7 +16,7 @@ class TransfertComptoirAdherentFormType extends TransfertFormType
{ {
$builder $builder
->add('expediteur', HiddenType::class, array( ->add('expediteur', HiddenType::class, array(
'data' => $this->tk->getToken()->getUser()->getComptoirsgere()->getId(), 'data' => $this->security->getUser()->getComptoirsgere()->getId(),
'data_class' => null, 'data_class' => null,
'entity_class' => Comptoir::class, 'entity_class' => Comptoir::class,
'em' => $this->em 'em' => $this->em
......
...@@ -16,7 +16,7 @@ class TransfertComptoirGroupeFormType extends TransfertFormType ...@@ -16,7 +16,7 @@ class TransfertComptoirGroupeFormType extends TransfertFormType
{ {
$builder $builder
->add('expediteur', HiddenType::class, array( ->add('expediteur', HiddenType::class, array(
'data' => $this->tk->getToken()->getUser()->getComptoirsgere()->getId(), 'data' => $this->security->getUser()->getComptoirsgere()->getId(),
'data_class' => null, 'data_class' => null,
'entity_class' => Comptoir::class, 'entity_class' => Comptoir::class,
'em' => $this->em 'em' => $this->em
......
...@@ -16,7 +16,7 @@ class TransfertComptoirPrestataireFormType extends TransfertFormType ...@@ -16,7 +16,7 @@ class TransfertComptoirPrestataireFormType extends TransfertFormType
{ {
$builder $builder
->add('expediteur', HiddenType::class, array( ->add('expediteur', HiddenType::class, array(
'data' => $this->tk->getToken()->getUser()->getComptoirsgere()->getId(), 'data' => $this->security->getUser()->getComptoirsgere()->getId(),
'data_class' => null, 'data_class' => null,
'entity_class' => Comptoir::class, 'entity_class' => Comptoir::class,
'em' => $this->em 'em' => $this->em
......
...@@ -17,7 +17,7 @@ class TransfertGroupeComptoirFormType extends TransfertFormType ...@@ -17,7 +17,7 @@ class TransfertGroupeComptoirFormType extends TransfertFormType
{ {
$builder $builder
->add('expediteur', HiddenType::class, array( ->add('expediteur', HiddenType::class, array(
'data' => $this->tk->getToken()->getUser()->getGroupesgere()->getId(), 'data' => $this->security->getUser()->getGroupesgere()->getId(),
'data_class' => null, 'data_class' => null,
'entity_class' => Groupe::class, 'entity_class' => Groupe::class,
'em' => $this->em 'em' => $this->em
......
...@@ -16,7 +16,7 @@ class TransfertPrestataireComptoirFormType extends TransfertFormType ...@@ -16,7 +16,7 @@ class TransfertPrestataireComptoirFormType extends TransfertFormType
{ {
$builder $builder
->add('expediteur', HiddenType::class, array( ->add('expediteur', HiddenType::class, array(
'data' => $this->tk->getToken()->getUser()->getPrestataire()->getId(), 'data' => $this->security->getUser()->getPrestataire()->getId(),
'data_class' => null, 'data_class' => null,
'entity_class' => Prestataire::class, 'entity_class' => Prestataire::class,
'em' => $this->em 'em' => $this->em
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace App\Repository; namespace App\Repository;
use App\Entity\Adherent;
use App\Entity\Flux; use App\Entity\Flux;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
......
<?php
namespace App\Twig;
use App\Entity\Flux;
use App\Entity\Groupe;
use App\Entity\Rubrique;
use App\Entity\User;
use App\Factory\FormFactory;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
use Twig\TwigTest;
class FormExtension extends AbstractExtension
{
public $container;
public function __construct($container)
{
$this->container = $container;
}
public function getFunctions()
{
return [
new \Twig_SimpleFunction('getTransactionAdherentAdherentForm', array($this, 'getTransactionAdherentAdherentForm')),
new \Twig_SimpleFunction('getTransactionAdherentPrestataireForm', array($this, 'getTransactionAdherentPrestataireForm')),
new \Twig_SimpleFunction('getTransactionPrestataireAdherentForm', array($this, 'getTransactionPrestataireAdherentForm')),
new \Twig_SimpleFunction('getTransactionPrestatairePrestataireForm', array($this, 'getTransactionPrestatairePrestataireForm')),
new \Twig_SimpleFunction('getTransfertComptoirToXForm', array($this, 'getTransfertComptoirToXForm')),
new \Twig_SimpleFunction('getTransfertGroupeComptoirForm', array($this, 'getTransfertGroupeComptoirForm')),
new \Twig_SimpleFunction('getTransfertSiegeGroupeForm', array($this, 'getTransfertSiegeGroupeForm')),
];
}
public function getTransactionAdherentAdherentForm(User $user)
{
return $this->container->get('app.formfactory')->getTransactionAdherentAdherentForm($user);
}
public function getTransactionAdherentPrestataireForm(User $user)
{
return $this->container->get('app.formfactory')->getTransactionAdherentPrestataireForm($user);
}
public function getTransactionPrestataireAdherentForm(User $user)
{
return $this->container->get('app.formfactory')->getTransactionPrestataireAdherentForm($user);
}
public function getTransactionPrestatairePrestataireForm(User $user)
{
return $this->container->get('app.formfactory')->getTransactionPrestatairePrestataireForm($user);
}
public function getTransfertComptoirToXForm(User $user)
{
return $this->container->get('app.formfactory')->getTransfertComptoirToXForm($user);
}
public function getTransfertGroupeComptoirForm(User $user)
{
return $this->container->get('app.formfactory')->getTransfertGroupeComptoirForm($user);
}
public function getTransfertSiegeGroupeForm(User $user)
{
return $this->container->get('app.formfactory')->getTransfertSiegeGroupeForm($user);
}
}
<div class="card mb-3">
<div class="card-header">Solde de mon compte : {{app.user.adherent.ecompte}}</div>
</div>
\ No newline at end of file
{% extends 'block/onetransaction.html.twig' %}
{% block blocktitle %}
<i class="fa fa-user mr-4"></i> Virement vers un adhérent
{% endblock blocktitle %}
{% block blockcontent %}
{% set form = getTransactionAdherentAdherentForm(app.user) %}
{{ parent() }}
{% endblock blockcontent %}
\ No newline at end of file
{% extends 'block/onetransaction.html.twig' %}
{% block blocktitle %}
<i class="fa fa-user mr-4"></i> Virement vers un prestataire
{% endblock blocktitle %}
{% block blockcontent %}
{% set form = getTransactionAdherentPrestataireForm(app.user) %}
{{ parent() }}
{% endblock blockcontent %}
\ No newline at end of file
{% set idcard = idcard|default(random(500)) %} {% set idcard = idcard|default(random(500)) %}
<div class="card mb-3"> <div class="card mb-3">
<div class="card-header" 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}}">
<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">
......
{% if app.user.cotisations|length > 0 %}
{% set idcard = 'cotisationspresta' %}
{% extends 'block/block_collapse.html.twig' %}
{% block blocktitle %}
<i class="fa fa-user mr-4"></i> Mes cotisations
{% endblock blocktitle %}
{% block blocksubtitle %}
{% endblock blocksubtitle %}
{% block blockcontent %}
<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>
{% endblock blockcontent %}
{% endif %}
\ No newline at end of file
{% extends 'block/block_collapse.html.twig' %}
{% block blocktitle %}
Transaction
{% endblock blocktitle %}
{% block blocksubtitle %}
{% endblock blocksubtitle %}
{% block blockcontent %}
{{ form_start(form) }}
{% if form.expediteur is defined %}
{{ form_row(form.expediteur) }}
{% endif %}
{% if form.destinataire is defined %}
{{ form_row(form.destinataire) }}
{% endif %}
{% if form.montant is defined %}
{{ form_row(form.montant) }}
{% endif %}
{% if form.moyen is defined %}
{{ form_row(form.moyen) }}
{% endif %}
{% if form.reference is defined %}
{{ form_row(form.reference) }}
{% endif %}
{% if form.save is defined %}
{{ form_row(form.save) }}
{% endif %}
{{ form_end(form) }}
{% endblock blockcontent %}
\ No newline at end of file
{% set fluxs = getAllFlux(app.user, app.request) %}
{% if fluxs.getTotalItemCount > 0 %}
{% set idcard = 'transactions' %}
{% extends 'block/block_collapse.html.twig' %}
{% block blocktitle %}
<i class="fa fa-user mr-4"></i> Opérations
{% endblock blocktitle %}
{% block blocksubtitle %}
{% endblock blocksubtitle %}
{% block blockcontent %}
<ul class='list-group'>
{% for flux in fluxs %}
<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>
{% endblock blockcontent %}
{% endif %}
\ No newline at end of file
...@@ -13,6 +13,16 @@ ...@@ -13,6 +13,16 @@
<div class='col-6 text-center'> <div class='col-6 text-center'>
{% if is_granted('ROLE_PRESTATAIRE') %} {% if is_granted('ROLE_PRESTATAIRE') %}
{% include 'presta/block/solde.html.twig' %} {% 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 %} {% endif %}
</div> </div>
<div class='col-3'> <div class='col-3'>
......
{% set idcard = 'soldepresta' %} <div class="card mb-3">
{% extends 'block/block_collapse.html.twig' %} <div class="card-header">Solde de mon compte : {{app.user.prestataire.compte}}</div>
</div>
{% block blocktitle %} \ No newline at end of file
<i class="fa fa-euro ml-4"></i> Solde de mon compte
{% endblock blocktitle %}
{% block blocksubtitle %}
{% endblock blocksubtitle %}
{% block blockcontent %}
Solde : {{app.user.prestataire.compte}} {{'mlc_name'|trans}}
{% endblock blockcontent %}
{% extends 'block/onetransaction.html.twig' %}
{% block blocktitle %}
<i class="fa fa-user mr-4"></i> Virement vers un adhérent
{% endblock blocktitle %}
{% block blockcontent %}
{% set form = getTransactionPrestataireAdherentForm(app.user) %}
{{ parent() }}
{% endblock blockcontent %}
\ No newline at end of file
{% extends 'block/onetransaction.html.twig' %}
{% block blocktitle %}
<i class="fa fa-user mr-4"></i> Virement vers un prestataire
{% endblock blocktitle %}
{% block blockcontent %}
{% set form = getTransactionPrestatairePrestataireForm(app.user) %}
{{ parent() }}
{% endblock blockcontent %}
\ No newline at end of file
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
{% endif %} {% endif %}
{% if app.user.prestataire.rubriques|length > 0 %} {% if app.user.prestataire.rubriques|length > 0 %}
<div class='flux mt-4'> <div class='flux mt-4'>
<h4>Mes rubriques :</h4> <h4>Mes rubriques :</h4>
......
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