Commit b932702c by Damien Moulard

fix impossible de cotiser par cb quand solde emlc à 0

parent cf595865
...@@ -154,11 +154,16 @@ jQuery(document).ready(function() { ...@@ -154,11 +154,16 @@ jQuery(document).ready(function() {
form.submit() form.submit()
} }
}); });
$('.cotisationSubmit').on('click', function(e){
$('.cotisationMLCSubmit').on('click', function(e){
// Stop form submition // Stop form submition
e.preventDefault(); e.preventDefault();
var form = this.closest('form') var form = this.closest('form')
// Set form moyen
$('#' + form.name + '_moyen')[0].value = 'mlc'
if (form.checkValidity()) { if (form.checkValidity()) {
var div = '.confirmCotisation' var div = '.confirmCotisation'
...@@ -172,5 +177,11 @@ jQuery(document).ready(function() { ...@@ -172,5 +177,11 @@ jQuery(document).ready(function() {
form.submit() form.submit()
} }
}); });
$('.cotisationCBSubmit').on('click', function(e){
var form = this.closest('form')
// Set form moyen
$('#' + form.name + '_moyen')[0].value = 'cb'
});
}); });
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"app": { "app": {
"js": [ "js": [
"/build/runtime.420770e4.js", "/build/runtime.420770e4.js",
"/build/app.a5bdb92a.js" "/build/app.a1cf5950.js"
], ],
"css": [ "css": [
"/build/app.0ecb0d81.css" "/build/app.0ecb0d81.css"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"build/admin.css": "/build/admin.4d653142.css", "build/admin.css": "/build/admin.4d653142.css",
"build/admin.js": "/build/admin.3024c297.js", "build/admin.js": "/build/admin.3024c297.js",
"build/app.css": "/build/app.0ecb0d81.css", "build/app.css": "/build/app.0ecb0d81.css",
"build/app.js": "/build/app.a5bdb92a.js", "build/app.js": "/build/app.a1cf5950.js",
"build/runtime.js": "/build/runtime.420770e4.js", "build/runtime.js": "/build/runtime.420770e4.js",
"build/ckeditor/adapters/jquery.js": "/build/ckeditor/adapters/jquery.js", "build/ckeditor/adapters/jquery.js": "/build/ckeditor/adapters/jquery.js",
"build/ckeditor/ckeditor.js": "/build/ckeditor/ckeditor.js", "build/ckeditor/ckeditor.js": "/build/ckeditor/ckeditor.js",
......
...@@ -52,13 +52,8 @@ class UserController extends AbstractController ...@@ -52,13 +52,8 @@ class UserController extends AbstractController
if ($form->isSubmitted()) { if ($form->isSubmitted()) {
$cotisation = $form->getData(); $cotisation = $form->getData();
if ($form->get('payMLC')->isClicked()) {
$cotisation->setMoyen(MoyenEnum::MOYEN_MLC);
} else {
$cotisation->setMoyen(MoyenEnum::MOYEN_CB);
}
if ($form->isValid()) { if ($form->isValid()) {
if ($form->get('payMLC')->isClicked() || !$form->get('payMLC')->isClicked() && !$form->get('payCB')->isClicked()) { if ($cotisation->getMoyen() == MoyenEnum::MOYEN_MLC) {
$cotisation->setRecu(true); $cotisation->setRecu(true);
$this->em->persist($cotisation); $this->em->persist($cotisation);
$this->em->flush(); $this->em->flush();
...@@ -78,7 +73,7 @@ class UserController extends AbstractController ...@@ -78,7 +73,7 @@ class UserController extends AbstractController
} else { } else {
$this->addFlash( $this->addFlash(
'error', 'error',
$this->translator->trans('Problème avec la cotisation !') $this->translator->trans('Problème avec la cotisation !') . ' ' . $form->getErrors()
); );
} }
} }
......
...@@ -88,21 +88,21 @@ class CotiserFormType extends AbstractType ...@@ -88,21 +88,21 @@ class CotiserFormType extends AbstractType
'data' => MoyenEnum::MOYEN_MLC, 'data' => MoyenEnum::MOYEN_MLC,
)) ))
; ;
// ->add('moyen', ChoiceType::class, array(
// 'required' => true,
// 'label' => 'Moyen de paiement :',
// 'choices' => $canPayWithMlc ? [MoyenEnum::getTypeName(MoyenEnum::MOYEN_MLC) => MoyenEnum::MOYEN_MLC, MoyenEnum::getTypeName(MoyenEnum::MOYEN_CB) => MoyenEnum::MOYEN_CB] : [MoyenEnum::getTypeName(MoyenEnum::MOYEN_CB) => MoyenEnum::MOYEN_CB]
// ))
if ($canPayWithMlc) { if ($canPayWithMlc) {
$builder->add('payMLC', SubmitType::class, array( $builder->add('payMLC', SubmitType::class, array(
'label' => "Payer en eMLC", 'label' => "Payer en eMLC",
'attr' => [ 'attr' => [
'class' => 'btn-primary btn cotisationSubmit' 'class' => 'btn-primary btn cotisationMLCSubmit'
] ]
)); ));
} }
if ($canPayWithCB) { if ($canPayWithCB) {
$builder->add('payCB', SubmitType::class, ['label' => "Payer en CB"]); $builder->add('payCB', SubmitType::class, array(
'label' => "Payer en CB",
'attr' => [
'class' => 'btn-primary btn cotisationCBSubmit'
]
));
} }
if ($this->security->getUser()->isGranted('ROLE_ADHERENT')) { if ($this->security->getUser()->isGranted('ROLE_ADHERENT')) {
......
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