mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
FIX [regroupment][form] add check to display regroupment field in the form or not. Only if regroupments exist
This commit is contained in:
parent
88ccbd450a
commit
678defdee7
@ -11,7 +11,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\MainBundle\Form\Type\Export;
|
namespace Chill\MainBundle\Form\Type\Export;
|
||||||
|
|
||||||
use Chill\MainBundle\Center\GroupingCenterInterface;
|
|
||||||
use Chill\MainBundle\Entity\Center;
|
use Chill\MainBundle\Entity\Center;
|
||||||
use Chill\MainBundle\Entity\Regroupment;
|
use Chill\MainBundle\Entity\Regroupment;
|
||||||
use Chill\MainBundle\Export\ExportManager;
|
use Chill\MainBundle\Export\ExportManager;
|
||||||
@ -72,8 +71,10 @@ final class PickCenterType extends AbstractType
|
|||||||
return $c->getName();
|
return $c->getName();
|
||||||
},
|
},
|
||||||
'data' => $centers,
|
'data' => $centers,
|
||||||
])
|
]);
|
||||||
->add('regroupment', EntityType::class, [
|
|
||||||
|
if (count($this->regroupmentRepository->findAllActive()) > 0) {
|
||||||
|
$builder->add('regroupment', EntityType::class, [
|
||||||
'class' => Regroupment::class,
|
'class' => Regroupment::class,
|
||||||
'label' => 'regroupment',
|
'label' => 'regroupment',
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
@ -83,6 +84,7 @@ final class PickCenterType extends AbstractType
|
|||||||
return $r->getName();
|
return $r->getName();
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$builder->setDataMapper(new ExportPickCenterDataMapper());
|
$builder->setDataMapper(new ExportPickCenterDataMapper());
|
||||||
}
|
}
|
||||||
|
@ -41,9 +41,10 @@
|
|||||||
<h3 class="m-3">{{ 'Center'|trans }}</h3>
|
<h3 class="m-3">{{ 'Center'|trans }}</h3>
|
||||||
{{ form_widget(form.centers.center) }}
|
{{ form_widget(form.centers.center) }}
|
||||||
|
|
||||||
<h3 class="m-3">{{ 'Pick aggregated centers'|trans }}</h3>
|
{% if form.centers.regroupment is defined %}
|
||||||
{{ form_widget(form.centers.regroupment) }}
|
<h3 class="m-3">{{ 'Pick aggregated centers'|trans }}</h3>
|
||||||
|
{{ form_widget(form.centers.regroupment) }}
|
||||||
|
{% endif %}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<p>{{ form_widget(form.submit, { 'attr' : { 'class' : 'btn btn-action btn-create' }, 'label' : 'Go to export options' } ) }}</p>
|
<p>{{ form_widget(form.submit, { 'attr' : { 'class' : 'btn btn-action btn-create' }, 'label' : 'Go to export options' } ) }}</p>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user