mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
person: add show hide on some fields + remove unknown genderType
This commit is contained in:
parent
bccaf5ad6e
commit
3d14f00cac
@ -127,7 +127,7 @@ class PersonType extends AbstractType
|
||||
->add('mobilenumber', TelType::class, array('required' => false))
|
||||
->add('acceptSMS', CheckboxType::class, array(
|
||||
'value' => false,
|
||||
'required' => true //TODO required only if mobilenumber is filled
|
||||
'required' => true
|
||||
));
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ class PersonType extends AbstractType
|
||||
if ($this->config['email'] === 'visible') {
|
||||
$builder
|
||||
->add('email', EmailType::class, array('required' => false))
|
||||
->add('acceptEmail', CheckboxType::class, array('required' => false));//TODO visible only if email is filled
|
||||
->add('acceptEmail', CheckboxType::class, array('required' => false));
|
||||
}
|
||||
|
||||
if ($this->config['country_of_birth'] === 'visible') {
|
||||
|
@ -24,8 +24,7 @@ class GenderType extends AbstractType {
|
||||
$a = array(
|
||||
Person::MALE_GENDER => Person::MALE_GENDER,
|
||||
Person::FEMALE_GENDER => Person::FEMALE_GENDER,
|
||||
Person::BOTH_GENDER => Person::BOTH_GENDER,
|
||||
Person::NO_INFORMATION => Person::NO_INFORMATION
|
||||
Person::BOTH_GENDER => Person::BOTH_GENDER
|
||||
);
|
||||
|
||||
$resolver->setDefaults(array(
|
||||
|
38
src/Bundle/ChillPersonBundle/Resources/public/js/person.js
Normal file
38
src/Bundle/ChillPersonBundle/Resources/public/js/person.js
Normal file
@ -0,0 +1,38 @@
|
||||
import { ShowHide } from 'ShowHide/show_hide.js';
|
||||
|
||||
const personEmail = document.getElementById("personEmail");
|
||||
const personAcceptEmail = document.getElementById("personAcceptEmail");
|
||||
const personPhoneNumber = document.getElementById("personPhoneNumber");
|
||||
const personAcceptSMS = document.getElementById("personAcceptSMS");
|
||||
|
||||
new ShowHide({
|
||||
froms: [personEmail],
|
||||
container: [personAcceptEmail],
|
||||
test: function(froms) {
|
||||
for (let f of froms.values()) {
|
||||
for (let input of f.querySelectorAll('input').values()) {
|
||||
if (input.value) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
event_name: 'input'
|
||||
});
|
||||
|
||||
new ShowHide({
|
||||
froms: [personPhoneNumber],
|
||||
container: [personAcceptSMS],
|
||||
test: function(froms) {
|
||||
for (let f of froms.values()) {
|
||||
for (let input of f.querySelectorAll('input').values()) {
|
||||
if (input.value) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
event_name: 'input'
|
||||
});
|
@ -82,15 +82,24 @@
|
||||
<fieldset>
|
||||
<legend><h2>{{ 'Contact information'|trans }}</h2></legend>
|
||||
{%- if form.email is defined -%}
|
||||
<div id="personEmail">
|
||||
{{ form_row(form.email, {'label': 'Email'}) }}
|
||||
</div>
|
||||
<div id="personAcceptEmail">
|
||||
{{ form_row(form.acceptEmail, {'label' : 'Accept emails ?'}) }}
|
||||
</div>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if form.phonenumber is defined -%}
|
||||
{{ form_row(form.phonenumber, {'label': 'Phonenumber'}) }}
|
||||
{%- endif -%}
|
||||
{%- if form.mobilenumber is defined -%}
|
||||
<div id="personPhoneNumber">
|
||||
{{ form_row(form.mobilenumber, {'label': 'Mobilenumber'}) }}
|
||||
</div>
|
||||
<div id="personAcceptSMS">
|
||||
{{ form_row(form.acceptSMS, {'label' : 'Accept short text message ?'}) }}
|
||||
</div>
|
||||
{%- endif -%}
|
||||
{%- if form.otherPhoneNumbers is defined -%}
|
||||
{{ form_widget(form.otherPhoneNumbers) }}
|
||||
@ -123,3 +132,8 @@
|
||||
|
||||
|
||||
{% endblock personcontent %}
|
||||
|
||||
|
||||
{% block js %}
|
||||
<script type="text/javascript" src="{{ asset('build/person.js') }}"></script>
|
||||
{% endblock js %}
|
||||
|
@ -11,4 +11,5 @@ module.exports = function(encore, entries)
|
||||
encore.addEntry('accompanying_course', __dirname + '/Resources/public/vuejs/AccompanyingCourse/index.js');
|
||||
encore.addEntry('household_members_editor', __dirname + '/Resources/public/vuejs/HouseholdMembersEditor/index.js');
|
||||
encore.addEntry('vue_accourse', __dirname + '/Resources/public/vuejs/AccompanyingCourse/index.js');
|
||||
encore.addEntry('person', __dirname + '/Resources/public/js/person.js');
|
||||
};
|
||||
|
@ -62,8 +62,6 @@ Man: Homme
|
||||
Woman: Femme
|
||||
both: Indéterminé
|
||||
Both: Indéterminé
|
||||
unknown: Aucune information
|
||||
Unknown: Aucune information
|
||||
Divorced: Divorcé(e)
|
||||
Separated: Séparé(e)
|
||||
Widow: Veuf(ve)
|
||||
|
Loading…
x
Reference in New Issue
Block a user