mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
household address: add a form for editing the validFrom date
This commit is contained in:
parent
de4f65fede
commit
3a3eb68288
@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\Entity\Address;
|
||||
use Chill\MainBundle\Form\Type\AddressType;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Form\HouseholdType;
|
||||
use Chill\PersonBundle\Repository\Household\PositionRepository;
|
||||
@ -136,6 +137,46 @@ class HouseholdController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(
|
||||
* "/{household_id}/address/edit_valid_from",
|
||||
* name="chill_person_household_address_valid_from_edit",
|
||||
* methods={"GET", "HEAD", "POST"}
|
||||
* )
|
||||
* @ParamConverter("household", options={"id": "household_id"})
|
||||
*/
|
||||
public function addressValidFromEdit(Request $request, Household $household)
|
||||
{
|
||||
// TODO ACL
|
||||
|
||||
$address_id = $request->query->get('address_id');
|
||||
$address = $this->getDoctrine()->getManager()
|
||||
->getRepository(Address::class)
|
||||
->find($address_id);
|
||||
|
||||
$form = $this->createForm(AddressType::class, $address, []);
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->getDoctrine()->getManager()->persist($address);
|
||||
$this->getDoctrine()->getManager()->flush();
|
||||
|
||||
return $this->redirectToRoute('chill_person_household_addresses', [
|
||||
'household_id' => $household->getId()
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
'@ChillPerson/Household/address_valid_from_edit.html.twig',
|
||||
[
|
||||
'household' => $household,
|
||||
'address' => $address,
|
||||
'form' => $form->createView()
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(
|
||||
* "/{household_id}/addresses",
|
||||
|
@ -0,0 +1,34 @@
|
||||
{% extends '@ChillPerson/Household/layout.html.twig' %}
|
||||
|
||||
{% block title 'Edit household address valid from'|trans %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{{ block('title') }}</h1>
|
||||
<div>
|
||||
{{ address|chill_entity_render_box}}
|
||||
</div>
|
||||
|
||||
{{ form_start(form) }}
|
||||
{{ form_errors(form) }}
|
||||
|
||||
<div>
|
||||
{{ form_row(form.validFrom) }}
|
||||
</div>
|
||||
<div hidden>
|
||||
{{ form_rest(form) }}
|
||||
</div>
|
||||
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="cancel">
|
||||
<a href="{{ path('chill_person_household_addresses', { 'household_id': household.id } ) }}" class="btn btn-cancel">
|
||||
{{ 'Cancel'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<button class="btn btn-update" type="submit">{{ 'Save'|trans }}</button>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{{ form_end(form) }}
|
||||
|
||||
{% endblock %}
|
@ -64,9 +64,12 @@
|
||||
}) }}
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path('chill_person_household_address_valid_from_edit', { 'household_id': household.id, 'address_id' : address.id } ) }}"
|
||||
class="btn btn-edit">{{ "edit address valid from"|trans }}
|
||||
</a>
|
||||
<a href="{{ path('chill_person_household_address_edit', { 'household_id': household.id, 'address_id' : address.id } ) }}"
|
||||
class="btn btn-edit"></a>
|
||||
|
||||
class="btn btn-edit">
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -498,6 +498,9 @@ Concerns household n°%id%: Concerne le ménage n°%id%
|
||||
Composition: Composition
|
||||
Budget: Budget
|
||||
The composition has been successfully removed.: La composition a été supprimée.
|
||||
edit address valid from: Changer la date du déménagement
|
||||
Edit household address valid from: Changer la date du déménagement
|
||||
|
||||
|
||||
# accompanying course work
|
||||
Accompanying Course Actions: Actions d'accompagnements
|
||||
|
Loading…
x
Reference in New Issue
Block a user