renderbox person and thirdparty on resume accompanyingcourse, flex-bloc and flex-table

This commit is contained in:
Mathieu Jaumotte 2021-07-28 23:41:10 +02:00
parent 2893b9c726
commit 3637ae6aee
6 changed files with 128 additions and 304 deletions

View File

@ -6,7 +6,7 @@
//}
.activity {
color: $chill-green;
//color: $chill-green;
}
// exceptions for flex-bloc in concerned-groups

View File

@ -18,57 +18,44 @@
{% else %}
<div class="flex-table list-records context-{{ context }}">
<!--
<thead>
<tr>
<th class="chill-red">{{'Date' | trans }}</th>
<th class="chill-green">{{'Duration Time' | trans }}</th>
<th class="chill-orange">{{'Reasons' | trans}}</th>
<th>{{'Type' | trans}}</th>
<th>&nbsp;</th>
</tr>
</thead>
-->
{% for activity in activities %}
{% set t = activity.type %}
<div class="item-bloc">
<div class="item-row main">
<div class="item-col">
{% if activity.date %}
<h3>{{ activity.date|format_date('long') }}</h3>
{% endif %}
<div class="duration">
{% if t.durationTimeVisible > 0 %}
<p>
<i class="fa fa-fw fa-hourglass-end"></i>
{{ activity.durationTime|date('H:i') }}
</p>
{% endif %}
{% if t.durationTimeVisible > 0 %}
<p>
<i class="fa fa-fw fa-hourglass-end"></i>
{{ activity.durationTime|date('H:i') }}
</p>
{% endif %}
{% if activity.travelTime and t.travelTimeVisible %}
<p>
<i class="fa fa-fw fa-car"></i>
{{ activity.travelTime|date('H:i') }}
</p>
<p>
<i class="fa fa-fw fa-car"></i>
{{ activity.travelTime|date('H:i') }}
</p>
{% endif %}
</div>
{% if context == 'person' and activity.accompanyingPeriod is not empty %}
<div class="accompanyingPeriodLink" style="margin-top: 1rem">
<a
href="{{ chill_path_add_return_path(
"chill_person_accompanying_course_index",
{ 'accompanying_period_id': activity.accompanyingPeriod.id }
) }}"
>
<i class="fa fa-random"></i>
{{ activity.accompanyingPeriod.id }}
<div class="accompanyingPeriodLink" style="margin-top: 1rem">
<a href="{{ chill_path_add_return_path(
"chill_person_accompanying_course_index",
{ 'accompanying_period_id': activity.accompanyingPeriod.id }
) }}">
<i class="fa fa-random"></i>
{{ activity.accompanyingPeriod.id }}
</a>
</div>
</div>
{% endif %}
</div>
<div class="item-col">
<ul class="list-content">
@ -77,19 +64,19 @@
<b>{{ 'by'|trans }}{{ activity.user.usernameCanonical }}</b>
</li>
{% endif %}
<li>
<b>{{ activity.type.name | localize_translatable_string }}</b>
{% if activity.attendee is not null and t.attendeeVisible %}
{% if activity.attendee %}
{{ '→ ' ~ 'present'|trans|capitalize }}
{% else %}
{{ '→ ' ~ 'present'|trans|capitalize }}
{% else %}
{{ '→ ' ~ 'not present'|trans|capitalize }}
{% endif %}
{% endif %}
</li>
<li>
<b>{{ 'location'|trans ~ ': ' }}</b>
Domicile de l'usager
@ -97,7 +84,7 @@
{% if activity.location %}{{ activity.location }}{% endif %}
#}
</li>
{%- if t.reasonsVisible -%}
<li>
{%- if activity.reasons is empty -%}
@ -121,7 +108,7 @@
{%- endif -%}
</li>
{% endif %}
{%- if t.socialActionsVisible -%}
<li class="social-actions">
{%- if activity.socialActions is empty -%}
@ -134,7 +121,7 @@
</li>
{% endif %}
</ul>
<ul class="record_actions">
<li>
@ -159,19 +146,19 @@
</ul>
</div>
</div>
{%
{%
if activity.comment.comment is not empty
or activity.persons|length > 0
or activity.thirdParties|length > 0
or activity.users|length > 0
or activity.users|length > 0
%}
<div class="item-row details">
<div class="item-col">
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'row', 'entity': activity } %}
</div>
{% if activity.comment.comment is not empty %}
<div class="item-col comment">
{{ activity.comment|chill_entity_render_box( { 'limit_lines': 3, 'metadata': false } ) }}
@ -179,7 +166,7 @@
{% endif %}
</div>
{% endif %}
</div>
{% endfor %}
</div>

View File

@ -0,0 +1,38 @@
<div class="alert alert-danger alert-with-actions">
<div class="message">
{{ 'Some peoples does not belong to any household currently. Add them to an household soon'|trans }}
</div>
<ul class="record_actions">
<li>
<button class="btn btn-create" data-bs-toggle="collapse" href="#withoutHouseholdList">
{{ 'Add to household now'|trans }}
</button>
</li>
</ul>
</div>
<div id="withoutHouseholdList" class="collapse">
<form method="GET"
action="{{ chill_path_add_return_path('chill_person_household_members_editor') }}">
<h3>{{ 'household.Select people to move'|trans }}</h3>
<ul>
{% for p in withoutHousehold %}
<li>
<input type="checkbox" name="persons[]" value="{{ p.id }}" checked />
{{ p|chill_entity_render_box }}
</li>
{% endfor %}
</ul>
<input type="hidden" name="expand_suggestions" value="true" />
<input type="hidden" name="accompanying_period_id" value="{{ accompanyingCourse.id }}" />
<ul class="record_actions">
<li>
<button type="submit" class="btn btn-edit">
{{ 'household.Household editor'|trans }}
</button>
</li>
</ul>
</form>
</div>

View File

@ -7,10 +7,10 @@
{% endblock %}
{% block content %}
<div class="accompanying_course-index">
<div class="accompanyingcourse-resume">
{% if 'DRAFT' == accompanyingCourse.step %}
<div class="col-8 centered error flash_message">
<div class="col-8 alert alert-danger flash_message mb-5">
<span>
{{ 'This accompanying course is still a draft'|trans }}
<a href="{{ path('chill_person_accompanying_course_edit', { 'accompanying_period_id': accompanyingCourse.id } ) }}">
@ -20,205 +20,61 @@
</div>
{% endif %}
{% if withoutHousehold|length > 0 %}
<div class="alert alert-danger alert-with-actions">
<div class="message">
{{ 'Some peoples does not belong to any household currently. Add them to an household soon'|trans }}
</div>
<ul class="record_actions">
<li>
<button class="btn btn-create" data-bs-toggle="collapse" href="#withoutHouseholdList">
{{ 'Add to household now'|trans }}
</button>
</li>
</ul>
</div>
<div id="withoutHouseholdList" class="collapse">
<form method="GET"
action="{{ chill_path_add_return_path('chill_person_household_members_editor') }}">
<h3>{{ 'household.Select people to move'|trans }}</h3>
<ul>
{% for p in withoutHousehold %}
<li>
<input type="checkbox" name="persons[]" value="{{ p.id }}" checked />
{{ p|chill_entity_render_box }}
</li>
{% endfor %}
</ul>
<input type="hidden" name="expand_suggestions" value="true" />
<input type="hidden" name="accompanying_period_id" value="{{ accompanyingCourse.id }}" />
<div class="associated-persons mb-5">
<h2 class="mb-3">{{ 'Associated peoples'|trans }}</h2>
<div class="flex-table mb-3">
{% for participation in accompanyingCourse.participations %}
{% if participation.enddate is null %}
<div class="item-bloc">
{{ participation.person|chill_entity_render_box({
'render': 'bloc', 'addLink': false, 'addInfo': true
}) }}
</div>
{% endif %}
{% endfor %}
{# AJOUTER ACTIONS
<ul class="record_actions">
{% if p.person.isSharingHousehold %}
<li>
<button type="submit" class="btn btn-edit">
{{ 'household.Household editor'|trans }}
</button>
<a href="{{ chill_path_add_return_path('chill_person_household_summary', { 'household_id': p.person.getCurrentHousehold.id }) }}"
class="btn btn-misc">
<i class="fa fa-home"></i>
n°&nbsp;
{{ p.person.getCurrentHousehold.id }}
</a>
</li>
{% endif %}
</ul>
</form>
#}
</div>
{% if withoutHousehold|length > 0 %}
{% include '@ChillPerson/AccompanyingCourse/_join_household.html.twig' with {} %}
{% endif %}
</div>
{% endif %}
<h2>{{ 'Associated peoples'|trans }}</h2>
<div class="flex-table">
{% for p in accompanyingCourse.participations %}
{% if p.enddate is null %}
<div class="item-bloc">
<div class="item-row">
<div class="item-col">
<h3>{{ p.person.firstname ~ ' ' ~ p.person.lastname }}</h3>
<p>
{% set born = (p.person.gender == 'woman') ? 'née': 'né' %}
{% set gender = (p.person.gender == 'woman') ? 'fa-venus' :
(p.person.gender == 'man') ? 'fa-mars' : 'fa-neuter' %}
{% set genderTitle = (p.person.gender == 'woman') ? 'femme' :
(p.person.gender == 'man') ? 'homme' : 'neutre' %}
<i class="fa fa-fw {{ gender }}" title="{{ genderTitle }}"></i>{{ born ~ ' le ' ~ p.person.birthdate|format_date('short') }}
</p>
</div>
<div class="item-col">
<ul class="list-content fa-ul">
<li>
{% if p.person.mobilenumber %}
<i class="fa fa-li fa-mobile"></i><a href="{{ 'tel:' ~ p.person.mobilenumber }}">
{{ p.person.mobilenumber|chill_format_phonenumber }}</a>
{% else %}
<i class="fa fa-li fa-phone"></i>
{% if p.person.phonenumber %}
<a href="{{ 'tel:' ~ p.person.phonenumber }}">{{ p.person.phonenumber|chill_format_phonenumber }}</a>
{% else %}
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %}
{% endif %}
</li>
<li>
<i class="fa fa-li fa-map-marker"></i>
{%- if p.person.lastAddress is not empty -%}
{{ p.person.currentHouseholdAddress|chill_entity_render_box({'with_valid_from': false}) }}
{%- else -%}
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
{%- endif -%}
</li>
</ul>
<ul class="record_actions">
<li>
<a href="{{ path('chill_person_view', { person_id: p.person.id }) }}" class="btn btn-show" target="_blank" title="Voir"></a>
</li>
{% if p.person.isSharingHousehold %}
<li>
<a href="{{ chill_path_add_return_path('chill_person_household_summary', { 'household_id': p.person.getCurrentHousehold.id }) }}"
class="btn btn-misc">
<i class="fa fa-home"></i>
n°&nbsp;
{{ p.person.getCurrentHousehold.id }}
</a>
</li>
{% endif %}
</ul>
</div>
<div class="requestor mb-5">
<h2 class="mb-3">{{ 'Requestor'|trans }}</h2>
{% if accompanyingCourse.requestorPerson is not empty %}
{% set requestor = accompanyingCourse.requestorPerson %}
{% set info = true %}
{% elseif accompanyingCourse.requestor is not empty %}
{% set requestor = accompanyingCourse.requestorThirdParty %}
{% set info = false %}
{% endif %}
{% if accompanyingCourse.requestor == null %}
<p class="chill-no-data-statement">{{ 'Any requestor to this accompanying course'|trans }}</p>
{% else %}
<div class="flex-bloc row row-cols-1 g-0">
<div class="item-bloc col">
{{ requestor|chill_entity_render_box({
'render': 'bloc', 'addLink': false, 'addEntity': true, 'addInfo': info
}) }}
</div>
</div>
{% endif %}
{% endfor %}
</div>
<h2>{{ 'Requestor'|trans }}</h2>
{% if accompanyingCourse.requestor == null %}
<p>{{ 'Any requestor to this accompanying course'|trans }}</p>
{% elseif accompanyingCourse.requestorPerson is not empty %}
{% set r = accompanyingCourse.requestorPerson %}
<div class="item-row">
<div class="item-col">
<h3>
{{ r.firstname ~ ' ' ~ r.lastname }}
<span class="badge rounded-pill bg-secondary">{{ 'Usager' }}</span>
</h3>
<p>
{% set born = (r.gender == 'woman') ? 'née': 'né' %}
{% set gender = (r.gender == 'woman') ? 'fa-venus' :
(r.gender == 'man') ? 'fa-mars' : 'fa-neuter' %}
{% set genderTitle = (r.gender == 'woman') ? 'femme' :
(r.gender == 'homme') ? 'fa-mars' : 'neutre' %}
<i class="fa fa-fw {{ gender }}" title="{{ genderTitle }}"></i>{{ born ~ ' le ' ~ r.birthdate|format_date('short') }}
</p>
</div>
<div class="item-col">
<ul class="list-content fa-ul">
<li>
{% if r.mobilenumber %}
<i class="fa fa-li fa-mobile"></i><a href="{{ 'tel:' ~ r.mobilenumber }}">
{{ r.mobilenumber|chill_format_phonenumber }}</a>
{% else %}
<i class="fa fa-li fa-phone"></i>
{% if r.phonenumber %}
<a href="{{ 'tel:' ~ r.phonenumber }}">{{ r.phonenumber|chill_format_phonenumber }}</a>
{% else %}
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %}
{% endif %}
</li>
<li>
<i class="fa fa-li fa-map-marker"></i>
{%- if r.lastAddress is not empty -%}
{{ r.getLastAddress|chill_entity_render_box({'with_valid_from': false}) }}
{%- else -%}
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
{%- endif -%}
</li>
</ul>
<ul class="record_actions">
<li>
<a href="{{ path('chill_person_view', { person_id: r.id }) }}" class="btn btn-show" target="_blank" title="Voir"></a>
</li>
</ul>
</div>
</div>
{% elseif accompanyingCourse.requestorThirdParty is not empty %}
{% set r = accompanyingCourse.requestorThirdParty %}
<div class="item-row">
<div class="item-col">
<h3>
{{ r.name }}
<span class="badge rounded-pill bg-secondary">{{ 'Tiers' }}</span>
</h3>
</div>
<div class="item-col">
<ul class="list-content fa-ul">
<li><i class="fa fa-li fa-envelope-o"></i>
<a href="{{ 'mailto:' ~ r.email }}">
{{ r.email|chill_print_or_message("thirdparty.No_email") }}
</a>
</li>
<li><i class="fa fa-li fa-phone"></i>
{% if r.telephone %}
<a href="{{ 'tel:' ~ r.telephone }}">{{ r.telephone|chill_format_phonenumber }}</a>
{% else %}
<span class="chill-no-data-statement">{{ 'thirdparty.No_phonenumber'|trans }}</span>
{% endif %}
</li>
<li><i class="fa fa-li fa-map-marker"></i>
{%- if r.address is not empty -%}
{{ r.getAddress|chill_entity_render_box({'with_valid_from': false}) }}
{%- else -%}
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
{%- endif -%}
</li>
</ul>
<ul class="record_actions">
<li>
<a href="{{ path('chill_3party_3party_show', { thirdparty_id: r.id }) }}" class="btn btn-show" target="_blank" title="Voir"></a>
</li>
</ul>
</div>
</div>
{% endif %}
<div class="resources my-5">
<div class="resources mb-5">
<h2 class="mb-3">{{ 'Resources'|trans }}</h2>
{% if accompanyingCourse.resources|length == 0 %}
<p class="chill-no-data-statement">{{ 'Any resource for this accompanying course'|trans }}</p>
@ -228,12 +84,12 @@
<div class="item-bloc col">
{% if r.person %}
{{ r.person|chill_entity_render_box({
'render': 'bloc', 'addLink': true, 'addEntity': true, 'addInfo': true
'render': 'bloc', 'addLink': false, 'addEntity': true, 'addInfo': true
}) }}
{% endif %}
{% if r.thirdParty %}
{{ r.thirdParty|chill_entity_render_box({
'render': 'bloc', 'addLink': true, 'addEntity': true, 'addInfo': true
'render': 'bloc', 'addLink': false, 'addEntity': true, 'addInfo': false
}) }}
{% endif %}
</div>
@ -242,9 +98,8 @@
{% endif %}
</div>
<h2>{{ 'Social actions'|trans }}</h2>
<div id="accompanying_course_work_list" class="short">
<div class="social-actions mb-5">
<h2 class="mb-3">{{ 'Social actions'|trans }}</h2>
{% for w in works %}
<div class="item">
<div class="title">
@ -253,7 +108,6 @@
{{ w.socialAction|chill_entity_render_box({ 'no-badge': false }) }}
</h2>
</div>
<div class="actions">
<ul class="record_actions">
<li>
@ -269,8 +123,10 @@
</div>
{% block contentActivity %}
<div class="activity mb-5">
{% set person = null %}
{% include 'ChillActivityBundle:Activity:list.html.twig' with { 'context': 'accompanyingCourse' } %}
</div>
{% endblock %}
</div>

View File

@ -1,6 +1,6 @@
{#
Template to render a person
* render [raw|label|row|bloc]
* render [raw|label|bloc]
OPTIONS
* addAltNames bool
* addLink bool
@ -64,12 +64,6 @@
{{ _self.label(person, options) }}
{%- endif -%}
{%- if render == 'row' -%}
<div class="entity-row">
{{ _self.label(person, options) }}
</div>
{%- endif -%}
{%- if render == 'bloc' -%}
<div class="item-row entity-bloc">
<div class="item-col">

View File

@ -1,6 +1,6 @@
{#
Template to render a thirdparty
* render [raw|label|row|bloc]
* render [raw|label|bloc]
OPTIONS
* with_valid_from bool
* addAltNames bool
@ -37,51 +37,6 @@
</p>
{%- endif -%}
{# AVANT
<div class="name">
{{ _self.raw(thirdparty, options) }}
</div>
<div class="category">
{% for type in thirdparty.type %}
<span class="category">
{{ ('chill_3party.key_label.'~type)|trans }}
</span>
{% endfor %}
</div>
{% if thirdparty.comment is not empty %}
<div class="comment">
{{ thirdparty.comment }}
</div>
{% endif %}
{% if thirdparty.address %}
<div class="chill_address">
<div class="chill_address_address">
{% if thirdparty.address.streetAddress1 %}<p class="street street1">{{ thirdparty.address.streetAddress1 }}</p>{% endif %}
{% if thirdparty.address.streetAddress2 is not empty %}<p class="street street2">{{ thirdparty.address.streetAddress2 }}</p>{% endif %}
{% if thirdparty.address.postCode is not empty %}
<p class="postalCode"><span class="code">{{ thirdparty.address.postCode.code }}</span> <span class="name">{{ thirdparty.address.postCode.name }}</span></p>
<p class="country">{{ thirdparty.address.postCode.country.name|localize_translatable_string }}</p>
{% endif %}
</div>
{%- if options['with_valid_from'] is defined and options['with_valid_from'] == true -%}
<span class="address_since">{{ 'Since %date%'|trans( { '%date%' : thirdparty.address.validFrom|format_date('long') } ) }}</span>
{%- endif -%}
</div>
{% endif %}
{% if thirdparty.email or thirdparty.telephone is not empty %}
<div class="contact">
<span class="email">
<a href="mailto:{{ thirdparty.email }}">{{ thirdparty.email }}</a>
</span>
<span class="telephone">
<a href="tel:{{ thirdparty.telephone }}">{{ thirdparty.telephone|chill_format_phonenumber }}</a>
</span>
</div>
{% endif %}
#}
{#- tricks to remove easily whitespace after template -#}
{%- if true -%}</div>{%- endif -%}
{% endmacro label %}
@ -94,12 +49,6 @@
{{ _self.label(thirdparty, options) }}
{%- endif -%}
{%- if render == 'row' -%}
<div class="entity-row">
{{ _self.label(thirdparty, options) }}
</div>
{%- endif -%}
{%- if render == 'bloc' -%}
<div class="item-row entity-bloc">
<div class="item-col">