Skip to content

Commit

Permalink
Amélioration présence assemblée générale (#1595)
Browse files Browse the repository at this point in the history
  • Loading branch information
stakovicz authored Jan 22, 2025
1 parent 6dbd009 commit 98d353f
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,49 +74,63 @@
</table>
{% endif %}

<h2>Ma participation à l'Assemblée Générale du {{ latest_date|date('d/m/Y') }}</h2>
<div class="afup-form">
{{ form_start(form) }}

<fieldset>
<legend>Je serai présent(e)</legend>
<legend>Ma participation à l'Assemblée Générale du {{ latest_date|date('d/m/Y') }}</legend>

<div class="afup-form-container">
<p>
<span class="obligatoire">*</span>&nbsp; Indique un champ obligatoire
</p>

{{ form_errors(form.presence) }}

{% for key, presenceItem in form.presence.children %}
<div class="rangee">
{{ form_label(presenceItem, null, {"label_attr": {"class": "libelle"}}) }}
<span class="element">
{{ form_widget(presenceItem) }}
</span>
{{ form_widget(presenceItem) }}
</span>
</div>

{% if presenceItem.vars.value == '2' %}
<div id="pouvoir">
{{ form_errors(form.id_personne_avec_pouvoir) }}
{{ form_label(form.id_personne_avec_pouvoir) }}
{{ form_widget(form.id_personne_avec_pouvoir) }}
</div>
{% endif %}
{% endfor %}
</div>
</fieldset>

<fieldset class="f2">
<legend>Je donne mon pouvoir à</legend>
<div class="afup-form-container">
<div>
{{ form_errors(form.id_personne_avec_pouvoir) }}
{{ form_label(form.id_personne_avec_pouvoir) }}
{{ form_widget(form.id_personne_avec_pouvoir) }}

<div class="right">
{{ form_widget(form.save, {"attr": {"class": "button button--call-to-action"}}) }}
</div>
<div class="clear"></div>
</div>
<script>
const ABSENCE = '2';
const pouvoirElement = document.getElementById('pouvoir');
pouvoirElement.classList.add('sr-only');
const presencesElement = document.getElementsByName('form[presence]');
presencesElement.forEach(function (presenceElement) {
presenceElement.addEventListener('change', (event) => {
if (event.target.value === ABSENCE) {
pouvoirElement.classList.remove('sr-only');
} else {
pouvoirElement.classList.add('sr-only');
}
});
if (presenceElement.value === ABSENCE && presenceElement.hasAttribute('checked')) {
pouvoirElement.classList.remove('sr-only');
}
});
</script>
</fieldset>

<fieldset>
<p>
<span class="obligatoire">*</span>&nbsp; Indique un champ obligatoire
</p>
</fieldset>

<fieldset>
<div class="right">
{{ form_widget(form.save, {"attr": {"class": "button button--call-to-action"}}) }}
</div>
</fieldset>

{{ form_end(form) }}
</div>
Expand Down
5 changes: 0 additions & 5 deletions htdocs/css/forms_company.css
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,6 @@
}


.afup-form label.required:before {
content: "* ";
}


.afup-form--miniform {
max-width: 600px;
margin: 0 auto;
Expand Down
8 changes: 7 additions & 1 deletion sources/AppBundle/Controller/MemberShipController.php
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,13 @@ public function generalMeetingAction(Request $request)
}

$form = $this->createFormBuilder()
->add('presence', ChoiceType::class, ['expanded' => true, 'choices' => ['Oui' => 1, 'Non' => 2, 'Je ne sais pas encore' => 0]])
->add('presence', ChoiceType::class, [
'expanded' => true,
'choices' => [
'Je participe' => 1,
'Je ne participe pas' => 2
]
])
->add(
'id_personne_avec_pouvoir',
ChoiceType::class,
Expand Down

0 comments on commit 98d353f

Please sign in to comment.