From 951160982d27a06a8f72d1fc1f22f7454cd6780d Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 17 Jun 2021 10:43:57 +0200 Subject: [PATCH 01/44] person: add more fields on Person + migration --- .../ChillPersonBundle/Entity/Person.php | 169 ++++++++++++++++-- .../Form/Type/GenderType.php | 3 +- .../migrations/Version20210617073504.php | 49 +++++ .../translations/messages.fr.yml | 2 + 4 files changed, 210 insertions(+), 13 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/migrations/Version20210617073504.php diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index 0ec04bf35..f44cb1c30 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -25,11 +25,13 @@ namespace Chill\PersonBundle\Entity; use ArrayIterator; use Chill\MainBundle\Entity\Center; use Chill\MainBundle\Entity\Country; +use Chill\MainBundle\Entity\Language; use Chill\PersonBundle\Entity\Household\Household; use Chill\PersonBundle\Entity\MaritalStatus; use Chill\PersonBundle\Entity\Household\HouseholdMember; use Chill\MainBundle\Entity\HasCenterInterface; use Chill\MainBundle\Entity\Address; +use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable; use DateTime; use Doctrine\ORM\Mapping as ORM; use Doctrine\Common\Collections\Collection; @@ -99,6 +101,14 @@ class Person implements HasCenterInterface */ private $birthdate; //to change in birthdate + /** + * The person's deathdate + * @var \DateTime + * + * @ORM\Column(type="date", nullable=true) + */ + private $deathdate; + /** * The person's place of birth * @var string @@ -142,6 +152,14 @@ class Person implements HasCenterInterface const MALE_GENDER = 'man'; const FEMALE_GENDER = 'woman'; const BOTH_GENDER = 'both'; + const NO_INFORMATION = 'unknown'; + + /** + * Comment on gender + * @var CommentEmbeddable + * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="genderComment_") + */ + private $genderComment; /** * The marital status of the person @@ -152,6 +170,21 @@ class Person implements HasCenterInterface */ private $maritalStatus; + /** + * The date of the last marital status change of the person + * @var \DateTime + * + * @ORM\Column(type="date", nullable=true) + */ + private $maritalStatusDate; + + /** + * Comment on marital status + * @var CommentEmbeddable + * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="maritalStatusComment_") + */ + private $maritalStatusComment; + /** * Contact information for contacting the person * @var string @@ -239,6 +272,31 @@ class Person implements HasCenterInterface */ private $memo = ''; // TO-CHANGE in remark + + /** + * Accept short text message (aka SMS) + * @var boolean + * + * @ORM\Column(type="boolean", options={"default" : false}) + */ + private $acceptSMS; + + /** + * Accept receiving email + * @var boolean + * + * @ORM\Column(type="boolean", options={"default" : false}) + */ + private $acceptEmail; + + /** + * Number of children + * @var int + * + * @ORM\Column(type="integer", options={"default" : 0}) + */ + private $numberOfChildren; + /** * @var boolean * @deprecated @@ -306,8 +364,10 @@ class Person implements HasCenterInterface } $this->open(new AccompanyingPeriod($opening)); + $this->genderComment = new CommentEmbeddable(); + $this->maritalStatusComment = new CommentEmbeddable(); } - + /** * This private function scan accompanyingPeriodParticipations Collection, * searching for a given AccompanyingPeriod @@ -319,10 +379,10 @@ class Person implements HasCenterInterface if ($accompanyingPeriod === $participation->getAccompanyingPeriod()) { return $participation; }} - + return null; } - + /** * This public function is the same but return only true or false */ @@ -330,7 +390,7 @@ class Person implements HasCenterInterface { return ($this->participationsContainAccompanyingPeriod($accompanyingPeriod)) ? false : true; } - + /** * Add AccompanyingPeriodParticipation * @@ -340,7 +400,7 @@ class Person implements HasCenterInterface { $participation = new AccompanyingPeriodParticipation($accompanyingPeriod, $this); $this->accompanyingPeriodParticipations->add($participation); - + return $this; } @@ -350,7 +410,7 @@ class Person implements HasCenterInterface public function removeAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod) : void { $participation = $this->participationsContainAccompanyingPeriod($accompanyingPeriod); - + if (! null === $participation) { $participation->setEndDate(\DateTimeImmutable::class); $this->accompanyingPeriodParticipations->removeElement($participation); @@ -428,7 +488,7 @@ class Person implements HasCenterInterface } return $accompanyingPeriods; } - + /** * Get AccompanyingPeriodParticipations Collection */ @@ -437,7 +497,7 @@ class Person implements HasCenterInterface return $this->accompanyingPeriodParticipations; } - /** + /** * Return a collection of participation, where the participation * is still opened, not a draft, and the period is still opened */ @@ -455,9 +515,9 @@ class Person implements HasCenterInterface ->filter(function (AccompanyingPeriodParticipation $app) { $period = $app->getAccompanyingPeriod(); return ( - NULL === $period->getClosingDate() + NULL === $period->getClosingDate() || new \DateTime('now') < $period->getClosingDate() - ) + ) && AccompanyingPeriod::STEP_DRAFT !== $period->getStep(); }); } @@ -1185,12 +1245,12 @@ class Person implements HasCenterInterface return true; } - + public function getFullnameCanonical() : string { return $this->fullnameCanonical; } - + public function setFullnameCanonical($fullnameCanonical) : Person { $this->fullnameCanonical = $fullnameCanonical; @@ -1247,4 +1307,89 @@ class Person implements HasCenterInterface { return NULL !== $this->getCurrentHousehold($at); } + + public function getGenderComment(): CommentEmbeddable + { + return $this->genderComment; + } + + public function setGenderComment(CommentEmbeddable $genderComment): self + { + $this->genderComment = $genderComment; + + return $this; + } + + public function getMaritalStatusComment(): CommentEmbeddable + { + return $this->maritalStatusComment; + } + + public function setMaritalStatusComment(CommentEmbeddable $maritalStatusComment): self + { + $this->maritalStatusComment = $maritalStatusComment; + + return $this; + } + + public function getDeathdate(): ?\DateTimeInterface + { + return $this->deathdate; + } + + public function setDeathdate(?\DateTimeInterface $deathdate): self + { + $this->deathdate = $deathdate; + + return $this; + } + + public function getMaritalStatusDate(): ?\DateTimeInterface + { + return $this->maritalStatusDate; + } + + public function setMaritalStatusDate(?\DateTimeInterface $maritalStatusDate): self + { + $this->maritalStatusDate = $maritalStatusDate; + + return $this; + } + + public function getAcceptSMS(): ?bool + { + return $this->acceptSMS; + } + + public function setAcceptSMS(bool $acceptSMS): self + { + $this->acceptSMS = $acceptSMS; + + return $this; + } + + public function getAcceptEmail(): ?bool + { + return $this->acceptEmail; + } + + public function setAcceptEmail(bool $acceptEmail): self + { + $this->acceptEmail = $acceptEmail; + + return $this; + } + + public function getNumberOfChildren(): ?int + { + return $this->numberOfChildren; + } + + public function setNumberOfChildren(int $numberOfChildren): self + { + $this->numberOfChildren = $numberOfChildren; + + return $this; + } + } diff --git a/src/Bundle/ChillPersonBundle/Form/Type/GenderType.php b/src/Bundle/ChillPersonBundle/Form/Type/GenderType.php index bdd31e899..232c838bb 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/GenderType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/GenderType.php @@ -24,7 +24,8 @@ class GenderType extends AbstractType { $a = array( Person::MALE_GENDER => Person::MALE_GENDER, Person::FEMALE_GENDER => Person::FEMALE_GENDER, - Person::BOTH_GENDER => Person::BOTH_GENDER + Person::BOTH_GENDER => Person::BOTH_GENDER, + Person::NO_INFORMATION => Person::NO_INFORMATION ); $resolver->setDefaults(array( diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20210617073504.php b/src/Bundle/ChillPersonBundle/migrations/Version20210617073504.php new file mode 100644 index 000000000..3a936e287 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/migrations/Version20210617073504.php @@ -0,0 +1,49 @@ +addSql('ALTER TABLE chill_person_person ADD deathdate DATE DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_person_person ADD maritalStatusDate DATE DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_person_person ADD acceptSMS BOOLEAN DEFAULT false NOT NULL'); + $this->addSql('ALTER TABLE chill_person_person ADD acceptEmail BOOLEAN DEFAULT false NOT NULL'); + $this->addSql('ALTER TABLE chill_person_person ADD numberOfChildren INT DEFAULT 0 NOT NULL'); + $this->addSql('ALTER TABLE chill_person_person ADD genderComment_comment TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_person_person ADD genderComment_userId INT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_person_person ADD genderComment_date TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_person_person ADD maritalStatusComment_comment TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_person_person ADD maritalStatusComment_userId INT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_person_person ADD maritalStatusComment_date TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_person_person DROP deathdate'); + $this->addSql('ALTER TABLE chill_person_person DROP maritalStatusDate'); + $this->addSql('ALTER TABLE chill_person_person DROP acceptSMS'); + $this->addSql('ALTER TABLE chill_person_person DROP acceptEmail'); + $this->addSql('ALTER TABLE chill_person_person DROP numberOfChildren'); + $this->addSql('ALTER TABLE chill_person_person DROP genderComment_comment'); + $this->addSql('ALTER TABLE chill_person_person DROP genderComment_userId'); + $this->addSql('ALTER TABLE chill_person_person DROP genderComment_date'); + $this->addSql('ALTER TABLE chill_person_person DROP maritalStatusComment_comment'); + $this->addSql('ALTER TABLE chill_person_person DROP maritalStatusComment_userId'); + $this->addSql('ALTER TABLE chill_person_person DROP maritalStatusComment_date'); + } +} diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index df1ef996f..cd65950a0 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -56,6 +56,8 @@ Man: Homme Woman: Femme both: Indéterminé Both: Indéterminé +unknown: Aucune information +Unknown: Aucune information Divorced: Divorcé(e) Separated: Séparé(e) Widow: Veuf(ve) From 901ae47ce6062754bc2d94b43e5dfacd25c6e6bd Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 17 Jun 2021 11:12:40 +0200 Subject: [PATCH 02/44] person: correct migration + entity --- src/Bundle/ChillPersonBundle/Entity/Person.php | 2 +- .../ChillPersonBundle/migrations/Version20210617073504.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index f44cb1c30..f812739c4 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -293,7 +293,7 @@ class Person implements HasCenterInterface * Number of children * @var int * - * @ORM\Column(type="integer", options={"default" : 0}) + * @ORM\Column(type="integer", nullable=true) */ private $numberOfChildren; diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20210617073504.php b/src/Bundle/ChillPersonBundle/migrations/Version20210617073504.php index 3a936e287..f9e96697d 100644 --- a/src/Bundle/ChillPersonBundle/migrations/Version20210617073504.php +++ b/src/Bundle/ChillPersonBundle/migrations/Version20210617073504.php @@ -23,7 +23,7 @@ final class Version20210617073504 extends AbstractMigration $this->addSql('ALTER TABLE chill_person_person ADD maritalStatusDate DATE DEFAULT NULL'); $this->addSql('ALTER TABLE chill_person_person ADD acceptSMS BOOLEAN DEFAULT false NOT NULL'); $this->addSql('ALTER TABLE chill_person_person ADD acceptEmail BOOLEAN DEFAULT false NOT NULL'); - $this->addSql('ALTER TABLE chill_person_person ADD numberOfChildren INT DEFAULT 0 NOT NULL'); + $this->addSql('ALTER TABLE chill_person_person ADD numberOfChildren INT DEFAULT NULL'); $this->addSql('ALTER TABLE chill_person_person ADD genderComment_comment TEXT DEFAULT NULL'); $this->addSql('ALTER TABLE chill_person_person ADD genderComment_userId INT DEFAULT NULL'); $this->addSql('ALTER TABLE chill_person_person ADD genderComment_date TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL'); From 8406c30c8e9f7883a05f4dc7f5c7c38e5952b158 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 17 Jun 2021 12:27:47 +0200 Subject: [PATCH 03/44] person: Person FormType + edit twig --- .../ChillPersonBundle/Form/PersonType.php | 36 ++++++++++++++++--- .../Resources/views/Person/edit.html.twig | 9 +++++ .../translations/messages.fr.yml | 6 ++++ 3 files changed, 46 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Form/PersonType.php b/src/Bundle/ChillPersonBundle/Form/PersonType.php index 42c625baa..d576822a9 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonType.php @@ -34,9 +34,12 @@ use Chill\PersonBundle\Entity\PersonPhone; use Chill\PersonBundle\Form\Type\Select2MaritalStatusType; use Symfony\Component\Form\AbstractType; use Chill\MainBundle\Form\Type\ChillDateType; +use Chill\MainBundle\Form\Type\CommentType; use Symfony\Component\Form\Extension\Core\Type\EmailType; use Symfony\Component\Form\Extension\Core\Type\TelType; use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Form\Extension\Core\Type\IntegerType; +use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -82,8 +85,17 @@ class PersonType extends AbstractType ->add('birthdate', ChillDateType::class, [ 'required' => false, ]) + ->add('deathdate', ChillDateType::class, [ + 'required' => false, + ]) ->add('gender', GenderType::class, array( 'required' => true + )) + ->add('genderComment', CommentType::class, array( + 'required' => false + )) + ->add('numberOfChildren', IntegerType::class, array( + 'required' => false )); if ($this->configAltNamesHelper->hasAltNames()) { @@ -111,7 +123,12 @@ class PersonType extends AbstractType } if ($this->config['mobilenumber'] === 'visible') { - $builder->add('mobilenumber', TelType::class, array('required' => false)); + $builder + ->add('mobilenumber', TelType::class, array('required' => false)) + ->add('acceptSMS', CheckboxType::class, array( + 'value' => false, + 'required' => true //TODO required only if mobilenumber is filled + )); } $builder->add('otherPhoneNumbers', ChillCollectionType::class, [ @@ -130,7 +147,9 @@ class PersonType extends AbstractType ]); if ($this->config['email'] === 'visible') { - $builder->add('email', EmailType::class, array('required' => false)); + $builder + ->add('email', EmailType::class, array('required' => false)) + ->add('acceptEmail', CheckboxType::class, array('required' => false));//TODO visible only if email is filled } if ($this->config['country_of_birth'] === 'visible') { @@ -153,9 +172,16 @@ class PersonType extends AbstractType } if ($this->config['marital_status'] === 'visible'){ - $builder->add('maritalStatus', Select2MaritalStatusType::class, array( - 'required' => false - )); + $builder + ->add('maritalStatus', Select2MaritalStatusType::class, array( + 'required' => false + )) + ->add('maritalStatusDate', ChillDateType::class, array( + 'required' => false + )) + ->add('maritalStatusComment', CommentType::class, array( + 'required' => false + )); } if($options['cFGroup']) { diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig index a69253695..66e1cb6e6 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig @@ -43,6 +43,7 @@ {{ form_widget(form.altNames, { 'label': 'Alternative names'}) }} {% endif %} {{ form_row(form.gender, {'label' : 'Gender'}) }} + {{ form_row(form.genderComment, { 'label' : 'Comment on the gender'} ) }}
@@ -54,6 +55,9 @@ {%- if form.countryOfBirth is defined -%} {{ form_row(form.countryOfBirth, { 'label' : 'Country of birth' } ) }} {%- endif -%} + {%- if form.deathdate is defined -%} + {{ form_row(form.deathdate, { 'label' : 'Date of death' } ) }} + {%- endif -%}
{%- if form.nationality is defined or form.spokenLanguages is defined or form.maritalStatus is defined -%} @@ -65,8 +69,11 @@ {%- if form.spokenLanguages is defined -%} {{ form_row(form.spokenLanguages, {'label' : 'Spoken languages'}) }} {%- endif -%} + {{ form_row(form.numberOfChildren, {'label' : 'Number of children'}) }} {%- if form.maritalStatus is defined -%} {{ form_row(form.maritalStatus, { 'label' : 'Marital status'} ) }} + {{ form_row(form.maritalStatusDate, { 'label' : 'Date of last marital status change'} ) }} + {{ form_row(form.maritalStatusComment, { 'label' : 'Comment on the marital status'} ) }} {%- endif -%} {%- endif -%} @@ -76,12 +83,14 @@

{{ 'Contact information'|trans }}

{%- if form.email is defined -%} {{ form_row(form.email, {'label': 'Email'}) }} + {{ form_row(form.acceptEmail, {'label' : 'Accept emails ?'}) }} {%- endif -%} {%- if form.phonenumber is defined -%} {{ form_row(form.phonenumber, {'label': 'Phonenumber'}) }} {%- endif -%} {%- if form.mobilenumber is defined -%} {{ form_row(form.mobilenumber, {'label': 'Mobilenumber'}) }} + {{ form_row(form.acceptSMS, {'label' : 'Accept short text message ?'}) }} {%- endif -%} {%- if form.otherPhoneNumbers is defined -%} {{ form_widget(form.otherPhoneNumbers) }} diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index cd65950a0..e6f33355c 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -10,6 +10,8 @@ First name or Last name: Prénom ou nom id: identifiant Birthdate: 'Date de naissance' birthdate: date de naissance +deathdate: date de décès +Date of death: Date de décès 'Date of birth': 'Date de naissance' dateOfBirth: date de naissance dateofbirth: date de naissance @@ -30,16 +32,20 @@ placeOfBirth: lieu de naissance countryOfBirth: 'Pays de naissance' 'Unknown country of birth': 'Pays inconnu' 'Marital status': 'État civil' +Date of last marital status change: État civil depuis le +Comment on the marital status: Commentaires sur l'état civil 'Number of children': 'Nombre d''enfants' '{0} No child|{1} One child | ]1,Inf] %nb% children': '{0} Aucun enfant|{1} Un enfant | ]1,Inf] %nb% enfants' 'National number': 'Numéro national' Email: 'Courrier électronique' +Accept emails ?: Accepte les courriels? Address: Adresse Memo: Mémo Phonenumber: 'Numéro de téléphone' phonenumber: numéro de téléphone Mobilenumber: 'Numéro de téléphone portable' mobilenumber: numéro de téléphone portable +Accept short text message ?: Accepte les SMS? Other phonenumber: Autre numéro de téléphone Description: description Add new phone: Ajouter un numéro de téléphone From a7131653c9047381f7fb27c72a19b2e2c1a38808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 17 Jun 2021 22:47:33 +0200 Subject: [PATCH 04/44] finish merge (oups) + layout of household in members editor app --- .../public/vuejs/_components/ShowAddress.vue | 4 +- .../vuejs/HouseholdMembersEditor/App.vue | 21 ++-- .../components/Household.vue | 13 +- .../vuejs/HouseholdMembersEditor/js/i18n.js | 4 +- .../HouseholdMembersEditor/store/index.js | 68 +++++++--- .../vuejs/_components/Household/Household.vue | 117 ++++++++++++++++++ 6 files changed, 194 insertions(+), 33 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Household/Household.vue diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/ShowAddress.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/ShowAddress.vue index c991b7763..d76f7a056 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/ShowAddress.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/ShowAddress.vue @@ -1,4 +1,5 @@ From 9d58356b90c5ff33ddafada9dfe72cf205e18609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 17 Jun 2021 22:54:46 +0200 Subject: [PATCH 05/44] remove drag-and-drop behaviour --- .../components/Concerned.vue | 44 +++---------------- .../vuejs/HouseholdMembersEditor/js/i18n.js | 1 + 2 files changed, 7 insertions(+), 38 deletions(-) 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 b2842de00..cacd71fd2 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue @@ -21,13 +21,10 @@
-
@@ -89,21 +86,18 @@ v-for="position in positions" >

{{ position.label.fr }}

-
+ +
-
- {{ $t('household_members_editor.drop_persons_here', {'position': position.label.fr }) }} -
+
+ +
+

{{ $t('household_members_editor.concerned.no_person_in_position') }}

@@ -120,22 +114,6 @@ div.person { } } -.drag-icon { - height: 1.1em; - margin-right: 0.5em; -} - -.droppable_zone { - background-color: var(--chill-llight-gray); - color: white; - font-size: large; - text-align: center; - display: table-cell; - vertical-align: middle; - padding: 1em; - background: linear-gradient(to top, var(--chill-light-gray), 30%, var(--chill-llight-gray)); -} - .move_to { .move_hint { text-align: center; @@ -194,18 +172,8 @@ export default { this.$refs.addPersons.resetSearch(); // to cast child method modal.showModal = false; }, - onStartDragConcern(evt, person_id) { - evt.dataTransfer.dropEffect = 'move' - evt.dataTransfer.effectAllowed = 'move' - evt.dataTransfer.setData('application/x.person', person_id) - }, - onDropConcern(evt, position_id) { - const person_id = Number(evt.dataTransfer.getData('application/x.person')); - this.moveToPosition(person_id, position_id); - }, moveToPosition(person_id, position_id) { this.$store.dispatch('markPosition', { person_id, position_id }); - }, removeConcerned(conc) { this.$store.dispatch('removeConcerned', conc); diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/js/i18n.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/js/i18n.js index 6e2f395c7..a058a976a 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/js/i18n.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/js/i18n.js @@ -19,6 +19,7 @@ const appMessages = { move_to: "Déplacer vers", persons_to_positionnate: 'Usagers à positionner', persons_leaving: "Usagers quittant leurs ménages", + no_person_in_position: "Aucun usager ne sera ajouté à cette position", }, drop_persons_here: "Glissez-déposez ici les usagers pour la position \"{position}\"", all_positionnated: "Tous les usagers sont positionnés", From f1120af59e3c166108c6bb83f0baa75cd92823c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 17 Jun 2021 23:10:18 +0200 Subject: [PATCH 06/44] add 'holder' in list of persons --- .../vuejs/_components/Household/Household.vue | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Household/Household.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Household/Household.vue index df421a8e8..def7e6971 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Household/Household.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Household/Household.vue @@ -11,11 +11,14 @@
-
+
{{ $t('current_members') }}: - @@ -35,6 +56,11 @@ export default { components: { VueMultiselect, }, + methods: { + submit() { + this.$store.dispatch('submit'); + } + }, computed: { ...mapState([ 'socialIssues', @@ -43,6 +69,7 @@ export default { ...mapGetters([ 'hasSocialIssuePicked', 'hasSocialActionPicked', + 'isLoadingSocialActions', ]), socialIssuePicked: { get() { diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/store.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/store.js index a60074698..1ecb12192 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/store.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/store.js @@ -16,6 +16,7 @@ const store = createStore({ socialActionPicked: null, startDate: new Date(), endDate: null, + isLoadingSocialActions: false, }, getters: { hasSocialActionPicked(state) { @@ -26,6 +27,9 @@ const store = createStore({ console.log(state.socialIssuePicked); return null !== state.socialIssuePicked; }, + isLoadingSocialActions(state) { + return state.isLoadingSocialActions; + }, }, mutations: { setSocialActionsReachables(state, actions) { @@ -43,12 +47,16 @@ const store = createStore({ state.socialIssuePicked = state.socialIssues .find(e => e.id === socialIssueId); }, + setIsLoadingSocialActions(state, s) { + state.isLoadingSocialActions = s; + } }, actions: { pickSocialIssue({ commit }, payload) { console.log('pick social issue'); console.log(payload); + commit('setIsLoadingSocialActions', true); findSocialActionsBySocialIssue(payload).then( (response) => { @@ -56,12 +64,19 @@ const store = createStore({ console.log(response.results); commit('setSocialIssue', payload); commit('setSocialActionsReachables', response.results); + commit('setIsLoadingSocialActions', false); }) .catch(err => { console.error(err); }); - } + }, + submit({ commit, getters }) { + console.log('submit'); + + + }, }, + }); export { store }; From 40fcb090822c53be0fde41c9e4a516daf5cdff65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 21 Jun 2021 13:38:43 +0200 Subject: [PATCH 20/44] layout for form --- .../CRUD/Controller/ApiController.php | 14 +- .../Resources/public/js/date.js | 11 +- .../AccompanyingCourseApiController.php | 15 ++ .../ChillPersonExtension.php | 13 ++ .../Entity/AccompanyingPeriod.php | 36 +++++ .../AccompanyingPeriodWork.php | 108 ++++++++++--- .../Entity/SocialWork/SocialAction.php | 6 + .../AccompanyingCourseWorkCreate/App.vue | 152 +++++++++++++----- .../AccompanyingCourseWorkCreate/store.js | 93 +++++++++-- .../vuejs/_api/AccompanyingCourseWork.js | 30 ++++ .../vuejs/_api/SocialWorkSocialAction.js | 2 +- .../AccompanyingCourseWork/create.html.twig | 7 +- .../Normalizer/SocialActionNormalizer.php | 2 + .../ChillPersonBundle/chill.api.specs.yaml | 49 ++++++ .../migrations/Version20210620143757.php | 51 ++++++ .../translations/messages.fr.yml | 5 + 16 files changed, 516 insertions(+), 78 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Resources/public/vuejs/_api/AccompanyingCourseWork.js create mode 100644 src/Bundle/ChillPersonBundle/migrations/Version20210620143757.php diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php index 9686a7b98..cab0bcdcb 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php @@ -359,9 +359,10 @@ class ApiController extends AbstractCRUDController * 6. validate the base entity (not the deserialized one). Groups are fetched from getValidationGroups, validation is perform by `validate` * 7. run onAfterValidation * 8. if errors, return a 422 response with errors - * 9. flush the data - * 10. run onAfterFlush - * 11. return a 202 response for DELETE with empty body, or HTTP 200 for post with serialized posted entity + * 9. if $forcePersist === true, persist the entity + * 10. flush the data + * 11. run onAfterFlush + * 12. return a 202 response for DELETE with empty body, or HTTP 200 for post with serialized posted entity * * @param string action * @param mixed id @@ -370,11 +371,12 @@ class ApiController extends AbstractCRUDController * @param string $property the name of the property. This will be used to make a `add+$property` and `remove+$property` method * @param string $postedDataType the type of the posted data (the content) * @param string $postedDataContext a context to deserialize posted data (the content) + * @param bool $forcePersist force to persist the created element (only for POST request) * @throw BadRequestException if unable to deserialize the posted data * @throw BadRequestException if the method is not POST or DELETE * */ - protected function addRemoveSomething(string $action, $id, Request $request, string $_format, string $property, string $postedDataType, $postedDataContext = []): Response + protected function addRemoveSomething(string $action, $id, Request $request, string $_format, string $property, string $postedDataType, array $postedDataContext = [], bool $forcePersist = false): Response { $entity = $this->getEntity($action, $id, $request); @@ -429,6 +431,10 @@ class ApiController extends AbstractCRUDController return $this->json($errors, 422); } + if ($forcePersist && $request->getMethod() === Request::METHOD_POST) { + $this->getDoctrine()->getManager()->persist($postedData); + } + $this->getDoctrine()->getManager()->flush(); diff --git a/src/Bundle/ChillMainBundle/Resources/public/js/date.js b/src/Bundle/ChillMainBundle/Resources/public/js/date.js index a11bc15bf..e49a05972 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/js/date.js +++ b/src/Bundle/ChillMainBundle/Resources/public/js/date.js @@ -11,9 +11,12 @@ * * Do not take time into account * - * **Experimental** */ const dateToISO = (date) => { + if (null === date) { + return null; + } + return [ date.getFullYear(), (date.getMonth() + 1).toString().padStart(2, '0'), @@ -36,10 +39,12 @@ const ISOToDate = (str) => { /** * Return a date object from iso string formatted as YYYY-mm-dd:HH:MM:ss+01:00 * - * **Experimental** */ const ISOToDatetime = (str) => { - console.log(str); + if (null === str) { + return null; + } + let [cal, times] = str.split('T'), [year, month, date] = cal.split('-'), diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php index 860cdfad7..8201752af 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php @@ -6,6 +6,7 @@ use Chill\MainBundle\CRUD\Controller\ApiController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Chill\PersonBundle\Entity\AccompanyingPeriod; +use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork; use Symfony\Component\HttpFoundation\Exception\BadRequestException; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; @@ -116,6 +117,20 @@ $workflow = $this->registry->get($accompanyingPeriod); return $this->addRemoveSomething('socialissue', $id, $request, $_format, 'socialIssue', SocialIssue::class, [ 'groups' => [ 'read' ] ]); } + public function workApi($id, Request $request, string $_format): Response + { + return $this->addRemoveSomething( + 'work', + $id, + $request, + $_format, + 'work', + AccompanyingPeriodWork::class, + [ 'groups' => [ 'accompanying_period_work:create' ] ], + true // force persist + ); + } + public function requestorApi($id, Request $request, string $_format): Response { /** @var AccompanyingPeriod $accompanyingPeriod */ diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index d810530ad..79dae3255 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -438,6 +438,19 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac Request::METHOD_DELETE=> \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE ] ], + 'work' => [ + 'methods' => [ + Request::METHOD_POST => true, + Request::METHOD_DELETE => false, + Request::METHOD_GET => false, + Request::METHOD_HEAD => false, + ], + 'controller_action' => 'workApi', + 'roles' => [ + Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE, + Request::METHOD_DELETE => 'ALWAYS_FAILS', + ] + ], 'confirm' => [ 'methods' => [ diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index 84f0c264b..47bb3c953 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -25,6 +25,7 @@ namespace Chill\PersonBundle\Entity; use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface; use Chill\MainBundle\Doctrine\Model\TrackCreationInterface; use Chill\MainBundle\Entity\Scope; +use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork; use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive; use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment; use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin; @@ -39,6 +40,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; use Chill\MainBundle\Entity\User; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\DiscriminatorMap; +use Symfony\Component\Validator\Constraints as Assert; /** * AccompanyingPeriod Class @@ -280,6 +282,15 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface */ private \DateTimeInterface $updatedAt; + /** + * @ORM\OneToMany( + * targetEntity=AccompanyingPeriodWork::class, + * mappedBy="accompanyingPeriod" + * ) + * @Assert\Valid(traverse=true) + */ + private Collection $works; + /** * AccompanyingPeriod constructor. * @@ -292,6 +303,7 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface $this->scopes = new ArrayCollection(); $this->socialIssues = new ArrayCollection(); $this->comments = new ArrayCollection(); + $this->works = new ArrayCollection(); } /** @@ -896,4 +908,28 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface return $this; } + + /** + * @return AccompanyingPeriodWork[] + */ + public function getWorks(): Collection + { + return $this->works; + } + + public function addWork(AccompanyingPeriodWork $work): self + { + $this->works[] = $work; + $work->setAccompanyingPeriod($this); + + return $this; + } + + public function removeWork(AccompanyingPeriodWork $work): self + { + $this->work->removeElement($work); + $work->setAccompanyingPeriod(null); + + return $this; + } } diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php index 25fbcc342..11570945e 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php @@ -7,86 +7,123 @@ use Chill\PersonBundle\Entity\SocialWork\SocialAction; use Chill\MainBundle\Entity\User; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\ThirdPartyBundle\Entity\ThirdParty; +use DateTimeInterface; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Serializer\Annotation as Serializer; +use Chill\MainBundle\Doctrine\Model\TrackCreationInterface; +use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface; +use Symfony\Component\Validator\Constraints as Assert; /** * @ORM\Entity * @ORM\Table(name="chill_person_accompanying_period_work") + * @Serializer\DiscriminatorMap( + * typeProperty="type", + * mapping={ + * "accompanying_period_work":AccompanyingPeriodWork::class + * } + * ) */ - class AccompanyingPeriodWork + class AccompanyingPeriodWork implements TrackCreationInterface, TrackUpdateInterface { /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") + * @Serializer\Groups({"read"}) */ - private $id; + private ?int $id; /** * @ORM\Column(type="text") + * @Serializer\Groups({"read"}) */ - private $note; + private string $note = ""; /** * @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class) + * @Serializer\Groups({"read"}) */ - private $accompanyingPeriod; + private ?AccompanyingPeriod $accompanyingPeriod = null; /** * @ORM\ManyToOne(targetEntity=SocialAction::class) + * @Serializer\Groups({"accompanying_period_work:create", "read"}) */ - private $socialAction; + private ?SocialAction $socialAction = null; /** - * @ORM\Column(type="datetime") + * @ORM\Column(type="datetime_immutable") + * @Serializer\Groups({"read"}) */ - private $createdAt; + private ?\DateTimeImmutable $createdAt = null; /** * @ORM\ManyToOne(targetEntity=User::class) * @ORM\JoinColumn(nullable=false) + * @Serializer\Groups({"read"}) */ - private $createdBy; + private ?User $createdBy = null; /** - * @ORM\Column(type="datetime") + * @ORM\Column(type="datetime_immutable") + * @Serializer\Groups({"read"}) */ - private $startDate; + private ?\DateTimeImmutable $updatedAt = null; /** - * @ORM\Column(type="datetime") + * @ORM\ManyToOne(targetEntity=User::class) + * @ORM\JoinColumn(nullable=false) + * @Serializer\Groups({"read"}) */ - private $endDate; + private ?User $updatedBy = null; + + /** + * @ORM\Column(type="date_immutable") + * @Serializer\Groups({"accompanying_period_work:create"}) + * @Serializer\Groups({"read"}) + */ + private \DateTimeImmutable $startDate; + + /** + * @ORM\Column(type="date_immutable", nullable=true, options={"default":null}) + * @Serializer\Groups({"accompanying_period_work:create", "read"}) + * @Assert\GreaterThan(propertyPath="startDate", + * message="accompanying_course_work.The endDate should be greater than the start date" + * ) + */ + private ?\DateTimeImmutable $endDate = null; /** * @ORM\ManyToOne(targetEntity=ThirdParty::class) + * @Serializer\Groups({"read"}) * * In schema : traitant */ - private $handlingThierParty; + private ?ThirdParty $handlingThierParty = null; /** * @ORM\Column(type="boolean") */ - private $createdAutomatically; + private bool $createdAutomatically = false; /** * @ORM\Column(type="text") */ - private $createdAutomaticallyReason; + private string $createdAutomaticallyReason = ""; /** * @ORM\OneToMany(targetEntity=AccompanyingPeriodWorkGoal::class, mappedBy="accompanyingPeriodWork") */ - private $goals; + private Collection $goals; /** * @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorks") * @ORM\JoinTable(name="chill_person_accompanying_period_work_result") */ - private $results; + private Collection $results; /** * @ORM\ManyToMany(targetEntity=ThirdParty::class) @@ -94,7 +131,7 @@ use Doctrine\ORM\Mapping as ORM; * * In schema : intervenants */ - private $thirdParties; + private Collection $thirdParties; public function __construct() { @@ -125,8 +162,17 @@ use Doctrine\ORM\Mapping as ORM; return $this->accompanyingPeriod; } + /** + * Internal: you should use `$accompanyingPeriod->removeWork($work);` or + * `$accompanyingPeriod->addWork($work);` + */ public function setAccompanyingPeriod(?AccompanyingPeriod $accompanyingPeriod): self { + if ($this->accompanyingPeriod instanceof AccompanyingPeriod && + $accompanyingPeriod !== $this->accompanyingPeriod) { + throw new \LogicException("A work cannot change accompanyingPeriod"); + } + $this->accompanyingPeriod = $accompanyingPeriod; return $this; @@ -144,7 +190,7 @@ use Doctrine\ORM\Mapping as ORM; return $this; } - public function getCreatedAt(): ?\DateTimeInterface + public function getCreatedAt(): ?\DateTimeImmutable { return $this->createdAt; } @@ -168,6 +214,30 @@ use Doctrine\ORM\Mapping as ORM; return $this; } + public function setUpdatedBy(User $user): TrackUpdateInterface + { + $this->updatedBy = $user; + + return $this; + } + + public function setUpdatedAt(DateTimeInterface $datetime): TrackUpdateInterface + { + $this->updatedAt = $datetime; + + return $this; + } + + public function getUpdatedAt(): ?\DateTimeImmutable + { + return $this->updatedAt; + } + + public function getUpdatedBy(): ?User + { + return $this->updatedBy; + } + public function getStartDate(): ?\DateTimeInterface { return $this->startDate; diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php index 6e104abcb..35abe392f 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php @@ -10,6 +10,12 @@ use Symfony\Component\Serializer\Annotation as Serializer; /** * @ORM\Entity * @ORM\Table(name="chill_person_social_action") + * @Serializer\DiscriminatorMap( + * typeProperty="type", + * mapping={ + * "social_work_social_action":SocialAction::class + * } + * ) */ class SocialAction { diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue index 3a3971d73..3c1f4b07a 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue @@ -1,55 +1,125 @@ + diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/index.js new file mode 100644 index 000000000..0ef2d0de4 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/index.js @@ -0,0 +1,15 @@ +import { createApp } from 'vue'; +import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n'; +import { store } from './store'; +import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n' +import App from './App.vue'; + +const i18n = _createI18n(personMessages); + +const app = createApp({ + template: ``, +}) +.use(store) +.use(i18n) +.component('app', App) +.mount('#accompanying_course_work_edit'); diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js new file mode 100644 index 000000000..f72badc91 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js @@ -0,0 +1,139 @@ +import { createStore } from 'vuex'; +import { datetimeToISO, ISOToDatetime } from 'ChillMainAssets/js/date.js'; +import { findSocialActionsBySocialIssue } from 'ChillPersonAssets/vuejs/_api/SocialWorkSocialAction.js'; +import { create } from 'ChillPersonAssets/vuejs/_api/AccompanyingCourseWork.js'; + +const debug = process.env.NODE_ENV !== 'production'; + +console.log(window.accompanyingCourseWork); + +const store = createStore({ + strict: debug, + state: { + work: window.accompanyingCourseWork, + startDate: ISOToDatetime(window.accompanyingCourseWork.startDate.datetime), + endDate: (window.accompanyingCourseWork.endDate !== null ? + ISOToDatetime(window.accompanyingCourseWork.endDate.datetime) : null), + note: window.accompanyingCourseWork.note, + goalsPicked: window.accompanyingCourseWork.goals, + resultsPicked: window.accompanyingCourseWork.results, + resultsForAction: [], + goalsForAction: [], + resultsForGoal: [], + errors: [], + }, + getters: { + socialAction(state) { + return state.work.socialAction; + }, + }, + mutations: { + setStartDate(state, date) { + state.startDate = date; + }, + setEndDate(state, date) { + state.endDate = date; + }, + setResultsForAction(state, results) { + console.log('set results for action', results); + state.resultsForAction = results; + }, + setResultsForGoal(state, { goal, results }) { + console.log('set results for goal', results); + state.goalsForAction = goal; + for (let i in results) { + let r = results[i]; + r.goalId = goal.id; + console.log('adding result', r); + state.resultsForGoal.push(r); + } + }, + addErrors(state, errors) { + console.log('handling errors', errors); + for (let i in errors) { + state.push(errors[i]); + } + }, + setNote(state, note) { + state.note = note; + }, + }, + actions: { + getReachablesGoalsForAction({ getters, commit, dispatch }) { + console.log('getReachablesGoalsForAction'); + let + socialActionId = getters.socialAction.id, + url = `/api/1.0/person/social-work/goal/by-social-action/${socialActionId}.json` + ; + + console.log(url); + + window + .fetch( + url + ).then( response => { + if (response.ok) { + return response.json(); + } + throw { m: 'Error while retriving goal for social action', s: response.status, b: response.body }; + }).then( data => { + for (let i in data.results) { + dispatch('getReachablesResultsForGoal', data.results[i]); + } + }).catch( errors => { + commit('addErrors', errors); + }); + }, + getReachablesResultsForGoal({ commit }, goal) { + console.log('getReachablesResultsForGoal'); + let + url = `/api/1.0/person/social-work/result/by-goal/${goal.id}.json` + ; + + console.log(url); + + window.fetch(url) + .then(response => { + if (response.ok) { + return response.json(); + } + + throw { m: 'Error while retriving results for goal', s: response.status, b: response.body }; + }) + .then(data => { + console.log('data'); + commit('setResultsForGoal', { goal, results: data.results }); + }); + }, + getReachablesResultsForAction({ getters, commit }) { + console.log('getReachablesResultsForAction'); + let + socialActionId = getters.socialAction.id, + url = `/api/1.0/person/social-work/result/by-social-action/${socialActionId}.json` + ; + + console.log(url); + + window.fetch(url) + .then(response => { + if (response.ok) { + return response.json(); + } + + throw { m: 'Error while retriving results for social action', s: response.status, b: response.body }; + }) + .then(data => { + console.log('data retrived', data); + commit('setResultsForAction', data.results); + }); + }, + initAsync({ dispatch }) { + dispatch('getReachablesResultsForAction'); + dispatch('getReachablesGoalsForAction'); + }, + } +}); + +store.dispatch('initAsync'); + +export { store }; diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/edit.html.twig new file mode 100644 index 000000000..e9fdbd3ce --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/edit.html.twig @@ -0,0 +1,24 @@ +{% extends '@ChillPerson/AccompanyingCourse/layout.html.twig' %} + +{% block title 'accompanying_course_work.Edit accompanying course work'|trans %} + + +{% block content %} +

{{ block('title') }}

+ +
+ +{% endblock %} + +{% block js %} + + + {{ encore_entry_script_tags('accompanying_course_work_edit') }} +{% endblock %} + +{% block css %} + {{ parent() }} + {{ encore_entry_link_tags('accompanying_course_work_edit') }} +{% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/list_by_accompanying_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/list_by_accompanying_period.html.twig new file mode 100644 index 000000000..86a7c5401 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/list_by_accompanying_period.html.twig @@ -0,0 +1,28 @@ +{% extends '@ChillPerson/AccompanyingCourse/layout.html.twig' %} + +{% block title 'accompanying_course_work.List accompanying course work'|trans %} + + +{% block content %} +

{{ block('title') }}

+ + + + + +{% endblock %} diff --git a/src/Bundle/ChillPersonBundle/chill.webpack.config.js b/src/Bundle/ChillPersonBundle/chill.webpack.config.js index b20aa004e..bc1bf0679 100644 --- a/src/Bundle/ChillPersonBundle/chill.webpack.config.js +++ b/src/Bundle/ChillPersonBundle/chill.webpack.config.js @@ -14,4 +14,5 @@ module.exports = function(encore, entries) encore.addEntry('vue_accourse', __dirname + '/Resources/public/vuejs/AccompanyingCourse/index.js'); encore.addEntry('household_edit_metadata', __dirname + '/Resources/public/modules/household_edit_metadata/index.js'); encore.addEntry('accompanying_course_work_create', __dirname + '/Resources/public/vuejs/AccompanyingCourseWorkCreate/index.js'); + encore.addEntry('accompanying_course_work_edit', __dirname + '/Resources/public/vuejs/AccompanyingCourseWorkEdit/index.js'); }; From 154fa4719d7a3bbcb9428da4f09d706e841b272f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 23 Jun 2021 17:46:51 +0200 Subject: [PATCH 28/44] add involved persons to accompanying period work --- .../AccompanyingPeriodWork.php | 33 +++++++++++++++++ .../AccompanyingCourseWorkCreate/App.vue | 37 ++++++++++++++++++- .../AccompanyingCourseWorkCreate/store.js | 33 ++++++++++++++--- .../migrations/Version20210623135043.php | 34 +++++++++++++++++ 4 files changed, 131 insertions(+), 6 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/migrations/Version20210623135043.php diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php index b42242a5b..5fd01acf3 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php @@ -4,6 +4,7 @@ namespace Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\SocialWork\Result; use Chill\PersonBundle\Entity\SocialWork\SocialAction; +use Chill\PersonBundle\Entity\Person; use Chill\MainBundle\Entity\User; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\ThirdPartyBundle\Entity\ThirdParty; @@ -148,11 +149,22 @@ use Symfony\Component\Validator\Constraints as Assert; */ private Collection $thirdParties; + /** + * + * @ORM\ManyToMany(targetEntity=Person::class) + * @ORM\JoinTable(name="chill_person_accompanying_period_work_person") + * @Serializer\Groups({"read"}) + * @Serializer\Groups({"accompanying_period_work:edit"}) + * @Serializer\Groups({"accompanying_period_work:create"}) + */ + private Collection $persons; + public function __construct() { $this->goals = new ArrayCollection(); $this->results = new ArrayCollection(); $this->thirdParties = new ArrayCollection(); + $this->persons = new ArrayCollection(); } public function getId(): ?int @@ -390,4 +402,25 @@ use Symfony\Component\Validator\Constraints as Assert; return $this; } + + public function getPersons(): Collection + { + return $this->persons; + } + + public function addPerson(Person $person): self + { + if (!$this->persons->contains($person)) { + $this->persons[] = $person; + } + + return $this; + } + + public function removePerson(Person $person): self + { + $this->persons->removeElement($person); + + return $this; + } } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue index 7e8f2d5f0..96edce825 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue @@ -28,8 +28,19 @@

spinner

-
+
+

{{ $t('persons_involved') }}

+ +
    +
  • + + +
  • +
+
+ +

@@ -85,6 +96,14 @@ #picking { grid-area: picking; + + #persons { + ul { + padding: 0; + + list-style-type: none; + } + } } #start_date { @@ -105,6 +124,7 @@ import { mapState, mapActions, mapGetters } from 'vuex'; import VueMultiselect from 'vue-multiselect'; import { dateToISO, ISOToDate } from 'ChillMainAssets/js/date.js'; +import Person from 'ChillPersonAssets/vuejs/_components/Person/Person.vue'; const i18n = { messages: { @@ -115,6 +135,7 @@ const i18n = { pick_social_issue: "Choisir une problématique sociale", pick_an_action: "Choisir une action d'accompagnement", pick_social_issue_linked_with_action: "Indiquez la problématique sociale liée à l'action d'accompagnement", + persons_involved: "Usagers concernés", } } @@ -124,6 +145,7 @@ export default { name: 'App', components: { VueMultiselect, + Person, }, methods: { submit() { @@ -136,6 +158,7 @@ export default { 'socialIssues', 'socialActionsReachables', 'errors', + 'personsReachables', ]), ...mapGetters([ 'hasSocialIssuePicked', @@ -144,6 +167,18 @@ export default { 'isPostingWork', 'hasErrors', ]), + personsPicked: { + get() { + let s = this.$store.state.personsPicked.map(p => p.id); + console.log('persons picked', s); + + return s; + }, + set(v) { + console.log('persons picked', v); + this.$store.commit('setPersonsPickedIds', v); + } + }, socialIssuePicked: { get() { let s = this.$store.state.socialIssuePicked; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/store.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/store.js index 8f0aed245..5efe3a6e9 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/store.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/store.js @@ -14,6 +14,10 @@ const store = createStore({ socialIssuePicked: null, socialActionsReachables: [], socialActionPicked: null, + personsPicked: window.accompanyingCourse.participations.filter(p => p.endDate == null) + .map(p => p.person), + personsReachables: window.accompanyingCourse.participations.filter(p => p.endDate == null) + .map(p => p.person), startDate: new Date(), endDate: null, isLoadingSocialActions: false, @@ -44,9 +48,17 @@ const store = createStore({ }, startDate: { datetime: datetimeToISO(state.startDate) - } + }, + persons: [] }; + for (let i in state.personsPicked) { + payload.persons.push({ + id: state.personsPicked[i].id, + type: 'person' + }); + } + if (null !== state.endDate) { payload.endDate = { datetime: datetimeToISO(state.endDate) @@ -71,12 +83,16 @@ const store = createStore({ state.socialActionPicked = socialAction; }, setSocialIssue(state, socialIssueId) { + console.log('set social issue', socialIssueId); if (socialIssueId === null) { state.socialIssuePicked = null; - return; + } else { + let mapped = state.socialIssues + .find(e => e.id === socialIssueId); + console.log('mapped', mapped); + state.socialIssuePicked = mapped; + console.log('social issue setted', state.socialIssuePicked); } - state.socialIssuePicked = state.socialIssues - .find(e => e.id === socialIssueId); }, setIsLoadingSocialActions(state, s) { state.isLoadingSocialActions = s; @@ -90,6 +106,11 @@ const store = createStore({ setEndDate(state, date) { state.endDate = date; }, + setPersonsPickedIds(state, ids) { + console.log('persons ids', ids); + state.personsPicked = state.personsReachables + .filter(p => ids.includes(p.id)) + }, addErrors(state, { errors, cancel_posting }) { console.log('add errors', errors); state.errors = errors; @@ -103,8 +124,10 @@ const store = createStore({ console.log('pick social issue'); commit('setIsLoadingSocialActions', true); - commit('setSocialIssue', null); + commit('setSocialAction', null); commit('setSocialActionsReachables', []); + commit('setSocialIssue', null); + findSocialActionsBySocialIssue(socialIssueId).then( (response) => { diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20210623135043.php b/src/Bundle/ChillPersonBundle/migrations/Version20210623135043.php new file mode 100644 index 000000000..d7f2f4ccc --- /dev/null +++ b/src/Bundle/ChillPersonBundle/migrations/Version20210623135043.php @@ -0,0 +1,34 @@ +addSql("CREATE TABLE chill_person_accompanying_period_work_person (accompanyingperiodwork_id INT NOT NULL, person_id INT NOT NULL, PRIMARY KEY(accompanyingperiodwork_id, person_id))"); + $this->addSql("CREATE INDEX IDX_615F494CB99F6060 ON chill_person_accompanying_period_work_person (accompanyingperiodwork_id)"); + $this->addSql("CREATE INDEX IDX_615F494C217BBB47 ON chill_person_accompanying_period_work_person (person_id)"); + $this->addSql("ALTER TABLE chill_person_accompanying_period_work_person ADD CONSTRAINT FK_615F494CB99F6060 FOREIGN KEY (accompanyingperiodwork_id) REFERENCES chill_person_accompanying_period_work (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE"); + $this->addSql("ALTER TABLE chill_person_accompanying_period_work_person ADD CONSTRAINT FK_615F494C217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE"); + + } + + public function down(Schema $schema): void + { + $this->addSql("DROP TABLE chill_person_accompanying_period_work_person"); + } +} From 5a4a0a3617794d0635e51298a5f15c3e1eaff7af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 23 Jun 2021 21:26:36 +0200 Subject: [PATCH 29/44] add results for actions in course edit form --- .../vuejs/AccompanyingCourseWorkEdit/App.vue | 73 ++++++++++++++++-- .../_components/AddResult.vue | 76 +++++++++++++++++++ .../vuejs/AccompanyingCourseWorkEdit/store.js | 9 +++ 3 files changed, 151 insertions(+), 7 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/_components/AddResult.vue diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue index f46c36d03..3ef3b3390 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue @@ -2,30 +2,41 @@

Hello

-
+

{{ work.socialAction.text }}

-
+
-
+
-
+
-
+

Objectifs

Résultats

+ + + +
+
+ {{ $t('results_without_objective') }} +
+
+ +
+
@@ -33,20 +44,64 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js index f72badc91..0e9e30897 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js @@ -26,6 +26,9 @@ const store = createStore({ socialAction(state) { return state.work.socialAction; }, + hasResultsForAction(state) { + return state.resultsForAction.length > 0; + } }, mutations: { setStartDate(state, date) { @@ -48,6 +51,12 @@ const store = createStore({ state.resultsForGoal.push(r); } }, + addResultPicked(state, result) { + state.resultsPicked.push(result); + }, + removeResultPicked(state, result) { + state.resultsPicked = state.resultsPicked.filter(r => r.id !== result.id); + }, addErrors(state, errors) { console.log('handling errors', errors); for (let i in errors) { From ac4cf43753c0e36d851d736bd16194cfc2e50916 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 23 Jun 2021 22:40:11 +0200 Subject: [PATCH 30/44] add goals to work, and add results for each goal --- .../vuejs/AccompanyingCourseWorkEdit/App.vue | 57 ++++++++++++++++++- .../_components/AddResult.vue | 40 ++++++++++++- .../vuejs/AccompanyingCourseWorkEdit/store.js | 39 ++++++++++++- 3 files changed, 130 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue index 3ef3b3390..feee033e4 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue @@ -27,8 +27,7 @@

Résultats

- - +
{{ $t('results_without_objective') }} @@ -37,6 +36,38 @@
+ + +
+
+ + + {{ g.title.fr }} + +
+
+ +
+
+ + +
+
+
+
    +
  • + + {{ g.title.fr }} +
  • +
+
+
+ + {{ $t('add_objective') }} +
+
+
+
@@ -106,12 +137,14 @@ export default { data() { return { editor: ClassicEditor, + showAddObjective: false, }; }, computed: { ...mapState([ 'work', 'resultsForAction', + 'goalsPicked', ]), ...mapGetters([ 'hasResultsForAction', @@ -142,6 +175,26 @@ export default { this.$store.mutate('setNote', note); } }, + availableForCheckGoal() { + let pickedIds = this.$store.state.goalsPicked.map(g => g.id); + console.log('pickeds goals id', pickedIds); + console.log(this.$store.state.goalsForAction); + + return this.$store.state.goalsForAction.filter(g => !pickedIds.includes(g.id)); + }, + }, + methods: { + toggleAddObjective() { + this.showAddObjective = !this.showAddObjective; + }, + addGoal(g) { + console.log('add Goal', g); + this.$store.commit('addGoal', g); + }, + removeGoal(g) { + console.log('remove goal', g); + this.$store.commit('removeGoal', g); + }, } }; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/_components/AddResult.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/_components/AddResult.vue index ed86724d2..d56a287a8 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/_components/AddResult.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/_components/AddResult.vue @@ -1,5 +1,5 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/list_by_accompanying_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/list_by_accompanying_period.html.twig index 86a7c5401..ec5279759 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/list_by_accompanying_period.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/list_by_accompanying_period.html.twig @@ -6,15 +6,78 @@ {% block content %}

{{ block('title') }}

- +
+ {% for w in works %} +
+
+

{{ 'accompanying_course_work.action'|trans }}

+

+ {{ w.socialAction|chill_entity_render_box({ 'no-badge': true }) }} +

+
+ +
+
    +
  • + {{ 'accompanying_course_work.create_date'|trans }} +
  • +
+
+ + {% if w.results|length > 0 %} +
+
+ {{ 'accompanying_course_work.results without objective'|trans }} +
+
+

{{ 'accompanying_course_work.goal'|trans }}

+
    + {% for r in w.results %} +
  • {{ r.title|localize_translatable_string }}
  • + {% endfor %} +
+
+
+ {% endif %} + + {% if w.goals|length > 0 %} +
+ {% for g in w.goals %} +
+

{{ 'accompanying_course_work.goal'|trans }}

+

{{ g.goal.title|localize_translatable_string }}

+
+
+ {% if g.results|length == 0 %} +

{{ 'accompanying_course_work.no_results'|trans }}

+ {% else %} +

{{ 'accompanying_course_work.result'|trans }}

+
    + {% for r in g.results %} +
  • {{ r.title|localize_translatable_string }}
  • + {% endfor %} +
+ {% endif %} +
+ {% endfor %} +
+ {% endif %} + + + +
+ {% else %} +

{{ 'accompanying_course_work.No work'|trans }}

+ {% endfor %} +
  • @@ -26,3 +89,9 @@
{% endblock %} + + +{% block css %} + {{ parent() }} + {{ encore_entry_link_tags('accompanying_course_work_list') }} +{% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Entity/social_action.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Entity/social_action.html.twig index 246ddd1ea..858643e95 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Entity/social_action.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Entity/social_action.html.twig @@ -1,6 +1,6 @@ {% set reversed_parents = parents|reverse %}
-
    -
  • - {{ 'accompanying_course_work.create_date'|trans }} +
      +
    • +
      + {{ w.createdAt|format_date('long') }} +
      +
      + {{ 'accompanying_course_work.create_date'|trans }} +
      +
    • +
    • +
      + {{ w.startDate|format_date('long') }} +
      +
      + {{ 'accompanying_course_work.start_date'|trans }} +
      +
    • +
    • +
      + {{ w.endDate|format_date('long') }} +
      +
      + {{ 'accompanying_course_work.end_date'|trans }} +
{% if w.results|length > 0 %} -
+
- {{ 'accompanying_course_work.results without objective'|trans }} +

{{ 'accompanying_course_work.goal'|trans }}

+

{{ 'accompanying_course_work.results without objective'|trans }}

-

{{ 'accompanying_course_work.goal'|trans }}

-
    +

    {{ 'accompanying_course_work.results'|trans }}

    +
      {% for r in w.results %} -
    • {{ r.title|localize_translatable_string }}
    • +
    • {{ r.title|localize_translatable_string }}
    • {% endfor %}
@@ -41,35 +63,40 @@ {% endif %} {% if w.goals|length > 0 %} -
- {% for g in w.goals %} -
+ {% for g in w.goals %} +
+

{{ 'accompanying_course_work.goal'|trans }}

-

{{ g.goal.title|localize_translatable_string }}

+

{{ g.goal.title|localize_translatable_string }}

-
+
{% if g.results|length == 0 %} +

{{ 'accompanying_course_work.results'|trans }}

{{ 'accompanying_course_work.no_results'|trans }}

{% else %} -

{{ 'accompanying_course_work.result'|trans }}

-
    +

    {{ 'accompanying_course_work.results'|trans }}

    +
      {% for r in g.results %} -
    • {{ r.title|localize_translatable_string }}
    • +
    • {{ r.title|localize_translatable_string }}
    • {% endfor %}
    {% endif %}
- {% endfor %} -
+
+ {% endfor %} {% endif %} +
+ {{ 'Last updated by'|trans}}: {{ w.updatedBy|chill_entity_render_box }}, {{ w.updatedAt|format_datetime('long', 'short') }} +
+ diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index d34bd76b7..8397c3fa7 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -339,7 +339,9 @@ accompanying_course_work: action: Action create_date: Date de création start_date: Date de début - results without objective: Résultats - orientation sans objectifs - motifs - dispositifs - no_result: Aucun résultat - orientation - result: Résultat - orientation - goal: Objectifs - motifs - dispositifs + end_date: Date de fin + results without objective: Aucun objectif - motif - dispositif + no_results: Aucun résultat - orientation + results: Résultats - orientations + goal: Objectif - motif - dispositif + From 25f2d170974cbf6839cba20e5d52d871bd48f679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 25 Jun 2021 21:34:36 +0200 Subject: [PATCH 44/44] documentation for api social actions --- .../ChillPersonBundle/chill.api.specs.yaml | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/chill.api.specs.yaml b/src/Bundle/ChillPersonBundle/chill.api.specs.yaml index 0b02127d9..6c7f1ef62 100644 --- a/src/Bundle/ChillPersonBundle/chill.api.specs.yaml +++ b/src/Bundle/ChillPersonBundle/chill.api.specs.yaml @@ -1144,6 +1144,65 @@ paths: description: "Unprocessable entity (validation errors)" 400: description: "Bad Request" + + /1.0/person/social/social-action.json: + get: + tags: + - accompanying-course-work + summary: get a list of social action + responses: + 401: + description: "Unauthorized" + 200: + description: "OK" + + /1.0/person/social/social-action/{id}.json: + get: + tags: + - accompanying-course-work + parameters: + - name: id + in: path + required: true + description: The social action's id + schema: + type: integer + format: integer + minimum: 1 + responses: + 401: + description: "Unauthorized" + 404: + description: "Not found" + 200: + description: "OK" + 400: + description: "Bad Request" + + + /1.0/person/social/social-action/by-social-issue/{id}.json: + get: + tags: + - accompanying-course-work + parameters: + - name: id + in: path + required: true + description: The social action's id + schema: + type: integer + format: integer + minimum: 1 + responses: + 401: + description: "Unauthorized" + 404: + description: "Not found" + 200: + description: "OK" + 400: + description: "Bad Request" + /1.0/person/social-work/result.json: get: