mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
first commit
This commit is contained in:
parent
83dd8f810c
commit
9f064784f2
@ -19,6 +19,7 @@ use Chill\PersonBundle\Repository\AccompanyingPeriodACLAwareRepositoryInterface;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||
use Symfony\Component\Form\FormFactoryInterface;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@ -64,7 +65,9 @@ class ReassignAccompanyingPeriodController extends AbstractController
|
||||
throw new AccessDeniedException();
|
||||
}
|
||||
|
||||
$form = $this->buildFilterForm();
|
||||
$periodIds = [];
|
||||
|
||||
$form = $this->buildFilterForm($periodIds);
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
@ -80,16 +83,25 @@ class ReassignAccompanyingPeriodController extends AbstractController
|
||||
$paginator->getCurrentPageFirstItemNumber()
|
||||
);
|
||||
|
||||
foreach ($periods as $period) {
|
||||
$periodIds[] = $period->getId();
|
||||
}
|
||||
|
||||
$assignForm= $this->buildFilterForm($periodIds);
|
||||
|
||||
dump($assignForm->get('periods'));
|
||||
|
||||
return new Response(
|
||||
$this->engine->render('@ChillPerson/AccompanyingPeriod/reassign_list.html.twig', [
|
||||
'paginator' => $paginator,
|
||||
'periods' => $periods,
|
||||
'form' => $form->createView(),
|
||||
'assignForm' => $assignForm->createView()
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
private function buildFilterForm(): FormInterface
|
||||
private function buildFilterForm(array $periodIds): FormInterface
|
||||
{
|
||||
$data = [
|
||||
'user' => null,
|
||||
@ -107,6 +119,9 @@ class ReassignAccompanyingPeriodController extends AbstractController
|
||||
'multiple' => false,
|
||||
'label' => 'User',
|
||||
'required' => false,
|
||||
])
|
||||
->add('periods', HiddenType::class, [
|
||||
'data' => serialize($periodIds),
|
||||
]);
|
||||
|
||||
return $builder->getForm();
|
||||
|
@ -14,7 +14,7 @@
|
||||
{% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_UPDATE', period) %}
|
||||
<div class="item-col item-meta">
|
||||
{% set job_id = null %}
|
||||
{% if period.job is defined %}
|
||||
{% if period.job is defined and period.job is not null %}
|
||||
{% set job_id = period.job.id %}
|
||||
{% endif %}
|
||||
<span
|
||||
@ -52,13 +52,33 @@
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<button type="submit" class="btn btn-save change-icon">
|
||||
<i class="fa fa-filter"></i> Filtrer
|
||||
<i class="fa fa-filter"></i> {{ 'Filter'|trans }}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{{ form_end(form) }}
|
||||
|
||||
<div>
|
||||
<p>{{ 'Attribute all parcours in this list to the following users,'|trans }}</p>
|
||||
{{ form_start(assignForm) }}
|
||||
<div class="row filter-box">
|
||||
<div class="col-md-6">
|
||||
{{ form_label(assignForm.user ) }}
|
||||
{{ form_widget(assignForm.user, {'attr': {'class': 'select2'}}) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<button type="submit" class="btn btn-save change-icon">
|
||||
{{ 'Reassign'|trans }}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
{{ form_end(assignForm) }}
|
||||
</div>
|
||||
|
||||
{% if form.user.vars.value is empty %}
|
||||
<p class="chill-no-data-statement">{{ 'period_by_user_list.Pick a user'|trans }}</p>
|
||||
{% elseif periods|length == 0 and form.user.vars.value is not empty %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user