mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
address-household: address move (WIP)
This commit is contained in:
parent
e9caa7b4b8
commit
14a9d9c739
@ -8,6 +8,8 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\MainBundle\Form\Type\AddressType;
|
||||
use Chill\MainBundle\Entity\Address;
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/person/household")
|
||||
@ -68,6 +70,30 @@ class HouseholdController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param Household $household
|
||||
* @param Address $address
|
||||
* @return \Symfony\Component\Form\Form
|
||||
*/
|
||||
protected function createCreateForm(Household $household, Address $address)
|
||||
{
|
||||
$form = $this->createForm(AddressType::class, $address, array(
|
||||
'method' => 'POST',
|
||||
'action' => $this->generateUrl('chill_person_address_create', array(
|
||||
'person_id' => $household->getId()
|
||||
)),
|
||||
'has_no_address' => true
|
||||
));
|
||||
|
||||
$form->add('submit', SubmitType::class, array(
|
||||
'label' => 'Submit'
|
||||
));
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(
|
||||
* "/{household_id}/address/move",
|
||||
@ -79,9 +105,16 @@ class HouseholdController extends AbstractController
|
||||
public function addressMove(Request $request, Household $household)
|
||||
{
|
||||
// TODO ACL
|
||||
|
||||
|
||||
$address = new HouseholdAddress();
|
||||
|
||||
$form = $this->createCreateForm($household, $address);
|
||||
|
||||
return $this->render('@ChillPerson/Household/address_move.html.twig',
|
||||
[
|
||||
'household' => $household
|
||||
'household' => $household,
|
||||
'form' => $form->createView()
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -3,9 +3,29 @@
|
||||
{% block title 'Move household'|trans %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{{ block('title') }}</h1>
|
||||
<h1>{{ block('title') }}</h1>
|
||||
|
||||
<p>Household with id {{ household.id }}</p>
|
||||
<p>Household with id {{ household.id }}</p>
|
||||
|
||||
<div>
|
||||
<h2>Select an existing address</h2>
|
||||
TODO: select of existing address !?
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h2>Create a new address</h2>
|
||||
<div id="address"></div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
{% block stylesheets %}
|
||||
<link href="{{ asset('build/address.css') }}" type="text/css" rel="stylesheet" />
|
||||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
{{ encore_entry_script_tags('address') }}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user