diff --git a/Form/Type/AddressType.php b/Form/Type/AddressType.php index edb1a657d..173bd9b70 100644 --- a/Form/Type/AddressType.php +++ b/Form/Type/AddressType.php @@ -42,7 +42,9 @@ class AddressType extends AbstractType 'required' => false )) ->add('postCode', PostalCodeType::class, array( - 'label' => 'Postal code' + 'label' => 'Postal code', + 'placeholder' => 'Choose a postal code', + 'required' => true )) ->add('validFrom', 'date', array( 'required' => true, diff --git a/Resources/config/validation.yml b/Resources/config/validation.yml index 6dc383502..87f696f43 100644 --- a/Resources/config/validation.yml +++ b/Resources/config/validation.yml @@ -29,3 +29,28 @@ Chill\MainBundle\Entity\Center: - Length: max: 50 min: 3 + +Chill\MainBundle\Entity\Address: + properties: + streetAddress1: + - Length: + min: 2 + max: 250 + postcode: + - NotNull: ~ + validFrom: + - NotNull: ~ + - Date: ~ + +Chill\MainBundle\Entity\PostalCode: + properties: + name: + - Length: + max: 250 + min: 2 + code: + - Length: + min: 2 + max: 100 + country: + - NotNull: ~ \ No newline at end of file diff --git a/Resources/translations/messages.fr.yml b/Resources/translations/messages.fr.yml index 51f355027..21d49684a 100644 --- a/Resources/translations/messages.fr.yml +++ b/Resources/translations/messages.fr.yml @@ -27,6 +27,7 @@ Street address1: Adresse ligne 1 Street address2: Adresse ligne 2 Postal code: Code postal Valid from: Valide à partir du +Choose a postal code: Choisir un code postal #serach Your search is empty. Please provide search terms.: La recherche est vide. Merci de fournir des termes de recherche. diff --git a/Resources/views/Address/macro.html.twig b/Resources/views/Address/macro.html.twig index a526070b1..4e60f3f01 100644 --- a/Resources/views/Address/macro.html.twig +++ b/Resources/views/Address/macro.html.twig @@ -2,8 +2,10 @@ {% set options = { 'with_valid_from' : true }|merge(options|default({})) %} {% if address.streetAddress1 is not empty %}{{ address.streetAddress1 }}
{% endif %} {% if address.streetAddress2 is not empty %}{{ address.streetAddress2 }}
{% endif %} + {% if address.postCode is not empty %} {{ address.postCode.code }} {{ address.postCode.name }}
{{ address.postCode.country.name|localize_translatable_string }}
+ {% endif %} {%- if options['with_valid_from'] == true -%} {{ 'Since %date%'|trans( { '%date%' : address.validFrom|localizeddate('long', 'none') } ) }} {%- endif -%}