admin: add AccompanyingPeriod Origin and closingMotive

This commit is contained in:
nobohan 2022-05-05 14:37:56 +02:00
parent 5daf09334b
commit 2fbdd169df
13 changed files with 202 additions and 94 deletions

View File

@ -16,10 +16,10 @@ use Chill\MainBundle\Pagination\PaginatorInterface;
use Symfony\Component\HttpFoundation\Request;
/**
* Class AdminClosingMotiveController
* Class ClosingMotiveController
* Controller for closing motives.
*/
class AdminClosingMotiveController extends CRUDController
class ClosingMotiveController extends CRUDController
{
/**
* @param \Chill\MainBundle\CRUD\Controller\string|string $action

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\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
use Chill\MainBundle\Pagination\PaginatorInterface;
use Symfony\Component\HttpFoundation\Request;
class OriginController 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

@ -146,13 +146,13 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
[
'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive::class,
'name' => 'closing_motive',
'base_path' => '/admin/closing-motive',
'base_path' => '/admin/person/closing-motive',
'form_class' => \Chill\PersonBundle\Form\ClosingMotiveType::class,
'controller' => \Chill\PersonBundle\Controller\AdminClosingMotiveController::class,
'controller' => \Chill\PersonBundle\Controller\ClosingMotiveController::class,
'actions' => [
'index' => [
'template' => '@ChillPerson/ClosingMotive/index.html.twig',
'role' => 'ROLE_ADMIN',
'template' => '@ChillPerson/ClosingMotive/index.html.twig',
],
'new' => [
'role' => 'ROLE_ADMIN',
@ -164,6 +164,27 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
],
],
],
[
'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\Origin::class,
'name' => 'origin',
'base_path' => '/admin/person/origin',
'form_class' => \Chill\PersonBundle\Form\OriginType::class,
'controller' => \Chill\PersonBundle\Controller\OriginController::class,
'actions' => [
'index' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillPerson/Origin/index.html.twig',
],
'new' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillPerson/Origin/new.html.twig',
],
'edit' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillPerson/Origin/edit.html.twig',
],
],
],
[
'class' => \Chill\PersonBundle\Entity\MaritalStatus::class,
'name' => 'person_marital-status',

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\PersonBundle\Form;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class OriginType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('label', TranslatableStringFormType::class)
->add('noActiveAfter', ChillDateType::class, [
'required' => false,
'input' => 'datetime_immutable',
'label' => 'origin.noActiveAfter'
]);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver
->setDefault('class', Origin::class);
}
}

View File

@ -45,29 +45,42 @@ class AdminMenuBuilder implements LocalMenuBuilderInterface
'route' => 'chill_crud_person_marital-status_index',
])->setExtras(['order' => 2020]);
$menu->addChild('person_admin.accompanying_period')
->setAttribute('class', 'list-group-item-header')
->setExtras(['order' => 2100, 'header' => true]);
$menu->addChild('person_admin.closing motives', [
'route' => 'chill_crud_closing_motive_index',
])->setExtras(['order' => 2110]);
$menu->addChild('person_admin.origin', [
'route' => 'chill_crud_origin_index',
])->setExtras(['order' => 2110]);
$menu->addChild('person_admin.social_work')
->setAttribute('class', 'list-group-item-header')
->setExtras(['order' => 3000, 'header' => true]);
->setExtras(['order' => 2200, 'header' => true]);
$menu->addChild('person_admin.social_action', [
'route' => 'chill_crud_social_action_index',
])->setExtras(['order' => 3001]);
])->setExtras(['order' => 2201]);
$menu->addChild('person_admin.social_issue', [
'route' => 'chill_crud_social_issue_index',
])->setExtras(['order' => 3002]);
])->setExtras(['order' => 2202]);
$menu->addChild('person_admin.social_goal', [
'route' => 'chill_crud_social_goal_index',
])->setExtras(['order' => 3010]);
])->setExtras(['order' => 2210]);
$menu->addChild('person_admin.social_evaluation', [
'route' => 'chill_crud_social_evaluation_index',
])->setExtras(['order' => 3020]);
])->setExtras(['order' => 2220]);
$menu->addChild('person_admin.social_result', [
'route' => 'chill_crud_social_result_index',
])->setExtras(['order' => 3030]);
])->setExtras(['order' => 2230]);
}
public static function getMenuIds(): array

View File

@ -1,12 +1,11 @@
{% extends '@ChillPerson/Admin/layout.html.twig' %}
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% endblock %}
{% block layout_wvm_content %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block content_form_actions_view %}{% endblock %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% 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

@ -1,6 +1,6 @@
{% extends '@ChillPerson/Admin/layout.html.twig' %}
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block layout_wvm_content %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block table_entities_thead_tr %}
<th>{{ 'Ordering'|trans }}</th>
@ -36,5 +36,11 @@
</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

@ -1,11 +1,12 @@
{% extends '@ChillPerson/Admin/layout.html.twig' %}
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% endblock %}
{% block layout_wvm_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% 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

@ -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,35 @@
{% 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>{{ 'Label'|trans }}</th>
<th>{{ 'origin.noActiveAfter'|trans }}</th>
<th>&nbsp;</th>
{% endblock %}
{% block table_entities_tbody %}
{% for entity in entities %}
<tr>
<td>{{ entity.id }}</td>
<td>{{ entity.label|localize_translatable_string }}</td>
<td>{% if entity.noActiveAfter %}{{ entity.noActiveAfter|date('Y-m-d') }}{% endif %}</td>
<td>
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_crud_origin_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

@ -125,72 +125,6 @@ chill_person_admin_redirect_to_admin_index:
order: 0
label: Main admin menu
chill_person_closingmotive_admin:
path: /{_locale}/admin/closing-motive
controller: cscrud_closing_motive_controller:index
options:
menus:
admin_person:
order: 90
label: 'person_admin.closing motives'
chill_person_maritalstatus_admin:
path: /{_locale}/admin/marital-status
controller: cscrud_marital_status_controller:index
options:
menus:
admin_person:
order: 120
label: 'person_admin.marital status'
chill_person_socialissue_admin:
path: /{_locale}/admin/social-work/social-issue
controller: cscrud_social_issue_controller:index
options:
menus:
admin_person:
order: 150
label: 'person_admin.social_issue'
chill_person_socialaction_admin:
path: /{_locale}/admin/social-work/social-action
controller: cscrud_social_action_controller:index
options:
menus:
admin_person:
order: 160
label: 'person_admin.social_action'
chill_person_social_evaluation_admin:
path: /{_locale}/admin/social-work/evaluation
controller: cscrud_social_evaluation_controller:index
options:
menus:
admin_person:
order: 170
label: 'person_admin.social_evaluation'
chill_person_social_goal_admin:
path: /{_locale}/admin/social-work/goal
controller: cscrud_social_goal_controller:index
options:
menus:
admin_person:
order: 180
label: 'person_admin.social_goal'
chill_person_social_result_admin:
path: /{_locale}/admin/social-work/result
controller: cscrud_social_result_controller:index
options:
menus:
admin_person:
order: 190
label: 'person_admin.social_result'
chill_person_controllers:
resource: "@ChillPersonBundle/Controller"
type: annotation

View File

@ -372,6 +372,12 @@ crud:
add_new: Ajouter un nouveau
title_new: Nouveau motif de clotûre
title_edit: Modifier le motif de clotûre
origin:
index:
title: Liste des origines de parcours
add_new: Ajouter une nouvelle
title_new: Nouvelle origine
title_edit: Modifier l'origine
person_marital-status:
index:
title: Liste des états civils
@ -410,6 +416,9 @@ crud:
title_new: Nouveau résultat
title_edit: Modifier le résultat
origin:
noActiveAfter: désactivé après
evaluation:
delay: Délai
notificationDelay: Délai de notification
@ -428,12 +437,14 @@ closing_motive:
Configuration of person bundle: Configuration du module "Personnes"
person_admin:
accompanying_period: Parcours d'accompagnement
What would you like to configure ?: Que souhaitez-vous configurer ?
closing motives: Motifs de clotûre
closing motives list: Liste des motifs de clotûre
closing motive explanation: >
Les motifs de clotûre donnent des indications sur la fermeture
d'une période d'accompagnement.
origin: Origines
marital status: États civils
marital status list: Liste des états civils
marital status explanation: >