mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
Merge branch 'master' into 110_extend_thirdparty
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
///
|
||||
div.thirdparty-list {
|
||||
label.counter {
|
||||
float: right;
|
||||
span {
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// render_box
|
||||
section.chill-entity {
|
||||
.entity-thirdparty {
|
||||
span.name {}
|
||||
}
|
||||
}
|
||||
|
||||
/* AVANT
|
||||
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';
|
||||
}
|
||||
}
|
||||
*/
|
@@ -1,2 +1,2 @@
|
||||
require('./thirdparty.scss');
|
||||
require('./chillthirdparty.scss');
|
||||
|
||||
|
@@ -1,59 +0,0 @@
|
||||
|
||||
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';
|
||||
}
|
||||
}
|
||||
}
|
||||
div.thirdparty-list {
|
||||
label.counter {
|
||||
float: right;
|
||||
span {
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,108 @@
|
||||
{#
|
||||
Template to render a thirdparty
|
||||
OPTIONS
|
||||
* render string ['raw'|'label'|'bloc']
|
||||
* with_valid_from bool
|
||||
* addLink bool
|
||||
* addEntity bool
|
||||
* addId bool
|
||||
* addInfo bool
|
||||
* hLevel integer
|
||||
* customButtons [
|
||||
'before' Twig\Markup, (injected with macro)
|
||||
'replace' Twig\Markup,
|
||||
'after' Twig\Markup
|
||||
]
|
||||
#}
|
||||
|
||||
{% macro raw(thirdparty, options) %}
|
||||
<span class="name">{{ thirdparty.name }}</span>
|
||||
{% endmacro raw %}
|
||||
|
||||
{% macro label(thirdparty, options) %}
|
||||
<div class="entity-label">
|
||||
|
||||
<div class="denomination {{ 'h' ~ options['hLevel'] }}">
|
||||
{%- if options['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, options) }}
|
||||
</a>
|
||||
{%- else -%}
|
||||
{{ _self.raw(thirdparty, options) }}
|
||||
{%- endif -%}
|
||||
{%- if options['addEntity'] -%}
|
||||
<span class="badge rounded-pill bg-secondary">{{ 'Third party'|trans }}</span>
|
||||
{%- endif -%}
|
||||
{%- if options['addId'] -%}
|
||||
<span class="id-number" title="{{ 'Third party'|trans ~ ' n° ' ~ thirdparty.id }}">
|
||||
{{ thirdparty.id|upper }}
|
||||
</span>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
{%- if options['addInfo'] -%}
|
||||
<p class="moreinfo">{#
|
||||
<span class="company">{{ thirdparty.nameCompany }}</span>
|
||||
<span class="acronym">{{ thirdparty.acronym }}</span>
|
||||
#} plus d'infos
|
||||
</p>
|
||||
{%- endif -%}
|
||||
|
||||
{#- tricks to remove easily whitespace after template -#}
|
||||
{%- if true -%}</div>{%- endif -%}
|
||||
{% endmacro label %}
|
||||
|
||||
{%- if render == 'raw' -%}
|
||||
{{ _self.raw(thirdparty, options) }}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if render == 'label' -%}
|
||||
{{ _self.label(thirdparty, options) }}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if render == 'bloc' -%}
|
||||
<div class="item-row entity-bloc">
|
||||
<div class="item-col">
|
||||
{{ _self.label(thirdparty, options) }}
|
||||
</div>
|
||||
<div class="item-col">
|
||||
<ul class="list-content fa-ul">
|
||||
{{ thirdparty.getAddress|chill_entity_render_box({
|
||||
'render': 'list',
|
||||
'with_picto': true,
|
||||
'multiline': false,
|
||||
'with_valid_from': false
|
||||
}) }}
|
||||
<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-envelope-o"></i>
|
||||
<a href="{{ 'mailto:' ~ thirdparty.email }}">
|
||||
{{ thirdparty.email|chill_print_or_message("thirdparty.No_email") }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="record_actions">
|
||||
{% if options['customButtons']['before'] is defined %}
|
||||
{{ options['customButtons']['before'] }}
|
||||
{% endif %}
|
||||
|
||||
{%- if options['customButtons']['replace'] is not defined and is_granted('CHILL_3PARTY_3PARTY_SHOW', thirdparty) -%}
|
||||
<li>
|
||||
<a class="btn btn-show" target="_blank" title="{{ 'Show thirdparty'|trans }}"
|
||||
href="{{ path('chill_3party_3party_show', { thirdparty_id: thirdparty.id }) }}"></a>
|
||||
</li>
|
||||
{%- else -%}
|
||||
{{ options['customButtons']['replace'] }}
|
||||
{%- endif -%}
|
||||
|
||||
{% if options['customButtons']['after'] is defined %}
|
||||
{{ options['customButtons']['after'] }}
|
||||
{% endif %}
|
||||
</ul>
|
||||
</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 -%}
|
@@ -1,7 +1,5 @@
|
||||
{% extends "@ChillMain/layout.html.twig" %}
|
||||
|
||||
{% import '@ChillMain/Address/macro.html.twig' as address %}
|
||||
|
||||
{% set title_ = 'Show third party %name%'|trans({'%name%' : thirdParty.name }) %}
|
||||
|
||||
{% block title title_ %}
|
||||
@@ -19,6 +17,7 @@
|
||||
</span>
|
||||
</h1>
|
||||
|
||||
|
||||
<dl class="chill_view_data">
|
||||
|
||||
<dt>{{ 'Name'|trans }}</dt>
|
||||
|
@@ -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
|
||||
@@ -22,50 +22,52 @@ 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;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
class ThirdPartyRender extends AbstractChillEntityRender
|
||||
{
|
||||
|
||||
protected EngineInterface $engine;
|
||||
|
||||
public function __construct(EngineInterface $engine)
|
||||
{
|
||||
$this->engine = $engine;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @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
|
||||
);
|
||||
|
||||
$params = [
|
||||
'with_valid_from' => $options['with_valid_from'] ?? true,
|
||||
'addLink' => $options['addLink'] ?? false,
|
||||
'addEntity' => $options['addEntity'] ?? false,
|
||||
'addId' => $options['addId'] ?? false,
|
||||
'addInfo' => $options['addInfo'] ?? false,
|
||||
'hLevel' => $options['hLevel'] ?? 3,
|
||||
'customButtons' => $options['customButtons'] ?? [],
|
||||
];
|
||||
|
||||
return
|
||||
$this->getDefaultOpeningBox('_3party').
|
||||
$this->templating->render('@ChillThirdParty/ThirdParty/_render.html.twig', [
|
||||
'contact' => $entity,
|
||||
$this->getDefaultOpeningBox('thirdparty') .
|
||||
$this->engine->render('@ChillThirdParty/Entity/thirdparty.html.twig', [
|
||||
'thirdparty' => $entity,
|
||||
'render' => $options['render'] ?? 'raw',
|
||||
'options' => $params
|
||||
]).
|
||||
]) .
|
||||
$this->getDefaultClosingBox();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param ThirdParty $entity
|
||||
* @param array $options
|
||||
* @return string
|
||||
|
@@ -1,6 +1,6 @@
|
||||
services:
|
||||
Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender:
|
||||
arguments:
|
||||
$templating: '@templating.engine.twig'
|
||||
$engine: '@Symfony\Component\Templating\EngineInterface'
|
||||
tags:
|
||||
- 'chill.render_entity'
|
||||
- 'chill.render_entity'
|
||||
|
@@ -44,6 +44,7 @@ shown to users: visible pour les utilisateurs
|
||||
Inactive, not shown to users: Inactif, invisible pour les utilisateurs
|
||||
Inactive: Inactif
|
||||
not shown to users: invisible pour les utilisateurs
|
||||
Show thirdparty: Voir le tiers
|
||||
|
||||
No nameCompany given: Aucune raison sociale renseignée
|
||||
No acronym given: Aucun sigle renseigné
|
||||
|
Reference in New Issue
Block a user