mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
household address: add max date for changing the validFrom date
This commit is contained in:
parent
017b7bca87
commit
6a4edd000f
@ -172,6 +172,13 @@ class HouseholdController extends AbstractController
|
|||||||
$minValidFrom = null;
|
$minValidFrom = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (count($addresses) > 1 && count($addresses) > $currentValueIndex + 1) {
|
||||||
|
$nextAddress = $addresses[$currentValueIndex + 1];
|
||||||
|
$maxValidFrom = $nextAddress->getValidFrom();
|
||||||
|
} else {
|
||||||
|
$maxValidFrom = null;
|
||||||
|
}
|
||||||
|
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
$this->getDoctrine()->getManager()->persist($address);
|
$this->getDoctrine()->getManager()->persist($address);
|
||||||
$this->getDoctrine()->getManager()->flush();
|
$this->getDoctrine()->getManager()->flush();
|
||||||
@ -186,7 +193,8 @@ class HouseholdController extends AbstractController
|
|||||||
'household' => $household,
|
'household' => $household,
|
||||||
'address' => $address,
|
'address' => $address,
|
||||||
'form' => $form->createView(),
|
'form' => $form->createView(),
|
||||||
'minValidFrom' => $minValidFrom
|
'minValidFrom' => $minValidFrom,
|
||||||
|
'maxValidFrom' => $maxValidFrom
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,16 @@
|
|||||||
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
{% if minValidFrom is not null %}
|
{% if minValidFrom is not null and maxValidFrom is not null %}
|
||||||
{{ form_row(form.validFrom, {'attr': {'min': minValidFrom|date('Y-m-d') }}) }}
|
{{ form_row(form.validFrom, {'attr': {'min': minValidFrom|date('Y-m-d'), 'max': maxValidFrom|date('Y-m-d') }}) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ form_row(form.validFrom) }}
|
{% if minValidFrom is not null %}
|
||||||
|
{{ form_row(form.validFrom, {'attr': {'min': minValidFrom|date('Y-m-d')}}) }}
|
||||||
|
{% elseif maxValidFrom is not null %}
|
||||||
|
{{ form_row(form.validFrom, {'attr': {'max': maxValidFrom|date('Y-m-d')}}) }}
|
||||||
|
{% else %}
|
||||||
|
{{ form_row(form.validFrom) }}
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div hidden>
|
<div hidden>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user