diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list.html.twig index ebfbed604..90d42340c 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list.html.twig @@ -1,165 +1,47 @@ +{% macro recordAction(period) %} + {# TODO if enable_accompanying_course_with_multiple_persons is true ... #} +
  • + {# {{ 'See this period'|trans }} #} +
  • + {# DISABLED if new accompanying course, this is not necessary + {% if person is defined %} +
  • + +
  • + {% if period.isOpen == true %} +
  • + + + {{'Close accompanying period'|trans }} + +
  • + {% endif %} + {% if period.canBeReOpened(person) == true %} +
  • + + + {{'Re-open accompanying period'|trans }} + +
  • + {% endif %} + {% elseif household is defined %} + TODO buttons specific for household ? + {% endif %} + #} +{% endmacro %} + {% block content %}
    - {% for accompanying_period in accompanying_periods %} -
    -
    + {% for period in accompanying_periods %} -
    -
    -
    - - - {{ accompanying_period.id }} - - {% if accompanying_period.emergency %} - {{- 'Emergency'|trans|upper -}} - {% endif %} - {% if accompanying_period.confidential %} - {{- 'Confidential'|trans|upper -}} - {% endif %} -
    -
    - {% if accompanying_period.step == 'DRAFT' %} - {{- 'Draft'|trans|upper -}} - {% elseif accompanying_period.step == 'CONFIRMED' %} - {{- 'Confirmed'|trans|upper -}} - {% else %} - {{- 'Closed'|trans|upper -}} - {% endif %} -
    -
    -
    -
    - {% if accompanying_period.closingDate == null %} - {{ 'accompanying_period.dates_from_%opening_date%'|trans({ '%opening_date%': accompanying_period.openingDate|format_date('long') } ) }} - {% else %} - {{ 'accompanying_period.dates_from_%opening_date%_to_%closing_date%'|trans({ - '%opening_date%': accompanying_period.openingDate|format_date('long'), - '%closing_date%': accompanying_period.closingDate|format_date('long')} - ) }} - {% if accompanying_period.isOpen == false %} -
    -
    {{ 'Closing motive'|trans }} :
    -
    {{ accompanying_period.closingMotive|chill_entity_render_box }}
    -
    - {% endif %} - {% endif %} -
    -
    - {% if chill_accompanying_periods.fields.user == 'visible' %} - {% if accompanying_period.user %} - ref: - {{ accompanying_period.user.username|chill_entity_render_box }} - {% else %} - {{ 'No accompanying user'|trans }} - {% endif %} - {% endif %} -
    -
    -
    + {% include 'ChillPersonBundle:AccompanyingPeriod:_list_item.html.twig' with { + 'recordAction': _self.recordAction(period) + } %} -
    -
    -
    - {% if accompanying_period.requestorPerson is not null or accompanying_period.requestorThirdParty is not null %} -
    -

    {{ 'Requestor'|trans({'gender': null }) }}

    -
    - {% if accompanying_period.requestorPerson is not null %} - - {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { - action: 'show', displayBadge: true, - targetEntity: { name: 'person', id: accompanying_period.requestorPerson.id }, - buttonText: accompanying_period.requestorPerson|chill_entity_render_string - } %} - - {% endif %} - {% if accompanying_period.requestorThirdParty is not null %} - - {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { - action: 'show', displayBadge: true, - targetEntity: { name: 'thirdparty', id: accompanying_period.requestorThirdParty.id }, - buttonText: accompanying_period.requestorThirdParty|chill_entity_render_string - } %} - - {% endif %} -
    -
    - {% endif %} - - {% if accompanying_period.participations.count > 0 %} -
    -

    {{ 'Participants'|trans }}

    -
    - {% for p in accompanying_period.getCurrentParticipations %} - - {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { - action: 'show', displayBadge: true, - targetEntity: { name: 'person', id: p.person.id }, - buttonText: p.person|chill_entity_render_string - } %} - - {% endfor %} -
    -
    - {% endif %} - - {% if accompanying_period.socialIssues.count > 0 %} -
    -

    {{ 'Social issues'|trans }}

    -
    - {% for si in accompanying_period.socialIssues %} -

    - {{ si|chill_entity_render_box }} -

    - {% endfor %} -
    -
    - {% endif %} -
    - -
    -
    - - - -
    -
    {% endfor %}
    {% endblock content %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list_item.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list_item.html.twig new file mode 100644 index 000000000..c3787258b --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list_item.html.twig @@ -0,0 +1,121 @@ +
    +
    +
    +
    +
    + + + {{ period.id }} + + {% if period.emergency %} + {{- 'Emergency'|trans|upper -}} + {% endif %} + {% if period.confidential %} + {{- 'Confidential'|trans|upper -}} + {% endif %} +
    +
    + {% if period.step == 'DRAFT' %} + {{- 'Draft'|trans|upper -}} + {% elseif period.step == 'CONFIRMED' %} + {{- 'Confirmed'|trans|upper -}} + {% else %} + {{- 'Closed'|trans|upper -}} + {% endif %} +
    +
    +
    +
    + {% if period.closingDate == null %} + {{ 'accompanying_period.dates_from_%opening_date%'|trans({ '%opening_date%': period.openingDate|format_date('long') } ) }} + {% else %} + {{ 'accompanying_period.dates_from_%opening_date%_to_%closing_date%'|trans({ + '%opening_date%': period.openingDate|format_date('long'), + '%closing_date%': period.closingDate|format_date('long')} + ) }} + {% if period.isOpen == false %} +
    +
    {{ 'Closing motive'|trans }} :
    +
    {{ period.closingMotive|chill_entity_render_box }}
    +
    + {% endif %} + {% endif %} +
    +
    + {% if chill_accompanying_periods.fields.user == 'visible' %} + {% if period.user %} + {{ 'Referrer'|trans }}: + {{ period.user.username|chill_entity_render_box }} + {% else %} + {{ 'No accompanying user'|trans }} + {% endif %} + {% endif %} +
    +
    +
    +
    +
    +
    + {% if period.requestorPerson is not null or period.requestorThirdParty is not null %} +
    +

    {{ 'Requestor'|trans({'gender': null }) }}

    +
    + {% if period.requestorPerson is not null %} + + {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { + action: 'show', displayBadge: true, + targetEntity: { name: 'person', id: period.requestorPerson.id }, + buttonText: period.requestorPerson|chill_entity_render_string + } %} + + {% endif %} + {% if period.requestorThirdParty is not null %} + + {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { + action: 'show', displayBadge: true, + targetEntity: { name: 'thirdparty', id: period.requestorThirdParty.id }, + buttonText: period.requestorThirdParty|chill_entity_render_string + } %} + + {% endif %} +
    +
    + {% endif %} + {% if period.participations.count > 0 %} +
    +

    {{ 'Participants'|trans }}

    +
    + {% for p in period.getCurrentParticipations %} + + {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { + action: 'show', displayBadge: true, + targetEntity: { name: 'person', id: p.person.id }, + buttonText: p.person|chill_entity_render_string + } %} + + {% endfor %} +
    +
    + {% endif %} + {% if period.socialIssues.count > 0 %} +
    +

    {{ 'Social issues'|trans }}

    +
    + {% for si in period.socialIssues %} +

    + {{ si|chill_entity_render_box }} +

    + {% endfor %} +
    +
    + {% endif %} +
    +
    + {% if recordAction is defined %} +
    + +
    + {% endif %} +