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 %}
  • - +
  • @@ -89,7 +92,7 @@
- +
{#- 'apps' is for AccompanyingPeriodParticipationS #} @@ -100,40 +103,40 @@ {%- set apps = apps|merge([app]) %} {%- endif %} {%- endfor %} - + {% if apps|length > 0 %} {% for app in apps %}
- +
- {{ 'Since %date%'|trans({'%date%': app.startDate|format_date('medium') }) }} {% if app.accompanyingPeriod.user is not null %} - ref: + ref: {{ app.accompanyingPeriod.user|chill_entity_render_box }} {% endif %}
- +
{% 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 %}