mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
wip render box person thirdparty display bloc
This commit is contained in:
@@ -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';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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) %}
|
||||
<span class="name">{{ thirdparty.name }}</span>
|
||||
{% endmacro raw %}
|
||||
|
||||
{% macro label(thirdparty, addLink, addEntity, addInfo, options) %}
|
||||
<div class="chill-entity thirdparty label">
|
||||
|
||||
<h3 class="denomination">
|
||||
{%- if addLink and is_granted('CHILL_3PARTY_3PARTY_SHOW', thirdparty) -%}
|
||||
<a href="{{ chill_path_add_return_path('chill_3party_3party_show', { 'thirdparty_id': thirdparty.id }) }}">
|
||||
{{ _self.raw(thirdparty) }}
|
||||
</a>
|
||||
{%- else -%}
|
||||
{{ _self.raw(thirdparty) }}
|
||||
{%- endif -%}
|
||||
{%- if addEntity -%}
|
||||
<span class="badge rounded-pill bg-secondary">{{ 'Third party'|trans }}</span>
|
||||
{%- endif -%}
|
||||
</h3>
|
||||
|
||||
{# AVANT
|
||||
<div class="name">
|
||||
{{ _self.raw(thirdparty) }}
|
||||
</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 %}
|
||||
|
||||
{%- if display == 'raw' -%}
|
||||
{{ _self.raw(thirdparty) }}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if display == 'label' -%}
|
||||
{{ _self.label(thirdparty, addLink, addEntity, addInfo, options) }}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if display == 'row' -%}
|
||||
<div class="chill-entity thirdparty row">
|
||||
{{ _self.label(thirdparty, addLink, addEntity, addInfo, options) }}
|
||||
</div>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if display == 'bloc' -%}
|
||||
<div class="chill-entity thirdparty bloc">
|
||||
<div class="item-row">
|
||||
<div class="item-col">
|
||||
{{ _self.label(thirdparty, addLink, addEntity, addInfo, options) }}
|
||||
</div>
|
||||
<div class="item-col">
|
||||
<ul class="list-content fa-ul">
|
||||
<li><i class="fa fa-li fa-envelope-o"></i>
|
||||
<a href="{{ 'mailto:' ~ thirdparty.email }}">
|
||||
{{ thirdparty.email|chill_print_or_message("thirdparty.No_email") }}
|
||||
</a>
|
||||
</li>
|
||||
<li><i class="fa fa-li fa-phone"></i>
|
||||
{% if thirdparty.telephone %}
|
||||
<a href="{{ 'tel:' ~ thirdparty.telephone }}">{{ thirdparty.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 thirdparty.address is not empty -%}
|
||||
{{ thirdparty.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: thirdparty.id }) }}" class="btn btn-show" target="_blank" title="Voir"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{%- endif -%}
|
@@ -1,52 +0,0 @@
|
||||
{# template to render a person #}
|
||||
{%- if options['only_denomination'] == true -%}
|
||||
<div class="chill_denomination">
|
||||
{{ contact.name }}
|
||||
</div>
|
||||
|
||||
{%- else -%}
|
||||
<div class="chill_contact">
|
||||
|
||||
<div class="chill_contact_name">
|
||||
{{ contact.name }}
|
||||
</div>
|
||||
<div class="chill_contact_category">
|
||||
{% for type in contact.type %}
|
||||
<span class="category">
|
||||
{{ ('chill_3party.key_label.'~type)|trans }}
|
||||
</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% if contact.comment is not empty %}
|
||||
<div class="chill_contact_comment">
|
||||
{{ contact.comment }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if contact.address %}
|
||||
<div class="chill_address">
|
||||
<div class="chill_address_address">
|
||||
|
||||
{% if contact.address.streetAddress1 %}<p class="street street1">{{ contact.address.streetAddress1 }}</p>{% endif %}
|
||||
{% if contact.address.streetAddress2 is not empty %}<p class="street street2">{{ contact.address.streetAddress2 }}</p>{% endif %}
|
||||
{% if contact.address.postCode is not empty %}
|
||||
<p class="postalCode"><span class="code">{{ contact.address.postCode.code }}</span> <span class="name">{{ contact.address.postCode.name }}</span></p>
|
||||
<p class="country">{{ contact.address.postCode.country.name|localize_translatable_string }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{%- if options['with_valid_from'] == true -%}
|
||||
<span class="address_since">{{ 'Since %date%'|trans( { '%date%' : contact.address.validFrom|format_date('long') } ) }}</span>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if contact.email or contact.telephone is not empty %}
|
||||
<div class="chill_contact_contact">
|
||||
<span class="email">
|
||||
<a href="mailto:{{ contact.email }}">{{ contact.email }}</a>
|
||||
</span>
|
||||
<span class="telephone">
|
||||
<a href="tel:{{ contact.telephone }}">{{ contact.telephone|chill_format_phonenumber }}</a>
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{%- endif -%}
|
@@ -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,
|
||||
* <http://www.champs-libres.coop>
|
||||
*
|
||||
* 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
|
||||
|
Reference in New Issue
Block a user