+
+
+ {%- if options['addLink'] and is_granted('CHILL_PERSON_SEE', person) -%}
- {{ _self.raw(person, addAltNames) }}
+ {{ _self.raw(person, options) }}
{%- else -%}
- {{ _self.raw(person, addAltNames) }}
+ {{ _self.raw(person, options) }}
{%- endif -%}
- {%- if addEntity -%}
+ {%- if options['addEntity'] -%}
{{ 'Person'|trans }}
{%- endif -%}
-
- {%- if addInfo -%}
- {% set born = (person.gender == 'woman') ? 'née le ': 'né le ' %}
+
+ {%- if options['addInfo'] -%}
{% 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 }}
-
{%- endif -%}
{#- tricks to remove easily whitespace after template -#}
@@ -58,25 +55,25 @@
{% endmacro label %}
-{%- if display == 'raw' -%}
- {{ _self.raw(person, addAltNames) }}
+{%- if render == 'raw' -%}
+ {{ _self.raw(person, options) }}
{%- endif -%}
-{%- if display == 'label' -%}
- {{ _self.label(person, addLink, addAltNames, addEntity, addInfo) }}
+{%- if render == 'label' -%}
+ {{ _self.label(person, options) }}
{%- endif -%}
-{%- if display == 'row' -%}
-
- {{ _self.label(person, addLink, addAltNames, addEntity, addInfo) }}
+{%- if render == 'row' -%}
+
+ {{ _self.label(person, options) }}
{%- endif -%}
-{%- if display == 'bloc' -%}
-
+{%- if render == 'bloc' -%}
+
- {{ _self.label(person, addLink, addAltNames, addEntity, addInfo) }}
+ {{ _self.label(person, options) }}
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 91a905cc1..5c0d7da78 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
@@ -46,7 +46,7 @@
{{ person|chill_entity_render_box({
- 'display': 'label', 'addLink': true, 'addInfo': true
+ 'render': 'label', 'addLink': true, 'addInfo': true
}) }}
diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php
index 353d05ecf..1eea36cdf 100644
--- a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php
+++ b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php
@@ -52,16 +52,22 @@ class PersonRender extends AbstractChillEntityRender
*/
public function renderBox($person, array $options): string
{
- return $this->engine->render('@ChillPerson/Entity/person.html.twig',
- [
+ $params = [
+ 'addAltNames' => $this->configAltNamesHelper->hasAltNames(),
+ 'addLink' => $options['addLink'] ?? false,
+ 'addEntity' => $options['addEntity'] ?? false,
+ 'addInfo' => $options['addInfo'] ?? false,
+ 'hLevel' => $options['hLevel'] ?? 3,
+ ];
+ dump($params);
+ return
+ $this->getDefaultOpeningBox('person') .
+ $this->engine->render('@ChillPerson/Entity/person.html.twig', [
'person' => $person,
- 'addAltNames' => $this->configAltNamesHelper->hasAltNames(),
- 'addLink' => $options['addLink'] ?? false,
- 'addEntity' => $options['addEntity'] ?? false,
- 'addInfo' => $options['addInfo'] ?? false,
- 'display' => $options['display'] ?? 'raw'
- ]
- );
+ 'render' => $options['render'] ?? 'raw',
+ 'options' => $params
+ ]) .
+ $this->getDefaultClosingBox();
}
/**
diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/thirdparty.scss b/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/thirdparty.scss
index 2efe06c5e..454a5b106 100644
--- a/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/thirdparty.scss
+++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/thirdparty.scss
@@ -1,9 +1,11 @@
-div.chill-entity {
- &.thirdparty {
- &.label {
- h3.denomination {
- font-size: 1.3em;
- font-weight: 700;
+section.chill-entity {
+ &.entity-thirdparty {
+ div.entity-label {
+ div.denomination {
+ &.h3 {
+ font-size: 1.3em;
+ font-weight: 700;
+ }
a {
text-decoration: none;
}
@@ -12,10 +14,12 @@ div.chill-entity {
margin-left: 0.3em;
}
}
- p.moreinfo {}
+ p.moreinfo {
+ span.company, span.acronym {}
+ }
}
- &.row {}
- &.bloc {}
+ div.entity-row {}
+ div.entity-bloc {}
/*
diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/Entity/thirdparty.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/Entity/thirdparty.html.twig
index 3f665aa26..cdcf53a0b 100644
--- a/src/Bundle/ChillThirdPartyBundle/Resources/views/Entity/thirdparty.html.twig
+++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/Entity/thirdparty.html.twig
@@ -1,36 +1,44 @@
{#
Template to render a thirdparty
+ * render [raw|label|row|bloc]
OPTIONS
- * display [raw|label|row|bloc]
* with_valid_from bool
* addAltNames bool
* addLink bool
* addEntity bool
* addInfo bool
+ * hLevel integer
#}
-{% macro raw(thirdparty) %}
+{% macro raw(thirdparty, options) %}
{{ thirdparty.name }}
{% endmacro raw %}
-{% macro label(thirdparty, addLink, addEntity, addInfo, options) %}
-
+{% macro label(thirdparty, options) %}
+
-
- {%- if addLink and is_granted('CHILL_3PARTY_3PARTY_SHOW', thirdparty) -%}
+
+ {%- if options['addLink'] and is_granted('CHILL_3PARTY_3PARTY_SHOW', thirdparty) -%}
- {{ _self.raw(thirdparty) }}
+ {{ _self.raw(thirdparty, options) }}
{%- else -%}
- {{ _self.raw(thirdparty) }}
+ {{ _self.raw(thirdparty, options) }}
{%- endif -%}
- {%- if addEntity -%}
+ {%- if options['addEntity'] -%}
{{ 'Third party'|trans }}
{%- endif -%}
-
+
+ {%- if options['addInfo'] -%}
+
{#
+ {{ thirdparty.nameCompany }}
+ {{ thirdparty.acronym }}
+ #} plus d'infos
+
+ {%- endif -%}
{# AVANT
- {{ _self.raw(thirdparty) }}
+ {{ _self.raw(thirdparty, options) }}
{% for type in thirdparty.type %}
@@ -77,25 +85,25 @@
{%- if true -%}
{%- endif -%}
{% endmacro label %}
-{%- if display == 'raw' -%}
- {{ _self.raw(thirdparty) }}
+{%- if render == 'raw' -%}
+ {{ _self.raw(thirdparty, options) }}
{%- endif -%}
-{%- if display == 'label' -%}
- {{ _self.label(thirdparty, addLink, addEntity, addInfo, options) }}
+{%- if render == 'label' -%}
+ {{ _self.label(thirdparty, options) }}
{%- endif -%}
-{%- if display == 'row' -%}
-
- {{ _self.label(thirdparty, addLink, addEntity, addInfo, options) }}
+{%- if render == 'row' -%}
+
+ {{ _self.label(thirdparty, options) }}
{%- endif -%}
-{%- if display == 'bloc' -%}
-
+{%- if render == 'bloc' -%}
+
- {{ _self.label(thirdparty, addLink, addEntity, addInfo, options) }}
+ {{ _self.label(thirdparty, options) }}
diff --git a/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php b/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php
index aea8cd45a..00f7effd3 100644
--- a/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php
+++ b/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php
@@ -22,7 +22,7 @@ namespace Chill\ThirdPartyBundle\Templating\Entity;
use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
-use Symfony\Bridge\Twig\TwigEngine;
+use Symfony\Component\Templating\EngineInterface;
/**
*
@@ -30,15 +30,12 @@ use Symfony\Bridge\Twig\TwigEngine;
*/
class ThirdPartyRender extends AbstractChillEntityRender
{
- /**
- *
- * @var TwigEngine
- */
- protected $templating;
- public function __construct(TwigEngine $templating)
+ protected EngineInterface $engine;
+
+ public function __construct(EngineInterface $engine)
{
- $this->templating = $templating;
+ $this->engine = $engine;
}
/**
@@ -49,17 +46,21 @@ class ThirdPartyRender extends AbstractChillEntityRender
*/
public function renderBox($entity, array $options): string
{
+ $params = [
+ 'with_valid_from' => $options['with_valid_from'] ?? true,
+ 'addLink' => $options['addLink'] ?? false,
+ 'addEntity' => $options['addEntity'] ?? false,
+ 'addInfo' => $options['addInfo'] ?? false,
+ 'hLevel' => $options['hLevel'] ?? 3,
+ ];
+
return
- $this->getDefaultOpeningBox('_3party').
- $this->templating->render('@ChillThirdParty/Entity/thirdparty.html.twig', [
+ $this->getDefaultOpeningBox('thirdparty') .
+ $this->engine->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
- ]).
+ 'render' => $options['render'] ?? 'raw',
+ 'options' => $params
+ ]) .
$this->getDefaultClosingBox();
}