Merge branch 'master' into 232_resources_comment

This commit is contained in:
2022-01-12 10:11:39 +01:00
96 changed files with 3798 additions and 625 deletions

View File

@@ -259,9 +259,9 @@ abbr.referrer { // still used ?
div#dashboards {
div.mbloc {
& > div:not(.warnings) {
border: 1px solid $chill-light-gray;
//border: 1px solid $chill-light-gray;
//border-radius: 0.35rem;
background-color: $chill-llight-gray;
border-radius: 0.35rem;
padding: 1rem;
}
& > div.warnings .alert {

View File

@@ -20,6 +20,11 @@ span.badge-thirdparty {
span.badge-user {
border-bottom-width: 1px;
&.system {
background-color: $chill-llight-gray;
font-style: italic;
color: $chill-gray;
}
}
span.badge-person {
border-bottom-color: $chill-green;

View File

@@ -81,6 +81,7 @@
{% endif %}
{% endfor %}
</div>
{% if form is not null %}
<div class="new-comment my-5">
<h2 class="chill-blue">{{ 'Write a new comment'|trans }}</h2>

View File

@@ -13,14 +13,19 @@
{% endmacro %}
{% block js %}
{{ parent() }}
{{ encore_entry_script_tags('page_accompanying_course_index_person_locate') }}
{{ encore_entry_script_tags('page_accompanying_course_index_masonry') }}
{{ parent() }}
{{ encore_entry_script_tags('page_accompanying_course_index_person_locate') }}
{{ encore_entry_script_tags('page_accompanying_course_index_masonry') }}
{{ encore_entry_script_tags('mod_notification_toggle_read_status') }}
{% endblock %}
{% block css %}
{{ parent() }}
{{ encore_entry_link_tags('mod_notification_toggle_read_status') }}
{% endblock %}
{% block content %}
<div class="accompanyingcourse-resume">
<div id="dashboards" class="row g-3" data-masonry='{"percentPosition": true }'>
{% if 'DRAFT' == accompanyingCourse.step %}
@@ -186,3 +191,18 @@
</div>
{% endblock %}
{% block block_post_menu %}
<div class="post-menu pt-4">
<div class="d-grid gap-2">
<a class="btn btn-primary" href="{{ chill_path_add_return_path('chill_main_notification_create', {'entityClass': 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod', 'entityId': accompanyingCourse.id}) }}">
<i class="fa fa-paper-plane fa-fw"></i>
{{ 'notification.Notify'|trans }}
</a>
</div>
{{ chill_list_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', accompanyingCourse.id) }}
</div>
{% endblock %}

View File

@@ -1,170 +1,60 @@
{% if person is defined %}
{% set contextEntity = { 'type': 'person', 'entity': person } %}{% endif %}
{% if household is defined %}
{% set contextEntity = { 'type': 'household', 'entity': household } %}{% endif %}
{% macro recordAction(period, contextEntity) %}
{# TODO if enable_accompanying_course_with_multiple_persons is true ... #}
<li>
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': period.id }) }}"
class="btn btn-show" title="{{ 'See accompanying period'|trans }}">{# {{ 'See this period'|trans }} #}</a>
</li>
{% if period.step == 'DRAFT' and contextEntity.type == 'person' %}
{% set person = contextEntity.entity %}
<li>
<a href="{{ path('chill_person_accompanying_course_delete', { 'accompanying_period_id': period.id, 'person_id' : person.id }) }}"
class="btn btn-delete" title="{{ 'Delete accompanying period'|trans }}">{# {{ 'Delete this period'|trans }} #}</a>
</li>
{% endif %}
{# DISABLED if new accompanying course, this is not necessary
{% if person is defined %}
<li>
<a href="{{ path('chill_person_accompanying_period_update', {'person_id' : person.id, 'period_id' : period.id } ) }}"
class="btn btn-update" title="{{ 'Edit accompanying period'|trans }}"></a>
</li>
{% if period.isOpen == true %}
<li>
<a href="{{ path('chill_person_accompanying_period_close', {'person_id' : person.id}) }}"
class="btn btn-update change-icon">
<i class="fa fa-fw fa-lock" aria-hidden="true"></i>
{{'Close accompanying period'|trans }}
</a>
</li>
{% endif %}
{% if period.canBeReOpened(person) == true %}
<li>
<a href="{{ path('chill_person_accompanying_period_re_open', {'person_id' : person.id, 'period_id' : period.id } ) }}"
class="btn btn-create change-icon">
<i class="fa fa-fw fa-unlock" aria-hidden="true"></i>
{{'Re-open accompanying period'|trans }}
</a>
</li>
{% endif %}
{% elseif household is defined %}
TODO buttons specific for household ?
{% endif %}
#}
{% endmacro %}
{% block content %}
<div class="flex-table accompanyingcourse-list">
{% for accompanying_period in accompanying_periods %}
<div class="item-bloc">
<div class="item-row">
<div class="wrap-header">
<div class="wh-row">
<div class="wh-col">
<span class="h3">
<i class="fa fa-fw fa-random"></i>
<b>{{ accompanying_period.id }}</b>
</span>
{% if accompanying_period.emergency %}
<span class="badge rounded-pill bg-danger">{{- 'Emergency'|trans|upper -}}</span>
{% endif %}
{% if accompanying_period.confidential %}
<span class="badge rounded-pill bg-danger">{{- 'Confidential'|trans|upper -}}</span>
{% endif %}
</div>
<div class="wh-col">
{% if accompanying_period.step == 'DRAFT' %}
<span class="badge bg-secondary">{{- 'Draft'|trans|upper -}}</span>
{% elseif accompanying_period.step == 'CONFIRMED' %}
<span class="badge bg-primary">{{- 'Confirmed'|trans|upper -}}</span>
{% else %}
<span class="badge bg-primary">{{- 'Closed'|trans|upper -}}</span>
{% endif %}
</div>
</div>
<div class="wh-row">
<div class="wh-col">
{% 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 %}
<dl class="chill_view_data">
<dt>{{ 'Closing motive'|trans }}&nbsp;:</dt>
<dd>{{ accompanying_period.closingMotive|chill_entity_render_box }}</dd>
</dl>
{% endif %}
{% endif %}
</div>
<div class="wh-col">
{% if chill_accompanying_periods.fields.user == 'visible' %}
{% if accompanying_period.user %}
<abbr class="referrer" title="{{ 'Referrer'|trans }}">ref:</abbr>
{{ accompanying_period.user.username|chill_entity_render_box }}
{% else %}
<span class="chill-no-data-statement">{{ 'No accompanying user'|trans }}</span>
{% endif %}
{% endif %}
</div>
</div>
</div>
{% for period in accompanying_periods %}
</div>
<div class="item-row separator">
<div class="wrap-list">
{% if accompanying_period.requestorPerson is not null or accompanying_period.requestorThirdParty is not null %}
<div class="wl-row">
<div class="wl-col title"><h3>{{ 'Requestor'|trans({'gender': null }) }}</h3></div>
<div class="wl-col list">
{% if accompanying_period.requestorPerson is not null %}
<span class="wl-item">
{% 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
} %}
</span>
{% endif %}
{% if accompanying_period.requestorThirdParty is not null %}
<span class="wl-item">
{% 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
} %}
</span>
{% endif %}
</div>
</div>
{% endif %}
{% include 'ChillPersonBundle:AccompanyingPeriod:_list_item.html.twig' with {
'recordAction': _self.recordAction(period, contextEntity)
} %}
{% if accompanying_period.participations.count > 0 %}
<div class="wl-row">
<div class="wl-col title"><h3>{{ 'Participants'|trans }}</h3></div>
<div class="wl-col list">
{% for p in accompanying_period.getCurrentParticipations %}
<span class="wl-item">
{% 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
} %}
</span>
{% endfor %}
</div>
</div>
{% endif %}
{% if accompanying_period.socialIssues.count > 0 %}
<div class="wl-row">
<div class="wl-col title"><h3>{{ 'Social issues'|trans }}</h3></div>
<div class="wl-col list">
{% for si in accompanying_period.socialIssues %}
<p class="wl-item">
{{ si|chill_entity_render_box }}
</p>
{% endfor %}
</div>
</div>
{% endif %}
</div>
</div>
<div class="item-row separator">
<ul class="record_actions">
{# TODO if enable_accompanying_course_with_multiple_persons is true ... #}
<li>
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': accompanying_period.id }) }}"
class="btn btn-show" title="{{ 'See accompanying period'|trans }}">{# {{ 'See this period'|trans }} #}</a>
</li>
{% if accompanying_period.step == 'DRAFT' %}
<li>
<a href="{{ path('chill_person_accompanying_course_delete', { 'accompanying_period_id': accompanying_period.id, 'person_id' : person.id }) }}"
class="btn btn-delete" title="{{ 'Delete accompanying period'|trans }}">{# {{ 'Delete this period'|trans }} #}</a>
</li>
{% endif %}
<!-- if new accompanying course, this is not necessary
{% if person is defined %}
<li>
<a href="{{ path('chill_person_accompanying_period_update', {'person_id' : person.id, 'period_id' : accompanying_period.id } ) }}"
class="btn btn-update" title="{{ 'Edit accompanying period'|trans }}"></a>
</li>
{% if accompanying_period.isOpen == true %}
<li>
<a href="{{ path('chill_person_accompanying_period_close', {'person_id' : person.id}) }}"
class="btn btn-update change-icon">
<i class="fa fa-fw fa-lock" aria-hidden="true"></i>
{{'Close accompanying period'|trans }}
</a>
</li>
{% endif %}
{% if accompanying_period.canBeReOpened(person) == true %}
<li>
<a href="{{ path('chill_person_accompanying_period_re_open', {'person_id' : person.id, 'period_id' : accompanying_period.id } ) }}"
class="btn btn-create change-icon">
<i class="fa fa-fw fa-unlock" aria-hidden="true"></i>
{{'Re-open accompanying period'|trans }}
</a>
</li>
{% endif %}
{% elseif household is defined %}
{# TODO buttons specific for household ? #}
{% endif %}
-->
</ul>
</div>
</div>
{% endfor %}
</div>
{% endblock content %}

View File

@@ -0,0 +1,121 @@
<div class="item-bloc accompanying-period-item{% if itemBlocClass is defined %} {{ itemBlocClass }}{% endif %}">
<div class="item-row">
<div class="wrap-header">
<div class="wh-row">
<div class="wh-col">
<span class="h3">
<i class="fa fa-fw fa-random"></i>
<b>{{ period.id }}</b>
</span>
{% if period.emergency %}
<span class="badge rounded-pill bg-danger">{{- 'Emergency'|trans|upper -}}</span>
{% endif %}
{% if period.confidential %}
<span class="badge rounded-pill bg-danger">{{- 'Confidential'|trans|upper -}}</span>
{% endif %}
</div>
<div class="wh-col">
{% if period.step == 'DRAFT' %}
<span class="badge bg-secondary">{{- 'Draft'|trans|upper -}}</span>
{% elseif period.step == 'CONFIRMED' %}
<span class="badge bg-primary">{{- 'Confirmed'|trans|upper -}}</span>
{% else %}
<span class="badge bg-primary">{{- 'Closed'|trans|upper -}}</span>
{% endif %}
</div>
</div>
<div class="wh-row">
<div class="wh-col">
{% 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 %}
<dl class="chill_view_data">
<dt>{{ 'Closing motive'|trans }}&nbsp;:</dt>
<dd>{{ period.closingMotive|chill_entity_render_box }}</dd>
</dl>
{% endif %}
{% endif %}
</div>
<div class="wh-col">
{% if chill_accompanying_periods.fields.user == 'visible' %}
{% if period.user %}
<abbr class="referrer" title="{{ 'Referrer'|trans }}">{{ 'Referrer'|trans }}:</abbr>
{{ period.user.username|chill_entity_render_box }}
{% else %}
<span class="chill-no-data-statement">{{ 'No accompanying user'|trans }}</span>
{% endif %}
{% endif %}
</div>
</div>
</div>
</div>
<div class="item-row separator">
<div class="wrap-list">
{% if period.requestorPerson is not null or period.requestorThirdParty is not null %}
<div class="wl-row">
<div class="wl-col title"><h3>{{ 'Requestor'|trans({'gender': null }) }}</h3></div>
<div class="wl-col list">
{% if period.requestorPerson is not null %}
<span class="wl-item">
{% 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
} %}
</span>
{% endif %}
{% if period.requestorThirdParty is not null %}
<span class="wl-item">
{% 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
} %}
</span>
{% endif %}
</div>
</div>
{% endif %}
{% if period.participations.count > 0 %}
<div class="wl-row">
<div class="wl-col title"><h3>{{ 'Participants'|trans }}</h3></div>
<div class="wl-col list">
{% for p in period.getCurrentParticipations %}
<span class="wl-item">
{% 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
} %}
</span>
{% endfor %}
</div>
</div>
{% endif %}
{% if period.socialIssues.count > 0 %}
<div class="wl-row">
<div class="wl-col title"><h3>{{ 'Social issues'|trans }}</h3></div>
<div class="wl-col list">
{% for si in period.socialIssues %}
<p class="wl-item">
{{ si|chill_entity_render_box }}
</p>
{% endfor %}
</div>
</div>
{% endif %}
</div>
</div>
{% if recordAction is defined %}
<div class="item-row separator">
<ul class="record_actions">
{{ recordAction }}
</ul>
</div>
{% endif %}
</div>

View File

@@ -1,3 +1,26 @@
<a href="{{ path('chill_person_accompanying_course_index', {'accompanying_period_id': notification.relatedEntityId }) }}">
Go to Acc. period.
</a>
{% macro recordAction(period) %}
<li>
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': period }) }}"
class="btn btn-show" title="{{ 'See accompanying period'|trans }}"></a>
</li>
{% endmacro %}
{% if period is not null %}
<div class="flex-table">
{% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', period) %}
{% include 'ChillPersonBundle:AccompanyingPeriod:_list_item.html.twig' with {
'recordAction': _self.recordAction(notification.relatedEntityId),
'itemBlocClass': 'bg-chill-llight-gray'
} %}
{% else %}
<div class="alert alert-warning border-warning border-1">
{{ 'This is the minimal period details'|trans ~ ': ' ~ period.id }}<br>
{{ 'You are getting a notification for a period you are not allowed to see'|trans }}
</div>
{% endif %}
</div>
{% else %}
<div class="alert alert-warning border-warning border-1">
{{ 'You are getting a notification for a period which does not exists any more'|trans }}
</div>
{% endif %}

View File

@@ -3,7 +3,7 @@
{% block title 'household.Household summary'|trans %}
{% block block_post_menu %}
<div class="block-post-menu"></div>
<div class="post-menu"></div>
{% endblock %}
{% block content %}

View File

@@ -0,0 +1,14 @@
{{ 'period_notification.You are designated to a new period'|trans }}
{{ 'period_notification.See it online'|trans }}:
{{ absolute_url(path('chill_person_accompanying_course_index', {'accompanying_period_id': accompanyingCourse.id}, false)) }}
{{ 'period_notification.Persons are'|trans }}:
{% for p in accompanyingCourse.getCurrentParticipations %}
* {{ p.person|chill_entity_render_string }}
{% endfor %}
{{ 'period_notification.Social issues are'|trans }}: {% for s in accompanyingCourse.socialIssues %}{{ s|chill_entity_render_string }}{% if not loop.last %}, {% endif %}{% endfor %}.

View File

@@ -1,5 +1,5 @@
{#
* Copyright (C) 2014-2021, Champs Libres Cooperative SCRLFS,
* Copyright (C) 2014-2021, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
@@ -38,7 +38,7 @@
}) }}
{% block block_post_menu %}
<div class="block-post-menu">
<div class="post-menu">
{{ chill_delegated_block('person_post_vertical_menu', { 'person': person } ) }}
</div>
{% endblock %}