From 76b49d22e792046006e14831cfe5d552df39a1a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 31 May 2022 22:45:21 +0200 Subject: [PATCH 01/26] module in ts to give an answer to calendar invite --- .../Controller/InviteApiController.php | 2 +- .../Resources/public/module/Invite/answer.js | 13 +++- .../Resources/public/vuejs/Invite/Answer.vue | 61 +++++++++++++++---- 3 files changed, 63 insertions(+), 13 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php b/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php index 960459617..62c3dc521 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/InviteApiController.php @@ -57,7 +57,7 @@ class InviteApiController throw new AccessDeniedHttpException('not allowed to answer on this invitation'); } - if (!in_array($answer, Invite::STATUSES, true) || Invite::PENDING === $answer) { + if (!in_array($answer, Invite::STATUSES, true)) { throw new BadRequestHttpException('answer not valid'); } diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/module/Invite/answer.js b/src/Bundle/ChillCalendarBundle/Resources/public/module/Invite/answer.js index ab10f72ee..a97fe584d 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/module/Invite/answer.js +++ b/src/Bundle/ChillCalendarBundle/Resources/public/module/Invite/answer.js @@ -14,7 +14,18 @@ document.addEventListener('DOMContentLoaded', function (e) { components: { Answer, }, - template: '', + data() { + return { + status: el.dataset.status, + calendarId: Number.parseInt(el.dataset.calendarId), + } + }, + template: '', + methods: { + onStatusChanged: function(newStatus) { + this.$data.status = newStatus; + }, + } }); app.use(i18n).mount(el); diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Invite/Answer.vue b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Invite/Answer.vue index d001334ae..a45ac2ed5 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Invite/Answer.vue +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Invite/Answer.vue @@ -1,31 +1,70 @@ + diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/Components/CalendarActive.vue b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/Components/CalendarActive.vue index 4c0a20457..8066499c7 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/Components/CalendarActive.vue +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/Components/CalendarActive.vue @@ -1,13 +1,13 @@ @@ -45,6 +45,16 @@ export default { } - diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store/getters.js b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store/getters.js index 492738060..b1f925e68 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store/getters.js +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store/getters.js @@ -62,8 +62,6 @@ export default { const userData = state.usersData.get(userId); if (kinds.ranges && userData.calendarRanges.length > 0) { - console.log('first range', userData.calendarRanges[0]); - console.log('state activity', state.activity); const s = { id: `ranges_${userId}`, events: userData.calendarRanges.filter(r => state.activity.calendarRange === null || r.calendarRangeId !== state.activity.calendarRange.calendarRangeId), @@ -92,7 +90,6 @@ export default { return sources; }, getInitialDate(state) { - console.log('initialDate', state.activity.startDate); return state.activity.startDate; }, /** diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store/index.js b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store/index.js index 723ad9151..5fb6b1d6a 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store/index.js +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store/index.js @@ -47,8 +47,6 @@ const store = createStore({ actions, }); -console.log('calendar event', store.state.activity); - whoami().then(me => { store.commit('setWhoAmiI', me); }); @@ -61,4 +59,6 @@ for (let u of store.state.activity.users) { store.commit('showUserOnCalendar', {ranges: false, remotes: false, user: u}); } +console.log('store', store); + export default store; diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store/utils.js b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store/utils.js index a322a25ac..176b84a6b 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store/utils.js +++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store/utils.js @@ -53,7 +53,7 @@ const createUserData = (user, colorIndex) => { const calendarRangeToFullCalendarEvent = (entity) => { return { id: `range_${entity.id}`, - title: "", + title: "(" + entity.user.text + ")", start: entity.startDate.datetime8601, end: entity.endDate.datetime8601, allDay: false, diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/edit.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/edit.html.twig index e3054c79d..bf88167df 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/edit.html.twig +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/edit.html.twig @@ -24,12 +24,15 @@
+

{{ 'Calendar data'|trans }}

+ +
+ {%- if form.location is defined -%} {{ form_row(form.location) }}
{% endif %} -

{{ 'Calendar data'|trans }}

{%- if form.startDate is defined -%} {{ form_row(form.startDate) }} @@ -77,7 +80,7 @@
  • diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/editByAccompanyingCourse.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/editByAccompanyingCourse.html.twig index 004a6fb92..a167d5c18 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/editByAccompanyingCourse.html.twig +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/editByAccompanyingCourse.html.twig @@ -15,10 +15,6 @@ {% block js %} {{ parent() }} {{ encore_entry_script_tags('vue_calendar') }} diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/PickEntity/PickEntity.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/PickEntity/PickEntity.vue index f688ff4f8..e121ca950 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/PickEntity/PickEntity.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/PickEntity/PickEntity.vue @@ -1,5 +1,5 @@