diff --git a/CHANGELOG.md b/CHANGELOG.md index ccfbf6bb5..b84e66d78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,9 @@ and this project adheres to * [docstore] Add an API entrypoint for StoredObject (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/466) * [person] Add the possibility of uploading existing documents to AccPeriodWorkEvaluationDocument (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/466) * [person] Add title to AccPeriodWorkEvaluationDocument (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/466) - +* [person] Order social issues by the field "ordering" (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/388) +* [Person/Household list] when listing other simultaneous members of an household, exclude the members on person, not on members (avoid to show two membersship with the same person) +* [Person] Display suffixText in RenderPerson, PersonText.vue, RenderPersonBox.vue (was made for displaying "enfant confie") (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/441) ## Test releases @@ -30,6 +32,7 @@ and this project adheres to * [person]: AddPersons: add suggestion of name when creating new person or thirdparty (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/422) * [main] Address: fix small bug: when modifying an address without street (isNoAddress), also check errors if street is an empty string as back-end change null value to empty string for street (and streetNumber) * [main] Address: stronger client-side validation of addresses (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/449) +* [thirdparty] Add a contact to a thirdparty from within onTheFly (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/345) * [person] accompanying course: filter suggested entities by open participations (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/415) [activity] can click through the cross icon for removing person in concerned group (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/476) [activity] correct associated persons by considering only open participations (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/476) @@ -40,6 +43,8 @@ and this project adheres to * [3party]: 3party: redirect to parent when contact (child) is opened in view page * [parcours / addresses]: launch an event when a person change address (either through changing household or because the household is associated to a new address). If the person is localising a course, the course location go back to a temporarily address. * Creation of PickCivilityType, and implementation in PersonType and ThirdpartyType +* [renderbox]: Fix display of address (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/462) +* [renderbox]: Add email in personRenderBox, this was not yet displayed. ### test release 2022-02-14 @@ -86,7 +91,19 @@ and this project adheres to * [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 +======= +* [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc. +>>>>>>> issue422_and_others_on_AddPersons + +======= +* [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) + +>>>>>>> b0d50d315c8e00959a967badac9cf5057ab2b4bc ### 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) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 33107d40b..392b3026a 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + 'ChillActivityBundle:ActivityReasonCategory' @@ -47,6 +47,11 @@ Activity[]|array + + + AppKernel + + require __DIR__ . '/../../../../../vendor/autoload.php' @@ -164,72 +169,18 @@ type - - - public function setUp() - - - - - public function setUp() - - - - - public function setUp() - - - - - public function setUp() - - - - - public function setUp() - - - - - public function setUp() - - - - - public function setUp() - - - - public function setUp() - \Chill\PersonBundle\Export\Filter\PersonHavingActivityBetweenDateFilter - - - public function setUp() - - - - public function setUp() - Prophecy\Prophet - - - public function setUp() - - - - public function setUp() - type @@ -254,11 +205,6 @@ $asideActivityCategory - - - public function setUp() - - $calculator::getAlias() @@ -288,11 +234,6 @@ 'ChillCalendarBundle:Calendar' - - - public function setUp() - - 'ChillCustomFieldsBundle:CustomFieldsGroup' @@ -397,10 +338,6 @@ - - public function setUp() - public function tearDown() - type type @@ -408,61 +345,6 @@ type - - - public function setUp() - - - - - public function setUp() - - - - - public function setUp() - - - - - public function setUp() - - - - - public function setUp() - - - - - public function setUp() - - - - - public function setUp() - - - - - protected function setUp() - - - - - protected function setUp() - - - - - protected function setUp() - - - - - 'ChillDocStoreBundle:AccompanyingCourseDocument' - - 'ChillDocStoreBundle:DocumentCategory' @@ -470,11 +352,6 @@ 'ChillDocStoreBundle:DocumentCategory' - - - 'ChillDocStoreBundle:PersonDocument' - - \Chill\PersonBundle\Entity\user @@ -570,9 +447,6 @@ type - - public function setUp() - 'ChillEventBundle:Event' 'ChillEventBundle:Event' @@ -588,10 +462,6 @@ - - public function setUp() - public function tearDown() - 'ChillMainBundle:Scope' @@ -891,11 +761,6 @@ OptionsResolverInterface - - - \Symfony\Component\Mailer\Exception\TransportExceptionInterface - - $current @@ -924,11 +789,6 @@ $onlyEnabled - - - AppKernel - - require __DIR__ . '/../../../../../vendor/autoload.php' @@ -1056,158 +916,15 @@ - - public function setUp() - type - - - public function setUp() - - - - - public function setUp() - - - - - protected function tearDown() - public function setUp() - - - - - public function setUp() - public function tearDown() - - - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - $this->prophet - Prophecy\Prophet - - - - - CenterType - - - CenterType - - - - - public function setUp() - - - - - public function setUp() - - - - - public function setUp() - - - - - public function setUp() - - - - public function setUp() - unknown - - - public function setUp() - - - - - public function setUp() - - - - - protected function setUp() - - - - - public function setUp() - - - - - public function setUp() - - - - - public function setUp() - - - - - protected function setUp() - - - - - public function setUp() - - - - - protected function setUp() - - unknown @@ -1412,20 +1129,6 @@ OptionsResolverInterface - - - $qb - $qb - $qb - QueryBuilder - SocialAction - SocialAction - - - $action - $orderBy - - AppKernel @@ -1505,33 +1208,13 @@ - - public function setUp() - public static function setUpBeforeClass() - AccompanyingPeriodRepository stdClass - - - public function setUp() - public static function setUpBeforeClass() - - - - - public function setUp() - - - - public function setUp() - public function tearDown() - public static function setUpBeforeClass() - 'ChillMainBundle:Center' 'ChillPersonBundle:AccompanyingPeriod\ClosingMotive' @@ -1543,40 +1226,19 @@ - - protected function tearDown() - User - - - protected function setUp() - - $this - - public function setUp() - public static function setUpBeforeClass() - 'ChillPersonBundle:Person' - - - public static function tearDownAfterClass() - - - - public function setUp() - public function tearDown() - 'ChillMainBundle:Country' 'ChillPersonBundle:Person' @@ -1586,140 +1248,25 @@ - - public function setUp() - public function tearDown() - 'ChillMainBundle:Country' 'ChillPersonBundle:Person' - - public function setUp() - public function tearDown() - 'ChillPersonBundle:Person' - - public function setUp() - public function tearDown() - 'ChillPersonBundle:Person' - - - public function setUp() - - - - - public function setUp() - - - - - public function setUp() - - $participationL - - getEndDate - - - - - public function setUp() - - - - - public function setUp() - - - - - public function setUp() - - - - - public function setUp() - - - - - public function setUp() - - - - - public function setUp() - - - - - public function setUp() - - - - - public function setUp() - - - - - public function setUp() - - - - - protected function setUp() - - - - - public function setUp() - - - - - protected function setUp() - - - - - protected function setUp() - - - - - protected function setUp() - - - - - protected function setUp() - - - - - protected function setUp() - - - - - protected function setUp() - @@ -1820,20 +1367,13 @@ require __DIR__ . '/../../../../../vendor/autoload.php' - - - public function setUp() - - type - - public function setUp() - public static function setUpBeforeClass() - - + + $client + $client $client $client $client @@ -1865,16 +1405,7 @@ type - - - Exception - - - - public function setUp() - public static function setUpBeforeClass() - type type @@ -1882,10 +1413,6 @@ - - public function setUp() - public function tearDown() - 'ChillCustomFieldsBundle:CustomFieldsGroup' @@ -1958,11 +1485,6 @@ CacheItempPoolInterface - - - protected function setUp() - - $taggedService->getClass()::getKey() @@ -1988,11 +1510,6 @@ $thirdParty - - - protected function setUp() - - $object diff --git a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php index 7ee09690a..a787e9ecd 100644 --- a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php +++ b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php @@ -22,7 +22,7 @@ use Chill\DocStoreBundle\Repository\DocumentCategoryRepository; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\Person; -use Chill\PersonBundle\Templating\Entity\PersonRender; +use Chill\PersonBundle\Templating\Entity\PersonRenderInterface; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; @@ -43,7 +43,7 @@ class ActivityContext implements private NormalizerInterface $normalizer; - private PersonRender $personRender; + private PersonRenderInterface $personRender; private TranslatableStringHelperInterface $translatableStringHelper; @@ -54,7 +54,7 @@ class ActivityContext implements NormalizerInterface $normalizer, TranslatableStringHelperInterface $translatableStringHelper, EntityManagerInterface $em, - PersonRender $personRender, + PersonRenderInterface $personRender, TranslatorInterface $translator, BaseContextData $baseContextData ) { diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/index.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/index.html.twig index 6ea6cfc23..df18efa71 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/index.html.twig +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/index.html.twig @@ -21,7 +21,7 @@ {% endblock %} {% block content %} -
+

{{ 'Documents' }}

{% if documents|length == 0 %} @@ -29,7 +29,7 @@ {% else %}
{% for document in documents %} - {% include 'ChillDocStoreBundle:List:list_item.html.twig' %} + {% include '@ChillDocStore/List/list_item.html.twig' %} {% endfor %}
{% endif %} diff --git a/src/Bundle/ChillMainBundle/ChillMainBundle.php b/src/Bundle/ChillMainBundle/ChillMainBundle.php index 07daf65ea..32e075b7f 100644 --- a/src/Bundle/ChillMainBundle/ChillMainBundle.php +++ b/src/Bundle/ChillMainBundle/ChillMainBundle.php @@ -29,7 +29,6 @@ use Chill\MainBundle\Security\ProvideRoleInterface; use Chill\MainBundle\Security\Resolver\CenterResolverInterface; use Chill\MainBundle\Security\Resolver\ScopeResolverInterface; use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface; -use Chill\MainBundle\Templating\Entity\CompilerPass as RenderEntityCompilerPass; use Chill\MainBundle\Templating\UI\NotificationCounterInterface; use Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -70,7 +69,6 @@ class ChillMainBundle extends Bundle $container->addCompilerPass(new MenuCompilerPass()); $container->addCompilerPass(new ACLFlagsCompilerPass()); $container->addCompilerPass(new GroupingCenterCompilerPass()); - $container->addCompilerPass(new RenderEntityCompilerPass()); $container->addCompilerPass(new CRUDControllerCompilerPass()); } } diff --git a/src/Bundle/ChillMainBundle/Controller/CivilityApiController.php b/src/Bundle/ChillMainBundle/Controller/CivilityApiController.php new file mode 100644 index 000000000..3db55ae0e --- /dev/null +++ b/src/Bundle/ChillMainBundle/Controller/CivilityApiController.php @@ -0,0 +1,24 @@ +addOrderBy('e.order', 'ASC'); + } +} diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index fa561b7e7..6e3d6d85e 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\MainBundle\DependencyInjection; use Chill\MainBundle\Controller\AddressApiController; +use Chill\MainBundle\Controller\CivilityApiController; use Chill\MainBundle\Controller\LocationController; use Chill\MainBundle\Controller\LocationTypeController; use Chill\MainBundle\Controller\UserController; @@ -559,6 +560,21 @@ class ChillMainExtension extends Extension implements ], ], ], + [ + 'class' => \Chill\MainBundle\Entity\Civility::class, + 'name' => 'civility', + 'base_path' => '/api/1.0/main/civility', + 'base_role' => 'ROLE_USER', + 'controller' => CivilityApiController::class, + 'actions' => [ + '_index' => [ + 'methods' => [ + Request::METHOD_GET => true, + Request::METHOD_HEAD => true, + ], + ], + ], + ], ], ]); } diff --git a/src/Bundle/ChillMainBundle/Entity/Civility.php b/src/Bundle/ChillMainBundle/Entity/Civility.php index c91016a63..e5d15a751 100644 --- a/src/Bundle/ChillMainBundle/Entity/Civility.php +++ b/src/Bundle/ChillMainBundle/Entity/Civility.php @@ -17,6 +17,7 @@ use Symfony\Component\Serializer\Annotation as Serializer; /** * @ORM\Table(name="chill_main_civility") * @ORM\Entity + * @Serializer\DiscriminatorMap(typeProperty="type", mapping={"chill_main_civility": Civility::class}) */ class Civility { @@ -29,6 +30,7 @@ class Civility /** * @ORM\Column(type="boolean") + * @Serializer\Groups({"read"}) */ private bool $active = true; diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/render_box.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/render_box.scss index 37d4f97c4..c42c592a9 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/render_box.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/render_box.scss @@ -72,7 +72,7 @@ section.chill-entity { } } p { - display: inline-block; + // display: inline-block; margin: 0 0 0 1.5em; text-indent: -1.5em; diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/Create.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/Create.vue index 061d728a0..22b0181e5 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/Create.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/Create.vue @@ -77,8 +77,7 @@ export default { return this.$refs.castPerson.$data.person; case 'thirdparty': let data = this.$refs.castThirdparty.$data.thirdparty; - data.name = data.text; - if (data.address !== null) { + if (data.address !== undefined && data.address !== null) { data.address = { id: data.address.address_id } } else { data.address = null; diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue index b03b98b23..e84496d31 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue @@ -18,7 +18,8 @@ @close="modal.showModal = false"> @@ -44,13 +45,22 @@ ref="castThirdparty">
-

{{ $t('onthefly.resource_comment_title') }}

-
- {{ parent.comment }} -
+

{{ $t('onthefly.resource_comment_title') }}

+
+ {{ parent.comment }} +
+ + diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue index dd26db217..f77f006db 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue @@ -12,6 +12,7 @@ {{ person.firstName }} {{ person.lastName }} +  {{ person.suffixText }} {{ altNameLabel }} @@ -20,6 +21,7 @@ {{ person.firstName }} {{ person.lastName }} +  {{ person.suffixText }} (‡) {{ altNameLabel }} @@ -85,6 +87,15 @@

+
  • + + {{ person.email }} +
  • +
  • + +

    {{ $t('renderbox.no_data') }}

    +
  • +
  • {{ person.mobilenumber }} diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue index 8f89649d8..8b991e3da 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue @@ -6,6 +6,7 @@ ({{ altNameLabel }}) +  {{ person.suffixText }} {{ $tc('renderbox.years_old', person.age) }}  (‡) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig index 02fc00e4c..e3280d755 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig @@ -12,6 +12,7 @@ * hLevel integer * addDeath bool * addAgeBadge bool + * suffixText bool * address_multiline bool * customButtons [ 'before' Twig\Markup, (injected with macro) @@ -46,6 +47,11 @@ ({{- 'years_old'|trans({ 'age': person.age }) -}}) {% endif %} {% endif %} + {%- if options['suffixText'] is defined -%} + {% for o in options['suffixText'] %} + {{ o }} + {% endfor %} + {% endif %} {% endmacro raw %} {% macro label(person, options) %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Macro/updatedBy.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Macro/updatedBy.html.twig index a0be22ffc..e40cbd3f7 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Macro/updatedBy.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Macro/updatedBy.html.twig @@ -3,10 +3,27 @@ {{ 'Last updated on'|trans }} {{ entity.updatedAt|format_datetime('medium', 'short') }} - , - {{ 'by_user'|trans }} - - {{ entity.updatedBy|chill_entity_render_box }} + {% if entity.updatedBy %} + {{ ', ' ~ 'by_user'|trans }} + + {{ entity.updatedBy|chill_entity_render_box }} + + {% endif %} +
  • +{% endmacro %} + +{% macro createdBy(entity) %} +
    + {{ 'Created on'|trans }} + + {{ entity.createdAt|format_datetime('medium', 'short') }} + + {% if entity.createdBy %} + {{ ', ' ~ 'by_user'|trans }} + + {{ entity.createdBy|chill_entity_render_string }} + + {% endif %}
    {% endmacro %} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php b/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php index 98dc14110..c046c8947 100644 --- a/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php +++ b/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php @@ -15,7 +15,7 @@ use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Repository\PersonNotDuplicateRepository; use Chill\PersonBundle\Security\Authorization\PersonVoter; -use Chill\PersonBundle\Templating\Entity\PersonRender; +use Chill\PersonBundle\Templating\Entity\PersonRenderInterface; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; @@ -39,7 +39,7 @@ class SimilarPersonMatcher protected PersonNotDuplicateRepository $personNotDuplicateRepository; - protected PersonRender $personRender; + protected PersonRenderInterface $personRender; /** * @var TokenStorageInterface @@ -51,7 +51,7 @@ class SimilarPersonMatcher AuthorizationHelper $authorizationHelper, TokenStorageInterface $tokenStorage, PersonNotDuplicateRepository $personNotDuplicateRepository, - PersonRender $personRender + PersonRenderInterface $personRender ) { $this->em = $em; $this->authorizationHelper = $authorizationHelper; diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php index 4dd32aa54..c19b35b57 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php @@ -19,7 +19,7 @@ use Chill\PersonBundle\Entity\Household\Household; use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\PersonAltName; use Chill\PersonBundle\Repository\Relationships\RelationshipRepository; -use Chill\PersonBundle\Templating\Entity\PersonRender; +use Chill\PersonBundle\Templating\Entity\PersonRenderInterface; use DateTimeInterface; use Doctrine\Common\Collections\ArrayCollection; use Symfony\Component\Serializer\Exception\UnexpectedValueException; @@ -37,7 +37,7 @@ class PersonDocGenNormalizer implements { use NormalizerAwareTrait; - private PersonRender $personRender; + private PersonRenderInterface $personRender; private RelationshipRepository $relationshipRepository; @@ -46,7 +46,7 @@ class PersonDocGenNormalizer implements private TranslatorInterface $translator; public function __construct( - PersonRender $personRender, + PersonRenderInterface $personRender, RelationshipRepository $relationshipRepository, TranslatorInterface $translator, TranslatableStringHelper $translatableStringHelper diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php index e91748de8..451171cb6 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php @@ -23,21 +23,15 @@ use Doctrine\Common\Collections\Collection; use Symfony\Component\Serializer\Exception\UnexpectedValueException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; -use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; -use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait; use function array_key_exists; /** * Serialize a Person entity. */ -class PersonJsonNormalizer implements - DenormalizerAwareInterface, - DenormalizerInterface, - NormalizerAwareInterface, - NormalizerInterface +class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwareInterface, PersonJsonNormalizerInterface { use DenormalizerAwareTrait; diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizerInterface.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizerInterface.php new file mode 100644 index 000000000..fd41752a8 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizerInterface.php @@ -0,0 +1,24 @@ + $options['customArea'] ?? [], 'addDeath' => $options['addDeath'] ?? true, 'addAgeBadge' => $options['addAgeBadge'] ?? false, + 'suffixText' => $options['suffixText'] ?? [], ]; return diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php new file mode 100644 index 000000000..631402851 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php @@ -0,0 +1,21 @@ +render = $render; } diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php index 73c29b1b3..f9f88debe 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ParticipationOverlapValidator.php @@ -13,7 +13,7 @@ namespace Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod; use Chill\MainBundle\Util\DateRangeCovering; use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation; -use Chill\PersonBundle\Templating\Entity\PersonRender; +use Chill\PersonBundle\Templating\Entity\PersonRenderInterface; use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender; use Doctrine\Common\Collections\Collection; use Symfony\Component\Validator\Constraint; @@ -26,11 +26,11 @@ class ParticipationOverlapValidator extends ConstraintValidator { private const MAX_PARTICIPATION = 1; - private PersonRender $personRender; + private PersonRenderInterface $personRender; private ThirdPartyRender $thirdpartyRender; - public function __construct(PersonRender $personRender, ThirdPartyRender $thirdPartyRender) + public function __construct(PersonRenderInterface $personRender, ThirdPartyRender $thirdPartyRender) { $this->personRender = $personRender; $this->thirdpartyRender = $thirdPartyRender; diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php index 3b84137fb..daf4d67f7 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ResourceDuplicateCheckValidator.php @@ -12,7 +12,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod; use Chill\PersonBundle\Entity\Person; -use Chill\PersonBundle\Templating\Entity\PersonRender; +use Chill\PersonBundle\Templating\Entity\PersonRenderInterface; use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender; use Doctrine\Common\Collections\Collection; use Symfony\Component\Form\Exception\UnexpectedTypeException; @@ -24,11 +24,11 @@ use function in_array; class ResourceDuplicateCheckValidator extends ConstraintValidator { - private PersonRender $personRender; + private PersonRenderInterface $personRender; private ThirdPartyRender $thirdpartyRender; - public function __construct(PersonRender $personRender, ThirdPartyRender $thirdPartyRender) + public function __construct(PersonRenderInterface $personRender, ThirdPartyRender $thirdPartyRender) { $this->personRender = $personRender; $this->thirdpartyRender = $thirdPartyRender; diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php index c357cb138..eba6fd87e 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/Household/HouseholdMembershipSequentialValidator.php @@ -13,7 +13,7 @@ namespace Chill\PersonBundle\Validator\Constraints\Household; use Chill\MainBundle\Util\DateRangeCovering; use Chill\PersonBundle\Entity\Person; -use Chill\PersonBundle\Templating\Entity\PersonRender; +use Chill\PersonBundle\Templating\Entity\PersonRenderInterface; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; use Symfony\Component\Validator\Exception\UnexpectedTypeException; @@ -26,9 +26,9 @@ use function count; */ class HouseholdMembershipSequentialValidator extends ConstraintValidator { - private PersonRender $render; + private PersonRenderInterface $render; - public function __construct(PersonRender $render) + public function __construct(PersonRenderInterface $render) { $this->render = $render; } diff --git a/src/Bundle/ChillPersonBundle/config/services/controller.yaml b/src/Bundle/ChillPersonBundle/config/services/controller.yaml index 421e13e93..22d58ccbe 100644 --- a/src/Bundle/ChillPersonBundle/config/services/controller.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/controller.yaml @@ -66,3 +66,4 @@ services: Chill\PersonBundle\Controller\RelationshipApiController: autowire: true tags: ['controller.service_arguments'] + diff --git a/src/Bundle/ChillThirdPartyBundle/DependencyInjection/ChillThirdPartyExtension.php b/src/Bundle/ChillThirdPartyBundle/DependencyInjection/ChillThirdPartyExtension.php index 1981d6daf..124f5b7f3 100644 --- a/src/Bundle/ChillThirdPartyBundle/DependencyInjection/ChillThirdPartyExtension.php +++ b/src/Bundle/ChillThirdPartyBundle/DependencyInjection/ChillThirdPartyExtension.php @@ -126,6 +126,21 @@ class ChillThirdPartyExtension extends Extension implements PrependExtensionInte ], ], ], + [ + 'class' => \Chill\ThirdPartyBundle\Entity\ThirdPartyProfession::class, + // 'controller' => \Chill\MainBundle\Controller\ProfessionApiController::class, + 'name' => 'profession', + 'base_path' => '/api/1.0/thirdparty/professions', + 'base_role' => 'ROLE_USER', + 'actions' => [ + '_index' => [ + 'methods' => [ + Request::METHOD_GET => true, + Request::METHOD_HEAD => true, + ], + ], + ], + ], ], ]); } diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php index 593d1c14c..25ef1be65 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php @@ -161,13 +161,14 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface * @var Civility * @ORM\ManyToOne(targetEntity=Civility::class) * ORM\JoinColumn(name="civility", referencedColumnName="id", nullable=true) - * @Groups({"docgen:read", "read", "docgen:read:3party:parent"}) + * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) * @Context(normalizationContext={"groups": "docgen:read"}, groups={"docgen:read:3party:parent"}) */ private ?Civility $civility = null; /** * @ORM\Column(name="comment", type="text", nullable=true) + * @Groups({"read", "write"}) */ private ?string $comment = null; @@ -200,7 +201,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") - * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) + * @Groups({"read", "docgen:read", "docgen:read:3party:parent"}) */ private ?int $id = null; @@ -235,7 +236,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface * * @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty", inversedBy="children") * @ORM\JoinColumn(name="parent_id", referencedColumnName="id") - * @Groups({"read", "docgen:read"}) + * @Groups({"read", "write", "docgen:read"}) * @Context(normalizationContext={"groups": "docgen:read:3party:parent"}, groups={"docgen:read"}) */ private ?ThirdParty $parent = null; @@ -246,7 +247,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface * @var ThirdPartyProfession * @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdPartyProfession") * ORM\JoinColumn(name="profession", referencedColumnName="id", nullable=true) - * @Groups({"docgen:read", "docgen:read:3party:parent"}) + * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) * @Context(normalizationContext={"groups": "docgen:read"}, groups={"docgen:read:3party:parent"}) */ private ?ThirdPartyProfession $profession = null; @@ -706,7 +707,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface /** * @return $this */ - public function setCivility(Civility $civility): ThirdParty + public function setCivility(?Civility $civility): ThirdParty { $this->civility = $civility; @@ -811,7 +812,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface /** * @return $this */ - public function setProfession(ThirdPartyProfession $profession): ThirdParty + public function setProfession(?ThirdPartyProfession $profession): ThirdParty { $this->profession = $profession; diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyProfession.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyProfession.php index 1963b34a7..896888a73 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyProfession.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyProfession.php @@ -18,11 +18,14 @@ use Symfony\Component\Serializer\Annotation as Serializer; /** * @ORM\Table(name="chill_3party.party_profession") * @ORM\Entity(repositoryClass=ThirdPartyProfessionRepository::class) + * @Serializer\DiscriminatorMap(typeProperty="type", mapping={ + * "third_party_profession": ThirdPartyProfession::class}) */ class ThirdPartyProfession { /** * @ORM\Column(type="boolean") + * @Serializer\Groups({"read"}) */ private bool $active = true; @@ -30,13 +33,13 @@ class ThirdPartyProfession * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") - * @Serializer\Groups({"docgen:read"}) + * @Serializer\Groups({"docgen:read", "read", "write"}) */ private ?int $id = null; /** * @ORM\Column(type="json") - * @Serializer\Groups({"docgen:read"}) + * @Serializer\Groups({"docgen:read", "read"}) */ private array $name = []; diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue index 4b012e3f0..40efa9bfb 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue @@ -19,9 +19,15 @@ >
    -
    - -
    +
    +
    +
    + + {{ $t('child_of') }} + {{ parent.text }} +
    +
    +
    + +
    +
    +
    + +
    +
    + +
    +
    +
    +
    - +
    @@ -98,6 +124,15 @@ aria-describedby="phonenumber" />
    +
    +
    + + +
    +
    @@ -106,10 +141,11 @@ import ThirdPartyRenderBox from '../Entity/ThirdPartyRenderBox.vue'; import AddAddress from 'ChillMainAssets/vuejs/Address/components/AddAddress'; import { getThirdparty } from '../../_api/OnTheFly'; import BadgeEntity from 'ChillMainAssets/vuejs/_components/BadgeEntity.vue'; +import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods'; export default { name: "OnTheFlyThirdParty", - props: ['id', 'type', 'action', 'query'], + props: ['id', 'type', 'action', 'query', 'parent'], components: { ThirdPartyRenderBox, AddAddress, @@ -124,8 +160,11 @@ export default { kind: 'company', name: '', telephone: '', - + civility: null, + profession: null, }, + professions: [], + civilities: [], addAddress: { options: { openPanesInModal: true, @@ -177,10 +216,10 @@ export default { }, methods: { loadData(){ - getThirdparty(this.id).then(thirdparty => new Promise((resolve, reject) => { + return getThirdparty(this.id).then(thirdparty => new Promise((resolve, reject) => { this.thirdparty = thirdparty; this.thirdparty.kind = thirdparty.kind; - //console.log('get thirdparty', thirdparty); + console.log('get thirdparty', thirdparty); if (this.action !== 'show') { if (thirdparty.address !== null) { // bof! we force getInitialAddress because addressId not available when mounted @@ -190,6 +229,30 @@ export default { resolve(); })); }, + loadCivilities() { + const url = `/api/1.0/main/civility.json`; + return makeFetch('GET', url) + .then(response => { + this.$data.civilities = response.results; + return Promise.resolve(); + }) + .catch((error) => { + console.log(error) + this.$toast.open({message: error.body}) + }) + }, + loadProfessions() { + const url = `/api/1.0/thirdparty/professions.json`; + return makeFetch('GET', url) + .then(response => { + this.$data.professions = response.results; + return Promise.resolve(); + }) + .catch((error) => { + console.log(error) + this.$toast.open({message: error.body}) + }) + }, submitAddress(payload) { console.log('submitAddress', payload); if (typeof payload.addressId !== 'undefined') { // <-- @@ -200,13 +263,24 @@ export default { } }, addQuery(query) { - this.thirdparty.text = query; - } + this.thirdparty.name = query; + }, }, - mounted() { - //console.log('mounted', this.action); + mounted() { + let dependencies = []; + dependencies.push(this.loadProfessions()); + dependencies.push(this.loadCivilities()); if (this.action !== 'create') { - this.loadData(); + if (this.id) { + dependencies.push(this.loadData()); + // here we can do something when all promises are resolve, with + // Promise.all(dependencies).then(() => { /* do something */ }); + } + if (this.action === 'addContact') { + this.$data.thirdparty.kind = 'child' + // this.$data.thirdparty.parent = this.parent.id + this.$data.thirdparty.address = null + } } else { this.thirdparty.kind = 'company'; } @@ -229,5 +303,16 @@ dl { margin-left: 1em; } } +.parent-info { + margin-bottom: 1rem; +} + +#child-info { + display: flex; + justify-content: space-between; + div { + width: 49%; + } +} diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_js/i18n.js b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_js/i18n.js index 37d09320d..76f01e3f4 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_js/i18n.js +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_js/i18n.js @@ -4,7 +4,12 @@ const thirdpartyMessages = { name: "Dénomination", email: "Courriel", phonenumber: "Téléphone", - } + comment: "Commentaire", + profession: "Qualité", + civility: "Civilité" + }, + child_of: "Contact de: ", + children: "Personnes de contact: ", } }; diff --git a/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php b/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php index 6ffcc2dea..d518a9f2b 100644 --- a/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php +++ b/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php @@ -36,6 +36,7 @@ class ThirdPartyNormalizer implements NormalizerAwareInterface, NormalizerInterf { return [ 'type' => 'thirdparty', + 'name' => $thirdParty->getName(), 'text' => $this->thirdPartyRender->renderString($thirdParty, []), 'id' => $thirdParty->getId(), 'kind' => $thirdParty->getKind(), @@ -45,6 +46,7 @@ class ThirdPartyNormalizer implements NormalizerAwareInterface, NormalizerInterf 'isChild' => $thirdParty->isChild(), 'parent' => $this->normalizer->normalize($thirdParty->getParent(), $format, $context), 'civility' => $this->normalizer->normalize($thirdParty->getCivility(), $format, $context), + 'profession' => $this->normalizer->normalize($thirdParty->getProfession(), $format, $context), 'contactDataAnonymous' => $thirdParty->isContactDataAnonymous(), ]; } diff --git a/src/Bundle/ChillThirdPartyBundle/chill.api.specs.yaml b/src/Bundle/ChillThirdPartyBundle/chill.api.specs.yaml index 52db7589c..eb303a4f0 100644 --- a/src/Bundle/ChillThirdPartyBundle/chill.api.specs.yaml +++ b/src/Bundle/ChillThirdPartyBundle/chill.api.specs.yaml @@ -110,3 +110,14 @@ paths: description: "OK" 422: description: "Object with validation errors" + + /1.0/thirdparty/professions.json: + get: + tags: + - thirdparty + summary: Return all thirdparty professions + responses: + 200: + description: "ok" + 401: + description: "Unauthorized"