diff --git a/CHANGELOG.md b/CHANGELOG.md index 3683260d6..dcbed5225 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,12 +13,34 @@ and this project adheres to * [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 releases + +### 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 + +>>>>>>> origin/master * [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 -* [person]: possibility to add person resources (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/382) -## Test releases ### test release 2022-01-24 diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 2947fda38..3e32edfce 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -256,7 +256,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, @@ -269,7 +269,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'; } 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/views/Activity/list_recent.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list_recent.html.twig index 0f426c5a9..e8be2c49e 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list_recent.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list_recent.html.twig @@ -48,7 +48,7 @@
  • {{ 'Participants'|trans ~ ' : ' }} {% for p in activity.personsAssociated %} - {{ p|chill_entity_render_box }} + {{ p|chill_entity_render_box({'addAgeBadge': true}) }} {% endfor %}
  • diff --git a/src/Bundle/ChillActivityBundle/Tests/Security/Authorization/ActivityVoterTest.php b/src/Bundle/ChillActivityBundle/Tests/Security/Authorization/ActivityVoterTest.php index b3d8472c6..3ca5aab45 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Security/Authorization/ActivityVoterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Security/Authorization/ActivityVoterTest.php @@ -29,9 +29,13 @@ use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; final class ActivityVoterTest extends KernelTestCase { use PrepareActivityTrait; + use PrepareCenterTrait; + use PreparePersonTrait; + use PrepareScopeTrait; + use PrepareUserTrait; /** diff --git a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php index eee8c7dc8..e5244009e 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityController.php @@ -32,6 +32,8 @@ final class AsideActivityController extends CRUDController { $asideActivity = new AsideActivity(); + $asideActivity->setAgent($this->getUser()); + $duration = $request->query->get('duration', '300'); $duration = DateTime::createFromFormat('U', $duration); $asideActivity->setDuration($duration); diff --git a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php index 5a4eec9e0..6ade55d07 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php @@ -14,9 +14,9 @@ namespace Chill\AsideActivityBundle\Form; use Chill\AsideActivityBundle\Entity\AsideActivity; use Chill\AsideActivityBundle\Entity\AsideActivityCategory; use Chill\AsideActivityBundle\Templating\Entity\CategoryRender; -use Chill\MainBundle\Entity\User; use Chill\MainBundle\Form\Type\ChillDateType; use Chill\MainBundle\Form\Type\ChillTextareaType; +use Chill\MainBundle\Form\Type\PickUserDynamicType; use DateInterval; use DateTime; use DateTimeImmutable; @@ -68,22 +68,10 @@ final class AsideActivityFormType extends AbstractType ]; $builder - ->add( - 'agent', - EntityType::class, - [ - 'label' => 'For agent', - 'required' => true, - 'class' => User::class, - 'data' => $this->storage->getToken()->getUser(), - 'query_builder' => static function (EntityRepository $er) { - return $er->createQueryBuilder('u')->where('u.enabled = true'); - }, - 'attr' => ['class' => 'select2 '], - 'placeholder' => 'Choose the agent for whom this activity is created', - 'choice_label' => 'username', - ] - ) + ->add('agent', PickUserDynamicType::class, [ + 'label' => 'For agent', + 'required' => true, + ]) ->add( 'date', ChillDateType::class, diff --git a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/new.html.twig b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/new.html.twig index 0781272a1..09acf9859 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/new.html.twig +++ b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/new.html.twig @@ -1,5 +1,15 @@ {% extends '@ChillMain/Admin/layout.html.twig' %} +{% block js %} + {{ parent() }} + {{ encore_entry_script_tags('mod_pickentity_type') }} +{% endblock %} + +{% block css %} + {{ parent() }} + {{ encore_entry_link_tags('mod_pickentity_type') }} +{% endblock %} + {% block title %} {% include('@ChillMain/CRUD/_new_title.html.twig') %} {% endblock %} @@ -8,4 +18,5 @@ {% embed '@ChillMain/CRUD/_new_content.html.twig' %} {% block content_form_actions_save_and_show %}{% endblock %} {% endembed %} -{% endblock %} \ No newline at end of file +{% endblock %} + diff --git a/src/Bundle/ChillMainBundle/Entity/Address.php b/src/Bundle/ChillMainBundle/Entity/Address.php index 070d40468..0e6cd549b 100644 --- a/src/Bundle/ChillMainBundle/Entity/Address.php +++ b/src/Bundle/ChillMainBundle/Entity/Address.php @@ -42,10 +42,16 @@ class Address */ private $buildingName; + /** + * @ORM\Column(type="boolean") + * @Groups({"write"}) + */ + private bool $confidential = false; + /** * @var string|null * - * @ORM\Column(type="string", length=16, nullable=true) + * @ORM\Column(type="string", length=255, nullable=true) * @Groups({"write"}) */ private $corridor; @@ -78,7 +84,7 @@ class Address /** * @var string|null * - * @ORM\Column(type="string", length=16, nullable=true) + * @ORM\Column(type="string", length=255, nullable=true) * @Groups({"write"}) */ private $flat; @@ -86,7 +92,7 @@ class Address /** * @var string|null * - * @ORM\Column(type="string", length=16, nullable=true) + * @ORM\Column(type="string", length=255, nullable=true) * @Groups({"write"}) */ private $floor; @@ -143,7 +149,7 @@ class Address /** * @var string|null * - * @ORM\Column(type="string", length=16, nullable=true) + * @ORM\Column(type="string", length=255, nullable=true) * @Groups({"write"}) */ private $steps; @@ -192,6 +198,7 @@ class Address return (new Address()) ->setAddressReference($original->getAddressReference()) ->setBuildingName($original->getBuildingName()) + ->setConfidential($original->getConfidential()) ->setCorridor($original->getCorridor()) ->setCustoms($original->getCustoms()) ->setDistribution($original->getDistribution()) @@ -229,6 +236,11 @@ class Address return $this->buildingName; } + public function getConfidential(): bool + { + return $this->confidential; + } + public function getCorridor(): ?string { return $this->corridor; @@ -369,6 +381,13 @@ class Address return $this; } + public function setConfidential(bool $confidential): self + { + $this->confidential = $confidential; + + return $this; + } + public function setCorridor(?string $corridor): self { $this->corridor = $corridor; diff --git a/src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php b/src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php index 51b8978a0..61ebce10b 100644 --- a/src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php +++ b/src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php @@ -20,10 +20,9 @@ use Doctrine\ORM\Mapping as ORM; class CommentEmbeddable { /** - * @var string * @ORM\Column(type="text", nullable=true) */ - private $comment; + private ?string $comment = null; /** * @var DateTime @@ -39,10 +38,7 @@ class CommentEmbeddable */ private $userId; - /** - * @return string - */ - public function getComment() + public function getComment(): ?string { return $this->comment; } @@ -68,9 +64,6 @@ class CommentEmbeddable return empty($this->getComment()); } - /** - * @param string $comment - */ public function setComment(?string $comment) { $this->comment = $comment; diff --git a/src/Bundle/ChillMainBundle/Entity/ResidentialAddress.php b/src/Bundle/ChillMainBundle/Entity/ResidentialAddress.php new file mode 100644 index 000000000..7763ea9d5 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Entity/ResidentialAddress.php @@ -0,0 +1,166 @@ +comment = new CommentEmbeddable(); + } + + public function getAddress(): ?Address + { + return $this->address; + } + + public function getComment(): CommentEmbeddable + { + return $this->comment; + } + + public function getEndDate(): ?DateTimeImmutable + { + return $this->endDate; + } + + public function getHostPerson(): ?Person + { + return $this->hostPerson; + } + + public function getHostThirdParty(): ?ThirdParty + { + return $this->hostThirdParty; + } + + public function getId(): ?int + { + return $this->id; + } + + public function getPerson(): ?Person + { + return $this->person; + } + + public function getStartDate(): ?DateTimeImmutable + { + return $this->startDate; + } + + public function setAddress(?Address $address): self + { + $this->address = $address; + + return $this; + } + + public function setComment(CommentEmbeddable $comment): self + { + $this->comment = $comment; + + return $this; + } + + public function setEndDate(?DateTimeImmutable $endDate): self + { + $this->endDate = $endDate; + + return $this; + } + + public function setHostPerson(?Person $hostPerson): self + { + $this->hostPerson = $hostPerson; + + return $this; + } + + public function setHostThirdParty(?ThirdParty $hostThirdParty): self + { + $this->hostThirdParty = $hostThirdParty; + + return $this; + } + + public function setPerson(?Person $person): self + { + $this->person = $person; + + return $this; + } + + public function setStartDate(DateTimeImmutable $startDate): self + { + $this->startDate = $startDate; + + return $this; + } +} diff --git a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php index b56435f5d..0d7142e9f 100644 --- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php +++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php @@ -37,6 +37,7 @@ use function count; class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface { use TrackCreationTrait; + use TrackUpdateTrait; /** diff --git a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowComment.php b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowComment.php index b041a5aa3..9f4e7f096 100644 --- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowComment.php +++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowComment.php @@ -24,6 +24,7 @@ use Doctrine\ORM\Mapping as ORM; class EntityWorkflowComment implements TrackCreationInterface, TrackUpdateInterface { use TrackCreationTrait; + use TrackUpdateTrait; /** diff --git a/src/Bundle/ChillMainBundle/Form/Type/ResidentialAddressType.php b/src/Bundle/ChillMainBundle/Form/Type/ResidentialAddressType.php new file mode 100644 index 000000000..0ebe47fef --- /dev/null +++ b/src/Bundle/ChillMainBundle/Form/Type/ResidentialAddressType.php @@ -0,0 +1,73 @@ +add('startDate', DateType::class, [ + 'required' => true, + 'input' => 'datetime_immutable', + 'widget' => 'single_text', + ]) + ->add('endDate', DateType::class, [ + 'required' => false, + 'input' => 'datetime_immutable', + 'widget' => 'single_text', + ]) + ->add('comment', CommentType::class, [ + 'required' => false, + ]); + + if ('person' === $options['kind']) { + $builder + ->add('hostPerson', PickPersonDynamicType::class, [ + 'label' => 'Person', + ]); + } + + if ('thirdparty' === $options['kind']) { + $builder + ->add('hostThirdParty', PickThirdpartyDynamicType::class, [ + 'label' => 'Third party', + ]); + } + + if ('address' === $options['kind']) { + $builder + ->add('address', PickAddressType::class, [ + 'required' => false, + 'label' => 'Address', + 'use_valid_from' => false, + 'use_valid_to' => false, + ]); + } + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => ResidentialAddress::class, + 'kind' => null, + ]); + } +} diff --git a/src/Bundle/ChillMainBundle/Repository/ResidentialAddressRepository.php b/src/Bundle/ChillMainBundle/Repository/ResidentialAddressRepository.php new file mode 100644 index 000000000..05cdfdf6c --- /dev/null +++ b/src/Bundle/ChillMainBundle/Repository/ResidentialAddressRepository.php @@ -0,0 +1,59 @@ +createQueryBuilder('r') + ->andWhere('r.exampleField = :val') + ->setParameter('val', $value) + ->orderBy('r.id', 'ASC') + ->setMaxResults(10) + ->getQuery() + ->getResult() + ; + } + */ + + /* + public function findOneBySomeField($value): ?ResidentialAddress + { + return $this->createQueryBuilder('r') + ->andWhere('r.exampleField = :val') + ->setParameter('val', $value) + ->getQuery() + ->getOneOrNullResult() + ; + } + */ +} diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/badge.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/badge.scss index 4d213645e..bfd43064b 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/badge.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/badge.scss @@ -12,6 +12,7 @@ display: block; top: calc(50% - 7px); right: 10px; + line-height: 11px; } } @@ -62,14 +63,19 @@ ul.list-suggest { & span:hover { color: $chill-l-gray; } + .person-text { + span { + padding-left: 0px; + } + } } } &.remove-items { li { position: relative; - span { + & > span { display: block; - padding-right: .75rem; + padding-right: 1.75rem; @include remove_link; } } diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss index 1eb437a2a..a95c4b993 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss @@ -22,6 +22,7 @@ $chill-theme-buttons: ( "cancel": $gray-300, "choose": $gray-300, "notify": $gray-300, + "search": $gray-300, "unlink": $chill-red, "tpchild": $chill-pink, ); @@ -80,6 +81,7 @@ $chill-theme-buttons: ( &.btn-notify::before, &.btn-tpchild::before, &.btn-download::before, + &.btn-search::before, &.btn-cancel::before { font: normal normal normal 14px/1 ForkAwesome; margin-right: 0.5em; @@ -108,6 +110,7 @@ $chill-theme-buttons: ( &.btn-notify::before { content: "\f1d8"; } // fa-paper-plane &.btn-tpchild::before { content: "\f007"; } // fa-user &.btn-download::before { content: "\f019"; } // fa-download + &.btn-search::before { content: "\f002"; } // fa-search } diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/blur/index.js b/src/Bundle/ChillMainBundle/Resources/public/module/blur/index.js index 6e3b75f2b..1d66d25e6 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/blur/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/module/blur/index.js @@ -1,21 +1,19 @@ require('./blur.scss'); -var toggleBlur = function(e){ - - var btn = e.target; - - btn.previousElementSibling.classList.toggle("blur"); - btn.classList.toggle("fa-eye"); - btn.classList.toggle("fa-eye-slash"); - -} - -var infos = document.getElementsByClassName("confidential"); -for(var i=0; i < infos.length; i++){ - infos[i].insertAdjacentHTML('beforeend', ''); -} - -var toggles = document.getElementsByClassName("toggle"); -for(var i=0; i < toggles.length; i++){ - toggles[i].addEventListener("click", toggleBlur); -} \ No newline at end of file +document.querySelectorAll('.confidential').forEach(function (el) { + let i = document.createElement('i'); + const classes = ['fa', 'fa-eye', 'toggle']; + i.classList.add(...classes); + el.appendChild(i); + const toggleBlur = function(e) { + for (let child of el.children) { + if (!child.classList.contains('toggle')) { + child.classList.toggle('blur'); + } + } + i.classList.toggle('fa-eye'); + i.classList.toggle('fa-eye-slash'); + } + i.addEventListener('click', toggleBlur); + toggleBlur(); +}); diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js b/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js index 1fd6b34f7..4cc917502 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js @@ -19,6 +19,12 @@ function loadDynamicPicker(element) { input = element.querySelector('[data-input-uniqid="'+ el.dataset.uniqid +'"]'), picked = (isMultiple) ? (JSON.parse(input.value)) : ((input.value === '[]') ? (null) : ([JSON.parse(input.value)])); + if (!isMultiple) { + if (input.value === '[]'){ + input.value = null; + } + } + const app = createApp({ template: ' @@ -15,7 +14,6 @@ @@ -24,7 +22,6 @@ @@ -33,7 +30,6 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/EditPane.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/EditPane.vue index 486d28e73..5279880bc 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/EditPane.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/EditPane.vue @@ -17,12 +17,22 @@
    +
    + + +
    + :value="value" /> @@ -118,7 +128,8 @@ export default { emits: ['getCities', 'getReferenceAddresses'], data() { return { - value: false + value: false, + valueConfidential: false, } }, computed: { @@ -134,6 +145,14 @@ export default { addressMap() { return this.entity.addressMap; }, + isConfidential: { + set(value) { + this.entity.selected.confidential = value; + }, + get() { + return this.entity.selected.confidential; + } + }, isNoAddress: { set(value) { console.log('isNoAddress value', value); diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/i18n.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/i18n.js index 98f31cbd3..28670f56c 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/i18n.js +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/i18n.js @@ -18,6 +18,7 @@ const addressMessages = { other_address: 'Autre adresse', create_address: 'Adresse inconnue. Cliquez ici pour créer une nouvelle adresse', isNoAddress: 'Pas d\'adresse complète', + isConfidential: 'Adresse confidentielle', street: 'Nom de rue', streetNumber: 'Numéro', floor: 'Étage', diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/BadgeEntity.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/BadgeEntity.vue index 5dd770328..4e99b7fd3 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/BadgeEntity.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/BadgeEntity.vue @@ -24,6 +24,11 @@ {{ $t('user')}} + + {{ $t('household')}} + + + \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js index 297642c24..249cd7d41 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js @@ -151,6 +151,10 @@ const appMessages = { placeholder: "Choisir un métier", not_valid: "Sélectionnez un métier du référent" }, + startdate: { + change: "Modifier la date de début", + date: "Date de début", + }, // catch errors 'Error while updating AccompanyingPeriod Course.': "Erreur du serveur lors de la mise à jour du parcours d'accompagnement.", 'Error while retriving AccompanyingPeriod Course.': "Erreur du serveur lors du chargement du parcours d'accompagnement.", diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js index 1413aa9e6..1fdc65c5e 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js @@ -8,6 +8,7 @@ import { getAccompanyingCourse, import { patchPerson } from "ChillPersonAssets/vuejs/_api/OnTheFly"; import { patchThirdparty } from "ChillThirdPartyAssets/vuejs/_api/OnTheFly"; import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods'; +import { datetimeToISO, ISOToDate, ISOToDatetime } from 'ChillMainAssets/chill/js/date.js'; const debug = process.env.NODE_ENV !== 'production'; @@ -278,6 +279,10 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise]) if (scopeIds.includes(scope.id)) { state.scopesAtBackend = state.scopesAtBackend.filter(s => s.id !== scope.id); } + }, + updateStartDate(state, date) { + console.log('new state date', date) + state.accompanyingCourse.openingDate = date; } }, actions: { @@ -701,15 +706,30 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise]) throw error; }) }, + updateStartDate({commit}, payload) { + console.log('payload', payload) + const date = ISOToDate(payload); + const url = `/api/1.0/person/accompanying-course/${id}.json`; + const body = { type: "accompanying_period", openingDate: { datetime: datetimeToISO(date) }}; + console.log('body', body) + return makeFetch('PATCH', url, body) + .then((response) => { + commit('updateStartDate', response.openingDate); + }) + .catch((error) => { + commit('catchError', error); + throw error; + }) + }, async fetchReferrersSuggested({ state, commit}) { let users = await getReferrersSuggested(state.accompanyingCourse); commit('setReferrersSuggested', users); commit('setFilteredReferrersSuggested'); if ( - null === state.accompanyingCourse.user - && !state.accompanyingCourse.confidential - && !state.accompanyingCourse.step === 'DRAFT' - && users.length === 1 + null === state.accompanyingCourse.user + && !state.accompanyingCourse.confidential + && !state.accompanyingCourse.step === 'DRAFT' + && users.length === 1 ) { // set the user if unique commit('updateReferrer', users[0]); diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue index 74ed0467c..503a00c59 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue @@ -5,7 +5,7 @@
    -
    +

    {{ $t('pick_social_issue_linked_with_action') }}

    {{ si.text }} @@ -33,7 +33,7 @@
    -
    +

    {{ $t('pick_an_action') }}

    -
    +

    {{ $t('persons_involved') }}

    • - - +
      + + +
    -
    + +
    +
    + +
    + +
    -
    + +
    + +
    + +
    +
    -

    {{ $t('form_has_errors') }}

    @@ -111,7 +128,7 @@ import { mapState, mapActions, mapGetters } from 'vuex'; import VueMultiselect from 'vue-multiselect'; import { dateToISO, ISOToDate } from 'ChillMainAssets/chill/js/date.js'; -import PersonRenderBox from 'ChillPersonAssets/vuejs/_components/Entity/PersonRenderBox.vue'; +import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue'; const i18n = { messages: { @@ -133,7 +150,7 @@ export default { name: 'App', components: { VueMultiselect, - PersonRenderBox, + PersonText, }, methods: { submit() { diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue index e43608895..5237dc7e2 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue @@ -141,10 +141,12 @@
    • -
    @@ -281,6 +283,7 @@ import ThirdPartyRenderBox from 'ChillThirdPartyAssets/vuejs/_components/Entity/ import PickTemplate from 'ChillDocGeneratorAssets/vuejs/_components/PickTemplate.vue'; import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue'; import PickWorkflow from 'ChillMainAssets/vuejs/_components/EntityWorkflow/PickWorkflow.vue'; +import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue'; const i18n = { messages: { @@ -329,7 +332,8 @@ export default { ThirdPartyRenderBox, PickTemplate, PickWorkflow, - OnTheFly + OnTheFly, + PersonText, }, i18n, data() { 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 74271954f..57d9ee3aa 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue @@ -11,7 +11,7 @@
    • - {{ c.person.text }} +
    @@ -57,12 +57,14 @@ import { mapState, mapGetters } from 'vuex'; import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue'; import PersonRenderBox from 'ChillPersonAssets/vuejs/_components/Entity/PersonRenderBox.vue'; +import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue'; export default { name: 'Concerned', components: { AddPersons, PersonRenderBox, + PersonText, }, computed: { ...mapState([ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Household.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Household.vue index 493092d81..5a8fe9c8d 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Household.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Household.vue @@ -61,6 +61,16 @@
  • +
  • + + +
  • @@ -77,16 +87,30 @@ import { mapGetters, mapState } from 'vuex'; import HouseholdRenderBox from 'ChillPersonAssets/vuejs/_components/Entity/HouseholdRenderBox.vue'; import CurrentHousehold from './CurrentHousehold'; +import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons'; export default { name: 'Household', components: { + AddPersons, CurrentHousehold, HouseholdRenderBox, }, emits: ['readyToGo'], data() { return { + addPersons: { + key: 'household_find', + options: { + type: ['household'], + priority: null, + uniq: true, + button: { + size: 'btn-sm', + type: 'btn-search', + } + } + }, addAddress: { key: 'household_new', options: { @@ -166,6 +190,13 @@ export default { this.$store.dispatch('selectHousehold', h); this.$emit('readyToGo'); }, + pickHouseholdFound({selected, modal}) { + selected.forEach(function(item) { + this.selectHousehold(item.result); + }, this); + this.$refs.pickHousehold.resetSearch(); // to cast child method + modal.showModal = false; + }, removeHouseholdAddress() { this.$store.commit('removeHouseholdAddress'); }, diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Positioning.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Positioning.vue index 487fb230e..005d46122 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Positioning.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Positioning.vue @@ -6,12 +6,13 @@
    -

    {{ conc.person.text }}

    + +

    @@ -34,6 +39,7 @@ import SuggestionPerson from './TypePerson'; import SuggestionThirdParty from './TypeThirdParty'; import SuggestionUser from './TypeUser'; +import SuggestionHousehold from './TypeHousehold'; export default { name: 'PersonSuggestion', @@ -41,6 +47,7 @@ export default { SuggestionPerson, SuggestionThirdParty, SuggestionUser, + SuggestionHousehold, }, props: [ 'item', @@ -70,7 +77,7 @@ export default { }; -