From c37b98cecd2c1b869a17665be7bf3dab1160679d Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Tue, 29 Jun 2021 13:53:15 +0200 Subject: [PATCH 01/72] Add a bit more typing to help future development and customizations. --- .../Controller/AbstractCRUDController.php | 31 +++++++++---------- .../CRUD/Controller/ApiController.php | 3 +- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php index a1d28483d..55f3bda24 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php @@ -10,6 +10,7 @@ use Chill\MainBundle\Pagination\PaginatorFactory; use Chill\MainBundle\Pagination\PaginatorInterface; use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Chill\MainBundle\CRUD\Resolver\Resolver; +use Doctrine\ORM\QueryBuilder; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Serializer\SerializerInterface; use Symfony\Component\Translation\TranslatorInterface; @@ -69,7 +70,7 @@ class AbstractCRUDController extends AbstractController * @param Request $request * @return int */ - protected function countEntities(string $action, Request $request, $_format): int + protected function countEntities(string $action, Request $request, string $_format): int { return $this->buildQueryEntities($action, $request) ->select('COUNT(e)') @@ -89,23 +90,23 @@ class AbstractCRUDController extends AbstractController * It returns, by default, a query builder. * */ - protected function queryEntities(string $action, Request $request, string $_format, PaginatorInterface $paginator) + protected function queryEntities(string $action, Request $request, string $_format, PaginatorInterface $paginator): QueryBuilder { - $query = $this->buildQueryEntities($action, $request) + $queryBuilder = $this->buildQueryEntities($action, $request) ->setFirstResult($paginator->getCurrentPage()->getFirstItemNumber()) ->setMaxResults($paginator->getItemsPerPage()); // allow to order queries and return the new query - return $this->orderQuery($action, $query, $request, $paginator, $_format); + return $this->orderQuery($action, $queryBuilder, $request, $paginator, $_format); } /** * Add ordering fields in the query build by self::queryEntities * */ - protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator, $_format) + protected function orderQuery(string $action, QueryBuilder $queryBuilder, Request $request, PaginatorInterface $paginator, string $_format): QueryBuilder { - return $query; + return $queryBuilder; } /** @@ -117,12 +118,8 @@ class AbstractCRUDController extends AbstractController * can add some by using the method `customizeQuery`. * * The alias for the entity is "e". - * - * @param string $action - * @param Request $request - * @return QueryBuilder */ - protected function buildQueryEntities(string $action, Request $request) + protected function buildQueryEntities(string $action, Request $request): QueryBuilder { $qb = $this->getDoctrine()->getManager() ->createQueryBuilder() @@ -135,14 +132,14 @@ class AbstractCRUDController extends AbstractController return $qb; } - protected function customizeQuery(string $action, Request $request, $query): void {} + protected function customizeQuery(string $action, Request $request, QueryBuilder $queryBuilder): void {} /** * Get the result of the query */ - protected function getQueryResult(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $query) + protected function getQueryResult(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, QueryBuilder $queryBuilder): array { - return $query->getQuery()->getResult(); + return $queryBuilder->getQuery()->getResult(); } protected function onPreIndex(string $action, Request $request, string $_format): ?Response @@ -161,7 +158,7 @@ class AbstractCRUDController extends AbstractController /** * method used by indexAction */ - protected function onPostIndexBuildQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $query): ?Response + protected function onPostIndexBuildQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, QueryBuilder $queryBuilder): ?Response { return null; } @@ -169,7 +166,7 @@ class AbstractCRUDController extends AbstractController /** * method used by indexAction */ - protected function onPostIndexFetchQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $entities): ?Response + protected function onPostIndexFetchQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, array $entities): ?Response { return null; } @@ -188,7 +185,7 @@ class AbstractCRUDController extends AbstractController /** * called on post fetch entity */ - protected function onPostFetchEntity(string $action, Request $request, $entity, $_format): ?Response + protected function onPostFetchEntity(string $action, Request $request, $entity, string $_format): ?Response { return null; } diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php index cab0bcdcb..fd55df30b 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php @@ -305,7 +305,8 @@ class ApiController extends AbstractCRUDController if ($response instanceof Response) { return $response; } - + + // TODO: $entity is never set before if (!isset($entity)) { $entity = ''; } From c25c302466b3625674ae86edc84f7b6975febe11 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Tue, 29 Jun 2021 13:54:01 +0200 Subject: [PATCH 02/72] Sort entities recursively. --- .../Controller/SocialIssueApiController.php | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php index 40d7068ce..4b8d87180 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php @@ -4,6 +4,9 @@ namespace Chill\PersonBundle\Controller; use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\Pagination\PaginatorInterface; +use Chill\PersonBundle\Entity\SocialWork\SocialIssue; +use Doctrine\ORM\QueryBuilder; +use Generator; use Symfony\Component\HttpFoundation\Request; class SocialIssueApiController extends ApiController @@ -18,4 +21,41 @@ class SocialIssueApiController extends ApiController ); $query->setParameter('now', new \DateTimeImmutable()); } + + protected function getQueryResult(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, QueryBuilder $queryBuilder): array + { + // Create a lazy generator to avoid performance issues. + $generator = $this->buildRecursively( + $queryBuilder->getQuery()->getResult(), + static fn (SocialIssue $socialIssue): iterable => $socialIssue->getChildren() + ); + + // Sadly, we must convert the generator into an array... + // so we lose all the performance gain we could have by using an iterator. + $results = []; + + // Reduce the generator into an array containing once each SocialIssue. + foreach ($generator as $socialIssue) { + // If the current item hasn't been seen yet, add it to the resultset. + $results += [$socialIssue->getId() => $socialIssue]; + } + + return $results; + } + + /** + * @param iterable $iterable + * @param callable(SocialIssue): iterable $childrenAccessor + * + * @return Generator + */ + private function buildRecursively(iterable $iterable, callable $childrenAccessor): Generator + { + foreach ($iterable as $item) + { + yield $item; + + yield from $this->buildRecursively($childrenAccessor($item), $childrenAccessor); + } + } } From 401659748c534d5329a38bb3c7081181c7b43a7c Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Tue, 29 Jun 2021 15:23:00 +0200 Subject: [PATCH 03/72] Default entities order: title ASC --- .../Controller/SocialIssueApiController.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php index 4b8d87180..62a708c45 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php @@ -5,9 +5,11 @@ namespace Chill\PersonBundle\Controller; use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\Pagination\PaginatorInterface; use Chill\PersonBundle\Entity\SocialWork\SocialIssue; +use DateTimeImmutable; use Doctrine\ORM\QueryBuilder; use Generator; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; class SocialIssueApiController extends ApiController { @@ -19,7 +21,7 @@ class SocialIssueApiController extends ApiController $query->expr()->isNull('e.desactivationDate') ) ); - $query->setParameter('now', new \DateTimeImmutable()); + $query->setParameter('now', new DateTimeImmutable()); } protected function getQueryResult(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, QueryBuilder $queryBuilder): array @@ -43,6 +45,15 @@ class SocialIssueApiController extends ApiController return $results; } + protected function onPostIndexBuildQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, QueryBuilder $queryBuilder): ?Response + { + $queryBuilder + ->orderBy("GET_JSON_FIELD_BY_KEY(e.title, :locale)", 'ASC') + ->setParameter(':locale', $request->getLocale()); + + return null; + } + /** * @param iterable $iterable * @param callable(SocialIssue): iterable $childrenAccessor From d50d3e0e4b55a154a3c1fbcd96c93921f79d1669 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 30 Jun 2021 08:33:11 +0200 Subject: [PATCH 04/72] Revert "Add a bit more typing to help future development and customizations." This reverts commit 32ce244de551c437d8eef08edeb1fd1906036827. --- .../Controller/AbstractCRUDController.php | 31 ++++++++++--------- .../CRUD/Controller/ApiController.php | 3 +- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php index 55f3bda24..a1d28483d 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php @@ -10,7 +10,6 @@ use Chill\MainBundle\Pagination\PaginatorFactory; use Chill\MainBundle\Pagination\PaginatorInterface; use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Chill\MainBundle\CRUD\Resolver\Resolver; -use Doctrine\ORM\QueryBuilder; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Serializer\SerializerInterface; use Symfony\Component\Translation\TranslatorInterface; @@ -70,7 +69,7 @@ class AbstractCRUDController extends AbstractController * @param Request $request * @return int */ - protected function countEntities(string $action, Request $request, string $_format): int + protected function countEntities(string $action, Request $request, $_format): int { return $this->buildQueryEntities($action, $request) ->select('COUNT(e)') @@ -90,23 +89,23 @@ class AbstractCRUDController extends AbstractController * It returns, by default, a query builder. * */ - protected function queryEntities(string $action, Request $request, string $_format, PaginatorInterface $paginator): QueryBuilder + protected function queryEntities(string $action, Request $request, string $_format, PaginatorInterface $paginator) { - $queryBuilder = $this->buildQueryEntities($action, $request) + $query = $this->buildQueryEntities($action, $request) ->setFirstResult($paginator->getCurrentPage()->getFirstItemNumber()) ->setMaxResults($paginator->getItemsPerPage()); // allow to order queries and return the new query - return $this->orderQuery($action, $queryBuilder, $request, $paginator, $_format); + return $this->orderQuery($action, $query, $request, $paginator, $_format); } /** * Add ordering fields in the query build by self::queryEntities * */ - protected function orderQuery(string $action, QueryBuilder $queryBuilder, Request $request, PaginatorInterface $paginator, string $_format): QueryBuilder + protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator, $_format) { - return $queryBuilder; + return $query; } /** @@ -118,8 +117,12 @@ class AbstractCRUDController extends AbstractController * can add some by using the method `customizeQuery`. * * The alias for the entity is "e". + * + * @param string $action + * @param Request $request + * @return QueryBuilder */ - protected function buildQueryEntities(string $action, Request $request): QueryBuilder + protected function buildQueryEntities(string $action, Request $request) { $qb = $this->getDoctrine()->getManager() ->createQueryBuilder() @@ -132,14 +135,14 @@ class AbstractCRUDController extends AbstractController return $qb; } - protected function customizeQuery(string $action, Request $request, QueryBuilder $queryBuilder): void {} + protected function customizeQuery(string $action, Request $request, $query): void {} /** * Get the result of the query */ - protected function getQueryResult(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, QueryBuilder $queryBuilder): array + protected function getQueryResult(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $query) { - return $queryBuilder->getQuery()->getResult(); + return $query->getQuery()->getResult(); } protected function onPreIndex(string $action, Request $request, string $_format): ?Response @@ -158,7 +161,7 @@ class AbstractCRUDController extends AbstractController /** * method used by indexAction */ - protected function onPostIndexBuildQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, QueryBuilder $queryBuilder): ?Response + protected function onPostIndexBuildQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $query): ?Response { return null; } @@ -166,7 +169,7 @@ class AbstractCRUDController extends AbstractController /** * method used by indexAction */ - protected function onPostIndexFetchQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, array $entities): ?Response + protected function onPostIndexFetchQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $entities): ?Response { return null; } @@ -185,7 +188,7 @@ class AbstractCRUDController extends AbstractController /** * called on post fetch entity */ - protected function onPostFetchEntity(string $action, Request $request, $entity, string $_format): ?Response + protected function onPostFetchEntity(string $action, Request $request, $entity, $_format): ?Response { return null; } diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php index fd55df30b..cab0bcdcb 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php @@ -305,8 +305,7 @@ class ApiController extends AbstractCRUDController if ($response instanceof Response) { return $response; } - - // TODO: $entity is never set before + if (!isset($entity)) { $entity = ''; } From b41b1346e5152734709edcb320ff3a0ad2949516 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 30 Jun 2021 08:37:49 +0200 Subject: [PATCH 05/72] Remove typing. Request from https://gitlab.com/Chill-Projet/chill-bundles/-/merge_requests/99 --- .../Controller/SocialIssueApiController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php index 62a708c45..4437955ed 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php @@ -24,11 +24,11 @@ class SocialIssueApiController extends ApiController $query->setParameter('now', new DateTimeImmutable()); } - protected function getQueryResult(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, QueryBuilder $queryBuilder): array + protected function getQueryResult(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $query) { // Create a lazy generator to avoid performance issues. $generator = $this->buildRecursively( - $queryBuilder->getQuery()->getResult(), + $query->getQuery()->getResult(), static fn (SocialIssue $socialIssue): iterable => $socialIssue->getChildren() ); @@ -45,9 +45,9 @@ class SocialIssueApiController extends ApiController return $results; } - protected function onPostIndexBuildQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, QueryBuilder $queryBuilder): ?Response + protected function onPostIndexBuildQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $query): ?Response { - $queryBuilder + $query ->orderBy("GET_JSON_FIELD_BY_KEY(e.title, :locale)", 'ASC') ->setParameter(':locale', $request->getLocale()); From d208a79764280733e1f1a830b6ac09e61562ecd1 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 30 Jun 2021 15:47:38 +0200 Subject: [PATCH 06/72] Add Doctrine extension. --- .../ChillMainExtension.php | 6 ++- .../Hydration/FlatHierarchyEntityHydrator.php | 48 +++++++++++++++++++ 2 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index 6826f854c..1637ee098 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -32,9 +32,8 @@ use Chill\MainBundle\Doctrine\DQL\JsonAggregate; use Chill\MainBundle\Doctrine\DQL\JsonbExistsInArray; use Chill\MainBundle\Doctrine\DQL\Similarity; use Chill\MainBundle\Doctrine\DQL\OverlapsI; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; use Chill\MainBundle\Doctrine\DQL\Replace; +use Chill\MainBundle\Doctrine\ORM\Hydration\FlatHierarchyEntityHydrator; use Chill\MainBundle\Doctrine\Type\NativeDateIntervalType; use Chill\MainBundle\Doctrine\Type\PointType; use Symfony\Component\HttpFoundation\Request; @@ -186,6 +185,9 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface, 'OVERLAPSI' => OverlapsI::class, ], ], + 'hydrators' => [ + 'chill_flat_hierarchy_list' => FlatHierarchyEntityHydrator::class, + ], ], ], ); diff --git a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php new file mode 100644 index 000000000..ed7588f94 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php @@ -0,0 +1,48 @@ +buildRecursively( + parent::hydrateAllData(), + static fn($value): iterable => $value->getChildren(), + ); + + $result = []; + + foreach ($generator as $entity) { + // We cannot expect anything from the object entity + // so, we cannot expect it to have a ::getId() method. + // So we use spl_object_hash() instead. + $result += [spl_object_hash($entity) => $entity]; + } + + return array_values($result); + } + + /** + * @param iterable $iterable + * @param callable(SocialIssue): iterable $childrenAccessor + * + * @return Generator + */ + private function buildRecursively(iterable $iterable, callable $childrenAccessor): Generator + { + foreach ($iterable as $item) + { + yield $item; + + yield from $this->buildRecursively($childrenAccessor($item), $childrenAccessor); + } + } +} From e1f8aa5a5ef3c6c75087f4e5589213598b5cddc2 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 30 Jun 2021 15:49:23 +0200 Subject: [PATCH 07/72] Use custom Doctrine hydrator. --- .../Controller/SocialIssueApiController.php | 40 ++----------------- 1 file changed, 4 insertions(+), 36 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php index 4437955ed..63deadd03 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php @@ -3,11 +3,9 @@ namespace Chill\PersonBundle\Controller; use Chill\MainBundle\CRUD\Controller\ApiController; +use Chill\MainBundle\Doctrine\ORM\Hydration\FlatHierarchyEntityHydrator; use Chill\MainBundle\Pagination\PaginatorInterface; -use Chill\PersonBundle\Entity\SocialWork\SocialIssue; use DateTimeImmutable; -use Doctrine\ORM\QueryBuilder; -use Generator; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -26,23 +24,9 @@ class SocialIssueApiController extends ApiController protected function getQueryResult(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $query) { - // Create a lazy generator to avoid performance issues. - $generator = $this->buildRecursively( - $query->getQuery()->getResult(), - static fn (SocialIssue $socialIssue): iterable => $socialIssue->getChildren() - ); - - // Sadly, we must convert the generator into an array... - // so we lose all the performance gain we could have by using an iterator. - $results = []; - - // Reduce the generator into an array containing once each SocialIssue. - foreach ($generator as $socialIssue) { - // If the current item hasn't been seen yet, add it to the resultset. - $results += [$socialIssue->getId() => $socialIssue]; - } - - return $results; + // In order to work, this hydrator only works with + // entities having the field "children" set up. + return $query->getQuery()->getResult(FlatHierarchyEntityHydrator::LIST); } protected function onPostIndexBuildQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $query): ?Response @@ -53,20 +37,4 @@ class SocialIssueApiController extends ApiController return null; } - - /** - * @param iterable $iterable - * @param callable(SocialIssue): iterable $childrenAccessor - * - * @return Generator - */ - private function buildRecursively(iterable $iterable, callable $childrenAccessor): Generator - { - foreach ($iterable as $item) - { - yield $item; - - yield from $this->buildRecursively($childrenAccessor($item), $childrenAccessor); - } - } } From ef6c5870b55cc6025c7ba21651b8b1b5c360c664 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 30 Jun 2021 22:44:43 +0200 Subject: [PATCH 08/72] Prevent multiples sub-queries. --- .../ORM/Hydration/FlatHierarchyEntityHydrator.php | 8 +++++++- .../Controller/SocialIssueApiController.php | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php index ed7588f94..d28c7af09 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php +++ b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php @@ -15,7 +15,13 @@ final class FlatHierarchyEntityHydrator extends ObjectHydrator { $generator = $this->buildRecursively( parent::hydrateAllData(), - static fn($value): iterable => $value->getChildren(), + static function($value): iterable { + $children = $value->getChildren(); + + $children->setInitialized(true); + + return $children; + } ); $result = []; diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php index 63deadd03..c1d251efb 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php @@ -6,6 +6,7 @@ use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\Doctrine\ORM\Hydration\FlatHierarchyEntityHydrator; use Chill\MainBundle\Pagination\PaginatorInterface; use DateTimeImmutable; +use Doctrine\ORM\Query; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -26,7 +27,10 @@ class SocialIssueApiController extends ApiController { // In order to work, this hydrator only works with // entities having the field "children" set up. - return $query->getQuery()->getResult(FlatHierarchyEntityHydrator::LIST); + return $query + ->getQuery() + ->setHint(Query::HINT_INCLUDE_META_COLUMNS, true) + ->getResult(FlatHierarchyEntityHydrator::LIST); } protected function onPostIndexBuildQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $query): ?Response From b33cb4946c0641c28f0fc4e0a65bb0f3ae96789d Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Thu, 1 Jul 2021 09:12:39 +0200 Subject: [PATCH 09/72] Improve/optimize list generation. --- .../Hydration/FlatHierarchyEntityHydrator.php | 60 +++++++++---------- 1 file changed, 27 insertions(+), 33 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php index d28c7af09..0bd9505a6 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php +++ b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php @@ -11,44 +11,38 @@ final class FlatHierarchyEntityHydrator extends ObjectHydrator { public const LIST = 'chill_flat_hierarchy_list'; - protected function hydrateAllData(): array + protected function hydrateAllData() { - $generator = $this->buildRecursively( - parent::hydrateAllData(), - static function($value): iterable { - $children = $value->getChildren(); - - $children->setInitialized(true); - - return $children; - } - ); - - $result = []; - - foreach ($generator as $entity) { - // We cannot expect anything from the object entity - // so, we cannot expect it to have a ::getId() method. - // So we use spl_object_hash() instead. - $result += [spl_object_hash($entity) => $entity]; - } - - return array_values($result); + return array_values(iterator_to_array($this->flatListGenerator($this->buildChildrenHashmap(parent::hydrateAllData())))); } - /** - * @param iterable $iterable - * @param callable(SocialIssue): iterable $childrenAccessor - * - * @return Generator - */ - private function buildRecursively(iterable $iterable, callable $childrenAccessor): Generator + private function flatListGenerator(array $hashMap, $parent = null): Generator { - foreach ($iterable as $item) - { - yield $item; + $parent = null === $parent ? + null : + spl_object_hash($parent); - yield from $this->buildRecursively($childrenAccessor($item), $childrenAccessor); + $hashMap += [$parent => []]; + + foreach ($hashMap[$parent] as $node) { + yield $node->getId() => $node; + yield from $this->flatListGenerator($hashMap, $node); } } + + private function buildChildrenHashmap(array $nodes): array + { + $r = []; + + foreach ($nodes as $node) { + $parentId = (null !== $parent = $node->getParent()) + ? spl_object_hash($parent) + : null; + + $r[$parentId][] = $node; + } + + return $r; + } + } From cc824faf544b04fa4a31c4410917e47b0677a186 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Sat, 10 Jul 2021 07:50:15 +0200 Subject: [PATCH 10/72] Improve performance. --- .../Hydration/FlatHierarchyEntityHydrator.php | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php index 0bd9505a6..eaa7b6c72 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php +++ b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php @@ -16,33 +16,33 @@ final class FlatHierarchyEntityHydrator extends ObjectHydrator return array_values(iterator_to_array($this->flatListGenerator($this->buildChildrenHashmap(parent::hydrateAllData())))); } - private function flatListGenerator(array $hashMap, $parent = null): Generator + private function flatListGenerator(array $hashMap, ?int $parent = null): Generator { - $parent = null === $parent ? - null : - spl_object_hash($parent); + $parent ??= spl_object_id($parent); $hashMap += [$parent => []]; foreach ($hashMap[$parent] as $node) { - yield $node->getId() => $node; + yield spl_object_id($node) => $node; yield from $this->flatListGenerator($hashMap, $node); } } private function buildChildrenHashmap(array $nodes): array { - $r = []; + return array_reduce( + $nodes, + static function (array $collect, $node) { + $parentId = (null === $parent = $node->getParent()) ? + null : + spl_object_id($parent); - foreach ($nodes as $node) { - $parentId = (null !== $parent = $node->getParent()) - ? spl_object_hash($parent) - : null; + $collect[$parentId][] = $node; - $r[$parentId][] = $node; - } - - return $r; + return $collect; + }, + [] + ); } } From 53d3a0921ba12a0b0dcbc8d4629f737d84e1a111 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Sat, 10 Jul 2021 08:17:37 +0200 Subject: [PATCH 11/72] Fix minor bug. --- .../Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php index eaa7b6c72..91013ddba 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php +++ b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php @@ -18,8 +18,7 @@ final class FlatHierarchyEntityHydrator extends ObjectHydrator private function flatListGenerator(array $hashMap, ?int $parent = null): Generator { - $parent ??= spl_object_id($parent); - + $parent = null === $parent ? null : spl_object_id($parent); $hashMap += [$parent => []]; foreach ($hashMap[$parent] as $node) { From d0b51f3573336fcad5490fe3e0fb3eae1ffd3add Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Sat, 10 Jul 2021 08:18:00 +0200 Subject: [PATCH 12/72] Add minor typing. --- .../Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php index 91013ddba..48b6ff875 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php +++ b/src/Bundle/ChillMainBundle/Doctrine/ORM/Hydration/FlatHierarchyEntityHydrator.php @@ -31,7 +31,7 @@ final class FlatHierarchyEntityHydrator extends ObjectHydrator { return array_reduce( $nodes, - static function (array $collect, $node) { + static function (array $collect, $node): array { $parentId = (null === $parent = $node->getParent()) ? null : spl_object_id($parent); From a48d7f5e9475ddbf065ae01ceb104b70c1a5aee7 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sat, 31 Jul 2021 10:34:20 +0200 Subject: [PATCH 13/72] move styles from bootstrap custom to chill entrypoint. split chillmain with imports sheets. clean styles --- .../Resources/public/chill/chillmain.scss | 305 +++++++++++++++++- .../Resources/public/chill/css/chillmain.css | 25 -- .../Resources/public/chill/index.js | 3 +- .../_buttons.scss => chill/scss/buttons.scss} | 0 .../Resources/public/chill/scss/forms.scss | 39 +++ .../Resources/public/chill/scss/mixins.scss | 14 + .../scss/record_actions.scss} | 51 +-- .../public/module/bootstrap/_custom.scss | 280 +--------------- .../bootstrap/{shared.scss => _shared.scss} | 0 .../views/SingleTask/_list.html.twig | 38 +-- .../public/chill/chillthirdparty.scss | 57 ---- 11 files changed, 395 insertions(+), 417 deletions(-) delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/chill/css/chillmain.css rename src/Bundle/ChillMainBundle/Resources/public/{module/bootstrap/custom/_buttons.scss => chill/scss/buttons.scss} (100%) create mode 100644 src/Bundle/ChillMainBundle/Resources/public/chill/scss/forms.scss rename src/Bundle/ChillMainBundle/Resources/public/{module/bootstrap/custom/_record_actions.scss => chill/scss/record_actions.scss} (71%) rename src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/{shared.scss => _shared.scss} (100%) diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss index 97c5e3cc9..c1aa19213 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss @@ -4,23 +4,153 @@ // Chill mixins @import './scss/mixins'; +// Chill buttons +@import './scss/buttons'; + +// Chill forms +@import './scss/forms'; + +// Chill record_actions +@import './scss/record_actions'; + // Chill entity render box system @import './scss/render_box'; // Chill flex responsive table/block presentation @import './scss/flex_table'; + /* - * Specific rules + * BASE LAYOUT POSITION */ -.custom_field_no_data, -.chill-no-data-statement { - font-style: italic; +body { + display: flex; + flex-direction: column; + min-height: 100vh; + footer { + margin-top: auto; + } +} + +header { + nav.navbar { + padding: 0; + a.navbar-brand img { + height: 50px; + margin: 8px 0; + } + div.navbar-collapse { + float: right; + } + ul.navbar-nav { + display: flex; + align-items: stretch; + li.nav-item { + display: flex; + &.btn { + padding-top: 0; + padding-bottom: 0; + } + & > a { + align-self: center; + } + form.form-inline { + align-self: center; + display: flex; + input.form-control { + align-self: center; + height: 32px; + } + } + } + } + div.dropdown-menu { + margin: 0; + padding: 0; + border-radius: 0; + a.dropdown-item { + width: 120%; + border: 0; + border-bottom: 1px solid $gray-200; + font-size: smaller; + i { + float: right; } + &:hover { + color: $gray-500 !important; } + } + } + + // fullwidth menu when navbar is collapsed + @media (max-width: 767px) { + & { + position: relative; + } + button.navbar-toggler { + float: right; + } + div.navbar-collapse { + float: none; + position: absolute; + top: 4em; + left: 0; + right: 0; + z-index: 2; + padding: 1em; + border-top: 1px solid shade-color($primary, 25%); + ul.navbar-nav { + display: grid; + grid-template-areas: + "sear sear sear" + "sect user lang"; + li.nav-item { + flex-direction: column; + border: 0; + a.nav-link {} + &.navigation-search { + grid-area: sear; + margin-bottom: 1em; + form { + width: 100%; + input.form-control {} + button.btn {} + } + } + &.nav-section { grid-area: sect; } + &.nav-user { grid-area: user; } + &.nav-language { grid-area: lang; } + } + li.dropdown { + &, & > * { + background-color: transparent !important; + } + a.dropdown-toggle {} + div.dropdown-menu { + display: block; + border: 0; + a.dropdown-item { + width: 100%; + border: 0; + border-top: 1px dotted $gray-200; + background-color: transparent !important; + } + } + } + } + } + } + + } } -// styles communs pour tous les bandeaux div.banner { + a { + text-decoration: none; + &.phone, + &.email { + color: white; + } + } .id-number { font-weight: lighter; font-size: 50%; @@ -28,17 +158,166 @@ div.banner { &:before { content: '(n°'; } &:after { content: ')'; } } - a.phone, - a.email { - color: white; - } - ul.list-content { - //margin: 0 auto; - } span.age { margin-left: 0.5em; &:before { content: '('; } &:after { content: ')'; } } - +} + +div.vertical-menu { + border-radius: 0; + margin-top: 0.5rem; + a.list-group-item { + background-color: $chill-yellow; + border: 0; + margin-bottom: 0.25rem; + &:hover { + background-color: tint-color($chill-yellow, 20%) + } + } +} + +footer.footer { + background: $dark; + padding-top: 10px; + padding-bottom: 10px; + width: 100%; + p { + font-family: Open Sans; + font-weight: 300; + clear: both; + color: $white; + font-size: 0.9em; + line-height: 1.5em; + margin: auto; + max-width: 35em; + text-align: center; + a, a:hover { + text-decoration: underline; + } + } +} + + +/* + * SPECIFIC RULES + */ + +/// titles +h1, h2, +.h1, .h2 { + font-weight: $headings-font-weight + 200; +} + +/// typography +.open_sansbold { + font-weight: bold; +} + +/// no borders on head table +table.table-bordered { + thead, thead * { + border: 0 !important; + text-align: center; + } +} + +/// chill elements of design +.chill-user-quote { + border-left: 10px solid $yellow; + margin: 1.5em 10px; + padding: 0.5em 15px; + quotes: "\201C" "\201D" "\2018" "\2019"; + background-color: $gray-200; + blockquote { + border-left: 0.4em solid $gray-400; + padding-left: 0.9em; + margin-left: 0.9em; + font-style: italic; + } +} + +.custom_field_no_data, +.chill-no-data-statement { + font-style: italic; +} + +//// still used ? +// move from chillmain.css, converted to sass + +div#usefulbar { + background-color: #fbba3a; + z-index: 1000; + padding-right: 15px; + + form { + margin: 0; + } + i.menu { + font-size: 2em; + } + ul { + display: flex; + justify-content: flex-end; + margin: 0; + padding-top: 5px; + padding-right: 10px; + } + li { + color: white; + margin-left: 10px; + a { + color: white; + text-shadow: 0px 0px 1px #555; + } + i.icon-user-add { + &:before { + vertical-align: -5px; + } + } + &#search_element { + text-align: right; + } + &#search_element div#search_form { + margin: 0; + padding: 0; + button { + color: white; + border: none; + bottom: -2px; + height: 35px; + } + } + &#search_element div#search_form { + div, .field { + margin: 0; + } + } + } +} + +div#flashMessages { + margin-top: 20px; + .flash-notice { + margin-top: 10px; + margin-bottom: 10px; + } +} + +.personName { + font-variant: small-caps; + text-transform: capitalize; +} + +input.belgian_national_number_inversed_date { + width: 7em; + margin-right: 1em; +} +input.belgian_national_number_daily_counter { + width: 4em; + margin-right: 1em; +} +input.belgian_national_number_control_digit { + width: 3em; } diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/css/chillmain.css b/src/Bundle/ChillMainBundle/Resources/public/chill/css/chillmain.css deleted file mode 100644 index 85c247173..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/css/chillmain.css +++ /dev/null @@ -1,25 +0,0 @@ -div#usefulbar { background-color: #fbba3a; z-index: 1000; padding-right: 15px; } -div#usefulbar form { margin: 0; } -div#usefulbar i.menu { font-size: 2em; } -div#usefulbar ul { display: flex; justify-content: flex-end; margin: 0; padding-top: 5px; padding-right: 10px; } -div#usefulbar li { color: white; margin-left: 10px; } -div#usefulbar li a { color: white; text-shadow: 0px 0px 1px #555; } -div#usefulbar li i.icon-user-add:before { vertical-align: -5px; } -div#usefulbar li#search_element { text-align: right; } -div#usefulbar li#search_element div#search_form { margin: 0; padding: 0; } -div#usefulbar li#search_element div#search_form div { margin: 0; } -div#usefulbar li#search_element div#search_form .field { margin: 0; } -div#usefulbar li#search_element div#search_form button { color: white; border: none; bottom: -2px; height: 35px; } - -div#flashMessages { margin-top: 20px; } -div#flashMessages .flash-notice { margin-top: 10px; margin-bottom: 10px; } - -.personName { font-variant: small-caps; text-transform: capitalize; } - -.personName { text-transform: capitalize; } - -input.belgian_national_number_inversed_date { width: 7em; margin-right: 1em; } - -input.belgian_national_number_daily_counter { width: 4em; margin-right: 1em; } - -input.belgian_national_number_control_digit { width: 3em; } \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/index.js b/src/Bundle/ChillMainBundle/Resources/public/chill/index.js index cf7365631..84f11fa43 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/index.js @@ -14,12 +14,12 @@ global.select2 = select2; require('select2/dist/css/select2.css'); require('select2-bootstrap-theme/dist/select2-bootstrap.css'); + /* * Load Chill themes assets */ require('./chillmain.scss'); -require('./css/chillmain.css'); import { chill } from './js/chill.js'; global.chill = chill; @@ -34,6 +34,7 @@ require('./img/favicon.ico'); require('./img/logo-chill-sans-slogan_white.png'); require('./img/logo-chill-outil-accompagnement_white.png'); + /* * Load local libs * Some libs are only used in a few pages, they are loaded on a case by case basis diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_buttons.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss similarity index 100% rename from src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_buttons.scss rename to src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/forms.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/forms.scss new file mode 100644 index 000000000..078e43787 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/forms.scss @@ -0,0 +1,39 @@ +/// forms +form { + + /* avoid useless html in first level of the custom fields row loop in forms + * (better should to improve the loop) + */ + & > div.container-fluid { + & > div.row > .parent { + padding: 0; + & div.cf-fields span.cf-title { + margin: 1em -15px 0; + width: calc(100% + 30px); + @include title_in_form; + } + } + } + + fieldset { + margin-top: 1em; + & > legend { + @include title_in_form; + } + } + + label { + display: inline; + &.required:after { + content: " *"; + color: $red; + } + } +} + +.col-form-label { + padding-top: .5em; + padding-bottom: .5em; + font-weight: 700; + margin-bottom: .375em; +} diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/mixins.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/mixins.scss index 22e1d310e..ad7244af7 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/mixins.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/mixins.scss @@ -1,4 +1,18 @@ +// +// +// + +@mixin title_in_form { + font-size: 1.438em; + font-weight: 700; + width: 100%; + border-bottom: 3px solid $gray-200; + margin-bottom: 1em; + display: block; +} + + // We use box-shadow instead of border // to avoid to manage border double-width // Then we can simulate border-collapse: collapse (table) diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_record_actions.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/record_actions.scss similarity index 71% rename from src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_record_actions.scss rename to src/Bundle/ChillMainBundle/Resources/public/chill/scss/record_actions.scss index 8ddc1b009..efedac51d 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_record_actions.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/record_actions.scss @@ -1,13 +1,22 @@ -ul.record_actions, -ul.record_actions_column { +ul.record_actions { display: flex; + flex-direction: row; + flex-wrap: wrap-reverse; justify-content: flex-end; + padding: 0.5em 0; - &.record_actions--left { + &.column { + flex-direction: column; + } + + &.left { justify-content: flex-start; } - padding: 0.5em 0; - flex-wrap: wrap-reverse; + + &.sticky-form-buttons { + padding-left: 1em; + padding-right: 1em; + } li { display: inline-block; @@ -18,37 +27,33 @@ ul.record_actions_column { &:last-child { margin-right: 0; } - } - li.cancel { - order: 1; - margin-right: auto; + &.cancel { + order: 1; + margin-right: auto; + } } } - -ul.record_actions { - flex-direction: row; -} - -ul.record_actions_column { - flex-direction: column; -} - -ul.record_actions.sticky-form-buttons { - padding-left: 1em; - padding-right: 1em; +.sticky-form-buttons { + margin-top: 4em; + background-color: $beige; + position: sticky; + bottom: 0.3em; + text-align: center; + display: flex; + padding: 0.8em 1.6em; + border-radius: 0; } +/// EXCEPTIONS // inside table exceptions table { - td ul.record_actions, ul.record_actions_small { li { margin-right: 0.2em; } } - ul.record_actions { margin: 0; padding: 0.5em; diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/_custom.scss b/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/_custom.scss index 17ca68d49..9d632026f 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/_custom.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/_custom.scss @@ -1,284 +1,6 @@ /* * These custom styles will override bootstrap enabled stylesheets + * in mod_bootstrap entrypoint */ -/// chill buttons -@import 'custom/_buttons'; -// chill record_actions -@import 'custom/_record_actions'; - -/// titles -h1, h2, .h1, .h2 { - font-weight: $headings-font-weight + 200; -} - -/// typography -.open_sansbold { - font-weight: bold; -} - -/// forms - -@mixin title_in_form { - font-size: 1.438em; - font-weight: 700; - width: 100%; - border-bottom: 3px solid $gray-200; - margin-bottom: 1em; - display: block; -} - -.col-form-label { - padding-top: .5em; - padding-bottom: .5em; - font-weight: 700; - margin-bottom: .375em; -} - -form { - /* avoid useless html in first level of the custom fields row loop in forms - * (better should to improve the loop) - */ - & > div.container-fluid { - & > div.row > .parent { - padding: 0; - & div.cf-fields span.cf-title { - margin: 1em -15px 0; - width: calc(100% + 30px); - @include title_in_form; - } - } - } - fieldset { - margin-top: 1em; - & > legend { - @include title_in_form; - } - } - label { - display: inline; - &.required:after { - content: " *"; - color: $red; - } - } -} - -/// table - -table.table-bordered { - thead, thead * { - border: 0 !important; - text-align: center; - } -} - -/// chill elements of design - -.sticky-form-buttons { - margin-top: 4em; - background-color: $beige; - position: sticky; - bottom: 0.3em; - text-align: center; - display: flex; - padding: 0.8em 1.6em; - border-radius: 0; -} - -.chill-user-quote { - border-left: 10px solid $yellow; - margin: 1.5em 10px; - padding: 0.5em 15px; - quotes: "\201C" "\201D" "\2018" "\2019"; - background-color: $gray-200; - blockquote { - border-left: 0.4em solid $gray-400; - padding-left: 0.9em; - margin-left: 0.9em; - font-style: italic; - } -} - -div.chill_address { - div.chill_address_address { - margin: 0.7em 0; - font-size: 98%; - font-variant: small-caps; - p { - display: inline-block; - margin: 0 0 0 1.5em; - text-indent: -1.5em; - } - } -} - -/// base layout positions - -body { - display: flex; - flex-direction: column; - min-height: 100vh; - footer { - margin-top: auto; - } -} - -header { - nav.navbar { - padding: 0; - a.navbar-brand img { - height: 50px; - margin: 8px 0; - } - div.navbar-collapse { - float: right; - } - ul.navbar-nav { - display: flex; - align-items: stretch; - li.nav-item { - display: flex; - &.btn { - padding-top: 0; - padding-bottom: 0; - } - & > a { - align-self: center; - } - form.form-inline { - align-self: center; - display: flex; - input.form-control { - align-self: center; - height: 32px; - } - } - } - } - div.dropdown-menu { - margin: 0; - padding: 0; - border-radius: 0; - a.dropdown-item { - width: 120%; - border: 0; - border-bottom: 1px solid $gray-200; - font-size: smaller; - i { - float: right; } - &:hover { - color: $gray-500 !important; } - } - } - - // fullwidth menu when navbar is collapsed - @media (max-width: 767px) { - & { - position: relative; - } - button.navbar-toggler { - float: right; - } - div.navbar-collapse { - float: none; - position: absolute; - top: 4em; - left: 0; - right: 0; - z-index: 2; - padding: 1em; - border-top: 1px solid shade-color($primary, 25%); - ul.navbar-nav { - display: grid; - grid-template-areas: - "sear sear sear" - "sect user lang"; - li.nav-item { - flex-direction: column; - border: 0; - a.nav-link {} - &.navigation-search { - grid-area: sear; - margin-bottom: 1em; - form { - width: 100%; - input.form-control {} - button.btn {} - } - } - &.nav-section { grid-area: sect; } - &.nav-user { grid-area: user; } - &.nav-language { grid-area: lang; } - } - li.dropdown { - &, & > * { - background-color: transparent !important; - } - a.dropdown-toggle {} - div.dropdown-menu { - display: block; - border: 0; - a.dropdown-item { - width: 100%; - border: 0; - border-top: 1px dotted $gray-200; - background-color: transparent !important; - } - } - } - } - } - } - - } -} - -div.banner { - div.header-name, - div.header-details { - div.row > div:first-child { - @media (min-width: 576px) { - //margin-left: 1.5em; - } - } - } - a { - text-decoration: none; - } -} - -div.vertical-menu { - border-radius: 0; - margin-top: 0.5rem; - a.list-group-item { - background-color: $chill-yellow; - border: 0; - margin-bottom: 0.25rem; - &:hover { - background-color: tint-color($chill-yellow, 20%) - } - } -} - -footer.footer { - background: $dark; - padding-top: 10px; - padding-bottom: 10px; - width: 100%; - p { - font-family: Open Sans; - font-weight: 300; - clear: both; - color: $white; - font-size: 0.9em; - line-height: 1.5em; - margin: auto; - max-width: 35em; - text-align: center; - a, a:hover { - text-decoration: underline; - } - } -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/shared.scss b/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/_shared.scss similarity index 100% rename from src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/shared.scss rename to src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/_shared.scss diff --git a/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/_list.html.twig b/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/_list.html.twig index 026e354c5..a5a867dcc 100644 --- a/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/_list.html.twig +++ b/src/Bundle/ChillTaskBundle/Resources/views/SingleTask/_list.html.twig @@ -10,17 +10,17 @@
{{ task.title }}
- + {% if person is null %}
{{ 'For person'|trans }} : {{ task.person}}
{% endif %} - +
{{ task_workflow_metadata(task, 'definition.name')|trans }}
- +
{% for place in workflow_marked_places(task) %} {{ place|trans }} @@ -29,10 +29,10 @@
{{ 'By'|trans }} : {{ task.assignee.username }}
{% endif %}
- + {% if task.startDate is not null or task.warningDate is not null or task.endDate is not null %}
-
    +
      {% if task.startDate is not null %}
    • {{ task.startDate|format_date('medium') }} @@ -51,14 +51,14 @@
{% endif %} - +
    {% if workflow_transitions(task)|length > 0 %}
  • - @@ -75,17 +75,17 @@
  • {% endif %} - +
  • - + {% if is_granted('CHILL_TASK_TASK_UPDATE', task) %}
  • {% endif %} - + {% if is_granted('CHILL_TASK_TASK_DELETE', task) %}
  • @@ -152,29 +152,29 @@

    {{ 'Filter the tasks'|trans }}

    {{ form_start(form) }} {{ form_row(form.user_id) }} - + {% if form.status is defined %} {{ form_row(form.status) }} {% endif %} - + {% if form.types is defined %} {{ form_row(form.types) }} {% endif %} - + {% if form.person_id is defined %} {{ form_row(form.person_id) }} {% endif %} - + {% if form.center_id is defined %} {{ form_row(form.center_id) }} {% endif %} - +
    - + {{ form_end(form)}} {% endif %} @@ -192,11 +192,11 @@
{% endif %} {% else %} - + {% if false == app.request.query.boolean('hide_form', false) %}

{{ 'Tasks'|trans }}

{% endif %} - + {% if person is not null and is_granted('CHILL_TASK_TASK_CREATE', person) %}
  • @@ -208,7 +208,7 @@
{% endif %} - + {% if single_task_ended_tasks is defined %} {{ helper.date_status('Tasks with expired deadline', single_task_ended_tasks, single_task_ended_count, single_task_ended_paginator, 'ended', isSingleStatus, person) }} {% endif %} diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/chillthirdparty.scss b/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/chillthirdparty.scss index 4ce6956c3..7651cd382 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/chillthirdparty.scss +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/chillthirdparty.scss @@ -1,4 +1,3 @@ - /// render_box section.chill-entity { .entity-thirdparty { @@ -6,59 +5,3 @@ section.chill-entity { } } -/* AVANT - border: 1px solid black; - background-color: rgba(255, 255, 255, 0.65); - padding: 1em; - margin: 1em 0; - max-width: 500px; - - div.name { - font-variant: small-caps; - } - - div.category { - margin: 0.5em 0; - font-size: 85%; - - span.category { - font-style: italic; - } - span::before { - margin-left: 0.5em; - margin-right: 0.5em; - font-family: 'ForkAwesome'; - content: '\f02e'; - font-style: normal; - } - } - - div.comment { - font-size: 85%; - font-style: italic; - } - - div.chill_address { - div.chill_address_address::before { - margin-left: 0.5em; - margin-right: 0.5em; - font-family: 'ForkAwesome'; - content: '\f015'; - } - } - - div.contact { - font-variant: small-caps; - span::before { - margin-left: 0.5em; - margin-right: 0.5em; - font-family: 'ForkAwesome'; - } - span.email::before { - content: '\f1fa'; - } - span.telephone::before { - content: '\f095'; - } - } - */ From 9764ee1794d4aa3633d4207937a06193dcdcf0e7 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sat, 31 Jul 2021 11:00:37 +0200 Subject: [PATCH 14/72] styles, replace colors by variables, minor changes with colors --- .../Resources/public/chill/chillmain.scss | 43 +++++++++++-------- .../public/chill/scss/flex_table.scss | 7 ++- .../module/bootstrap/custom/_variables.scss | 8 ++-- 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss index c1aa19213..5f57dd1bc 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss @@ -148,7 +148,7 @@ div.banner { text-decoration: none; &.phone, &.email { - color: white; + color: $white; } } .id-number { @@ -247,7 +247,7 @@ table.table-bordered { // move from chillmain.css, converted to sass div#usefulbar { - background-color: #fbba3a; + background-color: $yellow; z-index: 1000; padding-right: 15px; @@ -265,11 +265,11 @@ div#usefulbar { padding-right: 10px; } li { - color: white; + color: $white; margin-left: 10px; a { - color: white; - text-shadow: 0px 0px 1px #555; + color: $white; + text-shadow: 0px 0px 1px $gray-600; } i.icon-user-add { &:before { @@ -278,20 +278,18 @@ div#usefulbar { } &#search_element { text-align: right; - } - &#search_element div#search_form { - margin: 0; - padding: 0; - button { - color: white; - border: none; - bottom: -2px; - height: 35px; - } - } - &#search_element div#search_form { - div, .field { + div#search_form { margin: 0; + padding: 0; + div, .field { + margin: 0; + } + button { + color: $white; + border: none; + bottom: -2px; + height: 35px; + } } } } @@ -310,6 +308,8 @@ div#flashMessages { text-transform: capitalize; } +// probably used in client chill. +// think to rename like above input.belgian_national_number_inversed_date { width: 7em; margin-right: 1em; @@ -321,3 +321,10 @@ input.belgian_national_number_daily_counter { input.belgian_national_number_control_digit { width: 3em; } + +// +input.belgian_national_number { + &.inversed_date {} + &.daily_counter {} + &.control_digit {} +} diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss index c01ebc41d..2573e7387 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss @@ -41,7 +41,7 @@ div.flex-bloc { &:first-child { flex-grow: 0; flex-shrink: 0; flex-basis: auto; padding-bottom: 0.5em; - border-bottom: 1px dotted #0000004f; + border-bottom: 1px dotted $gray-900; margin-bottom: 0.5em; } &:last-child { @@ -79,6 +79,9 @@ div.flex-table { padding: 1em; &:nth-child(even) { background-color: $gray-200; + .chill-user-quote { + background-color: $gray-100; + } } div.item-row { @@ -86,7 +89,7 @@ div.flex-table { flex-direction: row; &:not(:first-child) { margin-top: 0.5em; - border-top: 1px dotted #0000004f; + border-top: 1px dotted $gray-900; padding-top: 0.5em; flex-direction: column; } diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_variables.scss b/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_variables.scss index dc2a722cf..04cf765e0 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_variables.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_variables.scss @@ -14,7 +14,7 @@ $gray-400: #ced4da !default; $gray-500: #b2b2b2 !default; $gray-600: #6c757d !default; $gray-700: #495057 !default; -$gray-800: #333333 !default; +$gray-800: #2c2d2f !default; $gray-900: #212529 !default; $black: #111 !default; // scss-docs-end gray-color-variables @@ -160,7 +160,7 @@ $chill-pink: $pink; $chill-gray: $gray-600; $chill-dark-gray: $gray-800; $chill-light-gray: $gray-200; -$chill-llight-gray: $gray-100; +$chill-llight-gray: $gray-100; // scss-docs-end theme-color-variables // scss-docs-start theme-colors-map @@ -176,7 +176,7 @@ $theme-colors: ( ) !default; // scss-docs-end theme-colors-map -$chill-colors: ( +$chill-colors: ( "chill-blue": $chill-blue, "chill-green": $chill-green, "chill-green-dark": $chill-green-dark, @@ -382,7 +382,7 @@ $border-color: $gray-300 !default; // scss-docs-end border-variables // scss-docs-start border-radius-variables -$border-radius: .25rem !default; // <== +$border-radius: .25rem !default; // <== $border-radius-sm: .2rem !default; $border-radius-lg: .3rem !default; $border-radius-pill: 50rem !default; From 1325355ca778b57067a14c377955f1d6ed74bfd4 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sat, 31 Jul 2021 13:14:31 +0200 Subject: [PATCH 15/72] revert flashbag wrapper class --- .../Resources/views/layout.html.twig | 37 +++++++++++-------- .../views/layoutWithVerticalMenu.html.twig | 37 +++++++++++-------- 2 files changed, 44 insertions(+), 30 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig b/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig index 140557d69..3b1fe5041 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/layout.html.twig @@ -53,23 +53,30 @@ {% block sublayout_content %}
- {% for flashMessage in app.session.flashbag.get('success') %} -
- {{ flashMessage|raw }} -
- {% endfor %} + {# Flash messages ! #} + {% if app.session.flashbag.keys()|length > 0 %} +
- {% for flashMessage in app.session.flashbag.get('error') %} -
- {{ flashMessage|raw }} -
- {% endfor %} + {% for flashMessage in app.session.flashbag.get('success') %} +
+ {{ flashMessage|raw }} +
+ {% endfor %} - {% for flashMessage in app.session.flashbag.get('notice') %} -
- {{ flashMessage|raw }} -
- {% endfor %} + {% for flashMessage in app.session.flashbag.get('error') %} +
+ {{ flashMessage|raw }} +
+ {% endfor %} + + {% for flashMessage in app.session.flashbag.get('notice') %} +
+ {{ flashMessage|raw }} +
+ {% endfor %} + +
+ {% endif %} {% block content %} {% if cFGroup and (cFGroup.getActiveCustomFields|length > 0) %} diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 57b051d68..048d4a61a 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -23,7 +23,7 @@ nationality: nationalité 'Without nationality': 'Sans nationalité' Gender: Genre gender: genre -Gender comment: Remarque sur le genre +Gender comment: Remarques sur le genre 'Creation date': 'Date d''ouverture' 'Not given': 'Non renseigné' 'Place of birth': 'Lieu de naissance' @@ -34,7 +34,7 @@ countryOfBirth: 'Pays de naissance' 'Unknown country of birth': 'Pays inconnu' 'Marital status': 'État civil' Date of last marital status change: État civil depuis le -Comment on the marital status: Commentaires sur l'état civil +Comment on the marital status: Remarques sur l'état civil 'Number of children': 'Nombre d''enfants' '{0} No child|{1} One child | ]1,Inf] %nb% children': '{0} Aucun enfant|{1} Un enfant | ]1,Inf] %nb% enfants' 'National number': 'Numéro national' From 6dae4785e653fdb6d9ee7d699d7112e3d93ea036 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sun, 1 Aug 2021 12:08:04 +0200 Subject: [PATCH 19/72] missing comment fields on person details page --- .../Resources/views/Person/view.html.twig | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/view.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/view.html.twig index aeaaeac37..db81ec320 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/view.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/view.html.twig @@ -107,7 +107,7 @@ This view should receive those arguments:
- {% if person.genderComment is not empty %} + {% if person.genderComment.comment is not empty %}

{{ 'Gender comment'|trans }} :

@@ -162,14 +162,16 @@ This view should receive those arguments: {% endif %} - {% if person.maritalStatusComment is not empty %} -
{{ 'Comment on the marital status'|trans }} :
-
+
{{ 'Comment on the marital status'|trans }} :
+
+ {% if person.maritalStatusComment.comment is not empty %}
{{ person.maritalStatusComment.comment|chill_markdown_to_html }}
-
- {% endif %} + {% else %} + {{ 'No data given'|trans }} + {% endif %} + {%- endif -%}
From 1c404e5cb3b62c77f1ebac147613401df3ae5613 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sun, 1 Aug 2021 13:23:06 +0200 Subject: [PATCH 20/72] lib/entity/comment_embeddable styles have been moved --- src/Bundle/ChillMainBundle/Resources/public/chill/index.js | 1 - .../Resources/public/lib/entity/comment_embeddable.scss | 1 - src/Bundle/ChillMainBundle/Resources/public/lib/entity/index.js | 2 -- 3 files changed, 4 deletions(-) delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/lib/entity/comment_embeddable.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/lib/entity/index.js diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/index.js b/src/Bundle/ChillMainBundle/Resources/public/chill/index.js index 84f11fa43..2e13bcc06 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/index.js @@ -46,7 +46,6 @@ require('../lib/breadcrumb/index.js'); require('../lib/download-report/index.js'); require('../lib/select_interactive_loading/index.js'); require('../lib/export-list/index.js'); -require('../lib/entity/index.js'); //require('../lib/show_hide/index.js'); //require('../lib/tabs/index.js'); diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/entity/comment_embeddable.scss b/src/Bundle/ChillMainBundle/Resources/public/lib/entity/comment_embeddable.scss deleted file mode 100644 index 8b1378917..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/lib/entity/comment_embeddable.scss +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/entity/index.js b/src/Bundle/ChillMainBundle/Resources/public/lib/entity/index.js deleted file mode 100644 index c739899a5..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/lib/entity/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// css classes to render entities -require('./comment_embeddable.scss'); From 4c47105de1b5a12e698f4dd9853d4d46ce216828 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sun, 1 Aug 2021 13:43:09 +0200 Subject: [PATCH 21/72] flex-table column width auto; overwrite for specific use --- .../Resources/public/chill/scss/flex_table.scss | 12 ++++-------- .../Resources/public/chill/chillperson.scss | 8 ++++++++ .../views/AccompanyingCourse/index.html.twig | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss index 526ad2787..4a569084f 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss @@ -3,11 +3,13 @@ */ div.flex-bloc, div.flex-table { + margin: 1.5em 0; + h2, h3, h4, dl, p { margin: 0; } h2, h3, h4 { - color: var(--bs-chill-blue); + color: $blue; } div.item-bloc { @include border-collapse; @@ -48,8 +50,6 @@ div.flex-bloc { 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; @@ -96,15 +96,13 @@ div.flex-table { div.item-col { &:first-child { - flex-grow: 0; flex-shrink: 0; flex-basis: 33%; + flex-grow: 0; flex-shrink: 0; flex-basis: auto; } &: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; @@ -126,8 +124,6 @@ div.flex-table { } } - // neutralize - div.chill_address div.chill_address_address p { text-indent: 0; } } } } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss index dace93340..5beb5249b 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss +++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss @@ -106,6 +106,14 @@ div#header-accompanying_course-details { padding-bottom: 1em; } +// flex-table precision +div.accompanyingcourse-resume { + div.associated-persons { + .flex-table .item-row .item-col:first-child { flex-basis: 33%; } + } +} + + /* * HOUSEHOLD CONTEXT * Header custom for Household diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index bb42a390a..8082a6387 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -36,7 +36,7 @@ {% if participation.enddate is null %}
{{ participation.person|chill_entity_render_box({ - 'render': 'bloc', 'addLink': false, 'addInfo': true, + 'render': 'bloc', 'addLink': false, 'addInfo': true, 'addAltNames': false, 'customButtons': { 'before': _self.button_person(participation.person) } }) }}
From c4a8b85be505203277e336032c258c9d2ab9de93 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sun, 1 Aug 2021 13:47:08 +0200 Subject: [PATCH 22/72] template accompanying period list: buttons, flex-table (wip) --- .../Resources/public/chill/scss/buttons.scss | 18 ++- .../views/AccompanyingPeriod/_list.html.twig | 153 +++++++++--------- .../views/AccompanyingPeriod/list.html.twig | 66 ++++---- 3 files changed, 124 insertions(+), 113 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss index 6264a3a95..c2995e57d 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss @@ -62,10 +62,10 @@ $chill-theme-buttons: ( &.btn-view::before, &.btn-save::before, &.btn-duplicate::before, - &.btn-not-duplicate::before, - &.btn-submit::before, - &.btn-reset::before, - &.btn-action::before, + // &.btn-not-duplicate::before, + // &.btn-submit::before, + // &.btn-reset::before, + // &.btn-action::before, &.btn-delete::before, &.btn-remove::before, &.btn-cancel::before { @@ -101,3 +101,13 @@ $chill-theme-buttons: ( color: $light; } } + +/// allow to hide icon (herited from scratch) +.btn { + &.change-icon { + &::before { + content: ''; + margin-right: 0; + } + } +} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list.html.twig index 7b4ac4a61..af358c01e 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list.html.twig @@ -1,39 +1,28 @@ {% block content %} - +
{% for accompanying_period in accompanying_periods %} -
+
- {{'period'|trans}} #{{ accompanying_period.id }} + #{{ accompanying_period.id }} {% if accompanying_period.emergency %} -   - - {{- 'Emergency'|trans|upper -}} - + {{- 'Emergency'|trans|upper -}} {% endif %} {% if accompanying_period.confidential %} -   - - {{- 'Confidential'|trans|upper -}} - + {{- 'Confidential'|trans|upper -}} {% endif %} {% if accompanying_period.step == 'DRAFT' %} -   - - {{- 'Draft'|trans|upper -}} - + {{- 'Draft'|trans|upper -}} {% else %} - - {{- 'Confirmed'|trans|upper -}} - + {{- 'Confirmed'|trans|upper -}} {% endif %}
{% if chill_accompanying_periods.fields.user == 'visible' %} {% if accompanying_period.user %} - {{ accompanying_period.user.username }} + {{ accompanying_period.user.username }} {% else %} {{ 'No accompanying user'|trans }} {% endif %} @@ -42,6 +31,7 @@
+ {% if accompanying_period.closingDate == null %} {{ 'accompanying_period.dates_from_%opening_date%'|trans({ '%opening_date%': accompanying_period.openingDate|format_date('long') } ) }} {% else %} @@ -49,92 +39,95 @@ '%opening_date%': accompanying_period.openingDate|format_date('long'), '%closing_date%': accompanying_period.closingDate|format_date('long')} ) }} - {% if accompanying_period.isOpen == false %}
{{ 'Closing motive'|trans }} :
{{ accompanying_period.closingMotive|chill_entity_render_box }}
{% endif %} - {% endif %} +
- -
-

{{ 'Participants'|trans }}

- {% if accompanying_period.participations.count > 0 %} - {% for p in accompanying_period.participations %} -

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

- {% endfor %} - {% else %} - {{ 'No data given'|trans }} - {% endif %} -
-
-

{{ 'Requestor'|trans }}

- {% if accompanying_period.requestorPerson is not null or accompanying_period.requestorThirdParty is not null %} - {% if accompanying_period.requestorPerson is not null %} -

{{ accompanying_period.requestorPerson.firstname ~ ' ' ~ accompanying_period.requestorPerson.lastname }}

- {% endif %} - {% if accompanying_period.requestorThirdParty is not null %} -

{{ accompanying_period.requestorThirdParty.name }}

- {% endif %} - {% else %} - {{ 'No data given'|trans }} - {% endif %} -
- -
-

{{ 'Social issues'|trans }}

- {% if accompanying_period.socialIssues.count > 0 %} - {% for si in accompanying_period.socialIssues %} -

{{ si.title|localize_translatable_string }}

- {% endfor %} - {% else %} - {{ 'No data given'|trans }} - {% endif %} -
-
+ +

{{ 'Participants'|trans }}

+ {% if accompanying_period.participations.count > 0 %} + {% for p in accompanying_period.participations %} +

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

+ {% endfor %} + {% else %} + {{ 'No data given'|trans }} + {% endif %} + +
+
+ +

{{ 'Requestor'|trans }}

+ {% if accompanying_period.requestorPerson is not null or accompanying_period.requestorThirdParty is not null %} + {% if accompanying_period.requestorPerson is not null %} +

{{ accompanying_period.requestorPerson.firstname ~ ' ' ~ accompanying_period.requestorPerson.lastname }}

+ {% endif %} + {% if accompanying_period.requestorThirdParty is not null %} +

{{ accompanying_period.requestorThirdParty.name }}

+ {% endif %} + {% else %} + {{ 'No data given'|trans }} + {% endif %} + +
+
+ +

{{ 'Social issues'|trans }}

+ {% if accompanying_period.socialIssues.count > 0 %} + {% for si in accompanying_period.socialIssues %} +

{{ si.title|localize_translatable_string }}

+ {% endfor %} + {% else %} + {{ 'No data given'|trans }} + {% endif %} + +
+
+ +
-
-
-

{% endfor %} - - +
{% endblock content %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig index 8ca4dd26e..4dc7a90aa 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig @@ -5,36 +5,44 @@ {% block title %}{{ 'Person accompanying period - %name%'|trans({ '%name%' : person.__toString}) }}{% endblock title %} {% block personcontent %} -

{{ 'Accompanying period list'|trans }}

+
-{% include 'ChillPersonBundle:AccompanyingPeriod:_list.html.twig' %} +

{{ 'Accompanying period list'|trans }}

- + {% include 'ChillPersonBundle:AccompanyingPeriod:_list.html.twig' %} + + +
{% endblock %} From 4be4cd72795207f0cf5a92136681c7c224afefd8 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sun, 1 Aug 2021 13:50:59 +0200 Subject: [PATCH 23/72] remove Altnames in accompanyingCourse resume --- .../Resources/views/AccompanyingCourse/index.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index 8082a6387..3294ba57c 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -63,7 +63,7 @@
{{ requestor|chill_entity_render_box({ - 'render': 'bloc', 'addLink': false, 'addEntity': true, 'addInfo': info + 'render': 'bloc', 'addLink': false, 'addEntity': true, 'addInfo': info, 'addAltNames': false }) }}
@@ -80,7 +80,7 @@
{% if r.person %} {{ r.person|chill_entity_render_box({ - 'render': 'bloc', 'addLink': false, 'addEntity': true, 'addInfo': true + 'render': 'bloc', 'addLink': false, 'addEntity': true, 'addInfo': true, 'addAltNames': false }) }} {% endif %} {% if r.thirdParty %} From 48873d15c9d1c401f45027864b370a05ba3d4b64 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sun, 1 Aug 2021 15:21:03 +0200 Subject: [PATCH 24/72] ajust list_with_period search with person render_box (and add new options to it) --- .../public/chill/scss/flex_table.scss | 7 +- .../public/chill/scss/person_with_period.scss | 12 +- .../components/Concerned.vue | 6 +- .../components/MemberDetails.vue | 6 +- .../views/AccompanyingPeriod/_list.html.twig | 52 +-- .../Resources/views/Entity/person.html.twig | 11 +- .../views/Household/summary.html.twig | 12 +- .../Resources/views/Person/list.html.twig | 190 +++++------ .../Person/list_by_phonenumber.html.twig | 170 +++++----- .../views/Person/list_with_period.html.twig | 298 ++++++++---------- .../Templating/Entity/PersonRender.php | 2 + 11 files changed, 378 insertions(+), 388 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss index 4a569084f..ec2bfae95 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss @@ -87,6 +87,7 @@ div.flex-table { div.item-row { display: flex; flex-direction: row; + &:not(:first-child) { margin-top: 0.5em; border-top: 1px dotted $gray-900; @@ -100,13 +101,13 @@ div.flex-table { } &:last-child { flex-grow: 1; flex-shrink: 1; flex-basis: auto; + display: flex; justify-content: flex-end; - ul.record_actions { - margin: 0; - align-self: flex-start; flex-grow: 1; flex-shrink: 0; flex-basis: auto; + align-self: flex-start; + margin: 0; li { margin-right: 5px; } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/person_with_period.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/person_with_period.scss index 6be613ea3..ada9bce9d 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/person_with_period.scss +++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/person_with_period.scss @@ -1,10 +1,12 @@ -/// complete and overwrite flex-table in chillmain.scss +/// overwrite flex-table +div.list-with-period { + div.flex-table div.item-row div.item-col:first-child { flex-basis: 33%; } +} + +/// div.list-with-period, div.list-household-members { - div.comment { - // for the comment for household-members - } div.periods { div.header, div.list-content { @@ -13,7 +15,7 @@ div.list-household-members { } div.header { position: relative; - a.sc-button { + a.btn { position: absolute; width: 30px; height: 30px; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue index eb611c9c1..9399f9245 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue @@ -22,8 +22,8 @@ class="item-bloc" v-bind:key="conc.person.id" > -
-
+
+
@@ -33,7 +33,7 @@
-
+
  • diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/MemberDetails.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/MemberDetails.vue index b55b6247c..e153373a1 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/MemberDetails.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/MemberDetails.vue @@ -1,7 +1,7 @@