From 601c16ac27ae8e212ec3790f36196488e5eb3e6d Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 17 Sep 2021 17:00:23 +0200 Subject: [PATCH 01/69] 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 02/69] 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 09/69] 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 10/69] 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 11/69] 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 12/69] 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 13/69] 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 14/69] 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 e35f002f2b3efbb61f26f847c4b38d332624a4fd Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 1 Oct 2021 19:05:03 +0200 Subject: [PATCH 15/69] improvements based on draft review of MR 153 --- .../Controller/AsideActivityController.php | 3 + .../ChillAsideActivityExtension.php | 2 +- .../src/Form/AsideActivityCategoryType.php | 8 +- .../src/Menu/SectionMenuBuilder.php | 1 - .../Admin/layout_asideactivity.html.twig | 2 +- .../views/asideActivity/_index.html.twig | 0 .../views/asideActivity/_view.html.twig | 4 +- .../views/asideActivity/index.html.twig | 93 +++++++++++++++- .../views/asideActivity/list.html.twig | 101 ------------------ .../src/migrations/Version20210706124644.php | 5 +- .../src/migrations/Version20210804082249.php | 5 +- .../src/migrations/Version20210806140343.php | 5 +- .../src/migrations/Version20210806140710.php | 5 +- .../src/migrations/Version20210810084456.php | 5 +- .../src/migrations/Version20210922182907.php | 5 +- .../src/translations/messages.fr.yml | 13 --- .../translations/messages.fr.yml | 88 ++++++++------- 17 files changed, 154 insertions(+), 191 deletions(-) delete mode 100644 src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/_index.html.twig delete mode 100644 src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/list.html.twig diff --git a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php index 8984b79f4..a0362ec12 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php @@ -57,6 +57,9 @@ final class AsideActivityController extends CRUDController $asideActivity->setDuration($duration); $categoryId = $request->query->get('type', 7); + if($categoryId === null){ + return $this->createNotFoundException('You must give a valid category id'); + } $category = $this->categoryRepository->find($categoryId); $asideActivity->setType($category); diff --git a/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/ChillAsideActivityExtension.php b/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/ChillAsideActivityExtension.php index fa1353c71..59e77c3e9 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/ChillAsideActivityExtension.php +++ b/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/ChillAsideActivityExtension.php @@ -87,7 +87,7 @@ final class ChillAsideActivityExtension extends Extension implements PrependExte 'controller' => \Chill\AsideActivityBundle\Controller\AsideActivityController::class, 'actions' => [ 'index' => [ - 'template' => '@ChillAsideActivity/asideActivity/list.html.twig', + 'template' => '@ChillAsideActivity/asideActivity/index.html.twig', 'role' => 'ROLE_USER' ], 'new' => [ diff --git a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php index c7357b603..39ddc826b 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php @@ -3,6 +3,7 @@ namespace Chill\AsideActivityBundle\Form; use Chill\AsideActivityBundle\Entity\AsideActivityCategory; +use Chill\AsideActivityBundle\Templating\Entity\CategoryRender; use Chill\MainBundle\Form\Type\TranslatableStringFormType; use Chill\MainBundle\Templating\TranslatableStringHelper; use Symfony\Bridge\Doctrine\Form\Type\EntityType; @@ -15,9 +16,10 @@ final class AsideActivityCategoryType extends AbstractType protected $translatableStringHelper; - public function __construct(TranslatableStringHelper $translatableStringHelper) + public function __construct(TranslatableStringHelper $translatableStringHelper, CategoryRender $categoryRender) { $this->translatableStringHelper = $translatableStringHelper; + $this->categoryRender = $categoryRender; } public function buildForm(FormBuilderInterface $builder, array $options) @@ -29,8 +31,10 @@ final class AsideActivityCategoryType extends AbstractType ->add('parent', EntityType::class, [ 'class' => AsideActivityCategory::class, 'required' => false, + 'label' => 'Type', 'choice_label' => function (AsideActivityCategory $category){ - return $this->translatableStringHelper->localize($category->getTitle()); + $options = []; + return $this->categoryRender->renderString($category, $options); } ]) ->add('isActive', ChoiceType::class, diff --git a/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php b/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php index 14e450b3e..7ae0be27a 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php @@ -40,7 +40,6 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface 'routeParameters' => [ 'type' => 1, 'duration' => 900, - 'note' => 'Pas des remarques' ] ]) ->setExtras([ diff --git a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/Admin/layout_asideactivity.html.twig b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/Admin/layout_asideactivity.html.twig index f0242c085..08b01cdbd 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/Admin/layout_asideactivity.html.twig +++ b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/Admin/layout_asideactivity.html.twig @@ -9,6 +9,6 @@ {% block layout_wvm_content %} {% block admin_content %} -

{{ 'Aside activity configuration' |trans }}

+

{{ 'Aside activity configuration'|trans }}

{% endblock %} {% endblock %} diff --git a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/_index.html.twig b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/_index.html.twig deleted file mode 100644 index e69de29bb..000000000 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 4601adab1..209214f65 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/_view.html.twig +++ b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/_view.html.twig @@ -3,7 +3,7 @@
{{ 'Type'|trans }}
-
{{ entity.type.title | localize_translatable_string }}
+
{{ entity.type.title|localize_translatable_string }}
{{ 'Created by'|trans }}
{{ entity.createdBy }}
@@ -37,7 +37,7 @@
  • - + {{ 'Back to the list'|trans }} diff --git a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/index.html.twig b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/index.html.twig index 0e8ea0506..ef1bc7f74 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/index.html.twig +++ b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/index.html.twig @@ -1,8 +1,91 @@ -{% extends '@ChillMain/layout.html.twig' %} +{% extends "@ChillMain/layout.html.twig" %} -{% block title %}{{ ('crud.' ~ crud_name ~ '.index.title')|trans({'%crud_name%': crud_name}) }}{% endblock %} +{% block title %} + {{ 'Aside activity list'|trans }} +{% endblock title %} {% block content %} - {% embed '@ChillAsideActivity/AsideActivity/_index.html.twig' %} - {% endembed %} -{% endblock content %} \ No newline at end of file +
    +

    {{ 'My aside activities'|trans }}

    + + {% if entities|length == 0 %} +

    + {{ "There aren't any aside activities."|trans }} + +

    + {% else %} + +
    + + {% for entity in entities %} + +
    +
    + +
    +

    + {{ entity.type.title|localize_translatable_string }} +

    +
    + {% if entity.date %} + {{ entity.date|format_date('long') }} + {% endif %} + {% if entity.date %} + + + + {{ entity.duration|date('H:i') }} + + + {% endif %} +
    +
    +
    +
    +
      +
    • + + {{ 'By'|trans }}: + {{ entity.createdBy.usernameCanonical }} + +
    • +
    • + + {{ 'For'|trans }}: + {{ entity.agent.usernameCanonical }} + + +
    • +
    +
    +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    +
    +
    +
    +
    +
    + {% endfor %} +
    + + {{ chill_pagination(paginator) }} + + + {% endif %} + + {% endblock %} diff --git a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/list.html.twig b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/list.html.twig deleted file mode 100644 index c6da4816b..000000000 --- a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/list.html.twig +++ /dev/null @@ -1,101 +0,0 @@ -{% extends "@ChillMain/layout.html.twig" %} - -{% block title %} - {{ 'Aside activity list' |trans }} -{% endblock title %} - -{% block content %} -
    -

    {{ 'My aside activities' |trans }}

    - - {% if entities|length == 0 %} -

    - {{ "There aren't any aside activities."|trans }} - -

    - {% else %} - -
    - - {% for entity in entities %} - -
    -
    - -
    -

    - {{ entity.type.title | localize_translatable_string }} -

    -
    - {% if entity.date %} - {{ entity.date|format_date('long') }} - {% endif %} - {% if entity.date %} - - - - {{ entity.duration|date('H:i') }} - - - {% endif %} -
    -
    -
    -
    -
    -
      -
    • - - {{ 'By'|trans }}: - {{ entity.createdBy.usernameCanonical }} - -
    • -
    • - - {{ 'For'|trans }}: - {{ entity.agent.usernameCanonical }} - - -
    • -
    -
    -
      -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    -
    -
    -
    -
    -
    - -
    -
    -
    -

    {{ entity.note }}

    -
    -
    -
    -
    - {% endfor %} -
    - - {{ chill_pagination(paginator) }} - - - {% endif %} - - {% endblock %} diff --git a/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210706124644.php b/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210706124644.php index 59fa35be4..13bee6404 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210706124644.php +++ b/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210706124644.php @@ -7,14 +7,11 @@ namespace Chill\Migrations\AsideActivity; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; -/** - * Auto-generated Migration: Please modify to your needs! - */ final class Version20210706124644 extends AbstractMigration { public function getDescription(): string { - return ''; + return 'Aside activity category entity created'; } public function up(Schema $schema): void diff --git a/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210804082249.php b/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210804082249.php index c96084ea8..85b99c572 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210804082249.php +++ b/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210804082249.php @@ -7,14 +7,11 @@ namespace Chill\Migrations\AsideActivity; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; -/** - * Auto-generated Migration: Please modify to your needs! - */ final class Version20210804082249 extends AbstractMigration { public function getDescription(): string { - return ''; + return 'Aside activity entity created'; } public function up(Schema $schema): void diff --git a/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210806140343.php b/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210806140343.php index 62b568407..75c7b81b2 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210806140343.php +++ b/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210806140343.php @@ -7,14 +7,11 @@ namespace Chill\Migrations\AsideActivity; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; -/** - * Auto-generated Migration: Please modify to your needs! - */ final class Version20210806140343 extends AbstractMigration { public function getDescription(): string { - return ''; + return 'Duration changed to type integer'; } public function up(Schema $schema): void diff --git a/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210806140710.php b/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210806140710.php index 92320e639..5c572e650 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210806140710.php +++ b/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210806140710.php @@ -7,14 +7,11 @@ namespace Chill\Migrations\AsideActivity; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; -/** - * Auto-generated Migration: Please modify to your needs! - */ final class Version20210806140710 extends AbstractMigration { public function getDescription(): string { - return ''; + return 'Duration changed back to timestamp'; } public function up(Schema $schema): void diff --git a/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210810084456.php b/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210810084456.php index 29d6be7f3..2984108c2 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210810084456.php +++ b/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210810084456.php @@ -7,14 +7,11 @@ namespace Chill\Migrations\AsideActivity; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; -/** - * Auto-generated Migration: Please modify to your needs! - */ final class Version20210810084456 extends AbstractMigration { public function getDescription(): string { - return ''; + return 'createdat, updatedat and date given a type timestamp'; } public function up(Schema $schema): void diff --git a/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210922182907.php b/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210922182907.php index 00948e210..13ba8749c 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210922182907.php +++ b/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20210922182907.php @@ -7,14 +7,11 @@ namespace Chill\Migrations\AsideActivity; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; -/** - * Auto-generated Migration: Please modify to your needs! - */ final class Version20210922182907 extends AbstractMigration { public function getDescription(): string { - return ''; + return 'Parent and children added to aside activity category entity'; } public function up(Schema $schema): void diff --git a/src/Bundle/ChillAsideActivityBundle/src/translations/messages.fr.yml b/src/Bundle/ChillAsideActivityBundle/src/translations/messages.fr.yml index 9f7d1bf35..979f95bac 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/translations/messages.fr.yml +++ b/src/Bundle/ChillAsideActivityBundle/src/translations/messages.fr.yml @@ -14,7 +14,6 @@ present: présent not present: absent Delete: Supprimer Update: Mettre à jour -Update activity: Modifier l'activité Aside activity data: Données de l'activité annexe There aren't any aside activities.: Aucune activité annexe enregistrée. Type: Type @@ -41,14 +40,8 @@ crud: title_edit: Edition d'une catégorie de type d'activité #forms -Activity creation: Nouvelle activité annexe Create a new aside activity type: Nouvelle categorie d'activité annexe -Create: Créer Back to the list: Retour à la liste -Save activity: Sauver l'activité -Reset form: Remise à zéro du formulaire -Choose the agent for whom this activity is created: Choissisez l'utilisateur pour qui l'activité est creéé. -Choose the activity category: Choissisez le type d'activité Choose the duration: Choisir la durée Choose a category: Choisir un categorie Is active: Actif @@ -154,12 +147,6 @@ days: jours #list My aside activities: Mes activités annexes -Date: Date -By: Par -For: Pour -Created by: Créé par -Created for: Créé pour - #Aside activity delete Delete aside activity: Supprimer une activité annexe Are you sure you want to remove the aside activity concerning "%name%" ?: Êtes-vous sûr de vouloir supprimer une activité annexe qui concerne "%name%" ? diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index f799f20b6..037ac443e 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -1,7 +1,7 @@ "This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License": "Ce programme est un logiciel libre: vous pouvez le redistribuer et/ou le modifier selon les termes de la licence GNU Affero GPL" User manual: Manuel d'utilisation Search: Rechercher -'Search persons, ...': 'Recherche des personnes, ...' +"Search persons, ...": "Recherche des personnes, ..." Person name: Nom / Prénom de la personne Login: Connexion Logout: Se déconnecter @@ -33,7 +33,7 @@ Cancel: Annuler Save: Enregistrer This form contains errors: Ce formulaire contient des erreurs Choose an user: Choisir un utilisateur -'You are going to leave a page with unsubmitted data. Are you sure you want to leave ?': "Vous allez quitter la page alors que des données n'ont pas été enregistrées. Êtes vous sûr de vouloir partir ?" +"You are going to leave a page with unsubmitted data. Are you sure you want to leave ?": "Vous allez quitter la page alors que des données n'ont pas été enregistrées. Êtes vous sûr de vouloir partir ?" No value: Aucune information Last updated by: Dernière mise à jour par Last updated on: Dernière mise à jour le @@ -71,24 +71,24 @@ Postal code: Code postal Valid from: Valide à partir du Choose a postal code: Choisir un code postal address: - address_homeless: L'adresse est-elle celle d'un domicile fixe ? - real address: Adresse d'un domicile - consider homeless: N'est pas l'adresse d'un domicile (SDF) + address_homeless: L'adresse est-elle celle d'un domicile fixe ? + real address: Adresse d'un domicile + consider homeless: N'est pas l'adresse d'un domicile (SDF) address more: - floor: ét - corridor: coul - steps: esc - flat: appart - buildingName: résidence - extra: '' - distribution: cedex + floor: ét + corridor: coul + steps: esc + flat: appart + buildingName: résidence + extra: "" + distribution: cedex Create a new address: Créer une nouvelle adresse #serach Your search is empty. Please provide search terms.: La recherche est vide. Merci de fournir des termes de recherche. The domain %domain% is unknow. Please check your search.: Le domaine de recherche "%domain%" est inconnu. Merci de vérifier votre recherche. -Invalid terms : Recherche invalide -You should not have more than one domain. : Vous ne devriez pas avoir plus d'un domaine de recherche. +Invalid terms: Recherche invalide +You should not have more than one domain.: Vous ne devriez pas avoir plus d'un domaine de recherche. #used for page title Search %pattern%: Recherche de "%pattern%" Results %start%-%end% of %total%: Résultats %start%-%end% sur %total% @@ -113,9 +113,9 @@ Permissions Menu: Gestion des droits Permissions management of your chill installation: Gestion des permissions de votre instance #admin section -'Administration interface': Interface d'administration +"Administration interface": Interface d'administration Welcome to the admin section !: > - Bienvenue dans l'interface d'administration ! + Bienvenue dans l'interface d'administration ! #admin section for center's administration Create a new center: Créer un nouveau centre @@ -212,7 +212,6 @@ Problem during download: Problème durant le téléchargement # sans valeur without data: sans valeur - #CSV List Formatter Add a number on first column: La première colonne est un numéro Number: Numéro @@ -230,9 +229,9 @@ Comma separated values (CSV): Valeurs séparées par des virgules (CSV - tableur Choose the format: Choisir le format # select2 -'select2.no_results': Aucun résultat -'select2.error_loading': Erreur de chargement des résultats -'select2.searching': Recherche en cours... +"select2.no_results": Aucun résultat +"select2.error_loading": Erreur de chargement des résultats +"select2.searching": Recherche en cours... # change password Change my password: Modification du mot de passe @@ -260,28 +259,35 @@ Impersonate: Incarner l'utilisateur Impersonate mode: Mode fantôme crud: - # general items - new: - button_action_form: Créer - link_edit: Modifier - save_and_close: Créer & fermer - save_and_show: Créer & voir - save_and_new: Créer & nouveau - success: Les données ont été créées - edit: - button_action_form: Enregistrer - back_to_view: Voir - save_and_close: Enregistrer & fermer - save_and_show: Enregistrer & voir - success: Les données ont été modifiées - delete: - success: Les données ont été supprimées - link_to_form: Supprimer - default: - success: Les données ont été enregistrées - view: - link_duplicate: Dupliquer + # general items + new: + button_action_form: Créer + link_edit: Modifier + save_and_close: Créer & fermer + save_and_show: Créer & voir + save_and_new: Créer & nouveau + success: Les données ont été créées + edit: + button_action_form: Enregistrer + back_to_view: Voir + save_and_close: Enregistrer & fermer + save_and_show: Enregistrer & voir + success: Les données ont été modifiées + delete: + success: Les données ont été supprimées + link_to_form: Supprimer + default: + success: Les données ont été enregistrées + view: + link_duplicate: Dupliquer No entities: Aucun élément CHILL_FOO_SEE: Voir un élément CHILL_FOO_EDIT: Modifier un élément + +#Show templates +Date: Date +By: Par +For: Pour +Created for: Créé pour +Created by: Créé par From e895125d12be49474ea2ba8f6989b6ecb83d3359 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 4 Oct 2021 10:47:09 +0200 Subject: [PATCH 16/69] view template replaced by CRUD view template --- .../views/asideActivity/_view.html.twig | 59 ------------------- .../views/asideActivity/view.html.twig | 55 ++++++++++++++--- 2 files changed, 47 insertions(+), 67 deletions(-) delete mode 100644 src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/_view.html.twig diff --git a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/_view.html.twig b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/_view.html.twig deleted file mode 100644 index 209214f65..000000000 --- a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/_view.html.twig +++ /dev/null @@ -1,59 +0,0 @@ -

    {{ "Aside activity"|trans }}

    - -
    - -
    {{ 'Type'|trans }}
    -
    {{ entity.type.title|localize_translatable_string }}
    - -
    {{ 'Created by'|trans }}
    -
    {{ entity.createdBy }}
    - -
    {{ 'Created for'|trans }}
    -
    {{ entity.agent }}
    - -

    {{ 'Activity data'|trans }}

    - -
    {{ 'Date'|trans }}
    -
    {{ entity.date|format_date('long') }}
    - -
    {{ 'Duration'|trans }}
    -
    {{ entity.duration|date('H:i') }}
    - -
    {{ 'Remark'|trans }}
    - {%- if entity.note is empty -%} -
    - {{ 'No comments'|trans }} -
    - {%- else -%} -
    -
    -
    -

    {{ entity.note }}

    -
    -
    -
    - {%- endif -%} -
    - - 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 1bd328308..e2a46d161 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/view.html.twig +++ b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/view.html.twig @@ -1,13 +1,52 @@ -{% extends "@ChillMain/layout.html.twig" %} +{% extends '@ChillMain/layout.html.twig' %} -{% set activeRouteKey = 'chill_aside_activity_list' %} +{% set activeRouteKey = '' %} -{% block title 'Show the aside activity'|trans %} +{% block title %} + {% include('@ChillMain/CRUD/_view_title.html.twig') %} +{% endblock %} -{% block content -%} -
    +{% block content %} + {% embed '@ChillMain/CRUD/_view_content.html.twig' %} + {% block crud_content_header %} +

    {{ ('crud.' ~ crud_name ~ '.title_view')|trans }}

    + {% endblock crud_content_header %} + {% block crud_content_view_details %} +
    - {% include '@ChillAsideActivity/asideActivity/_view.html.twig' %} +
    {{ 'Type'|trans }}
    +
    {{ entity.type.title|localize_translatable_string }}
    -
    -{% endblock content %} +
    {{ 'Created by'|trans }}
    +
    {{ entity.createdBy }}
    + +
    {{ 'Created for'|trans }}
    +
    {{ entity.agent }}
    + +

    {{ 'Activity data'|trans }}

    + +
    {{ 'Date'|trans }}
    +
    {{ entity.date|format_date('long') }}
    + +
    {{ 'Duration'|trans }}
    +
    {{ entity.duration|date('H:i') }}
    + +
    {{ 'Remark'|trans }}
    + {%- if entity.note is empty -%} +
    + {{ 'No comments'|trans }} +
    + {%- else -%} +
    +
    +
    +

    {{ entity.note }}

    +
    +
    +
    + {%- endif -%} +
+ + {% endblock %} + {% endembed %} +{% endblock %} From da19f6844026fb7844e782282e70f986ee76efc5 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 4 Oct 2021 11:20:07 +0200 Subject: [PATCH 17/69] Title display of aside activities adjusted to display full title (parent > child > ...) Styling to be discussed --- .../src/Resources/views/asideActivity/index.html.twig | 2 +- .../src/Resources/views/asideActivity/view.html.twig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/index.html.twig b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/index.html.twig index ef1bc7f74..a97a29875 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/index.html.twig +++ b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/index.html.twig @@ -24,7 +24,7 @@

- {{ entity.type.title|localize_translatable_string }} + {{ entity.type|chill_entity_render_box }}

{% if entity.date %} 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 e2a46d161..75da9a444 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/view.html.twig +++ b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/view.html.twig @@ -15,7 +15,7 @@
{{ 'Type'|trans }}
-
{{ entity.type.title|localize_translatable_string }}
+
{{ entity.type|chill_entity_render_box }}
{{ 'Created by'|trans }}
{{ entity.createdBy }}
From 152a7de1dc85e21fd2820ae21087bb6295fcbf00 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 4 Oct 2021 12:09:26 +0200 Subject: [PATCH 18/69] section menu entries de-activated for role_admin --- .../src/Menu/SectionMenuBuilder.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php b/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php index 7ae0be27a..8a8d65156 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\AuthorizationChecker; use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -15,10 +16,12 @@ use Symfony\Contracts\Translation\TranslatorInterface; class SectionMenuBuilder implements LocalMenuBuilderInterface { protected TranslatorInterface $translator; + public AuthorizationCheckerInterface $authorizationChecker; - public function __construct(TranslatorInterface $translator) + public function __construct(TranslatorInterface $translator, AuthorizationCheckerInterface $authorizationChecker) { $this->translator = $translator; + $this->authorizationChecker = $authorizationChecker; } /** @@ -28,6 +31,7 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface */ public function buildMenu($menuId, MenuItem $menu, array $parameters) { + if ($this->authorizationChecker->isGranted('ROLE_USER')){ $menu->addChild($this->translator->trans('Create an aside activity'), [ 'route' => 'chill_crud_aside_activity_new' ]) @@ -46,6 +50,7 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface 'order' => 12, 'icons' => ['plus'] ]); + } } /** From cd6dec5082edb557de7f815f797aee1503777958 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 4 Oct 2021 12:11:27 +0200 Subject: [PATCH 19/69] Display of aside activity title styling changed from badge to normal title display --- .../asideActivityCategory.html.twig | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivityCategory/asideActivityCategory.html.twig b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivityCategory/asideActivityCategory.html.twig index 17077db14..8521b3132 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivityCategory/asideActivityCategory.html.twig +++ b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivityCategory/asideActivityCategory.html.twig @@ -1,13 +1,14 @@ {% set reversed_parents = parents|reverse %} - - - {%- for p in reversed_parents %} - - {{ p.title|localize_translatable_string }}{{ options['default.separator'] }} - - {%- endfor -%} - - {{ asideActivityCategory.title|localize_translatable_string }} + + {# #} + {%- for p in reversed_parents %} + + {{ p.title|localize_translatable_string }}{{ options['default.separator'] }} + {%- endfor -%} + + {{ asideActivityCategory.title|localize_translatable_string }} + {# #} From 369a29af48bbe1b6b0ef1dc854c47068ed65c127 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 4 Oct 2021 14:22:27 +0200 Subject: [PATCH 20/69] accompanying course work, specific render for list page or resume page (wip) --- .../Resources/views/AccompanyingCourse/index.html.twig | 2 +- .../Resources/views/AccompanyingCourseWork/index.html.twig | 2 +- .../list_by_accompanying_period.html.twig | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index 13eb99c14..55a9505f9 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -172,7 +172,7 @@ {% block contentActivity %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/index.html.twig index 92b1919af..ddeea92e9 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/index.html.twig @@ -7,7 +7,7 @@

{{ block('title') }}

- {% include 'ChillPersonBundle:AccompanyingCourseWork:list_by_accompanying_period.html.twig' %} + {% include 'ChillPersonBundle:AccompanyingCourseWork:list_by_accompanying_period.html.twig' with {'render': 'list'} %}
  • diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/list_by_accompanying_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/list_by_accompanying_period.html.twig index d44b7eb3b..01b7c9b2b 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/list_by_accompanying_period.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/list_by_accompanying_period.html.twig @@ -5,7 +5,7 @@

    {% endif %} -
    +
    {% for w in works %}
    From 27125b838ec89bf6a15cbc8232cbb8d7fcb7aee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 4 Oct 2021 15:15:26 +0200 Subject: [PATCH 21/69] various minor fixes in aside activities --- .../asideActivityCategory.html.twig | 4 +--- .../src/Resources/views/asideActivity/index.html.twig | 6 +++--- .../src/Templating/Entity/CategoryRender.php | 4 ++-- .../src/translations/messages.fr.yml | 2 ++ 4 files changed, 8 insertions(+), 8 deletions(-) rename src/Bundle/ChillAsideActivityBundle/src/Resources/views/{asideActivityCategory => Entity}/asideActivityCategory.html.twig (75%) diff --git a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivityCategory/asideActivityCategory.html.twig b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/Entity/asideActivityCategory.html.twig similarity index 75% rename from src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivityCategory/asideActivityCategory.html.twig rename to src/Bundle/ChillAsideActivityBundle/src/Resources/views/Entity/asideActivityCategory.html.twig index 8521b3132..1b31cc765 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivityCategory/asideActivityCategory.html.twig +++ b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/Entity/asideActivityCategory.html.twig @@ -1,7 +1,6 @@ {% set reversed_parents = parents|reverse %} - {# #} + class="chill-entity entity-aside_activity-category"> {%- for p in reversed_parents %} {{ p.title|localize_translatable_string }}{{ options['default.separator'] }} @@ -10,5 +9,4 @@ {{ asideActivityCategory.title|localize_translatable_string }} - {# #} diff --git a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/index.html.twig b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/index.html.twig index a97a29875..6cc45aeaf 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/index.html.twig +++ b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/index.html.twig @@ -24,7 +24,7 @@

    - {{ entity.type|chill_entity_render_box }} + {{ entity.type|chill_entity_render_box }}

    {% if entity.date %} @@ -46,13 +46,13 @@
  • {{ 'By'|trans }}: - {{ entity.createdBy.usernameCanonical }} + {{ entity.createdBy|chill_entity_render_box }}
  • {{ 'For'|trans }}: - {{ entity.agent.usernameCanonical }} + {{ entity.agent|chill_entity_render_box }}
  • diff --git a/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php b/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php index 8bab0986c..902ed7a68 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php @@ -70,11 +70,11 @@ final class CategoryRender implements ChillEntityRenderInterface $options = array_merge(self::DEFAULT_ARGS, $options); $parents = $this->buildParents($asideActivityCategory); - return $this->engine->render('@ChillAsideActivity/asideActivityCategory/asideActivityCategory.html.twig', + return $this->engine->render('@ChillAsideActivity/Entity/asideActivityCategory.html.twig', [ 'asideActivityCategory' => $asideActivityCategory, 'parents' => $parents, 'options' => $options ]); } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillAsideActivityBundle/src/translations/messages.fr.yml b/src/Bundle/ChillAsideActivityBundle/src/translations/messages.fr.yml index 6ee180ad9..c16f6af6a 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/translations/messages.fr.yml +++ b/src/Bundle/ChillAsideActivityBundle/src/translations/messages.fr.yml @@ -49,6 +49,8 @@ Agent: Utilisateur date: Date Duration: Durée Note: Note +Choose the agent for whom this activity is created: Choisissez l'agent pour qui l'activité est créée +Choose the activity category: Choisir la catégorie #Duration minutes: minutes From 27dea97bc6b4251f16270c01d514743846c51093 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 4 Oct 2021 15:55:35 +0200 Subject: [PATCH 22/69] fixes minor for admin aside activity --- CHANGELOG.md | 6 ++- .../src/Controller/AdminController.php | 20 -------- .../AsideActivityCategoryController.php | 12 ++++- .../src/Entity/AsideActivityCategory.php | 16 +++++++ .../src/Form/AsideActivityCategoryType.php | 8 ++-- .../src/Form/AsideActivityFormType.php | 9 ++++ .../src/Menu/AdminMenuBuilder.php | 48 +++++++++++++++++++ .../Admin/layout_asideactivity.html.twig | 4 +- .../views/Admin/menu_asideactivity.html.twig | 4 -- .../asideActivityCategory/edit.html.twig | 2 +- .../asideActivityCategory/index.html.twig | 6 ++- .../views/asideActivityCategory/new.html.twig | 2 +- .../src/migrations/Version20211004134012.php | 29 +++++++++++ .../views/Menu/defaultMenu.html.twig | 8 ++-- 14 files changed, 134 insertions(+), 40 deletions(-) delete mode 100644 src/Bundle/ChillAsideActivityBundle/src/Controller/AdminController.php create mode 100644 src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php delete mode 100644 src/Bundle/ChillAsideActivityBundle/src/Resources/views/Admin/menu_asideactivity.html.twig create mode 100644 src/Bundle/ChillAsideActivityBundle/src/migrations/Version20211004134012.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e2691c63..9050e6e1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,11 @@ and this project adheres to ## Unreleased - +* [Aside activity] Fixes for aside activity + + * categories with child + * fast creation buttons + * add ordering for types ## Test releases diff --git a/src/Bundle/ChillAsideActivityBundle/src/Controller/AdminController.php b/src/Bundle/ChillAsideActivityBundle/src/Controller/AdminController.php deleted file mode 100644 index ae04b2110..000000000 --- a/src/Bundle/ChillAsideActivityBundle/src/Controller/AdminController.php +++ /dev/null @@ -1,20 +0,0 @@ - - * @author Champs Libres - */ -class AdminController extends AbstractController -{ - - public function redirectToAdminIndexAction() - { - return $this->redirectToRoute('chill_main_admin_central'); - } -} \ No newline at end of file diff --git a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityCategoryController.php b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityCategoryController.php index 37f10c343..bf062b50d 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityCategoryController.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityCategoryController.php @@ -3,6 +3,9 @@ namespace Chill\AsideActivityBundle\Controller; use Chill\MainBundle\CRUD\Controller\CRUDController; +use Chill\MainBundle\Pagination\PaginatorInterface; +use Doctrine\ORM\QueryBuilder; +use Symfony\Component\HttpFoundation\Request; /** @@ -10,5 +13,12 @@ use Chill\MainBundle\CRUD\Controller\CRUDController; */ class AsideActivityCategoryController extends CRUDController { + protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator) + { + /** @var QueryBuilder $query */ + $query->addOrderBy('e.ordering', 'ASC'); -} \ No newline at end of file + return $query; + } + +} diff --git a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php index e82bb9ec8..e405f1556 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php @@ -32,6 +32,12 @@ class AsideActivityCategory */ private bool $isActive = true; + /** + * @var float + * @ORM\Column(type="float", options={"default": 0.00}) + */ + private float $ordering = 0.00; + /** * @ORM\ManyToOne(targetEntity=AsideActivityCategory::class, inversedBy="children") * @ORM\JoinColumn(nullable=true) @@ -124,4 +130,14 @@ class AsideActivityCategory return $this; } + public function getOrdering(): float + { + return $this->ordering; + } + + public function setOrdering(float $ordering): AsideActivityCategory + { + $this->ordering = $ordering; + return $this; + } } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php index 39ddc826b..0060ab1b9 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityCategoryType.php @@ -9,11 +9,12 @@ 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\Extension\Core\Type\NumberType; use Symfony\Component\Form\FormBuilderInterface; final class AsideActivityCategoryType extends AbstractType { - + protected $translatableStringHelper; public function __construct(TranslatableStringHelper $translatableStringHelper, CategoryRender $categoryRender) @@ -31,13 +32,14 @@ final class AsideActivityCategoryType extends AbstractType ->add('parent', EntityType::class, [ 'class' => AsideActivityCategory::class, 'required' => false, - 'label' => 'Type', + 'label' => 'Parent', 'choice_label' => function (AsideActivityCategory $category){ $options = []; return $this->categoryRender->renderString($category, $options); } ]) - ->add('isActive', ChoiceType::class, + ->add('ordering', NumberType::class) + ->add('isActive', ChoiceType::class, [ 'choices' => [ 'Yes' => true, diff --git a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php index 59bd50874..7c7803816 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php @@ -10,6 +10,7 @@ use Chill\MainBundle\Form\Type\ChillDateType; use Chill\MainBundle\Form\Type\ChillTextareaType; use Chill\MainBundle\Templating\TranslatableStringHelper; use Doctrine\ORM\EntityRepository; +use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\Form\AbstractType; @@ -80,6 +81,14 @@ final class AsideActivityFormType extends AbstractType 'required' => true, 'class' => AsideActivityCategory::class, 'placeholder' => 'Choose the activity category', + 'query_builder' => function(EntityRepository $er) { + $qb = $er->createQueryBuilder('ac'); + $qb->where($qb->expr()->eq('ac.isActive', 'TRUE')) + ->addOrderBy('ac.ordering', 'ASC') + ; + + return $qb; + }, 'choice_label' => function (AsideActivityCategory $asideActivityCategory) { $options = []; return $this->categoryRender->renderString($asideActivityCategory, $options); diff --git a/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php b/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php new file mode 100644 index 000000000..ecc1a1f90 --- /dev/null +++ b/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php @@ -0,0 +1,48 @@ +security = $security; + } + + public static function getMenuIds(): array + { + return ['admin_index', 'admin_section', 'admin_aside_activity']; + } + + public function buildMenu($menuId, MenuItem $menu, array $parameters) + { + // all the entries below must have ROLE_ADMIN permissions + if (!$this->security->isGranted('ROLE_ADMIN')) { + return; + } + + if (in_array($menuId, ['admin_index', 'admin_section'])) { + $menu->addChild('Aside activities', [ + 'route' => 'chill_crud_aside_activity_category_index' + ]) + ->setExtras([ + 'order' => 900, + 'explain' => "Configure aside activities categories" + ]); + } else { + $menu + ->addChild('Aside activity categories', [ + 'route' => 'chill_crud_aside_activity_category_index' + ]) + ->setExtras([ + 'order' => '50' + ]); + } + + } +} diff --git a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/Admin/layout_asideactivity.html.twig b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/Admin/layout_asideactivity.html.twig index 08b01cdbd..3f44e432d 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/Admin/layout_asideactivity.html.twig +++ b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/Admin/layout_asideactivity.html.twig @@ -1,9 +1,7 @@ {% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %} {% block vertical_menu_content %} - {{ chill_menu('admin_aside_activity', { - 'layout': '@ChillAsideActivity/Admin/menu_asideactivity.html.twig', - }) }} + {{ chill_menu('admin_aside_activity') }} {% endblock %} {% block layout_wvm_content %} diff --git a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/Admin/menu_asideactivity.html.twig b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/Admin/menu_asideactivity.html.twig deleted file mode 100644 index 34ea309e5..000000000 --- a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/Admin/menu_asideactivity.html.twig +++ /dev/null @@ -1,4 +0,0 @@ -{% extends "@ChillMain/Menu/verticalMenu.html.twig" %} -{% block v_menu_title %} - {{ 'Aside activity configuration menu'|trans }} -{% endblock %} diff --git a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivityCategory/edit.html.twig b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivityCategory/edit.html.twig index dacee767c..3fb6fb612 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivityCategory/edit.html.twig +++ b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivityCategory/edit.html.twig @@ -1,4 +1,4 @@ -{% extends "@ChillActivity/Admin/layout_activity.html.twig" %} +{% extends "@ChillAsideActivity/Admin/layout_asideactivity.html.twig" %} {% block title %} {% include('@ChillMain/CRUD/_edit_title.html.twig') %} diff --git a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivityCategory/index.html.twig b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivityCategory/index.html.twig index d8cb67716..2c8373daf 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivityCategory/index.html.twig +++ b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivityCategory/index.html.twig @@ -1,11 +1,12 @@ {% extends "@ChillAsideActivity/Admin/layout_asideactivity.html.twig" %} {% block admin_content %} -

    {{ 'ActivityType list'|trans }}

    +

    {{ 'Aside Activity Type list'|trans }}

    + @@ -14,7 +15,8 @@ {% for entity in entities %} - + +
    {{ 'Ordering'|trans }} {{ 'Name'|trans }} {{ 'Active'|trans }} {{ 'Actions'|trans }}
    {{ entity.title|localize_translatable_string }}{{ entity.ordering }}{{ entity|chill_entity_render_box }} {%- if entity.isActive -%} diff --git a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivityCategory/new.html.twig b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivityCategory/new.html.twig index d7ac89752..3c8ded234 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivityCategory/new.html.twig +++ b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivityCategory/new.html.twig @@ -1,4 +1,4 @@ -{% extends "@ChillActivity/Admin/layout_activity.html.twig" %} +{% extends "@ChillAsideActivity/Admin/layout_asideactivity.html.twig" %} {% block title %} {% include('@ChillMain/CRUD/_new_title.html.twig') %} diff --git a/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20211004134012.php b/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20211004134012.php new file mode 100644 index 000000000..42763638e --- /dev/null +++ b/src/Bundle/ChillAsideActivityBundle/src/migrations/Version20211004134012.php @@ -0,0 +1,29 @@ +addSql('ALTER TABLE chill_asideactivity.asideactivitycategory ADD ordering DOUBLE PRECISION NOT NULL DEFAULT 0.00'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_asideactivity.asideactivitycategory DROP ordering'); + } +} diff --git a/src/Bundle/ChillMainBundle/Resources/views/Menu/defaultMenu.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Menu/defaultMenu.html.twig index 67a32b98b..6eada4dd6 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Menu/defaultMenu.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Menu/defaultMenu.html.twig @@ -1,5 +1,5 @@ {# - * Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS, + * Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS, / * * This program is free software: you can redistribute it and/or modify @@ -17,7 +17,7 @@ #} \ No newline at end of file + From c41bc7bef962de33b4b1e7cf03b79e84e01aa88d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 4 Oct 2021 16:16:34 +0200 Subject: [PATCH 23/69] prevent recursion --- .../src/Entity/AsideActivityCategory.php | 27 ++++++++++++++++++- .../src/translations/validators.fr.yaml | 1 + 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillAsideActivityBundle/src/translations/validators.fr.yaml diff --git a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php index e405f1556..09087226c 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivityCategory.php @@ -7,6 +7,8 @@ namespace Chill\AsideActivityBundle\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Validator\Constraints as Assert; +use Symfony\Component\Validator\Context\ExecutionContextInterface; /** * @ORM\Entity @@ -83,11 +85,32 @@ class AsideActivityCategory return $this; } - public function getParent(): ?self + public function getParent(): ?self { return $this->parent; } + /** + * + * @Assert\Callback() + */ + public function preventRecursiveParent(ExecutionContextInterface $context, $payload) + { + if (!$this->hasParent()) { + return; + } + + if ($this->getParent() === $this) { + // replace parent with old parent. This prevent recursive loop + // when displaying form + $this->parent = $this->oldParent; + $context->buildViolation('You must not add twice the same category in the parent tree (previous result returned)') + ->atPath('parent') + ->addViolation() + ; + } + } + public function hasParent(): bool { return $this->parent !== null; @@ -95,6 +118,8 @@ class AsideActivityCategory public function setParent(?self $parent): self { + // cache the old result for changing it during validaiton + $this->oldParent = $this->parent; $this->parent = $parent; return $this; diff --git a/src/Bundle/ChillAsideActivityBundle/src/translations/validators.fr.yaml b/src/Bundle/ChillAsideActivityBundle/src/translations/validators.fr.yaml new file mode 100644 index 000000000..28883568c --- /dev/null +++ b/src/Bundle/ChillAsideActivityBundle/src/translations/validators.fr.yaml @@ -0,0 +1 @@ +You must not add twice the same category in the parent tree (previous result returned): Il est interdit d'indiquer la même entité dans l'arbre des parents. Le résultat précédent a été rétabli From ed8a569fea86e69d1a6aa7330db1cdc6c50c9932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 4 Oct 2021 16:30:08 +0200 Subject: [PATCH 24/69] remove obsolete test --- .../Services/ChillMenuTwigFunctionTest.php | 54 ------------------- 1 file changed, 54 deletions(-) delete mode 100644 src/Bundle/ChillMainBundle/Tests/Services/ChillMenuTwigFunctionTest.php diff --git a/src/Bundle/ChillMainBundle/Tests/Services/ChillMenuTwigFunctionTest.php b/src/Bundle/ChillMainBundle/Tests/Services/ChillMenuTwigFunctionTest.php deleted file mode 100644 index a85ff9710..000000000 --- a/src/Bundle/ChillMainBundle/Tests/Services/ChillMenuTwigFunctionTest.php +++ /dev/null @@ -1,54 +0,0 @@ - - * Copyright (C) 2014, Champs Libres Cooperative SCRLFS, - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -namespace Chill\MainBundle\Tests\Services; - -use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -use Symfony\Component\DomCrawler\Crawler; - -/** - * Test the Twig function 'chill_menu' - * - * @author Julien Fastré - */ -class ChillMenuTwigFunctionTest extends KernelTestCase -{ - - private static $templating; - - public static function setUpBeforeClass() - { - self::bootKernel(array('environment' => 'test')); - static::$templating = static::$container - ->get('templating'); - $pathToBundle = static::$container->getParameter('kernel.bundles_metadata')['ChillMainBundle']['path']; - //load templates in Tests/Resources/views - static::$container->get('twig.loader') - ->addPath($pathToBundle.'/Resources/test/views/', $namespace = 'tests'); - } - - public function testNormalMenu() - { - $content = static::$templating->render('@tests/menus/normalMenu.html.twig'); - $this->assertContains('ul', $content, - "test that the file contains an ul tag" - ); - } -} From af4cf550467e4496af8945ab23b0c4c1b36968d6 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 4 Oct 2021 19:33:12 +0200 Subject: [PATCH 25/69] start of entity listener for person name capitalization --- .../Config/services/eventlisteners.yaml | 8 +++++ .../Controller/PersonController.php | 2 +- .../EventListener/PersonCreateEvent.php | 36 +++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillPersonBundle/Config/services/eventlisteners.yaml create mode 100644 src/Bundle/ChillPersonBundle/EventListener/PersonCreateEvent.php diff --git a/src/Bundle/ChillPersonBundle/Config/services/eventlisteners.yaml b/src/Bundle/ChillPersonBundle/Config/services/eventlisteners.yaml new file mode 100644 index 000000000..7a555afd8 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Config/services/eventlisteners.yaml @@ -0,0 +1,8 @@ +services: + Chill\PersonBundle\EventListener\: + autowire: true + autoconfigure: true + tags: + - name: "doctrine.orm.entity_listener" + event: "prePersist" + entity: 'Chill\PersonBundle\Entity\Person' diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonController.php b/src/Bundle/ChillPersonBundle/Controller/PersonController.php index 03da97d5f..570b51f8d 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonController.php @@ -268,7 +268,7 @@ final class PersonController extends AbstractController ) { $this->em->persist($person); - $this->em->flush(); + // $this->em->flush(); $this->lastPostDataReset(); if ($form->get('createPeriod')->isClicked()) { diff --git a/src/Bundle/ChillPersonBundle/EventListener/PersonCreateEvent.php b/src/Bundle/ChillPersonBundle/EventListener/PersonCreateEvent.php new file mode 100644 index 000000000..26413f332 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/EventListener/PersonCreateEvent.php @@ -0,0 +1,36 @@ +em = $em; + } + + public function onPrePersist(LifecycleEventArgs $event): void + { + $person = $event->getObject(); + + if ($person instanceof Person){ + $firstnameCaps = ucfirst(strtolower($person->getFirstName())); + $person->setFirstName($firstnameCaps); + + $lastnameCaps = strtoupper($person->getLastName()); + $person->setLastName($lastnameCaps); + + dump($person); + // $this->em->persist($person); + // $this->em->flush(); + } + } +} \ No newline at end of file From 7d8f38005044b9e0c6c5305ee72f4c9e9c4a3a4a Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 5 Oct 2021 13:57:04 +0200 Subject: [PATCH 26/69] entity listener added to person to capitalize names --- src/Bundle/ChillPersonBundle/Entity/Person.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index 9aaad8c04..61e6f17ed 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -1775,4 +1775,18 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI return $this; } + /** + * @ORM\PrePersist + */ + + public function nameToCaps(): void + { + $firstNameCaps = ucfirst(strtolower($this->firstName)); + $this->setFirstName($firstNameCaps); + + $lastNameCaps = strtoupper($this->lastName); + $this->setLastName($lastNameCaps); + + } + } From 0c4ea8155059ce79ebc1ed4807ac1e89ba9a1cc1 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 6 Oct 2021 12:16:45 +0200 Subject: [PATCH 27/69] eventListener created and tested for firstname, lastname and altnames --- .../Config/services/eventlisteners.yaml | 8 --- .../ChillPersonExtension.php | 1 + .../ChillPersonBundle/Entity/Person.php | 8 +++ .../EventListener/PersonCreateEvent.php | 36 ---------- .../EventListener/PersonEventListener.php | 46 +++++++++++++ .../EventListener/PersonCreateEventTest.php | 68 +++++++++++++++++++ .../services/doctrineEventListener.yaml | 12 ++++ 7 files changed, 135 insertions(+), 44 deletions(-) delete mode 100644 src/Bundle/ChillPersonBundle/Config/services/eventlisteners.yaml delete mode 100644 src/Bundle/ChillPersonBundle/EventListener/PersonCreateEvent.php create mode 100644 src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php create mode 100644 src/Bundle/ChillPersonBundle/config/services/doctrineEventListener.yaml diff --git a/src/Bundle/ChillPersonBundle/Config/services/eventlisteners.yaml b/src/Bundle/ChillPersonBundle/Config/services/eventlisteners.yaml deleted file mode 100644 index 7a555afd8..000000000 --- a/src/Bundle/ChillPersonBundle/Config/services/eventlisteners.yaml +++ /dev/null @@ -1,8 +0,0 @@ -services: - Chill\PersonBundle\EventListener\: - autowire: true - autoconfigure: true - tags: - - name: "doctrine.orm.entity_listener" - event: "prePersist" - entity: 'Chill\PersonBundle\Entity\Person' diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index d597e3572..bc3b798fa 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -84,6 +84,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac $loader->load('services/repository.yaml'); $loader->load('services/serializer.yaml'); $loader->load('services/security.yaml'); + $loader->load('services/doctrineEventListener.yaml'); // load service advanced search only if configure if ($config['search']['search_by_phone'] != 'never') { diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index 61e6f17ed..e202e9404 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -1784,6 +1784,14 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI $firstNameCaps = ucfirst(strtolower($this->firstName)); $this->setFirstName($firstNameCaps); + $altNamesCaps = []; + foreach($this->altNames as $altName) + { + $altNamesCaps[] = ucfirst(strtolower($altName)); + } + + $this->setAltNames($altNamesCaps); + $lastNameCaps = strtoupper($this->lastName); $this->setLastName($lastNameCaps); diff --git a/src/Bundle/ChillPersonBundle/EventListener/PersonCreateEvent.php b/src/Bundle/ChillPersonBundle/EventListener/PersonCreateEvent.php deleted file mode 100644 index 26413f332..000000000 --- a/src/Bundle/ChillPersonBundle/EventListener/PersonCreateEvent.php +++ /dev/null @@ -1,36 +0,0 @@ -em = $em; - } - - public function onPrePersist(LifecycleEventArgs $event): void - { - $person = $event->getObject(); - - if ($person instanceof Person){ - $firstnameCaps = ucfirst(strtolower($person->getFirstName())); - $person->setFirstName($firstnameCaps); - - $lastnameCaps = strtoupper($person->getLastName()); - $person->setLastName($lastnameCaps); - - dump($person); - // $this->em->persist($person); - // $this->em->flush(); - } - } -} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php b/src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php new file mode 100644 index 000000000..bd2f6acd0 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php @@ -0,0 +1,46 @@ +getObjectManager(); + + if($event->getObject() instanceof Person){ + + $person = $event->getObject(); + $firstnameCaps = ucwords(strtolower($person->getFirstName()), " \t\r\n\f\v'-"); + $person->setFirstName($firstnameCaps); + + $lastnameCaps = strtoupper($person->getLastName()); + $person->setLastName($lastnameCaps); + + + $em->persist($person); + $em->flush(); + + } elseif ($event->getObject() instanceof PersonAltName){ + + $altname = $event->getObject(); + $altnameCaps = ucwords(strtolower($altname->getLabel()), " \t\r\n\f\v'-"); + $altname->setLabel($altnameCaps); + + $em->persist($altname); + $em->flush(); + + } else { + + throw new NotFoundHttpException('Entity must be a person or an altname'); + + } + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php b/src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php new file mode 100644 index 000000000..b4d3fb92c --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php @@ -0,0 +1,68 @@ +setFirstName($firstname); + $person->setLastName($lastname); + + $args = $this->createMock(LifecycleEventArgs::class); + $args->method('getObject') + ->willReturn($person); + + $listener->onPrePersist($args); + + $this->assertEquals($firstnameExpected, $person->getFirstName()); + $this->assertEquals($lastnameExpected, $person->getLastName()); + } + + /** + * @dataProvider generateAltNames + */ + public function testAltNamesOnPrePersist($altname, $altnameExpected) + { + $listener = new PersonEventListener(); + + $personAltname = new PersonAltName(); + + $personAltname->setLabel($altname); + + $args = $this->createMock(LifecycleEventArgs::class); + $args->method('getObject') + ->willReturn($personAltname); + + $listener->onPrePersist($args); + + $this->assertEquals($altnameExpected, $personAltname->getLabel()); + } + + public function generateNames(): iterator + { + yield ['julie', 'Julie', 'lenaerts', 'LENAERTS']; + yield ['jean-marie', 'Jean-Marie', 'lenaerts', 'LENAERTS']; + yield ['vinCENT', 'Vincent', 'van gogh', 'VAN GOGH']; + yield ['Vincent', 'Vincent', 'van Gogh', 'VAN GOGH']; + yield ['André marie', 'André Marie', 'Bah', 'BAH']; + } + + public function generateAltNames(): iterator + { + yield ['vinCENT', 'Vincent']; + yield ['jean-marie', 'Jean-Marie']; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/doctrineEventListener.yaml b/src/Bundle/ChillPersonBundle/config/services/doctrineEventListener.yaml new file mode 100644 index 000000000..a73545391 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/config/services/doctrineEventListener.yaml @@ -0,0 +1,12 @@ +services: + Chill\PersonBundle\EventListener\PersonEventListener: + autoconfigure: true + tags: + - + name: 'doctrine.orm.entity_listener' + event: 'prePersist' + entity: 'Chill\PersonBundle\Entity\Person' + - + name: 'doctrine.orm.entity_listener' + event: 'prePersist' + entity: 'Chill\PersonBundle\Entity\PersonAltName' \ No newline at end of file From 72d67624a2107a05536ac4243e39df0b737ca406 Mon Sep 17 00:00:00 2001 From: julielenaerts Date: Wed, 6 Oct 2021 12:49:15 +0200 Subject: [PATCH 28/69] minor fixes --- .../ChillPersonBundle/Entity/Person.php | 22 ------------------- .../services/doctrineEventListener.yaml | 4 ++-- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index e202e9404..9aaad8c04 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -1775,26 +1775,4 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI return $this; } - /** - * @ORM\PrePersist - */ - - public function nameToCaps(): void - { - $firstNameCaps = ucfirst(strtolower($this->firstName)); - $this->setFirstName($firstNameCaps); - - $altNamesCaps = []; - foreach($this->altNames as $altName) - { - $altNamesCaps[] = ucfirst(strtolower($altName)); - } - - $this->setAltNames($altNamesCaps); - - $lastNameCaps = strtoupper($this->lastName); - $this->setLastName($lastNameCaps); - - } - } diff --git a/src/Bundle/ChillPersonBundle/config/services/doctrineEventListener.yaml b/src/Bundle/ChillPersonBundle/config/services/doctrineEventListener.yaml index a73545391..6d038d7a5 100644 --- a/src/Bundle/ChillPersonBundle/config/services/doctrineEventListener.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/doctrineEventListener.yaml @@ -4,9 +4,9 @@ services: tags: - name: 'doctrine.orm.entity_listener' - event: 'prePersist' + event: 'onPrePersist' entity: 'Chill\PersonBundle\Entity\Person' - name: 'doctrine.orm.entity_listener' - event: 'prePersist' + event: 'onPrePersist' entity: 'Chill\PersonBundle\Entity\PersonAltName' \ No newline at end of file From b510d6a7f5bf593c65bff81472de80ddad8f4413 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 6 Oct 2021 14:07:26 +0200 Subject: [PATCH 29/69] option added to distinguish between edit and new action so that modification of activity with uactive type is possible --- .../Controller/ActivityController.php | 2 ++ src/Bundle/ChillActivityBundle/Form/ActivityType.php | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index a454626b7..80bf8bb04 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -256,6 +256,7 @@ class ActivityController extends AbstractController 'role' => new Role('CHILL_ACTIVITY_CREATE'), 'activityType' => $entity->getType(), 'accompanyingPeriod' => $accompanyingPeriod, + 'edit' => false ])->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { @@ -366,6 +367,7 @@ class ActivityController extends AbstractController 'role' => new Role('CHILL_ACTIVITY_UPDATE'), 'activityType' => $entity->getType(), 'accompanyingPeriod' => $accompanyingPeriod, + 'edit' => true ])->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityType.php b/src/Bundle/ChillActivityBundle/Form/ActivityType.php index 8c8fb45a9..3906fadd6 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityType.php @@ -93,7 +93,7 @@ class ActivityType extends AbstractType /** @var \Chill\ActivityBundle\Entity\ActivityType $activityType */ $activityType = $options['activityType']; - if (!$activityType->isActive()) { + if (!$activityType->isActive() && $options['edit'] !== true) { throw new \InvalidArgumentException('Activity type must be active'); } @@ -101,7 +101,9 @@ class ActivityType extends AbstractType if ($options['center']) { $builder->add('scope', ScopePickerType::class, [ 'center' => $options['center'], - 'role' => $options['role'] + 'role' => $options['role'], + // TODO make required again once scope and rights are fixed + 'required' => false ]); } @@ -376,11 +378,12 @@ class ActivityType extends AbstractType ]); $resolver - ->setRequired(['center', 'role', 'activityType', 'accompanyingPeriod']) + ->setRequired(['center', 'role', 'activityType', 'accompanyingPeriod', 'edit']) ->setAllowedTypes('center', ['null', 'Chill\MainBundle\Entity\Center']) ->setAllowedTypes('role', 'Symfony\Component\Security\Core\Role\Role') ->setAllowedTypes('activityType', \Chill\ActivityBundle\Entity\ActivityType::class) ->setAllowedTypes('accompanyingPeriod', [\Chill\PersonBundle\Entity\AccompanyingPeriod::class, 'null']) + ->setAllowedTypes('edit', 'bool') ; } From 7dd42c3fa273a809a7e46045fc5dd71836edb6ae Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 6 Oct 2021 15:52:11 +0200 Subject: [PATCH 30/69] accented letters in majascule --- .../EventListener/PersonEventListener.php | 15 ++++++++------- .../Tests/EventListener/PersonCreateEventTest.php | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php b/src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php index bd2f6acd0..95dcbc888 100644 --- a/src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php +++ b/src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php @@ -13,20 +13,21 @@ class PersonEventListener { public function onPrePersist(LifecycleEventArgs $event): void { - $em = $event->getObjectManager(); + // $em = $event->getObjectManager(); if($event->getObject() instanceof Person){ $person = $event->getObject(); - $firstnameCaps = ucwords(strtolower($person->getFirstName()), " \t\r\n\f\v'-"); + $firstnameCaps = mb_convert_case(mb_strtolower($person->getFirstName()), MB_CASE_TITLE, 'UTF-8'); + $firstnameCaps = ucwords(strtolower($firstnameCaps), " \t\r\n\f\v'-"); $person->setFirstName($firstnameCaps); - $lastnameCaps = strtoupper($person->getLastName()); + $lastnameCaps = mb_strtoupper($person->getLastName(), 'UTF-8'); $person->setLastName($lastnameCaps); - $em->persist($person); - $em->flush(); + // $em->persist($person); + // $em->flush(); } elseif ($event->getObject() instanceof PersonAltName){ @@ -34,8 +35,8 @@ class PersonEventListener $altnameCaps = ucwords(strtolower($altname->getLabel()), " \t\r\n\f\v'-"); $altname->setLabel($altnameCaps); - $em->persist($altname); - $em->flush(); + // $em->persist($altname); + // $em->flush(); } else { diff --git a/src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php b/src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php index b4d3fb92c..b8ab4c0fd 100644 --- a/src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php @@ -52,9 +52,9 @@ class PersonCreateEventTest extends TestCase public function generateNames(): iterator { - yield ['julie', 'Julie', 'lenaerts', 'LENAERTS']; + yield ['émelie-marie', 'Émelie-Marie', 'lenaerts', 'LENAERTS']; yield ['jean-marie', 'Jean-Marie', 'lenaerts', 'LENAERTS']; - yield ['vinCENT', 'Vincent', 'van gogh', 'VAN GOGH']; + yield ['vinCENT', 'Vincent', 'fastré', 'FASTRÉ']; yield ['Vincent', 'Vincent', 'van Gogh', 'VAN GOGH']; yield ['André marie', 'André Marie', 'Bah', 'BAH']; } From 24320cb702df218c44d6d151df748c07966134b8 Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 6 Oct 2021 17:28:07 +0200 Subject: [PATCH 31/69] address: alter postalcode entity --- .../ChillMainBundle/Entity/PostalCode.php | 61 +++++++++++++++++++ .../migrations/Version20211006151653.php | 33 ++++++++++ 2 files changed, 94 insertions(+) create mode 100644 src/Bundle/ChillMainBundle/migrations/Version20211006151653.php diff --git a/src/Bundle/ChillMainBundle/Entity/PostalCode.php b/src/Bundle/ChillMainBundle/Entity/PostalCode.php index 910245680..cd7e8aa5f 100644 --- a/src/Bundle/ChillMainBundle/Entity/PostalCode.php +++ b/src/Bundle/ChillMainBundle/Entity/PostalCode.php @@ -2,6 +2,7 @@ namespace Chill\MainBundle\Entity; +use Chill\MainBundle\Doctrine\Model\Point; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; @@ -62,6 +63,30 @@ class PostalCode */ private $origin = 0; + /** + * @var string + * + * @ORM\Column(type="string", length=255, nullable=true) + * @groups({"write", "read"}) + */ + private $refId; + + /** + * @var string + * + * @ORM\Column(type="string", length=255, nullable=true) + * @groups({"write", "read"}) + */ + private $source; + + /** + * @var Point + * + * @ORM\Column(type="point", nullable=true) + * @groups({"write", "read"}) + */ + private $center; + /** * Get id * @@ -169,5 +194,41 @@ class PostalCode { return $this->country; } + + public function getRefId(): ?string + { + return $this->refId; + } + + public function setRefId(?string $refId): self + { + $this->refId = $refId; + + return $this; + } + + public function getSource(): ?string + { + return $this->source; + } + + public function setSource(?string $source): self + { + $this->source = $source; + + return $this; + } + + public function getCenter(): ?Point + { + return $this->center; + } + + public function setCenter(?Point $center): self + { + $this->center = $center; + + return $this; + } } diff --git a/src/Bundle/ChillMainBundle/migrations/Version20211006151653.php b/src/Bundle/ChillMainBundle/migrations/Version20211006151653.php new file mode 100644 index 000000000..a6a66ce7e --- /dev/null +++ b/src/Bundle/ChillMainBundle/migrations/Version20211006151653.php @@ -0,0 +1,33 @@ +addSql('ALTER TABLE chill_main_postal_code ADD refId VARCHAR(255) DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_main_postal_code ADD source VARCHAR(255) DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_main_postal_code ADD center geometry(POINT,4326) DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_main_postal_code DROP refId'); + $this->addSql('ALTER TABLE chill_main_postal_code DROP source'); + $this->addSql('ALTER TABLE chill_main_postal_code DROP center'); + } +} From 3770318e6a43769110a7f49af2164cb8167649c7 Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 6 Oct 2021 21:48:56 +0200 Subject: [PATCH 32/69] enlarge the loadpostalcode command to more fields --- .../Command/LoadPostalCodesCommand.php | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php index ba51db779..6b047a04b 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php @@ -19,6 +19,8 @@ namespace Chill\MainBundle\Command; +use Chill\MainBundle\Doctrine\Model\Point; +use Chill\MainBundle\Entity\Country; use Doctrine\ORM\EntityManager; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; @@ -69,6 +71,9 @@ class LoadPostalCodesCommand extends Command . "using the postal code and name. \n" . "The CSV file must have the following columns: " . "postal code, label, country code." + . "Optionally, the csv file can have the following " + . "columns after the country code: reference code, latitude, longitude, source. " + . "The latitude and longitude columns are supposed to be in WGS84 and expressed in decimal degrees. " . "The CSV file should not have any header row.") ->addArgument('csv_file', InputArgument::REQUIRED, "the path to " . "the csv file. See the help for specifications.") @@ -137,7 +142,7 @@ class LoadPostalCodesCommand extends Command $output->writeln(''.$num.' were added !'); } - private function getCSVResource(InputInterface $input) + public function getCSVResource(InputInterface $input) { $fs = new Filesystem(); $filename = $input->getArgument('csv_file'); @@ -163,7 +168,7 @@ class LoadPostalCodesCommand extends Command } $em = $this->entityManager; $country = $em - ->getRepository('ChillMainBundle:Country') + ->getRepository(Country::class) ->findOneBy(array('countryCode' => $row[2])); if ($country === NULL) { @@ -173,7 +178,7 @@ class LoadPostalCodesCommand extends Command // try to find an existing postal code $existingPC = $em - ->getRepository('ChillMainBundle:PostalCode') + ->getRepository(PostalCode::class) ->findBy(array('code' => $row[0], 'name' => $row[1])); if (count($existingPC) > 0) { @@ -187,6 +192,18 @@ class LoadPostalCodesCommand extends Command ->setCountry($country) ; + if (NULL != $row[3]){ + $postalCode->setRefId($row[3]); + } + + if (NULL != $row[4] & NULL != $row[5]){ + $postalCode->setCenter(Point::fromLonLat((float) $row[5], (float) $row[4])); + } + + if (NULL != $row[6]){ + $postalCode->setSource($row[6]); + } + $errors = $this->validator->validate($postalCode); if ($errors->count() == 0) { From 9d6958a8358d31a13313accf8cdfbea5ac28725c Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 7 Oct 2021 10:56:10 +0200 Subject: [PATCH 33/69] logic moved to controller instead of form --- .../ChillActivityBundle/Controller/ActivityController.php | 6 ++++-- src/Bundle/ChillActivityBundle/Form/ActivityType.php | 7 +------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 80bf8bb04..8a4a228eb 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -174,6 +174,10 @@ class ActivityController extends AbstractController $activityType = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityType::class) ->find($activityType_id); + if (isset($activityType) && !$activityType->isActive()) { + throw new \InvalidArgumentException('Activity type must be active'); + } + $activityData = null; if ($request->query->has('activityData')) { $activityData = $request->query->get('activityData'); @@ -256,7 +260,6 @@ class ActivityController extends AbstractController 'role' => new Role('CHILL_ACTIVITY_CREATE'), 'activityType' => $entity->getType(), 'accompanyingPeriod' => $accompanyingPeriod, - 'edit' => false ])->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { @@ -367,7 +370,6 @@ class ActivityController extends AbstractController 'role' => new Role('CHILL_ACTIVITY_UPDATE'), 'activityType' => $entity->getType(), 'accompanyingPeriod' => $accompanyingPeriod, - 'edit' => true ])->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityType.php b/src/Bundle/ChillActivityBundle/Form/ActivityType.php index 3906fadd6..5a711408c 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityType.php @@ -93,10 +93,6 @@ class ActivityType extends AbstractType /** @var \Chill\ActivityBundle\Entity\ActivityType $activityType */ $activityType = $options['activityType']; - if (!$activityType->isActive() && $options['edit'] !== true) { - throw new \InvalidArgumentException('Activity type must be active'); - } - // TODO revoir la gestion des center au niveau du form des activité. if ($options['center']) { $builder->add('scope', ScopePickerType::class, [ @@ -378,12 +374,11 @@ class ActivityType extends AbstractType ]); $resolver - ->setRequired(['center', 'role', 'activityType', 'accompanyingPeriod', 'edit']) + ->setRequired(['center', 'role', 'activityType', 'accompanyingPeriod']) ->setAllowedTypes('center', ['null', 'Chill\MainBundle\Entity\Center']) ->setAllowedTypes('role', 'Symfony\Component\Security\Core\Role\Role') ->setAllowedTypes('activityType', \Chill\ActivityBundle\Entity\ActivityType::class) ->setAllowedTypes('accompanyingPeriod', [\Chill\PersonBundle\Entity\AccompanyingPeriod::class, 'null']) - ->setAllowedTypes('edit', 'bool') ; } From aa852ec92469009bfa435531a21f654c1d269206 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 7 Oct 2021 11:13:38 +0200 Subject: [PATCH 34/69] minor changes review: comments removed, logicexception, more test cases passed --- .../EventListener/PersonEventListener.php | 17 +++++------------ .../EventListener/PersonCreateEventTest.php | 2 ++ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php b/src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php index 95dcbc888..68504504f 100644 --- a/src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php +++ b/src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php @@ -7,14 +7,13 @@ namespace Chill\PersonBundle\EventListener; use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\PersonAltName; use Doctrine\Persistence\Event\LifecycleEventArgs; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use LogicException; +use Symfony\Component\Validator\Exception\LogicException as ExceptionLogicException; class PersonEventListener { public function onPrePersist(LifecycleEventArgs $event): void { - // $em = $event->getObjectManager(); - if($event->getObject() instanceof Person){ $person = $event->getObject(); @@ -25,22 +24,16 @@ class PersonEventListener $lastnameCaps = mb_strtoupper($person->getLastName(), 'UTF-8'); $person->setLastName($lastnameCaps); - - // $em->persist($person); - // $em->flush(); - } elseif ($event->getObject() instanceof PersonAltName){ $altname = $event->getObject(); - $altnameCaps = ucwords(strtolower($altname->getLabel()), " \t\r\n\f\v'-"); + $altnameCaps = mb_convert_case(mb_strtolower($altname->getLabel()), MB_CASE_TITLE, 'UTF-8'); + $altnameCaps = ucwords(strtolower($altnameCaps), " \t\r\n\f\v'-"); $altname->setLabel($altnameCaps); - // $em->persist($altname); - // $em->flush(); - } else { - throw new NotFoundHttpException('Entity must be a person or an altname'); + throw new LogicException('Entity must be a person or an altname'); } } diff --git a/src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php b/src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php index b8ab4c0fd..00f2e3ea8 100644 --- a/src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php @@ -63,6 +63,8 @@ class PersonCreateEventTest extends TestCase { yield ['vinCENT', 'Vincent']; yield ['jean-marie', 'Jean-Marie']; + yield ['fastré', 'Fastré']; + yield ['émile', 'Émile']; } } \ No newline at end of file From fd73fac1a83fd353db21056a7de7a6769fa52cb9 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 7 Oct 2021 12:32:26 +0200 Subject: [PATCH 35/69] adapt migration --- .../ChillMainBundle/migrations/Version20211006151653.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/migrations/Version20211006151653.php b/src/Bundle/ChillMainBundle/migrations/Version20211006151653.php index a6a66ce7e..c3853b568 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20211006151653.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20211006151653.php @@ -19,14 +19,14 @@ final class Version20211006151653 extends AbstractMigration public function up(Schema $schema): void { - $this->addSql('ALTER TABLE chill_main_postal_code ADD refId VARCHAR(255) DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_main_postal_code ADD refPostalCodeId VARCHAR(255) DEFAULT NULL'); $this->addSql('ALTER TABLE chill_main_postal_code ADD source VARCHAR(255) DEFAULT NULL'); $this->addSql('ALTER TABLE chill_main_postal_code ADD center geometry(POINT,4326) DEFAULT NULL'); } public function down(Schema $schema): void { - $this->addSql('ALTER TABLE chill_main_postal_code DROP refId'); + $this->addSql('ALTER TABLE chill_main_postal_code DROP refPostalCodeId'); $this->addSql('ALTER TABLE chill_main_postal_code DROP source'); $this->addSql('ALTER TABLE chill_main_postal_code DROP center'); } From 748fe28f8d558fb2c4c504ab009473b75e2c5b12 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 7 Oct 2021 13:42:26 +0200 Subject: [PATCH 36/69] postal code: rename fields to avoid confusion in load fixtures --- .../Command/LoadPostalCodesCommand.php | 4 ++-- .../ChillMainBundle/Entity/PostalCode.php | 20 +++++++++---------- .../migrations/Version20211006151653.php | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php index 6b047a04b..7655c2ed8 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php @@ -193,7 +193,7 @@ class LoadPostalCodesCommand extends Command ; if (NULL != $row[3]){ - $postalCode->setRefId($row[3]); + $postalCode->setRefPostalCodeId($row[3]); } if (NULL != $row[4] & NULL != $row[5]){ @@ -201,7 +201,7 @@ class LoadPostalCodesCommand extends Command } if (NULL != $row[6]){ - $postalCode->setSource($row[6]); + $postalCode->setPostalCodeSource($row[6]); } $errors = $this->validator->validate($postalCode); diff --git a/src/Bundle/ChillMainBundle/Entity/PostalCode.php b/src/Bundle/ChillMainBundle/Entity/PostalCode.php index cd7e8aa5f..8855c40f1 100644 --- a/src/Bundle/ChillMainBundle/Entity/PostalCode.php +++ b/src/Bundle/ChillMainBundle/Entity/PostalCode.php @@ -69,7 +69,7 @@ class PostalCode * @ORM\Column(type="string", length=255, nullable=true) * @groups({"write", "read"}) */ - private $refId; + private $refPostalCodeId; /** * @var string @@ -77,7 +77,7 @@ class PostalCode * @ORM\Column(type="string", length=255, nullable=true) * @groups({"write", "read"}) */ - private $source; + private $postalCodeSource; /** * @var Point @@ -195,26 +195,26 @@ class PostalCode return $this->country; } - public function getRefId(): ?string + public function getRefPostalCodeId(): ?string { - return $this->refId; + return $this->refPostalCodeId; } - public function setRefId(?string $refId): self + public function setRefPostalCodeId(?string $refPostalCodeId): self { - $this->refId = $refId; + $this->refPostalCodeId = $refPostalCodeId; return $this; } - public function getSource(): ?string + public function getPostalCodeSource(): ?string { - return $this->source; + return $this->postalCodeSource; } - public function setSource(?string $source): self + public function setPostalCodeSource(?string $postalCodeSource): self { - $this->source = $source; + $this->postalCodeSource = $postalCodeSource; return $this; } diff --git a/src/Bundle/ChillMainBundle/migrations/Version20211006151653.php b/src/Bundle/ChillMainBundle/migrations/Version20211006151653.php index c3853b568..9f4508ba8 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20211006151653.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20211006151653.php @@ -20,14 +20,14 @@ final class Version20211006151653 extends AbstractMigration public function up(Schema $schema): void { $this->addSql('ALTER TABLE chill_main_postal_code ADD refPostalCodeId VARCHAR(255) DEFAULT NULL'); - $this->addSql('ALTER TABLE chill_main_postal_code ADD source VARCHAR(255) DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_main_postal_code ADD postalCodeSource VARCHAR(255) DEFAULT NULL'); $this->addSql('ALTER TABLE chill_main_postal_code ADD center geometry(POINT,4326) DEFAULT NULL'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE chill_main_postal_code DROP refPostalCodeId'); - $this->addSql('ALTER TABLE chill_main_postal_code DROP source'); + $this->addSql('ALTER TABLE chill_main_postal_code DROP postalCodeSource'); $this->addSql('ALTER TABLE chill_main_postal_code DROP center'); } } From 665b0f8533e35bd83fb762301d72c3966aa837ae Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 7 Oct 2021 13:48:05 +0200 Subject: [PATCH 37/69] postal code: adapt fixtures --- .../DataFixtures/ORM/LoadPostalCodes.php | 404 ++++++++++++++++-- 1 file changed, 364 insertions(+), 40 deletions(-) diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadPostalCodes.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadPostalCodes.php index 6e3d1781b..26ce7415e 100644 --- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadPostalCodes.php +++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadPostalCodes.php @@ -22,6 +22,8 @@ namespace Chill\MainBundle\DataFixtures\ORM; +use Chill\MainBundle\Doctrine\Model\Point; +use Chill\MainBundle\Entity\Country; use Doctrine\Common\DataFixtures\AbstractFixture; use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Persistence\ObjectManager; @@ -40,21 +42,41 @@ class LoadPostalCodes extends AbstractFixture implements OrderedFixtureInterface return 50; } - public static $refs = array(); + public static $refs = []; public function load(ObjectManager $manager) { - $lines = str_getcsv(self::$codes, "\n"); - $belgium = $manager->getRepository('ChillMainBundle:Country') - ->findOneBy(array('countryCode' => 'BE')); + echo "loading postal codes... \n"; + $this->loadPostalCodeCSV($manager, self::$postalCodeBelgium, 'BE'); + $this->loadPostalCodeCSV($manager, self::$postalCodeFrance, 'FR'); + } + + private function loadPostalCodeCSV(ObjectManager $manager, string $csv, string $countryCode) { + + $lines = str_getcsv($csv, "\n"); + $country = $manager->getRepository(Country::class) + ->findOneBy(['countryCode' => $countryCode]); foreach($lines as $line) { $code = str_getcsv($line); $c = new PostalCode(); - $c->setCountry($belgium) + $c->setCountry($country) ->setCode($code[0]) - ->setName(\ucwords(\strtolower($code[2]))) + ->setName(\ucwords(\strtolower($code[1]))) ; + + if (NULL != $code[3]){ + $c->setRefPostalCodeId($code[3]); + } + + if (NULL != $code[4] & NULL != $code[5]){ + $c->setCenter(Point::fromLonLat((float) $code[5], (float) $code[4])); + } + + if (NULL != $code[6]){ + $c->setPostalCodeSource($code[6]); + } + $manager->persist($c); $ref = 'postal_code_'.$code[0]; @@ -66,40 +88,342 @@ class LoadPostalCodes extends AbstractFixture implements OrderedFixtureInterface $manager->flush(); } - - private static $codes = << Date: Thu, 7 Oct 2021 15:50:35 +0200 Subject: [PATCH 38/69] changelog updated --- src/Bundle/ChillActivityBundle/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Bundle/ChillActivityBundle/CHANGELOG.md b/src/Bundle/ChillActivityBundle/CHANGELOG.md index 871ead4bd..6261aa1db 100644 --- a/src/Bundle/ChillActivityBundle/CHANGELOG.md +++ b/src/Bundle/ChillActivityBundle/CHANGELOG.md @@ -27,3 +27,4 @@ Version 1.5.5 ============= - [activity] replace dropdown for selecting reasons and use chillEntity for reason rendering +- fix bug: error when trying to edit activity of which the type has been deactivated From fb05d892a2cc95e3a1162174353d37f2468dfe8c Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 7 Oct 2021 16:09:17 +0200 Subject: [PATCH 39/69] reorganization of files --- .../public/module/disable-buttons/index.js | 13 +++++++++++++ src/Bundle/ChillMainBundle/chill.webpack.config.js | 1 + .../Resources/views/Person/create.html.twig | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/disable-buttons/index.js diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/disable-buttons/index.js b/src/Bundle/ChillMainBundle/Resources/public/module/disable-buttons/index.js new file mode 100644 index 000000000..2bbc33497 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/public/module/disable-buttons/index.js @@ -0,0 +1,13 @@ +/** + * Submit buttons are disabled as soon as submit button is clicked and form is submitted. + */ + +var submitButtons = document.querySelectorAll("[type=submit]"); +var form = document.getElementById('create-form'); + + for(var i=0; i {% endif %} - {{ form_start(form) }} + {{ form_start(form, {'attr' : {'id' : 'create-form'}}) }} {{ form_row(form.lastName, { 'label' : 'Last name'|trans }) }} From d524897838dc7a89e09e07f8a1edf8e4ecd35ccd Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 7 Oct 2021 16:57:22 +0200 Subject: [PATCH 40/69] entrypoint added to webpack and js included in create template for person --- .../public/module/disable-buttons/index.js | 17 ++++++++++------- .../Resources/views/Person/create.html.twig | 4 ++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/disable-buttons/index.js b/src/Bundle/ChillMainBundle/Resources/public/module/disable-buttons/index.js index 2bbc33497..c6ec7c789 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/disable-buttons/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/module/disable-buttons/index.js @@ -1,13 +1,16 @@ /** - * Submit buttons are disabled as soon as submit button is clicked and form is submitted. + * Submit button(s) are disabled as soon as submit button is clicked and form is submitted. + * ID 'create-form' must be added to submit forms. */ -var submitButtons = document.querySelectorAll("[type=submit]"); var form = document.getElementById('create-form'); +var submitButtons = document.querySelectorAll("[type=submit]"); +form.addEventListener('submit', function(e){ for(var i=0; i {% endblock content %} + +{% block js %} + {{ encore_entry_script_tags('mod_disablebuttons') }} +{% endblock js %} From 8fca704f74f350d4e9a6de839488d308e79a8b1f Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 7 Oct 2021 17:05:09 +0200 Subject: [PATCH 41/69] adjustment so that altnames are fully capitalized --- .../EventListener/PersonEventListener.php | 3 +-- .../Tests/EventListener/PersonCreateEventTest.php | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php b/src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php index 68504504f..6c9b746d7 100644 --- a/src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php +++ b/src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php @@ -27,8 +27,7 @@ class PersonEventListener } elseif ($event->getObject() instanceof PersonAltName){ $altname = $event->getObject(); - $altnameCaps = mb_convert_case(mb_strtolower($altname->getLabel()), MB_CASE_TITLE, 'UTF-8'); - $altnameCaps = ucwords(strtolower($altnameCaps), " \t\r\n\f\v'-"); + $altnameCaps = mb_strtoupper($altname->getLabel(), 'UTF-8'); $altname->setLabel($altnameCaps); } else { diff --git a/src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php b/src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php index 00f2e3ea8..c8690a237 100644 --- a/src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/EventListener/PersonCreateEventTest.php @@ -61,10 +61,9 @@ class PersonCreateEventTest extends TestCase public function generateAltNames(): iterator { - yield ['vinCENT', 'Vincent']; - yield ['jean-marie', 'Jean-Marie']; - yield ['fastré', 'Fastré']; - yield ['émile', 'Émile']; + yield ['vinCENT', 'VINCENT']; + yield ['jean-marie', 'JEAN-MARIE']; + yield ['fastré', 'FASTRÉ']; + yield ['émile', 'ÉMILE']; } - } \ No newline at end of file From 2d4b6d1dd16c9cca5c615c59336b092073a518f9 Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 8 Oct 2021 12:14:45 +0200 Subject: [PATCH 42/69] minor correction following MR review + Changelog --- CHANGELOG.md | 2 ++ .../ChillMainBundle/Command/LoadPostalCodesCommand.php | 2 +- src/Bundle/ChillMainBundle/Entity/PostalCode.php | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9050e6e1c..5a490010a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ and this project adheres to ## Unreleased +* add 3 new fields to PostalCode and adapt postal code command and fixtures + * [Aside activity] Fixes for aside activity * categories with child diff --git a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php index 7655c2ed8..21090a61f 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php @@ -142,7 +142,7 @@ class LoadPostalCodesCommand extends Command $output->writeln(''.$num.' were added !'); } - public function getCSVResource(InputInterface $input) + private function getCSVResource(InputInterface $input) { $fs = new Filesystem(); $filename = $input->getArgument('csv_file'); diff --git a/src/Bundle/ChillMainBundle/Entity/PostalCode.php b/src/Bundle/ChillMainBundle/Entity/PostalCode.php index 8855c40f1..91ce46e17 100644 --- a/src/Bundle/ChillMainBundle/Entity/PostalCode.php +++ b/src/Bundle/ChillMainBundle/Entity/PostalCode.php @@ -67,7 +67,7 @@ class PostalCode * @var string * * @ORM\Column(type="string", length=255, nullable=true) - * @groups({"write", "read"}) + * @groups({"read"}) */ private $refPostalCodeId; @@ -75,7 +75,7 @@ class PostalCode * @var string * * @ORM\Column(type="string", length=255, nullable=true) - * @groups({"write", "read"}) + * @groups({"read"}) */ private $postalCodeSource; @@ -83,7 +83,7 @@ class PostalCode * @var Point * * @ORM\Column(type="point", nullable=true) - * @groups({"write", "read"}) + * @groups({"read"}) */ private $center; From 3a07fa4faf8f04868df5cde8c29d1f97e601d1c8 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 4 Oct 2021 17:22:08 +0200 Subject: [PATCH 43/69] resume short list style abstraction for accourse-work and activities (wip) --- .../Resources/public/chill/chillactivity.scss | 32 ++++++- .../Resources/views/Activity/list.html.twig | 12 +-- .../views/Activity/recent_list.html.twig | 46 +++++++++ .../Resources/views/Activity/show.html.twig | 2 +- .../Resources/public/chill/chillperson.scss | 2 + .../chill/scss/accompanying_period_work.scss | 56 +++++++---- .../Resources/public/chill/scss/mixins.scss | 4 +- .../views/AccompanyingCourse/index.html.twig | 96 +------------------ .../AccompanyingCourseWork/index.html.twig | 2 +- .../list_by_accompanying_period.html.twig | 4 +- ...cent_list_by_accompanying_period.html.twig | 32 +++++++ 11 files changed, 160 insertions(+), 128 deletions(-) create mode 100644 src/Bundle/ChillActivityBundle/Resources/views/Activity/recent_list.html.twig create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/recent_list_by_accompanying_period.html.twig diff --git a/src/Bundle/ChillActivityBundle/Resources/public/chill/chillactivity.scss b/src/Bundle/ChillActivityBundle/Resources/public/chill/chillactivity.scss index 528d75ded..b2e36b2bf 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/chill/chillactivity.scss +++ b/src/Bundle/ChillActivityBundle/Resources/public/chill/chillactivity.scss @@ -21,9 +21,9 @@ div.new-activity-select-type { } } -// exceptions for flex-table in list-records +// exceptions for flex-table div.activity-list { - div.flex-table { + &.flex-table { div.item-bloc { div.item-row.main { div.item-col { @@ -86,7 +86,6 @@ div.activity-list { } } } - } ul.list-content { list-style-type: none; @@ -103,6 +102,32 @@ div.activity-list { margin-top: 1em; } } + + /// Activities on resume page + h2.badge-title { + span.title_label { + background-color: #668821; + div.duration { + font-size: 70%; + font-weight: 500; + p { + margin-bottom: 0; + text-align: right; + } + } + } + span.title_action { + //text-transform: capitalize !important; + font-weight: 500 !important; + border-left: 20px groove yellowgreen; + &:before { + content: '\f04b'; + font-family: ForkAwesome; + color: yellowgreen; + margin: 0 0 0 -1.05em; + } + } + } } // exceptions for flex-bloc in concerned-groups @@ -130,7 +155,6 @@ div.flex-bloc.concerned-groups { } } - /// CHILL ENTITY RENDER BOX .chill-entity { diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig index c227f5539..0e661c224 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig @@ -1,4 +1,4 @@ -
    +
    {% if activities|length == 0 %}

    @@ -7,7 +7,7 @@

    {% else %} -
    +
    {% for activity in activities %} {% set t = activity.type %}
    @@ -102,12 +102,8 @@
  • - {{ 'location'|trans ~ ': ' }} - Domicile de l'usager - - {# TODO {% if activity.location %}{{ activity.location }}{% endif %} - #} - + {{ 'location'|trans ~ ': ' }} Domicile de l'usager + {# TODO {% if activity.location %}{{ activity.location }}{% endif %} #}
  • {%- if t.reasonsVisible -%} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/recent_list.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/recent_list.html.twig new file mode 100644 index 000000000..f62271bb5 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/recent_list.html.twig @@ -0,0 +1,46 @@ +
    + {% for activity in activities | slice(0,5) %} + {% set t = activity.type %} + + + +

    + + {% if activity.date %} +

    {{ activity.date|format_date('short') }}

    + {% endif %} +
    + {% if activity.durationTime and t.durationTimeVisible %} +

    + + {{ activity.durationTime|date('H:i') }} +

    + {% endif %} + {% if activity.travelTime and t.travelTimeVisible %} +

    + + {{ activity.travelTime|date('H:i') }} +

    + {% endif %} +
    +
    + + {{ activity.type.name | localize_translatable_string }} +
      +
    • + {{ 'location'|trans ~ ': ' }} + {# TODO {% if activity.location %}{{ activity.location }}{% endif %} #} + Domicile de l'usager +
    • + {% if activity.user and t.userVisible %} +
    • + {{ 'Referrer'|trans ~ ': ' }} + {{ activity.user.usernameCanonical }} +
    • + {% endif %} +
    +
    +

    + + {% endfor %} +
    diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig index 1f54692d9..eba074e07 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig @@ -73,7 +73,7 @@ {% endif %} {% if t.travelTimeVisible %} -
    {{ 'Travel Time'|trans }}
    +
    {{ 'Travel time'|trans }}
    {% if entity.travelTime is not null %} {{ entity.travelTime|date('H:i') }} {% else %} diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss index 094a2eb0a..2b389239e 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss +++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss @@ -248,8 +248,10 @@ span.fa-holder { } } +/// div.accompanyingcourse-resume { div.associated-persons { + font-size: 110%; span.household { display: inline-block; border-radius: 8px; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/accompanying_period_work.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/accompanying_period_work.scss index e4d84a7a4..95138bb0b 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/accompanying_period_work.scss +++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/accompanying_period_work.scss @@ -1,28 +1,49 @@ +/// Display Title like a badge (with background-colored label) +h2.badge-title { + display: flex; + flex-direction: row; + width: 100%; + color: $dark; + + a & { + text-decoration: none; + } + + span.title_label { + border-radius: 0.35rem 0 0 0.35rem; + color: $white; + font-size: 80%; + padding: 0.5em; + padding-right: 0; + } + span.title_action { + flex-grow: 1; + margin: 0 0 0 auto; + border-radius: 0 0.35rem 0.35rem 0; + background-color: $light; + padding: 0.2em 1em; + + ul.small_in_title { + margin-top: 0.5em; + font-size: 70%; + padding-left: 1rem; + } + } +} + + /// AccompanyingCourse Work list Page div.accompanying_course_work-list { - h2.title { - display: flex; - flex-direction: row; - width: 100%; - color: $dark; - //height: 40px; - + h2.badge-title { span.title_label { - border-radius: 0.35rem 0 0 0.35rem; background-color: $social-action-label-color; - color: $white; - font-size: 80%; - padding: 0.5em; - padding-right: 0; } span.title_action { - flex-grow: 1; - margin: 0 0 0 auto; - border-radius: 0 0.35rem 0.35rem 0; - background-color: $light; - padding: 0.2em 0.7em; @include badge_social_action; + &:before { + margin: 0 0.3em 0 -1.05em !important; + } } } @@ -140,4 +161,3 @@ div.accompanying_course_work-list { } } - diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/mixins.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/mixins.scss index 4ff1d72bc..517530197 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/mixins.scss +++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/mixins.scss @@ -15,7 +15,7 @@ $social-action-label-color: shade-color($orange, 34%); /// @mixin badge_social_issue { - text-transform: capitalize !important; + //text-transform: capitalize !important; font-weight: 500 !important; border-left: 20px groove $social-issue-color; &:before { @@ -32,7 +32,7 @@ $social-action-label-color: shade-color($orange, 34%); /// @mixin badge_social_action { - text-transform: capitalize !important; + //text-transform: capitalize !important; font-weight: 500 !important; border-left: 20px groove $social-action-color; &:before { diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index 55a9505f9..52d648091 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -71,7 +71,7 @@
    {% if accompanyingCourse.locationStatus == 'person' %} -
    {{ 'This course is located by'|trans }}
    +

    {{ 'This course is located by'|trans }}

    {{ accompanyingCourse.personLocation|chill_entity_render_string }}

    {% elseif accompanyingCourse.locationStatus == 'address' %}

    {{ 'This course has a temporarily location'|trans }}

    @@ -82,97 +82,9 @@ {% endif %}
    - - {# DISABLED -

    {{ 'Resume Accompanying Course'|trans }}

    - -
    -

    {{ 'Associated peoples'|trans }}

    -
    - {% for participation in accompanyingCourse.participations %} - {% if participation.enddate is null %} -
    - {{ participation.person|chill_entity_render_box({ - 'render': 'bloc', 'addLink': false, 'addInfo': true, 'addAltNames': false, - 'customButtons': { 'before': _self.button_person(participation.person) } - }) }} -
    - {% endif %} - {% endfor %} -
    -
    - -
    -

    {{ 'Accompanying course location'|trans }}

    - - {% if accompanyingCourse.locationStatus == 'person' %} -

    {{ 'This course is located by'|trans }} - {{ accompanyingCourse.personLocation|chill_entity_render_string }} -

    - {% elseif accompanyingCourse.locationStatus == 'address' %} -

    {{ 'This course has a temporarily location'|trans }}

    - {% endif %} - - {% if accompanyingCourse.locationStatus != 'none' %} -
    -
    - {{ accompanyingCourse.location|chill_entity_render_box }} -
    -
    - {% endif %} -
    - -
    -

    {{ 'Requestor'|trans }}

    - {% if accompanyingCourse.requestorPerson is not empty %} - {% set requestor = accompanyingCourse.requestorPerson %} - {% set info = true %} - {% elseif accompanyingCourse.requestor is not empty %} - {% set requestor = accompanyingCourse.requestorThirdParty %} - {% set info = false %} - {% endif %} - {% if accompanyingCourse.requestor == null %} -

    {{ 'Any requestor to this accompanying course'|trans }}

    - {% else %} -
    -
    - {{ requestor|chill_entity_render_box({ - 'render': 'bloc', 'addLink': false, 'addEntity': true, 'addInfo': info, 'addAltNames': false - }) }} -
    -
    - {% endif %} -
    - -
    -

    {{ 'Resources'|trans }}

    - {% if accompanyingCourse.resources|length == 0 %} -

    {{ 'Any resource for this accompanying course'|trans }}

    - {% else %} -
    - {% for r in accompanyingCourse.resources %} -
    - {% if r.person %} - {{ r.person|chill_entity_render_box({ - 'render': 'bloc', 'addLink': false, 'addEntity': true, 'addInfo': true, 'addAltNames': false - }) }} - {% endif %} - {% if r.thirdParty %} - {{ r.thirdParty|chill_entity_render_box({ - 'render': 'bloc', 'addLink': false, 'addEntity': true, 'addInfo': false - }) }} - {% endif %} -
    - {% endfor %} -
    - {% endif %} -
    - #} -
    - {% block contentActivity %} @@ -189,9 +101,9 @@ {% set accompanying_course_id = accompanyingCourse.id %} {% endif %} -

    {{ 'Activity list' |trans }}

    +

    {{ 'Activity list' |trans }}

    - {% include 'ChillActivityBundle:Activity:list.html.twig' with { 'context': 'accompanyingCourse', 'no_action': true } %} + {% include 'ChillActivityBundle:Activity:recent_list.html.twig' with { 'context': 'accompanyingCourse', 'no_action': true } %}
    {% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/index.html.twig index ddeea92e9..92b1919af 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/index.html.twig @@ -7,7 +7,7 @@

    {{ block('title') }}

    - {% include 'ChillPersonBundle:AccompanyingCourseWork:list_by_accompanying_period.html.twig' with {'render': 'list'} %} + {% include 'ChillPersonBundle:AccompanyingCourseWork:list_by_accompanying_period.html.twig' %}
    • diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/list_by_accompanying_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/list_by_accompanying_period.html.twig index 01b7c9b2b..f0f0a051e 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/list_by_accompanying_period.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/list_by_accompanying_period.html.twig @@ -5,12 +5,12 @@

      {% endif %} -
      +
      {% for w in works %}
      -

      +

      {{ 'accompanying_course_work.action'|trans }} {{ w.socialAction|chill_entity_render_string }}

      diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/recent_list_by_accompanying_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/recent_list_by_accompanying_period.html.twig new file mode 100644 index 000000000..61f48aa76 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/recent_list_by_accompanying_period.html.twig @@ -0,0 +1,32 @@ + {% if works|length == 0 %} +

      {{ 'accompanying_course_work.Any work'|trans }} + {# TODO link #} +

      + {% endif %} + +
      + {% for w in works | slice(0,5) %} + + +

      + {{ 'accompanying_course_work.action'|trans }} + {{ w.socialAction|chill_entity_render_string }} + +
        +
      • + {{ 'accompanying_course_work.start_date'|trans ~ ' : ' }} + {{ w.startDate|format_date('short') }} +
      • +
      • + {{ 'Last updated by'|trans ~ ' : ' }} + {{ w.updatedBy|chill_entity_render_box }}, {{ w.updatedAt|format_datetime('short', 'short') }} +
      • +
      + +
      +

      + {% endfor %} +
      + + From 84189faae6c05b249aea6817424d1b0957b8756e Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 4 Oct 2021 20:44:45 +0200 Subject: [PATCH 44/69] Translation for Last Items --- src/Bundle/ChillActivityBundle/translations/messages.fr.yml | 2 ++ .../Resources/views/AccompanyingCourse/index.html.twig | 4 ++-- src/Bundle/ChillPersonBundle/translations/messages.fr.yml | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 679004e2e..fd7dc64f8 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -210,3 +210,5 @@ Group by reasons: Sujet d'activité Aggregate by activity user: Aggréger par utilisateur lié à l'activité Aggregate by activity type: Aggréger par type d'activité Aggregate by activity reason: Aggréger par sujet de l'activité + +Last activities: Les dernières activités diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index 52d648091..0204b147f 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -83,7 +83,7 @@
      @@ -101,7 +101,7 @@ {% set accompanying_course_id = accompanyingCourse.id %} {% endif %} -

      {{ 'Activity list' |trans }}

      +

      {{ 'Last activities' |trans }}

      {% include 'ChillActivityBundle:Activity:recent_list.html.twig' with { 'context': 'accompanyingCourse', 'no_action': true } %}
      diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 0b6cb8e8f..a17bbc55f 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -191,6 +191,7 @@ Associated peoples: Usagers concernés Resources: Interlocuteurs privilégiés Any requestor to this accompanying course: Aucun demandeur pour ce parcours Social actions: Actions d'accompagnement +Last social actions: Les dernières actions d'accompagnement Social issues: Problématiques sociales Last events on accompanying course: Dernières actions de suivi Edit & activate accompanying course: Modifier et valider @@ -380,7 +381,7 @@ Create Accompanying Course: Créer un nouveau parcours Drop Accompanying Course: Supprimer le parcours This course is located at a temporarily address. You should locate this course to an user: Le parcours est localisé à une adresse temporaire. Il devrait être localisé auprès d'une personne concernée. Accompanying course location: Localisation du parcours -This course is located by: Parcours localisé auprès de +This course is located by: Localisé auprès de This course has a temporarily location: Localisation temporaire Choose a person to locate by: Localiser auprès d'un usager concerné Associate at least one member with an household, and set an address to this household: Associez au moins un membre du parcours à un ménage, et indiquez une adresse à ce ménage. From 52c1a01980926d39dadc4584585e2ac232288028 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 5 Oct 2021 16:20:15 +0200 Subject: [PATCH 45/69] Refactoring sass chill colors variables and badge mixins --- .../Resources/public/chill/chillactivity.scss | 26 ---- .../Resources/public/chill/chillmain.scss | 3 + .../public/chill/scss/chill_variables.scss | 13 ++ .../Resources/public/chill/scss/mixins.scss | 2 - .../Resources/public/chill/chillperson.scss | 66 ++-------- .../chill/scss/accompanying_period_work.scss | 48 +------- .../Resources/public/chill/scss/badge.scss | 115 ++++++++++++++++++ .../Resources/public/chill/scss/mixins.scss | 49 ++++---- .../public/chill/scss/render_box.scss | 4 +- .../components/Banner/SocialIssue.vue | 4 +- .../components/SocialIssue.vue | 4 +- 11 files changed, 173 insertions(+), 161 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Resources/public/chill/scss/chill_variables.scss create mode 100644 src/Bundle/ChillPersonBundle/Resources/public/chill/scss/badge.scss diff --git a/src/Bundle/ChillActivityBundle/Resources/public/chill/chillactivity.scss b/src/Bundle/ChillActivityBundle/Resources/public/chill/chillactivity.scss index b2e36b2bf..10d94f667 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/chill/chillactivity.scss +++ b/src/Bundle/ChillActivityBundle/Resources/public/chill/chillactivity.scss @@ -102,32 +102,6 @@ div.activity-list { margin-top: 1em; } } - - /// Activities on resume page - h2.badge-title { - span.title_label { - background-color: #668821; - div.duration { - font-size: 70%; - font-weight: 500; - p { - margin-bottom: 0; - text-align: right; - } - } - } - span.title_action { - //text-transform: capitalize !important; - font-weight: 500 !important; - border-left: 20px groove yellowgreen; - &:before { - content: '\f04b'; - font-family: ForkAwesome; - color: yellowgreen; - margin: 0 0 0 -1.05em; - } - } - } } // exceptions for flex-bloc in concerned-groups diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss index 436f764dd..593cd49b4 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss @@ -1,6 +1,9 @@ // Access to Bootstrap variables and mixins @import '~ChillMainAssets/module/bootstrap/shared'; +// Chill variables +@import './scss/chill_variables'; + // Chill mixins @import './scss/mixins'; diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/chill_variables.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/chill_variables.scss new file mode 100644 index 000000000..61d975b42 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/chill_variables.scss @@ -0,0 +1,13 @@ +/* +* ADDITIONNAL COLORS VARIABLES +*/ + +// Contexts banners +$chill-person-context: $chill-green; +$chill-accourse-context: #718596; +$chill-household-context: #929d69; + +// Badges colors +$social-issue-color: #4bafe8; +$social-action-color: $orange; +$activity-color: yellowgreen; diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/mixins.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/mixins.scss index 9b4650087..ef874c274 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/mixins.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/mixins.scss @@ -1,4 +1,3 @@ - // // Titles in forms // @@ -12,7 +11,6 @@ display: block; } - // We use box-shadow instead of border // to avoid to manage border double-width // Then we can simulate border-collapse: collapse (table) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss index 2b389239e..8f0ae64b2 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss +++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss @@ -1,10 +1,13 @@ // Access to Bootstrap variables and mixins @import '~ChillMainAssets/module/bootstrap/shared'; +@import 'ChillMainAssets/chill/scss/chill_variables'; + // Complete/override Main generic assets @import './scss/mixins'; @import './scss/render_box.scss'; @import './scss/flex_table.scss'; +@import './scss/badge.scss'; // Specific templates styles @import './scss/accompanying_period_work.scss'; @@ -19,13 +22,13 @@ div.banner { div#header-person-name { - background: none repeat scroll 0 0 $chill-green-dark; + background: none repeat scroll 0 0 shade-color($chill-person-context, 20%); color: $white; padding-top: 1em; padding-bottom: 1em; } div#header-person-details { - background: none repeat scroll 0 0 $chill-green; + background: none repeat scroll 0 0 $chill-person-context; color: $white; padding-top: 1em; padding-bottom: 1em; @@ -92,7 +95,6 @@ div.person-view { * Header custom for Accompanying Course */ -$chill-accourse-context: #718596; div.banner { div#header-accompanying_course-name { @@ -104,9 +106,9 @@ div.banner { span { a { color: $white; - } - a:hover { - text-decoration: underline; + &:hover { + text-decoration: underline; + } } } } @@ -118,7 +120,7 @@ div.banner { } } -abbr.referrer { +abbr.referrer { // still used ? font-size: 70%; padding-right: 0.4em; align-self: center; // in flex context @@ -129,8 +131,6 @@ abbr.referrer { * Header custom for Household */ -$chill-household-context: #929d69; - div.banner { div#header-household-name { background: none repeat scroll 0 0 $chill-household-context; @@ -142,9 +142,9 @@ div.banner { span { a { color: $white; - } - a:hover { - text-decoration: underline; + &:hover { + text-decoration: underline; + } } } div.household-members { @@ -208,47 +208,7 @@ div.household-resume { } } -/* -* BADGES, MARKS, PINS -* for chill person theme -*/ - -// chill person badges -span.badge-person, -span.badge-thirdparty { - display: inline-block; - padding: 0 0.5em !important; - background-color: $white; - color: $dark; - border: 1px solid $chill-ll-gray; - border-bottom-width: 2px; - border-bottom-style: solid; - border-radius: 6px; - a { - text-decoration: none; - } -} -span.badge-person { - border-bottom-color: $chill-green; -} -// todo: move in thirdparty -span.badge-thirdparty { - border-bottom-color: shade-color($chill-pink, 10%); -} - -// household holder mark -span.fa-holder { - width: 1em; - margin: -10px 0.3em -8px 0; - i:last-child { - font-weight: 900; - color: white; - font-size: 70%; - font-family: "Open Sans Extrabold"; - } -} - -/// +/// Horizontal list of persons (Accourse resume page) div.accompanyingcourse-resume { div.associated-persons { font-size: 110%; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/accompanying_period_work.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/accompanying_period_work.scss index 95138bb0b..29267ad75 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/accompanying_period_work.scss +++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/accompanying_period_work.scss @@ -1,52 +1,6 @@ -/// Display Title like a badge (with background-colored label) -h2.badge-title { - display: flex; - flex-direction: row; - width: 100%; - color: $dark; - - a & { - text-decoration: none; - } - - span.title_label { - border-radius: 0.35rem 0 0 0.35rem; - color: $white; - font-size: 80%; - padding: 0.5em; - padding-right: 0; - } - span.title_action { - flex-grow: 1; - margin: 0 0 0 auto; - border-radius: 0 0.35rem 0.35rem 0; - background-color: $light; - padding: 0.2em 1em; - - ul.small_in_title { - margin-top: 0.5em; - font-size: 70%; - padding-left: 1rem; - } - } -} - - /// AccompanyingCourse Work list Page div.accompanying_course_work-list { - h2.badge-title { - span.title_label { - background-color: $social-action-label-color; - } - span.title_action { - @include badge_social_action; - &:before { - margin: 0 0.3em 0 -1.05em !important; - } - } - } - div.timeline { width: 100%; ul { @@ -146,7 +100,7 @@ div.accompanying_course_work-list { } } &.goal_title li::marker { - color: $sky-blue; + color: $social-issue-color; } &.result_list li::marker { color: $pink; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/badge.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/badge.scss new file mode 100644 index 000000000..2c379b5a2 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/badge.scss @@ -0,0 +1,115 @@ +/* +* BADGES, MARKS, PINS +* for chill person theme +*/ + +// chill person badges +span.badge-person, +span.badge-thirdparty { + display: inline-block; + padding: 0 0.5em !important; + background-color: $white; + color: $dark; + border: 1px solid $chill-ll-gray; + border-bottom-width: 2px; + border-bottom-style: solid; + border-radius: 6px; + a { + text-decoration: none; + } +} + + span.badge-person { + border-bottom-color: $chill-green; + } + + // todo: move in thirdparty + span.badge-thirdparty { + border-bottom-color: shade-color($chill-pink, 10%); + } + +/* +* HOUSEHOLD HOLDER MARK +*/ + +span.fa-holder { + width: 1em; + margin: -10px 0.3em -8px 0; + i:last-child { + font-family: "Open Sans Extrabold"; + font-weight: 900; + font-size: 70%; + color: $white; + } +} + +/* +* BADGE_TITLE +* Display Title like a badge (with background-colored label) +*/ + +h2.badge-title { + display: flex; + flex-direction: row; + width: 100%; + color: $dark; + + a & { text-decoration: none; } // ?!? keep it ? + + span.title_label { + border-radius: 0.35rem 0 0 0.35rem; + color: $white; + font-size: 80%; + padding: 0.5em; + padding-right: 0; + } + span.title_action { + flex-grow: 1; + margin: 0 0 0 auto; + border-radius: 0 0.35rem 0.35rem 0; + background-color: $light; + padding: 0.2em 1em; + + ul.small_in_title { + margin-top: 0.5em; + font-size: 70%; + padding-left: 1rem; + } + } +} + + /// AccompanyingCourse Work list Page + div.accompanying_course_work-list { + h2.badge-title { + span.title_label { + // Calculate same color then border:groove + background-color: shade-color($social-action-color, 34%); + } + span.title_action { + @include badge_title($social-action-color); + } + } + } + + /// Activities on resume page + div.activity-list { + h2.badge-title { + span.title_label { + // Calculate same color then border:groove + background-color: shade-color($activity-color, 34%); + } + span.title_action { + @include badge_title($activity-color); + } + span.title_label { + div.duration { + font-size: 70%; + font-weight: 500; + p { + margin-bottom: 0; + text-align: right; + } + } + } + } + } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/mixins.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/mixins.scss index 517530197..878ff82e1 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/mixins.scss +++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/mixins.scss @@ -1,44 +1,39 @@ -// Additionnal colors -$sky-blue: #4bafe8; - -// mixins variables -$social-issue-color: $sky-blue; -$social-action-color: $orange; - -// Calculate same color then border:groove -// origin: $orange, computed: #965028 -$social-action-label-color: shade-color($orange, 34%); - /// -/// Social Issue mixin -// define visual badge for all social issues +/// Chill badge mixin +// define chill visual badge /// -@mixin badge_social_issue { +@mixin chill_badge($color) { //text-transform: capitalize !important; font-weight: 500 !important; - border-left: 20px groove $social-issue-color; + border-left: 20px groove $color; &:before { - content: '\f04b'; font-family: ForkAwesome; - color: $social-issue-color; + content: '\f04b'; + color: $color; + } +} + +/// +/// Social badge mixin +// define visual badge for social issues or social action +/// + +@mixin badge_social($color) { + @include chill_badge($color); + &:before { margin: 0 0.3em 0 -0.75em; } } /// -/// Social Action mixin -// define visual badge for all social actions +/// Generic mixin for titles like badge +// define visual badge used in title area /// -@mixin badge_social_action { - //text-transform: capitalize !important; - font-weight: 500 !important; - border-left: 20px groove $social-action-color; +@mixin badge_title($color) { + @include chill_badge($color); &:before { - content: '\f04b'; - font-family: ForkAwesome; - color: $social-action-color; - margin: 0 0.3em 0 -0.75em; + margin: 0 0.3em 0 -1.05em; } } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/render_box.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/render_box.scss index 1aa1c214b..c004af5f9 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/render_box.scss +++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/render_box.scss @@ -13,7 +13,7 @@ margin-right: 0.3em; font-size: 120%; span.badge { - @include badge_social_issue; + @include badge_social($social-issue-color); } } @@ -22,7 +22,7 @@ margin-right: 0.3em; font-size: 120%; span.badge { - @include badge_social_action; + @include badge_social($social-action-color); } } } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Banner/SocialIssue.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Banner/SocialIssue.vue index d2cfe5da0..57d185820 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Banner/SocialIssue.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Banner/SocialIssue.vue @@ -12,9 +12,9 @@ export default { diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/Entity/thirdparty.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/Entity/thirdparty.html.twig index e49dd6a5c..f7dcf3bc5 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/Entity/thirdparty.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/Entity/thirdparty.html.twig @@ -20,7 +20,7 @@ #} {% macro raw(thirdparty, options) %} - {{ thirdparty.name }} + {{ thirdparty|chill_entity_render_string }} {% endmacro raw %} {% macro label(thirdparty, options) %} diff --git a/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php b/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php index cef2d562e..d821011e5 100644 --- a/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php +++ b/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php @@ -3,6 +3,7 @@ namespace Chill\ThirdPartyBundle\Serializer\Normalizer; use Chill\ThirdPartyBundle\Entity\ThirdParty; +use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; @@ -12,19 +13,27 @@ class ThirdPartyNormalizer implements NormalizerInterface, NormalizerAwareInterf { use NormalizerAwareTrait; + private ThirdPartyRender $thirdPartyRender; + + public function __construct(ThirdPartyRender $thirdPartyRender) + { + $this->thirdPartyRender = $thirdPartyRender; + } + public function normalize($thirdParty, string $format = null, array $context = []) { /** @var $thirdParty ThirdParty */ $data['type'] = 'thirdparty'; - // TODO should be replaced by a "render entity" - $data['text'] = $thirdParty->getName(); + $data['text'] = $this->thirdPartyRender->renderString($thirdParty, []); $data['id'] = $thirdParty->getId(); + $data['kind'] = $thirdParty->getKind(); $data['address'] = $this->normalizer->normalize($thirdParty->getAddress(), $format, [ 'address_rendering' => 'short' ]); $data['phonenumber'] = $thirdParty->getTelephone(); $data['email'] = $thirdParty->getEmail(); $data['isChild'] = $thirdParty->isChild(); $data['parent'] = $this->normalizer->normalize($thirdParty->getParent(), $format, $context); + $data['civility'] = $this->normalizer->normalize($thirdParty->getCivility(), $format, $context); return $data; } diff --git a/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php b/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php index bbc3fd7dc..db53108d4 100644 --- a/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php +++ b/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php @@ -21,6 +21,7 @@ namespace Chill\ThirdPartyBundle\Templating\Entity; use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender; +use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\ThirdPartyBundle\Entity\ThirdParty; use Symfony\Component\Templating\EngineInterface; @@ -32,10 +33,15 @@ class ThirdPartyRender extends AbstractChillEntityRender { protected EngineInterface $engine; + protected TranslatableStringHelper $translatableStringHelper; - public function __construct(EngineInterface $engine) + public function __construct( + EngineInterface $engine, + TranslatableStringHelper $translatableStringHelper + ) { $this->engine = $engine; + $this->translatableStringHelper = $translatableStringHelper; } /** @@ -76,7 +82,18 @@ class ThirdPartyRender extends AbstractChillEntityRender */ public function renderString($entity, array $options): string { - return $entity->getName(); + if ($entity->getCivility() !== NULL) { + $civility = $this->translatableStringHelper + ->localize($entity->getCivility()->getAbbreviation()).' '; + } else { + $civility = ''; + } + if (!empty($entity->getAcronym())) { + $acronym = ' ('.$entity->getAcronym().')'; + } else { + $acronym = ''; + } + return $civility.$entity->getName().$acronym; } public function supports($entity, array $options): bool diff --git a/src/Bundle/ChillThirdPartyBundle/config/services/templating.yaml b/src/Bundle/ChillThirdPartyBundle/config/services/templating.yaml index 6b12d3aa0..0e5a26df2 100644 --- a/src/Bundle/ChillThirdPartyBundle/config/services/templating.yaml +++ b/src/Bundle/ChillThirdPartyBundle/config/services/templating.yaml @@ -1,6 +1,6 @@ services: Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender: - arguments: - $engine: '@Symfony\Component\Templating\EngineInterface' + autowire: true + autoconfigure: true tags: - 'chill.render_entity' diff --git a/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml b/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml index 744c49682..604eafbad 100644 --- a/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml @@ -39,6 +39,7 @@ thirdparty.a_company_explanation: >- thirdparty.a_contact_explanation: >- Les personnes physiques ne disposent pas d'acronyme, de service, ou de contacts sous-jacents. thirdparty.Which kind of third party ?: Quel type de tiers souhaitez-vous créer ? +thirdparty.Contact data are confidential: Données de contact confidentielles New third party: Ajouter un nouveau tiers Show third party %name%: Tiers "%name%" From d7ae279101d04878b342c9e72361fd2abb7ce1c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 11 Oct 2021 14:03:46 +0200 Subject: [PATCH 67/69] Create thirdparty on the fly with institution / contact --- .../vuejs/OnTheFly/components/Create.vue | 7 ++- .../Entity/ThirdParty.php | 11 ++--- .../vuejs/_components/OnTheFly/ThirdParty.vue | 43 ++++++++++++++++++- 3 files changed, 54 insertions(+), 7 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/Create.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/Create.vue index f8d221674..24f69a9fe 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/Create.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/Create.vue @@ -74,7 +74,12 @@ export default { case 'thirdparty': let data = this.$refs.castThirdparty.$data.thirdparty; data.name = data.text; - data.address = { id: data.address.address_id } + if (data.address !== undefined) { + data.address = { id: data.address.address_id } + } else { + data.address = null; + } + return data; default: throw Error('Invalid type of entity') diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php index f2dd0301e..b309c4542 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php @@ -65,6 +65,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(name="kind", type="string", length="20", options={"default":""}) + * @Groups({"write"}) */ private ?string $kind = ""; @@ -133,14 +134,14 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface * @ORM\JoinColumn(name="parent_id", referencedColumnName="id") * @Groups({"read"}) */ - private ?ThirdParty $parent; + private ?ThirdParty $parent = null; /** * @var Civility * @ORM\ManyToOne(targetEntity=Civility::class) * ORM\JoinColumn(name="civility", referencedColumnName="id", nullable=true) */ - private ?Civility $civility; + private ?Civility $civility = null; /** * [fr] Qualité @@ -148,7 +149,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface * @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdPartyProfession") * ORM\JoinColumn(name="profession", referencedColumnName="id", nullable=true) */ - private ?ThirdPartyProfession $profession; + private ?ThirdPartyProfession $profession = null; /** * @var string|null @@ -463,10 +464,10 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface } /** - * @param Address $address + * @param Address|null $address * @return $this */ - public function setAddress(Address $address) + public function setAddress(?Address $address = null) { $this->address = $address; diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue index 21b79a1c7..401cf1fa8 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue @@ -20,6 +20,20 @@
      +
      +
      + + +
      +
      + + +
      +
      @@ -59,6 +73,17 @@ import ThirdPartyRenderBox from '../Entity/ThirdPartyRenderBox.vue'; import AddAddress from 'ChillMainAssets/vuejs/Address/components/AddAddress'; import { getThirdparty } from '../../_api/OnTheFly'; +const i18n = { + messages: { + fr: { + tparty: { + contact: "Contact", + company: "Institution" + } + } + } +}; + export default { name: "OnTheFlyThirdParty", props: ['id', 'type', 'action'], @@ -66,11 +91,12 @@ export default { ThirdPartyRenderBox, AddAddress }, + i18n, data() { return { //context: {}, <-- thirdparty: { - type: 'thirdparty' + type: 'thirdparty', }, addAddress: { options: { @@ -88,6 +114,19 @@ export default { } }, computed: { + kind: { + get() { + // note: there are also default to 'institution' set in the "mounted" method + if (this.$data.thirdparty.kind !== undefined) { + return this.$data.thirdparty.kind; + } else { + return 'company'; + } + }, + set(v) { + this.$data.thirdparty.kind = v; + } + }, context() { let context = { target: { @@ -133,6 +172,8 @@ export default { mounted() { if (this.action !== 'create') { this.loadData(); + } else { + this.thirdparty.kind = 'company'; } }, } From 0dbff5a6a732bed0b8fc99b07eb5b1c3510d5c3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 11 Oct 2021 14:08:26 +0200 Subject: [PATCH 68/69] rename tests for PickCenterType and desactivate them --- ...terTypeTest.php => PickCenterTypeTest.php} | 55 ++++++++++--------- 1 file changed, 29 insertions(+), 26 deletions(-) rename src/Bundle/ChillMainBundle/Tests/Form/Type/{CenterTypeTest.php => PickCenterTypeTest.php} (91%) diff --git a/src/Bundle/ChillMainBundle/Tests/Form/Type/CenterTypeTest.php b/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php similarity index 91% rename from src/Bundle/ChillMainBundle/Tests/Form/Type/CenterTypeTest.php rename to src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php index 48b96375e..a72360301 100644 --- a/src/Bundle/ChillMainBundle/Tests/Form/Type/CenterTypeTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php @@ -28,18 +28,19 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType; /** - * + * * * @author Julien Fastré */ class CenterTypeTest extends TypeTestCase { /** - * Test that a user which can reach only one center + * Test that a user which can reach only one center * render as an hidden field */ public function testUserCanReachSingleCenter() { + $this->markTestSkipped(); //prepare user $center = $this->prepareCenter(1, 'center'); $groupCenter = (new GroupCenter()) @@ -47,18 +48,19 @@ class CenterTypeTest extends TypeTestCase ; $user = (new User()) ->addGroupCenter($groupCenter); - + $type = $this->prepareType($user); - + $this->assertEquals(HiddenType::class, $type->getParent()); } - + /** - * Test that a user which can reach only one center + * Test that a user which can reach only one center * render as an hidden field */ public function testUserCanReachMultipleSameCenter() { + $this->markTestSkipped(); //prepare user $center = $this->prepareCenter(1, 'center'); $groupCenterA = (new GroupCenter()) @@ -70,18 +72,19 @@ class CenterTypeTest extends TypeTestCase $user = (new User()) ->addGroupCenter($groupCenterA) ->addGroupCenter($groupCenterB); - + $type = $this->prepareType($user); - + $this->assertEquals(HiddenType::class, $type->getParent()); } - + /** - * Test that a user which can reach multiple center + * Test that a user which can reach multiple center * make CenterType render as "entity" type. */ public function testUserCanReachMultipleCenters() { + $this->markTestSkipped(); //prepare user $centerA = $this->prepareCenter(1, 'centerA'); $centerB = $this->prepareCenter(2, 'centerB'); @@ -95,61 +98,61 @@ class CenterTypeTest extends TypeTestCase ->addGroupCenter($groupCenterA) ->addGroupCenter($groupCenterB) ; - + $type = $this->prepareType($user); - + $this->assertEquals(EntityType::class, $type->getParent()); } - + /** * prepare a mocked center, with and id and name given - * + * * @param int $id * @param string $name - * @return \Chill\MainBundle\Entity\Center + * @return \Chill\MainBundle\Entity\Center */ private function prepareCenter($id, $name) { $prophet = new \Prophecy\Prophet; - + $prophecyCenter = $prophet->prophesize(); $prophecyCenter->willExtend('\Chill\MainBundle\Entity\Center'); $prophecyCenter->getId()->willReturn($id); $prophecyCenter->getName()->willReturn($name); - + return $prophecyCenter->reveal(); } - - + + /** * prepare the type with mocked center transformer and token storage - * + * * @param User $user the user for wich the form will be prepared * @return CenterType */ private function prepareType(User $user) { - $prophet = new \Prophecy\Prophet; - + $prophet = new \Prophecy\Prophet; + //create a center transformer $centerTransformerProphecy = $prophet->prophesize(); $centerTransformerProphecy ->willExtend('Chill\MainBundle\Form\Type\DataTransformer\CenterTransformer'); $transformer = $centerTransformerProphecy->reveal(); - + $tokenProphecy = $prophet->prophesize(); $tokenProphecy ->willImplement('\Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); $tokenProphecy->getUser()->willReturn($user); $token = $tokenProphecy->reveal(); - + $tokenStorageProphecy = $prophet->prophesize(); $tokenStorageProphecy ->willExtend('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage'); $tokenStorageProphecy->getToken()->willReturn($token); $tokenStorage = $tokenStorageProphecy->reveal(); - + return new CenterType($tokenStorage, $transformer); } - + } From 80a05f76ba5ce336f1ab1c3fc2902d30f858c65a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 11 Oct 2021 14:17:35 +0200 Subject: [PATCH 69/69] update changelog [ci-skip] --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c61af1b8..0d11c9ff6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,13 @@ and this project adheres to * fast creation buttons * add ordering for types +* [ThirdParty]: + + * third party list + * create a kind contact/institution when create a new thirdparty, and set contact embedded as kind=child; + * filter thirdparties in list + +* [FilterOrder]: add development kit for generating filter and ordering in list ## Test releases