addresses: edit address for household (WIP)

This commit is contained in:
nobohan 2021-06-16 15:05:32 +02:00
parent 06daf35e96
commit 5b72eeb147
4 changed files with 58 additions and 6 deletions

View File

@ -2,6 +2,7 @@
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\Entity\Address;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@ -97,4 +98,26 @@ class HouseholdController extends AbstractController
]
);
}
/**
* @Route(
* "/{household_id}/address/edit",
* name="chill_person_household_address_edit",
* methods={"GET", "HEAD", "POST"}
* )
* @ParamConverter("household", options={"id" = "household_id"})
*/
public function addressEdit(Request $request, Household $household)
{
// TODO ACL
//$address = $this->findAddressById($household, $address_id); //TODO
return $this->render('@ChillPerson/Household/address_edit.html.twig',
[
'household' => $household,
//'address' => $address,
]
);
}
}

View File

@ -8,12 +8,10 @@
</add-address>
</div>
<div>
<div v-if="newAddress.text">
{{ newAddress.text }}
</div>
<div v-if="newAddress.postcode">
{{ newAddress.postcode.name }}
</div>
<show-address
v-if="newAddress"
v-bind:address="newAddress">
</show-address>
</div>
</div>
<div class='household__address-move__valid'>
@ -45,14 +43,17 @@
<script>
import AddAddress from 'ChillMainAssets/vuejs/_components/AddAddress.vue';
import ShowAddress from 'ChillMainAssets/vuejs/_components/ShowAddress.vue';
export default {
name: 'App',
components: {
AddAddress,
ShowAddress
},
data() {
return {
edit: window.mode === 'edit',
householdId: window.householdId,
backUrl: `/fr/person/household/${householdId}/addresses`, //TODO better way to pass this
validFrom: new Date().toISOString().split('T')[0]

View File

@ -0,0 +1,26 @@
{% extends '@ChillPerson/Household/layout.html.twig' %}
{% block title 'Edit household address'|trans %}
{% block content %}
<h1>{{ block('title') }}</h1>
<div>
<div id="household-address"></div>
</div>
{% block stylesheets %}
<link href="{{ asset('build/address.css') }}" type="text/css" rel="stylesheet" />
{% endblock %}
{% block js %}
<script type="text/javascript">
window.householdId = {{ household.id|e('js') }};
window.addressId = {{ address.id|e('js') }};
window.mode = 'edit';
window.vueRootComponent = 'app';
</script>
{{ encore_entry_script_tags('household_address') }}
{% endblock %}
{% endblock %}

View File

@ -54,8 +54,10 @@
<span class="country">({{ address.postCode.country.name|localize_translatable_string }})</span>
</div>
{% endif %}
</div>
{% endif %}
<a href="{{ path('chill_person_household_address_edit', { 'household_id': household.id, 'address_id' : address.id } ) }}" class="sc-button bt-edit"></a>
</div>
</div>
</div>