Merge remote-tracking branch 'origin/features/rdv'

This commit is contained in:
Julien Fastré 2021-08-20 12:48:37 +02:00
commit 20ef04683d
16 changed files with 104 additions and 75 deletions

View File

@ -139,10 +139,9 @@ class CalendarController extends AbstractController
$this->addFlash('success', $this->get('translator')->trans('Success : calendar item created!')); $this->addFlash('success', $this->get('translator')->trans('Success : calendar item created!'));
$params = $this->buildParamsToUrl($user, $accompanyingPeriod); //TODO useful? $params = $this->buildParamsToUrl($user, $accompanyingPeriod);
$params['id'] = $entity->getId();
return $this->redirectToRoute('chill_calendar_calendar_show', $params); return $this->redirectToRoute('chill_calendar_calendar', $params);
} elseif ($form->isSubmitted() and !$form->isValid()) { } elseif ($form->isSubmitted() and !$form->isValid()) {
$this->addFlash('error', $this->get('translator')->trans('This form contains errors')); $this->addFlash('error', $this->get('translator')->trans('This form contains errors'));
} }
@ -241,8 +240,7 @@ class CalendarController extends AbstractController
$this->addFlash('success', $this->get('translator')->trans('Success : calendar item updated!')); $this->addFlash('success', $this->get('translator')->trans('Success : calendar item updated!'));
$params = $this->buildParamsToUrl($user, $accompanyingPeriod); $params = $this->buildParamsToUrl($user, $accompanyingPeriod);
$params['id'] = $id; return $this->redirectToRoute('chill_calendar_calendar', $params);
return $this->redirectToRoute('chill_calendar_calendar_show', $params);
} elseif ($form->isSubmitted() and !$form->isValid()) { } elseif ($form->isSubmitted() and !$form->isValid()) {
$this->addFlash('error', $this->get('translator')->trans('This form contains errors')); $this->addFlash('error', $this->get('translator')->trans('This form contains errors'));
} }
@ -304,7 +302,7 @@ class CalendarController extends AbstractController
$em->flush(); $em->flush();
$this->addFlash('success', $this->get('translator') $this->addFlash('success', $this->get('translator')
->trans("The calendar has been successfully removed.")); ->trans("The calendar item has been successfully removed."));
$params = $this->buildParamsToUrl($user, $accompanyingPeriod); $params = $this->buildParamsToUrl($user, $accompanyingPeriod);
return $this->redirectToRoute('chill_calendar_calendar', $params); return $this->redirectToRoute('chill_calendar_calendar', $params);

View File

@ -48,13 +48,13 @@ class CalendarType extends AbstractType
->add('comment', CommentType::class, [ ->add('comment', CommentType::class, [
'required' => false 'required' => false
]) ])
->add('cancelReason', EntityType::class, [ // ->add('cancelReason', EntityType::class, [
'required' => false, // 'required' => false,
'class' => CancelReason::class, // 'class' => CancelReason::class,
'choice_label' => function (CancelReason $entity) { // 'choice_label' => function (CancelReason $entity) {
return $entity->getCanceledBy(); // return $entity->getCanceledBy();
}, // },
]) // ])
->add('sendSMS', ChoiceType::class, [ ->add('sendSMS', ChoiceType::class, [
'required' => false, 'required' => false,
'choices' => [ 'choices' => [

View File

@ -0,0 +1 @@
require('./scss/calendar.scss');

View File

@ -0,0 +1,10 @@
div#calendarControls {
height: 50%;
display: flex;
flex-direction: column;
justify-content: flex-end;
}
div#fullCalendar{
}

View File

@ -1,18 +1,21 @@
<template> <template>
<concerned-groups></concerned-groups> <concerned-groups></concerned-groups>
<calendar-user-selector <teleport to="#calendarControls">
v-bind:users="users" <calendar-user-selector
v-bind:calendarEvents="calendarEvents" v-bind:users="users"
v-bind:updateEventsSource="updateEventsSource" v-bind:calendarEvents="calendarEvents"
v-bind:showMyCalendar="showMyCalendar" v-bind:updateEventsSource="updateEventsSource"
v-bind:toggleMyCalendar="toggleMyCalendar" > v-bind:showMyCalendar="showMyCalendar"
</calendar-user-selector> v-bind:toggleMyCalendar="toggleMyCalendar" >
<h2 class="chill-red">{{ $t('choose_your_date') }}</h2> </calendar-user-selector>
<FullCalendar ref="fullCalendar" :options="calendarOptions"> </teleport>
<template v-slot:eventContent='arg'> <teleport to="#fullCalendar">
<b>{{ arg.timeText }}</b> <FullCalendar ref="fullCalendar" :options="calendarOptions">
</template> <template v-slot:eventContent='arg'>
</FullCalendar> <b>{{ arg.timeText }}</b>
</template>
</FullCalendar>
</teleport>
</template> </template>
<script> <script>

View File

@ -1,6 +1,6 @@
<template> <template>
<h2 class="chill-red">{{ $t('choose_your_calendar_user') }}</h2> <div class="calendar__controls">
<div> <h2 class="chill-red">{{ $t('choose_your_calendar_user') }}</h2>
<VueMultiselect <VueMultiselect
name="field" name="field"
id="calendarUserSelector" id="calendarUserSelector"
@ -196,3 +196,12 @@ export default {
<style src="vue-multiselect/dist/vue-multiselect.css"></style> <style src="vue-multiselect/dist/vue-multiselect.css"></style>
<style lang="scss" scoped>
div.calendar__controls {
background-color: 'black';
height: 50%;
display: flex;
flex-direction: column;
justify-content: flex-end;
}
</style>

View File

@ -2,7 +2,7 @@ const calendarUserSelectorMessages = {
fr: { fr: {
choose_your_calendar_user: "Afficher les plages de disponibilités", choose_your_calendar_user: "Afficher les plages de disponibilités",
select_user: "Sélectionnez des calendriers", select_user: "Sélectionnez des calendriers",
show_my_calendar: "Affichez mon calendrier" show_my_calendar: "Afficher mon calendrier"
} }
}; };

View File

@ -40,10 +40,6 @@
.. location .. location
{%- if form.cancelReason is defined -%}
{{ form_row(form.cancelReason) }}
{% endif %}
{%- if form.comment is defined -%} {%- if form.comment is defined -%}
{{ form_row(form.comment) }} {{ form_row(form.comment) }}
{% endif %} {% endif %}
@ -52,8 +48,7 @@
{{ form_row(form.sendSMS) }} {{ form_row(form.sendSMS) }}
{% endif %} {% endif %}
<div id="fullCalendar"></div>
..calendarRange
<ul class="record_actions sticky-form-buttons"> <ul class="record_actions sticky-form-buttons">
<li class="cancel"> <li class="cancel">

View File

@ -36,3 +36,7 @@
{{ parent() }} {{ parent() }}
{{ encore_entry_link_tags('vue_calendar') }} {{ encore_entry_link_tags('vue_calendar') }}
{% endblock %} {% endblock %}
{% block block_post_menu %}
<div id="calendarControls"></div>
{% endblock %}

View File

@ -24,22 +24,25 @@
<div class="item-bloc"> <div class="item-bloc">
<div class="item-row main"> <div class="item-row main">
<div class="item-col"> <div class="item-col">
{% if calendar.startDate %}
<h3>{{ calendar.startDate|format_datetime('long') }} </h3>
{% endif %}
{% if calendar.endDate %}
<h3>{{ calendar.endDate|format_datetime('long') }}</h3>
{% endif %}
<div class="duration">
<p> {% if calendar.startDate and calendar.endDate %}
<i class="fa fa-fw fa-hourglass-end"></i> {% if calendar.endDate.diff(calendar.startDate).days >= 1 %}
{{ calendar.endDate.diff(calendar.startDate)|date("%H:%M")}} <h3>{{ "From the day"|trans }} {{ calendar.startDate|format_datetime('medium', 'short') }} </h3>
</p> <h3>{{ "to the day"|trans }} {{ calendar.endDate|format_datetime('medium', 'short') }}</h3>
</div> {% else %}
<h3>{{ calendar.startDate|format_date('full') }} </h3>
<h3>{{ calendar.startDate|format_datetime('none', 'short', locale='fr') }} - {{ calendar.endDate|format_datetime('none', 'short', locale='fr') }}</h3>
<div class="duration">
<p>
<i class="fa fa-fw fa-hourglass-end"></i>
{{ calendar.endDate.diff(calendar.startDate)|date("%H:%M")}}
</p>
</div>
{% endif %}
{% endif %}
{% if context == 'user' and calendar.accompanyingPeriod is not empty %} {% if context == 'user' and calendar.accompanyingPeriod is not empty %}
<div class="accompanyingPeriodLink" style="margin-top: 1rem"> <div class="accompanyingPeriodLink" style="margin-top: 1rem">
@ -66,7 +69,7 @@
{% if calendar.mainUser is not empty %} {% if calendar.mainUser is not empty %}
<li> <li>
<b>{{ 'main user concerned'|trans }}{{ calendar.mainUser.usernameCanonical }}</b> <b>{{ 'main user concerned'|trans }}: {{ calendar.mainUser.usernameCanonical }}</b>
</li> </li>
{% endif %} {% endif %}

View File

@ -1,4 +1,4 @@
<h1>{{ "Calendar item creation"|trans ~ ' :' }}</h1> <h1>{{ "Calendar item creation"|trans }}</h1>
{{ form_start(form) }} {{ form_start(form) }}
{{ form_errors(form) }} {{ form_errors(form) }}
@ -34,16 +34,8 @@
{{ form_row(form.endDate) }} {{ form_row(form.endDate) }}
{% endif %} {% endif %}
{%- if form.calendarRange is defined -%}
{{ form_row(form.calendarRange) }}
{% endif %}
.. location .. location
{%- if form.cancelReason is defined -%}
{{ form_row(form.cancelReason) }}
{% endif %}
{%- if form.comment is defined -%} {%- if form.comment is defined -%}
{{ form_row(form.comment) }} {{ form_row(form.comment) }}
{% endif %} {% endif %}
@ -52,19 +44,16 @@
{{ form_row(form.sendSMS) }} {{ form_row(form.sendSMS) }}
{% endif %} {% endif %}
<div id="fullCalendar"></div>
..calendarRange
<ul class="record_actions sticky-form-buttons"> <ul class="record_actions sticky-form-buttons">
<li class="cancel"> <li class="cancel">
<a <a
class="btn btn-cancel" class="btn btn-cancel"
{%- if context == 'person' -%} {%- if context == 'person' -%}
href="{{ chill_return_path_or('chill_activity_activity_list', { 'person_id': person.id } )}}" href="{{ chill_return_path_or('chill_calendar_calendar', { 'person_id': person.id } )}}"
{%- else -%} {%- else -%}
href="{{ chill_return_path_or('chill_activity_activity_list', { 'accompanying_period_id': accompanyingCourse.id } )}}" href="{{ chill_return_path_or('chill_calendar_calendar', { 'accompanying_period_id': accompanyingCourse.id } )}}"
{%- endif -%} {%- endif -%}
> >
{{ 'Cancel'|trans|chill_return_path_label }} {{ 'Cancel'|trans|chill_return_path_label }}

View File

@ -34,4 +34,6 @@
<link rel="stylesheet" href="{{ asset('build/vue_calendar.css') }}"/> <link rel="stylesheet" href="{{ asset('build/vue_calendar.css') }}"/>
{% endblock %} {% endblock %}
{% block block_post_menu %}
<div id="calendarControls"></div>
{% endblock %}

View File

@ -11,11 +11,18 @@
<h2 class="chill-red">{{ 'Calendar data'|trans }}</h2> <h2 class="chill-red">{{ 'Calendar data'|trans }}</h2>
<dt class="inline">{{ 'start date'|trans }}</dt> {% if entity.endDate.diff(entity.startDate).days >= 1 %}
<dd>{{ entity.startDate|format_datetime('long') }}</dd> <dt>{{ "From the day"|trans }} {{ entity.startDate|format_datetime('medium', 'short') }}
{{ "to the day"|trans }} {{ entity.endDate|format_datetime('medium', 'short') }}
<dt class="inline">{{ 'end date'|trans }}</dt> </dt>
<dd>{{ entity.endDate|format_datetime('long') }}</dd> <dd></dd>
{% else %}
<dt>
{{ entity.startDate|format_date('full') }},
{{ entity.startDate|format_datetime('none', 'short', locale='fr') }} - {{ entity.endDate|format_datetime('none', 'short', locale='fr') }}
</dt>
<dd></dd>
{% endif %}
<dt class="inline">{{ 'cancel reason'|trans }}</dt> <dt class="inline">{{ 'cancel reason'|trans }}</dt>
<dd> <dd>

View File

@ -1,10 +1,10 @@
// this file loads all assets from the Chill calendar bundle // this file loads all assets from the Chill calendar bundle
module.exports = function(encore, entries) { module.exports = function(encore, entries) {
//entries.push(__dirname + '/Resources/public/index.js'); entries.push(__dirname + '/Resources/public/chill/index.js');
encore.addAliases({ encore.addAliases({
ChillCalendarAssets: __dirname + '/Resources/public' ChillCalendarAssets: __dirname + '/Resources/public'
}); });
encore.addEntry('vue_calendar', __dirname + '/Resources/public/vuejs/Calendar/index.js'); encore.addEntry('vue_calendar', __dirname + '/Resources/public/vuejs/Calendar/index.js');
}; };

View File

@ -6,7 +6,7 @@ Are you sure you want to remove the calendar item?: Êtes-vous sûr de vouloir s
Concerned groups: Parties concernées Concerned groups: Parties concernées
Calendar data: Données du rendez-vous Calendar data: Données du rendez-vous
Update calendar: Modifier le rendez-vous Update calendar: Modifier le rendez-vous
main user concerned: Utilisateur principal main user concerned: Utilisateur concerné
Main user: Utilisateur principal Main user: Utilisateur principal
Calendar item creation: Création du rendez-vous Calendar item creation: Création du rendez-vous
start date: début du rendez-vous start date: début du rendez-vous
@ -18,3 +18,7 @@ sendSMS: Envoi d'un SMS
Send s m s: Envoi d'un SMS ? Send s m s: Envoi d'un SMS ?
Cancel reason: Motif d'annulation Cancel reason: Motif d'annulation
Add a new calendar: Ajouter un nouveau rendez-vous Add a new calendar: Ajouter un nouveau rendez-vous
"Success : calendar item updated!": "Rendez-vous mis à jour"
The calendar item has been successfully removed.: Le rendez-vous a été supprimé
From the day: Du
to the day: au

View File

@ -17,6 +17,10 @@
'layout': '@ChillPerson/menu.html.twig', 'layout': '@ChillPerson/menu.html.twig',
'args' : { 'accompanyingCourse': accompanyingCourse } 'args' : { 'accompanyingCourse': accompanyingCourse }
}) }} }) }}
{% block block_post_menu %}
{% endblock %}
{% endblock %} {% endblock %}
{% block css %} {% block css %}