Commit b30a3d0b by Damien Moulard

resolve merge conflicts + remove useless code

parents 1e077d7f 8e14715a
......@@ -215,8 +215,22 @@ $(function() {
// BOOTSTRAP TOOLTIPS
$('[data-toggle="tooltip"]').tooltip()
$("input:text[name='formAchatMonnaieAdherent[don][montant]']").change(function() {
var valuetotal = parseFloat($('input.achatmonnaie-montant-slider').slider().val()) + parseFloat($("input:text[name='formAchatMonnaieAdherent[don][montant]']").val().replace(",", "."))
$("input:text[name='formAchatMonnaieAdherent[don][montant]']").on('input', function() {
let montant = 0;
let montantSlider = parseFloat($('input.achatmonnaie-montant-slider').slider().val());
if (!isNaN(montantSlider)) {
montant = montantSlider;
} else {
montant = parseFloat($('input#formAchatMonnaieAdherent_montant').val());
}
let montantDon = parseFloat($("input:text[name='formAchatMonnaieAdherent[don][montant]']").val().replace(",", "."));
if (isNaN(montantDon)) {
montantDon = 0;
}
var valuetotal = montant + montantDon;
$("span.achat_monnaie_montant_total").text(valuetotal + ' €')
});
$("input:text[name='formAchatMonnaieAConfirmerAdherent[don][montant]']").change(function() {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -3,7 +3,7 @@
"app": {
"js": [
"/build/runtime.6ad5c9da.js",
"/build/app.e59ff819.js"
"/build/app.79a96478.js"
],
"css": [
"/build/app.2a0f820a.css"
......
{
"build/app.css": "/build/app.2a0f820a.css",
"build/app.js": "/build/app.e59ff819.js",
"build/app.js": "/build/app.79a96478.js",
"build/admin.css": "/build/admin.5dc0eea7.css",
"build/admin.js": "/build/admin.8a6adf4b.js",
"build/runtime.js": "/build/runtime.6ad5c9da.js",
......
......@@ -42,6 +42,10 @@ class AdhesionController extends AbstractController
*/
public function adhererAction(Request $request)
{
if ($this->getParameter('tav_env') == true) {
return $this->redirect($this->router->generate('index'));
}
$adherent = new Adherent();
$form = $this->createForm(AdhererFormType::class, $adherent);
......
......@@ -122,6 +122,45 @@ class UserAdherentController extends FluxController
}
/**
* @Route("/adherent/paiement-cotis-tav/", name="paiementCotisTav")
* @IsGranted("ROLE_ADHERENT")
*/
public function paiementCotisTavAction(Request $request)
{
if (empty($this->getUser()) || empty($this->getUser()->getAdherent())) {
return $this->redirectToRoute('index');
}
$entity = new AchatMonnaieAdherent();
$form = $this->createForm(AchatMonnaieAdherentFormType::class, $entity);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
// TODO: set CB payment when functionality validated
$flux = $form->getData();
if (null == $flux->getDon() || 0 == $flux->getDon()->getMontant()) {
$flux->setDon(null);
}
$this->em->persist($flux);
$this->operationUtils->executeOperations($flux);
$this->em->flush();
$this->addFlash(
'success',
$this->translator->trans('Cotisation payée ! [Payzen désactivé en attent du compte ; bonification et mensualité pas encore implémentés]')
);
return $this->redirectToRoute('index');
}
return $this->render('@kohinos/flux/transaction.html.twig', [
'form' => $form->createView(),
'title' => $this->translator->trans('Payer sa cotisation'),
]);
}
/**
* @Route("/adherent/demande/achat-monnaie/", name="achatMonnaieAConfirmerAdherent")
* @IsGranted("ROLE_ADHERENT")
*/
......
......@@ -22,7 +22,6 @@ use App\Form\Type\VenteComptoirPrestataireFormType;
use App\Form\Type\VenteEmlcAdherentFormType;
use App\Form\Type\VenteEmlcPrestataireFormType;
use App\Form\Type\EncaisserCotisationAdherentFormType;
use App\Form\Type\EncaisserCotisationAdherentValidationFormType;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
......@@ -227,11 +226,6 @@ class UserComptoirController extends FluxController
);
}
$this->addFlash(
'error',
$this->translator->trans('Opération impossible : l\'habitant.e n\'a pas de profil de cotisation associé.')
);
return $this->redirectToRoute('index');
}
}
......@@ -439,7 +439,7 @@ class FormFactory
public function getSetPaymentCodeForm(User $user)
{
if (empty($user) || !$user->isGranted('ROLE_ADHERENT')) {
throw new \Exception('[FORM 23] Opération impossible !');
throw new \Exception('[FORM 24] Opération impossible !');
}
$form = $this->ff->create(SetPaymentCodeFormType::class, $user->getAdherent(), ['action' => $this->router->generate('adherentSetPaymentCode')]);
......@@ -458,4 +458,17 @@ class FormFactory
return $form->createView();
}
public function getPayerCotisationTAVForm(User $user)
{
if (empty($user) || !$user->isGranted('ROLE_ADHERENT')) {
throw new \Exception('[FORM 25] Opération impossible !');
}
$entity = new AchatMonnaieAdherent();
$entity->setOperateur($user);
$form = $this->ff->create(AchatMonnaieAdherentFormType::class, $entity, ['action' => $this->router->generate('paiementCotisTav')]);
return $form->createView();
}
}
......@@ -32,46 +32,66 @@ class AchatMonnaieFormType extends FluxFormType
'entity_class' => Siege::class,
'em' => $this->em,
])
->add('montantradio', ChoiceType::class, [
'choices' => [
'30 €' => 30,
'50 €' => 50,
'100 €' => 100,
],
'required' => false,
'placeholder' => false,
'data' => $this->defaultMontantSlider,
'expanded' => true,
'multiple' => false,
'label' => 'Sélectionnez un montant :',
'mapped' => false,
])
->add('montant', RangeType::class, [
'attr' => [
'min' => 0,
'max' => $this->maxMontantSlider,
'data-provide' => 'slider',
'data-slider-ticks' => '[0, 50, 100, 150, 200, 250]',
'data-slider-ticks-labels' => '[0, 50, 100, 150, 200, 250]',
'data-slider-ticks-positions' => '[0, 20, 40, 60, 80, 100]',
'data-slider-min' => '0',
'data-slider-max' => $this->maxMontantSlider,
'data-slider-step' => '5',
'data-slider-value' => $this->defaultMontantSlider,
'style' => 'width:100%;',
'class' => 'achatmonnaie-montant-slider',
],
'label' => 'Ou choisissez librement le montant : ',
'required' => false,
])
->add('payOther', SubmitType::class, [
'label' => 'Payer autrement',
'translation_domain' => 'messages',
'attr' => [
'class' => 'btn-secondary',
],
])
;
if ($this->container->getParameter('tav_env')) {
$montant = 0;
$profilDeCotisation = $this->security->getUser()->getAdherent()->getProfilDeCotisation();
if (null != $profilDeCotisation) {
$montant = $profilDeCotisation->getMontant();
} else {
$montant = intval($this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::COTISATION_ADHERENT_DEFAULT));
}
$builder
->add('montant', HiddenType::class, [
'data' => $montant,
])
;
} else {
$builder
->add('montantradio', ChoiceType::class, [
'choices' => [
'30 €' => 30,
'50 €' => 50,
'100 €' => 100,
],
'required' => false,
'placeholder' => false,
'data' => $this->defaultMontantSlider,
'expanded' => true,
'multiple' => false,
'label' => 'Sélectionnez un montant :',
'mapped' => false,
])
->add('montant', RangeType::class, [
'attr' => [
'min' => 0,
'max' => $this->maxMontantSlider,
'data-provide' => 'slider',
'data-slider-ticks' => '[0, 50, 100, 150, 200, 250]',
'data-slider-ticks-labels' => '[0, 50, 100, 150, 200, 250]',
'data-slider-ticks-positions' => '[0, 20, 40, 60, 80, 100]',
'data-slider-min' => '0',
'data-slider-max' => $this->maxMontantSlider,
'data-slider-step' => '5',
'data-slider-value' => $this->defaultMontantSlider,
'style' => 'width:100%;',
'class' => 'achatmonnaie-montant-slider',
],
'label' => 'Ou choisissez librement le montant : ',
'required' => false,
])
->add('payOther', SubmitType::class, [
'label' => 'Payer autrement',
'translation_domain' => 'messages',
'attr' => [
'class' => 'btn-secondary',
],
])
;
}
if ('true' === $this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::USE_PAYZEN)) {
$builder
->add('save', SubmitType::class, [
......
......@@ -54,6 +54,7 @@ class FormExtension extends AbstractExtension
new \Twig_SimpleFunction('getTicketFixDestroyForm', [$this, 'getTicketFixDestroyForm']),
new \Twig_SimpleFunction('getSetPaymentCodeForm', [$this, 'getSetPaymentCodeForm']),
new \Twig_SimpleFunction('getComptoirEncaisserCotisationForm', [$this, 'getComptoirEncaisserCotisationForm']),
new \Twig_SimpleFunction('getPayerCotisationTAVForm', [$this, 'getPayerCotisationTAVForm'])
];
}
......@@ -211,4 +212,9 @@ class FormExtension extends AbstractExtension
{
return $this->container->get('app.formfactory')->getComptoirEncaisserCotisationForm($user);
}
public function getPayerCotisationTAVForm(User $user)
{
return $this->container->get('app.formfactory')->getPayerCotisationTAVForm($user);
}
}
......@@ -5,20 +5,23 @@
{% set esoldelabel = 'Solde e-mlc'|trans %}
{% include '@kohinos/block/solde.html.twig' with {'compte': app.user.adherent.emlcAccount.balance, 'soldelabel': esoldelabel, 'currency' : 'e'~(KOH_MLC_SYMBOL|default(''))} %}
{% if tav_env == 1 %}
{% include '@kohinos/tav/block/payment_code.html.twig' %}
{% endif %}
{% if KOH_USE_PAYZEN == 'true' or KOH_USE_HELLOASSO == 'true' %}
{% include '@kohinos/adherent/block/achat_monnaie.html.twig' %}
{% if not tav_env %}
{% if KOH_USE_PAYZEN == 'true' or KOH_USE_HELLOASSO == 'true' %}
{% include '@kohinos/adherent/block/achat_monnaie.html.twig' %}
{% else %}
{% include '@kohinos/adherent/block/demande_achat_monnaie.html.twig' %}
{% endif %}
{% include '@kohinos/adherent/block/transaction_presta.html.twig' %}
{% include '@kohinos/adherent/block/transaction_adherent.html.twig' %}
{# {% include '@kohinos/block/transactions.html.twig' %} #}
{% include '@kohinos/block/operations.html.twig' %}
{% include '@kohinos/block/cotisations.html.twig' %}
{% include '@kohinos/adherent/block/infos.html.twig' %}
{% if KOH_USE_SOLIDOUME|default('false') == 'true' and getSolidoumeParam('name')|default('') is not null %}
{% include '@kohinos/adherent/block/solidoume.html.twig' %}
{% endif %}
{% else %}
{% include '@kohinos/adherent/block/demande_achat_monnaie.html.twig' %}
{% include '@kohinos/tav/block/adherent_payer_cotisation.html.twig' %}
{% include '@kohinos/tav/block/adherent_payment_code.html.twig' %}
{% include '@kohinos/block/operations.html.twig' %}
{% endif %}
{% include '@kohinos/adherent/block/transaction_presta.html.twig' %}
{% include '@kohinos/adherent/block/transaction_adherent.html.twig' %}
{# {% include '@kohinos/block/transactions.html.twig' %} #}
{% include '@kohinos/block/operations.html.twig' %}
{% include '@kohinos/block/cotisations.html.twig' %}
{% include '@kohinos/adherent/block/infos.html.twig' %}
{% if KOH_USE_SOLIDOUME|default('false') == 'true' and getSolidoumeParam('name')|default('') is not null %}
{% include '@kohinos/adherent/block/solidoume.html.twig' %}
{% endif %}
\ No newline at end of file
......@@ -8,7 +8,7 @@
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
{% if app.user is null and ((KOH_USE_WORDPRESS is defined and KOH_USE_PAYZEN == 'true') or (KOH_USE_HELLOASSO is defined and KOH_USE_HELLOASSO == 'true')) %}
{% if app.user is null and ((KOH_USE_WORDPRESS is defined and KOH_USE_PAYZEN == 'true') or (KOH_USE_HELLOASSO is defined and KOH_USE_HELLOASSO == 'true')) and not tav_env %}
<li class="nav-item dropdownmenu-item has-child dropdown" role="menuitem">
<a href="#" id="navbarDropdown1" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="nav-link parent dropdown-toggle ">{{ 'Adhérer'|trans }}</a>
......
......@@ -4,7 +4,9 @@
<div class='container' style='max-width: 800px;'>
{% include '@kohinos/block/breadcrumb.html.twig' with {'label' : 'Mon compte'|trans } %}
<div id="accordion" class='text-center mb-5'>
{% include '@kohinos/block/userinfos.html.twig' %}
{% if not tav_env or tav_env == 1 and not (is_granted('ROLE_ADHERENT') and app.user.adherent) %}
{% include '@kohinos/block/userinfos.html.twig' %}
{% endif %}
{% include '@kohinos/block/userpassword.html.twig' %}
</div>
</div>
......
{% extends '@kohinos/block/block_collapse.html.twig' %}
{% block blocktitle %}
<i class="fa fa-shopping-basket mr-4"></i> {{'Payer ma cotisation'|trans }}
{% endblock blocktitle %}
{% block blockcontent %}
{% set form = getPayerCotisationTAVForm(app.user) %}
<p>
{{ 'Montant de la cotisation à payer'|trans }} : <span class="paiement_cotisation_montant">{{ form.montant.vars.value }}</span>
</p>
{{form_start(form)}}
{% if form.don is defined %}
{{ form_row(form.don, {row_attr:{style: 'max-width: 200px;margin: 0 auto;'}}) }}
<hr/>
<p><b>{{ 'TOTAL A PAYER'|trans }} : <span class="achat_monnaie_montant_total">{{ form.montant.vars.value }}</span></b></p>
{% endif %}
{% if form.save is defined %}
{{ form_widget(form.save) }}
{% endif %}
{% if form.saveHelloAsso is defined %}
{{ form_widget(form.saveHelloAsso) }}
{% endif %}
{{form_end(form)}}
{% 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