mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-10-31 01:08:26 +00:00 
			
		
		
		
	update twig template and AddressType following the changes in Address entity
This commit is contained in:
		| @@ -367,12 +367,12 @@ class Address | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     public function getNumber(): ?string | ||||
|     public function getStreetNumber(): ?string | ||||
|     { | ||||
|         return $this->streetNumber; | ||||
|     } | ||||
|  | ||||
|     public function setNumber(string $streetNumber): self | ||||
|     public function setStreetNumber(string $streetNumber): self | ||||
|     { | ||||
|         $this->streetNumber = $streetNumber; | ||||
|  | ||||
|   | ||||
| @@ -33,8 +33,8 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | ||||
|  * A type to create/update Address entity | ||||
|  * | ||||
|  * Options: | ||||
|  *  | ||||
|  * - `has_valid_from` (boolean): show if an entry "has valid from" must be  | ||||
|  * | ||||
|  * - `has_valid_from` (boolean): show if an entry "has valid from" must be | ||||
|  * shown. | ||||
|  * - `null_if_empty` (boolean): replace the address type by null if the street | ||||
|  * or the postCode is empty. This is useful when the address is not required and | ||||
| @@ -45,10 +45,10 @@ class AddressType extends AbstractType | ||||
|     public function buildForm(FormBuilderInterface $builder, array $options) | ||||
|     { | ||||
|         $builder | ||||
|               ->add('streetAddress1', TextType::class, array( | ||||
|               ->add('street', TextType::class, array( | ||||
|                  'required' => !$options['has_no_address'] // true if has no address is false | ||||
|               )) | ||||
|               ->add('streetAddress2', TextType::class, array( | ||||
|               ->add('streetNumber', TextType::class, array( | ||||
|                  'required' => false | ||||
|               )) | ||||
|               ->add('postCode', PostalCodeType::class, array( | ||||
| @@ -57,7 +57,7 @@ class AddressType extends AbstractType | ||||
|                  'required' => !$options['has_no_address'] // true if has no address is false | ||||
|               )) | ||||
|             ; | ||||
|          | ||||
|  | ||||
|         if ($options['has_valid_from']) { | ||||
|             $builder | ||||
|               ->add('validFrom', DateType::class, array( | ||||
| @@ -67,7 +67,7 @@ class AddressType extends AbstractType | ||||
|                  ) | ||||
|               ); | ||||
|         } | ||||
|          | ||||
|  | ||||
|         if ($options['has_no_address']) { | ||||
|             $builder | ||||
|                 ->add('isNoAddress', ChoiceType::class, [ | ||||
| @@ -79,12 +79,12 @@ class AddressType extends AbstractType | ||||
|                     'label' => 'address.address_homeless' | ||||
|                 ]); | ||||
|         } | ||||
|          | ||||
|  | ||||
|         if ($options['null_if_empty'] === TRUE) { | ||||
|             $builder->setDataMapper(new AddressDataMapper()); | ||||
|         } | ||||
|     } | ||||
|      | ||||
|  | ||||
|     public function configureOptions(OptionsResolver $resolver) | ||||
|     { | ||||
|         $resolver | ||||
|   | ||||
| @@ -6,8 +6,8 @@ | ||||
|             <div class="chill_address_is_noaddress">{{ 'address.consider homeless'|trans }}</div> | ||||
|         {% endif %} | ||||
|         <div class="chill_address_address"> | ||||
|         {% if address.streetAddress1 is not empty %}<p class="street street1">{{ address.streetAddress1 }}</p>{% endif %} | ||||
|         {% if address.streetAddress2 is not empty %}<p class="street street2">{{ address.streetAddress2 }}</p>{% endif %} | ||||
|         {% if address.street is not empty %}<p class="street street1">{{ address.street }}</p>{% endif %} | ||||
|         {% if address.streetNumber is not empty %}<p class="street street2">{{ address.streetNumber }}</p>{% endif %} | ||||
|         {% if address.postCode is not empty %} | ||||
|         <p class="postalCode"><span class="code">{{ address.postCode.code }}</span> <span class="name">{{ address.postCode.name }}</span></p> | ||||
|         <p class="country">{{ address.postCode.country.name|localize_translatable_string }}</p> | ||||
|   | ||||
| @@ -21,17 +21,17 @@ | ||||
| {% block title 'Update address for %name%'|trans({ '%name%': person.firstName ~ ' ' ~ person.lastName } ) %} | ||||
|  | ||||
| {% block personcontent %} | ||||
|      | ||||
|  | ||||
|     <h1>{{ 'Update address for %name%'|trans({ '%name%': person.firstName ~ ' ' ~ person.lastName } ) }}</h1> | ||||
|      | ||||
|  | ||||
|     {{ form_start(form) }} | ||||
|      | ||||
|  | ||||
|     {{ form_row(form.isNoAddress) }} | ||||
|     {{ form_row(form.streetAddress1) }} | ||||
|     {{ form_row(form.streetAddress2) }} | ||||
|     {{ form_row(form.street) }} | ||||
|     {{ form_row(form.streetNumber) }} | ||||
|     {{ form_row(form.postCode) }} | ||||
|     {{ form_row(form.validFrom) }} | ||||
|      | ||||
|  | ||||
|     <ul class="record_actions sticky-form-buttons"> | ||||
|         <li class="cancel"> | ||||
|             <a href="{{ path('chill_person_address_list', { 'person_id' : person.id } ) }}" class="sc-button bt-cancel"> | ||||
| @@ -42,7 +42,7 @@ | ||||
|             {{ form_row(form.submit, { 'attr' : { 'class': 'sc-button bt-save' }, 'label': 'Save' } ) }} | ||||
|         </li> | ||||
|     </ul> | ||||
|      | ||||
|  | ||||
|     {{ form_end(form) }} | ||||
|      | ||||
| {% endblock personcontent %} | ||||
|  | ||||
| {% endblock personcontent %} | ||||
|   | ||||
| @@ -21,21 +21,21 @@ | ||||
| {% block title %}{{ 'New address for %name%'|trans({ '%name%': person.firstName|capitalize ~ ' ' ~ person.lastName } )|capitalize }}{% endblock %} | ||||
|  | ||||
| {% block personcontent %} | ||||
|      | ||||
|  | ||||
|     <h1>{{ 'New address for %name%'|trans({ '%name%': person.firstName ~ ' ' ~ person.lastName } ) }}</h1> | ||||
|      | ||||
|  | ||||
|     {{ form_start(form) }} | ||||
|      | ||||
|  | ||||
|     {{ form_row(form.isNoAddress) }} | ||||
|     {{ form_row(form.streetAddress1) }} | ||||
|     {{ form_errors(form.streetAddress1) }} | ||||
|     {{ form_row(form.streetAddress2) }} | ||||
|     {{ form_errors(form.streetAddress2) }} | ||||
|     {{ form_row(form.street) }} | ||||
|     {{ form_errors(form.street) }} | ||||
|     {{ form_row(form.streetNumber) }} | ||||
|     {{ form_errors(form.streetNumber) }} | ||||
|     {{ form_row(form.postCode) }} | ||||
|     {{ form_errors(form.postCode) }} | ||||
|     {{ form_row(form.validFrom) }} | ||||
|     {{ form_errors(form.validFrom) }} | ||||
|      | ||||
|  | ||||
|     <ul class="record_actions sticky-form-buttons"> | ||||
|         <li class="cancel"> | ||||
|             <a href="{{ path('chill_person_address_list', { 'person_id' : person.id } ) }}" class="sc-button bt-cancel"> | ||||
| @@ -46,7 +46,7 @@ | ||||
|             {{ form_row(form.submit, { 'attr' : { 'class': 'sc-button bt-create'  }, 'label': 'Create' } ) }} | ||||
|         </li> | ||||
|     </ul> | ||||
|      | ||||
|  | ||||
|     {{ form_end(form) }} | ||||
|      | ||||
| {% endblock personcontent %} | ||||
|  | ||||
| {% endblock personcontent %} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user