Browse Source

[Frontoffice] Bug adresses

feature/export_comptable
Fab 4 years ago
parent
commit
5fd7d057c6
3 changed files with 17 additions and 4 deletions
  1. +14
    -3
      ShopBundle/Model/User.php
  2. +1
    -1
      ShopBundle/Resources/views/backend/default/block/form_address.html.twig
  3. +2
    -0
      ShopBundle/Resources/views/backend/user/edit.html.twig

+ 14
- 3
ShopBundle/Model/User.php View File

@@ -181,9 +181,20 @@ abstract class User extends UserModelFOS
/**
* @return Collection|Address[]
*/
public function getAddresses(): Collection
{
return $this->addresses;
public function getAddresses($status = null): Collection
{
if($status){
$addressToReturn = new ArrayCollection();
foreach ($this->addresses as $address){
if($address->getStatus() == $status) {
$addressToReturn[] = $address;
}
}
return $addressToReturn;
}else{
return $this->addresses;
}

}

public function addAddress(Address $address): self

+ 1
- 1
ShopBundle/Resources/views/backend/default/block/form_address.html.twig View File

@@ -71,7 +71,7 @@
<div class="col-12">
{{ form_row(form.status) }}
<p class="callout callout-info">
Sauf si vous avez ce que ce vous faites ce champ doit toujours être "Activer"
Sauf si vous savez ce que ce vous faites ce champ doit toujours être "Activer"
</p>
</div>


+ 2
- 0
ShopBundle/Resources/views/backend/user/edit.html.twig View File

@@ -19,7 +19,9 @@
<div class="col-5">
<div class="row" id="user-addresses">
{% for address in entity.addresses %}
{% if address.status >=0 %}
{% include '@LcShop/backend/user/block_useraddress.html.twig' %}
{% endif %}
{% endfor %}
</div>
<button type="button" data-url="{{ path('easyadmin', {"action": 'editAddressUser', 'entity': 'User', 'id': entity.id, 'addressId': 'new'}) }}"

Loading…
Cancel
Save