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('mobilenumber', TelType::class, array('required' => false))
|
||||||
->add('acceptSMS', CheckboxType::class, array(
|
->add('acceptSMS', CheckboxType::class, array(
|
||||||
'value' => false,
|
'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') {
|
if ($this->config['email'] === 'visible') {
|
||||||
$builder
|
$builder
|
||||||
->add('email', EmailType::class, array('required' => false))
|
->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') {
|
if ($this->config['country_of_birth'] === 'visible') {
|
||||||
|
@ -24,8 +24,7 @@ class GenderType extends AbstractType {
|
|||||||
$a = array(
|
$a = array(
|
||||||
Person::MALE_GENDER => Person::MALE_GENDER,
|
Person::MALE_GENDER => Person::MALE_GENDER,
|
||||||
Person::FEMALE_GENDER => Person::FEMALE_GENDER,
|
Person::FEMALE_GENDER => Person::FEMALE_GENDER,
|
||||||
Person::BOTH_GENDER => Person::BOTH_GENDER,
|
Person::BOTH_GENDER => Person::BOTH_GENDER
|
||||||
Person::NO_INFORMATION => Person::NO_INFORMATION
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$resolver->setDefaults(array(
|
$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>
|
<fieldset>
|
||||||
<legend><h2>{{ 'Contact information'|trans }}</h2></legend>
|
<legend><h2>{{ 'Contact information'|trans }}</h2></legend>
|
||||||
{%- if form.email is defined -%}
|
{%- if form.email is defined -%}
|
||||||
{{ form_row(form.email, {'label': 'Email'}) }}
|
<div id="personEmail">
|
||||||
{{ form_row(form.acceptEmail, {'label' : 'Accept emails ?'}) }}
|
{{ form_row(form.email, {'label': 'Email'}) }}
|
||||||
|
</div>
|
||||||
|
<div id="personAcceptEmail">
|
||||||
|
{{ form_row(form.acceptEmail, {'label' : 'Accept emails ?'}) }}
|
||||||
|
</div>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
{%- if form.phonenumber is defined -%}
|
{%- if form.phonenumber is defined -%}
|
||||||
{{ form_row(form.phonenumber, {'label': 'Phonenumber'}) }}
|
{{ form_row(form.phonenumber, {'label': 'Phonenumber'}) }}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- if form.mobilenumber is defined -%}
|
{%- if form.mobilenumber is defined -%}
|
||||||
{{ form_row(form.mobilenumber, {'label': 'Mobilenumber'}) }}
|
<div id="personPhoneNumber">
|
||||||
{{ form_row(form.acceptSMS, {'label' : 'Accept short text message ?'}) }}
|
{{ form_row(form.mobilenumber, {'label': 'Mobilenumber'}) }}
|
||||||
|
</div>
|
||||||
|
<div id="personAcceptSMS">
|
||||||
|
{{ form_row(form.acceptSMS, {'label' : 'Accept short text message ?'}) }}
|
||||||
|
</div>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- if form.otherPhoneNumbers is defined -%}
|
{%- if form.otherPhoneNumbers is defined -%}
|
||||||
{{ form_widget(form.otherPhoneNumbers) }}
|
{{ form_widget(form.otherPhoneNumbers) }}
|
||||||
@ -123,3 +132,8 @@
|
|||||||
|
|
||||||
|
|
||||||
{% endblock personcontent %}
|
{% endblock personcontent %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block js %}
|
||||||
|
<script type="text/javascript" src="{{ asset('build/person.js') }}"></script>
|
||||||
|
{% endblock js %}
|
||||||
|
@ -7,8 +7,9 @@ module.exports = function(encore, entries)
|
|||||||
encore.addAliases({
|
encore.addAliases({
|
||||||
ChillPersonAssets: __dirname + '/Resources/public'
|
ChillPersonAssets: __dirname + '/Resources/public'
|
||||||
});
|
});
|
||||||
|
|
||||||
encore.addEntry('accompanying_course', __dirname + '/Resources/public/vuejs/AccompanyingCourse/index.js');
|
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('household_members_editor', __dirname + '/Resources/public/vuejs/HouseholdMembersEditor/index.js');
|
||||||
encore.addEntry('vue_accourse', __dirname + '/Resources/public/vuejs/AccompanyingCourse/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
|
Woman: Femme
|
||||||
both: Indéterminé
|
both: Indéterminé
|
||||||
Both: Indéterminé
|
Both: Indéterminé
|
||||||
unknown: Aucune information
|
|
||||||
Unknown: Aucune information
|
|
||||||
Divorced: Divorcé(e)
|
Divorced: Divorcé(e)
|
||||||
Separated: Séparé(e)
|
Separated: Séparé(e)
|
||||||
Widow: Veuf(ve)
|
Widow: Veuf(ve)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user