From 88362bd284a1c77e8ab00b1a1b0d9625e8d7f386 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 25 Aug 2021 17:46:51 +0200 Subject: [PATCH 001/217] start of updating personrenderbox to display age. only one scenario done --- .../Resources/public/vuejs/_js/i18n.js | 3 ++- .../_components/Entity/PersonRenderBox.vue | 22 +++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js index 84db72236..9c28c9fdb 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js @@ -76,7 +76,8 @@ const messages = { birthday: { man: "Né le", woman: "Née le" - } , + }, + years_old: "ans", no_data: "Aucune information renseignée", type: { thirdparty: "Tiers", diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue index 464e2190e..0a8a8da9f 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue @@ -27,7 +27,7 @@ -

+

@@ -114,12 +114,14 @@ export default { return this.person.gender == 'woman' ? 'fa-venus' : this.person.gender == 'man' ? 'fa-mars' : 'fa-neuter'; }, birthdate: function(){ - var date = new Date(this.person.birthdate.datetime); + const date = new Date(this.person.birthdate.datetime); return dateToISO(date); }, deathdate: function(){ - var date = new Date(this.person.deathdate.datetime); + if(this.person.deathdate){ + const date = new Date(this.person.deathdate.datetime); return dateToISO(date); + } }, altNameLabel: function(){ for(let i = 0; i < this.person.altNames.length; i++){ @@ -131,6 +133,12 @@ export default { return this.person.altNames[i].key } }, + getAge: function(){ + if(this.person.birthdate && !this.person.deathdate){ + const birthday = new Date(this.person.birthdate.datetime) + const now = new Date() + return (now.getFullYear() - birthday.getFullYear()) + } } } @@ -153,6 +161,12 @@ div.flex-table { } } } + +.age{ + margin-left: 0.5em; + &:before { content: '('; } + &:after { content: ')'; } +} From 5194cad354ebb8873d66c362399a8e289f7d35cb Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 26 Aug 2021 14:53:04 +0200 Subject: [PATCH 002/217] Adaptations for display of age and deathdate (different scenarios not all finished) --- .../Resources/public/vuejs/_js/i18n.js | 1 + .../_components/Entity/PersonRenderBox.vue | 23 +++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js index 9c28c9fdb..593d76f7d 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js @@ -77,6 +77,7 @@ const messages = { man: "Né le", woman: "Née le" }, + deathdate: "Date de décès", years_old: "ans", no_data: "Aucune information renseignée", type: { diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue index 0a8a8da9f..f886a3d29 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue @@ -28,12 +28,16 @@

+ {{ person.deathdate }} -

@@ -100,7 +104,7 @@ export default { }, props: ['person', 'options'], computed: { - getGender: function() { + getGenderTranslation: function() { return this.person.gender == 'woman' ? 'renderbox.birthday.woman' : 'renderbox.birthday.man'; }, isMultiline: function() { @@ -138,6 +142,17 @@ export default { const birthday = new Date(this.person.birthdate.datetime) const now = new Date() return (now.getFullYear() - birthday.getFullYear()) + } else if(this.person.birthdate && this.person.deathdate){ + const birthday = new Date(this.person.birthdate.datetime) + const deathdate = new Date(this.person.deathdate.datetime) + return (deathdate.getFullYear() - birthday.getFullYear()) + } else if(!this.person.birthdate && this.person.deathdate.datetime) { + // todo: change this + return "Age unknown" + } else { + // todo: change this + return "Age unknown" + } } } } From c5f40c53ea258e8dd982ed43f87816ddb2e71993 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 26 Aug 2021 16:42:33 +0200 Subject: [PATCH 003/217] further adaptations to display deathdate. deathdate added to what API returns --- .../PersonsAssociated/ParticipationItem.vue | 2 +- .../_components/Entity/PersonRenderBox.vue | 9 +- .../Normalizer/PersonNormalizer.php | 2 + .../ChillPersonBundle/chill.api.specs.yaml | 138 ++++++++---------- 4 files changed, 72 insertions(+), 79 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue index 04c6b73a9..704f66be3 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue @@ -6,7 +6,7 @@ addEntity: false, addLink: false, addAltNames: true, - addAge : false, + addAge : true, hLevel : 3, }" :person="participation.person"> diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue index f886a3d29..82948a37a 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue @@ -28,7 +28,6 @@

- {{ person.deathdate }}

@@ -118,13 +117,15 @@ export default { return this.person.gender == 'woman' ? 'fa-venus' : this.person.gender == 'man' ? 'fa-mars' : 'fa-neuter'; }, birthdate: function(){ + if(this.person.birthdate){ const date = new Date(this.person.birthdate.datetime); - return dateToISO(date); + return dateToISO(date) + } }, deathdate: function(){ if(this.person.deathdate){ const date = new Date(this.person.deathdate.datetime); - return dateToISO(date); + return date.toLocaleDateString("fr-FR"); } }, altNameLabel: function(){ diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonNormalizer.php index cde495f52..3dabb43cb 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonNormalizer.php @@ -69,6 +69,7 @@ class PersonNormalizer implements 'firstName' => $person->getFirstName(), 'lastName' => $person->getLastName(), 'birthdate' => $this->normalizer->normalize($person->getBirthdate()), + 'deathdate' => $this->normalizer->normalize($person->getDeathdate()), 'center' => $this->normalizer->normalize($person->getCenter()), 'phonenumber' => $person->getPhonenumber(), 'mobilenumber' => $person->getMobilenumber(), @@ -125,6 +126,7 @@ class PersonNormalizer implements foreach ([ 'birthdate' => \DateTime::class, + 'deathdate' => \DateTime::class, 'center' => Center::class ] as $item => $class) { if (\array_key_exists($item, $data)) { diff --git a/src/Bundle/ChillPersonBundle/chill.api.specs.yaml b/src/Bundle/ChillPersonBundle/chill.api.specs.yaml index 1b2c9cd85..020fa409f 100644 --- a/src/Bundle/ChillPersonBundle/chill.api.specs.yaml +++ b/src/Bundle/ChillPersonBundle/chill.api.specs.yaml @@ -45,7 +45,7 @@ components: type: type: string enum: - - 'person' + - "person" firstName: type: string lastName: @@ -55,7 +55,9 @@ components: description: a canonical representation for the person name readOnly: true birthdate: - $ref: '#/components/schemas/Date' + $ref: "#/components/schemas/Date" + deathdate: + $ref: "#/components/schemas/Date" phonenumber: type: string mobilenumber: @@ -78,7 +80,7 @@ components: type: type: string enum: - - 'person' + - "person" required: - id - type @@ -96,7 +98,7 @@ components: type: type: string enum: - - 'thirdparty' + - "thirdparty" required: - id - type @@ -119,15 +121,15 @@ components: type: type: string enum: - - 'accompanying_period_resource' + - "accompanying_period_resource" readOnly: true id: type: integer readOnly: true resource: anyOf: - - $ref: '#/components/schemas/PersonById' - - $ref: '#/components/schemas/ThirdPartyById' + - $ref: "#/components/schemas/PersonById" + - $ref: "#/components/schemas/ThirdPartyById" ResourceById: type: object properties: @@ -136,7 +138,7 @@ components: type: type: string enum: - - 'accompanying_period_resource' + - "accompanying_period_resource" required: - id - type @@ -146,7 +148,7 @@ components: type: type: string enum: - - 'accompanying_period_comment' + - "accompanying_period_comment" readOnly: true id: type: integer @@ -161,7 +163,7 @@ components: type: type: string enum: - - 'accompanying_period_comment' + - "accompanying_period_comment" required: - id - type @@ -173,7 +175,7 @@ components: type: type: string enum: - - 'social_issue' + - "social_issue" parent_id: type: integer readOnly: true @@ -195,12 +197,12 @@ components: Household: type: object properties: - id: - type: integer - type: - type: string - enum: - - 'household' + id: + type: integer + type: + type: string + enum: + - "household" HouseholdPosition: type: object properties: @@ -209,7 +211,7 @@ components: type: type: string enum: - - 'household_position' + - "household_position" AccompanyingCourseWork: type: object properties: @@ -218,7 +220,7 @@ components: type: type: string enum: - - 'accompanying_period_work' + - "accompanying_period_work" note: type: string startDate: @@ -243,15 +245,15 @@ components: type: type: string enum: - - 'accompanying_period_work_goal' + - "accompanying_period_work_goal" note: type: string goal: - $ref: '#/components/schemas/SocialWorkGoalById' + $ref: "#/components/schemas/SocialWorkGoalById" results: type: array items: - $ref: '#/components/schemas/SocialWorkGoalById' + $ref: "#/components/schemas/SocialWorkGoalById" SocialWorkResultById: type: object @@ -261,7 +263,7 @@ components: type: type: string enum: - - 'social_work_result' + - "social_work_result" SocialWorkGoalById: type: object properties: @@ -270,7 +272,7 @@ components: type: type: string enum: - - 'social_work_goal' + - "social_work_goal" paths: /1.0/person/person/{id}.json: @@ -308,7 +310,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Person' + $ref: "#/components/schemas/Person" responses: 200: description: "OK" @@ -355,18 +357,17 @@ paths: 422: description: "Unprocessable entity (validation errors)" - /1.0/person/address/suggest/by-person/{id}.json: get: tags: - address summary: get a list of suggested address for a person description: > - The address are computed from various source. Currently: + The address are computed from various source. Currently: - - the address of course to which the person is participating + - the address of course to which the person is participating - The current person's address is always ignored. + The current person's address is always ignored. parameters: - name: id in: path @@ -390,11 +391,11 @@ paths: - address summary: get a list of suggested address for a household description: > - The address are computed from various source. Currently: + The address are computed from various source. Currently: - - the address of course to which the members is participating + - the address of course to which the members is participating - The current household address is always ignored. + The current household address is always ignored. parameters: - name: id in: path @@ -452,7 +453,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/AccompanyingPeriod' + $ref: "#/components/schemas/AccompanyingPeriod" examples: Set the requestor as anonymous: value: @@ -488,7 +489,7 @@ paths: id: 0 personLocation: null addressLocation: - id: 7960 + id: 7960 responses: 401: description: "Unauthorized" @@ -520,8 +521,8 @@ paths: application/json: schema: oneOf: - - $ref: '#/components/schemas/PersonById' - - $ref: '#/components/schemas/ThirdPartyById' + - $ref: "#/components/schemas/PersonById" + - $ref: "#/components/schemas/ThirdPartyById" examples: add person with id 50: summary: "a person with id 50" @@ -585,7 +586,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/PersonById' + $ref: "#/components/schemas/PersonById" responses: 401: description: "Unauthorized" @@ -614,7 +615,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/PersonById' + $ref: "#/components/schemas/PersonById" responses: 401: description: "Unauthorized" @@ -645,7 +646,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Resource' + $ref: "#/components/schemas/Resource" examples: add person with id 50: summary: "a person with id 50" @@ -690,7 +691,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ResourceById' + $ref: "#/components/schemas/ResourceById" responses: 401: description: "Unauthorized" @@ -721,7 +722,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Comment' + $ref: "#/components/schemas/Comment" examples: a single comment: summary: "a simple comment" @@ -759,7 +760,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/CommentById' + $ref: "#/components/schemas/CommentById" responses: 401: description: "Unauthorized" @@ -790,7 +791,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Scope' + $ref: "#/components/schemas/Scope" examples: add a scope: value: @@ -824,7 +825,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ScopeById' + $ref: "#/components/schemas/ScopeById" responses: 401: description: "Unauthorized" @@ -855,7 +856,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/SocialIssue' + $ref: "#/components/schemas/SocialIssue" examples: add a social issue: value: @@ -889,7 +890,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/SocialIssue' + $ref: "#/components/schemas/SocialIssue" responses: 401: description: "Unauthorized" @@ -926,11 +927,11 @@ paths: type: type: string enum: - - 'accompanying_period_work' + - "accompanying_period_work" startDate: - $ref: '#/components/schemas/Date' + $ref: "#/components/schemas/Date" endDate: - $ref: '#/components/schemas/Date' + $ref: "#/components/schemas/Date" examples: create a work: value: @@ -992,7 +993,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/AccompanyingCourseWork' + $ref: "#/components/schemas/AccompanyingCourseWork" responses: 401: description: "Unauthorized" @@ -1029,8 +1030,6 @@ paths: 400: description: "transition cannot be applyed" - - /1.0/person/accompanying-period/origin.json: get: tags: @@ -1064,8 +1063,6 @@ paths: 404: description: "Not found" - - /1.0/person/household.json: get: tags: @@ -1095,7 +1092,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Household' + $ref: "#/components/schemas/Household" 404: description: "not found" 401: @@ -1107,9 +1104,9 @@ paths: - household summary: Return households associated with the given person through accompanying periods description: | - Return households associated with the given person throught accompanying periods participation. + Return households associated with the given person throught accompanying periods participation. - The current household of the given person is excluded. + The current household of the given person is excluded. parameters: - name: person_id in: path @@ -1125,7 +1122,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Household' + $ref: "#/components/schemas/Household" 404: description: "not found" 401: @@ -1149,23 +1146,22 @@ paths: type: object properties: person: - $ref: '#/components/schemas/PersonById' + $ref: "#/components/schemas/PersonById" start_date: - $ref: '#/components/schemas/Date' + $ref: "#/components/schemas/Date" position: - $ref: '#/components/schemas/HouseholdPosition' + $ref: "#/components/schemas/HouseholdPosition" holder: type: boolean comment: type: string destination: - $ref: '#/components/schemas/Household' + $ref: "#/components/schemas/Household" examples: Moving person to a new household: value: concerned: - - - person: + - person: id: 0 type: person position: @@ -1180,8 +1176,7 @@ paths: Moving person to a new household and set an address to this household: value: concerned: - - - person: + - person: id: 0 type: person position: @@ -1198,8 +1193,7 @@ paths: Moving person to an existing household: value: concerned: - - - person: + - person: id: 0 type: person position: @@ -1215,8 +1209,7 @@ paths: Removing a person from any household: value: concerned: - - - person: + - person: id: 0 type: person start_date: @@ -1270,8 +1263,6 @@ paths: 400: description: "transition cannot be applyed" - - /1.0/person/social/social-action.json: get: tags: @@ -1349,7 +1340,6 @@ paths: 404: description: not found - /1.0/person/social-work/social-issue.json: get: tags: @@ -1379,7 +1369,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/SocialIssue' + $ref: "#/components/schemas/SocialIssue" 404: description: "not found" 401: From 52a0c0e95bd81dc005fbd52553a690ea13a873f4 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 27 Aug 2021 09:30:15 +0200 Subject: [PATCH 004/217] create new person: add an action and put action buttons in a dropdown --- .../Controller/PersonController.php | 4 ++- .../Resources/views/Person/create.html.twig | 26 +++++++++++++++---- .../translations/messages.fr.yml | 3 ++- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonController.php b/src/Bundle/ChillPersonBundle/Controller/PersonController.php index c390565b5..759f892b2 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonController.php @@ -244,7 +244,9 @@ final class PersonController extends AbstractController 'label' => 'Add the person' ])->add('createPeriod', SubmitType::class, [ 'label' => 'Add the person and create an accompanying period' - ]); + ])->add('createHousehold', SubmitType::class, [ + 'label' => 'Add the person and create an household' + ]); // TODO createHousehold form action $form->handleRequest($request); diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/create.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/create.html.twig index 9718308ed..eddcfd676 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/create.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/create.html.twig @@ -76,12 +76,28 @@ {{ form_row(form.gender, { 'label' : 'Gender'|trans }) }} +
+ {# TODO remove this field (vendee) #} + {{ form_row(form.center, { 'label' : 'Center'|trans }) }} +
+
    -
  • - {{ form_widget(form.editPerson, { 'attr': { 'class': 'btn btn-create' }}) }} -
  • -
  • - {{ form_widget(form.createPeriod, { 'attr': { 'class': 'btn btn-create' }}) }} +
diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 54c1f3818..852f3256b 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -119,7 +119,8 @@ address_country_code: Code pays 'Alreay existing person': 'Dossiers déjà encodés' 'Add the person': 'Ajouter la personne' -'Add the person and create an accompanying period': "Ajouter la personne et créer une période d'accompagnement" +'Add the person and create an accompanying period': "Créer la personne ET créer une période d'accompagnement" +'Add the person and create an household': "Créer la personne ET créer un ménage" Show person: Voir le dossier de la personne 'Confirm the creation': 'Confirmer la création' 'You will create this person': 'Vous allez créer le dossier suivant' From a302f0fdbfe6c1272d623e9e02576213d229793f Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 27 Aug 2021 09:35:28 +0200 Subject: [PATCH 005/217] invert firstname lastname when creating new person (TO BE CONFIRMED) --- .../ChillPersonBundle/Resources/views/Person/create.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/create.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/create.html.twig index eddcfd676..7056f25a3 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/create.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/create.html.twig @@ -64,10 +64,10 @@ {{ form_start(form) }} - {{ form_row(form.firstName, { 'label' : 'First name'|trans }) }} - {{ form_row(form.lastName, { 'label' : 'Last name'|trans }) }} + {{ form_row(form.firstName, { 'label' : 'First name'|trans }) }} + {% if form.altNames is defined %} {{ form_widget(form.altNames) }} {% endif %} From 2333b5c6b467d354ff6a63cccb054dc4677c52c3 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 27 Aug 2021 09:55:13 +0200 Subject: [PATCH 006/217] rename some translations --- .../Resources/views/Activity/show.html.twig | 8 ++++---- .../Resources/public/vuejs/Address/i18n.js | 2 +- .../Resources/public/vuejs/_js/i18n.js | 4 ++-- .../Controller/AccompanyingCourseController.php | 2 +- .../Menu/AccompanyingCourseMenuBuilder.php | 2 +- .../views/AccompanyingCourse/history.html.twig | 16 ++++++++-------- .../translations/messages.fr.yml | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig index f46e80cd2..81ebddc05 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig @@ -73,7 +73,7 @@ {% endif %} {% if t.commentVisible %} -
{{ 'Comment'|trans }}
+
{{ 'activity.comment'|trans }}
{%- if entity.comment.empty -%}
{{ 'No comment associated'|trans }}
{%- else -%} @@ -120,17 +120,17 @@ {{ 'Edit'|trans }} - + {# TODO {% if is_granted('CHILL_ACTIVITY_DELETE', entity) %} #} - +
  • {{ 'Delete'|trans }}
  • - + {# {% endif %} #} diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/i18n.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/i18n.js index 9cfd05a3e..2b4b4a9ea 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/i18n.js +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/i18n.js @@ -24,7 +24,7 @@ const addressMessages = { flat: 'Appartement', buildingName: 'Nom du bâtiment', extra: 'Complément d\'adresse', - distribution: 'Service particulier de distribution', + distribution: 'Cedex', create_postal_code: 'Localité inconnue. Cliquez ici pour créer une nouvelle localité', postalCode_name: 'Nom', postalCode_code: 'Code postal', diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js index f15dd6143..63e0da95a 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js @@ -43,7 +43,7 @@ const messages = { check_all: "cocher tout", reset: "réinitialiser", redirect: { - person: "Quitter la page et ouvrir le dossier", + person: "Quitter la page et ouvrir la fiche de l'usager", thirdparty: "Quitter la page et voir le tiers", } }, @@ -57,7 +57,7 @@ const messages = { show: { person: "Détails de l'usager", thirdparty: "Détails du tiers", - file_person: "Ouvrir le dossier", + file_person: "Ouvrir la fiche de l'usager", file_thirdparty: "Voir le Tiers", }, edit: { diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php index de67602b4..2f086c9f5 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php @@ -139,7 +139,7 @@ class AccompanyingCourseController extends Controller /** * History page of Accompanying Course section * - * the page show anti chronologic history with all actions, title of page is 'accompanying course details' + * the page show anti chronologic history with all actions, title of page is 'Accompanying Course History' * * @Route("/{_locale}/parcours/{accompanying_period_id}/history", name="chill_person_accompanying_course_history") * @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"}) diff --git a/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php index 744e5dbbe..df70b9e64 100644 --- a/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php @@ -54,7 +54,7 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface return; } - $menu->addChild($this->translator->trans('Accompanying Course Details'), [ + $menu->addChild($this->translator->trans('Accompanying Course History'), [ 'route' => 'chill_person_accompanying_course_history', 'routeParameters' => [ 'accompanying_period_id' => $period->getId() diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/history.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/history.html.twig index 5b0ada868..488dc3df9 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/history.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/history.html.twig @@ -1,7 +1,7 @@ {% extends '@ChillPerson/AccompanyingCourse/layout.html.twig' %} {% block title %} - {{ 'Accompanying Course Details'|trans }} + {{ 'Accompanying Course History'|trans }} {% endblock %} {% block content %} @@ -15,8 +15,8 @@ Il faudrait peut-être modifier son adresse comme ceci: `/fr/parcours/{id}/timeline`

    - {# start test flex-table - + {# start test flex-table +
    {% for p in accompanyingCourse.participations %}
    @@ -52,16 +52,16 @@
  • - +
    - Lorem ipsum dolor sit amet, incididunt ut labore et dolore magna aliqua. + Lorem ipsum dolor sit amet, incididunt ut labore et dolore magna aliqua.
    - Rhoncus est pellentesque elit eu ultrices vitae auctor. + Rhoncus est pellentesque elit eu ultrices vitae auctor.
    - Facilisis gravida neque convallis a cras semper auctor neque. + Facilisis gravida neque convallis a cras semper auctor neque.
    {% endfor %} @@ -70,5 +70,5 @@ {# end test flex-table #} {# ==> insert accompanyingCourse vue component #} -
    +
    {% endblock %} diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 852f3256b..8b6b6db58 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -373,7 +373,7 @@ Confirmed: en file active # Accompanying Course Accompanying Course: Parcours d'accompagnement -Accompanying Course Details: Détails du parcours +Accompanying Course History: Historique du parcours Resume Accompanying Course: Résumé du parcours Show Accompanying Course: Voir le parcours Edit Accompanying Course: Modifier le parcours From c258179017fbcc4d1720959dd179b12cd841edff Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 27 Aug 2021 11:02:35 +0200 Subject: [PATCH 007/217] move and rename vue HouseholdRenderBox --- .../components/Household.vue | 8 +-- .../HouseholdRenderBox.vue} | 61 ++++++++----------- 2 files changed, 30 insertions(+), 39 deletions(-) rename src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/{Household/Household.vue => Entity/HouseholdRenderBox.vue} (82%) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Household.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Household.vue index 05746429c..23334a0f9 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Household.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Household.vue @@ -3,7 +3,7 @@
    - +
    @@ -101,7 +101,7 @@ v-for="h in filterHouseholdSuggestionByAccompanyingPeriod" class="item" > - +
    • @@ -155,14 +155,14 @@ div.householdAddressSuggestionList { + + diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/HouseholdRenderBox.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/HouseholdRenderBox.vue index 21734e7e8..741470b81 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/HouseholdRenderBox.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/HouseholdRenderBox.vue @@ -1,71 +1,56 @@ - From 6e57d16ebf35cb64641c4e062c2a350f229ca627 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 6 Sep 2021 16:36:27 +0200 Subject: [PATCH 047/217] fix conflict with fa-ul and floatbutton (different with top or bottom) --- .../Resources/public/chill/scss/flex_table.scss | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss index 82ea0aa04..c25285da1 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss @@ -260,8 +260,7 @@ div.wrap-header { /* * FLOATBUTTON -* pas convaincant: -* conflits avec les fa-ul > li, lien non cliquables, text qui ne se place pas correctement +* p-ê pas convaincant: cet asset est toujours en observation */ div.floatbutton { @@ -278,6 +277,11 @@ div.floatbutton { div.action { padding: 0 0 1em 1em; } + + // avoid a position relative that make links unclickable + .fa-ul > li { + position: initial; + } } &.bottom { display: flex; @@ -301,9 +305,4 @@ div.floatbutton { background-color: #00ffffa3; } } - - // avoid a position relative that make links unclickable - .fa-ul > li { - //position: initial; // in conflict with picto fa-ul !! - } } From cf78c59e768edc635b2649b300fcf081c6c464d0 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 6 Sep 2021 16:37:30 +0200 Subject: [PATCH 048/217] vue personRenderBox when no returnPath --- .../Resources/public/vuejs/AccompanyingCourse/js/i18n.js | 2 +- .../public/vuejs/_components/Entity/PersonRenderBox.vue | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js index 66c45dc13..cf685cac3 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js @@ -44,7 +44,7 @@ const appMessages = { date_start_to_end: "Participation du {start} au {end}", leave_course: "L'usager quitte le parcours", sure: "Êtes-vous sûr ?", - sure_description: "Une fois confirmé, il ne sera pas possible de faire marche arrière ! La sortie restera cependant consignée dans l'historique du parcours.", + sure_description: "Une fois confirmé, il ne sera pas possible de faire marche arrière ! La sortie reste cependant consignée dans l'historique du parcours.", ok: "Oui, l'usager quitte le parcours", show_household_number: "Voir le ménage (n° {id})", show_household: "Voir le ménage" diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue index adac402d9..b8a638593 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue @@ -167,7 +167,8 @@ export default { return `/fr/person/${this.person.id}/general`; }, getCurrentHouseholdUrl() { - return `/fr/person/household/${this.person.current_household_id}/summary?returnPath=${this.returnPath}` + let returnPath = this.returnPath ? `?returnPath=${this.returnPath}` : ``; + return `/fr/person/household/${this.person.current_household_id}/summary${returnPath}` } } } From a94a757ae63218cde9f0a4e57d282ea94131b954 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 6 Sep 2021 16:50:10 +0200 Subject: [PATCH 049/217] accourse: don't display old participations (fix counter) --- .../Resources/public/chill/scss/flex_table.scss | 2 +- .../AccompanyingCourse/components/PersonsAssociated.vue | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss index c25285da1..2b9e4e671 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss @@ -277,7 +277,7 @@ div.floatbutton { div.action { padding: 0 0 1em 1em; } - + // avoid a position relative that make links unclickable .fa-ul > li { position: initial; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue index edde7fbdb..37833ef29 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue @@ -2,7 +2,7 @@

      {{ $t('persons_associated.title')}}

      -
      +
      @@ -58,11 +58,13 @@ export default { }, computed: { ...mapState({ - participations: state => state.accompanyingCourse.participations, - counter: state => state.accompanyingCourse.participations.length + participations: state => state.accompanyingCourse.participations }), currentParticipations() { return this.participations.filter(p => p.endDate === null) + }, + counter() { + return this.currentParticipations.length; } }, methods: { From dba3ede9e16a03821e97d9d2fb0f1c4d34db4c3c Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 6 Sep 2021 18:46:37 +0200 Subject: [PATCH 050/217] when a person has a household without address: display no_data message, even if option addNoData is false --- .../Resources/public/vuejs/_js/i18n.js | 1 + .../_components/Entity/PersonRenderBox.vue | 25 ++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js index 39bbd4cb1..9d1c8adde 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js @@ -77,6 +77,7 @@ const messages = { man: "Né le", woman: "Née le" } , + household_without_address: "Le ménage de l'usager est sans adresse", no_data: "Aucune information renseignée", type: { thirdparty: "Tiers", diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue index b8a638593..ea1a3008e 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue @@ -48,20 +48,27 @@
      +
      + +
      +
      + +
      +

      {{ $t('persons_associated.person_without_household_warning') }}

      +
      + + +
      + +
      + + +
      +
      @@ -65,6 +88,9 @@ export default { }, counter() { return this.currentParticipations.length; + }, + participationWithoutHousehold() { + return this.currentParticipations.filter(p => p.person.current_household_id === null); } }, methods: { @@ -88,3 +114,29 @@ export default { } } + diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js index cf685cac3..d7c01a174 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js @@ -47,7 +47,9 @@ const appMessages = { sure_description: "Une fois confirmé, il ne sera pas possible de faire marche arrière ! La sortie reste cependant consignée dans l'historique du parcours.", ok: "Oui, l'usager quitte le parcours", show_household_number: "Voir le ménage (n° {id})", - show_household: "Voir le ménage" + show_household: "Voir le ménage", + person_without_household_warning: "Certaines personnes n'appartiennent à aucun ménage actuellement. Renseignez leur appartenance à un ménage dès que possible.", + update_household: "Modifier l'appartenance", }, requestor: { title: "Demandeur", From 753e6c110545611d41ea6f4026ae863eb4335a1e Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 10 Sep 2021 11:32:12 +0200 Subject: [PATCH 053/217] adding a dev page with sass assets album --- .../Resources/views/Activity/list.html.twig | 2 +- .../Resources/public/chill/scss/flex_table.scss | 13 ++++++++----- .../components/PersonsAssociated.vue | 2 +- .../vuejs/_components/Entity/PersonRenderBox.vue | 2 +- .../views/Household/_render_member.html.twig | 2 +- .../_components/Entity/ThirdPartyRenderBox.vue | 2 +- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig index 5bcd41c66..07b59c7e7 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig @@ -48,7 +48,7 @@
    -
    +
    diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss index 2b9e4e671..21ecde267 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss @@ -1,3 +1,6 @@ +// See Assets Album page: +// http://localhost:8001/_dev/assets + /* * __FLEX-TABLE_________ * FLEX RESPONSIVE TABLE/BLOCK PRESENTATION @@ -175,13 +178,13 @@ div.wrap-list { border: 1px solid $black; div.wl-col.title { - background-color: $yellow; + background-color: yellow; } div.wl-col.list { - background-color: $green; + background-color: cyan; p.wl-item { - background-color: $orange; + background-color: orange; } } } @@ -263,7 +266,7 @@ div.wrap-header { * p-ê pas convaincant: cet asset est toujours en observation */ -div.floatbutton { +div.float-button { width: 100%; div.box { @@ -302,7 +305,7 @@ div.floatbutton { border: 1px solid black; background-color: yellow; div.action { - background-color: #00ffffa3; + background-color: transparentize(#00ffff, 0.4); } } } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue index 4c6757fcd..da1b4c4e6 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue @@ -32,7 +32,7 @@
    -
    +
    diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue index 29578d3ba..249162b87 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue @@ -41,7 +41,7 @@
    -
    +
    diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Household/_render_member.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Household/_render_member.html.twig index f1c96e5fa..25160ff5b 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Household/_render_member.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Household/_render_member.html.twig @@ -20,7 +20,7 @@ }) }}
    -
    +
      diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue index 90dd51837..c710cedfb 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue @@ -32,7 +32,7 @@
    -
    +
    From ff7cb6ca79c3b307896d860f66716ed892c68332 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 10 Sep 2021 11:38:18 +0200 Subject: [PATCH 054/217] adding unlink chill button --- .../Resources/public/chill/scss/buttons.scss | 6 +++++- .../Resources/views/Household/summary.html.twig | 11 +++++------ .../translations/messages+intl-icu.fr.yaml | 6 ++++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss index 6b54172c7..14c22685b 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss @@ -19,7 +19,8 @@ $chill-theme-buttons: ( "view": $chill-blue, "misc": $gray-300, "cancel": $gray-300, - "choose": $gray-300 + "choose": $gray-300, + "unlink": $chill-red, ); @each $button, $color in $chill-theme-buttons { @@ -45,6 +46,7 @@ $chill-theme-buttons: ( &.btn-delete, &.btn-danger, &.btn-remove, + &.btn-unlink, &.btn-action, &.btn-edit, &.btn-update { @@ -67,6 +69,7 @@ $chill-theme-buttons: ( // &.btn-submit::before, // &.btn-reset::before, // &.btn-action::before, + &.btn-unlink::before, &.btn-delete::before, &.btn-remove::before, &.btn-choose::before, @@ -94,6 +97,7 @@ $chill-theme-buttons: ( &.btn-remove::before { content: "\f00d"; } // fa-times &.btn-cancel::before { content: "\f060"; } // fa-arrow-left &.btn-choose::before { content: "\f00c"; } // fa-check // f046 fa-check-square-o + &.btn-unlink::before { content: "\f127"; } // fa-chain-broken } diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig index 89bb4da14..1568b6bed 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig @@ -88,14 +88,13 @@ {% macro customButtons(member, household) %}
  • - - {{ 'household.Change position'|trans }} + + {{ 'household.Leave'|trans }}
  • - - {{ 'household.Leave'|trans }} +
  • {% endmacro %} diff --git a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml index cdaf55cc8..f1362e7ae 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml +++ b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml @@ -23,7 +23,9 @@ household: Those members does not share address: Ces usagers ne partagent pas l'adresse du ménage. Any persons into this position: Aucune personne n'appartient au ménage à cette position. Leave household: Quitter le ménage - Leave: Quitter + Leave: Détacher + person: + leave: L'usager quitte le ménage Join: Rejoindre un ménage Change position: Repositionner Household file: Dossier ménage @@ -54,7 +56,7 @@ household: Expecting for birth on date: Naissance attendue pour le {date} Expecting for birth: Naissance attendue (date inconnue) Any expecting birth: Aucune naissance proche n'a été renseignée. - Comment and expecting birth: Commentaire et naissance attendue + Comment and expecting birth: Mettre à jour le commentaire Edit member metadata: Données supplémentaires comment_membership: Commentaire général sur les membres expecting_birth: Naissance attendue ? From 74957154b1bebf26f34e50ab0adf266651c21e57 Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 23 Aug 2021 09:11:08 +0200 Subject: [PATCH 055/217] rdv: pages by User --- .../Controller/CalendarController.php | 43 ++++++++++--------- ...firm_deleteByAccompanyingCourse.html.twig} | 0 .../Calendar/confirm_deleteByUser.html.twig | 18 ++++++++ .../Calendar/confirm_deletePerson.html.twig | 17 -------- .../Resources/views/Calendar/edit.html.twig | 8 ++-- ...wig => editByAccompanyingCourse.html.twig} | 2 +- .../views/Calendar/editByUser.html.twig | 36 ++++++++++++++++ .../Resources/views/Calendar/list.html.twig | 7 ++- .../views/Calendar/listByUser.html.twig | 9 ++++ .../Resources/views/Calendar/show.html.twig | 19 ++++++-- ...wig => showByAccompanyingCourse.html.twig} | 0 .../views/Calendar/showByUser.html.twig | 13 ++++++ .../translations/messages.fr.yml | 1 + 13 files changed, 127 insertions(+), 46 deletions(-) rename src/Bundle/ChillCalendarBundle/Resources/views/Calendar/{confirm_deleteAccompanyingCourse.html.twig => confirm_deleteByAccompanyingCourse.html.twig} (100%) create mode 100644 src/Bundle/ChillCalendarBundle/Resources/views/Calendar/confirm_deleteByUser.html.twig delete mode 100644 src/Bundle/ChillCalendarBundle/Resources/views/Calendar/confirm_deletePerson.html.twig rename src/Bundle/ChillCalendarBundle/Resources/views/Calendar/{editAccompanyingCourse.html.twig => editByAccompanyingCourse.html.twig} (97%) create mode 100644 src/Bundle/ChillCalendarBundle/Resources/views/Calendar/editByUser.html.twig create mode 100644 src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByUser.html.twig rename src/Bundle/ChillCalendarBundle/Resources/views/Calendar/{showAccompanyingCourse.html.twig => showByAccompanyingCourse.html.twig} (100%) create mode 100644 src/Bundle/ChillCalendarBundle/Resources/views/Calendar/showByUser.html.twig diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php index a894099e4..6e8dc624c 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php @@ -80,11 +80,10 @@ class CalendarController extends AbstractController if ($user instanceof User) { - // $calendar = $em->getRepository(Calendar::class) - // ->findByUser($user) - // ; - - // $view = 'ChillCalendarBundle:Calendar:listByUser.html.twig'; + $calendarItems = $em->getRepository(Calendar::class) + ->findByUser($user) + ; + $view = 'ChillCalendarBundle:Calendar:listByUser.html.twig'; } elseif ($accompanyingPeriod instanceof AccompanyingPeriod) { $calendarItems = $em->getRepository(Calendar::class)->findBy( ['accompanyingPeriod' => $accompanyingPeriod], @@ -174,11 +173,11 @@ class CalendarController extends AbstractController [$user, $accompanyingPeriod] = $this->getEntity($request); if ($accompanyingPeriod instanceof AccompanyingPeriod) { - $view = 'ChillCalendarBundle:Calendar:showAccompanyingCourse.html.twig'; + $view = 'ChillCalendarBundle:Calendar:showByAccompanyingCourse.html.twig'; } - // elseif ($person instanceof Person) { - // $view = 'ChillCalendarBundle:Calendar:showPerson.html.twig'; - // } + elseif ($user instanceof User) { + $view = 'ChillCalendarBundle:Calendar:showByUser.html.twig'; + } $entity = $em->getRepository('ChillCalendarBundle:Calendar')->find($id); @@ -198,9 +197,9 @@ class CalendarController extends AbstractController } return $this->render($view, [ - //'person' => $person, 'accompanyingCourse' => $accompanyingPeriod, 'entity' => $entity, + 'user' => $user //'delete_form' => $deleteForm->createView(), ]); } @@ -218,11 +217,11 @@ class CalendarController extends AbstractController [$user, $accompanyingPeriod] = $this->getEntity($request); if ($accompanyingPeriod instanceof AccompanyingPeriod) { - $view = 'ChillCalendarBundle:Calendar:editAccompanyingCourse.html.twig'; + $view = 'ChillCalendarBundle:Calendar:editByAccompanyingCourse.html.twig'; + } + elseif ($user instanceof User) { + $view = 'ChillCalendarBundle:Calendar:editByUser.html.twig'; } - // elseif ($person instanceof Person) { - // $view = 'ChillCalendarBundle:Calendar:editPerson.html.twig'; - // } $entity = $em->getRepository('ChillCalendarBundle:Calendar')->find($id); @@ -259,6 +258,7 @@ class CalendarController extends AbstractController 'form' => $form->createView(), 'delete_form' => $deleteForm->createView(), 'accompanyingCourse' => $accompanyingPeriod, + 'user' => $user, 'entity_json' => $entity_array ]); } @@ -274,11 +274,11 @@ class CalendarController extends AbstractController [$user, $accompanyingPeriod] = $this->getEntity($request); if ($accompanyingPeriod instanceof AccompanyingPeriod) { - $view = 'ChillCalendarBundle:Calendar:confirm_deleteAccompanyingCourse.html.twig'; + $view = 'ChillCalendarBundle:Calendar:confirm_deleteByAccompanyingCourse.html.twig'; } - // elseif ($person instanceof Person) { - // $view = 'ChillCalendarBundle:Calendar:confirm_deletePerson.html.twig'; - // } + elseif ($user instanceof User) { + $view = 'ChillCalendarBundle:Calendar:confirm_deleteByUser.html.twig'; + } /* @var $entity Calendar */ $entity = $em->getRepository('ChillCalendarBundle:Calendar')->find($id); @@ -324,9 +324,9 @@ class CalendarController extends AbstractController /** * Creates a form to delete a Calendar entity by id. */ - private function createDeleteForm(int $id, ?Person $person, ?AccompanyingPeriod $accompanyingPeriod): Form + private function createDeleteForm(int $id, ?User $user, ?AccompanyingPeriod $accompanyingPeriod): Form { - $params = $this->buildParamsToUrl($person, $accompanyingPeriod); + $params = $this->buildParamsToUrl($user, $accompanyingPeriod); $params['id'] = $id; return $this->createFormBuilder() @@ -350,7 +350,8 @@ class CalendarController extends AbstractController throw $this->createNotFoundException('User not found'); } - $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $user); + // TODO Add permission + // $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $user); } elseif ($request->query->has('accompanying_period_id')) { $accompanying_period_id = $request->get('accompanying_period_id'); $accompanyingPeriod = $em->getRepository(AccompanyingPeriod::class)->find($accompanying_period_id); diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/confirm_deleteAccompanyingCourse.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/confirm_deleteByAccompanyingCourse.html.twig similarity index 100% rename from src/Bundle/ChillCalendarBundle/Resources/views/Calendar/confirm_deleteAccompanyingCourse.html.twig rename to src/Bundle/ChillCalendarBundle/Resources/views/Calendar/confirm_deleteByAccompanyingCourse.html.twig diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/confirm_deleteByUser.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/confirm_deleteByUser.html.twig new file mode 100644 index 000000000..4f1ad45e5 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/confirm_deleteByUser.html.twig @@ -0,0 +1,18 @@ +{% extends "@ChillMain/layout.html.twig" %} + +{% set user = calendar.user %} + +{% set activeRouteKey = 'chill_calendar_calendar' %} + +{% block title 'Remove activity'|trans %} + +{% block content %} +{{ include('@ChillMain/Util/confirmation_template.html.twig', + { + 'title' : 'Remove calendar item'|trans, + 'confirm_question' : 'Are you sure you want to remove the calendar item?'|trans, + 'cancel_route' : 'chill_calendar_calendar', + 'cancel_parameters' : { 'user_id' : calendar.user.id, 'id' : calendar.id }, + 'form' : delete_form + } ) }} +{% endblock %} diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/confirm_deletePerson.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/confirm_deletePerson.html.twig deleted file mode 100644 index 9f8172bb4..000000000 --- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/confirm_deletePerson.html.twig +++ /dev/null @@ -1,17 +0,0 @@ -{% extends "@ChillPerson/Person/layout.html.twig" %} - -{% set activeRouteKey = 'chill_activity_activity_list' %} -{% set person = activity.person %} - -{% block title 'Remove activity'|trans %} - -{% block personcontent %} -{{ include('@ChillMain/Util/confirmation_template.html.twig', - { - 'title' : 'Remove activity'|trans, - 'confirm_question' : 'Are you sure you want to remove the activity about "%name%" ?'|trans({ '%name%' : person.firstname ~ ' ' ~ person.lastname } ), - 'cancel_route' : 'chill_activity_activity_list', - 'cancel_parameters' : { 'person_id' : activity.person.id, 'id' : activity.id }, - 'form' : delete_form - } ) }} -{% endblock %} diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/edit.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/edit.html.twig index f64e22353..4b4dca59b 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/edit.html.twig +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/edit.html.twig @@ -48,15 +48,17 @@ {{ form_row(form.sendSMS) }} {% endif %} +
    +
    • diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/editAccompanyingCourse.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/editByAccompanyingCourse.html.twig similarity index 97% rename from src/Bundle/ChillCalendarBundle/Resources/views/Calendar/editAccompanyingCourse.html.twig rename to src/Bundle/ChillCalendarBundle/Resources/views/Calendar/editByAccompanyingCourse.html.twig index f41939f62..1d506cb48 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/editAccompanyingCourse.html.twig +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/editByAccompanyingCourse.html.twig @@ -2,7 +2,7 @@ {% set activeRouteKey = 'chill_calendar_calendar_list' %} -{% block title 'Update calendar'|trans %} +{% block title 'Update calendar'|trans %} {% block content %}
      diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/editByUser.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/editByUser.html.twig new file mode 100644 index 000000000..b2368ca76 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/editByUser.html.twig @@ -0,0 +1,36 @@ +{% extends "@ChillMain/layout.html.twig" %} + +{% block title 'Update calendar'|trans %} + +{% block content %} +
      +
      +
      + +
      {# <=== vue component #} + {% include 'ChillCalendarBundle:Calendar:edit.html.twig' with {'context': 'user'} %} + +
      +
      +
      +{% endblock %} + +{% block js %} + {{ parent() }} + + {{ encore_entry_script_tags('vue_calendar') }} +{% endblock %} + +{% block css %} + {{ parent() }} + {{ encore_entry_link_tags('vue_calendar') }} +{% endblock %} diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/list.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/list.html.twig index d5ea0e172..33ea5d1b8 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/list.html.twig +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/list.html.twig @@ -8,7 +8,11 @@ {% set accompanying_course_id = accompanyingCourse.id %} {% endif %} -

      {{ 'Calendar list' |trans }}

      +{% if user %} +

      {{ 'My calendar list' |trans }}

      +{% else %} +

      {{ 'Calendar list' |trans }}

      +{% endif %} {% if calendarItems|length == 0 %}

      @@ -54,6 +58,7 @@ {% endif %} +

        diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByUser.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByUser.html.twig new file mode 100644 index 000000000..ce4a8843c --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByUser.html.twig @@ -0,0 +1,9 @@ +{% extends "@ChillMain/layout.html.twig" %} + +{% set activeRouteKey = 'chill_calendar_calendar_list' %} + +{% block title %}{{ 'My calendar list' |trans }}{% endblock title %} + +{% block content %} + {% include 'ChillCalendarBundle:Calendar:list.html.twig' with {'context': 'user'} %} +{% endblock %} diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/show.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/show.html.twig index efab85442..d450d2ab8 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/show.html.twig +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/show.html.twig @@ -58,24 +58,37 @@ {% set accompanying_course_id = accompanyingCourse.id %} {% endif %} +{% set user_id = null %} +{% if user %} + {% set user_id = user.id %} +{% endif %} +
        • - + {{ 'Back to the list'|trans }}
        • + {% if accompanyingCourse %}
        • {{ 'Edit'|trans }}
        • - + {% endif %} + {% if user %} +
        • + + {{ 'Edit'|trans }} + +
        • + {% endif %} {# TODO {% if is_granted('CHILL_ACTIVITY_DELETE', entity) %} #}
        • - + {{ 'Delete'|trans }}
        • diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/showAccompanyingCourse.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/showByAccompanyingCourse.html.twig similarity index 100% rename from src/Bundle/ChillCalendarBundle/Resources/views/Calendar/showAccompanyingCourse.html.twig rename to src/Bundle/ChillCalendarBundle/Resources/views/Calendar/showByAccompanyingCourse.html.twig diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/showByUser.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/showByUser.html.twig new file mode 100644 index 000000000..8fa216fa4 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/showByUser.html.twig @@ -0,0 +1,13 @@ +{% extends "@ChillMain/layout.html.twig" %} + +{% block title 'Calendar'|trans %} + +{% block content -%} +
          +
          +
          + {% include 'ChillCalendarBundle:Calendar:show.html.twig' with {'context': 'user'} %} +
          +
          +
          +{% endblock content %} diff --git a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml index e5e5c636a..0eb7349a4 100644 --- a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml @@ -1,5 +1,6 @@ Calendar: Rendez-vous Calendar list: Liste des rendez-vous +My calendar list: Mes rendez-vous There is no calendar items.: Il n'y a pas de rendez-vous Remove calendar item: Supprimer le rendez-vous Are you sure you want to remove the calendar item?: Êtes-vous sûr de vouloir supprimer le rendez-vous? From 68538f0e85a1d40ae5aa575ad90b478f9c2ec3aa Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 23 Aug 2021 09:21:47 +0200 Subject: [PATCH 056/217] rdv: add user menu entry for my calendar list --- src/Bundle/ChillTaskBundle/Menu/UserMenuBuilder.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Bundle/ChillTaskBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillTaskBundle/Menu/UserMenuBuilder.php index 33e84949f..f4dc4391e 100644 --- a/src/Bundle/ChillTaskBundle/Menu/UserMenuBuilder.php +++ b/src/Bundle/ChillTaskBundle/Menu/UserMenuBuilder.php @@ -115,6 +115,17 @@ class UserMenuBuilder implements LocalMenuBuilderInterface 'icon' => 'tasks' ]); + $menu->addChild("My calendar list", [ + 'route' => 'chill_calendar_calendar', + 'routeParameters' => [ + 'user_id' => $user->getId(), + ] + ]) + ->setExtras([ + 'order' => -9, + 'icon' => 'tasks' + ]); + /* $menu->addChild("My aside activities", [ 'route' => 'chill_crud_aside_activity_index' From 864f84fededa3db5a8cc4e2f5e0a656b9eccedb2 Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 23 Aug 2021 09:36:53 +0200 Subject: [PATCH 057/217] rdv: change entrypoint for calendar css + correct calendar controls as a function of context --- .../CalendarUserSelector/CalendarUserSelector.vue | 11 +---------- .../Resources/views/Calendar/edit.html.twig | 4 +++- .../views/Calendar/editByAccompanyingCourse.html.twig | 1 + .../ChillCalendarBundle/chill.webpack.config.js | 4 ++-- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_components/CalendarUserSelector/CalendarUserSelector.vue b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_components/CalendarUserSelector/CalendarUserSelector.vue index 758b7bae8..bf359f49b 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_components/CalendarUserSelector/CalendarUserSelector.vue +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_components/CalendarUserSelector/CalendarUserSelector.vue @@ -1,5 +1,5 @@ + {{ encore_entry_script_tags('vue_mycalendarrange') }} +{% endblock %} + +{% block css %} + {{ parent() }} + {{ encore_entry_link_tags('vue_calendar') }} +{% endblock %} diff --git a/src/Bundle/ChillCalendarBundle/chill.webpack.config.js b/src/Bundle/ChillCalendarBundle/chill.webpack.config.js index 258e43089..f91b30268 100644 --- a/src/Bundle/ChillCalendarBundle/chill.webpack.config.js +++ b/src/Bundle/ChillCalendarBundle/chill.webpack.config.js @@ -6,5 +6,6 @@ module.exports = function(encore, entries) { }); encore.addEntry('vue_calendar', __dirname + '/Resources/public/vuejs/Calendar/index.js'); + encore.addEntry('vue_mycalendarrange', __dirname + '/Resources/public/vuejs/MyCalendarRange/index.js'); encore.addEntry('page_calendar', __dirname + '/Resources/public/chill/index.js'); }; From 329d3cc3d8b793403042340dbe3f4e490cdb9743 Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 30 Aug 2021 11:02:53 +0200 Subject: [PATCH 060/217] rdv: add API entry point for POSTing calendar range --- .../Controller/CalendarRangeAPIController.php | 19 ++++--- .../ChillCalendarExtension.php | 3 +- .../Entity/CalendarRange.php | 6 +-- .../ChillCalendarBundle/chill.api.specs.yaml | 50 +++++++++++++++++++ 4 files changed, 66 insertions(+), 12 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php index be279ed36..672e9527c 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php @@ -18,16 +18,19 @@ class CalendarRangeAPIController extends ApiController */ public function availableRanges(Request $request, string $_format): JsonResponse { - if ($request->query->has('user')) { - $user = $request->query->get('user'); - } - $em = $this->getDoctrine()->getManager(); - $query = $em->createQuery( - 'SELECT c FROM ChillCalendarBundle:CalendarRange c - WHERE NOT EXISTS (SELECT cal.id FROM ChillCalendarBundle:Calendar cal WHERE cal.calendarRange = c.id)') - ; + $sql = 'SELECT c FROM ChillCalendarBundle:CalendarRange c + WHERE NOT EXISTS (SELECT cal.id FROM ChillCalendarBundle:Calendar cal WHERE cal.calendarRange = c.id)'; + + if ($request->query->has('user')) { + $user = $request->query->get('user'); + $sql = $sql . ' AND c.user = :user'; + $query = $em->createQuery($sql) + ->setParameter('user', $user); + } else { + $query = $em->createQuery($sql); + } $results = $query->getResult(); diff --git a/src/Bundle/ChillCalendarBundle/DependencyInjection/ChillCalendarExtension.php b/src/Bundle/ChillCalendarBundle/DependencyInjection/ChillCalendarExtension.php index 2927d4910..5f20f5968 100644 --- a/src/Bundle/ChillCalendarBundle/DependencyInjection/ChillCalendarExtension.php +++ b/src/Bundle/ChillCalendarBundle/DependencyInjection/ChillCalendarExtension.php @@ -72,7 +72,8 @@ class ChillCalendarExtension extends Extension implements PrependExtensionInterf '_entity' => [ 'methods' => [ Request::METHOD_GET => true, - Request::METHOD_HEAD => true + Request::METHOD_HEAD => true, + Request::METHOD_POST => true, ] ], ] diff --git a/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php b/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php index f9582c8c2..b83684a7c 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php +++ b/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php @@ -25,19 +25,19 @@ class CalendarRange /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") - * @Groups({"read"}) + * @groups({"read", "write"}) */ private User $user; /** * @ORM\Column(type="datetimetz_immutable") - * @groups({"read"}) + * @groups({"read", "write"}) */ private \DateTimeImmutable $startDate; /** * @ORM\Column(type="datetimetz_immutable") - * @groups({"read"}) + * @groups({"read", "write"}) */ private \DateTimeImmutable $endDate; diff --git a/src/Bundle/ChillCalendarBundle/chill.api.specs.yaml b/src/Bundle/ChillCalendarBundle/chill.api.specs.yaml index 8da280b36..1ca66375d 100644 --- a/src/Bundle/ChillCalendarBundle/chill.api.specs.yaml +++ b/src/Bundle/ChillCalendarBundle/chill.api.specs.yaml @@ -8,6 +8,28 @@ servers: - url: "/api" description: "Your current dev server" +components: + schemas: + Date: + type: object + properties: + datetime: + type: string + format: date-time + User: + type: object + properties: + id: + type: integer + type: + type: string + enum: + - user + username: + type: string + text: + type: string + paths: /1.0/calendar/calendar.json: get: @@ -48,6 +70,34 @@ paths: responses: 200: description: "ok" + post: + tags: + - calendar + summary: create a new calendar range + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + user: + $ref: '#/components/schemas/User' + startDate: + $ref: '#/components/schemas/Date' + endDate: + $ref: '#/components/schemas/Date' + responses: + 401: + description: "Unauthorized" + 404: + description: "Not found" + 200: + description: "OK" + 422: + description: "Unprocessable entity (validation errors)" + 400: + description: "transition cannot be applyed" /1.0/calendar/calendar-range/{id}.json: get: From 0fe6d7d00b3a9ae4e3f4a0993dabba19b0d6948a Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 30 Aug 2021 11:57:15 +0200 Subject: [PATCH 061/217] rdv: add calendar range events in myCalendar --- .../public/vuejs/MyCalendarRange/App.vue | 54 +++++++++++++------ .../public/vuejs/MyCalendarRange/index.js | 4 +- .../public/vuejs/MyCalendarRange/store.js | 38 +++++++++++++ .../Resources/public/vuejs/_api/api.js | 12 ++++- 4 files changed, 90 insertions(+), 18 deletions(-) create mode 100644 src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue index 1eaf04335..ace1ec5f4 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue @@ -7,6 +7,7 @@  {{ arg.event.title }} +
      @@ -17,7 +18,7 @@ import FullCalendar from '@fullcalendar/vue3'; import dayGridPlugin from '@fullcalendar/daygrid'; import interactionPlugin from '@fullcalendar/interaction'; import timeGridPlugin from '@fullcalendar/timegrid'; -import { fetchCalendar } from '../_api/api'; +import { fetchCalendar, fetchCalendarRangesByUser } from '../_api/api'; export default { name: "App", @@ -30,7 +31,8 @@ export default { userId: window.userId, showMyCalendar: true, calendarEvents: { - user: [], + userCalendar: [], + userCalendarRange: [] }, calendarOptions: { locale: frLocale, @@ -59,30 +61,49 @@ export default { }, fetchData() { console.log(this.userId); - fetchCalendar(this.userId).then(calendar => new Promise((resolve, reject) => { - let results = calendar.results; - let events = results.map(i => + + fetchCalendarRangesByUser(this.userId).then(calendarRanges => new Promise((resolve, reject) => { + let events = calendarRanges.results.map(i => ({ start: i.startDate.datetime, end: i.endDate.datetime, }) ); - let calendarEventsCurrentUser = { - events: events, - color: 'darkblue', - id: 1000, - editable: false + let calendarRangeEvents = { + events: events, + color: 'orange', + textColor: '#444444' }; - this.calendarEvents.user = calendarEventsCurrentUser; - this.updateEventsSource() - resolve(); + this.calendarEvents.userCalendarRange = calendarRangeEvents; + + fetchCalendar(this.userId).then(calendar => new Promise((resolve, reject) => { + let events = calendar.results.map(i => + ({ + start: i.startDate.datetime, + end: i.endDate.datetime, + }) + ); + let calendarEventsCurrentUser = { + events: events, + color: 'darkblue', + id: 1000, + editable: false + }; + this.calendarEvents.userCalendar = calendarEventsCurrentUser; + this.updateEventsSource(); + resolve(); + })); + + resolve(); })); }, updateEventsSource() { this.calendarOptions.eventSources = []; + this.calendarOptions.eventSources.push(this.calendarEvents.userCalendarRange); if (this.showMyCalendar) { - this.calendarOptions.eventSources.push(this.calendarEvents.user); + this.calendarOptions.eventSources.push(this.calendarEvents.userCalendar); } + console.log(this.calendarOptions.eventSources); }, toggleMyCalendar(value) { this.showMyCalendar = value; @@ -92,11 +113,14 @@ export default { }, onDateSelect(payload) { console.log(payload) + this.$store.dispatch('createRange', payload); }, onEventChange(payload) { - //this.$store.dispatch('updateEvent', payload); + console.log(payload) + this.$store.dispatch('updateRange', payload); }, onEventClick(payload) { + console.log(payload) }, }, mounted() { diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/index.js b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/index.js index ca338a3be..a10a16601 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/index.js +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/index.js @@ -1,7 +1,7 @@ import { createApp } from 'vue'; import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n' import { appMessages } from './i18n' -//import store from './store' +import store from './store' import App from './App.vue'; @@ -10,7 +10,7 @@ const i18n = _createI18n(appMessages); const app = createApp({ template: ``, }) -//.use(store) +.use(store) .use(i18n) .component('app', App) .mount('#myCalendar'); diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js new file mode 100644 index 000000000..457069de7 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js @@ -0,0 +1,38 @@ +import 'es6-promise/auto'; +import { createStore } from 'vuex'; + +const debug = process.env.NODE_ENV !== 'production'; + +const store = createStore({ + strict: debug, + state: { + newCalendarRanges: [], + updateCalendarRanges: [], + deleteCalendarRanges: [] + }, + mutations: { + updateRange(state, payload) { + state.updateCalendarRanges.push({start: payload.start, end: payload.end}); + }, + addRange(state, payload) { + state.newCalendarRanges.push({start: payload.start, end: payload.end}); + } + }, + actions: { + createRange({ commit }, payload) { + console.log('### action createRange', payload); + commit('addRange', payload); + }, + updateRange({ commit }, payload) { + console.log('### action updateRange', payload); + commit('updateRange', payload); + }, + saveRanges({ commit }, payload) { + console.log('### action saveRange', payload); + postRange() + }, + + } +}); + +export default store; diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_api/api.js b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_api/api.js index a11ca8498..2c08068fd 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_api/api.js +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_api/api.js @@ -12,6 +12,15 @@ const fetchCalendarRanges = () => { }); }; +const fetchCalendarRangesByUser = (userId) => { + const url = `/api/1.0/calendar/calendar-range-available.json?user=${userId}`; + return fetch(url) + .then(response => { + if (response.ok) { return response.json(); } + throw Error('Error with request resource response'); + }); +}; + /* * Endpoint chill_api_single_calendar * method GET, get Calendar events, can be filtered by mainUser @@ -28,5 +37,6 @@ const fetchCalendar = (mainUserId) => { export { fetchCalendarRanges, - fetchCalendar + fetchCalendar, + fetchCalendarRangesByUser }; From 6d607e3939ecab641daff95b912192b80b964f85 Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 30 Aug 2021 17:44:52 +0200 Subject: [PATCH 062/217] rdv: edit calendar ranges: create and update calendar ranges --- .../ChillCalendarExtension.php | 2 + .../public/vuejs/MyCalendarRange/App.vue | 31 ++++++++-- .../public/vuejs/MyCalendarRange/store.js | 60 ++++++++++++++++++- .../Resources/public/vuejs/_api/api.js | 43 ++++++++++++- 4 files changed, 127 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/DependencyInjection/ChillCalendarExtension.php b/src/Bundle/ChillCalendarBundle/DependencyInjection/ChillCalendarExtension.php index 5f20f5968..f4c5411f8 100644 --- a/src/Bundle/ChillCalendarBundle/DependencyInjection/ChillCalendarExtension.php +++ b/src/Bundle/ChillCalendarBundle/DependencyInjection/ChillCalendarExtension.php @@ -74,6 +74,8 @@ class ChillCalendarExtension extends Extension implements PrependExtensionInterf Request::METHOD_GET => true, Request::METHOD_HEAD => true, Request::METHOD_POST => true, + Request::METHOD_PATCH => true, + Request::METHOD_DELETE => true, ] ], ] diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue index ace1ec5f4..e28655ab4 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue @@ -7,7 +7,10 @@  {{ arg.event.title }} - +
    @@ -32,7 +35,11 @@ export default { showMyCalendar: true, calendarEvents: { userCalendar: [], - userCalendarRange: [] + userCalendarRange: [], + new: { + events: [], + color: "red" + } }, calendarOptions: { locale: frLocale, @@ -43,7 +50,7 @@ export default { selectable: true, select: this.onDateSelect, eventChange: this.onEventChange, - eventClick: this.onEventClick, + // eventClick: this.onEventClick, selectMirror: true, editable: true, weekends: false, @@ -67,6 +74,7 @@ export default { ({ start: i.startDate.datetime, end: i.endDate.datetime, + calendarRangeId: i.id }) ); let calendarRangeEvents = { @@ -100,6 +108,7 @@ export default { updateEventsSource() { this.calendarOptions.eventSources = []; this.calendarOptions.eventSources.push(this.calendarEvents.userCalendarRange); + this.calendarOptions.eventSources.push(this.calendarEvents.new); if (this.showMyCalendar) { this.calendarOptions.eventSources.push(this.calendarEvents.userCalendar); } @@ -113,15 +122,25 @@ export default { }, onDateSelect(payload) { console.log(payload) + this.calendarEvents.new.events.push({ //TODO does not work + start: payload.startStr, + end: payload.endStr, + }); + this.updateEventsSource(); this.$store.dispatch('createRange', payload); }, onEventChange(payload) { console.log(payload) this.$store.dispatch('updateRange', payload); + //TODO update the eventsSource with payload, or use the store for updating the eventsSource }, - onEventClick(payload) { - console.log(payload) - }, + // onEventClick(payload) { + // console.log(payload) + // //TODO update the eventsSource with payload, or use the store for updating the eventsSource + // }, + onClickSave(payload){ + this.$store.dispatch('saveRanges', payload); + } }, mounted() { this.init(); diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js index 457069de7..cec206661 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js @@ -1,5 +1,6 @@ import 'es6-promise/auto'; import { createStore } from 'vuex'; +import { postCalendarRange, patchCalendarRange } from '../_api/api'; const debug = process.env.NODE_ENV !== 'production'; @@ -12,10 +13,23 @@ const store = createStore({ }, mutations: { updateRange(state, payload) { - state.updateCalendarRanges.push({start: payload.start, end: payload.end}); + state.updateCalendarRanges.push({ + id: payload.event.extendedProps.calendarRangeId, + start: payload.event.start, + end: payload.event.end + }); }, addRange(state, payload) { state.newCalendarRanges.push({start: payload.start, end: payload.end}); + }, + clearNewCalendarRanges(state) { + state.newCalendarRanges = []; + }, + clearUpdateCalendarRanges(state) { + state.updateCalendarRanges = []; + }, + deleteUpdateCalendarRanges(state) { + state.deleteCalendarRanges = []; } }, actions: { @@ -29,10 +43,52 @@ const store = createStore({ }, saveRanges({ commit }, payload) { console.log('### action saveRange', payload); - postRange() + console.log(this.state) + //TODO: if smthg new in newCalendarRange, postRange(), if smthg to update in updateCalendarRanges, update... + if (this.state.newCalendarRanges.length > 0){ + this.state.newCalendarRanges.map(cr => { + postCalendarRange({ + user: { + type: 'user', + id: window.userId, + }, + startDate: { + datetime: `${cr.start.toISOString().split('.')[0]}+0000`, //should be like "2021-08-20T15:00:00+0200", + }, + endDate: { + datetime: `${cr.end.toISOString().split('.')[0]}+0000`, // TODO check if OK with time zone + }, + }, 'POST'); + }) + commit('clearNewCalendarRanges'); + } + if (this.state.updateCalendarRanges.length > 0){ + this.state.updateCalendarRanges.map(cr => { + console.log(cr) + patchCalendarRange(cr.id, + { + startDate: { + datetime: `${cr.start.toISOString().split('.')[0]}+0000`, //should be like "2021-08-20T15:00:00+0200", + }, + endDate: { + datetime: `${cr.end.toISOString().split('.')[0]}+0000`, // TODO check if OK with time zone + }, + }); + }) + commit('clearUpdateCalendarRanges'); + } + if (this.state.deleteCalendarRanges.length > 0){ + this.state.deleteCalendarRanges.map(cr => { + postCalendarRange({ + id: cr.id //TODO check functionning + }, 'DELETE'); + }) + commit('deleteUpdateCalendarRanges'); + } }, } }); + export default store; diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_api/api.js b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_api/api.js index 2c08068fd..c062d0d6e 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_api/api.js +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_api/api.js @@ -35,8 +35,49 @@ const fetchCalendar = (mainUserId) => { }); }; + +/* +* Endpoint chill_api_single_calendar_range__entity_create +* method POST or DELETE, post CalendarRange entity +*/ +const postCalendarRange = (body, method) => { + const url = `/api/1.0/calendar/calendar-range.json?`; + return fetch(url, { + method: method, + headers: { + 'Content-Type': 'application/json;charset=utf-8' + }, + body: JSON.stringify(body) + }).then(response => { + if (response.ok) { return response.json(); } + throw Error('Error with request resource response'); + }); +}; + +/* +* Endpoint chill_api_single_calendar_range__entity +* method PATCH, patch CalendarRange entity +*/ +const patchCalendarRange = (id, body) => { + console.log(body) + const url = `/api/1.0/calendar/calendar-range/${id}.json`; + return fetch(url, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json;charset=utf-8' + }, + body: JSON.stringify(body) + }).then(response => { + if (response.ok) { return response.json(); } + throw Error('Error with request resource response'); + }); +}; + + export { fetchCalendarRanges, fetchCalendar, - fetchCalendarRangesByUser + fetchCalendarRangesByUser, + postCalendarRange, + patchCalendarRange }; From bcb36ddc112476f16f1db559bd21bfbe0c2d48b1 Mon Sep 17 00:00:00 2001 From: nobohan Date: Tue, 31 Aug 2021 09:03:12 +0200 Subject: [PATCH 063/217] rdv: edit calendar range: fix display of new calendar ranges --- .../public/vuejs/MyCalendarRange/App.vue | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue index e28655ab4..5f6ed3c0d 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue @@ -34,11 +34,11 @@ export default { userId: window.userId, showMyCalendar: true, calendarEvents: { - userCalendar: [], - userCalendarRange: [], + userCalendar: null, + userCalendarRange: null, new: { events: [], - color: "red" + color: "#3788d8" } }, calendarOptions: { @@ -50,6 +50,8 @@ export default { selectable: true, select: this.onDateSelect, eventChange: this.onEventChange, + eventDrop: this.onEventDropOrResize, + eventResize: this.onEventDropOrResize, // eventClick: this.onEventClick, selectMirror: true, editable: true, @@ -79,7 +81,7 @@ export default { ); let calendarRangeEvents = { events: events, - color: 'orange', + color: '#79bafc', textColor: '#444444' }; this.calendarEvents.userCalendarRange = calendarRangeEvents; @@ -107,8 +109,8 @@ export default { }, updateEventsSource() { this.calendarOptions.eventSources = []; - this.calendarOptions.eventSources.push(this.calendarEvents.userCalendarRange); this.calendarOptions.eventSources.push(this.calendarEvents.new); + this.calendarOptions.eventSources.push(this.calendarEvents.userCalendarRange); if (this.showMyCalendar) { this.calendarOptions.eventSources.push(this.calendarEvents.userCalendar); } @@ -122,17 +124,24 @@ export default { }, onDateSelect(payload) { console.log(payload) - this.calendarEvents.new.events.push({ //TODO does not work + let events = this.calendarEvents.new.events; + events.push({ start: payload.startStr, - end: payload.endStr, + end: payload.endStr }); + this.calendarEvents.new = { + events: events, + color: "#3788d8" + }; this.updateEventsSource(); this.$store.dispatch('createRange', payload); }, onEventChange(payload) { console.log(payload) this.$store.dispatch('updateRange', payload); - //TODO update the eventsSource with payload, or use the store for updating the eventsSource + }, + onEventDropOrResize(payload) { + payload.event.setProp('color', '#3788d8'); }, // onEventClick(payload) { // console.log(payload) From 25b85fcc6816fdfa8a45b36349a81415f634dc4c Mon Sep 17 00:00:00 2001 From: nobohan Date: Tue, 31 Aug 2021 14:16:42 +0200 Subject: [PATCH 064/217] rdv: edit calendar ranges: add delete + doc swagger --- .../Controller/CalendarRangeAPIController.php | 6 +++ .../ChillCalendarExtension.php | 2 +- .../Resources/public/chill/scss/calendar.scss | 10 ++++ .../public/vuejs/MyCalendarRange/App.vue | 29 ++++++----- .../public/vuejs/MyCalendarRange/store.js | 26 +++++++--- .../Resources/public/vuejs/_api/api.js | 41 +++++++++++++-- .../views/Calendar/listByUser.html.twig | 1 + .../ChillCalendarBundle/chill.api.specs.yaml | 50 +++++++++++++++++++ 8 files changed, 137 insertions(+), 28 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php index 672e9527c..a60eb98b3 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php @@ -38,4 +38,10 @@ class CalendarRangeAPIController extends ApiController //TODO use also the paginator, eg return $this->serializeCollection('get', $request, $_format, $paginator, $results); } + // public function calendarRangeApi($id, Request $request, string $_format): Response + // { + // return $this->addRemoveSomething('calendarRange', $id, $request, $_format, 'calendarRange', CalendarRange::class, [ 'groups' => [ 'read' ] ]); + // } + + } \ No newline at end of file diff --git a/src/Bundle/ChillCalendarBundle/DependencyInjection/ChillCalendarExtension.php b/src/Bundle/ChillCalendarBundle/DependencyInjection/ChillCalendarExtension.php index f4c5411f8..8660fac52 100644 --- a/src/Bundle/ChillCalendarBundle/DependencyInjection/ChillCalendarExtension.php +++ b/src/Bundle/ChillCalendarBundle/DependencyInjection/ChillCalendarExtension.php @@ -66,7 +66,7 @@ class ChillCalendarExtension extends Extension implements PrependExtensionInterf '_index' => [ 'methods' => [ Request::METHOD_GET => true, - Request::METHOD_HEAD => true + Request::METHOD_HEAD => true, ], ], '_entity' => [ diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/chill/scss/calendar.scss b/src/Bundle/ChillCalendarBundle/Resources/public/chill/scss/calendar.scss index b224125f1..a2c0c4b89 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/chill/scss/calendar.scss +++ b/src/Bundle/ChillCalendarBundle/Resources/public/chill/scss/calendar.scss @@ -7,4 +7,14 @@ div#calendarControls { div#fullCalendar{ +} + +span.calendarRangeItems { + display: flex; + flex-direction: row; + justify-content: space-between; + a { + text-decoration: none; + padding: 3px; + } } \ No newline at end of file diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue index 5f6ed3c0d..320b5a978 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue @@ -2,14 +2,19 @@

    {{ $t('edit_your_calendar_range') }}

    - @@ -52,7 +57,6 @@ export default { eventChange: this.onEventChange, eventDrop: this.onEventDropOrResize, eventResize: this.onEventDropOrResize, - // eventClick: this.onEventClick, selectMirror: true, editable: true, weekends: false, @@ -69,8 +73,6 @@ export default { this.fetchData() }, fetchData() { - console.log(this.userId); - fetchCalendarRangesByUser(this.userId).then(calendarRanges => new Promise((resolve, reject) => { let events = calendarRanges.results.map(i => ({ @@ -123,7 +125,6 @@ export default { this.calendarOptions.weekends = !this.calendarOptions.weekends; }, onDateSelect(payload) { - console.log(payload) let events = this.calendarEvents.new.events; events.push({ start: payload.startStr, @@ -137,18 +138,17 @@ export default { this.$store.dispatch('createRange', payload); }, onEventChange(payload) { - console.log(payload) - this.$store.dispatch('updateRange', payload); }, onEventDropOrResize(payload) { payload.event.setProp('color', '#3788d8'); + this.$store.dispatch('updateRange', payload); }, - // onEventClick(payload) { - // console.log(payload) - // //TODO update the eventsSource with payload, or use the store for updating the eventsSource - // }, onClickSave(payload){ this.$store.dispatch('saveRanges', payload); + }, + onDelete(payload){ + payload.setProp('color', '#dddddd'); + this.$store.dispatch('deleteRange', payload); } }, mounted() { @@ -156,4 +156,3 @@ export default { } } - diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js index cec206661..319514fd1 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js @@ -1,6 +1,6 @@ import 'es6-promise/auto'; import { createStore } from 'vuex'; -import { postCalendarRange, patchCalendarRange } from '../_api/api'; +import { postCalendarRange, patchCalendarRange, deleteCalendarRange } from '../_api/api'; const debug = process.env.NODE_ENV !== 'production'; @@ -20,7 +20,17 @@ const store = createStore({ }); }, addRange(state, payload) { - state.newCalendarRanges.push({start: payload.start, end: payload.end}); + state.newCalendarRanges.push({ + start: payload.start, + end: payload.end + }); + }, + deleteRange(state, payload) { + state.deleteCalendarRanges.push({ + id: payload.extendedProps.calendarRangeId, + start: payload.start, + end: payload.end + }); }, clearNewCalendarRanges(state) { state.newCalendarRanges = []; @@ -41,10 +51,13 @@ const store = createStore({ console.log('### action updateRange', payload); commit('updateRange', payload); }, + deleteRange({ commit }, payload) { + console.log('### action deleteRange', payload); + commit('deleteRange', payload); + }, saveRanges({ commit }, payload) { console.log('### action saveRange', payload); console.log(this.state) - //TODO: if smthg new in newCalendarRange, postRange(), if smthg to update in updateCalendarRanges, update... if (this.state.newCalendarRanges.length > 0){ this.state.newCalendarRanges.map(cr => { postCalendarRange({ @@ -58,13 +71,12 @@ const store = createStore({ endDate: { datetime: `${cr.end.toISOString().split('.')[0]}+0000`, // TODO check if OK with time zone }, - }, 'POST'); + }); }) commit('clearNewCalendarRanges'); } if (this.state.updateCalendarRanges.length > 0){ this.state.updateCalendarRanges.map(cr => { - console.log(cr) patchCalendarRange(cr.id, { startDate: { @@ -79,9 +91,7 @@ const store = createStore({ } if (this.state.deleteCalendarRanges.length > 0){ this.state.deleteCalendarRanges.map(cr => { - postCalendarRange({ - id: cr.id //TODO check functionning - }, 'DELETE'); + deleteCalendarRange(cr.id); }) commit('deleteUpdateCalendarRanges'); } diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_api/api.js b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_api/api.js index c062d0d6e..aa3d12f8d 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_api/api.js +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_api/api.js @@ -38,12 +38,12 @@ const fetchCalendar = (mainUserId) => { /* * Endpoint chill_api_single_calendar_range__entity_create -* method POST or DELETE, post CalendarRange entity +* method POST, post CalendarRange entity */ -const postCalendarRange = (body, method) => { +const postCalendarRange = (body) => { const url = `/api/1.0/calendar/calendar-range.json?`; return fetch(url, { - method: method, + method: 'POST', headers: { 'Content-Type': 'application/json;charset=utf-8' }, @@ -73,11 +73,44 @@ const patchCalendarRange = (id, body) => { }); }; +/* +* Endpoint chill_api_single_calendar_range__entity +* method DELETE, delete CalendarRange entity +*/ +const deleteCalendarRange = (id) => { + const url = `/api/1.0/calendar/calendar-range/${id}.json`; + return fetch(url, { + method: 'DELETE', + headers: { + 'Content-Type': 'application/json;charset=utf-8' + }, + }).then(response => { + if (response.ok) { return response.json(); } + throw Error('Error with request resource response'); + }); +}; + +// const deleteCalendarRange = (id) => { +// const url = `/api/1.0/calendar/calendar-range.json`; +// return fetch(url, { +// method: 'DELETE', +// headers: { +// 'Content-Type': 'application/json;charset=utf-8' +// }, +// body: JSON.stringify({ +// id: id +// }) +// }).then(response => { +// if (response.ok) { return response.json(); } +// throw Error('Error with request resource response'); +// }); +// }; export { fetchCalendarRanges, fetchCalendar, fetchCalendarRangesByUser, postCalendarRange, - patchCalendarRange + patchCalendarRange, + deleteCalendarRange }; diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByUser.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByUser.html.twig index f33e73851..004000fc6 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByUser.html.twig +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByUser.html.twig @@ -19,4 +19,5 @@ {% block css %} {{ parent() }} {{ encore_entry_link_tags('vue_calendar') }} + {{ encore_entry_link_tags('page_calendar') }} {% endblock %} diff --git a/src/Bundle/ChillCalendarBundle/chill.api.specs.yaml b/src/Bundle/ChillCalendarBundle/chill.api.specs.yaml index 1ca66375d..ebe0de88d 100644 --- a/src/Bundle/ChillCalendarBundle/chill.api.specs.yaml +++ b/src/Bundle/ChillCalendarBundle/chill.api.specs.yaml @@ -120,6 +120,56 @@ paths: description: "not found" 401: description: "Unauthorized" + patch: + tags: + - calendar + summary: update a calendar range + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + user: + $ref: '#/components/schemas/User' + startDate: + $ref: '#/components/schemas/Date' + endDate: + $ref: '#/components/schemas/Date' + responses: + 401: + description: "Unauthorized" + 404: + description: "Not found" + 200: + description: "OK" + 422: + description: "Unprocessable entity (validation errors)" + 400: + description: "transition cannot be applyed" + delete: + tags: + - calendar + summary: "Remove a calendar range" + parameters: + - name: id + in: path + required: true + description: The calendar range id + schema: + type: integer + format: integer + minimum: 1 + responses: + 401: + description: "Unauthorized" + 404: + description: "Not found" + 200: + description: "OK" + 422: + description: "object with validation errors" /1.0/calendar/calendar-range-available.json: get: From e1ccc8aba55c02e444d088cd9c5a19d8a7e418a0 Mon Sep 17 00:00:00 2001 From: nobohan Date: Sun, 5 Sep 2021 11:06:39 +0200 Subject: [PATCH 065/217] =?UTF-8?q?rdv:=20edition=20plage=20de=20disponibi?= =?UTF-8?q?lit=C3=A9s:=20copy=20events=20to=20next=20day=20(WIP)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../public/vuejs/MyCalendarRange/App.vue | 65 ++++++++++++++++++- .../public/vuejs/MyCalendarRange/i18n.js | 5 ++ 2 files changed, 68 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue index 320b5a978..48d07a74c 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue @@ -16,6 +16,18 @@ @click.prevent="onClickSave"> {{ $t('action.save')}} +
    + + +
    +
    + + +
    +
    @@ -68,6 +80,17 @@ export default { } } }, + computed: { + showMyCalendarWidget: { + set(value) { + this.toggleMyCalendar(value); + this.updateEventsSource(); + }, + get() { + return this.showMyCalendar; + } + } + }, methods: { init() { this.fetchData() @@ -143,12 +166,50 @@ export default { payload.event.setProp('color', '#3788d8'); this.$store.dispatch('updateRange', payload); }, - onClickSave(payload){ + onClickSave(payload) { this.$store.dispatch('saveRanges', payload); }, - onDelete(payload){ + onDelete(payload) { payload.setProp('color', '#dddddd'); this.$store.dispatch('deleteRange', payload); + }, + copyDay(payload) { + console.log(payload); + // TODO get current day, or get current new events + console.log(this.calendarEvents.new); + if (this.calendarEvents.new.events) { + // TODO copy all events of the **LAST** day and create a array of events for the next day + // TODO if showWeekends, copy on the next day always, else, skip weekends + let events = this.calendarEvents.new.events.map(i => { + let startDate = new Date(new Date(i.start).getTime() + 24*60*60*1000); + let endDate = new Date(new Date(i.end).getTime() + 24*60*60*1000); + return ({ + start: startDate.toISOString(), + end: endDate.toISOString() + }) + } + + ); + let copiedEvents = { + events: events, + color: "#3788d8" + }; + console.log(copiedEvents) + //TODO in a loop : this.$store.dispatch('createRange', payload); + + let newEvents = this.calendarEvents.new.events; + newEvents.push(...copiedEvents.events); + this.calendarEvents.new = { + events: newEvents, + color: "#3788d8" + }; + + console.log(this.calendarEvents.new.events) + this.updateEventsSource(); + } else { + console.log('no new events to copy-paste!') + } + } }, mounted() { diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/i18n.js b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/i18n.js index 2f3f698ce..2d7513327 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/i18n.js +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/i18n.js @@ -1,5 +1,10 @@ const appMessages = { fr: { + edit_your_calendar_range: "Planifiez vos plages de disponibilités", + show_my_calendar: "Afficher mon calendrier", + show_weekends: "Afficher les week-ends", + copy_range_to_next_day: "Copier les plages du jour au jour suivant", + copy_range_to_next_week: "Copier les plages de la semaine à la semaine suivante" } } From 6bfc180951b5a257968c0dc22877604038f2ab89 Mon Sep 17 00:00:00 2001 From: nobohan Date: Sun, 5 Sep 2021 22:29:56 +0200 Subject: [PATCH 066/217] rdv: plages de disponibilites: copy the next day + refresh after save --- .../public/vuejs/MyCalendarRange/App.vue | 128 ++++++++++++++---- .../public/vuejs/MyCalendarRange/i18n.js | 3 +- .../public/vuejs/MyCalendarRange/store.js | 49 ++----- 3 files changed, 109 insertions(+), 71 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue index 48d07a74c..06dcec898 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue @@ -24,10 +24,13 @@
    - +

    {{ $t('copy_range_how_to')}}

    +
    @@ -38,7 +41,7 @@ import FullCalendar from '@fullcalendar/vue3'; import dayGridPlugin from '@fullcalendar/daygrid'; import interactionPlugin from '@fullcalendar/interaction'; import timeGridPlugin from '@fullcalendar/timegrid'; -import { fetchCalendar, fetchCalendarRangesByUser } from '../_api/api'; +import { deleteCalendarRange, fetchCalendar, fetchCalendarRangesByUser, patchCalendarRange, postCalendarRange } from '../_api/api'; export default { name: "App", @@ -77,7 +80,8 @@ export default { center: 'title', right: 'dayGridMonth,timeGridWeek,timeGridDay' }, - } + }, + } }, computed: { @@ -89,11 +93,19 @@ export default { get() { return this.showMyCalendar; } - } - }, + }, + }, methods: { init() { - this.fetchData() + this.fetchData(); + }, + resetCalendar() { + this.fetchData(); + this.calendarEvents.new = { + events: [], + color: "#3788d8" + }; + this.updateEventsSource(); }, fetchData() { fetchCalendarRangesByUser(this.userId).then(calendarRanges => new Promise((resolve, reject) => { @@ -157,6 +169,7 @@ export default { events: events, color: "#3788d8" }; + this.lastNewDate = new Date(payload.startStr); this.updateEventsSource(); this.$store.dispatch('createRange', payload); }, @@ -166,50 +179,107 @@ export default { payload.event.setProp('color', '#3788d8'); this.$store.dispatch('updateRange', payload); }, - onClickSave(payload) { - this.$store.dispatch('saveRanges', payload); + onClickSave(payload) { + if (this.$store.state.newCalendarRanges.length > 0){ + this.$store.state.newCalendarRanges.map(cr => { + postCalendarRange({ + user: { + type: 'user', + id: window.userId, + }, + startDate: { + datetime: `${cr.start.toISOString().split('.')[0]}+0000`, //should be like "2021-08-20T15:00:00+0200", + }, + endDate: { + datetime: `${cr.end.toISOString().split('.')[0]}+0000`, // TODO check if OK with time zone + }, + }).then((_r) => this.resetCalendar()); + }); + this.$store.dispatch('clearNewCalendarRanges', payload); + } + if (this.$store.state.updateCalendarRanges.length > 0){ + this.$store.state.updateCalendarRanges.map(cr => { + patchCalendarRange(cr.id, + { + startDate: { + datetime: `${cr.start.toISOString().split('.')[0]}+0000`, //should be like "2021-08-20T15:00:00+0200", + }, + endDate: { + datetime: `${cr.end.toISOString().split('.')[0]}+0000`, // TODO check if OK with time zone + }, + }).then((_r) => this.resetCalendar()); + }) + this.$store.dispatch('clearUpdateCalendarRanges', payload); + } + if (this.$store.state.deleteCalendarRanges.length > 0){ + this.$store.state.deleteCalendarRanges.map(cr => { + deleteCalendarRange(cr.id).then((_r) => this.resetCalendar());; + }) + this.$store.dispatch('deleteUpdateCalendarRanges', payload); + } + }, onDelete(payload) { payload.setProp('color', '#dddddd'); this.$store.dispatch('deleteRange', payload); }, - copyDay(payload) { - console.log(payload); - // TODO get current day, or get current new events + isSameDay(date1, date2) { + return date1.getFullYear() === date2.getFullYear() && + date1.getMonth() === date2.getMonth() && + date1.getDate() === date2.getDate(); + }, + isFriday(date) { + return date.getDay() === 5 + }, + // disableCopyDayButton() { //TODO does not update! + // return this.calendarEvents.new.events.length === 0 + // }, + copyDay(_payload) { console.log(this.calendarEvents.new); - if (this.calendarEvents.new.events) { - // TODO copy all events of the **LAST** day and create a array of events for the next day - // TODO if showWeekends, copy on the next day always, else, skip weekends - let events = this.calendarEvents.new.events.map(i => { - let startDate = new Date(new Date(i.start).getTime() + 24*60*60*1000); - let endDate = new Date(new Date(i.end).getTime() + 24*60*60*1000); - return ({ - start: startDate.toISOString(), - end: endDate.toISOString() - }) - } - + if (this.calendarEvents.new.events.length > 0) { + // Create the copied events + let increment = !this.calendarOptions.weekends && this.isFriday(this.lastNewDate) ? 24*60*60*1000*3 : 24*60*60*1000; + let events = this.calendarEvents.new.events.filter( + i => this.isSameDay(new Date(i.start), this.lastNewDate)).map( + i => { + let startDate = new Date(new Date(i.start).getTime() + increment); + let endDate = new Date(new Date(i.end).getTime() + increment); + return ({ + start: startDate.toISOString(), + end: endDate.toISOString() + }) + } ); let copiedEvents = { events: events, color: "#3788d8" }; - console.log(copiedEvents) - //TODO in a loop : this.$store.dispatch('createRange', payload); - + console.log(copiedEvents); + + // Add to the calendar let newEvents = this.calendarEvents.new.events; newEvents.push(...copiedEvents.events); this.calendarEvents.new = { events: newEvents, color: "#3788d8" }; - - console.log(this.calendarEvents.new.events) this.updateEventsSource(); + + // Set the last new date + this.lastNewDate = new Date(copiedEvents.events[copiedEvents.events.length - 1].start); + + // Dispatch in store for saving + for (let i = 0; i < copiedEvents.events.length; i++) { + let eventObj = { + start: new Date(copiedEvents.events[i].start), + end: new Date(copiedEvents.events[i].end) + } + this.$store.dispatch('createRange', eventObj); + } + } else { console.log('no new events to copy-paste!') } - } }, mounted() { diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/i18n.js b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/i18n.js index 2d7513327..8353a0a1f 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/i18n.js +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/i18n.js @@ -4,7 +4,8 @@ const appMessages = { show_my_calendar: "Afficher mon calendrier", show_weekends: "Afficher les week-ends", copy_range_to_next_day: "Copier les plages du jour au jour suivant", - copy_range_to_next_week: "Copier les plages de la semaine à la semaine suivante" + copy_range_to_next_week: "Copier les plages de la semaine à la semaine suivante", + copy_range_how_to: "Créez les plages de disponibilités durant une journée et copiez-les facilement au jour suivant avec ce bouton. Si les week-ends sont cachés, le jour suivant un vendredi sera le lundi." } } diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js index 319514fd1..63130e06f 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js @@ -55,48 +55,15 @@ const store = createStore({ console.log('### action deleteRange', payload); commit('deleteRange', payload); }, - saveRanges({ commit }, payload) { - console.log('### action saveRange', payload); - console.log(this.state) - if (this.state.newCalendarRanges.length > 0){ - this.state.newCalendarRanges.map(cr => { - postCalendarRange({ - user: { - type: 'user', - id: window.userId, - }, - startDate: { - datetime: `${cr.start.toISOString().split('.')[0]}+0000`, //should be like "2021-08-20T15:00:00+0200", - }, - endDate: { - datetime: `${cr.end.toISOString().split('.')[0]}+0000`, // TODO check if OK with time zone - }, - }); - }) - commit('clearNewCalendarRanges'); - } - if (this.state.updateCalendarRanges.length > 0){ - this.state.updateCalendarRanges.map(cr => { - patchCalendarRange(cr.id, - { - startDate: { - datetime: `${cr.start.toISOString().split('.')[0]}+0000`, //should be like "2021-08-20T15:00:00+0200", - }, - endDate: { - datetime: `${cr.end.toISOString().split('.')[0]}+0000`, // TODO check if OK with time zone - }, - }); - }) - commit('clearUpdateCalendarRanges'); - } - if (this.state.deleteCalendarRanges.length > 0){ - this.state.deleteCalendarRanges.map(cr => { - deleteCalendarRange(cr.id); - }) - commit('deleteUpdateCalendarRanges'); - } + clearNewCalendarRanges({ commit }, payload) { + commit('clearNewCalendarRanges', payload); }, - + clearUpdateCalendarRanges({ commit }, payload) { + commit('clearUpdateCalendarRanges', payload); + }, + deleteUpdateCalendarRanges({ commit }, payload) { + commit('deleteUpdateCalendarRanges', payload); + } } }); From 0a274eb2a4bd33d2de8a6521be27f3de69ded9e8 Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 6 Sep 2021 13:28:39 +0200 Subject: [PATCH 067/217] Enable DELETE in the ApiController --- .../Controller/CalendarRangeAPIController.php | 6 --- .../CRUD/Controller/ApiController.php | 50 +++++++++++++++++++ 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php index a60eb98b3..672e9527c 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php @@ -38,10 +38,4 @@ class CalendarRangeAPIController extends ApiController //TODO use also the paginator, eg return $this->serializeCollection('get', $request, $_format, $paginator, $results); } - // public function calendarRangeApi($id, Request $request, string $_format): Response - // { - // return $this->addRemoveSomething('calendarRange', $id, $request, $_format, 'calendarRange', CalendarRange::class, [ 'groups' => [ 'read' ] ]); - // } - - } \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php index cab0bcdcb..359ff0384 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php @@ -87,6 +87,8 @@ class ApiController extends AbstractCRUDController return $this->entityPut('_entity', $request, $id, $_format); case Request::METHOD_POST: return $this->entityPostAction('_entity', $request, $id, $_format); + case Request::METHOD_DELETE: + return $this->entityDelete('_entity', $request, $id, $_format); default: throw new \Symfony\Component\HttpFoundation\Exception\BadRequestException("This method is not implemented"); } @@ -217,6 +219,54 @@ class ApiController extends AbstractCRUDController $this->getContextForSerializationPostAlter($action, $request, $_format, $entity) ); } + public function entityDelete($action, Request $request, $id, string $_format): Response + { + $entity = $this->getEntity($action, $id, $request, $_format); + + if (NULL === $entity) { + throw $this->createNotFoundException(sprintf("The %s with id %s " + . "is not found", $this->getCrudName(), $id)); + } + + $response = $this->checkACL($action, $request, $_format, $entity); + if ($response instanceof Response) { + return $response; + } + + $response = $this->onPostCheckACL($action, $request, $_format, $entity); + if ($response instanceof Response) { + return $response; + } + + $response = $this->onBeforeSerialize($action, $request, $_format, $entity); + if ($response instanceof Response) { + return $response; + } + + $errors = $this->validate($action, $request, $_format, $entity); + + $response = $this->onAfterValidation($action, $request, $_format, $entity, $errors); + if ($response instanceof Response) { + return $response; + } + + if ($errors->count() > 0) { + $response = $this->json($errors); + $response->setStatusCode(Response::HTTP_UNPROCESSABLE_ENTITY); + + return $response; + } + + $this->getDoctrine()->getManager()->remove($entity); + $this->getDoctrine()->getManager()->flush(); + + $response = $this->onAfterFlush($action, $request, $_format, $entity, $errors); + if ($response instanceof Response) { + return $response; + } + + return $this->json(Response::HTTP_OK); + } protected function onAfterValidation(string $action, Request $request, string $_format, $entity, ConstraintViolationListInterface $errors, array $more = []): ?Response { From 82e76d7d5a208a93df8887d85f22223ef16d76a9 Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 6 Sep 2021 14:50:48 +0200 Subject: [PATCH 068/217] =?UTF-8?q?rdv:=20plages=20de=20disponibilit=C3=A9?= =?UTF-8?q?s:=20various=20UX/UI=20improvements?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../public/vuejs/MyCalendarRange/App.vue | 91 +++++++++++++++---- .../public/vuejs/MyCalendarRange/i18n.js | 7 +- .../Resources/public/vuejs/_api/api.js | 16 ---- 3 files changed, 77 insertions(+), 37 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue index 06dcec898..1c0e7c4b4 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue @@ -1,6 +1,16 @@ @@ -42,6 +80,7 @@ import dayGridPlugin from '@fullcalendar/daygrid'; import interactionPlugin from '@fullcalendar/interaction'; import timeGridPlugin from '@fullcalendar/timegrid'; import { deleteCalendarRange, fetchCalendar, fetchCalendarRangesByUser, patchCalendarRange, postCalendarRange } from '../_api/api'; +import { mapState } from 'vuex'; export default { name: "App", @@ -51,6 +90,9 @@ export default { data() { return { errorMsg: [], + flag: { + loading: false + }, userId: window.userId, showMyCalendar: true, calendarEvents: { @@ -61,6 +103,8 @@ export default { color: "#3788d8" } }, + lastNewDate: null, + disableCopyDayButton: true, calendarOptions: { locale: frLocale, plugins: [ dayGridPlugin, interactionPlugin, timeGridPlugin ], @@ -85,6 +129,12 @@ export default { } }, computed: { + ...mapState({ + newCalendarRanges: state => state.newCalendarRanges, + updateCalendarRanges: state => state.updateCalendarRanges, + deleteCalendarRanges: state => state.deleteCalendarRanges, + dirty: state => state.newCalendarRanges.length > 0 || state.updateCalendarRanges.length > 0 || state.deleteCalendarRanges.length > 0 + }), showMyCalendarWidget: { set(value) { this.toggleMyCalendar(value); @@ -108,6 +158,7 @@ export default { this.updateEventsSource(); }, fetchData() { + this.flag.loading = true; fetchCalendarRangesByUser(this.userId).then(calendarRanges => new Promise((resolve, reject) => { let events = calendarRanges.results.map(i => ({ @@ -138,6 +189,7 @@ export default { }; this.calendarEvents.userCalendar = calendarEventsCurrentUser; this.updateEventsSource(); + this.flag.loading = false; resolve(); })); @@ -169,6 +221,7 @@ export default { events: events, color: "#3788d8" }; + this.disableCopyDayButton = false; this.lastNewDate = new Date(payload.startStr); this.updateEventsSource(); this.$store.dispatch('createRange', payload); @@ -179,7 +232,8 @@ export default { payload.event.setProp('color', '#3788d8'); this.$store.dispatch('updateRange', payload); }, - onClickSave(payload) { + onClickSave(payload) { + this.flag.loading = true; if (this.$store.state.newCalendarRanges.length > 0){ this.$store.state.newCalendarRanges.map(cr => { postCalendarRange({ @@ -231,9 +285,6 @@ export default { isFriday(date) { return date.getDay() === 5 }, - // disableCopyDayButton() { //TODO does not update! - // return this.calendarEvents.new.events.length === 0 - // }, copyDay(_payload) { console.log(this.calendarEvents.new); if (this.calendarEvents.new.events.length > 0) { diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/i18n.js b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/i18n.js index 8353a0a1f..96eca1d6a 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/i18n.js +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/i18n.js @@ -4,8 +4,13 @@ const appMessages = { show_my_calendar: "Afficher mon calendrier", show_weekends: "Afficher les week-ends", copy_range_to_next_day: "Copier les plages du jour au jour suivant", + copy_range_from_day: "Copier les plages du ", + to_the_next_day: " au jour suivant", copy_range_to_next_week: "Copier les plages de la semaine à la semaine suivante", - copy_range_how_to: "Créez les plages de disponibilités durant une journée et copiez-les facilement au jour suivant avec ce bouton. Si les week-ends sont cachés, le jour suivant un vendredi sera le lundi." + copy_range_how_to: "Créez les plages de disponibilités durant une journée et copiez-les facilement au jour suivant avec ce bouton. Si les week-ends sont cachés, le jour suivant un vendredi sera le lundi.", + new_range_to_save: "Nouvelles plages à enregistrer", + update_range_to_save: "Plages à modifier", + delete_range_to_save: "Plages à supprimer" } } diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_api/api.js b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_api/api.js index aa3d12f8d..7aad8ace2 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_api/api.js +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/_api/api.js @@ -90,22 +90,6 @@ const deleteCalendarRange = (id) => { }); }; -// const deleteCalendarRange = (id) => { -// const url = `/api/1.0/calendar/calendar-range.json`; -// return fetch(url, { -// method: 'DELETE', -// headers: { -// 'Content-Type': 'application/json;charset=utf-8' -// }, -// body: JSON.stringify({ -// id: id -// }) -// }).then(response => { -// if (response.ok) { return response.json(); } -// throw Error('Error with request resource response'); -// }); -// }; - export { fetchCalendarRanges, fetchCalendar, From c42ec1d49353530f34a8b999f548561c0f13895a Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 6 Sep 2021 15:37:54 +0200 Subject: [PATCH 069/217] rdv: plages de disponibilites: remove new events before it was saved --- .../public/vuejs/MyCalendarRange/App.vue | 24 +++++++++++++++---- .../public/vuejs/MyCalendarRange/store.js | 15 +++++++++--- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue index 1c0e7c4b4..8572ff4fa 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue @@ -133,7 +133,7 @@ export default { newCalendarRanges: state => state.newCalendarRanges, updateCalendarRanges: state => state.updateCalendarRanges, deleteCalendarRanges: state => state.deleteCalendarRanges, - dirty: state => state.newCalendarRanges.length > 0 || state.updateCalendarRanges.length > 0 || state.deleteCalendarRanges.length > 0 + dirty: state => state.newCalendarRanges.length > 0 || state.updateCalendarRanges.length > 0 || state.deleteCalendarRanges.length > 0 }), showMyCalendarWidget: { set(value) { @@ -269,13 +269,29 @@ export default { this.$store.state.deleteCalendarRanges.map(cr => { deleteCalendarRange(cr.id).then((_r) => this.resetCalendar());; }) - this.$store.dispatch('deleteUpdateCalendarRanges', payload); + this.$store.dispatch('clearDeleteCalendarRanges', payload); } }, onDelete(payload) { - payload.setProp('color', '#dddddd'); - this.$store.dispatch('deleteRange', payload); + if (payload.extendedProps.hasOwnProperty("calendarRangeId")) { + payload.setProp('color', '#dddddd'); + this.$store.dispatch('deleteRange', payload); + } else { + let newEvents = this.calendarEvents.new.events; + let filterEvents = newEvents.filter((e) => + e.start !== payload.startStr && e.end !== payload.endStr + ); + this.calendarEvents.new = { + events: filterEvents, + color: "#3788d8" + }; + + this.$store.dispatch('removeNewCalendarRanges', payload); + + this.updateEventsSource(); + } + }, isSameDay(date1, date2) { return date1.getFullYear() === date2.getFullYear() && diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js index 63130e06f..7db701a0d 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js @@ -38,8 +38,14 @@ const store = createStore({ clearUpdateCalendarRanges(state) { state.updateCalendarRanges = []; }, - deleteUpdateCalendarRanges(state) { + clearDeleteCalendarRanges(state) { state.deleteCalendarRanges = []; + }, + removeNewCalendarRanges(state, payload) { + let filteredCollection = state.newCalendarRanges.filter( + (e) => e.start.toString() !== payload.start.toString() && e.end.toString() !== payload.end.toString() + ) + state.newCalendarRanges = filteredCollection; } }, actions: { @@ -61,8 +67,11 @@ const store = createStore({ clearUpdateCalendarRanges({ commit }, payload) { commit('clearUpdateCalendarRanges', payload); }, - deleteUpdateCalendarRanges({ commit }, payload) { - commit('deleteUpdateCalendarRanges', payload); + clearDeleteCalendarRanges({ commit }, payload) { + commit('clearDeleteCalendarRanges', payload); + }, + removeNewCalendarRanges({ commit }, payload) { + commit('removeNewCalendarRanges', payload); } } }); From 0ab53f465955e5c0809202212aaaff939c4d1ac0 Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 10 Sep 2021 09:16:02 +0200 Subject: [PATCH 070/217] rdv: add header --- .../Resources/views/Calendar/list.html.twig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/list.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/list.html.twig index 71b2e98a6..331544854 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/list.html.twig +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/list.html.twig @@ -18,6 +18,9 @@
    {% endif %} +{% if context == 'user' %} +

    {{ 'My calendar list' |trans }}

    +{% endif %} {% if calendarItems|length == 0 %}

    From 29c148f92457ac64f8ac8ba8d2d2eedc1c384eb9 Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 10 Sep 2021 13:38:13 +0200 Subject: [PATCH 071/217] rdv: can remove from delete calendar ranges --- .../public/vuejs/MyCalendarRange/App.vue | 18 +++++++++++++----- .../public/vuejs/MyCalendarRange/store.js | 13 +++++++++++-- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue index 8572ff4fa..0a7d83db6 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue @@ -17,7 +17,7 @@ {{ arg.timeText }}  {{ arg.event.title }} + @click.prevent="onClickDelete(arg.event)"> @@ -164,7 +164,8 @@ export default { ({ start: i.startDate.datetime, end: i.endDate.datetime, - calendarRangeId: i.id + calendarRangeId: i.id, + toDelete: 0 }) ); let calendarRangeEvents = { @@ -273,10 +274,17 @@ export default { } }, - onDelete(payload) { + onClickDelete(payload) { if (payload.extendedProps.hasOwnProperty("calendarRangeId")) { - payload.setProp('color', '#dddddd'); - this.$store.dispatch('deleteRange', payload); + if (payload.extendedProps.toDelete === 1) { + payload.setExtendedProp('toDelete', 0) + payload.setProp('color', '#79bafc'); + this.$store.dispatch('removeFromDeleteRange', payload); + } else { + payload.setExtendedProp('toDelete', 1) + payload.setProp('color', '#dddddd'); + this.$store.dispatch('deleteRange', payload); + } } else { let newEvents = this.calendarEvents.new.events; let filterEvents = newEvents.filter((e) => diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js index 7db701a0d..997f95b11 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store.js @@ -46,7 +46,13 @@ const store = createStore({ (e) => e.start.toString() !== payload.start.toString() && e.end.toString() !== payload.end.toString() ) state.newCalendarRanges = filteredCollection; - } + }, + removeFromDeleteRange(state, payload) { + let filteredCollection = state.deleteCalendarRanges.filter( + (e) => e.start.toString() !== payload.start.toString() && e.end.toString() !== payload.end.toString() + ) + state.deleteCalendarRanges = filteredCollection; + }, }, actions: { createRange({ commit }, payload) { @@ -72,7 +78,10 @@ const store = createStore({ }, removeNewCalendarRanges({ commit }, payload) { commit('removeNewCalendarRanges', payload); - } + }, + removeFromDeleteRange({ commit }, payload) { + commit('removeFromDeleteRange', payload); + }, } }); From f6f24d0bebe4225322332e79ca72d376ada01ef7 Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 10 Sep 2021 14:06:35 +0200 Subject: [PATCH 072/217] rdv: style my calendar --- .../public/vuejs/MyCalendarRange/App.vue | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue index 0a7d83db6..56d914b95 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue @@ -169,9 +169,10 @@ export default { }) ); let calendarRangeEvents = { - events: events, - color: '#79bafc', - textColor: '#444444' + events: events, + borderColor: "#3788d8", + backgroundColor: '#ffffff', + textColor: '#444444', }; this.calendarEvents.userCalendarRange = calendarRangeEvents; @@ -220,7 +221,9 @@ export default { }); this.calendarEvents.new = { events: events, - color: "#3788d8" + borderColor: "#3788d8", + backgroundColor: '#fffadf ', + textColor: '#444444', }; this.disableCopyDayButton = false; this.lastNewDate = new Date(payload.startStr); @@ -230,7 +233,9 @@ export default { onEventChange(payload) { }, onEventDropOrResize(payload) { - payload.event.setProp('color', '#3788d8'); + payload.event.setProp('borderColor', '#3788d8'); + payload.event.setProp('backgroundColor', '#fffadf'); + payload.event.setProp('textColor', '#444444'); this.$store.dispatch('updateRange', payload); }, onClickSave(payload) { @@ -278,11 +283,11 @@ export default { if (payload.extendedProps.hasOwnProperty("calendarRangeId")) { if (payload.extendedProps.toDelete === 1) { payload.setExtendedProp('toDelete', 0) - payload.setProp('color', '#79bafc'); + payload.setProp('borderColor', '#79bafc'); this.$store.dispatch('removeFromDeleteRange', payload); } else { payload.setExtendedProp('toDelete', 1) - payload.setProp('color', '#dddddd'); + payload.setProp('borderColor', '#dddddd'); this.$store.dispatch('deleteRange', payload); } } else { From c89e2662b1b281f6e0b8ae841eea410cb6c5f1d6 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 10 Sep 2021 12:29:06 +0200 Subject: [PATCH 073/217] household resume page, improve ux --- .../Resources/views/Form/fields.html.twig | 6 + .../Resources/public/chill/chillperson.scss | 23 ++ .../Address/_insert_vue_address.html.twig | 3 + .../views/Household/_render_member.html.twig | 2 +- .../views/Household/layout.html.twig | 4 + .../views/Household/summary.html.twig | 308 ++++++++++-------- .../translations/messages+intl-icu.fr.yaml | 5 +- 7 files changed, 210 insertions(+), 141 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/views/Form/fields.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Form/fields.html.twig index 1e2bf713f..ce406286b 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Form/fields.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Form/fields.html.twig @@ -192,3 +192,9 @@ {% endif %} {% endfor %} {% endblock %} + +{% block comment_widget %} + {% for entry in form %} + {{ form_widget(entry) }} + {% endfor %} +{% endblock comment_widget %} diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss index f3759aef7..071d0f9a5 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss +++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss @@ -185,6 +185,29 @@ div.banner { } } +div.household-resume { + display: flex; + flex-direction: row; + align-items: center; + + div.col-address { + font-size: 120%; + padding-left: 1em; + + } + div.col-comment { + //padding: 0; + margin-bottom: 1rem; + display: flex; + flex-direction: column; + > * > * { + & > .chill-user-quote { + margin: 1.5em -1.67em 0; + } + } + } +} + /* * BADGES, MARKS, PINS * for chill person theme diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Address/_insert_vue_address.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Address/_insert_vue_address.html.twig index 8038257d6..e235aae15 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Address/_insert_vue_address.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Address/_insert_vue_address.html.twig @@ -9,6 +9,9 @@ * modalTitle twig translated chain * buttonText twig translated chain * buttonSize bootstrap class like 'btn-sm' + * buttonDisplayText bool + * binModalStep1 bool + * binModalStep2 bool #}

    diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Household/_render_member.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Household/_render_member.html.twig index 25160ff5b..5b41a15e3 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Household/_render_member.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Household/_render_member.html.twig @@ -31,7 +31,7 @@
  • diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Household/layout.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Household/layout.html.twig index d97de654f..0bd208e7a 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Household/layout.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Household/layout.html.twig @@ -17,4 +17,8 @@ 'layout': '@ChillPerson/menu.html.twig', 'args' : { 'household': household } }) }} + + {% block block_post_menu %} + {% endblock %} + {% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig index 1568b6bed..9b553f0f0 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig @@ -2,163 +2,195 @@ {% block title 'household.Household summary'|trans %} +{% block block_post_menu %} +
    +{% endblock %} + {% block content %}
    -

    {{ block('title') }}

    + {# +

    {{ block('title') }}

    +

    {{ 'household.Current address'|trans }}

    + #} -

    {{ 'household.Current address'|trans }}

    + {% set address = household.currentAddress %} -{% set address = household.currentAddress %} - -{% if address is empty %} -

    {{ 'household.Household does not have any address currently'|trans }}

    -{% else %} -
    -
    - {{ address|chill_entity_render_box({'multiline': true}) }} -
    -
    -{% endif %} - -

    {{ 'household.Household members'|trans }}

    - -{% if form is not null %} - {{ form_start(form) }} - - {{ form_row(form.commentMembers) }} - -
    - {{ form_row(form.waitingForBirth) }} -
    - -
    - {{ form_row(form.waitingForBirthDate) }} -
    - -
      -
    • - -
    • -
    - - {{ form_end(form) }} -{% else %} - - {% if not household.commentMembers.isEmpty() %} - {{ household.commentMembers|chill_entity_render_box }} - {% endif %} - - {% if household.waitingForBirth %} - {% if household.waitingForBirthDate is not null %} - {{ 'household.Expecting for birth on date'|trans({ 'date': household.waitingForBirthDate|format_date('long') }) }} + {% if address is empty %} +

    {{ 'household.Household does not have any address currently'|trans }}

    {% else %} - {{ 'household.Expecting for birth'|trans }} +
    + +
    + +

    {{ 'Address'|trans }}

    + + {{ address|chill_entity_render_box({'multiline': true}) }} + +
      +
    • + {# include vue_address component #} + {% include '@ChillPerson/Address/_insert_vue_address.html.twig' with { + mode: 'create', + buttonSize: 'btn-sm', + buttonText: 'Move household', + modalTitle: 'Move household', + buttonDisplayText: false + } %} +
    • +
    • + + + +
    • +
    + +
    +
    + {% if form is null %} + + {% if household.waitingForBirth or not household.commentMembers.isEmpty() %} +
    + {% if household.waitingForBirth %} + + {% if household.waitingForBirthDate is not null %} + {{ 'household.Expecting for birth on date'|trans({ 'date': household.waitingForBirthDate|format_date('long') }) }} + {% else %} + {{ 'household.Expecting for birth'|trans }} + {% endif %} + {% endif %} + + {% if not household.commentMembers.isEmpty() %} + {{ household.commentMembers|chill_entity_render_box }} + {% endif %} +
    + {% endif %} + + {% if not household.commentMembers.isEmpty() %} + + {{ 'household.Edit comment and expecting birth'|trans }} + + {% else %} + + {{ 'household.New comment and expecting birth'|trans }} + + {% endif %} + + {% else %} + + {{ form_start(form) }} +
    + {{ form_widget(form.waitingForBirth) }} +
    +
    + {{ form_widget(form.waitingForBirthDate) }} +
    +
    + {{ form_widget(form.commentMembers) }} +
    +
      +
    • + +
    • +
    + {{ form_end(form) }} + + {% endif %} + +
    +
    {% endif %} - {% else %} -

    - {{ 'household.Any expecting birth'|trans }} -

    - {% endif %} - +

    {{ 'household.Household members'|trans }}

    -{% endif %} + {% for p in positions %} +
    +

    {{ p.label|localize_translatable_string }} + {% if false == p.shareHousehold %} + + {% endif %} +

    + {%- set members = household.currentMembersByPosition(p) %} -{% for p in positions %} -
    -

    {{ p.label|localize_translatable_string }} - {% if false == p.shareHousehold %} - + {% macro customButtons(member, household) %} +
  • + +
  • +
  • + +
  • + {% endmacro %} + + {% if members|length > 0 %} +
    + {% for m in members %} + {% include '@ChillPerson/Household/_render_member.html.twig' with { + 'member': m, + 'customButtons': { 'after': _self.customButtons(m, household) } + } %} + {% endfor %} +
    + {% else %} +

    {{ 'household.Any persons into this position'|trans }}

    {% endif %} -

    - {%- set members = household.currentMembersByPosition(p) %} + {% set members = household.nonCurrentMembersByPosition(p) %} + {% if members|length > 0 %} - {% macro customButtons(member, household) %} -
  • - - {{ 'household.Leave'|trans }} -
  • -
  • - -
  • - {% endmacro %} - - {% if members|length > 0 %} -
    - {% for m in members %} - {% include '@ChillPerson/Household/_render_member.html.twig' with { - 'member': m, - 'customButtons': { 'after': _self.customButtons(m, household) } - } %} - {% endfor %} -
    - {% else %} -

    {{ 'household.Any persons into this position'|trans }}

    - {% endif %} - - {% set members = household.nonCurrentMembersByPosition(p) %} - {% if members|length > 0 %} - - -
    -
    -

    - -

    -
    -
    - {% for m in members %} - {% include '@ChillPerson/Household/_render_member.html.twig' with { 'member': m } %} - {% endfor %} + +
    +
    +

    + +

    +
    +
    + {% for m in members %} + {% include '@ChillPerson/Household/_render_member.html.twig' with { 'member': m } %} + {% endfor %} +
    + {% endif %} +
    - {% endif %} + {% endfor %} -
    -{% endfor %} - - +
    {% endblock %} diff --git a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml index f1362e7ae..cea908ccf 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml +++ b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml @@ -43,7 +43,7 @@ household: Current household members: Membres actuels Household summary: Résumé du ménage Accompanying period: Parcours d'accompagnement - Addresses: Adresses + Addresses: Historique adresse Current address: Adresse actuelle Household does not have any address currently: Le ménage n'a pas d'adresse renseignée actuellement Edit household members: Modifier l'appartenance au ménage @@ -56,7 +56,8 @@ household: Expecting for birth on date: Naissance attendue pour le {date} Expecting for birth: Naissance attendue (date inconnue) Any expecting birth: Aucune naissance proche n'a été renseignée. - Comment and expecting birth: Mettre à jour le commentaire + New comment and expecting birth: Écrire un commentaire + Edit comment and expecting birth: Mettre à jour le commentaire Edit member metadata: Données supplémentaires comment_membership: Commentaire général sur les membres expecting_birth: Naissance attendue ? From fa938471aa205a6efe117429c1af61fc453aa29e Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 10 Sep 2021 16:39:59 +0200 Subject: [PATCH 074/217] vue_accourse: move no-household warning above table --- .../components/PersonsAssociated.vue | 45 +++++++++---------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue index da1b4c4e6..f04674cef 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue @@ -9,6 +9,26 @@
    +
    + +
    +
    + +
    +

    {{ $t('persons_associated.person_without_household_warning') }}

    +
    + + +
    +
    +
    +
    -
    - -
    -
    - -
    -

    {{ $t('persons_associated.person_without_household_warning') }}

    -
    - - -
    - -
    - - -
    -
    @@ -118,7 +115,7 @@ export default { div#accompanying-course { div.vue-component { & > div.alert { - margin: 1em 0 0; + margin: 0 0 -1em; } div.no-household { display: flex; From da9d81dc050f0a28dd84536ec6f0c20e0fbe9451 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 10 Sep 2021 17:18:43 +0200 Subject: [PATCH 075/217] vue_accourse: GET form submit for no_household persons --- .../components/PersonsAssociated.vue | 47 ++++++++++++------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue index f04674cef..79a9df5a6 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue @@ -11,22 +11,30 @@
    -
    -
    - -
    -

    {{ $t('persons_associated.person_without_household_warning') }}

    -
    - - -
    -
    +
    +
    +
    + +
    +

    {{ $t('persons_associated.person_without_household_warning') }}

    +
    + + +
    + + + +
    +
    @@ -78,6 +86,7 @@ export default { }, computed: { ...mapState({ + courseId: state => state.accompanyingCourse.id, participations: state => state.accompanyingCourse.participations }), currentParticipations() { @@ -88,6 +97,9 @@ export default { }, participationWithoutHousehold() { return this.currentParticipations.filter(p => p.person.current_household_id === null); + }, + getReturnPath() { + return window.location.pathname + window.location.search + window.location.hash; } }, methods: { @@ -118,6 +130,7 @@ div#accompanying-course { margin: 0 0 -1em; } div.no-household { + padding-bottom: 1.5em; display: flex; flex-direction: row; & > i { @@ -125,7 +138,7 @@ div#accompanying-course { padding-top: 0.2em; opacity: 0.75; } - & > div { + & > form { flex-basis: auto; div.action { button.btn-update { From 855686c0bad80d08886cdb593a1945fb87ca821f Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 10 Sep 2021 17:31:19 +0200 Subject: [PATCH 076/217] rdv: add content of calendar item in a modal --- .../ChillCalendarBundle/Entity/Calendar.php | 5 + .../public/vuejs/MyCalendarRange/App.vue | 94 ++++++- .../public/vuejs/MyCalendarRange/i18n.js | 4 +- .../Resources/views/Calendar/list.html.twig | 231 +++++++++--------- 4 files changed, 210 insertions(+), 124 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php index 0663ca08b..fbde03af2 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php +++ b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php @@ -37,12 +37,14 @@ class Calendar * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") + * @Serializer\Groups({"calendar:read"}) */ private ?int $id; /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") * @Groups({"read"}) + * @Serializer\Groups({"calendar:read"}) */ private User $user; @@ -64,6 +66,7 @@ class Calendar * cascade={"persist", "remove", "merge", "detach"}) * @ORM\JoinTable(name="chill_calendar.calendar_to_persons") * @Groups({"read"}) + * @Serializer\Groups({"calendar:read"}) */ private Collection $persons; @@ -74,6 +77,7 @@ class Calendar * cascade={"persist", "remove", "merge", "detach"}) * @ORM\JoinTable(name="chill_calendar.calendar_to_thirdparties") * @Groups({"read"}) + * @Serializer\Groups({"calendar:read"}) */ private Collection $professionals; @@ -89,6 +93,7 @@ class Calendar /** * @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="comment_") + * @Serializer\Groups({"calendar:read"}) */ private CommentEmbeddable $comment; diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue index 56d914b95..214b8d941 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue @@ -14,9 +14,9 @@ + +{{ encore_entry_script_tags('vue_address') }} +{{ encore_entry_link_tags('vue_address') }} + +{# TODO + * un seul fichier include twig qui fais la liaison avec vue_address + * dans main + * enlever les références à household, person, thirdparty + * addAddress + * option buttonText est buggée + * gestion du step1 + * + +#} diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig index 1997466c2..fc0bb1a88 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig @@ -31,7 +31,36 @@ {{ form_row(form.telephone) }} {{ form_row(form.email) }} - {{ form_row(form.address) }} + +
    + {{ form_label(form.address) }} + {{ form_widget(form.address) }} +
    + new tp => + {% if thirdParty.address %} + edit address + {# include vue_address component #} + {% include '@ChillThirdParty/Address/_insert_vue_address.html.twig' with { + mode: 'edit', + address_id: thirdParty.address.id, + buttonSize: 'btn-sm', + binModalStep1: false, + backUrl: path('chill_3party_3party_new') + } %} + {% else %} + create address + {# include vue_address component #} + {% include '@ChillThirdParty/Address/_insert_vue_address.html.twig' with { + mode: 'create', + buttonSize: 'btn-sm', + buttonText: 'Create a new address', + modalTitle: 'Create a new address', + binModalStep1: false, + backUrl: path('chill_3party_3party_new') + } %} + {% endif %} +
    +
    {{ form_row(form.comment) }} {{ form_row(form.centers) }} diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig index 85c8dd41d..ccc624e0c 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig @@ -48,7 +48,32 @@ {{ form_row(form.telephone) }} {{ form_row(form.email) }} - {{ form_row(form.address) }} + +
    + {{ form_label(form.address) }} + {{ form_widget(form.address) }} +
    + update tp => + {% if thirdParty.address %} + edit address + {# include vue_address component #} + {% include '@ChillThirdParty/Address/_insert_vue_address.html.twig' with { + mode: 'edit', + address_id: thirdParty.address.id, + buttonSize: 'btn-sm', + binModalStep1: false + } %} + {% else %} + create address + {# include vue_address component #} + {% include '@ChillThirdParty/Address/_insert_vue_address.html.twig' with { + mode: 'create', + buttonSize: 'btn-sm', + binModalStep1: false + } %} + {% endif %} +
    +
    {{ form_row(form.comment) }} {{ form_row(form.centers) }} From 6e31e01e5158dce1f24f541afd03d6f099721db0 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 15 Sep 2021 16:11:25 +0200 Subject: [PATCH 114/217] tp: rename field translation --- .../Resources/public/module/ckeditor5/index.js | 4 ++-- .../Resources/views/ThirdParty/update.html.twig | 2 +- src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/index.js b/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/index.js index 678f418b0..ddbc4afa7 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/index.js @@ -52,10 +52,10 @@ Fields.forEach(function(field) { ClassicEditor .create( field ) .then( editor => { - console.log( 'CkEditor was initialized', editor ); + //console.log( 'CkEditor was initialized', editor ); }) .catch( error => { console.error( error.stack ); }) ; -}); \ No newline at end of file +}); diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig index ccc624e0c..768f4369e 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig @@ -5,7 +5,7 @@ {% block content %}
    -
    +

    {{ 'Update third party %name%'|trans({ '%name%': thirdParty.name }) }} diff --git a/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml b/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml index dd4cef51f..7878ec196 100644 --- a/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml @@ -12,7 +12,7 @@ thirdparty.No_phonenumber: Aucun numéro de téléphone thirdparty.No_email: Aucun email thirdparty.No_comment: Aucun commentaire -thirdparty.NameCompany: Raison sociale +thirdparty.NameCompany: Service/Département thirdparty.Acronym: Sigle thirdparty.Categories: Catégories thirdparty.Child: Personne de contact From 683eac91d8e91d6bfcccd35e55992d5d9b752908 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 15 Sep 2021 16:06:15 +0200 Subject: [PATCH 115/217] thirdparty, manage case with only one type in that case, type field is hidden, uniq type is automatically written in table --- .../Form/ThirdPartyType.php | 71 +++++++++++++------ .../Resources/views/ThirdParty/new.html.twig | 2 +- .../views/ThirdParty/update.html.twig | 2 +- 3 files changed, 50 insertions(+), 25 deletions(-) diff --git a/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php b/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php index 30323794e..2ec113eb9 100644 --- a/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php +++ b/src/Bundle/ChillThirdPartyBundle/Form/ThirdPartyType.php @@ -62,6 +62,35 @@ class ThirdPartyType extends AbstractType foreach ($this->typesManager->getProviders() as $key => $provider) { $types['chill_3party.key_label.'.$key] = $key; } + if (count($types) === 1) { + $builder + ->add('type', HiddenType::class, [ + 'data' => array_values($types) + ]) + ->get('type') + ->addModelTransformer(new CallbackTransformer( + function (?array $typeArray): ?string { + if (null === $typeArray) { + return null; + } + return implode(',', $typeArray); + }, + function (?string $typeStr): ?array { + if (null === $typeStr) { + return null; + } + return explode(',', $typeStr); + } + )) + ; + } else { + $builder->add('type', ChoiceType::class, [ + 'choices' => $types, + 'expanded' => true, + 'multiple' => true, + 'label' => 'thirdparty.Type' + ]); + } $builder ->add('name', TextType::class, [ @@ -81,12 +110,6 @@ class ThirdPartyType extends AbstractType 'multiple' => true, 'attr' => ['class' => 'select2'] ]) - ->add('type', ChoiceType::class, [ - 'choices' => $types, - 'expanded' => true, - 'multiple' => true, - 'label' => 'thirdparty.Type' - ]) ->add('telephone', TextType::class, [ 'label' => 'Phonenumber', 'required' => false @@ -113,24 +136,26 @@ class ThirdPartyType extends AbstractType 'attr' => ['class' => 'select2'] ]) ; - $builder->add('address', HiddenType::class); - $builder->get('address') - ->addModelTransformer(new CallbackTransformer( - function (?Address $address): string { - if (null === $address) { - return ''; + + $builder + ->add('address', HiddenType::class) + ->get('address') + ->addModelTransformer(new CallbackTransformer( + function (?Address $address): string { + if (null === $address) { + return ''; + } + return $address->getId(); + }, + function (?string $addressId): ?Address { + if (null === $addressId) { + return null; + } + return $this->om + ->getRepository(Address::class) + ->findOneBy(['id' => (int) $addressId]); } - return $address->getId(); - }, - function (string $addressId): ?Address { - if ('' === $addressId) { - return null; - } - return $this->om - ->getRepository(Address::class) - ->findOneBy(['id' => (int) $addressId]); - } - )) + )) ; // Contact Person ThirdParty (child) diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig index fc0bb1a88..4fa9847c0 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig @@ -26,8 +26,8 @@ {{ form_row(form.profession) }} {% endif %} - {{ form_row(form.categories) }} {{ form_row(form.type) }} + {{ form_row(form.categories) }} {{ form_row(form.telephone) }} {{ form_row(form.email) }} diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig index 768f4369e..340ecf15b 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig @@ -43,8 +43,8 @@ {{ form_row(form.profession) }} {% endif %} - {{ form_row(form.categories) }} {{ form_row(form.type) }} + {{ form_row(form.categories) }} {{ form_row(form.telephone) }} {{ form_row(form.email) }} From c2f75654dd8b683da68d9f22e3a9342628502766 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 15 Sep 2021 18:17:06 +0200 Subject: [PATCH 116/217] move _insert_vue_address include template in main, make it more generic because it is used with person and household, but prepare to extend for thirdparty --- .../Address/_insert_vue_address.html.twig | 30 +++++++------------ .../Resources/views/Address/edit.html.twig | 4 ++- .../Resources/views/Address/list.html.twig | 18 +++++++---- .../Resources/views/Address/new.html.twig | 4 ++- .../views/Household/address_edit.html.twig | 4 ++- .../views/Household/address_move.html.twig | 4 ++- .../views/Household/addresses.html.twig | 7 +++-- .../views/Household/summary.html.twig | 4 ++- 8 files changed, 42 insertions(+), 33 deletions(-) rename src/Bundle/{ChillPersonBundle => ChillMainBundle}/Resources/views/Address/_insert_vue_address.html.twig (67%) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Address/_insert_vue_address.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Address/_insert_vue_address.html.twig similarity index 67% rename from src/Bundle/ChillPersonBundle/Resources/views/Address/_insert_vue_address.html.twig rename to src/Bundle/ChillMainBundle/Resources/views/Address/_insert_vue_address.html.twig index e235aae15..fabfc69cb 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Address/_insert_vue_address.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Address/_insert_vue_address.html.twig @@ -3,8 +3,12 @@ It push all variables from context in Address/App.vue. OPTIONS - * mode string ['edit*'|'new'|'create'] - * address_id integer + * targetEntity { + name: string + id: integer + } + * mode string ['edit*'|'create'] + * addressId integer * backUrl twig route: path('route', {parameters}) * modalTitle twig translated chain * buttonText twig translated chain @@ -19,29 +23,18 @@ - -{{ encore_entry_script_tags('vue_address') }} -{{ encore_entry_link_tags('vue_address') }} - -{# TODO - * un seul fichier include twig qui fais la liaison avec vue_address - * dans main - * enlever les références à household, person, thirdparty - * addAddress - * option buttonText est buggée - * gestion du step1 - * - -#} diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig index 4fa9847c0..682764f7c 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig @@ -40,23 +40,25 @@ {% if thirdParty.address %} edit address {# include vue_address component #} - {% include '@ChillThirdParty/Address/_insert_vue_address.html.twig' with { + {% include '@ChillMain/Address/_insert_vue_address.html.twig' with { + targetEntity: { name: 'thirdparty', id: thirdParty.id }, + backUrl: path('chill_3party_3party_new') mode: 'edit', - address_id: thirdParty.address.id, + addressId: thirdParty.address.id, buttonSize: 'btn-sm', binModalStep1: false, - backUrl: path('chill_3party_3party_new') } %} {% else %} create address {# include vue_address component #} - {% include '@ChillThirdParty/Address/_insert_vue_address.html.twig' with { + {% include '@ChillMain/Address/_insert_vue_address.html.twig' with { + targetEntity: { name: 'thirdparty', id: thirdParty.id }, + backUrl: path('chill_3party_3party_new') mode: 'create', buttonSize: 'btn-sm', buttonText: 'Create a new address', modalTitle: 'Create a new address', binModalStep1: false, - backUrl: path('chill_3party_3party_new') } %} {% endif %}

    diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig index 340ecf15b..b2cc7f56d 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig @@ -57,16 +57,20 @@ {% if thirdParty.address %} edit address {# include vue_address component #} - {% include '@ChillThirdParty/Address/_insert_vue_address.html.twig' with { + {% include '@ChillMain/Address/_insert_vue_address.html.twig' with { + targetEntity: { name: 'thirdparty', id: thirdParty.id }, + backUrl: path('chill_3party_3party_update', { thirdparty_id: thirdParty_id }), mode: 'edit', - address_id: thirdParty.address.id, + addressId: thirdParty.address.id, buttonSize: 'btn-sm', binModalStep1: false } %} {% else %} create address {# include vue_address component #} - {% include '@ChillThirdParty/Address/_insert_vue_address.html.twig' with { + {% include '@ChillMain/Address/_insert_vue_address.html.twig' with { + targetEntity: { name: 'thirdparty', id: thirdParty.id }, + backUrl: path('chill_3party_3party_update', { thirdparty_id: thirdParty_id }), mode: 'create', buttonSize: 'btn-sm', binModalStep1: false From 310e9f5a82b4b89e031159a5643cac2dcce16270 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 15 Sep 2021 18:41:14 +0200 Subject: [PATCH 118/217] tp: adapt _insert_vue_address include parameters --- .../Resources/views/ThirdParty/update.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig index b2cc7f56d..820330f95 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig @@ -59,7 +59,7 @@ {# include vue_address component #} {% include '@ChillMain/Address/_insert_vue_address.html.twig' with { targetEntity: { name: 'thirdparty', id: thirdParty.id }, - backUrl: path('chill_3party_3party_update', { thirdparty_id: thirdParty_id }), + backUrl: path('chill_3party_3party_update', { thirdparty_id: thirdParty.id }), mode: 'edit', addressId: thirdParty.address.id, buttonSize: 'btn-sm', @@ -70,7 +70,7 @@ {# include vue_address component #} {% include '@ChillMain/Address/_insert_vue_address.html.twig' with { targetEntity: { name: 'thirdparty', id: thirdParty.id }, - backUrl: path('chill_3party_3party_update', { thirdparty_id: thirdParty_id }), + backUrl: path('chill_3party_3party_update', { thirdparty_id: thirdParty.id }), mode: 'create', buttonSize: 'btn-sm', binModalStep1: false From 17a3f45247a07f74a26e5425b34058314a7e1d38 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 16 Sep 2021 15:48:45 +0200 Subject: [PATCH 119/217] AddAddress final submit, managed by callback and not an event --- .../Resources/public/vuejs/Address/App.vue | 20 +++--- .../vuejs/Address/components/AddAddress.vue | 70 ++++++++++++------- .../Address/components/ShowAddressPane.vue | 13 ++-- .../Resources/views/ThirdParty/show.html.twig | 4 +- 4 files changed, 63 insertions(+), 44 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue index 249b53588..b79840998 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue @@ -4,7 +4,7 @@ v-bind:context="context" v-bind:options="addAddress.options" v-bind:result="addAddress.result" - @submitAddress="submitAddress" + v-bind:addressChanged="submitAddress" ref="addAddress"> @@ -73,13 +73,11 @@ export default { displayErrors() { return this.$refs.addAddress.errorMsg; }, - submitAddress() { - console.log('@@@ click on Submit Address Button'); - let payload = this.$refs.addAddress.submitNewAddress(); // Cast child method - this.addDateToAddressAndPostAddressTo(payload); + submitAddress(payload) { + console.log('@@@ click on Submit Address Button', payload); + this.addDateToAddressAndPostAddressTo(payload); // !! }, - addDateToAddressAndPostAddressTo(payload) - { + addDateToAddressAndPostAddressTo(payload) { payload.body = { validFrom: { datetime: `${this.context.valid.from.toISOString().split('T')[0]}T00:00:00+0100` @@ -100,11 +98,9 @@ export default { this.$refs.addAddress.flag.loading = false; }); }, - - postAddressTo(payload) - { + postAddressTo(payload) { console.log('postAddressTo', payload.entity); - if (!this.context.edit) { + if (!this.context.edit) { // !! switch (payload.entity) { case 'household': postAddressToHousehold(payload.entityId, payload.addressId) @@ -141,7 +137,7 @@ export default { } } else { // address is already linked, just finish ! - window.location.assign(this.context.backUrl); + //window.location.assign(this.context.backUrl); } }, } 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 19d35381c..8faaa4e5a 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue @@ -57,9 +57,9 @@ v-bind:entity="this.entity" v-bind:valid="this.context.valid" v-bind:flag="this.flag" - ref="showAddress" - v-bind:insideModal="false" @openEditPane="openEditPane" - @submitAddress="$emit('submitAddress')"> + v-bind:insideModal="false" + @openEditPane="openEditPane" + ref="showAddress">
    @@ -110,7 +110,8 @@ v-bind:default="this.default" v-bind:entity="this.entity" v-bind:flag="this.flag" - v-bind:insideModal="false" @closeEditPane="closeEditPane" + v-bind:insideModal="false" + @closeEditPane="closeEditPane" @getCities="getCities" @getReferenceAddresses="getReferenceAddresses"> @@ -127,8 +128,7 @@ import EditAddressPane from './EditAddressPane.vue'; export default { name: "AddAddress", - props: ['context', 'options', 'result'], - emits: ['submitAddress'], + props: ['context', 'options', 'addressChanged'], components: { Modal, ShowAddressPane, @@ -249,7 +249,7 @@ export default { this.getInitialAddress(this.context.addressId); } - // when create new address, start first with editPane + // when create new address, start first with editPane !! if ( this.context.edit === false && this.flag.editPane === false ) { @@ -407,10 +407,19 @@ export default { this.updateAddress({ addressId: this.context.addressId, newAddress: newAddress - }); + }) + .then(payload => { + console.log('payload', payload); + this.addressChanged(payload); + } + ); + } else { - this.addNewAddress(newAddress); + this.addNewAddress(newAddress) + .then(payload => this.addressChanged(payload)); } + + }, /* @@ -428,25 +437,30 @@ export default { if (this.context.entity.type === 'person') { postcodeBody = Object.assign(postcodeBody, {'origin': 3}); } - postPostalCode(postcodeBody) + return postPostalCode(postcodeBody) .then(postalCode => { payload.postcode = {'id': postalCode.id }; - this.postNewAddress(payload); + return this.postNewAddress(payload); }); } else { - this.postNewAddress(payload); + return this.postNewAddress(payload); } }, postNewAddress(payload) { //console.log('postNewAddress', payload); - postAddress(payload) + return postAddress(payload) .then(address => new Promise((resolve, reject) => { this.entity.address = address; this.flag.loading = false; this.flag.success = true; - resolve(); + resolve({ + entity: this.context.entity.type, + entityId: this.context.entity.id, + addressId: this.entity.address.address_id + } + ); })) .catch((error) => { this.errorMsg.push(error); @@ -463,31 +477,37 @@ export default { this.flag.loading = true; // TODO change the condition because it writes new postal code in edit mode now: !writeNewPostalCode - if ('newPostcode' in payload.newAddress) { + if ('newPostcode' in payload.newAddress) { let postcodeBody = payload.newAddress.newPostcode; postcodeBody = Object.assign(postcodeBody, {'origin': 3}); - postPostalCode(postcodeBody) + return postPostalCode(postcodeBody) .then(postalCode => { + console.log('create new postcode', postalCode.id); payload.newAddress.postcode = {'id': postalCode.id }; - this.patchExistingAddress(payload); + return this.patchExistingAddress(payload); }); } else { - this.patchExistingAddress(payload); + return this.patchExistingAddress(payload); } }, patchExistingAddress(payload) { console.log('patchExistingAddress', payload); - patchAddress(payload.addressId, payload.newAddress) + return patchAddress(payload.addressId, payload.newAddress) .then(address => new Promise((resolve, reject) => { - this.entity.address = address; - this.flag.loading = false; - this.flag.success = true; - resolve(); - })) + this.entity.address = address; + this.flag.loading = false; + this.flag.success = true; + return resolve({ + entity: this.context.entity.type, + entityId: this.context.entity.id, + addressId: this.entity.address.address_id + }); + }) + ) .catch((error) => { this.errorMsg.push(error); this.flag.loading = false; @@ -497,7 +517,6 @@ export default { /* * Method called by parent when submitting address * (get out step1 show pane, submit button) - */ submitNewAddress() { let payload = { @@ -513,6 +532,7 @@ export default { return payload; } + */ } } diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowAddressPane.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowAddressPane.vue index d3894f972..25811f7be 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowAddressPane.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowAddressPane.vue @@ -4,9 +4,11 @@ {{ $t('loading') }}
    +
    {{ errorMsg }}
    +
    {{ $t(getSuccessText) }}
    @@ -26,23 +28,24 @@
    @@ -65,7 +68,7 @@ export default { 'errorMsg', 'insideModal' ], - emits: ['openEditPane', 'submitAddress'], //? + emits: ['openEditPane'], // 'submitAddress' computed: { address() { return this.entity.address; diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/show.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/show.html.twig index 6f647f6b6..d711bdefa 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/show.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/show.html.twig @@ -82,7 +82,7 @@ {% if thirdParty.address == null %} {{ 'No address given'|trans }} {% else %} - {{ thirdParty.address|chill_entity_render_box({'with_valid_from': false }) }} + {{ thirdParty.address|chill_entity_render_box({'with_valid_from': false, 'extended_infos': true }) }} {% endif %} @@ -103,7 +103,7 @@
    • - {{ 'Cancel'|trans }} + {{ 'Back to the list'|trans }}
    • From a5ceb551eba4965560116570961dde46df148006 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 16 Sep 2021 16:05:36 +0200 Subject: [PATCH 120/217] twig pass arguments to vue_address with dataset attributes --- .../Resources/public/vuejs/Address/App.vue | 62 ++++--------------- .../Resources/public/vuejs/Address/index.js | 62 ++++++++++++++++--- .../Address/_insert_vue_address.html.twig | 41 ++++++------ .../Resources/views/Address/edit.html.twig | 4 +- .../Resources/views/Address/list.html.twig | 8 +-- .../Resources/views/Address/new.html.twig | 4 +- .../views/Household/address_edit.html.twig | 4 +- .../views/Household/address_move.html.twig | 4 +- 8 files changed, 98 insertions(+), 91 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue index b79840998..1cde88830 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue @@ -2,21 +2,13 @@ +>
    {{ encore_entry_script_tags('vue_address') }} {{ encore_entry_link_tags('vue_address') }} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Address/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Address/edit.html.twig index 954bbf348..20713ec49 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Address/edit.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Address/edit.html.twig @@ -30,8 +30,8 @@ {% include '@ChillMain/Address/_insert_vue_address.html.twig' with { targetEntity: { name: 'person', id: person.id }, backUrl: path('chill_person_address_list', { 'person_id': person.id }), - binModalStep1: false, - binModalStep2: false, + bindModalStep1: false, + bindModalStep2: false, } %} {% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Address/list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Address/list.html.twig index 2c2da145f..3719e0ebe 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Address/list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Address/list.html.twig @@ -74,8 +74,8 @@ backUrl: path('chill_person_address_list', { 'person_id': person.id }), mode: 'edit', addressId: address.id, - binModalStep1: false, - binModalStep2: false, + bindModalStep1: false, + bindModalStep2: false, } %} #} @@ -90,8 +90,8 @@ backUrl: path('chill_person_address_list', { 'person_id': person.id }), mode: 'edit', addressId: address.id, - binModalStep1: false, - binModalStep2: false, + bindModalStep1: false, + bindModalStep2: false, } %} #} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Address/new.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Address/new.html.twig index d5a55c760..96c317234 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Address/new.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Address/new.html.twig @@ -30,8 +30,8 @@ {% include '@ChillMain/Address/_insert_vue_address.html.twig' with { targetEntity: { name: 'person', id: person.id }, backUrl: path('chill_person_address_list', { 'person_id': person.id }), - binModalStep1: false, - binModalStep2: false, + bindModalStep1: false, + bindModalStep2: false, } %} {% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Household/address_edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Household/address_edit.html.twig index 63ff0a041..353ba09a5 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Household/address_edit.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Household/address_edit.html.twig @@ -10,8 +10,8 @@ {% include '@ChillMain/Address/_insert_vue_address.html.twig' with { targetEntity: { name: 'household', id: household.id }, backUrl: path('chill_person_household_addresses', { 'household_id': household.id }) - binModalStep1: false, - binModalStep2: false, + bindModalStep1: false, + bindModalStep2: false, } %}
    diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Household/address_move.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Household/address_move.html.twig index f744f5d9f..b6fc39dd9 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Household/address_move.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Household/address_move.html.twig @@ -10,8 +10,8 @@ {% include '@ChillMain/Address/_insert_vue_address.html.twig' with { targetEntity: { name: 'household', id: household.id }, backUrl: path('chill_person_household_addresses', { 'household_id': household.id }) - binModalStep1: false, - binModalStep2: false, + bindModalStep1: false, + bindModalStep2: false, } %}
    From da32afeb3fe2edede24eca017ced43a9477e763e Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 16 Sep 2021 16:06:39 +0200 Subject: [PATCH 121/217] addAddress: improve boolean variables --- .../vuejs/Address/components/AddAddress.vue | 3 +++ .../Resources/public/vuejs/Address/index.js | 16 +++++++--------- .../views/Address/_insert_vue_address.html.twig | 12 ++++++------ .../Resources/views/Household/summary.html.twig | 6 +++++- 4 files changed, 21 insertions(+), 16 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 8faaa4e5a..57ee15a06 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue @@ -187,6 +187,9 @@ export default { }, computed: { step1WithModal() { + console.log('options displayText', this.options.button.displayText); + console.log('options bindModal.step1', this.options.bindModal.step1); + console.log('options bindModal.step2', this.options.bindModal.step2); return (this.options.bindModal !== null && typeof this.options.bindModal.step1 !== 'undefined') ? this.options.bindModal.step1 : this.default.bindModal.step1; }, diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/index.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/index.js index 31c84ecf3..5443601e1 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/index.js @@ -7,25 +7,25 @@ const i18n = _createI18n( addressMessages ); let containers = document.querySelectorAll('.address-container'); containers.forEach((container) => { + const app = createApp({ template: ``, data() { return { addAddress: { context: { - edit: container.dataset.mode === 'edit', entity: { type: container.dataset.targetEntityName, id: container.dataset.targetEntityId }, - addressId: container.dataset.addressId | null, - backUrl: container.dataset.backUrl, + edit: container.dataset.mode === 'edit', //boolean + addressId: container.dataset.addressId || null, + backUrl: container.dataset.backUrl || null, valid: { from: new Date() }, }, options: { - /// Options override default. /// null value take default component value defined in AddAddress data() button: { @@ -34,19 +34,17 @@ containers.forEach((container) => { edit: container.dataset.buttonText || null }, size: container.dataset.buttonSize || null, - displayText: container.dataset.buttonDisplayText //boolean, default: true + displayText: container.dataset.buttonDisplayText !== 'false' //boolean, default: true }, - /// Modal title text if create or edit address (trans chain, see i18n) title: { create: container.dataset.modalTitle || null, edit: container.dataset.modalTitle || null }, - /// Display each step in page or Modal bindModal: { - step1: container.dataset.bindModalStep1, //boolean, default: true - step2: container.dataset.bindModalStep2 //boolean, default: true + step1: container.dataset.bindModalStep1 !== 'false', //boolean, default: true + step2: container.dataset.bindModalStep2 !== 'false' //boolean, default: true } } } diff --git a/src/Bundle/ChillMainBundle/Resources/views/Address/_insert_vue_address.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Address/_insert_vue_address.html.twig index 2d521ccae..4b38f288f 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Address/_insert_vue_address.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Address/_insert_vue_address.html.twig @@ -47,16 +47,16 @@ data-button-size="{{ buttonSize|e('html_attr') }}" {% endif %} - {% if buttonDisplayText is defined and buttonDisplayText == false %} - data-button-display-text=false + {% if buttonDisplayText is defined and buttonDisplayText != 1 %} + data-button-display-text="false" {% endif %} - {% if bindModalStep1 is defined and bindModalStep1 == false %} - data-bind-modal-step1=false + {% if bindModalStep1 is defined and bindModalStep1 != 1 %} + data-bind-modal-step1="false" {% endif %} - {% if bindModalStep2 is defined and bindModalStep2 == false %} - data-bind-modal-step2=false + {% if bindModalStep2 is defined and bindModalStep2 != 1 %} + data-bind-modal-step2="false" {% endif %} >
    diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig index faf9f13d6..a680f18f2 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig @@ -37,8 +37,12 @@ buttonSize: 'btn-sm', buttonText: 'Move household', modalTitle: 'Move household', - buttonDisplayText: false + buttonDisplayText: false, } %} + {# + bindModalStep1: false, + bindModalStep2: true, + #}
  • Date: Thu, 16 Sep 2021 16:12:32 +0200 Subject: [PATCH 122/217] Address: replace variable entity.type by entity.name --- .../Resources/public/vuejs/Address/App.vue | 2 +- .../public/vuejs/Address/components/AddAddress.vue | 8 ++++---- .../public/vuejs/Address/components/ShowAddressPane.vue | 4 ++-- .../Resources/public/vuejs/Address/index.js | 2 +- .../AccompanyingCourse/components/ButtonLocation.vue | 2 +- .../AccompanyingCourse/components/CourseLocation.vue | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue index 1cde88830..21b4ce5ef 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue @@ -1,6 +1,6 @@ @@ -121,16 +121,16 @@ import Modal from 'ChillMainAssets/vuejs/_components/Modal'; import { getAddress, fetchCountries, fetchCities, fetchReferenceAddresses, patchAddress, postAddress, postPostalCode } from '../api'; import { postAddressToPerson, postAddressToHousehold } from "ChillPersonAssets/vuejs/_api/AddAddress.js"; -import ShowAddressPane from './ShowAddressPane.vue'; -import EditAddressPane from './EditAddressPane.vue'; +import ShowPane from './ShowPane.vue'; +import EditPane from './EditPane.vue'; export default { name: "AddAddress", props: ['context', 'options', 'addressChangedCallback'], components: { Modal, - ShowAddressPane, - EditAddressPane, + ShowPane, + EditPane, }, data() { return { diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/EditAddressPane.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/EditPane.vue similarity index 99% rename from src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/EditAddressPane.vue rename to src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/EditPane.vue index 7bbad3db5..8cacf9981 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/EditAddressPane.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/EditPane.vue @@ -85,7 +85,7 @@ import AddressMap from './AddAddress/AddressMap'; import AddressMore from './AddAddress/AddressMore' export default { - name: "EditAddressPane", + name: "EditPane", components: { CountrySelection, CitySelection, diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowAddressPane.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowPane.vue similarity index 99% rename from src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowAddressPane.vue rename to src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowPane.vue index 7e55f0c1b..eace3f6d2 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowAddressPane.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowPane.vue @@ -66,7 +66,7 @@ import { dateToISO, ISOToDate, ISOToDatetime } from 'ChillMainAssets/chill/js/da import AddressRenderBox from 'ChillMainAssets/vuejs/_components/Entity/AddressRenderBox.vue'; export default { - name: 'ShowAddressPane', + name: 'ShowPane', components: { AddressRenderBox }, From 782f0bc3326a6ac145b9ef82afb2defc0fd33964 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 17 Sep 2021 10:43:59 +0200 Subject: [PATCH 132/217] twig _insert_vue_address, rename mode create --- .../Resources/views/Address/_insert_vue_address.html.twig | 2 +- .../ChillPersonBundle/Resources/views/Address/list.html.twig | 2 +- .../Resources/views/Household/addresses.html.twig | 2 +- .../Resources/views/Household/summary.html.twig | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/views/Address/_insert_vue_address.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Address/_insert_vue_address.html.twig index 05f557d44..fa08286f8 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Address/_insert_vue_address.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Address/_insert_vue_address.html.twig @@ -7,7 +7,7 @@ name: string id: integer } - * mode string ['edit*'|'create'] + * mode string ['edit*'|'new'] * addressId integer * backUrl twig route: path('route', {parameters}) * modalTitle twig translated chain diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Address/list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Address/list.html.twig index 3719e0ebe..ce68e4da8 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Address/list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Address/list.html.twig @@ -32,7 +32,7 @@ {% include '@ChillMain/Address/_insert_vue_address.html.twig' with { targetEntity: { name: 'person', id: person.id }, backUrl: path('chill_person_address_list', { 'person_id': person.id }), - mode: 'create', + mode: 'new', buttonSize: 'btn-lg', buttonText: 'Add an address', modalTitle: 'Add an address', diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Household/addresses.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Household/addresses.html.twig index 087e8be11..3bee011dd 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Household/addresses.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Household/addresses.html.twig @@ -18,7 +18,7 @@ {% include '@ChillMain/Address/_insert_vue_address.html.twig' with { targetEntity: { name: 'household', id: household.id }, backUrl: path('chill_person_household_address_move', { 'household_id': household.id }), - mode: 'create', + mode: 'new', buttonSize: 'btn-lg', buttonText: 'Move household', modalTitle: 'Move household', diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig index a680f18f2..e8b0c7b78 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig @@ -33,7 +33,7 @@ {% include '@ChillMain/Address/_insert_vue_address.html.twig' with { targetEntity: { name: 'household', id: household.id }, backUrl: path('chill_person_household_addresses', { 'household_id': household.id }), - mode: 'create', + mode: 'new', buttonSize: 'btn-sm', buttonText: 'Move household', modalTitle: 'Move household', From 6a60758c0d322c733c39952a86b41ee373581c1d Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 17 Sep 2021 10:50:57 +0200 Subject: [PATCH 133/217] AddAddress: openPanesInModal, uniq option to enable/disable all step123 in Modal --- .../vuejs/Address/components/AddAddress.vue | 25 +++++-------------- .../Resources/public/vuejs/Address/index.js | 7 ++---- .../Address/_insert_vue_address.html.twig | 10 +++----- .../components/CourseLocation.vue | 4 +-- .../Resources/views/Address/edit.html.twig | 3 +-- .../Resources/views/Address/list.html.twig | 6 ++--- .../Resources/views/Address/new.html.twig | 3 +-- .../views/Household/address_edit.html.twig | 3 +-- .../views/Household/address_move.html.twig | 3 +-- .../views/Household/summary.html.twig | 3 +-- 10 files changed, 19 insertions(+), 48 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 248e7da2b..69f764284 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue @@ -9,8 +9,8 @@ - modalDialogClass="modal-dialog-scrollable modal-xl" @close="flag.showPane = false"> @@ -62,7 +62,7 @@
  • - + @@ -147,10 +147,7 @@ export default { displayText: true }, title: { create: 'add_an_address_title', edit: 'edit_address' }, - bindModal: { - step1: true, - step2: true, - }, + openPanesInModal: true, useDate: { validFrom: false, validTo: false @@ -192,19 +189,9 @@ export default { } }, computed: { - step1WithModal() { - return (typeof this.options.bindModal !== 'undefined' && typeof this.options.bindModal.step1 !== 'undefined') ? - this.options.bindModal.step1 : this.default.bindModal.step1; - }, - step2WithModal() { - let step2 = (typeof this.options.bindModal !== 'undefined' && typeof this.options.bindModal.step2 !== 'undefined') ? - this.options.bindModal.step2 : this.default.bindModal.step2; - - if (step2 === false && this.step1WithModal === true) { - console.log("step2 must open in a Modal"); - return true; - } - return step2; + InModal() { + return (typeof this.options.openPanesInModal !== 'undefined') ? + this.options.openPanesInModal : this.default.openPanesInModal; }, getTextTitle() { if ( typeof this.options.title !== 'undefined' diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/index.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/index.js index cb628586a..4e49b2207 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/index.js @@ -38,12 +38,9 @@ containers.forEach((container) => { create: container.dataset.modalTitle || null, edit: container.dataset.modalTitle || null }, - /// Display each step in page or Modal - bindModal: { - step1: container.dataset.bindModalStep1 !== 'false', //boolean, default: true - step2: container.dataset.bindModalStep2 !== 'false' //boolean, default: true - }, // Use Date fields + /// Display panes in Modal for step123 + openPanesInModal: container.dataset.openPanesInModal !== 'false', //boolean, default: true useDate: { validFrom: container.dataset.useValidFrom === 'true', //boolean, default: false validTo: container.dataset.useValidTo === 'true' //boolean, default: false diff --git a/src/Bundle/ChillMainBundle/Resources/views/Address/_insert_vue_address.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Address/_insert_vue_address.html.twig index fa08286f8..052cdbec9 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Address/_insert_vue_address.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Address/_insert_vue_address.html.twig @@ -14,9 +14,8 @@ * buttonText twig translated chain * buttonSize bootstrap class like 'btn-sm' * buttonDisplayText bool - * bindModalStep1 bool - * bindModalStep2 bool + * openPanesInModal bool (default: true) #}
    diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Household/address_move.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Household/address_move.html.twig index 6d65c0a7f..2b7dfa8f0 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Household/address_move.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Household/address_move.html.twig @@ -10,8 +10,7 @@ {% include '@ChillMain/Address/_insert_vue_address.html.twig' with { targetEntity: { name: 'household', id: household.id }, backUrl: path('chill_person_household_addresses', { 'household_id': household.id }), - bindModalStep1: false, - bindModalStep2: false, + openPanesInModal: false, } %}
    diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig index e8b0c7b78..d8c53dbf5 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig @@ -40,8 +40,7 @@ buttonDisplayText: false, } %} {# - bindModalStep1: false, - bindModalStep2: true, + openPanesInModal: false #}
  • From f048395a892b641148933b7c21c50bddfceb8229 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 17 Sep 2021 10:57:13 +0200 Subject: [PATCH 134/217] AddAddress: reorganize 4 steps Pane: show, suggest, edit, and date --- .../Address/components/ActionButtons.vue | 30 +++++ .../vuejs/Address/components/AddAddress.vue | 123 ++++++++++++------ .../vuejs/Address/components/DatePane.vue | 121 +++++++++++++++++ .../vuejs/Address/components/EditPane.vue | 42 +++--- .../vuejs/Address/components/ShowPane.vue | 101 ++++---------- .../vuejs/Address/components/SuggestPane.vue | 60 +++++++++ 6 files changed, 338 insertions(+), 139 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ActionButtons.vue create mode 100644 src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/DatePane.vue create mode 100644 src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/SuggestPane.vue diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ActionButtons.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ActionButtons.vue new file mode 100644 index 000000000..94d6ab105 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ActionButtons.vue @@ -0,0 +1,30 @@ + + + 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 69f764284..1948535dc 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue @@ -1,18 +1,21 @@ + + 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 8cacf9981..0009df622 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/EditPane.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/EditPane.vue @@ -2,7 +2,7 @@
    - @@ -82,7 +80,8 @@ import CountrySelection from './AddAddress/CountrySelection'; import CitySelection from './AddAddress/CitySelection'; import AddressSelection from './AddAddress/AddressSelection'; import AddressMap from './AddAddress/AddressMap'; -import AddressMore from './AddAddress/AddressMore' +import AddressMore from './AddAddress/AddressMore'; +import ActionButtons from './ActionButtons.vue'; export default { name: "EditPane", @@ -91,7 +90,8 @@ export default { CitySelection, AddressSelection, AddressMap, - AddressMore + AddressMore, + ActionButtons }, props: [ 'context', diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowPane.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowPane.vue index eace3f6d2..f57340bf0 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowPane.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ShowPane.vue @@ -1,68 +1,27 @@ + + From 331dd286e79e7c8c395234070261b7b553227da0 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 17 Sep 2021 10:59:06 +0200 Subject: [PATCH 135/217] AddAddress: adding a new stickyActions option --- .../public/vuejs/Address/components/ActionButtons.vue | 1 + .../Resources/public/vuejs/Address/index.js | 4 +++- .../views/Address/_insert_vue_address.html.twig | 9 +++++++-- .../Resources/views/Address/new.html.twig | 1 + 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ActionButtons.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ActionButtons.vue index 94d6ab105..a0bb66f33 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ActionButtons.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ActionButtons.vue @@ -24,6 +24,7 @@ export default { props: [ 'options', 'default' ], computed: { isStickyForm() { + return (typeof this.options.stickyActions !== 'undefined') ? this.options.stickyActions : this.default.stickyActions; } } } diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/index.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/index.js index 4e49b2207..7ecf4847a 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/index.js @@ -38,9 +38,11 @@ containers.forEach((container) => { create: container.dataset.modalTitle || null, edit: container.dataset.modalTitle || null }, - // Use Date fields /// Display panes in Modal for step123 openPanesInModal: container.dataset.openPanesInModal !== 'false', //boolean, default: true + /// Display actions buttons of panes in a sticky-form-button navbar + stickyActions: container.dataset.stickyActions === 'true', //boolean, default: false + /// Use Date fields useDate: { validFrom: container.dataset.useValidFrom === 'true', //boolean, default: false validTo: container.dataset.useValidTo === 'true' //boolean, default: false diff --git a/src/Bundle/ChillMainBundle/Resources/views/Address/_insert_vue_address.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Address/_insert_vue_address.html.twig index 052cdbec9..bf996f593 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Address/_insert_vue_address.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Address/_insert_vue_address.html.twig @@ -13,9 +13,11 @@ * modalTitle twig translated chain * buttonText twig translated chain * buttonSize bootstrap class like 'btn-sm' - * buttonDisplayText bool - + * buttonDisplayText bool (default: true) * openPanesInModal bool (default: true) + * stickyActions bool (default: false) + * useValidFrom bool (default: false) + * useValidTo bool (default: false) #}
    Date: Fri, 17 Sep 2021 13:09:18 +0200 Subject: [PATCH 136/217] AddAddress: adjust Open and Close methods for each step --- .../Resources/public/vuejs/Address/App.vue | 4 +- .../Address/components/ActionButtons.vue | 17 ++- .../vuejs/Address/components/AddAddress.vue | 110 +++++++++++++----- .../vuejs/Address/components/DatePane.vue | 5 +- .../vuejs/Address/components/EditPane.vue | 12 +- .../vuejs/Address/components/ShowPane.vue | 20 +++- .../vuejs/Address/components/SuggestPane.vue | 5 +- .../Resources/public/vuejs/Address/index.js | 2 +- .../Resources/views/Address/new.html.twig | 5 +- .../views/Household/address_edit.html.twig | 1 + 10 files changed, 132 insertions(+), 49 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue index e4d332289..a1496e7d6 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue @@ -33,8 +33,8 @@ export default { }, mounted() { - console.log('AddAddress: data context', this.context); - console.log('AddAddress: data options', this.options); + //console.log('AddAddress: data context', this.context); + //console.log('AddAddress: data options', this.options); }, methods: { displayErrors() { diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ActionButtons.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ActionButtons.vue index a0bb66f33..afe059da6 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ActionButtons.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/ActionButtons.vue @@ -2,19 +2,23 @@
      + +
    @@ -24,7 +28,16 @@ export default { props: [ 'options', 'default' ], computed: { isStickyForm() { - return (typeof this.options.stickyActions !== 'undefined') ? this.options.stickyActions : this.default.stickyActions; + return (typeof this.options.stickyActions !== 'undefined') ? + this.options.stickyActions : this.default.stickyActions; + }, + }, + methods: { + resetPane() { + this.flag.suggestPane = false; + this.flag.editPane = false; + this.flag.datePane = false; + this.flag.showPane = true; } } } 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 1948535dc..259266c92 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue @@ -12,10 +12,10 @@ - + + @close="resetPane"> @@ -63,10 +65,10 @@
    - + + @close="resetPane">