mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix bug when postal code is null + add validation for address &postcode
fix #20 fix #18
This commit is contained in:
parent
4a77d7617a
commit
386d4dd623
@ -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,
|
||||
|
@ -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: ~
|
@ -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.
|
||||
|
@ -2,8 +2,10 @@
|
||||
{% set options = { 'with_valid_from' : true }|merge(options|default({})) %}
|
||||
{% if address.streetAddress1 is not empty %}<span class="street street1">{{ address.streetAddress1 }}</span><br/>{% endif %}
|
||||
{% if address.streetAddress2 is not empty %}<span class="street street2">{{ address.streetAddress2 }}</span><br/>{% endif %}
|
||||
{% if address.postCode is not empty %}
|
||||
<span class="postalCode"><span class="code">{{ address.postCode.code }}</span> <span class="name">{{ address.postCode.name }}</span></span><br/>
|
||||
<span class="country">{{ address.postCode.country.name|localize_translatable_string }}</span><br/>
|
||||
{% endif %}
|
||||
{%- if options['with_valid_from'] == true -%}
|
||||
<span class="address_since">{{ 'Since %date%'|trans( { '%date%' : address.validFrom|localizeddate('long', 'none') } ) }}</span>
|
||||
{%- endif -%}
|
||||
|
Loading…
x
Reference in New Issue
Block a user