mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
admin: refine social work admin form
This commit is contained in:
parent
b7ed658f96
commit
f449dcbda1
@ -19,8 +19,11 @@ 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\Templating\Listing\FilterOrderHelper;
|
||||||
|
use Chill\MainBundle\Templating\Listing\FilterOrderHelperFactoryInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
|
use LogicException;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
use Symfony\Component\Form\Form;
|
use Symfony\Component\Form\Form;
|
||||||
use Symfony\Component\Form\FormInterface;
|
use Symfony\Component\Form\FormInterface;
|
||||||
@ -41,14 +44,57 @@ class UserController extends CRUDController
|
|||||||
|
|
||||||
private ValidatorInterface $validator;
|
private ValidatorInterface $validator;
|
||||||
|
|
||||||
|
private FilterOrderHelperFactoryInterface $filterOrderHelperFactory;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
LoggerInterface $chillLogger,
|
LoggerInterface $chillLogger,
|
||||||
ValidatorInterface $validator,
|
ValidatorInterface $validator,
|
||||||
UserPasswordEncoderInterface $passwordEncoder
|
UserPasswordEncoderInterface $passwordEncoder,
|
||||||
|
FilterOrderHelperFactoryInterface $filterOrderHelperFactory
|
||||||
) {
|
) {
|
||||||
$this->logger = $chillLogger;
|
$this->logger = $chillLogger;
|
||||||
$this->validator = $validator;
|
$this->validator = $validator;
|
||||||
$this->passwordEncoder = $passwordEncoder;
|
$this->passwordEncoder = $passwordEncoder;
|
||||||
|
$this->filterOrderHelperFactory = $filterOrderHelperFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// public function index(Request $request)
|
||||||
|
// {
|
||||||
|
// dump($request);
|
||||||
|
|
||||||
|
// //$filterOrder = $this->buildFilterOrderHelper('index', $request);
|
||||||
|
// return parent::indexEntityAction('index', $request);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// protected function buildFilterOrderHelper($action, $request): FilterOrderHelper
|
||||||
|
// {
|
||||||
|
// $filter_order = $this->filterOrderHelperFactory
|
||||||
|
// ->create(self::class)
|
||||||
|
// ->addSearchBox(['name'])
|
||||||
|
// ->build();
|
||||||
|
// dump($filter_order);
|
||||||
|
// return $filter_order;
|
||||||
|
// }
|
||||||
|
|
||||||
|
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 (null === $filterOrder) {
|
||||||
|
throw new LogicException('filterOrder should not be null');
|
||||||
|
}
|
||||||
|
dump($filterOrder);
|
||||||
|
$count = parent::countEntities($action, $request, $filterOrder);
|
||||||
|
|
||||||
|
dump($count);
|
||||||
|
return $count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
{% block admin_content %}
|
{% block admin_content %}
|
||||||
|
|
||||||
<h1>{{"Users"|trans}}</h1>
|
<h1>{{"Users"|trans}}</h1>
|
||||||
|
|
||||||
|
{{ filter_order|chill_render_filter_order_helper }}
|
||||||
|
|
||||||
{% for entity in entities %}
|
{% for entity in entities %}
|
||||||
<div class="flex-table">
|
<div class="flex-table">
|
||||||
<div class="item-bloc">
|
<div class="item-bloc">
|
||||||
|
@ -286,7 +286,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
|||||||
],
|
],
|
||||||
'edit' => [
|
'edit' => [
|
||||||
'role' => 'ROLE_ADMIN',
|
'role' => 'ROLE_ADMIN',
|
||||||
'template' => '@ChillPerson/SocialWork/edit.html.twig',
|
'template' => '@ChillPerson/SocialWork/SocialIssue/edit.html.twig',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@ -307,7 +307,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
|||||||
],
|
],
|
||||||
'edit' => [
|
'edit' => [
|
||||||
'role' => 'ROLE_ADMIN',
|
'role' => 'ROLE_ADMIN',
|
||||||
'template' => '@ChillPerson/SocialWork/edit.html.twig',
|
'template' => '@ChillPerson/SocialWork/SocialAction/edit.html.twig',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
{% block table_entities_thead_tr %}
|
{% block table_entities_thead_tr %}
|
||||||
<th>{{ 'Id'|trans }}</th>
|
<th>{{ 'Id'|trans }}</th>
|
||||||
<th>{{ 'Title'|trans }}</th>
|
<th>{{ 'Title'|trans }}</th>
|
||||||
|
<th>{{ 'evaluation.delay'|trans }}</th>
|
||||||
|
<th>{{ 'evaluation.notificationDelay'|trans }}</th>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
@ -13,6 +15,32 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{{ entity.id }}</td>
|
<td>{{ entity.id }}</td>
|
||||||
<td>{{ entity.title|localize_translatable_string }}</td>
|
<td>{{ entity.title|localize_translatable_string }}</td>
|
||||||
|
<td>
|
||||||
|
{% if entity.delay is not null %}
|
||||||
|
{% if entity.delay.d > 0 %}
|
||||||
|
{{ entity.delay.d }} {{'days'|trans}}
|
||||||
|
{% endif %}
|
||||||
|
{% if entity.delay.m > 0 %}
|
||||||
|
{{ entity.delay.m }} {{'months'|trans}}
|
||||||
|
{% endif %}
|
||||||
|
{% if entity.delay.y > 0 %}
|
||||||
|
{{ entity.delay.y }} {{'years'|trans}}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% if entity.notificationDelay is not null %}
|
||||||
|
{% if entity.notificationDelay.d > 0 %}
|
||||||
|
{{ entity.notificationDelay.d }} {{'days'|trans}}
|
||||||
|
{% endif %}
|
||||||
|
{% if entity.notificationDelay.m > 0 %}
|
||||||
|
{{ entity.notificationDelay.m }} {{'months'|trans}}
|
||||||
|
{% endif %}
|
||||||
|
{% if entity.notificationDelay.y > 0 %}
|
||||||
|
{{ entity.notificationDelay.y }} {{'years'|trans}}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
{% block table_entities_thead_tr %}
|
{% block table_entities_thead_tr %}
|
||||||
<th>{{ 'Id'|trans }}</th>
|
<th>{{ 'Id'|trans }}</th>
|
||||||
<th>{{ 'Title'|trans }}</th>
|
<th>{{ 'Title'|trans }}</th>
|
||||||
|
<th>{{ 'Social actions'|trans }}</th>
|
||||||
|
<th>{{ 'goal.desactivationDate'|trans }}</th>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
@ -13,6 +15,16 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{{ entity.id }}</td>
|
<td>{{ entity.id }}</td>
|
||||||
<td>{{ entity.title|localize_translatable_string }}</td>
|
<td>{{ entity.title|localize_translatable_string }}</td>
|
||||||
|
<td>
|
||||||
|
{% for sa in entity.socialActions %}
|
||||||
|
{{ sa.title|localize_translatable_string }}{% if not loop.last %},{% else %}.{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% if entity.desactivationDate is not null %}
|
||||||
|
{{ entity.desactivationDate|date('Y-m-d') }}
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
{% 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 crud_content_form_rows %}
|
||||||
|
{% for f in form %}
|
||||||
|
{% if f.vars.name == 'parent' %}
|
||||||
|
{{ form_row(f, { 'attr':{'disabled':'disabled'}}) }}
|
||||||
|
{% else %}
|
||||||
|
{{ form_row(f) }}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endblock crud_content_form_rows %}
|
||||||
|
|
||||||
|
{% block content_form_actions_save_and_show %}{% endblock %}
|
||||||
|
{% endembed %}
|
||||||
|
{% endblock admin_content %}
|
@ -5,6 +5,9 @@
|
|||||||
{% block table_entities_thead_tr %}
|
{% block table_entities_thead_tr %}
|
||||||
<th>{{ 'Id'|trans }}</th>
|
<th>{{ 'Id'|trans }}</th>
|
||||||
<th>{{ 'Title'|trans }}</th>
|
<th>{{ 'Title'|trans }}</th>
|
||||||
|
<th>{{ 'Parent'|trans }}</th>
|
||||||
|
<th>{{ 'goal.desactivationDate'|trans }}</th>
|
||||||
|
<th>{{ 'socialAction.defaultNotificationDelay'|trans }}</th>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
@ -13,6 +16,29 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{{ entity.id }}</td>
|
<td>{{ entity.id }}</td>
|
||||||
<td>{{ entity.title|localize_translatable_string }}</td>
|
<td>{{ entity.title|localize_translatable_string }}</td>
|
||||||
|
<td>
|
||||||
|
{% if entity.parent is not null %}
|
||||||
|
{{ entity.parent.title|localize_translatable_string }}
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% if entity.desactivationDate is not null %}
|
||||||
|
{{ entity.desactivationDate|date('Y-m-d') }}
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% if entity.defaultNotificationDelay is not null %}
|
||||||
|
{% if entity.defaultNotificationDelay.d > 0 %}
|
||||||
|
{{ entity.defaultNotificationDelay.d }} {{'days'|trans}}
|
||||||
|
{% endif %}
|
||||||
|
{% if entity.defaultNotificationDelay.m > 0 %}
|
||||||
|
{{ entity.defaultNotificationDelay.m }} {{'months'|trans}}
|
||||||
|
{% endif %}
|
||||||
|
{% if entity.defaultNotificationDelay.y > 0 %}
|
||||||
|
{{ entity.defaultNotificationDelay.y }} {{'years'|trans}}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
{% 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 crud_content_form_rows %}
|
||||||
|
{% for f in form %}
|
||||||
|
{% if f.vars.name == 'parent' %}
|
||||||
|
{{ form_row(f, { 'attr':{'disabled':'disabled'}}) }}
|
||||||
|
{% else %}
|
||||||
|
{{ form_row(f) }}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endblock crud_content_form_rows %}
|
||||||
|
|
||||||
|
{% block content_form_actions_save_and_show %}{% endblock %}
|
||||||
|
{% endembed %}
|
||||||
|
{% endblock admin_content %}
|
@ -5,6 +5,8 @@
|
|||||||
{% block table_entities_thead_tr %}
|
{% block table_entities_thead_tr %}
|
||||||
<th>{{ 'Id'|trans }}</th>
|
<th>{{ 'Id'|trans }}</th>
|
||||||
<th>{{ 'Title'|trans }}</th>
|
<th>{{ 'Title'|trans }}</th>
|
||||||
|
<th>{{ 'Parent'|trans }}</th>
|
||||||
|
<th>{{ 'goal.desactivationDate'|trans }}</th>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
@ -13,6 +15,16 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{{ entity.id }}</td>
|
<td>{{ entity.id }}</td>
|
||||||
<td>{{ entity.title|localize_translatable_string }}</td>
|
<td>{{ entity.title|localize_translatable_string }}</td>
|
||||||
|
<td>
|
||||||
|
{% if entity.parent is not null %}
|
||||||
|
{{ entity.parent.title|localize_translatable_string }}
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% if entity.desactivationDate is not null %}
|
||||||
|
{{ entity.desactivationDate|date('Y-m-d') }}
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
|
@ -456,6 +456,10 @@ relation:
|
|||||||
title: Premier membre
|
title: Premier membre
|
||||||
reverseTitle: Deuxième membre
|
reverseTitle: Deuxième membre
|
||||||
|
|
||||||
|
days: jours
|
||||||
|
months: mois
|
||||||
|
years: années
|
||||||
|
|
||||||
# specific to closing motive
|
# specific to closing motive
|
||||||
closing_motive:
|
closing_motive:
|
||||||
any parent: Aucun parent
|
any parent: Aucun parent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user