diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss
index ed432a7e4..3fcdb9da1 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss
+++ b/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss
@@ -84,6 +84,7 @@ div.flex-table {
/*
* Bloc appearance
*/
+/*
div.flex-bloc {
box-sizing: border-box;
display: flex;
@@ -134,6 +135,8 @@ div.flex-bloc {
margin: auto 0;
}
}
+ */
+
/*
* Table appearance
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/index.js b/src/Bundle/ChillPersonBundle/Resources/public/chill/index.js
index 7ad042e2c..69e589bab 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/chill/index.js
+++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/index.js
@@ -7,6 +7,7 @@ require('./scss/person_with_period.scss');
require('./scss/household_banner.scss');
require('./scss/accompanying_period_work.scss');
require('./scss/person_by_phonenumber.scss');
+require('./scss/render_box.scss');
require('./svg/phone-alt-solid.svg');
require('./svg/mobile-alt-solid.svg');
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/person_with_period.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/person_with_period.scss
index 9e3ff8f6e..6be613ea3 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/person_with_period.scss
+++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/person_with_period.scss
@@ -2,24 +2,11 @@
div.list-with-period,
div.list-household-members {
- .chill-entity__person {
- .chill-entity__person__first-name,
- .chill-entity__person__last-name {
- font-size: 1.3em;
- font-weight: 700;
- }
- }
-
- .chill_denomination {
- font-size: 1.3em;
- font-weight: 700;
- }
-
div.comment {
// for the comment for household-members
}
div.periods {
- div.header,
+ div.header,
div.list-content {
width: calc(100% - 40px);
margin-left: 40px;
@@ -28,17 +15,17 @@ div.list-household-members {
position: relative;
a.sc-button {
position: absolute;
- width: 30px;
+ width: 30px;
height: 30px;
- top: 10px;
+ top: 10px;
left: -40px;
padding: 0;
i {
padding: 5px;
}
}
- abbr.referrer {
- font-size: 70%;
+ abbr.referrer {
+ font-size: 70%;
}
span.user {
margin-left: 1em;
@@ -51,3 +38,6 @@ div.list-household-members {
}
}
}
+
+
+
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/render_box.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/render_box.scss
new file mode 100644
index 000000000..7f1773710
--- /dev/null
+++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/render_box.scss
@@ -0,0 +1,20 @@
+div.chill-entity {
+ &.person {
+ &.label {
+ h3.denomination {
+ font-size: 1.3em;
+ font-weight: 700;
+ a {
+ text-decoration: none;
+ }
+ span.firstname, span.lastname, span.altname {}
+ span.badge {
+ margin-left: 0.3em;
+ }
+ }
+ p.moreinfo {}
+ }
+ &.row {}
+ &.bloc {}
+ }
+}
diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig
index 7461c2767..03f5bb379 100644
--- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig
+++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig
@@ -222,103 +222,28 @@
{{ 'Resources'|trans }}
{% if accompanyingCourse.resources|length == 0 %}
- {{ 'Any resource for this accompanying course'|trans }}
+ {{ 'Any resource for this accompanying course'|trans }}
{% else %}
-
- {% for r in accompanyingCourse.resources %}
+
+ {% for r in accompanyingCourse.resources %}
{% if r.person %}
-
-
-
- {{ r.person.firstname ~ ' ' ~ r.person.lastname }}
- {{ 'Usager' }}
-
-
- {% set born = (r.person.gender == 'woman') ? 'née': 'né' %}
- {% set gender = (r.person.gender == 'woman') ? 'fa-venus' :
- (r.person.gender == 'man') ? 'fa-mars' : 'fa-neuter' %}
- {% set genderTitle = (r.person.gender == 'woman') ? 'femme' :
- (r.person.gender == 'homme') ? 'fa-mars' : 'neutre' %}
- {{ born ~ ' le ' ~ r.person.birthdate|format_date('short') }}
-
-
-
-
- -
- {% if r.person.mobilenumber %}
- {{ r.person.mobilenumber }}
- {% else %}
-
- {% if r.person.phonenumber %}
- {{ r.person.phonenumber }}
- {% else %}
- {{ 'No data given'|trans }}
- {% endif %}
- {% endif %}
-
- -
-
- {%- if r.person.lastAddress is not empty -%}
- {{ r.person.getLastAddress|chill_entity_render_box({'with_valid_from': false}) }}
- {%- else -%}
- {{ 'No address given'|trans }}
- {%- endif -%}
-
-
-
-
-
+ {{ r.person|chill_entity_render_box({
+ 'display': 'bloc', 'addLink': true, 'addEntity': true, 'addInfo': true
+ }) }}
{% endif %}
{% if r.thirdParty %}
-
-
-
- {{ r.thirdParty.name }}
- {{ 'Tiers' }}
-
-
-
-
+ {{ r.thirdParty|chill_entity_render_box({
+ 'display': 'bloc', 'addLink': true, 'addEntity': true, 'addInfo': true
+ }) }}
{% endif %}
- {% endfor %}
-
+ {% endfor %}
+
{% endif %}
{{ 'Social actions'|trans }}
diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig
index 24afd7bf3..a7ffc1775 100644
--- a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig
+++ b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig
@@ -1,17 +1,115 @@
-
- {%- if addLink and is_granted('CHILL_PERSON_SEE', person) -%}
- {%- set showLink = true -%}{%- endif -%}
- {{ person.firstName }}
- {{ person.lastName }}
+{#
+ Template to render a person
+ OPTIONS
+ * display [raw|label|row|bloc]
+ * addAltNames bool
+ * addLink bool
+ * addEntity bool
+ * addInfo bool
+#}
+{% macro raw(person, addAltNames) %}
+ {{ person.firstName }}
+ {{ person.lastName }}
{%- if addAltNames -%}
- {%- for n in person.altNames -%}
- {%- if loop.first -%}({% else %} {%- endif -%}
-
- {{- n.label -}}
-
- {%- if loop.last -%}) {%- endif -%}
- {%- endfor -%}
+ {%- for n in person.altNames -%}
+ {%- if loop.first -%}({% else %} {%- endif -%}
+
+ {{- n.label -}}
+
+ {%- if loop.last -%}){%- endif -%}
+ {%- endfor -%}
{%- endif -%}
- {%- if showLink is defined -%}{%- endif -%}
-{#- tricks to remove easily whitespace after template -#}
-{%- if true -%}{%- endif -%}
+{% endmacro raw %}
+
+{% macro label(person, addLink, addAltNames, addEntity, addInfo) %}
+
+
+ {%- if addLink and is_granted('CHILL_PERSON_SEE', person) -%}
+
+ {{ _self.raw(person, addAltNames) }}
+
+ {%- else -%}
+ {{ _self.raw(person, addAltNames) }}
+ {%- endif -%}
+ {%- if addEntity -%}
+ {{ 'Person'|trans }}
+ {%- endif -%}
+
+ {%- if addInfo -%}
+ {% set born = (person.gender == 'woman') ? 'née le ': 'né le ' %}
+ {% set gender = (person.gender == 'woman') ? 'fa-venus' :
+ (person.gender == 'man') ? 'fa-mars' : 'fa-neuter' %}
+ {% set genderTitle = (person.gender == 'woman') ? 'woman' :
+ (person.gender == 'man') ? 'man' : 'neuter' %}
+
+
+ {{ born|trans }}
+
+ {# TODO
+ {{ 'Born the %date%'|transchoice(person.genderNumeric, {
+ '%date%': person.birthdate|format_date("medium") }) }}
+ #}
+
+ {%- endif -%}
+ {#- tricks to remove easily whitespace after template -#}
+ {%- if true -%}
{%- endif -%}
+{% endmacro label %}
+
+
+{%- if display == 'raw' -%}
+ {{ _self.raw(person, addAltNames) }}
+{%- endif -%}
+
+{%- if display == 'label' -%}
+ {{ _self.label(person, addLink, addAltNames, addEntity, addInfo) }}
+{%- endif -%}
+
+{%- if display == 'row' -%}
+
+ {{ _self.label(person, addLink, addAltNames, addEntity, addInfo) }}
+
+{%- endif -%}
+
+{%- if display == 'bloc' -%}
+
+
+
+ {{ _self.label(person, addLink, addAltNames, addEntity, addInfo) }}
+
+
+
+ -
+ {% if person.mobilenumber %}
+ {{ person.mobilenumber }}
+ {% else %}
+
+ {% if person.phonenumber %}
+ {{ person.phonenumber }}
+ {% else %}
+ {{ 'No data given'|trans }}
+ {% endif %}
+ {% endif %}
+
+ -
+
+ {%- if person.lastAddress is not empty -%}
+ {{ person.getLastAddress|chill_entity_render_box({'with_valid_from': false}) }}
+ {%- else -%}
+ {{ 'No address given'|trans }}
+ {%- endif -%}
+
+
+ {%- if is_granted('CHILL_PERSON_SEE', person) -%}
+
+ {%- endif -%}
+
+
+
+{%- endif -%}
+
diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig
index ab88c81ef..91a905cc1 100644
--- a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig
+++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig
@@ -39,21 +39,24 @@
{% for person in persons %}
-
+
-
+
-
{{ person|chill_entity_render_box({'addLink': true}) }}
-
{{ 'Born the %date%'|transchoice(person.genderNumeric, { '%date%': person.birthdate|format_date("medium") }) }}
+
+ {{ person|chill_entity_render_box({
+ 'display': 'label', 'addLink': true, 'addInfo': true
+ }) }}
+
-
+
-
{{ person.center }}
-
+
-
{% if person.mobilenumber is not empty %}
{{ person.mobilenumber|chill_format_phonenumber }}
@@ -66,7 +69,7 @@
{% endif %}
{% endif %}
-
+
-
{% if person.getLastAddress is not null %}
@@ -75,7 +78,7 @@
{{ 'No address'|trans }}
{% endif %}
-
+
-
+
{#- 'apps' is for AccompanyingPeriodParticipationS #}
@@ -100,40 +103,40 @@
{%- set apps = apps|merge([app]) %}
{%- endif %}
{%- endfor %}
-
+
{% if apps|length > 0 %}
{% for app in apps %}
-
+
-
+
{% for issue in app.accompanyingPeriod.socialIssues|slice(0,2) %}
{{ issue|chill_entity_render_box }}
{% endfor %}
-
+
{% if app.accompanyingPeriod.socialIssues|length > 2 %}
{{ 'and %number% other'|transchoice(app.accompanyingPeriod.socialIssues|length-2) }}
{% endif %}
-
+
{% endfor %}
-
+
{% endif %}
-
+
{% endfor %}
@@ -162,7 +165,7 @@
{% endif %}
-
+
{% else %}
-
diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php
index 717ee4fc6..353d05ecf 100644
--- a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php
+++ b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php
@@ -2,7 +2,7 @@
/*
* Chill is a software for social workers
*
- * Copyright (C) 2014-2019, Champs Libres Cooperative SCRLFS,
+ * Copyright (C) 2014-2019, Champs Libres Cooperative SCRLFS,
*
*
* This program is free software: you can redistribute it and/or modify
@@ -35,7 +35,7 @@ class PersonRender extends AbstractChillEntityRender
private ConfigPersonAltNamesHelper $configAltNamesHelper;
private EngineInterface $engine;
-
+
public function __construct(
ConfigPersonAltNamesHelper $configAltNamesHelper,
EngineInterface $engine
@@ -43,9 +43,9 @@ class PersonRender extends AbstractChillEntityRender
$this->configAltNamesHelper = $configAltNamesHelper;
$this->engine = $engine;
}
-
+
/**
- *
+ *
* @param Person $person
* @param array $options
* @return string
@@ -56,13 +56,16 @@ class PersonRender extends AbstractChillEntityRender
[
'person' => $person,
'addAltNames' => $this->configAltNamesHelper->hasAltNames(),
- 'addLink' => $options['addLink'] ?? false
+ 'addLink' => $options['addLink'] ?? false,
+ 'addEntity' => $options['addEntity'] ?? false,
+ 'addInfo' => $options['addInfo'] ?? false,
+ 'display' => $options['display'] ?? 'raw'
]
);
}
/**
- *
+ *
* @param Person $person
* @param array $options
* @return string
@@ -76,7 +79,7 @@ class PersonRender extends AbstractChillEntityRender
protected function addAltNames(Person $person, bool $addSpan)
{
$str = '';
-
+
if ($this->configAltNamesHelper->hasAltNames()) {
$altNames = $this->configAltNamesHelper->getChoices();
$isFirst = true;
@@ -94,18 +97,18 @@ class PersonRender extends AbstractChillEntityRender
$str .= '';
}
$str .= $altName->getLabel();
-
+
if ($addSpan) {
$str .= "";
}
}
}
-
+
if (!$isFirst) {
$str .= ")";
}
}
-
+
return $str;
}
diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/thirdparty.scss b/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/thirdparty.scss
index 952b011ec..2efe06c5e 100644
--- a/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/thirdparty.scss
+++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/thirdparty.scss
@@ -1,51 +1,79 @@
+div.chill-entity {
+ &.thirdparty {
+ &.label {
+ h3.denomination {
+ font-size: 1.3em;
+ font-weight: 700;
+ a {
+ text-decoration: none;
+ }
+ span.name {}
+ span.badge {
+ margin-left: 0.3em;
+ }
+ }
+ p.moreinfo {}
+ }
+ &.row {}
+ &.bloc {}
+
+
+/*
+ border: 1px solid black;
+ background-color: rgba(255, 255, 255, 0.65);
+ padding: 1em;
+ margin: 1em 0;
+ max-width: 500px;
+
+ div.name {
+ font-variant: small-caps;
+ }
+
+ div.category {
+ margin: 0.5em 0;
+ font-size: 85%;
+
+ span.category {
+ font-style: italic;
+ }
+ span::before {
+ margin-left: 0.5em;
+ margin-right: 0.5em;
+ font-family: 'ForkAwesome';
+ content: '\f02e';
+ font-style: normal;
+ }
+ }
+
+ div.comment {
+ font-size: 85%;
+ font-style: italic;
+ }
+
+ div.chill_address {
+ div.chill_address_address::before {
+ margin-left: 0.5em;
+ margin-right: 0.5em;
+ font-family: 'ForkAwesome';
+ content: '\f015';
+ }
+ }
+
+ div.contact {
+ font-variant: small-caps;
+ span::before {
+ margin-left: 0.5em;
+ margin-right: 0.5em;
+ font-family: 'ForkAwesome';
+ }
+ span.email::before {
+ content: '\f1fa';
+ }
+ span.telephone::before {
+ content: '\f095';
+ }
+ }
+ */
-div.chill_contact {
- border: 1px solid black;
- background-color: rgba(255, 255, 255, 0.65);
- padding: 1em;
- margin: 1em 0;
- max-width: 500px;
- div.chill_contact_name {
- font-variant: small-caps;
- }
- div.chill_contact_category {
- margin: 0.5em 0;
- font-size: 85%;
- span.category {
- font-style: italic;
}
- span::before {
- margin-left: 0.5em;
- margin-right: 0.5em;
- font-family: 'ForkAwesome';
- content: '\f02e';
- font-style: normal;
- }
- }
- div.chill_contact_comment {
- font-size: 85%;
- font-style: italic;
- }
- div.chill_address {
- div.chill_address_address::before {
- margin-left: 0.5em;
- margin-right: 0.5em;
- font-family: 'ForkAwesome';
- content: '\f015';
- }
- }
- div.chill_contact_contact {
- font-variant: small-caps;
- span::before {
- margin-left: 0.5em;
- margin-right: 0.5em;
- font-family: 'ForkAwesome';
- }
- span.email::before {
- content: '\f1fa';
- }
- span.telephone::before {
- content: '\f095';
- }
- }
-}
\ No newline at end of file
+}
diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/Entity/thirdparty.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/Entity/thirdparty.html.twig
new file mode 100644
index 000000000..3f665aa26
--- /dev/null
+++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/Entity/thirdparty.html.twig
@@ -0,0 +1,130 @@
+{#
+ Template to render a thirdparty
+ OPTIONS
+ * display [raw|label|row|bloc]
+ * with_valid_from bool
+ * addAltNames bool
+ * addLink bool
+ * addEntity bool
+ * addInfo bool
+#}
+{% macro raw(thirdparty) %}
+ {{ thirdparty.name }}
+{% endmacro raw %}
+
+{% macro label(thirdparty, addLink, addEntity, addInfo, options) %}
+
+
+
+ {%- if addLink and is_granted('CHILL_3PARTY_3PARTY_SHOW', thirdparty) -%}
+
+ {{ _self.raw(thirdparty) }}
+
+ {%- else -%}
+ {{ _self.raw(thirdparty) }}
+ {%- endif -%}
+ {%- if addEntity -%}
+ {{ 'Third party'|trans }}
+ {%- endif -%}
+
+
+ {# AVANT
+
+ {{ _self.raw(thirdparty) }}
+
+
+ {% for type in thirdparty.type %}
+
+ {{ ('chill_3party.key_label.'~type)|trans }}
+
+ {% endfor %}
+
+ {% if thirdparty.comment is not empty %}
+
+ {% endif %}
+ {% if thirdparty.address %}
+
+
+
+ {% if thirdparty.address.streetAddress1 %}
{{ thirdparty.address.streetAddress1 }}
{% endif %}
+ {% if thirdparty.address.streetAddress2 is not empty %}
{{ thirdparty.address.streetAddress2 }}
{% endif %}
+ {% if thirdparty.address.postCode is not empty %}
+
{{ thirdparty.address.postCode.code }} {{ thirdparty.address.postCode.name }}
+
{{ thirdparty.address.postCode.country.name|localize_translatable_string }}
+ {% endif %}
+
+
+ {%- if options['with_valid_from'] is defined and options['with_valid_from'] == true -%}
+
{{ 'Since %date%'|trans( { '%date%' : thirdparty.address.validFrom|format_date('long') } ) }}
+ {%- endif -%}
+
+ {% endif %}
+ {% if thirdparty.email or thirdparty.telephone is not empty %}
+
+ {% endif %}
+ #}
+
+ {#- tricks to remove easily whitespace after template -#}
+ {%- if true -%}
{%- endif -%}
+{% endmacro label %}
+
+{%- if display == 'raw' -%}
+ {{ _self.raw(thirdparty) }}
+{%- endif -%}
+
+{%- if display == 'label' -%}
+ {{ _self.label(thirdparty, addLink, addEntity, addInfo, options) }}
+{%- endif -%}
+
+{%- if display == 'row' -%}
+
+ {{ _self.label(thirdparty, addLink, addEntity, addInfo, options) }}
+
+{%- endif -%}
+
+{%- if display == 'bloc' -%}
+
+
+
+ {{ _self.label(thirdparty, addLink, addEntity, addInfo, options) }}
+
+
+
+
+{%- endif -%}
diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/_render.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/_render.html.twig
deleted file mode 100644
index 626b556ee..000000000
--- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/_render.html.twig
+++ /dev/null
@@ -1,52 +0,0 @@
-{# template to render a person #}
-{%- if options['only_denomination'] == true -%}
-
- {{ contact.name }}
-
-
-{%- else -%}
-
-{%- endif -%}
diff --git a/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php b/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php
index be2f82cb5..aea8cd45a 100644
--- a/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php
+++ b/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php
@@ -2,7 +2,7 @@
/*
* Chill is a software for social workers
*
- * Copyright (C) 2014-2020 , Champs Libres Cooperative SCRLFS,
+ * Copyright (C) 2014-2020 , Champs Libres Cooperative SCRLFS,
*
*
* This program is free software: you can redistribute it and/or modify
@@ -25,7 +25,7 @@ use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Symfony\Bridge\Twig\TwigEngine;
/**
- *
+ *
*
*/
class ThirdPartyRender extends AbstractChillEntityRender
@@ -35,37 +35,36 @@ class ThirdPartyRender extends AbstractChillEntityRender
* @var TwigEngine
*/
protected $templating;
-
+
public function __construct(TwigEngine $templating)
{
$this->templating = $templating;
}
-
+
/**
- *
+ *
* @param ThirdParty $entity
* @param array $options
* @return string
*/
public function renderBox($entity, array $options): string
{
- $params = \array_merge(
- [ 'with_valid_from' => true ],
- $options
- );
-
return
$this->getDefaultOpeningBox('_3party').
- $this->templating->render('@ChillThirdParty/ThirdParty/_render.html.twig', [
- 'contact' => $entity,
- 'options' => $params
+ $this->templating->render('@ChillThirdParty/Entity/thirdparty.html.twig', [
+ 'thirdparty' => $entity,
+ 'with_valid_from' => $options['with_valid_from'] ?? true,
+ 'addLink' => $options['addLink'] ?? false,
+ 'addEntity' => $options['addEntity'] ?? false,
+ 'addInfo' => $options['addInfo'] ?? false,
+ 'display' => $options['display'] ?? 'raw',
+ 'options' => $options
]).
$this->getDefaultClosingBox();
-
}
/**
- *
+ *
* @param ThirdParty $entity
* @param array $options
* @return string