Merge branch 'issue596_admin_user' into 'master'

Admin interface

See merge request Chill-Projet/chill-bundles!429
This commit is contained in:
Julien Fastré 2022-05-13 14:13:09 +00:00
commit 6edc9b25db
238 changed files with 3566 additions and 1572 deletions

View File

@ -11,6 +11,10 @@ and this project adheres to
## Unreleased ## Unreleased
<!-- write down unreleased development here --> <!-- write down unreleased development here -->
* [admin] refactorisation of the admin section: reorganisation of the menu, translations, form types, new entities (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/592)
* [admin] add admin section for languages and countries (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/596)
* [activity] activity admin: translations + remove label field for comment on admin activity type (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/587)
* [main] admin user_job: improvements (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/588)
* [address] can add extra address info even if noAddress (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/576) * [address] can add extra address info even if noAddress (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/576)

View File

@ -2,7 +2,14 @@
en cours de rédaction en cours de rédaction
## Translations
Par bundle, toutes les traductions des pages twig se trouvent dans un seul fichier `translations/messages.fr.yaml`.
## Emplacement des fichiers
Les controllers, form type & templates twig sont placés à la racine des dossiers `Controller`, `Form` & `Ressources/views`, respectivement. Pour les pages Admin, on ne les mets plus dans des sous-dossiers Admin.
## Assets: nommage des entrypoints ## Assets: nommage des entrypoints
Trois types d'entrypoint: Trois types d'entrypoint:
@ -146,19 +153,20 @@ Ces règles n'ont pas toujours été utilisées par le passé. Elles sont souhai
Les routes sont nommées de cette manière: Les routes sont nommées de cette manière:
`chill_bundle_entite_action` `chill_(api|crud)_bundle_(api)_entite_action`
1. d'abord chill_ (pour tous les modules chill) 1. d'abord chill_ (pour tous les modules chill)
2. ensuite une string qui est identique, par bundle 2. ensuite `crud` ou `api`, optionnel, automatiquement ajouté si la route est générée par la configuration
3. si le point est un point d'api (json), alors ajouter la string `api` 3. ensuite une string qui indique le bundle (`main`, `person`, `activity`, ...)
4. ensuite une string qui indique sur quelle entité porte la route, voire également les sous-entités 4. ensuite, `api`, si la route est une route d'api.
5. ensuite une action (`list`, `view`, `edit`, `new`, ...) 5. ensuite une string qui indique sur quelle entité porte la route, voire également les sous-entités
6. ensuite une action (`list`, `view`, `edit`, `new`, ...)
Le fait d'indiquer `api` en 3 permet de distinguer les routes d'api qui sont générées par la configuration (qui sont toutes préfixées par `chill_api`, de celles générées manuellement. (Exemple: `chill_api_household__index`, et `chill_person_api_household_members_move`) Le fait d'indiquer `api` en quatrième position permet de distinguer les routes d'api qui sont générées par la configuration (qui sont toutes préfixées par `chill_api`, de celles générées manuellement. (Exemple: `chill_api_household__index`, et `chill_person_api_household_members_move`)
Si les points 4 et 5 sont inexistants, alors ils sont remplacés par d'autres éléments de manière à garantir l'unicité de la route, et sa bonne compréhension. Si les points 4 et 5 sont inexistants, alors ils sont remplacés par d'autres éléments de manière à garantir l'unicité de la route, et sa bonne compréhension.
### URL ### Nommage des URL
Les URL respectent également une convention: Les URL respectent également une convention:
@ -219,6 +227,14 @@ Les éléments suivants devraient se trouver dans la liste:
Ces éléments peuvent être entrecoupés de l'identifiant d'une entité. Dans ce cas, cet identifiant se place juste après l'entité auquel il se rapporte. Ces éléments peuvent être entrecoupés de l'identifiant d'une entité. Dans ce cas, cet identifiant se place juste après l'entité auquel il se rapporte.
#### Pour les URL de l'espace Admin
Même conventions que dans les autres pages html de l'application, **mais `admin` est ajouté en deuxième position**. Soit:
`/{_locale}/admin/bundle/entity/{id}/action`
## Règles UI chill ## Règles UI chill
### Titre des pages ### Titre des pages

View File

@ -57,7 +57,7 @@ class ActivityTypeType extends AbstractType
$fields = [ $fields = [
'persons', 'user', 'date', 'location', 'persons', 'persons', 'user', 'date', 'location', 'persons',
'thirdParties', 'durationTime', 'travelTime', 'attendee', 'thirdParties', 'durationTime', 'travelTime', 'attendee',
'reasons', 'comment', 'sentReceived', 'documents', 'reasons', 'sentReceived', 'documents',
'emergency', 'socialIssues', 'socialActions', 'users', 'emergency', 'socialIssues', 'socialActions', 'users',
]; ];
@ -69,6 +69,9 @@ class ActivityTypeType extends AbstractType
'empty_data' => '', 'empty_data' => '',
]); ]);
} }
$builder
->add('commentVisible', ActivityFieldPresence::class);
} }
public function configureOptions(OptionsResolver $resolver) public function configureOptions(OptionsResolver $resolver)

View File

@ -15,8 +15,6 @@ use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Knp\Menu\MenuItem; use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
use function in_array;
final class AdminMenuBuilder implements LocalMenuBuilderInterface final class AdminMenuBuilder implements LocalMenuBuilderInterface
{ {
private Security $security; private Security $security;
@ -32,27 +30,38 @@ final class AdminMenuBuilder implements LocalMenuBuilderInterface
return; return;
} }
if (in_array($menuId, ['admin_index', 'admin_section'], true)) {
$menu->addChild('Activities', [ $menu->addChild('Activities', [
'route' => 'chill_admin_activity_index', 'route' => 'chill_activity_admin_index',
]) ])
->setAttribute('class', 'list-group-item-header')
->setExtras([ ->setExtras([
'order' => 2000, 'order' => 5000,
'explain' => 'Activity configuration', 'icons' => ['exchange'],
]); ]);
} else {
$menu $menu->addChild('Activity Reasons', [
->addChild('Activities', [ 'route' => 'chill_activity_activityreason',
'route' => 'chill_admin_activity_index', ])->setExtras(['order' => 5010]);
])
->setExtras([ $menu->addChild('Activity Reasons Category', [
'order' => '60', 'route' => 'chill_activity_activityreasoncategory',
]); ])->setExtras(['order' => 5020]);
}
$menu->addChild('Activity type', [
'route' => 'chill_activity_type_admin',
])->setExtras(['order' => 5030]);
$menu->addChild('Activity Presences', [
'route' => 'chill_crud_activity_presence_index',
])->setExtras(['order' => 5040]);
$menu->addChild('Activity Types Categories', [
'route' => 'chill_activity_type_category_admin',
])->setExtras(['order' => 5050]);
} }
public static function getMenuIds(): array public static function getMenuIds(): array
{ {
return ['admin_index', 'admin_section', 'admin_activity']; return ['admin_section', 'admin_activity'];
} }
} }

View File

@ -1,10 +1,10 @@
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %} {% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %} {% block title %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %} {% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% endblock %} {% endblock %}
{% block layout_wvm_content %} {% block admin_content %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %} {% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block content_form_actions_view %}{% endblock %} {% block content_form_actions_view %}{% endblock %}
{% block content_form_actions_save_and_show %}{% endblock %} {% block content_form_actions_save_and_show %}{% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %} {% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block admin_content %} {% block admin_content %}
<h1>{{ 'ActivityPresence list'|trans }}</h1> <h1>{{ 'ActivityPresence list'|trans }}</h1>
@ -34,7 +34,7 @@
</tbody> </tbody>
</table> </table>
<ul class="record_actions"> <ul class="record_actions sticky-form-buttons">
<li> <li>
<a href="{{ path('chill_crud_activity_presence_new') }}" class="btn btn-create"> <a href="{{ path('chill_crud_activity_presence_new') }}" class="btn btn-create">
{{ 'Create a new activity presence'|trans }} {{ 'Create a new activity presence'|trans }}

View File

@ -1,10 +1,10 @@
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %} {% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %} {% block title %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %} {% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% endblock %} {% endblock %}
{% block layout_wvm_content %} {% block admin_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %} {% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %} {% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %} {% endembed %}

View File

@ -1,20 +1,4 @@
{# {% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
{% block admin_content %} {% block admin_content %}
<h1>{{ 'ActivityReason edit'|trans }}</h1> <h1>{{ 'ActivityReason edit'|trans }}</h1>
@ -24,7 +8,7 @@
{{ form_row(edit_form.active) }} {{ form_row(edit_form.active) }}
{{ form_row(edit_form.category) }} {{ form_row(edit_form.category) }}
<ul class="record_actions"> <ul class="record_actions sticky-form-buttons">
<li class="cancel"> <li class="cancel">
<a href="{{ path('chill_activity_activityreason') }}" class="btn btn-cancel">{{ 'Back to the list'|trans }}</a> <a href="{{ path('chill_activity_activityreason') }}" class="btn btn-cancel">{{ 'Back to the list'|trans }}</a>
</li> </li>

View File

@ -1,20 +1,4 @@
{# {% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
{% block admin_content %} {% block admin_content %}
<h1>{{ 'ActivityReason list'|trans }}</h1> <h1>{{ 'ActivityReason list'|trans }}</h1>
@ -45,7 +29,11 @@
</tbody> </tbody>
</table> </table>
<ul class="record_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> <li>
<a href="{{ path('chill_activity_activityreason_new') }}" class="btn btn-new"> <a href="{{ path('chill_activity_activityreason_new') }}" class="btn btn-new">
{{ 'Create a new activity reason'|trans }} {{ 'Create a new activity reason'|trans }}

View File

@ -1,20 +1,4 @@
{# {% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
{% block admin_content %} {% block admin_content %}
<h1>{{ 'ActivityReason creation'|trans }}</h1> <h1>{{ 'ActivityReason creation'|trans }}</h1>
@ -24,7 +8,7 @@
{{ form_row(form.active) }} {{ form_row(form.active) }}
{{ form_row(form.category) }} {{ form_row(form.category) }}
<ul class="record_actions"> <ul class="record_actions sticky-form-buttons">
<li class="cancel"> <li class="cancel">
<a href="{{ path('chill_activity_activityreason') }}" class="btn btn-cancel">{{ 'Back to the list'|trans }}</a> <a href="{{ path('chill_activity_activityreason') }}" class="btn btn-cancel">{{ 'Back to the list'|trans }}</a>
</li> </li>

View File

@ -1,20 +1,4 @@
{# {% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
{% block admin_content %} {% block admin_content %}
<h1>{{ 'ActivityReason'|trans }}</h1> <h1>{{ 'ActivityReason'|trans }}</h1>
@ -38,7 +22,7 @@
</tbody> </tbody>
</table> </table>
<ul class="record_actions"> <ul class="record_actions sticky-form-buttons">
<li class="cancel"> <li class="cancel">
<a href="{{ path('chill_activity_activityreason') }}" class="btn btn-cancel"> <a href="{{ path('chill_activity_activityreason') }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }} {{ 'Back to the list'|trans }}

View File

@ -1,20 +1,4 @@
{# {% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
{% block admin_content %} {% block admin_content %}
<h1>{{ 'ActivityReasonCategory edit'|trans }}</h1> <h1>{{ 'ActivityReasonCategory edit'|trans }}</h1>
@ -23,7 +7,7 @@
{{ form_row(edit_form.name) }} {{ form_row(edit_form.name) }}
{{ form_row(edit_form.active) }} {{ form_row(edit_form.active) }}
<ul class="record_actions"> <ul class="record_actions sticky-form-buttons">
<li class="cancel"> <li class="cancel">
<a href="{{ path('chill_activity_activityreasoncategory') }}" class="btn btn-cancel"> <a href="{{ path('chill_activity_activityreasoncategory') }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }} {{ 'Back to the list'|trans }}

View File

@ -1,20 +1,4 @@
{# {% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
{% block admin_content %} {% block admin_content %}
<h1>{{ 'ActivityReasonCategory list'|trans }}</h1> <h1>{{ 'ActivityReasonCategory list'|trans }}</h1>
@ -46,7 +30,7 @@
</tbody> </tbody>
</table> </table>
<ul class="record_actions"> <ul class="record_actions sticky-form-buttons">
<li> <li>
<a href="{{ path('chill_activity_activityreasoncategory_new') }}" class="btn btn-new"> <a href="{{ path('chill_activity_activityreasoncategory_new') }}" class="btn btn-new">
{{ 'Create a new activity category reason'|trans }} {{ 'Create a new activity category reason'|trans }}

View File

@ -1,20 +1,4 @@
{# {% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
{% block admin_content %} {% block admin_content %}
<h1>{{ 'ActivityReasonCategory creation'|trans }}</h1> <h1>{{ 'ActivityReasonCategory creation'|trans }}</h1>
@ -23,7 +7,7 @@
{{ form_row(form.name) }} {{ form_row(form.name) }}
{{ form_row(form.active) }} {{ form_row(form.active) }}
<ul class="record_actions"> <ul class="record_actions sticky-form-buttons">
<li class="cancel"> <li class="cancel">
<a href="{{ path('chill_activity_activityreasoncategory') }}" class="btn btn-cancel">{{ 'Back to the list'|trans }}</a> <a href="{{ path('chill_activity_activityreasoncategory') }}" class="btn btn-cancel">{{ 'Back to the list'|trans }}</a>
</li> </li>

View File

@ -1,20 +1,4 @@
{# {% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
{% block admin_content %} {% block admin_content %}
<h1>{{ 'ActivityReasonCategory'|trans }}</h1> <h1>{{ 'ActivityReasonCategory'|trans }}</h1>
@ -37,7 +21,7 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<ul class="record_actions"> <ul class="record_actions sticky-form-buttons">
<li class="cancel"> <li class="cancel">
<a href="{{ path('chill_activity_activityreasoncategory') }}" class="btn btn-cancel"> <a href="{{ path('chill_activity_activityreasoncategory') }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }} {{ 'Back to the list'|trans }}

View File

@ -1,10 +1,10 @@
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %} {% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %} {% block title %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %} {% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% endblock %} {% endblock %}
{% block layout_wvm_content %} {% block admin_content %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %} {% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block content_form_actions_view %}{% endblock %} {% block content_form_actions_view %}{% endblock %}
{% block content_form_actions_save_and_show %}{% endblock %} {% block content_form_actions_save_and_show %}{% endblock %}

View File

@ -1,20 +1,4 @@
{# {% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
{% block admin_content %} {% block admin_content %}
<h1>{{ 'ActivityType list'|trans }}</h1> <h1>{{ 'ActivityType list'|trans }}</h1>
@ -50,7 +34,7 @@
</tbody> </tbody>
</table> </table>
<ul class="record_actions"> <ul class="record_actions sticky-form-buttons">
<li> <li>
<a href="{{ path('chill_crud_activity_type_new') }}" class="btn btn-create"> <a href="{{ path('chill_crud_activity_type_new') }}" class="btn btn-create">
{{ 'Create a new activity type'|trans }} {{ 'Create a new activity type'|trans }}

View File

@ -1,10 +1,10 @@
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %} {% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %} {% block title %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %} {% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% endblock %} {% endblock %}
{% block layout_wvm_content %} {% block admin_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %} {% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %} {% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %} {% endembed %}

View File

@ -1,10 +1,10 @@
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %} {% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %} {% block title %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %} {% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% endblock %} {% endblock %}
{% block layout_wvm_content %} {% block admin_content %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %} {% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block content_form_actions_view %}{% endblock %} {% block content_form_actions_view %}{% endblock %}
{% block content_form_actions_save_and_show %}{% endblock %} {% block content_form_actions_save_and_show %}{% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %} {% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block admin_content %} {% block admin_content %}
<h1>{{ 'ActivityTypeCategory list'|trans }}</h1> <h1>{{ 'ActivityTypeCategory list'|trans }}</h1>
@ -34,7 +34,7 @@
</tbody> </tbody>
</table> </table>
<ul class="record_actions"> <ul class="record_actions sticky-form-buttons">
<li> <li>
<a href="{{ path('chill_crud_activity_type_category_new') }}" class="btn btn-create"> <a href="{{ path('chill_crud_activity_type_category_new') }}" class="btn btn-create">
{{ 'Create a new activity type category'|trans }} {{ 'Create a new activity type category'|trans }}

View File

@ -1,10 +1,10 @@
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %} {% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %} {% block title %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %} {% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% endblock %} {% endblock %}
{% block layout_wvm_content %} {% block admin_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %} {% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %} {% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %} {% endembed %}

View File

@ -20,7 +20,7 @@
{% block vertical_menu_content %} {% block vertical_menu_content %}
{{ chill_menu('admin_activity', { {{ chill_menu('admin_activity', {
'layout': '@ChillActivity/Admin/menu_activity.html.twig', 'layout': '@ChillMain/Admin/menu_admin_section.html.twig',
}) }} }) }}
{% endblock %} {% endblock %}

View File

@ -1,20 +0,0 @@
{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillMain/Menu/verticalMenu.html.twig" %}
{% block v_menu_title %}{{ 'Activity configuration menu'|trans }}{% endblock %}

View File

@ -10,48 +10,22 @@ chill_activity_activityreasoncategory:
resource: "@ChillActivityBundle/config/routes/activityreasoncategory.yaml" resource: "@ChillActivityBundle/config/routes/activityreasoncategory.yaml"
prefix: / prefix: /
chill_admin_activity_index: chill_activity_admin_index:
path: /{_locale}/admin/activity path: /{_locale}/admin/activity
controller: Chill\ActivityBundle\Controller\AdminController::indexActivityAction controller: Chill\ActivityBundle\Controller\AdminController::indexActivityAction
options:
menus:
admin_section:
label: Activities
order: 2000
icons: [tag]
chill_admin_activity_redirect_to_admin_index: chill_admin_activity_redirect_to_admin_index:
path: /{_locale}/admin/activity_redirect_to_main path: /{_locale}/admin/activity_redirect_to_main
controller: Chill\ActivityBundle\Controller\AdminController::redirectToAdminIndexAction controller: Chill\ActivityBundle\Controller\AdminController::redirectToAdminIndexAction
options:
menus:
admin_activity:
order: 0
label: Main admin menu
chill_activity_type_admin: chill_activity_type_admin:
path: /{_locale}/admin/activity/type path: /{_locale}/admin/activity/type
controller: cscrud_activity_type_controller:index controller: cscrud_activity_type_controller:index
options:
menus:
admin_activity:
order: 2020
label: 'Activity Types'
chill_activity_type_category_admin: chill_activity_type_category_admin:
path: /{_locale}/admin/activity/type_category path: /{_locale}/admin/activity/type_category
controller: cscrud_activity_type_category_controller:index controller: cscrud_activity_type_category_controller:index
options:
menus:
admin_activity:
order: 2999
label: 'Activity Types Categories'
chill_activity_presence_admin: chill_activity_presence_admin:
path: /{_locale}/admin/activity/presence path: /{_locale}/admin/activity/presence
controller: cscrud_activity_presence_controller:index controller: cscrud_activity_presence_controller:index
options:
menus:
admin_activity:
order: 2021
label: 'Activity Presences'

View File

@ -1,11 +1,6 @@
chill_activity_activityreason: chill_activity_activityreason:
path: /{_locale}/admin/activityreason/ path: /{_locale}/admin/activityreason/
controller: Chill\ActivityBundle\Controller\ActivityReasonController::indexAction controller: Chill\ActivityBundle\Controller\ActivityReasonController::indexAction
options:
menus:
admin_activity:
order: 2000
label: "Activity Reasons"
chill_activity_activityreason_show: chill_activity_activityreason_show:
path: /{_locale}/admin/activityreason/{id}/show path: /{_locale}/admin/activityreason/{id}/show

View File

@ -1,11 +1,6 @@
chill_activity_activityreasoncategory: chill_activity_activityreasoncategory:
path: /{_locale}/admin/activityreasoncategory/ path: /{_locale}/admin/activityreasoncategory/
controller: Chill\ActivityBundle\Controller\ActivityReasonCategoryController::indexAction controller: Chill\ActivityBundle\Controller\ActivityReasonCategoryController::indexAction
options:
menus:
admin_activity:
order: 2010
label: "Activity Reasons Category"
chill_activity_activityreasoncategory_show: chill_activity_activityreasoncategory_show:
path: /{_locale}/admin/activityreasoncategory/{id}/show path: /{_locale}/admin/activityreasoncategory/{id}/show

View File

@ -113,7 +113,7 @@ Activity type configuration: Configuration des categories d'activités
Activity Reasons: Sujets d'une activité Activity Reasons: Sujets d'une activité
Activity Reasons Category: Catégories de sujet d'activités Activity Reasons Category: Catégories de sujet d'activités
Activity Types Categories: Catégories des types d'activité Activity Types Categories: Catégories des types d'activité
Activity Presences: Presences des activités Activity Presences: Presences aux activités
# Crud # Crud
@ -124,6 +124,9 @@ crud:
activity_type_category: activity_type_category:
title_new: Nouvelle catégorie de type d'activité title_new: Nouvelle catégorie de type d'activité
title_edit: Edition d'une catégorie de type d'activité title_edit: Edition d'une catégorie de type d'activité
activity_presence:
title_new: Nouvelle Présence aux activités
title_edit: Edition d'une Présence aux activités
# activity reason admin # activity reason admin
ActivityReason list: Liste des sujets ActivityReason list: Liste des sujets
@ -145,6 +148,10 @@ ActivityReasonCategory: Catégorie de sujet d'activité
ActivityReasonCategory is active and will be proposed: La catégorie est active et sera proposée ActivityReasonCategory is active and will be proposed: La catégorie est active et sera proposée
ActivityReasonCategory is inactive and won't be proposed: La catégorie est inactive et ne sera pas proposée ActivityReasonCategory is inactive and won't be proposed: La catégorie est inactive et ne sera pas proposée
#activity presence admin
ActivityPresence list: Liste des Présences aux activités
Create a new activity presence: Créer une nouvelle "Présence aux activités"
# activity type type admin # activity type type admin
ActivityType list: Types d'activités ActivityType list: Types d'activités
Create a new activity type: Créer un nouveau type d'activité Create a new activity type: Créer un nouveau type d'activité

View File

@ -0,0 +1,29 @@
<?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\AsideActivityBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
/**
* Class AdminController.
*/
class AdminController extends AbstractController
{
/**
* @Route("/{_locale}/admin/aside-activity", name="chill_aside_activity_admin")
*/
public function indexAdminAction()
{
return $this->render('ChillAsideActivityBundle:Admin:index.html.twig');
}
}

View File

@ -14,8 +14,6 @@ namespace Chill\AsideActivityBundle\Menu;
use Knp\Menu\MenuItem; use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
use function in_array;
final class AdminMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface final class AdminMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface
{ {
private Security $security; private Security $security;
@ -32,27 +30,25 @@ final class AdminMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuild
return; return;
} }
if (in_array($menuId, ['admin_index', 'admin_section'], true)) {
$menu->addChild('Aside activities', [ $menu->addChild('Aside activities', [
'route' => 'chill_crud_aside_activity_category_index', 'route' => 'chill_aside_activity_admin',
]) ])
->setAttribute('class', 'list-group-item-header')
->setExtras([ ->setExtras([
'order' => 900, 'order' => 7000,
'explain' => 'Aside activity type configuration', 'explain' => 'Aside activity type configuration',
]); ]);
} else {
$menu $menu
->addChild('Aside activity categories', [ ->addChild('Aside activity categories', [
'route' => 'chill_crud_aside_activity_category_index', 'route' => 'chill_crud_aside_activity_category_index',
]) ])
->setExtras([ ->setExtras([
'order' => '50', 'order' => 7010,
]); ]);
} }
}
public static function getMenuIds(): array public static function getMenuIds(): array
{ {
return ['admin_index', 'admin_section', 'admin_aside_activity']; return ['admin_section', 'admin_aside_activity'];
} }
} }

View File

@ -1,7 +1,9 @@
{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %} {% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %}
{% block vertical_menu_content %} {% block vertical_menu_content %}
{{ chill_menu('admin_aside_activity') }} {{ chill_menu('admin_aside_activity', {
'layout': '@ChillMain/Admin/menu_admin_section.html.twig',
}) }}
{% endblock %} {% endblock %}
{% block layout_wvm_content %} {% block layout_wvm_content %}

View File

@ -1,10 +1,10 @@
{% extends "@ChillAsideActivity/Admin/layout_asideactivity.html.twig" %} {% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %} {% block title %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %} {% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% endblock %} {% endblock %}
{% block layout_wvm_content %} {% block admin_content %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %} {% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block content_form_actions_view %}{% endblock %} {% block content_form_actions_view %}{% endblock %}
{% block content_form_actions_save_and_show %}{% endblock %} {% block content_form_actions_save_and_show %}{% endblock %}

View File

@ -1,6 +1,9 @@
{% extends "@ChillAsideActivity/Admin/layout_asideactivity.html.twig" %} {% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block title %}{{ 'Aside Activity Type List'|trans }}{% endblock title %}
{% block admin_content %} {% block admin_content %}
<h1>{{ 'Aside Activity Type List'|trans }}</h1> <h1>{{ 'Aside Activity Type List'|trans }}</h1>
<table class="records_list table table-bordered border-dark"> <table class="records_list table table-bordered border-dark">
@ -36,7 +39,7 @@
</tbody> </tbody>
</table> </table>
<ul class="record_actions"> <ul class="record_actions sticky-form-buttons">
<li> <li>
<a href="{{ path('chill_crud_aside_activity_category_new') }}" class="btn btn-create"> <a href="{{ path('chill_crud_aside_activity_category_new') }}" class="btn btn-create">
{{ 'Create a new aside activity type'|trans }} {{ 'Create a new aside activity type'|trans }}

View File

@ -1,10 +1,10 @@
{% extends "@ChillAsideActivity/Admin/layout_asideactivity.html.twig" %} {% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %} {% block title %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %} {% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% endblock %} {% endblock %}
{% block layout_wvm_content %} {% block admin_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %} {% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %} {% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %} {% endembed %}

View File

@ -38,7 +38,7 @@ crud:
confirm_message_delete: Êtes-vous sûr de vouloir supprimer cette activité annexe? confirm_message_delete: Êtes-vous sûr de vouloir supprimer cette activité annexe?
aside_activity_category: aside_activity_category:
title_new: Nouvelle catégorie d'activité annexe title_new: Nouvelle catégorie d'activité annexe
title_edit: Edition d'une catégorie de type d'activité title_edit: Édition d'une catégorie de type d'activité
#forms #forms
Create a new aside activity type: Nouvelle categorie d'activité annexe Create a new aside activity type: Nouvelle categorie d'activité annexe
@ -165,3 +165,4 @@ Phonecall: "Appel téléphonique"
Aside activities: Activités annexes Aside activities: Activités annexes
Aside activity types: Types d'activités annexes Aside activity types: Types d'activités annexes
Aside activity type configuration: Configuration des categories d'activités annexes Aside activity type configuration: Configuration des categories d'activités annexes
Aside activity configuration: Configuration des activités annexes

View File

@ -0,0 +1,28 @@
<?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\CalendarBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
class AdminController extends AbstractController
{
/**
* Calendar admin.
*
* @Route("/{_locale}/admin/calendar", name="chill_calendar_admin_index")
*/
public function indexAdminAction()
{
return $this->render('ChillCalendarBundle:Admin:index.html.twig');
}
}

View File

@ -0,0 +1,26 @@
<?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\CalendarBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
use Chill\MainBundle\Pagination\PaginatorInterface;
use Symfony\Component\HttpFoundation\Request;
class CancelReasonController extends CRUDController
{
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
{
$query->addOrderBy('e.id', 'ASC');
return parent::orderQuery($action, $query, $request, $paginator);
}
}

View File

@ -47,6 +47,29 @@ class ChillCalendarExtension extends Extension implements PrependExtensionInterf
protected function prependCruds(ContainerBuilder $container) protected function prependCruds(ContainerBuilder $container)
{ {
$container->prependExtensionConfig('chill_main', [ $container->prependExtensionConfig('chill_main', [
'cruds' => [
[
'class' => \Chill\CalendarBundle\Entity\CancelReason::class,
'name' => 'calendar_cancel-reason',
'base_path' => '/admin/calendar/cancel-reason',
'form_class' => \Chill\CalendarBundle\Form\CancelReasonType::class,
'controller' => \Chill\CalendarBundle\Controller\CancelReasonController::class,
'actions' => [
'index' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillCalendar/CancelReason/index.html.twig',
],
'new' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillCalendar/CancelReason/new.html.twig',
],
'edit' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillCalendar/CancelReason/edit.html.twig',
],
],
],
],
'apis' => [ 'apis' => [
[ [
'controller' => \Chill\CalendarBundle\Controller\CalendarRangeAPIController::class, 'controller' => \Chill\CalendarBundle\Controller\CalendarRangeAPIController::class,

View File

@ -0,0 +1,39 @@
<?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\CalendarBundle\Form;
use Chill\CalendarBundle\Entity\CancelReason;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class CancelReasonType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', TranslatableStringFormType::class)
->add('active', CheckboxType::class, [
'required' => false,
])
->add('canceledBy', TextType::class);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver
->setDefault('class', CancelReason::class);
}
}

View File

@ -0,0 +1,54 @@
<?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\CalendarBundle\Menu;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
class AdminMenuBuilder implements LocalMenuBuilderInterface
{
/**
* @var AuthorizationCheckerInterface
*/
protected $authorizationChecker;
public function __construct(AuthorizationCheckerInterface $authorizationChecker)
{
$this->authorizationChecker = $authorizationChecker;
}
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{
if (!$this->authorizationChecker->isGranted('ROLE_ADMIN')) {
return;
}
$menu->addChild('Calendar', [
'route' => 'chill_calendar_admin_index',
])
->setAttribute('class', 'list-group-item-header')
->setExtras([
'order' => 6000,
'icons' => ['calendar'],
]);
$menu->addChild('Cancel reason', [
'route' => 'chill_crud_calendar_cancel-reason_index',
])->setExtras(['order' => 6010]);
}
public static function getMenuIds(): array
{
return ['admin_section', 'admin_calendar'];
}
}

View File

@ -0,0 +1,13 @@
{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %}
{% block vertical_menu_content %}
{{ chill_menu('admin_calendar', {
'layout': '@ChillMain/Admin/menu_admin_section.html.twig',
}) }}
{% endblock %}
{% block layout_wvm_content %}
{% block admin_content %}<!-- block content empty -->
<h1>{{ 'Calendar configuration' |trans }}</h1>
{% endblock %}
{% endblock %}

View File

@ -0,0 +1,11 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock admin_content %}

View File

@ -0,0 +1,43 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block table_entities_thead_tr %}
<th>{{ 'Id'|trans }}</th>
<th>{{ 'Name'|trans }}</th>
<th>{{ 'canceledBy'|trans }}</th>
<th>{{ 'active'|trans }}</th>
<th>&nbsp;</th>
{% endblock %}
{% block table_entities_tbody %}
{% for entity in entities %}
<tr>
<td>{{ entity.id }}</td>
<td>{{ entity.name|localize_translatable_string }}</td>
<td>{{ entity.canceledBy }}</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="{{ chill_path_add_return_path('chill_crud_calendar_cancel-reason_edit', { 'id': entity.id }) }}" class="btn btn-edit"></a>
</li>
</ul>
</td>
</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

@ -0,0 +1,12 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock admin_content %}

View File

@ -26,3 +26,14 @@ The calendar item has been successfully removed.: Le rendez-vous a été supprim
From the day: Du From the day: Du
to the day: au to the day: au
Transform to activity: Transformer en échange Transform to activity: Transformer en échange
canceledBy: supprimé par
Canceled by: supprimé par
Calendar configuration: Gestion des rendez-vous
crud:
calendar_cancel-reason:
index:
title: Liste des motifs d'annulation
add_new: Ajouter un nouveau
title_new: Nouveau motif d'annulation
title_edit: Modifier le motif d'annulation

View File

@ -34,6 +34,7 @@ class ChillCustomFieldsExtension extends Extension implements PrependExtensionIn
$loader->load('services/fixtures.yaml'); $loader->load('services/fixtures.yaml');
$loader->load('services/controller.yaml'); $loader->load('services/controller.yaml');
$loader->load('services/command.yaml'); $loader->load('services/command.yaml');
$loader->load('services/menu.yaml');
//add at least a blank array at 'customizable_entities' options //add at least a blank array at 'customizable_entities' options
//$customizable_entities = (isset($config['customizables_entities']) //$customizable_entities = (isset($config['customizables_entities'])

View File

@ -0,0 +1,58 @@
<?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\CustomFieldsBundle\Menu;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
class AdminMenuBuilder implements LocalMenuBuilderInterface
{
/**
* @var AuthorizationCheckerInterface
*/
protected $authorizationChecker;
public function __construct(AuthorizationCheckerInterface $authorizationChecker)
{
$this->authorizationChecker = $authorizationChecker;
}
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{
if (!$this->authorizationChecker->isGranted('ROLE_ADMIN')) {
return;
}
$menu->addChild('Custom fields', [
'route' => 'customfield_section',
])
->setAttribute('class', 'list-group-item-header')
->setExtras([
'order' => 4500,
'icons' => ['plus'],
]);
$menu->addChild('Custom fields group', [
'route' => 'customfield_section',
])->setExtras(['order' => 4510]);
$menu->addChild('Custom fields group', [
'route' => 'customfieldsgroup',
])->setExtras(['order' => 4520]);
}
public static function getMenuIds(): array
{
return ['admin_section', 'admin_custom_fields'];
}
}

View File

@ -1,26 +1,8 @@
{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %} {% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %}
{% block vertical_menu_content %} {% block vertical_menu_content %}
{{ chill_menu('admin_custom_fields', { {{ chill_menu('admin_custom_fields', {
'layout': '@ChillCustomFields/Admin/menu.html.twig', 'layout': '@ChillMain/Admin/menu_admin_section.html.twig',
}) }} }) }}
{% endblock %} {% endblock %}

View File

@ -1,20 +0,0 @@
{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillMain/Menu/verticalMenu.html.twig" %}
{% block v_menu_title %}{{ 'Custom fields configuration menu'|trans }}{% endblock %}

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
#} #}
{% extends "@ChillCustomFields/Admin/layout.html.twig" %} {% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block title %}{{ 'CustomField edit'|trans }}{% endblock title %} {% block title %}{{ 'CustomField edit'|trans }}{% endblock title %}

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
#} #}
{% extends "@ChillCustomFields/Admin/layout.html.twig" %} {% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block title %}{{ 'CustomField creation'|trans }}{% endblock title %} {% block title %}{{ 'CustomField creation'|trans }}{% endblock title %}

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
#} #}
{% extends "@ChillCustomFields/Admin/layout.html.twig" %} {% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block admin_content %} {% block admin_content %}
<h1>CustomField</h1> <h1>CustomField</h1>

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
#} #}
{% extends "@ChillCustomFields/Admin/layout.html.twig" %} {% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block title %}{{ 'CustomFieldsGroup edit'|trans }}{% endblock %} {% block title %}{{ 'CustomFieldsGroup edit'|trans }}{% endblock %}

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
#} #}
{% extends "@ChillCustomFields/Admin/layout.html.twig" %} {% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block title %}{{ 'CustomFieldsGroup list'|trans }}{% endblock %} {% block title %}{{ 'CustomFieldsGroup list'|trans }}{% endblock %}

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
#} #}
{% extends "@ChillCustomFields/Admin/layout.html.twig" %} {% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block admin_content %} {% block admin_content %}
<h1>{{ 'CustomFieldsGroup creation'|trans }}</h1> <h1>{{ 'CustomFieldsGroup creation'|trans }}</h1>

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
#} #}
{% extends "@ChillCustomFields/Admin/layout.html.twig" %} {% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block title %}{{ 'CustomFieldsGroup details'|trans }}{% endblock %} {% block title %}{{ 'CustomFieldsGroup details'|trans }}{% endblock %}

View File

@ -1,12 +1,6 @@
customfield_section: customfield_section:
path: /{_locale}/admin/customfield/ path: /{_locale}/admin/customfield/
defaults: { _controller: "ChillCustomFieldsBundle:Admin:index" } defaults: { _controller: "ChillCustomFieldsBundle:Admin:index" }
options:
menus:
admin_section:
order: 1000
label: "Custom fields configuration"
icons: ['asterisk']
customfield_new: customfield_new:
path: /{_locale}/admin/customfield/new path: /{_locale}/admin/customfield/new

View File

@ -1,11 +1,6 @@
customfieldsgroup: customfieldsgroup:
path: /{_locale}/admin/customfieldsgroup/ path: /{_locale}/admin/customfieldsgroup/
defaults: { _controller: "ChillCustomFieldsBundle:CustomFieldsGroup:index" } defaults: { _controller: "ChillCustomFieldsBundle:CustomFieldsGroup:index" }
options:
menus:
admin_custom_fields:
order: 1010
label: "CustomFields Groups"
customfieldsgroup_show: customfieldsgroup_show:
path: /{_locale}/admin/customfieldsgroup/{id}/show path: /{_locale}/admin/customfieldsgroup/{id}/show

View File

@ -0,0 +1,7 @@
services:
Chill\CustomFieldsBundle\Menu\:
autowire: true
autoconfigure: true
resource: '../../Menu/'
tags: ['chill.menu_builder']

View File

@ -37,16 +37,18 @@ CustomFields List: Liste des champs personnalisés
CustomFields Groups: Groupe de champs personnalisés CustomFields Groups: Groupe de champs personnalisés
#customfield administration #customfield administration
Custom fields: Champs personnalisés
CustomFields configuration: Gestion des champs personnalisés
CustomField edit: Modification d'un champ personnalisé CustomField edit: Modification d'un champ personnalisé
CustomField creation: Nouveau champ personnalisé CustomField creation: Nouveau champ personnalisé
General informations: Informations générales General informations: Informations générales
Options: Options Options: Options
Custom fields group: Groupe de champ personnalisé Custom fields group: Groupe de champs personnalisés
Ordering: Ordre d'apparition Ordering: Ordre d'apparition
Required field: Champs requis Required field: Champs requis
An answer is required: Une réponse est requise An answer is required: Une réponse est requise
Any answer is required: Aucune réponse n'est requise Any answer is required: Aucune réponse n'est requise
Back to the group: Retour au groupe de champs personnalisé Back to the group: Retour au groupe de champs personnalisés
Slug: Identifiant textuel Slug: Identifiant textuel
The custom field has been created: Le champ personnalisé est créé The custom field has been created: Le champ personnalisé est créé
The custom field form contains errors: Le formulaire contient des erreurs The custom field form contains errors: Le formulaire contient des erreurs

View File

@ -68,7 +68,7 @@ class AdminDocGeneratorTemplateController extends CRUDController
{ {
$this->denyAccessUnlessGranted('ROLE_ADMIN'); $this->denyAccessUnlessGranted('ROLE_ADMIN');
return $this->render('ChillDocGeneratorBundle:Admin/DocGeneratorTemplate:pick-context.html.twig', [ return $this->render('@ChillDocGenerator/DocGeneratorTemplate/pick-context.html.twig', [
'contexts' => $this->contextManager->getContexts(), 'contexts' => $this->contextManager->getContexts(),
]); ]);
} }

View File

@ -56,16 +56,16 @@ class ChillDocGeneratorExtension extends Extension implements PrependExtensionIn
'controller' => \Chill\DocGeneratorBundle\Controller\AdminDocGeneratorTemplateController::class, 'controller' => \Chill\DocGeneratorBundle\Controller\AdminDocGeneratorTemplateController::class,
'actions' => [ 'actions' => [
'index' => [ 'index' => [
'template' => '@ChillDocGenerator/Admin/DocGeneratorTemplate/index.html.twig', 'template' => '@ChillDocGenerator/DocGeneratorTemplate/index.html.twig',
'role' => 'ROLE_ADMIN', 'role' => 'ROLE_ADMIN',
], ],
'new' => [ 'new' => [
'role' => 'ROLE_ADMIN', 'role' => 'ROLE_ADMIN',
'template' => '@ChillDocGenerator/Admin/DocGeneratorTemplate/new.html.twig', 'template' => '@ChillDocGenerator/DocGeneratorTemplate/new.html.twig',
], ],
'edit' => [ 'edit' => [
'role' => 'ROLE_ADMIN', 'role' => 'ROLE_ADMIN',
'template' => '@ChillDocGenerator/Admin/DocGeneratorTemplate/edit.html.twig', 'template' => '@ChillDocGenerator/DocGeneratorTemplate/edit.html.twig',
], ],
], ],
], ],

View File

@ -16,8 +16,6 @@ use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface; use Symfony\Contracts\Translation\TranslatorInterface;
use function in_array;
class AdminMenuBuilder implements LocalMenuBuilderInterface class AdminMenuBuilder implements LocalMenuBuilderInterface
{ {
private Security $security; private Security $security;
@ -33,19 +31,17 @@ class AdminMenuBuilder implements LocalMenuBuilderInterface
public function buildMenu($menuId, MenuItem $menu, array $parameters) public function buildMenu($menuId, MenuItem $menu, array $parameters)
{ {
if ($this->security->isGranted('ROLE_ADMIN')) { if ($this->security->isGranted('ROLE_ADMIN')) {
if (in_array($menuId, ['admin_index', 'admin_section'], true)) {
$menu->addChild($this->translator->trans('docgen.Document generation'), [ $menu->addChild($this->translator->trans('docgen.Document generation'), [
'route' => 'chill_crud_docgen_template_index', 'route' => 'chill_crud_docgen_template_index',
])->setExtras([ ])->setExtras([
'order' => 350, 'order' => 4020,
'explain' => 'docgen.Manage templates and document generation', 'explain' => 'docgen.Manage templates and document generation',
]); ]);
} }
} }
}
public static function getMenuIds(): array public static function getMenuIds(): array
{ {
return ['admin_index', 'admin_section', 'docgen_admin']; return ['admin_section', 'admin_docstore'];
} }
} }

View File

@ -1,4 +0,0 @@
{% extends '@ChillPerson/Admin/layout.html.twig' %}
{% block vertical_menu_content %}
{% endblock %}

View File

@ -1,8 +1,8 @@
{% extends '@ChillDocGenerator/Admin/layout.html.twig' %} {% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title 'docgen.Edit template'|trans %} {% block title 'docgen.Edit template'|trans %}
{% block layout_wvm_content %} {% block admin_content %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %} {% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block crud_content_header %} {% block crud_content_header %}

View File

@ -1,6 +1,6 @@
{% extends '@ChillDocGenerator/Admin/layout.html.twig' %} {% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block layout_wvm_content %} {% block admin_content %}
{% embed '@ChillMain/CRUD/_index.html.twig' %} {% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block table_entities_thead_tr %} {% block table_entities_thead_tr %}
<th></th> <th></th>
@ -34,5 +34,11 @@
</tr> </tr>
{% endfor %} {% endfor %}
{% endblock %} {% 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 %} {% endembed %}
{% endblock %} {% endblock %}

View File

@ -1,8 +1,8 @@
{% extends '@ChillDocGenerator/Admin/layout.html.twig' %} {% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title 'docgen.New template'|trans %} {% block title 'docgen.New template'|trans %}
{% block layout_wvm_content %} {% block admin_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %} {% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block crud_content_header %} {% block crud_content_header %}

View File

@ -1,8 +1,8 @@
{% extends '@ChillDocGenerator/Admin/layout.html.twig' %} {% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title 'docgen.Pick template context'|trans %} {% block title 'docgen.Pick template context'|trans %}
{% block layout_wvm_content %} {% block admin_content %}
<div class="col-md-10 col-xxl"> <div class="col-md-10 col-xxl">
<h1>{{ block('title') }}</h1> <h1>{{ block('title') }}</h1>

View File

@ -8,7 +8,7 @@ docgen:
New template: Nouveau modèle New template: Nouveau modèle
Edit template: Modifier modèle Edit template: Modifier modèle
test generate: Tester la génération test generate: Tester la génération
With context: 'Avec le contexte :' With context %name%: 'Avec le contexte "%name%"'
crud: crud:
@ -18,3 +18,5 @@ crud:
add_new: Créer add_new: Créer
Show data instead of generating: Montrer les données au lieu de générer le document
Template file: Fichier modèle

View File

@ -102,10 +102,18 @@ class DocumentCategoryController extends AbstractController
public function new(Request $request): Response public function new(Request $request): Response
{ {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$nextId = $em
->createQuery(
'SELECT MAX(c.idInsideBundle) + 1 FROM ChillDocStoreBundle:DocumentCategory c'
)
->getSingleResult();
$documentCategory = new DocumentCategory( $documentCategory = new DocumentCategory(
ChillDocStoreBundle::class, ChillDocStoreBundle::class,
$em->getRepository(DocumentCategory::class)->nextIdInsideBundle() reset($nextId)
); );
$documentCategory $documentCategory
->setDocumentClass(PersonDocument::class); ->setDocumentClass(PersonDocument::class);
@ -120,8 +128,6 @@ class DocumentCategoryController extends AbstractController
return $this->redirectToRoute('document_category_index'); return $this->redirectToRoute('document_category_index');
} }
$documentCategory->setBundleId(ChillDocStoreBundle::class);
return $this->render('ChillDocStoreBundle:DocumentCategory:new.html.twig', [ return $this->render('ChillDocStoreBundle:DocumentCategory:new.html.twig', [
'document_category' => $documentCategory, 'document_category' => $documentCategory,
'form' => $form->createView(), 'form' => $form->createView(),

View File

@ -87,6 +87,13 @@ class DocumentCategory
return $this->name; return $this->name;
} }
public function setBundleId($id): self
{
$this->bundleId = $id;
return $this;
}
public function setDocumentClass($documentClass): self public function setDocumentClass($documentClass): self
{ {
$this->documentClass = $documentClass; $this->documentClass = $documentClass;

View File

@ -37,13 +37,13 @@ class DocumentCategoryType extends AbstractType
$builder $builder
->add('bundleId', ChoiceType::class, [ ->add('bundleId', ChoiceType::class, [
'choices' => $this->chillBundlesFlipped, 'choices' => $this->chillBundlesFlipped,
'disabled' => true, 'disabled' => false,
]) ])
->add('idInsideBundle', null, [ ->add('idInsideBundle', null, [
'disabled' => true, 'disabled' => true,
]) ])
->add('documentClass', null, [ ->add('documentClass', null, [
'disabled' => true, 'disabled' => false,
]) // cahcerh par default PersonDocument ]) // cahcerh par default PersonDocument
->add('name', TranslatableStringFormType::class); ->add('name', TranslatableStringFormType::class);
} }

View File

@ -9,7 +9,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Chill\PersonBundle\Menu; namespace Chill\DocStoreBundle\Menu;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface; use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Knp\Menu\MenuItem; use Knp\Menu\MenuItem;
@ -33,16 +33,22 @@ class AdminMenuBuilder implements LocalMenuBuilderInterface
return; return;
} }
$menu->addChild('Person', [ $menu->addChild('Documents', [
'route' => 'chill_person_admin', 'route' => 'chill_docstore_admin',
]) ])
->setAttribute('class', 'list-group-item-header')
->setExtras([ ->setExtras([
'order' => 20, 'order' => 4000,
'icons' => ['file-pdf-o'],
]); ]);
$menu->addChild('Document category list', [
'route' => 'chill_docstore_category_admin',
])->setExtras(['order' => 4010]);
} }
public static function getMenuIds(): array public static function getMenuIds(): array
{ {
return ['admin_section']; return ['admin_section', 'admin_docstore'];
} }
} }

View File

@ -61,15 +61,4 @@ class DocumentCategoryRepository implements ObjectRepository
{ {
return DocumentCategory::class; return DocumentCategory::class;
} }
public function nextIdInsideBundle()
{
$array_res = $this->em
->createQuery(
'SELECT MAX(c.idInsideBundle) + 1 FROM ChillDocStoreBundle:DocumentCategory c'
)
->getSingleResult();
return reset($array_res);
}
} }

View File

@ -1,26 +1,8 @@
{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %} {% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %}
{% block vertical_menu_content %} {% block vertical_menu_content %}
{{ chill_menu('admin_docstore', { {{ chill_menu('admin_docstore', {
'layout': '@ChillDocStore/Admin/menu.html.twig', 'layout': '@ChillMain/Admin/menu_admin_section.html.twig',
}) }} }) }}
{% endblock %} {% endblock %}

View File

@ -1,21 +0,0 @@
{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillMain/Menu/verticalMenu.html.twig" %}
{% block v_menu_title %}{{ 'Documents configuration'|trans }}{% endblock %}

View File

@ -1,20 +1,4 @@
{# {% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
* Copyright (C) 2018, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "ChillDocStoreBundle:Admin:layout.html.twig" %}
{% block title %}{{ 'Document category edit'|trans }}{% endblock title %} {% block title %}{{ 'Document category edit'|trans }}{% endblock title %}
@ -27,7 +11,7 @@
{{ form_start(form) }} {{ form_start(form) }}
{{ form_widget(form) }} {{ form_widget(form) }}
<ul class="record_actions"> <ul class="record_actions sticky-form-buttons">
<li class="cancel"> <li class="cancel">
<a href="{{ path('document_category_index') }}" class="btn btn-cancel"> <a href="{{ path('document_category_index') }}" class="btn btn-cancel">
{{ 'Back to the category list' | trans }} {{ 'Back to the category list' | trans }}

View File

@ -1,20 +1,4 @@
{# {% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
* Copyright (C) 2018, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "ChillDocStoreBundle:Admin:layout.html.twig" %}
{% block title %}{{ 'Document category list' | trans }}{% endblock title %} {% block title %}{{ 'Document category list' | trans }}{% endblock title %}
@ -54,7 +38,7 @@
</tbody> </tbody>
</table> </table>
<ul class="record_actions"> <ul class="record_actions sticky-form-buttons">
<li> <li>
<a href="{{ path('document_category_new') }}" class="btn btn-create">{{ 'Create new category' | trans }}</a> <a href="{{ path('document_category_new') }}" class="btn btn-create">{{ 'Create new category' | trans }}</a>
</li> </li>

View File

@ -1,20 +1,4 @@
{# {% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
* Copyright (C) 2018, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "ChillDocStoreBundle:Admin:layout.html.twig" %}
{% block title %}{{ 'Create new document category' | trans }}{% endblock title %} {% block title %}{{ 'Create new document category' | trans }}{% endblock title %}
@ -27,14 +11,14 @@
{{ form_start(form) }} {{ form_start(form) }}
{{ form_widget(form) }} {{ form_widget(form) }}
<ul class="record_actions"> <ul class="record_actions sticky-form-buttons">
<li class="cancel"> <li class="cancel">
<a href="{{ path('document_category_index') }}" class="btn btn-cancel"> <a href="{{ path('document_category_index') }}" class="btn btn-cancel">
{{ 'Back to the category list' | trans }} {{ 'Back to the category list' | trans }}
</a> </a>
</li> </li>
<li> <li>
<button class="btn btn-new">{{ button_label|default('New')|trans }}</button> <button class="btn btn-new">{{ button_label|default('Create')|trans }}</button>
</li> </li>
</ul> </ul>
{{ form_end(form) }} {{ form_end(form) }}

View File

@ -1,20 +1,4 @@
{# {% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
* Copyright (C) 2018, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "ChillDocStoreBundle:Admin:layout.html.twig" %}
{% block title %}{{ 'Document category show'|trans }}{% endblock title %} {% block title %}{{ 'Document category show'|trans }}{% endblock title %}

View File

@ -25,8 +25,3 @@ chill_docstore_admin_redirect_to_admin_index:
chill_docstore_category_admin: chill_docstore_category_admin:
path: /{_locale}/admin/document/category path: /{_locale}/admin/document/category
controller: Chill\DocStoreBundle\Controller\DocumentCategoryController::indexAction controller: Chill\DocStoreBundle\Controller\DocumentCategoryController::indexAction
options:
menus:
admin_docstore:
order: 90
label: "Documents categories"

View File

@ -1,4 +1,6 @@
services: services:
Chill\DocStoreBundle\Menu\MenuBuilder: Chill\DocStoreBundle\Menu\:
autowire: true autowire: true
autoconfigure: true autoconfigure: true
resource: '../../Menu/'
tags: ['chill.menu_builder']

View File

@ -59,6 +59,7 @@ Document class: Classe de document
no records found: no records found:
Create new category: Créer une nouvelle catégorie Create new category: Créer une nouvelle catégorie
Back to the category list: Retour à la liste Back to the category list: Retour à la liste
Create new DocumentCategory: Créer une nouvelle catégorie de document
# WOPI EDIT # WOPI EDIT
online_edit_document: Éditer en ligne online_edit_document: Éditer en ligne

View File

@ -24,13 +24,27 @@ class AdminController extends AbstractController
return $this->render('@ChillMain/Admin/index.html.twig'); return $this->render('@ChillMain/Admin/index.html.twig');
} }
public function indexLocationsAction() /**
* @Route("/{_locale}/admin/language", name="chill_main_language_admin")
*/
public function indexLanguageAction()
{ {
return $this->render('@ChillMain/Admin/layout_location.html.twig'); return $this->render('@ChillMain/Admin/indexLanguage.html.twig');
} }
public function indexPermissionsAction() /**
* @Route("/{_locale}/admin/location", name="chill_main_location_admin")
*/
public function indexLocationAction()
{ {
return $this->render('@ChillMain/Admin/layout_permissions.html.twig'); return $this->render('@ChillMain/Admin/indexLocation.html.twig');
}
/**
* @Route("/{_locale}/admin/user", name="chill_main_user_admin")
*/
public function indexUserAction()
{
return $this->render('@ChillMain/Admin/indexUser.html.twig');
} }
} }

View File

@ -1,18 +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\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
class AdminCountryCRUDController extends CRUDController
{
}

View File

@ -36,7 +36,7 @@ class CenterController extends AbstractController
$em->persist($center); $em->persist($center);
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl('admin_center_show', ['id' => $center->getId()])); return $this->redirect($this->generateUrl('admin_center'));
} }
return $this->render('@ChillMain/Center/new.html.twig', [ return $this->render('@ChillMain/Center/new.html.twig', [

View File

@ -0,0 +1,26 @@
<?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\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
use Chill\MainBundle\Pagination\PaginatorInterface;
use Symfony\Component\HttpFoundation\Request;
class CivilityController extends CRUDController
{
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
{
$query->addOrderBy('e.order', 'ASC');
return parent::orderQuery($action, $query, $request, $paginator);
}
}

View File

@ -0,0 +1,26 @@
<?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\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
use Chill\MainBundle\Pagination\PaginatorInterface;
use Symfony\Component\HttpFoundation\Request;
class CountryController extends CRUDController
{
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
{
$query->addOrderBy('e.countryCode', 'ASC');
return parent::orderQuery($action, $query, $request, $paginator);
}
}

View File

@ -0,0 +1,26 @@
<?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\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
use Chill\MainBundle\Pagination\PaginatorInterface;
use Symfony\Component\HttpFoundation\Request;
class LanguageController extends CRUDController
{
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
{
$query->addOrderBy('e.id', 'ASC');
return parent::orderQuery($action, $query, $request, $paginator);
}
}

View File

@ -36,7 +36,7 @@ class ScopeController extends AbstractController
$em->persist($scope); $em->persist($scope);
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl('admin_scope_show', ['id' => $scope->getId()])); return $this->redirect($this->generateUrl('admin_scope'));
} }
return $this->render('@ChillMain/Scope/new.html.twig', [ return $this->render('@ChillMain/Scope/new.html.twig', [

View File

@ -19,6 +19,8 @@ use Chill\MainBundle\Form\UserCurrentLocationType;
use Chill\MainBundle\Form\UserPasswordType; use Chill\MainBundle\Form\UserPasswordType;
use Chill\MainBundle\Form\UserType; use Chill\MainBundle\Form\UserType;
use Chill\MainBundle\Pagination\PaginatorInterface; use Chill\MainBundle\Pagination\PaginatorInterface;
use Chill\MainBundle\Repository\UserRepository;
use Chill\MainBundle\Templating\Listing\FilterOrderHelper;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use RuntimeException; use RuntimeException;
use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\SubmitType;
@ -39,14 +41,18 @@ class UserController extends CRUDController
private UserPasswordEncoderInterface $passwordEncoder; private UserPasswordEncoderInterface $passwordEncoder;
private UserRepository $userRepository;
private ValidatorInterface $validator; private ValidatorInterface $validator;
public function __construct( public function __construct(
LoggerInterface $chillLogger, LoggerInterface $chillLogger,
ValidatorInterface $validator, ValidatorInterface $validator,
UserPasswordEncoderInterface $passwordEncoder UserPasswordEncoderInterface $passwordEncoder,
UserRepository $userRepository
) { ) {
$this->logger = $chillLogger; $this->logger = $chillLogger;
$this->userRepository = $userRepository;
$this->validator = $validator; $this->validator = $validator;
$this->passwordEncoder = $passwordEncoder; $this->passwordEncoder = $passwordEncoder;
} }
@ -215,6 +221,27 @@ class UserController extends CRUDController
]); ]);
} }
protected function buildFilterOrderHelper(string $action, Request $request): ?FilterOrderHelper
{
return $this->getFilterOrderHelperFactory()
->create(self::class)
->addSearchBox(['label'])
->build();
}
protected function countEntities(string $action, Request $request, ?FilterOrderHelper $filterOrder = null): int
{
if (!$filterOrder instanceof FilterOrderHelper) {
return parent::countEntities($action, $request, $filterOrder);
}
if (null === $filterOrder->getQueryString()) {
return parent::countEntities($action, $request, $filterOrder);
}
return $this->userRepository->countByUsernameOrEmail($filterOrder->getQueryString());
}
protected function createFormFor(string $action, $entity, ?string $formClass = null, array $formOptions = []): FormInterface protected function createFormFor(string $action, $entity, ?string $formClass = null, array $formOptions = []): FormInterface
{ {
// for "new", add special config // for "new", add special config
@ -250,6 +277,33 @@ class UserController extends CRUDController
return parent::generateTemplateParameter($action, $entity, $request, $defaultTemplateParameters); return parent::generateTemplateParameter($action, $entity, $request, $defaultTemplateParameters);
} }
protected function getQueryResult(
string $action,
Request $request,
int $totalItems,
PaginatorInterface $paginator,
?FilterOrderHelper $filterOrder = null
) {
if (0 === $totalItems) {
return [];
}
if (!$filterOrder instanceof FilterOrderHelper) {
return parent::getQueryResult($action, $request, $totalItems, $paginator, $filterOrder);
}
if (null === $filterOrder->getQueryString()) {
return parent::getQueryResult($action, $request, $totalItems, $paginator, $filterOrder);
}
return $this->userRepository->findByUsernameOrEmail(
$filterOrder->getQueryString(),
['usernameCanonical' => 'ASC'],
$paginator->getItemsPerPage(),
$paginator->getCurrentPageFirstItemNumber()
);
}
protected function onPrePersist(string $action, $entity, FormInterface $form, Request $request) protected function onPrePersist(string $action, $entity, FormInterface $form, Request $request)
{ {
// for "new", encode the password // for "new", encode the password
@ -264,7 +318,8 @@ class UserController extends CRUDController
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator) protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
{ {
$query->addOrderBy('e.usernameCanonical', 'ASC'); $query
->addOrderBy('e.usernameCanonical', 'ASC');
return parent::orderQuery($action, $query, $request, $paginator); return parent::orderQuery($action, $query, $request, $paginator);
} }

View File

@ -0,0 +1,26 @@
<?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\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
use Chill\MainBundle\Pagination\PaginatorInterface;
use Symfony\Component\HttpFoundation\Request;
class UserJobController extends CRUDController
{
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
{
$query->addOrderBy('e.id', 'ASC');
return parent::orderQuery($action, $query, $request, $paginator);
}
}

View File

@ -13,9 +13,13 @@ namespace Chill\MainBundle\DependencyInjection;
use Chill\MainBundle\Controller\AddressApiController; use Chill\MainBundle\Controller\AddressApiController;
use Chill\MainBundle\Controller\CivilityApiController; use Chill\MainBundle\Controller\CivilityApiController;
use Chill\MainBundle\Controller\CivilityController;
use Chill\MainBundle\Controller\CountryController;
use Chill\MainBundle\Controller\LanguageController;
use Chill\MainBundle\Controller\LocationController; use Chill\MainBundle\Controller\LocationController;
use Chill\MainBundle\Controller\LocationTypeController; use Chill\MainBundle\Controller\LocationTypeController;
use Chill\MainBundle\Controller\UserController; use Chill\MainBundle\Controller\UserController;
use Chill\MainBundle\Controller\UserJobController;
use Chill\MainBundle\DependencyInjection\Widget\Factory\WidgetFactoryInterface; use Chill\MainBundle\DependencyInjection\Widget\Factory\WidgetFactoryInterface;
use Chill\MainBundle\Doctrine\DQL\GetJsonFieldByKey; use Chill\MainBundle\Doctrine\DQL\GetJsonFieldByKey;
use Chill\MainBundle\Doctrine\DQL\JsonAggregate; use Chill\MainBundle\Doctrine\DQL\JsonAggregate;
@ -30,10 +34,16 @@ use Chill\MainBundle\Doctrine\DQL\Unaccent;
use Chill\MainBundle\Doctrine\ORM\Hydration\FlatHierarchyEntityHydrator; use Chill\MainBundle\Doctrine\ORM\Hydration\FlatHierarchyEntityHydrator;
use Chill\MainBundle\Doctrine\Type\NativeDateIntervalType; use Chill\MainBundle\Doctrine\Type\NativeDateIntervalType;
use Chill\MainBundle\Doctrine\Type\PointType; use Chill\MainBundle\Doctrine\Type\PointType;
use Chill\MainBundle\Entity\Civility;
use Chill\MainBundle\Entity\Country;
use Chill\MainBundle\Entity\Language;
use Chill\MainBundle\Entity\Location; use Chill\MainBundle\Entity\Location;
use Chill\MainBundle\Entity\LocationType; use Chill\MainBundle\Entity\LocationType;
use Chill\MainBundle\Entity\User; use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Entity\UserJob; use Chill\MainBundle\Entity\UserJob;
use Chill\MainBundle\Form\CivilityType;
use Chill\MainBundle\Form\CountryType;
use Chill\MainBundle\Form\LanguageType;
use Chill\MainBundle\Form\LocationFormType; use Chill\MainBundle\Form\LocationFormType;
use Chill\MainBundle\Form\LocationTypeType; use Chill\MainBundle\Form\LocationTypeType;
use Chill\MainBundle\Form\UserJobType; use Chill\MainBundle\Form\UserJobType;
@ -299,6 +309,7 @@ class ChillMainExtension extends Extension implements
'cruds' => [ 'cruds' => [
[ [
'class' => UserJob::class, 'class' => UserJob::class,
'controller' => UserJobController::class,
'name' => 'admin_user_job', 'name' => 'admin_user_job',
'base_path' => '/admin/main/user-job', 'base_path' => '/admin/main/user-job',
'base_role' => 'ROLE_ADMIN', 'base_role' => 'ROLE_ADMIN',
@ -310,9 +321,11 @@ class ChillMainExtension extends Extension implements
], ],
'new' => [ 'new' => [
'role' => 'ROLE_ADMIN', 'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/UserJob/new.html.twig',
], ],
'edit' => [ 'edit' => [
'role' => 'ROLE_ADMIN', 'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/UserJob/edit.html.twig',
], ],
], ],
], ],
@ -382,6 +395,72 @@ class ChillMainExtension extends Extension implements
], ],
], ],
], ],
[
'class' => Country::class,
'name' => 'main_country',
'base_path' => '/admin/main/country',
'base_role' => 'ROLE_ADMIN',
'form_class' => CountryType::class,
'controller' => CountryController::class,
'actions' => [
'index' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/Country/index.html.twig',
],
'new' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/Country/new.html.twig',
],
'edit' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/Country/edit.html.twig',
],
],
],
[
'class' => Civility::class,
'name' => 'main_civility',
'base_path' => '/admin/main/civility',
'base_role' => 'ROLE_ADMIN',
'form_class' => CivilityType::class,
'controller' => CivilityController::class,
'actions' => [
'index' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/Civility/index.html.twig',
],
'new' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/Civility/new.html.twig',
],
'edit' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/Civility/edit.html.twig',
],
],
],
[
'class' => Language::class,
'name' => 'main_language',
'base_path' => '/admin/main/language',
'base_role' => 'ROLE_ADMIN',
'form_class' => LanguageType::class,
'controller' => LanguageController::class,
'actions' => [
'index' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/Language/index.html.twig',
],
'new' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/Language/new.html.twig',
],
'edit' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/Language/edit.html.twig',
],
],
],
], ],
'apis' => [ 'apis' => [
[ [

View File

@ -0,0 +1,45 @@
<?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\Form;
use Chill\MainBundle\Entity\Civility;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class CivilityType extends \Symfony\Component\Form\AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name', TranslatableStringFormType::class, [
'required' => true,
])
->add('abbreviation', TranslatableStringFormType::class)
->add('active', ChoiceType::class, [
'choices' => [
'Active' => true,
'Inactive' => false,
],
])
->add('order', IntegerType::class);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Civility::class,
]);
}
}

View File

@ -0,0 +1,41 @@
<?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\Form;
use Chill\MainBundle\Entity\Country;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class CountryType extends \Symfony\Component\Form\AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name', TranslatableStringFormType::class, [
'label' => 'Name',
'required' => true,
])
->add('countryCode', TextType::class, [
'label' => 'Country code',
'required' => true,
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Country::class,
]);
}
}

View File

@ -0,0 +1,41 @@
<?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\Form;
use Chill\MainBundle\Entity\Language;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class LanguageType extends \Symfony\Component\Form\AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('id', TextType::class, [
'label' => 'Id',
'required' => true,
])
->add('name', TranslatableStringFormType::class, [
'label' => 'Name',
'required' => true,
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Language::class,
]);
}
}

View File

@ -83,10 +83,24 @@ final class UserRepository implements ObjectRepository
return $this->findBy(['enabled' => true], $orderBy, $limit, $offset); return $this->findBy(['enabled' => true], $orderBy, $limit, $offset);
} }
public function findByUsernameOrEmail(string $pattern) public function findByUsernameOrEmail(string $pattern, ?array $orderBy = [], ?int $limit = null, ?int $offset = null): array
{ {
$qb = $this->queryByUsernameOrEmail($pattern); $qb = $this->queryByUsernameOrEmail($pattern);
$qb->select('u');
if (null !== $limit) {
$qb->setMaxResults($limit);
}
if (null !== $offset) {
$qb->setFirstResult($offset);
}
foreach ($orderBy as $field => $order) {
$qb->addOrderBy('u.' . $field, $order);
}
return $qb->getQuery()->getResult(); return $qb->getQuery()->getResult();
} }
@ -164,13 +178,13 @@ final class UserRepository implements ObjectRepository
private function queryByUsernameOrEmail(string $pattern): QueryBuilder private function queryByUsernameOrEmail(string $pattern): QueryBuilder
{ {
$qb = $this->entityManager->createQueryBuilder('u'); $qb = $this->entityManager->createQueryBuilder()->from(User::class, 'u');
$searchByPattern = $qb->expr()->orX(); $searchByPattern = $qb->expr()->orX();
$searchByPattern $searchByPattern
->add($qb->expr()->eq('u.usernameCanonical', 'LOWER(UNACCENT(:pattern))')) ->add($qb->expr()->like('u.usernameCanonical', 'CONCAT(\'%\', LOWER(UNACCENT(:pattern)), \'%\')'))
->add($qb->expr()->eq('u.emailCanonical', 'LOWER(UNACCENT(:pattern))')); ->add($qb->expr()->like('u.emailCanonical', 'CONCAT(\'%\', LOWER(UNACCENT(:pattern)), \'%\')'));
$qb $qb
->where($searchByPattern) ->where($searchByPattern)

View File

@ -187,6 +187,10 @@ div.vertical-menu {
background-color: tint-color($chill-yellow, 20%) background-color: tint-color($chill-yellow, 20%)
} }
} }
a.list-group-item-header {
text-transform: uppercase;
font-weight: bold;
}
} }
footer.footer { footer.footer {
@ -210,6 +214,20 @@ footer.footer {
} }
} }
/*
* ADMIN STYLES
*/
div.admin {
flex-direction: row-reverse;
div.vertical-menu {
font-size: 0.9em;
.list-group-item {
padding: 0.3rem 0.7rem;
}
}
}
/* /*
* GENERIC MAIN STYLES * GENERIC MAIN STYLES
* miscellaneous * miscellaneous

View File

@ -1,8 +0,0 @@
{% extends '@ChillMain/Admin/layout_permissions.html.twig' %}
{% block title %}{{ ('crud.' ~ crud_name ~ '.index.title')|trans({'%crud_name%': crud_name}) }}{% endblock %}
{% block content %}
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% endembed %}
{% endblock content %}

View File

@ -1,15 +1,8 @@
{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %} {% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %}
{% block vertical_menu_content %}
{% endblock %}
{% block admin_content %} {% block admin_content %}
<h1>{{ 'Administration interface'|trans }}</h1> <h1>{{ 'Administration interface'|trans }}</h1>
<p>{{ 'Welcome to the admin section !'|trans }}</p> <p>{{ 'Welcome to the admin section !'|trans }}</p>
{{ chill_menu('admin_index', {
'layout': '@ChillMain/Admin/menu_admin_index.html.twig'
}) }}
{% endblock %} {% endblock %}

View File

@ -0,0 +1,13 @@
{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %}
{% block vertical_menu_content %}
{{ chill_menu('admin_language', {
'layout': '@ChillMain/Admin/menu_admin_section.html.twig',
}) }}
{% endblock %}
{% block layout_wvm_content %}
{% block admin_content %}<!-- block content empty -->
<h1>{{ 'Language configuration' |trans }}</h1>
{% endblock %}
{% endblock %}

Some files were not shown because too many files have changed in this diff Show More