fixes in template with new route and forms

This commit is contained in:
Julien Fastré 2022-06-06 22:07:04 +02:00
parent fc7d2fcca3
commit 168aff81f4
8 changed files with 62 additions and 28 deletions

View File

@ -292,7 +292,7 @@ class CalendarController extends AbstractController
$params = $this->buildParamsToUrl($user, $accompanyingPeriod); $params = $this->buildParamsToUrl($user, $accompanyingPeriod);
return $this->redirectToRoute('chill_calendar_calendar_list', $params); return $this->redirectToRoute('chill_calendar_calendar_list_by_period', $params);
} }
if ($form->isSubmitted() && !$form->isValid()) { if ($form->isSubmitted() && !$form->isValid()) {

View File

@ -273,7 +273,7 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface
'calendar_identifier' => $identifier, 'calendar_identifier' => $identifier,
]); ]);
return []; return ['id' => null, 'lastModifiedDateTime' => null, 'changeKey' => null];
} }
try { try {
@ -409,7 +409,8 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface
$eventDatas[] = $this->remoteEventConverter->calendarToEvent($calendar); $eventDatas[] = $this->remoteEventConverter->calendarToEvent($calendar);
if (0 < count($newInvites)) { if (0 < count($newInvites)) {
$eventDatas[] = $this->remoteEventConverter->calendarToEventAttendeesOnly($calendar); // it seems that invitaiton are always send, even if attendee changes are mixed with other datas
// $eventDatas[] = $this->remoteEventConverter->calendarToEventAttendeesOnly($calendar);
} }
foreach ($eventDatas as $eventData) { foreach ($eventDatas as $eventData) {
@ -446,7 +447,7 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface
'calendar_identifier' => $identifier, 'calendar_identifier' => $identifier,
]); ]);
return []; return ['id' => null, 'lastModifiedDateTime' => null, 'changeKey' => null];
} }
try { try {

View File

@ -41,7 +41,7 @@
<teleport to="#fullCalendar"> <teleport to="#fullCalendar">
<div class="calendar-actives"> <div class="calendar-actives">
<template class="" v-for="u in getActiveUsers" :key="u.id"> <template class="" v-for="u in getActiveUsers" :key="u.id">
<calendar-active :user="u" ></calendar-active> <calendar-active :user="u" :invite="this.$store.getters.getInviteForUser(u)"></calendar-active>
</template> </template>
</div> </div>
<div class="display-options row justify-content-between"> <div class="display-options row justify-content-between">
@ -60,8 +60,8 @@
<div class="float-end"> <div class="float-end">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-text"> <div class="input-group-text">
<input id="showHideWE" class="form-check-input mt-0" type="checkbox" v-model="this.hideWeekEnds" /> <input id="showHideWE" class="form-check-input mt-0" type="checkbox" v-model="this.hideWeekEnds">
<label for="showHideWE" class="form-check-label">Masquer les week-ends</label> <label for="showHideWE" class="form-check-label"> Masquer les week-ends</label>
</div> </div>
</div> </div>
</div> </div>
@ -188,8 +188,9 @@ export default {
console.log('onDateSelect', payload); console.log('onDateSelect', payload);
// show an alert if changing mainUser // show an alert if changing mainUser
if (this.$store.getters.getMainUser !== null if ((this.$store.getters.getMainUser !== null
&& this.$store.state.me.id !== this.$store.getters.getMainUser.id) { && this.$store.state.me.id !== this.$store.getters.getMainUser.id)
|| this.$store.getters.getMainUser === null) {
if (!window.confirm(this.$t('will_change_main_user_for_me'))) { if (!window.confirm(this.$t('will_change_main_user_for_me'))) {
return; return;
} else { } else {

View File

@ -1,6 +1,15 @@
<template> <template>
<div :style="style" class="calendar-active"> <div :style="style" class="calendar-active">
<span class="badge-user">{{ user.text }}</span> <span class="badge-user">
{{ user.text }}
<template v-if="invite !== null">
<i v-if="invite.status === 'accepted'" class="fa fa-check"></i>
<i v-else-if="invite.status === 'declined'" class="fa fa-times"></i>
<i v-else-if="invite.status === 'pending'" class="fa fa-question-o"></i>
<i v-else-if="invite.status === 'tentative'" class="fa fa-question"></i>
<span v-else="">{{ invite.status }}</span>
</template>
</span>
<span class="form-check-inline form-switch"> <span class="form-check-inline form-switch">
<input class="form-check-input" type="checkbox" id="flexSwitchCheckDefault" v-model="rangeShow"> <input class="form-check-input" type="checkbox" id="flexSwitchCheckDefault" v-model="rangeShow">
&nbsp;<label class="form-check-label" for="flexSwitchCheckDefault" title="Disponibilités"><i class="fa fa-calendar-check-o"></i></label> &nbsp;<label class="form-check-label" for="flexSwitchCheckDefault" title="Disponibilités"><i class="fa fa-calendar-check-o"></i></label>
@ -17,12 +26,21 @@ import {mapGetters} from 'vuex';
export default { export default {
name: "CalendarActive", name: "CalendarActive",
props: ['user'], props: {
user: {
type: Object,
required: true
},
invite: {
type: Object,
required: false,
default: null,
}
},
computed: { computed: {
style() { style() {
return { return {
backgroundColor: this.$store.getters.getUserData(this.user).mainColor, backgroundColor: this.$store.getters.getUserData(this.user).mainColor,
color: 'black',
}; };
}, },
rangeShow: { rangeShow: {
@ -53,6 +71,8 @@ export default {
border-radius: 0.5rem; border-radius: 0.5rem;
color: var(--bs-blue);
& > .badge-user { & > .badge-user {
margin-right: 0.5rem; margin-right: 0.5rem;
} }

View File

@ -92,6 +92,9 @@ export default {
getInitialDate(state) { getInitialDate(state) {
return state.activity.startDate; return state.activity.startDate;
}, },
getInviteForUser: (state) => (user) => {
return state.activity.invites.find(i => i.user.id === user.id);
},
/** /**
* get the user data for a specific user * get the user data for a specific user
* *

View File

@ -9,8 +9,8 @@
{ {
'title' : 'Remove calendar item'|trans, 'title' : 'Remove calendar item'|trans,
'confirm_question' : 'Are you sure you want to remove the calendar item?'|trans, 'confirm_question' : 'Are you sure you want to remove the calendar item?'|trans,
'cancel_route' : 'chill_calendar_calendar_list', 'cancel_route' : 'chill_calendar_calendar_list_by_period',
'cancel_parameters' : { 'accompanying_period_id' : accompanyingCourse.id, 'id' : calendar.id }, 'cancel_parameters' : { 'id' : accompanyingCourse.id },
'form' : delete_form 'form' : delete_form
} ) }} } ) }}
{% endblock %} {% endblock %}

View File

@ -33,7 +33,6 @@
<div id="location"></div> <div id="location"></div>
{% endif %} {% endif %}
{%- if form.startDate is defined -%} {%- if form.startDate is defined -%}
{{ form_row(form.startDate) }} {{ form_row(form.startDate) }}
{% endif %} {% endif %}

View File

@ -3,6 +3,9 @@
{{ form_start(form) }} {{ form_start(form) }}
{{ form_errors(form) }} {{ form_errors(form) }}
<div id="calendar"></div> {# <=== vue component #}
<div id="mainUser"></div> {# <=== vue component: mainUser #}
<h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2> <h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2>
@ -27,6 +30,13 @@
<h2 class="chill-red">{{ 'Calendar data'|trans }}</h2> <h2 class="chill-red">{{ 'Calendar data'|trans }}</h2>
<div id="schedule"></div>
{%- if form.location is defined -%}
{{ form_row(form.location) }}
<div id="location"></div>
{% endif %}
{%- if form.startDate is defined -%} {%- if form.startDate is defined -%}
{{ form_row(form.startDate) }} {{ form_row(form.startDate) }}
{% endif %} {% endif %}
@ -35,11 +45,12 @@
{{ form_row(form.endDate) }} {{ form_row(form.endDate) }}
{% endif %} {% endif %}
{%- if form.location is defined -%} {%- if form.calendarRange is defined -%}
{{ form_row(form.location) }} {{ form_row(form.calendarRange) }}
<div id="location"></div>
{% endif %} {% endif %}
<div id="fullCalendar"></div>
{%- if form.comment is defined -%} {%- if form.comment is defined -%}
{{ form_row(form.comment) }} {{ form_row(form.comment) }}
{% endif %} {% endif %}
@ -52,7 +63,6 @@
{{ form_row(form.sendSMS) }} {{ form_row(form.sendSMS) }}
{% endif %} {% endif %}
<div id="fullCalendar"></div>
<ul class="record_actions sticky-form-buttons"> <ul class="record_actions sticky-form-buttons">
<li class="cancel"> <li class="cancel">
@ -61,7 +71,7 @@
{%- if context == 'person' -%} {%- if context == 'person' -%}
href="{{ chill_return_path_or('chill_calendar_calendar_list', { 'person_id': person.id } )}}" href="{{ chill_return_path_or('chill_calendar_calendar_list', { 'person_id': person.id } )}}"
{%- else -%} {%- else -%}
href="{{ chill_return_path_or('chill_calendar_calendar_list', { 'accompanying_period_id': accompanyingCourse.id } )}}" href="{{ chill_return_path_or('chill_calendar_calendar_list_by_period', { 'id': accompanyingCourse.id } )}}"
{%- endif -%} {%- endif -%}
> >
{{ 'Cancel'|trans|chill_return_path_label }} {{ 'Cancel'|trans|chill_return_path_label }}