mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Use twig formatter from ChillFormTypesBundle.
This commit is contained in:
parent
c388f91e88
commit
e449efc695
@ -1,40 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Chill is a software for social workers
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\Phonenumber;
|
|
||||||
|
|
||||||
use Twig\Extension\AbstractExtension;
|
|
||||||
use Twig\TwigFilter;
|
|
||||||
|
|
||||||
class Templating extends AbstractExtension
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var PhonenumberHelper
|
|
||||||
*/
|
|
||||||
protected $phonenumberHelper;
|
|
||||||
|
|
||||||
public function __construct(PhonenumberHelper $phonenumberHelper)
|
|
||||||
{
|
|
||||||
$this->phonenumberHelper = $phonenumberHelper;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function formatPhonenumber($phonenumber)
|
|
||||||
{
|
|
||||||
return $this->phonenumberHelper->format($phonenumber) ?? $phonenumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFilters()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
new TwigFilter('chill_format_phonenumber', [$this, 'formatPhonenumber']),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
@ -91,17 +91,58 @@
|
|||||||
<a href="{{ path('chill_person_new') }}" class="btn btn-create">
|
<a href="{{ path('chill_person_new') }}" class="btn btn-create">
|
||||||
{{ 'Add a person'|trans }}
|
{{ 'Add a person'|trans }}
|
||||||
</a>
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% if person.birthdate is not null %}{{person.birthdate|format_date('long') }}{% else %}{{ 'Unknown date of birth'|trans }}{% endif %}
|
||||||
|
</td>
|
||||||
|
<td class="person-list__--by-phonenumber__phones">
|
||||||
|
<ul>
|
||||||
|
{% if person.phonenumber is not empty %}
|
||||||
|
<li>
|
||||||
|
<a href="tel:{{ person.phonenumber }}"><img src="{{ asset('build/images/mobile-alt-solid.svg') }}"> <pre>{{ person.phonenumber|phone_number_format('INTERNATIONAL') }}</pre></a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if person.mobilenumber is not empty%}
|
||||||
|
<li>
|
||||||
|
<a href="tel:{{ person.mobilenumber }}"><img src="{{ asset('build/images/phone-alt-solid.svg') }}"> <pre>{{ person.mobilenumber|phone_number_format('INTERNATIONAL') }}</pre></a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li><a class="sc-button bt-show" href="{{ path('chill_person_view', { person_id : person.getId }) }}"></a></li>
|
||||||
|
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
|
||||||
|
<li><a class="sc-button bt-update" href="{{ path('chill_person_general_edit', { person_id : person.getId }) }}"></a></li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<ul class="record_actions">
|
||||||
|
{% if is_granted('CHILL_PERSON_CREATE') %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('chill_person_new') }}" class="sc-button bt-create">
|
||||||
|
{{ 'Add a person'|trans }}
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if preview == true and persons|length < total %}
|
{% if preview == true and persons|length < total %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_main_search', { "name": search_name|default('abcd'), "q" : pattern }) }}" class="btn btn-misc">
|
<a href="{{ path('chill_main_search', { "name": search_name|default('abcd'), "q" : pattern }) }}" class="sc-button">
|
||||||
{{ 'See all results'|trans }}
|
{{ 'See all results'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if preview == false %}
|
||||||
|
{{ chill_pagination(paginator) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if preview == false %}
|
{% if preview == false %}
|
||||||
{{ chill_pagination(paginator) }}
|
{{ chill_pagination(paginator) }}
|
||||||
|
@ -119,14 +119,40 @@ This view should receive those arguments:
|
|||||||
{% endapply %}</dd>
|
{% endapply %}</dd>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
|
{%- if chill_person.fields.email == 'visible' -%}
|
||||||
|
<dl>
|
||||||
|
<dt>{{ 'Email'|trans }} :</dt>
|
||||||
|
<dd>{% if person.email is not empty %}<a href="mailto:{{ person.email|escape('html_attr') }}">{{ person.email }}</a>{% else %}<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>{% endif %}</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</figure>
|
{%- endif -%}
|
||||||
</div>
|
{%- if chill_person.fields.phonenumber == 'visible' -%}
|
||||||
|
<dl>
|
||||||
{% if person.genderComment.comment is not empty %}
|
<dt>{{ 'Phonenumber'|trans }} :</dt>
|
||||||
<div class="col-12">
|
<dd>{% if person.phonenumber is not empty %}<a href="tel:{{ person.phonenumber|phone_number_format('INTERNATIONAL') }}"><pre>{{ person.phonenumber|phone_number_format('INTERNATIONAL') }}</pre></a>{% else %}<span class="chill-no-data-statement">{{ 'No data given'|trans }}{% endif %}</dd>
|
||||||
<figure class="person-details">
|
</dl>
|
||||||
<h2 class="chill-beige">{{ 'Gender comment'|trans }} :</h2>
|
{% endif %}
|
||||||
|
{%- if chill_person.fields.mobilenumber == 'visible' -%}
|
||||||
|
<dl>
|
||||||
|
<dt>{{ 'Mobilenumber'|trans }} :</dt>
|
||||||
|
<dd>{% if person.mobilenumber is not empty %}<a href="tel:{{ person.mobilenumber|phone_number_format('INTERNATIONAL') }}"><pre>{{ person.mobilenumber|phone_number_format('INTERNATIONAL') }}</pre></a>{% else %}<span class="chill-no-data-statement">{{ 'No data given'|trans }}{% endif %}</dd>
|
||||||
|
</dl>
|
||||||
|
{% endif %}
|
||||||
|
{% for pp in person.otherPhoneNumbers %}
|
||||||
|
<dt>{{ 'Other phonenumber'|trans }} :</dt>
|
||||||
|
<dd>
|
||||||
|
<a href="tel:{{ pp.phoneNumber|phone_number_format('INTERNATIONAL') }}"><pre>{{ pp.phoneNumber|phone_number_format('INTERNATIONAL') }}</pre></a>
|
||||||
|
{% if pp.description is not empty %}
|
||||||
|
<blockquote class="chill-user-quote">
|
||||||
|
{{ pp.description|nl2br }}
|
||||||
|
{% endif %}
|
||||||
|
</blockquote>
|
||||||
|
</dd>
|
||||||
|
{% endfor %}
|
||||||
|
{%- if chill_person.fields.contact_info == 'visible' -%}
|
||||||
|
<dl>
|
||||||
|
<dt>{{ 'Notes on contact information'|trans }} :</dt>
|
||||||
|
<dd>
|
||||||
|
{% if person.contactInfo is not empty %}
|
||||||
<div class="chill-user-quote">
|
<div class="chill-user-quote">
|
||||||
{{ person.genderComment.comment|chill_markdown_to_html }}
|
{{ person.genderComment.comment|chill_markdown_to_html }}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user