diff --git a/src/Bundle/ChillMainBundle/Entity/SavedExport.php b/src/Bundle/ChillMainBundle/Entity/SavedExport.php index 3ac361e81..81ca33e72 100644 --- a/src/Bundle/ChillMainBundle/Entity/SavedExport.php +++ b/src/Bundle/ChillMainBundle/Entity/SavedExport.php @@ -18,6 +18,7 @@ use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait; use Doctrine\ORM\Mapping as ORM; use Ramsey\Uuid\Uuid; use Ramsey\Uuid\UuidInterface; +use Symfony\Component\Validator\Constraints as Assert; /** * @ORM\Entity @@ -31,6 +32,7 @@ class SavedExport implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) + * @Assert\NotBlank */ private string $description = ''; @@ -53,6 +55,7 @@ class SavedExport implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(type="text", nullable=false, options={"default": ""}) + * @Assert\NotBlank */ private string $title = ''; @@ -96,9 +99,9 @@ class SavedExport implements TrackCreationInterface, TrackUpdateInterface return $this->user; } - public function setDescription(string $description): SavedExport + public function setDescription(?string $description): SavedExport { - $this->description = $description; + $this->description = (string) $description; return $this; } @@ -117,9 +120,9 @@ class SavedExport implements TrackCreationInterface, TrackUpdateInterface return $this; } - public function setTitle(string $title): SavedExport + public function setTitle(?string $title): SavedExport { - $this->title = $title; + $this->title = (string) $title; return $this; } diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickRollingDateType.php b/src/Bundle/ChillMainBundle/Form/Type/PickRollingDateType.php index 2c90379f2..5b5bff6b3 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickRollingDateType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickRollingDateType.php @@ -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-'); + } } diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss index 7cd3f5479..eaa11e3d6 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss @@ -524,6 +524,7 @@ div.exports-list { flex-basis: 33%; @include media-breakpoint-down(lg) { flex-basis: 50%; } @include media-breakpoint-down(sm) { flex-basis: 100%; } + div:last-child, p:last-child { margin-top: auto; } diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/pick-rolling-date/index.js b/src/Bundle/ChillMainBundle/Resources/public/module/pick-rolling-date/index.js new file mode 100644 index 000000000..2600ea40b --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/public/module/pick-rolling-date/index.js @@ -0,0 +1,28 @@ +import {ShowHide} from 'ChillMainAssets/lib/show_hide/index'; + +document.addEventListener('DOMContentLoaded', function(_e) { + console.log('pick-rolling-date'); + document.querySelectorAll('div[data-rolling-date]').forEach( (picker) => { + const + roll_wrapper = picker.querySelector('div.roll-wrapper'), + fixed_wrapper = picker.querySelector('div.fixed-wrapper'); + + new ShowHide({ + froms: [roll_wrapper], + container: [fixed_wrapper], + test: function (elems) { + console.log('testing'); + console.log('elems', elems); + for (let el of elems) { + for (let select_roll of el.querySelectorAll('select[data-roll-picker]')) { + console.log('select_roll', select_roll); + console.log('value', select_roll.value); + return select_roll.value === 'fixed_date'; + } + } + return false; + } + }) + }); +}); + diff --git a/src/Bundle/ChillMainBundle/Resources/views/Export/layout.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Export/layout.html.twig index b86f617b4..873ace4ac 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Export/layout.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Export/layout.html.twig @@ -52,20 +52,18 @@
{{ export.description|trans }}
- -{{ export.description|trans }}
+{{ s.export.title|trans }}
- -{{ s.export.title|trans }}
- -