diff --git a/CHANGELOG.md b/CHANGELOG.md index e102074e6..abd12d439 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,11 +11,105 @@ and this project adheres to ## Unreleased +* renommer "dossier numéro" en "parcours numéro" dans les résultats de recherche +* renomme date de début en date d'ouverture dans le formulaire parcours +* [homepage widget] improve content tables, improve counter pluralization with style on number +* [notification lists] add comments counter information +* [workflows] fix popover header with previous transition +* [parcours]: validation + message for closing parcours adjusted. +* [household]: household composition double edit button replaced by a delete action (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/426) +[fast_actions] improve fast-actions buttons override mechanism, fix https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/413 +[homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc. +* [person]: Comment on marital status is possible even if marital status is not defined (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/421) +* [parcours]: In the list of person results the requestor is not displayed if defined as anonymous (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/424) +* [bugfix]: modal closes and newly created person/thirdparty is selected when multiple persons/thirdparties are created through the modal (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/429) +* [person_resource]: Onthefly button added to view person/thirdparty and badge differentiation for a contact-thirdparty (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/428) +* [workflow][notification] improve how notifications and workflows are 'attached' to entities: contextual list, counter, buttons and vue modal +* [AddAddress] disable multiselect search, and rely only on most pertinent Cities and Street computed backend +* [fast_actions] improve fast-actions buttons override mechanism, fix https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/413 +* [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc. * [thirdparty] Add a contact to a thirdparty from within onTheFly (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/345) ## Test releases +### test release 2021-01-31 + +* [person] accompanying course: optimisation: do not fetch some resources for the banner (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/409) +* [person] accompanying course: close modal when edit participation (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/420) +* [person] accompanying course: treat validation error when editing on-the-fly entities (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/420) +* [activity] show activity attendee (présence) in the activity list (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/412) +* [activity] admin: change validation rule for social action visible field (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/413) +* [parcours]: component added to change the opening date of a parcours (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/411) +* [search]: listing of parcours display changed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/410) +* [user]: page with accompanying periods to which is user is referent (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/408) +* [person] age added to renderstring + renderbox/ vue component created to display person text (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/389) +* [household member editor] allow to push to existing household + + +### test release 2021-01-28 + +* [person] improve filiations vis graph: disable physics, use chill colors for persons-households-course, increase label of relations, remove labels on household arrows and other improvements (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/286, https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/362) +* [activity] Order activity by date and by id (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/364) +* [main] increase length of 4 Address fields (change to TEXT, no size limits) (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/277) +* [main] Add confidential option for address, in edit and view (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/165) +* [person] name suggestions within create person form when person is created departing from a search input (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/377) +* [person] Add residential address entity, form and list for each person +* [aside_activity]: dynamicUserPickerType used (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/399) +* dispatching list + + +### test release 2021-01-26 + +* [parcours] comments truncated if too long + link added (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/406) +* [person]: possibility to add person resources (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/382) +* [person ressources]: module added + + +### test release 2022-01-24 + +* [person] name suggestions within create person form when person is created departing from a search input (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/377) +* [notification: formulaire création] descend la box avec la description dans le bas du formulaire +* [notification for activity]: fix link to activity +* [notification] add "URGENT" before accompanying course with emergency = true +* [notification] add a "read more" button on system notification +* [notification] add `[Chill]` in the subject of each notification, automatically +* [notification] add a counter for notification in activity list and accompanying period list, and search results +* [parcours] bugfix if deathdate is not defined (eg. for a thirdparty) parcours is still displayed. Gave error before. +* [workflow] add breadcrumb to show steps +* [popover] add popover html popup mechanism (used by workflow breadcrumb) +* [templates] improve updatedBy macro in item metadatas +* [parcours]: bug fix when comment is pinned all other comments remain in the collection (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/385) +* [workflow] + * add My workflow section with my opened subscriptions + * apply workflow on documents, accompanyingCourseWork and Evaluations +* [wopi-link] a new vue component allow to open wopi link in a fullscreen chill-themed modal + +### test release 2022-01-19 +* vuejs: add dead information on all on-the-fly person render boxes, in vis graph and other templates (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/271) +* [thirdparty] fix bug in 3rd party view: types was replaced by thirdPartyTypes +* [main] location form type: fix unmapped address field (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/246) +* [activity] fix wrong import of js assets for adding and viewing documents in activity (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/83 & https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/176) +* [person]: space added between deathdate and age in twig renderbox (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/380) +* [forms] dynamic picker types for user/person/thirdparty types created (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/386) + +### test release 2022-01-17 + +* [main] Add editableByUser field to locationType entity, adapt the admin template and add this condition in the location-type endpoint (see https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/297) +* [main] Add mainLocation field to User entity and add it in user form type +* rewrite page which allow to select activity +* [main] Add mainLocation field to User entity and add it in user form type +* [course list in person context] show full username/label for ref +* [accompanying period work] remove the possibility to generate document from an accompanying period work +* vuejs: add validation on required fields for AddPerson, Address and Location components +* vuejs: treat 422 validation errors in locations and AddPerson components +* [person]: space added between deathdate and age in twig renderbox (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/380) + +## Test releases +* vuejs: add validation on required fields for AddPerson, Address and Location components +* vuejs: treat 422 validation errors in locations and AddPerson components +* [person]: space added between deathdate and age in twig renderbox (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/380) + ### test release 2022-01-12 * fix thirdparty normalizer on telephone field: https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/322 diff --git a/composer.json b/composer.json index d3766bb65..2223f65c0 100644 --- a/composer.json +++ b/composer.json @@ -52,9 +52,6 @@ "twig/string-extra": "^3.3", "twig/twig": "^3.0" }, - "conflict": { - "symfony/symfony": "*" - }, "require-dev": { "doctrine/doctrine-fixtures-bundle": "^3.3", "drupol/php-conventions": "^5", @@ -71,23 +68,17 @@ "symfony/var-dumper": "^4.4", "symfony/web-profiler-bundle": "^4.4" }, - "config": { - "bin-dir": "bin", - "optimize-autoloader": true, - "sort-packages": true, - "vendor-dir": "tests/app/vendor", - "allow-plugins": { - "composer/package-versions-deprecated": true, - "phpstan/extension-installer": true, - "ergebnis/composer-normalize": true, - "phpro/grumphp": true - } + "conflict": { + "symfony/symfony": "*" }, "autoload": { "psr-4": { "Chill\\ActivityBundle\\": "src/Bundle/ChillActivityBundle", + "Chill\\AsideActivityBundle\\": "src/Bundle/ChillAsideActivityBundle/src", "Chill\\BudgetBundle\\": "src/Bundle/ChillBudgetBundle", + "Chill\\CalendarBundle\\": "src/Bundle/ChillCalendarBundle", "Chill\\CustomFieldsBundle\\": "src/Bundle/ChillCustomFieldsBundle", + "Chill\\DocGeneratorBundle\\": "src/Bundle/ChillDocGeneratorBundle", "Chill\\DocStoreBundle\\": "src/Bundle/ChillDocStoreBundle", "Chill\\EventBundle\\": "src/Bundle/ChillEventBundle", "Chill\\FamilyMemberBundle\\": "src/Bundle/ChillFamilyMemberBundle", @@ -96,9 +87,6 @@ "Chill\\ReportBundle\\": "src/Bundle/ChillReportBundle", "Chill\\TaskBundle\\": "src/Bundle/ChillTaskBundle", "Chill\\ThirdPartyBundle\\": "src/Bundle/ChillThirdPartyBundle", - "Chill\\AsideActivityBundle\\": "src/Bundle/ChillAsideActivityBundle/src", - "Chill\\DocGeneratorBundle\\": "src/Bundle/ChillDocGeneratorBundle", - "Chill\\CalendarBundle\\": "src/Bundle/ChillCalendarBundle", "Chill\\WopiBundle\\": "src/Bundle/ChillWopiBundle/src" } }, @@ -111,10 +99,10 @@ "config": { "allow-plugins": { "composer/package-versions-deprecated": true, - "phpstan/extension-installer": true, "ergebnis/composer-normalize": true, + "ocramius/package-versions": true, "phpro/grumphp": true, - "ocramius/package-versions": true + "phpstan/extension-installer": true }, "bin-dir": "bin", "optimize-autoloader": true, @@ -123,8 +111,8 @@ }, "scripts": { "auto-scripts": { - "cache:clear": "symfony-cmd", - "assets:install %PUBLIC_DIR%": "symfony-cmd" + "assets:install %PUBLIC_DIR%": "symfony-cmd", + "cache:clear": "symfony-cmd" } } } diff --git a/package.json.txt b/package.json.txt deleted file mode 100644 index 58f21ac5d..000000000 --- a/package.json.txt +++ /dev/null @@ -1,3 +0,0 @@ -add npm/yarn dependency in package.json : - -"select2-bootstrap-theme": "0.1.0-beta.10", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index d996ff3b8..20970a799 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -80,11 +80,6 @@ parameters: count: 1 path: src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php - - - message: "#^Foreach overwrites \\$action with its value variable\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php - - message: "#^Foreach overwrites \\$action with its value variable\\.$#" count: 1 diff --git a/phpstan-critical.neon b/phpstan-critical.neon index b214654bf..632356aa6 100644 --- a/phpstan-critical.neon +++ b/phpstan-critical.neon @@ -30,36 +30,6 @@ parameters: count: 2 path: src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php - - - message: "#^Parameter \\$action of method Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\AccompanyingPeriodWorkRepository\\:\\:buildQueryBySocialActionWithDescendants\\(\\) has invalid type Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\SocialAction\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php - - - - message: "#^Parameter \\$action of method Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\AccompanyingPeriodWorkRepository\\:\\:countBySocialActionWithDescendants\\(\\) has invalid type Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\SocialAction\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php - - - - message: "#^Undefined variable\\: \\$action$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php - - - - message: "#^Undefined variable\\: \\$limit$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php - - - - message: "#^Undefined variable\\: \\$offset$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php - - - - message: "#^Undefined variable\\: \\$orderBy$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php - - message: "#^Variable variables are not allowed\\.$#" count: 4 diff --git a/phpstan-types.neon b/phpstan-types.neon index 949ff774a..2cc55255a 100644 --- a/phpstan-types.neon +++ b/phpstan-types.neon @@ -400,11 +400,6 @@ parameters: count: 1 path: src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php - - - message: "#^Method Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\AccompanyingPeriodWorkRepository\\:\\:buildQueryBySocialActionWithDescendants\\(\\) has invalid return type Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\QueryBuilder\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 3 diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 6db1f6945..3858979ef 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -31,15 +31,17 @@ use DateTime; use Doctrine\ORM\EntityManagerInterface; use InvalidArgumentException; use Psr\Log\LoggerInterface; +use RuntimeException; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\Role\Role; -use Symfony\Component\Serializer\SerializerInterface; +use Symfony\Component\Serializer\SerializerInterface; use function array_key_exists; final class ActivityController extends AbstractController @@ -199,12 +201,36 @@ final class ActivityController extends AbstractController 'role' => new Role('CHILL_ACTIVITY_UPDATE'), 'activityType' => $entity->getActivityType(), 'accompanyingPeriod' => $accompanyingPeriod, - ])->handleRequest($request); + ]); + + if ($form->has('documents')) { + $form->add('gendocTemplateId', HiddenType::class, [ + 'mapped' => false, + 'data' => null, + 'attr' => [ + // required for js + 'data-template-id' => 'data-template-id', + ], + ]); + } + + $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $this->entityManager->persist($entity); $this->entityManager->flush(); + if ($form->has('gendocTemplateId') && null !== $form['gendocTemplateId']->getData()) { + return $this->redirectToRoute( + 'chill_docgenerator_generate_from_template', + [ + 'template' => $form->get('gendocTemplateId')->getData(), + 'entityClassName' => Activity::class, + 'entityId' => $entity->getId(), + ] + ); + } + $this->addFlash('success', $this->get('translator')->trans('Success : activity updated!')); $params = $this->buildParamsToUrl($person, $accompanyingPeriod); @@ -255,7 +281,7 @@ final class ActivityController extends AbstractController if ($person instanceof Person) { $this->denyAccessUnlessGranted(ActivityVoter::SEE, $person); $activities = $this->activityACLAwareRepository - ->findByPerson($person, ActivityVoter::SEE, 0, null); + ->findByPerson($person, ActivityVoter::SEE, 0, null, ['date' => 'DESC', 'id' => 'DESC']); $event = new PrivacyEvent($person, [ 'element_class' => Activity::class, @@ -268,7 +294,7 @@ final class ActivityController extends AbstractController $this->denyAccessUnlessGranted(ActivityVoter::SEE, $accompanyingPeriod); $activities = $this->activityACLAwareRepository - ->findByAccompanyingPeriod($accompanyingPeriod, ActivityVoter::SEE); + ->findByAccompanyingPeriod($accompanyingPeriod, ActivityVoter::SEE, 0, null, ['date' => 'DESC', 'id' => 'DESC']); $view = 'ChillActivityBundle:Activity:listAccompanyingCourse.html.twig'; } @@ -392,12 +418,36 @@ final class ActivityController extends AbstractController 'role' => new Role('CHILL_ACTIVITY_CREATE'), 'activityType' => $entity->getActivityType(), 'accompanyingPeriod' => $accompanyingPeriod, - ])->handleRequest($request); + ]); + + if ($form->has('documents')) { + $form->add('gendocTemplateId', HiddenType::class, [ + 'mapped' => false, + 'data' => null, + 'attr' => [ + // required for js + 'data-template-id' => 'data-template-id', + ], + ]); + } + + $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $this->entityManager->persist($entity); $this->entityManager->flush(); + if ($form->has('gendocTemplateId') && null !== $form['gendocTemplateId']->getData()) { + return $this->redirectToRoute( + 'chill_docgenerator_generate_from_template', + [ + 'template' => $form->get('gendocTemplateId')->getData(), + 'entityClassName' => Activity::class, + 'entityId' => $entity->getId(), + ] + ); + } + $this->addFlash('success', $this->get('translator')->trans('Success : activity created!')); $params = $this->buildParamsToUrl($person, $accompanyingPeriod); @@ -471,20 +521,21 @@ final class ActivityController extends AbstractController public function showAction(Request $request, int $id): Response { - $view = null; + $entity = $this->activityRepository->find($id); - [$person, $accompanyingPeriod] = $this->getEntity($request); + if (null === $entity) { + throw $this->createNotFoundException('Unable to find Activity entity.'); + } + + $accompanyingPeriod = $entity->getAccompanyingPeriod(); + $person = $entity->getPerson(); if ($accompanyingPeriod instanceof AccompanyingPeriod) { $view = 'ChillActivityBundle:Activity:showAccompanyingCourse.html.twig'; } elseif ($person instanceof Person) { $view = 'ChillActivityBundle:Activity:showPerson.html.twig'; - } - - $entity = $this->activityRepository->find($id); - - if (null === $entity) { - throw $this->createNotFoundException('Unable to find Activity entity.'); + } else { + throw new RuntimeException('the activity should be linked with a period or person'); } if (null !== $accompanyingPeriod) { @@ -493,8 +544,7 @@ final class ActivityController extends AbstractController $entity->personsNotAssociated = $entity->getPersonsNotAssociated(); } - // TODO revoir le Voter de Activity pour tenir compte qu'une activité peut appartenir a une période - // $this->denyAccessUnlessGranted('CHILL_ACTIVITY_SEE', $entity); + $this->denyAccessUnlessGranted(ActivityVoter::SEE, $entity); $deleteForm = $this->createDeleteForm($entity->getId(), $person, $accompanyingPeriod); diff --git a/src/Bundle/ChillActivityBundle/Entity/Activity.php b/src/Bundle/ChillActivityBundle/Entity/Activity.php index 77f650ce4..2bb40d432 100644 --- a/src/Bundle/ChillActivityBundle/Entity/Activity.php +++ b/src/Bundle/ChillActivityBundle/Entity/Activity.php @@ -12,7 +12,7 @@ declare(strict_types=1); namespace Chill\ActivityBundle\Entity; use Chill\ActivityBundle\Validator\Constraints as ActivityValidator; -use Chill\DocStoreBundle\Entity\Document; +use Chill\DocStoreBundle\Entity\StoredObject; use Chill\MainBundle\Entity\Center; use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable; use Chill\MainBundle\Entity\HasCenterInterface; @@ -67,7 +67,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac /** * @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType") - * @Groups({"read"}) + * @Groups({"read", "docgen:read"}) * @SerializedName("activityType") * @ORM\JoinColumn(name="type_id") */ @@ -75,16 +75,19 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac /** * @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityPresence") + * @Groups({"docgen:read"}) */ private ?ActivityPresence $attendee = null; /** * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_") + * @Groups({"docgen:read"}) */ private CommentEmbeddable $comment; /** * @ORM\Column(type="datetime") + * @Groups({"docgen:read"}) */ private DateTime $date; @@ -100,6 +103,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac /** * @ORM\Column(type="boolean", options={"default": false}) + * @Groups({"docgen:read"}) */ private bool $emergency = false; @@ -107,13 +111,13 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac * @ORM\Id * @ORM\Column(name="id", type="integer") * @ORM\GeneratedValue(strategy="AUTO") - * @Groups({"read"}) + * @Groups({"read", "docgen:read"}) */ private ?int $id = null; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location") - * @groups({"read"}) + * @groups({"read", "docgen:read"}) */ private ?Location $location = null; @@ -124,42 +128,45 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac /** * @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person") - * @Groups({"read"}) + * @Groups({"read", "docgen:read"}) */ private ?Collection $persons = null; /** * @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason") + * @Groups({"docgen:read"}) */ private Collection $reasons; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope") + * @Groups({"docgen:read"}) */ private ?Scope $scope = null; /** * @ORM\Column(type="string", options={"default": ""}) + * @Groups({"docgen:read"}) */ private string $sentReceived = ''; /** * @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialAction") * @ORM\JoinTable(name="chill_activity_activity_chill_person_socialaction") - * @Groups({"read"}) + * @Groups({"read", "docgen:read"}) */ private Collection $socialActions; /** * @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialIssue") * @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue") - * @Groups({"read"}) + * @Groups({"read", "docgen:read"}) */ private Collection $socialIssues; /** * @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty") - * @Groups({"read"}) + * @Groups({"read", "docgen:read"}) */ private ?Collection $thirdParties = null; @@ -170,12 +177,13 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") + * @Groups({"docgen:read"}) */ private User $user; /** * @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User") - * @Groups({"read"}) + * @Groups({"read", "docgen:read"}) */ private ?Collection $users = null; @@ -191,7 +199,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac $this->socialActions = new ArrayCollection(); } - public function addDocument(Document $document): self + public function addDocument(StoredObject $document): self { $this->documents[] = $document; @@ -302,6 +310,18 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac return $this->documents; } + /** + * @Groups({"docgen:read"}) + */ + public function getDurationMinute(): int + { + if (null === $this->durationTime) { + return 0; + } + + return (int) round(($this->durationTime->getTimestamp() + $this->durationTime->getOffset()) / 60.0, 0); + } + public function getDurationTime(): ?DateTime { return $this->durationTime; @@ -402,6 +422,18 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac return $this->travelTime; } + /** + * @Groups({"docgen:read"}) + */ + public function getTravelTimeMinute(): int + { + if (null === $this->travelTime) { + return 0; + } + + return (int) round(($this->travelTime->getTimestamp() + $this->travelTime->getOffset()) / 60.0, 0); + } + /** * @deprecated */ @@ -425,7 +457,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac return $this->getEmergency(); } - public function removeDocument(Document $document): void + public function removeDocument(StoredObject $document): void { $this->documents->removeElement($document); } diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php b/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php index 725b1eb8e..89f616dc2 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\ActivityBundle\Entity; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Serializer\Annotation as Serializer; /** * Class ActivityPresence. @@ -31,11 +32,14 @@ class ActivityPresence * @ORM\Id * @ORM\Column(name="id", type="integer") * @ORM\GeneratedValue(strategy="AUTO") + * @Serializer\Groups({"docgen:read"}) */ private ?int $id; /** * @ORM\Column(type="json") + * @Serializer\Groups({"docgen:read"}) + * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ private array $name = []; diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php index 5ad692bf4..bdf75ed05 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php @@ -13,8 +13,10 @@ namespace Chill\ActivityBundle\Entity; use Doctrine\ORM\Mapping as ORM; use InvalidArgumentException; +use Symfony\Component\Serializer\Annotation as Serializer; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; +use Symfony\Component\Validator\Context\ExecutionContextInterface; /** * Class ActivityType. @@ -118,6 +120,7 @@ class ActivityType * @ORM\Id * @ORM\Column(name="id", type="integer") * @ORM\GeneratedValue(strategy="AUTO") + * @Groups({"docgen:read"}) */ private ?int $id; @@ -133,7 +136,8 @@ class ActivityType /** * @ORM\Column(type="json") - * @Groups({"read"}) + * @Groups({"read", "docgen:read"}) + * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ private array $name = []; @@ -190,7 +194,6 @@ class ActivityType /** * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) - * @Assert\EqualTo(propertyPath="socialIssuesVisible", message="This parameter must be equal to social issue parameter") */ private int $socialActionsVisible = self::FIELD_INVISIBLE; @@ -260,6 +263,23 @@ class ActivityType */ private int $userVisible = self::FIELD_REQUIRED; + /** + * @Assert\Callback + * + * @param mixed $payload + */ + public function checkSocialActionsVisibility(ExecutionContextInterface $context, $payload) + { + if ($this->socialIssuesVisible !== $this->socialActionsVisible) { + if (!(2 === $this->socialIssuesVisible && 1 === $this->socialActionsVisible)) { + $context + ->buildViolation('The socialActionsVisible value is not compatible with the socialIssuesVisible value') + ->atPath('socialActionsVisible') + ->addViolation(); + } + } + } + /** * Get active * return true if the type is active. diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityType.php b/src/Bundle/ChillActivityBundle/Form/ActivityType.php index 7c5e0e410..6f935ad99 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityType.php @@ -307,6 +307,7 @@ class ActivityType extends AbstractType 'allow_add' => true, 'button_add_label' => 'activity.Insert a document', 'button_remove_label' => 'activity.Remove a document', + 'empty_collection_explain' => 'No documents', ]); } diff --git a/src/Bundle/ChillActivityBundle/Resources/public/chill/chillactivity.scss b/src/Bundle/ChillActivityBundle/Resources/public/chill/chillactivity.scss index 275f67950..5c1c83d06 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/chill/chillactivity.scss +++ b/src/Bundle/ChillActivityBundle/Resources/public/chill/chillactivity.scss @@ -9,8 +9,9 @@ div.new-activity-select-type { display: flex; flex-direction: row; flex-wrap: wrap; - justify-content: center; + justify-content: flex-start; gap: 12px; + margin-bottom: 30px; div.bloc { width: 200px; @@ -27,26 +28,28 @@ div.new-activity-select-type { // precise dashboard specific details p.date-label { - display: inline-block; - margin: 0 0.5em 0 0; - font-weight: 700; - font-size: 18pt; + display: inline-block; + margin: 0 0.5em 0 0; + font-weight: 700; + font-size: 18pt; } div.dashboard, +h4.badge-title, +h3.badge-title, h2.badge-title { - ul.list-content { - font-size: 70%; - list-style-type: none; - padding-left: 0; - margin: 0; - li { - margin-bottom: 0.2em; - // exception: change bg color for action badges above dashboard - .bg-light { - background-color: $chill-light-gray !important; - } - } - } + ul.list-content { + font-size: 70%; + list-style-type: none; + padding-left: 0; + margin: 0; + li { + margin-bottom: 0.2em; + // exception: change bg color for action badges above dashboard + .bg-light { + background-color: $chill-light-gray !important; + } + } + } } //// ACTIVITY SHOW AND FORM PAGES diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/App.vue b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/App.vue index 2fb9d022d..4809a5fae 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/App.vue +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/App.vue @@ -11,7 +11,7 @@ import Location from './components/Location.vue'; export default { name: "App", - props: ['hasSocialIssues', 'hasLocation', 'hasPerson'], + props: ['hasSocialIssues', 'hasLocation', 'hasPerson'], components: { ConcernedGroups, SocialIssuesAcc, diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/ConcernedGroups.vue b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/ConcernedGroups.vue index f5057eb25..45483dc95 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/ConcernedGroups.vue +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/ConcernedGroups.vue @@ -1,45 +1,48 @@ diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location.vue b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location.vue index b8249ccc5..91c5db839 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location.vue +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location.vue @@ -24,7 +24,7 @@ v-model="location" > - + diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location/NewLocation.vue b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location/NewLocation.vue index 35bf9a065..c9a1c233c 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location/NewLocation.vue +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location/NewLocation.vue @@ -18,15 +18,6 @@