From 014e281d137c86f97d5c874a97d8775582582263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 30 Jun 2022 21:40:40 +0200 Subject: [PATCH] add sms on calendar list --- .../ChillCalendarBundle/Entity/Calendar.php | 2 +- .../ChillCalendarBundle/Form/CalendarType.php | 1 - .../listByAccompanyingCourse.html.twig | 31 ++++++++++++++++--- .../Resources/views/Calendar/show.html.twig | 15 +++++++-- .../translations/messages.fr.yml | 3 ++ 5 files changed, 43 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php index da024fa94..17dbbe7c5 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php +++ b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php @@ -175,7 +175,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(type="boolean", nullable=true) */ - private ?bool $sendSMS = null; + private ?bool $sendSMS = false; /** * @ORM\Column(type="text", nullable=false, options={"default": Calendar::SMS_PENDING}) diff --git a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php index 05fa11524..ebd62fb2e 100644 --- a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php +++ b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php @@ -78,7 +78,6 @@ class CalendarType extends AbstractType // }, // ]) ->add('sendSMS', ChoiceType::class, [ - 'required' => false, 'choices' => [ 'Oui' => true, 'Non' => false, diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByAccompanyingCourse.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByAccompanyingCourse.html.twig index f5220d713..cdd6a096a 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByAccompanyingCourse.html.twig +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByAccompanyingCourse.html.twig @@ -45,7 +45,7 @@

{{ calendar.startDate|format_datetime('short', 'short') }} - {{ calendar.endDate|format_datetime('none', 'short') }}

{% endif %} -
+

{{ calendar.duration|date('%H:%I')}} @@ -103,6 +103,27 @@ {% endif %}

+
+ {% if false == calendar.sendSMS or null == calendar.sendSMS %} + + + + + {% else %} + {% if calendar.smsStatus == 'sms_sent' %} + + + + + {% else %} + + + + + {% endif %} + {% endif %} +
+
    {% if (calendar.isInvited(app.user)) %} {% set invite = calendar.inviteForUser(app.user) %} @@ -110,21 +131,23 @@
    {% endif %} + {% if false %}
  • - +
  • + {% endif %} {# TOOD {% if is_granted('CHILL_ACTIVITY_UPDATE', calendar) %} #}
  • - +
  • {# TOOD {% endif %} {% if is_granted('CHILL_ACTIVITY_DELETE', calendar) %} #}
  • - +
  • {# {% endif %} diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/show.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/show.html.twig index 3a1bf03d5..bff4baa53 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/show.html.twig +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/show.html.twig @@ -1,4 +1,13 @@

    {{ "Calendar"|trans }}

    +

    + {% if entity.endDate.diff(entity.startDate).days >= 1 %} + {{ "From the day"|trans }} {{ entity.startDate|format_datetime('medium', 'short') }} + {{ "to the day"|trans }} {{ entity.endDate|format_datetime('medium', 'short') }} + {% else %} + {{ entity.startDate|format_date('full') }}, + {{ entity.startDate|format_datetime('none', 'short', locale='fr') }} - {{ entity.endDate|format_datetime('none', 'short', locale='fr') }} + {% endif %} +

    {{ 'main user concerned'|trans }}
    @@ -6,7 +15,7 @@

    {{ 'Concerned groups'|trans }}

    -{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'render': 'bloc' } %} +{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': 'calendar_' ~ context, 'render': 'bloc' } %}

    {{ 'Calendar data'|trans }}

    @@ -79,8 +88,8 @@
    • - + {{ 'Back to the list'|trans }}
    • diff --git a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml index a038a11ea..681e0cd69 100644 --- a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml @@ -26,6 +26,9 @@ The calendar item has been successfully removed.: Le rendez-vous a été supprim From the day: Du to the day: au Transform to activity: Transformer en échange +Will send SMS: Un SMS de rappel sera envoyé +Will not send SMS: Aucun SMS de rappel ne sera envoyé +SMS already sent: Un SMS a été envoyé canceledBy: supprimé par Canceled by: supprimé par