Commit 77be41c1 by Julien Jorry

FluxController factorisation + add transfert/transactions missing + fix add cotisation + other fixs

parent e5c4d0a6
......@@ -2091,3 +2091,6 @@
margin-left: auto !important;
}
}
.main-header .sidebar-toggle:before {
content: '' !important;
}
\ No newline at end of file
......@@ -43,7 +43,34 @@ sonata_admin:
# button_list: '@SonataAdmin/Button/list_button.html.twig'
# button_show: '@SonataAdmin/Button/show_button.html.twig'
assets:
extra_stylesheets: ['build/admin.css']
stylesheets:
# The default stylesheet list:
- bundles/sonatacore/vendor/bootstrap/dist/css/bootstrap.min.css
# - bundles/sonatacore/vendor/components-font-awesome/css/font-awesome.min.css
- fontawesome/css/fontawesome.min.css
- fontawesome/css/solid.css
- fontawesome/css/brands.css
# - public/fontawesome/css/v4-shims.css
- bundles/sonatacore/vendor/ionicons/css/ionicons.min.css
- bundles/sonataadmin/vendor/admin-lte/dist/css/AdminLTE.min.css
- bundles/sonataadmin/vendor/admin-lte/dist/css/skins/skin-black.min.css
- bundles/sonataadmin/vendor/iCheck/skins/square/blue.css
- bundles/sonatacore/vendor/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css
- bundles/sonataadmin/vendor/jqueryui/themes/base/jquery-ui.css
- bundles/sonatacore/vendor/select2/select2.css
- bundles/sonatacore/vendor/select2-bootstrap-css/select2-bootstrap.min.css
- bundles/sonataadmin/vendor/x-editable/dist/bootstrap3-editable/css/bootstrap-editable.css
- bundles/sonataadmin/css/styles.css
- bundles/sonataadmin/css/layout.css
- bundles/sonataadmin/css/tree.css
- bundles/sonataadmin/css/colors.css
extra_stylesheets:
- build/admin.css
# javascript paths to add to the page in addition to the list above
extra_javascripts:
# - fontawesome/js/all.js
# - public/fontawesome/js/v4-shims.js
dashboard:
# DASHBOARD de l'admin
#
......@@ -155,7 +182,7 @@ sonata_admin:
keep_open: false
label: Prestataires
label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-user-circle-o"></i>'
icon: '<i class="fa fa-user-tie"></i>'
items:
- admin.prestataire.gerer
- admin.prestataire.cotisations
......@@ -164,7 +191,7 @@ sonata_admin:
on_top: true
label: Groupes locaux
label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-bandcamp"></i>'
icon: '<i class="fa fa-chess-rook"></i>'
items:
- admin.groupe.gerer
sonata.admin.group.comptoir:
......@@ -187,7 +214,7 @@ sonata_admin:
on_top: true
label: "News"
label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-bars"></i>'
icon: '<i class="fa fa-newspaper"></i>'
items:
- admin.news.gerer
sonata.admin.group.document:
......@@ -195,7 +222,7 @@ sonata_admin:
on_top: true
label: "Documents"
label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-file-text"></i>'
icon: '<i class="fa fa-file"></i>'
items:
- admin.document.gerer
sonata.admin.group.page:
......@@ -203,7 +230,7 @@ sonata_admin:
on_top: true
label: "Pages"
label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-newspaper-o"></i>'
icon: '<i class="fa fa-pager"></i>'
items:
- admin.page.gerer
sonata.admin.group.rubrique:
......@@ -234,7 +261,7 @@ sonata_admin:
keep_open: false
label: "Flux"
label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-euro"></i>'
icon: '<i class="fa fa-euro-sign"></i>'
items:
- admin.flux.gerer
- admin.all.cotisations
......
......@@ -90,7 +90,7 @@ class CotisationAdherentAdmin extends CotisationAdmin
->add('expediteur', EntityType::class, array(
'label' => 'Expéditeur',
'class' => Adherent::class,
'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Adherent::class)->findBy(array('enabled' => true), array('lastname'=> 'ASC')),
'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Adherent::class)->findBy(array('enabled' => true), array('user'=> 'ASC')),
'placeholder' => 'Choisir un adhérent',
'required' => true,
))
......
......@@ -29,6 +29,7 @@ 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\DateType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
......@@ -265,7 +266,7 @@ class PrestataireAdmin extends AbstractAdmin
$formMapper
->with('Cotisation', ['class' => 'col-md-5'])
->add('user.cotisations.last.cotisationInfos.annee', TextType::class, array('label' => 'Année', 'data' => $now->format('Y')))
->add('user.cotisations.last.montant', TextType::class, array(
->add('user.cotisations.last.montant', MoneyType::class, array(
'label' => 'Montant',
'data' => $this->getConfigurationPool()->getContainer()->getParameter('cotisation_montant')
))
......
......@@ -21,10 +21,8 @@ class GroupAdmin extends BaseGroupAdmin
protected function configureRoutes(RouteCollection $collection)
{
$subject = $this->getSubject();
if (!empty($subject) && !($subject->isGranted('ROLE_SUPER_ADMIN') || $subject->isGranted('ROLE_ADMIN_SIEGE'))) {
$collection->clearExcept('list');
}
}
public function getBatchActions()
{
......
......@@ -2,25 +2,27 @@
namespace App\Controller;
use App\Entity\TransactionAdherentPrestataire;
use App\Form\Type\TransactionAdherentPrestataireFormType;
use Nelmio\ApiDocBundle\Annotation\Security;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Form;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Translation\TranslatorInterface;
/**
*
* Types de transfert : (Les transferts dans la structure sont les flux de billets détenus par les opérateurs.)
*
* - SIEGE => GROUPES LOCAUX (Transfert du siège au groupe)
* - GROUPE => SIEGE (Transfert du groupe au siège)
* - GROUPES LOCAUX => COMPTOIRS (Transfert du groupe au comptoir)
* - COMPTOIRS => GROUPES LOCAUX (Transfert du comptoir au groupe)
* - COMPTOIRS => ADHERENTS (Diffusion de monnaie papier auprès des adhérents)
* - COMPTOIRS => PRESTATAIRES (Diffusion de monnaie papier auprès des prestataires)
* - PRESTATAIRES => COMPTOIRS (Reconversion)
*
*
* Types de transaction :
*
* - PRESTATAIRES => ADHERENTS (Virement vers un adherent)
......@@ -30,29 +32,37 @@ use Symfony\Component\Routing\Annotation\Route;
*/
class FluxController extends AbstractController
{
// /**
// * @Route("/flux/transaction/adherent/prestataire", name="transactionAdherentPrestataire")
// */
// public function transactionAdherentPrestataireAction(Request $request)
// {
// $em = $this->getDoctrine()->getManager();
// $entity = new TransactionAdherentPrestataire();
// $entity->setOperateur($this->getUser());
// $form = $this->createForm(TransactionAdherentPrestataireFormType::class, $entity);
// $form->handleRequest($request);
protected $translator;
// $data = $form->getData();
// dump($data);
public function __construct(EntityManagerInterface $em, TranslatorInterface $translator)
{
$this->em = $em;
$this->translator = $translator;
}
// if ($form->isSubmitted() && $form->isValid()) {
// //TODO : terminer fonction ;)
// $em->persist($data);
// $em->flush();
// }
protected function manageFluxForm(Request $request, Form $form, $compte, $success, $title)
{
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$data = $form->getData();
$this->em->persist($data);
$this->em->flush();
$this->addFlash(
'success',
$success
);
$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/transactionAdherentPrestataire.html.twig', [
// 'form' => $form->createView(),
// ]);
// }
return $this->render('flux/transaction.html.twig', [
'form' => $form->createView(),
'compte' => $compte,
'title' => $title
]);
}
}
......@@ -21,7 +21,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Translation\TranslatorInterface;
class UserAdherentController extends AbstractController
class UserAdherentController extends FluxController
{
protected $em;
protected $translator;
......@@ -69,29 +69,13 @@ class UserAdherentController extends AbstractController
$entity->setOperateur($this->getUser());
$entity->setExpediteur($this->getUser()->getAdherent());
$form = $this->createForm(TransactionAdherentPrestataireFormType::class, $entity);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$data = $form->getData();
$this->em->persist($data);
$this->em->flush();
$this->addFlash(
'success',
$this->translator->trans('Transaction bien effectuée !')
return $this->manageFluxForm(
$request,
$form,
$this->getUser()->getAdherent()->getCompte(),
$this->translator->trans('Transaction à un prestataire bien effectuée !'),
$this->translator->trans('Transaction à un prestataire')
);
$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()->getAdherent()->getCompte(),
'title' => $this->translator->trans('Transaction à un prestataire')
]);
}
/**
......@@ -107,28 +91,12 @@ class UserAdherentController extends AbstractController
$entity->setOperateur($this->getUser());
$entity->setExpediteur($this->getUser()->getAdherent());
$form = $this->createForm(TransactionAdherentAdherentFormType::class, $entity);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$data = $form->getData();
$this->em->persist($data);
$this->em->flush();
$this->addFlash(
'success',
$this->translator->trans('Transaction bien effectuée !')
return $this->manageFluxForm(
$request,
$form,
$this->getUser()->getAdherent()->getCompte(),
$this->translator->trans('Transaction à un adhérent bien effectuée !'),
$this->translator->trans('Transaction à un adhérent')
);
$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()->getAdherent()->getCompte(),
'title' => $this->translator->trans('Transaction à un adhérent')
]);
}
}
......@@ -8,6 +8,7 @@ use App\Entity\Geoloc;
use App\Entity\Groupe;
use App\Entity\TransactionAdherentPrestataire;
use App\Entity\TransfertComptoirAdherent;
use App\Entity\TransfertComptoirPrestataire;
use App\Entity\TransfertPrestataireComptoir;
use App\Entity\Usergroup;
use App\Form\Type\AdherentInfosFormType;
......@@ -15,26 +16,18 @@ use App\Form\Type\AdhererFormType;
use App\Form\Type\GroupeInfosFormType;
use App\Form\Type\TransactionAdherentPrestataireFormType;
use App\Form\Type\TransfertComptoirAdherentFormType;
use App\Form\Type\TransfertComptoirPrestataireFormType;
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;
use Symfony\Component\Translation\TranslatorInterface;
class UserComptoirController extends AbstractController
class UserComptoirController extends FluxController
{
protected $translator;
public function __construct(EntityManagerInterface $em, TranslatorInterface $translator)
{
$this->em = $em;
$this->translator = $translator;
}
/**
* @Route("/user/comptoir/infos", name="comptoir_infos")
* @IsGranted("ROLE_COMPTOIR")
......@@ -72,29 +65,31 @@ class UserComptoirController extends AbstractController
$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',
$this->translator->trans('Transfert bien effectuée !')
return $this->manageFluxForm(
$request,
$form,
$this->getUser()->getComptoirsgere()->getCompte(),
$this->translator->trans('Transfert à un adhérent bien effectuée !'),
$this->translator->trans('Transfert à un adhérent')
);
$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' => $this->translator->trans('Transfert à un adhérent')
]);
/**
* @Route("/user/comptoir/transfert/prestataire/", name="transfertComptoirPrestataire")
* @IsGranted("ROLE_COMPTOIR")
*/
public function transfertComptoirPrestataireAction(Request $request)
{
$entity = new TransfertComptoirPrestataire();
$entity->setOperateur($this->getUser());
$form = $this->createForm(TransfertComptoirPrestataireFormType::class, $entity);
return $this->manageFluxForm(
$request,
$form,
$this->getUser()->getComptoirsgere()->getCompte(),
$this->translator->trans('Transfert à un prestataire bien effectuée !'),
$this->translator->trans('Transfert à un prestataire')
);
}
/**
......@@ -106,28 +101,12 @@ class UserComptoirController extends AbstractController
$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',
$this->translator->trans('Reconversion bien effectuée !')
return $this->manageFluxForm(
$request,
$form,
$this->getUser()->getComptoirsgere()->getCompte(),
$this->translator->trans('Reconversion bien effectuée !'),
$this->translator->trans("Reconversion d'un prestataire")
);
$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' => $this->translator->trans("Reconversion d'un prestataire")
]);
}
}
......@@ -24,17 +24,8 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Translation\TranslatorInterface;
class UserGestionnaireGroupeController extends AbstractController
class UserGestionnaireGroupeController extends FluxController
{
protected $em;
protected $translator;
public function __construct(EntityManagerInterface $em, TranslatorInterface $translator)
{
$this->em = $em;
$this->translator = $translator;
}
/**
* @Route("/user/groupe/infos", name="groupe_infos")
* @Security("is_granted('ROLE_GESTION_GROUPE') or is_granted('ROLE_CONTACT')")
......@@ -72,28 +63,12 @@ class UserGestionnaireGroupeController extends AbstractController
$entity = new TransfertGroupeComptoir();
$entity->setOperateur($this->getUser());
$form = $this->createForm(TransfertGroupeComptoirFormType::class, $entity);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$data = $form->getData();
$this->em->persist($data);
$this->em->flush();
$this->addFlash(
'success',
$this->translator->trans('Transfert bien effectuée !')
return $this->manageFluxForm(
$request,
$form,
$this->getUser()->getGroupesgere()->getCompte(),
$this->translator->trans('Transfert bien effectué !'),
$this->translator->trans('Transfert à un comptoir')
);
$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()->getGroupesgere()->getCompte(),
'title' => $this->translator->trans('Transfert à un comptoir')
]);
}
}
......@@ -18,17 +18,8 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Translation\TranslatorInterface;
class UserPrestataireController extends AbstractController
class UserPrestataireController extends FluxController
{
private $em;
private $translator;
public function __construct(EntityManagerInterface $em, TranslatorInterface $translator)
{
$this->em = $em;
$this->translator = $translator;
}
/**
* @Route("/prestataireinfos", name="prestataire_infos")
* @IsGranted("ROLE_PRESTATAIRE")
......@@ -100,29 +91,13 @@ class UserPrestataireController extends AbstractController
$entity->setOperateur($this->getUser());
$entity->setExpediteur($this->getUser()->getPrestataire());
$form = $this->createForm('App\Form\Type\TransactionPrestataire'.ucwords($type).'FormType', $entity);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$data = $form->getData();
$this->em->persist($data);
$this->em->flush();
$this->addFlash(
'success',
$this->translator->trans('Transaction bien effectuée !')
return $this->manageFluxForm(
$request,
$form,
$this->getUser()->getPrestataire()->getCompte(),
$this->translator->trans('Transaction bien effectuée !'),
$this->translator->trans('Transaction à un ').$type
);
$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' => $this->translator->trans('Transaction à un ').$type
]);
}
......@@ -136,28 +111,12 @@ class UserPrestataireController extends AbstractController
$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',
$this->translator->trans('Reconversion envoyée, elle sera validée lorsque le virement sera effectué !')
return $this->manageFluxForm(
$request,
$form,
$this->getUser()->getPrestataire()->getCompte(),
$this->translator->trans('Reconversion envoyée, elle sera validée lorsque le virement sera effectué !'),
$this->translator->trans('Reconversion de monnaie au siège')
);
$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' => $this->translator->trans('Reconversion de monnaie au siège')
]);
}
}
......@@ -29,17 +29,8 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Translation\TranslatorInterface;
class UserSiegeController extends AbstractController
class UserSiegeController extends FluxController
{
protected $em;
protected $translator;
public function __construct(EntityManagerInterface $em, TranslatorInterface $translator)
{
$this->em = $em;
$this->translator = $translator;
}
// /**
// * @Route("/user/siege/infos", name="groupe_infos")
// * @Security("is_granted('ROLE_AMIN_SIEGE') or is_granted('ROLE_SUPER_ADMIN')")
......@@ -77,29 +68,13 @@ class UserSiegeController extends AbstractController
$entity = new TransfertSiegeGroupe();
$entity->setOperateur($this->getUser());
$form = $this->createForm(TransfertSiegeGroupeFormType::class, $entity);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$data = $form->getData();
$this->em->persist($data);
$this->em->flush();
$this->addFlash(
'success',
$this->translator->trans('Transfert bien effectuée !')
return $this->manageFluxForm(
$request,
$form,
$this->em->getRepository(Siege::class)->findOneById(1)->getCompte(),
$this->translator->trans('Transfert bien effectué !'),
$this->translator->trans('Transaction à un groupe')
);
$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->em->getRepository(Siege::class)->findOneById(1)->getCompte(),
'title' => $this->translator->trans('Transfert à un groupe')
]);
}
/**
......@@ -111,28 +86,12 @@ class UserSiegeController extends AbstractController
$entity = new TransfertGroupeSiege();
$entity->setOperateur($this->getUser());
$form = $this->createForm(TransfertGroupeSiegeFormType::class, $entity);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$data = $form->getData();
$this->em->persist($data);
$this->em->flush();
$this->addFlash(
'success',
$this->translator->trans('Transfert bien effectuée !')
return $this->manageFluxForm(
$request,
$form,
$this->em->getRepository(Siege::class)->findOneById(1)->getCompte(),
$this->translator->trans('Transfert bien effectué !'),
$this->translator->trans('Transaction du groupe au siège')
);
$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->em->getRepository(Siege::class)->findOneById(1)->getCompte(),
'title' => $this->translator->trans('Transfert du groupe au siège')
]);
}
}
......@@ -32,7 +32,7 @@ class Adherent
/**
* @var User
*
* @ORM\OneToOne(targetEntity="User", cascade={"all"}, mappedBy="adherent", fetch="EAGER")
* @ORM\OneToOne(targetEntity="User", cascade={"all"}, mappedBy="adherent", fetch="LAZY")
*/
protected $user;
......
......@@ -268,4 +268,27 @@ abstract class Flux
}
}
}
public function toHtmlArray(): string
{
if (empty($this->getDestinataire()) || empty($this->getExpediteur()) || empty($this->getMontant())) {
return "[FLUX] Visualisation impossible ! Destinataire / Expéditeur et/ou montant manquant(s) !";
}
$return = '<tr>';
$return .= '<td>'.$this->getCreatedAt()->format('d/m/Y H:i').'</td>';
$return .= '<td>'.ucwords($this->getParenttype()).'</td>';
$return .= '<td>'.$this->getExpediteur().'</td>';
$return .= '<td>'.$this->getDestinataire().'</td>';
$return .= '<td>'.$this->getMontant().'&euro;</td>';
$return .= '</tr>';
return $return;
}
public function __toString(): string
{
if (empty($this->getDestinataire()) || empty($this->getExpediteur()) || empty($this->getMontant())) {
return "[FLUX] Visualisation impossible ! Destinataire / Expéditeur et/ou montant manquant(s) !";
}
return $this->getCreatedAt()->format('d/m/Y H:i').' | '.ucwords($this->getParenttype()).' : '.$this->getDestinataire().' => '.$this->getExpediteur().' ; '.$this->getMontant().'&euro;';
}
}
......@@ -23,7 +23,7 @@ class TransactionPrestataireAdherentFormType extends TransactionFormType
))
->add('destinataire', EntityType::class, array(
'class' => Adherent::class,
'choices' => $this->em->getRepository(Adherent::class)->findBy(array('enabled' => true)),
'choices' => $this->em->getRepository(Adherent::class)->findOrderByName(),
'placeholder' => 'Adherent',
'required' => true,
'label' => 'Adherent :',
......
......@@ -23,7 +23,7 @@ class TransfertComptoirAdherentFormType extends TransfertFormType
))
->add('destinataire', EntityType::class, array(
'class' => Adherent::class,
'choices' => $this->em->getRepository(Adherent::class)->findBy(array('enabled' => true)),
// 'choices' => $this->em->getRepository(Adherent::class)->findOrderByName(),
'placeholder' => 'Adherent',
'required' => true,
'label' => 'Adherent :',
......
......@@ -22,6 +22,22 @@ class AdherentRepository extends ServiceEntityRepository
/**
* @return Adherent[] Returns an array of Adherent objects
*/
public function findOrderByName()
{
$qb = $this->createQueryBuilder('p');
return $qb
->leftjoin('p.user', 'u')
->where('p.enabled = :enabled')
->setParameter('enabled', true)
->orderBy('u.lastname', 'ASC')
->getQuery()
->getResult()
;
}
/**
* @return Adherent[] Returns an array of Adherent objects
*/
public function findbyExclude(Adherent $adherent)
{
$qb = $this->createQueryBuilder('p');
......
......@@ -9,10 +9,21 @@
{% block blocksubtitle %}
{% endblock blocksubtitle %}
{% block blockcontent %}
<ul class='list-group'>
<table class="table">
<thead>
<tr>
<th scope="col">Date</th>
<th scope="col">Type</th>
<th scope="col">Expediteur</th>
<th scope="col">Destinataire</th>
<th scope="col">Montant</th>
</tr>
</thead>
<tbody>
{% 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>
{{flux.toHtmlArray()|raw}}
{% endfor %}
</ul>
</tbody>
</table>
{% endblock blockcontent %}
{% endif %}
\ No newline at end of file
......@@ -4,37 +4,37 @@
{% if is_granted('ROLE_PREVIOUS_ADMIN') %}
<div class='w-100 text-center mb-2'>
<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=_exit'>
RETOUR SUPER ADMIN
{{ 'RETOUR SUPER ADMIN'|trans }}
</a>
</div>
{% else %}
<div class='mb-2'>
<a class='btn btn-xs m-1 btn-primary' href='{{path('index', [], true)}}?_switch_user=user_prestataire'>
PRESTATAIRE
{{ 'PRESTATAIRE'|trans }}
</a>
<a class='btn btn-xs m-1 btn-primary' href='{{path('index', [], true)}}?_switch_user=user_adherent'>
ADHERENT
{{ 'ADHERENT'|trans }}
</a>
<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=user_adminsiege'>
ADMIN SIEGE
{{ 'ADMIN SIEGE'|trans }}
</a>
<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=user_comptoir'>
COMPTOIR
{{ 'COMPTOIR'|trans }}
</a>
<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=user_gestiongroupe'>
GESTION GROUPE
{{ 'GESTION GROUPE'|trans }}
</a>
<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=user_contact'>
CONTACT
{{ 'CONTACT'|trans }}
</a>
<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=user_tresorier'>
TRESORIER
{{ 'TRESORIER'|trans }}
</a>
<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=user_controleur'>
CONTROLEUR
{{ 'CONTROLEUR'|trans }}
</a>
<a class='btn btn-xs m-1 btn-primary' href='{{path(routeName, [], true)}}?_switch_user=user_redacteur'>
REDACTEUR
{{ 'REDACTEUR'|trans }}
</a>
</div>
{% endif %}
......@@ -43,6 +43,7 @@
{# 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 %}
......@@ -51,10 +52,14 @@
{% include 'block/userpassword.html.twig' %}
{% include 'siege/block/transfert_siegegroupe.html.twig' %}
{% include 'siege/block/transfert_groupesiege.html.twig' %}
{% elseif is_granted('ROLE_REDACTEUR') %}
{% include 'block/userinfos.html.twig' %}
{% include 'block/userpassword.html.twig' %}
{% elseif is_granted('ROLE_TRESORIER') %}
{% set siege = getSiege() %}
{% set compte = siege.getCompte() %}
{% set soldelabel = 'Solde du siège'|trans %}
......@@ -62,9 +67,13 @@
{% include 'block/userinfos.html.twig' %}
{% include 'block/userpassword.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 %}
......@@ -75,7 +84,9 @@
{% include 'block/userpassword.html.twig' %}
{% include 'block/transactions.html.twig' %}
{% include 'groupe/block/transaction_comptoir.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 ~ '"' %}
......@@ -86,8 +97,11 @@
{% include 'block/userpassword.html.twig' %}
{% include 'block/transactions.html.twig' %}
{% include 'comptoir/block/transaction_adherent.html.twig' %}
{% include 'comptoir/block/transaction_prestataire.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 %}
......@@ -97,14 +111,18 @@
{% include 'block/userinfos.html.twig' %}
{% include 'block/userpassword.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' %}
{% include 'block/userpassword.html.twig' %}
{% elseif is_granted('ROLE_PRESTATAIRE') %}
{% include 'presta/block/solde.html.twig' %}
{% include 'presta/block/infos.html.twig' %}
{% include 'block/userinfos.html.twig' %}
......@@ -115,7 +133,9 @@
{% 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/userpassword.html.twig' %}
......@@ -123,6 +143,7 @@
{% 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 %}
......
......@@ -152,6 +152,7 @@ Modified for MLC from Sonata package.
<a href="#" class="sidebar-toggle" data-toggle="offcanvas"
role="button" title="{{ 'toggle_navigation'|trans({}, 'SonataAdminBundle') }}">
<i class="fa fa-bars"></i>
<span class="sr-only">{{ 'toggle_navigation'|trans({}, 'SonataAdminBundle') }}</span>
</a>
......
{% extends 'block/onetransaction.html.twig' %}
{% block blocktitle %}
<i class="fa fa-exchange-alt mr-4"></i> {{'Virement vers un prestataire'|trans}}
{% endblock blocktitle %}
{% block blockcontent %}
{% set form = getTransfertComptoirToXForm(app.user, 'prestataire') %}
{{ parent() }}
{% endblock blockcontent %}
\ No newline at end of file
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