Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adhésion : améliorations sur la page "Adhésion rapide" #996

Merged
merged 3 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 26 additions & 19 deletions app/Resources/views/user/_partial/user_quick_form.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="row">
<div class="input-field col s12 m6 offset-m3">
<div class="input-field col s12 m6 {% if maximum_nb_of_beneficiaries_in_membership > 1 %}offset-m3{% endif %}">
<div class="errors">
{{ form_errors(form.email) }}
</div>
Expand All @@ -9,7 +9,9 @@
{{ form_label(form.email) }}
</div>
</div>
<div class="col s12 m5 card teal lighten-5">
</div>
<div class="row">
<div class="col s12 {% if maximum_nb_of_beneficiaries_in_membership > 1 %}m5{% else %}m6{% endif %} card teal lighten-5">
<div class="row card-content">
<div class="col s12">
<h4>Nouvelle adhésion</h4>
Expand Down Expand Up @@ -50,7 +52,11 @@
</div>
{% endfor %}
</div>
<a href="#" class="add-another-collection-widget blue-grey-text" data-list-selector="#beneficiaries-emails-fields-list"><i class="material-icons left">add_circle</i>ajouter un second beneficiaire ?</a>
{% if maximum_nb_of_beneficiaries_in_membership > 1 %}
<a href="#" class="add-another-collection-widget blue-grey-text" data-list-selector="#beneficiaries-emails-fields-list">
<i class="material-icons left">add_circle</i>ajouter un second bénéficiaire ?
</a>
{% endif %}
<script>
var max_b = {{ maximum_nb_of_beneficiaries_in_membership }};
defer(function() {
Expand Down Expand Up @@ -98,23 +104,24 @@
</div>
</div>
</div>
<div class="col s12 m2 center-align">
<h4>ou</h4>
</div>
<div class="col s12 m5 card indigo lighten-5">
<div class="row card-content">
<div class="col s12">
<h4>Ajout à une adhésion existante</h4>
</div>
<div class="input-field col s12">
<div class="errors">
{{ form_errors(form.join_to) }}
{% if maximum_nb_of_beneficiaries_in_membership > 1 %}
<div class="col s12 m2 center-align">
<h4>ou</h4>
</div>
<div class="col s12 m5 card indigo lighten-5">
<div class="row card-content">
<div class="col s12">
<h4>Ajout à une adhésion existante</h4>
</div>
<div class="input-field col s12">
<div class="errors">
{{ form_errors(form.join_to) }}
</div>
<i class="material-icons prefix">person_add</i>
{{ form_widget(form.join_to) }}
{{ form_label(form.join_to) }}
</div>
<i class="material-icons prefix">person_add</i>
{{ form_widget(form.join_to) }}
{{ form_label(form.join_to) }}
</div>
</div>
</div>

{% endif %}
</div>
22 changes: 15 additions & 7 deletions app/Resources/views/user/quick_new.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,23 @@
{% block content %}
<h4>Adhésion rapide</h4>

{#<p>Pour une adhésion <span style="text-decoration: underline;">future</span>, choisir <span style="text-decoration: underline;">Helloasso</span> : la personne recevra un lien pour finaliser et payer son adhésion en ligne.</p>#}
<!--
<p>
Pour une adhésion <span style="text-decoration: underline;">future</span>,
choisir <span style="text-decoration: underline;">Helloasso</span> :
la personne recevra un lien pour finaliser et payer son adhésion en ligne.
</p>
-->

{{ form_start(form) }}
<div class="errors">
{{ form_errors(form) }}
</div>
{% include "user/_partial/user_quick_form.html.twig" with { form: form } %}
<div>
<button type="submit" class="btn waves-effect waves-light teal"><i class="material-icons left">check</i>Valider</button>
<a href="{{ path("user_office_tools") }}" class="btn white blue-grey-text"><i class="material-icons left">arrow_back</i>Retour</a>
</div>
<div class="" style="display: none">
{{ form_widget(form) }}
<a href="{{ path("user_office_tools") }}" class="btn white red-text" title="Annuler">Annuler</a>
<button type="submit" class="btn teal"><i class="material-icons left">check</i>Valider</button>
</div>
{{ form_end(form) }}
{{ form_row(form._token) }}
{{ form_end(form, {'render_rest': false}) }}
{% endblock %}
2 changes: 1 addition & 1 deletion src/AppBundle/Controller/MembershipController.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ public function setEmailAction(Beneficiary $beneficiary, Request $request)
$em->flush();
$request->getSession()->getFlashBag()->add('success', 'Merci ! votre email a bien été enregistré');
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$request->getSession()->getFlashBag()->add('warning', 'Oups, le format du courriel entré semble problématique');
$request->getSession()->getFlashBag()->add('warning', "Oups, le format de l'email entré semble problématique");
}
return $this->render('beneficiary/confirm.html.twig', array(
'beneficiary' => $beneficiary,
Expand Down
8 changes: 3 additions & 5 deletions src/AppBundle/Controller/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,25 +155,23 @@ public function changePasswordAction(Request $request)
*/
public function quickNewAction(Request $request, \Swift_Mailer $mailer)
{
$session = new Session();
$em = $this->getDoctrine()->getManager();

$ab = new AnonymousBeneficiary();

$form = $this->createForm(AnonymousBeneficiaryType::class, $ab);
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {

$ab->setRegistrar($this->getCurrentAppUser());

$em = $this->getDoctrine()->getManager();
$em->persist($ab);
$em->flush();

$dispatcher = $this->get('event_dispatcher');
$dispatcher->dispatch(AnonymousBeneficiaryCreatedEvent::NAME, new AnonymousBeneficiaryCreatedEvent($ab));

$session = new Session();
$session->getFlashBag()->add('success', 'La nouvelle adhésion a bien été prise en compte !');

return $this->redirectToRoute('user_quick_new');
}

Expand Down
23 changes: 17 additions & 6 deletions src/AppBundle/Form/AnonymousBeneficiaryType.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,29 @@ public function buildForm(FormBuilderInterface $builder, array $options)
}

$builder
->add('email',EmailType::class,array('label'=>'Courriel du nouveau membre'))
->add('join_to',AutocompleteBeneficiaryType::class,array('label'=>'Email ou nom du compte parent','required'=>false))
->add('beneficiaries_emails',CollectionType::class,array('label'=>'Email beneficiaire',
'required'=>false,
->add('email', EmailType::class, array(
'label' => 'Email du nouveau membre'
))
->add('join_to', AutocompleteBeneficiaryType::class, array(
'label' => 'Email ou nom du compte parent',
'required' => false
))
->add('beneficiaries_emails',CollectionType::class, array(
'label' => false, // 'Email bénéficiaire',
'required' => false,
'entry_type' => EmailType::class,
'entry_options' => array('label'=>'Email beneficiaire','attr'=>array('placehoder'=>'email@domain.fr'),'required'=>false,'constraints' => [new UniqueEmail()]),
'entry_options' => array(
'label' => 'Email bénéficiaire',
'attr' => array('placehoder'=>'email@domain.fr'),
'required' => false,
'constraints' => [new UniqueEmail()]
),
'allow_add'=>true
))
->add('amount', TextType::class, array(
'label' => 'Montant',
'attr'=> array('placeholder' => '15'),
'required'=>false
'required' => false
))
->add('mode', ChoiceType::class, array( // todo, make it dynamic
'label' => 'Mode de réglement',
Expand Down
4 changes: 2 additions & 2 deletions src/AppBundle/Validator/Constraints/UniqueEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
*/
class UniqueEmail extends Constraint
{
public $message = 'Ce courriel est déjà utilisé.';
}
public $message = 'Cet email est déjà utilisé.';
}
Loading