From 741043c1775cc9cd85d8e19e5d46282c35f22531 Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 24 Jan 2022 10:05:47 +0100 Subject: [PATCH 01/51] address: alter some address field to TEXT + add confidential field --- src/Bundle/ChillMainBundle/Entity/Address.php | 29 ++++++++++-- .../migrations/Version20220124085957.php | 44 +++++++++++++++++++ 2 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/migrations/Version20220124085957.php diff --git a/src/Bundle/ChillMainBundle/Entity/Address.php b/src/Bundle/ChillMainBundle/Entity/Address.php index 070d40468..3a35abb94 100644 --- a/src/Bundle/ChillMainBundle/Entity/Address.php +++ b/src/Bundle/ChillMainBundle/Entity/Address.php @@ -42,10 +42,18 @@ class Address */ private $buildingName; + /** + * @var bool + * + * @ORM\Column(type="boolean") + * @Groups({"write"}) + */ + private $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 +86,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 +94,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 +151,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 +200,7 @@ class Address return (new Address()) ->setAddressReference($original->getAddressReference()) ->setBuildingName($original->getBuildingName()) + ->setConfidential($original->getConfidential()) ->setCorridor($original->getCorridor()) ->setCustoms($original->getCustoms()) ->setDistribution($original->getDistribution()) @@ -234,6 +243,11 @@ class Address return $this->corridor; } + public function getConfidential(): bool + { + return $this->confidential; + } + /** * Get customs informations in the address. */ @@ -369,6 +383,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/migrations/Version20220124085957.php b/src/Bundle/ChillMainBundle/migrations/Version20220124085957.php new file mode 100644 index 000000000..d1b8d6739 --- /dev/null +++ b/src/Bundle/ChillMainBundle/migrations/Version20220124085957.php @@ -0,0 +1,44 @@ +addSql('ALTER TABLE chill_main_address ADD confidential BOOLEAN DEFAULT FALSE'); + $this->addSql('ALTER TABLE chill_main_address ALTER floor TYPE TEXT'); + $this->addSql('ALTER TABLE chill_main_address ALTER corridor TYPE TEXT'); + $this->addSql('ALTER TABLE chill_main_address ALTER steps TYPE TEXT'); + $this->addSql('ALTER TABLE chill_main_address ALTER flat TYPE TEXT'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_main_address DROP confidential'); + $this->addSql('ALTER TABLE chill_main_address ALTER corridor TYPE VARCHAR(16)'); + $this->addSql('ALTER TABLE chill_main_address ALTER flat TYPE VARCHAR(16)'); + $this->addSql('ALTER TABLE chill_main_address ALTER floor TYPE VARCHAR(16)'); + $this->addSql('ALTER TABLE chill_main_address ALTER steps TYPE VARCHAR(16)'); + } +} From 02d8ceba259d3cc320e338507d2634ba015c405f Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 24 Jan 2022 10:42:05 +0100 Subject: [PATCH 02/51] address: add confidential in normalizer + code style fix --- src/Bundle/ChillMainBundle/Entity/Address.php | 10 +++++----- .../Normalizer/AddressNormalizer.php | 2 ++ .../migrations/Version20220124085957.php | 20 +++++++++---------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Entity/Address.php b/src/Bundle/ChillMainBundle/Entity/Address.php index 3a35abb94..ef965f062 100644 --- a/src/Bundle/ChillMainBundle/Entity/Address.php +++ b/src/Bundle/ChillMainBundle/Entity/Address.php @@ -238,16 +238,16 @@ class Address return $this->buildingName; } - public function getCorridor(): ?string - { - return $this->corridor; - } - public function getConfidential(): bool { return $this->confidential; } + public function getCorridor(): ?string + { + return $this->corridor; + } + /** * Get customs informations in the address. */ diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php index 0b46127b6..10e889344 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php @@ -45,6 +45,7 @@ class AddressNormalizer implements ContextAwareNormalizerInterface, NormalizerAw 'extra', 'validFrom' => DateTimeInterface::class, 'validTo' => DateTimeInterface::class, + 'confidential', ]; private AddressRender $addressRender; @@ -83,6 +84,7 @@ class AddressNormalizer implements ContextAwareNormalizerInterface, NormalizerAw 'buildingName' => $address->getBuildingName(), 'distribution' => $address->getDistribution(), 'extra' => $address->getExtra(), + 'confidential' => $address->getConfidential(), 'lines' => $this->addressRender->renderLines($address), ]; diff --git a/src/Bundle/ChillMainBundle/migrations/Version20220124085957.php b/src/Bundle/ChillMainBundle/migrations/Version20220124085957.php index d1b8d6739..17b58825d 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20220124085957.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20220124085957.php @@ -15,10 +15,19 @@ use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; /** - * Alter some address fields + add confidential field on Address + * Alter some address fields + add confidential field on Address. */ final class Version20220124085957 extends AbstractMigration { + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_main_address DROP confidential'); + $this->addSql('ALTER TABLE chill_main_address ALTER corridor TYPE VARCHAR(16)'); + $this->addSql('ALTER TABLE chill_main_address ALTER flat TYPE VARCHAR(16)'); + $this->addSql('ALTER TABLE chill_main_address ALTER floor TYPE VARCHAR(16)'); + $this->addSql('ALTER TABLE chill_main_address ALTER steps TYPE VARCHAR(16)'); + } + public function getDescription(): string { return 'Alter some address fields + add confidential field on Address'; @@ -32,13 +41,4 @@ final class Version20220124085957 extends AbstractMigration $this->addSql('ALTER TABLE chill_main_address ALTER steps TYPE TEXT'); $this->addSql('ALTER TABLE chill_main_address ALTER flat TYPE TEXT'); } - - public function down(Schema $schema): void - { - $this->addSql('ALTER TABLE chill_main_address DROP confidential'); - $this->addSql('ALTER TABLE chill_main_address ALTER corridor TYPE VARCHAR(16)'); - $this->addSql('ALTER TABLE chill_main_address ALTER flat TYPE VARCHAR(16)'); - $this->addSql('ALTER TABLE chill_main_address ALTER floor TYPE VARCHAR(16)'); - $this->addSql('ALTER TABLE chill_main_address ALTER steps TYPE VARCHAR(16)'); - } } From b3edba3abe955bb000e8b7e74bb9b6ab9683ac30 Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 24 Jan 2022 11:04:17 +0100 Subject: [PATCH 03/51] address: add confidential in vuejs edit form --- .../vuejs/Address/components/AddAddress.vue | 2 ++ .../vuejs/Address/components/EditPane.vue | 23 +++++++++++++++++-- .../Resources/public/vuejs/Address/i18n.js | 1 + 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue index 1f62269de..2ca73b92c 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue @@ -562,6 +562,7 @@ export default { this.entity.loaded.cities = []; this.entity.loaded.countries = []; + this.entity.selected.confidential = this.context.edit ? this.entity.address.confidential : false; this.entity.selected.isNoAddress = (this.context.edit && this.entity.address.text === '') ? true : false; this.entity.selected.country = this.context.edit ? this.entity.address.country : {}; @@ -593,6 +594,7 @@ export default { { console.log('apply changes'); let newAddress = { + 'confidential': this.entity.selected.confidential, 'isNoAddress': this.entity.selected.isNoAddress, 'street': this.entity.selected.isNoAddress ? '' : this.entity.selected.address.street, 'streetNumber': this.entity.selected.isNoAddress ? '' : this.entity.selected.address.streetNumber, 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', From d087f051f0afd562752dd35c148e018dc36634d3 Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 24 Jan 2022 11:08:25 +0100 Subject: [PATCH 04/51] address: remove maxlenght constraint in vuejs form for corridor, flat, steps, floor --- .../vuejs/Address/components/AddAddress/AddressMore.vue | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMore.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMore.vue index 1216871ab..93a64ad19 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMore.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMore.vue @@ -6,7 +6,6 @@ @@ -15,7 +14,6 @@ @@ -24,7 +22,6 @@ @@ -33,7 +30,6 @@ From 6b78c06dfb1ab7b89a96a90b5987817623f4c8ee Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 24 Jan 2022 12:04:23 +0100 Subject: [PATCH 05/51] address: use address.confidential in AddressRenderBox.vue --- .../_components/Entity/AddressRenderBox.vue | 75 ++++++++++++++----- 1 file changed, 58 insertions(+), 17 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue index 8a069298a..385f7aa3d 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue @@ -1,26 +1,58 @@ @@ -147,13 +147,15 @@ import {dateToISO} from 'ChillMainAssets/chill/js/date.js'; import AddressRenderBox from 'ChillMainAssets/vuejs/_components/Entity/AddressRenderBox.vue'; import Confidential from 'ChillMainAssets/vuejs/_components/Confidential.vue'; import BadgeEntity from 'ChillMainAssets/vuejs/_components/BadgeEntity.vue'; +import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue'; export default { name: "PersonRenderBox", components: { AddressRenderBox, Confidential, - BadgeEntity + BadgeEntity, + PersonText }, props: ['person', 'options', 'render', 'returnPath'], computed: { @@ -168,7 +170,7 @@ export default { return this.person.gender === 'woman' ? 'fa-venus' : this.person.gender === 'man' ? 'fa-mars' : this.person.gender === 'neuter' ? 'fa-neuter' : 'fa-genderless'; }, getGenderTranslation: function() { - return this.person.gender === 'woman' ? 'renderbox.birthday.woman' : 'renderbox.birthday.man'; + return this.person.gender === 'woman' ? 'renderbox.birthday.woman' : 'renderbox.birthday.man'; }, getGender() { return this.person.gender === 'woman' ? 'person.gender.woman' : this.person.gender === 'man' ? 'person.gender.man' : this.person.gender === 'neuter' ? 'person.gender.neuter' : 'person.gender.undefined'; From 5b25f8296326667d79725ed3e9fd9c408bee24dc Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 27 Jan 2022 16:24:35 +0100 Subject: [PATCH 19/51] changelog updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b1e466b6..593fcf262 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to * [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] age added to renderstring + renderbox/ vue component created to display person text (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/389) ## Test releases From ad8d40cb1c9384f710d7ad618cc92b956dcb677a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 27 Jan 2022 16:52:41 +0100 Subject: [PATCH 20/51] work on confidential / blur module --- src/Bundle/ChillMainBundle/Entity/Address.php | 2 +- .../Resources/public/module/blur/index.js | 36 +++++++++---------- .../public/vuejs/_components/Confidential.vue | 24 +++++++------ .../Resources/views/Entity/address.html.twig | 6 ++-- .../views/AccompanyingCourse/index.html.twig | 4 +-- .../views/Entity/thirdparty.html.twig | 2 +- 6 files changed, 38 insertions(+), 36 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Entity/Address.php b/src/Bundle/ChillMainBundle/Entity/Address.php index ef965f062..b717b33eb 100644 --- a/src/Bundle/ChillMainBundle/Entity/Address.php +++ b/src/Bundle/ChillMainBundle/Entity/Address.php @@ -48,7 +48,7 @@ class Address * @ORM\Column(type="boolean") * @Groups({"write"}) */ - private $confidential = false; + private bool $confidential = false; /** * @var string|null 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/vuejs/_components/Confidential.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Confidential.vue index efdf62926..0a34c4123 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Confidential.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Confidential.vue @@ -1,22 +1,26 @@ -