From 866b92f7e5b8f95a58676c832de784ca057ea06f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 30 Mar 2023 16:29:02 +0200 Subject: [PATCH 01/22] Fixed: loading of main user through pick entity in calendar form --- .../ChillCalendarBundle/Entity/Calendar.php | 1 + .../Resources/public/vuejs/Calendar/App.vue | 28 +++++++++++++++++-- .../public/vuejs/Calendar/store/actions.js | 2 ++ .../public/vuejs/Calendar/store/utils.ts | 2 +- tests/app | 2 +- 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php index 56373ca17..cfe1fb2c3 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php +++ b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php @@ -92,6 +92,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente /** * @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod", inversedBy="calendars") + * @Serializer\Groups({"calendar:read", "read"}) */ private ?AccompanyingPeriod $accompanyingPeriod = null; diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/App.vue b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/App.vue index 32b6b569b..e09175a4b 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/App.vue +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/App.vue @@ -15,6 +15,7 @@ :picked="null !== this.$store.getters.getMainUser ? [this.$store.getters.getMainUser] : []" :removableIfSet="false" :displayPicked="false" + :suggested="this.suggestedUsers" @addNewEntity="setMainUser" > @@ -143,6 +144,7 @@ export default { slotMinTime: '09:00:00', slotMaxTime: '18:00:00', hideWeekEnds: true, + previousUser: [], } }, computed: { @@ -188,11 +190,23 @@ export default { users.push(this.$store.getters.getUserDataById(id).user); } return users; - } + }, + suggestedUsers() { + const suggested = []; + + this.$data.previousUser.forEach(u => { + if (u.id !== this.$store.getters.getMainUser.id) { + suggested.push(u) + } + }); + + return suggested; + }, }, methods: { - setMainUser(user) { - console.log('setMainUser APP', user); + setMainUser({entity}) { + const user = entity; + console.log('setMainUser APP', entity); if (user.id !== this.$store.getters.getMainUser && ( this.$store.state.activity.calendarRange !== null @@ -205,6 +219,14 @@ export default { } } + // add the previous user, if any, in the previous user list (in use for suggestion) + if (null !== this.$store.getters.getMainUser) { + const suggestedUids = new Set(this.$data.previousUser.map(u => u.id)); + if (!suggestedUids.has(this.$store.getters.getMainUser.id)){ + this.$data.previousUser.push(this.$store.getters.getMainUser); + } + } + this.$store.dispatch('setMainUser', user); this.$store.commit('showUserOnCalendar', {user, ranges: true, remotes: true}); }, diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store/actions.js b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store/actions.js index 1568944db..0e4d91afc 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store/actions.js +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store/actions.js @@ -202,6 +202,8 @@ export default { return dispatch('associateCalendarToRange', { range: null }).then(() => { commit('setMainUser', mainUser); + + return dispatch('fetchCalendarEvents'); }); }, diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store/utils.ts b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store/utils.ts index 04ca26726..e9b24a1f0 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store/utils.ts +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store/utils.ts @@ -54,7 +54,7 @@ export const mapEntity = (entity: EventInput): EventInput => { export const createUserData = (user: User, colorIndex: number): UserData => { const colorId = colorIndex % COLORS.length; - console.log('colorId', colorId); + return { user: user, calendarRanges: [], diff --git a/tests/app b/tests/app index 5b35e7ccd..5e478fdfb 160000 --- a/tests/app +++ b/tests/app @@ -1 +1 @@ -Subproject commit 5b35e7ccd0735e5593835e28acbf82386c18e1b6 +Subproject commit 5e478fdfbf429baf3ce852ae69eb1f7101b1b416 From 3c88630edc1e449824dd6d2cfd91699e2cb47f86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 30 Mar 2023 17:13:25 +0200 Subject: [PATCH 02/22] fix: [calendar list on person page] add scripts to download documents --- .../Resources/views/Calendar/listByPerson.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByPerson.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByPerson.html.twig index 7c5fdc639..9e3b59d2a 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByPerson.html.twig +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByPerson.html.twig @@ -9,13 +9,13 @@ {% block js %} {{ parent() }} {{ encore_entry_script_tags('mod_answer') }} - {{ encore_entry_script_tags('mod_async_upload') }} + {{ encore_entry_script_tags('mod_document_action_buttons_group') }} {% endblock %} {% block css %} {{ parent() }} {{ encore_entry_link_tags('mod_answer') }} - {{ encore_entry_link_tags('mod_async_upload') }} + {{ encore_entry_link_tags('mod_document_action_buttons_group') }} {% endblock %} {% block content %} From d290572ca8983c9cb02fb1093d5117593b72d51f Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 30 Mar 2023 19:41:55 +0200 Subject: [PATCH 03/22] FIX [translation] add hardcoded text into a translation --- .../Resources/public/vuejs/MyCalendarRange/App2.vue | 2 +- .../Resources/public/vuejs/MyCalendarRange/i18n.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App2.vue b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App2.vue index fb17ba141..1d353baed 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App2.vue +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App2.vue @@ -1,7 +1,7 @@