Merge branch '675-active-scope' into VSR-issues

This commit is contained in:
Mathieu Jaumotte 2022-12-12 20:33:35 +01:00
commit 9f00754eb7
31 changed files with 294 additions and 196 deletions

View File

@ -36,7 +36,7 @@ final class AdminMenuBuilder implements LocalMenuBuilderInterface
->setAttribute('class', 'list-group-item-header')
->setExtras([
'order' => 5000,
'icons' => ['exchange'],
//'icons' => ['exchange'],
]);
$menu->addChild('Activity Reasons', [

View File

@ -1,4 +1,4 @@
<div class="{% block crud_content_main_div_class %}col-10 centered{% endblock %}">
{% block crud_content_header %}
<h1>{{ ('crud.'~crud_name~'.title_delete')|trans({ '%as_string%': 'Aside Activity' }) }}</h1>
{% endblock crud_content_header %}
@ -27,4 +27,4 @@
</ul>
{{ form_end(form) }}
</div>

View File

@ -39,7 +39,7 @@ class AdminMenuBuilder implements LocalMenuBuilderInterface
->setAttribute('class', 'list-group-item-header')
->setExtras([
'order' => 6000,
'icons' => ['calendar'],
//'icons' => ['calendar'],
]);
$menu->addChild('Cancel reason', [

View File

@ -39,7 +39,7 @@ class AdminMenuBuilder implements LocalMenuBuilderInterface
->setAttribute('class', 'list-group-item-header')
->setExtras([
'order' => 4500,
'icons' => ['plus'],
//'icons' => ['plus'],
]);
$menu->addChild('Custom fields group', [

View File

@ -39,7 +39,7 @@ class AdminMenuBuilder implements LocalMenuBuilderInterface
->setAttribute('class', 'list-group-item-header')
->setExtras([
'order' => 4000,
'icons' => ['file-pdf-o'],
//'icons' => ['file-pdf-o'],
]);
$menu->addChild('Document category list', [

View File

@ -0,0 +1,16 @@
<?php
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
use Symfony\Component\HttpFoundation\Request;
class ScopeApiController extends ApiController
{
protected function customizeQuery(string $action, Request $request, $query): void
{
if ('_index' === $action) {
$query->andWhere($query->expr()->eq('e.active', "'TRUE'"));
}
}
}

View File

@ -625,6 +625,7 @@ class ChillMainExtension extends Extension implements
],
[
'class' => \Chill\MainBundle\Entity\Scope::class,
'controller' => \Chill\MainBundle\Controller\ScopeApiController::class,
'name' => 'scope',
'base_path' => '/api/1.0/main/scope',
'base_role' => 'ROLE_USER',

View File

@ -13,6 +13,7 @@ namespace Chill\MainBundle\Form;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@ -21,7 +22,13 @@ class ScopeType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', TranslatableStringFormType::class);
->add('name', TranslatableStringFormType::class)
->add('active', ChoiceType::class, [
'choices' => [
'Active' => true,
'Inactive' => false,
]])
;
}
/**

View File

@ -220,12 +220,8 @@ footer.footer {
*/
div.admin {
flex-direction: row-reverse;
div.vertical-menu {
font-size: 0.9em;
.list-group-item {
padding: 0.3rem 0.7rem;
}
.list-group-item {}
}
}
@ -367,6 +363,19 @@ div#flashMessages {
}
}
/// unbullet lists
ul.unbullet {
list-style-type: none;
padding-left: 0;
}
/// libellé
span.dt {
font-size: 90%;
font-weight: bolder;
background-color: var(--bs-chill-light-gray);
}
/*
* SPECIFIC RULES
*/

View File

@ -28,10 +28,15 @@
</div>
{% endif %}
{% block admin_content %}
<!-- block admin content empty -->
{% endblock %}
<div class="row justify-content-center">
<div class="col-md-10 col-xxl">
{% block admin_content %}
<!-- block admin content empty -->
{% endblock %}
</div>
</div>
</div>
<div class="col-md-3">
{% block vertical_menu_content %}

View File

@ -1,4 +1,4 @@
<div class="{% block crud_content_main_div_class %}col-10 centered{% endblock %}">
{% block crud_content_header %}
<h1>{{ ('crud.'~crud_name~'.title_delete')|trans({ '%as_string%': entity|chill_entity_render_string }) }}</h1>
{% endblock crud_content_header %}
@ -34,4 +34,4 @@
</ul>
{{ form_end(form) }}
</div>

View File

@ -1,5 +1,5 @@
{% set formId = crudMainFormId|default('crud_main_form') %}
<div class="{% block crud_content_main_div_class %}col-10 centered{% endblock %}">
{% set formId = crudMainFormId|default('crud_main_form') %}
{% block crud_content_header %}
<h1>{{ ('crud.'~crud_name~'.title_edit')|trans }}</h1>
{% endblock crud_content_header %}
@ -64,4 +64,4 @@
{% endblock %}
{% endblock %}
</div>

View File

@ -1,5 +1,3 @@
<div class="col-10 centered">
{% block index_header %}
<h1>{{ ('crud.' ~ crud_name ~ '.index.title')|trans({'%crud_name%': crud_name}) }}</h1>
{% endblock index_header %}
@ -16,7 +14,7 @@
{% endblock %}
{% else %}
{% block table_entities %}
<table>
<table class="table table-bordered border-dark">
<thead>
<tr>
{% block table_entities_thead_tr %}
@ -54,4 +52,3 @@
{% endblock %}
</ul>
{% endblock list_actions %}
</div>

View File

@ -1,5 +1,5 @@
{% set formId = crudMainFormId|default('crud_main_form') %}
<div class="{% block crud_content_main_div_class %}col-10 centered{% endblock %}">
{% set formId = crudMainFormId|default('crud_main_form') %}
{% block crud_content_header %}
<h1>{{ ('crud.' ~ crud_name ~ '.title_new')|trans({'%crud_name%' : crud_name }) }}</h1>
{% endblock crud_content_header %}
@ -52,4 +52,4 @@
{{ form_end(form) }}
{% endblock %}
</div>

View File

@ -1,4 +1,4 @@
<div class="{% block crud_content_main_div_class %}col-10 centered{% endblock %}">
{% block crud_content_header %}
<h1>{{ 'crud.%crud_name%.title_view'|trans({'%crud_name%' : crud_name }) }}</h1>
{% endblock crud_content_header %}
@ -60,4 +60,4 @@
{% endblock crud_content_view_actions %}
{% endblock crud_content_view %}
</div>

View File

@ -7,8 +7,6 @@
{{ form_start(edit_form) }}
{{ form_row(edit_form.name) }}
{{ form_row(edit_form.submit, { 'attr' : { 'class' : 'btn btn-chill-green' } } ) }}
{{ form_end(edit_form) }}
<ul class="record_actions sticky-form-buttons">
<li class='cancel'>
@ -16,5 +14,10 @@
{{ 'Back to the list'|trans }}
</a>
</li>
<li>
{{ form_widget(edit_form.submit, { 'attr' : { 'class' : 'btn btn-update' }}) }}
</li>
</ul>
{{ form_end(edit_form) }}
{% endblock %}

View File

@ -1,39 +1,50 @@
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}{{ 'Center list'|trans }}{% endblock %}
{% block admin_content -%}
<h1>{{ 'Center list'|trans }}</h1>
<table class="records_list">
<thead>
<tr>
<th>{{ 'Name'|trans }}</th>
<th>{{ 'Actions'|trans }}</th>
</tr>
</thead>
<tbody>
{% for entity in entities %}
<tr>
<td>{{ entity.name }}</td>
<td>
<ul class="record_actions">
<li>
<a href="{{ path('admin_center_edit', { 'id': entity.id }) }}" class="btn btn-edit">{{ 'edit'|trans }}</a>
</li>
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<ul class="record_actions sticky-form-buttons">
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
<li>
<a href="{{ path('admin_center_new') }}" class="btn btn-create">{{ 'Create a new center'|trans }}</a>
</li>
</ul>
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block index_header %}
<h1>{{ 'Center list'|trans }}</h1>
{% endblock %}
{% block filter_order %}{% endblock %}
{% block table_entities_thead_tr %}
<th>id</th>
<th>{{ 'Name'|trans }}</th>
<th>{{ 'Actions'|trans }}</th>
{% endblock %}
{% block table_entities_tbody %}
{% for entity in entities %}
<tr>
<td>{{ entity.id }}</td>
<td>{{ entity.name }}</td>
<td>
<ul class="record_actions">
<li>
<a href="{{ path('admin_center_edit', { 'id': entity.id }) }}" class="btn btn-edit">{{ 'edit'|trans }}</a>
</li>
</ul>
</td>
</tr>
{% endfor %}
{% endblock %}
{% block pagination %}{% endblock %}
{% block list_actions %}
<ul class="record_actions sticky-form-buttons">
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
<li>
<a href="{{ path('admin_center_new') }}" class="btn btn-create">{{ 'Create a new center'|trans }}</a>
</li>
</ul>
{% endblock list_actions %}
{% endembed %}
{% endblock %}

View File

@ -7,8 +7,6 @@
{{ form_start(form) }}
{{ form_row(form.name) }}
{{ form_row(form.submit, { 'attr' : { 'class' : 'btn btn-chill-green' } } ) }}
{{ form_end(form) }}
<ul class="record_actions sticky-form-buttons">
<li class='cancel'>
@ -16,5 +14,10 @@
{{ 'Back to the list'|trans }}
</a>
</li>
<li>
{{ form_widget(form.submit, { 'attr' : { 'class' : 'btn btn-save' }}) }}
</li>
</ul>
{{ form_end(form) }}
{% endblock %}

View File

@ -7,8 +7,7 @@
{{ form_start(edit_form) }}
{{ form_row(edit_form.name) }}
{{ form_row(edit_form.submit, { 'attr' : { 'class' : 'btn btn-chill-green' } } ) }}
{{ form_end(edit_form) }}
{{ form_row(edit_form.active) }}
<ul class="record_actions sticky-form-buttons">
<li class='cancel'>
@ -16,5 +15,11 @@
{{ 'Back to the list'|trans }}
</a>
</li>
<li>
{{ form_widget(edit_form.submit, { 'attr' : { 'class' : 'btn btn-update' }}) }}
</li>
</ul>
{{ form_end(edit_form) }}
{% endblock %}

View File

@ -1,39 +1,58 @@
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}{{ 'List circles'|trans }}{% endblock %}
{% block admin_content -%}
<h1>{{ 'List circles'|trans }}</h1>
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block index_header %}
<h1>{{ 'List circles'|trans }}</h1>
{% endblock %}
{% block filter_order %}{% endblock %}
{% block table_entities_thead_tr %}
<th>id</th>
<th>{{ 'Name'|trans }}</th>
<th>{{ 'Active'|trans }}</th>
<th>{{ 'Actions'|trans }}</th>
{% endblock %}
{% block table_entities_tbody %}
{% for entity in entities %}
<tr>
<td>{{ entity.id }}</td>
<td>{{ entity.name|localize_translatable_string }}</td>
<td style="text-align:center;">
{%- if entity.active -%}
<i class="fa fa-check-square-o"></i>
{%- else -%}
<i class="fa fa-square-o"></i>
{%- endif -%}
</td>
<td>
<ul class="record_actions">
<li>
<a href="{{ path('admin_scope_edit', { 'id': entity.id }) }}" class="btn btn-edit">{{ 'edit'|trans }}</a>
</li>
</ul>
</td>
</tr>
{% endfor %}
{% endblock %}
{% block pagination %}{% endblock %}
{% block list_actions %}
<ul class="record_actions sticky-form-buttons">
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
<li>
<a href="{{ path('admin_scope_new') }}" class="btn btn-create">{{ 'Create a new circle'|trans }}</a>
</li>
</ul>
{% endblock list_actions %}
<table class="records_list">
<thead>
<tr>
<th>{{ 'Name'|trans }}</th>
<th>{{ 'Actions'|trans }}</th>
</tr>
</thead>
<tbody>
{% for entity in entities %}
<tr>
<td>{{ entity.name|localize_translatable_string }}</td>
<td>
<ul class="record_actions">
<li>
<a href="{{ path('admin_scope_edit', { 'id': entity.id }) }}" class="btn btn-edit">{{ 'edit'|trans }}</a>
</li>
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<ul class="record_actions sticky-form-buttons">
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
<li>
<a href="{{ path('admin_scope_new') }}" class="btn btn-create">{{ 'Create a new circle'|trans }}</a>
</li>
</ul>
{% endembed %}
{% endblock %}

View File

@ -7,8 +7,7 @@
{{ form_start(form) }}
{{ form_row(form.name) }}
{{ form_row(form.submit, { 'attr' : { 'class' : 'btn btn-chill-green' } } ) }}
{{ form_end(form) }}
{{ form_row(form.active) }}
<ul class="record_actions sticky-form-buttons">
<li class='cancel'>
@ -16,5 +15,9 @@
{{ 'Back to the list'|trans }}
</a>
</li>
<li>
{{ form_widget(form.submit, { 'attr' : { 'class' : 'btn btn-save' }}) }}
</li>
</ul>
{{ form_end(form) }}
{% endblock %}

View File

@ -1,83 +1,99 @@
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block admin_content %}
<h1>{{"Users"|trans}}</h1>
{{ filter_order|chill_render_filter_order_helper }}
{% for entity in entities %}
<div class="flex-table">
<div class="item-bloc">
<div class="item-row">
<div class="item-col">
{% if entity.civility is not null %}
{% if entity.civility.name|length > 0 %}
{{ entity.civility.name|first }}
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block index_header %}
<h1>{{"Users"|trans}}</h1>
{% endblock %}
{% block filter_order %}{{ filter_order|chill_render_filter_order_helper }}{% endblock %}
{% block table_entities_thead_tr %}
<th>{{ 'Active'|trans }}</th>
<th>{{ 'Username'|trans }}</th>
<th>{{ 'Datas'|trans }}</th>
<th>{{ 'Actions'|trans }}</th>
{% endblock %}
{% block table_entities_tbody %}
{% for entity in entities %}
<tr>
<td>
{% if entity.isEnabled %}
<i class="fa fa-check-square-o"></i>
{% else %}
<i class="fa fa-square-o"></i>
{% endif %}
{% endif %}
{{ entity.label }}
{% if entity.isEnabled %}
<i class="fa fa-check chill-green"></i>
{% else %}
<i class="fa fa-times chill-red"></i>
{% endif %}
</div>
<div class="item-col"><i>{{ entity.email }}</i></div>
</div>
<div class="item-row">
<div class="item-col">
login: {{ entity.username|e('html_attr') }}
</div>
<div class="item-col">
{% if entity.userJob %}
{{ entity.userJob.label|localize_translatable_string }}
{% endif %}
</div>
</div>
<div class="item-row">
<div class="item-col">
{% if entity.mainScope %}
{{ entity.mainScope.name|localize_translatable_string }}
{% endif %}
{% if entity.mainCenter %}
, {{ entity.mainCenter.name }}
{% endif %}
</div>
</div>
<div class="item-row">
<ul class="record_actions">
<li>
<a class="btn btn-edit" href="{{ path('chill_crud_admin_user_edit', { 'id': entity.id }) }}"></a>
</li>
{% if allow_change_password is same as(true) %}
<li>
<a class="btn btn-chill-red" href="{{ path('admin_user_edit_password', { 'id' : entity.id }) }}" title="{{ 'Edit password'|trans|e('html_attr') }}"><i class="fa fa-ellipsis-h"></i></a>
</li>
{% endif %}
{% if is_granted('ROLE_ALLOWED_TO_SWITCH') %}
<li>
<a class="btn btn-chill-blue" href="{{ path('chill_main_homepage', {'_switch_user': entity.username }) }}" title="{{ "Impersonate"|trans|e('html_attr') }}"><i class="fa fa-user-secret"></i></a>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
{% endfor %}
{{ chill_pagination(paginator) }}
<ul class="record_actions sticky-form-buttons">
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
<li>
<a href="{{ path('chill_crud_admin_user_new') }}" class="btn btn-create">{{ 'Create'|trans }}</a>
</li>
</ul>
</td>
<td>
{#
{% if entity.civility is not null %}
{% if entity.civility.name|length > 0 %}
{{ entity.civility.name|first }}
{% endif %}
{% endif %}
#}
{{ entity.label }}
</td>
<td>
<ul class="unbullet">
<li>
<span class="dt">login:</span>
{{ entity.username|e('html_attr') }}
</li>
<li>
<span class="dt">email:</span>
{{ entity.email }}
</li>
<li>
<span class="dt">métier:</span>
{% if entity.userJob %}{{ entity.userJob.label|localize_translatable_string }}{% endif %}
</li>
<li>
<span class="dt">cercle/centre:</span>
{% if entity.mainScope %}
{{ entity.mainScope.name|localize_translatable_string }}
{% endif %}
{% if entity.mainCenter %}, {{ entity.mainCenter.name }}{% endif %}
</li>
</ul>
</td>
<td>
<ul class="record_actions">
<li>
<a class="btn btn-edit" title="{{ 'Edit'|trans }}" href="{{ path('chill_crud_admin_user_edit', { 'id': entity.id }) }}"></a>
</li>
{% if allow_change_password is same as(true) %}
<li>
<a class="btn btn-chill-red" href="{{ path('admin_user_edit_password', { 'id' : entity.id }) }}" title="{{ 'Edit password'|trans|e('html_attr') }}"><i class="fa fa-ellipsis-h"></i></a>
</li>
{% endif %}
{% if is_granted('ROLE_ALLOWED_TO_SWITCH') %}
<li>
<a class="btn btn-chill-blue" href="{{ path('chill_main_homepage', {'_switch_user': entity.username }) }}" title="{{ "Impersonate"|trans|e('html_attr') }}"><i class="fa fa-user-secret"></i></a>
</li>
{% endif %}
</ul>
</td>
</tr>
{% endfor %}
{% endblock %}
{% block pagination %}{{ chill_pagination(paginator) }}{% endblock %}
{% block list_actions %}
<ul class="record_actions sticky-form-buttons">
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
<li>
<a href="{{ path('chill_crud_admin_user_new') }}" class="btn btn-create">{{ 'Create'|trans }}</a>
</li>
</ul>
{% endblock list_actions %}
{% endembed %}
{% endblock %}

View File

@ -2,12 +2,14 @@
{% block admin_content %}
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block table_entities_thead_tr %}
<th>id</th>
<th>{{ 'label'|trans }}</th>
<th>{{ 'active'|trans }}</th>
<th>&nbsp;</th>
<th>{{ 'Label'|trans }}</th>
<th>{{ 'Active'|trans }}</th>
<th>{{ 'Actions'|trans }}</th>
{% endblock %}
{% block table_entities_tbody %}
{% for entity in entities %}
<tr>
@ -30,11 +32,12 @@
</tr>
{% endfor %}
{% endblock %}
{% block actions_before %}
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
{% endblock %}
{% endembed %}
{% endblock %}

View File

@ -40,7 +40,7 @@ class AdminLanguageMenuBuilder implements LocalMenuBuilderInterface
->setAttribute('class', 'list-group-item-header')
->setExtras([
'order' => 1200,
'icons' => ['globe-w'],
//'icons' => ['globe-w'],
]);
$menu->addChild('Language list', [
'route' => 'chill_crud_main_language_index',

View File

@ -40,7 +40,7 @@ class AdminLocationMenuBuilder implements LocalMenuBuilderInterface
->setAttribute('class', 'list-group-item-header')
->setExtras([
'order' => 1300,
'icons' => ['map-marker'],
//'icons' => ['map-marker'],
]);
$menu->addChild('Location type list', [

View File

@ -46,7 +46,7 @@ class AdminUserMenuBuilder implements LocalMenuBuilderInterface
->setAttribute('class', 'list-group-item-header')
->setExtras([
'order' => 1000,
'icons' => ['key'],
//'icons' => ['key'],
]);
$menu->addChild('Center list', [

View File

@ -39,7 +39,7 @@ class AdminAccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
->setAttribute('class', 'list-group-item-header')
->setExtras([
'order' => 2200,
'icons' => ['random'],
//'icons' => ['random'],
]);
$menu->addChild('person_admin.closing motives', [

View File

@ -39,7 +39,7 @@ class AdminHouseholdMenuBuilder implements LocalMenuBuilderInterface
->setAttribute('class', 'list-group-item-header')
->setExtras([
'order' => 2100,
'icons' => ['home'],
//'icons' => ['home'],
]);
$menu->addChild('Position', [

View File

@ -39,7 +39,7 @@ class AdminPersonMenuBuilder implements LocalMenuBuilderInterface
->setAttribute('class', 'list-group-item-header')
->setExtras([
'order' => 2000,
'icons' => ['child'],
//'icons' => ['child'],
]);
$menu->addChild('Civility', [

View File

@ -39,7 +39,7 @@ class AdminSocialWorkMenuBuilder implements LocalMenuBuilderInterface
->setAttribute('class', 'list-group-item-header')
->setExtras([
'order' => 2300,
'icons' => ['handshake-o'],
//'icons' => ['handshake-o'],
]);
$menu->addChild('person_admin.social_action', [

View File

@ -39,7 +39,7 @@ class AdminMenuBuilder implements LocalMenuBuilderInterface
->setAttribute('class', 'list-group-item-header')
->setExtras([
'order' => 3000,
'icons' => ['male'],
//'icons' => ['male'],
]);
$menu->addChild('Third party category', [