Feature: [rolling date] do not show the fixed date input, unless the fixed date value is picked

This commit is contained in:
2022-11-16 22:50:04 +01:00
parent 318d6b6d4e
commit 15c304b1d1
6 changed files with 55 additions and 1 deletions

View File

@@ -16,6 +16,8 @@ use Chill\MainBundle\Service\RollingDate\RollingDate;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
@@ -59,8 +61,13 @@ class PickRollingDateType extends AbstractType
if (RollingDate::T_FIXED_DATE === $data->getRoll() && null === $data->getFixedDate()) {
$context
->buildViolation('rolling_date.When fixed date is selected, you must provide a date')
->atPath('roll')
->atPath('fixedDate')
->addViolation();
}
}
public function buildView(FormView $view, FormInterface $form, array $options)
{
$view->vars['uniqid'] = uniqid('rollingdate-');
}
}