From 349db2142defe9cc6845e8ca7e7244997740da37 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 3 Mar 2022 14:39:00 +0100 Subject: [PATCH 01/10] person: add url field to SocialWork Evaluation entity + populate with http title values --- .../Entity/SocialWork/Evaluation.php | 18 +++++++++ .../migrations/Version20220303113855.php | 38 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/migrations/Version20220303113855.php diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php index 1350ae6d8..9349c335e 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php @@ -62,6 +62,12 @@ class Evaluation */ private array $title = []; + /** + * @ORM\Column(type="text", nullable=true) + * @Serializer\Groups({"read", "docgen:read"}) + */ + private ?string $url = null; + public function __construct() { $this->socialActions = new ArrayCollection(); @@ -101,6 +107,11 @@ class Evaluation return $this->title; } + public function getUrl(): ?string + { + return $this->url; + } + public function removeSocialAction(SocialAction $socialAction): self { if ($this->socialActions->contains($socialAction)) { @@ -130,4 +141,11 @@ class Evaluation return $this; } + + public function setUrl(?string $url): self + { + $this->url = $url; + + return $this; + } } diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20220303113855.php b/src/Bundle/ChillPersonBundle/migrations/Version20220303113855.php new file mode 100644 index 000000000..9991d2eca --- /dev/null +++ b/src/Bundle/ChillPersonBundle/migrations/Version20220303113855.php @@ -0,0 +1,38 @@ +addSql('ALTER TABLE chill_person_social_work_evaluation ADD url TEXT DEFAULT NULL'); + $this->addSql("UPDATE chill_person_social_work_evaluation SET url = CASE WHEN title->>'fr' LIKE 'http%' THEN title->>'fr' ELSE null END;"); + } + + public function down(Schema $schema): void + { + + $this->addSql('ALTER TABLE chill_person_social_work_evaluation DROP url'); + } +} From 568a1d95f46544fff7040710359b5fd7ea91a634 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 3 Mar 2022 15:10:05 +0100 Subject: [PATCH 02/10] AccompanyingCourseWorkEdit: add url to vuejs form --- .../components/AddEvaluation.vue | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue index 579d0b306..d2b8c5b46 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue @@ -5,6 +5,11 @@ {{ evaluation.evaluation.title.fr }} + +
@@ -128,4 +133,11 @@ export default { } } } + div.item-url { + i { + color: unset!important; + margin-left: 1rem; + margin-right: 0.5rem; + } + } From a88e052eb64f06c4195f9a3b20f319ac291505d3 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 3 Mar 2022 15:12:47 +0100 Subject: [PATCH 03/10] upd CHANGELOG --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bd743078..7de2c188a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ and this project adheres to ## Unreleased +* [person] Add url in accompanying period work evaluations entity and form (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/476) + + * [parcours] Toggle emergency/intensity only by referrer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/442) * [docstore] Add an API entrypoint for StoredObject (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/466) * [person] Add the possibility of uploading existing documents to AccPeriodWorkEvaluationDocument (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/466) From c5eac09478e1b9bed3369182ce351f64420a0366 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 3 Mar 2022 15:17:05 +0100 Subject: [PATCH 04/10] php cs fix on migration --- .../migrations/Version20220303113855.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20220303113855.php b/src/Bundle/ChillPersonBundle/migrations/Version20220303113855.php index 9991d2eca..7840cdfce 100644 --- a/src/Bundle/ChillPersonBundle/migrations/Version20220303113855.php +++ b/src/Bundle/ChillPersonBundle/migrations/Version20220303113855.php @@ -15,10 +15,15 @@ use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; /** - * Add url to SocialWork Evaluation + * Add url to SocialWork Evaluation. */ final class Version20220303113855 extends AbstractMigration { + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_person_social_work_evaluation DROP url'); + } + public function getDescription(): string { return 'Add url to SocialWork Evaluation'; @@ -29,10 +34,4 @@ final class Version20220303113855 extends AbstractMigration $this->addSql('ALTER TABLE chill_person_social_work_evaluation ADD url TEXT DEFAULT NULL'); $this->addSql("UPDATE chill_person_social_work_evaluation SET url = CASE WHEN title->>'fr' LIKE 'http%' THEN title->>'fr' ELSE null END;"); } - - public function down(Schema $schema): void - { - - $this->addSql('ALTER TABLE chill_person_social_work_evaluation DROP url'); - } } From 187c9d82b6cd499bc56547ab8f061042d71b4656 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 3 Mar 2022 16:37:58 +0100 Subject: [PATCH 05/10] assign User to undsipatched acc period: filter users by job type --- .../public/mod/AccompanyingPeriod/setReferrer.js | 13 ++++++------- .../_components/AccompanyingPeriod/SetReferrer.vue | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/mod/AccompanyingPeriod/setReferrer.js b/src/Bundle/ChillPersonBundle/Resources/public/mod/AccompanyingPeriod/setReferrer.js index b73c0afea..939075380 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/mod/AccompanyingPeriod/setReferrer.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/mod/AccompanyingPeriod/setReferrer.js @@ -19,22 +19,21 @@ import {fetchResults} from 'ChillMainAssets/lib/api/apiMethods.js'; */ document.querySelectorAll('[data-set-referrer-app]').forEach(function (el) { - let - periodId = Number.parseInt(el.dataset.setReferrerAccompanyingPeriodId); - + const periodId = Number.parseInt(el.dataset.setReferrerAccompanyingPeriodId); + const jobId = Number.parseInt(el.dataset.setReferrerJobId); const url = `/api/1.0/person/accompanying-course/${periodId}/referrers-suggested.json`; fetchResults(url).then(suggested => { - + const filteredSuggested = suggested.filter((s) => s.user_job ? s.user_job.id === jobId : false); const app = createApp({ components: { SetReferrer, }, template: - '', + '', data() { return { - periodId, suggested, original: suggested, + periodId, filteredSuggested, original: filteredSuggested, } }, methods: { @@ -56,7 +55,7 @@ document.querySelectorAll('[data-set-referrer-app]').forEach(function (el) { label.textContent = ref.text; label.classList.remove('chill-no-data-statement'); - this.suggested = this.original.filter(user => user.id !== ref.id); + this.filteredSuggested = this.original.filter(user => user.id !== ref.id); } } }); diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriod/SetReferrer.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriod/SetReferrer.vue index 3d3675c73..38418f305 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriod/SetReferrer.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriod/SetReferrer.vue @@ -1,12 +1,12 @@