From 6a62b46decd7d03fa17141888c69434c8451af80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 20 May 2021 17:41:37 +0200 Subject: [PATCH 01/13] first impl --- .../Doctrine/Model/TrackCreationInterface.php | 12 + .../Doctrine/Model/TrackUpdateInterface.php | 12 + .../modules/scratch/custom/_address.scss | 6 + .../scratch/custom/_record_actions.scss | 5 + .../views/Address/entity_render.html.twig | 16 ++ .../Templating/Entity/AddressRender.php | 67 ++++++ .../Templating/Entity/AddressRenderTest.php | 55 +++++ .../config/services/templating.yaml | 7 + .../Entity/AccompanyingPeriod.php | 197 +++++++++++++++-- .../ChillPersonBundle/Entity/Person.php | 25 +++ .../Resources/public/index.js | 3 +- .../Resources/public/sass/index.js | 2 +- .../public/sass/person_with_period.scss | 50 +++++ .../Resources/views/Entity/person.html.twig | 15 ++ .../views/Entity/social_issue.html.twig | 3 + .../views/Person/list_with_period.html.twig | 208 ++++++++++++++++++ .../ChillPersonBundle/Search/PersonSearch.php | 2 +- .../Templating/Entity/SocialIssueRender.php | 50 +++++ .../config/services/templating.yaml | 11 +- 19 files changed, 729 insertions(+), 17 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Doctrine/Model/TrackCreationInterface.php create mode 100644 src/Bundle/ChillMainBundle/Doctrine/Model/TrackUpdateInterface.php create mode 100644 src/Bundle/ChillMainBundle/Resources/views/Address/entity_render.html.twig create mode 100644 src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php create mode 100644 src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php create mode 100644 src/Bundle/ChillPersonBundle/Resources/public/sass/person_with_period.scss create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/Entity/social_issue.html.twig create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig create mode 100644 src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php diff --git a/src/Bundle/ChillMainBundle/Doctrine/Model/TrackCreationInterface.php b/src/Bundle/ChillMainBundle/Doctrine/Model/TrackCreationInterface.php new file mode 100644 index 000000000..192d4e7a9 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Doctrine/Model/TrackCreationInterface.php @@ -0,0 +1,12 @@ + + {% if options['has_no_address'] == true and address.isNoAddress == true %} +
{{ 'address.consider homeless'|trans }}
+ {% endif %} +
+ {% if address.street is not empty %}

{{ address.street }}

{% endif %} + {% if address.streetNumber is not empty %}

{{ address.streetNumber }}

{% endif %} + {% if address.postCode is not empty %} +

{{ address.postCode.code }} {{ address.postCode.name }}

+

{{ address.postCode.country.name|localize_translatable_string }}

+ {% endif %} +
+{%- if options['with_valid_from'] == true -%} +{{ 'Since %date%'|trans( { '%date%' : address.validFrom|format_date('long') } ) }} +{%- endif -%} + diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php new file mode 100644 index 000000000..90a707e40 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php @@ -0,0 +1,67 @@ + true, + 'has_no_address' => false, + 'multiline' => true, + ]; + + public function __construct(EngineInterface $templating) + { + $this->templating = $templating; + } + + /** + * {@inheritDoc} + */ + public function supports($entity, array $options): bool + { + return $entity instanceof Address; + } + + /** + * @param Address addr + */ + public function renderString($addr, array $options): string + { + $lines = []; + if (!empty($addr->getStreet())) { + $lines[0] = $addr->getStreet(); + } + if (!empty($addr->getStreetNumber())) { + $lines[0] .= ", ".$addr->getStreetNumber(); + } + if (!empty($addr->getPostcode())) { + $lines[1] = \strtr("{postcode} {label}", [ + '{postcode}' => $addr->getPostcode()->getCode(), + '{label}' => $addr->getPostcode()->getName() + ]); + } + + return implode(" - ", $lines); + } + + /** + * {@inheritDoc} + * @param Address addr + */ + public function renderBox($addr, array $options): string + { + $options = \array_merge(self::DEFAULT_OPTIONS, $options); + + return $this->templating + ->render('@ChillMain/Address/entity_render.html.twig', [ + 'address' => $addr, + 'options' => $options + ]); + } +} diff --git a/src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php b/src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php new file mode 100644 index 000000000..79551d23c --- /dev/null +++ b/src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php @@ -0,0 +1,55 @@ +get(EngineInterface::class); + $renderer = new AddressRender($engine); + + $this->assertEquals($expectedString, $renderer->renderString($addr, [])); + return; + $this->assertIsString($renderer->renderBox($addr, [])); + } + + + public function addressDataProvider(): \Iterator + { + $addr = new Address(); + $country = (new Country()) + ->setName([ "fr" => "Pays" ]) + ->setCountryCode("BE") + ; + $postCode = new PostalCode(); + $postCode->setName("Locality") + ->setCode("012345") + ->setCountry($country) + ; + + $addr->setStreet("Rue ABC") + ->setStreetNumber("5") + ->setPostcode($postCode) + ; + + yield[ $addr, "Rue ABC, 5 - 012345 Locality"]; + } + +} diff --git a/src/Bundle/ChillMainBundle/config/services/templating.yaml b/src/Bundle/ChillMainBundle/config/services/templating.yaml index 29dc676d1..9d103f690 100644 --- a/src/Bundle/ChillMainBundle/config/services/templating.yaml +++ b/src/Bundle/ChillMainBundle/config/services/templating.yaml @@ -41,3 +41,10 @@ services: Chill\MainBundle\Templating\ChillMarkdownRenderExtension: tags: - { name: twig.extension } + + Chill\MainBundle\Templating\Entity\AddressRender: + arguments: + - '@Symfony\Component\Templating\EngineInterface' + tags: + - { name: 'chill.render_entity' } + diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index 8ec017c07..d5b43446c 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -22,25 +22,34 @@ namespace Chill\PersonBundle\Entity; +use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface; +use Chill\MainBundle\Doctrine\Model\TrackCreationInterface; use Chill\MainBundle\Entity\Scope; use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive; use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment; use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin; use Chill\PersonBundle\Entity\AccompanyingPeriod\Resource; +use Chill\PersonBundle\Entity\SocialWork\SocialIssue; use Chill\ThirdPartyBundle\Entity\ThirdParty; +use DateTimeInterface; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Context\ExecutionContextInterface; use Chill\MainBundle\Entity\User; +use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Annotation\DiscriminatorMap; /** * AccompanyingPeriod Class * * @ORM\Entity * @ORM\Table(name="chill_person_accompanying_period") + * @DiscriminatorMap(typeProperty="type", mapping={ + * "accompanying_period"=AccompanyingPeriod::class + * }) */ -class AccompanyingPeriod +class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface { /** * Mark an accompanying period as "occasional" @@ -80,6 +89,7 @@ class AccompanyingPeriod * @ORM\Id * @ORM\Column(name="id", type="integer") * @ORM\GeneratedValue(strategy="AUTO") + * @Groups({"read"}) */ private $id; @@ -87,6 +97,7 @@ class AccompanyingPeriod * @var \DateTime * * @ORM\Column(type="date") + * @Groups({"read", "write"}) */ private $openingDate; @@ -94,6 +105,7 @@ class AccompanyingPeriod * @var \DateTime * * @ORM\Column(type="date", nullable=true) + * @Groups({"read", "write"}) */ private $closingDate = null; @@ -101,6 +113,7 @@ class AccompanyingPeriod * @var string * * @ORM\Column(type="text") + * @Groups({"read", "write"}) */ private $remark = ''; @@ -108,17 +121,28 @@ class AccompanyingPeriod * @var Collection * * @ORM\OneToMany(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\Comment", - * mappedBy="accompanyingPeriod" + * mappedBy="accompanyingPeriod", + * cascade={"persist", "remove"}, + * orphanRemoval=true * ) */ private $comments; + /** + * @ORM\ManyToOne( + * targetEntity=Comment::class + * ) + * @Groups({"read"}) + */ + private ?Comment $initialComment = null; + /** * @var Collection * * @ORM\OneToMany(targetEntity=AccompanyingPeriodParticipation::class, * mappedBy="accompanyingPeriod", * cascade={"persist", "refresh", "remove", "merge", "detach"}) + * @Groups({"read"}) */ private $participations; @@ -128,36 +152,42 @@ class AccompanyingPeriod * @ORM\ManyToOne( * targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive") * @ORM\JoinColumn(nullable=true) + * @Groups({"read", "write"}) */ private $closingMotive = null; /** * @ORM\ManyToOne(targetEntity=User::class) * @ORM\JoinColumn(nullable=true) + * @Groups({"read", "write"}) */ private $user; /** * @ORM\ManyToOne(targetEntity=User::class) * @ORM\JoinColumn(nullable=true) + * @Groups({"read"}) */ private $createdBy; /** * @var string * @ORM\Column(type="string", length=32, nullable=true) + * @Groups({"read"}) */ private $step = self::STEP_DRAFT; /** * @ORM\ManyToOne(targetEntity=Origin::class) * @ORM\JoinColumn(nullable=true) + * @Groups({"read", "write"}) */ private $origin; /** * @var string * @ORM\Column(type="string", nullable=true) + * @Groups({"read", "write"}) */ private $intensity; @@ -172,6 +202,7 @@ class AccompanyingPeriod * joinColumns={@ORM\JoinColumn(name="accompanying_period_id", referencedColumnName="id")}, * inverseJoinColumns={@ORM\JoinColumn(name="scope_id", referencedColumnName="id")} * ) + * @Groups({"read"}) */ private $scopes; @@ -189,19 +220,22 @@ class AccompanyingPeriod /** * @var bool - * @ORM\Column(type="boolean") + * @ORM\Column(type="boolean", options={"default": false} ) + * @Groups({"read", "write"}) */ private $requestorAnonymous = false; /** * @var bool - * @ORM\Column(type="boolean") + * @ORM\Column(type="boolean", options={"default": false} ) + * @Groups({"read", "write"}) */ private $emergency = false; /** * @var bool - * @ORM\Column(type="boolean") + * @ORM\Column(type="boolean", options={"default": false} ) + * @Groups({"read", "write"}) */ private $confidential = false; @@ -210,21 +244,54 @@ class AccompanyingPeriod * * @ORM\OneToMany( * targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\Resource", - * mappedBy="accompanyingPeriod" + * mappedBy="accompanyingPeriod", + * cascade={"persist", "remove"}, + * orphanRemoval=true * ) + * @Groups({"read"}) */ private $resources; + /** + * @ORM\ManyToMany( + * targetEntity=SocialIssue::class + * ) + * @ORM\JoinTable( + * name="chill_person_accompanying_period_social_issues" + * ) + * @Groups({"read"}) + */ + private Collection $socialIssues; + + /** + * @ORM\Column(type="datetime", nullable=true, options={"default": NULL}) + */ + private \DateTimeInterface $createdAt; + + /** + * @ORM\ManyToOne( + * targetEntity=User::class + * ) + */ + private User $updatedBy; + + /** + * @ORM\Column(type="datetime", nullable=true, options={"default": NULL}) + */ + private \DateTimeInterface $updatedAt; + /** * AccompanyingPeriod constructor. * * @param \DateTime $dateOpening * @uses AccompanyingPeriod::setClosingDate() */ - public function __construct(\DateTime $dateOpening) { - $this->setOpeningDate($dateOpening); + public function __construct(\DateTime $dateOpening = null) { + $this->setOpeningDate($dateOpening ?? new \DateTime('now')); $this->participations = new ArrayCollection(); $this->scopes = new ArrayCollection(); + $this->socialIssues = new ArrayCollection(); + $this->comments = new ArrayCollection(); } /** @@ -318,23 +385,55 @@ class AccompanyingPeriod return $this->remark; } + /** + * @Groups({"read"}) + */ public function getComments(): Collection { - return $this->comments; + return $this->comments->filter(function (Comment $c) { + return $c !== $this->initialComment; + }); } public function addComment(Comment $comment): self { $this->comments[] = $comment; + $comment->setAccompanyingPeriod($this); return $this; } public function removeComment(Comment $comment): void { + $comment->setAccompanyingPeriod(null); $this->comments->removeElement($comment); } + /** + * @Groups({"write"}) + */ + public function setInitialComment(?Comment $comment = null): self + { + if (NULL !== $this->initialComment) { + $this->removeComment($this->initialComment); + } + if ($comment instanceof Comment) { + $this->addComment($comment); + } + + $this->initialComment = $comment; + + return $this; + } + + /** + * @Groups({"read"}) + */ + public function getInitialComment(): ?Comment + { + return $this->initialComment; + } + /** * Get Participations Collection */ @@ -515,9 +614,9 @@ class AccompanyingPeriod return $this->requestorPerson; } - public function setRequestorPerson(Person $requestorPerson): self + private function setRequestorPerson(Person $requestorPerson = null): self { - $this->requestorPerson = ($this->requestorThirdParty === null) ? $requestorPerson : null; + $this->requestorPerson = $requestorPerson; return $this; } @@ -527,21 +626,53 @@ class AccompanyingPeriod return $this->requestorThirdParty; } - public function setRequestorThirdParty(ThirdParty $requestorThirdParty): self + private function setRequestorThirdParty(ThirdParty $requestorThirdParty = null): self { - $this->requestorThirdParty = ($this->requestorPerson === null) ? $requestorThirdParty : null; + $this->requestorThirdParty = $requestorThirdParty; return $this; } /** * @return Person|ThirdParty + * @Groups({"read"}) */ public function getRequestor() { return $this->requestorPerson ?? $this->requestorThirdParty; } + + /** + * Set a requestor + * + * The requestor is either an instance of ThirdParty, or an + * instance of Person + * + * @param $requestor Person|ThirdParty + * @return self + * @throw UnexpectedValueException if the requestor is not a Person or ThirdParty + * @Groups({"write"}) + */ + public function setRequestor($requestor): self + { + if ($requestor instanceof Person) { + $this->setRequestorThirdParty(NULL); + $this->setRequestorPerson($requestor); + } elseif ($requestor instanceof ThirdParty) { + $this->setRequestorThirdParty($requestor); + $this->setRequestorPerson(NULL); + } elseif (NULL === $requestor) { + $this->setRequestorPerson(NULL); + $this->setRequestorThirdParty(NULL); + } else { + throw new \UnexpectedValueException("requestor is not an instance of Person or ThirdParty"); + } + + return $this; + } + + public function isRequestorAnonymous(): bool { return $this->requestorAnonymous; @@ -638,6 +769,7 @@ class AccompanyingPeriod public function addResource(Resource $resource): self { + $resource->setAccompanyingPeriod($this); $this->resources[] = $resource; return $this; @@ -645,9 +777,27 @@ class AccompanyingPeriod public function removeResource(Resource $resource): void { + $resource->setAccompanyingPeriod(null); $this->resources->removeElement($resource); } + public function getSocialIssues(): Collection + { + return $this->socialIssues; + } + + public function addSocialIssue(SocialIssue $socialIssue): self + { + $this->socialIssues[] = $socialIssue; + + return $this; + } + + public function removeSocialIssue(SocialIssue $socialIssue): void + { + $this->socialIssues->removeElement($socialIssue); + } + /** * Get a list of all persons which are participating to this course */ @@ -659,4 +809,25 @@ class AccompanyingPeriod } ); } + + public function setCreatedAt(\DateTimeInterface $datetime): self + { + $this->createdAt = $datetime; + + return $this; + } + + public function setUpdatedBy(User $user): self + { + $this->updatedBy = $user; + + return $this; + } + + public function setUpdatedAt(\DateTimeInterface $datetime): self + { + $this->updatedAt = $datetime; + + return $this; + } } diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index e88998205..a469c65d2 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -417,6 +417,31 @@ class Person implements HasCenterInterface return $this->accompanyingPeriodParticipations; } + /** + * Return a collection of participation, where the participation + * is still opened, not a draft, and the period is still opened + */ + public function getOpenedParticipations(): Collection + { + // create a criteria for filtering easily + $criteria = Criteria::create(); + $criteria + ->andWhere(Criteria::expr()->eq('endDate', NULL)) + ->orWhere(Criteria::expr()->gt('endDate', new \DateTime('now'))) + ; + + return $this->getAccompanyingPeriodParticipations() + ->matching($criteria) + ->filter(function (AccompanyingPeriodParticipation $app) { + $period = $app->getAccompanyingPeriod(); + return ( + NULL === $period->getClosingDate() + || new \DateTime('now') < $period->getClosingDate() + ) + && AccompanyingPeriod::STEP_DRAFT !== $period->getStep(); + }); + } + /** * Get the accompanying periods of a give person with the chronological order. */ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/index.js b/src/Bundle/ChillPersonBundle/Resources/public/index.js index f4bcba7fb..e3563b4ff 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/index.js @@ -1 +1,2 @@ -require('./sass/person.scss'); \ No newline at end of file +require('./sass/person.scss'); +require('./sass/person_with_period.scss'); diff --git a/src/Bundle/ChillPersonBundle/Resources/public/sass/index.js b/src/Bundle/ChillPersonBundle/Resources/public/sass/index.js index 35945c7ff..89e749e5c 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/sass/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/sass/index.js @@ -1,5 +1,5 @@ require('./phone-alt-solid.svg'); require('./mobile-alt-solid.svg'); require('./person_by_phonenumber.scss'); - +require('./person_with_period.scss'); diff --git a/src/Bundle/ChillPersonBundle/Resources/public/sass/person_with_period.scss b/src/Bundle/ChillPersonBundle/Resources/public/sass/person_with_period.scss new file mode 100644 index 000000000..46422d994 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/public/sass/person_with_period.scss @@ -0,0 +1,50 @@ +.person-list--with-period { + .person-list--with-period__item { + margin-bottom: 0; + padding: 1em 1em 2em 1em; + &:nth-last-of-type { + padding-bottom: 1em; + } + + &:nth-of-type(odd) { + //background-color: var(--chill-light-gray); + } + &:nth-of-type(even) { + //background-color: var(--chill-dark-gray); + } + + .chill-entity__person { + .chill-entity__person__first-name, + .chill-entity__person__last-name { + font-size: 1.3em; + font-weight: 700; + } + } + + & > div { + display: flex; + flex-direction: row; + + .person-list--with-period__item__box-where { + align-self: flex-end; + margin-left: auto; + width: 33%; + + text-align: right; + } + } + + ul.person-list--with-period__item__periods { + list-style-type: none; + padding: 0; + margin: 0; + + li { + + } + } + } + .person-list--with-period__item:hover { + background-color: var(--chill-llight-gray); + } +} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig new file mode 100644 index 000000000..afcd2799c --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig @@ -0,0 +1,15 @@ + + {%- if addLink and is_granted('CHILL_PERSON_SEE', person) -%} + {%- set showLink = true -%}{%- endif -%} + {{ person.firstName }} + {{ person.lastName }} + {%- if addAltNames -%} + {%- for n in person.altNames -%} + {%- if loop.first -%}({% else %} {%- endif -%} + + {{ n.label }} + + {%- if loop.last %}) {% endif -%} + {%- endfor -%} + {%- endif -%} + {%- if showLink is defined -%}{%- endif -%} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Entity/social_issue.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Entity/social_issue.html.twig new file mode 100644 index 000000000..eeb3c4712 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/Entity/social_issue.html.twig @@ -0,0 +1,3 @@ + + + diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig new file mode 100644 index 000000000..ce5ee2beb --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig @@ -0,0 +1,208 @@ +

{{ title|default('Person search results')|trans }}

+ +

+ {{ '%total% persons matching the search pattern:'|transchoice( total, { '%total%' : total}) }} + + {{ pattern }} + +

+ +

{{ 'Results %start%-%end% of %total%'|trans({ '%start%' : start, '%end%': start + persons|length, '%total%' : total } ) }}

+ + + + +{% if persons|length > 0 %} + +
+ {% for person in persons %} +
+
+
+
+ {{ person|chill_entity_render_box({'addLink': true}) }} + {{ person.birthdate|format_date("medium") }} +
+ +
+
+ {{ person.center }} + {% if person.getLastAddress is not null %} + {{ person.getLastAddress|chill_entity_render_box({'with_valid_from': false}) }} + {% else %} + {{ 'No address'|trans }} + {% endif %} + {% if person.mobilenumber is not empty %} + {{ person.mobilenumber }} + {% endif %} + {% if person.phonenumber is not empty %} + {{ person.phonenumber }} + {% endif %} + +
+
+ + {#- 'apps' is for AccompanyingPeriodParticipationS #} + {#- filter using acl -#} + {%- set apps = [] %} + {%- for app in person.openedParticipations %} + {%- if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', app.accompanyingPeriod) %} + {%- set apps = apps|merge([app]) %} + {%- endif %} + {%- endfor %} + {% if apps|length > 0 %} + + {% endif %} + +
+ {% endfor %} +
+ + {# + + + + + + + + + + + {% for person in persons %} + + + + + + + {% endfor %} + +
{% trans %}Name{% endtrans %}{% trans %}Date of birth{% endtrans %}{% trans %}Nationality{% endtrans %} 
+ {% set is_open = person.isOpen() %} + + {{ person|chill_entity_render_box }} + {% apply spaceless %} + {% if chill_person.fields.accompanying_period == 'visible' %} + {% if is_open == false %} + + {% else %} + + {% endif %} + {% endif %} + {% endapply %} + + + {% if person.birthdate is not null %} + {{ person.birthdate|format_date('long') }} + {% else %}{{ 'Unknown date of birth'|trans }}{% endif %} + + {% if person.nationality is not null %} + {{person.nationality.name | localize_translatable_string }} + {% else %} + {{ 'Without nationality'|trans }} + {% endif %} + +
    +
  • + {% if is_granted('CHILL_PERSON_UPDATE', person) %} +
  • + {% endif %} +
+
+ + #} + + +{% else %} + +{% endif %} + +{% if preview == false %} +{{ chill_pagination(paginator) }} +{% endif %} + diff --git a/src/Bundle/ChillPersonBundle/Search/PersonSearch.php b/src/Bundle/ChillPersonBundle/Search/PersonSearch.php index 34f79bb87..fe938999a 100644 --- a/src/Bundle/ChillPersonBundle/Search/PersonSearch.php +++ b/src/Bundle/ChillPersonBundle/Search/PersonSearch.php @@ -120,7 +120,7 @@ class PersonSearch extends AbstractSearch implements ContainerAwareInterface, $paginator = $this->paginatorFactory->create($total); if ($format === 'html') { - return $this->container->get('templating')->render('ChillPersonBundle:Person:list.html.twig', + return $this->container->get('templating')->render('@ChillPerson/Person/list_with_period.html.twig', array( 'persons' => $this->search($terms, $start, $limit, $options), 'pattern' => $this->recomposePattern($terms, array('nationality', diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php new file mode 100644 index 000000000..f7b0da53c --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php @@ -0,0 +1,50 @@ + ' > ', + ]; + + public function __construct(TranslatableStringHelper $translatableStringHelper) + { + $this->translatableStringHelper = $translatableStringHelper; + } + + public function supports($entity, array $options): bool + { + return $entity instanceof SocialIssue; + } + + public function renderString($socialIssue, array $options): string + { + /** @var $socialIssue SocialIssue */ + $options = \array_merge(self::DEFAULT_ARGS, $options); + + $str = $this->translatableStringHelper->localize($socialIssue->getTitle()); + + while ($socialIssue->hasParent()) { + $socialIssue = $socialIssue->getParent(); + $str .= $options[self::SEPARATOR_KEY].$this->translatableStringHelper->localize( + $socialIssue->getTitle() + ); + } + + return $str; + } + + public function renderBox($entity, array $options): string + { + return "renderBox not implemented for social issue"; + } +} diff --git a/src/Bundle/ChillPersonBundle/config/services/templating.yaml b/src/Bundle/ChillPersonBundle/config/services/templating.yaml index 3456c96de..5715f344c 100644 --- a/src/Bundle/ChillPersonBundle/config/services/templating.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/templating.yaml @@ -1,12 +1,21 @@ services: + Chill\PersonBundle\Templating\Entity\: + resource: '../../Templating/Entity' + tags: + - 'chill.render_entity' + Chill\PersonBundle\Templating\Entity\PersonRender: arguments: $configAltNamesHelper: '@Chill\PersonBundle\Config\ConfigPersonAltNamesHelper' tags: - 'chill.render_entity' - + Chill\PersonBundle\Templating\Entity\ClosingMotiveRender: arguments: $translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper' + + Chill\PersonBundle\Templating\Entity\SocialIssueRender: + arguments: + $translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper' tags: - 'chill.render_entity' From 8ae113c872392e6d5d74485a25b7b19f67e232cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 20 May 2021 19:20:06 +0200 Subject: [PATCH 02/13] person search rendering more reponsive --- .../Entity/SocialWork/SocialIssue.php | 11 +++++ .../public/sass/person_with_period.scss | 44 +++++++++++++------ .../views/Entity/social_issue.html.twig | 12 ++++- .../views/Person/list_with_period.html.twig | 8 ++-- .../Templating/Entity/SocialIssueRender.php | 29 ++++++++++-- .../config/services/templating.yaml | 1 + .../translations/messages.fr.yml | 4 +- 7 files changed, 86 insertions(+), 23 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php index 2b6df9be2..6b2152cdf 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php @@ -4,10 +4,15 @@ namespace Chill\PersonBundle\Entity\SocialWork; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Annotation\DiscriminatorMap; /** * @ORM\Entity * @ORM\Table(name="chill_person_social_issue") + * @DiscriminatorMap(typeProperty="type", mapping={ + * "social_issue"=SocialIssue::class + * }) */ class SocialIssue { @@ -35,6 +40,7 @@ class SocialIssue /** * @ORM\Column(type="json") + * @Groups({"read"}) */ private $title = []; @@ -59,6 +65,11 @@ class SocialIssue return $this->parent; } + public function hasParent(): bool + { + return $this->parent !== null; + } + public function setParent(?self $parent): self { $this->parent = $parent; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/sass/person_with_period.scss b/src/Bundle/ChillPersonBundle/Resources/public/sass/person_with_period.scss index 46422d994..7d61483db 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/sass/person_with_period.scss +++ b/src/Bundle/ChillPersonBundle/Resources/public/sass/person_with_period.scss @@ -6,13 +6,6 @@ padding-bottom: 1em; } - &:nth-of-type(odd) { - //background-color: var(--chill-light-gray); - } - &:nth-of-type(even) { - //background-color: var(--chill-dark-gray); - } - .chill-entity__person { .chill-entity__person__first-name, .chill-entity__person__last-name { @@ -23,14 +16,39 @@ & > div { display: flex; - flex-direction: row; + } + @media screen and (min-width: 720px) { + & > div { + flex-direction: row; - .person-list--with-period__item__box-where { - align-self: flex-end; - margin-left: auto; - width: 33%; + .person-list--with-period__item__box-where { + align-self: flex-end; + margin-left: auto; + width: 33%; - text-align: right; + text-align: right; + } + } + } + + @media screen and (max-width: 720px) { + & > div { + flex-direction: column; + } + } + + @media screen and (max-width: 460px) { + .person-list--with-period__item__box-where__center { + display: none; + } + .chill_address { + .street { + display: none; + } + + .country { + display: none; + } } } diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Entity/social_issue.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Entity/social_issue.html.twig index eeb3c4712..2db894e3c 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Entity/social_issue.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Entity/social_issue.html.twig @@ -1,3 +1,13 @@ +{% set reversed_parents = parents|reverse %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig index ce5ee2beb..da571d173 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig @@ -44,7 +44,7 @@
{{ person|chill_entity_render_box({'addLink': true}) }} - {{ person.birthdate|format_date("medium") }} + {{ 'Born the %date%'|transchoice(person.genderNumeric, { '%date%': person.birthdate|format_date("medium") }) }}
    @@ -60,17 +60,17 @@
- {{ person.center }} + {{ person.center }} {% if person.getLastAddress is not null %} {{ person.getLastAddress|chill_entity_render_box({'with_valid_from': false}) }} {% else %} {{ 'No address'|trans }} {% endif %} {% if person.mobilenumber is not empty %} - {{ person.mobilenumber }} + {{ person.mobilenumber|chill_format_phonenumber }} {% endif %} {% if person.phonenumber is not empty %} - {{ person.phonenumber }} + {{ person.phonenumber|chill_format_phonenumber }} {% endif %}
diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php index f7b0da53c..1923325f9 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php @@ -5,10 +5,12 @@ namespace Chill\PersonBundle\Templating\Entity; use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface; use Chill\PersonBundle\Entity\SocialWork\SocialIssue; use Chill\MainBundle\Templating\TranslatableStringHelper; +use Symfony\Component\Templating\EngineInterface; class SocialIssueRender implements ChillEntityRenderInterface { private TranslatableStringHelper $translatableStringHelper; + private EngineInterface $engine; public const SEPARATOR_KEY = 'default.separator'; @@ -16,9 +18,10 @@ class SocialIssueRender implements ChillEntityRenderInterface self::SEPARATOR_KEY => ' > ', ]; - public function __construct(TranslatableStringHelper $translatableStringHelper) + public function __construct(TranslatableStringHelper $translatableStringHelper, EngineInterface $engine) { $this->translatableStringHelper = $translatableStringHelper; + $this->engine = $engine; } public function supports($entity, array $options): bool @@ -42,9 +45,27 @@ class SocialIssueRender implements ChillEntityRenderInterface return $str; } - - public function renderBox($entity, array $options): string + + protected function buildParents($socialIssue): array { - return "renderBox not implemented for social issue"; + $parents = []; + while ($socialIssue->hasParent()) { + $socialIssue = $parents[] = $socialIssue->getParent(); + } + + return $parents; + } + + public function renderBox($socialIssue, array $options): string + { + $options = \array_merge(self::DEFAULT_ARGS, $options); + // give some help to twig: an array of parents + $parents = $this->buildParents($socialIssue); + + return $this->engine->render('@ChillPerson/Entity/social_issue.html.twig', [ + 'socialIssue' => $socialIssue, + 'parents' => $parents, + 'options' => $options + ]); } } diff --git a/src/Bundle/ChillPersonBundle/config/services/templating.yaml b/src/Bundle/ChillPersonBundle/config/services/templating.yaml index 5715f344c..aa5dd677a 100644 --- a/src/Bundle/ChillPersonBundle/config/services/templating.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/templating.yaml @@ -17,5 +17,6 @@ services: Chill\PersonBundle\Templating\Entity\SocialIssueRender: arguments: $translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper' + $engine: '@Symfony\Component\Templating\EngineInterface' tags: - 'chill.render_entity' diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index ab3a5bfe6..fdaf7768b 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -46,7 +46,7 @@ Add new phone: Ajouter un numéro de téléphone Remove phone: Supprimer 'Notes on contact information': 'Remarques sur les informations de contact' 'Remarks': 'Remarques' -'{0} Born the %date% | {1} Born the %date%': '{0} Né le %date% | {1} Née le %date%' +'Born the %date%': '{0} Né le %date% | {1} Née le %date%' 'Spoken languages': 'Langues parlées' 'Unknown spoken languages': 'Langues parlées inconnues' Male: Homme @@ -125,6 +125,8 @@ Reset: 'Remise à zéro' 'Person search results': 'Recherche de personnes' Person search results by phonenumber: Recherche de personnes par numéro de téléphone 'Search within persons': 'Recherche parmi les personnes' +Open person file: Ouvrir le dossier +and %number% other: '{0} et aucun autre| {1} et une autre |]1, Inf] et %number% autres' '%total% persons matching the search pattern:': '{0} Aucune personne ne correspond aux termes de recherche : | {1} Une personne a été trouvée par la recherche : | ]1,Inf] %total% personnes correspondent aux termes de recherche :' 'Last opening since %last_opening%': 'Dernière ouverture le %last_opening%.' 'Person accompanying period - %name%': 'Historique du dossier - %name%' From d4f96ee25f7eefecb8b9f2dfafb5a31461c5aa79 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 24 May 2021 11:22:27 +0200 Subject: [PATCH 03/13] add 'with_icon' option in twig address macro --- .../ChillMainBundle/Resources/views/Address/macro.html.twig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Resources/views/Address/macro.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Address/macro.html.twig index 5de175169..990dbc043 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Address/macro.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Address/macro.html.twig @@ -1,11 +1,12 @@ {%- macro _render(address, options) -%} {%- set options = { 'with_valid_from' : true }|merge(options|default({})) -%} {%- set options = { 'has_no_address' : false }|merge(options|default({})) -%} + {%- set options = { 'with_icon' : false }|merge(options|default({})) -%}
{% if options['has_no_address'] == true and address.isNoAddress == true %}
{{ 'address.consider homeless'|trans }}
{% endif %} -
+
{% if options['with_icon'] == true %}{% endif %} {% if address.street is not empty %}

{{ address.street }}

{% endif %} {% if address.streetNumber is not empty %}

{{ address.streetNumber }}

{% endif %} {% if address.postCode is not empty %} From cdade50d76a70c26b3b22e48ae8ca9e86320b813 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 24 May 2021 11:23:03 +0200 Subject: [PATCH 04/13] display person and thirdparty informations in accompanyingCourse index template (twig) --- .../views/AccompanyingCourse/index.html.twig | 121 +++++++++++++++--- 1 file changed, 106 insertions(+), 15 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index e12037cd2..d87b33a2b 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -1,4 +1,5 @@ {% extends 'ChillPersonBundle:AccompanyingCourse:layout.html.twig' %} +{% import '@ChillMain/Address/macro.html.twig' as address %} {% block title %} {{ 'Resume Accompanying Course'|trans }} @@ -6,23 +7,113 @@ {% block content %} - {% if 'DRAFT' == accompanyingCourse.step %} -
- - {{ 'This accompanying course is still a draft'|trans }} - - {{ 'Edit & activate accompanying course'|trans }} - - -
- {% endif %} + {% if 'DRAFT' == accompanyingCourse.step %} +
+ + {{ 'This accompanying course is still a draft'|trans }} + + {{ 'Edit & activate accompanying course'|trans }} + + +
+ {% endif %} -

{{ 'Associated peoples'|trans }}

+

{{ 'Associated peoples'|trans }}

-

{{ 'Resources'|trans }}

+ {% for p in accompanyingCourse.participations %} + {% if p.enddate is null %} +
+ {{ p.person.firstname ~ ' ' ~ p.person.lastname }} +
+ {{ p.person.gender == 'woman' ? 'F' : 'M' }}
+ {{ 'né le ' ~ p.person.birthdate|format_date('short') }}
-

{{ 'Social actions'|trans }}

- -

{{ 'Last events on accompanying course'|trans }}

+ {% if p.person.mobilenumber %} + {{ p.person.mobilenumber }} + {% else %} + + {% if p.person.phonenumber %} + {{ p.person.phonenumber }} + {% else %} + {{ 'No data given'|trans }} + {% endif %} + {% endif %}
+ + {%- if p.person.lastAddress is not empty -%} + {{ address._render(p.person.lastAddress, {'has_no_address': true, 'with_valid_from': false, 'with_icon': true}) }} + {%- else -%} + + {{ 'No address given'|trans }} + {%- endif -%} + +
    +
  • + +
  • +
+ {% endif %} + {% endfor %} + +

{{ 'Resources'|trans }}

+ + {% for r in accompanyingCourse.resources %} + {% if r.person %} +
+ {{ r.person.firstname ~ ' ' ~ r.person.lastname }} + {{ 'Usager' }} +
+ {{ r.person.gender == 'woman' ? 'F' : 'M' }}
+ {{ 'né le ' ~ r.person.birthdate|format_date('short') }}
+ + {% if r.person.mobilenumber %} + {{ r.person.mobilenumber }} + {% else %} + + {% if r.person.phonenumber %} + {{ r.person.phonenumber }} + {% else %} + {{ 'No data given'|trans }} + {% endif %} + {% endif %}
+ + {%- if r.person.lastAddress is not empty -%} + {{ address._render(r.person.lastAddress, {'has_no_address': true, 'with_valid_from': false, 'with_icon': true}) }} + {%- else -%} + + {{ 'No address given'|trans }} + {%- endif -%} + +
    +
  • + +
  • +
+ {% endif %} + + {% if r.thirdParty %} +
+ {{ r.thirdParty.name }} + {{ 'Tiers' }} +
+ {{ r.thirdParty.telephone|chill_print_or_message("thirdparty.No_phonenumber") }}
+ {{ r.thirdParty.email|chill_print_or_message("thirdparty.No_email") }}
+ + {% if r.thirdParty.address == null %} + {{ 'No address given'|trans }} + {% else %} + {{ address._render(r.thirdParty.address, {'with_valid_from': false, 'with_icon': true }) }} + {% endif %} + +
    +
  • + +
  • +
+ {% endif %} + {% endfor %} + +

{{ 'Social actions'|trans }}

+ +

{{ 'Last events on accompanying course'|trans }}

{% endblock %} From 20a14c9ff46a3426e1cb3fdceb4880a5a51555c4 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 24 May 2021 13:19:37 +0200 Subject: [PATCH 05/13] cleaning chillmain.scss --- .../Resources/public/scss/chillmain.scss | 70 ++++++++++--------- 1 file changed, 38 insertions(+), 32 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss b/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss index 6aa0e1c8d..4f421afe6 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss @@ -1,12 +1,48 @@ /* * NOTE 2021.04 - * scss/chill.scss is the main sass file for the new chill.2 + * scss/chillmain.scss is the main sass file for the new chill.2 * scratch will be replaced by bootstrap, please avoid to edit in modules/scratch/_custom.scss * - * when possible, try to use bootstrap class naming + * when possible, try to use bootstrap html class */ + +/* [hack] /!\ Contourne le positionnement problématique du div#content_conainter suivant, + * car sa position: relative le place au-dessus du bandeau et les liens sont incliquables */ +div.subheader { + height: 130px; +} + /* + * Specific rules + */ + +// [scratch] un bouton 'disabled' non clickable +.sc-button { + &.disabled { + cursor: default; + &.bt-remove { + background-color: #d9d9d9; + } + } +} + +// [debug] un affichage discret pour le debug +.discret { + color: grey; + margin-right: 1em; +} + +// reserre la hauteur des rangées de tableau (ul.record_actions prennait trop de place) +table { + ul.record_actions { + margin: 0; + padding: 0.5em; + } +} + +/* + * ACCOMPANYING_COURSE * Header custom for Accompanying Course */ @@ -25,39 +61,9 @@ div#header-accompanying_course-name { } } } - div#header-accompanying_course-details { background: none repeat scroll 0 0 #718596ab; color: #FFF; padding-top: 1em; padding-bottom: 1em; } - -/* /!\ Contourne le positionnement problématique du div#content_conainter suivant, - * car sa position: relative le place au-dessus du bandeau et les liens sont incliquables */ -div.subheader { - height: 130px; -} - -//// SCRATCH BUTTONS -.sc-button { - &.disabled { - cursor: default; - &.bt-remove { - background-color: #d9d9d9; - } - } -} - -//// à ranger -.discret { - color: grey; - margin-right: 1em; -} - -table { - ul.record_actions { - margin: 0; - padding: 0.5em; - } -} From 7efbf2fce84f5adb1761727b45dcf1ce781efac6 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 25 May 2021 10:49:11 +0200 Subject: [PATCH 06/13] =?UTF-8?q?59=20r=C3=A9sum=C3=A9,=20flex=20person=20?= =?UTF-8?q?position?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Resources/public/scss/chillmain.scss | 40 +++++++++++ .../views/AccompanyingCourse/index.html.twig | 71 +++++++++++-------- 2 files changed, 82 insertions(+), 29 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss b/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss index 4f421afe6..145487a89 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss @@ -67,3 +67,43 @@ div#header-accompanying_course-details { padding-top: 1em; padding-bottom: 1em; } + + +div.flex-bloc { + display: flex; + flex-direction: row; + flex-wrap: wrap; + align-items: stretch; + align-content: stretch; + &.right { + justify-content: flex-end; + } + div.item-bloc { + border: 1px solid #000; + margin: 0 1em 1em 0; + padding: 1em; + flex-grow: 0; + flex-shrink: 0; + flex-basis: 30%; + + display: flex; + flex-direction: column; + h5 { + margin-top: 0; + margin-bottom: 0.3em; + } + .content-bloc { + margin: 0; + font-size: 90%; + } + dl { + } + ul.record_actions { + margin-top: auto; + margin-bottom: 0; + } + } + @media only screen and (max-width: 768px) { + flex-direction: column; + } +} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index d87b33a2b..563f57b25 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -19,40 +19,53 @@ {% endif %}

{{ 'Associated peoples'|trans }}

- +
{% for p in accompanyingCourse.participations %} {% if p.enddate is null %} -
- {{ p.person.firstname ~ ' ' ~ p.person.lastname }} -
- {{ p.person.gender == 'woman' ? 'F' : 'M' }}
- {{ 'né le ' ~ p.person.birthdate|format_date('short') }}
+
+ +
{{ p.person.firstname ~ ' ' ~ p.person.lastname }}
+
+ +
+ {{ p.person.gender == 'woman' ? 'F' : 'M' }} +
+
+ {{ 'né le ' ~ p.person.birthdate|format_date('short') }} +
+
+ {% if p.person.mobilenumber %} +
{{ p.person.mobilenumber }} + {% else %} +
+ {% if p.person.phonenumber %} + {{ p.person.phonenumber }} + {% else %} + {{ 'No data given'|trans }} + {% endif %} + {% endif %} + +
+ {%- if p.person.lastAddress is not empty -%} + {{ address._render(p.person.lastAddress, {'has_no_address': true, 'with_valid_from': false, 'with_icon': true}) }} + {%- else -%} +
+ {{ 'No address given'|trans }} + {%- endif -%} + - {% if p.person.mobilenumber %} - {{ p.person.mobilenumber }} - {% else %} - - {% if p.person.phonenumber %} - {{ p.person.phonenumber }} - {% else %} - {{ 'No data given'|trans }} - {% endif %} - {% endif %}
- - {%- if p.person.lastAddress is not empty -%} - {{ address._render(p.person.lastAddress, {'has_no_address': true, 'with_valid_from': false, 'with_icon': true}) }} - {%- else -%} - - {{ 'No address given'|trans }} - {%- endif -%} - -
    -
  • - -
  • -
+
+
    +
  • + +
  • +
+ +
{% endif %} {% endfor %} +
+

{{ 'Resources'|trans }}

From fc2a2da75fe5fa4e59077861a2f67f120de50730 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 25 May 2021 15:36:07 +0200 Subject: [PATCH 07/13] page blocs design --- .../Resources/public/scss/chillmain.scss | 13 ++- .../views/AccompanyingCourse/index.html.twig | 101 +++++++++++------- 2 files changed, 75 insertions(+), 39 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss b/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss index 145487a89..d24708fdb 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss @@ -82,6 +82,7 @@ div.flex-bloc { border: 1px solid #000; margin: 0 1em 1em 0; padding: 1em; + padding-bottom: 0; flex-grow: 0; flex-shrink: 0; flex-basis: 30%; @@ -94,15 +95,23 @@ div.flex-bloc { } .content-bloc { margin: 0; - font-size: 90%; + font-size: 80%; } - dl { + dd { + margin: 0.67em auto; } ul.record_actions { margin-top: auto; margin-bottom: 0; } } + @media only screen and (max-width: 1024px) { + div.item-bloc { + flex-grow: 0; + flex-shrink: 0; + flex-basis: 45%; + } + } @media only screen and (max-width: 768px) { flex-direction: column; } diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index 563f57b25..937fb2e0a 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -28,16 +28,18 @@
- {{ p.person.gender == 'woman' ? 'F' : 'M' }} -
-
- {{ 'né le ' ~ p.person.birthdate|format_date('short') }} + {% set born = (p.person.gender == 'woman') ? 'née': 'né' %} + {% set gender = (p.person.gender == 'woman') ? 'fa-venus' : + (p.person.gender == 'man') ? 'fa-mars' : 'fa-neuter' %} + {% set genderTitle = (p.person.gender == 'woman') ? 'femme' : + (p.person.gender == 'homme') ? 'fa-mars' : 'neutre' %} + {{ born ~ ' le ' ~ p.person.birthdate|format_date('short') }}
{% if p.person.mobilenumber %} -
{{ p.person.mobilenumber }} + {{ p.person.mobilenumber }} {% else %} -
+ {% if p.person.phonenumber %} {{ p.person.phonenumber }} {% else %} @@ -68,62 +70,87 @@

{{ 'Resources'|trans }}

- +
{% for r in accompanyingCourse.resources %} +
{% if r.person %} +
{{ r.person.firstname ~ ' ' ~ r.person.lastname }} {{ 'Usager' }}
- {{ r.person.gender == 'woman' ? 'F' : 'M' }}
- {{ 'né le ' ~ r.person.birthdate|format_date('short') }}
- - {% if r.person.mobilenumber %} - {{ r.person.mobilenumber }} - {% else %} - - {% if r.person.phonenumber %} - {{ r.person.phonenumber }} - {% else %} - {{ 'No data given'|trans }} - {% endif %} - {% endif %}
- - {%- if r.person.lastAddress is not empty -%} - {{ address._render(r.person.lastAddress, {'has_no_address': true, 'with_valid_from': false, 'with_icon': true}) }} - {%- else -%} - - {{ 'No address given'|trans }} - {%- endif -%} +
+ +
+ {% set born = (r.person.gender == 'woman') ? 'née': 'né' %} + {% set gender = (r.person.gender == 'woman') ? 'fa-venus' : + (r.person.gender == 'man') ? 'fa-mars' : 'fa-neuter' %} + {% set genderTitle = (r.person.gender == 'woman') ? 'femme' : + (r.person.gender == 'mhomme') ? 'fa-mars' : 'neutre' %} + {{ born ~ ' le ' ~ r.person.birthdate|format_date('short') }} +
+
+ {% if r.person.mobilenumber %} + {{ r.person.mobilenumber }} + {% else %} + + {% if r.person.phonenumber %} + {{ r.person.phonenumber }} + {% else %} + {{ 'No data given'|trans }} + {% endif %} + {% endif %} +
+
+ {%- if r.person.lastAddress is not empty -%} + {{ address._render(r.person.lastAddress, {'has_no_address': true, 'with_valid_from': false, 'with_icon': true}) }} + {%- else -%} + + {{ 'No address given'|trans }} + {%- endif -%} +
+
+ {% endif %} - {% if r.thirdParty %} +
{{ r.thirdParty.name }} {{ 'Tiers' }}
- {{ r.thirdParty.telephone|chill_print_or_message("thirdparty.No_phonenumber") }}
- {{ r.thirdParty.email|chill_print_or_message("thirdparty.No_email") }}
- - {% if r.thirdParty.address == null %} - {{ 'No address given'|trans }} - {% else %} - {{ address._render(r.thirdParty.address, {'with_valid_from': false, 'with_icon': true }) }} - {% endif %} - +
+ +
+ {{ r.thirdParty.telephone|chill_print_or_message("thirdparty.No_phonenumber") }} +
+
+ {{ r.thirdParty.email|chill_print_or_message("thirdparty.No_email") }} +
+
+ {% if r.thirdParty.address == null %} + {{ 'No address given'|trans }} + {% else %} + {{ address._render(r.thirdParty.address, {'with_valid_from': false, 'with_icon': true }) }} + {% endif %} +
+ +
+ {% endif %} +
{% endfor %} +

{{ 'Social actions'|trans }}

From 31252461c93306cc0a71c95bfcab7eb1ab845fd9 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 25 May 2021 19:05:51 +0200 Subject: [PATCH 08/13] load vue banner component for each page of AccompanyingCourse context * vue css and js loaded from layout.html.twig * rename 'show' template to 'edit' template * overwrite js block for 'edit' template (load all component, not only banner) --- .../AccompanyingCourseController.php | 13 ++--- .../Menu/AccompanyingCourseMenuBuilder.php | 2 +- .../public/vuejs/AccompanyingCourse/index.js | 55 ++++++++++++++----- .../{show.html.twig => edit.html.twig} | 5 +- .../AccompanyingCourse/history.html.twig | 22 ++++---- .../views/AccompanyingCourse/index.html.twig | 3 + .../views/AccompanyingCourse/layout.html.twig | 6 ++ 7 files changed, 70 insertions(+), 36 deletions(-) rename src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/{show.html.twig => edit.html.twig} (86%) diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php index 6786cb05f..e5b0cdda7 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php @@ -72,7 +72,7 @@ class AccompanyingCourseController extends Controller $em->persist($period); $em->flush(); - return $this->redirectToRoute('chill_person_accompanying_course_show', [ + return $this->redirectToRoute('chill_person_accompanying_course_edit', [ 'accompanying_period_id' => $period->getId() ]); @@ -92,17 +92,16 @@ class AccompanyingCourseController extends Controller } /** - * Show page of Accompanying Course section + * Edit page of Accompanying Course section * - * the page show all blocks except one active edit block, managed by vuejs component - * that's why title of page is 'edit accompanying course' + * the page edit all blocks managed by vuejs component * - * @Route("/{_locale}/parcours/{accompanying_period_id}/show", name="chill_person_accompanying_course_show") + * @Route("/{_locale}/parcours/{accompanying_period_id}/edit", name="chill_person_accompanying_course_edit") * @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"}) */ - public function showAction(AccompanyingPeriod $accompanyingCourse): Response + public function editAction(AccompanyingPeriod $accompanyingCourse): Response { - return $this->render('@ChillPerson/AccompanyingCourse/show.html.twig', [ + return $this->render('@ChillPerson/AccompanyingCourse/edit.html.twig', [ 'accompanyingCourse' => $accompanyingCourse ]); } diff --git a/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php index e9ce20b53..49543c42d 100644 --- a/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php @@ -43,7 +43,7 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface ->setExtras(['order' => 10]); $menu->addChild($this->translator->trans('Edit Accompanying Course'), [ - 'route' => 'chill_person_accompanying_course_show', + 'route' => 'chill_person_accompanying_course_edit', 'routeParameters' => [ 'accompanying_period_id' => $period->getId() ]]) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/index.js index 66b6d6683..2a7f19d61 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/index.js @@ -4,20 +4,47 @@ import { appMessages } from './js/i18n' import { initPromise } from './store' import App from './App.vue'; +import Banner from './components/Banner.vue'; -initPromise.then(store => { +const root = window.vueRootComponent; - //console.log('store in create_store', store); - //console.log('store accompanyingCourse', store.state.accompanyingCourse); - - const i18n = _createI18n(appMessages); - - const app = createApp({ - template: ``, - }) - .use(store) - .use(i18n) - .component('app', App) - .mount('#accompanying-course'); +/* +* Load all App component, for AccompanyingCourse edition page +*/ +if (root === 'app') { -}); + initPromise.then(store => { + + const i18n = _createI18n(appMessages); + + const app = createApp({ + template: ``, + }) + .use(store) + .use(i18n) + .component('app', App) + .mount('#accompanying-course'); + + }); +} + +/* +* Load only Banner sub-component, for all others AccompanyingCourse page +*/ +if (root === 'banner') { + + initPromise.then(store => { + + const i18n = _createI18n(appMessages); + + const app = createApp({ + template: ``, + }) + .use(store) + .use(i18n) + .component('banner', Banner) + .mount('#accompanying-course'); + + }); + +} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/show.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/edit.html.twig similarity index 86% rename from src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/show.html.twig rename to src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/edit.html.twig index 23ffb5864..6aa978149 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/show.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/edit.html.twig @@ -10,13 +10,10 @@
{# <== insert accompanyingCourse vue component #} {% endblock %} -{% block css %} - {{ encore_entry_link_tags('accompanying_course') }} -{% endblock %} - {% block js %} {{ encore_entry_script_tags('accompanying_course') }} {% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/history.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/history.html.twig index 8d6ee2a30..9ef00e360 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/history.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/history.html.twig @@ -9,18 +9,20 @@

{{ block('title') }}

-{{ accompanyingCourse.id }}
-{{ accompanyingCourse.openingDate|format_date('short') }}
-{{ accompanyingCourse.closingDate|format_date('short') }}
-{{ accompanyingCourse.closingMotive|chill_entity_render_box }}
-{{ accompanyingCourse.remark|raw }}
-{{ accompanyingCourse.user }}
-usagers:
-{% for p in accompanyingCourse.participations %}
-    {{ p.person.id }} | {{ p.person.fullnamecanonical }} | {{ p.startdate|format_date('short') }} | {{ p.enddate|format_date('short') }}
-{% endfor %}
+    {{ accompanyingCourse.id }}
+    {{ accompanyingCourse.openingDate|format_date('short') }}
+    {{ accompanyingCourse.closingDate|format_date('short') }}
+    {{ accompanyingCourse.closingMotive|chill_entity_render_box }}
+    {{ accompanyingCourse.remark|raw }}
+    {{ accompanyingCourse.user }}
+    usagers:
+    {% for p in accompanyingCourse.participations %}
+        {{ p.person.id }} | {{ p.person.fullnamecanonical }} | {{ p.startdate|format_date('short') }} | {{ p.enddate|format_date('short') }}
+    {% endfor %}
     
{{ dump() }} + {# ==> insert accompanyingCourse vue component #} +
{% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index 937fb2e0a..f2595c65b 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -156,4 +156,7 @@

{{ 'Last events on accompanying course'|trans }}

+ + {# ==> insert accompanyingCourse vue component #} +
{% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/layout.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/layout.html.twig index 82def471c..0bab5d893 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/layout.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/layout.html.twig @@ -16,7 +16,13 @@ {% endblock %} {% block css %} + {{ encore_entry_link_tags('accompanying_course') }} {% endblock %} {% block js %} + + {{ encore_entry_script_tags('accompanying_course') }} {% endblock %} From ce9070e641b33e5693fca12f3f91d68216ca608d Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 25 May 2021 19:09:50 +0200 Subject: [PATCH 09/13] redirect to resume page after confirm action --- .../public/vuejs/AccompanyingCourse/store/index.js | 3 ++- .../Resources/views/AccompanyingCourse/index.html.twig | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js index c9121c5fd..279bfc2a4 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js @@ -191,8 +191,9 @@ let initPromise = getAccompanyingCourse(id) //console.log('## action: confirmAccompanyingCourse'); confirmAccompanyingCourse(id) .then(response => new Promise((resolve, reject) => { + window.location.replace(`/fr/parcours/${id}`); + console.log('fetch resolve'); commit('confirmAccompanyingCourse', response); - console.log('fetch resolve'); // redirection with #top anchor resolve(); })).catch((error) => { commit('catchError', error) }); } diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index f2595c65b..b21fd24ea 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -77,7 +77,7 @@
{{ r.person.firstname ~ ' ' ~ r.person.lastname }} - {{ 'Usager' }} + {{ 'Usager' }}
@@ -122,7 +122,7 @@
{{ r.thirdParty.name }} - {{ 'Tiers' }} + {{ 'Tiers' }}
@@ -130,7 +130,10 @@ {{ r.thirdParty.telephone|chill_print_or_message("thirdparty.No_phonenumber") }}
- {{ r.thirdParty.email|chill_print_or_message("thirdparty.No_email") }} + + + {{ r.thirdParty.email|chill_print_or_message("thirdparty.No_email") }} +
{% if r.thirdParty.address == null %} From 2f27674e05a06c82e22cbe1e07fc625ad876ed96 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 25 May 2021 20:40:05 +0200 Subject: [PATCH 10/13] flex table (row) design --- .../Resources/public/scss/chillmain.scss | 70 ++++++++++++++++++- .../views/AccompanyingCourse/index.html.twig | 8 +-- 2 files changed, 72 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss b/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss index d24708fdb..8770d3100 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss @@ -68,7 +68,11 @@ div#header-accompanying_course-details { padding-bottom: 1em; } +/* +* FLEX RESPONSIVE TABLE/BLOCK PRESENTATION +*/ +/// 1. bloc appearance div.flex-bloc { display: flex; flex-direction: row; @@ -77,16 +81,22 @@ div.flex-bloc { align-content: stretch; &.right { justify-content: flex-end; + div.item-bloc { + margin-left: 1em; + margin-right: 0; + } } div.item-bloc { border: 1px solid #000; - margin: 0 1em 1em 0; + margin-bottom: 1em; + margin-right: 1em; + margin-left: 0; padding: 1em; padding-bottom: 0; flex-grow: 0; flex-shrink: 0; flex-basis: 30%; - + background-color: #e6e6e6; display: flex; flex-direction: column; h5 { @@ -114,5 +124,61 @@ div.flex-bloc { } @media only screen and (max-width: 768px) { flex-direction: column; + div.item-bloc { + margin-right: 0; + } + &.right div.item-bloc { + margin-left: 0; + } + } +} + +/// 2. table appearance +div.flex-table { + display: flex; + flex-direction: column; + align-items: stretch; + align-content: stretch; + div.item-bloc { + border: 1px solid #000; + border-top: 0; + &:first-child { + border-top: 1px solid #000; + } + &:nth-child(even) { + background-color: #e6e6e6; + } + padding: 1em; + display: flex; + flex-direction: row; + & > h5 { + margin-top: 0; + margin-bottom: 0.3em; + flex-grow: 0; + flex-shrink: 0; + flex-basis: 33%; + } + & > .content-bloc { + margin: 0; + font-size: 80%; + flex-grow: 1; + flex-shrink: 0; + flex-basis: 50%; + dd { + margin: 0.67em auto; + } + } + & > ul.record_actions { + flex-grow: 0; + flex-shrink: 0; + flex-basis: 0; + margin-top: auto; + margin-bottom: 0; + } + } + @media only screen and (max-width: 768px) { + div.item-bloc { + flex-direction: column; + } } } diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index b21fd24ea..cf35e89ac 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -19,7 +19,7 @@ {% endif %}

{{ 'Associated peoples'|trans }}

-
+
{% for p in accompanyingCourse.participations %} {% if p.enddate is null %}
@@ -126,15 +126,15 @@
-
- {{ r.thirdParty.telephone|chill_print_or_message("thirdparty.No_phonenumber") }} -
{{ r.thirdParty.email|chill_print_or_message("thirdparty.No_email") }}
+
+ {{ r.thirdParty.telephone|chill_print_or_message("thirdparty.No_phonenumber") }} +
{% if r.thirdParty.address == null %} {{ 'No address given'|trans }} From caeb75ce13214f7be9fb0825b1845336347c7942 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 25 May 2021 21:44:15 +0200 Subject: [PATCH 11/13] vue requestor component, flex-table design --- .../Resources/public/scss/chillmain.scss | 2 +- .../components/Requestor.vue | 101 ++++++++++++------ .../components/StickyNav.vue | 2 +- 3 files changed, 70 insertions(+), 35 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss b/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss index 8770d3100..f931db1e7 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss @@ -151,7 +151,7 @@ div.flex-table { padding: 1em; display: flex; flex-direction: row; - & > h5 { + & > h4, & > h5 { margin-top: 0; margin-bottom: 0.3em; flex-grow: 0; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue index c6783677a..32fbb86c2 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue @@ -3,45 +3,47 @@

{{ $t('requestor.title') }}

-
+
+ -
{{ $t('requestor.type') }}
-
{{ accompanyingCourse.requestor.type }}
-
{{ $t('requestor.text') }}
-
{{ accompanyingCourse.requestor.text }}
-
{{ $t('requestor.is_anonymous') }}
-
{{ accompanyingCourse.requestorAnonymous }}
+
+

+ {{ accompanyingCourse.requestor.type }} + {{ accompanyingCourse.requestor.text }} +

-
-
{{ $t('requestor.person_id') }}
-
{{ accompanyingCourse.requestor.person_id }}
-
{{ $t('requestor.birthdate') }}
-
{{ $d(accompanyingCourse.requestor.birthdate.datetime, 'short') }}
-
{{ $t('requestor.center') }}
-
{{ accompanyingCourse.requestor.center.name }}
-
{{ $t('requestor.firstName') }}
-
{{ accompanyingCourse.requestor.firstName }}
-
{{ $t('requestor.lastName') }}
-
{{ accompanyingCourse.requestor.lastName }}
-
{{ $t('requestor.phonenumber') }}
-
{{ accompanyingCourse.requestor.phonenumber }}
-
{{ $t('requestor.mobilenumber') }}
-
{{ accompanyingCourse.requestor.mobilenumber }}
-
{{ $t('requestor.altNames') }}
-
{{ accompanyingCourse.requestor.altNames }}
-
- -
-
{{ $t('requestor.person_id') }}
-
{{ accompanyingCourse.requestor.thirdparty_id }}
-
{{ $t('requestor.address') }}
-
{{ accompanyingCourse.requestor.address.text }}
-
{{ $t('requestor.location') }}
-
{{ accompanyingCourse.requestor.address.postcode.name }}
+
+ +
{{ $t('requestor.birthdate') }}
+
{{ $d(accompanyingCourse.requestor.birthdate.datetime, 'short') }}
+ +
{{ $t('requestor.center') }}
+
{{ accompanyingCourse.requestor.center.name }}
+ +
{{ $t('requestor.phonenumber') }}
+
{{ accompanyingCourse.requestor.phonenumber }}
+
{{ $t('requestor.mobilenumber') }}
+
{{ accompanyingCourse.requestor.mobilenumber }}
+
+ +
+ +
{{ $t('requestor.address') }}
+
{{ accompanyingCourse.requestor.address.text }}
+ +
{{ $t('requestor.location') }}
+
{{ accompanyingCourse.requestor.address.postcode.name }}
+
+ +
    +
  • + +
  • +
    @@ -53,6 +55,7 @@
+
@@ -104,6 +107,13 @@ export default { get() { return this.$store.state.accompanyingCourse.requestorAnonymous; } + }, + url() { + return (this.accompanyingCourse.requestor.type === 'person') ? { + show: `/fr/person/${this.accompanyingCourse.requestor.id}/general`, + } : { + show: `/fr/thirdparty/thirdparty/${this.accompanyingCourse.requestor.id}/show`, + } } }, methods: { @@ -120,3 +130,28 @@ export default { } } + + diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav.vue index 117c4f09b..3bc1ea33a 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav.vue @@ -184,7 +184,7 @@ div#navmap { } } @media only screen and (max-width: 768px) { - div.sticky-section { + div#navmap { display: none; } } From 37996651c48a909d32e80a1636c721c0409ffa3f Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 26 May 2021 00:09:25 +0200 Subject: [PATCH 12/13] Search list with periods, html/scss refactoring --- .../public/sass/person_with_period.scss | 127 ++++--- .../views/AccompanyingCourse/index.html.twig | 4 +- .../views/Person/list_with_period.html.twig | 318 ++++++++---------- .../translations/messages.fr.yml | 4 +- 4 files changed, 208 insertions(+), 245 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/sass/person_with_period.scss b/src/Bundle/ChillPersonBundle/Resources/public/sass/person_with_period.scss index 7d61483db..2f0e5de55 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/sass/person_with_period.scss +++ b/src/Bundle/ChillPersonBundle/Resources/public/sass/person_with_period.scss @@ -1,68 +1,67 @@ -.person-list--with-period { - .person-list--with-period__item { - margin-bottom: 0; - padding: 1em 1em 2em 1em; - &:nth-last-of-type { - padding-bottom: 1em; - } - - .chill-entity__person { - .chill-entity__person__first-name, - .chill-entity__person__last-name { - font-size: 1.3em; - font-weight: 700; +/// complete and overwrite flex-table in chillmain.scss +div.list-with-period { // .flex-table + + div.item-bloc { + margin-bottom: 0; + + &:nth-last-of-type { + padding-bottom: 1em; } - } - - & > div { - display: flex; - } - @media screen and (min-width: 720px) { + + flex-direction: column; // !! & > div { - flex-direction: row; - - .person-list--with-period__item__box-where { - align-self: flex-end; - margin-left: auto; - width: 33%; - - text-align: right; - } + display: flex; + flex-direction: row; + + &.person { + div.box-person { + flex-grow: 0; + flex-shrink: 0; + flex-basis: 33%; + } + div.box-where { + flex-grow: 1; + flex-shrink: 0; + flex-basis: 40%; + } + ul.record_actions { + flex-grow: 0; + flex-shrink: 0; + flex-basis: 25%; + li { + margin-right: 0; + } + } + @media only screen and (max-width: 768px) { + flex-direction: column; + } + } + + &.periods { + list-style-type: none; + padding: 0; + margin: 0; + display: flex; + flex-direction: column; + div.header { + abbr.referrer { + font-size: 70%; + } + span.user {} + } + span.more { + font-style: italic; + } + } } - } - - @media screen and (max-width: 720px) { - & > div { - flex-direction: column; - } - } - - @media screen and (max-width: 460px) { - .person-list--with-period__item__box-where__center { - display: none; - } - .chill_address { - .street { - display: none; - } - - .country { - display: none; - } - } - } - - ul.person-list--with-period__item__periods { - list-style-type: none; - padding: 0; - margin: 0; - - li { - - } - } - } - .person-list--with-period__item:hover { - background-color: var(--chill-llight-gray); - } + } +} + + +.chill-entity__person { + .chill-entity__person__first-name, + .chill-entity__person__last-name { + font-size: 1.3em; + font-weight: 700; + } } diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index cf35e89ac..1bfb60037 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -11,7 +11,7 @@
{{ 'This accompanying course is still a draft'|trans }} - + {{ 'Edit & activate accompanying course'|trans }} @@ -51,7 +51,7 @@ {%- if p.person.lastAddress is not empty -%} {{ address._render(p.person.lastAddress, {'has_no_address': true, 'with_valid_from': false, 'with_icon': true}) }} {%- else -%} -
+ {{ 'No address given'|trans }} {%- endif -%}
diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig index da571d173..c935a73f9 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig @@ -3,206 +3,168 @@

{{ '%total% persons matching the search pattern:'|transchoice( total, { '%total%' : total}) }} - {{ pattern }} + {{ pattern }}

{{ 'Results %start%-%end% of %total%'|trans({ '%start%' : start, '%end%': start + persons|length, '%total%' : total } ) }}

- + {% if persons|length > 0 %} -
- {% for person in persons %} -
-
-
-
- {{ person|chill_entity_render_box({'addLink': true}) }} - {{ 'Born the %date%'|transchoice(person.genderNumeric, { '%date%': person.birthdate|format_date("medium") }) }} -
- -
-
- {{ person.center }} - {% if person.getLastAddress is not null %} - {{ person.getLastAddress|chill_entity_render_box({'with_valid_from': false}) }} - {% else %} - {{ 'No address'|trans }} - {% endif %} - {% if person.mobilenumber is not empty %} - {{ person.mobilenumber|chill_format_phonenumber }} - {% endif %} - {% if person.phonenumber is not empty %} - {{ person.phonenumber|chill_format_phonenumber }} - {% endif %} - -
-
- - {#- 'apps' is for AccompanyingPeriodParticipationS #} - {#- filter using acl -#} - {%- set apps = [] %} - {%- for app in person.openedParticipations %} - {%- if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', app.accompanyingPeriod) %} - {%- set apps = apps|merge([app]) %} - {%- endif %} - {%- endfor %} - {% if apps|length > 0 %} - - {% endif %} - -
- {% endfor %} -
- - {# - - - - - - - - - - - {% for person in persons %} - - - - - - - {% endfor %} - -
{% trans %}Name{% endtrans %}{% trans %}Date of birth{% endtrans %}{% trans %}Nationality{% endtrans %} 
- {% set is_open = person.isOpen() %} - - {{ person|chill_entity_render_box }} - {% apply spaceless %} - {% if chill_person.fields.accompanying_period == 'visible' %} - {% if is_open == false %} - - {% else %} - - {% endif %} + - {% if person.birthdate is not null %} - {{ person.birthdate|format_date('long') }} - {% else %}{{ 'Unknown date of birth'|trans }}{% endif %} - - {% if person.nationality is not null %} - {{person.nationality.name | localize_translatable_string }} - {% else %} - {{ 'Without nationality'|trans }} - {% endif %} - -
    -
  • - {% if is_granted('CHILL_PERSON_UPDATE', person) %} -
  • {% endif %} -
-
+ + +
+
+ {% if person.getLastAddress is not null %} + {{ person.getLastAddress|chill_entity_render_box({'with_valid_from': false}) }} + {% else %} + {{ 'No address'|trans }} + {% endif %} + + +
+
+ + +
- #} + {#- 'apps' is for AccompanyingPeriodParticipationS #} + {#- filter using acl -#} + {%- set apps = [] %} + {%- for app in person.openedParticipations %} + {%- if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', app.accompanyingPeriod) %} + {%- set apps = apps|merge([app]) %} + {%- endif %} + {%- endfor %} + + {% if apps|length > 0 %} +
+ {% for app in apps %} +
+ + + {% for issue in app.accompanyingPeriod.socialIssues|slice(0,2) %} + {{ issue|chill_entity_render_box }} + {% endfor %} + + {% if app.accompanyingPeriod.socialIssues|length > 2 %} + {{ 'and %number% other'|transchoice(app.accompanyingPeriod.socialIssues|length-2) }} + {% endif %} +
+ {% endfor %} +
+ {% endif %} -
- {% if search_name != "person_similarity" %} -
  • - - {{ 'Advanced search'|trans }} - -
  • - {% endif %} - {% if preview == true and persons|length < total %} -
  • - - {{ 'See all results'|trans }} - -
  • - {% endif %} - + {% endfor %} + + + + {% else %} {% endif %} {% if preview == false %} -{{ chill_pagination(paginator) }} + {{ chill_pagination(paginator) }} {% endif %} - diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index ebb62b6ad..c2f56d7f8 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -125,7 +125,7 @@ Reset: 'Remise à zéro' 'Person search results': 'Recherche de personnes' Person search results by phonenumber: Recherche de personnes par numéro de téléphone 'Search within persons': 'Recherche parmi les personnes' -Open person file: Ouvrir le dossier +Open person file: Ouvrir and %number% other: '{0} et aucun autre| {1} et une autre |]1, Inf] et %number% autres' '%total% persons matching the search pattern:': '{0} Aucune personne ne correspond aux termes de recherche : | {1} Une personne a été trouvée par la recherche : | ]1,Inf] %total% personnes correspondent aux termes de recherche :' 'Last opening since %last_opening%': 'Dernière ouverture le %last_opening%.' @@ -172,6 +172,8 @@ Resources: Interlocuteurs privilégiés Social actions: Actions d'accompagnement Last events on accompanying course: Dernières actions de suivi Edit & activate accompanying course: Modifier et valider +See accompanying periods: Voir les périodes d'accompagnement +Referrer: Référent # pickAPersonType Pick a person: Choisir une personne From 6c8f1f77ff8a7186596833912d426a65573bdc98 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 26 May 2021 18:01:58 +0200 Subject: [PATCH 13/13] improve flex-table and flex-box --- .../Resources/public/scss/chillmain.scss | 189 ++++++++------ .../public/sass/person_with_period.scss | 85 +++---- .../AccompanyingCourse/history.html.twig | 64 ++++- .../views/AccompanyingCourse/index.html.twig | 235 +++++++++--------- .../views/Person/list_with_period.html.twig | 78 +++--- .../translations/messages.fr.yml | 1 + 6 files changed, 368 insertions(+), 284 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss b/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss index f931db1e7..b91aadb42 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss @@ -71,75 +71,102 @@ div#header-accompanying_course-details { /* * FLEX RESPONSIVE TABLE/BLOCK PRESENTATION */ +div.flex-bloc, +div.flex-table { + h2, h3, h4, dl, p { + margin: 0; + } + h2, h3, h4 { + color: var(--chill-blue); + } +} -/// 1. bloc appearance +/* +* Bloc appearance +*/ div.flex-bloc { + box-sizing: border-box; display: flex; flex-direction: row; flex-wrap: wrap; align-items: stretch; align-content: stretch; - &.right { - justify-content: flex-end; - div.item-bloc { - margin-left: 1em; - margin-right: 0; - } - } + div.item-bloc { + flex-grow: 0; flex-shrink: 1; flex-basis: 50%; + + margin: 0; border: 1px solid #000; - margin-bottom: 1em; - margin-right: 1em; - margin-left: 0; padding: 1em; - padding-bottom: 0; - flex-grow: 0; - flex-shrink: 0; - flex-basis: 30%; - background-color: #e6e6e6; + + border-top: 0; + &:nth-child(1), &:nth-child(2) { + border-top: 1px solid #000; + } + border-left: 0; + &:nth-child(odd) { + border-left: 1px solid #000; + } + + //background-color: #e6e6e6; display: flex; flex-direction: column; - h5 { - margin-top: 0; - margin-bottom: 0.3em; - } - .content-bloc { - margin: 0; - font-size: 80%; - } - dd { - margin: 0.67em auto; - } - ul.record_actions { - margin-top: auto; - margin-bottom: 0; + + div.item-row { + flex-grow: 1; flex-shrink: 1; flex-basis: auto; + display: flex; + 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; + display: flex; + + .list-content { // ul, dl, or div + } + ul.record_actions { + margin: 0; + align-self: flex-end; + flex-grow: 1; flex-shrink: 0; flex-basis: auto; + li { + margin-right: 5px; + } + } + } + } } } - @media only screen and (max-width: 1024px) { - div.item-bloc { - flex-grow: 0; - flex-shrink: 0; - flex-basis: 45%; - } - } - @media only screen and (max-width: 768px) { + @media only screen and (max-width: 945px) { margin: auto -0.2em; } + @media only screen and (max-width: 935px) { margin: auto -0.5em; } + @media only screen and (max-width: 920px) { margin: auto -0.9em; } + @media only screen and (max-width: 900px) { flex-direction: column; + margin: auto 0; div.item-bloc { - margin-right: 0; - } - &.right div.item-bloc { - margin-left: 0; + border-left: 1px solid #000; + &:nth-child(2) { + border-top: 0; + } } } } -/// 2. table appearance +/* +* Table appearance +*/ div.flex-table { display: flex; flex-direction: column; align-items: stretch; align-content: stretch; + div.item-bloc { + display: flex; + flex-direction: column; + padding: 1em; border: 1px solid #000; border-top: 0; &:first-child { @@ -148,37 +175,51 @@ div.flex-table { &:nth-child(even) { background-color: #e6e6e6; } - padding: 1em; - display: flex; - flex-direction: row; - & > h4, & > h5 { - margin-top: 0; - margin-bottom: 0.3em; - flex-grow: 0; - flex-shrink: 0; - flex-basis: 33%; - } - & > .content-bloc { - margin: 0; - font-size: 80%; - flex-grow: 1; - flex-shrink: 0; - flex-basis: 50%; - dd { - margin: 0.67em auto; + + div.item-row { + display: flex; + flex-direction: row; + &:not(:first-child) { + margin-top: 0.5em; + border-top: 1px dotted #0000004f; + padding-top: 0.5em; + flex-direction: column; } - } - & > ul.record_actions { - flex-grow: 0; - flex-shrink: 0; - flex-basis: 0; - margin-top: auto; - margin-bottom: 0; + + div.item-col { + &:first-child { + flex-grow: 0; flex-shrink: 0; flex-basis: 33%; + } + &:last-child { + flex-grow: 1; flex-shrink: 1; flex-basis: auto; + display: flex; + justify-content: flex-end; + + .list-content { // ul, dl, or div + } + ul.record_actions { + margin: 0; + align-self: flex-start; + flex-grow: 1; flex-shrink: 0; flex-basis: auto; + li { + margin-right: 5px; + } + } + } + } + @media only screen and (max-width: 900px) { + flex-direction: column; + div.item-col { + &:last-child { + ul.record_actions { + align-self: flex-end; + } + } + } + } + + // neutralize + div.chill_address div.chill_address_address p { text-indent: 0; } } } - @media only screen and (max-width: 768px) { - div.item-bloc { - flex-direction: column; - } - } -} +} diff --git a/src/Bundle/ChillPersonBundle/Resources/public/sass/person_with_period.scss b/src/Bundle/ChillPersonBundle/Resources/public/sass/person_with_period.scss index 2f0e5de55..6f52d2cae 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/sass/person_with_period.scss +++ b/src/Bundle/ChillPersonBundle/Resources/public/sass/person_with_period.scss @@ -1,63 +1,46 @@ /// complete and overwrite flex-table in chillmain.scss -div.list-with-period { // .flex-table - - div.item-bloc { - margin-bottom: 0; - - &:nth-last-of-type { - padding-bottom: 1em; +div.list-with-period { + div.person { + ul.record_actions { + li { + margin-right: 0 !important; + } } - - flex-direction: column; // !! - & > div { - display: flex; - flex-direction: row; - - &.person { - div.box-person { - flex-grow: 0; - flex-shrink: 0; - flex-basis: 33%; - } - div.box-where { - flex-grow: 1; - flex-shrink: 0; - flex-basis: 40%; - } - ul.record_actions { - flex-grow: 0; - flex-shrink: 0; - flex-basis: 25%; - li { - margin-right: 0; - } - } - @media only screen and (max-width: 768px) { - flex-direction: column; + } + div.periods { + div.header, + div.list-content { + width: calc(100% - 40px); + margin-left: 40px; + } + div.header { + position: relative; + a.sc-button { + position: absolute; + width: 30px; + height: 30px; + top: 10px; + left: -40px; + padding: 0; + i { + padding: 5px; } } - - &.periods { - list-style-type: none; - padding: 0; - margin: 0; - display: flex; - flex-direction: column; - div.header { - abbr.referrer { - font-size: 70%; - } - span.user {} - } - span.more { - font-style: italic; - } + abbr.referrer { + font-size: 70%; + } + span.user { + margin-left: 1em; + } + } + div.list-content { + span.more { + font-style: italic; } } } } - .chill-entity__person { .chill-entity__person__first-name, .chill-entity__person__last-name { diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/history.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/history.html.twig index 9ef00e360..f5f1fc067 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/history.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/history.html.twig @@ -8,20 +8,58 @@

    {{ block('title') }}

    -
    -    {{ accompanyingCourse.id }}
    -    {{ accompanyingCourse.openingDate|format_date('short') }}
    -    {{ accompanyingCourse.closingDate|format_date('short') }}
    -    {{ accompanyingCourse.closingMotive|chill_entity_render_box }}
    -    {{ accompanyingCourse.remark|raw }}
    -    {{ accompanyingCourse.user }}
    -    usagers:
    -    {% for p in accompanyingCourse.participations %}
    -        {{ p.person.id }} | {{ p.person.fullnamecanonical }} | {{ p.startdate|format_date('short') }} | {{ p.enddate|format_date('short') }}
    -    {% endfor %}
    -    
    + {# start test flex-table #} +
    + {% for p in accompanyingCourse.participations %} +
    +
    +
    +

    + + {{ p.person.firstname ~ ' ' ~ p.person.lastname }} + +

    +

    + + {{ 'Née le ' ~ p.person.birthdate|format_date('short') }} +

    +
    +
    +
      +
    • + {{ p.startdate|format_date('short') }} → {{ p.enddate|format_date('short') }} +
    • +
    • + +32 488 660 685 +
    • +
    • + robert@brisefeuille.fake.co +
    • +
    • + 59, avenue Fernandez 79, boulevard Laurence Levy 1210 Saint-josse-ten-noode Belgique +
    • +
    +
      +
    • +
    • +
    +
    + +
    +
    + Lorem ipsum dolor sit amet, incididunt ut labore et dolore magna aliqua. +
    +
    + Rhoncus est pellentesque elit eu ultrices vitae auctor. +
    +
    + Facilisis gravida neque convallis a cras semper auctor neque. +
    +
    + {% endfor %} +
    + {# end test flex-table #} - {{ dump() }} {# ==> insert accompanyingCourse vue component #}
    diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index 1bfb60037..98f26987f 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -23,46 +23,48 @@ {% for p in accompanyingCourse.participations %} {% if p.enddate is null %}
    - -
    {{ p.person.firstname ~ ' ' ~ p.person.lastname }}
    -
    - -
    - {% set born = (p.person.gender == 'woman') ? 'née': 'né' %} - {% set gender = (p.person.gender == 'woman') ? 'fa-venus' : - (p.person.gender == 'man') ? 'fa-mars' : 'fa-neuter' %} - {% set genderTitle = (p.person.gender == 'woman') ? 'femme' : - (p.person.gender == 'homme') ? 'fa-mars' : 'neutre' %} - {{ born ~ ' le ' ~ p.person.birthdate|format_date('short') }} -
    -
    - {% if p.person.mobilenumber %} - {{ p.person.mobilenumber }} - {% else %} - - {% if p.person.phonenumber %} - {{ p.person.phonenumber }} - {% else %} - {{ 'No data given'|trans }} - {% endif %} - {% endif %} -
    -
    - {%- if p.person.lastAddress is not empty -%} - {{ address._render(p.person.lastAddress, {'has_no_address': true, 'with_valid_from': false, 'with_icon': true}) }} - {%- else -%} - - {{ 'No address given'|trans }} - {%- endif -%} -
    - -
    -
      -
    • - -
    • -
    - +
    +
    +

    {{ p.person.firstname ~ ' ' ~ p.person.lastname }}

    +

    + {% set born = (p.person.gender == 'woman') ? 'née': 'né' %} + {% set gender = (p.person.gender == 'woman') ? 'fa-venus' : + (p.person.gender == 'man') ? 'fa-mars' : 'fa-neuter' %} + {% set genderTitle = (p.person.gender == 'woman') ? 'femme' : + (p.person.gender == 'homme') ? 'fa-mars' : 'neutre' %} + {{ born ~ ' le ' ~ p.person.birthdate|format_date('short') }} +

    +
    +
    +
      +
    • + {% if p.person.mobilenumber %} + {{ p.person.mobilenumber }} + {% else %} + + {% if p.person.phonenumber %} + {{ p.person.phonenumber }} + {% else %} + {{ 'No data given'|trans }} + {% endif %} + {% endif %} +
    • +
    • + + {%- if p.person.lastAddress is not empty -%} + {{ p.person.getLastAddress|chill_entity_render_box({'with_valid_from': false}) }} + {%- else -%} + {{ 'No address given'|trans }} + {%- endif -%} +
    • +
    +
      +
    • + +
    • +
    +
    +
    {% endif %} {% endfor %} @@ -70,85 +72,96 @@

    {{ 'Resources'|trans }}

    -
    +
    {% for r in accompanyingCourse.resources %}
    {% if r.person %} -
    - {{ r.person.firstname ~ ' ' ~ r.person.lastname }} - {{ 'Usager' }} -
    -
    - -
    - {% set born = (r.person.gender == 'woman') ? 'née': 'né' %} - {% set gender = (r.person.gender == 'woman') ? 'fa-venus' : - (r.person.gender == 'man') ? 'fa-mars' : 'fa-neuter' %} - {% set genderTitle = (r.person.gender == 'woman') ? 'femme' : - (r.person.gender == 'mhomme') ? 'fa-mars' : 'neutre' %} - {{ born ~ ' le ' ~ r.person.birthdate|format_date('short') }} -
    -
    - {% if r.person.mobilenumber %} - {{ r.person.mobilenumber }} - {% else %} - - {% if r.person.phonenumber %} - {{ r.person.phonenumber }} - {% else %} - {{ 'No data given'|trans }} - {% endif %} - {% endif %} -
    -
    - {%- if r.person.lastAddress is not empty -%} - {{ address._render(r.person.lastAddress, {'has_no_address': true, 'with_valid_from': false, 'with_icon': true}) }} - {%- else -%} - - {{ 'No address given'|trans }} - {%- endif -%} -
    - -
    -
      -
    • - -
    • -
    +
    +
    +

    + {{ r.person.firstname ~ ' ' ~ r.person.lastname }} + {{ 'Usager' }} +

    +

    + {% set born = (r.person.gender == 'woman') ? 'née': 'né' %} + {% set gender = (r.person.gender == 'woman') ? 'fa-venus' : + (r.person.gender == 'man') ? 'fa-mars' : 'fa-neuter' %} + {% set genderTitle = (r.person.gender == 'woman') ? 'femme' : + (r.person.gender == 'homme') ? 'fa-mars' : 'neutre' %} + {{ born ~ ' le ' ~ r.person.birthdate|format_date('short') }} +

    +
    +
    +
      +
    • + {% if r.person.mobilenumber %} + {{ r.person.mobilenumber }} + {% else %} + + {% if r.person.phonenumber %} + {{ r.person.phonenumber }} + {% else %} + {{ 'No data given'|trans }} + {% endif %} + {% endif %} +
    • +
    • + + {%- if r.person.lastAddress is not empty -%} + {{ r.person.getLastAddress|chill_entity_render_box({'with_valid_from': false}) }} + {%- else -%} + {{ 'No address given'|trans }} + {%- endif -%} +
    • +
    +
      +
    • + +
    • +
    +
    +
    {% endif %} {% if r.thirdParty %} -
    - {{ r.thirdParty.name }} - {{ 'Tiers' }} -
    -
    - -
    - - - {{ r.thirdParty.email|chill_print_or_message("thirdparty.No_email") }} - -
    -
    - {{ r.thirdParty.telephone|chill_print_or_message("thirdparty.No_phonenumber") }} -
    -
    - {% if r.thirdParty.address == null %} - {{ 'No address given'|trans }} - {% else %} - {{ address._render(r.thirdParty.address, {'with_valid_from': false, 'with_icon': true }) }} - {% endif %} -
    - -
    -
      -
    • - -
    • -
    +
    +
    +

    + {{ r.thirdParty.name }} + {{ 'Tiers' }} +

    +
    +
    + +
      +
    • + +
    • +
    +
    +
    {% endif %}
    diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig index c935a73f9..10c0e0bc7 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig @@ -37,47 +37,47 @@ {% if persons|length > 0 %} -
    +
    {% for person in persons %}
    -
    +
    -
    +
    {{ person|chill_entity_render_box({'addLink': true}) }}
    {{ 'Born the %date%'|transchoice(person.genderNumeric, { '%date%': person.birthdate|format_date("medium") }) }}
    -
    -
    -
    {{ person.center }}
    +
    +
    -
    - -
      +
    + +
    +
    {#- 'apps' is for AccompanyingPeriodParticipationS #} @@ -100,30 +102,36 @@ {%- endfor %} {% if apps|length > 0 %} -
    {% for app in apps %} -
    - - +
    + +
    + + + + {{ 'Since %date%'|trans({'%date%': app.startDate|format_date('medium') }) }} + {% if app.accompanyingPeriod.user is not null %} + + ref: + {{ app.accompanyingPeriod.user|chill_entity_render_box }} + + {% endif %} +
    + +
    {% for issue in app.accompanyingPeriod.socialIssues|slice(0,2) %} - {{ issue|chill_entity_render_box }} + {{ issue|chill_entity_render_box }} {% endfor %} {% if app.accompanyingPeriod.socialIssues|length > 2 %} - {{ 'and %number% other'|transchoice(app.accompanyingPeriod.socialIssues|length-2) }} + {{ 'and %number% other'|transchoice(app.accompanyingPeriod.socialIssues|length-2) }} {% endif %}
    + +
    {% endfor %} -
    + {% endif %}
    diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index c2f56d7f8..12ba14b05 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -173,6 +173,7 @@ Social actions: Actions d'accompagnement Last events on accompanying course: Dernières actions de suivi Edit & activate accompanying course: Modifier et valider See accompanying periods: Voir les périodes d'accompagnement +See accompanying period: Voir cette période d'accompagnement Referrer: Référent # pickAPersonType