mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-30 19:43:49 +00:00
Add / Edit / Delete activity from Accompanying Course
This commit is contained in:
@@ -82,10 +82,13 @@ class ActivityType extends AbstractType
|
||||
throw new \InvalidArgumentException('Activity type must be active');
|
||||
}
|
||||
|
||||
$builder->add('scope', ScopePickerType::class, [
|
||||
'center' => $options['center'],
|
||||
'role' => $options['role']
|
||||
]);
|
||||
// TODO revoir la gestion des center au niveau du form des activité.
|
||||
if ($options['center']) {
|
||||
$builder->add('scope', ScopePickerType::class, [
|
||||
'center' => $options['center'],
|
||||
'role' => $options['role']
|
||||
]);
|
||||
}
|
||||
|
||||
if ($activityType->isVisible('date')) {
|
||||
$builder->add('date', ChillDateType::class, [
|
||||
@@ -108,7 +111,7 @@ class ActivityType extends AbstractType
|
||||
$builder->add('travelTime', ChoiceType::class, $durationTimeOptions);
|
||||
}
|
||||
|
||||
if ($activityType->isVisible('travelTime')) {
|
||||
if ($activityType->isVisible('attendee')) {
|
||||
$builder->add('attendee', EntityType::class, [
|
||||
'label' => $activityType->getLabel('attendee'),
|
||||
'required' => $activityType->isRequired('attendee'),
|
||||
@@ -123,7 +126,7 @@ class ActivityType extends AbstractType
|
||||
]);
|
||||
}
|
||||
|
||||
if ($activityType->isVisible('user')) {
|
||||
if ($activityType->isVisible('user') && $options['center']) {
|
||||
$builder->add('user', UserPickerType::class, [
|
||||
'label' => $activityType->getLabel('user'),
|
||||
'required' => $activityType->isRequired('user'),
|
||||
@@ -229,6 +232,10 @@ class ActivityType extends AbstractType
|
||||
}
|
||||
|
||||
foreach (['durationTime', 'travelTime'] as $fieldName) {
|
||||
if (!$activityType->isVisible($fieldName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$builder->get($fieldName)
|
||||
->addModelTransformer($durationTimeTransformer);
|
||||
|
||||
@@ -279,7 +286,7 @@ class ActivityType extends AbstractType
|
||||
|
||||
$resolver
|
||||
->setRequired(['center', 'role', 'activityType'])
|
||||
->setAllowedTypes('center', 'Chill\MainBundle\Entity\Center')
|
||||
->setAllowedTypes('center', ['null', 'Chill\MainBundle\Entity\Center'])
|
||||
->setAllowedTypes('role', 'Symfony\Component\Security\Core\Role\Role')
|
||||
->setAllowedTypes('activityType', \Chill\ActivityBundle\Entity\ActivityType::class)
|
||||
;
|
||||
|
Reference in New Issue
Block a user