From 55095ee6accbf3ae79bf503697ccfb8840b87c26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 21 Oct 2022 10:17:58 +0200 Subject: [PATCH] Feature: [calendar] show documents in layout of list (and move sms info) --- .../views/Calendar/_documents.twig.html | 45 +++ .../listByAccompanyingCourse.html.twig | 310 +++++++++--------- .../translations/messages.fr.yml | 2 + .../public/chill/scss/record_actions.scss | 11 + 4 files changed, 220 insertions(+), 148 deletions(-) create mode 100644 src/Bundle/ChillCalendarBundle/Resources/views/Calendar/_documents.twig.html diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/_documents.twig.html b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/_documents.twig.html new file mode 100644 index 000000000..187f36dd7 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/_documents.twig.html @@ -0,0 +1,45 @@ +{% if calendar.documents|length > 0 %} + +{% import "@ChillDocStore/Macro/macro.html.twig" as m %} +{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %} + + + +
+ + + + + + {% for d in calendar.documents %} + + + + {% endfor %} + +
+

{{ 'chill_calendar.Documents'|trans }}

+
+
    +
  • + {{ mm.mimeIcon(d.storedObject.type) }} + {{ d.storedObject.title }} + +
      + {% if chill_document_is_editable(d.storedObject) %} +
    • + {{ d.storedObject|chill_document_edit_button }} +
    • + {% endif %} +
    • + {{ m.download_button(d.storedObject, d.storedObject.title) }} +
    • +
    +
  • +
+
+
+{% endif %} diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByAccompanyingCourse.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByAccompanyingCourse.html.twig index 03e4c85c2..56d9a667d 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByAccompanyingCourse.html.twig +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/listByAccompanyingCourse.html.twig @@ -1,4 +1,4 @@ -{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %} +{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %} {% set activeRouteKey = 'chill_calendar_calendar_list' %} @@ -10,193 +10,207 @@ {% block js %} {{ parent() }} {{ encore_entry_script_tags('mod_answer') }} + {{ encore_entry_script_tags('mod_async_upload') }} {% endblock %} {% block css %} {{ parent() }} {{ encore_entry_link_tags('mod_answer') }} + {{ encore_entry_link_tags('mod_async_upload') }} {% endblock %} {% block content %} -

{{ 'Calendar list' |trans }}

+

{{ 'Calendar list' |trans }}

{{ filterOrder|chill_render_filter_order_helper }} {% if calendarItems|length == 0 %} -

- {{ "There is no calendar items."|trans }} - -

-{% else %} +

+ {{ "There is no calendar items."|trans }} + +

+ {% else %} -
+
- {% for calendar in calendarItems %} + {% for calendar in calendarItems %} -
-
-
-
-
-
- {% if calendar.endDate.diff(calendar.startDate).days >= 1 %} -

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

- {% else %} -

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

- {% endif %} +
+
+
+
+
+
+ {% if calendar.endDate.diff(calendar.startDate).days >= 1 %} +

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

+ {% else %} +

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

+ {% endif %} -
-

+

- {{ calendar.duration|date('%H:%I')}} -

-
+ {{ calendar.duration|date('%H:%I') }} + {% if false == calendar.sendSMS or null == calendar.sendSMS %} + + {% else %} + {% if calendar.smsStatus == 'sms_sent' %} + + + + + {% else %} + + + + + {% endif %} + {% endif %} +
+
-
-
-
    - {% if calendar.mainUser is not empty %} - {{ calendar.mainUser|chill_entity_render_box }} - {% endif %} -
-
+
+
    + {% if calendar.mainUser is not empty %} + {{ calendar.mainUser|chill_entity_render_box }} + {% endif %} +
+
-
-
- - {% - if calendar.comment.comment is not empty - or calendar.users|length > 0 - or calendar.thirdParties|length > 0 - or calendar.users|length > 0 - %} -
-
- {% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with { - 'context': 'calendar_accompanyingCourse', - 'render': 'wrap-list', - 'entity': calendar - } %} -
- -
- {% endif %} - - {% if calendar.comment.comment is not empty %} -
-
- {{ calendar.comment|chill_entity_render_box( { 'limit_lines': 3, 'metadata': false } ) }}
- {% endif %} - {% if calendar.location is not empty %} -
+ {% if calendar.comment.comment is not empty + or calendar.users|length > 0 + or calendar.thirdParties|length > 0 + or calendar.users|length > 0 %} +
+
+ {% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with { + 'context': 'calendar_accompanyingCourse', + 'render': 'wrap-list', + 'entity': calendar + } %} +
+ +
+ {% endif %} + + {% if calendar.comment.comment is not empty %} +
+
+ {{ calendar.comment|chill_entity_render_box( { 'limit_lines': 3, 'metadata': false } ) }} +
+
+ {% endif %} + + {% if calendar.location is not empty %} +
+
+ {% if calendar.location.address is not same as(null) and calendar.location.name is not empty %} + {% endif %} + {% if calendar.location.name is not empty %}{{ calendar.location.name }}{% endif %} + {% if calendar.location.address is not same as(null) %}{{ calendar.location.address|chill_entity_render_box({'multiline': false, 'with_picto': (calendar.location.name is empty)}) }}{% else %} + {% endif %} + {% if calendar.location.phonenumber1 is not empty %} {{ calendar.location.phonenumber1|chill_format_phonenumber }}{% endif %} + {% if calendar.location.phonenumber2 is not empty %} {{ calendar.location.phonenumber2|chill_format_phonenumber }}{% endif %} +
+
+ {% endif %} + +
- {% if calendar.location.address is not same as(null) and calendar.location.name is not empty %}{% endif %} - {% if calendar.location.name is not empty %}{{ calendar.location.name }}{% endif %} - {% if calendar.location.address is not same as(null) %}{{ calendar.location.address|chill_entity_render_box({'multiline': false, 'with_picto': (calendar.location.name is empty)}) }}{% else %}{% endif %} - {% if calendar.location.phonenumber1 is not empty %} {{ calendar.location.phonenumber1|chill_format_phonenumber }}{% endif %} - {% if calendar.location.phonenumber2 is not empty %} {{ calendar.location.phonenumber2|chill_format_phonenumber }}{% endif %} + + {{ include('@ChillCalendar/Calendar/_documents.twig.html') }}
- {% endif %} -
-
- {% if false == calendar.sendSMS or null == calendar.sendSMS %} - - - - - {% else %} - {% if calendar.smsStatus == 'sms_sent' %} - - - - - {% else %} - - - - +
+
- -
    - {% if is_granted('CHILL_CALENDAR_CALENDAR_SEE', calendar) and hasDocs %} -
  • - - {{ 'chill_calendar.Add a document'|trans }} - -
  • - {% endif %} - {% if is_granted('CHILL_ACTIVITY_CREATE', accompanyingCourse) and calendar.activity is null %} -
  • - - {{ 'Transform to activity'|trans }} - -
  • - {% endif %} - {% if (calendar.isInvited(app.user)) %} - {% set invite = calendar.inviteForUser(app.user) %} -
  • -
    -
  • - {% endif %} - {% if false %} -
  • - -
  • - {% endif %} - {# TOOD + {% if is_granted('CHILL_ACTIVITY_CREATE', accompanyingCourse) and calendar.activity is null %} +
  • + + {{ 'Transform to activity'|trans }} + +
  • + {% endif %} + {% if (calendar.isInvited(app.user)) %} + {% set invite = calendar.inviteForUser(app.user) %} +
  • +
    +
  • + {% endif %} + {% if false %} +
  • + +
  • + {% endif %} + {# TOOD {% if is_granted('CHILL_ACTIVITY_UPDATE', calendar) %} - #} -
  • - -
  • - {# TOOD + #} +
  • + +
  • + {# TOOD {% endif %} {% if is_granted('CHILL_ACTIVITY_DELETE', calendar) %} - #} -
  • - -
  • - {# - {% endif %} - #} -
+ #} +
  • + +
  • + {# + {% endif %} + #} + + +
    + {% endfor %} -
    - {% endfor %} + {% if calendarItems|length < paginator.getTotalItems %} + {{ chill_pagination(paginator) }} + {% endif %} - {% if calendarItems|length < paginator.getTotalItems %} - {{ chill_pagination(paginator) }} +
    + {% endif %} + + +
    -{% endif %} - - - + {% endblock %} diff --git a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml index 7e8717003..95d99b867 100644 --- a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml @@ -51,6 +51,7 @@ chill_calendar: To: Au Next calendars: Prochains rendez-vous Add a document: Ajouter un document + Documents: Documents remote_ms_graph: @@ -125,3 +126,4 @@ docgen: Third party label: Label pour choisir le tiers Destinee: Destinataire None: Aucun choix + title of the generated document: Titre du document généré diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/record_actions.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/record_actions.scss index d72b77e04..b8f60e250 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/record_actions.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/record_actions.scss @@ -5,6 +5,10 @@ ul.record_actions { justify-content: flex-end; padding: 0.5em 0; + &.inline { + display: inline-block; + } + &.column { flex-direction: column; } @@ -18,6 +22,13 @@ ul.record_actions { padding-right: 1em; } + &.small { + .btn { + padding: .25rem .5rem; + font-size: .75rem; + } + } + li { display: inline-block; list-style-type: none;