mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 22:04:23 +00:00
adapt thirdparty templates
This commit is contained in:
parent
1e626d573f
commit
25b00296ca
@ -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;
|
||||||
@ -25,21 +26,21 @@ class ThirdPartyType extends AbstractType
|
|||||||
* @var AuthorizationHelper
|
* @var AuthorizationHelper
|
||||||
*/
|
*/
|
||||||
protected $authorizationHelper;
|
protected $authorizationHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var TokenStorageInterface
|
* @var TokenStorageInterface
|
||||||
*/
|
*/
|
||||||
protected $tokenStorage;
|
protected $tokenStorage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var ThirdPartyTypeManager
|
* @var ThirdPartyTypeManager
|
||||||
*/
|
*/
|
||||||
protected $typesManager;
|
protected $typesManager;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
AuthorizationHelper $authorizationHelper,
|
AuthorizationHelper $authorizationHelper,
|
||||||
TokenStorageInterface $tokenStorage,
|
TokenStorageInterface $tokenStorage,
|
||||||
ThirdPartyTypeManager $typesManager
|
ThirdPartyTypeManager $typesManager
|
||||||
) {
|
) {
|
||||||
@ -47,7 +48,7 @@ class ThirdPartyType extends AbstractType
|
|||||||
$this->tokenStorage = $tokenStorage;
|
$this->tokenStorage = $tokenStorage;
|
||||||
$this->typesManager = $typesManager;
|
$this->typesManager = $typesManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
@ -57,7 +58,7 @@ class ThirdPartyType extends AbstractType
|
|||||||
foreach ($this->typesManager->getProviders() as $key => $provider) {
|
foreach ($this->typesManager->getProviders() as $key => $provider) {
|
||||||
$types['chill_3party.key_label.'.$key] = $key;
|
$types['chill_3party.key_label.'.$key] = $key;
|
||||||
}
|
}
|
||||||
|
|
||||||
$builder
|
$builder
|
||||||
->add('name', TextType::class, [
|
->add('name', TextType::class, [
|
||||||
'required' => true
|
'required' => true
|
||||||
@ -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, [
|
||||||
@ -99,9 +100,9 @@ class ThirdPartyType extends AbstractType
|
|||||||
])
|
])
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param array $options
|
* @param array $options
|
||||||
* @return \Chill\MainBundle\Entity\Center[]
|
* @return \Chill\MainBundle\Entity\Center[]
|
||||||
*/
|
*/
|
||||||
@ -113,11 +114,11 @@ class ThirdPartyType extends AbstractType
|
|||||||
case 'update': $role = new Role(ThirdPartyVoter::UPDATE);
|
case 'update': $role = new Role(ThirdPartyVoter::UPDATE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->authorizationHelper->getReachableCenters(
|
return $this->authorizationHelper->getReachableCenters(
|
||||||
$this->tokenStorage->getToken()->getUser(), $role);
|
$this->tokenStorage->getToken()->getUser(), $role);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
@ -126,7 +127,7 @@ class ThirdPartyType extends AbstractType
|
|||||||
$resolver->setDefaults(array(
|
$resolver->setDefaults(array(
|
||||||
'data_class' => 'Chill\ThirdPartyBundle\Entity\ThirdParty'
|
'data_class' => 'Chill\ThirdPartyBundle\Entity\ThirdParty'
|
||||||
));
|
));
|
||||||
|
|
||||||
$resolver->setRequired('usage')
|
$resolver->setRequired('usage')
|
||||||
->setAllowedValues('usage', ['create', 'update'])
|
->setAllowedValues('usage', ['create', 'update'])
|
||||||
;
|
;
|
||||||
|
@ -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>
|
||||||
|
@ -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_start(form) }}
|
||||||
{{ form_row(form.telephone) }}
|
{{ form_row(form.name) }}
|
||||||
{{ form_row(form.email) }}
|
{{ form_row(form.type) }}
|
||||||
{{ form_row(form.address) }}
|
{{ form_row(form.telephone) }}
|
||||||
|
{{ form_row(form.email) }}
|
||||||
{{ form_row(form.active) }}
|
{{ form_row(form.address) }}
|
||||||
{{ form_row(form.centers) }}
|
|
||||||
{{ form_row(form.comment) }}
|
{{ 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 %}
|
||||||
|
@ -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>
|
<h1>
|
||||||
|
{{ title_ }}
|
||||||
<dl class="chill_view_data">
|
<span class="badge bg-{{ thirdParty.active ? 'success' : 'danger' }}"
|
||||||
<dt>{{ 'Name'|trans }}</dt>
|
title="{{ (thirdParty.active ? 'shown to users' : 'not shown to users')|trans }}">
|
||||||
<dd>{{ thirdParty.name }}</dd>
|
{{ (thirdParty.active ? 'Active' : 'Inactive')|trans }}
|
||||||
|
</span>
|
||||||
<dt>{{ 'Type'|trans }}</dt>
|
</h1>
|
||||||
{% set types = [] %}
|
|
||||||
{% for t in thirdParty.type %}
|
<dl class="chill_view_data">
|
||||||
{% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %}
|
<dt>{{ 'Name'|trans }}</dt>
|
||||||
{% endfor %}
|
<dd>{{ thirdParty.name }}</dd>
|
||||||
<dd>{{ types|join(', ') }}</dd>
|
|
||||||
|
<dt>{{ 'Type'|trans }}</dt>
|
||||||
<dt>{{ 'Centers'|trans }}</dt>
|
{% set types = [] %}
|
||||||
<dd>{{ 'The party is visible in those centers'|trans }} : {{ thirdParty.centers|join(', ') }}</dd>
|
{% for t in thirdParty.type %}
|
||||||
|
{% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %}
|
||||||
<dt>{{ 'Phonenumber'|trans }}</dt>
|
{% endfor %}
|
||||||
<dd>{{ thirdParty.telephone|chill_print_or_message("thirdparty.No_phonenumber") }}</dd>
|
<dd>{{ types|join(', ') }}</dd>
|
||||||
|
|
||||||
<dt>{{ 'email'|trans }}<dt>
|
<dt>{{ 'Centers'|trans }}</dt>
|
||||||
<dd>{{ thirdParty.email|chill_print_or_message("thirdparty.No_email") }}</dd>
|
<dd>{{ 'The party is visible in those centers'|trans }} : {{ thirdParty.centers|join(', ') }}</dd>
|
||||||
|
|
||||||
<dt>{{ 'Address'|trans }}</dt>
|
<dt>{{ 'Phonenumber'|trans }}</dt>
|
||||||
<dd>
|
<dd>{{ thirdParty.telephone|chill_print_or_message("thirdparty.No_phonenumber") }}</dd>
|
||||||
{% if thirdParty.address == null %}
|
|
||||||
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
|
<dt>{{ 'email'|trans }}<dt>
|
||||||
{% else %}
|
<dd>{{ thirdParty.email|chill_print_or_message("thirdparty.No_email") }}</dd>
|
||||||
{{ address._render(thirdParty.address, {'with_valid_from': false }) }}
|
|
||||||
{% endif %}
|
<dt>{{ 'Address'|trans }}</dt>
|
||||||
</dd>
|
<dd>
|
||||||
|
{% if thirdParty.address == null %}
|
||||||
<dt>{{ 'Comment'|trans }}</dt>
|
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
|
||||||
<dd>{{ thirdParty.comment|chill_print_or_message("thirdparty.No_comment") }}</dd>
|
{% else %}
|
||||||
|
{{ address._render(thirdParty.address, {'with_valid_from': false }) }}
|
||||||
</dl>
|
{% endif %}
|
||||||
|
</dd>
|
||||||
<ul class="record_actions">
|
|
||||||
<li class="cancel">
|
<dt>{{ 'Comment'|trans }}</dt>
|
||||||
<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_3party_3party_index') }}">
|
<dd>
|
||||||
{{ 'Cancel'|trans }}
|
{% if thirdParty.comment is not empty %}
|
||||||
</a>
|
<blockquote class="chill-user-quote">
|
||||||
</li>
|
{{ thirdParty.comment|chill_markdown_to_html }}
|
||||||
|
</blockquote>
|
||||||
{% if is_granted('CHILL_3PARTY_3PARTY_UPDATE', thirdParty) %}
|
{% endif %}
|
||||||
<li>
|
</dd>
|
||||||
<a class="btn btn-update" href="{{ chill_path_forward_return_path('chill_3party_3party_update', { 'thirdparty_id': thirdParty.id }) }}">
|
|
||||||
{{ 'Update'|trans }}
|
</dl>
|
||||||
</a>
|
|
||||||
</li>
|
<ul class="record_actions sticky-form-buttons">
|
||||||
{% endif %}
|
<li class="cancel">
|
||||||
</ul>
|
<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) %}
|
||||||
|
<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 %}
|
||||||
|
@ -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>
|
{{ form_row(form.active) }}
|
||||||
</ul>
|
{{ form_row(form.centers) }}
|
||||||
|
{{ form_row(form.comment) }}
|
||||||
{{ form_end(form) }}
|
|
||||||
|
|
||||||
|
<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 %}
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user