adapt thirdparty templates

This commit is contained in:
Mathieu Jaumotte 2021-07-16 17:01:32 +02:00
parent 1e626d573f
commit 25b00296ca
6 changed files with 157 additions and 122 deletions

View File

@ -2,6 +2,7 @@
namespace Chill\ThirdPartyBundle\Form; namespace Chill\ThirdPartyBundle\Form;
use Chill\MainBundle\Form\Type\ChillTextareaType;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
@ -69,7 +70,7 @@ class ThirdPartyType extends AbstractType
->add('email', EmailType::class, [ ->add('email', EmailType::class, [
'required' => false 'required' => false
]) ])
->add('comment', TextareaType::class, [ ->add('comment', ChillTextareaType::class, [
'required' => false 'required' => false
]) ])
->add('type', ChoiceType::class, [ ->add('type', ChoiceType::class, [

View File

@ -15,6 +15,7 @@
<nav class="filter-actions border border-secondary my-4 p-3"> <nav class="filter-actions border border-secondary my-4 p-3">
filter nav filter nav
{{ dump() }}
</nav> </nav>
</div> </div>

View File

@ -3,32 +3,38 @@
{% block title 'Create third party'|trans %} {% block title 'Create third party'|trans %}
{% block content %} {% block content %}
<div class="col-10 centered"> <div class="thirdparty-new my-5">
<h1>{{ 'Create third party'|trans }}</h1> <div class="row justify-content-center">
<div class="col-md-10 col-xxl">
{{ form_start(form) }} <h1>{{ 'Create third party'|trans }}</h1>
{{ form_row(form.name) }}
{{ form_row(form.type) }}
{{ form_row(form.telephone) }}
{{ form_row(form.email) }}
{{ form_row(form.address) }}
{{ form_row(form.active) }} {{ form_start(form) }}
{{ form_row(form.centers) }} {{ form_row(form.name) }}
{{ form_row(form.comment) }} {{ form_row(form.type) }}
{{ form_row(form.telephone) }}
{{ form_row(form.email) }}
{{ form_row(form.address) }}
{{ form_row(form.active) }}
{{ form_row(form.centers) }}
{{ form_row(form.comment) }}
<ul class="record_actions"> <ul class="record_actions">
<li class="cancel"> <li class="cancel">
<a href="{{ chill_return_path_or('chill_3party_3party_index') }}" class="btn btn-cancel"> <a href="{{ chill_return_path_or('chill_3party_3party_index') }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }} {{ 'Back to the list'|trans }}
</a> </a>
</li> </li>
<li> <li>
{{ form_widget(form.submit, {'label': 'Create', 'attr': {'class': 'btn btn-new' }}) }} {{ form_widget(form.submit, {'label': 'Create', 'attr': {'class': 'btn btn-new' }}) }}
</li> </li>
</ul> </ul>
{{ form_end(form) }} {{ form_end(form) }}
</div>
</div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -7,61 +7,75 @@
{% block title title_ %} {% block title title_ %}
{% block content %} {% block content %}
<div class="col-10 centered"> <div class="thirdparty-show my-5">
<h1> <div class="row justify-content-center">
{{ title_ }} <div class="col-md-10 col-xxl">
<span class="chill__box {{ thirdParty.active ? 'green' : 'red' }}">{{ (thirdParty.active ? 'Active, shown to users' : 'Inactive, not shown to users')|trans }}</span>
</h1>
<dl class="chill_view_data"> <h1>
<dt>{{ 'Name'|trans }}</dt> {{ title_ }}
<dd>{{ thirdParty.name }}</dd> <span class="badge bg-{{ thirdParty.active ? 'success' : 'danger' }}"
title="{{ (thirdParty.active ? 'shown to users' : 'not shown to users')|trans }}">
{{ (thirdParty.active ? 'Active' : 'Inactive')|trans }}
</span>
</h1>
<dt>{{ 'Type'|trans }}</dt> <dl class="chill_view_data">
{% set types = [] %} <dt>{{ 'Name'|trans }}</dt>
{% for t in thirdParty.type %} <dd>{{ thirdParty.name }}</dd>
{% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %}
{% endfor %}
<dd>{{ types|join(', ') }}</dd>
<dt>{{ 'Centers'|trans }}</dt> <dt>{{ 'Type'|trans }}</dt>
<dd>{{ 'The party is visible in those centers'|trans }}&nbsp;: {{ thirdParty.centers|join(', ') }}</dd> {% set types = [] %}
{% for t in thirdParty.type %}
{% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %}
{% endfor %}
<dd>{{ types|join(', ') }}</dd>
<dt>{{ 'Phonenumber'|trans }}</dt> <dt>{{ 'Centers'|trans }}</dt>
<dd>{{ thirdParty.telephone|chill_print_or_message("thirdparty.No_phonenumber") }}</dd> <dd>{{ 'The party is visible in those centers'|trans }}&nbsp;: {{ thirdParty.centers|join(', ') }}</dd>
<dt>{{ 'email'|trans }}<dt> <dt>{{ 'Phonenumber'|trans }}</dt>
<dd>{{ thirdParty.email|chill_print_or_message("thirdparty.No_email") }}</dd> <dd>{{ thirdParty.telephone|chill_print_or_message("thirdparty.No_phonenumber") }}</dd>
<dt>{{ 'Address'|trans }}</dt> <dt>{{ 'email'|trans }}<dt>
<dd> <dd>{{ thirdParty.email|chill_print_or_message("thirdparty.No_email") }}</dd>
{% if thirdParty.address == null %}
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
{% else %}
{{ address._render(thirdParty.address, {'with_valid_from': false }) }}
{% endif %}
</dd>
<dt>{{ 'Comment'|trans }}</dt> <dt>{{ 'Address'|trans }}</dt>
<dd>{{ thirdParty.comment|chill_print_or_message("thirdparty.No_comment") }}</dd> <dd>
{% if thirdParty.address == null %}
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
{% else %}
{{ address._render(thirdParty.address, {'with_valid_from': false }) }}
{% endif %}
</dd>
</dl> <dt>{{ 'Comment'|trans }}</dt>
<dd>
{% if thirdParty.comment is not empty %}
<blockquote class="chill-user-quote">
{{ thirdParty.comment|chill_markdown_to_html }}
</blockquote>
{% endif %}
</dd>
<ul class="record_actions"> </dl>
<li class="cancel">
<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_3party_3party_index') }}">
{{ 'Cancel'|trans }}
</a>
</li>
{% if is_granted('CHILL_3PARTY_3PARTY_UPDATE', thirdParty) %} <ul class="record_actions sticky-form-buttons">
<li> <li class="cancel">
<a class="btn btn-update" href="{{ chill_path_forward_return_path('chill_3party_3party_update', { 'thirdparty_id': thirdParty.id }) }}"> <a class="btn btn-cancel" href="{{ chill_return_path_or('chill_3party_3party_index') }}">
{{ 'Update'|trans }} {{ 'Cancel'|trans }}
</a> </a>
</li> </li>
{% endif %}
</ul>
{% if is_granted('CHILL_3PARTY_3PARTY_UPDATE', thirdParty) %}
<li>
<a class="btn btn-update" href="{{ chill_path_forward_return_path('chill_3party_3party_update', { 'thirdparty_id': thirdParty.id }) }}">
{{ 'Update'|trans }}
</a>
</li>
{% endif %}
</ul>
</div>
</div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -3,35 +3,44 @@
{% block title 'Update third party %name%'|trans({ '%name%': thirdParty.name }) %} {% block title 'Update third party %name%'|trans({ '%name%': thirdParty.name }) %}
{% block content %} {% block content %}
<div class="col-10 centered"> <div class="thirdparty-edit my-5">
<h1> <div class="row justify-content-center">
{{ 'Update third party %name%'|trans({ '%name%': thirdParty.name }) }} <div class="col-md-10 col-xxl">
<span class="chill__box {{ thirdParty.active ? 'green' : 'red' }}">{{ (thirdParty.active ? 'Active, shown to users' : 'Inactive, not shown to users')|trans }}</span>
</h1> <h1>
{{ 'Update third party %name%'|trans({ '%name%': thirdParty.name }) }}
{{ form_start(form) }} <span class="badge bg-{{ thirdParty.active ? 'success' : 'danger' }}"
{{ form_row(form.name) }} title="{{ (thirdParty.active ? 'shown to users' : 'not shown to users')|trans }}">
{{ form_row(form.type) }} {{ (thirdParty.active ? 'Active' : 'Inactive')|trans }}
{{ form_row(form.telephone) }} </span>
{{ form_row(form.email) }} </h1>
{{ form_row(form.address) }}
{{ form_row(form.active) }}
{{ form_row(form.centers) }}
{{ form_row(form.comment) }}
<ul class="record_actions"> {{ form_start(form) }}
<li class="cancel"> {{ form_row(form.name) }}
<a class="btn btn-cancel" href="{{ chill_path_forward_return_path('chill_3party_3party_index') }}"> {{ form_row(form.type) }}
{{ 'Back to the list'|trans }} {{ form_row(form.telephone) }}
</a> {{ form_row(form.email) }}
<li> {{ form_row(form.address) }}
{{ form_row(form.submit, {'label': 'Update', 'attr': {'class': 'btn btn-update' }}) }}
</li>
</ul>
{{ form_end(form) }} {{ form_row(form.active) }}
{{ form_row(form.centers) }}
{{ form_row(form.comment) }}
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a class="btn btn-cancel" href="{{ chill_path_forward_return_path('chill_3party_3party_index') }}">
{{ 'Back to the list'|trans }}
</a>
<li>
{{ form_widget(form.submit, {'label': 'Update', 'attr': {'class': 'btn btn-update' }}) }}
</li>
</ul>
{{ form_end(form) }}
</div>
</div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -19,8 +19,12 @@ Update third party %name%: Mettre à jour "%name%"
List of third parties: Liste des tiers List of third parties: Liste des tiers
Third party updated: Le tiers a été mis à jour Third party updated: Le tiers a été mis à jour
Third party created: Le tiers a été créé Third party created: Le tiers a été créé
Active, shown to users: Actif, visible par les utilisateurs Active, shown to users: Actif, visible pour les utilisateurs
Inactive, not shown to users: Inactif, invisible par les utilisateurs Active: Actif
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
The party is visible in those centers: Le tiers est visible dans ces centres The party is visible in those centers: Le tiers est visible dans ces centres