From 601c16ac27ae8e212ec3790f36196488e5eb3e6d Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 17 Sep 2021 17:00:23 +0200 Subject: [PATCH 001/231] first commit: rendez-vous menu entry deleted from task usermenubuilder. Start sous-types --- .../src/Entity/AsideActivityCategory.php | 59 ++++++++++++++++++- .../src/config/services/menu.yaml | 2 +- .../ChillTaskBundle/Menu/UserMenuBuilder.php | 20 +++---- 3 files changed, 69 insertions(+), 12 deletions(-) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php index 6c580394b..1aa2b7d2a 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace Chill\AsideActivityBundle\Entity; -use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; @@ -21,6 +20,16 @@ class AsideActivityCategory */ private int $id; + /** + * @ORM\ManyToOne(targetEntity=AsideActivityCategory::class, inversedBy="children") + */ + private $parent; + + /** + * @ORM\ManyToOne(targetEntity=AsideActivityCategory::class, mappedBy="parent") + */ + private $children; + /** * @ORM\Column(type="json", length=255) */ @@ -59,4 +68,52 @@ class AsideActivityCategory return $this; } + + public function getParent(): ?self + { + return $this->parent; + } + + public function hasParent(): bool + { + return $this->parent !== null; + } + + public function setParent(?self $parent): self + { + $this->parent = $parent; + + return $this; + } + + /** + * @return Collection|self[] + */ + public function getChildren(): Collection + { + return $this->children; + } + + public function addChild(self $child): self + { + if (!$this->children->contains($child)) { + $this->children[] = $child; + $child->setParent($this); + } + + return $this; + } + + public function removeChild(self $child): self + { + if ($this->children->removeElement($child)) { + // set the owning side to null (unless already changed) + if ($child->getParent() === $this) { + $child->setParent(null); + } + } + + return $this; + } + } diff --git a/src/Bundle/ChillAsideActivityBundle/src/config/services/menu.yaml b/src/Bundle/ChillAsideActivityBundle/src/config/services/menu.yaml index 614391a0e..909f82381 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/config/services/menu.yaml +++ b/src/Bundle/ChillAsideActivityBundle/src/config/services/menu.yaml @@ -1,5 +1,5 @@ services: Chill\AsideActivityBundle\Menu\: - resource: './../../Menu' + resource: "./../../Menu" autowire: true autoconfigure: true diff --git a/src/Bundle/ChillTaskBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillTaskBundle/Menu/UserMenuBuilder.php index 632961953..0330699ad 100644 --- a/src/Bundle/ChillTaskBundle/Menu/UserMenuBuilder.php +++ b/src/Bundle/ChillTaskBundle/Menu/UserMenuBuilder.php @@ -115,16 +115,16 @@ class UserMenuBuilder implements LocalMenuBuilderInterface 'icon' => 'tasks' ]); - $menu->addChild("My calendar list", [ - 'route' => 'chill_calendar_calendar_list', - 'routeParameters' => [ - 'user_id' => $user->getId(), - ] - ]) - ->setExtras([ - 'order' => -9, - 'icon' => 'tasks' - ]); + // $menu->addChild("My calendar list", [ + // 'route' => 'chill_calendar_calendar_list', + // 'routeParameters' => [ + // 'user_id' => $user->getId(), + // ] + // ]) + // ->setExtras([ + // 'order' => -9, + // 'icon' => 'tasks' + // ]); /* $menu->addChild("My aside activities", [ From d2ce4865c0644ccac2452d87b4b19523110792e5 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 21 Sep 2021 11:42:18 +0200 Subject: [PATCH 002/231] display all aside activities created for and created by user with temporary badge --- .../Controller/AsideActivityController.php | 3 +- .../views/asideActivity/list.html.twig | 38 ++++++++----------- .../src/translations/messages.fr.yml | 3 +- 3 files changed, 19 insertions(+), 25 deletions(-) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php index 88e53c8d2..59bbf821b 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php @@ -17,7 +17,8 @@ final class AsideActivityController extends CRUDController $qb = parent::buildQueryEntities($action, $request); if ('index' === $action) { - $qb->andWhere($qb->expr()->eq('e.agent', ':user')); + $qb->where($qb->expr()->eq('e.agent', ':user')); + $qb->orWhere($qb->expr()->eq('e.createdBy', ':user')); $qb->setParameter('user', $this->getUser()); } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/list.html.twig b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/list.html.twig index d0e02e3d2..cf747be72 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/list.html.twig +++ b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/list.html.twig @@ -19,7 +19,6 @@ class="flex-table my-4 list-records"> {# Sort activities according to date in descending order #} {% for entity in entities %} - {% set t = entity.type %}
@@ -29,6 +28,10 @@ {{ entity.type.title | localize_translatable_string }} +

{{ 'Created for' | trans }} + : + {{ entity.agent }}

+ {% if entity.date %}

{{ entity.date|format_date('long') }}

{% endif %} @@ -43,34 +46,23 @@
    - {% if entity.createdBy %} -
  • - {{ 'Created by: '|trans }}{{ entity.createdBy.usernameCanonical }} -
  • - {% endif %} +
  • + + {{ 'Created by'|trans }} + : + {{ entity.createdBy.usernameCanonical }} + +
- {# {% - if entity.note is not empty - or entity.createdBy|length > 0 - %} -
- {% if entity.note is not empty %} -
- {{ entity.note|chill_markdown_to_html }} -
- {% endif %} - -
- {% endif %} #}
      -
    • - -
    • +
    • + +
    • @@ -82,7 +74,7 @@ {% endfor %}
- {{ chill_pagination(paginator) }} + {{ chill_pagination(paginator) }} - - {% endif %} + {% endif %} -{% endblock %} + {% endblock %} From 15897b4f332c4da9eef501dc67372d79a4ba00cb Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 22 Sep 2021 20:35:46 +0200 Subject: [PATCH 009/231] asideactivity category entity changed to have parent and children properties --- .../src/migrations/Version20210922182907.php | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210922182907.php diff --git a/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210922182907.php b/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210922182907.php new file mode 100644 index 000000000..7699f86f3 --- /dev/null +++ b/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210922182907.php @@ -0,0 +1,29 @@ +addSql('ALTER TABLE chill_asideactivity.asideactivitycategory ADD parent VARCHAR(255) DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_asideactivity.AsideActivityCategory DROP parent'); + } +} From 05c5eaa925906d4a2107b78fe3bd65cbb81f6cf9 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 23 Sep 2021 14:54:11 +0200 Subject: [PATCH 010/231] stash commit --- .../src/Entity/AsideActivityCategory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php index 1aa2b7d2a..3ebe6f28a 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php @@ -26,7 +26,7 @@ class AsideActivityCategory private $parent; /** - * @ORM\ManyToOne(targetEntity=AsideActivityCategory::class, mappedBy="parent") + * @ORM\OneToMany(targetEntity=AsideActivityCategory::class, mappedBy="parent") */ private $children; From a28c996164769189f23f1a0b36e02f8ae15630fb Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 23 Sep 2021 14:55:54 +0200 Subject: [PATCH 011/231] stash commit 2 --- .../src/Entity/AsideActivityCategory.php | 26 +- .../src/Form/AsideActivityCategoryType.php | 18 +- .../src/Form/AsideActivityFormType.php | 12 +- .../asideActivityCategory.html.twig | 13 + .../src/Templating/Entity/CategoryRender.php | 80 +++ .../src/config/services.yaml | 15 +- .../src/migrations/Version20210922182907.php | 4 +- .../public/chill/scss/flex_table.scss | 454 ++++++++++-------- 8 files changed, 391 insertions(+), 231 deletions(-) create mode 100644 src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivityCategory/asideActivityCategory.html.twig create mode 100644 src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php diff --git a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php index 3ebe6f28a..e82bb9ec8 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Chill\AsideActivityBundle\Entity; +use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; @@ -20,8 +21,20 @@ class AsideActivityCategory */ private int $id; + /** + * @ORM\Column(type="json", length=255) + */ + private array $title; + + /** + * @ORM\OneToMany(targetEntity=AsideActivityCategory::class, mappedBy="parent") + * @ORM\Column(type="boolean") + */ + private bool $isActive = true; + /** * @ORM\ManyToOne(targetEntity=AsideActivityCategory::class, inversedBy="children") + * @ORM\JoinColumn(nullable=true) */ private $parent; @@ -30,15 +43,10 @@ class AsideActivityCategory */ private $children; - /** - * @ORM\Column(type="json", length=255) - */ - private array $title; - - /** - * @ORM\Column(type="boolean") - */ - private bool $isActive = true; + public function __construct() + { + $this->children = new ArrayCollection(); + } public function getId(): ?int { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php index 1bfc6ed37..c7357b603 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php @@ -4,19 +4,35 @@ namespace Chill\AsideActivityBundle\Form; use Chill\AsideActivityBundle\Entity\AsideActivityCategory; use Chill\MainBundle\Form\Type\TranslatableStringFormType; +use Chill\MainBundle\Templating\TranslatableStringHelper; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; - use Symfony\Component\Form\FormBuilderInterface; final class AsideActivityCategoryType extends AbstractType { + + protected $translatableStringHelper; + + public function __construct(TranslatableStringHelper $translatableStringHelper) + { + $this->translatableStringHelper = $translatableStringHelper; + } + public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('title', TranslatableStringFormType::class, [ 'label' => 'Nom', ]) + ->add('parent', EntityType::class, [ + 'class' => AsideActivityCategory::class, + 'required' => false, + 'choice_label' => function (AsideActivityCategory $category){ + return $this->translatableStringHelper->localize($category->getTitle()); + } + ]) ->add('isActive', ChoiceType::class, [ 'choices' => [ diff --git a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php index d7e5a7700..46f54471f 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php @@ -4,6 +4,7 @@ namespace Chill\AsideActivityBundle\Form; use Chill\AsideActivityBundle\Entity\AsideActivity; use Chill\AsideActivityBundle\Entity\AsideActivityCategory; +use Chill\AsideActivityBundle\Templating\Entity\CategoryRender; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Form\Type\ChillDateType; use Chill\MainBundle\Form\Type\ChillTextareaType; @@ -19,22 +20,25 @@ use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; - +use Symfony\Component\Templating\EngineInterface; final class AsideActivityFormType extends AbstractType { protected array $timeChoices; private TranslatableStringHelper $translatableStringHelper; private TokenStorageInterface $storage; + private CategoryRender $categoryRender; public function __construct ( TranslatableStringHelper $translatableStringHelper, ParameterBagInterface $parameterBag, - TokenStorageInterface $storage + TokenStorageInterface $storage, + CategoryRender $categoryRender ){ $this->timeChoices = $parameterBag->get('chill_aside_activity.form.time_duration'); $this->translatableStringHelper = $translatableStringHelper; $this->storage = $storage; + $this->CategoryRender = $categoryRender; } public function buildForm(FormBuilderInterface $builder, array $options) @@ -78,7 +82,9 @@ final class AsideActivityFormType extends AbstractType 'class' => AsideActivityCategory::class, 'placeholder' => 'Choose the activity category', 'choice_label' => function (AsideActivityCategory $asideActivityCategory) { - return $this->translatableStringHelper->localize($asideActivityCategory->getTitle()); + $options = []; + return $this->categoryRender->renderString($asideActivityCategory, $options); + // return $this->translatableStringHelper->localize($asideActivityCategory->getTitle()); }, ]) ->add('duration', ChoiceType::class, $durationTimeOptions) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivityCategory/asideActivityCategory.html.twig b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivityCategory/asideActivityCategory.html.twig new file mode 100644 index 000000000..17077db14 --- /dev/null +++ b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivityCategory/asideActivityCategory.html.twig @@ -0,0 +1,13 @@ +{% set reversed_parents = parents|reverse %} + + + {%- for p in reversed_parents %} + + {{ p.title|localize_translatable_string }}{{ options['default.separator'] }} + + {%- endfor -%} + + {{ asideActivityCategory.title|localize_translatable_string }} + + + diff --git a/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php b/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php new file mode 100644 index 000000000..8bab0986c --- /dev/null +++ b/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php @@ -0,0 +1,80 @@ + ' > ' + ]; + + public function __construct(TranslatableStringHelper $translatableStringHelper, EngineInterface $engine) + { + $this->translatableStringHelper = $translatableStringHelper; + $this->engine = $engine; + } + + /** + * @param AsideActivityCategory $asideActivityCategory + */ + public function renderString($asideActivityCategory, array $options): string + { + $options = array_merge(self::DEFAULT_ARGS, $options); + + $titles[] = $this->translatableStringHelper->localize($asideActivityCategory->getTitle()); + + while ($asideActivityCategory->hasParent()) { + $asideActivityCategory = $asideActivityCategory->getParent(); + $titles[] = $this->translatableStringHelper->localize($asideActivityCategory->getTitle()); + } + + $titles = array_reverse($titles); + + return implode($options[self::SEPERATOR_KEY], $titles); + + } + + /** + * @param AsideActivityCategory $asideActivityCategory + */ + public function supports($asideActivityCategory, array $options): bool + { + return $asideActivityCategory instanceof AsideActivityCategory; + } + + public function buildParents(AsideActivityCategory $asideActivityCategory) + { + $parents = []; + + while($asideActivityCategory->hasParent()) { + $asideActivityCategory = $parents[] = $asideActivityCategory->getParent(); + } + + return $parents; + } + + /** + * @param AsideActivityCategory $asideActivityCategory + */ + public function renderBox($asideActivityCategory, array $options): string + { + $options = array_merge(self::DEFAULT_ARGS, $options); + $parents = $this->buildParents($asideActivityCategory); + + return $this->engine->render('@ChillAsideActivity/asideActivityCategory/asideActivityCategory.html.twig', + [ + 'asideActivityCategory' => $asideActivityCategory, + 'parents' => $parents, + 'options' => $options + ]); + } +} \ No newline at end of file diff --git a/src/Bundle/ChillAsideActivityBundle/src/config/services.yaml b/src/Bundle/ChillAsideActivityBundle/src/config/services.yaml index 8ff656fdc..ede446723 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/config/services.yaml +++ b/src/Bundle/ChillAsideActivityBundle/src/config/services.yaml @@ -1,5 +1,12 @@ services: - Chill\AsideActivityBundle\DataFixtures\: - resource: './../DataFixtures' - autowire: true - autoconfigure: true + Chill\AsideActivityBundle\DataFixtures\: + resource: "./../DataFixtures" + autowire: true + autoconfigure: true + + Chill\AsideActivityBundle\Templating\Entity\: + autowire: true + autoconfigure: true + resource: "../Templating/Entity" + tags: + - "chill.render_entity" diff --git a/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210922182907.php b/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210922182907.php index 7699f86f3..00948e210 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210922182907.php +++ b/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210922182907.php @@ -19,7 +19,9 @@ final class Version20210922182907 extends AbstractMigration public function up(Schema $schema): void { - $this->addSql('ALTER TABLE chill_asideactivity.asideactivitycategory ADD parent VARCHAR(255) DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_asideactivity.asideactivitycategory ADD parent_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_asideactivity.asideactivitycategory ADD CONSTRAINT FK_7BF90DBE727ACA70 FOREIGN KEY (parent_id) REFERENCES chill_asideactivity.AsideActivityCategory (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('CREATE INDEX IDX_7BF90DBE727ACA70 ON chill_asideactivity.asideactivitycategory (parent_id)'); } public function down(Schema $schema): void diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss index 21ecde267..69f3f30f2 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss @@ -8,39 +8,45 @@ div.flex-bloc, div.flex-table { + display: flex; + align-items: stretch; + align-content: stretch; + box-sizing: border-box; + margin: 1.5em 0; + + div.item-bloc { display: flex; - align-items: stretch; - align-content: stretch; - box-sizing: border-box; - margin: 1.5em 0; + @include border-collapse; + padding: 1em; - div.item-bloc { + div.item-row { + display: flex; + + div.item-col:last-child { display: flex; - @include border-collapse; - padding: 1em; - - div.item-row { - display: flex; - - div.item-col:last-child { - display: flex; - } - } + } } + } - h2, h3, h4, dl, p { - margin: 0; - } - h2, h3, h4 { - color: $blue; - } + h2, + h3, + h4, + dl, + p { + margin: 0; + } + h2, + h3, + h4 { + color: $blue; + } - ul.record_actions { - margin: 0; - li { - margin-right: 5px; - } + ul.record_actions { + margin: 0; + li { + margin-right: 5px; } + } } /* @@ -48,36 +54,43 @@ div.flex-table { */ div.flex-bloc { - flex-direction: row; - flex-wrap: wrap; + flex-direction: row; + flex-wrap: wrap; - div.item-bloc { - flex-grow: 0; flex-shrink: 1; flex-basis: auto; - flex-direction: column; - margin: 0; - hyphens: auto; + div.item-bloc { + flex-grow: 0; + flex-shrink: 1; + flex-basis: auto; + flex-direction: column; + margin: 0; + hyphens: auto; - div.item-row { - flex-grow: 1; flex-shrink: 1; flex-basis: auto; - flex-direction: column; + div.item-row { + flex-grow: 1; + flex-shrink: 1; + flex-basis: auto; + flex-direction: column; - div.item-col { - - &:first-child { - flex-grow: 0; flex-shrink: 0; flex-basis: auto; - } - - &:last-child { - flex-grow: 1; flex-shrink: 1; flex-basis: auto; - @include separator; - - ul.record_actions { - align-self: flex-end; - } - } - } + div.item-col { + &:first-child { + flex-grow: 0; + flex-shrink: 0; + flex-basis: auto; } + + &:last-child { + flex-grow: 1; + flex-shrink: 1; + flex-basis: auto; + @include separator; + + ul.record_actions { + align-self: flex-end; + } + } + } } + } } /* @@ -85,53 +98,57 @@ div.flex-bloc { */ div.flex-table { + flex-direction: column; + + div.item-bloc { flex-direction: column; - div.item-bloc { - flex-direction: column; + &:nth-child(even) { + background-color: $gray-200; - &:nth-child(even) { - background-color: $gray-200; - - .chill-user-quote { - background-color: shade-color($gray-200, 5%) - } - } - - div.item-row { - flex-direction: row; - - div.item-col { - &:first-child { - flex-grow: 0; flex-shrink: 0; flex-basis: auto; - } - - &:last-child { - flex-grow: 1; flex-shrink: 1; flex-basis: auto; - justify-content: flex-end; - - @include media-breakpoint-down(md) { - @include separator; - } - - ul.record_actions { - align-self: flex-start; - } - } - } - - @include media-breakpoint-down(md) { - flex-direction: column; - div.item-col { - &:last-child { - ul.record_actions { - align-self: flex-end; - } - } - } - } - } + .chill-user-quote { + background-color: shade-color($gray-200, 5%); + } } + + div.item-row { + flex-direction: row; + + div.item-col { + &:first-child { + flex-grow: 0; + flex-shrink: 0; + flex-basis: auto; + } + + &:last-child { + flex-grow: 1; + flex-shrink: 1; + flex-basis: auto; + justify-content: flex-end; + + @include media-breakpoint-down(md) { + @include separator; + } + + ul.record_actions { + align-self: flex-start; + } + } + } + + @include media-breakpoint-down(md) { + flex-direction: column; + div.item-col { + &:last-child { + ul.record_actions { + align-self: flex-end; + } + } + } + } + } + } } /* @@ -140,54 +157,54 @@ div.flex-table { */ div.wrap-list { - padding: 0; - width: 100%; + padding: 0; + width: 100%; - div.wl-row { - display: flex; - flex-direction: row; - flex-wrap: wrap; - justify-content: space-between; + div.wl-row { + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: space-between; - div.wl-col.title { - width: auto; - flex-shrink: 0; + div.wl-col.title { + width: auto; + flex-shrink: 0; - @include media-breakpoint-up(md) { - //margin-left: 1.5em; - } + @include media-breakpoint-up(md) { + //margin-left: 1.5em; + } - & > * { - padding-right: 1em; - } - } - - div.wl-col.list { - width: 75%; - margin: auto 0 0 auto; - - .wl-item { - margin: 0.1em; - padding: 0em; - display: inline-block; - } - } + & > * { + padding-right: 1em; + } } - &.debug .wl-row { - border: 1px solid $black; + div.wl-col.list { + width: 75%; + margin: auto 0 0 auto; - div.wl-col.title { - background-color: yellow; - } - div.wl-col.list { - background-color: cyan; - - p.wl-item { - background-color: orange; - } - } + .wl-item { + margin: 0.1em; + padding: 0em; + display: inline-block; + } } + } + + &.debug .wl-row { + border: 1px solid $black; + + div.wl-col.title { + background-color: yellow; + } + div.wl-col.list { + background-color: cyan; + + p.wl-item { + background-color: orange; + } + } + } } /* @@ -196,43 +213,56 @@ div.wrap-list { */ div.wrap-header { - width: 100%; + width: 100%; + + div.wh-row { + display: flex; + flex-direction: row; + + &:first-child { + align-items: baseline; + } + &:last-child { + } + + div.wh-col { + &:first-child { + flex-grow: 0; + flex-shrink: 1; + flex-basis: auto; + } + &:last-child { + flex-grow: 1; + flex-shrink: 1; + flex-basis: auto; - div.wh-row { display: flex; - flex-direction: row; + justify-content: flex-end; + } + } + } + &.debug { + border: 1px solid $black; + div.wh-row { + &:first-child div.wh-col { &:first-child { - align-items: baseline; + background-color: $yellow; } - &:last-child {} - - div.wh-col { - &:first-child { - flex-grow: 0; flex-shrink: 1; flex-basis: auto; - } - &:last-child { - flex-grow: 1; flex-shrink: 1; flex-basis: auto; - - display: flex; - justify-content: flex-end; - } - } - } - - &.debug { - border: 1px solid $black; - div.wh-row { - &:first-child div.wh-col { - &:first-child { background-color: $yellow; } - &:last-child { background-color: $beige; } - } - &:last-child div.wh-col { - &:first-child { background-color: $orange; } - &:last-child { background-color: $pink; } - } + &:last-child { + background-color: $beige; } + } + &:last-child div.wh-col { + &:first-child { + background-color: $orange; + } + &:last-child { + background-color: $pink; + } + } } + } } /* @@ -243,69 +273,67 @@ div.flex-bloc, div.flex-table, div.wrap-list, div.wrap-header { + div.separator { + @include separator; + } - div.separator { - @include separator; - } - - ul.record_actions { - flex-grow: 1; - flex-shrink: 0; - flex-basis: auto; - margin: 0; - - li { - margin-right: 5px; - } + ul.record_actions { + flex-grow: 1; + flex-shrink: 0; + flex-basis: auto; + margin: 0; + + li { + margin-right: 5px; } + } } - /* * FLOATBUTTON * p-ê pas convaincant: cet asset est toujours en observation */ div.float-button { + width: 100%; + + div.box { width: 100%; - div.box { - width: 100%; + div.action { + float: right; + } + } + &.top { + div.action { + padding: 0 0 1em 1em; + } - div.action { - float: right; - } + // avoid a position relative that make links unclickable + .fa-ul > li { + position: initial; } - &.top { - div.action { - padding: 0 0 1em 1em; - } - - // avoid a position relative that make links unclickable - .fa-ul > li { - position: initial; - } + } + &.bottom { + display: flex; + overflow: hidden; + div.action { + height: calc(100% - 0em); + shape-outside: inset(calc(100% - 2em) 0 0); + display: flex; + align-items: flex-end; + padding: 0 0 0 1em; + * { + align-self: flex-end !important; + } } - &.bottom { - display: flex; - overflow: hidden; - div.action { - height: calc(100% - 0em); - shape-outside: inset(calc(100% - 2em) 0 0); - display: flex; - align-items: flex-end; - padding: 0 0 0 1em; - * { - align-self: flex-end !important; - } - } - } - &.debug { - padding: 1em; - border: 1px solid black; - background-color: yellow; - div.action { - background-color: transparentize(#00ffff, 0.4); - } + } + &.debug { + padding: 1em; + border: 1px solid black; + background-color: yellow; + div.action { + background-color: transparentize(#00ffff, 0.4); } + } } From 960db6aefcb4892cba03a1d854171cbb8689a8f7 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 24 Sep 2021 14:41:37 +0200 Subject: [PATCH 012/231] fast aside activity creation implemented --- .../Controller/AsideActivityController.php | 26 +++++++++++++++++++ .../src/Form/AsideActivityFormType.php | 4 +-- .../src/Menu/SectionMenuBuilder.php | 21 ++++++++++++--- .../src/config/services.yaml | 10 +++++++ .../src/translations/messages.fr.yml | 1 + .../Resources/views/layout.html.twig | 3 +++ 6 files changed, 58 insertions(+), 7 deletions(-) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php index 59bbf821b..8984b79f4 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php @@ -4,6 +4,8 @@ declare(strict_types=1); namespace Chill\AsideActivityBundle\Controller; +use Chill\AsideActivityBundle\Entity\AsideActivity; +use Chill\AsideActivityBundle\Repository\AsideActivityCategoryRepository; use Chill\MainBundle\CRUD\Controller\CRUDController; use Doctrine\ORM\QueryBuilder; use Symfony\Component\HttpFoundation\Request; @@ -12,6 +14,14 @@ use Doctrine\Common\Collections\Criteria; final class AsideActivityController extends CRUDController { + + private $categoryRepository; + + public function __construct(AsideActivityCategoryRepository $categoryRepository) + { + $this->categoryRepository = $categoryRepository; + } + protected function buildQueryEntities(string $action, Request $request) { $qb = parent::buildQueryEntities($action, $request); @@ -38,5 +48,21 @@ final class AsideActivityController extends CRUDController return parent::orderQuery($action, $query, $request, $paginator); } + public function createEntity(string $action, Request $request): object + { + $asideActivity = new AsideActivity(); + $duration = $request->query->get('duration', '300'); + $duration = \DateTime::createFromFormat('U', $duration); + $asideActivity->setDuration($duration); + + $categoryId = $request->query->get('type', 7); + $category = $this->categoryRepository->find($categoryId); + $asideActivity->setType($category); + + $note = $request->query->get('note', null); + $asideActivity->setNote($note); + + return $asideActivity; + } } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php index 46f54471f..59bd50874 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php @@ -25,7 +25,6 @@ use Symfony\Component\Templating\EngineInterface; final class AsideActivityFormType extends AbstractType { protected array $timeChoices; - private TranslatableStringHelper $translatableStringHelper; private TokenStorageInterface $storage; private CategoryRender $categoryRender; @@ -38,7 +37,7 @@ final class AsideActivityFormType extends AbstractType $this->timeChoices = $parameterBag->get('chill_aside_activity.form.time_duration'); $this->translatableStringHelper = $translatableStringHelper; $this->storage = $storage; - $this->CategoryRender = $categoryRender; + $this->categoryRender = $categoryRender; } public function buildForm(FormBuilderInterface $builder, array $options) @@ -84,7 +83,6 @@ final class AsideActivityFormType extends AbstractType 'choice_label' => function (AsideActivityCategory $asideActivityCategory) { $options = []; return $this->categoryRender->renderString($asideActivityCategory, $options); - // return $this->translatableStringHelper->localize($asideActivityCategory->getTitle()); }, ]) ->add('duration', ChoiceType::class, $durationTimeOptions) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php b/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php index b9776b92b..14e450b3e 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php @@ -4,6 +4,7 @@ namespace Chill\AsideActivityBundle\Menu; use Chill\MainBundle\Routing\LocalMenuBuilderInterface; use Knp\Menu\MenuItem; +use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; use Symfony\Contracts\Translation\TranslatorInterface; /** @@ -27,12 +28,24 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface */ public function buildMenu($menuId, MenuItem $menu, array $parameters) { - $menu->addChild($this->translator->trans('Create an aside activity'), [ - 'route' => 'chill_crud_aside_activity_new' + $menu->addChild($this->translator->trans('Create an aside activity'), [ + 'route' => 'chill_crud_aside_activity_new' + ]) + ->setExtras([ + 'order' => 11, + 'icons' => [ 'plus' ] + ]); + $menu->addChild($this->translator->trans('Phonecall'), [ + 'route' => 'chill_crud_aside_activity_new', + 'routeParameters' => [ + 'type' => 1, + 'duration' => 900, + 'note' => 'Pas des remarques' + ] ]) ->setExtras([ - 'order' => 11, - 'icons' => [ 'plus' ] + 'order' => 12, + 'icons' => ['plus'] ]); } diff --git a/src/Bundle/ChillAsideActivityBundle/src/config/services.yaml b/src/Bundle/ChillAsideActivityBundle/src/config/services.yaml index ede446723..34bb6da33 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/config/services.yaml +++ b/src/Bundle/ChillAsideActivityBundle/src/config/services.yaml @@ -10,3 +10,13 @@ services: resource: "../Templating/Entity" tags: - "chill.render_entity" + + Chill\AsideActivityBundle\Repository\: + resource: "../Repository" + autowire: true + autoconfigure: true + + Chill\AsideActivityBundle\Controller\: + resource: "../Controller" + autowire: true + autoconfigure: true diff --git a/src/Bundle/ChillAsideActivityBundle/src/translations/messages.fr.yml b/src/Bundle/ChillAsideActivityBundle/src/translations/messages.fr.yml index 086ca3dc2..9f7d1bf35 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/translations/messages.fr.yml +++ b/src/Bundle/ChillAsideActivityBundle/src/translations/messages.fr.yml @@ -169,3 +169,4 @@ The activity has been successfully removed.: L'activité a été supprimée. Create an aside activity: "Creér une activité annexe" Aside activity configuration menu: "Menu de configuration des activités annexes" Aside activity configuration: "Configuration des activités annexes" +Phonecall: "Appel téléphonique" diff --git a/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig b/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig index dc500642c..f6699a575 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig @@ -92,6 +92,9 @@ + {{ chill_widget('homepage', {} ) }} {% endblock %} From b87c995d22e39f99833e97e045972929cd258515 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 24 Sep 2021 14:42:07 +0200 Subject: [PATCH 013/231] fix UserMenuBuilder so that menu entry is not visible for admin menu --- .../ChillAsideActivityBundle/src/Menu/UserMenuBuilder.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Menu/UserMenuBuilder.php b/src/Bundle/ChillAsideActivityBundle/src/Menu/UserMenuBuilder.php index 22424bc84..4858e6ee7 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Menu/UserMenuBuilder.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Menu/UserMenuBuilder.php @@ -72,7 +72,7 @@ class UserMenuBuilder implements LocalMenuBuilderInterface public function buildMenu($menuId, MenuItem $menu, array $parameters) { - + if ($this->authorizationChecker->isGranted('ROLE_USER')){ $menu->addChild("My aside activities", [ 'route' => 'chill_crud_aside_activity_index' ]) @@ -80,6 +80,8 @@ class UserMenuBuilder implements LocalMenuBuilderInterface 'order' => 10, 'icon' => 'tasks' ]); + } + } public static function getMenuIds(): array From 6301c4c10b57d3d20e68973a5b31cd728397c232 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 24 Sep 2021 14:42:37 +0200 Subject: [PATCH 014/231] optimisation twig template --- .../src/Resources/views/asideActivity/view.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/view.html.twig b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/view.html.twig index 6df3d6958..1bd328308 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/view.html.twig +++ b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/view.html.twig @@ -7,7 +7,7 @@ {% block content -%}
- {% include 'ChillAsideActivityBundle:asideActivity:_view.html.twig' %} + {% include '@ChillAsideActivity/asideActivity/_view.html.twig' %}
{% endblock content %} From 4de106ec309b1e5d21026477e1775ccb7c57cf67 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 27 Sep 2021 10:21:11 +0200 Subject: [PATCH 015/231] accourse service: improve styles of checkboxes list --- .../AccompanyingCourse/components/Scopes.vue | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Scopes.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Scopes.vue index 903f85a86..1feb514db 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Scopes.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Scopes.vue @@ -1,18 +1,20 @@ From 349a0e69f182476a8e24c0d77d64f67f38c34331 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 27 Sep 2021 10:56:43 +0200 Subject: [PATCH 016/231] accourse: add warning alert box in each bloc with minimum confirm conditions --- .../Resources/public/vuejs/AccompanyingCourse/App.vue | 7 ++++++- .../vuejs/AccompanyingCourse/components/Confirm.vue | 2 +- .../AccompanyingCourse/components/CourseLocation.vue | 9 ++++++++- .../components/PersonsAssociated.vue | 10 ++++++++-- .../vuejs/AccompanyingCourse/components/Scopes.vue | 2 +- .../AccompanyingCourse/components/SocialIssue.vue | 9 ++++++++- .../public/vuejs/AccompanyingCourse/js/i18n.js | 3 +++ 7 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue index e4baa082b..bd7705ca4 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue @@ -87,8 +87,8 @@ export default { } padding: 0em 0em; margin: 1em 0; - border: 1px dotted tint-color($chill-accourse-context, 10%); border-radius: 5px; + border: 1px dotted tint-color($chill-accourse-context, 10%); border-left: 1px dotted tint-color($chill-accourse-context, 10%); border-right: 1px dotted tint-color($chill-accourse-context, 10%); dd { @@ -96,10 +96,15 @@ export default { } & > div { margin: 1em 3em 0; + &.flex-table, &.flex-bloc { margin: 1em 0 0; } + &.alert.to-confirm { + margin: 1em 0 0; + padding: 1em 3em; + } } div.flex-table { diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Confirm.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Confirm.vue index b8d131f2d..f23a7c9e5 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Confirm.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Confirm.vue @@ -91,7 +91,7 @@ export default { }, scopes: { msg: 'confirm.set_a_scope', - anchor: '#section-65' + anchor: '#section-60' } } } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/CourseLocation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/CourseLocation.vue index afe13845c..fa1638b1c 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/CourseLocation.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/CourseLocation.vue @@ -55,11 +55,15 @@ +
+ {{ $t('courselocation.not_valid') }} +
+ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue index 97a286d70..52b538284 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue @@ -26,7 +26,7 @@ :id="p.person.id" :value="p.person.id" /> -