mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
crudification for thirdparty
This commit is contained in:
parent
a8edef13a3
commit
7ea2c36c5e
@ -67,7 +67,7 @@ class CenterTransformer implements DataTransformerInterface
|
||||
}
|
||||
|
||||
if ($this->multiple) {
|
||||
return new ArrayCollect($centers);
|
||||
return new ArrayCollection($centers);
|
||||
} else {
|
||||
return $centers[0];
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\CallbackTransformer;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
@ -41,7 +43,7 @@ use Symfony\Component\Security\Core\Security;
|
||||
*
|
||||
*
|
||||
*/
|
||||
class CenterType extends AbstractType
|
||||
class PickCenterType extends AbstractType
|
||||
{
|
||||
protected AuthorizationHelperInterface $authorizationHelper;
|
||||
|
||||
@ -112,9 +114,8 @@ class CenterType extends AbstractType
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$centers = $this->getReachableCenters($options['role'], $options['scopes']);
|
||||
dump($centers);
|
||||
|
||||
if (count($centers) <= 1) {
|
||||
dump($centers);
|
||||
$multiple = $options['choice_options']['multiple'] ?? false;
|
||||
$builder->add('center', HiddenType::class);
|
||||
$builder->get('center')->addModelTransformer(
|
||||
@ -165,4 +166,9 @@ class CenterType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
$view->vars['is_hidden'] = count($this->getReachableCenters($options['role'],
|
||||
$options['scopes'])) <= 1;
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
{% set formId = crudMainFormId|default('crud_main_form') %}
|
||||
<div class="{% block crud_content_main_div_class %}{% endblock %}">
|
||||
<div class="{% block crud_content_main_div_class %}col-10 centered{% endblock %}">
|
||||
{% block crud_content_header %}
|
||||
<h1>{{ ('crud.'~crud_name~'.title_edit')|trans }}</h1>
|
||||
{% endblock crud_content_header %}
|
||||
|
@ -1,10 +1,11 @@
|
||||
{% set formId = crudMainFormId|default('crud_main_form') %}
|
||||
<div class="{% block crud_content_main_div_class %}col-10 centered{% endblock %}">
|
||||
{% block crud_content_header %}
|
||||
<h1>{{ ('crud.' ~ crud_name ~ '.title_new')|trans({'%crud_name%' : crud_name }) }}</h1>
|
||||
{% endblock crud_content_header %}
|
||||
|
||||
{% block crud_content_form %}
|
||||
{{ form_start(form) }}
|
||||
{{ form_start(form, { 'attr' : { 'id': formId } }) }}
|
||||
|
||||
{% block crud_content_form_rows %}
|
||||
{% for f in form %}{% if f.vars.name != 'submit' %}
|
||||
@ -14,6 +15,8 @@
|
||||
|
||||
{% block crud_content_after_form %}{% endblock %}
|
||||
|
||||
{{ form_end(form) }}
|
||||
|
||||
{% block crud_content_form_actions %}
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
{% block content_form_actions_back %}
|
||||
@ -25,21 +28,21 @@
|
||||
{% endblock %}
|
||||
{% block content_form_actions_save_and_close %}
|
||||
<li class="">
|
||||
<button type="submit" name="submit" value="save-and-close" class="btn btn-create">
|
||||
<button type="submit" name="submit" value="save-and-close" class="btn btn-create" form="{{ formId }}">
|
||||
{{ 'crud.new.save_and_close'|trans }}
|
||||
</button>
|
||||
</li>
|
||||
{% endblock %}
|
||||
{% block content_form_actions_save_and_show %}
|
||||
<li class="">
|
||||
<button type="submit" name="submit" value="save-and-show" class="btn btn-create">
|
||||
<button type="submit" name="submit" value="save-and-show" class="btn btn-create" form="{{ formId }}">
|
||||
{{ 'crud.new.save_and_show'|trans }}
|
||||
</button>
|
||||
</li>
|
||||
{% endblock %}
|
||||
{% block content_form_actions_save_and_new %}
|
||||
<li class="">
|
||||
<button type="submit" name="submit" value="save-and-new" class="btn btn-create">
|
||||
<button type="submit" name="submit" value="save-and-new" class="btn btn-create" form="{{ formId }}">
|
||||
{{ 'crud.new.save_and_new'|trans }}
|
||||
</button>
|
||||
</li>
|
||||
|
@ -198,3 +198,15 @@
|
||||
{{ form_widget(entry) }}
|
||||
{% endfor %}
|
||||
{% endblock comment_widget %}
|
||||
|
||||
{% block pick_center_widget %}
|
||||
{{ form_widget(form.center) }}
|
||||
{% endblock pick_center_widget %}
|
||||
|
||||
{% block pick_center_row %}
|
||||
{% if (not form.vars.is_hidden) %}
|
||||
{{ block('form_row') }}
|
||||
{% else %}
|
||||
{{ form_widget(form.center) }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
@ -36,7 +36,7 @@ services:
|
||||
tags:
|
||||
- { name: form.type, alias: select2_chill_language }
|
||||
|
||||
Chill\MainBundle\Form\Type\CenterType:
|
||||
Chill\MainBundle\Form\Type\PickCenterType:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
|
||||
|
@ -22,7 +22,9 @@
|
||||
namespace Chill\PersonBundle\Form;
|
||||
|
||||
use Chill\MainBundle\Form\Event\CustomizeFormEvent;
|
||||
use Chill\MainBundle\Repository\CenterRepository;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
@ -30,12 +32,11 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
|
||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||
use Chill\MainBundle\Form\Type\CenterType;
|
||||
use Chill\MainBundle\Form\Type\PickCenterType;
|
||||
use Chill\PersonBundle\Form\Type\GenderType;
|
||||
use Chill\MainBundle\Form\Type\DataTransformer\CenterTransformer;
|
||||
use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper;
|
||||
use Chill\PersonBundle\Form\Type\PersonAltNameType;
|
||||
use Chill\MainBundle\Form\Type\Export\PickCenterType;
|
||||
|
||||
final class CreationPersonType extends AbstractType
|
||||
{
|
||||
@ -43,11 +44,7 @@ final class CreationPersonType extends AbstractType
|
||||
// TODO: See if this is still valid and update accordingly.
|
||||
const NAME = 'chill_personbundle_person_creation';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var CenterTransformer
|
||||
*/
|
||||
private $centerTransformer;
|
||||
private CenterRepository $centerRepository;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -58,11 +55,11 @@ final class CreationPersonType extends AbstractType
|
||||
private EventDispatcherInterface $dispatcher;
|
||||
|
||||
public function __construct(
|
||||
CenterTransformer $centerTransformer,
|
||||
CenterRepository $centerRepository,
|
||||
ConfigPersonAltNamesHelper $configPersonAltNamesHelper,
|
||||
EventDispatcherInterface $dispatcher
|
||||
) {
|
||||
$this->centerTransformer = $centerTransformer;
|
||||
$this->centerTransformer = $centerRepository;
|
||||
$this->configPersonAltNamesHelper = $configPersonAltNamesHelper;
|
||||
$this->dispatcher = $dispatcher;
|
||||
}
|
||||
@ -82,8 +79,9 @@ final class CreationPersonType extends AbstractType
|
||||
->add('gender', GenderType::class, array(
|
||||
'required' => true, 'placeholder' => null
|
||||
))
|
||||
->add('center', CenterType::class, [
|
||||
'required' => false
|
||||
->add('center', PickCenterType::class, [
|
||||
'required' => false,
|
||||
'role' => PersonVoter::CREATE,
|
||||
])
|
||||
;
|
||||
|
||||
|
@ -71,7 +71,7 @@ final class ThirdPartyController extends CRUDController
|
||||
/**
|
||||
* @Route("/new", name="chill_3party_3party_new")
|
||||
*/
|
||||
public function newAction(Request $request)
|
||||
public function newActionkk(Request $request)
|
||||
{
|
||||
$this->denyAccessUnlessGranted(ThirdPartyVoter::CREATE);
|
||||
|
||||
@ -115,7 +115,7 @@ final class ThirdPartyController extends CRUDController
|
||||
* @Route("/{thirdparty_id}/update", name="chill_3party_3party_update")
|
||||
* @ParamConverter("thirdParty", options={"id": "thirdparty_id"})
|
||||
*/
|
||||
public function updateAction(ThirdParty $thirdParty, Request $request)
|
||||
public function updateActionkk(ThirdParty $thirdParty, Request $request)
|
||||
{
|
||||
$this->denyAccessUnlessGranted(ThirdPartyVoter::CREATE);
|
||||
|
||||
|
@ -71,7 +71,16 @@ class ChillThirdPartyExtension extends Extension implements PrependExtensionInte
|
||||
'role' => ThirdPartyVoter::SHOW,
|
||||
],
|
||||
'new' => [
|
||||
'template' => '@ChillThirdParty/ThirdParty/new.html.twig',
|
||||
'role' => ThirdPartyVoter::CREATE,
|
||||
],
|
||||
'edit' => [
|
||||
'template' => '@ChillThirdParty/ThirdParty/update.html.twig',
|
||||
'role' => ThirdPartyVoter::UPDATE,
|
||||
],
|
||||
'view' => [
|
||||
'template' => '@ChillThirdParty/ThirdParty/view.html.twig',
|
||||
'role' => ThirdPartyVoter::SHOW,
|
||||
]
|
||||
]
|
||||
|
||||
|
@ -3,8 +3,10 @@
|
||||
namespace Chill\ThirdPartyBundle\Form;
|
||||
|
||||
use Chill\MainBundle\Entity\Address;
|
||||
use Chill\MainBundle\Form\Type\PickCenterType;
|
||||
use Chill\MainBundle\Form\Type\ChillTextareaType;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdPartyCategory;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdPartyCivility;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdPartyProfession;
|
||||
@ -129,12 +131,22 @@ class ThirdPartyType extends AbstractType
|
||||
->add('comment', ChillTextareaType::class, [
|
||||
'required' => false
|
||||
])
|
||||
->add('centers', PickCenterType::class, [
|
||||
'role' => $this->om->contains($options['data']) ?
|
||||
ThirdPartyVoter::UPDATE : ThirdPartyVoter::CREATE,
|
||||
'choice_options' => [
|
||||
'multiple' => true,
|
||||
'attr' => ['class' => 'select2']
|
||||
]
|
||||
])
|
||||
/*
|
||||
->add('centers', EntityType::class, [
|
||||
'choices' => $this->getReachableCenters($options),
|
||||
'class' => \Chill\MainBundle\Entity\Center::class,
|
||||
'multiple' => true,
|
||||
'attr' => ['class' => 'select2']
|
||||
])
|
||||
*/
|
||||
;
|
||||
|
||||
$builder
|
||||
@ -228,12 +240,14 @@ class ThirdPartyType extends AbstractType
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => 'Chill\ThirdPartyBundle\Entity\ThirdParty'
|
||||
'data_class' => ThirdParty::class
|
||||
));
|
||||
|
||||
/*
|
||||
$resolver->setRequired('usage')
|
||||
->setAllowedValues('usage', ['create', 'update'])
|
||||
;
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
53
src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/_form.html.twig
vendored
Normal file
53
src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/_form.html.twig
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
{% if form.civility is defined %}
|
||||
{{ form_row(form.civility) }}
|
||||
{% endif %}
|
||||
|
||||
{{ form_row(form.name) }}
|
||||
|
||||
{% if form.nameCompany is defined %}
|
||||
{{ form_row(form.nameCompany) }}
|
||||
{{ form_row(form.acronym) }}
|
||||
{% endif %}
|
||||
|
||||
{% if form.profession is defined %}
|
||||
{{ form_row(form.profession) }}
|
||||
{% endif %}
|
||||
|
||||
{{ form_row(form.types) }}
|
||||
{{ form_row(form.categories) }}
|
||||
|
||||
{{ form_row(form.telephone) }}
|
||||
{{ form_row(form.email) }}
|
||||
|
||||
<div class="mb-3 row">
|
||||
{{ form_label(form.address) }}
|
||||
{{ form_widget(form.address) }}
|
||||
<div class="col-sm-8">
|
||||
{% if thirdParty.address %}
|
||||
{# include vue_address component #}
|
||||
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
|
||||
targetEntity: { name: 'thirdparty', id: thirdParty.id },
|
||||
mode: 'edit',
|
||||
addressId: thirdParty.address.id,
|
||||
buttonSize: 'btn-sm',
|
||||
} %}
|
||||
{#
|
||||
backUrl: path('chill_3party_3party_new'),
|
||||
#}
|
||||
{% else %}
|
||||
{# include vue_address component #}
|
||||
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
|
||||
targetEntity: { name: 'thirdparty', id: thirdParty.id },
|
||||
mode: 'new',
|
||||
buttonSize: 'btn-sm',
|
||||
buttonText: 'Create a new address',
|
||||
modalTitle: 'Create a new address',
|
||||
} %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ form_row(form.comment) }}
|
||||
{{ form_row(form.centers) }}
|
||||
|
||||
{{ form_row(form.active) }}
|
@ -77,12 +77,12 @@
|
||||
<ul class="record_actions">
|
||||
{% if is_granted('CHILL_3PARTY_3PARTY_UPDATE', tp) %}
|
||||
<li>
|
||||
<a href="{{ chill_path_add_return_path('chill_3party_3party_update', { 'thirdparty_id': tp.id }) }}" class="btn btn-sm btn-update"></a>
|
||||
<a href="{{ chill_path_add_return_path('chill_crud_3party_3party_edit', { 'id': tp.id }) }}" class="btn btn-sm btn-update"></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if is_granted('CHILL_3PARTY_3PARTY_SHOW', tp) %}
|
||||
<li>
|
||||
<a href="{{ chill_path_add_return_path('chill_3party_3party_show', { 'thirdparty_id': tp.id }) }}" class="btn btn-sm btn-show"></a>
|
||||
<a href="{{ chill_path_add_return_path('chill_crud_3party_3party_view', { 'id': tp.id }) }}" class="btn btn-sm btn-show"></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
@ -1,87 +1,20 @@
|
||||
{% extends "@ChillMain/layout.html.twig" %}
|
||||
|
||||
{% set thirdParty = entity %}
|
||||
|
||||
{% block title 'Create third party'|trans %}
|
||||
|
||||
{% block content %}
|
||||
<div class="thirdparty-new my-5">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-10 col-xxl">
|
||||
|
||||
<h1>{{ 'Create third party'|trans }}</h1>
|
||||
|
||||
{{ form_start(form) }}
|
||||
|
||||
{% if form.civility is defined %}
|
||||
{{ form_row(form.civility) }}
|
||||
{% endif %}
|
||||
|
||||
{{ form_row(form.name) }}
|
||||
|
||||
{% if form.nameCompany is defined %}
|
||||
{{ form_row(form.nameCompany) }}
|
||||
{{ form_row(form.acronym) }}
|
||||
{% endif %}
|
||||
|
||||
{% if form.profession is defined %}
|
||||
{{ form_row(form.profession) }}
|
||||
{% endif %}
|
||||
|
||||
{{ form_row(form.types) }}
|
||||
{{ form_row(form.categories) }}
|
||||
|
||||
{{ form_row(form.telephone) }}
|
||||
{{ form_row(form.email) }}
|
||||
|
||||
<div class="mb-3 row">
|
||||
{{ form_label(form.address) }}
|
||||
{{ form_widget(form.address) }}
|
||||
<div class="col-sm-8">
|
||||
{% if thirdParty.address %}
|
||||
{# include vue_address component #}
|
||||
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
|
||||
targetEntity: { name: 'thirdparty', id: thirdParty.id },
|
||||
mode: 'edit',
|
||||
addressId: thirdParty.address.id,
|
||||
buttonSize: 'btn-sm',
|
||||
} %}
|
||||
{#
|
||||
backUrl: path('chill_3party_3party_new'),
|
||||
#}
|
||||
{% else %}
|
||||
{# include vue_address component #}
|
||||
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
|
||||
targetEntity: { name: 'thirdparty', id: thirdParty.id },
|
||||
mode: 'new',
|
||||
buttonSize: 'btn-sm',
|
||||
buttonText: 'Create a new address',
|
||||
modalTitle: 'Create a new address',
|
||||
} %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ form_row(form.comment) }}
|
||||
{{ form_row(form.centers) }}
|
||||
|
||||
{{ form_row(form.active) }}
|
||||
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="cancel">
|
||||
<a href="{{ chill_return_path_or('chill_3party_3party_index') }}" class="btn btn-cancel">
|
||||
{{ 'Back to the list'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
{{ form_widget(form.submit, {'label': 'Create', 'attr': {'class': 'btn btn-new' }}) }}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{{ form_end(form) }}
|
||||
|
||||
</div>
|
||||
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
|
||||
{% block crud_content_header %}
|
||||
<h1>{{ 'Create third party'|trans }}</h1>
|
||||
{% endblock %}
|
||||
{% block crud_content_form_rows %}
|
||||
{% include '@ChillThirdParty/ThirdParty/_form.html.twig' %}
|
||||
{% endblock %}
|
||||
{% endembed %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -1,122 +0,0 @@
|
||||
{% extends "@ChillMain/layout.html.twig" %}
|
||||
|
||||
{% set title_ = 'Show third party %name%'|trans({'%name%' : thirdParty.name }) %}
|
||||
|
||||
{% block title title_ %}
|
||||
|
||||
{% block content %}
|
||||
<div class="thirdparty-show my-5">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-10 col-xxl">
|
||||
|
||||
<h1>
|
||||
{{ title_ }}
|
||||
<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>
|
||||
|
||||
|
||||
<dl class="chill_view_data">
|
||||
|
||||
<dt>{{ 'Name'|trans }}</dt>
|
||||
<dd>
|
||||
{% if thirdParty.isLeaf == true %}{{ thirdParty.civility }}{% endif %}
|
||||
{{ thirdParty.name }}
|
||||
</dd>
|
||||
|
||||
{% if thirdParty.isLeaf == false %}
|
||||
<dt>{{ 'thirdparty.NameCompany'|trans }}</dt>
|
||||
<dd>
|
||||
{% if thirdParty.nameCompany == null %}
|
||||
<span class="chill-no-data-statement">{{ 'No nameCompany given'|trans }}</span>
|
||||
{% else %}
|
||||
{{ thirdParty.nameCompany }}
|
||||
{% endif %}
|
||||
</dd>
|
||||
|
||||
<dt>{{ 'thirdparty.Acronym'|trans }}</dt>
|
||||
<dd>
|
||||
{% if thirdParty.acronym == null %}
|
||||
<span class="chill-no-data-statement">{{ 'No acronym given'|trans }}</span>
|
||||
{% else %}
|
||||
{{ thirdParty.acronym }}
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% endif %}
|
||||
|
||||
<dt>{{ 'Type'|trans }}</dt>
|
||||
{% set types = [] %}
|
||||
{% for t in thirdParty.types %}
|
||||
{% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %}
|
||||
{% endfor %}
|
||||
<dd>
|
||||
{{ types|join(', ') }}
|
||||
</dd>
|
||||
|
||||
<dt>{{ 'Phonenumber'|trans }}</dt>
|
||||
<dd>
|
||||
{% if thirdParty.telephone == null %}
|
||||
<span class="chill-no-data-statement">{{ 'No phone given'|trans }}</span>
|
||||
{% else %}
|
||||
<a href="{{ 'tel:' ~ thirdParty.telephone }}">
|
||||
{{ thirdParty.telephone|chill_print_or_message("thirdparty.No_phonenumber") }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</dd>
|
||||
|
||||
<dt>{{ 'email'|trans }}<dt>
|
||||
<dd>
|
||||
{% if thirdParty.email == null %}
|
||||
<span class="chill-no-data-statement">{{ 'No email given'|trans }}</span>
|
||||
{% else %}
|
||||
<a href="{{ 'mailto:' ~ thirdParty.email }}">
|
||||
{{ thirdParty.email|chill_print_or_message("thirdparty.No_email") }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</dd>
|
||||
|
||||
<dt>{{ 'Address'|trans }}</dt>
|
||||
<dd>
|
||||
{% if thirdParty.address == null %}
|
||||
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
|
||||
{% else %}
|
||||
{{ thirdParty.address|chill_entity_render_box({'with_valid_from': false, 'extended_infos': true }) }}
|
||||
{% endif %}
|
||||
</dd>
|
||||
|
||||
<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>
|
||||
|
||||
<dt>{{ 'Centers'|trans }}</dt>
|
||||
<dd>{{ 'The party is visible in those centers'|trans }} : {{ thirdParty.centers|join(', ') }}</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="cancel">
|
||||
<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_3party_3party_index') }}">
|
||||
{{ 'Back to the list'|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>
|
||||
{% endblock %}
|
@ -1,30 +1,47 @@
|
||||
{% extends "@ChillMain/layout.html.twig" %}
|
||||
|
||||
{% set thirdParty = entity %}
|
||||
|
||||
{% block title 'Update third party %name%'|trans({ '%name%': thirdParty.name }) %}
|
||||
|
||||
{% block content %}
|
||||
<div class="thirdparty-new my-5">
|
||||
<div class="row justify-content-center">
|
||||
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
|
||||
{% block crud_content_header %}
|
||||
<h1>
|
||||
{{ 'Update third party %name%'|trans({ '%name%': thirdParty.name }) }}
|
||||
<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>
|
||||
{% endblock %}
|
||||
{% block crud_content_form_rows %}
|
||||
<div class="date-by">
|
||||
{% if thirdParty.updatedAt != null %}
|
||||
{{ 'thirdparty.UpdatedAt.short'|trans ~ thirdParty.updatedAt|format_date('short') }}
|
||||
{% else %}
|
||||
{{ 'thirdparty.CreatedAt.short'|trans ~ thirdParty.createdAt|format_date('short') }}
|
||||
{% endif %}
|
||||
{% if thirdParty.updatedBy != null %}
|
||||
{{ 'thirdparty.UpdateBy.short'|trans ~ thirdParty.updatedBy.usernameCanonical }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% include '@ChillThirdParty/ThirdParty/_form.html.twig' %}
|
||||
{% endblock %}
|
||||
{% endembed %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block content_not %}
|
||||
<div class="thirdparty-edit my-5">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-10">
|
||||
|
||||
<h1>
|
||||
{{ 'Update third party %name%'|trans({ '%name%': thirdParty.name }) }}
|
||||
<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>
|
||||
|
||||
<div class="date-by">
|
||||
{% if thirdParty.updatedAt != null %}
|
||||
{{ 'thirdparty.UpdatedAt.short'|trans ~ thirdParty.updatedAt|format_date('short') }}
|
||||
{% else %}
|
||||
{{ 'thirdparty.CreatedAt.short'|trans ~ thirdParty.createdAt|format_date('short') }}
|
||||
{% endif %}
|
||||
{% if thirdParty.updatedBy != null %}
|
||||
{{ 'thirdparty.UpdateBy.short'|trans ~ thirdParty.updatedBy.usernameCanonical }}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{{ form_start(form) }}
|
||||
|
||||
|
110
src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/view.html.twig
vendored
Normal file
110
src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/view.html.twig
vendored
Normal file
@ -0,0 +1,110 @@
|
||||
{% extends "@ChillMain/layout.html.twig" %}
|
||||
|
||||
{% set thirdParty = entity %}
|
||||
{% set title_ = 'Show third party %name%'|trans({'%name%' : thirdParty.name }) %}
|
||||
|
||||
{% block title title_ %}
|
||||
|
||||
{% block content %}
|
||||
<div class="thirdparty-show my-5">
|
||||
<div class="row justify-content-center">
|
||||
{% embed '@ChillMain/CRUD/_view_content.html.twig' %}
|
||||
{% block crud_content_header %}
|
||||
<h1>
|
||||
{{ title_ }}
|
||||
<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>
|
||||
{% endblock %}
|
||||
|
||||
{% block crud_content_view_details %}
|
||||
<dl class="chill_view_data">
|
||||
|
||||
<dt>{{ 'Name'|trans }}</dt>
|
||||
<dd>
|
||||
{% if thirdParty.isLeaf == true %}{{ thirdParty.civility }}{% endif %}
|
||||
{{ thirdParty.name }}
|
||||
</dd>
|
||||
|
||||
{% if thirdParty.isLeaf == false %}
|
||||
<dt>{{ 'thirdparty.NameCompany'|trans }}</dt>
|
||||
<dd>
|
||||
{% if thirdParty.nameCompany == null %}
|
||||
<span class="chill-no-data-statement">{{ 'No nameCompany given'|trans }}</span>
|
||||
{% else %}
|
||||
{{ thirdParty.nameCompany }}
|
||||
{% endif %}
|
||||
</dd>
|
||||
|
||||
<dt>{{ 'thirdparty.Acronym'|trans }}</dt>
|
||||
<dd>
|
||||
{% if thirdParty.acronym == null %}
|
||||
<span class="chill-no-data-statement">{{ 'No acronym given'|trans }}</span>
|
||||
{% else %}
|
||||
{{ thirdParty.acronym }}
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% endif %}
|
||||
|
||||
<dt>{{ 'Type'|trans }}</dt>
|
||||
{% set types = [] %}
|
||||
{% for t in thirdParty.types %}
|
||||
{% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %}
|
||||
{% endfor %}
|
||||
<dd>
|
||||
{{ types|join(', ') }}
|
||||
</dd>
|
||||
|
||||
<dt>{{ 'Phonenumber'|trans }}</dt>
|
||||
<dd>
|
||||
{% if thirdParty.telephone == null %}
|
||||
<span class="chill-no-data-statement">{{ 'No phone given'|trans }}</span>
|
||||
{% else %}
|
||||
<a href="{{ 'tel:' ~ thirdParty.telephone }}">
|
||||
{{ thirdParty.telephone|chill_print_or_message("thirdparty.No_phonenumber") }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</dd>
|
||||
|
||||
<dt>{{ 'email'|trans }}<dt>
|
||||
<dd>
|
||||
{% if thirdParty.email == null %}
|
||||
<span class="chill-no-data-statement">{{ 'No email given'|trans }}</span>
|
||||
{% else %}
|
||||
<a href="{{ 'mailto:' ~ thirdParty.email }}">
|
||||
{{ thirdParty.email|chill_print_or_message("thirdparty.No_email") }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</dd>
|
||||
|
||||
<dt>{{ 'Address'|trans }}</dt>
|
||||
<dd>
|
||||
{% if thirdParty.address == null %}
|
||||
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
|
||||
{% else %}
|
||||
{{ thirdParty.address|chill_entity_render_box({'with_valid_from': false, 'extended_infos': true }) }}
|
||||
{% endif %}
|
||||
</dd>
|
||||
|
||||
<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>
|
||||
|
||||
<dt>{{ 'Centers'|trans }}</dt>
|
||||
<dd>{{ 'The party is visible in those centers'|trans }} : {{ thirdParty.centers|join(', ') }}</dd>
|
||||
|
||||
</dl>
|
||||
{% endblock %}
|
||||
{% block content_form_actions_delete %}{% endblock %}
|
||||
{% block content_view_actions_duplicate_link %}{% endblock %}
|
||||
{% endembed %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
x
Reference in New Issue
Block a user